Compare commits

..

1881 Commits

Author SHA1 Message Date
080cf9332b Merge branch 'gooseberry' into temp_motionpaths
Conflicts:
	source/blender/blenkernel/intern/object.c
2015-06-10 18:38:23 +02:00
9676642cc9 Super hacky hack (not for master for sure) to stop blender for crashing
with scene audio recursion in mattieu's gooseberry edit in sequencer.

Will probably cause something else to explode but let's just guard
against this in the audio lib for now.
2015-06-10 18:20:15 +02:00
09df0f0b77 Sequencer:
Add option to ommit strip name and info display.
2015-06-10 14:06:13 +02:00
d48e165edd Gooseberry: Use more proper flag for psys reconstruction after memory optimization 2015-06-09 19:04:53 +02:00
e73e5c9930 Gooseberry: Fix for flickering grass
The issue was caused by memory optimization marking particle system to recalc,
and because of the way how particle flags works it was possible that it'll
cause particle's re-distribution. Now this memory optimization will act the
same as loading the file.

Would need to review if this fix is to go to master/cycles_memory branches
but for now it'll be cool to figure out what to do with the farm.
2015-06-09 18:56:43 +02:00
313c958f43 More cosmetic stuff for the play button
Draw outer ring with quad strip instead of line
(line width would vary across the ring)
2015-06-09 18:15:32 +02:00
58f75e903a Small cheat for attract tool:
Draw overdrop on top of post-draw call back.
2015-06-09 16:38:48 +02:00
23d0af5031 Particles: Avoid bad memory access when calculating child weight
Not sure it's totally correct solution, but it's better than giving
unpredictable results.
2015-06-09 14:50:28 +02:00
ab742d302e Center the play gisom triangle more correctly. 2015-06-09 14:37:50 +02:00
a7a87e4ade Reset frame when stopping playing. 2015-06-09 14:07:29 +02:00
010e2a2b36 Add play gismos to collapsed image sequences. When clicking repeatedly
on the sequence they are toggled between play-pause.
2015-06-09 13:51:54 +02:00
a4ee50f52e Disable file collapse when user cancels after an operator.
Now file open operator also sets a temporary flag for collapse. This
allows the user to configure the option to always collapse files and the
editor will remember the setting and not reset it back after finishing a
collapsed file open.
2015-06-09 12:29:16 +02:00
dd346c5591 Never collapse directories 2015-06-08 18:47:54 +02:00
c5fc9ebfcb Animation support for collapsed image sequences.
Selected animation sequences will play back their thumbnails now.

We'll probably need a way to scrub here, will investigate that next.
2015-06-08 16:55:51 +02:00
dbb3e8da3e Gooseberry: Previous commit broke compilation of debug builds 2015-06-08 16:31:07 +02:00
f3a434c321 Merge branch 'cycles_memory_experiments' into gooseberry
Conflicts:
	intern/cycles/blender/blender_object.cpp
	intern/cycles/blender/blender_sync.h
2015-06-08 16:10:34 +02:00
77e18b8122 Gooseberry: Fix compilation error with strict compiler flags 2015-06-08 16:06:06 +02:00
ed20f7bfb0 Yet another weekly issue squashed, player did not display indicator with
image sequences.

Simple matter of storing the frame for image sequences too.
2015-06-08 16:03:43 +02:00
566f3cfb0b Sort files in collapsed sequences by frame number.
Now getting an "animation" preview should be pretty easy.
2015-06-08 15:51:44 +02:00
afe8eb3b59 Cycles: Merge density and color volume attributes if they both requested
This way we store quite reasonable amount of memory (density is stored as RGBA
textures, which ends up in gigabytes of RAM for hires smoke sims).

It's not really pretty implementation and we'll really need to support textures
with 1 and 3 channels instead of doing such packing, but we need to be able to
render some files here.
2015-06-08 15:48:11 +02:00
2485aa340b Merge branch 'fcurves-simplify' into gooseberry 2015-06-08 15:41:36 +02:00
b3259d51b4 Cycles: Free hires smoke data from blender side after scene was fully synchronized
This happens if all object's smokes are backed to files and rendering is either
happening from command line of with locked interface.

The idea behind this change is to make as much memory available for path tracing
as possible, so after heavy swapping during synchronization period there's loads
of free memory to put important data back to RAM.
2015-06-08 15:34:07 +02:00
7fe46cdecb Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/key.c
	source/blender/blenlib/intern/path_util.c
	source/blender/editors/object/object_shapekey.c
2015-06-08 15:28:25 +02:00
1ecfffeced Initial fcurve simplification code.
Notes:
* This is own coocking, since it seems hard to find papers on simplifying already existing bezier curves,
  and we do not really need the 'generic' least-square fitting of bezier in a set of points, here.
* It takes advantage of specificities of FCurves (e.g. only difference that matters here is Y value at same X frame,
  no vertical overlapping, etc.).
* It gives reasonably good results, but could most likely be enhanced quite a bit still.
* Only 'hooked' to bake action operator right now (needs more work to add it to graph editor too).
* Ultimately should probably be redone in C. Would keep it in Python until we have a real good
  cleanup behavior though, much easier to experiment in later language.
2015-06-08 15:09:07 +02:00
c5ea1d47e8 Clear previous collapsed data if needed. 2015-06-08 14:40:53 +02:00
a5f6fcde2e Refactor: move all collapsed image variables into a struct. 2015-06-08 14:34:10 +02:00
f1cd1e6503 Merge branch 'master' into cycles_memory_experiments
Conflicts:
	intern/cycles/blender/blender_object.cpp
	intern/cycles/blender/blender_sync.h
	intern/cycles/render/graph.h
	intern/cycles/render/mesh.cpp
2015-06-08 14:20:07 +02:00
309c66d4c3 Fix issue with collapsed images during last weekly.
We need to clear the collapsed flag when it does not apply anymore, so
files get displayed properly.
2015-06-08 12:54:32 +02:00
ae0612c2ac Do not show fps while scrubbing. 2015-06-05 16:47:01 +02:00
6ac3ebc052 Do not store frame change in undo stack (causes much waiting for
animators in heavy scenes)
2015-06-05 16:31:40 +02:00
06058c5feb Merge branch 'master' into gooseberry 2015-06-05 15:28:29 +02:00
3a3317ff39 Indicator for the player (togglable with I key).
Draws a green line where the current frame is in the movie.
2015-06-05 14:45:26 +02:00
12a77b7ac7 Collapsed images:
* Icon of collapsed images is same as a movie
* Size displayed is cummulative size of all images
* Frame range is displayed in the filename
2015-06-05 14:01:40 +02:00
7575ecadff Merge branch 'alembic' into gooseberry 2015-06-05 13:02:34 +02:00
f19f6da7c2 Fix outdated stub factory class for pointcache when Alembic is disabled. 2015-06-05 13:01:07 +02:00
7592e5dbf5 Disable collapse images option after operator ends. 2015-06-05 11:26:25 +02:00
a2a970cbdd Collapse image sequence feature now uses BLI_path_* functions to detect
filenames.
2015-06-04 21:15:54 +02:00
62e8708232 Fix stupid recent mistake 2015-06-04 20:55:30 +02:00
4f64596916 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/makesdna/DNA_object_types.h
2015-06-04 20:51:17 +02:00
fa147804b8 Make clamping able to return to exact previous values. 2015-06-04 17:51:21 +02:00
468c96c0fa Load image sequence collapsing for sequencer
Very dirty feature that will have to be reimplemented when the new asset engine makes it into blender.

This commit tweaks the filebrowser to detect sequences of images that form parts of a movie. The
files need to be in the format <number>filelame.ext or <number>.filename.ext

There is a new option next to hidden file option that makes it so this collapsing takes place.

When collapsing is on, any movie files that have the same filename will be collapsed to the first
detected file in the sequence. Selecting that file will select all files in the sequence.

There is a shortcut in the sequence editor in the Add menu, "Image Sequence" that enables collapsing
by default. Unfortunately, selecting multiple movies will not add multiple sequences to the sequencer,
at least for now, but it should make it quite easier for people to quickly select the whole range of
images for a movie. Importing the image sequence into the sequencer will use placeholders, so any missing images
will display as black.
2015-06-04 12:47:25 +02:00
343c4fb54a Merge branch 'master' into gooseberry
Conflicts:
	intern/cycles/kernel/svm/svm.h
2015-06-04 12:05:11 +02:00
44276743cf Merge branch 'alembic' into gooseberry 2015-06-03 12:11:15 +02:00
d392367782 Only use string properties from the cachelib for metadata.
Using ints and floats would require prefixing the Alembic metadata
keys, which becomes messy and ambiguous. Encoding other data types as
strings can be done on the python side as well.
2015-06-03 10:54:14 +02:00
7dee53c6df Have to use IDP_ReplaceInGroup to overwrite ID properties that already
exist.
2015-06-03 10:44:48 +02:00
65a73d62d8 Python UI fix for displaying int and float properties as labels. 2015-06-02 18:29:51 +02:00
222ff8f4b7 Added missing break statements. 2015-06-02 18:29:30 +02:00
7e17e0189c Display extra metadata for the cache input archive. 2015-06-02 18:17:51 +02:00
3019eff71e Use ID property groups for storing and loading metadata associated to
Alembic archives.

Two separate property groups for metadata are used (so that reading
caches does not overwrite metadata for output caches).
2015-06-02 17:59:47 +02:00
08667e616f Merge branch 'alembic' into gooseberry 2015-06-02 15:27:18 +02:00
1ae3ffb6c9 Write metadata to caches (application name, date of creation, user
description).

Cache library output archives now have a description string next to them
that gets written into the archive.
2015-06-02 15:25:13 +02:00
33d6e6ed42 Display basic metadata of a cache archive in the cache library input
settings.
2015-06-02 13:05:11 +02:00
f9ec2e706e Silence compiler errors by returning a default value for vector
interpolation.
2015-06-02 12:29:37 +02:00
9e140a2c39 Support for an optional semantics argument when interpolating cached
properties.

This is necessary to distinguish e.g. vector semantics (linear vs. slerp
interpolation for positional/normal vectors). It would be simpler to
do this based purely on types, but the typing of common Alembic
properties is not sufficiently unique. Semantics arguments are enum
values, that can be omitted if the default interpolation should be used.
2015-06-01 19:14:34 +02:00
e499f9d900 Interpolation code for reading Alembic cache samples on subframes.
This features is needed for motion blur. All properties with position
semantics (transform matrices, mesh and curve vertex locations, etc.)
need to be interpolated for fractions of full frames, in order to
reproduce the motion and deformation correctly.

Alternatively we could store subframe time sampling for this subset of
properties. However, this would increase the amount of data stored,
and it might actually show artifacts from subframe interpolation in
Blender which is not visible to animators otherwise and should be
ignored.
2015-05-30 15:57:19 +02:00
6d6db87ae7 Make use of the subframe value in Scene when reading from cache archives.
Subframes are necessary when interpolating values.
2015-05-30 13:28:21 +02:00
179acf028c Use the Alembic generic chrono_t type internally for reading from
archives, instead of Blender frame values.

This is easier to use for interpolation, the frame value is really only
required externally, before and after reading a sample.
2015-05-30 13:25:22 +02:00
f0d15a6798 Merge branch 'master' into gooseberry 2015-05-29 17:45:03 +02:00
1c66edc14d Gooseberry: Workaround stupidness of MSVC with strict flags 2015-05-29 13:53:02 +05:00
054a97698e Merge branch 'alembic' into gooseberry 2015-05-28 15:27:18 +02:00
f1bd802b11 Moved child strand deformation into the general cache processing
function.

Strands processing now has 3 main steps:
1) apply parent modifiers
2) deform child strands
3) apply child modifiers
2015-05-28 15:25:00 +02:00
4905de28e5 Merge branch 'alembic' into gooseberry 2015-05-28 12:52:10 +02:00
e233e5f2a8 Allow external object targets for the cache shrinkwrap modifier. 2015-05-28 12:51:32 +02:00
383c52bff2 Merge branch 'alembic' into gooseberry 2015-05-27 20:23:29 +02:00
076b65e677 Presets for cached hair simulations.
This requires some modifications to the existing preset python class.
Serializing curve mappings can not be done with a simple property
assignment.

Also the fact that operator confirm popups drop all layout context
pointers means that we have to store the modifier name in the operator
in order to apply the preset to the correct modifier.
2015-05-27 20:20:30 +02:00
443890fefe Merge branch 'master' into gooseberry
Conflicts:
	source/blender/windowmanager/intern/wm_playanim.c
2015-05-27 20:05:06 +02:00
ae2f50268b Blenderplayer:
* Add space key to easily start-stop the player.
* Keep old behaviour of stopping when scrubbing.
* Sound scrubbing can be heard now even when scrubbing after pausing.
2015-05-27 18:21:31 +02:00
1aad1a7601 Merge branch 'alembic' into gooseberry 2015-05-27 17:56:34 +02:00
e8fb1b3ecf Fix for incorrect update callback in haircut cache modifier, leading
to unrelated property changes.
2015-05-27 17:55:13 +02:00
cd8baf871b Merge branch 'alembic' into gooseberry 2015-05-27 16:47:53 +02:00
9c87f0f2c8 Fix for the hair strands cutting modifier for caches.
The cutoff value was off by 1.0, due to an invalid increment for the
first vertex.
2015-05-27 16:46:23 +02:00
b98c3efaa4 Cleanup and fix for the cache backend factory, due to changed API
functions.
2015-05-27 15:55:40 +02:00
96e878b6cc Merge branch 'alembic' into gooseberry 2015-05-27 15:22:57 +02:00
2aa75bb106 Simplified render/preview settings for cache baking.
The previous way of selecting preview ("realtime") and render settings
on the cache library level was complicated and confusing. Now there are
just 2 buttons for baking either the preview or render level.
Technically the cache still works the same way, so a 3rd button could be
added for baking both passes into the same cache, should the need arise.

The preview cache now also uses the preview frame range, which should
help in quick testing of hair simulation settings. Render always uses
the scene frame range, like render buttons do.

For display in the viewport and rendering the cache will now use
whatever data is available in the archive. If the cache contains only
render data, the viewport will also draw full render data. Vice versa,
if the cache contains only preview data, this will also be used for
rendering.

Hair toggles for children and motion now are only used for the viewport
display. This simplifies the settings a lot and removes one potential
button to be overlooked.
2015-05-27 15:16:40 +02:00
62fd4395ac Merge branch 'master' into gooseberry 2015-05-27 14:44:40 +02:00
322380999e Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/object/object_ops.c
2015-05-26 14:56:36 +02:00
2e70a29f9e Merge branch 'master' into alembic 2015-05-26 09:34:31 +02:00
650fdcd74f Merge branch 'alembic' into gooseberry 2015-05-24 12:46:48 +02:00
48d0dd9b3a Fix for cycles rendering of shortened hair curves.
The strands data can now contain more vertices than are supposed to be
rendered (if cutoff < numverts).
2015-05-24 12:44:51 +02:00
bac7573dc5 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/blenkernel/intern/key.c
	source/blender/bmesh/intern/bmesh_strands_conv.c
2015-05-22 18:04:44 +02:00
466d17cffd Support for cutoff parameters in Alembic files.
These are optional, so older alembic cache versions still work.
2015-05-22 17:52:56 +02:00
7125b76c9a Take transformation of the duplicator object into accound for hair
cutting.

When using a dupli object from the same group as a target it is
sufficient to calculate the relative transform in the shared duplicator
local space. When using an external object though we have to transform
into world space first.
2015-05-22 17:25:48 +02:00
bd027416c4 Fix for incorrect cutoff points with the haircut cache modifier. 2015-05-22 16:59:01 +02:00
7b66e7bdd1 Implemented hair cutting for cached strands, based on a cutoff parameter
for child hairs.

The algorithm works by finding the first intersection of each child
hair with the target mesh. The child hairs have to be deformed with
their parents first (this usually happens *after* modifiers).
2015-05-22 16:22:57 +02:00
0ee5fa7745 Clean keyframes:
Keep handles as they were (cleanup code could ever slightly tweak
animation handles, which was not so good)
2015-05-22 15:42:28 +02:00
434ae40d63 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/windowmanager/intern/wm_playanim.c
2015-05-22 12:49:26 +02:00
89f1778328 Option for the haircut cache modifier to either use a scene object or
an "internal" object from the group.
2015-05-22 12:30:55 +02:00
3b089c1b90 Initialize curve mappings once after creating, just to be sure. 2015-05-22 12:18:51 +02:00
29ed48cced New cache modifier "Haircut", for removing unwanted child hairs. 2015-05-22 12:18:51 +02:00
d8c1d2d843 Alembic: Update stubs file so building without alembic works fine 2015-05-22 12:56:51 +05:00
94e69a379e SCons: Hopefully fix for gooseberry branch compilation 2015-05-21 20:43:41 +05:00
02d6601657 Use a flag to explicitly apply shape keys to either the goal positions
or the motion state.
2015-05-21 17:35:40 +02:00
5b26c112d9 Use correct blending weights for hair shapekey references. 2015-05-21 16:15:29 +02:00
67c8eb148b Removed unused variable. 2015-05-21 15:21:50 +02:00
f4ea6b4424 Properly loop sound when reaching the end of a movie 2015-05-20 19:27:55 +02:00
e09464a26b Speed of sound would get reset when stopping and resuming. 2015-05-20 19:14:59 +02:00
ca69120326 Blenderplayer audio:
Start and pause support
2015-05-20 18:52:30 +02:00
a5461ffa64 Blenderplayer sound:
Support speed of sound based on how fps is different from the movie fps.
For high fps the picture thread can lag behind the sound still, need
some way to framedrop.
2015-05-20 18:33:57 +02:00
53cbbcbb21 Keep interpolation type of keyframes when cleaning
Not sure how well that will work in practice, but there's a
whole studio of people ready to test.
2015-05-20 16:23:55 +02:00
b6b219996d Squeakycleanlinator tool for Hwoozeberry.
Basically it's a clean tool, but also removes a channel if the only
remaining keyframe has the default value only and is not used by
drivers or generative modifiers.

It's supposed to help with performance of the heavy scenes in
gooseberry.

Field test in gooseberry for now, masterification later.
2015-05-20 15:30:33 +02:00
efb4f87b75 Use dedicated versions of shapekey eval functions for strands.
Strand shapekeys will be interpreted as delta keys without a basis,
since the basis would be animated and therefore useless for static keys.
To avoid complexity in the already overburdened shapekey functions and
to skip old legacy code, the strands shapekeys now have their own
functions.
2015-05-20 14:30:39 +02:00
0c83b9c129 Removed some useless old code. 2015-05-20 12:56:43 +02:00
dc4d03c519 Removed the complicated optional refdata handling from the generic
shape key eval function.

This now goes to a dedicated strands function which can be cleaned up
properly, all the old code can function as before.
2015-05-20 12:48:28 +02:00
5f195acd1e Merge branch 'master' into gooseberry 2015-05-20 12:42:23 +02:00
b75a56dcc1 Fixed shape key reference data usage, for applying shape keys on top
of an animated base.

This is necessary for strand shape keys. The basis of the data comes
from the cached animation or simulation results, i.e. we can't use the
fixed basis key or the result would always become static.
2015-05-20 12:14:55 +02:00
fe0025f2ab Merge branch 'master' into gooseberry 2015-05-19 18:34:43 +02:00
2496259714 Apply strand shape keys to both the base strand coordinates and the
motion state.

This means shape keys work on the goal positions for hair as well as
the simulation results (hair motion).

If the simulation is created before shape keys are applied, the
resulting sim will be mixed with the shape keys, becoming more rigid
with increased shape weights.

OTOH the shape keys can also be applied to the animation result, before
doing hair simulation. In that case the shape will only affect the goal
positions and the bending shape of the hair, but the hair is otherwise
free to move.
2015-05-19 17:31:31 +02:00
ebd7269a99 Set the 'from' pointer in Key directly in the init method, so it works
with NULL pointers too.
2015-05-19 15:42:11 +02:00
b2d5d53fc8 Added back the deprecated KeyFrom struct in Key, for backward
compatibility.
2015-05-19 15:19:06 +02:00
60cd118a46 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/blenkernel/intern/key.c
	source/blender/makesdna/DNA_key_types.h
2015-05-19 14:55:20 +02:00
fdd1dfb657 Unified code for identifying unconventional shapekey owners between
gooseberry and alembic branches.

The shapekey code has been modified in both branches, adding particle
shapekeys in gooseberry and cache library shapekeys in alembic. The
two approaches are slightly different, but based on the same idea of
extending the 'from' owner info in Key, so that keys can be used without
a 'from' ID and/or with an index for identification.

This patch unifies the approach in both branches to make it slightly
less messy and avoid merge conflicts.
2015-05-19 14:50:52 +02:00
a91ccbc790 Ported key owner type code from gooseberry, to better sync both branches.
The shapekey code has been modified in both branches, adding particle
shapekeys in gooseberry and cache library shapekeys in alembic. The
two approaches are slightly different, but based on the same idea of
extending the 'from' owner info in Key, so that keys can be used without
a 'from' ID and/or with an index for identification.
2015-05-19 14:26:56 +02:00
3600b9f6bd Fix building without FFMPEG
Note - seems fps for movies are only calculated with ffmpeg?
2015-05-19 13:15:42 +02:00
a975f970ce Merge branch 'alembic' into gooseberry 2015-05-19 12:02:06 +02:00
5fd5d3c8b2 Improved relaxation code for strand lengths in hair edit mode. 2015-05-19 12:00:35 +02:00
f0e00033d1 Fix for incorrect vertex loops when calculating strands.
This was using vprev from previous strands, leading to spurious changes
on untouched strands when combing.
2015-05-19 11:56:44 +02:00
8357040667 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/windowmanager/intern/wm_playanim.c
2015-05-19 11:20:54 +02:00
66d39ad417 Merge branch 'master' into alembic 2015-05-19 08:48:46 +02:00
8ef679b6fd Merge branch 'alembic' into gooseberry 2015-05-18 20:36:44 +02:00
6091d9afa0 Use the extended archive writer variant to set the correct start frame
for slices.

Also the time sampling for slice output properties must be passed down
from the output archive, since the input properties use the original
start frame and cycle times.
2015-05-18 20:34:34 +02:00
a085b4c9f6 Use fps and start frame settings for cache archives internally, rather
than relying on values from Scene.

This gives more flexibility when creating archives. A default variant
for opening archives using the scene settings is still available.
2015-05-18 19:59:30 +02:00
8c21b0a943 New operator for 'splicing' Alembic data, i.e. writing part of the frame
range to a new archive.

This feature is useful when cache size becomes to big and unwieldy.
For sending shots to a render farm a large cache can now be split into
smaller parts, which are spliced off and can be sent individually.
2015-05-18 19:43:01 +02:00
27fa4d3301 Scrubbing after movie has finished playing works now 2015-05-18 19:13:35 +02:00
d266ed5819 Initial support of audio scrubbing in blenderplayer.
Still lots of corner cases to check:

* sound FPS not changing with speed settings of player
* picture and video still not 100% in synch
* Haven't checked what happens when audio is finished.

Some changes were made to make things nicer:

* Scrub now initiates on mouse click instead of mouse motion, makes
things more predictable.
* When scrubbing a movie with sound, don't pause playing after
scrubbing.
2015-05-18 18:49:50 +02:00
8374cf4fb6 Merge branch 'alembic' into gooseberry 2015-05-18 13:10:37 +02:00
aa91aa8b9b Optional arguments for the cache baking operator to chose a frame range.
If these properties are left undefined the operator will use the scene
frame range as before.
2015-05-18 13:09:19 +02:00
735408c4e4 Merge branch 'alembic' into gooseberry 2015-05-18 12:40:22 +02:00
258d927147 Very basic printing of cache bake info to have some feedback in
background mode.
2015-05-18 12:38:56 +02:00
7543035ffe Test support for audio in internal player to showcase in weekly :) 2015-05-15 17:33:09 +02:00
adf1b932f0 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/animation/anim_draw.c
2015-05-15 17:32:45 +02:00
e1c1b546b5 Merge branch 'alembic' into gooseberry 2015-05-15 13:00:59 +02:00
849ea4b818 Removed redundant particle matrix calculation when writing hair caches.
This could give a significant improvement in cache baking speed. The
particle matrix is particularly costly to calculate for highly
subdivided meshes.
2015-05-15 12:13:52 +02:00
7629a78b2a Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/mesh.c
	source/blender/depsgraph/intern/depsgraph_build_relations.cc
2015-05-14 16:51:28 +02:00
1518fde97d Merge branch 'master' into alembic
Conflicts:
	build_files/scons/tools/Blender.py
	source/blender/blenkernel/intern/mesh.c
2015-05-14 16:35:33 +02:00
51325025ec Merge branch 'master' into gooseberry
Conflicts:
	build_files/scons/tools/Blender.py
	source/blender/blenkernel/intern/mesh.c
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/editors/interface/interface_handlers.c
2015-05-14 19:25:15 +05:00
67dd6243f2 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-14 13:26:56 +02:00
4376dfbf21 Fix for Drag force fields: was using inverted velocity. 2015-05-14 12:17:14 +02:00
e9263a8ee3 Zoom to frame options, requested by the Hwoozeberry (dutch translation)
team.

There are 3 options here:

1) Keep range (previous behaviour)
2) Seconds - allows a specified offset in seconds around current frame
3) keyframes - zoom to include a number of keyframes around the cursor

Options 2 and 3 have their own properties to tweak the behaviour and all
options can be found in User Preferences->Interface under the 2D
viewports section.

Number 3 will probably need some refinement so commiting here for the
hwoozeberry team to test first.
2015-05-13 20:31:03 +02:00
c98fb76b4e Fix for previous commit: the "goal deflect" feature wasn't actually
filtering effectors by type.
2015-05-13 18:13:50 +02:00
bab4d495dd Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-13 16:50:06 +02:00
d99620f296 Optional feature "Goal Deflect" to disable goal forces when hitting a
deflector object.
2015-05-13 16:49:12 +02:00
28669b4e42 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-12 12:48:51 +02:00
7335d6675e Revert "Disabled the goal spring that is supposed to stabilize roots."
This reverts commit 1b32ac9779.

The goal spring is not working as intended, but is better than having
no bending force at the roots at all. Needs a better solution (virtual
root vertex).
2015-05-12 12:47:03 +02:00
99734166b0 Fix for incorrect sub-stepping in the strands hair sim solver.
The code was copied from the old cloth solver, which used a while loop.
Ended up using double step increments, which screwed up some
calculations ...
2015-05-12 12:44:24 +02:00
ab7e9340ca Fix for initialization of effector velocities. 2015-05-11 19:49:23 +02:00
1b32ac9779 Disabled the goal spring that is supposed to stabilize roots.
There are larger bugs still roaming free which need to be solved first.
Goal springs also are inherently unstable because the solver can not
properly estimate their Jacobian.
2015-05-11 19:46:41 +02:00
7391480b66 Merge branch 'alembic' into gooseberry 2015-05-11 15:23:20 +02:00
215b9ae288 Fix for crash when using cache file paths without slashes in them. 2015-05-11 15:22:39 +02:00
9a6ea84acb Merge branch 'alembic' into gooseberry 2015-05-11 14:00:20 +02:00
aff1cfc013 Fix for potential NULL pointer access when looking up strands data from
caches.

The 'find' function was returning a bool value, but this does not
guarantee non-null pointers. Removed the return value to avoid
confusion, now callers should simply check the returned pointers.
2015-05-11 13:58:15 +02:00
bc4be56608 Change of cache filter group behavior to allow partial caching.
The filter group was used by omitting any object instances that were
not in the group. This reduces the cache size, but it also entirely
skips objects.

Now the filter group only prevents writing of the actual object data,
but still allows storing dupli instances and dummy entries in the cache.
Any objects from cached dupli lists that don't have cached data (mesh or
strands) will now use the original object data instead.
2015-05-11 13:51:22 +02:00
09ad591e1f Merge branch 'alembic' into gooseberry 2015-05-11 11:41:40 +02:00
a5392ad4aa Fix for running bake operator in background mode without a job.
The cache bake operator would always create a job in the window manager.
However, when running in background mode via a script, the operator can
not be modal and the script would return right after starting the job.
Then Blender is stopped and the baking job with it.

To prevent this the operator now only runs in a job when executed from
the invoke function (or when 'use_job' is set explicitly).
2015-05-11 11:37:31 +02:00
d5228eb992 Drag type force field for keeping hairs "stuck" to a mesh surface. 2015-05-10 14:04:05 +02:00
28d4538215 Merge branch 'alembic' into gooseberry 2015-05-08 17:55:18 +02:00
f89385b17c Merge branch 'master' into gooseberry 2015-05-08 17:17:47 +02:00
70e768b095 Hide regular strands when the duplicator object is in hair edit mode. 2015-05-08 15:25:53 +02:00
1e3e6e2f18 Don't use the refkey for calculating shape deltas, but only for the base
shape.

Shape keys distinguish between the base shape (shape without any keys)
and the individual reference shapes for each shape key (which define
the delta offsets). For strand shapes, which have to work on top of
animation, the base shape must be the original cache result rather than
a static shape, but the delta for each keyblock is still calculated
wrt. an explicit shape.
2015-05-08 15:04:17 +02:00
def79482c2 Merge branch 'alembic' into gooseberry 2015-05-08 13:00:50 +02:00
96bbbbd5ea Follow up fix for bend stiffness curve map versioning.
The DNA lookup for pointers is a bit weird, it expects "CurveMapping" as
the type name, but then the variable field becomes
"*bend_stiffness_mapping".
2015-05-08 12:59:27 +02:00
cc588eb1e4 Merge branch 'master' into gooseberry 2015-05-08 12:36:20 +02:00
b032c86a12 Handle transformation difference between a cached duplicator object and
group objects when editing shape keys.

The edit data (including CD_SHAPEKEY layers) is in the active object's
space, i.e. the duplicator. The original data however is cached strands
data, which is in the dupli object's space. All geometry data needs to
be transformed properly when entering/exiting edit mode.
2015-05-08 12:19:27 +02:00
d4cdac35f8 Merge branch 'master' into alembic 2015-05-08 11:24:43 +02:00
ef88d436c3 Merge branch 'alembic' into gooseberry 2015-05-08 11:16:11 +02:00
548102fcb8 Version fix for bend stiffness curve mapping. 2015-05-08 11:13:04 +02:00
0335a0507c Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-08 10:48:53 +02:00
158568e347 Another curve mapping to control bending stiffness along hair strands.
This already exists for goal springs. Bending stiffness, however, is
preferable to global goal springs for physical realism. Controlling
stiffness in this way allows using bending forces to also simulate
unconventional hair, such as clumpy strands that are thicker and stiffer
at the base.

Note that hair interaction can also be simulated with this tool in some
way, although eventually better methods may be needed for such effects.
2015-05-08 10:45:08 +02:00
b120755c21 Merge branch 'alembic' into gooseberry 2015-05-07 20:21:05 +02:00
345f68f7b9 Fix for uninitialized values in strand children, leading to random
crashes.
2015-05-07 20:20:11 +02:00
a8293335ba Avoid crashes in pie menus now that strand edit mode forces us to have
more than 8 object modes. We will have to support auto pie expansion at
some point...
2015-05-07 19:31:34 +02:00
87aaa8ecfb Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/implicit_blender.c
2015-05-07 17:02:36 +02:00
d17a52109e Fix for NaN error when using zero-length springs in the mass-spring
solver.

This happens when using goal springs, which are now defined as linear
springs between actual vertices and virtual goal vertices. The Jacobian
was not accounting for the possibility of zero rest length.
2015-05-07 17:01:26 +02:00
ddd48cc788 Cleanup: warnings 2015-05-08 00:22:30 +10:00
f33286c48f Merge branch 'alembic' into gooseberry 2015-05-08 00:15:43 +10:00
9ba112eb89 Cleanup: quiet warnings 2015-05-08 00:06:09 +10:00
06226b28cd Merge branch 'master' into alembic 2015-05-07 23:49:36 +10:00
8e9c7f70c8 Merge branch 'master' into gooseberry 2015-05-07 23:38:03 +10:00
13f0ec29ce Extended RNA update for shape keys to trigger re-reading of dupli caches. 2015-05-07 15:25:45 +02:00
ac0b89f656 Merge branch 'alembic' into gooseberry 2015-05-07 14:45:16 +02:00
93944e5249 Fix for missing lib-link of effector weights group pointer. 2015-05-07 14:44:19 +02:00
d2421cee51 Merge branch 'alembic' into gooseberry 2015-05-07 14:17:59 +02:00
1326240006 Fix for cache simulation force fields, these were not added up. 2015-05-07 14:16:41 +02:00
249b3cca61 Merge branch 'master' into gooseberry 2015-05-07 14:10:00 +02:00
52117a07cc Conversion for shape keys back to strands data from edit mode. 2015-05-07 13:01:28 +02:00
d4249df4f7 Strands edit data conversion wants the raw shape key number (starting
at 1), converts to index internally.
2015-05-07 10:55:21 +02:00
429741ac19 Gooseberry: Attempt to fix compilation error with scons 2015-05-07 13:01:42 +05:00
409988e3c3 Fix for own error in merging alembic branch, breaking shape keys.
Both the gooseberry and alembic branches contain extensions of the Key
DNA structure, in order to make it work for particles and caches
respectively. This was giving badly resolved conflicts on merge.
2015-05-06 19:23:02 +02:00
2b415683fd Merge branch 'master' into alembic 2015-05-06 18:58:32 +02:00
83fc255bc8 Merge branch 'master' into gooseberry 2015-05-06 18:44:13 +02:00
f5ae2e1bbc Moved the child deformation for strands out of the core cache reading
function.

This is a feature for display in the viewport and rendering, which has
nothing to do with the core cache reading functionality. In the general
case you'd want the child data to remain unmodified.
2015-05-06 16:44:24 +02:00
79c17aaad8 Support metadata display in sequencer overdrop
Getting a consistent look here is difficult since editors apply their
own scaling. ideally, here we would have a consistent look with constant
font size but this is still to be realized in master and needs some
extra thought.
2015-05-06 16:06:57 +02:00
a0c83f1754 Merge branch 'alembic' into gooseberry 2015-05-06 15:39:17 +02:00
1938fcac8e Fix fo 'simple' particle hair matrix calculation.
The parent matrix is used for single-parent children ('simple'), in
which case the pa->num_dmcache has to be used to get the correct
position on subdivided meshes.
2015-05-06 15:36:46 +02:00
f26b373cb9 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/object/object_shapekey.c
2015-05-06 15:31:57 +02:00
ebcb8223bd Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/blenkernel/intern/customdata.c
	source/blender/blenkernel/intern/key.c
	source/blender/editors/object/object_shapekey.c
	source/blender/makesdna/DNA_customdata_types.h
	source/blender/makesrna/intern/rna_key.c
2015-05-06 14:02:29 +02:00
af7fe835ff Store MSurfaceSample data in hair strands for mapping to a mesh.
This data is not strictly necessary for the strands drawing or rendering
or even hair simulation, because the hair root offset and rotation is
already cached explicitly. However, the strand edit mode needs this
information to correctly apply length constraints.
2015-05-06 11:13:36 +02:00
6534a7b9ed Fix for threaded dupli cache generation from groups.
Strands require a valid DerivedMesh for calculating their root matrix
and surface mapping. The scheduler tasks were created such that strands
would be calculated while the DM task was not finished yet, leading to
missing DM data.
2015-05-06 10:12:46 +02:00
264e800965 Alembic: Quick fixes for strict compiler flags 2015-05-05 21:54:43 +05:00
c685b9f30b Alembic support for MSurfaceSample customdata. 2015-05-05 16:59:49 +02:00
39ab4dab66 Take transformation into account between the duplicator and strands
object.

The strand edit mode uses the local space of the active object, which
is the duplicator (and dupli cache owner). The strands data is in local
space of the original particle system object however, so have to
convert. This is a very hackish solution, using the first instance of
the strands data, which only works for single instance data.
2015-05-05 15:37:00 +02:00
e0a780d9a7 Strand edit functions for storing edit data in the Cache Shape Key
modifier and editing in hair edit mode.
2015-05-05 14:41:04 +02:00
46b9180a0a Merge branch 'strand_editmode' into alembic 2015-05-05 14:29:42 +02:00
38d9301674 Another fix for mirror editing of strand data.
Currently strand edit mode tool use the object data 'x mirror' flag.
This flag is only available on mesh objects, but the strand editing
can be used for dupli override caches etc. as well. Eventually strand
editing should get it's own independent flag to avoid this problem.
2015-05-05 14:27:44 +02:00
017d505cac Merge branch 'strand_editmode' into alembic 2015-05-05 14:05:03 +02:00
fbc70fa51c Fix for call to mirror functions when mirroring is not enabled, giving
warnings.
2015-05-05 14:03:59 +02:00
ccfea77463 Merge branch 'strand_editmode' into alembic 2015-05-04 18:39:27 +02:00
d52bdb6d3d Moved particle related functions of the strands edit mode into a
separate file.

This may seem a bit like overkill, but it helps ensure that no particle
depedencies messes up the strand editing code. The same will be done for
other use cases of the strand editing code in the future.
2015-05-04 18:37:45 +02:00
f7e8171264 Merge branch 'strand_editmode' into alembic 2015-05-04 17:53:00 +02:00
16b6d6c676 Added missing CD layer type name for MSurfaceSample. 2015-05-04 17:52:13 +02:00
ff5fa0df18 Merge branch 'strand_editmode' into alembic
Conflicts:
	source/blender/editors/space_view3d/drawstrands.c
	source/blender/editors/space_view3d/view3d_intern.h
2015-05-04 17:37:11 +02:00
b97214a0ba Forgot this last merge 2015-05-04 17:35:23 +02:00
dc7d07753f Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-05-04 17:34:32 +02:00
62b139385a Merge branch 'master' into alembic 2015-05-04 17:15:00 +02:00
bf7e8b42fa Merge branch 'master' into strand_editmode
Conflicts:
	source/blender/bmesh/bmesh_class.h
	source/blender/bmesh/intern/bmesh_mesh_conv.h
2015-05-04 17:14:25 +02:00
556c25f145 Extended shape key evaluation for cached strands blending.
Now shape keys don't replace the cached base data entirely with the
static Basis shape. Instead the current state as coming from the cache
is interpreted as the variable refkey instead of the Basis key.

The Basis key is in fact redundant, but removing it would require
changing a lot of shared shapekey code, so it's left in for now.
2015-05-04 16:54:26 +02:00
ed5de2ba08 Consider an empty keyblocks list to be a new key, so a Basis shape is
added automatically.
2015-05-04 13:05:06 +02:00
1ea8324a71 Actual shape key evaluation in the shape key modifier for caches. 2015-05-04 13:04:41 +02:00
de125950f5 Make strand shapes relative by default. 2015-05-04 13:01:30 +02:00
2df6da20aa Unused variables. 2015-05-04 13:01:08 +02:00
1e6e44fd24 New 'fromtype' variable in Key to allow handling type-dependent pointer
size and stride.

This is terribly messy due to the legacy code. At some point should be
cleaned up to get rid of the 'from' backpointer and simplify.
2015-05-04 12:59:34 +02:00
51260cbe71 Create a dummy weights array for strand keys, otherwise the eval
function will exit early.
2015-05-04 12:57:26 +02:00
809d5d92d3 Fix for lib_link of cache shape keys, avoid discarding this, they are
expected to stay alive.
2015-05-04 12:54:29 +02:00
247de3f9db Fix for incorrect/unnecessary storage of Key data in readfile.
The Key struct in the cache strands shape modifier is in fact "owned"
by the modifier, but linked in the Main blenddata, so it does not have
to be written explicitly.
2015-05-03 19:25:54 +02:00
699c280a3f Added a new "Modifiers" display mode for cache libraries, which reads
the source cache and then applies modifiers afterward.

This only performs non-iterative modifiers, which don't require the
passage of time to work (e.g. shrinkwrap).
2015-05-03 19:19:43 +02:00
ba878a0880 Main shape key implementation for cached strand data.
This includes storage of the shape keys in a `Key` instance in the
modifier data, and accompanying operators for adding, removing, moving,
etc. shape keys, as well as the necessary UI code.
2015-05-03 18:24:43 +02:00
ed81c38c97 Extended 'add' function for shape keys that allows passing a NULL
pointer for 'from'.

The Key DNA has some very old and largely deprecated legacy code that
needs initializing, which requires either explicit info or deduction
from an ID. The cache modifier creates keys in a new environment without
an existing known ID type to deduce the data element settings from.
2015-05-03 13:46:38 +02:00
958e6b1f20 Some NULL pointer checks in shape key code to ensure the Key struct can
be used without a 'from' pointer.
2015-05-03 12:47:54 +02:00
dbc4be381d New cache modifier type "Strands Key" for implementing shape keys on
cached strands data.

This modifier acts as a container for shape key data (i.e. as part of
the cache library). Such shape data can be applied to cached strands
data, which allows tweaking of animated hair shapes.

This could work both as a shape for the strand goals (adding dynamics
on top) or as a final modification after dynamics. Both methods have
their advantages (pre-sim allows control and sim at the same time,
post-sim gives accurate shapes but becomes rigid).
2015-05-03 12:13:03 +02:00
de5952c3d6 Removed optimization by applying cache shrinkwrap modifier only in the
realtime pass.

As with hair sim, this would be preferable, but is causing too many
problems with the current cache archive layout.
2015-05-03 12:07:17 +02:00
920aa5e7d2 Merge branch 'master' into gooseberry 2015-05-01 17:43:49 +02:00
e51b2ea0b9 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-01 16:11:27 +02:00
909134270a Fix for memory leak when reading cached strands data with UV or vertex
color layers.

The layer data is added to the strands after creation, but can be
existing already. It should only be reallocated when the number of
layers changes, and must be freed cleanly in that case.
2015-05-01 16:09:32 +02:00
cbd0d7a6b4 Alternative implementation for goal spring targets as vertices.
When using external forces to implement goal springs to explicit
positions in space, the system cannot calculate a stable solution based
on the goal velocities. The new approach implements goals as vertices
in the simulation, which are constrained to their animated locations.
This way they are treated like regular vertices, but the springs only
affect their non-constrained counterpart (the actual vertices).
2015-05-01 15:51:14 +02:00
38e54a7060 Rotation randomization feature for the particle instance modifier.
When using the hair path deformation feature of the modifier, each copy
of the mesh can now be rotated around the path, in addition to changing
length and offset. This includes a constant phase angle as well as a
randomization factor.
2015-05-01 13:07:46 +02:00
7e2fc0d78a Merge branch 'alembic' into gooseberry 2015-05-01 10:28:23 +02:00
50a8b15f47 Fix for shifted sample-to-frame mapping in Alembic files with hair
simulation.

The hair sim skips the first frame (velocities are undefined there), but
still has to create the motion state data in order to have it written
as a sample. Otherwise the strands motion state samples start one sample
short and frames get mapped to one sample in the past. This then leads
to incorrect movement of all hair vertices other than the roots (which
are always clamped to the animated positions).
2015-05-01 10:24:32 +02:00
3247955492 Graph editor uses own function for setting frame, use scrub flag there
as well.
2015-04-30 17:47:56 +02:00
83e83c6de7 Bring back audio scrub after last commit 2015-04-30 17:27:14 +02:00
dc25505aea Make Hjalti happier commit.
Treat scrubbing as animation. This takes care of too many updates from
our armature system.
2015-04-30 16:48:10 +02:00
02a76aa765 Merge branch 'master' into gooseberry 2015-04-30 15:18:02 +02:00
b063b2e265 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-30 14:45:53 +02:00
afc6142b91 Fix for deflector force fields in cache simulation.
Make sure forces always push outward when not using "double sided"
deflectors (default).
2015-04-30 12:14:51 +02:00
a8cdd9dda7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-04-29 21:41:02 +02:00
20c4b0d4a2 Merge branch 'master' into gooseberry 2015-04-29 18:50:19 +02:00
1c9985e015 Gooseberry: Fix crash of backdrop widget in graph space
This fix should actually happen in wiggly-widgets branch but it's now
has some commits which are not in gooseberry and merging them night
be not really safe.
2015-04-29 19:33:06 +05:00
303e9b4032 Fix really stupid own mistake that caused leakage of timers. 2015-04-29 16:21:21 +02:00
8fdfca67a5 Merge branch 'master' into gooseberry 2015-04-29 18:55:16 +05:00
7e3e624298 Tentative fix for flickering particle duplis, when using "pick random"
with a dupligroup and distributed rendering.

The particle duplis were generated using the global RNG (BLI_rand). This
is unstable once scenes become a bit more complex and objects are
evaluated in multiple threads.

This patch is not in master, because it changes the look of existing
particle setups.
2015-04-29 15:21:43 +02:00
9b4912ba9e New shrinkwrap modifier for cached hair data.
This is experimental. It might work for simple collision-like features,
by keeping goal positions for hair above the mesh surface. However, the
nature of nearest-point lookup on meshes means that the goal position
can flip to the other side of a mesh rapidly, which would lead to
strong forces and unstable behavior.

This code should be seen as an experiment.
2015-04-29 14:16:18 +02:00
b6aaa73953 Merge branch 'master' into gooseberry 2015-04-29 12:38:26 +02:00
90b3832c4d Merge branch 'alembic' into gooseberry
Conflicts:
	intern/cycles/blender/blender_sync.h
2015-04-29 14:48:37 +05:00
2b833c7ae8 Alembic: Fix compilation error after recent task/threads changes
For some reason CMake worked just fine, but SCons was giving issues.
2015-04-29 14:41:32 +05:00
fe052ca1ff Merge branch 'master' into gooseberry 2015-04-29 14:19:15 +05:00
adf4d0e3e3 Merge branch 'master' into alembic
Conflicts:
	intern/cycles/blender/blender_sync.h
2015-04-29 14:00:07 +05:00
0a94fbbf23 Merge branch 'alembic' into gooseberry 2015-04-28 19:26:03 +02:00
b4e5161b02 Fix for own bug in rB6d1fecc15254381420fdb1290eb611ed14cddaae.
The UV and vertex color attribute export function expects the curve data
arrays to contain only a single attribute at a time. They must be
cleared before filling in data for each UV/vcol attribute.
2015-04-28 19:18:15 +02:00
b3bdb23088 Merge branch 'alembic' into gooseberry 2015-04-28 16:53:14 +02:00
bc2055e7b7 Merge branch 'master' into gooseberry
Conflicts:
	intern/cycles/blender/blender_object.cpp
	intern/cycles/blender/blender_sync.h
	source/blender/editors/interface/interface_utils.c
2015-04-28 16:44:17 +02:00
e4758d3dfb Use quaternions instead of 3x3 matrices to store rotation of strand
roots in Alembic caches.

This kind of data is a big chunk of massive hair systems. Test files
could be reduced this way by almost 30%.
2015-04-28 11:34:02 +02:00
55ad6a99f6 Merge branch 'alembic' into gooseberry 2015-04-28 10:04:27 +02:00
6465cc7ef9 Accidentally deleted a return statement in previous commit. 2015-04-28 10:03:20 +02:00
22b35d7217 Fixed minor memory leak when the bake operator exits early without
freeing allocated data.
2015-04-28 10:01:50 +02:00
b539039d19 Optional filter group pointer in Cache Library for limiting cache
content.

This group is only used for the baking operator (like the datatypes
filter), but has no effect when reading caches. The UI now uses a box
layout to reflect this.
2015-04-28 09:43:33 +02:00
e9ae916750 Removed unused function for constructing a list of objects used by a
cache library.

This was no longer how cache libraries are used anyway, they now cache
based on duplilists, which can be more than recursive groups.
2015-04-27 19:24:31 +02:00
6d1fecc152 Support for UV and vertex color attributes of cached strands data.
Unlike particles, the Strands data stores UV coordinates and vertex
colors explicitly as a per-strand (const) property. This means Cycles
does not have to know the details of how particles map themselves to
a changing mesh surfaces (which is very complicated and fraught with
broken use cases and bugs). The UVs and colors are stored once for each
strand, since they are not expected to change over time (strands being
fixed to the mesh surface).
2015-04-27 15:18:30 +02:00
211afbabc7 Alembic: Make group's write_sample() threaded
The idea is to evaluate derived meshes in multiple threads, which will
reduce overall write_sample() time. We can't make all routines threaded
in there because alembic's file IO can't be threaded.

In any case, this change gives 2x speedup of exporting render resolution
version of Franck here.
2015-04-27 17:58:13 +05:00
3c0d111267 Alembic: Add utilities for task pool and scoped lock
Currently unused, but handy for some further development.
2015-04-27 15:34:03 +05:00
970f7feed4 Alembic: Minor tweak to disabling hdf5 if alembic does not support it
Mainly just suppresses meaningless message if hdf5 is already disabled in cmake.
2015-04-27 14:51:16 +05:00
Julian Eisel
e4b1b17925 Merge branch 'master' into gooseberry 2015-04-25 14:07:18 +02:00
757b5249d4 Alembic: Solve compilation error with strict compiler flags 2015-04-25 14:12:33 +05:00
3c5476e7f2 Do the actual frame change on timer events, not mouse move - those can
be buffered and choke the operator.
2015-04-24 17:47:35 +02:00
53441b8027 Merge branch 'alembic' into gooseberry 2015-04-24 17:37:22 +02:00
544f6dd9b6 Animation scrubbing - optimization attempt
Experiment for animators to try - only do full notification of scene at
end of scrubbing, do only manual area update instead like we do for
animation. Also skip audio update unless we do audio scrubbing.
2015-04-24 16:58:59 +02:00
8dcffc0f05 Use a wrapper around alembic read_sample function calls, to catch
Alembic exceptions and prevent crashing.

Alembic can throw exceptions on relatively common and uncritical errors,
such as mismatching properties in files which don't fit the expected
schema. These cases should now be handled gracefully and simple reject
the cache file with an error message.
2015-04-24 14:30:21 +02:00
00c69c9171 Support CD_MTFACE as a dummy layer in Alembic exports.
Customdata layers also store some base information, such as "active"
layer for rendering. This information is needed currently for syncing
particle UV and MCol data in cycles, even though the MTFACE layer type
itself is pretty much deprecated.
2015-04-24 14:29:13 +02:00
8c5a9cc8df Fix compilation issue 2015-04-24 11:41:58 +02:00
5eea19da4f Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_edit.c
2015-04-24 11:38:40 +02:00
c9e22c6ea9 Support for Loop UV and vertex color customdata attributes.
The exclusion mask for meshes in Alembic caches now is a bit more
specific as well, to not bluntly exclude all bmesh attributes.
2015-04-24 11:02:45 +02:00
84cbaf6f77 Fixed missing increment of when writing out CD_ORIGSPACE_MLOOP data. 2015-04-24 10:51:28 +02:00
290188c7fb Merge branch 'alembic' into gooseberry 2015-04-23 18:46:04 +02:00
c836cbab11 Don't disable hair sim during the render pass.
This otherwise prevents hair simulation motion showing up in renders.

The Alembic structure will have to be redesigned anyway. The current
concept of storing two separate entire scenes for viewport/render will
be replaced by a per-object detail level system. This allows performing
hair simulation only once and still use different resolutions etc.
where appropriate.
2015-04-23 18:43:20 +02:00
0b0b350e21 Merge branch 'alembic' into gooseberry 2015-04-23 16:10:48 +02:00
80126d8cf8 Merge branch 'master' into gooseberry 2015-04-23 16:10:22 +02:00
bc4347a73c Merge branch 'master' into alembic 2015-04-23 16:09:34 +02:00
0b026fd6ef Alembic: Use task pool for calculating DM for dupli object data 2015-04-23 18:49:22 +05:00
55c2330aeb Alembic: Typo sneaked in last moment before previous commit 2015-04-23 18:48:34 +05:00
5982a57f02 Alembic: Limit frame update to only group which we're interested in
The idea is simple: make it so scene_update_for_newframe is only doing updates
of the stuff which is really needed for the currently baking group.

Implementation is a bit tricky since we don't have parent relations after the
DAG is built, so doing some graph traversal there.

This code is also now using simplified version of scene_update_for_newframe()
which means in theory we can try de-duplicating some pieces of code, but that
can be done later.

Additionally, the same approach can be used to optimize motion path calculation.
2015-04-23 17:04:21 +05:00
0293378aa4 Test to check accuracy of claims about openalsoft being fixable by a
better config.
2015-04-23 13:01:03 +02:00
14653ab241 Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-23 14:53:38 +05:00
8b9d1818a5 Smoke: Fix crash when auto-sim happens outside of the backed frame range
Apparently, even if the smoke is backed to an external files it still could be
tried to be simulated at the frames outside of the baked range.

Kinda weird feature which isn't really safe, but better not to crash here.

Not totally happy with the code yet, will check with Lukas or Daniel how it
could be improved further.
2015-04-23 14:51:21 +05:00
66f7253aae Merge branch 'master' into alembic 2015-04-23 09:14:35 +02:00
cd5ab215e3 Allow the dupli override simulation to specify layers of effector
influence explicitly.

The previous code would only allow using the layers of the given object.
This is not useful for dupli overrides, because even finding which
layers an object in a dupligroup is in is cumbersome. It makes more
sense to use the layers of the duplicator instead.

There is an '_ex' version of the pdInitEffectors function now, with
an explicit layers argument. The simple version now also skips the
'precalc' argument, because this was true in every case except the
depsgraph dependency building anyway.
2015-04-23 09:09:06 +02:00
e2eb097491 Merge branch 'alembic' into gooseberry 2015-04-23 08:42:17 +02:00
38a28ce636 Fix for potentially uninitialized variable. 2015-04-23 08:41:28 +02:00
8a168e24cc Merge branch 'alembic' into gooseberry 2015-04-23 08:39:19 +02:00
adc0300bb9 Fix for incorrect index in strands normal calculation. 2015-04-23 08:38:03 +02:00
9e9a3cb7b6 Git missed those last commit 2015-04-22 19:40:11 +02:00
a6167306a2 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/interface/interface_handlers.c
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-04-22 19:34:37 +02:00
d794ce627f Merge branch 'alembic' into gooseberry 2015-04-22 15:58:55 +02:00
523ea570e7 Make size calculation in cache archive info operators an optional extra
step.

This calculate can take a bit of time (some seconds to a minute in
tests), due to having to loop through all array samples. In many cases
only the basic structure is wanted.
2015-04-22 15:50:19 +02:00
9cfff67158 Merge branch 'alembic' into gooseberry 2015-04-22 14:25:38 +02:00
dbbc7b465d Alembic: Fix wrong detection in Cycles whether cache is to be used for meshes 2015-04-22 17:06:02 +05:00
dada265e2f Alembic: Fix crash of viewport render with strands read from alembic cache
The issue was caused by RNA passing ownership from the cache data used by Blender
to Cycles. This lead to situations when all of a sudden blender looses data it
was expecting to have.

Now instead of passing ownership we're just copying strands from the data, so both
Blender and Cycles are having it's own local data.

Ideally this data will be shared between viewport and Cycles, but that's a bit
more tricky to do without modifying RNA API. Would happen eventually tho.
2015-04-22 16:07:27 +05:00
adb7299dea Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-22 12:11:47 +02:00
ffbb48b064 Enabled air drag forces in cached hair sim. 2015-04-22 12:10:52 +02:00
39990d8eec Use mass parameter for setting gravity forces in cached hair sim. 2015-04-22 12:10:52 +02:00
d0f8995129 Alembic: Fixes for strict compiler flags 2015-04-22 13:14:24 +05:00
d5ed706674 Alembic: Code cleanup, space around unused pointer function argument 2015-04-22 13:05:39 +05:00
456515b59d Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-22 12:18:35 +05:00
edb7a6819d Cycles: Typo in triangle storage tooltip 2015-04-22 12:17:31 +05:00
8bd84d8ec9 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/drawvolume.c
2015-04-21 17:31:55 +02:00
33e515671a Estimation for overall data size of Alembic components.
This is not accurate, but should give some indication about the most
expensive parts of a cache, so it can be optimized efficiently.
2015-04-21 17:26:33 +02:00
af12668c28 Improved Alembic archive examination tool for cache libraries.
A new panel is added for showing the structure and contents of archives
of a cache library (instead of simply dumping on the terminal). The
archive structure is stored in a lightweight tree structure, mirroring
the hierarchy of objects and properties in Alembic. These
object/property nodes can be expanded individually for easier navigation
through the archive.
2015-04-21 13:35:25 +02:00
6caba7bba2 Use a dedicated panel for cache library UI instead of appending to the
duplication UI.
2015-04-21 11:51:04 +02:00
d739889cb9 Alembic: Make alembic's HDF5 library optional
This way blender will be happy about alembic compiled without HDF5 support.
2015-04-21 13:39:52 +05:00
944ac62ad1 Fix alembic-cached dupli not updating in Render mode in 3DViews.
Probably a typo? Objects/parents sent to sync_mesh in case of dupli were meaningless...
2015-04-20 21:01:38 +02:00
72794d9e01 ShapeKey propagate operator for hair edit mode.
This implements roughly the same functionality as the equivalent mesh
shape propagate operator, with some tweaks specific to hair editing.

The operator copies selected points to all the shape keys. Unlike meshes
these points may be shifted afterward to achieve consistent segment
length (this can be avoided by selected entire strands before using the
operator).
2015-04-20 20:21:02 +02:00
734ee5a43a Merge branch 'master' into alembic 2015-04-20 19:34:26 +02:00
3e305dcaee Fix for particle shape key editing to prevent losing shape data
when switching the active key.

Particle shapes were always using the relative blending of keys when
evaluating hair data. This works ok for meshes, because their edit data
is entirely separate from the mesh data (using bmesh). For particles,
however, the edit mode is hardwired to the hair data, so when switching
keys in edit mode we must take care to replace everything with the
shape. Otherwise the hair data will be using blender shapes and the edit
data will overwrite any shape keys with that.
2015-04-20 18:58:07 +02:00
eb73721a23 Placeholder image strips feedback session changes no.2:
Change paths operator can also have the same placeholder logic now
2015-04-20 18:07:34 +02:00
a7880dd5c8 Fix 'Children' draw option showing nothing when no children in hairsim/cache
If number of children is zero, even if we do have "valid" children cache, do
not generate children strands from cache...
2015-04-20 17:56:35 +02:00
3a8958cb18 Placeholder image strips feedback session changes no.1:
Autodetect range of strips.
2015-04-20 17:35:09 +02:00
afcdb207c2 Placeholders for sequencer take one.
Placeholder images, means that the image sequence reserves a range for
images, displaying black while we wait for them to finish rendering.

This is meant as a feature to not break the layout of gooseberry
sequence edits while we wait for those frames to arrive.
2015-04-20 16:33:44 +02:00
8a9dc8451d Merge branch 'master' into alembic 2015-04-20 15:45:17 +02:00
4cecbf42cc Merge branch 'master' into gooseberry 2015-04-20 17:45:16 +05:00
227be153e9 Merge branch 'master' into alembic 2015-04-20 13:58:16 +02:00
2db121704b Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-20 16:38:31 +05:00
5edf8a8a5b Cycles: Fix threading issue caused by several nodes sharing the same image 2015-04-20 16:36:08 +05:00
dbd873380f Cycles: Replace name-based node matching with type-based
This commit replaces name-based node matching in the mesh device update
with check of special type. It is more robust approach for adding new
nodes which could use image slots for storage. it's also adds updates
of environment texture nodes used in bump shader (this was missing in
the original image sync reshuffle commit).
2015-04-20 16:27:20 +05:00
20e960215a Particle shapekey code is only in the gooseberry branch, disabled here. 2015-04-20 12:59:01 +02:00
9cafd3ae56 SimDebugData is now global, for easier usage and less intrusive code. 2015-04-20 12:58:16 +02:00
0dccffb7aa Fix for CustomDataType syntax error from merging. 2015-04-20 12:37:21 +02:00
7719a6365a Use the X mirror option in new strand edit stroke brush tools.
Note that currently this has virtually no effect, because the mirror
option relies on exact positions of vertices, which does not happen with
random hair placement (the add brush has no mirror option yet).

Eventually topological mirroring should help with this case, but is not
implemented for either old or new strand edit yet.
2015-04-20 12:25:18 +02:00
3a3327dcd5 Cleanup: rename function argument for consistency. 2015-04-20 12:25:18 +02:00
8ffcd1f434 Utility methods for mirrored strand editing.
These are a modified version of their BMEditMesh counterparts.

use_topology is not yet implemented for strands. Native strand topology
is not very useful for this. Instead, the topology of the scalp mesh
should be used for finding mirrored strand roots, then the arc- or
parametric length of a vertex from the root to find mirrored verts.

Conflicts:
	source/blender/blenkernel/BKE_editstrands.h
2015-04-20 12:25:15 +02:00
ed1dc43657 Fix for strands undo creating an invalid BMesh.
When copying mesh data to bmesh the MVERT and similar customdata types
have to be omitted. Otherwise the bmesh instance ends up with NULL
pointers in customdata layers, but entries in the typemap != -1. The
effect was that when storing new steps after one or more undo, the
resulting original data would be copied, and subsequent undo steps
are ignored.
2015-04-20 12:24:34 +02:00
5b9b779cab Minor code reshuffling. 2015-04-20 12:24:34 +02:00
4798464e8b Extended Mesh <-> BMesh copy function versions for specifying custom
data masks explicitly.

A dummy mesh is used for strand edit undo storage like in mesh edit
to prevent unnecessary code duplication. However, when copying from/to
BMesh only the mesh data layers are copied by default, omitting the new
data layers for strands (currently only MSurfaceSample hair root data).
2015-04-20 12:24:33 +02:00
299859e40b Sanity check: if there is no edited/active object for an undo step,
consider it invalid and clean up.
2015-04-20 12:24:33 +02:00
5e42aff397 Basic undo support in the new strand edit mode.
This uses the generalized undo stack system which is also used for
object data edit. An extension is necessary to tell the undo functions
which object is specifically used for generating undo data and
identifying the stack, since strand editing does not edit the obdata
itself.
2015-04-20 12:24:33 +02:00
3f539c987f Removed deprecated UI button for the hair debug flag. 2015-04-20 12:24:33 +02:00
6146b90312 Select Linked operator for hair edit mode (select all vertices of a
strand).
2015-04-20 12:24:03 +02:00
8b2ec99f57 Lasso Select operator for hair edit mode. 2015-04-20 12:24:03 +02:00
410998cdc6 Border Select operator for hair edit mode. 2015-04-20 12:24:03 +02:00
b6f4e0932d Mouse Select operator for hair edit mode. 2015-04-20 12:24:03 +02:00
62fa5c4a84 Select/Deselect All operator for hair edit mode. 2015-04-20 12:24:03 +02:00
2cddc3cda8 Disabled the partial IK strand relaxation for the time being.
First goal is to reproduce current particle edit tools in the strand
edit mode, then make improvements.
2015-04-20 12:24:03 +02:00
9120df6cb3 Missing bmesh include path in scons files. 2015-04-20 12:24:02 +02:00
48a86af388 IK solver for hair strands that provides a better solution for keeping
consistent segment lengths when transforming vertices.

Warning: The implementation is not correct yet, but all the steps should
be there.

The main idea is to treat strands as a sequence of joints that are
displaced out of their original locations by a transform or other tool.
The solver then tries to find a global per-strand solution that keeps
the segment lengths unmodified, with a minimum change in angles from
the original starting shape. Such a solution is much more usable and
efficient than the current O(n^2) attempt of "spreading the error"
across the strand.

The inverse kinematics method is very flexible. It can also include
stretching, which would be very welcome for features like the length
tool. Different parts of the strand could be weighted separately using
scaling factors for the angle/stretch parameters.

Conflicts:
	source/blender/physics/intern/implicit.h
2015-04-20 12:24:00 +02:00
eacc24ccf1 Ported over the relaxation method for hair vertices from particle edit
mode.

This method is simple, but not really very usable. It works by
successively relaxing segments that are too long or too short, moving
both vertices along the edge between them. This is repeated N^2 times
(N: number of vertices on the strand).

A true IK solver could give a lot better results, as well as providing
many opportunities to apply weighting for targets (e.g. preferring to
move non-selected over selected vertices). Many different methods for
simple IK solvers exist, so there should be one that works well for
large number of simple strands. See e.g.
http://www.math.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf
2015-04-20 12:23:49 +02:00
ac54ded29b Primitive transform operator support for strand vertices.
This does not yet prevent root transforms and/or length changes.
2015-04-20 12:23:49 +02:00
f7511b3d01 Improved hair combing tool, adjusting edge directions instead of
vertex positions.

This works a lot better with strokes perpendicular to the general hair
strand direction. With the previous comb tool such strokes would only
make a small dent in the hair curve and then vertices would slip out
of the tool circle. The edge combing affects the local direction of
strands, which acts as a kind of grabbing functionality by moving
further vertices in front of the tool circle. The result is that
drawing a curvy hair shape with the comb becomes much easier.

In addition, the new tool also uses edge filtering and weighting rather
than vertices. This means that small brushes also work well, instead
of having no effect when hitting the edge segments between vertices.

Further improvement could be achieved later by using a global strand
solver, which adjusts vertex positions based on an error metric along
the whole of the strand.
2015-04-20 12:23:48 +02:00
208ddcde2c Use a simple low-pass filter to generate a smoother, more stable
direction vector for the hair stroke tool.

This is necessary for directional tools such as combing, where the
stroke direction can lead to unwanted results if it changes too
abruptly.
2015-04-20 12:23:48 +02:00
f3b22c5769 Support for sim_debug drawing in hair edit mode (dev feature). 2015-04-20 12:23:48 +02:00
b70c815ac2 Renamed the edithair files in BKE to editstrands.
The rationale behind this is that the BKE code could be used for
modeling hair and fur as well as a number of other features such as
grass. The primary addition to BMesh is the limitation to strand-like
topology (simple vertex chains, optionally rooted on a mesh surface).

The editor code OTOH is quite hair specific, since the result should
be suitable for hair simulation, and the workflow should mimick actual
hair grooming intuitively. Eventually the hair edit mode could become
a generalized strand edit mode with slightly different tool sets for
various purposes, but for now it is quite specifically built for hair.

Conflicts:
	source/blender/blenkernel/CMakeLists.txt
	source/blender/blenkernel/intern/particle.c
2015-04-20 12:23:46 +02:00
d0a1fc8bb0 Sanity check for strand root/tip checks, now supports single vertices. 2015-04-20 12:23:23 +02:00
2d1d909817 MSVC compiler cannot handle standard C code.
Conflicts:
	source/blender/editors/physics/particle_edit.c
2015-04-20 12:23:20 +02:00
e9737da5f2 Fix scons build files for new hair edit code parts. 2015-04-20 12:23:16 +02:00
1e047231c6 Fix for hair-to-particle export: need to set weight=1.0 for hair roots,
since the particle system uses this for pinning them to the mesh.
2015-04-20 12:23:16 +02:00
142ef0b2e9 Fixed lib-linking for hair edit settings brush and object pointers. 2015-04-20 12:23:15 +02:00
56a09434c5 Basic Add tool for creating new strands in hair edit mode. 2015-04-20 12:23:15 +02:00
8672304e30 Fix for uninitialized return value. 2015-04-20 12:23:15 +02:00
f95dde244e Better feedback about valid sample from mesh sampling methods.
Conflicts:
	source/blender/editors/object/object_shapekey.c
2015-04-20 12:23:15 +02:00
79e649a3bf New simple storage method for single sample values. 2015-04-20 12:23:15 +02:00
e5b25e3c07 Generic raycast method for generating mesh surface samples.
Conflicts:
	source/blender/blenkernel/intern/mesh_sample.c
2015-04-20 12:23:15 +02:00
a4664ef88d New mesh sample evaluation function for shape key data. 2015-04-20 12:23:15 +02:00
be312b1399 First selection operator implementation for hair edit: circle select. 2015-04-20 12:23:14 +02:00
3edc512888 Show selection state of hair vertices with the usual theme colors. 2015-04-20 12:23:14 +02:00
b2ea8c1022 Added back different selection modes (strands, verts, tips) for hair
editing.
2015-04-20 12:23:14 +02:00
339a8b7521 Fix for OpenlGL state restoration after strand drawing, disable color
material option.
2015-04-20 12:23:14 +02:00
77da317cb1 Apply the same weight profile in the comb tool as in particle edit mode.
The comb tool will likely get a complete overhaul, but until then it
should just behave like the old tool.
2015-04-20 12:23:14 +02:00
2c0616b034 Support for common operators, keymap entries and radial controls for
hair brush settings.
2015-04-20 12:23:14 +02:00
a9fbd3b23b Fix for brush radius, the Brush.size property is actually the radius and
not the diameter.
2015-04-20 12:23:14 +02:00
687b5a1ec0 Implemented basic cursor drawing for hair edit mode brushes. 2015-04-20 12:23:13 +02:00
59efe23830 Primitive hair lighting in OpenGL solid shading, cleanup of strands
drawing code for edit mode.

The lighting uses the same method as the particle hair, interpreting
strand direction as the normal. This is nowhere near realistic hair
shading, but doing this with line shading alone in the fixed-function
pipeline is probably not possible. A GLSL shader could be used instead
for a more realistic alternative as part of the viewport project. At
least this simple shading mode gives some orientation feedback while
editing hair.
2015-04-20 12:23:13 +02:00
d16599ea04 Display basic brush properties in the toolbar for hair edit mode. 2015-04-20 12:23:13 +02:00
37d3a3331e Use the "official" brush size calculated by blenkernel and subdivide
the stroke step to avoid tunneling.
2015-04-20 12:23:13 +02:00
5254df30ba Filter affected hair vertices in edit mode based on the brush size and
z depth.
2015-04-20 12:23:13 +02:00
2590231315 Constrain hair root vertices to their mesh location after applying tools.
Conflicts:
	source/blender/bmesh/intern/bmesh_interp.c
	source/blender/bmesh/intern/bmesh_interp.h
2015-04-20 12:23:11 +02:00
83b20c7ddf Enforce hair constraints (constant segment length) after applying a tool.
Currently uses the same approach as old particle edit mode (rescale
hair segments from the root on). A more sophisticated approach using
least-square error minimization of the displacement could yield better
results.
2015-04-20 12:22:10 +02:00
0e06a60168 Make sure tool input data is in object space. 2015-04-20 12:22:10 +02:00
121677d7c8 Nicer vector math for mouse coordinates. 2015-04-20 12:22:10 +02:00
1615da133f Simplified first version of the hair stroke combing functionality.
Stroke tools will be categorized by the hair elements they operate on:
vertices, segments or strands (roots). In addition to that a filter
function defines the influence of the brush. This should be defined by
the other brush settings and be largely independent of the main tool
mode.
2015-04-20 12:22:10 +02:00
7ae6492c85 Lots of small fixes for paint system quirks to make hair brushes work
in the UI.

Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
	source/blender/editors/transform/manipulator_widget.c
2015-04-20 12:21:58 +02:00
7779166313 Define hair edit settings and brush types in the RNA, similar to paint
and sculpt settings.

Conflicts:
	source/blender/makesdna/DNA_brush_types.h
2015-04-20 12:19:28 +02:00
833a11f891 New image file icons for hair brush tools and an according tool enum in
the Brush RNA.
2015-04-20 12:17:16 +02:00
79959152e6 Calculate some basic info about mouse strokes and context and pass it
on to a general hair tool function.
2015-04-20 12:17:16 +02:00
4fd6a7a696 Revert previous hair edit operator scaffolding and port over the old
operator for strokes instead.

The paint system is much too complicated and does not add any real
advantage at this point.
2015-04-20 12:17:16 +02:00
98b15d9a7c Copied high-level operator code from the paint/sculpt system as a basis
for brush-stroke operators in hair edit mode.

Hopefully this can help avoid some redundant code and ensure consistent
keymapping etc.
2015-04-20 12:17:16 +02:00
a889a1458c Missing bmesh include folder for hair editor in scons. 2015-04-20 12:17:16 +02:00
7b6332f634 Apply the hair matrices when converting from particle keys to bmesh,
so the edit data is consistently in object space.
2015-04-20 12:17:16 +02:00
0a27e97fb7 Fix for GL buffer size for edges, needs to 2x for two vertex indices. 2015-04-20 12:17:16 +02:00
eb5257002b New drawing code for hair edit mode.
Conflicts:
	source/blender/editors/space_view3d/drawobject.c
	source/blender/editors/space_view3d/view3d_intern.h
2015-04-20 12:17:14 +02:00
23b284348b Removed deprecated code. 2015-04-20 12:15:17 +02:00
2d79994e39 Free strand edit memory after use. 2015-04-20 12:15:17 +02:00
fd34e3efbc Fix for verts-of-strand iterator: This requires a second pointer in
addition to the edge, otherwise the last point is omitted.
2015-04-20 12:15:17 +02:00
dc43df89cd CustomData layer for storing hair root locations as MSurfaceSamples.
This requires converting the old messy particle num/num_dmcache/fuv/foffset
data into the new mesh samples, which can potentially introduce floating
point errors and inaccuracies due to lack of face index mapping in the
new system. However, in any well-constructed particle system the hair
roots should be nearest to their num face, so mapping would be accurate
enough. If necessary face index data could be added to samples as a
legacy code hack, but probably it's best to eventually replace the
hair system as a whole anyway.
2015-04-20 12:15:17 +02:00
4e47239de2 Store the hair key weight in edit mode.
Currently particles only have a single weight value, controlling
pinning in the simulation (for root and virtual root verts) and goal
force scaling. This will be replaced by a full vertex group weight
system eventually.
2015-04-20 12:15:17 +02:00
991ee8a570 First customdata layer for particle mass.
This is more for testing purposes, since currently there is only a
single mass property for the psys as a whole. This should change in the
future though, to allow variable mass per strand or vertex.

Conflicts:
	source/blender/bmesh/intern/bmesh_interp.c
2015-04-20 12:15:15 +02:00
e43ef55e7f Basic particle data reconstruction when exiting edit mode. 2015-04-20 12:14:34 +02:00
1afd5be044 Fix for verts-of-strand iterator: After last edge step has to set the
edge to NULL to avoid infinite looping over the same edge (1-elem disk).
2015-04-20 12:14:34 +02:00
d550a29558 Fix for particle-to-bmesh: only was looping over totvert instead of
pa->totkey.
2015-04-20 12:14:34 +02:00
5f44f4a2ff Intermediate commit: switching strand edit data to BMesh.
Hair/Strand editing will only use a subset of the bmesh topology and
expect a specific topology that needs to be verified and enforced.
However, this extra requirement is much less work than reimplementing a
whole edit data system with the same feature set as bmesh and avoids
much redundant code.

Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-04-20 12:14:30 +02:00
b0a9e48a19 New customdata type for mesh surface samples.
Conflicts:
	source/blender/makesdna/DNA_customdata_types.h
2015-04-20 12:14:23 +02:00
afb947c00c Switched the hair edit data to a bmesh-like structure for consistency.
This means using mempools to store curve and vertex data, which allows
arbitrary addition and removal of data more easily. Also this includes
an iterator system similar to bmesh iterators (although the simpler
topology makes it a lot less complex).

Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-04-20 12:13:35 +02:00
f1e4d35489 Reconstruct most basic particle data when applying the hair edit, so
particle hairs remain visible.

Note that currently the hair root location (num/num_dmcache, fuv, foffset)
is not stored from edit data, so all hairs end up in a default location.
2015-04-20 12:12:01 +02:00
1c7053f7a0 Store hair edit data in particle systems and manage it in the operator
for entering/exiting the edit mode.

Conflicts:
	source/blender/blenkernel/intern/particle.c
2015-04-20 12:11:59 +02:00
7bb90a06e1 Moved code for the hair edit data structures to blenkernel.
This makes it work more like editmesh, and avoid the awkward and
basically bad-level approach in particles, where the edit data is an
anonymous pointer in particle systems together with a callback for
freeing.

Conflicts:
	source/blender/blenkernel/CMakeLists.txt
2015-04-20 12:11:44 +02:00
a9001adbb4 New edit mode for hair.
Conflicts:
	source/blender/blenloader/intern/readfile.c
2015-04-20 12:11:05 +02:00
dd69a3dbcf Finished the particle-to-edit conversion function. 2015-04-20 12:10:33 +02:00
c65f1b2e15 More work on particle conversion methods for hair edit mode. 2015-04-20 12:10:33 +02:00
09a7dbc29a New editor library for hair edit mode. 2015-04-20 12:10:33 +02:00
6078e79cea Minor syntax fix. 2015-04-20 12:10:33 +02:00
6783b15453 Shifted the dispatch from the algorithm side to the storage side of the
sampling system to keep the code simple.

Now there is a MSurfaceSampleStorage struct that encodes the storage
details, which the algorithms don't have to care about.
2015-04-20 12:10:33 +02:00
82132fc5b0 Added generalized method for creating an array of mesh samples with
arbitrary stride.
2015-04-20 12:10:32 +02:00
4b4f24607e Changed mesh sample definition to use 3 vertex weights instead of a
face index. This is easier to sample uniformly and avoids the need for
tesselation for evaluating.
2015-04-20 12:10:32 +02:00
fe48c353f1 Normalize the normal vector after sample eval to account for
interpolation.
2015-04-20 12:10:32 +02:00
308af3bfb3 Added a bool return to the eval function to give feedback on invalid
samples.
2015-04-20 12:10:32 +02:00
3f7d66ece4 Added a basic RNA definition for the mesh sampling system. 2015-04-20 12:10:32 +02:00
a952800ffc Eval function to get a location and normal vector from mesh samples. 2015-04-20 12:10:32 +02:00
71e34dad2b Usable random distribution algorithm.
Does not include area weighting yet.
2015-04-20 12:10:32 +02:00
24b77359ae Skeleton code for sampling meshes.
Conflicts:
	source/blender/blenkernel/CMakeLists.txt
2015-04-20 12:10:29 +02:00
386e1a1c94 Merge branch 'master' into cycles_memory_experiments 2015-04-20 15:07:15 +05:00
c9c207f093 Merge branch 'master' into gooseberry 2015-04-20 15:06:26 +05:00
d516158bb3 Merge branch 'master' into alembic 2015-04-20 11:55:36 +02:00
a2d5380f62 Merge branch 'alembic' into gooseberry 2015-04-20 10:38:12 +02:00
bd5f946f39 Fix for stupid MSVC, does not allow const expression as array size. 2015-04-20 10:37:01 +02:00
10df745d21 Revert 0d3da1343c
Disabling group -> duplicator dependencies would in theory make caches
more attractive because the invisible objects don't have to be updated
just because of the group.

However, the viewport and render starts to behave unpredictably without
these updates, because the dupli cache relies in many ways on the
objects it is supposed to override.
2015-04-20 09:39:08 +02:00
77a5443c60 Merge branch 'master' into gooseberry 2015-04-18 15:03:13 +02:00
ee04d04c0c Some minor fixes needed to build alembic with install_deps.sh. 2015-04-18 13:06:43 +02:00
47baee761e Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-17 23:36:42 +05:00
638b979895 Cycles: Add debug option to disable pre-aligned triangles storage
This option makes it so BVH does not use pre-aligned storage for triangle vertex
coordinates which was originally needed for faster coordinate lookup when doing
triangle intersection test. This array gives up to 10% performance comparing to
fetching individual coordinates but it also used 12 floats per BVH primitive,
which might translate to quite huge array in a complex scene.

Intention of this option is to investigate if this is a right direction to make
gooseberry files being able to render on local farm which is not totally great
in memory.

Current approach is not totally cheap, meaning even the case with the storage
enabled might be slower, but currently it's within 1%.
2015-04-17 23:34:54 +05:00
84f7f3d4b8 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-17 17:47:49 +02:00
e3a0345d8d Merge branch 'master' into gooseberry 2015-04-17 19:11:42 +05:00
e229f431ed "Deflector" force modifier for cache simulation.
This works like the existing effectors when using "surface" mode: It
selects the closest point on the mesh surface and creates a force based
on distance and falloff.

Unlike the old effectors it also supports signed distance, based on
the surface normal, which gives more control over the allowable distance
of strands to the mesh surface.
2015-04-17 09:47:58 +02:00
0faee07971 New cache modifier type for creating force fields on duplis of the
cached group itself.

This allows using the dupli group objects themselves as force fields,
in particular for collision objects in strand simulation. Without this
feature only the original objects of are recognized by the effectors
system, and even if duplis worked properly their settings would not be
accessible due to linking and dupli group hiding. The cache modifier
circumvents this issue by providing a new force field system, separate
from the current effectors.
2015-04-16 21:16:49 +02:00
26d74de2cd Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-16 16:24:24 +02:00
c412e7aca0 Merge branch 'alembic' into gooseberry 2015-04-16 16:08:53 +02:00
bda3e21e95 Revert recent commits, no time to improve things now. 2015-04-16 15:50:06 +02:00
78f8c3eb31 Merge branch 'master' into cycles_memory_experiments 2015-04-16 17:42:11 +05:00
91161dc983 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/drawobject.c
2015-04-16 13:03:26 +02:00
ea189ce26e Don't write dupli instances to caches in the Render pass.
Duplilists are always generated for viewport/realtime settings, render
settings only affect the mesh geometry but not the duplis.
2015-04-16 12:52:42 +02:00
36aad476dc Cleanup: Removed unused writer/reader classes for Alembic.
These classes were used previously to write parts of the Blender DNA
directly to Alembic. Their code is shared with other classes that are
still in use, so none of the really substantial parts have been deleted.
2015-04-16 12:07:28 +02:00
3538ebf443 Cleanup: Removed unused parts of the C API for caching.
This only removes trivial C function wrappers for parts of the C++ code
that are not used directly any more from outside the bl_pointcache
library. Some internal parts may be removed later, this cleanup is
mostly to reduce code noise.
2015-04-16 11:57:16 +02:00
e39d9960fb Renamed passes for cache writing to reflect their origin with mesh
modifier evaluation.
2015-04-16 11:51:15 +02:00
f5d5ffd335 Smoke: Fix compilation error with smoke disabled 2015-04-16 14:32:37 +05:00
a7846047a1 Remove the dual "root" object at the top of Alembic archives.
Using two full scene nodes for render/realtime data creates a lot of
duplication in both storage and processing time. Instead storing
specific data types like meshes in different versions keeps duplication
to the necessary minimum and allows easier fallback where available.
2015-04-16 10:42:48 +02:00
4a868954c5 Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-16 00:12:30 +05:00
d5c40c704f Smoke: Fix another crash caused by recent changes
Didn't notice initFie and so are called from constructor for some reason..
2015-04-16 00:11:35 +05:00
461e9a25eb Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-15 23:11:46 +05:00
465e59ac7d Smoke: Fix wrong bit test in previous commit 2015-04-15 22:50:39 +05:00
551a1b7c28 Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-15 20:41:57 +05:00
a1c1b32e4e Merge branch 'master' into cycles_memory_experiments 2015-04-15 20:41:25 +05:00
650915595c Draw modifiers as inactive when channel modifiers are deactivated. 2015-04-15 17:39:39 +02:00
4b04fad0a9 Smoke: Don't allocate arrays needed for hi-res simulation if smoke is baked to file
There used to be quite huge 3D arrays stored in memory which are only needed for
simulation steps and not used at all if the smoke is baked to file. That memory
is unmanaged by blender and not visible in the info space header and in practice
they could easily be gigabytes for hires smoke.

This commit only addressed hires smoke since it's the more important at this
point, and non-hires smoke wouldn't have such noticeable benefit.

In the case of tornado file it gives around 20% memory saving (which is about
26GB vs. 33GB on later frames of 01.03.02.A3 shot.
2015-04-15 20:35:02 +05:00
ebc94798de Make icon use a dim version instead for modifier muting 2015-04-15 16:31:46 +02:00
62eec5ab8e Add toggle that disables modifiers on fcurves. Gooseberry request, not
sure how useful it would be on master + it misses an icon, so commiting
here first.
2015-04-15 16:00:17 +02:00
77cbc67328 Removed the unused particle writer/reader code from Alembic.
We only use particles to initialize strands export now.
2015-04-15 12:47:44 +02:00
a67658dddc Only process hair simulation in "realtime" mode.
This means no motion state data is generated for render mode, this
requires some larger changes to the way render/realtime data is stored
in the caches.
2015-04-15 12:29:17 +02:00
c634edf4b1 Merge branch 'alembic' into gooseberry 2015-04-15 11:04:12 +02:00
88387ffa59 Object and particle system selection in the cache hair sim modifier.
Before this the hair sim would be applied indiscriminately to all the
strands in the cache data. Now an object/psys combination from the dupli
cache must be selected. Note that this is not the actual target of the
hair simulation, which still operates on the cache overrides instead.
The Object/Psys only functions as a selectable key, if no matching data
is found in the cache no hairsim will be applied.
2015-04-15 11:00:17 +02:00
0b30c9db2a Merge branch 'alembic' into gooseberry 2015-04-14 16:09:06 +02:00
53b5099e27 Another fix for child deformation.
Needs the parent base shape in the rotated deformed root space, or the
child gets additional deformation from the root rotations.
2015-04-14 15:28:48 +02:00
638e159de2 Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-14 17:32:14 +05:00
5155c165b5 Cycles leaf nodes split: Fix crash when rendering scene without inner nodes 2015-04-14 17:26:53 +05:00
f0035cdbbf Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-14 16:26:25 +05:00
cb69152ad5 Merge branch 'master' into cycles_memory_experiments 2015-04-14 16:19:13 +05:00
e0bbdd9704 Cycles: Split BVH nodes storage into inner and leaf nodes
This way we can get rid of inefficient memory usage caused by BVH boundbox
part being unused by leaf nodes but still being allocated for them. Doing
such split allows to save 6 of float4 values for QBVH per leaf node and 3
of float4 values for regular BVH per leaf node.

This translates into following memory save using 01.01.01.G rendered
without hair:

                   Device memory size   Device memory peak   Global memory peak
Before the patch:  4957                 5051                 7668
With the patch:    4467                 4562                 7332

The measurements are done against current master. Still need to run speed tests
and it's hard to predict if it's faster or not: on the one hand leaf nodes are
now much more coherent in cache, on the other hand they're not so much coherent
with regular nodes anymore.

Reviewers: brecht, juicyfruit

Subscribers: venomgfx, eyecandy

Differential Revision: https://developer.blender.org/D1236
2015-04-14 16:19:10 +05:00
ea8fb0953c AnimSys utility function was renamed in master. 2015-04-14 12:46:02 +02:00
4a3e22a34c Merge branch 'alembic' into gooseberry
Conflicts:
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-04-14 12:34:05 +02:00
12dd009356 Merge branch 'master' into alembic
Conflicts:
	source/blender/blenkernel/intern/object_dupli.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-04-14 12:25:17 +02:00
280dc1163b Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/drawobject.c
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-14 12:24:21 +02:00
c4e0d09e2d Fix for missing child data when the pathcache is not calculated.
The child strand root matrix and position still need to be stored, so
the writer must not exit early based on existence of the pathcache.
2015-04-14 12:21:19 +02:00
a8487f7f62 Optimization for particle baking to caches, skip evaluation of pathcache
when not needed.

The pathcache data is only required in the first frame to construct the
child strand shapes. For subsequent frames the children are calculated
using the initial shape and parent deformation, so particles don't need
to recalculate all the time.

This gives a significant performance increase of the baking process when
using a lot of complicated child hairs.
2015-04-14 11:50:53 +02:00
24caf4f98f Major optimization for cache size when storing child strands.
The basis for this optimization is that child strands have a shape that
does not actually change over time: the particle code does not enforce
this formally, but in fact all the clump/kink/roughness algorithms take
great care to not introduce changes of shape over time.

The final look of child hairs is achieved only by following the parent
hair deformation, i.e. by applying the offset of the matching parametric
position on the parent strand.

This means that for caching child strands it is sufficient to store the
full vertex data only in the first sample, and then apply the parent
deformation on subsequent frames using only the animated root matrices.

In test cases this seems to reduce the cache size to something between
10-20 % of the original size (down to some hundred MB from some 10 GB).
Further optimizations could be achieved by using smaller data types,
such as quaternions instead of 3x3 or 4x4 matrices for the remaining
child data.
2015-04-14 11:06:14 +02:00
09701e0ccc Apply child strand deformation only when using the cache result for
viewport or render display.

This way the strands can be cleanly written to subsequent output caches
without accumulating deformations.
2015-04-14 11:06:14 +02:00
da2bf129a4 Ignore the display/render settings of the cachelibrary when doing
simulations.

Otherwise the child strands and/or motion state can be missing and lead
to incomplete output caches.
2015-04-14 11:06:14 +02:00
Julian Eisel
1bccbbc04c Merge branch 'master' into gooseberry 2015-04-13 20:36:07 +02:00
7c28ee9c4a Merge branch 'master' into gooseberry 2015-04-13 18:38:21 +02:00
4c4673ce7f Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-04-13 19:18:27 +05:00
1f75229237 Merge branch 'master' into gooseberry 2015-04-13 15:58:18 +02:00
04d9e28621 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-04-13 14:31:36 +02:00
eeb3ccad48 Merge branch 'alembic' into gooseberry 2015-04-13 15:49:45 +05:00
7de6ed780d Alembic: Fix compilation error with alembic disabled
Was a mismatch in stub factory methods, presumably after some recent
changes in hair/strands.
2015-04-13 15:48:47 +05:00
bfb8788b64 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-12 14:41:34 +02:00
bf34249912 Fix for broken and messy particle time values to get consistent caches.
Particles use 0..100 range for parent particle "times" (curve parameter)
and 0..1 for children. For caches this is now uniformly calculated in
the 0..1 range to avoid breaking child interpolation.
2015-04-12 14:39:03 +02:00
8f6fd382a1 Used the mass parameter for hair simulation. 2015-04-11 21:51:44 +02:00
3ad7e5c1f2 Optional force and jacobian return values from angular bending springs,
for occasional debugging.
2015-04-11 21:50:03 +02:00
d0de201abd Merge branch 'alembic' into gooseberry 2015-04-11 17:32:38 +02:00
3c817d664e Fix for install_deps script: declare "skip-alembic" as a formal
parameter or it won't be parsed at all.
2015-04-11 17:31:20 +02:00
0ffe8be5e9 Fix for missing function argument commented out during cleanup. 2015-04-11 14:04:03 +02:00
9210f39112 Child strand deformation based on parent motion states when reading from
caches.

This allows child strands to follow the motion of parent strands as
calculated by the hair simulation. Unlike the particle system path
caching, this method does not regenerate all the children every frame.
Instead, it relies on an initial child setup that defines the base
shape, then applies the parent motion as a weighted linear deformation.

The result is in fact the same as with regular particle clumping, kink,
roughness etc.. Particles also take care to not change the child shape
when the parent moves, but this is not formalized anywhere (which makes
changing particle code quite difficult). So ignoring the particle code
is both permissible and efficient.
2015-04-11 12:44:01 +02:00
7d520f64a6 Fix for stupid particle times.
Normalize particle 'time' values to 0..1 range when writing to cache,
anything else is useless.
2015-04-11 12:38:23 +02:00
ac6038e991 Cycles: free mesh BVH after packing the scene BVH
The idea is to avoid having original BVH and BVH packed into scene BVH and hence
reduce memory footprint.

This change doesn't give any measurable differences on it's own, but together
with D1215 and D1217 it gives quite nice results.

Reviewers: campbellbarton, brecht, juicyfruit

Subscribers: eyecandy

Differential Revision: https://developer.blender.org/D1218
2015-04-10 23:20:34 +05:00
90c18b422d Cycles: Synchronize images after building mesh BVH
This way memory overhead caused by the BVH building is not so visible and peak
memory usage will be reduced.

Implementing this idea is not so straightforward actually, because we need to
synchronize images used for true displacement before meshes. Detecting whether
image is used for true displacement is not so striaghtforward, so for now all
all displacement types will synchronize images used for them.

Such change brings memory usage from 4.1G to 4.0G with the 01_01_01_D scene
from gooseberry. With 01_01_01_G scene it's 7.6G vs. 6.8G (before and after
the patch).

Reviewers: campbellbarton, juicyfruit, brecht

Subscribers: eyecandy

Differential Revision: https://developer.blender.org/D1217
2015-04-10 23:19:38 +05:00
a13952e84e Merge branch 'cycles_memory_experiments' into gooseberry
Conflicts:
	intern/cycles/blender/blender_sync.h
2015-04-10 20:56:44 +05:00
45ea4c8dbe Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-10 17:56:01 +02:00
bf2856c758 Cycles: Experiment with culling objects based on the camera frustum
The idea is to give artists a simplier way to control memory usage in such
scenes as grass fields by doing automatic object culling based on whether
they're visible in the frame or not.

This is controlled on per-object level. In order to use this option few
steps are required:

- Allow renderer to use camera culling (Performance panel of render settings)
- Set camera cull margin (measured in relative value to the render resolution)
- Enable Camera Cull for objects which are desired to be culled
  (object culling option could be found in Option panel in object buttons).

Interface decisions are not final for sure and to be refined if this
option is considered good enough for production.

Reviewers: juicyfruit, brecht, campbellbarton

Subscribers: venomgfx, eyecandy

Differential Revision: https://developer.blender.org/D1230
2015-04-10 20:55:44 +05:00
d0276014f9 Small fix for uninitialized variable (currently unused). 2015-04-10 13:53:20 +02:00
5ca4b182eb Implemented alembic archive info as a stream callback and disabled
popup and clipboard output.

For a production-size archive the info string can become really large,
and putting it into a buffer takes a long time. As a debugging tool the
stdout printing is sufficient for now and can be done as a stringstream.
2015-04-10 13:48:46 +02:00
0d2826d86b Merge branch 'master' into gooseberry 2015-04-10 13:06:00 +02:00
c2d6d6d824 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/drawvolume.c
2015-04-10 12:47:50 +02:00
a6b9fc6f22 Use depsgraph tagging and notifiers to enforce dupli cache updates
in the viewport.
2015-04-10 12:34:25 +02:00
b3faf5a4ea Explicit flags for toggling motion (from simulation) and child strands
in both display and render of caches.
2015-04-10 11:55:09 +02:00
702ae54436 External forces in strand hair simulation.
Arbitrary wind force "density" factor has been moved out of the force
function now, so cloth simulation can do this on it's own without
affecting the strand sim.
2015-04-10 10:03:48 +02:00
bb043dbef3 Goal springs for cached strand simulation.
In addition to the original particle hair sim settings the parameters
for strand sim have a curve to define the strength of goal springs along
strands. This useful because currently there is no way to override the
weights of strands. This would require a new particle edit mode that can
work with non-particle data in a sane way ...
2015-04-10 09:15:11 +02:00
59940c3b68 Disable the UI for drawing objects of cache libraries.
This takes an arbitrarily large amount of space in the UI and does
currently not have a good purpose.

Eventually this information could be displayed in a dedicated part of
the UI, with proper scrolling.
2015-04-09 21:10:00 +02:00
6abb0eaa8a Added visibility attribute for dupli objects in Alembic caches.
This combines the DupliObject.no_draw flag with the instanced object's
visibility.
2015-04-09 18:50:26 +02:00
ee110680fd Merge branch 'master' into gooseberry 2015-04-09 18:30:40 +02:00
8c34de9918 Fix for potential memory corruption in selection drawing code.
This code works much like the main object drawing code and has to take
the same precautions regarding replacing the derivedFinal pointer in
Objects. This pointer may be replaced during drawing calls, regardless
of the "ownership" indicated by needsFree.
2015-04-09 17:34:41 +02:00
3a38ba68c6 Check for empty schemas more consistently before trying to read.
Reading from an empty object in Alembic will throw an exception, which
is not easily handled yet. So rather avoid annoying crashes the clumsy
way for now.
2015-04-09 15:35:04 +02:00
871a29eeac Writer for child strand data.
Cache chains now support child strands too, instead of dropping
child data when writing out from strand data.
2015-04-09 14:45:16 +02:00
73796bb884 Merge branch 'alembic' into gooseberry 2015-04-09 13:06:47 +02:00
e6f41832c0 Extra changes to make strict flags happy 2015-04-09 15:51:02 +05:00
216a0993cd Merge branch 'master' into gooseberry 2015-04-09 12:49:45 +02:00
6ee460f299 Fix compilation with strict compiler flags 2015-04-09 15:47:13 +05:00
bfe9fc218d Extended Cycles to support both parent and child strands.
The code for syncing Strands and StrandsChildren data to Cycles curves
is almost identical, so to avoid code duplication a little templated
traits type has been defined, which provides the appropriate accessors
for both cases. This is very local and should not be too confusing.
2015-04-09 12:11:37 +02:00
cf1f78cc40 Cache reader for child strands.
This creates child strands along with the parents. These are not yet
deformed by parents or simulation, and are also not written back into
subsequent caches yet.
2015-04-09 10:44:32 +02:00
c8a7cd4266 Store child strand curves alongside the parent strands in dupli object
data.

Child strands have their own struct type for vertices and curves to
avoid unnecessary overhead (parent curves store a full 3x3 matrix after
all).

Child strands may be constructed from particle pathcaches, or read from
curves data in alembic files.
2015-04-09 09:57:20 +02:00
6142df649f Nominal support for UVs and Vcols with cached strand data.
These are dummy values currently. The UV and vcol values will be stored
in strands directly, unlike particles which evaluate them every time;
this is a much safer and more efficient approach that makes strand data
truely independent from the "emitter" mesh. Such data will be made
available later, primarily for child curves.
2015-04-09 09:03:54 +02:00
6564405d61 Merge branch 'alembic' into gooseberry 2015-04-08 22:36:41 +02:00
8699a0ba77 Fix for object matrix sampling with the default 1-second rate. 2015-04-08 22:35:38 +02:00
70c588bc3f Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-08 22:03:23 +02:00
d1c7efd73f Applying the inverse object transform for strand data is not necessary.
Particle pathcache data is in world space, but strands are stored in
object space already.
2015-04-08 20:02:42 +02:00
e0b9f82dcb Basic cache overrides for strand render data in Cycles.
Still buggy, but the basic workflow is there:
When a cache library is used in conjunction with a group duplicator and
it has strands that match the particle systems, Cycles will use the
new Strands structure to construct its internal curves.
2015-04-08 19:19:01 +02:00
d65c48e9a8 DNA file for strands types.
This is not strictly needed because the strands data is only created
at runtime at this point. However, it might be useful to later include
this in blend files.

Also the C++ RNA API has a bug that makes non-DNA collection properties
difficult (the length function is not implemented properly).
2015-04-08 18:49:18 +02:00
780d257e6e Merge branch 'master' into gooseberry 2015-04-08 20:21:02 +05:00
Julian Eisel
82a4d19a6b Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_transform.h
	source/blender/windowmanager/intern/wm_operators.c
2015-04-08 16:32:22 +02:00
Julian Eisel
715c57f3b0 Merge branch 'master' into gooseberry 2015-04-08 16:27:31 +02:00
38269a93c2 Yet another writer class for storing child strand data generated by
particles.

This is currently the same as the ParticlePathcache writer class, but
will be modified somewhat later to store additional information such as
parent weights. The purpose of this cache object is not to populate the
particle child caches, but to store renderable data associated to dupli
cache strands.
2015-04-08 13:45:13 +02:00
aee5f39e10 Child strands structure for storing renderable child hairs efficiently.
This is a separate struct to avoid storing unnecessary data (this means
a bit of code duplication for iterators). The child strands can be used
as the actual render data, while the parent strands usually would be
used only for simulation/deformation purposes.
2015-04-08 13:43:01 +02:00
d4c002d537 Merge branch 'master' into gooseberry 2015-04-08 12:50:39 +02:00
079f1aa64a Bending forces in strand hair simulation. 2015-04-08 11:44:37 +02:00
bdeb9cd7ea Store root orientation matrix in strand curves as well as caches.
This matrix is needed to create a stable and smooth coordinate system
along the strands, for things such as bending forces and child hair
deformation. The base matrix is defined on the "scalp" mesh and should
be stable wrt. deformation and animation of the mesh. For any point on
the strand a matrix is then calculated using parallel transport, i.e.
by rotating the base matrix successively along each curve corner.
2015-04-07 19:16:30 +02:00
676f742a6c Yet another iterator for looping over strands, this time for triples
of consecutive vertices ("bends").

This will be useful for calculating bending forces, without making basic
iteration a big headache.
2015-04-07 18:17:21 +02:00
d5be72b05f Nicer iterator for looping over strand edges directly.
Avoids the ugly construct with vertex iterators that have to drag an
extra 'prev' iterator along.
2015-04-07 18:12:04 +02:00
41447d212b Use the dupli object's obmat for world space simulation.
The overall world space matrix for dupli sims has to be the combined
obmat of the cached object as well as the duplicator for the dupligroup
instance. The cached strand data is generally in object space, so the
matrix has to be applied to get all the forces and interactions right.
2015-04-07 17:45:09 +02:00
ce47924c7e World transform for simulation of caches.
This compensates the transformation of the dupli instance being cached,
so that forces such as gravity are in the correct reference frame.

Note that this does not yet generate fictitious forces resulting from
a moving and/or accelerated frame of reference. For this we would also
have to calculate linear/angular velocity and acceleration of the dupli
object.
2015-04-07 17:22:45 +02:00
1873771940 Make sure the frame values for cache modifier evaluation are initialized
correctly.

Also skip empty frames in hair simulation (this includes the first
frame).
2015-04-07 16:37:57 +02:00
c29d7a2c2b Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-04-07 16:17:16 +02:00
e4f37a50ca Small fix for smoke display thickness, setting was not initialized for
new smoke domains.
2015-04-07 16:14:09 +02:00
2ab422506b Thickness setting for smoke drawing in the OpenGL viewport.
This is the first actual drawing/display setting for smoke, so a new
panel "Display" has been added to give it a home in the UI.

The name "thickness" has been chosen deliberately to distinguish it from
density, since the parameter only affects OpenGL drawing but not the
actual physical density values.
2015-04-07 16:00:20 +02:00
c253ef851c Use matching defaults and ranges in RNA/BKE for hairsim parameters. 2015-04-07 14:51:31 +02:00
59d236c21d Unused line, the strand array offset is provided by the iterator now. 2015-04-07 14:46:08 +02:00
4fdda03150 Better defaults for stretch stiffness and damping.
The strong stretch forces lead to awkward lengthening of segments when
the damping factor is too high.

In fact, in a natural hair strand the stretching usually means the hair
itself is curly and stretches as a helical spring. In that case
the damping is quite small compared to the stiffness, and little energy
is lost to the stretching (the hair becomes "bouncy"). When the hair is
very stiff the damping should also be small in order to avoid extreme
forces resulting from the hair root location constraint.
2015-04-07 14:41:48 +02:00
e5a47562eb Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/image.c
	source/blender/blenkernel/intern/object_dupli.c
	source/blender/blenkernel/intern/sequencer.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/editors/space_view3d/view3d_ops.c
	source/blender/makesdna/DNA_sequence_types.h
	source/blender/makesdna/DNA_view3d_types.h
	source/blender/windowmanager/CMakeLists.txt
	source/blender/windowmanager/intern/wm_operators.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-04-07 14:19:16 +02:00
648dbb23f9 Fix for stretch forces being defined wrt. the root vertex.
Was not advancing the iterator for the previous vertex correctly.
2015-04-07 12:56:36 +02:00
1ab8999f14 Moved root animation calculation into the solver code.
The solver can calculate the de-facto velocity of the root using the
difference of the already-updated vertex location and the state from the
previous step.
2015-04-07 12:26:52 +02:00
8b9d5fd1eb Fix for simdebug data cache reading.
Data pointers were not advanced, so only the first debug element would
show up properly.
2015-04-07 12:09:46 +02:00
dc6d51c555 Take strand bounds into account when calculating bounding boxes for
dupli overrides.
2015-04-07 11:17:19 +02:00
f24153bcbc Apply sim debug data from caches back to the global hash table.
Note that this is quite messy atm, it will override debug data if
different caches are used, and does not discriminate when writing to
caches either.
2015-04-05 17:10:14 +02:00
8c055802a2 Write out sim debug data along with dupli caches, if the global sim
debug flag is enabled.
2015-04-05 16:02:41 +02:00
7ffdbecdbf Merge branch 'cycles_point_density' into gooseberry 2015-04-05 15:04:31 +02:00
c324136028 Fix for undefined psmd field in when evaluating particle textures. 2015-04-05 15:03:56 +02:00
a4bc9cd0bd SimDebugData writer/reader for Alembic caches.
This will allow debug visualization data to be stored inside caches
along the actual simulation state.

While the regular simulation allows examining simulation data on-the-fly
by stepping through the regular timeline, the new baking mechanism used
for caches does not easily allow simulation data to be visualized frame
by frame. Caching this data will allow adding it to the global sim debug
data.

This would also still be very handy if the baking process itself becomes
more interactive again. Unlike the current simulation progression, the
cached data can be accessed randomly, so scrubbing throught the timeline
becomes possible.
2015-04-05 14:47:56 +02:00
04d604648a Fixed unused parameter warnings in Alembic customdata code. 2015-04-05 11:54:43 +02:00
2681b66c1d Merge branch 'cycles_point_density' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/particle.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/makesdna/DNA_particle_types.h
	source/blender/makesdna/DNA_texture_types.h
	source/blender/makesrna/intern/rna_particle.c
2015-04-04 14:30:54 +02:00
bd503353bb Support for particle texture color in point density textures.
This works for all pointdensity use cases, BI as well as Cycles.
2015-04-04 14:23:14 +02:00
aa43c13c3e Particle color influence option for particle textures.
This color is currently only displayed in the viewport (when enabling
"Texture" color mode in the Display settings). It will be used for
controlling the smoke color when using particles for smoke emission.

Conflicts:
	source/blender/blenkernel/intern/particle.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/makesdna/DNA_particle_types.h
	source/blender/makesdna/DNA_texture_types.h
	source/blender/makesrna/intern/rna_particle.c
2015-04-04 13:35:48 +02:00
11cb027ac4 Merge branch 'cycles_point_density' into gooseberry 2015-04-03 19:57:19 +02:00
f48e3cf6bf Color support for point density texture in Cycles.
This extends the point density evaluation to also store RGB color values
in the array provided by Cycles.

Since internally all Cycles textures are 4-float RGBA textures anyway,
it does not make a lot of sense to store density and color separately.
This could eventually be preferable to avoid unnecessary storage.
2015-04-03 19:49:02 +02:00
3c5be38c9f Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-03 17:32:46 +02:00
3cbdb31255 Added the major parameters for the hair simulation.
This is basically copied from existing cloth sim settings, with a good
deal of cleanup and sanitization.

Unlike cloth parameters, the damping values are described as relative
to their associated stiffness values for springs. This is much easier
to use in practice and less prone to lead to unstable simulations.
Damping simply works best when the force is in the same order of
magnitude as the stiffness, so having a relative factor requires much
less adjustment on the user side.
2015-04-03 15:18:52 +02:00
0ab2bb586e Added effector weights for cache hair simulation. 2015-04-03 14:20:33 +02:00
93c49605fd RNA for modifier struct subtypes.
Also renamed StrandSimParams to HairSimParams, since strands are only
the agnostic data structure, while these parameters are specifically
used to simulate hair-like behavior. Other simulations could use strands
but implement completely different kinds of physics (e.g. grass, ropes).
2015-04-03 14:18:46 +02:00
49890a8119 Smaller strips not working for files with sequencer 2015-04-03 14:13:41 +02:00
1550f092ba "Structural" spring forces for strands.
These connect strand points to ensure constant length and form the main
spring system in strand simulation.

Note that parameters are still hardcoded.
2015-04-03 12:32:50 +02:00
bff8ea5cd7 Fix unfreed motion state memory when freeing strand data. 2015-04-03 12:04:40 +02:00
f1234c6335 Scalp animation support: copy strand root locations from the rest pose
before performing a time step.
2015-04-03 12:00:36 +02:00
3509cb3c60 Pinning for strand roots.
Note that roots are currently not animated.
2015-04-03 11:38:34 +02:00
f0ea8a19c1 Use FPS value to sync the strand simulation time with the render time.
Additionally the time can be scaled using the timescale parameter.
2015-04-03 11:28:15 +02:00
f19a416b36 Correct progression handling of the strands motion state through cache
baking.

For now this simply applies gravity and applies the basic hair solver
for velocities and positions.
2015-04-03 11:21:40 +02:00
1e8b62476b Make mattieu happy - allow smaller strips vertically.
Allows mattieu's masterplan to keep overdrop at higher sequencer space
and all strips lower.

This won't align text so well though, but will leave it simple and he
can give feedback later.
2015-04-02 20:54:17 +02:00
38d8abb3c3 Cycles point density: Fix using double semicolon at the end of line 2015-04-02 22:35:36 +05:00
5156c283dd Fix for wrong pointer used in the modifier cache copy function. 2015-04-02 16:39:10 +02:00
a6998f132a Force calculation function for strands (only gravity atm). 2015-04-02 15:03:06 +02:00
6c832657cc Sanity check and nicer substep loop for strands simulation. 2015-04-02 13:57:34 +02:00
daca75d8e1 Fixed writing code for cache modifiers to include extra DNA fields of
subtypes.
2015-04-02 13:54:08 +02:00
366fc83f6d Fixed DupliCache writers/readers to support subsequent stages of
cache manipulation.

Strand data in caches is now stored in a named list, so we can avoid
adding strand data in every frame.
2015-04-02 13:36:50 +02:00
335b495196 Merge branch 'master' into gooseberry 2015-04-02 12:37:22 +02:00
274bb10a36 Merge branch 'master' into gooseberry 2015-04-02 21:30:10 +11:00
f0e8334d1a Merge branch 'master' into alembic 2015-04-02 21:24:57 +11:00
049dec083a cleanup: warning 2015-04-02 21:24:50 +11:00
ebf079c004 Disallow deleting of files by the point cache in the clear function.
This function is used in every part of the code, and has been causing
great pain when deleting 15 hours worth of baking in an instant.
The complexity of the code makes it unfeasible to fix this selectively,
so for now simply disallow the code from deleting any of the files.

For selected well-defined cases the deleting can be reenabled later,
e.g. when the user presses the `Bake` button and confirms deletion in
a popup.
2015-04-02 11:04:36 +02:00
9cfe6aae91 Removed unused BKE_ptcache_remove function, one less potential place
where cache files might get deleted.
2015-04-02 11:04:36 +02:00
615c57ec31 Clear duplilist instances when reading from a dupli cache, to avoid
generating a new dupli instance on every frame.
2015-04-01 20:31:28 +02:00
e0d90141b0 Made the duplicache clear function public.
It's a common operation that may be useful later, no reason to keep this
hidden.
2015-04-01 20:27:01 +02:00
644b68ac6e Basic strand processing in the hair sim cache modifier. 2015-04-01 20:03:46 +02:00
Julian Eisel
55280eecad Revert "Always display full data paths in tooltips"
Seems like there is currently now way to get the full data path
reliably. So instead of the old "..." this patch just displays
(null) which also isn't really useful.
2015-04-01 16:46:27 +02:00
83e8b3a51e Clean up vertex/normal client state after drawing strands.
This should hopefully prevent some random crashes.
2015-04-01 16:11:57 +02:00
Julian Eisel
30d72d682a Always display full data paths in tooltips
Another experiment for gooseberry. We should make Blender smarter
here in general, but it's a start.
2015-04-01 15:57:21 +02:00
Julian Eisel
5baff6246f Reorganized RMB menu and new entry "Copy Full Data Path"
D763 ready for testing from the sheepy people.
2015-04-01 13:41:38 +02:00
30ea4349c9 Merge branch 'alembic' into gooseberry 2015-04-01 13:08:30 +02:00
295b28c7b1 Clean up: Avoid unused variable warnings. 2015-04-01 13:07:38 +02:00
afddaf1188 Added missing stub function when Alembic is disabled. 2015-04-01 13:02:25 +02:00
aa9f8d32fd Merge branch 'alembic' into gooseberry 2015-04-01 12:32:29 +02:00
f428fcd23d Merge branch 'cycles_point_density' into gooseberry 2015-04-01 15:31:52 +05:00
99b10373db Cycles point density: Particle state coordinates are actually in the world space
Code was assuming they're in the object space which caused wrong
texture sampling and translation to the world location.
2015-04-01 15:30:56 +05:00
08e39a5bfb Override the init function for DupliObjectReader, so Cycles gets the
cache result when constructing render meshes.
2015-04-01 12:21:41 +02:00
6b4ea6da17 Merge branch 'cycles_point_density' into gooseberry 2015-04-01 14:38:39 +05:00
49a608aaec Cycles point density: Fix crash when source object is not set 2015-04-01 14:37:34 +05:00
9c269243db Added writers for DupliCache data to allow truely successive cache
modification.

The bake operator will now generate output based on the 'source_mode'
setting:
* When the source is SCENE it uses the basic object data as stored in
  the Object ID datablocks (DerivedMesh, particle hair strands etc.)
* When the source is CACHE it fills a temporary DupliCache with data
  from the cache archive (like it would for the display dupli_cache,
  but also supporting render data). This dupli cache is carried over
  between frames during baking, which allows modifiers to act as
  simulations and sequentially advance motion states.
2015-04-01 11:31:41 +02:00
23447ce3b9 Merge branch 'master' into gooseberry 2015-04-01 11:25:25 +02:00
dc172108f2 Merge branch 'master' into cycles_point_density 2015-04-01 14:23:02 +05:00
9e39cfe16d Merge branch 'alembic' into gooseberry 2015-04-01 10:01:25 +02:00
8ac00ec76a Merge branch 'cycles_point_density' into gooseberry 2015-03-31 22:36:50 +05:00
22fa9d3448 Fix compilation error of blender player 2015-03-31 22:36:12 +05:00
83620641d2 Merge branch 'master' into gooseberry 2015-03-31 22:23:10 +05:00
d391ab8d4a GHash iterator wrapper for DupliCache, so cache modifiers can access
all components in the cache.
2015-03-31 18:46:01 +02:00
f8e623e0b8 Removed unused "object cache" iterator code. 2015-03-31 18:12:10 +02:00
806a338090 Merge branch 'cycles_point_density' into gooseberry 2015-03-31 21:10:52 +05:00
1d32a23c78 Added transient DupliCache data baking modifiers/simulations and
writing into the output cache archive.
2015-03-31 18:06:48 +02:00
3c0e15c81a Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_intern.h
	source/blender/makesrna/intern/rna_modifier.c
2015-03-31 17:49:54 +02:00
866537d001 Removed the Cache modifier because it is unused now and causes some
merge conflicts with master.
2015-03-31 17:44:05 +02:00
3c6c33be98 Merge branch 'master' into alembic
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/space_view3d/view3d_intern.h
	source/blender/makesdna/DNA_modifier_types.h
	source/blender/makesrna/intern/rna_modifier.c
	source/blender/modifiers/MOD_modifiertypes.h
	source/blender/modifiers/intern/MOD_util.c
2015-03-31 16:59:19 +02:00
c8b831d742 Cycles: Point density texture experiment
This commit implements point density texture for Cycles shading nodes.

It's done via creating voxel texture at shader compilation time, Not
totally memory efficient, but avoids adding sampling code to kernel
(which keeps render time as low as possible), In the future this will
be compensated by using OpenVDB for more efficient storage of sparse
volume data.

Sampling of the voxel texture is happening at blender side and the
same code is used as for Blender Internal's renderer.

This texture is controlled by only object, particle system and radius.
Linear falloff is used and there's no turbulence. This is because
falloff is expected to happen using Curve Mapping node. Turbulence
will be done as a distortion on the input coordinate. It's already
possible to fake it using nose textures and in the future we can add
more proper turbulence distortion node, which then could also be used
for 2D texture mapping.

OSL is not currently supported. There's no actual stoppers for support
it, but so far it's not really a priority at this point.

Reviewers: campbellbarton, juicyfruit, brecht

Subscribers: campbellbarton, dingto, eyecandy

Differential Revision: https://developer.blender.org/D1208
2015-03-31 19:52:48 +05:00
54c2e625e5 Removed the redundant cache exporter class from the pointcache lib.
Writing in C++ is a little bit more convenient, but this functionality
does not require the additional level of complexity.
2015-03-31 14:25:10 +02:00
6bcc28b8ab Support for shading "normals" in strand rendering.
Note that the fixed-function OpenGL pipeline does not support true
strand normals. The shading model used copies the method implemented for
particles, using the edge directions as normals. This is totally
unphysical but at least gives some indication of direction. Viewport
refactor and programmable shaders are needed to make this work nicer.
2015-03-31 12:21:49 +02:00
297563286e Store the overall result of cache reading in the DupliCache.
This is used to prevent empty dupli lists when reading the cache fails.
In that case the duplilist function will now revert to default scene
evaluation.
2015-03-31 11:49:41 +02:00
1700c4c6fb Extend the cache reading function to take the result archive into account. 2015-03-31 11:26:17 +02:00
fc1d50f1e7 Reorganization of file paths and input/output workflow in cache
libraries.

Having a cache archive output in each modifier is not really practical.

Now the cache library has at most 2 file paths. These are used based on
2 associated settings: source mode/path and display mode/path.

* The SOURCE mode determines whether the original scene data is used as
input or a cache archive. If the scene input is used the dupli group
objects will be evaluated as usual with Mesh data, modifiers, proxy
armatures, etc.. With cache input the data stored in a cache is used to
override the scene data instead.
* The DISPLAY mode is essentially a toggle for the whole cache modifier
stack. If it is set to 'source' the respective source data is used
without further modification. If set to 'result' the data from the
output cache archive is used, which can be generated using the bake
operator. During baking the data will be passed through the cache
modifiers to create a variation of the original source data.
2015-03-31 10:33:33 +02:00
1740fedb64 Merge branch 'master' into gooseberry 2015-03-31 00:27:22 +05:00
b1a8b9806b Simplification of the cache library filtering mechanism.
Now the filtering is simply based on the data types that should go into
the cache, instead of selecting each object and component individually.

This is slightly more limited and may need to be revisited again later,
but for the time being it is much less confusing and clumsy. Filtering
by objects can be accomplished by creating groups accordingly. Making
groups specifically for caching is totally acceptable.
2015-03-30 18:43:31 +02:00
6d0fe090c2 Merge branch 'alembic' into gooseberry 2015-03-30 18:36:17 +02:00
3a5cd5f4d4 Fix for crash on dupli drawing, due to check of ob.transflag after it
is already restored.
2015-03-30 18:34:10 +02:00
2a032a2f6e Merge branch 'alembic' into gooseberry 2015-03-30 14:16:03 +02:00
3b4d464d1a Fix for crashes when changing draw types that affect dupli objects.
The draw code was restoring the derivedFinal mesh unconditionally after
drawing duplis. However, the drawing code can in some cases replace the
derivedFinal pointer during drawing (bad!). This then leads to invalid
pointer access.

Fix is to only touch the derivedFinal when it's actually a dupli cache
mesh.
2015-03-30 14:11:58 +02:00
0255e37a3d Merge branch 'alembic' into gooseberry 2015-03-30 12:42:54 +02:00
e0cf04c6d4 cachelibrary.modifier_bake operator has been removed in favor of
`cachelibrary.bake`.
2015-03-30 12:41:29 +02:00
892644a44c Preliminary fix for bad level calls to WM job functions from BKE.
The job invocation should happen only in editors/. Also it makes sense
to modify the bake operator such that it supports both the basic cache
library and an optional modifier output.

The design for this area is in progress anyway, probably the cache
library archive paths will be changed so that there is always one input
and optionally an output path, with all the modifiers working in
sequence.
2015-03-30 12:39:06 +02:00
ccb51e6db4 Removed unused code for ill-defined "cache objects".
The cache libraries now work based on dupli objects instead of
recursive group content, so this concept is no longer needed.
2015-03-30 12:39:06 +02:00
297bbc316a Simplified functions for generating absolute file paths from the base
cache library and modifiers.
2015-03-30 12:39:06 +02:00
2a12013600 Sanity check: motion state data in curves is optional. 2015-03-30 12:39:06 +02:00
aff4e02df2 Write out the complete dupli group in cache modifiers.
Theoretically we could write a stitcher that writes only the parts of
the data affected by a modifier and simply copies the rest, but this
is much more involved and not necessary at this point.
2015-03-30 12:39:06 +02:00
d694058fcf Merge branch 'master' into gooseberry 2015-03-30 15:07:24 +05:00
df714d0144 Merge branch 'alembic' into gooseberry 2015-03-30 14:15:19 +05:00
66e6fe54ac Merge branch 'master' into gooseberry 2015-03-30 14:00:28 +05:00
d7ddffdcce Merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_physics_smoke.py
	source/blender/editors/include/ED_transform.h
	source/blender/editors/space_view3d/view3d_intern.h
2015-03-30 13:50:59 +05:00
f1f51c07f4 Alebic: Fix compilation error of blenderplayer target on buildbot 2015-03-30 13:43:14 +05:00
803ff1a2f9 Writer for strand data and extension for the new motion state data.
Unlike the particle hair writer this one does not work with the particle
system data but the new Strands data. This will allow successive
manipulations of cached hair data by first storing the initial particle
grooming data ("hair edit"), read this data from the cache into a
Strands instance, then apply hair simulation and write the result back
into a second Strands cache.
2015-03-29 20:25:40 +02:00
a54ce3d26a Added optional motion state data to Strands.
This implements the distinction between the strand goal position
(grooming data, shape keys) and the result of dynamics simulation.
2015-03-29 20:23:54 +02:00
cf7b4e3054 Baking API for cache modifiers.
Cache baking means the cache modifier should read input caches over the
given frame range and produce the correct output for writing into the
output cache file.

Cache modifiers can optionally implement a 'bake' function. This is used
through a bake operator from the cache modifier panel. Baking is
executed in a job, which will help with cancelling bakes and displaying
status info.
2015-03-29 18:23:11 +02:00
a5180abde0 Merge branch 'alembic' into gooseberry 2015-03-27 17:27:11 +01:00
5fb18b1e00 Avoid clearing the record of cached frames when doing particle trails.
This is implemented badly: when using disk caches i reads the *entire*
cache from the disk to create the trail. In the process it also clears
the cached_frames array, which makes it look like the cache was deleted.
2015-03-27 14:55:25 +01:00
a93d4da344 Merge branch 'master' into gooseberry 2015-03-27 11:39:53 +01:00
e9df0e53d1 Use the last valid cache modifier output file for reading into the
dupli cache.

This makes the cache modifier stack work more like actual modifiers:
Each will take the previous result and write it into its own output
file. The last output is the final result used for viewport display.
2015-03-27 11:20:55 +01:00
89ea3e73ee New modifier system for cache libraries.
This system imitates the modifier stack for mesh objects. It will be
used to handle simulations and similar processing of cached data.
2015-03-27 11:20:55 +01:00
49cf27d39e Smoke sim option for emitting color based on particle textures.
When using a particle inflow object, there is now an option "Set Color"
which uses particle texture color to override the uniform smoke emission
color.

Particles must have one or more textures with the "Color" influence
enabled (the resulting color can be visualized in the viewport using the
"Texture" display option). The color will then replace the default smoke
flow setting and allows variable color per particle.

Combined with "Strand/Particle" texture mapping this can also be used
to change the particle emission color over the lifetime of particles or
make variable colors for each particle in the system.

Note that this currently does not work with child particles.
2015-03-27 10:36:48 +01:00
db92aac478 Particle color influence option for particle textures.
This color is currently only displayed in the viewport (when enabling
"Texture" color mode in the Display settings). It will be used for
controlling the smoke color when using particles for smoke emission.
2015-03-27 10:36:48 +01:00
3dd78fc48f quiet warnings (increase int size for bitshift) 2015-03-27 04:32:08 +11:00
ef7755bacb Merge branch 'master' into gooseberry 2015-03-26 17:54:47 +01:00
8362dd7c36 Cleanup: style 2015-03-27 03:40:10 +11:00
207bccef45 Merge branch 'master' into alembic 2015-03-27 03:27:11 +11:00
a4a74ca143 Merge branch 'alembic' into gooseberry 2015-03-26 14:55:15 +01:00
7a9492db9f Merge branch 'master' into gooseberry 2015-03-26 14:50:50 +01:00
567b78944e Minor naming conflict fix. 2015-03-26 14:45:32 +01:00
06f1b66175 Alembic: correct last commit 2015-03-26 14:13:43 +01:00
0a9b21b76c Alembic: cleanup warnings 2015-03-26 14:13:43 +01:00
def2be6be5 Alembic: expose CMake var ALEMBIC_INCLUDE_DIR
The include path could be cached to a stale value, with no obvious way to reset.
2015-03-26 14:13:43 +01:00
fb2b9ea3b4 Customdata caching for CD_ORIGSPACE_MLOOP. 2015-03-26 14:13:43 +01:00
786af9d7d9 Customdata caching for CD_ORCO. 2015-03-26 14:13:43 +01:00
475a6bdb36 Basic drawing code for strands loaded from caches.
This is entirely separate from particle systems and their insane
drawing function.
2015-03-26 14:13:43 +01:00
ecc28ae46d Simplified data structure and reading code for strands in Alembic
caches.
2015-03-26 14:13:43 +01:00
ec4e32fdea Fix wrong time sampling in customdata array properties.
The time sampling should be specified explicitly when creating
properties.
2015-03-26 14:13:43 +01:00
a0697b9b0f Explicit CD type masks for each element.
Avoid storing redundant normals for vertices.
2015-03-26 14:13:43 +01:00
64f1532f55 Fix for crash when deleting an object that was used in a dupli cache.
Object-unlink was clearing the linked object's dupli cache instead of
the duplicator.
2015-03-26 14:13:43 +01:00
aa8c33e6ab Make sure normals are correct before writing mesh data to caches.
Normal data layers might not be updated during cache baking
automatically.
2015-03-26 14:13:43 +01:00
b8d7b55726 New data structure for restoring strand data originating from particles.
The rationale here is that we don't try to replace particle data
temporarily like we do with DerivedMesh. This would be needed for
drawing cached data overrides in the viewport and pass them to renderers
(unless these read Alembic directly) and later for performing dupli
simulation.
2015-03-26 14:13:43 +01:00
abcdb0f7e4 Renamed the cache_dm to simply dm.
The fact that this is used for caching is only apparent on the higher
levels of the Object struct.
2015-03-26 14:13:43 +01:00
4dc7114e43 Write basic hair curves to caches for dupli groups.
This data will be used for dupli simulations later on. Child path
generation could also be done based on this data without involvement of
particle systems.
2015-03-26 14:13:42 +01:00
44d1c19f82 More compact sample writing code for particle pathcache caching. 2015-03-26 14:13:42 +01:00
962739281e Make the nested DM writer in Object writers a pointer, instead of using
the do_mesh flag.

This will be more in line with how optional particle system writer will
be created.
2015-03-26 14:13:42 +01:00
2a10d77a22 Revert "Avoid conflicting unordered_map definition in cycles"
This seems to break windows builds and should not be necessary.

This reverts commit 12384d564f.
2015-03-26 14:13:42 +01:00
2eaf0fd723 Fix for use of non-portable function snprintf. 2015-03-26 14:13:42 +01:00
44b516fa6a Fix for use of unknown uint type instead of unsigned int. 2015-03-26 14:13:42 +01:00
b2a004ddaf Use a stub factory when Alembic is disabled to avoid invalid pointer
access.
2015-03-26 14:13:42 +01:00
590fa47360 Fix for linking order in scons preventing correct initialization of
the Alembic caching implementation.
2015-03-26 14:13:42 +01:00
e715de6394 Added Alembic dependency config to the linux x86_64 player buildbot file. 2015-03-26 14:13:42 +01:00
f354fa56b5 Fix for bf_pointcache lib missing in the blenderplayer and fix for link
order.
2015-03-26 14:13:42 +01:00
1e93189351 Missing include path for scons build files of the gameengine player. 2015-03-26 14:13:42 +01:00
66b25f72c4 Missing library linking in the blenderplayer. 2015-03-26 14:13:42 +01:00
b41ffbea51 Stub function for Alembic init when Alembic is not enabled. 2015-03-26 14:13:42 +01:00
22309a0be6 Use dupli overrides also for the selection drawing code.
Now clicking a cached dupli instance also selects the duplicator object
as expected.
2015-03-26 14:13:41 +01:00
b122777ce7 Use dupli cache in bounding box calculations involving duplis.
This feature is mostly useful for the "view selected" operator. It is
also used in the "set origin to geometry" operator, but since the
cache overrides the object geometry anyway the effect may not be what
users expect (which is acceptable).
2015-03-26 14:13:41 +01:00
d4f48ffc63 Simple mesh import from Alembic files in Cycles standalone.
Note that Cycles currently only supports tessellated triangle/quad
meshes. Alembic PolyMesh generally has ngons, so external tessellation
is required until cycles gets a proper tessellation implementation of
its own.
2015-03-26 14:13:41 +01:00
ad85c05ae2 More control over verbosity with Alembic archive info printing. 2015-03-26 14:13:41 +01:00
902a747f60 Simple inclusion of alembic files from inside xml files for cycles
standalone.

The cycles XML files now can refer to Alembic (.abc) files. This will
call the default alembic reader to read in scene data. Currently it
simply prints the Alembic file structure.

Eventually a proper schema needs to be defined for both xml and abc.
Also care has to be taken to handle potential conflicts between settings
both within xml/abc and between them.
2015-03-26 14:13:41 +01:00
0742817088 Basic Alembic integration in the Cycles standalone.
This adds Alembic to the standalone application version of cycles.
Files can be specified as XML or Alembic, or use automatic detection
based on the filename extension.

Currently the Alembic reader just dumps the file structure to stdout
as a test.
2015-03-26 14:13:41 +01:00
d1d98c23ee Fix for cycles cmake missing GLEW library variable when building without
the GUI.
2015-03-26 14:13:41 +01:00
64a7d76bd8 Avoid conflicting unordered_map definition in cycles by using a general
include path instead of the boost one.

For explanation see http://stackoverflow.com/questions/3973659/c-unordered-map-compiling-issue-with-g
2015-03-26 14:13:41 +01:00
fc5858b320 Fix for corruption of the item hash table in cache libraries on copy. 2015-03-26 14:13:41 +01:00
84ccc6a3c0 Take cache library items into account when baking caches.
This means we don't bluntly store all the data in a group, but use the
selection from the cache library. It also helps to avoid issues with
object visibility which is not yet stored in the cache.
2015-03-26 14:13:41 +01:00
bb2fd946ec Working implementation of cache reading for dupli data during renders. 2015-03-26 14:13:41 +01:00
fce1a01f7b Use the temporary 'is_dupli' flag to prevent objects from freeing
overriden data that is owned by the cache.

This is not at all nice ... Hopefully it doesn't get too complicated to
work around all these drawing code and depsgraph issues, so the code
can be understood and replaced at some point in the future.
2015-03-26 14:13:41 +01:00
da44371fdf Replacing boundbox temporarily during drawing is dangerous, since it
can be freed at any point.

Luckily we only need the boundbox locally for testing dupli visibility.
2015-03-26 14:13:40 +01:00
7a771a6c34 Fully reset the OB_FROM_DUPLI flag for each dupli instance, in case
later duplis can not be found in the cache.
2015-03-26 14:13:40 +01:00
dccc3e62e7 Distinguish realtime/render setting in the Object writer.
Now the derived_render mesh version is created locally when writing
render results.
2015-03-26 14:13:40 +01:00
1ad78297ca Combined storage of render and realtime data in caches.
Caches now create 2 new roots below the main 'top' object of Alembic:
root and root_render for realtime and render data respectively.
This makes it easy to switch the whole archive to either of the modes
during baking and for constructing dupli caches.

Alternatively individual objects could store hires versions of their
data. This would also be more efficient if the cache contains many
simple objects which don't have 2 different variants. However, such
design decisions are difficult to make at this point and the
implementation can be modifier later.
2015-03-26 14:13:40 +01:00
b8c29051f9 Make sure the cache baking job cancels properly when interrupted in the
first stage.
2015-03-26 14:13:40 +01:00
14d401ac12 Allow cache libraries to store both render and realtime (viewport) data.
This is the default now. It should make workflow a lot more foolproof
and convenient, since having only one of these modes active at a time
very easily leads to broken renders and confusing situations.

The problem is mostly due to the complicated way the depsgraph layer
feature is used to handle duplicator visibility. The duplicator is
declared as a child of its group's objects (even though no real
dependency exists!), so that a visible duplicator triggers updates of
invisible group objects, making instances of hidden groups possible.

However, dupli caches have to disable this dependency in order to avoid
unnecessary costly updates in hidden layers which are overridden by
cached data anyway. At the point where these dependencies are created
the evaluation context is unknown though, which means we cannot
distinguish between render and realtime evaluation for the purpose of
cache reading ...
2015-03-26 14:13:40 +01:00
17ccf6387c Removed deprecated code. 2015-03-26 14:13:40 +01:00
fe1ec0100d Make sure mesh data is really stored and reconstructed from the cache
entirely.

Also the code is much better structured now, moving toward a more
standardized sample/schema class definition.
2015-03-26 14:13:40 +01:00
e0f3d9250a CD_NORMAL support for mesh customdata caching. 2015-03-26 14:13:40 +01:00
640e3fd365 Fix for use of wrong CustomData for tessfaces. 2015-03-26 14:13:40 +01:00
b4f62f7866 Copy rgba components of MCol explicitly to the Alembic C4f type to avoid
potentially different ordering.
2015-03-26 14:13:40 +01:00
aeb4384d5a MCol customdata caching. 2015-03-26 14:13:40 +01:00
aef3dc4938 MTFACE customdata is not suitable or necessary for caching, so disable
it.
2015-03-26 14:13:40 +01:00
3a38ed914a Added customdata writers/readers for missing mesh edge, poly and loop
data.
2015-03-26 14:13:39 +01:00
f65b7c8377 UI cleanup and a bit nicer workflow by treating read/write mode like
an enum toggle.
2015-03-26 14:13:39 +01:00
84411eb190 Disable the bake operator if cache reading is enabled.
Re-baking cache results is not technically prohibited, but not useful
and allowing only read or write selectively gives a nicer workflow.
2015-03-26 14:13:39 +01:00
c5d1d174f2 Cycles support for dupli caches.
If a cache is read-enabled cycles will now use the cached mesh data
instead of dupli results.
2015-03-26 14:13:39 +01:00
aebc98e061 Skip drawing of particle systems (including hair) when using cache
duplis.

Particle systems can not be overridden from caches easily, there are too
many strings attached to the data and code to make this reliable.
Instead, a new simplified data structure for reading hair from caches
will be added, which replaces drawing and rendering of particle data.
The original particle data is not updated through duplis, so is usually
out of sync and should not be displayed.
2015-03-26 14:13:39 +01:00
cf5a4256a8 Main argument is no longer needed for cache reading, the cachelib is
now given explicitly.
2015-03-26 14:13:39 +01:00
ca8b8d9309 Removed unused variable. 2015-03-26 14:13:39 +01:00
b4295d1c8f Calculate bounding boxes for cached DMs to avoid visual popping when
using the original Object's bb.
2015-03-26 14:13:39 +01:00
850c47b5a8 Test for NULL archive pointer when writing as well.
This should not usually happen because the operator asks for permission
to delete the file prior to writing, but should be checked nevertheless.
2015-03-26 14:13:39 +01:00
0e70ddfe14 Safeguard against crashes from invalid Alembic file paths by returning
NULL archive pointers.

This allows writer/reader code to test against obvious archive errors
easily and is unmistakable.
2015-03-26 14:13:39 +01:00
f5b360b4da Fix for wrong ID code used in RNA->idcode mapping. 2015-03-26 14:13:39 +01:00
6589a564c9 Removed group pointer from cache libraries and use object->cachelib
pointer instead.

This change makes it possible to have group duplicators using different
versions of a cache.
2015-03-26 14:13:39 +01:00
790f8d935a Added a cache library pointer to objects as a replacement for CL->GR
pointers.

Relationship between CacheLibrary, duplicator Objects and Groups is
difficult. There are a number of somewhat conflicting goals:
- CacheLibraries write out data for objects and dupli groups. Multiple
  objects can be stored in the same cache: CL *->* GR
- Objects can override a dupli group with different caches: OB *->1 CL
- As before, each object can be the duplicator for one group: OB *->1 GR

To combine these requirements, the first relationship will be made
indirect. Only the Object -> Group/CacheLib relations are explicit
pointers in the DNA. For finding all objects contained in a cache
library the usual recursive DNA tagging system must then be used.
2015-03-26 14:13:38 +01:00
4950ea97dc Removed the now redundant "Read" toggle from cache libraries.
At this point the reading is toggled on the side of group duplicators.
2015-03-26 14:13:38 +01:00
4f91f81e02 Removed the explicit duplicache rebuild operator.
The cache is now updated on frame changes automatically, the operator
should no longer be needed.
2015-03-26 14:13:38 +01:00
ea5c140926 Removed unused deprecated functions for cache library. 2015-03-26 14:13:38 +01:00
869e11ef5a Sanity check for dupligroup caching functions. 2015-03-26 14:13:38 +01:00
0d3da1343c Use a new flag in duplicator objects to enable cache reading and avoid
unnecessary dependencies.

This flag will replace the current "read" mode on cache libraries.

Beside enabling cache reading, it also disables the current "fake"
dependencies between duplicators and their group objects. This is
exploiting the layer visibility mechanism in depsgraph to ensure that
animated group objects get evaluated when used by a visible duplicator,
even when they are not themselves visible. These dependencies cause
group object updates even if the duplicator is using cached results.
To avoid this unnecessary overhead and make caching worthwhile we
rebuild depsgraph without these relations when using the cache instead.
2015-03-26 14:13:38 +01:00
26b58bd151 Enable frame updates of duplicache through use of an invalidation flag. 2015-03-26 14:13:38 +01:00
124e00bf8a Disable additional depsgraph tagging through cache libraries.
This code is outdated due to changes in reading code and obscures some
genuine depsgraph behavior.
2015-03-26 14:13:38 +01:00
03ffed6fb1 Mesh overrides for duplis from cached Alembic data.
If a duplicator has cached data it will now replace the derivedFinal
mesh of objects with the cached version for drawing.

This is a compromise atm: It would be better to actually draw derived
meshes directly, so that we don't have to modify objects. Then we could
also have multiple different instances of the same orignal object
(in whatever way these might be defined). DNA Objects would then be
totally separate from duplis, but at this point the drawing and render
code makes this unfeasible.
2015-03-26 14:13:38 +01:00
9683f7aae1 Mesh storage and reading in child objects for dupligroups.
The layout of the Alembic files resembles the DNA structure in Blender:
- On the top level (under the top/root node) there are Abc::Objects for
  Blender ID datablocks (currently Object and Group)
- Objects store final data (DerivedMesh) and later simulation results
  etc.
- Groups store their full duplilists for instancing. Currently there is
  no recursive nesting of groups, since this would limit duplis to
  dupligroups and exclude e.g. duplifaces.

On reading the duplilist gets reconstructed and stored in the DupliCache
for a duplicator empty (the group instance). DerivedMesh data is stored
in a hash table for each instanciated object and can later replace
finalDM in drawing and rendering.
2015-03-26 14:13:38 +01:00
8db0e2b8c2 Simplification of the archive init functions in writers and readers.
Now the base types for readers/writers are not nominally forming the
interface any more (they may be removed entirely later). This makes
possible a cleaner init method directly in the Abc Writer/Reader
classes.

Further work may be required in this area.
2015-03-26 14:13:38 +01:00
ad2a8e7fd8 Moved the dupli cache reading code into a AbcDupligroupReader class.
This is more in line with how readers work in the Blender Alembic
implementation elsewhere.

Generally, readers are less persistent than writers: they are created
whenever cache results need to be updated (e.g. on frame changes) and
discarded afterward. Writers OTOH stay alive during the whole baking
job, since they keep the references to Alembic Writer instances and can
only be deleted once the writing for that part is done.
2015-03-26 14:13:37 +01:00
401b720531 Store and apply dupli object transforms in the Alembic cache.
Note that the cache stores dupli matrices without the final parent
transform, since it only knows about the group itself. The duplicator
obmat is applied to the duplis after reading the cache.
2015-03-26 14:13:37 +01:00
bdedd88d92 Handle dupli cache on object copy and freeing. 2015-03-26 14:13:37 +01:00
cc1ce64b02 Updated cache reading function for the new duplilist structure.
Now we store duplilists entirely inside a single alembic object for the
group. This allows using all the generated duplis, which would be
difficult if the alembic file had to define all the possible recursive
dupli relations that Blender allows, beside straightforward Group duplis.
2015-03-26 14:13:37 +01:00
e5940d0515 Use a nested Object writer to store the Object ID blocks used by dupli
lists.
2015-03-26 14:13:37 +01:00
75d83d954a Better dupligroup Alembic writer.
Uses the duplilist generated by Blender to define instances, instead of
recreating the group layout. This omits some information about actual
structure of the DNA, which might be useful later on. The main problem
is that the duplilist itself does not encode this, so it's a tradeoff
between either including the Group structure or omitting the other
dupli types, like face, vertex, particle duplis.
2015-03-26 14:13:37 +01:00
1a4f89029f Alternative dupli generator function for creating duplis in a group
without a specific parent.
2015-03-26 14:13:37 +01:00
b691dfdaa9 Some disabled code to enable automatic cache updates on every duplilist
creation call.

This is executed *a lot* (even for simple things such as viewport
panning), so the code is probably not suitable in this form. At least
it could do a frame comparison to avoid unnecessary updates.
2015-03-26 14:13:37 +01:00
31009f8919 Use a cached group only when a CacheLibrary is actually available.
Otherwise the regular duplilist generator is used.
2015-03-26 14:13:37 +01:00
da7a970e3b Replace usage of the procedural duplilist generation by cached duplilist. 2015-03-26 14:13:37 +01:00
4fd3943696 Store object pointers for the dupli objects we generate from caches.
This is necessary for the current viewport drawing and rendering code,
which expected each dupli instance to represent a copy of data in the
DNA.

The code maps base-level objects in the cache to DNA Objects inside the
dupligroup by name. Only objects that can be found in the blend data
will be allowed for DupliObjects.
2015-03-26 14:13:37 +01:00
607e0f0d52 Moved the DupliCache struct into DNA, it will be needed for drawing and
RNA access later.
2015-03-26 14:13:37 +01:00
b592669097 Simple operator to force rebuilding of a dupligroup cache.
This is a placeholder for proper depsgraph integration. Eventually frame
changes and some other updates should rebuild dupligroup caches
automatically using the depsgraph. Until then this operator is a quick
way to test the IO from caches and the further drawing and rendering
(TODO).
2015-03-26 14:13:37 +01:00
39af6d71cf Cache reading functions for constructing a nested dupligroup list based
on Alembic cache data.
2015-03-26 14:13:36 +01:00
c61c039f21 Include mesh writers in the cache writers list. 2015-03-26 14:13:36 +01:00
018f613c90 Removed unused code. 2015-03-26 14:13:36 +01:00
0fbad24bf2 Removed current implementation of cache reading from various parts of
BKE (DerivedMesh, particles, cloth).

The new cache implementation will be used for constructing dupli data
instead, bypassing the complexities of the modifier stack.

Conflicts:
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c

Conflicts:
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c
2015-03-26 14:13:34 +01:00
ad65238df7 Initial code to support dupli group instancing and overrides through
Alembic caches.

This creates representations (Abc::Object) for Blender Object and Group
datablocks in the Alembic files and uses Alembic instancing to define
the dupligroup hierarchy. This leads to a relatively flat hierarchy in
Alembic files:

Top -> Object/Group -> DerivedMesh/Particles/Hair/Cloth/Smoke/...

The dupligroup structure can not be represented by a hierarchical
structure such as the Alembic object nesting, because of the
many-to-many relationship between objects and groups (a group can
contain multiple objects, multiple objects can instance the same group).
Instead we use the instancing feature of Alembic to represent
dupligroups. This is created in 2 stages to ensure all the main ID
blocks have been serialized before creating references.
2015-03-26 14:13:08 +01:00
b82bf93000 Nicer info printing support for instances in Alembic files.
This now avoids repetition of internal instance structure.
2015-03-26 14:13:08 +01:00
e7a9635ed3 Fix for invalid ob->data access in case non-mesh objects are in the
cached group.
2015-03-26 14:13:08 +01:00
3c733e8eda Improved edge attribute caching.
Now edges should be fully restored from cache, fixing edge display.
2015-03-26 14:13:08 +01:00
e92c7ea9bb Omit hair path lengths for anything but the first sample.
We can safely assume that paths don't change their lengths. This might
safe some cache space.
2015-03-26 14:13:08 +01:00
1930d4b364 Fix for particle pathcache caching: have to check the psys->renderdata
pointer to figure out if we are evaluating with render settings.
2015-03-26 14:13:08 +01:00
d76746acde Fix for some archive checks to make sure we don't access invalid data.
This can happen if the archive file cannot be opened for some reason.
2015-03-26 14:13:08 +01:00
a60b289809 Implementation of MDeformVert customdata layers in Alembic. 2015-03-26 14:13:08 +01:00
07fbb0e25e Fix for name collisions in compound properties when writing CustomData.
This is not clearly documented for Alembic, but apparently properties
inside compounds still need to be name uniquely for the whole object.
This is somewhat involved for Blender's CustomData, because we have
5 different customdata elements for meshes (vert, edge, face, poly,
loop) and each of these can have the same types and multiple layers of
the same type ...
2015-03-26 14:13:08 +01:00
e6e058289d Fix for Alembic info printer printing to std::cout instead of the
internal stringstream.
2015-03-26 14:13:08 +01:00
2d3261754a Fix for potential size issue: need 64 bits for CustomDataMask types. 2015-03-26 14:13:08 +01:00
b17fdec19c Nicer error handling for unimplemented CustomData layer types.
Instead of failing an assert, simply print an error message and return
gracefully. We don't want Blender crashing because of this.
2015-03-26 14:13:08 +01:00
5d044d62e2 Ugly hack for caching code to deal with quirky modifier stack behavior.
CustomData layers are pruned by the CDDM_copy function when they have
CD_FLAG_NOCOPY set. This is based on later modifiers in the stack, which
can specify that they require certain data layers - but the caching
modifier itself should store only what is needed by later modifiers.
It means we cannot easily keep a full copy of the DM in the cache
modifier to writing into caches later.

For now the hackish solution is to temporarily disable NOCOPY flags when
copying the DM. This is really not nice and needs a better solution.
2015-03-26 14:13:08 +01:00
80e541e581 Support CD_ORIGSPACE layer caching.
This is needed by particles for distributions on meshes with changed
topology (which is of course broken).
2015-03-26 14:13:07 +01:00
78d00e5eeb Tessface customdata for derived mesh caching. 2015-03-26 14:13:07 +01:00
c409adf4c8 Support for CustomData in Alembic caches.
This is a skeleton feature that provides a general way of storing
CustomData types. Currently only ORIGINDEX layers are implemented, the
code is designed to make extension easy.

Storing CustomData layers in Alembic is a bit involved because the
complex structs often used as customdata need to be de-interleaved for
Alembic into a set of POD (plain-old-datatype) array properties.

In addition the property names should be unique, so that mapping abc
properties back to customdata layers is safe. This works by using 2
levels of compound properties: the first level stored per CD type
properties, with a number of properties for each layer of this type,
using either a name or index (for unnamed layers). The internal
properties can then in turn be compounds, if structs need to be
serialized into PODs.

Abc property readers/writers are created dynamically for the CustomData
compounds. This is necessary because we don't know in advance what kind
of data layers a DerivedMesh or other CD user will have, and this can
change each frame in theory. Alembic is easier with state data schemes,
but using it this way is possible (if somewhat cumbersome).
2015-03-26 14:13:07 +01:00
4f326e5987 Fix for cache item filtering: items can be part of the cache library
but disabled, in that case hide them as well.
2015-03-26 14:13:07 +01:00
d49c83eebf Fixed test for "render" eval mode for hair dynamics.
This is totally weird and convoluted, no idea if correct.

Conflicts:
	source/blender/blenkernel/intern/particle_system.c

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
2015-03-26 14:13:04 +01:00
98e0de16ab Removed the DM writer/reader from hair dynamics again, this is part of
the particle stuff and does not work.
2015-03-26 14:12:49 +01:00
eed8674c17 Archive Info operator for Cache Library archives.
This creates a string with information about all the objects and
properties contained within a (Alembic) archive, used by a cache
library.

The operator has 3 modes of presenting the info string:
- stdout, ie. printing to the terminal
- popup window (not very useful usually due to size limits and lack of
  scrolling)
- clipboard copy
2015-03-26 14:12:48 +01:00
38b0940a54 Use a combined class for hair dynamics for cloth and mesh data.
Particles store a copy of the DM internally as the emitter.
2015-03-26 14:12:48 +01:00
15e3298d54 Alembic: Fixes for linux buildbot and scons 2015-03-26 14:12:48 +01:00
ce6a8188c0 Depsgraph tagging function for cached objects.
This is necessary to trigger object data updates for indirectly linked
objects, which would otherwise not be evaluated.
2015-03-26 14:12:48 +01:00
9787f4bbaa Convenience feature: When linking a cache library, always default it to
'read' mode locally.

Linking a cache library is meant to be used for getting existing cache
data into a file.
2015-03-26 14:12:48 +01:00
43093f141a Left a comment in DerivedMesh.c explaining why the caching system has
to use the cumbersome cachedm pointer instead of virtual modifiers.
2015-03-26 14:12:48 +01:00
75e146f8a2 Use a dedicated input_dm pointer in the cache modifier to provide a mesh
result read from the cache.

Mixing this with the output_dm used for writing leads to undefined
situations where the DM was released but should actually be passed on.
2015-03-26 14:12:48 +01:00
8b67c63274 Use correct flag enums for checking render/viewport eval mode when
writing derived mesh caches.
2015-03-26 14:12:48 +01:00
a8a5785cc2 Fix for meaningless build error (no return value, can never happen). 2015-03-26 14:12:48 +01:00
39c4c37599 Minor fix for UI code showing cache items. 2015-03-26 14:12:48 +01:00
91ec385a0d Render/Viewport evaluation mode for cache libraries.
This designates a cache library to be used either for the viewport or
for renders. A "Render" cache library will evaluate modifiers with
render settings and a "Viewport" cache library will use viewport
(realtime) settings.

When reading the cache, the library will only be
used for the assigned purpose, i.e. a Render cache does not work for
viewport caching and vice-versa (although a cache can be baked for one
setting and then switched afterward).

Note that render results will never be visible in the realtime viewport
due to the way object evaluation is handled in Blender at this point
(render settings are only evaluated explicitly during renderer sync).

Conflicts:
	source/blender/blenkernel/intern/particle_system.c

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
2015-03-26 14:12:45 +01:00
81c720f76e Allow the cache bake operator to overwrite existing files, using a
confirm dialog.
2015-03-26 14:12:39 +01:00
359b3f7011 Removed now-unused util_path files from the pointcache lib.
Paths are constructed outside this module now. A valid absolute path
should always be provided through the API calls.
2015-03-26 14:12:39 +01:00
e46cce7fe9 Record and display the last result of cache reading in the cache library
items.
2015-03-26 14:12:39 +01:00
920ff67dea Free readers properly after applying cached data. 2015-03-26 14:12:39 +01:00
c4fe4b71ef Set reader/writer archive as a separate step outside the constructors.
This allows nicer creation of readers/writers //before// actually
opening the archive. This in turns can simplify code quite a bit.
2015-03-26 14:12:39 +01:00
76b999949d Moved functions for constructing readers/writers based on cache library
out of pointcache into blenkernel.

This is quite simple and repetitive and there is not need to have this
in the main pointcache/Alembic API. The code is mostly concerned with
logic of DNA data, so pointcache shouldn't have to deal with it.
2015-03-26 14:12:39 +01:00
0db1e01089 Ported archive filename constructor from pointcache library to BKE.
The pointcache library is now pretty much independent from ID blocks and
should not be responsible for handling file paths. The path construction
is also fairly straightforward now compared to the old point cache
system, with only basic conversion of relative to absolute paths for
loading archive files.
2015-03-26 14:12:39 +01:00
730e38279a Cache read result enum in DNA mirroring the internal pointcache results.
This can be stored in cache library items as an indicator of cache
reading state.
2015-03-26 14:12:39 +01:00
70a5fccfb4 Use a uiTemplate function for showing cache library items instead of
python code to unify symbols.

This is necessary because the operator for adding new items (as opposed
to the enable/disable button) cannot be shown with the same checkbox
button. The UI template function can display a custom button for the
operator, so the look becomes less confusing.
2015-03-26 14:12:38 +01:00
3e4cf67ef4 Nicer default filename for cache library paths.
This now appends a default extension based on the cache backend used.
At this point this is always Alembic (.abc) but would allow other
backend formats in the future.
2015-03-26 14:12:38 +01:00
03ac4af650 Improved filtering for cache library content.
In addition to the object name filtering, items in cache library groups
can now be filtered by type as well.

Existing items in the cache are always displayed, so as to not hide
important information (what gets stored in the cache). The filtering
is primarily a utility to simplify searching inside the group for things
that should be added to the cache.
2015-03-26 14:12:38 +01:00
8eeb5382d9 Use a generator in the python code to iterate over all the potential
cache library items.

This should ideally happen on the RNA side, but making the equivalent of
python generators in the RNA is really difficult.
2015-03-26 14:12:38 +01:00
07e7cdad8d Don't show mesh cache items for non-mesh objects. 2015-03-26 14:12:38 +01:00
9848f404fb Disabled collection properties for 'virtual' cache items in RNA.
This requires a better design and is not so easy to implement properly
within the limits of RNA definition. These collections don't physically
exist in the DNA, they are mainly utilities for looping over
//potential// items in a cache library. For now the python code has to
be adapted to only show valid items, until the RNA provides a good
solution.
2015-03-26 14:12:38 +01:00
89e0abb3e6 Generic validation function to help ensure that we don't add meaningless
items to a cache library.
2015-03-26 14:12:38 +01:00
4302580af9 Replaced use of the HDF5 Alembic backend by Ogawa.
Ogawa is replacing HDF5 as the new de-facto standard. Selecting either
should be more formalized and a user option, for now it's just hardcoded.
2015-03-26 14:12:38 +01:00
e1a17cea89 Filter utility for finding objects in a cache group faster.
This is a preliminary feature and implemented purely in python, to be
replaced later.
2015-03-26 14:12:38 +01:00
303997ea71 New 'read' flag to toggle reading of the CacheLibrary as a whole.
This is also used during the bake process to avoid confusion: The read
flag gets disabled for the baking cachelib, so that objects don't try
to read cache data that is supposed to be generated.
2015-03-26 14:12:38 +01:00
aa36820fa2 Delete operator for cache library datablocks.
CacheLibrary datablock has a generic unlink function now, but currently
nothing actually links to cache libs themselves, so it's empty. Still
good to keep this in mind for the future.
2015-03-26 14:12:38 +01:00
26bb16c833 Reader/Writer API functions for basic particles.
Also slightly renamed pathcache functions for consistency (use plural
'particles' instead of 'particle').
2015-03-26 14:12:38 +01:00
d20d2d78ee Removed deprecated and unused alembic API functions.
These are now implemented as virtual functions in the Factor class.
2015-03-26 14:12:38 +01:00
a593d05733 Fixes for scons build files. 2015-03-26 14:12:37 +01:00
0a2d0fb667 Fix for circular linker dependency with cache code library.
The `bf_pointcache_alembic` code is a separate library, to avoid
muddling up core code with alembic includes and preprocessor defines.
Alembic stuff only belongs strictly into alembic code and can be
disabled cleanly.

The `bf_pointcache` and `bf_pointcache_alembic` libraries had a circular
dependency, because the alembic implementation functions were called
directly. Now there is a "Factory" class to abstract the creation of
concrete implementations for readers and writers.
`bf_pointcache_alembic` defines this factory and is registered
//outside// of the core `bf_pointcache` lib, so there is no linker
circularity.
2015-03-26 14:12:37 +01:00
d50aa3b019 Removed unused thread mutex file from pointcache lib. 2015-03-26 14:12:37 +01:00
188cc9b12c Removed deprecated rna_pointcache.c file.
Scons was still compilling this, since it's source files are not
explicit.
2015-03-26 14:12:37 +01:00
2abbfea29f Fix for indirectly linked object pointers in cache libraries.
These must be made "extern" to avoid losing links on loading.
2015-03-26 14:12:37 +01:00
4fa4f54e00 Removed remaining 1 frame difference in archive storage.
This was an artifact from the previous way of mapping non-0 start frame
to time 0.0. Now we start at times > 0.0 to match with the start frame.
Both ways are possible, can be changed later if needed.
2015-03-26 14:12:37 +01:00
7a84204449 Fixed start frame mapping in Alembic archives.
Writers were always starting at time 0.0, which means that for start
frames > 1 the readers would always be off. Now match the writer start
frame to the actual Blender start frame.
2015-03-26 14:12:37 +01:00
1168ec39c7 Added poll function for the cache manager panel to prevent hiding in
Cycles render engine.

The "compat_engines" thingy really gets in the way here ...
2015-03-26 14:12:37 +01:00
61d6e50444 Cache reading for particle paths.
Conflicts:
	source/blender/blenkernel/intern/particle.c

Conflicts:
	source/blender/blenkernel/intern/particle.c
2015-03-26 14:12:33 +01:00
49485305d1 Fix for cache modifier linking and handling of the default case (no
cachd modifier).
2015-03-26 14:11:17 +01:00
b61334cc84 Changed implementation of the Cache modifier to work in tandem with the
cache library system.

The Cache modifier is now an optional "break point" of the modifier
stack:
- Without a cache modifier the stack works as before. Baking will write
  the final stack result. After baking the cache replaces the whole
  stack.
- With a cache modifier the stack result at the modifier's position is
  stored. The cache is then applied as the output of that modifier,
  skipping preceding modifiers. That way additional modifiers can be
  applied on top of the cache.
- When using multiple cache modifiers, only the last (active) one will
  be used, since all previous cache results would be discarded anyway.
2015-03-26 14:11:17 +01:00
29bf328e41 Replaced point cache in cloth modifiers (also hair) with the new caching
system.

Conflicts:
	source/blender/blenkernel/intern/cloth.c

Conflicts:
	source/blender/blenkernel/intern/cloth.c
2015-03-26 14:11:12 +01:00
e1e8b6e57e 'expand' function for cache libraries, so link/append makes it load the
group and objects too.
2015-03-26 14:10:35 +01:00
a5e717f1d4 Make cache libraries a linkable data block. 2015-03-26 14:10:35 +01:00
dc655c4ee6 Take NULL object pointers in cache items into account.
This can happen if an object gets deleted or isn't loaded for some
reason. The item should just be ignored in that case and removed at the
next opportunity (cleanup function).
2015-03-26 14:10:35 +01:00
87bf9ee25e When using the "new cache library" operator, enable fake user by
default.

Nothing actually links to a cache library at this point (and probably
won't in the future), so fake user is necessary to avoid losing data.
2015-03-26 14:10:35 +01:00
083597eb69 Display cache library name and fake user button, imitating template_ID. 2015-03-26 14:10:35 +01:00
5ada4a5502 Importing of caches into Blender data.
Currently only implemented for DerivedMesh.
This replaces the `final_dm` calculation of the modifier stack with the
result from cache loading.
2015-03-26 14:10:35 +01:00
228a3fd4dc UI fixes, draw bake operator button only once at the top. 2015-03-26 14:10:35 +01:00
45a1bd8054 Hair path writer needs 2 different variants for parent/child hairs. 2015-03-26 14:10:35 +01:00
8dce165500 Added writers for derived mesh result and hair paths. 2015-03-26 14:10:35 +01:00
490a775fa7 Use explicit name strings for all readers/writers in the cache instead
of constructing names internally.

This helps prevent name collisions and guarantees a consistent naming
scheme for putting multiple items in the same cache.
2015-03-26 14:10:35 +01:00
46f15b3ea9 New reader/writer for DerivedMesh.
Used as a base for existing PointCacheModifier classes, but can be used
on its own.
2015-03-26 14:10:35 +01:00
0eaff16da8 General support for export to/import from Alembic files based on Cache
Libraries.
2015-03-26 14:10:34 +01:00
2146d7b9c9 Deleted unimplemented parts of the previous pointcache system, to make
refactoring simpler.

Since the new approach is not tied to the old set of point cache data
types there is really no need to carry their empty husks around. Once
the new caching system is defined in detail we can add back whatever
makes sense.
2015-03-26 14:10:34 +01:00
ae4f0c33c6 Disabled specialized Point Cache modifier handling in the modifier
stack, this will be replaced and is not correct anyway.
2015-03-26 14:10:34 +01:00
01a1c34d91 Refactoring of archive handling in readers/writers.
Now instead of each reader/writer creating its own archive, the archive
is created by the caller in advance and passed as a constructor
argument. This means that multiple items can be stored together in the
same archive.
2015-03-26 14:10:34 +01:00
6ca19d7aa9 Removed unused Scene pointer from the base Reader/Writer classes. 2015-03-26 14:10:34 +01:00
9bf48ec3cd Operator skeleton for a cache bake operator, using the job system. 2015-03-26 14:10:34 +01:00
3113f5cfe5 Fix for undefined return value. 2015-03-26 14:10:34 +01:00
babf2ca5d9 Removed unused line. 2015-03-26 14:10:34 +01:00
25d5856683 Unlink and cleanup functions when objects or the cached group get
unlinked or changed.
2015-03-26 14:10:34 +01:00
eb79cb0c84 Make sure cache item pointers are lib-linked correctly. 2015-03-26 14:10:34 +01:00
1c14dccb5e Name string construction for cache items, to use as a unique identifier
in the cache library.
2015-03-26 14:10:34 +01:00
efa3b04ddf Draw some UI buttons for all the current cache item types. 2015-03-26 14:10:33 +01:00
8393bb1f41 Updated hash table for lookup of enabled cache items and added basic
UI support.
2015-03-26 14:10:33 +01:00
8afec0b6d6 Improved collections in RNA for looping over potential caching items
in the object group.
2015-03-26 14:10:33 +01:00
bb86cdb738 Define a collection of "object_caches" in the CacheLibrary RNA for
iterating over all objects eligible for caching in the group.

This allows for nested dupligroup instances as well. All objects that
are instantiated at least once by any group can be included in the
respective cache, but get represented only once because the cached data
is the same anyway.
2015-03-26 14:10:33 +01:00
095403be92 Link main CacheLibrary pointers in readfile. 2015-03-26 14:10:33 +01:00
b2b8cbf2b6 Simplified cache item path description, based on plain ID blocks with
subtype/index.

This omits possible instancing and recursion by dupli groups, but since
the data of instances is always the same in Blender at this point, there
is little need to take them into account for caching.

At some point in the future it may become desirable to store full dupli
hierarchies in the cache, but it doesn't make sense to try to design a
fully-fledged path descriptor for this hypothetical case now.
2015-03-26 14:10:33 +01:00
6b3a64b81b BKE functions for managing cache content based on a group.
This uses a complete hierarchy of group instances, based on a path
hierarchy (object names).

Putting
2015-03-26 14:10:33 +01:00
4f13290574 Simple cache manager panel UI in the scene buttons.
This is mostly a simple and unintrusive placeholder to have some way of
making caches accessible, but needs some more thought.
2015-03-26 14:10:33 +01:00
f8612bccf3 Group pointer property for cache libraries to associate them with an
object group.

This is somewhat experimental, eventually we may want to link to Objects
instead, or allow multiple cache targets for the same cache, etc.
2015-03-26 14:10:33 +01:00
505fe4ff8c Missing include. 2015-03-26 14:10:33 +01:00
983ef57353 Removed meaningless comment. 2015-03-26 14:10:33 +01:00
e9efdae466 New operator for adding cache libraries.
Conflicts:
	release/scripts/startup/bl_ui/properties_physics_common.py
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/editors/physics/physics_ops.c
	source/blender/editors/physics/physics_pointcache.c
2015-03-26 14:10:33 +01:00
51bd9beb1b New ID datablock 'CacheLibrary', for managing physical cache archives
and files.

At it's core this is just a file path, but many different cache users
may refer to this, so having a dedicated ID block helps. It can be
compared to Image datablocks, which also primarily are used for data
on storage, but can be packed with the blend file, and carry some
additional information that would be cumbersome to keep sync'ed
otherwise.

The name 'CacheLibrary' deliberately resembles the 'Library' datablock:
just as a Library stores ID blocks in a physical file, a CacheLibrary
stores cached data (in Alembic HDF5/Ogawa or other formats).

Conflicts:
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/makesdna/DNA_pointcache_types.h

Conflicts:
	source/blender/makesrna/intern/rna_main_api.c
2015-03-26 14:10:33 +01:00
2483e50093 Fix for remaining PointCache references in the alembic code.
Now, for the time being, uses a simple relative "//blendcache/" folder
path again. This will be adressed later.
2015-03-26 14:10:32 +01:00
9e3c7ca085 PointCache modifier to act as a terminator in modifier stacks.
When writing DerivedMesh data, the modifier result at the point of the
modifier will be used for writing to the cache. If this modifier is not
used the derivedFinal mesh is used instead.
2015-03-26 14:10:32 +01:00
b91059f7a1 Cache API for export/import of Blender data to/from Alembic files.
The pointcache API is designed to keep the general concept of caching
separate from the concrete Alembic implementation. Other types of file
export/import would be possible, e.g. for OpenVDB data.
2015-03-26 14:10:32 +01:00
d402042a77 Initial Alembic library integration for Blender.
Adds Alembic as a dependency and build support in cmake and scons.

Also extends the install_deps.sh script with a temporary installation
procedure for the Alembic libraries. This is still very hackish and
needs to be improved.
2015-03-26 14:10:32 +01:00
71bd43a589 Merge branch 'master' into gooseberry 2015-03-26 14:01:43 +01:00
7c08e7fcdf Revert "Better fix for animation returning negative values when AVsynch is on,"
This reverts commit 459b1a907c.
2015-03-26 14:01:22 +01:00
7d035bcba1 Alembic: correct last commit 2015-03-26 21:06:40 +11:00
88218c4d44 Alembic: cleanup warnings 2015-03-26 21:04:52 +11:00
c34e4d57fd Alembic: expose CMake var ALEMBIC_INCLUDE_DIR
The include path could be cached to a stale value, with no obvious way to reset.
2015-03-26 21:00:24 +11:00
ad3e6ecfb4 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/render/render_opengl.c
2015-03-25 20:10:02 +01:00
465819af4f Customdata caching for CD_ORIGSPACE_MLOOP. 2015-03-25 18:57:52 +01:00
e1273f7d79 Customdata caching for CD_ORCO. 2015-03-25 18:44:56 +01:00
b690f220e2 Basic drawing code for strands loaded from caches.
This is entirely separate from particle systems and their insane
drawing function.
2015-03-25 18:07:03 +01:00
aebc04ec1f Smoke cache offset (start frame) feature.
This lets users set a start frame at which a cached smoke simulation
starts. This offset is simply subtracted from the current scene frame
for evaluating the cache.
2015-03-25 15:58:47 +01:00
be72ad615a Simplified data structure and reading code for strands in Alembic
caches.
2015-03-25 15:08:02 +01:00
d92b6cba67 Revert "Disable cuda binaries on the buildbot for the gooseberry branch."
This reverts commit 83da7b1edb.
2015-03-25 14:46:30 +01:00
83da7b1edb Disable cuda binaries on the buildbot for the gooseberry branch.
Doing this increases build times too much for fast updates.
2015-03-25 14:44:47 +01:00
2891298ad2 Fix wrong time sampling in customdata array properties.
The time sampling should be specified explicitly when creating
properties.
2015-03-25 13:35:52 +01:00
7f822bb4dd Merge branch 'master' into gooseberry
Conflicts:
	source/blender/gpu/intern/gpu_buffers.c
2015-03-25 12:39:38 +01:00
0561e18f81 Explicit CD type masks for each element.
Avoid storing redundant normals for vertices.
2015-03-25 10:32:57 +01:00
c86606eeba Fix for crash when deleting an object that was used in a dupli cache.
Object-unlink was clearing the linked object's dupli cache instead of
the duplicator.
2015-03-24 18:17:22 +01:00
0113a3c27c Make sure normals are correct before writing mesh data to caches.
Normal data layers might not be updated during cache baking
automatically.
2015-03-24 18:02:36 +01:00
53ac275ace New data structure for restoring strand data originating from particles.
The rationale here is that we don't try to replace particle data
temporarily like we do with DerivedMesh. This would be needed for
drawing cached data overrides in the viewport and pass them to renderers
(unless these read Alembic directly) and later for performing dupli
simulation.
2015-03-24 17:50:46 +01:00
4be32cf007 Renamed the cache_dm to simply dm.
The fact that this is used for caching is only apparent on the higher
levels of the Object struct.
2015-03-24 15:28:12 +01:00
bf047cb850 Write basic hair curves to caches for dupli groups.
This data will be used for dupli simulations later on. Child path
generation could also be done based on this data without involvement of
particle systems.
2015-03-24 12:57:30 +01:00
d82be1df11 More compact sample writing code for particle pathcache caching. 2015-03-24 12:19:08 +01:00
972e9fd23e Make the nested DM writer in Object writers a pointer, instead of using
the do_mesh flag.

This will be more in line with how optional particle system writer will
be created.
2015-03-24 11:26:07 +01:00
5f392bbad3 Revert "Avoid conflicting unordered_map definition in cycles"
This seems to break windows builds and should not be necessary.

This reverts commit 12384d564f.
2015-03-24 11:03:38 +01:00
fe457ddbee Fix for use of non-portable function snprintf. 2015-03-24 09:40:42 +01:00
dedc0c5d0f Fix for use of unknown uint type instead of unsigned int. 2015-03-24 09:29:53 +01:00
c4fe6fe945 Use a stub factory when Alembic is disabled to avoid invalid pointer
access.
2015-03-23 18:11:28 +01:00
876c8e2267 Fix for linking order in scons preventing correct initialization of
the Alembic caching implementation.
2015-03-23 18:04:19 +01:00
a06cb41772 Added Alembic dependency config to the linux x86_64 player buildbot file. 2015-03-23 16:01:56 +01:00
f8bde3c0a3 Fix for bf_pointcache lib missing in the blenderplayer and fix for link
order.
2015-03-23 16:00:57 +01:00
4d5e41280e Missing include path for scons build files of the gameengine player. 2015-03-23 15:04:47 +01:00
0febcc745a Missing library linking in the blenderplayer. 2015-03-23 14:09:05 +01:00
5f2e5ffd18 Merge branch 'master' into gooseberry 2015-03-23 13:59:50 +01:00
d54f93463f Stub function for Alembic init when Alembic is not enabled. 2015-03-23 13:31:16 +01:00
da89029856 Use dupli overrides also for the selection drawing code.
Now clicking a cached dupli instance also selects the duplicator object
as expected.
2015-03-23 12:46:34 +01:00
8d76a2f418 Use dupli cache in bounding box calculations involving duplis.
This feature is mostly useful for the "view selected" operator. It is
also used in the "set origin to geometry" operator, but since the
cache overrides the object geometry anyway the effect may not be what
users expect (which is acceptable).
2015-03-23 12:46:33 +01:00
379e54b818 Simple mesh import from Alembic files in Cycles standalone.
Note that Cycles currently only supports tessellated triangle/quad
meshes. Alembic PolyMesh generally has ngons, so external tessellation
is required until cycles gets a proper tessellation implementation of
its own.
2015-03-23 12:46:33 +01:00
c7c9fd5218 More control over verbosity with Alembic archive info printing. 2015-03-23 12:46:33 +01:00
4ef7ad13fa Simple inclusion of alembic files from inside xml files for cycles
standalone.

The cycles XML files now can refer to Alembic (.abc) files. This will
call the default alembic reader to read in scene data. Currently it
simply prints the Alembic file structure.

Eventually a proper schema needs to be defined for both xml and abc.
Also care has to be taken to handle potential conflicts between settings
both within xml/abc and between them.
2015-03-23 12:46:33 +01:00
351f1e1ebf Basic Alembic integration in the Cycles standalone.
This adds Alembic to the standalone application version of cycles.
Files can be specified as XML or Alembic, or use automatic detection
based on the filename extension.

Currently the Alembic reader just dumps the file structure to stdout
as a test.
2015-03-23 12:46:33 +01:00
8d68336344 Fix for cycles cmake missing GLEW library variable when building without
the GUI.
2015-03-23 12:46:33 +01:00
12384d564f Avoid conflicting unordered_map definition in cycles by using a general
include path instead of the boost one.

For explanation see http://stackoverflow.com/questions/3973659/c-unordered-map-compiling-issue-with-g
2015-03-23 12:46:33 +01:00
d91a144305 Fix for corruption of the item hash table in cache libraries on copy. 2015-03-23 12:46:33 +01:00
7335a20091 Take cache library items into account when baking caches.
This means we don't bluntly store all the data in a group, but use the
selection from the cache library. It also helps to avoid issues with
object visibility which is not yet stored in the cache.
2015-03-23 12:46:33 +01:00
40b817c7d4 Working implementation of cache reading for dupli data during renders. 2015-03-23 12:46:33 +01:00
129ab67f2e Use the temporary 'is_dupli' flag to prevent objects from freeing
overriden data that is owned by the cache.

This is not at all nice ... Hopefully it doesn't get too complicated to
work around all these drawing code and depsgraph issues, so the code
can be understood and replaced at some point in the future.
2015-03-23 12:46:33 +01:00
d3eb022b10 Replacing boundbox temporarily during drawing is dangerous, since it
can be freed at any point.

Luckily we only need the boundbox locally for testing dupli visibility.
2015-03-23 12:46:32 +01:00
26bd70ed8c Fully reset the OB_FROM_DUPLI flag for each dupli instance, in case
later duplis can not be found in the cache.
2015-03-23 12:46:32 +01:00
f092792284 Distinguish realtime/render setting in the Object writer.
Now the derived_render mesh version is created locally when writing
render results.
2015-03-23 12:46:32 +01:00
88718c7252 Combined storage of render and realtime data in caches.
Caches now create 2 new roots below the main 'top' object of Alembic:
root and root_render for realtime and render data respectively.
This makes it easy to switch the whole archive to either of the modes
during baking and for constructing dupli caches.

Alternatively individual objects could store hires versions of their
data. This would also be more efficient if the cache contains many
simple objects which don't have 2 different variants. However, such
design decisions are difficult to make at this point and the
implementation can be modifier later.
2015-03-23 12:46:32 +01:00
168867f3b0 Make sure the cache baking job cancels properly when interrupted in the
first stage.
2015-03-23 12:46:32 +01:00
4a6e331915 Allow cache libraries to store both render and realtime (viewport) data.
This is the default now. It should make workflow a lot more foolproof
and convenient, since having only one of these modes active at a time
very easily leads to broken renders and confusing situations.

The problem is mostly due to the complicated way the depsgraph layer
feature is used to handle duplicator visibility. The duplicator is
declared as a child of its group's objects (even though no real
dependency exists!), so that a visible duplicator triggers updates of
invisible group objects, making instances of hidden groups possible.

However, dupli caches have to disable this dependency in order to avoid
unnecessary costly updates in hidden layers which are overridden by
cached data anyway. At the point where these dependencies are created
the evaluation context is unknown though, which means we cannot
distinguish between render and realtime evaluation for the purpose of
cache reading ...
2015-03-23 12:46:32 +01:00
0dd01668b4 Removed deprecated code. 2015-03-23 12:46:32 +01:00
834ac256f4 Make sure mesh data is really stored and reconstructed from the cache
entirely.

Also the code is much better structured now, moving toward a more
standardized sample/schema class definition.
2015-03-23 12:46:32 +01:00
be72e44548 CD_NORMAL support for mesh customdata caching. 2015-03-23 12:46:32 +01:00
9adbeed82c Fix for use of wrong CustomData for tessfaces. 2015-03-23 12:46:32 +01:00
7343aa5e0e Copy rgba components of MCol explicitly to the Alembic C4f type to avoid
potentially different ordering.
2015-03-23 12:46:32 +01:00
a30be4c277 MCol customdata caching. 2015-03-23 12:46:32 +01:00
9baf925d2b MTFACE customdata is not suitable or necessary for caching, so disable
it.
2015-03-23 12:46:31 +01:00
266c99334d Added customdata writers/readers for missing mesh edge, poly and loop
data.
2015-03-23 12:46:31 +01:00
c053f0a53d UI cleanup and a bit nicer workflow by treating read/write mode like
an enum toggle.
2015-03-23 12:46:31 +01:00
19c5b3c61c Disable the bake operator if cache reading is enabled.
Re-baking cache results is not technically prohibited, but not useful
and allowing only read or write selectively gives a nicer workflow.
2015-03-23 12:46:31 +01:00
edf089a572 Cycles support for dupli caches.
If a cache is read-enabled cycles will now use the cached mesh data
instead of dupli results.
2015-03-23 12:46:31 +01:00
a86067888e Skip drawing of particle systems (including hair) when using cache
duplis.

Particle systems can not be overridden from caches easily, there are too
many strings attached to the data and code to make this reliable.
Instead, a new simplified data structure for reading hair from caches
will be added, which replaces drawing and rendering of particle data.
The original particle data is not updated through duplis, so is usually
out of sync and should not be displayed.
2015-03-23 12:46:31 +01:00
657cc3575a Main argument is no longer needed for cache reading, the cachelib is
now given explicitly.
2015-03-23 12:46:31 +01:00
ca0fcba43d Removed unused variable. 2015-03-23 12:46:31 +01:00
f161bb5912 Calculate bounding boxes for cached DMs to avoid visual popping when
using the original Object's bb.
2015-03-23 12:46:31 +01:00
542b40ae73 Test for NULL archive pointer when writing as well.
This should not usually happen because the operator asks for permission
to delete the file prior to writing, but should be checked nevertheless.
2015-03-23 12:46:31 +01:00
a85928466f Safeguard against crashes from invalid Alembic file paths by returning
NULL archive pointers.

This allows writer/reader code to test against obvious archive errors
easily and is unmistakable.
2015-03-23 12:46:31 +01:00
d0128f7c7c Fix for wrong ID code used in RNA->idcode mapping. 2015-03-23 12:46:30 +01:00
c9d7056f76 Removed group pointer from cache libraries and use object->cachelib
pointer instead.

This change makes it possible to have group duplicators using different
versions of a cache.
2015-03-23 12:46:30 +01:00
4959b2b30a Added a cache library pointer to objects as a replacement for CL->GR
pointers.

Relationship between CacheLibrary, duplicator Objects and Groups is
difficult. There are a number of somewhat conflicting goals:
- CacheLibraries write out data for objects and dupli groups. Multiple
  objects can be stored in the same cache: CL *->* GR
- Objects can override a dupli group with different caches: OB *->1 CL
- As before, each object can be the duplicator for one group: OB *->1 GR

To combine these requirements, the first relationship will be made
indirect. Only the Object -> Group/CacheLib relations are explicit
pointers in the DNA. For finding all objects contained in a cache
library the usual recursive DNA tagging system must then be used.
2015-03-23 12:46:30 +01:00
6f3e220d58 Removed the now redundant "Read" toggle from cache libraries.
At this point the reading is toggled on the side of group duplicators.
2015-03-23 12:46:30 +01:00
eb37ae59f2 Removed the explicit duplicache rebuild operator.
The cache is now updated on frame changes automatically, the operator
should no longer be needed.
2015-03-23 12:46:30 +01:00
f1b4f4900b Removed unused deprecated functions for cache library. 2015-03-23 12:46:30 +01:00
6860bfbe35 Sanity check for dupligroup caching functions. 2015-03-23 12:46:30 +01:00
0142bdb1ad Use a new flag in duplicator objects to enable cache reading and avoid
unnecessary dependencies.

This flag will replace the current "read" mode on cache libraries.

Beside enabling cache reading, it also disables the current "fake"
dependencies between duplicators and their group objects. This is
exploiting the layer visibility mechanism in depsgraph to ensure that
animated group objects get evaluated when used by a visible duplicator,
even when they are not themselves visible. These dependencies cause
group object updates even if the duplicator is using cached results.
To avoid this unnecessary overhead and make caching worthwhile we
rebuild depsgraph without these relations when using the cache instead.
2015-03-23 12:46:30 +01:00
c2012a68b8 Enable frame updates of duplicache through use of an invalidation flag. 2015-03-23 12:46:30 +01:00
78709abd10 Disable additional depsgraph tagging through cache libraries.
This code is outdated due to changes in reading code and obscures some
genuine depsgraph behavior.
2015-03-23 12:46:30 +01:00
667fcac696 Mesh overrides for duplis from cached Alembic data.
If a duplicator has cached data it will now replace the derivedFinal
mesh of objects with the cached version for drawing.

This is a compromise atm: It would be better to actually draw derived
meshes directly, so that we don't have to modify objects. Then we could
also have multiple different instances of the same orignal object
(in whatever way these might be defined). DNA Objects would then be
totally separate from duplis, but at this point the drawing and render
code makes this unfeasible.
2015-03-23 12:46:30 +01:00
bcca4e5676 Mesh storage and reading in child objects for dupligroups.
The layout of the Alembic files resembles the DNA structure in Blender:
- On the top level (under the top/root node) there are Abc::Objects for
  Blender ID datablocks (currently Object and Group)
- Objects store final data (DerivedMesh) and later simulation results
  etc.
- Groups store their full duplilists for instancing. Currently there is
  no recursive nesting of groups, since this would limit duplis to
  dupligroups and exclude e.g. duplifaces.

On reading the duplilist gets reconstructed and stored in the DupliCache
for a duplicator empty (the group instance). DerivedMesh data is stored
in a hash table for each instanciated object and can later replace
finalDM in drawing and rendering.
2015-03-23 12:46:30 +01:00
fe143aaeb3 Simplification of the archive init functions in writers and readers.
Now the base types for readers/writers are not nominally forming the
interface any more (they may be removed entirely later). This makes
possible a cleaner init method directly in the Abc Writer/Reader
classes.

Further work may be required in this area.
2015-03-23 12:46:29 +01:00
f3e5bd94db Moved the dupli cache reading code into a AbcDupligroupReader class.
This is more in line with how readers work in the Blender Alembic
implementation elsewhere.

Generally, readers are less persistent than writers: they are created
whenever cache results need to be updated (e.g. on frame changes) and
discarded afterward. Writers OTOH stay alive during the whole baking
job, since they keep the references to Alembic Writer instances and can
only be deleted once the writing for that part is done.
2015-03-23 12:46:29 +01:00
3b83c585e2 Store and apply dupli object transforms in the Alembic cache.
Note that the cache stores dupli matrices without the final parent
transform, since it only knows about the group itself. The duplicator
obmat is applied to the duplis after reading the cache.
2015-03-23 12:46:29 +01:00
da381bb948 Handle dupli cache on object copy and freeing. 2015-03-23 12:46:29 +01:00
ca2756dbc3 Updated cache reading function for the new duplilist structure.
Now we store duplilists entirely inside a single alembic object for the
group. This allows using all the generated duplis, which would be
difficult if the alembic file had to define all the possible recursive
dupli relations that Blender allows, beside straightforward Group duplis.
2015-03-23 12:46:29 +01:00
bdcf91615d Use a nested Object writer to store the Object ID blocks used by dupli
lists.
2015-03-23 12:46:29 +01:00
f1fde1f4fb Better dupligroup Alembic writer.
Uses the duplilist generated by Blender to define instances, instead of
recreating the group layout. This omits some information about actual
structure of the DNA, which might be useful later on. The main problem
is that the duplilist itself does not encode this, so it's a tradeoff
between either including the Group structure or omitting the other
dupli types, like face, vertex, particle duplis.
2015-03-23 12:46:29 +01:00
c71768d864 Alternative dupli generator function for creating duplis in a group
without a specific parent.
2015-03-23 12:46:29 +01:00
a40efb7810 Some disabled code to enable automatic cache updates on every duplilist
creation call.

This is executed *a lot* (even for simple things such as viewport
panning), so the code is probably not suitable in this form. At least
it could do a frame comparison to avoid unnecessary updates.
2015-03-23 12:46:29 +01:00
11828eb1e5 Use a cached group only when a CacheLibrary is actually available.
Otherwise the regular duplilist generator is used.
2015-03-23 12:46:29 +01:00
57bd99124d Replace usage of the procedural duplilist generation by cached duplilist. 2015-03-23 12:46:29 +01:00
64b6bf3a26 Store object pointers for the dupli objects we generate from caches.
This is necessary for the current viewport drawing and rendering code,
which expected each dupli instance to represent a copy of data in the
DNA.

The code maps base-level objects in the cache to DNA Objects inside the
dupligroup by name. Only objects that can be found in the blend data
will be allowed for DupliObjects.
2015-03-23 12:46:28 +01:00
caaf794642 Moved the DupliCache struct into DNA, it will be needed for drawing and
RNA access later.
2015-03-23 12:46:28 +01:00
5bc204d8f4 Simple operator to force rebuilding of a dupligroup cache.
This is a placeholder for proper depsgraph integration. Eventually frame
changes and some other updates should rebuild dupligroup caches
automatically using the depsgraph. Until then this operator is a quick
way to test the IO from caches and the further drawing and rendering
(TODO).
2015-03-23 12:46:28 +01:00
0ff8990e13 Cache reading functions for constructing a nested dupligroup list based
on Alembic cache data.
2015-03-23 12:46:28 +01:00
70b56ec378 Include mesh writers in the cache writers list. 2015-03-23 12:46:28 +01:00
2786cb8c13 Removed unused code. 2015-03-23 12:46:28 +01:00
6ff214d938 Removed current implementation of cache reading from various parts of
BKE (DerivedMesh, particles, cloth).

The new cache implementation will be used for constructing dupli data
instead, bypassing the complexities of the modifier stack.

Conflicts:
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c
2015-03-23 12:45:48 +01:00
9146dcfda7 Initial code to support dupli group instancing and overrides through
Alembic caches.

This creates representations (Abc::Object) for Blender Object and Group
datablocks in the Alembic files and uses Alembic instancing to define
the dupligroup hierarchy. This leads to a relatively flat hierarchy in
Alembic files:

Top -> Object/Group -> DerivedMesh/Particles/Hair/Cloth/Smoke/...

The dupligroup structure can not be represented by a hierarchical
structure such as the Alembic object nesting, because of the
many-to-many relationship between objects and groups (a group can
contain multiple objects, multiple objects can instance the same group).
Instead we use the instancing feature of Alembic to represent
dupligroups. This is created in 2 stages to ensure all the main ID
blocks have been serialized before creating references.
2015-03-23 12:23:38 +01:00
62ec8251e4 Nicer info printing support for instances in Alembic files.
This now avoids repetition of internal instance structure.
2015-03-23 12:23:38 +01:00
becc6432b5 Fix for invalid ob->data access in case non-mesh objects are in the
cached group.
2015-03-23 12:23:38 +01:00
a17db9b8c1 Improved edge attribute caching.
Now edges should be fully restored from cache, fixing edge display.
2015-03-23 12:23:38 +01:00
c761b512d4 Omit hair path lengths for anything but the first sample.
We can safely assume that paths don't change their lengths. This might
safe some cache space.
2015-03-23 12:23:38 +01:00
daef0f0d00 Fix for particle pathcache caching: have to check the psys->renderdata
pointer to figure out if we are evaluating with render settings.
2015-03-23 12:23:38 +01:00
467a19c6ef Fix for some archive checks to make sure we don't access invalid data.
This can happen if the archive file cannot be opened for some reason.
2015-03-23 12:23:37 +01:00
1b7ff83152 Implementation of MDeformVert customdata layers in Alembic. 2015-03-23 12:23:37 +01:00
fc22692394 Fix for name collisions in compound properties when writing CustomData.
This is not clearly documented for Alembic, but apparently properties
inside compounds still need to be name uniquely for the whole object.
This is somewhat involved for Blender's CustomData, because we have
5 different customdata elements for meshes (vert, edge, face, poly,
loop) and each of these can have the same types and multiple layers of
the same type ...
2015-03-23 12:23:37 +01:00
8519ec96d7 Fix for Alembic info printer printing to std::cout instead of the
internal stringstream.
2015-03-23 12:23:37 +01:00
12497e457c Fix for potential size issue: need 64 bits for CustomDataMask types. 2015-03-23 12:23:37 +01:00
d483a5b1db Nicer error handling for unimplemented CustomData layer types.
Instead of failing an assert, simply print an error message and return
gracefully. We don't want Blender crashing because of this.
2015-03-23 12:23:37 +01:00
e39af0806d Ugly hack for caching code to deal with quirky modifier stack behavior.
CustomData layers are pruned by the CDDM_copy function when they have
CD_FLAG_NOCOPY set. This is based on later modifiers in the stack, which
can specify that they require certain data layers - but the caching
modifier itself should store only what is needed by later modifiers.
It means we cannot easily keep a full copy of the DM in the cache
modifier to writing into caches later.

For now the hackish solution is to temporarily disable NOCOPY flags when
copying the DM. This is really not nice and needs a better solution.
2015-03-23 12:23:37 +01:00
43a09876e9 Support CD_ORIGSPACE layer caching.
This is needed by particles for distributions on meshes with changed
topology (which is of course broken).
2015-03-23 12:23:37 +01:00
f5de2c6693 Tessface customdata for derived mesh caching. 2015-03-23 12:23:37 +01:00
ec998c9cf5 Support for CustomData in Alembic caches.
This is a skeleton feature that provides a general way of storing
CustomData types. Currently only ORIGINDEX layers are implemented, the
code is designed to make extension easy.

Storing CustomData layers in Alembic is a bit involved because the
complex structs often used as customdata need to be de-interleaved for
Alembic into a set of POD (plain-old-datatype) array properties.

In addition the property names should be unique, so that mapping abc
properties back to customdata layers is safe. This works by using 2
levels of compound properties: the first level stored per CD type
properties, with a number of properties for each layer of this type,
using either a name or index (for unnamed layers). The internal
properties can then in turn be compounds, if structs need to be
serialized into PODs.

Abc property readers/writers are created dynamically for the CustomData
compounds. This is necessary because we don't know in advance what kind
of data layers a DerivedMesh or other CD user will have, and this can
change each frame in theory. Alembic is easier with state data schemes,
but using it this way is possible (if somewhat cumbersome).
2015-03-23 12:23:37 +01:00
00edf75a62 Fix for cache item filtering: items can be part of the cache library
but disabled, in that case hide them as well.
2015-03-23 12:23:37 +01:00
1d0b6c6e7c Fixed test for "render" eval mode for hair dynamics.
This is totally weird and convoluted, no idea if correct.

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
2015-03-23 12:23:33 +01:00
99231fb9c3 Removed the DM writer/reader from hair dynamics again, this is part of
the particle stuff and does not work.
2015-03-23 12:23:22 +01:00
01bf0f37a7 Archive Info operator for Cache Library archives.
This creates a string with information about all the objects and
properties contained within a (Alembic) archive, used by a cache
library.

The operator has 3 modes of presenting the info string:
- stdout, ie. printing to the terminal
- popup window (not very useful usually due to size limits and lack of
  scrolling)
- clipboard copy
2015-03-23 12:23:22 +01:00
03fddef28a Use a combined class for hair dynamics for cloth and mesh data.
Particles store a copy of the DM internally as the emitter.
2015-03-23 12:23:21 +01:00
a9e1e240f4 Alembic: Fixes for linux buildbot and scons 2015-03-23 12:23:21 +01:00
61ee7c96d1 Depsgraph tagging function for cached objects.
This is necessary to trigger object data updates for indirectly linked
objects, which would otherwise not be evaluated.
2015-03-23 12:23:21 +01:00
8794a167a6 Convenience feature: When linking a cache library, always default it to
'read' mode locally.

Linking a cache library is meant to be used for getting existing cache
data into a file.
2015-03-23 12:23:21 +01:00
4a399119f3 Left a comment in DerivedMesh.c explaining why the caching system has
to use the cumbersome cachedm pointer instead of virtual modifiers.
2015-03-23 12:23:21 +01:00
46cd930df7 Use a dedicated input_dm pointer in the cache modifier to provide a mesh
result read from the cache.

Mixing this with the output_dm used for writing leads to undefined
situations where the DM was released but should actually be passed on.
2015-03-23 12:23:21 +01:00
028085e856 Use correct flag enums for checking render/viewport eval mode when
writing derived mesh caches.
2015-03-23 12:23:21 +01:00
1bfcc2d0de Fix for meaningless build error (no return value, can never happen). 2015-03-23 12:23:21 +01:00
f7d04e0d6a Minor fix for UI code showing cache items. 2015-03-23 12:23:21 +01:00
f63a70c6b0 Render/Viewport evaluation mode for cache libraries.
This designates a cache library to be used either for the viewport or
for renders. A "Render" cache library will evaluate modifiers with
render settings and a "Viewport" cache library will use viewport
(realtime) settings.

When reading the cache, the library will only be
used for the assigned purpose, i.e. a Render cache does not work for
viewport caching and vice-versa (although a cache can be baked for one
setting and then switched afterward).

Note that render results will never be visible in the realtime viewport
due to the way object evaluation is handled in Blender at this point
(render settings are only evaluated explicitly during renderer sync).

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
2015-03-23 12:23:18 +01:00
cc0cabaa95 Allow the cache bake operator to overwrite existing files, using a
confirm dialog.
2015-03-23 12:23:12 +01:00
d70519b284 Removed now-unused util_path files from the pointcache lib.
Paths are constructed outside this module now. A valid absolute path
should always be provided through the API calls.
2015-03-23 12:23:12 +01:00
90b97cfdc8 Record and display the last result of cache reading in the cache library
items.
2015-03-23 12:23:12 +01:00
92f6fb7650 Free readers properly after applying cached data. 2015-03-23 12:23:12 +01:00
f2a1508a86 Set reader/writer archive as a separate step outside the constructors.
This allows nicer creation of readers/writers //before// actually
opening the archive. This in turns can simplify code quite a bit.
2015-03-23 12:23:12 +01:00
2b9a4ca54e Moved functions for constructing readers/writers based on cache library
out of pointcache into blenkernel.

This is quite simple and repetitive and there is not need to have this
in the main pointcache/Alembic API. The code is mostly concerned with
logic of DNA data, so pointcache shouldn't have to deal with it.
2015-03-23 12:23:12 +01:00
7cb320ee61 Ported archive filename constructor from pointcache library to BKE.
The pointcache library is now pretty much independent from ID blocks and
should not be responsible for handling file paths. The path construction
is also fairly straightforward now compared to the old point cache
system, with only basic conversion of relative to absolute paths for
loading archive files.
2015-03-23 12:23:12 +01:00
d28353e9e2 Cache read result enum in DNA mirroring the internal pointcache results.
This can be stored in cache library items as an indicator of cache
reading state.
2015-03-23 12:23:12 +01:00
ee4c862926 Use a uiTemplate function for showing cache library items instead of
python code to unify symbols.

This is necessary because the operator for adding new items (as opposed
to the enable/disable button) cannot be shown with the same checkbox
button. The UI template function can display a custom button for the
operator, so the look becomes less confusing.
2015-03-23 12:23:12 +01:00
f000702532 Nicer default filename for cache library paths.
This now appends a default extension based on the cache backend used.
At this point this is always Alembic (.abc) but would allow other
backend formats in the future.
2015-03-23 12:23:12 +01:00
bc5cdd60d4 Improved filtering for cache library content.
In addition to the object name filtering, items in cache library groups
can now be filtered by type as well.

Existing items in the cache are always displayed, so as to not hide
important information (what gets stored in the cache). The filtering
is primarily a utility to simplify searching inside the group for things
that should be added to the cache.
2015-03-23 12:23:12 +01:00
f15e5d3e89 Use a generator in the python code to iterate over all the potential
cache library items.

This should ideally happen on the RNA side, but making the equivalent of
python generators in the RNA is really difficult.
2015-03-23 12:23:12 +01:00
bdc9a7d7f7 Don't show mesh cache items for non-mesh objects. 2015-03-23 12:23:11 +01:00
ad1fda1823 Disabled collection properties for 'virtual' cache items in RNA.
This requires a better design and is not so easy to implement properly
within the limits of RNA definition. These collections don't physically
exist in the DNA, they are mainly utilities for looping over
//potential// items in a cache library. For now the python code has to
be adapted to only show valid items, until the RNA provides a good
solution.
2015-03-23 12:23:11 +01:00
e9d947860a Generic validation function to help ensure that we don't add meaningless
items to a cache library.
2015-03-23 12:23:11 +01:00
15ce114a3b Replaced use of the HDF5 Alembic backend by Ogawa.
Ogawa is replacing HDF5 as the new de-facto standard. Selecting either
should be more formalized and a user option, for now it's just hardcoded.
2015-03-23 12:23:11 +01:00
b41c208e87 Filter utility for finding objects in a cache group faster.
This is a preliminary feature and implemented purely in python, to be
replaced later.
2015-03-23 12:23:11 +01:00
b94d8c93e7 New 'read' flag to toggle reading of the CacheLibrary as a whole.
This is also used during the bake process to avoid confusion: The read
flag gets disabled for the baking cachelib, so that objects don't try
to read cache data that is supposed to be generated.
2015-03-23 12:23:11 +01:00
8e76ac4744 Delete operator for cache library datablocks.
CacheLibrary datablock has a generic unlink function now, but currently
nothing actually links to cache libs themselves, so it's empty. Still
good to keep this in mind for the future.
2015-03-23 12:23:11 +01:00
4cec4d9d3c Reader/Writer API functions for basic particles.
Also slightly renamed pathcache functions for consistency (use plural
'particles' instead of 'particle').
2015-03-23 12:23:11 +01:00
4484761714 Removed deprecated and unused alembic API functions.
These are now implemented as virtual functions in the Factor class.
2015-03-23 12:23:11 +01:00
03f2e329bb Fixes for scons build files. 2015-03-23 12:23:11 +01:00
4f7bc3a7aa Fix for circular linker dependency with cache code library.
The `bf_pointcache_alembic` code is a separate library, to avoid
muddling up core code with alembic includes and preprocessor defines.
Alembic stuff only belongs strictly into alembic code and can be
disabled cleanly.

The `bf_pointcache` and `bf_pointcache_alembic` libraries had a circular
dependency, because the alembic implementation functions were called
directly. Now there is a "Factory" class to abstract the creation of
concrete implementations for readers and writers.
`bf_pointcache_alembic` defines this factory and is registered
//outside// of the core `bf_pointcache` lib, so there is no linker
circularity.
2015-03-23 12:23:11 +01:00
8618cd39d6 Removed unused thread mutex file from pointcache lib. 2015-03-23 12:23:10 +01:00
51d7c80a00 Removed deprecated rna_pointcache.c file.
Scons was still compilling this, since it's source files are not
explicit.
2015-03-23 12:23:10 +01:00
1106645500 Fix for indirectly linked object pointers in cache libraries.
These must be made "extern" to avoid losing links on loading.
2015-03-23 12:23:10 +01:00
a8a00074c1 Removed remaining 1 frame difference in archive storage.
This was an artifact from the previous way of mapping non-0 start frame
to time 0.0. Now we start at times > 0.0 to match with the start frame.
Both ways are possible, can be changed later if needed.
2015-03-23 12:23:10 +01:00
dc703cefbf Fixed start frame mapping in Alembic archives.
Writers were always starting at time 0.0, which means that for start
frames > 1 the readers would always be off. Now match the writer start
frame to the actual Blender start frame.
2015-03-23 12:23:10 +01:00
609ce89688 Added poll function for the cache manager panel to prevent hiding in
Cycles render engine.

The "compat_engines" thingy really gets in the way here ...
2015-03-23 12:23:10 +01:00
66f9cda5b3 Cache reading for particle paths.
Conflicts:
	source/blender/blenkernel/intern/particle.c
2015-03-23 12:23:07 +01:00
f0d8395191 Fix for cache modifier linking and handling of the default case (no
cachd modifier).
2015-03-23 12:22:59 +01:00
fccc665162 Changed implementation of the Cache modifier to work in tandem with the
cache library system.

The Cache modifier is now an optional "break point" of the modifier
stack:
- Without a cache modifier the stack works as before. Baking will write
  the final stack result. After baking the cache replaces the whole
  stack.
- With a cache modifier the stack result at the modifier's position is
  stored. The cache is then applied as the output of that modifier,
  skipping preceding modifiers. That way additional modifiers can be
  applied on top of the cache.
- When using multiple cache modifiers, only the last (active) one will
  be used, since all previous cache results would be discarded anyway.
2015-03-23 12:22:59 +01:00
b321526888 Replaced point cache in cloth modifiers (also hair) with the new caching
system.

Conflicts:
	source/blender/blenkernel/intern/cloth.c
2015-03-23 12:22:56 +01:00
267d37ce51 'expand' function for cache libraries, so link/append makes it load the
group and objects too.
2015-03-23 12:21:58 +01:00
ab6c48b935 Make cache libraries a linkable data block. 2015-03-23 12:21:58 +01:00
9e336362d8 Take NULL object pointers in cache items into account.
This can happen if an object gets deleted or isn't loaded for some
reason. The item should just be ignored in that case and removed at the
next opportunity (cleanup function).
2015-03-23 12:21:57 +01:00
c32587c103 When using the "new cache library" operator, enable fake user by
default.

Nothing actually links to a cache library at this point (and probably
won't in the future), so fake user is necessary to avoid losing data.
2015-03-23 12:21:57 +01:00
af671df3e1 Display cache library name and fake user button, imitating template_ID. 2015-03-23 12:21:57 +01:00
9bb0f55e3c Importing of caches into Blender data.
Currently only implemented for DerivedMesh.
This replaces the `final_dm` calculation of the modifier stack with the
result from cache loading.
2015-03-23 12:21:57 +01:00
982ea69660 UI fixes, draw bake operator button only once at the top. 2015-03-23 12:21:57 +01:00
173a104335 Hair path writer needs 2 different variants for parent/child hairs. 2015-03-23 12:21:57 +01:00
59db306770 Added writers for derived mesh result and hair paths. 2015-03-23 12:21:57 +01:00
8696000dd1 Use explicit name strings for all readers/writers in the cache instead
of constructing names internally.

This helps prevent name collisions and guarantees a consistent naming
scheme for putting multiple items in the same cache.
2015-03-23 12:21:57 +01:00
da1c8006f2 New reader/writer for DerivedMesh.
Used as a base for existing PointCacheModifier classes, but can be used
on its own.
2015-03-23 12:21:57 +01:00
df36ca1ff7 General support for export to/import from Alembic files based on Cache
Libraries.
2015-03-23 12:21:56 +01:00
3ddf2c232f Deleted unimplemented parts of the previous pointcache system, to make
refactoring simpler.

Since the new approach is not tied to the old set of point cache data
types there is really no need to carry their empty husks around. Once
the new caching system is defined in detail we can add back whatever
makes sense.
2015-03-23 12:21:56 +01:00
08e06cdaf7 Disabled specialized Point Cache modifier handling in the modifier
stack, this will be replaced and is not correct anyway.
2015-03-23 12:21:56 +01:00
a47ce4b04d Refactoring of archive handling in readers/writers.
Now instead of each reader/writer creating its own archive, the archive
is created by the caller in advance and passed as a constructor
argument. This means that multiple items can be stored together in the
same archive.
2015-03-23 12:21:56 +01:00
e0c8daa160 Removed unused Scene pointer from the base Reader/Writer classes. 2015-03-23 12:21:56 +01:00
091dc4ec7e Operator skeleton for a cache bake operator, using the job system. 2015-03-23 12:21:56 +01:00
ee550b2fc7 Fix for undefined return value. 2015-03-23 12:21:56 +01:00
e675d415d6 Removed unused line. 2015-03-23 12:21:29 +01:00
a73fa2e02c Unlink and cleanup functions when objects or the cached group get
unlinked or changed.
2015-03-23 12:21:29 +01:00
a12f53ab83 Make sure cache item pointers are lib-linked correctly. 2015-03-23 12:21:29 +01:00
eb6785112b Name string construction for cache items, to use as a unique identifier
in the cache library.
2015-03-23 12:21:29 +01:00
14f9a277ab Draw some UI buttons for all the current cache item types. 2015-03-23 12:21:29 +01:00
87dc360d7e Updated hash table for lookup of enabled cache items and added basic
UI support.
2015-03-23 12:21:28 +01:00
4683478db8 Improved collections in RNA for looping over potential caching items
in the object group.
2015-03-23 12:21:28 +01:00
6df11cdd3f Define a collection of "object_caches" in the CacheLibrary RNA for
iterating over all objects eligible for caching in the group.

This allows for nested dupligroup instances as well. All objects that
are instantiated at least once by any group can be included in the
respective cache, but get represented only once because the cached data
is the same anyway.
2015-03-23 12:21:28 +01:00
4e9d0af4af Link main CacheLibrary pointers in readfile. 2015-03-23 12:21:28 +01:00
c4d998ecad Simplified cache item path description, based on plain ID blocks with
subtype/index.

This omits possible instancing and recursion by dupli groups, but since
the data of instances is always the same in Blender at this point, there
is little need to take them into account for caching.

At some point in the future it may become desirable to store full dupli
hierarchies in the cache, but it doesn't make sense to try to design a
fully-fledged path descriptor for this hypothetical case now.
2015-03-23 12:21:28 +01:00
55b4652885 BKE functions for managing cache content based on a group.
This uses a complete hierarchy of group instances, based on a path
hierarchy (object names).

Putting
2015-03-23 12:21:28 +01:00
472d5b964a Simple cache manager panel UI in the scene buttons.
This is mostly a simple and unintrusive placeholder to have some way of
making caches accessible, but needs some more thought.
2015-03-23 12:21:28 +01:00
e6a6e5d17a Group pointer property for cache libraries to associate them with an
object group.

This is somewhat experimental, eventually we may want to link to Objects
instead, or allow multiple cache targets for the same cache, etc.
2015-03-23 12:21:28 +01:00
eec3e90cdb Missing include. 2015-03-23 12:21:28 +01:00
2fc6bdbd63 Removed meaningless comment. 2015-03-23 12:21:28 +01:00
ecd576e689 New operator for adding cache libraries.
Conflicts:
	release/scripts/startup/bl_ui/properties_physics_common.py
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/editors/physics/physics_ops.c
	source/blender/editors/physics/physics_pointcache.c
2015-03-23 12:21:27 +01:00
03ecd1760a New ID datablock 'CacheLibrary', for managing physical cache archives
and files.

At it's core this is just a file path, but many different cache users
may refer to this, so having a dedicated ID block helps. It can be
compared to Image datablocks, which also primarily are used for data
on storage, but can be packed with the blend file, and carry some
additional information that would be cumbersome to keep sync'ed
otherwise.

The name 'CacheLibrary' deliberately resembles the 'Library' datablock:
just as a Library stores ID blocks in a physical file, a CacheLibrary
stores cached data (in Alembic HDF5/Ogawa or other formats).

Conflicts:
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/makesdna/DNA_pointcache_types.h

Conflicts:
	source/blender/makesrna/intern/rna_main_api.c
2015-03-23 12:21:21 +01:00
bc56a3797e Fix for remaining PointCache references in the alembic code.
Now, for the time being, uses a simple relative "//blendcache/" folder
path again. This will be adressed later.
2015-03-23 12:20:22 +01:00
ab027c9a34 PointCache modifier to act as a terminator in modifier stacks.
When writing DerivedMesh data, the modifier result at the point of the
modifier will be used for writing to the cache. If this modifier is not
used the derivedFinal mesh is used instead.
2015-03-23 12:12:07 +01:00
6d94c2f57a Cache API for export/import of Blender data to/from Alembic files.
The pointcache API is designed to keep the general concept of caching
separate from the concrete Alembic implementation. Other types of file
export/import would be possible, e.g. for OpenVDB data.
2015-03-23 11:53:56 +01:00
0c6df47e7b Initial Alembic library integration for Blender.
Adds Alembic as a dependency and build support in cmake and scons.

Also extends the install_deps.sh script with a temporary installation
procedure for the Alembic libraries. This is still very hackish and
needs to be improved.
2015-03-23 11:53:05 +01:00
6d495cc4ef WIP Commit 2015-03-20 17:27:25 +01:00
b999ed2efd Merge branch 'master' into gooseberry 2015-03-20 16:36:34 +01:00
7e79651a56 Get rid of old panel for GPU depth of field settings 2015-03-20 15:56:49 +01:00
a568de8a83 Merge branch 'master' into gooseberry 2015-03-20 15:45:11 +01:00
004429761d Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_view3d.h
2015-03-17 11:07:03 +01:00
459b1a907c Better fix for animation returning negative values when AVsynch is on,
patch by Nexyon, thanks!
2015-03-16 11:50:17 +01:00
c3c2a3bbe8 Revert "Attempted fix for OpenAL synchronization."
This reverts commit d10e80fe79.
2015-03-16 11:45:59 +01:00
fc09d58127 Cleanup fcurve tags properly. 2015-03-13 16:47:45 +01:00
5d94e2d40b Stub API to add an object to motionpath processing job. 2015-03-13 16:12:23 +01:00
accfe0d3ed Object now also support proper undo 2015-03-13 15:17:11 +01:00
44f77072d6 Armatures support proper undo now. 2015-03-13 15:03:25 +01:00
779cf534af Keep keyframes on undo
WIP code to tag fcurves with existing keyframes on current frame so they
can be restored (inserted into) after cancelling tranform.
2015-03-13 14:44:26 +01:00
e1815ce69e Merge branch 'master' into gooseberry 2015-03-13 17:47:41 +05:00
d164634cc0 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-03-13 13:41:37 +01:00
07a29084a1 Cleanup: unused var 2015-03-13 02:04:03 +11:00
7a9428e110 Merge branch 'master' into gooseberry 2015-03-13 02:01:11 +11:00
0b3a652cd5 Only insert/delete keyframes automatically if the real time motionpath
update is on.
2015-03-12 11:27:24 +01:00
09d0516b4d Revert "Fix blenderplayer not compiling after modifier d&d commit"
This reverts commit 1a0e6336d6.
2015-03-11 19:08:30 +01:00
3f5b1e7989 Revert "Modifier Drag&Drop"
This reverts commit 91d0f6f113.

Artists here seem to dislike the interface being stuck after a change to
modifiers, reverting until an interactive solution is coded.
2015-03-11 19:07:40 +01:00
20d4047d22 Minor stuff 2015-03-09 18:17:28 +01:00
e4e62880d7 Remove inserted keyframes if transform was cancelled 2015-03-09 15:43:27 +01:00
8662dbee63 Merge branch 'gooseberry' into temp_motionpaths 2015-03-09 14:44:48 +01:00
6610bcb697 Don't push merge without building first fix. 2015-03-09 12:46:22 +01:00
3272c3a7a0 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-03-09 12:44:04 +01:00
8cad3e3581 Transform widget: Don't highlight rectangle (cursor should be enough
indication)
2015-03-09 12:41:54 +01:00
02c142e582 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/makesdna/DNA_view3d_types.h
2015-03-09 12:40:59 +01:00
Julian Eisel
1a0e6336d6 Fix blenderplayer not compiling after modifier d&d commit 2015-03-08 16:23:56 +01:00
Julian Eisel
91d0f6f113 Modifier Drag&Drop
**Warning: WIP!** Basic functionality works fine and there shouldn't be any crashes, however, if you occur issues, feel free to report them to me (not in the bug tracker!)

Some more effort is needed to get this ready for master, but I thought it would be nice as a little present for the Gooseberry-team (I heard some of you were requesting this?) and the ones using the Gooseberry-builds :)

Oh, and better not look at that code, it's ugly and a lot of changes are planned, I just wanted to get something working before getting into details.
2015-03-06 17:24:11 +01:00
7b426d2384 Fix issue reported on irc by Sebastian, crash when undoing and changing
screen.

Apparently the screen on the given file did not have a scene attached.

Not sure how this is possible exactly, but for now just guard against it
at load time by assigning default scene in that case.
2015-03-06 17:24:11 +01:00
d1794b897c Fix broken "force setting multisamples only once", introduced in b5b359b48f 2015-03-06 17:24:11 +01:00
a15b239adc Fix metaball->mesh removing all metas in the scene
Assumed the entire scene used the one motherball.
2015-03-06 17:24:11 +01:00
76c215249e Fix access freed memory when doing constraints ID counter on main free
Basically just made constraints free function aware of possible do_id_users
argument, same as we've got for objects, object data and so on.
2015-03-06 17:24:11 +01:00
77c70d4495 Fix T43905: Crash happens when press Create Plane Track
It was only happening on 32bit platforms because of alignment
differences when allocating class.

Now got rid of copy of eigen matricies stored by value in the
residual block which solves aligment issues and should also
give some unmeasurable speedup.
2015-03-06 17:24:11 +01:00
8be2775367 PyAPI: clarify fallback docstring 2015-03-06 17:24:10 +01:00
720599e7a8 Fix T43904: calc_vert_angle returns wrong value
This was mis-named, rename to `calc_edge_angle`
and allow a fallback value in the case when the vert doesn't have 2-edges.
2015-03-06 17:24:10 +01:00
c12ae10487 BMesh: Add extended BM_vert_calc_edge_angle that takes a fallback value 2015-03-06 17:24:10 +01:00
7acf48d2fe Cleanup: quiet minilzo warnings 2015-03-06 17:24:10 +01:00
f64ba6abfa Cleanup: unused warnings 2015-03-06 17:24:10 +01:00
b2d6443ed0 Cleanup: unused macro warning 2015-03-06 17:24:10 +01:00
14d30210eb Fix typo in "Add" and "Subtract" mode of Vector Math node.
Differential Revision: https://developer.blender.org/D1003
2015-03-06 17:24:10 +01:00
Julian Eisel
0d3ad6ef63 Correction to previous commit
Calling ensure_lookup_table for each face is stupid! :/
(Noted by Sergey - thx)
2015-03-06 17:24:10 +01:00
Julian Eisel
14298b2e7d Fix T43900: "Operator Mesh Add" template fails
Another script that was missing the lookup_table call.
2015-03-06 17:24:09 +01:00
7c61f548d6 Revert "COLLADA - support for shadeless material (SHADER_CONSTANT)"
This reverts commit 04b0a9f4b8.
2015-03-06 17:24:09 +01:00
d10e80fe79 Attempted fix for OpenAL synchronization.
This hit animators already, basically when using sound sync we can
hit negative frames. This happens because we always subtracted the full
range of the triple buffer size from the timing, even when buffers were
flushed.

Also, old code read the offset from the offset of the reader. The
problem here, is that due to threading there is a time offset between
the when this offset is set and when it is offloaded to the buffers,
which means that we could get quite some variance between time
reporting.

Now sounds keep a private byte offset which is incremented right before
invalidating old buffers. This should make the combination of OpenAL
time report + byte offset more accurate. For even more accuracy we might
spinlock while updating those values but for now left it as is for fear
of the lock interfering with frame update performance. We can try to be
smarter here, storing old value while update is happening, and use
trylock and the old values if it fails but for now commit the simple
version.
2015-03-06 17:22:54 +01:00
d9e703ef5d Merge branch 'master' into temp_motionpaths 2015-03-06 11:57:59 +01:00
bd56eca825 Merge branch 'master' into gooseberry 2015-03-05 19:15:31 +01:00
6c317fbcb9 Don't re-typedef structure in wm_types.h
This makes strict compilers to give quite a few of warnings.
2015-03-04 18:13:58 +05:00
02685aca52 Fix T43878: Applying non-constructive modifiers crashing blender
The issue was caused by recent DM to mesh conversion which was taking ownership,
and it was failing if there are any referenced layers in the custom data.

Now disable passing ownership if there are any referenced layers.
2015-03-04 18:06:21 +05:00
6ae390decc Merge branch 'gooseberry' into temp_motionpaths 2015-03-03 11:37:58 +01:00
3224749763 Merge branch 'master' into gooseberry 2015-03-03 23:09:31 +13:00
df33afff86 Enable motion curve update for armatures as well.
This is currently brute force updating, also disabled object copies
but it's likely that we'll need those to do threaded update of the
motionpaths.
2015-03-02 19:28:53 +01:00
cde74b2d5a Motion Paths real time update WIP 2015-03-02 17:53:00 +01:00
2cacb22422 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-03-01 15:41:10 +01:00
f5c9df75ad Merge branch 'master' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-03-01 12:42:35 +01:00
41d05dbf30 Merge branch 'cycles_memory' into gooseberry 2015-02-27 15:07:03 +01:00
d4386ee615 Fix blenderplayer 2015-02-27 15:06:45 +01:00
02acdead96 Merge branch 'cycles_memory' into gooseberry 2015-02-27 16:36:48 +05:00
136c8d1ae0 Add argument to DM_to_mesh() function to take ownership over the DM
The idea is pretty simple: instead of making temporary copy of all the
related custom data layers just pass the ownership from the DM to the
mesh.

This is really handy in cases when you've got DM which you need to
convert to Mesh datablock and wouldn't need that DM after conversion
anyway.

Foe example, render database conversion, exporters and even Modifier
Apply will benefit from this option.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1127
2015-02-27 16:27:56 +05:00
0ef8993fdc Merge branch 'cycles_memory' into gooseberry 2015-02-27 12:46:19 +05:00
30a324013a Merge branch 'master' into gooseberry 2015-02-27 12:00:48 +05:00
6320749361 Add an option to mesh.calc_tessface() to get rid of polygons and loops
The purpose of this change is to add extra possibility to render engines and
export scripts to reduce peak memory footprint during their operation.

This new argument should be used with care since it'll leave mesh in not really
compatible with blender format, but it's ok to be used on temp meshes.

Unfortunately, it's hard to get scene where it'll show huge benefit because
in my tests with cycles peak memory is reached in MEM_printmemlist_stats().

However, in the file with sintel dragon it gives around 1gig of memory benefit
after removing the polys which would allow other heavy to compute stuff such as
hair (or even pointiness calculation) to not be a peak memory usage.

In any case, this change is nice to have IMO, and only means more parts of
scene export code should be optimized memory-wise.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1125
2015-02-27 01:07:59 +05:00
79a5c97064 Cycles: Free caches used by the synchronized objects
Issue this commit is addressed to is that particle system and particle modifier
will contain caches once derived mesh was requested and this cached data will
never be freed.

This could easily lead to unwanted memory peaks during synchronization stage
of rendering.

The idea is to have RNA function in object which would free caches which can't
be freed otherwise. This function is not intended to deal with derived final
since it might be used by other objects (for example by object with boolean
modifier).

This cache freeing is only happening in the background rendering and locked
interface rendering.

From quick tests with victor file this change reduces peak memory usage by
command line rendering by around 6% (1780MB vs. 1883MB). For rendering from
the interface it's about 12% (1763MB vs. 1998MB).

Reviewers: campbellbarton, lukastoenne

Differential Revision: https://developer.blender.org/D1121
2015-02-27 01:01:07 +05:00
faf612f113 Fix for child particle clumping noise, using the orco parent location
for clumping instead of deformed location.

The orco location must be used for roughness to ensure a stable shape,
but for moving child keys toward the parent (clumping) the deformed
location must be used.
2015-02-26 12:40:14 +01:00
466c532ba6 RNA: correct limits 2015-02-26 15:53:28 +11:00
eb25547a84 Pointer property for selecting particle systems in the particle instance
modifier.

Internally the property is still an integer index, but using a pointer
with a dropdown is much more convenient.
2015-02-24 19:17:38 +01:00
d22699be69 Removed stupid limit of 10 on particle instance modifier psys index. 2015-02-24 18:49:48 +01:00
cfa92fcc6f Fix for clumping noise randomness being unstable under deformation.
This randomisation was using the deformed parent coordinates for
calculating noise vectors, which causes unwanted movement as the parent
hair deforms. Instead the `orco` coordinates must be used for all noise
vectors, since these are from the undeformed mesh.
2015-02-24 16:36:15 +01:00
5de381ce5b Merge branch 'master' into gooseberry 2015-02-23 18:50:10 +01:00
4887d4c52a Fix T43770, we were doing multiplication with object matrix and not
reverting the GL state.
2015-02-23 10:45:54 +01:00
e93ec66dd0 Experimental hair shape key control with textures.
Rationale for this feature goes like this:

In meshes the influence of shape keys can be limited to certain vertex
groups. This allows shapes to be applied selectively on parts of the
mesh and possibly even be animated by changing vertex group weights over
time.

With hair shape keys there is no equivalent feature to vertex groups
(defining a vertex group on hair keys would be rather tedious anyway).
It would be possible to use the emitter mesh vgroups to assign a
per-strand blending weight, but since hairs usually are much more dense
than mesh vertices this would sacrifice accuracy.

A better option is to allow textures to influence the hair shape key
blending. For this purpose there is now a new texture influence.
A shape key name needs to be assigned to the MTex in addition to a
factor. It will then act as a multiplier for the shape key weight,
i.e. the base shapekey value still works as an overall control.
2015-02-23 10:03:46 +01:00
bdf39274cd Disallow duplis when drawing motion paths, also make it so draw option
is on by default
2015-02-20 16:06:01 +01:00
bcf88bf242 Merge branch 'master' into gooseberry 2015-02-21 00:10:38 +11:00
a605d93128 Use new motionpath flag exlusively to draw motionpaths for objects 2015-02-19 19:00:51 +01:00
a44112a552 Don't draw motion paths for armatures in edit mode. Results in nice
crashes
2015-02-19 18:56:38 +01:00
bd1af1dc8e Hjalti's Motion Path commit series no 2.
Draw motionpaths after scene. They are not really XRays since they don't
require any depth info so add separate list for them. Feature could be a
little more polished to avoid too many state changes but for now just
commit something that works (tm)
2015-02-19 18:44:23 +01:00
78fb421f4b Merge branch 'master' into gooseberry 2015-02-19 22:20:12 +05:00
a9c3fb718f Hjalti's Motion Path commit series no 1.
Introduce global flag to draw motion paths. Always. Even in render only
mode :)
2015-02-19 18:09:45 +01:00
efe4f99a10 Projective painting: Only dither if factor is more than zero 2015-02-19 16:46:05 +01:00
1329843744 Fix T43735 painting on perpendicular to the screen polygons is
problematic (still!)

It seems due to floating point precision issues we have to account for
even more cases.

Added colinear check for one more triangle edge-vertex and assumed that
if no collision test is found then triangle is completely inside box.

Such cases are mostly from float precision not catching triangle just
outside bucket. Now tests are much better for simple tests (paint/flood
fill cube from ortho view, paint sphere), however there are still some
rare cases of stray pixels.
2015-02-19 16:38:56 +01:00
a199460495 Merge branch 'master' into gooseberry 2015-02-19 13:28:18 +01:00
3cb9ec1844 New option "use signed distance" for force fields with "surface" shape.
By default a surface-based force will push things away from the surface
in both directions, regardless of whether a point is "inside" or
"outside" (judging by the surface normal). The new option makes a force
field always push things away in the direction of the normal, so that
it becomes less likely to get points "trapped" inside a mesh object.
2015-02-18 12:22:59 +01:00
58ffd8beb3 Always make sure the surface modifier has tessfaces available for
building the BVH.

A long long time ago (rB3816554cbc1a40dc5199c8e56e45817ec09128d5) it
was coded such that edges would be used instead of faces for surface
distance calculation. This is pretty much never what you actually want.
2015-02-18 11:51:47 +01:00
17a4f326b0 Merge branch 'master' into gooseberry 2015-02-18 02:26:48 +05:00
fd0732b5fa Merge branch 'master' into gooseberry 2015-02-18 00:59:50 +05:00
d0da158ad5 Merge branch 'master' into gooseberry
Conflicts:
	intern/cycles/blender/blender_mesh.cpp
	source/blender/editors/space_view3d/view3d_draw.c
2015-02-17 15:24:23 +01:00
64e3661434 Store particle index and randomized value from particle instance
modifiers, for use in shaders.

The particle instance modifier can now store 2 custom data layers:
- Index: the integer index of the particle
- Value: a randomized floating point number for shader variation

These layers have user-defined names, so multiple particle instance
modifiers can be used without overwriting customdata layers. In Cycles
the data can be accessed using an Attribute node with the same names.
2015-02-16 14:30:07 +01:00
5a14dd7476 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-02-16 13:02:00 +01:00
84ea48d58b Painstakingly merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
	source/blender/blenkernel/BKE_camera.h
	source/blender/blenkernel/BKE_screen.h
	source/blender/blenkernel/intern/camera.c
	source/blender/blenkernel/intern/screen.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/blenloader/intern/writefile.c
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/render/render_opengl.c
	source/blender/editors/space_view3d/space_view3d.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/gpu/CMakeLists.txt
	source/blender/gpu/GPU_compositing.h
	source/blender/gpu/GPU_extensions.h
	source/blender/gpu/intern/gpu_compositing.c
	source/blender/gpu/intern/gpu_extensions.c
	source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
	source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
	source/blender/gpu/shaders/gpu_shader_fx_lib.glsl
	source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
	source/blender/gpu/shaders/gpu_shader_fx_vert.glsl
	source/blender/makesdna/DNA_camera_types.h
	source/blender/makesdna/DNA_gpu_types.h
	source/blender/makesdna/DNA_view3d_types.h
	source/blender/makesdna/intern/makesdna.c
	source/blender/makesrna/intern/rna_camera.c
	source/blender/makesrna/intern/rna_scene.c
	source/blender/makesrna/intern/rna_space.c
2015-02-13 12:48:36 +01:00
80ce3516cc Partial instancing feature for the ParticleInstance modifier.
This allows using the same particle system for multiple objects without
creating too much repetitiveness. Each instance object can select a
range of the particles to actually use for instancing (default 1.0 means
all particles are used). To further avoid overlap with multiple
instancing objects, the offset value can be used to make each system
use a specific range of particles.
2015-02-12 20:20:55 +01:00
ced2f75554 Merge branch 'master' into gooseberry 2015-02-11 20:01:51 +01:00
ab4eb7a714 Merge branch 'master' into gooseberry 2015-02-11 17:27:08 +01:00
ae7d197c93 Merge branch 'master' into gooseberry 2015-02-11 18:29:11 +05:00
9adb6daa8c Merge branch 'master' into gooseberry 2015-02-11 11:19:13 +01:00
81c56d15c7 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-02-11 11:07:08 +01:00
54a8e50dea Merge branch 'master' into gooseberry 2015-02-11 10:46:33 +11:00
88fc1a5c50 Minor optimization for mask modifier
- don't resize ghash buckets (reserve maximum size)
- get vert, edge arrays instead of DM getVert, getEdge
- calloc -> malloc
2015-02-11 10:46:17 +11:00
ca04eef4f2 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-02-11 00:29:31 +01:00
5cef36e6e2 Merge branch 'master' into gooseberry 2015-02-10 20:24:35 +01:00
fe610b7437 Merge branch 'master' into gooseberry 2015-02-10 17:40:46 +01:00
6f9982a13c Merge branch 'master' into gooseberry 2015-02-10 21:01:22 +05:00
1dba2cd025 Add second widget call in-scene 2015-02-10 16:12:26 +01:00
26a74c8e11 Fix error in last commit 2015-02-10 12:53:36 +01:00
748d9eca90 Separate widget drawing to update and draw phase to make in-scene widget
drawing possible (need to update once, draw twice).
2015-02-10 12:52:29 +01:00
1a33fb983b Support dupli transparency pass.
Only for gooseberry for now, since it's slightly hacky and adds extra
cost to duplis.
2015-02-10 10:57:39 +01:00
258c2286cd Merge branch 'master' into gooseberry 2015-02-10 13:19:17 +05:00
60927ae2e0 WIP code to use in scene drawing for widgets. 2015-02-09 17:52:39 +01:00
f1462c759f Fix warning in py code. 2015-02-09 14:47:45 +01:00
606de82218 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-02-09 14:30:12 +01:00
59dd3735bf Merge branch 'GPU_subsurf' into wiggly-widgets
Conflicts:
	source/blender/blenkernel/intern/subsurf_ccg.c
	source/blender/gpu/GPU_buffers.h
	source/blender/gpu/intern/gpu_buffers.c
2015-02-09 14:28:07 +01:00
d67d29035a Fix some ordering issues, remove leftover glBegin/glEnd 2015-02-09 14:23:58 +01:00
f07ca03185 Initial VBO code for GPU subsurf.
This commit adds a few generalizations to the VBO
code so that modifiers can create and populate their own GPU objects.

The VBO code originally supported CDDerivedMesh only. The design moves slightly
towards the viewport refactor where the rendering system requests data from the
modifiers.

In this commit only basic support for vertices and normals is provided and
some features from blender's VBO system, suchs as mapping to original faces,
unique element indices for vertices and loose vertex/edge support are missing.
Also, the quick navigation feature of the subsurf modifier won't be supported
for now.

What we do have is full support for solid shading with multiple materials,
flat/smooth shading and a big performance boost.
2015-02-09 14:19:03 +01:00
5186062d58 Integration of particle shapekeys with the depsgraph and driver eval.
It's a bit messy, but that is to be expected: all of the areas involved
(particles, shapekeys, depsgraph, drivers) are badly designed and
supposed to get major refactoring ...
2015-02-09 13:58:24 +01:00
a8b00f679a Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-02-09 11:57:34 +01:00
017e2fb284 Merge branch 'master' into gooseberry 2015-02-06 17:41:15 +01:00
56e2469030 Cleanup 2015-02-06 17:22:08 +01:00
93549d4225 Tabbing into (but not out of) scene strips is supported now 2015-02-06 17:08:51 +01:00
6794e4a8bf Bring back yet again no scaling for proxies (squashing to a merge commit is bad) 2015-02-06 16:45:03 +01:00
3de0722234 Merge branch 'master' into gooseberry 2015-02-06 16:44:03 +01:00
264e830a7d bring back no scaling for proxies 2015-02-06 16:43:05 +01:00
88e07b1397 Slip tool accepts numerical input. 2015-02-06 16:43:05 +01:00
0a02c15dbc Get rid of no scaling for proxies for master, it causes FX to crash,
will code another workaround for gooseberry.
2015-02-06 16:43:05 +01:00
julianeisel
840ec37b33 Graph Editor: Auto View
Auto View automatically adjusts the view based on selection, so that the view is
always focused on the current selection.
A checkbox in the header is used to access it and it works for the following
selection methods: Toggle All, Border, Circle, Lasso, Left, Right, More, Less,
Linked, Column (so all except of single selection, in which this can be a bit
annoying)

Reviewed by @Aligorith (thanks for that :) )
2015-02-06 16:43:05 +01:00
7263fbd7a6 Fix T43578: Beauty Triangulation would hang in infinite loop, due to float rpecision issue.
Only recompute if cost is below -FLT_EPSILON, we can get cases where both cases generate
very tiny negative costs (see 'Cylinder.004' mesh in .blend attached to report).
2015-02-06 16:43:04 +01:00
722894ee1b Speed hack for gooseberry:
Proxies get no effects for speed (since they haven't been scaled)
2015-02-06 16:01:09 +01:00
28587f9134 Merge branch 'master' into gooseberry 2015-02-06 14:31:20 +01:00
3efbb8777a Gooseberry: fix multires sculpting not updating normals
Looks like just a refactoring mistake in the Gooseberry branch.
2015-02-06 14:14:40 +01:00
12cb3a78f2 Merge branch 'master' into gooseberry 2015-02-06 12:57:04 +01:00
94e9742453 Print actual changed paths in the "make paths absolute" operator. 2015-02-06 12:18:32 +01:00
2fb86d80fc Add more info to the "make paths relative" operator to show which paths
where actually changed.
2015-02-06 12:09:22 +01:00
ef555380ba Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-02-05 15:32:36 +01:00
a9c3ddc617 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/object/object_intern.h
	source/blender/editors/object/object_ops.c
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/makesrna/intern/rna_object.c
2015-02-05 12:38:50 +01:00
bffa829b40 Move priority of widget handler back for node editor. Still not very
clean but should allow gooseberrians to work a little better
2015-02-05 12:29:37 +01:00
97053e034a Initialize dropboxes and widgets together before opening the homefile,
makes sure areas get their proper handlers registered
2015-02-05 12:15:23 +01:00
7414464e23 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/object/object_intern.h
	source/blender/editors/object/object_ops.c
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/makesdna/DNA_customdata_types.h
	source/blender/makesrna/intern/rna_object.c
2015-02-05 12:08:55 +01:00
6a0e403a17 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_image.h
	source/blender/blenkernel/intern/sequencer.c
	source/blender/imbuf/intern/anim_movie.c
2015-02-04 20:46:03 +01:00
bdb372338b Sequencer: Implement priority queue based on frame number instead of
memory size (Thanks to sergey for suggestion)
2015-02-04 18:14:31 +01:00
8f51baff85 Possibly dangerous feature - don't scale images if they come from a
proxy.
2015-02-04 18:14:31 +01:00
c8d5206082 New space enum option for the particle instance modifier, to chose which
space the particle data should be interpreted in.

By default the space will now be `Local`, meaning that copies of the
mesh are made with the offset of the respective particle in the particle
object's local space, rather than using the world space offset of the
particle //inside the modified object space//. This behavior is much
more intuitive and consistent with true duplicators, such as face duplis.
Old files will still have `World` setting, so existing blend files are
not changed.
2015-02-04 17:41:15 +01:00
f27389cd01 Better implementation for cache disable - do not store or retrieve cache
ever if debug value is 314
2015-02-04 13:56:57 +01:00
1ec9604b70 Merge branch 'master' into gooseberry 2015-02-04 13:40:21 +01:00
48954596d1 Disable sequencer preprocess cache if 314 debug value is set 2015-02-04 13:35:56 +01:00
becce54286 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/image.c
2015-02-04 07:19:16 +11:00
322cf7cf4e More roughness options for offsetting child clumping.
This is obviously total madness, this feature is totally unusable when
the coder is not sitting next to you ... But so are the rest of particle
settings, the only solution is a future node system.
2015-02-03 18:33:22 +01:00
7e4e99c294 Merge branch 'master' into gooseberry 2015-02-02 14:48:13 +01:00
92fdd1efdf Merge branch 'master' into gooseberry 2015-02-02 14:23:35 +01:00
3637371c96 Fix for unfreed effector weights in hair dynamics.
The internal cloth modifier effector weights get replaced temporarily
to make the cloth sim use the particle weight settings instead. But
the particle sim was not putting back the original weights, which can be
non-NULL in case the cloth sim allocated these already. Messy design ...
2015-02-02 14:09:02 +01:00
5dac6e6129 Fix for unfreed memory due to unnecessary early exit in the free
function.
2015-02-02 13:37:35 +01:00
783b41a55d Fix for unfreed memory of internal hair cloth modifier pointcache. 2015-02-02 12:51:22 +01:00
253cb97862 Cleanup: Moved particle interpolation code into own file. 2015-02-01 18:25:46 +01:00
b0c5622a97 Merge branch 'master' into gooseberry 2015-01-30 16:03:39 +01:00
f095fbc6be New option for the particle Add brush: use_add_stroke to toggle
between stroke and single-add mode.

This was requested especially for use with tablets. With a pen it is
difficult to set a precise point and the tool ends up making multiple
hairs close together all the time. Disabling the stroke option helps
adding individual hairs.
2015-01-30 15:17:55 +01:00
2a3ced0308 Merge branch 'master' into gooseberry 2015-01-30 15:14:24 +01:00
cb6c0663e1 Merge branch 'master' into gooseberry 2015-01-30 14:30:57 +01:00
9c3e41b4f6 Ultra hacky fix for sequencer:
Avoid opening the file when doing uncached reading because ffmpeg takes
quite a long time to read the first frame. Instead, avi jpeg is almost
instantaneous here.
This will leave the anim struct without an Imbuf and that can cause
other unexpected issues elsewhere so commiting on gooseberry first
to try.
Speedup is quite impressive though.

Needless to say, code here quickly becomes a mess and the proxy system
should be made saner but for now just commit to keep things working at
the studio.
2015-01-30 12:25:22 +01:00
06aae6789f Added missing blenderplayer stubs for new particle edit shapekey
functions used in RNA.
2015-01-30 11:31:15 +01:00
b3ca0e21a5 Merge branch 'master' into gooseberry 2015-01-29 19:35:43 +01:00
eee7918c37 Disabled the child hair hull drawing feature.
This is incompatible with particle data structures in their current form.
Hull drawing requires sorting child particles based on the distance from
their primary parent. However, this changes the order of children, which
is the main method of generating random numbers for them. In the
viewport this is not a problem, but when rendering the children are
constantly recreated, using the respective deformed emitter mesh each
time. This leads to changing child orders when using the convex hull
sorting, and therefore different randomisation values.

To properly implement child hull drawing we would have to generate a
stable parent-child offset metric as well as avoiding any resorting in
the actual data arrays. This in turn requires terribly inefficient
drawing iteration, which could become a bottleneck by itself even before
taking cache coherence or OpenGL optimization requirements into account
(collecting child data into a dedicated buffer for drawing).
2015-01-29 17:00:51 +01:00
76e7528cb1 Comment out the proxy fix to test if it makes things better, 2015-01-29 14:40:49 +01:00
46024a14bb Merge branch 'master' into gooseberry 2015-01-29 16:58:49 +05:00
4f47a8b240 Quick test to figure out performance bottleneck in gooseberry.
Failed proxies will now attempt to fetch a smaller proxy first before
fetching the full resolution. This might allow us to see if we are
hitting a bandwidth issue (due to high res) or a file query issue (due
to more file queries)
2015-01-29 12:53:06 +01:00
bb4a0a9c05 Merge branch 'master' into gooseberry 2015-01-29 12:42:36 +01:00
c602fada48 Merge branch 'master' into gooseberry 2015-01-29 22:05:51 +11:00
3482b33f9b Wire-color was accidentally broken in a merge
Adding back changes to background needed for auto-contrast.
2015-01-29 14:16:46 +11:00
615330a16b Support for the (still experimental) parent coloring mode in regular
strand drawing.

Parent coloring is currently still entirely random, but can be improved
for all use-cases later.
2015-01-28 18:13:47 +01:00
b7abaf151f Apply shape keys directly to the hair key data, instead of only applying
to the hair dynamics input DM.

Also this calculation has to happen before caching paths, otherwise
there is a 1-update lag because parent paths still use old values.
2015-01-28 17:34:46 +01:00
d2219f871c After editing hair, apply the changes back to the active hair shape key.
This makes shape keys for hair actually usable by completing basic edit
mode integration.
2015-01-28 16:18:21 +01:00
d045fd79d6 Apply hair shape keys to the particle base data when entering edit mode
and when switching the active key during edit mode.

This is different from how shape key editing works on meshes: there the
edit data (BMEditMesh) stores customdata layers for shape keys, then
writes them back to the mesh. The hair edit mode is a lot more messy and
confusing, it has to update the base data immeditately (with potential
consequences for undo ...)
2015-01-28 15:44:31 +01:00
b2ca6a2d8e Merge branch 'master' into gooseberry 2015-01-28 15:34:37 +01:00
b52530f104 Merge branch 'master' into gooseberry 2015-01-28 14:44:12 +01:00
4ad69e11e8 Initialize new hair shape keys with data from the current particle keys. 2015-01-28 14:38:52 +01:00
307c7667e4 Merge branch 'master' into gooseberry 2015-01-28 17:33:00 +05:00
6dc4664efb Merge branch 'master' into gooseberry 2015-01-28 11:49:39 +01:00
420d381037 Requiring COMPAT_ENGINES for particle panels is stupid. 2015-01-28 11:09:56 +01:00
d92f5918b1 Merge branch 'master' into gooseberry 2015-01-27 18:19:51 +01:00
e4b7084bf6 Merge branch 'master' into gooseberry 2015-01-27 16:19:14 +05:00
3a6e8ec938 Merge branch 'master' into gooseberry 2015-01-27 13:47:15 +05:00
f202dab0f2 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/makesdna/DNA_customdata_types.h
2015-01-26 17:43:02 +01:00
f71847159d Experimental: random colors for child hulls. 2015-01-23 17:47:52 +01:00
b33c55ddee Fix for invalid cache index -1 in some cases, like virtual parents.
The code was assuming that child 0 is always valid, but in fact has to
be treated like all others that can be disable due to preview percentage,
virtual parents, etc.
2015-01-23 17:10:15 +01:00
d79197d9a8 Use the particle system material for OpenGL drawing.
This is probably not correct yet, the code is terribly confusing ...
2015-01-23 16:44:59 +01:00
b26825646b Implemented caps for the convex hair bundle hulls.
The current algorithm generates a triangle strip to fill the end of
each child bundle. This is not quite ideal, because even though the
base child groups are constructed to be convex, the resulting child
paths can become concave again by clumping, roughness, hair dynamics
etc.. This can create face inversion as well as ugly shading artifacts,
so a nicer algorithm may be desirable.
2015-01-23 16:10:32 +01:00
526edf8411 Only perform the inner loop over one group of connected paths in macros.
This allows more customized handling of path drawing in the outer loop
(needed for drawing end caps).
2015-01-23 12:06:31 +01:00
9b6f30e060 Nicer iterating over pairs of connected neighboring child paths. 2015-01-23 11:57:05 +01:00
892eb413f5 Removed parent path drawing code for hulls, this is never used anyway. 2015-01-23 09:47:28 +01:00
f919c5c700 Calculate normals and use smooth shading in the strand direction for
child hulls.

Note that the perpendicular direction around the hair bundles is not
smooth-shaded. Smooth shading doesn't make as much sense there because
large angles are common in this direction and give awkward shading
results.
2015-01-22 19:50:40 +01:00
07a49a9367 Disabled fallback path drawing for now, is currently nested inside the
OpenGL immediate mode calls.
2015-01-22 19:50:40 +01:00
46ab5bbb58 Don't draw 2-sided flat hulls, this just gives ugly Z fighting. 2015-01-22 19:50:40 +01:00
10bf7f6d3d Ignore paths with segments == -1, this is used to indicated hidden
children.
2015-01-22 19:50:40 +01:00
01ec68f457 Completed the convex hull calculation for child paths.
Parent index is only stored for hull children as a means of identifying
them in the drawing code.
2015-01-22 19:50:40 +01:00
1422f0d6cf Use line drawing as a fallback if only one child is assigned to a parent. 2015-01-22 19:50:40 +01:00
d64c5b0d30 Simple immediate-mode OpenGL drawing for convex child hair hulls. 2015-01-22 19:50:40 +01:00
2aaf1dc22a Fix for recent particle drawing commit, need to update the local draw
data variable after changing the buffer.
2015-01-22 19:50:40 +01:00
d57bd6e71b Sorting of child particles by primary parent and offset in hair space.
This is a prerequisite for constructing the convex hull of child paths
around a parent.
2015-01-22 19:50:40 +01:00
f143953ff1 More code cleanup to avoid crazy huge and messy particle functions. 2015-01-22 19:50:40 +01:00
68d80478af New draw mode 'HULL' for hair drawing.
Not implemented yet, currently uses just the child path drawing.
2015-01-22 19:50:39 +01:00
4478300c95 Cleanup: Make path update flag tests a little bit more understandable. 2015-01-22 19:50:39 +01:00
8142e13d1a quiet py exception 2015-01-22 22:14:04 +11:00
47618d0393 Merge branch 'master' into gooseberry 2015-01-22 00:53:29 +05:00
5662864e5b Merge branch 'master' into gooseberry 2015-01-21 14:05:35 +01:00
0f26b5d2f5 Removed the solver_index from cloth vertices.
This was used as part of the "sim preview" feature, where some amount of
vertices were tagged as disabled in the particle system. Due to the
mind twisting complexity of using the nested cloth modifier to simulate
hair strands indirectly it became necessary to still store all the
vertices, but then disable them again on the solver level ... If this
ever gets reimplemented it must be done in a sane way, avoiding the
cloth step altogether.
2015-01-21 10:38:54 +01:00
6681a6e838 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/physics/intern/BPH_mass_spring.cpp
	source/blender/physics/intern/implicit_blender.c
2015-01-21 10:13:47 +01:00
9a5f80e103 Merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 11:50:56 +01:00
00d4bf4ce8 Merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	source/blender/blenkernel/BKE_cloth.h
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/collision.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/physics/particle_edit.c
	source/blender/makesdna/DNA_particle_types.h
	source/blender/physics/BPH_mass_spring.h
	source/blender/physics/intern/BPH_mass_spring.cpp
	source/blender/physics/intern/implicit_blender.c
2015-01-20 11:10:39 +01:00
6f7ef81bb4 Fix for incorrect DNA field name in versioning, causes constant
resetting of clump noise size on reload.
2015-01-19 15:09:44 +01:00
c55d20b301 Use separate flags to enable/disable clump and roughness curves for
child hairs.

This allows disabling the curves temporarily without losing the setup.
2015-01-19 13:32:53 +01:00
6e5b21f808 Merge branch 'master' into gooseberry 2015-01-18 18:51:08 +01:00
4dec17b48c Merge branch 'master' into gooseberry 2015-01-16 17:34:19 +01:00
e52f280f1f Fix for slow deformation-motionblur in Cycles using the new spiral kink
mode.

This was caused by variation of the number of keys on child hairs due
to shortening of hair curves based on euclidian distances. The other
kink modes also shorten hairs, but use the parametric distance instead,
which does not vary with deformation of hairs.
2015-01-16 16:04:10 +01:00
b60e52f7cc Merge branch 'master' into gooseberry 2015-01-16 16:41:56 +05:00
3c2e313ad2 Second variant of the copy-to-select operator for particles to only
copy the active particle system (and not remove existing in the process).
2015-01-16 11:42:13 +01:00
5a830bbb01 Make removal of existing particle systems on copying optional.
This will be most useful when copying individual particle systems
one-by-one (to be implemented).
2015-01-16 11:12:04 +01:00
fd2ac986c8 Merge branch 'master' into gooseberry 2015-01-16 15:06:10 +05:00
e5c1f28372 Merge branch 'master' into gooseberry 2015-01-16 02:29:32 +05:00
b48b8938c3 Merge branch 'master' into gooseberry 2015-01-16 01:45:20 +05:00
d926a25765 Added space selection option to the particle system copy operator.
By default this now copies from one object's local space to another
object's local space (instead of the previous world space). This is
more useful when transferring particles between objects, because it
doesn't require moving objects on top of each other, as long as they
have similar shapes.
2015-01-15 20:38:35 +01:00
8793d9dac5 Merge branch 'master' into gooseberry 2015-01-15 22:36:26 +05:00
d7c1798a23 Removed debugging code. 2015-01-15 18:18:03 +01:00
355b289625 Fix for particle system copy: This has to make sure the ORIGSPACE data
layer is available.

Otherwise particle mapping to the new mesh cannot work with subdivided
and constructively-modified meshes.
2015-01-15 18:15:52 +01:00
9bdefd5b01 Added a "specials" menu button next to the particle systems list for
accessing the copy operator.
2015-01-15 12:53:28 +01:00
57f69a5d8f Changed the workflow for the particle system copy operator to the common
active-to-selected pattern.
2015-01-15 12:35:19 +01:00
a3b8538e89 New operator for copying (hair) particle systems from one object to
another, including edit data (grooming).

This uses basically the same method as the existing connect/disconnect
feature. The main difference is that it allows working with multiple
objects and transferring the //particle/hair data// instead of the
//mesh// data (which is what connect/disconnect expects). This is a much
more realistic workflow when rigging, topology etc. changes and
groomed hair has to be transferred to the changed model.
2015-01-15 11:55:26 +01:00
f62b9d874a Removed unused particles pointer from particle edit data. 2015-01-15 11:55:26 +01:00
305af3ebbe Fix T43254: Camera required for rendering sequencer scene 2015-01-15 07:07:35 +11:00
7086e0fb50 warning: unused var 2015-01-15 07:06:02 +11:00
5fe11d4c40 Merge branch 'master' into gooseberry 2015-01-15 06:43:24 +11:00
1c8c53767d New texture influence option for particle kink amplitude (as opposed to
frequency).
2015-01-14 12:29:19 +01:00
6e5044867f Renaming "Kink" texture influence to "Kink Frequency" to be more
specific.
2015-01-14 12:03:55 +01:00
15490d4685 Spiral rotation axis was not always fully normalized, avoid an assert. 2015-01-14 11:48:51 +01:00
c84bd7fb0e Make random child length work again with the spiral kink mode. 2015-01-14 10:09:16 +01:00
e408277d13 Add missing stub to the player, so buildbot keeps delivering gooseberry builds 2015-01-14 13:05:13 +05:00
400bade662 Merge branch 'master' into gooseberry 2015-01-14 12:58:30 +05:00
4a8eb2a5c2 Allow clumping and roughness in Spiral kink mode as well.
This requires interpolating the parent key properties, because no single
parent key can be mapped to each key on the children any more.
2015-01-13 20:58:28 +01:00
9e95e65be8 Optional randomization factors for the spiral radius and axis orientation. 2015-01-13 19:41:25 +01:00
fa0a2d8127 Support in Cycles for the extra spiral keys in hair paths. 2015-01-13 19:18:46 +01:00
d79c6d8af3 Nicer calculation of the kink axis and result of the spiraling for
negative radius.
2015-01-13 18:37:24 +01:00
679c90a360 Removed unused old code. 2015-01-13 18:03:47 +01:00
00b7010b76 Disable the path length check for spiral kink mode.
This test is terribly expensive for some reason and not necessary for
for the spiral mode anyway.
2015-01-13 17:59:41 +01:00
e3325ad73e Fix for calculation of the key velocity on the last child hair segment. 2015-01-13 17:28:53 +01:00
99611fc38b Another crappy approach to spirals on hairs, crazy expensive though. 2015-01-13 17:24:20 +01:00
bdae59ac84 Spiral kink mode for particles.
This is BAD code, but the particle kinking does not make it easy to
write a non-local modifier that requires neighboring positions,
curvature, etc. The feature is needed for Gooseberry.
2015-01-12 20:24:50 +01:00
c0888fa7c1 Optional clumping noise feature for simulating twisted hair strands.
This adds another level of clumping on child hairs. When enabled, child
hairs chose a secondary clumping target using a Voronoi pattern. This
adds visual detail on a smaller scale, which is useful particularly when
the number of parents is relatively small.

Natural fibres behave in a similar way when they become sticky and
intertwined. Hairs close to each other form a first twisted strand, then
combine into larger strands. Similar features can be found in ropes:
http://en.wikipedia.org/wiki/Hair_twists
http://en.wikipedia.org/wiki/Rope
2015-01-12 16:03:12 +01:00
3b1186addd Disable scope updates in texture and image paint modes.
Scope update is very slow for high resolutions, and currently blocks
the UI thread(!). This is especially terrible in paint modes, where
each stroke causes a scope update and unacceptable freezing.

The scopes update method tries to avoid this somewhat by skipping if the
toolbar is disabled, but this doesn't help when painting where brush
tools etc. are frequently needed. It's also a bad-level poll, with the
core system accessing a UI element.

Eventually scope updates should become a low-priority background job,
as well as becoming threaded. Until then this polling provides a usable
workaround to the most outrageous cases.
2015-01-12 14:27:41 +01:00
5a535bb5b0 Merge branch 'master' into gooseberry 2015-01-11 18:51:01 +01:00
7bb53800ba Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/object/object_intern.h
	source/blender/editors/object/object_ops.c
	source/blender/makesrna/intern/rna_modifier.c
2015-01-10 10:26:11 +01:00
e61a707869 Merge branch 'master' into gooseberry 2015-01-09 18:08:20 +01:00
326d7fd5fd Curve-based control for "roughness" (noise displacement) of child hair. 2015-01-09 15:58:18 +01:00
62fae2b981 Merge branch 'hair_clumping' into gooseberry 2015-01-09 14:27:18 +01:00
9f835cc10e Curve-based control for child path tapering.
This is an alternative method to the current fixed function with a
clump factor and "shape" parameter. This function is quite limited and
does not give the desired result in many cases (e.g. long, parallel
rasta strands are problematic). So rather than trying to add more
parameters there is now a fully user-defined optional curve for setting
the tapering shape.
2015-01-09 14:24:19 +01:00
32acaf1bc5 Merge branch 'master' into gooseberry 2015-01-09 13:28:15 +01:00
8c99bf9ed9 Moved kink, clump and roughness functions into the dedicated source file. 2015-01-09 11:44:05 +01:00
ac4d90fda4 Reorganizing hair child code a little bit to make it not totally insane.
This contains a few pieces of code for a future "modifier" system that
would allow more flexible combination of effects. Eventually a node
system is the way to go, but the current code makes that impossible.
2015-01-09 11:31:00 +01:00
ba4e7d95db Paste flipped bones:
* Simplify logic for bone detection on copy (no need to do mirrored
naming then)
* Add shortcuts ctrl(cmd)-shift-V for copying flipped
2015-01-08 13:01:48 +01:00
b62c0315fa Merge branch 'master' into gooseberry 2015-01-08 12:48:18 +01:00
64d39b7378 Separate context freeing from task freeing in threaded particle updates
to prevent double-freeing/invalid mem access.

This can happen with the "virtual parents" feature, which generates both
parent and child paths. Each task free function also freed the shared
context, leading to double freeing.
2015-01-08 12:41:55 +01:00
4137ef10da Gooseberry animation request: Paste flipped pose in action
and graph editor.

This was a tricky commit that was not so straightforward to make work.
The information for bones is not easy to come by in the animation curves,
however we do have some string manipulation tricks to make it happen.
For now committing to gooseberry branch for testing, it will be ported
to master after most usual use cases have been confirmed as working.

(Current test with all rotation modes and translation seems to work, but
Not sure how well this will hold up with drivers etc)
2015-01-07 22:25:33 +01:00
70eee6a0ed Merge branch 'master' into gooseberry 2015-01-07 16:17:16 +01:00
4f338dfdea Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/blenkernel/intern/key.c
2015-01-07 14:52:08 +01:00
66d03f8405 Merge branch 'master' into gooseberry 2015-01-06 15:50:37 +01:00
ba0d452357 Merge branch 'master' into gooseberry 2015-01-06 23:11:54 +11:00
7c28022dc2 Merge branch 'master' into gooseberry 2015-01-06 12:17:47 +01:00
c5ede37a9e Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/makesrna/intern/rna_object.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-01-05 12:24:47 +01:00
f902bbad83 Cleanup the file mess with facemaps, make correct BKE/ED files for all
functions. Blenderplayer compiles again
2015-01-05 12:16:44 +01:00
f929c03791 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/camera.c
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-01-05 12:00:17 +01:00
df877cc991 Merge branch 'master' into gooseberry 2015-01-03 00:11:50 +05:00
b8c2f58f1c Gooseberry: Fix stubs for player, so buildbot can deliver builds again
Please note, that this commit doesn't fix issues with functions declared
in BKE header and implemented in editor/. This is to be fixed separately.
2014-12-31 14:02:22 +05:00
532a03c232 Properly register the mathutils.interpolate submodule. 2014-12-31 09:58:47 +01:00
cc67f8e492 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/makesrna/intern/rna_modifier.c
2014-12-30 12:29:34 +01:00
eca3250c89 Little experiment: hook up a transform operator to a bone facemap. For
now moves the mesh only, doesn't set the bone as selected.
2014-12-22 12:04:45 +01:00
d9b7655bbd Fix for invalid access to undefined hair data in edge-only cloth meshes.
Cloth data is used both for hair and actual cloth, which makes things
really difficult. The face number was used for distinguishing the two
types (no faces == hair mesh), but the extra hair data necessary for
hair sim is generated by particles and not available for edge-only cloth
meshes. This really needs to be sanitized ...
2014-12-22 11:54:24 +01:00
f9cedb4896 Facemap widgets:
* Only draw on mouse over
* Fix crash with highlighted widgets.
2014-12-22 11:28:41 +01:00
b68a951e91 Modify facemaps mapping to bones.
Now simply add a flag to the armature modifier to use facemaps. Facemaps
on the mesh object with the same name as the armature bones will get
displayed as widgets.
2014-12-19 16:11:04 +01:00
bffe48f12c Presets for hair dynamics.
This is necessary because the hair dynamics settings are not part of the
ParticleSettings datablock, but part of the convoluted cloth modifier
inside the particle system struct. In the future this will be recoded
properly, but in the meantime presets provide a simple an unobtrusive
way to have reusable dynamics settings for hair.
2014-12-19 14:56:02 +01:00
16478df500 Merge branch 'master' into wiggly-widgets 2014-12-19 14:44:35 +01:00
1fd375fd30 Merge branch 'master' into gooseberry 2014-12-19 13:37:38 +01:00
61bba5e66f Radical simplification of the wind effect on hair, since the previous
approach does not work very well.

Using a cross section estimate still causes large oscillations due to
varying hair force based on angles. It also requires a sensible hair
thickness value (particle radius) which is difficult to control and
visualize at this point.

The new model is based purely on per-vertex forces, which seems to be
much more stable. It's also somewhat justified by the fact that each
hair vertex represents a certain mass.
2014-12-18 13:52:31 +01:00
b0c0505624 Facemap bones now draw properly. It's not possible yet to select the
bones so use with caution.
2014-12-17 18:51:49 +01:00
018593b75a Fix more crashes when removing facemaps. Indices of leftover facemaps
above the deleted one could become invalid
2014-12-17 18:33:33 +01:00
a1e28859c7 More silly mistakes in widget move code. 2014-12-17 18:16:32 +01:00
380a32581f Stubs for new facemap widget, fixes for facemaps.
Move/remove facemap not working well (probably was never working but by
displaying them has actually made the issue apparent)
2014-12-17 18:08:30 +01:00
8ffd46d139 Fix crash with decimate modifier on zero. 2014-12-17 16:53:05 +01:00
4887f7b48c Fixes to facemaps:
* Test display code that displays the active facemap. Will not work on
subsurf modifier yet (crash)
* Fix loading of files with facemaps
* Facemap data now reside on polys instead of tessfaces.
2014-12-17 16:42:36 +01:00
ad23e225c9 Merge branch 'master' into wiggly-widgets 2014-12-17 12:00:00 +01:00
00fe49de83 Code that will draw a transparent overlay of a facemap over the mesh
(crashes atm).
2014-12-16 20:14:10 +01:00
3a7b5bdeb0 Improved force field effects on hair strands.
The previous calculation was modulated with the angle between the wind
direction and the segments, which leads to very oscillating behavior.

Now the formula includes an estimate for the geometric cross section
of a hair segment based on the incident angle and the hair thickness
(currently just the particle size). This gives a more stable behavior
and more realistic response to wind.
2014-12-16 19:40:29 +01:00
bc99082e45 Add code that copies sorted per facemap vertex indices to a VBO buffer 2014-12-16 19:35:57 +01:00
3d74e55dd7 Initial VBO code for GPU subsurf.
This commit adds a few generalizations to the VBO
code so that modifiers can create and populate their own GPU objects.

The VBO code originally supported CDDerivedMesh only. The design moves
slightly towards the viewport refactor where the rendering system
requests data from modifiers.

What we do have is support for solid shading with multiple
materials, flat/smooth shading and a big performance boost.
Performance could

In this commit only basic support for vertices and normals is provided
and some features from blender's VBO system, such as mapping to
original faces, unique element indices for vertices and loose vertex/
and can be added later. The one feature that is missing now is the quick
navigation feature of the multires modifier (which uses the same code).

- Why this commit is made on the widget branch -

Facemap widgets need to avoid drawing the whole mesh when we do
collision detection on them. For subsurf drawing we need to iterate
through the whole mesh every time. What we need instead is sort
indexed elemet drawing according to the facemap each face belongs to.
This screams VBOs but since I was going to add that, I thought that
I could push it a bit further and add proper solid shading support.
2014-12-16 18:26:14 +01:00
c32ac24d41 Revert "Initial VBO code for GPU subsurf."
This reverts commit 7163ddf53e.
2014-12-16 18:18:57 +01:00
7163ddf53e Initial VBO code for GPU subsurf.
This commit adds a few generalizations to the VBO
code so that modifiers can create and populate their own GPU objects.

The VBO code originally supported CDDerivedMesh only. The design moves
slightly towards the viewport refactor where the rendering system
requests data from modifiers.

In this commit only basic support for vertices and normals is provided
and some features from blender's VBO system, such as mapping to
original faces, unique element indices for vertices and loose vertex/
and can be added later. The one feature that is missing now is the quick
navigation feature of the multires modifier (which uses the same code).

What we do have is full support for solid shading with multiple
materials, flat/smooth shading and a big performance boost.
Performance could

- Why this commit is made on the widget branch -

Facemap widgets need to avoid drawing the whole mesh when we do
collision detection on them. For subsurf drawing we need to iterate
through the whole mesh every time. What we need instead is sort
indexed elemet drawing according to the facemap each face belongs to.
This screams VBOs but since I was going to add that, I thought that
I could push it a bit further and add proper solid shading support.
2014-12-16 17:05:11 +01:00
c2d22f79ad New python submodule mathutils.interpolate for various mesh interpolation and weighting methods.
This module will contain mirrored functions for calculating and applying
weights for points on a mesh. This includes barycentric and UV weighting
and possibly more advanced global weighting such as harmonic weights.

The naming should follow this scheme:
<type>_{2d,3d}_{calc,apply}

e.g.
poly_2d_calc
poly_2d_apply
uv_3d_calc
...

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D939
2014-12-15 20:05:17 +01:00
1740ee2d3d Merge branch 'master' into wiggly-widgets 2014-12-15 17:10:53 +01:00
91ed7c270c Placeholder GPU functions to get GPU facemap index buffer. API should
allow a widget to draw a specific facemap bound to a mesh quickly.
2014-12-15 17:08:10 +01:00
1a366cb02a Fix selection id not getting incremented in face-map bones 2014-12-15 14:01:53 +01:00
935fa0670e Merge branch 'wiggly-widgets' into gooseberry 2014-12-15 12:11:41 +01:00
bffde905b6 Deactivate irritating shapekey widget while it's still under
development.
2014-12-15 12:11:09 +01:00
6b8ebd6bd6 Hook up facemap property to bones.
A bone using a facemap will not be displayed at all, rather it will use
the facemap of the mesh as an interaction area. The facemap still does
nothing since it's not yet hooked up to the customdata and widget code.
That will come next.
2014-12-15 12:09:54 +01:00
8c069258df Merge branch 'master' into gooseberry 2014-12-12 16:32:47 +01:00
3ac798261f Merge branch 'wiggly-widgets' into gooseberry 2014-12-12 16:27:31 +01:00
74308df3f0 Support for custom cursors for widgets.
They are set when a highlighted widget intersection is detected and on
area level.

There's a discussion about using owners and a stack or array for cursors
but that needs some more thought and design.
2014-12-12 16:27:06 +01:00
9880af5779 More changes to overdrop transform operator.
* Calling key press confirms
* Change name of operator accordingly.
2014-12-12 14:17:38 +01:00
7b4fdfbfd9 Merge branch 'wiggly-widgets' into gooseberry 2014-12-12 13:04:06 +01:00
9a9347eb8d Gooseberry request draw sequencer backdrop on -top- of everything.
Due to this we -obviously- rename this to overdrop

I am not sure if others would agree here, but it's pretty safe to do
this on a branch first. Rationale is that it's much nicer to work on
full screen with this.
2014-12-12 13:02:23 +01:00
90bbe335fc Merge branch 'wiggly-widgets' into gooseberry 2014-12-12 12:35:03 +01:00
443ef39203 Minor adjustments to the cage transform widget and sequencer operator.
* Bigger scale handler for widget.
* Operator has description on area
* Cancelling resets position.
2014-12-12 12:34:31 +01:00
472abc4669 Merge branch 'master' into gooseberry 2014-12-11 14:43:37 +01:00
d445330c53 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_event_system.c
2014-12-11 14:06:58 +01:00
58fedf3b67 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/makesrna/intern/rna_space.c
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_event_system.c
2014-12-11 14:00:23 +01:00
4380a92c05 Sequencer operator that uses widgets and controls the placement of the
backdrop is now functional.

The widget could communicate with the sequencer properties directly, but
here we set it to control the operator properties as a demonstration.

After some minor stress testing, time to give this to gooseberry team.
2014-12-10 21:00:59 +01:00
a6a6c49398 Fix some registration issues, also add scale property for sequencer
backdrop widget.
2014-12-10 19:24:28 +01:00
6da4973e8e Something draws now in sequencer when we register the widget for the
operator.
2014-12-10 18:55:03 +01:00
f64e323e2b Yet more refactoring:
Areas support more than one widgetmap - will be useful to partition area
in different transform regions like data, pixel, 3D (will be done in a
separate refactor).

Also get rid of the context widget hack in favour of adding the
widgetmap handler to the operator handler itself, so handling will
be unified when the widget controls a property or spawns an operator
2014-12-10 18:23:00 +01:00
dc0b8f291b Merge branch 'master' into gooseberry 2014-12-10 17:26:59 +01:00
fac8a0c4f9 Privatize registration function for individual widgets.
Handle events for widgetmap first when and pass to operator when
operator is active.

This is still a pretty confusing design, working on a simpler one now.
2014-12-10 15:57:27 +01:00
b8e88c1821 Sequencer: optionally use scenes nested strips (like meta strips)
This commit makes it possible to use scenes as a kind of
multi-user metastrip (with their own time).

Currently this supports rendering & drawing nested strips,
but no convenient way to tab-enter into a scene strip.
2014-12-10 15:26:41 +01:00
3347195ba1 Merge branch 'master' into gooseberry 2014-12-10 15:24:13 +01:00
182545c820 Create sequencer widget handlers 2014-12-10 12:57:09 +01:00
0fb37c710f Add back idnames to the widgetmaps, we could well need to define both
for different transform areas.
2014-12-10 12:46:15 +01:00
ef8a3d65f1 Big refactor commit.
* Minor cleanup - propname does not need to be stored anymore.
* Code to support modal widgetmap registration for operators - still
untested, but will be tested soon on sequencer cage widget
* Widgets take parameters to initialize property slots that are used for
feedback or control.
Cage now uses this to feed offset/scale to different properties.
* Initialize common properties during widget registration.
2014-12-09 21:01:51 +01:00
6496051251 Merge branch 'master' into gooseberry 2014-12-09 16:55:38 +01:00
04671df15f Code for runtime registration of widgets that should make it possible to
remove and add widgetgroup types from the system.

Start operator that will control sequencer backdrop. Architecture here
still needs a little work so good compatibility with Add-ons can be
ensured.
2014-12-08 15:48:09 +01:00
5d2f1a9466 Make resizer widgets smaller, express them in pixels. 2014-12-08 13:16:01 +01:00
ab46b5ed62 Clamp during rectangle interaction to make sure widget stays big enough
to interact with (also handles negative case). 15 pixels threshold was
chosen.
2014-12-08 12:48:26 +01:00
5feafed611 Correct backdrop fit operator for compositor. 2014-12-08 12:30:50 +01:00
09d18fb74d Scale handlers for the rectangle transform working 2014-12-08 12:25:30 +01:00
900e3eacd7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_event_system.c
2014-12-08 11:14:23 +01:00
b51ee540ae Initial Python API for Widgets
Note this is only the initial Python API structure & isn't usable in its current state.

Work by Psy-fi & myself.
2014-12-06 20:55:57 +01:00
7d79196698 minor corrections to last commit 2014-12-06 15:37:46 +01:00
81e2e1be41 Widget API: remove unused identifier member
also comment some of the code.
2014-12-06 15:06:24 +01:00
d4c9ff8a21 Add facemaps panel to the supported cycles panels 2014-12-05 17:59:27 +01:00
787743b1ed Add back an extra paramater to the intersection function to determine
the highlighted part of the widget.
2014-12-05 16:42:59 +01:00
0a7eb30cee Cleanup leftover code. 2014-12-05 15:59:53 +01:00
b0f53133c1 Hook up the new DNA data to the node edtior. Now the backdrop supports
2D interaction (scale still pending)
2014-12-05 15:18:49 +01:00
8abeeafcb6 Rename Cage to RectTransform, add DNA for struct that will be used for
interaction with the widget.
2014-12-05 12:55:33 +01:00
cb2f1eb3eb Merge branch 'master' into wiggly-widgets 2014-12-05 11:45:40 +01:00
f2a7c2ffc1 Merge branch 'master' into gooseberry 2014-12-04 12:48:22 +01:00
aad164978c Get rid of operator, and use facemap name field on shapekey. 2014-12-03 17:15:21 +01:00
e01e074276 Face maps initial data structure, rna types and save/load
commit and operators to set faces in a group in edit mode.

Face maps are groupings of faces, similar to vertex groups, however,
each face can only belong to one face map.

They will be used for widget interaction, but there will possibly be
more uses for them in the future.

Code needs some cleanup still here, will apply as work is being done.

There is some code here for object mode interaction but it hasn't been
tested yet. This will probably be done with the widgets themselves.
2014-12-03 16:30:39 +01:00
de94752d8e Revert "Add space for facegroup storage"
This reverts commit 687cb3ab86.
2014-12-03 16:27:35 +01:00
a6adbc968f Left this in last merge 2014-12-03 16:23:25 +01:00
1138a296cb Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenkernel/BKE_context.h
	source/blender/editors/include/ED_transform.h
	source/blender/editors/transform/transform_ops.c
2014-12-03 16:20:40 +01:00
9720402fca Placeholder operator 2014-12-03 16:08:53 +01:00
e7d0c58bc9 Merge branch 'master' into gooseberry 2014-12-02 18:00:48 +01:00
c51ca1b7de Fix for missing library linking in blenderplayer. 2014-12-01 18:15:53 +01:00
8ccdf15ace Forgot this last merge 2014-12-01 14:59:18 +01:00
b57d67dfb9 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_context.h
	source/blender/editors/include/ED_transform.h
	source/blender/editors/transform/transform_ops.c
2014-12-01 14:54:28 +01:00
73efb36091 Shapekey widget is correctly bound to the shapekey property and controls
it.
2014-12-01 12:54:40 +01:00
1f501db162 More cleanup to the widget API.
Now with RNA pointer copy we don't need to allocate RNA pointers
anymore. The API is much more streamlined and is almost like the panel
API.
2014-12-01 12:28:39 +01:00
af74cba653 Widgets: Cleanup, no draw flag now, widgets are fully dynamic. Also
calculate scale always to make sure interaction happens correctly.
2014-12-01 11:57:52 +01:00
2b1bdb5412 Refactor widgets to always be recreated on redraw - like buttons.
This allows us to spawn a different number of widgets per frame, which
will be needed for shapekey doritos. Also added a widgetgroup for the
shapekeys
2014-11-28 23:02:42 +01:00
0b443c8a23 Merge branch 'master' into gooseberry 2014-11-28 22:21:00 +01:00
a99f5a7463 Add stub operator for widget operation so it is blocking and events do not get
lost when region changes.
2014-11-28 16:35:07 +01:00
6336b215a9 Merge branch 'master' into gooseberry 2014-11-28 16:26:44 +01:00
f74e4d9dfe Merge branch 'viewport_experiments' into gooseberry
Conflicts:
	source/blender/gpu/intern/gpu_buffers.c
2014-11-28 16:21:45 +01:00
5467064777 Merge branch 'master' into viewport_experiments
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/gpu/GPU_buffers.h
	source/blender/gpu/intern/gpu_buffers.c
2014-11-28 16:15:13 +01:00
bd434b92b6 Revert "Hook up flags to request a specific sorting scheme from GPU buffer setup"
This reverts commit 827ad6075d.
2014-11-28 16:10:25 +01:00
7e9eb8b83b Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2014-11-28 11:47:16 +01:00
9768480a7b Merge branch 'master' into gooseberry 2014-11-27 21:40:41 +01:00
8ce8a4edb3 Merge branch 'master' into gooseberry 2014-11-27 19:12:40 +01:00
2a3d6efa96 Merge branch 'master' into wiggly-widgets 2014-11-26 19:28:24 +01:00
d898581b52 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/gpu/intern/gpu_extensions.c
2014-11-26 15:09:57 +01:00
5373b4a8b1 Merge branch 'master' into viewport_experiments
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/gpu/intern/gpu_extensions.c
2014-11-25 16:31:55 +01:00
c0d8ed55e4 Merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/space_sequencer.py
	source/blender/blenkernel/BKE_sequencer.h
	source/blender/blenkernel/intern/sequencer.c
	source/blender/blenkernel/intern/sound.c
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/animation/anim_ops.c
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_sequencer/sequencer_edit.c
	source/blender/editors/space_sequencer/sequencer_intern.h
	source/blender/editors/space_sequencer/sequencer_preview.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/editors/space_view3d/view3d_edit.c
	source/blender/editors/space_view3d/view3d_ops.c
	source/blender/editors/transform/transform.c
	source/blender/editors/transform/transform_conversions.c
	source/blender/editors/transform/transform_snap.c
	source/blender/makesdna/DNA_space_types.h
	source/blender/makesdna/DNA_view3d_types.h
	source/blender/makesrna/intern/rna_space.c
2014-11-25 14:25:27 +01:00
aae1162945 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/editors/space_view3d/view3d_edit.c
	source/blender/editors/space_view3d/view3d_ops.c
2014-11-24 19:22:15 +01:00
8aed4bb1d6 Fix compilation error with SCons
The file wasn't being comiling by CMake, remove it from SCons compilation as well.
Not sure if the same is required in original branch, maybe it'll be redone anyway.

For now let's make it so gooseberry branch is compiling nicely on the buildbot.
2014-11-24 14:09:52 +05:00
dd43f9c056 Cage widget now does something useful (tm). Basically, we can now
transform the x direction of the backdrop in sequencer when a viewer
node is active.

There are still some issues with property transform not being a proper
operator, but we can fix that easily.

To make full 2D transform work we need positions stored in one property.
2014-11-21 18:05:39 +01:00
ff50cd9740 2D widgets Cleanup:
* Get rid of invalid flag (we avoid drawing widgets by dereferencing RNA
now so it should be OK)

* Add intersect function for 2D widgets (still needs correct mapping to
be any useful though)
2014-11-21 17:07:26 +01:00
44b4ced395 Correctly center the widget in node space 2014-11-21 16:48:33 +01:00
82401df4b2 Merge branch 'master' into gooseberry 2014-11-21 16:30:10 +01:00
261c0a5282 Merge branch 'wiggly-widgets' into gooseberry 2014-11-21 16:25:48 +01:00
bfa17440eb Cage actually now draws something, also change widget, will be modified
to control placement of backdrop.
2014-11-21 16:24:05 +01:00
3e8367037f Another fix for particle instance child lookups, was not subtracting
parent amount.
2014-11-21 16:01:21 +01:00
007eaf34dc Fix for invalid particle pointer access in mixed particle/child loop. 2014-11-21 16:01:21 +01:00
1068021523 Better update function for particle settings affecting nested cloth
modifier.
2014-11-21 16:01:21 +01:00
af8c0c84f6 Fix for applying the bending randomness factor.
A stupid hack is needed here, changing the way the factor is applied to
angular bending springs. In cloth sim the bending factor of individual
springs is applied as a mix value between the bending stiffness and a
max value, but this max value isn't even used in hair sim so that
approach becomes useless.
2014-11-21 16:01:20 +01:00
bc637d0e1a Randomness factor for hair bending stiffness.
This helps to create some variation in a hair system, which can
otherwise become very uniform and boring. It's yet another confusing
setting in a system that should have been nodified, but only option for
now (broken windows ...)
2014-11-21 16:01:20 +01:00
e8ddfb1fe2 Fix for particle instance initial frames.
These were not orthonormal and tended to flip with changing hair
direction, now use the particle hair matrix which is stable wrt. the
mesh surface.
2014-11-21 16:01:20 +01:00
eb3d1e3e4f Merge branch 'master' into wiggly-widgets 2014-11-21 11:24:52 +01:00
7c078f97df Fix T42639, editcurve flags not getting restored on undo.
Error here could be reproduced by tweaking curve properties such as
2d-3d or fill type and undoing.
2014-11-20 18:58:59 +01:00
bcd78c9311 Initialize the snaping aspect just once. 2014-11-20 18:39:26 +01:00
0853c0109c Merge branch 'master' into gooseberry 2014-11-20 18:21:39 +01:00
a014b8f1c1 Merge branch 'wiggly-widgets' into gooseberry 2014-11-20 18:19:31 +01:00
6279dde2f2 Fix crash with widgetgroup 2014-11-20 18:16:58 +01:00
3102ced864 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/editors/transform/transform_manipulator.c
2014-11-19 16:48:04 +01:00
ef310b2ae1 lost instance of transform manipulator 2014-11-19 16:13:15 +01:00
bfa6b80b8b Merge branch 'master' into wiggly-widgets 2014-11-19 16:08:05 +01:00
fee102e818 Bring back the old manipulator code, it works better with the transform
system for now. Backup the old code in a new file
2014-11-19 16:07:56 +01:00
896ee44ed6 Borrow transform system interaction: When arrow direction has direction
close to view direction, use up/down movement of mouse to calculate
offset.
2014-11-19 15:28:10 +01:00
ca65c70ce1 warnings 2014-11-19 15:27:56 +01:00
13b196f460 Merge branch 'master' into gooseberry 2014-11-19 15:23:38 +01:00
134d69582c More refinement to the widget system. Now camera widget should be
indistinguishable than the displayed widget (might probably be worth
deleting the original)
2014-11-19 14:48:02 +01:00
6ce5174301 Arrow Widget:
Create a cross style widget, with wireframe cross.

Allows setting a custom scale for the arrow widget also, an up
orientation.
2014-11-19 14:24:29 +01:00
58f7e89e39 Add flag so widgets only draw on mouse over.
Camera widget now uses this, also now they only draw if limits is on.
2014-11-19 13:03:30 +01:00
36f18cd35c Arrow widget interaction:
Fix interaction when pivot is beside the camera. basically we now do all
calculations in 3D space and we do not scale correct the offset in 3D -
this creates a nasty dependency loop between drawing and calculation for
widgets bound to properties - ie offset depends on scale but scale
depends on screen position - ie offset.

Also added an extra callback to get the final position of the widget in
3d space and use that to calculate the scale. This takes care of
bringing a close to the camera widget to the background and the widget
keeping its initial size. The final position can be different from the
initial position, especially when the widget is offset from the original
position.
2014-11-19 12:32:21 +01:00
681ea5d187 Merge branch 'viewport_experiments' into gooseberry 2014-11-18 17:48:13 +01:00
ec69df6147 Merge branch 'master' into viewport_experiments 2014-11-18 17:47:56 +01:00
40b1d29ec7 Merge branch 'master' into viewport_experiments
Conflicts:
	source/blender/gpu/intern/gpu_extensions.c
2014-11-18 13:49:57 +01:00
d7fa0fcaae More info for widget undo push string 2014-11-17 18:48:37 +01:00
275a26353e Add widget for focus of camera. There are some general issues with
widget scale that I'll fix later.
2014-11-17 17:27:45 +01:00
2dd9e41d93 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/editors/transform/transform_manipulator.c
2014-11-17 16:30:52 +01:00
195788a24a Add flag so offset is applied in world, not screen space. 2014-11-17 15:39:21 +01:00
9880574aaa Fixed overlooked function name change in game engine code. 2014-11-17 15:20:29 +01:00
7fe2e945bd Merge branch 'gooseberry' into hair_immediate_fixes 2014-11-17 14:54:51 +01:00
54ae1e90d7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/editors/transform/transform_manipulator.c
2014-11-17 14:52:53 +01:00
def2bb7644 Fix for particle instance modifier: use a stable parallel-transport
framing method instead of the Frenet frame.

The Frenet frame is very succeptible to sudden twists along straight
sections of a curve where the second derivative (curvature) becomes 0.
2014-11-17 14:16:35 +01:00
141f2c1d5c Use better algorithm for arrow widget back transform.
We now use plane/line intersection which seems to work quite well and
agrees to great extent with the transform system as well. There still
some small discrepancy but may also be related to scaling.
2014-11-17 12:31:42 +01:00
2114f49750 WIP cage transform.
This also includes code for the node editor but probably
will try a different use case first.
2014-11-16 19:40:13 +01:00
d03ceb2a15 Nicer hashing functionality for sim debugging using a variadic macro
to support multiple hash identifiers.

Using explicit hashing functions for every sim debug call defeats the
purpose of having a quick feedback system. Now this can be done simply
by passing an arbitrary number of hash inputs (integers) at the end of
the function calls, which are then combined by a system of variadic
macros (based on the ELEM feature). Up to 8 identifiers are supported
currently, but more could be added easily if needed.
2014-11-16 14:59:33 +01:00
67e48a5b04 Merge branch 'master' into gooseberry 2014-11-15 20:52:11 +01:00
b30019fabe Merge branch 'hair_immediate_fixes' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	source/blender/editors/physics/particle_edit.c
	source/blender/makesdna/DNA_modifier_types.h
	source/blender/physics/intern/BPH_mass_spring.cpp
	source/blender/physics/intern/hair_volume.cpp
	source/blender/physics/intern/implicit.h
	source/blender/physics/intern/implicit_blender.c
	source/blender/physics/intern/implicit_eigen.cpp
2014-11-15 15:07:06 +01:00
9f1ad068e9 Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenkernel/intern/implicit.c
2014-11-15 14:40:23 +01:00
95c5c39e5d Merge branch 'master' into gooseberry 2014-11-15 14:15:30 +01:00
5aaef09702 Some tweaking of value ranges for hair target density and removed
density factor (already included in grid velocity).
2014-11-15 12:40:34 +01:00
3021399869 Ensure View3D fx when using them, prevents some crashes with old files 2014-11-14 23:52:41 +01:00
ace38bdc82 Fix SSAO not being constant in camera view. 2014-11-14 19:55:30 +01:00
5a7f8f8ef8 Inverted effect of target density was unstable, the divergence term
needs to be substracted instead.
2014-11-14 17:11:33 +01:00
7289f36a59 Use dedicated debug values in cloth settings instead of abusing unused
other values.
2014-11-14 16:48:01 +01:00
f5e1be8532 Fixed wrong stride values used for offsetting the index of Eigen values.
The Eigen solver for hair grids uses an extra margin of 1, which means
greater stride values.
2014-11-14 15:51:23 +01:00
1103abdb86 Merge branch 'terrible_consequencer' into gooseberry
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2014-11-14 15:36:24 +01:00
e346911943 Gooseberry request, snap frame marker during frame setting by holding
ctrl key
2014-11-14 15:35:30 +01:00
f5c2b1c2f6 Merge branch 'master' into terrible_consequencer
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2014-11-14 15:07:10 +01:00
d1bfb48216 Hair grid code was using an invalid hair segment at each hair end with
zero vectors, leading to bad density values.
2014-11-14 14:55:56 +01:00
0655c4931c Merge branch 'viewport_experiments' into gooseberry 2014-11-14 14:46:02 +01:00
63663f00dc A bunch of debug drawing changes. 2014-11-14 14:45:46 +01:00
cb94f59f71 Fix T42596 crash with DOF on MacOS.
Compiler failed on last shader and failure was not detected. However
compiler error also revealed a blurring error as well :)
2014-11-14 14:45:20 +01:00
ee3b3f7669 Corrected the divergence and gradient calculation for the hair grid
solver input and output.

This uses the central difference method (instead of combined forward/
backward difference), which makes it easier to correctly account for
grid borders.
2014-11-14 14:41:55 +01:00
d7fcab7e25 Merge branch 'master' into gooseberry 2014-11-14 14:34:59 +01:00
63d7d8e1e5 Merge branch 'master' into viewport_experiments 2014-11-14 14:07:47 +01:00
f79cf18848 Fallback method for defining density in the hair grid using discrete
samples.

This is just an intermediate method to make sure the density is valid.
Eventually the closest-point method should be used, but for testing
the poisson solver this is easier to debug.
2014-11-14 11:10:45 +01:00
be9fbfd92f Added a margin to the number of cells used in the poisson grid solver,
to ensure we always have one layer of empty cells around the fluid.
2014-11-14 10:42:09 +01:00
3cf9c897ee Merge branch 'master' into gooseberry 2014-11-14 10:05:19 +01:00
c77eefb1f0 Merge branch 'master' into gooseberry 2014-11-13 17:44:10 +01:00
644848fab7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/implicit.c
2014-11-13 17:40:06 +01:00
746b93497f fixes for last merge 2014-11-13 17:35:21 +01:00
024645d8e0 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2014-11-13 17:23:19 +01:00
316a3e830c Merge branch 'master' into gooseberry 2014-11-13 17:15:24 +01:00
4dc9ca29de Merge branch 'master' into gooseberry 2014-11-13 17:14:35 +01:00
7a53563c98 Implementation of a target density feature for the hair simulation.
This allows setting a target density which the fluid simulation will
take into account as an additional term in the pressure Poisson
equation. Based on two papers
"Detail Preserving Continuum Simulation of Straight Hair" (McAdams et al. 2009)
and
"Two-way Coupled SPH and Particle Level Set Fluid Simulation" (Losasso et al. 2008)

Currently the target pressure is specified directly, but it will be
a lot more convenient to define this in terms of a geometric value such
as "number of hairs per area" (combined with hair "thickness").
2014-11-13 16:06:39 +01:00
debe72a243 Another fix for off-by-one hair grid resolution errors. 2014-11-13 16:05:17 +01:00
de30eddf82 Rewriting the grid rasterization function for hair segments. 2014-11-13 16:04:31 +01:00
120d78d6d5 Draw actual hair keys when the "Guide Hair" setting is enabled.
Without this certain debug tasks become very hard to visualize.
2014-11-13 15:15:02 +01:00
6e56dcdc79 Change widget interaction slightly so transform works immediately.
It may be better to use transform code for widgets but this will cause
nested operators for widget/operator and needs some consideration.

For transform e.g. we would have one transform operator taking care of
transformation of the widget, then feeding this back to regular object
transform.
2014-11-12 15:41:24 +01:00
01a37d8b03 Fix incorrect wrapping of lamp to RNA for widget. 2014-11-12 14:37:50 +01:00
f2db6b227c Remove magic numbers 2014-11-12 13:41:13 +01:00
aa22fa21f9 Widgets: inverted/constrained to property range working for properties
(not operators yet).

Now "umbrella" widget type works correctly.

Includes minor cleanup of view3d widgetgroup routines.
2014-11-12 12:00:12 +01:00
dfaddba86c correct offset for scaled widgets during interaction 2014-11-12 11:06:25 +01:00
4d3c1325d6 Merge branch 'terrible_consequencer' into gooseberry 2014-11-11 18:41:50 +01:00
500bac8225 Snap to left-right based on position of mouse relative to selection. 2014-11-11 18:41:09 +01:00
6101bdaf70 Support endpoint snapping correctly. 2014-11-11 18:13:00 +01:00
ec0c58823d First iteration of snapping based on strips - will be improved based on
imput from Mathieu.
2014-11-11 18:00:47 +01:00
b089332a4d WidgetMaps:
Now widgetmaps get created and destroyed with the area. Not sure if it's
the best design but it avoids too many creations and recreations.

arrow offset now calculated at property binding time - no RNA access
during interaction means no chance of crash during undo.
2014-11-10 15:48:02 +01:00
6968547b80 Bound properties/operators to widgets at draw time. This fits our design
much better (is the same as the way panels work) and will help avoiding
some crashes on undo.
2014-11-10 14:55:07 +01:00
5015864b68 Fix for grid drawing in 3D view, was using one less grid cell. 2014-11-10 11:34:36 +01:00
6c999f6ca4 Merge branch 'master' into wiggly-widgets 2014-11-10 11:10:45 +01:00
a659027d91 Merge branch 'hair_immediate_fixes' into gooseberry 2014-11-09 13:16:47 +01:00
7f7a63fb11 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/implicit.c
2014-11-09 17:10:15 +05:00
9f47e5d6eb Merge branch 'master' into hair_immediate_fixes 2014-11-09 12:13:43 +01:00
ca66f4444d Fix for color-wire auto-contrast 2014-11-09 01:01:26 +01:00
e6d6cbccc8 Merge branch 'master' into gooseberry 2014-11-08 22:31:28 +01:00
7f2f9f0acd Exposing customdata mask layer (CD_PAINT_MASK) to Python API
There are several more or less new customdata layers that currently cannot be accessed via Python (or some are exposed via BMesh API but not via Mesh API). This patch aims to expose one of those layers - CD_PAINT_MASK.
It'd be pretty useful for existing and future addons targeting sculpt workflow. Currently to get some access to the mask we employ a hackish approach via hiding/revealing masked vertices, this adds mode switches and doesn't allow to get actual mask values which could be useful if converted into vertex group weights for later use in e.g. modifiers. With this patch we'd be able to access mask data directly.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Subscribers: radcapricorn

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D782
2014-11-08 19:51:30 +01:00
3c0aed7dbc Implemented PIC and FLIP methods for combining the fluid grid simulation
with the Lagrangian hair model.
2014-11-08 19:34:16 +01:00
66f5f6770c Main solver step for generating a divergence-free hair velocity field
on the grid.

This uses the Eigen conjugate-gradient solver to solve the implicit
Poisson equation for the pressure Laplacian:

    div(grad(p)) = div(v)

As described in "Detail Preserving Continuum Simulation of Straight Hair"
(McAdams, Selle, 2009).
2014-11-08 18:45:28 +01:00
016168652f Allow separate widget data per editor.
To make this work, we need separate type/instance for the widgets. This
is a bit ugly but it is necessary if we want widgets on each editor to
depend of per editor-options or visibility state.
2014-11-07 18:12:32 +01:00
4e4c1a0ea0 Support undo. Scale stays same for non-3D widgets 2014-11-07 12:52:46 +01:00
70423fa275 Pampering the stupid MSVC compiler again, it fails to build valid C code. 2014-11-07 11:43:25 +01:00
c68eb204b5 Merge branch 'master' into gooseberry 2014-11-06 15:36:16 +01:00
b69314c620 Added new header for Eigen utility classes.
These make passing data between Eigen vector and matrix types and plain
C arrays more convenient.
2014-11-06 15:14:43 +01:00
68d835301e Updated a few comments. 2014-11-06 15:08:25 +01:00
a50706e07d Compile hair volumetrics code as C++, so we can use Eigen easier. 2014-11-06 15:05:42 +01:00
16bb70a1a4 Minor debug code fix. 2014-11-06 14:57:31 +01:00
29543afa4e Use a fixed, uniform cell size for hair continuum grids.
This is a bit more awkward for artists to use, but necessary for
a stable solution of the hair continuum calculation. The grid size is
defined by the user, the extent of the grid is then calculated based on
the hair geometry. A hard upper limit prevents bad memory allocation
in case too small values are entered.
2014-11-06 14:12:01 +01:00
08c477a6aa Removed unused voxel_filter_size DNA property.
This is an artifact of earlier attempts to implement velocity smoothing,
but doesn't work anyway.
2014-11-06 12:36:49 +01:00
cf28448364 Renamed HairVertexGrid to HairGrid, since it's not actually storing
hair vertex data.
2014-11-06 12:32:35 +01:00
439c7e089a Removed unused "collider grid" struct from hair volumetrics.
This is a leftover from previous approach of hair collisions (with
insufficient results). The hair volumetrics actually implements
"collision" with solid objects as well, but uses a Neumann boundary
condition on the main grid for this purpose.
2014-11-06 12:28:13 +01:00
7432efd9d7 Better grid rasterization method for hair volumetric grids.
This is based on the paper
"Detail Preserving Continuum Simulation of Straight Hair"
(McAdams, Selle, Ward, 2009)

The main difference is that hair line segments are used rather than only
rasterizing velocity at the vertices. This gives a much better coverage
of the hair volume grid, otherwise gaps can be produced at smaller grid
cell sizes and the distribution is uneven along the hair curve.

The algorithm for rasterizing is a variation of Bresenham's algorithm
extended onto 3D grids.
2014-11-06 12:17:09 +01:00
2a18501562 Add mapping to properties for widgets.
Still pretty much exploring the best way to move here but currently this
works by wrapping objects in RNA pointers, pretty much like buttons do.

Also modified the arrow widget for lamps to use the new code. The new
"unmbrella" widget works now as expected for lamps - of course fine
tuning is also needed.
2014-11-05 19:41:19 +01:00
04cb1b097a New debug element "circle" for simulations, which is quite useful for
visualizing scalar fields.
2014-11-05 19:17:39 +01:00
4b11cf171a Resurrection of 2.49 feature:
Ghosting of original arrow position while we are interacting with an
arrow widget.
2014-11-05 18:23:53 +01:00
71f1a3b1e2 Make projection code for arrow widget better. Also add some code to
allow tweaking of properties
2014-11-05 18:09:56 +01:00
49b972c43c Debug grid drawing for hair volume was drawing one subdivision too many. 2014-11-05 17:25:50 +01:00
e51d7a7a85 Merge branch 'master' into wiggly-widgets 2014-11-05 11:41:16 +01:00
5d42ab2ad0 Warnings 2014-11-04 17:58:50 +01:00
94d0fb0344 Merge branch 'master' into gooseberry 2014-11-04 17:10:33 +01:00
43d4a56d8d Support animation of camera dof properties.
Also minor cleanup
2014-11-04 17:02:08 +01:00
975e2580a8 Support animation of camera dof properties.
Also minor cleanup
2014-11-04 16:47:40 +01:00
5e8abc5afe Merge branch 'viewport_experiments' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_data_camera.py
	release/scripts/startup/bl_ui/space_view3d.py
2014-11-04 15:29:46 +01:00
7b0031b187 Avoid freeing and reading/writing NULL pointers. Should not happen often
but better guard against it.
2014-11-04 15:26:25 +01:00
4322085f4f Only show properties if not in camera view, else direct user to camera
properties
2014-11-04 15:25:55 +01:00
9480cede0f Avoid freeing and reading/writing NULL pointers. Should not happen often
but better guard against it.
2014-11-04 14:48:33 +01:00
4aad147fe4 Support camera GPU parameters when looking/rendering through camera in
the viewport.
2014-11-04 14:30:19 +01:00
b550e788f2 Use own file for GPU option types.
* Add gpu options for depth of field to camera - still inactive.
* GPUFXOptions now passed to the compositing system startup
so users can swap options if they wish to

This commit changes read-write data again, people should reset their
values again (sorry for that but this is still WIP)
2014-11-04 14:30:19 +01:00
3a87fb5508 Support camera GPU parameters when looking/rendering through camera in
the viewport.
2014-11-04 14:28:25 +01:00
f89fab339e Use own file for GPU option types.
* Add gpu options for depth of field to camera - still inactive.
* GPUFXOptions now passed to the compositing system startup
so users can swap options if they wish to

This commit changes read-write data again, people should reset their
values again (sorry for that but this is still WIP)
2014-11-04 13:02:30 +01:00
ca0a0abf57 Merge branch 'terrible_consequencer' into gooseberry 2014-11-04 11:24:22 +01:00
46b787bd6e Merge branch 'viewport_experiments' into gooseberry
Conflicts:
	source/blender/makesdna/DNA_view3d_types.h
2014-11-04 11:12:08 +01:00
c73b7a6790 Merge branch 'master' into gooseberry 2014-11-04 09:23:23 +01:00
46cc844f43 Offscreen rendering for viewport FX.
This is working mostly from the 3D viewport currently, rendering from
the render buttons or the sequencer will not use the FX yet. Still it's
a solid step towards that direction. Also moved options out of the v3d
struct. Old options will be lost and people may get some warnings,
however simply enableing and disabling one of the compositing settings
will bring the controls back.
2014-11-03 20:20:32 +01:00
038c0d5466 fix some errors 2014-11-03 15:51:19 +01:00
4139deab00 Merge branch 'master' into terrible_consequencer
Conflicts:
	source/blender/editors/include/UI_view2d.h
	source/blender/editors/space_sequencer/sequencer_edit.c
2014-11-03 15:45:20 +01:00
7798ecd743 Add another level of small blur to bridge between no/medium blurring.
Algorithm used is now a full implementation of

"Practical Post-Process depth of field", presented here [1],
with a few modifications as to how circle of confusion is
applied at the final pass.

[1] http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html
2014-11-03 14:06:47 +01:00
78d42f7885 Merge branch 'master' into viewport_experiments 2014-11-03 09:56:49 +01:00
fbb2c79618 Color Wire: improve method of tinting colors
also improve method to ensure contrast with background
2014-11-01 20:27:52 +01:00
eb8a09d567 DOF effect works :) 2014-10-31 21:23:57 +01:00
b455f80367 Unused leftover debug variable. 2014-10-31 21:20:38 +01:00
6a2ea7eb4e Reimplemented the voxel texture type for displaying hair continuum grids. 2014-10-31 20:29:51 +01:00
12657f7ef6 Expose hair grid info in the RNA (read-only); it can be useful for
debugging purposes.
2014-10-31 17:10:34 +01:00
adcdb4334b Debug visualization code of a slice of the hair velocity vector field. 2014-10-31 16:33:35 +01:00
2f1192d302 Removed arbitrary factor 2.0 on volumetric hair friction factor.
This was introducing energy into the system for any factor beyond 0.5
and caused major instability.
2014-10-31 16:30:54 +01:00
ff15a79cbd Fill the hair volume grid with the _new_ velocities from the first
solver step, instead of using the previous step's velocities.
2014-10-31 15:20:45 +01:00
2a5556b426 Merge branch 'master' into viewport_experiments 2014-10-31 14:45:00 +01:00
bcc5c1b4e1 Debug drawing feature to visualize the hair continuum grid. 2014-10-31 14:23:32 +01:00
53e624cd71 Perform grid-based velocity smoothing for hair outside of the implicit
solver step.

Calculating forces and jacobians from linearly interpolated grid values
is problematic due to discontinuities at the grid boundaries. The new
approach of modifying velocities after the backward euler solver step
was suggested in a newer paper

"Detail Preserving Continuum Simulation of Straight Hair"
(McAdams, Selle 2009)
2014-10-31 11:59:14 +01:00
a3b9dbf17c Merge branch 'master' into gooseberry 2014-10-30 22:34:08 +01:00
20ae92b352 Experimental color wire-frame (for testing in the studio) 2014-10-30 16:26:39 +01:00
82f30be425 Fix for warnings/errors 2014-10-30 16:17:30 +01:00
ad47b5a9d2 Merge branch 'master' into hair_immediate_fixes 2014-10-30 16:02:10 +01:00
1556753281 Reorganizing hair dynamics UI layout a bit to make settings slightly
more intuitive.

Also removed a couple of unused or useless features from the UI:
* collider friction is unused and replaced in favor of true collision
* spring damping refers to structural springs (stretch), which is
  not noticable in hair due to extreme stiffness atm.
* pressure factors are not sure since this feature is too unstable atm.
2014-10-30 15:59:13 +01:00
356ed34ba5 Disabled the hair preview feature in the code, due to limited usefulness.
Interpolating hairs in a meaningful way is a quite difficult problem.
It works ok-ish for child hairs as long as they don't move, but with
motion the direction of interpolated hairs can become quite nonsensical
quickly.

Probably a better way to create simulation previews is to limit
simulation to a particular well-defined area (like render preview
borders), but run it in full detail in that area. The error from
omitting some interaction should still be much less than orientation
errors from interpolation.
2014-10-30 15:59:13 +01:00
2f1631f747 Moved render simplification function for particle distribution into the
distribution code.
2014-10-30 15:59:13 +01:00
00151430fc Removed unused variable. 2014-10-30 15:59:13 +01:00
ec476a168b A little bit of code sanity by splitting particle distribution function
by type.

Instead of squashing totally unrelated code into the same monster
function.
2014-10-30 15:59:13 +01:00
d4823812fa Moved particle code for distributions into own file to make hacking
easier.

This code is badly broken and needs to be replaced, but at least having
a workable code structure might help with quick hacks to fix the worst
cases.
2014-10-30 15:59:13 +01:00
7a59a58990 Removed unused line. 2014-10-30 15:59:13 +01:00
bbddc2c033 New hair editing feature "Shape Cut", for cutting hair based on a mesh
shape instead of a brush tool.

The brush cutting tool for hair, while useful, is not very accurate and
often requires rotating the model constantly to get the right trimming
on every side. This makes adjustments to a hair shape a very tedious
process.

On the other hand, making proxy meshes for hair shapes is a common
workflow. The new operator allows using such rough meshes as boundaries
for hair. All hairs that are outside the shape mesh are removed, while
those cutting it at some length are shortened accordingly.

The operator can be accessed in the particle edit mode toolbar via the
"Shape Cut" button. The "Shape Object" must be set first and stays
selected as a tool setting for repeatedly applying the shape.
2014-10-30 15:59:13 +01:00
d1be54886e Switched back to blender implicit solver for merge. 2014-10-30 15:59:13 +01:00
2224220d20 Unified the main Eigen solver function a bit for constrained/unconstrained
solver variants.
2014-10-30 15:59:13 +01:00
e57d3af847 Ported the remaining implicit solver functions for Eigen.
Also added a couple of utility wrapper functions for Eigen types to make
interfacing with plain float arrays and blenlib math easier.
2014-10-30 15:59:13 +01:00
4e38d9df9e Updating Eigen implicit dynamics solver implementation to adhere to the
new mass-spring solver API.
2014-10-30 15:59:13 +01:00
4dd4145fee Merge branch 'master' into gooseberry 2014-10-30 15:31:47 +01:00
f63ce02a63 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenlib/BLI_math_matrix.h
	source/blender/blenlib/intern/math_matrix.c
	source/blender/editors/object/object_bake_api.c
2014-10-30 15:24:40 +01:00
b6393da835 Reorganizing hair dynamics UI layout a bit to make settings slightly
more intuitive.

Also removed a couple of unused or useless features from the UI:
* collider friction is unused and replaced in favor of true collision
* spring damping refers to structural springs (stretch), which is
  not noticable in hair due to extreme stiffness atm.
* pressure factors are not sure since this feature is too unstable atm.
2014-10-30 15:10:34 +01:00
3e5627ec57 Disabled the hair preview feature in the code, due to limited usefulness.
Interpolating hairs in a meaningful way is a quite difficult problem.
It works ok-ish for child hairs as long as they don't move, but with
motion the direction of interpolated hairs can become quite nonsensical
quickly.

Probably a better way to create simulation previews is to limit
simulation to a particular well-defined area (like render preview
borders), but run it in full detail in that area. The error from
omitting some interaction should still be much less than orientation
errors from interpolation.
2014-10-30 14:41:14 +01:00
de27811177 Correctly downsample circles of confusion and use parallelism to do it
more efficient.
2014-10-29 19:41:12 +01:00
6484056cc1 Second pass, blurs the downsampled buffer once. 2014-10-29 18:31:15 +01:00
a4f35de026 Use the correct shaders and varyings 2014-10-29 18:08:22 +01:00
ba2f0ad779 Viewport DOF:
* Scons builds correctly
* Separate vertex shader file for DOF, will make handling main easier
* Downsample color buffer + blur it. Circle of confusion is calculated
from zplane instead of length of distance from camera.
2014-10-29 16:18:19 +01:00
e0cba973e7 First ping pong between low resolution buffers working. Nice landmark
for working code.

Also cleanup unused variables and do not bind the same texture to two slots
(blurred texture is going to be different anyway)
2014-10-29 12:46:25 +01:00
c6292918a3 Framebuffer compositing:
* Cleanup compositing buffers better when not needed.

* Support passes for the dof effect through defines in main - easy
solution to allow not having too many files for one shader effect.
2014-10-29 12:01:13 +01:00
518f794a6f SSAO and DOF work well together now. 2014-10-29 11:12:41 +01:00
dc22a50488 Code that enables simultaneous DOF-SSAO effect. There's some sort of
texture coordinate offset still.
2014-10-28 21:24:38 +01:00
d2d3bd35c1 Use optimized view space reconstruction for ortho case as well. 2014-10-28 19:44:05 +01:00
0782c680a6 Add a library file for projection shader code, should enable us to use
optimized position calculation again - relevant for both SSAO and DOF
2014-10-28 19:07:58 +01:00
8f25b6d6c8 More attempts to synchronize viewport and camera dof - probably will
need fixes in the rendering systems. Reserve textures for the dof
effect.
2014-10-28 18:28:58 +01:00
d86c686e41 Moved render simplification function for particle distribution into the
distribution code.
2014-10-28 17:16:59 +01:00
97caee6c46 Removed unused variable. 2014-10-28 17:09:45 +01:00
e43ecb1201 A little bit of code sanity by splitting particle distribution function
by type.

Instead of squashing totally unrelated code into the same monster
function.
2014-10-28 16:45:23 +01:00
d6e93d9dfe Moved particle code for distributions into own file to make hacking
easier.

This code is badly broken and needs to be replaced, but at least having
a workable code structure might help with quick hacks to fix the worst
cases.
2014-10-28 16:29:33 +01:00
6e8ba2f3f5 DOF calculation shader. 2014-10-27 20:45:51 +01:00
c48abbb090 Merge branch 'master' into viewport_experiments 2014-10-27 11:10:49 +01:00
5efa0e03b5 Add separate file for DOF effect and cleanup the parameter passing a little. 2014-10-27 10:06:56 +01:00
d54c249a7b Separate SSAO pass - it's unlikely we'll be able to reuse this with
depth of field in one pass, so better separate the shaders as well
2014-10-23 22:42:48 +02:00
3967f5659d Fix irritating issue with self shadowing.
Issue here was position reconstruction could use depths from pixels off
the initial position. Using linear filtering here eliminates the issue.

Usually this is not correct however given that for depth discontinuities
we will get different depths anyway, the cases where we get smooth
interpolation of depths helps a lot in image quality.
2014-10-23 20:12:39 +02:00
1082a2f125 Add some pedantic GLSL casts to make shader compile in OSX 2014-10-23 17:01:19 +02:00
ddb33a3181 SSAO introduce quality settings
Basically change the way SSAO samples the screen by using a circular
filter instead. This is inspired by HBAO though we still don't use this.

The quality settings change the number and density of samples. We can
definitely improve things here though.

We also jitter the sampling locations per pixel. Generally this adds a
kind of noise. Some banding is, unfortunately still apparent and small
distances will introduce noise. This can be fixed but I will have to see
if it can be done without much of a cost.
2014-10-22 19:27:43 +02:00
f19fcf7aad Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenkernel/intern/key.c
2014-10-22 18:12:42 +02:00
cfd13b6dd2 Removed unused line. 2014-10-22 18:11:12 +02:00
529c287260 New hair editing feature "Shape Cut", for cutting hair based on a mesh
shape instead of a brush tool.

The brush cutting tool for hair, while useful, is not very accurate and
often requires rotating the model constantly to get the right trimming
on every side. This makes adjustments to a hair shape a very tedious
process.

On the other hand, making proxy meshes for hair shapes is a common
workflow. The new operator allows using such rough meshes as boundaries
for hair. All hairs that are outside the shape mesh are removed, while
those cutting it at some length are shortened accordingly.

The operator can be accessed in the particle edit mode toolbar via the
"Shape Cut" button. The "Shape Object" must be set first and stays
selected as a tool setting for repeatedly applying the shape.
2014-10-22 16:42:32 +02:00
33e7e1ddb2 SSAO works again. Unfortunately it's unavoidable to have it work without
explicit attenuation control (by using just max distance).

Also it now supports orthographic cameras properly. The maximum distance is
now defined in world space units so it should be slightly easier to understand
and uniform across perspective and orthographic cameras.

The optimizations can be generalized for orthographic cameras but the code is
more complex and the runtime advantage is questionable in that case
(in the end a matrix transform is 4 dot products which are not that terrible)
so commented out the code there for now.
2014-10-22 16:33:33 +02:00
c7e85ca92c Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/key.c
	source/blender/blenloader/intern/versioning_270.c
2014-10-22 11:20:43 +02:00
0c8469c440 Correct normal reconstruction with optimized formula.
This needed some adjustments from the formula I found on the article on
view space reconstruction, since OpenGL makes different assumptions about its
projection matrix.

SSAO does not work yet correctly under new model assumptions but we are going
to substitute with nice horizon based ambient occlusion.
2014-10-22 01:14:25 +02:00
30be0f0977 Refactoring of SSAO code. Uses some optimizations but result is different
still test file here to help with debugging.
2014-10-21 20:33:09 +02:00
e1755158c0 Merge branch 'master' into viewport_experiments 2014-10-21 16:54:24 +02:00
e963efcd19 Normalize the depth to the -1.0 to 1.0 range as well. 2014-10-20 21:46:29 +02:00
5b4b83d7e3 Add shader files to the source tree. It helps by displaying them in the
IDE
2014-10-20 20:38:50 +02:00
5c31594ab7 Merge branch 'master' into viewport_experiments 2014-10-20 18:56:00 +02:00
f7c5a231d5 Merge branch 'master' into terrible_consequencer
Conflicts:
	source/blender/editors/space_sequencer/sequencer_edit.c
	source/blender/editors/space_sequencer/sequencer_ops.c
2014-10-20 15:49:54 +02:00
18bc829e5e Trim tool:
Support metastrips and multiple strips at once.
2014-10-20 15:01:34 +02:00
c99b02b047 WIP support for meta trimming 2014-10-20 11:04:14 +02:00
09180f7ca8 Merge branch 'master' into terrible_consequencer 2014-10-20 10:55:34 +02:00
388dc24330 Hook widget event to the lamp operator. 2014-10-17 19:17:05 +02:00
97bb7d0a5b Hook calling widget to operator event system. Alpha alpha code still.
Transform/lamp still don't process those.
2014-10-17 17:11:14 +02:00
ffac46c30c Store the active widget in the context. This allows us to first call the
widget handler if needed.
2014-10-17 16:45:26 +02:00
1f9f58938d Arrow handler that does something useful (tm). However still not hooked
up to operators.
2014-10-17 16:11:23 +02:00
585204bd61 Dummy handler for arrows, take care of some allocation issues for
operators.
2014-10-17 15:09:51 +02:00
80c9a971f9 Add callbacks for operator initialization. Now a widget will directly
call an operator and have its own handlers for input.

No handlers implemented yet.
2014-10-17 14:48:58 +02:00
28599523fc Classic fix linking of the widget library. 2014-10-17 11:23:07 +02:00
057c7fd6cb Merge branch 'master' into wiggly-widgets 2014-10-17 10:45:48 +02:00
050bc3f3c4 More API reorganization 2014-10-15 19:49:21 +02:00
c56b812f76 WIP commit, basically introducing a few things here:
* highlighted vs active widget.

Active widget takes all input and basically highjacks drawing of all
other widgets in the widgetmap.

* operator names for widgets. Now widgets will spawn operators based on
names that are passed on them. They will also modify a named property of
the operator and pass it on, after which operator can process it.
2014-10-15 19:16:09 +02:00
814fb1e775 Manipulator:
* Fix error in plane manipulator handling.
* Don't show manipulator widgets on paint modes.
2014-10-15 16:56:31 +02:00
4581091fc4 Only detect active widget on mousemoves. Now handler operates on
mouseclick (bound to change)
2014-10-15 16:37:46 +02:00
a4bb56f9ba Merge branch 'master' into wiggly-widgets 2014-10-15 15:51:52 +02:00
8b90c081b0 Ring widgets:
Add a clipping style, just like manipulator
2014-10-15 15:45:17 +02:00
9a6719a314 Undo previous changes to sound.
The sound system really needs better design for the sequencer and
patching it up now won't really help us in the long run.

Also the sequencer kept leaking file descriptors when preserving
the audio handlles on undo making the branch unusable on mac and
windows.

It's almost certain patching over this will lead to more trouble, better
handle it separately and keep the system working for now.

Kept threaded loading of waveforms since we control the file input
directly there and leads to nice speedup, but we still clear the whole
sound + the waveform on undo, which is pretty bad.
2014-10-15 14:20:44 +02:00
d2fd772374 Merge branch 'master' into terrible_consequencer 2014-10-15 11:40:21 +02:00
687cb3ab86 Add space for facegroup storage 2014-10-15 10:49:58 +02:00
9c5e1a0ea5 Widgets:
* Move lamp operators to a proper place
* Store a list of widgets to avoid polling too many times
* Fix wrong indices when widgetgroup was not used.
* Lamp widget now uses an arrow widget. This will be refined to make a
nice prototype for operator/widget interaction.
2014-10-14 18:37:28 +02:00
ebfad36a22 Use a property to make the transform operator widget driven.
Design is still pending here, but for now just use to not remove widget
display.
2014-10-14 16:20:20 +02:00
1b936e8ce6 Change dial to something that resembles current rotation widget better. 2014-10-14 13:03:30 +02:00
20fc027690 Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2014-10-14 12:54:12 +02:00
e7da5a2d8f Merge branch 'master' into hair_immediate_fixes 2014-10-14 09:07:58 +02:00
35d504d136 Merge branch 'master' into gooseberry 2014-10-13 20:00:53 +02:00
c5a9add370 Dial widget, used in rotation manipulator code.
The widget can still change in the future, also widget styles can always
be used to create new widget visualizations.
2014-10-13 18:16:09 +02:00
14686a3677 Implement non-3D drawing per widget.
Basically, 3D widgets stay the same size whatever the zoom is in 3D
view. Ported over from manipulator code.
2014-10-13 16:43:35 +02:00
543dfc2a6a Merge branch 'master' into wiggly-widgets 2014-10-13 16:13:19 +02:00
41f1bb1096 Switched back to blender implicit solver for merge. 2014-10-12 17:13:08 +02:00
75ca718d8f Unified the main Eigen solver function a bit for constrained/unconstrained
solver variants.
2014-10-12 17:04:04 +02:00
5b1bfacfe2 Ported the remaining implicit solver functions for Eigen.
Also added a couple of utility wrapper functions for Eigen types to make
interfacing with plain float arrays and blenlib math easier.
2014-10-12 16:14:15 +02:00
dbe2f67ca5 Updating Eigen implicit dynamics solver implementation to adhere to the
new mass-spring solver API.
2014-10-12 12:45:07 +02:00
a0ac1c8b5c Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-11 11:23:24 +02:00
afa23b3919 Compatibility fix for shape keys.
Avoid moving the 'from' pointer around in DNA. This way files stay back-
as well as forward-compatible. Only the additional type enum and
sub-index is stored in a new from_extra struct in shape keys now.
2014-10-11 11:21:31 +02:00
c2765bd99f Fix for invalid ID access during versioning.
For now is fixed by doing a versioning hack in the lib_link function,
but would be nicer to avoid this altogether for forward compatibility.
2014-10-10 14:55:20 +02:00
5739db16eb Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-10 10:37:29 +02:00
ed19740751 Merge branch 'master' into hair_immediate_fixes 2014-10-10 10:33:09 +02:00
af0de1c646 Interpolation for non-simulated hairs in preview.
This generates a somewhat believable overall look for the hair system
by blending simulated hairs. For small number of hairs and small
preview ratios this can get quite inaccurate, but that's the tradeoff
for getting preview functionality ...
2014-10-10 10:29:02 +02:00
7cd6d9aada Calculate blending weights for preview hairs by constructing a kd-tree
of simulated hairs and using nearest neighbors.
2014-10-09 12:52:52 +02:00
06a854cddb Removed debug prints. 2014-10-09 12:18:04 +02:00
0d2dfcb212 Solved various update issues with the hair preview factor.
This is still terribly messy, especially because every change of the
particle system has to be piped through the dummy cloth modifier somehow.
The automatic caching system also tends to get in the way a lot; after
changing the preview factor one basically always has to start at frame 1
currently because the cloth modifier has to be reconstructed and forgets
about all caching.
2014-10-09 12:14:36 +02:00
face9721d8 Widgets:
* Add option for shaded/non shaded widgets
* Normalize arrow widget size to 1.0 so size is predictable. Probably
will use the same scheme for other widgets as well
2014-10-08 22:51:54 +02:00
e8d49c06c0 All translation axis now drawn and operated through the widget system. 2014-10-08 20:11:19 +02:00
334b25a226 * Manipulator Y 3D arrow moved and rotated correctly.
* Light manipulator doing undo now
* Scons should be fixed.
2014-10-08 19:34:16 +02:00
e15819daf3 Green widget handles y translation properly. 2014-10-08 18:32:06 +02:00
c1ffa9d0e0 ManipulatorGroup customdata.
Make WidgetGroup data private.
2014-10-08 18:13:12 +02:00
3a55705044 WidgetGroup now handles updating the manipulator properties.
Still not hooked new arrow widget to the system
2014-10-08 16:56:15 +02:00
02b81b3bca Add python exporter that exports a mesh in a C file in a renderer-ready
format (vertices + normals + triangle vertex indices)

This will allow us to create widgets in blender instead of defining them
programmatically.

May also support facegroups for different colors in the future though
they must be somehow tied to the UI colors.
2014-10-08 15:50:30 +02:00
671a508ae3 Enable depth testing for widgets.
Especially if we have many widgets on screen, sorting them will be
difficult and for mesh-armature widgets it will be unavoidable if we
want to avoid tweaking "back" surfaces.
2014-10-08 12:45:54 +02:00
e2c5839114 Merge branch 'master' into wiggly-widgets 2014-10-08 12:31:05 +02:00
237d7f3188 Complete shaded arrow widget code. It will need sorting if keep the
shading.
2014-10-07 20:29:40 +02:00
b9b0495de9 WIP redesign of the system. Nothing functional (not even manipulator).
There is first code for display of an arrow widget. The manipulator will
use those when they are ready.

Basically the manipulator is now a WidgetGroup. WidgetGroups are a new entity and
they manage a group of related widgets. They should be responsible for state update,
drawing and polling of their widgets and can be bound to specific rules.

There is a big design plan on a whiteboard beside me, it will take a few
big commits still to take shape though. One thing at a time, I am first making
reusable arrow widgets that will allow us replace the translate widgets properly.

There are a few reusable widgets planned, more to come later.
2014-10-07 19:09:45 +02:00
dd9f957ccb Preliminary commit for simulation preview. 2014-10-07 17:27:04 +02:00
6f0602ca17 Dragging the light handle will now point the lamp to the point in 3D
where user is dragging over.
2014-10-07 12:48:29 +02:00
2fa1dfacda Merge branch 'master' into wiggly-widgets 2014-10-07 11:14:47 +02:00
854db0f0ae enum instead of #define for cloth vertex flags. 2014-10-07 10:12:42 +02:00
635ce0e9ed Removed accidentally committed debug print. 2014-10-06 19:10:07 +02:00
860a27d00d Removed accidentally committed debug print. 2014-10-06 19:09:18 +02:00
cdca6e7be4 Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-06 19:02:57 +02:00
2d09ebb5b6 Use the generic task scheduler for threaded particle tasks, i.e.
distribution and path caching for child particles.

This gives a significant improvement of viewport playback performance
with higher child particle counts. Particles previously used their own
threads and had a rather high limit for threading. Also threading
apparently was disabled because only 1 thread was being used ...
2014-10-06 18:58:41 +02:00
1383661488 Merge branch 'master' into hair_immediate_fixes 2014-10-06 11:48:19 +02:00
5731472612 Removed block matrix indices storage from ClothSpring struct.
This is not necessary: the implicit solver data can keep track instead
of how many off-diagonal matrix blocks are in use (provided the
allocation limit is calculated correctly). Every time a spring is
created it then simply increments this counter and uses the block index
locally - no need to store this persistently.
2014-10-04 16:14:40 +02:00
a44e944c99 Removed unused force arguments for angular bending springs and avoid
redundant calculation for counterforces.
2014-10-04 15:56:06 +02:00
5b52e4b1f6 Fix for brackets lost in merge. 2014-10-04 11:50:13 +02:00
2976eb598a Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2014-10-04 11:19:01 +02:00
f8b19d1d6e Logic for light position operator. 2014-10-03 19:51:26 +02:00
ce9603e382 WIP, operator to tweak the lamp "focus", driven through widgets. 2014-10-03 19:11:24 +02:00
8f86174ea5 Use the hair shape keys as goal positions (xconst) in the hair solver.
Note that this does not change the natural bending shape of the hair so
far, but only affects the global goal position for now.
2014-10-03 17:32:58 +02:00
37a7421e10 Lamp widget:
* Make a lamp widget design for the active lamp.
* Fix some handler errors for widgets + autoupdate for different widget
handles.
2014-10-03 17:11:01 +02:00
71dd6e2ada Guide hair drawing for hair particles.
Without this the particle system only shows the actual non-simulated
hairs ("guide hairs") during edit mode. These hairs are used for goals
as well, so showing them in the regular viewport is pretty important.

Also the usual hair curves are interpolated along the entire length,
which makes it very difficult to see exact vertex positions, unless
using exact powers of 2 for the segment number and match the display
steps.
2014-10-03 16:46:08 +02:00
98caf9331d Fixed RNA update callbacks to ensure the hair path cache is rebuilt. 2014-10-03 14:54:21 +02:00
1b8781b40e Fix for hair shape key ui script. 2014-10-03 14:19:32 +02:00
b69cf65893 Fixed some ui script errors. 2014-10-03 14:06:29 +02:00
6db28d51b6 Fixed some uses of ob->shapenr instead of psys->shapenr. 2014-10-03 14:05:59 +02:00
f208502fb3 Replaced the single ID *from pointer in shape keys with a more
detailed `owner` struct.

This allows distinction of classic ID block shape keys from particle
system keys.
2014-10-03 14:04:42 +02:00
639ff6e94d Evaluate shape keys when building the particle path cache. 2014-10-03 12:16:24 +02:00
007974899f Placeholder widget code for spotlamps 2014-10-03 12:15:57 +02:00
0b104fa5c5 Shape key "specials" menu for particle shape keys. 2014-10-03 09:49:10 +02:00
94512106f5 Renamed file to make it consistent with object shapekey operators. 2014-10-03 09:09:04 +02:00
8c92b530dd Fix for RNA using ptr->id.data instead of ptr->data for ParticleSystem. 2014-10-03 09:06:34 +02:00
88105788ac Merge branch 'master' into wiggly-widgets 2014-10-02 20:34:26 +02:00
6c09f016de Move widget drawing at a higher level - try drawing on top of rendering
too.

Rationale - widgets might be useful to have even on rendered scenes -
we'll have to see about how this will work

Also use area initialization code to register region specific widgets once.

lala
2014-10-02 20:33:59 +02:00
0b6e2aa6d2 Conversion functions from/to hair shape keys to particle data. 2014-10-02 19:20:16 +02:00
d9b7f7305a Shape key infrastructure for hair. 2014-10-02 19:04:59 +02:00
2ee254e1a8 Merge branch 'master' into wiggly-widgets 2014-10-01 19:18:15 +02:00
b1f3383eec Merge branch 'wiggly-widgets' into gooseberry 2014-10-01 19:02:54 +02:00
392e9e18f1 Fix release comfirm for central widget in transform operator 2014-10-01 19:01:18 +02:00
d928155df1 Fixes to highlight code, now widgetmaps remember last active widget and
reset accordingly.
2014-10-01 18:44:40 +02:00
43c2e17289 Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-01 18:33:04 +02:00
7aee4e2997 Improved child hair curling for interpolated child particles.
The curl radius for children in interpolated mode was calculated using
the total offset from the parent particle. This leads to very large
radii when the distance is large due to sparse parents. Such behavior is
also very unrealistic because the curl radius is mostly constant and
defined by the material properties.

All the child hairs are roughly parallel by default. To simulate the
agglomeration of children into hair wisps the "flatness" parameter is
now used to clump them together.
2014-10-01 18:25:17 +02:00
7e2dd7d3e1 Highlighting for manipulator widget.
This should use an "active" system, similar to buttons to detect if last
widget has changed and act accordingly. Currently, when the active
widget changes, there is no change in highlights.
2014-10-01 17:43:33 +02:00
2b7f356442 Tidy up the widget API, only do 3d intersection on widgetmaps that
support it (determined during creation)
2014-10-01 15:37:45 +02:00
8e1208c974 Widget API:
Code that handles 3D object intersection via GPU selection. We might
want to use raycasting here, but leaving that for when we have it.

Manipulator code now uses this API to do intersection testing
2014-10-01 14:59:09 +02:00
4ce4f57acf Refactoring of manipulator code to use selection evaluation and codes
that can be shared with other widgets.
2014-10-01 12:44:17 +02:00
d2e148f2de Cloth solver data for edit mode is unused, removed it. 2014-10-01 11:25:45 +02:00
76dc35fcde Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-01 11:16:04 +02:00
182535b296 Merge branch 'master' into hair_immediate_fixes 2014-10-01 10:06:00 +02:00
18cffd6fbf WIP code reshuffling for widgets 2014-09-30 18:33:23 +02:00
088ff210a9 Manipulator now uses the widget system (no operators used).
Widgets use a similar notification system as operators. It might be
worth using WM_BREAK messages like the rest of the handlers. For now
this should do.
2014-09-29 19:48:38 +02:00
10a3ca0189 Move manipulator handler to the widget system. 2014-09-29 18:51:00 +02:00
60e77c50ee Draw manipulator from widget callback (handling still done separately) 2014-09-29 16:36:08 +02:00
3982f9daf0 Merge branch 'master' into wiggly-widgets 2014-09-29 14:16:19 +02:00
c7ccbc9e75 Fix for scons files missing physics include folder. 2014-09-26 23:38:42 +02:00
07dac94618 Yet another attempt to solve OSX issues, restore sequence sounds too, or
sounds get added to two sequence and file descriptors leak
2014-09-26 19:47:21 +02:00
ebf005e32b Added separate damping for bending springs.
The bend damping factor was hardcoded to the same value as the stiffness.
Now it has its own factor in the settings and button in hair dynamics.
2014-09-26 17:25:21 +02:00
06871e6fbc Minor corrections to the types 2014-09-26 13:57:05 +02:00
ac97720734 New data types for sequencer.
Uses struct hierarchies to reduce the data used per strip.

Also changed sequence -> strip. Might be better to use NSequence for
editing as well.
2014-09-26 12:17:12 +02:00
56719625fc Merge branch 'master' into terrible_consequencer 2014-09-26 10:32:06 +02:00
e239912c06 Set the length threshold for hair simulation to 10% again (from 1%).
With the default 5 substeps the simulation can otherwise still become
unstable. This is just a preliminary measure anyway until the length
variance can be fixed properly.
2014-09-26 10:08:56 +02:00
b89a1a64c5 Fix for outdated root array size when changing the particle amount
during simulation.
2014-09-26 09:33:51 +02:00
408837ed1b Fix for hair chain testing in the cloth modifier.
Bending springs are en-bloc and not interleaved with other springs, so
this can't be used as a test for hair roots. Use consecutive indices
instead.
2014-09-26 09:26:08 +02:00
2682ea830a Completed the implementation of bent rest shapes for hair.
Basically follows the Pixar approach from "Artistic Simulation of Curly
Hair".
2014-09-25 23:19:20 +02:00
0717da3ac5 Gooseberry request: Backdrop for sequencer. 2014-09-25 23:09:38 +02:00
7c83650fb3 Add missing notification for trimming to stop showing the extensions 2014-09-25 18:10:39 +02:00
36607080bd Gooseberry request, hide the extensions except when trimming. 2014-09-25 18:00:00 +02:00
ca7219ddff Get rid of temporary flags when loading the sound. 2014-09-25 16:59:34 +02:00
d366d8e028 Attempt to fix OSX issues (again): cleanup the loading flag for files
that are loading when interrupted.
2014-09-25 16:26:52 +02:00
d0ac4e1c60 Target calculation for local non-straight rest shapes.
This is more involved than using simple straight bending targets
constructed from the neighboring segments, but necessary for restoring
groomed rest shapes.

The targets are defined by parallel-transporting a coordinate frame
along the hair, which smoothly rotates to avoid sudden twisting (Frenet
frame problem). The rest positions of hair vertices defines the target
vectors relative to the frame. In the deformed motion state the frame
is then recalculated and the targets constructed in world/root space.
2014-09-25 15:42:08 +02:00
26a906d53c Have to include BLI_utildefines before BKE_collision now to have bool
defined.
2014-09-25 11:03:31 +02:00
6dcc3f0b91 change widget code, area now just stores a pointer to the widget list
corresponidng to it.
2014-09-24 19:09:07 +02:00
5dfb07ab43 Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenkernel/intern/implicit.c
2014-09-24 19:02:58 +02:00
2bb6d18f41 Merge branch 'master' into wiggly-widgets 2014-09-24 18:30:56 +02:00
467da3ce16 Store the waveforms between undo steps when they exist. 2014-09-24 17:03:35 +02:00
0684d0fe9f Fix compilation in MacOSX 2014-09-24 16:28:50 +02:00
8e95eae192 More undo issue solving.
This commit moves sound loading out of library linking. The approach
chosen here is to do lazy initialization by basically validating the
sound before attaching to the scene.

Loading the sound buffer requires a valid Main pointer, which means we
have to pass this around in many places. We might also consider caching
the waveforms in this way too, but for now we're still using the
threaded update.

We'll have to test this somewhat to see if it behaves well..There are
corner cases which might not be covered. Sounds are muted if we undo
during an animation, but this bug existed in master as well.
2014-09-24 16:21:49 +02:00
aebcb6a860 Merge branch 'master' into terrible_consequencer 2014-09-24 10:23:37 +02:00
c95c25e29e Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2014-09-24 10:05:04 +02:00
f3f741b3a4 Clear forces and constraints together at the start of the time step,
easier to verify.
2014-09-24 08:55:29 +02:00
9aa7fcd588 Threaded sound strip display data loading.
Sound loading can take too much so move it to a job and continue. This makes
interaction much better. A similar system should be usable for movie previews.
2014-09-23 17:37:19 +02:00
2788b38e38 Fix for missing initialization of local cloth modifier inside particle
systems.
2014-09-22 21:20:22 +02:00
ee323fc61d Proper implementation of angular bending springs including jacobian
derivatives for stabilization.

The bending forces are based on a simplified torsion model where each
neighboring point of a vertex creates a force toward a local goal. This
can be extended later by defining the goals in a local curve frame, so
that natural hair shapes other than perfectly straight hair are
supported.

Calculating the jacobians for the bending forces analytically proved
quite difficult and doesn't work yet, so the fallback method for now
is a straightforward finite difference method. This works very well and
is not too costly. Even the original paper ("Artistic Simulation of
Curly Hair") suggests this approach.
2014-09-22 19:27:41 +02:00
bf996074bb Gooseberry request, option to turn all waveform display on/off. 2014-09-22 15:29:22 +02:00
c4b6d60af3 Attempt to fix shader compilation in OSX. strict compilation does not
allow dividing float by integer.
2014-09-22 14:20:30 +02:00
f0fb58afe3 Unused function declaration. 2014-09-21 11:48:27 +02:00
caf81de33c Basic solver result feedback from the mass-spring (cloth/hair) solver.
This returns a general status (success/no-convergence/other) along with
basic statistics (min/max/average) for the error value and the number
of iterations. It allows some general estimation of the simulation
quality and detection of critical settings that could become a problem.
Better visualization and extended feedback can follow later.
2014-09-20 21:05:46 +02:00
9b1f109c89 Hack to make undo/redo faster in sequencer when using strips with
waveform display.

Basically, we store the waveform. This is not really recommended but
until we have nice threaded creation for the strips that doesn't block
the interface it's a nice solution for gooseverry.

May be wise to limit the undo memory for people who use that because
basically each operation will store a copy of the waveform in the file.
2014-09-19 19:51:01 +02:00
0f62717edb Merge branch 'master' into terrible_consequencer 2014-09-19 19:15:35 +02:00
1760d7566a Calculate bending targets based on the direction of previous segments.
This makes the bending a truely local effect. Eventually target
directions should be based in a local coordinate frame that gets
parallel transported along the curve. This will allow non-straight
rest shapes for hairs as well as supporting twist forces. However,
calculating locally transformed spring forces is more complicated.
2014-09-19 16:53:35 +02:00
1cd9800f3c Simple debug drawing support inside the implicit solver. 2014-09-19 16:52:49 +02:00
f0cf10b3b9 Widgets API.
This commit has first WIP code for widgets API.
Generally widgets should be registered similar to dropboxes, that is,
any code can query for a widgetmap for a certain space and area type
and the window manager will take care of initializing the handlers
automatically.

The owner will be able remove and readd widgets to a certain widgetmap
dynamically. Generally owners should cleanup their widgets though initial code
cleans up leftover widgets automatically.

All this is the theory still, some parts are in that commit, more to come
later, but it's a solid base to build from for an initial commit.
2014-09-19 13:07:01 +02:00
eb38d27b33 Added a damping term for angular bending springs. 2014-09-19 11:51:35 +02:00
1e8f11c473 Simple initial implementation of angular bending springs.
These are much better suited for creating stiff hair. The previous
bending springs are based on "push" type spring along the hypothenuse
of 3 hair vertices. This sort of spring requires a very large force
in the direction of the spring for any angular effect, and is still
unstable in the equilibrium.

The new bending spring model is based on "target" vectors defined in a
local hair frame, which generates a force perpendicular to the hair
segment. For further details see
"Artistic Simulation of Curly Hair" (Pixar technical memo #12-03a)
or
"A Mass Spring Model for Hair Simulation" (Selle, Lentine, Fedkiw 2008)

Currently the implementation uses a single root frame that is not yet
propagated along the hair, so the resulting rest shape is not very
natural. Also damping and derivatives are still missing.
2014-09-19 11:15:16 +02:00
33cee269da Custom color for SSAO 2014-09-18 21:40:45 +02:00
ce9fb0e997 Do not calculate SSAO on the background. Saves cycles on pixel shaders
as well as solves issue with SSAO artifacts around grids.
2014-09-18 21:20:46 +02:00
0416edaa6a Replace the dynamic root transform in the implicit solver data with a
single transform matrix.

Dynamic properties of the transformation are only needed during the
setup phase when they should be read from external data (hair system
roots) and generate fictitious forces on each point.
2014-09-18 19:42:20 +02:00
6b94a91827 More scons fixes for physics lib. 2014-09-18 11:27:34 +02:00
af484ae58e Merge branch 'master' into hair_immediate_fixes 2014-09-18 11:04:05 +02:00
2ed8ff0f02 Fixed scons build files for new physics subfolder. 2014-09-18 10:35:26 +02:00
3b4dd79db9 Disabled the velocity filtering feature for now, since the weighting is
incorrect.

The voxel grid needs better tool support to make it usable, so fixing
the filtering is not high priority right now.
2014-09-18 09:24:31 +02:00
41a71918bb Added basic filtering feature for velocity smoothing.
This is part of the original method from "Volumetric Methods for
Simulation and Rendering of Hair". The current filter is a simple box
filter. Other energy-preserving filters such as gaussian filtering
can be implemented later.

The filter size is currently given as a cell count. This is not ideal,
rather it should use a geometrical length value, but this is too
abstract for proper artistical use. Eventually defining the whole grid
in terms of spatial size might work better (possibly using an external
object).
2014-09-18 09:06:25 +02:00
dc1e92f16d Made the voxel grid size for hair interaction configurable and increased
the default to 32.
2014-09-17 14:21:06 +02:00
7334e9de91 Reduced the length threshold for disabling short hairs from 0.1 to 0.01. 2014-09-17 13:49:10 +02:00
b963bddd01 Fix for rB71271bb, was replacing the force vectors entirely instead of
adding.
2014-09-17 11:34:39 +02:00
71271bb0c7 Fix for effector force fields on hair, using the world-to-root
transformation.
2014-09-17 11:01:23 +02:00
ea6c0355f6 Add weak repulsion forces to hair collision response to keep the hair
at a the margin distance ("outer" softbody margin).

This has to be clamped arbitrarily unfortunately, otherwise the
repulsion force can add too much energy into the system. A factor of
4 * restitution impulse seems to give good results for now, this can
be refined later on if necessary.
2014-09-17 10:11:03 +02:00
81a3a364b5 fix issue with scons 2014-09-16 23:56:45 +02:00
7d3ddcac28 Added back the velocity smoothing implementation.
This is now also decoupled from the internal solver data. The grid is
created as an opaque structure, filled with vertex or collider data
(todo), and then forces can be calculated by interpolating the grid at
random locations. These forces and derivatives are then fed into the
solver.
2014-09-16 20:44:25 +02:00
c56cf0b887 WIP, beginning of renderer system that should take care of sorting
materials properly for rendering.

-Need to check aspect system first before going too much into this-
2014-09-16 19:07:56 +02:00
827ad6075d Hook up flags to request a specific sorting scheme from GPU buffer setup
routines. (still inactive
)
2014-09-16 18:30:38 +02:00
1e65bf5824 Fix for Sintel hair bug.
The hair solver needs sane input to converge within reasonable time
steps. In particular the spring lengths must not be too difference
(factor 0.01..100 or so max, this is comparable to rigid body simulation
of vastly different masses, which is also unstable).

The basic hair system generate strands with equally spaced points, which
is good solver material. However, the hair edit operators, specifically
the cutting tool, can move points along the strands, creating tightly
packed hair points. This puts the solver under enormous stress and
causes the "explosions" observed already during the Sintel project.

The simple solution for now is to exclude very short hairs from the
simulation. Later the cutting tool should be modified such that it
keeps the segments roughly at the same length and throws away vertices
when the hair gets too short (same goes for the extension tool).

The hair system should have a general mechanism for making sure that
situations such as this don't occur. This will have to be a design
consideration for replacements in any future hair system.
2014-09-16 14:36:56 +02:00
d1ed35480e Fix issue with sculpting and SSAO.
We need to enable stenciling on the compositing FBO or we can clear
areas we don't want to clear and cause invalid depth values.
2014-09-16 14:09:21 +02:00
829addcff0 Restore texture coordinates properly 2014-09-16 11:25:05 +02:00
313b568f92 Merge branch 'master' into viewport_experiments 2014-09-16 10:26:34 +02:00
3a0d276c55 Fix for flickering, recreate the framebuffer textures in that case
(looks like it's the only way to have matching per pixel results too)
2014-09-15 20:32:49 +02:00
acdaf71bbe Move GPU compositing to its own file.
Also avoid recreating the framebuffers and gpu/color textures each
frame.

Happiness :)

There are still some glithes when scaling the areas, I'll look at those
next.
2014-09-15 20:06:34 +02:00
fd388925c7 Minor fix when gravity code is disabled. 2014-09-15 17:41:53 +02:00
21f43fb13c SSAO
* Expose attenuation value - allows to change influence of far objects
* Change influence of far objects to quadratic, eliminates some extreme
fringing from far occluding surfaces.
2014-09-15 16:55:05 +02:00
2632c1308f SSAO shader.
This works by using the calculated view space normal and accumulating
coverage of a certain area by nearby pixels. There are two sliders to
control the effect:

* Scale controls the area around each pixel that the shader "collides"
against
* Darkening scales the occlusion effect.

The effect works, but due to the way the normals are calculated, the
normals are never smooth shaded (that would require a separate render
target to store them) and the edges or polygons can be too apparent.
This is not really fixable at the moment unless we move to deferred
pipeline.

The FX system is stll not well optimized and rendering does not always
work correctly, but it's good to have this out for people to play with.
2014-09-15 16:12:01 +02:00
624c99523e Removed unused code. 2014-09-15 14:22:36 +02:00
28f173b3e7 Added a calculation function for the fictitious forces introduced by
moving hair root reference frames.

This calculates Euler, Coriolis and Centrifugal forces which result
from describing hair in a moving reference frame.
http://en.wikipedia.org/wiki/Fictitious_force
2014-09-15 14:18:40 +02:00
e2e49b9a11 Fix for own misconception of fictitious forces in the moving hair root
frames.

These forces don't have to be calculated for each individual
contribution. Rather they can be split off and be calculated on top of
the basic force vector rotation (todo).
2014-09-15 12:51:18 +02:00
68275a412d Added back spring force definitions outside the implicit solver.
There are currently 3 types of springs: basic linear springs, goal
springs toward a fixed global target (not recommended, but works) and
bending springs.

These are agnostic to the specific spring definition in the cloth system
so hair systems can use the same API without converting everything to
cloth first.
2014-09-15 12:10:49 +02:00
ffb8b18074 Main cloth force calculation function outside of implicit core code.
Still misses spring forces.
2014-09-14 19:36:33 +02:00
6288a2d928 Hair volume calculation is now in its own file.
Code is currently disabled until the other main forces are in place.
2014-09-14 18:08:14 +02:00
5f0436838f Moved the unused goal force calculation function to the main mass-spring
source file.
2014-09-14 17:47:22 +02:00
d0337e0098 Moved most of the main cloth solver function out of implicit code core.
Force calculation is disabled, will follow shortly.
2014-09-14 17:36:53 +02:00
c5cb46fb27 Moved init/free functions for solver data out of implicit core.
This also initializes spring matrix indices (off-diagonal 3x3 blocks),
which now uses a new API function.
2014-09-14 14:16:03 +02:00
4da2c8498f Moved "set_positions" for cloth out of core implicit solver.
API for the solver now has functions for setting of vertex motion state
and the associated root transform data.
2014-09-14 13:23:14 +02:00
fe135d3550 Renamed functions to make them explicitly refer to cloth, and split the
create/free functions for solver data off from the cloth solver.
2014-09-13 18:45:58 +02:00
6978d15595 Moved the cloth solver code into a new subfolder/library inside Blender
code.

The implicit solver itself should remain agnostic to the specifics of
the Blender data (cloth vs. hair). This way we could avoid the bloated
data conversion chain from particles/hair to derived mesh to cloth
modifier to implicit solver data and back. Every step in this chain adds
overhead as well as rounding errors and a possibility for bugs, not to
speak of making the code horribly complicated.

The new subfolder is named "physics" since it should be the start of a
somewhat "unified" physics systems combining all the various solvers in
the same place and managing things like synchronized time steps.
2014-09-13 14:36:46 +02:00
33722d4011 Greatly improved normal calculation using view space position
derivatives.
2014-09-12 19:56:56 +02:00
9e2efd68e1 Framebuffer FX.
This commit introduces offscreen rendering for the 3D viewport.
There is test code that calculates depth and normal data
in screen space.

Currently just DOF is supported with a few parameters to control the
effect

This code recreates the framebuffer and texture objects every frame
which will make it -slow-. Use at your own risk.
2014-09-12 18:04:55 +02:00
1ecdfe22a6 Desperate attempt to get stable collisions: Disable restitution and
handle only one collision contact at a time.

Collision still randomly explodes, even with differing results on the
same file. This could indicate a threading issue, possibly also related
to the dependency graph since multiple objects are involved in
collisions.
2014-09-12 16:46:47 +02:00
9bae16453c Revert "Ignore velocity changes when the cloth solver does not converge."
This reverts commit c52b8ae818.

Sadly, at this point solver convergence is an exception rather than the
rule... Individual hairs can "explode" easily and thus disable the whole
simulation, which isn't helpful either.
2014-09-12 15:48:59 +02:00
c52b8ae818 Ignore velocity changes when the cloth solver does not converge.
This helps keep the simulation stable as long as there are only a few
substeps that become too constrained for the solver.

Eventually we need better feedback about these solver results, so that
artists can tweak situations specifically to resolve bad solver results.
This is somewhat similar to the camera tracker, which also can run into
cases that cannot be resolved and have to be fixed manually.
2014-09-12 15:02:37 +02:00
73235b3c61 Moved collision response into the main cloth sim source file and fixed
some coordinate transform issues.

Collision response should be regarded as part of the dynamics system
instead of the basic collision detection.
2014-09-12 14:34:14 +02:00
fcdcb8c818 Correction for inverse constraint matrix rotation. 2014-09-12 12:37:49 +02:00
9959cce4b6 Transform the constraint matrix and target solver vector z according to
the root frame transforms as well.

This ensures the hair constraints are actually in root space and applied
correctly by the solver.
2014-09-12 12:30:13 +02:00
efd1414d90 Use identity transform in the solver data roots to avoid possible errors
when this data is used outside the transform functions.
2014-09-12 12:28:56 +02:00
4ef085fe99 Option for disabling the root frame transformation altogether, mostly
for testing.
2014-09-12 11:22:39 +02:00
7d21e08de6 Ported root frame transformation to the old cloth solver. 2014-09-12 10:26:43 +02:00
8808289236 Switched back to the old solver for the time being.
The Eigen solver is not quite stable currently (possibly due to
incorrect porting of force calculations). It also still lacks threading
support and optimized matrix construction, making it slower in
comparison. Eventually would still like to switch, but fixing these
issues takes time.
2014-09-12 10:21:31 +02:00
26e8ebf5e2 Implemented gradient transformation for forces in the root frame (dFdX,
dFdV).
2014-09-12 10:19:41 +02:00
5e35f07ad1 Removed unused variable. 2014-09-11 18:32:26 +02:00
5ba680aa4e First stage of implementing moving frames of reference for hair/cloth.
This adds transformations for each hair from world to "root space".
Currently positions and velocities are simply transformed for the solver
data and inverse-transformed when copying the results back to the cloth
data. This way the hair movement becomes independent from the movement
of the emitter object. Eventually the "fictitious" forces originating
from emitter movement can be added back in a controlled way.

http://en.wikipedia.org/wiki/Fictitious_force

Ignoring these fictitious forces or scaling their effect is physically
correct, because in the absence of external forces the hair will always
return to rest position in this root frame.

External forces currently are not yet transformed into the root space.
2014-09-11 17:53:25 +02:00
330f5f1395 Disable some debugging options in Eigen to make it more usable in Debug
mode.

Eigen can become very slow in debug mode, which is a bit of a problem.
It relies heavily on compiler optimizations to remove function calls
etc. More optimizations may be desirable, possibly putting the implicit
solver into its own little library and enabling optimizations in debug
mode there could help.
2014-09-11 17:49:26 +02:00
6cd7d8f0ec Added new data in the cloth modifier for hair root information.
This will allow us to implement moving reference frames for hair and
make "fictitious" forces optional, aiding in creating stable and
controllable hair systems.

Adding data in this place is a nasty hack, but it's too difficult to
encode as a DM data layer and the whole cloth modifier/DM intermediate
data copying for hair should be removed anyway.
2014-09-11 14:19:52 +02:00
f503262eef Cleanup, removed unused old code. 2014-09-11 14:15:00 +02:00
a56baae7ce Optimized matrix filling using the Eigen triplets method.
Otherwise the construction of matrices becomes very slow for larger
vertex counts because adding a new element is O(n), making it O(n^2) in
total.
2014-09-11 11:14:11 +02:00
1f383436c7 Added back external effector forces for the cloth solver. 2014-09-10 23:11:56 +02:00
cbe66e6d82 Reenabled goal springs and removed the arbitrary structural scaling
factor.
2014-09-10 21:06:01 +02:00
ccf98b9faa Fixed bending forces for cloth springs. 2014-09-10 19:14:38 +02:00
0066cd1671 Correctly implemented and verified gravity, drag, structural springs. 2014-09-10 18:55:15 +02:00
e308e99208 Minor fix in debug print, so solver prints can be diff'ed. 2014-09-10 17:10:14 +02:00
b6f3db98c0 A couple of defines to disable various influences on the cloth sim for
debugging.
2014-09-10 16:59:22 +02:00
f235da9b53 Debug printing code for large sparse vectors and matrices, to compare
solver input/output of the old and new methods.
2014-09-10 16:04:31 +02:00
3871ec3d59 Added a new internal header for implicit solver defines.
Should become its own intern wrapper library eventually.
2014-09-10 14:30:55 +02:00
0335d92d84 Reenabled air drag force for cloth sim. 2014-09-09 12:36:49 +02:00
dfba467861 Arbitrary scaling factor for the structural spring forces (stretching).
This is not nice at all, but for some reason (possibly time scale) the
old force values are much too high and cause the solver to become
unstable. These will be revisited later anyway, so for now such scaling
should be fine.
2014-09-09 12:01:10 +02:00
4b9771a7cb Switched to the modified CG method that supports constraints, and
added back structural stretch springs.
2014-09-08 19:03:39 +02:00
084c6de309 Implemented a modifier conjugate gradient algorithm to support stable
constraining.

The algorithm is described in the paper "Large Steps in Cloth Simulation"
(Baraff/Witkin 1998). The same method was (incorrectly) implemented in
the old cloth solver.

It is based on restricting the degrees of freedom (ndof) of vertices
using a block matrix and a vector of target velocity deltas.
See chapter 5 of the paper for details.
2014-09-08 12:31:53 +02:00
e189fc0eeb Reimplemented Goal springs for the Eigen CG solver method.
Note that goal springs currently are really bad ... They have a factor
on hairs that "fades" goal influence from the root to the tip. The last
point on the hair is completely free, which makes the goal springs
pretty much useless on their own without supporting bend stiffness.
Can only assume this was added to compensate unphysical behavior of
goal springs when using uniform weight, but it's a poor replacement for
true localized bending forces ...
2014-09-05 17:07:30 +02:00
4535a9d926 To make gravity a true force vector, multiply by the mass. 2014-09-05 13:02:20 +02:00
854600aeed Alternative new solver for cloth using the Eigen CG solver instead of
a custom built solver.

The old cloth solver is broken unfortunately. Eigen is a designated
linear algebra library and very likely their implementation is a lot
better (can't compare until it's implemented though).

Only basic gravity is active atm, spring forces, external force fields,
damping and volumetric friction have to be added back by converting
the data into the Eigen format.
2014-09-05 12:48:49 +02:00
f3be91c2d8 Don't try to enforce a velocity change for pinned vertices; their
velocity is defined externally by hair root motion.
2014-09-04 19:58:17 +02:00
c4e00b15c7 Use squareroot of the current epsilon error target for CG, since we
square this value anyway.
2014-09-04 19:57:21 +02:00
f5efcfd3a7 WIP for overlay under sequencer strip view. 2014-09-04 19:51:17 +02:00
21e141406f Fix cancelling trim not refreshing the view 2014-09-04 17:43:55 +02:00
603392e587 Allow trimming scenes as well. 2014-09-04 15:51:55 +02:00
b39b70a615 Trim tool
* Support slow trimming with shift
* Give feedback on how many frames the input was trimmed
2014-09-04 15:36:41 +02:00
d2ece0d29b Disabled collision culling on the inside of the collider faces for now,
this seems to remove too many contact points somehow ...
2014-09-04 15:06:15 +02:00
6346a50405 Fix for collision response, the impulse response was far too small. 2014-09-04 15:05:12 +02:00
9faf2408fb Use the S matrix of the modifier CG algorithm for implementing collision
responses.

The S matrix together with the z Vector encodes the degrees of freedom
of a colliding hair point and the target velocity change. In a collision
the hair vertex is restricted in the normal direction (when moving
toward the collider) and the collision dynamics define target velocity.
2014-09-04 14:22:22 +02:00
010a52ff3c Better contact point near-test for hair.
This simply uses the position above the triangle instead of the
intersection point of the vertex path. The other method was broken
anyway, but also has a problem catching all the contacts reliably. The
new method might have a few false positives but that is acceptable.
2014-09-04 14:19:05 +02:00
ecf25938d0 Force refresh when trimming. 2014-09-04 12:55:24 +02:00
3d64c3530b Trim operator, accessible through T key, also in Strip menu. It moves
the contents of the strip around.

Only tested with movie strips now, metastrips won't work. Also there
might be some lingering bugs. Sonetimes refresh is needed to get
contents showing up correctly.
2014-09-04 12:50:17 +02:00
43b115ff1a Fixed for hair collision detection, old/new positions were swapped. 2014-09-04 10:34:32 +02:00
dd4504e895 Reduced minimum for cloth solver substeps to 1.
This is not very useful for artists, but helps with debugging.
2014-09-04 09:45:45 +02:00
5efd4b5552 Removed own debug print. 2014-09-04 09:32:01 +02:00
302d912732 Added a comment and use the new CG solver as the "official" version now. 2014-09-04 09:26:40 +02:00
4599123f8f Fixed implementation of the Conjugate Gradient method for the cloth
solver that properly supports constraints with some degrees-of-freedom.

The previous solver implementation only used the S matrix (constraint
filter matrix) for pinning vertices, in which case all elements are
zero and the error doesn't show up. With partial constraints (useful for
collision contacts) the matrix has non-zero off-diagonal elements and
the algorithm easily diverges.

There are also initial steps for implementing collision prevention as
described in the Baraff/Witkin paper "Large Steps in Cloth Simulation"
(http://www.cs.cmu.edu/~baraff/papers/sig98.pdf).
2014-09-03 23:49:24 +02:00
92bda4dd6b Hair collision: Use the S matrix for enforcing contact constraints.
This is a first test, the contacts are very explosive atm because they
basically pin hair vertices globally on collision, which leads to
stretching of the springs which is then suddenly released in the next
frame.
2014-09-03 17:12:17 +02:00
458fcfd4c4 Minor corrections:
* Add some comments to better describe what some numbers mean
* Fix cuddliness and parent position of strips
2014-09-03 16:47:31 +02:00
0796c1005e Preparation for collision code fixing.
Instead of handling contact tests and collision response in the same
function in collision.c, first generate contact points and return them
as a list, then free at the end of the stepping function. This way the
contact response can be integrated into the conjugate gradient method
properly instead of using the hackish and unstable double evaluation
that is currently used.
2014-09-03 15:44:03 +02:00
cfea750197 Cleanup: added some comments to the members of Implicit_Data. 2014-09-03 13:43:37 +02:00
509d516517 Merge branch 'master' into terrible_consequencer 2014-09-03 12:27:53 +02:00
087727366c Cleanup: No point in passing all the implicit solver arguments
individually.
2014-09-03 11:45:20 +02:00
570eb7f69b Cleanup: removed the unused olddV vectors from implicit solver data. 2014-09-03 11:34:40 +02:00
e167f9c9aa Revert "Gooseberry feature request, allow select left-right strips
operator to select all"

This change has been in master all the time after all, exposed the
operation better in master.

This reverts commit 799f974668.
2014-09-03 11:21:20 +02:00
3eed8933bd Some more debug elements for hair collisions. 2014-09-03 11:20:32 +02:00
b3a28d8334 Extended line/face collision near-check, to allow for distance margins.
The original BLI method for line/triangle intersection returns false
in case the line does not actually intersect, but in order to generate
repulsion forces we need to also handle contacts inside the margin.
2014-09-03 11:17:24 +02:00
799f974668 Gooseberry feature request, allow select left-right strips operator to
select all strips independently of channel of the active strip.
2014-09-02 19:23:56 +02:00
60a17cca27 Fix crash when setting parent. 2014-09-02 18:20:10 +02:00
cb1730d180 Merge branch 'master' into terrible_consequencer 2014-09-02 18:03:39 +02:00
7c0be7b2b1 Fix bounce/repulse calculation. 2014-09-02 15:03:15 +02:00
b23828f37f Hair debugging: use "categories" (strings) for grouping debug elements
and support clearing for categories.
2014-09-02 14:10:28 +02:00
5c1d565170 Fix for hair collision detection: need to use the second point of the
timestep segment.

This ensures the distance for a collision pair is the one of the current
point position, and the response gets calculated accordingly.
2014-09-02 12:49:55 +02:00
268d356fe2 Use repulsion forces in combination with the one-time penalty forces
in collision.
2014-09-01 18:49:53 +02:00
54832f1a19 Fix for crash when going into particle edit mode with baked hair
simulation.

Note that this currently generates an extreme amount of points, by
making a edit pathcache curve for each hair in every frame! But at least
doesn't simply crash now.
2014-09-01 18:47:27 +02:00
22245d0e04 Clear debug_data pointer in local cloth modifier data of the particle
systems on blend file load.
2014-09-01 18:46:32 +02:00
3a77ea644e Partial response force for hair collisions.
This implements a penalty force as well as a repulsion force to avoid
further penetration, as suggested in
"Simulating Complex Hair with Robust Collision Handling"
(http://graphics.snu.ac.kr/publications/2005-choe-HairSim/Choe_2005_SCA.pdf)

Friction forces are still missing. More problematic is handling of
moving colliders, when face swap places with the hair vertex and a
collision is missed, putting the vertex inside the mesh volume. Larger
margins might help, but ultimately using Bullet collision detection is
probably more reliable and failsafe.
2014-09-01 17:46:17 +02:00
1cce769d9a Merge branch 'master' into terrible_consequencer 2014-09-01 15:51:49 +02:00
670ee4c105 Debug drawing for simulations, to aid in visualizing abstract data such
as forces, velocities, contact points etc.

This uses a hash table to store debug elements (dots, lines, vectors at
this point). The hash table allows continuous display of elements that
are generated only in certain time steps, e.g. contact points, while
avoiding massive memory allocation. In any case, this system is really
a development feature, but very helpful in finding issues with the
internal solver data.
2014-08-30 17:54:36 +02:00
881e2f879a Some initial collision code, without actual response forces still.
This is still using the old BVH tree collision methods to generate
contact points, similar to what cloth does. This should be replaced
by a Bullet collision check, but generating contacts in this way is
easier for now, and lets us test responses and stability (although in
more complex collision cases the BVH method fails utterly, beside being
terribly inefficient with many colliders).
2014-08-30 15:23:40 +02:00
69f6ca664e Merge branch 'master' into hair_immediate_fixes 2014-08-29 17:06:21 +02:00
42a02c61e8 Implemented internal hair pressure to prevent hair from collapsing in
on itself.

This uses the same voxel structure as the hair smoothing algorithm.
A slightly different method was suggested in the original paper
(Volumetric Methods for Simulation and Rendering of Hair), but this is
based on directing hair based on a target density, which is another
way of implementing global goals. Our own approach is to define a
pressure threshold above which the hair is repelled in the density
gradient direction to simulate internal pressure from collisions.
2014-08-28 14:55:55 +02:00
e7e21950e7 Fixed hair velocity smoothing.
This is an important hair interaction feature that simulates friction
between hairs in an efficient way. The method is based on the paper
"Volumetric Methods for Simulation and Rendering of Hair"
( http://graphics.pixar.com/library/Hair/paper.pdf )

It was partially implemented already, but didn't work in this simplified
version. The same voxel structure can be used for implemeting repelling
forces on hair based on density, which can help a hair system maintain
volume instead of collapsing in on itself.
2014-08-27 18:12:51 +02:00
bd1c73636e Support for various data properties of the hair grid in the voxel
texture.
2014-08-27 14:11:49 +02:00
93d8e94598 Fixed voxel grid initialization from hair points and colliders by using
the suggested tent function from the original paper.

Plain float->int conversion for the grid location otherwise leads to
skewed data and unnecessary loss of information.
2014-08-27 12:33:39 +02:00
5d87f52a7a New voxel texture mode "Hair", for displaying the internal hair volume
structure as a texture.

This is mostly a debugging feature that may be removed again later.
2014-08-27 12:33:39 +02:00
a5be383c69 Code cleanup: Use a variable-sized array for the hair volume velocity
smoothing and collision code, split into multiple functions.
2014-08-27 12:33:39 +02:00
ab4da07b76 Add simple code to add (ctrl-P) and display parents. (WIP)
This is not a serious attempt though and possibly a good solution should
go through a dependency graph. Also there are some crashes on undo.
2014-08-15 16:58:30 +02:00
cb5b088410 Merge branch 'master' into terrible_consequencer 2014-08-13 20:48:33 +02:00
8ecb39a555 Fix cuddly strips shading and drawing issues. Also now there are no
issues on big zooms (they behave really cuddly)
2014-08-05 16:32:21 +02:00
ff66e9f929 Cuddlification of strips complete. Still need to make corners shrink on big zoom 2014-08-05 12:34:36 +02:00
4af1346a80 Strip drawing : Remove handle square, triangle is enough indicator here.
Also add cuddly outline
2014-08-04 22:47:42 +02:00
2206 changed files with 87285 additions and 87383 deletions

View File

@@ -45,7 +45,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
endif()
endif()
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
if(NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
# keep until CMake-3.0 is min requirement
@@ -53,9 +53,7 @@ if(NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
endif()
if(NOT EXECUTABLE_OUTPUT_PATH)
set(FIRST_RUN TRUE)
else()
set(FIRST_RUN FALSE)
set(FIRST_RUN "TRUE")
endif()
# this starts out unset
@@ -73,6 +71,7 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE NDEBU
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL NDEBUG)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO NDEBUG)
#-----------------------------------------------------------------------------
# Set policy
@@ -130,7 +129,7 @@ macro(option_defaults_init)
set(${_var} ON)
list(APPEND _init_vars "${_var}")
endforeach()
unset(_var)
unset(_INC)
endmacro()
# remove from namespace
@@ -158,30 +157,25 @@ option_defaults_init(
_init_SDL
_init_FFTW3
_init_GAMEENGINE
_init_OPENSUBDIV
)
# customize...
if (UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE)
# some of these libraries are problematic on Linux
# disable less important dependencies by default
set(_init_BUILDINFO OFF)
set(_init_CODEC_FFMPEG OFF)
set(_init_CYCLES_OSL OFF)
set(_init_IMAGE_OPENEXR OFF)
set(_init_IMAGE_REDCODE OFF)
set(_init_INPUT_NDOF OFF)
set(_init_JACK OFF)
set(_init_LIBMV_SCHUR_SPECIALIZATION OFF)
set(_init_OPENCOLLADA OFF)
set(_init_OPENCOLORIO OFF)
set(_init_SDL OFF)
set(_init_FFTW3 OFF)
set(_init_OPENSUBDIV OFF)
elseif(WIN32)
set(_init_JACK OFF)
elseif(APPLE)
set(_init_INPUT_NDOF OFF)
set(_init_JACK OFF)
set(_init_OPENSUBDIV OFF)
set(_init_GAMEENGINE OFF)
endif()
@@ -226,15 +220,7 @@ mark_as_advanced(WITH_SYSTEM_BULLET)
option(WITH_GAMEENGINE "Enable Game Engine" ${_init_GAMEENGINE})
option(WITH_PLAYER "Build Player" OFF)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
option(WITH_COMPOSITOR_WERROR "Treat warnings as errors in compositor code" OFF)
mark_as_advanced(WITH_COMPOSITOR_WERROR)
option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" _init_OPENSUBDIV)
option(WITH_SUBSURF_WERROR "Treat warnings as errors in subsurf code" OFF)
mark_as_advanced(WITH_COMPOSITOR_WERROR)
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -252,13 +238,7 @@ option(WITH_HEADLESS "Build without graphical support (renderfarm, server m
mark_as_advanced(WITH_HEADLESS)
option(WITH_AUDASPACE "Build with blenders audio library (only disable if you know what you're doing!)" ON)
option(WITH_SYSTEM_AUDASPACE "Build with external audaspace library installed on the system (only enable if you know what you're doing!)" OFF)
mark_as_advanced(WITH_AUDASPACE)
mark_as_advanced(WITH_SYSTEM_AUDASPACE)
if(NOT WITH_AUDASPACE)
set(WITH_SYSTEM_AUDASPACE OFF)
endif()
option(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" ON)
@@ -294,6 +274,10 @@ option(WITH_MOD_REMESH "Enable Remesh Modifier" ON)
# mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" OFF)
# Alembic
option(WITH_ALEMBIC "Enable Alembic Support" OFF)
option(WITH_HDF5 "Enable HDF5 Support for Alembic" OFF)
# Image format support
option(WITH_OPENIMAGEIO "Enable OpenImageIO Support (http://www.openimageio.org)" ON)
option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ${_init_IMAGE_OPENEXR})
@@ -337,11 +321,9 @@ if(UNIX AND NOT APPLE)
endif()
# Camera/motion tracking
option(WITH_LIBMV "Enable Libmv structure from motion library" ON)
option(WITH_LIBMV "Enable libmv structure from motion library" ON)
option(WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." ${_init_LIBMV_SCHUR_SPECIALIZATION})
option(WITH_LIBMV_WERROR "Treat warnings as errors in Libmv (and Blender's motion tracking) code")
mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
mark_as_advanced(WITH_LIBMV_WERROR)
# Freestyle
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
@@ -375,20 +357,18 @@ if(UNIX AND NOT APPLE)
endif()
# Cycles
option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
option(WITH_CYCLES "Enable cycles Render Engine" ON)
option(WITH_CYCLES_STANDALONE "Build cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build cycles standalone with GUI" OFF)
option(WITH_CYCLES_OSL "Build Cycles with OSL support" ${_init_CYCLES_OSL})
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_50 sm_52 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF)
option(WITH_CYCLES_WERROR "Treat warnings as errors in Cycles code" OFF)
option(WITH_CYCLES_LOGGING "Build cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build cycles with extra debug capabilities" OFF)
mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG)
mark_as_advanced(WITH_CYCLES_WERROR)
# LLVM
option(WITH_LLVM "Use LLVM" OFF)
@@ -418,6 +398,7 @@ option(WITH_BOOST "Enable features depending on boost" ON)
# Unit testsing
option(WITH_GTESTS "Enable GTest unit testing" OFF)
option(WITH_TESTS_PERFORMANCE "Enable performance tests" OFF)
# Documentation
@@ -434,6 +415,7 @@ option(WITH_GL_EGL "Use the EGL OpenGL system library instead of th
option(WITH_GL_PROFILE_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON )
option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.2+ 'core' profile." OFF)
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
option(WITH_GPU_DEBUG "Create a debug OpenGL context (allows inserting custom messages and getting notifications for bad GL use)" OFF)
mark_as_advanced(
WITH_GLEW_MX
@@ -442,6 +424,7 @@ mark_as_advanced(
WITH_GL_PROFILE_COMPAT
WITH_GL_PROFILE_CORE
WITH_GL_PROFILE_ES20
WITH_GPU_DEBUG
)
if(WITH_GL_PROFILE_COMPAT)
@@ -471,7 +454,6 @@ mark_as_advanced(WITH_CPP11)
# Dependency graph
option(WITH_LEGACY_DEPSGRAPH "Build Blender with legacy dependency graph" ON)
mark_as_advanced(WITH_LEGACY_DEPSGRAPH)
# avoid using again
option_defaults_clear()
@@ -511,11 +493,7 @@ if(APPLE)
endif()
execute_process(COMMAND uname -r OUTPUT_VARIABLE MAC_SYS) # check for actual system-version
if(${MAC_SYS} MATCHES 15)
set(OSX_SYSTEM 10.11)
# throw an error here, older cmake cannot handle 2 digit subversion!
cmake_minimum_required(VERSION 3.0.0)
elseif(${MAC_SYS} MATCHES 14)
if(${MAC_SYS} MATCHES 14)
set(OSX_SYSTEM 10.10)
# throw an error here, older cmake cannot handle 2 digit subversion!
cmake_minimum_required(VERSION 3.0.0)
@@ -532,11 +510,13 @@ if(APPLE)
else()
set(OSX_SYSTEM unsupported)
endif()
message(STATUS "Detected system-version: " ${OSX_SYSTEM})
# workaround for incorrect cmake xcode lookup for developer previews - XCODE_VERSION does not take xcode-select path into accout
# but would always look into /Applications/Xcode.app while dev versions are named Xcode<version>-DP<preview_number>
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_CHECK OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "/Contents/Developer" "" XCODE_BUNDLE ${XCODE_CHECK}) # truncate to bundlepath in any case
message(STATUS "Xcode-bundle : " ${XCODE_BUNDLE})
if(${CMAKE_GENERATOR} MATCHES "Xcode")
@@ -564,8 +544,8 @@ if(APPLE)
string(SUBSTRING "${XCODE_VERS_BUILD_NR}" 6 3 XCODE_VERSION) # truncate away build-nr
unset(XCODE_VERS_BUILD_NR)
endif()
message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_BUNDLE}")
message(STATUS "Detected Xcode-version: " ${XCODE_VERSION})
if(${XCODE_VERSION} VERSION_LESS 4.3)
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE) # use guaranteed existing sdk
@@ -664,27 +644,26 @@ if(NOT WITH_BOOST)
set_and_warn(WITH_CYCLES OFF)
set_and_warn(WITH_AUDASPACE OFF)
set_and_warn(WITH_ALEMBIC OFF)
set_and_warn(WITH_INTERNATIONAL OFF)
set_and_warn(WITH_OPENAL OFF) # depends on AUDASPACE
set_and_warn(WITH_GAMEENGINE OFF) # depends on AUDASPACE
elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_ALEMBIC OR WITH_INTERNATIONAL)
# Keep enabled
else()
# Enabled but we don't need it
set(WITH_BOOST OFF)
endif()
# disable hdf5 if Alembic is disabled
if(NOT WITH_ALEMBIC)
set(WITH_HDF5 OFF)
endif()
# auto enable openimageio for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
# auto enable llvm for cycles_osl
if(WITH_CYCLES_OSL)
set(WITH_LLVM ON CACHE BOOL "" FORCE)
endif()
else()
set(WITH_CYCLES_OSL OFF)
endif()
# auto enable openimageio linking dependencies
@@ -693,6 +672,11 @@ if(WITH_OPENIMAGEIO)
set(WITH_IMAGE_TIFF ON)
endif()
# auto enable llvm for cycles_osl
if(WITH_CYCLES_OSL)
set(WITH_LLVM ON CACHE BOOL "" FORCE)
endif()
# don't store paths to libs for portable distribution
if(WITH_INSTALL_PORTABLE)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
@@ -719,34 +703,6 @@ if(HAVE_STDBOOL_H)
add_definitions(-DHAVE_STDBOOL_H)
endif()
if(WITH_AUDASPACE)
if(WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_DEFINITIONS
-DWITH_AUDASPACE
-DWITH_SYSTEM_AUDASPACE
"-DAUD_DEVICE_H=<AUD_Device.h>"
"-DAUD_SPECIAL_H=<AUD_Special.h>"
"-DAUD_SOUND_H=<AUD_Sound.h>"
"-DAUD_HANDLE_H=<AUD_Handle.h>"
"-DAUD_SEQUENCE_H=<AUD_Sequence.h>"
"-DAUD_TYPES_H=<AUD_Types.h>"
"-DAUD_PYTHON_H=<python/PyAPI.h>"
)
else()
set(AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
set(AUDASPACE_PY_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
set(AUDASPACE_DEFINITIONS
-DWITH_AUDASPACE
"-DAUD_DEVICE_H=<AUD_C-API.h>"
"-DAUD_SPECIAL_H=<AUD_C-API.h>"
"-DAUD_SOUND_H=<AUD_C-API.h>"
"-DAUD_HANDLE_H=<AUD_C-API.h>"
"-DAUD_SEQUENCE_H=<AUD_C-API.h>"
"-DAUD_TYPES_H=<AUD_Space.h>"
)
endif()
endif()
#-----------------------------------------------------------------------------
# Check for valid directories
# ... a partial checkout may cause this.
@@ -848,14 +804,6 @@ if(WITH_X11)
endif()
# ----------------------------------------------------------------------------
# Main Platform Checks
#
# - UNIX
# - WIN32
# - APPLE
if(UNIX AND NOT APPLE)
macro(find_package_wrapper)
if(WITH_STATIC_LIBS)
@@ -924,13 +872,6 @@ if(UNIX AND NOT APPLE)
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
find_package_wrapper(Audaspace)
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
message(FATAL_ERROR "Audaspace external library not found!")
endif()
endif()
if(WITH_OPENAL)
find_package_wrapper(OpenAL)
if(NOT OPENAL_FOUND)
@@ -1131,9 +1072,9 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_LLVM)
find_package_wrapper(LLVM)
find_package_wrapper(LLVM)
if(NOT LLVM_FOUND)
if(NOT LLVM_FOUND)
set(WITH_LLVM OFF)
message(STATUS "LLVM not found")
endif()
@@ -1144,18 +1085,19 @@ if(UNIX AND NOT APPLE)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'")
endif()
if(WITH_OPENSUBDIV)
find_package_wrapper(OpenSubdiv)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
set(OPENSUBDIV_LIBPATH) # TODO, remove and reference the absolute path everywhere
if(NOT OPENSUBDIV_FOUND)
set(WITH_OPENSUBDIV OFF)
message(STATUS "OpenSubdiv not found")
if(WITH_ALEMBIC)
find_package_wrapper(Alembic)
set(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARIES} ${BOOST_LIBRARIES})
if(NOT ALEMBIC_HDF5_FOUND AND WITH_HDF5)
message(STATUS "Alembic is compiled without HDF5 support, disabling HDF5 options")
set(WITH_HDF5 OFF)
endif()
endif()
if(WITH_HDF5)
find_package_wrapper(HDF5)
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
@@ -1193,12 +1135,12 @@ if(UNIX AND NOT APPLE)
execute_process(
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
if ("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
else()
message(STATUS "GNU gold linker isn't available, using the default system linker.")
endif()
else ()
message(INFO "GNU gold linker isn't available, using the default system linker.")
endif ()
unset(LD_VERSION)
# CLang is the same as GCC for now.
@@ -1576,13 +1518,6 @@ elseif(WIN32)
)
endif()
if(WITH_OPENSUBDIV)
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBPATH}/osdCPU.lib ${OPENSUBDIV_LIBPATH}/osdGPU.lib)
find_package(OpenSubdiv)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
@@ -1590,16 +1525,6 @@ elseif(WIN32)
set(SDL_LIBPATH ${SDL}/lib)
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace.lib)
set(AUDASPACE_C_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_C_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-c.lib)
set(AUDASPACE_PY_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
endif()
# used in many places so include globally, like OpenGL
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
@@ -1919,17 +1844,6 @@ elseif(APPLE)
endif()
endif()
if(WITH_OPENSUBDIV)
set(OPENSUBDIV ${LIBDIR}/opensubdiv)
set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
find_library(OSL_LIB_UTIL NAMES osdutil PATHS ${OPENSUBDIV_LIBPATH})
find_library(OSL_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
find_library(OSL_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
list(APPEND OPENSUBDIV_LIBRARIES ${OSL_LIB_UTIL} ${OSL_LIB_CPU} ${OSL_LIB_GPU})
endif()
if(WITH_JACK)
find_library(JACK_FRAMEWORK
NAMES jackmp
@@ -2270,6 +2184,12 @@ if(WITH_CYCLES)
endif()
endif()
if(WITH_ALEMBIC)
if(NOT WITH_BOOST)
message(FATAL_ERROR "Alembic requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_ALEMBIC")
endif()
endif()
if(WITH_INTERNATIONAL)
if(NOT WITH_BOOST)
message(FATAL_ERROR "Internationalization requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
@@ -2322,14 +2242,9 @@ endif()
if(WITH_IMAGE_OPENJPEG)
if(WITH_SYSTEM_OPENJPEG)
# dealt with above
set(OPENJPEG_DEFINES "")
else()
set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
set(OPENJPEG_DEFINES "-DOPJ_STATIC")
endif()
# Special handling of Windows platform where openjpeg is always static.
if(WIN32)
set(OPENJPEG_DEFINES "-DOPJ_STATIC")
add_definitions(-DOPJ_STATIC)
endif()
endif()
@@ -2462,6 +2377,10 @@ if(WITH_GL_EGL)
list(APPEND GL_DEFINITIONS -DWITH_EGL)
endif()
if(WITH_GPU_DEBUG)
list(APPEND GL_DEFINITIONS -DWITH_GPU_DEBUG)
endif()
#-----------------------------------------------------------------------------
# Configure OpenMP.
if(WITH_OPENMP)
@@ -2868,29 +2787,25 @@ include(build_files/cmake/packaging.cmake)
# Print Final Configuration
if(FIRST_RUN)
set(_config_msg "\nBlender Configuration\n=====================")
function(info_cfg_option
_setting
)
set(_msg " - ${_setting}")
set(_config_msg "\n* Blender Configuration *")
macro(info_cfg_option
_setting)
set(_msg " * ${_setting}")
string(LENGTH "${_msg}" _len)
while("32" GREATER "${_len}")
set(_msg "${_msg} ")
math(EXPR _len "${_len} + 1")
endwhile()
set(_config_msg "${_config_msg}\n${_msg}${${_setting}}" PARENT_SCOPE)
endfunction()
set(_config_msg "${_config_msg}\n${_msg}${${_setting}}")
endmacro()
function(info_cfg_text
_text
)
macro(info_cfg_text
_text)
set(_config_msg "${_config_msg}\n\n ${_text}")
set(_config_msg "${_config_msg}\n\n ${_text}" PARENT_SCOPE)
endfunction()
endmacro()
message(STATUS "C Compiler: \"${CMAKE_C_COMPILER_ID}\"")
message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
@@ -2969,6 +2884,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_GL_PROFILE_COMPAT)
info_cfg_option(WITH_GL_PROFILE_CORE)
info_cfg_option(WITH_GL_PROFILE_ES20)
info_cfg_option(WITH_GPU_DEBUG)
if(WIN32)
info_cfg_option(WITH_GL_ANGLE)
endif()

View File

@@ -43,11 +43,6 @@ ifndef BUILD_DIR
BUILD_DIR:=$(shell dirname "$(BLENDER_DIR)")/build_$(OS_NCASE)
endif
# Allow to use alternative binary (pypy3, etc)
ifndef PYTHON
PYTHON:=python3
endif
# -----------------------------------------------------------------------------
# additional targets for the build configuration
@@ -81,20 +76,18 @@ endif
# -----------------------------------------------------------------------------
# Get the number of cores for threaded build
ifndef NPROCS
NPROCS:=1
ifeq ($(OS), Linux)
NPROCS:=$(shell nproc)
endif
ifeq ($(OS), Darwin)
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f3)
endif
ifeq ($(OS), FreeBSD)
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
endif
ifeq ($(OS), NetBSD)
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
endif
NPROCS:=1
ifeq ($(OS), Linux)
NPROCS:=$(shell nproc)
endif
ifeq ($(OS), Darwin)
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f3)
endif
ifeq ($(OS), FreeBSD)
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
endif
ifeq ($(OS), NetBSD)
NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | cut -d" " -f2 )
endif
@@ -122,14 +115,14 @@ endif
# Build Blender
all: FORCE
@echo
@echo Configuring Blender in \"$(BUILD_DIR)\" ...
@echo Configuring Blender ...
# # if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
# # $(CMAKE_CONFIG); \
# # fi
# if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
# $(CMAKE_CONFIG); \
# fi
# # do this always incase of failed initial build, could be smarter here...
@$(CMAKE_CONFIG)
# do this always incase of failed initial build, could be smarter here...
$(CMAKE_CONFIG)
@echo
@echo Building Blender ...
@@ -208,12 +201,6 @@ help: FORCE
@echo " * tgz - create a compressed archive of the source code."
@echo " * update - updates git and all submodules"
@echo ""
@echo "Environment Variables"
@echo " * BUILD_CMAKE_ARGS - arguments passed to CMake."
@echo " * BUILD_DIR - override default build path."
@echo " * PYTHON - use this for the Python command (used for checking tools)."
@echo " * NPROCS - number of processes to use building (auto-detect when omitted)."
@echo ""
@echo "Documentation Targets (not associated with building blender)"
@echo " * doc_py - generate sphinx python api docs"
@echo " * doc_doxy - generate doxygen C/C++ docs"
@@ -223,7 +210,6 @@ help: FORCE
@echo "Information"
@echo " * help - this help message"
@echo " * help_features - show a list of optional features when building"
@echo ""
# -----------------------------------------------------------------------------
# Packages
@@ -247,21 +233,21 @@ test: FORCE
# run pep8 check check on scripts we distribute.
test_pep8: FORCE
$(PYTHON) tests/python/pep8.py > test_pep8.log 2>&1
python3 tests/python/pep8.py > test_pep8.log 2>&1
@echo "written: test_pep8.log"
# run some checks on our cmakefiles.
test_cmake: FORCE
$(PYTHON) build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
@echo "written: test_cmake_consistency.log"
# run deprecation tests, see if we have anything to remove.
test_deprecated: FORCE
$(PYTHON) tests/check_deprecated.py
python3 tests/check_deprecated.py
test_style_c: FORCE
# run our own checks on C/C++ style
PYTHONIOENCODING=utf_8 $(PYTHON) \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
"$(BLENDER_DIR)/source/blender" \
"$(BLENDER_DIR)/source/creator" \
@@ -270,7 +256,7 @@ test_style_c: FORCE
test_style_c_qtc: FORCE
# run our own checks on C/C++ style
USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 $(PYTHON) \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
"$(BLENDER_DIR)/source/blender" \
"$(BLENDER_DIR)/source/creator" \
@@ -282,7 +268,7 @@ test_style_c_qtc: FORCE
test_style_osl: FORCE
# run our own checks on C/C++ style
PYTHONIOENCODING=utf_8 $(PYTHON) \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" \
"$(BLENDER_DIR)/release/scripts/templates_osl"
@@ -291,7 +277,7 @@ test_style_osl: FORCE
test_style_osl_qtc: FORCE
# run our own checks on C/C++ style
USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 $(PYTHON) \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" \
"$(BLENDER_DIR)/release/scripts/templates_osl" \
@@ -304,10 +290,10 @@ test_style_osl_qtc: FORCE
#
project_qtcreator: FORCE
$(PYTHON) build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
python3 build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
project_netbeans: FORCE
$(PYTHON) build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
python3 build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
project_eclipse: FORCE
cmake -G"Eclipse CDT4 - Unix Makefiles" -H"$(BLENDER_DIR)" -B"$(BUILD_DIR)"
@@ -320,39 +306,39 @@ project_eclipse: FORCE
check_cppcheck: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt"
check_clang_array: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
check_splint: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
check_sparse: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
check_smatch: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
check_spelling_py: FORCE
cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/release/scripts"
check_spelling_c: FORCE
cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/source" \
"$(BLENDER_DIR)/intern/cycles" \
@@ -361,7 +347,7 @@ check_spelling_c: FORCE
check_spelling_c_qtc: FORCE
cd "$(BUILD_DIR)" ; USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 $(PYTHON) \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/source" \
"$(BLENDER_DIR)/intern/cycles" \
@@ -372,7 +358,7 @@ check_spelling_c_qtc: FORCE
check_spelling_osl: FORCE
cd "$(BUILD_DIR)" ;\
PYTHONIOENCODING=utf_8 $(PYTHON) \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
@@ -418,10 +404,10 @@ doc_dna: FORCE
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: FORCE
$(PYTHON) doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
python3 doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
help_features: FORCE
@$(PYTHON) -c \
@python3 -c \
"import re; \
print('\n'.join([ \
w for l in open('"$(BLENDER_DIR)"/CMakeLists.txt', 'r').readlines() \

View File

@@ -331,10 +331,7 @@ if env['OURPLATFORM']=='darwin':
print B.bc.OKGREEN + "Available SDK's: \n" + B.bc.ENDC + MACOSX_SDK_CHECK.replace('\t', '')
if env['MACOSX_SDK'] == '': # no set sdk, choosing best one found
if 'OS X 10.11' in MACOSX_SDK_CHECK:
env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.11.sdk'
elif 'OS X 10.10' in MACOSX_SDK_CHECK:
if 'OS X 10.10' in MACOSX_SDK_CHECK:
env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.10.sdk'
elif 'OS X 10.9' in MACOSX_SDK_CHECK:
@@ -517,10 +514,6 @@ if env['WITH_BF_STATICCXX']:
else:
print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
# audaspace is needed for the game engine
if not env['WITH_BF_AUDASPACE']:
env['WITH_BF_GAMEENGINE'] = False
# check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
if 'blenderplayer' in B.targets:
env['WITH_BF_PLAYER'] = True
@@ -547,25 +540,13 @@ else:
env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__')
# TODO, make optional (as with CMake)
env['CPPFLAGS'].append('-DWITH_AUDASPACE')
env['CPPFLAGS'].append('-DWITH_AVI')
env['CPPFLAGS'].append('-DWITH_OPENNL')
if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
env['CPPFLAGS'].append('-DHAVE_STDBOOL_H')
# Audaspace
if env['WITH_BF_AUDASPACE']:
env['BF_AUDASPACE_C_INC'] = '#intern/audaspace/intern'
env['BF_AUDASPACE_PY_INC'] = '#intern/audaspace/intern'
env['BF_AUDASPACE_DEF'] = ['WITH_AUDASPACE']
env['BF_AUDASPACE_DEF'].append('AUD_DEVICE_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_SPECIAL_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_SOUND_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_HANDLE_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_SEQUENCE_H="<AUD_C-API.h>"')
env['BF_AUDASPACE_DEF'].append('AUD_TYPES_H="<AUD_Space.h>"')
# OpenGL
if env['WITH_BF_GL_PROFILE_COMPAT']:
@@ -785,8 +766,6 @@ if B.targets != ['cudakernels']:
data_to_c_simple("release/datafiles/preview_cycles.blend")
# --- glsl ---
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_geometry.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_program_smoke_frag.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_program_smoke_color_frag.glsl")
@@ -810,7 +789,6 @@ if B.targets != ['cudakernels']:
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_vert.glsl")
data_to_c_simple("intern/opencolorio/gpu_shader_display_transform.glsl")
data_to_c_simple("intern/opensubdiv/gpu_shader_opensubd_display.glsl")
# --- blender ---
data_to_c_simple("release/datafiles/bfont.pfb")
@@ -839,6 +817,13 @@ if B.targets != ['cudakernels']:
data_to_c_simple("release/datafiles/brushicons/fill.png")
data_to_c_simple("release/datafiles/brushicons/flatten.png")
data_to_c_simple("release/datafiles/brushicons/grab.png")
data_to_c_simple("release/datafiles/brushicons/hairadd.png")
data_to_c_simple("release/datafiles/brushicons/haircomb.png")
data_to_c_simple("release/datafiles/brushicons/haircut.png")
data_to_c_simple("release/datafiles/brushicons/hairlength.png")
data_to_c_simple("release/datafiles/brushicons/hairpuff.png")
data_to_c_simple("release/datafiles/brushicons/hairsmooth.png")
data_to_c_simple("release/datafiles/brushicons/hairweight.png")
data_to_c_simple("release/datafiles/brushicons/inflate.png")
data_to_c_simple("release/datafiles/brushicons/layer.png")
data_to_c_simple("release/datafiles/brushicons/lighten.png")
@@ -1322,15 +1307,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
allinstall += windlls
# TODO(sergey): For unti we've got better way to deal with python binary
if env['WITH_BF_PYTHON']:
py_target = os.path.join(env['BF_INSTALLDIR'], VERSION, 'python', 'bin')
if env['BF_DEBUG']:
allinstall += env.Install(dir=py_target, source = ['${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll'])
else:
allinstall += env.Install(dir=py_target, source = ['${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll'])
if env['OURPLATFORM'] == 'win64-mingw':
dllsources = []

View File

@@ -27,16 +27,13 @@ getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,no-sudo,with-all,with-opencollada,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,\
force-all,force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-osd,\
force-ffmpeg,force-opencollada,\
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,\
skip-ffmpeg,skip-opencollada,\
force-all,force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-opencollada,\
force-ffmpeg,force-alembic,\
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,skip-opencollada,skip-alembic,\
required-numpy: \
-- "$@" \
)
COMMANDLINE=$@
DISTRO=""
RPM=""
SRC="$HOME/src/blender-deps"
@@ -44,7 +41,6 @@ INST="/opt/lib"
TMP="/tmp"
CWD=$PWD
INFO_PATH=$CWD
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Do not install some optional, potentially conflicting libs by default...
WITH_ALL=false
@@ -99,6 +95,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--with-opencollada
Build and install the OpenCOLLADA libraries.
--with-alembic
Build and install the Alembic library.
--ver-ocio=<ver>
Force version of OCIO library.
@@ -142,15 +141,15 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--force-osl
Force the rebuild of OpenShadingLanguage.
--force-osd
Force the rebuild of OpenSubdiv.
--force-opencollada
Force the rebuild of OpenCOLLADA.
--force-ffmpeg
Force the rebuild of FFMpeg.
--force-alembic
Force the rebuild of Alembic.
Note about the --force-foo options:
* They obviously only have an effect if those libraries are built by this script
(i.e. if there is no available and satisfactory package)!
@@ -181,15 +180,15 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--skip-osl
Unconditionally skip OpenShadingLanguage installation/building.
--skip-osd
Unconditionally skip OpenSubdiv installation/building.
--skip-opencollada
Unconditionally skip OpenCOLLADA installation/building.
--skip-ffmpeg
Unconditionally skip FFMpeg installation/building.
--skip-alembic
Unconditionally skip Alembic installation/building.
--required-numpy
Use this in case your distro features a valid python package, but no matching Numpy one.
It will force compilation of both python and numpy\""
@@ -243,12 +242,6 @@ OSL_VERSION_MIN=$OSL_VERSION
OSL_FORCE_REBUILD=false
OSL_SKIP=false
# OpenSubdiv needs to be compiled for now
OSD_VERSION="3.0.2"
OSD_VERSION_MIN=$OSD_VERSION
OSD_FORCE_REBUILD=false
OSD_SKIP=false
# Version??
OPENCOLLADA_VERSION="1.3"
OPENCOLLADA_FORCE_REBUILD=false
@@ -280,6 +273,11 @@ MP3LAME_DEV=""
OPENJPEG_USE=false
OPENJPEG_DEV=""
ALEMBIC_VERSION="1.5.5"
ALEMBIC_VERSION_MIN="1.5.5"
ALEMBIC_FORCE_REBUILD=false
ALEMBIC_SKIP=false
# Switch to english language, else some things (like check_package_DEB()) won't work!
LANG_BACK=$LANG
LANG=""
@@ -391,11 +389,6 @@ while true; do
OSL_VERSION_MIN=$OSL_VERSION
shift; shift; continue
;;
--ver-osd)
OSD_VERSION="$2"
OSD_VERSION_MIN=$OSD_VERSION
shift; shift; continue
;;
--force-all)
PYTHON_FORCE_REBUILD=true
NUMPY_FORCE_REBUILD=true
@@ -405,7 +398,6 @@ while true; do
OIIO_FORCE_REBUILD=true
LLVM_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
OSD_FORCE_REBUILD=true
OPENCOLLADA_FORCE_REBUILD=true
FFMPEG_FORCE_REBUILD=true
shift; continue
@@ -439,15 +431,15 @@ while true; do
--force-osl)
OSL_FORCE_REBUILD=true; shift; continue
;;
--force-osd)
OSD_FORCE_REBUILD=true; shift; continue
;;
--force-opencollada)
OPENCOLLADA_FORCE_REBUILD=true; shift; continue
;;
--force-ffmpeg)
FFMPEG_FORCE_REBUILD=true; shift; continue
;;
--force-alembic)
ALEMBIC_FORCE_REBUILD=true; shift; continue
;;
--skip-python)
PYTHON_SKIP=true; shift; continue
;;
@@ -472,15 +464,15 @@ while true; do
--skip-osl)
OSL_SKIP=true; shift; continue
;;
--skip-osd)
OSD_SKIP=true; shift; continue
;;
--skip-opencollada)
OPENCOLLADA_SKIP=true; shift; continue
;;
--skip-ffmpeg)
FFMPEG_SKIP=true; shift; continue
;;
--skip-alembic)
ALEMBIC_SKIP=true; shift; continue
;;
--required-numpy)
NUMPY_REQUIRED=true; shift; continue
;;
@@ -537,18 +529,13 @@ OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
OSL_SOURCE_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
OSL_SOURCE_REPO_BRANCH="blender-fixes"
OSD_USE_REPO=true
# Script foo to make the version string compliant with the archive name:
# ${Varname//SearchForThisChar/ReplaceWithThisChar}
OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
OSD_SOURCE_REPO=( "https://github.com/PixarAnimationStudios/OpenSubdiv.git" )
OSD_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
OSD_SOURCE_REPO_BRANCH="dev"
OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
ALEMBIC_SOURCE=( "https://code.google.com/p/alembic/" )
ALEMBIC_REPO_UID=( "1_05_05" )
##### Generic Helpers #####
@@ -875,6 +862,7 @@ compile_Boost() {
# Rebuild dependecies as well!
OIIO_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
ALEMBIC_FORCE_REBUILD=true
prepare_opt
@@ -1379,7 +1367,19 @@ compile_LLVM() {
cd $_src
# XXX Ugly patching hack!
patch -p1 -i "$SCRIPT_DIR/install_deps_patches/llvm.patch"
cat << EOF | patch -p1
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@
set(LLVM_VERSION_MAJOR 3)
set(LLVM_VERSION_MINOR 1)
-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
+set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
EOF
cd $CWD
@@ -1449,10 +1449,10 @@ compile_OSL() {
# Clean install if needed!
magic_compile_check osl-$OSL_VERSION $osl_magic
if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
#~ if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
#~ rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically
clean_OSL
fi
#~ clean_OSL
#~ fi
if [ ! -d $_inst ]; then
INFO "Building OpenShadingLanguage-$OSL_VERSION"
@@ -1481,9 +1481,6 @@ compile_OSL() {
# Stick to same rev as windows' libs...
git checkout $OSL_SOURCE_REPO_UID
git reset --hard
# XXX Ugly patching hack!
patch -p1 -i "$SCRIPT_DIR/install_deps_patches/osl.patch"
fi
# Always refresh the whole build!
@@ -1525,9 +1522,6 @@ compile_OSL() {
fi
fi
#~ cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
#~ cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
cmake $cmake_d ..
make -j$THREADS && make install
@@ -1552,99 +1546,6 @@ compile_OSL() {
run_ldconfig "osl"
}
#### Build OSD ####
_init_osd() {
_src=$SRC/OpenSubdiv-$OSD_VERSION
_git=true
_inst=$INST/osd-$OSD_VERSION
_inst_shortcut=$INST/osd
}
clean_OSD() {
_init_osd
_clean
}
compile_OSD() {
# To be changed each time we make edits that would modify the compiled result!
osd_magic=0
_init_osd
# Clean install if needed!
magic_compile_check osd-$OSD_VERSION $osd_magic
if [ $? -eq 1 -o $OSD_FORCE_REBUILD == true ]; then
clean_OSD
fi
if [ ! -d $_inst ]; then
INFO "Building OpenSubdiv-$OSD_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
if [ $OSD_USE_REPO == true ]; then
git clone ${OSD_SOURCE_REPO[0]} $_src
else
download OSD_SOURCE[@] "$_src.tar.gz"
INFO "Unpacking OpenSubdiv-$OSD_VERSION"
tar -C $SRC --transform "s,(.*/?)OpenSubdiv-[^/]*(.*),\1OpenSubdiv-$OSD_VERSION\2,x" \
-xf $_src.tar.gz
fi
fi
cd $_src
if [ $OSD_USE_REPO == true ]; then
git remote set-url origin ${OSD_SOURCE_REPO[0]}
# XXX For now, always update from latest repo...
git pull --no-edit -X theirs origin $OSD_SOURCE_REPO_BRANCH
# Stick to same rev as windows' libs...
git checkout $OSD_SOURCE_REPO_UID
git reset --hard
fi
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
# ptex is only needed when nicholas bishop is ready
cmake_d="$cmake_d -D NO_PTEX=1"
cmake_d="$cmake_d -D NO_CLEW=1"
# maya plugin, docs, tutorials, regression tests and examples are not needed
cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
cmake $cmake_d ..
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set osd-$OSD_VERSION $osd_magic
cd $CWD
INFO "Done compiling OpenSubdiv-$OSD_VERSION!"
else
INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-osd option."
fi
run_ldconfig "osd"
}
#### Build OpenCOLLADA ####
_init_opencollada() {
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
@@ -1829,6 +1730,165 @@ compile_FFmpeg() {
fi
}
#### Build ALEMBIC ####
_init_alembic() {
_src=$SRC/Alembic-$ALEMBIC_VERSION
_hg=false
_inst=$INST/alembic-$ALEMBIC_VERSION
_inst_shortcut=$INST/alembic
}
clean_alembic() {
_init_alembic
_clean
}
compile_alembic() {
# To be changed each time we make edits that would modify the compiled result!
alembic_magic=1
_init_alembic
# Clean install if needed!
magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
if [ $? -eq 1 -o $ALEMBIC_FORCE_REBUILD == true ]; then
clean_alembic
fi
if [ ! -d $_inst ]; then
INFO "Building Alembic-$ALEMBIC_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
hg clone -u $ALEMBIC_REPO_UID $ALEMBIC_SOURCE $_src
fi
cd $_src
# XXX Ugly patching hack!
# Alembice cmake files are erratic, to say the least
# have to manually disable a bunch of crap here
cat << EOF | patch -p1
--- a/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
+++ b/CMakeLists.txt Thu Oct 16 15:03:27 2014 +0200
@@ -57,9 +57,9 @@
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} )
SET( VERSION ${PROJECT_VERSION} )
-SET( ALEMBIC_NO_TESTS FALSE )
-SET( ALEMBIC_NO_BOOTSTRAP FALSE )
-SET( ALEMBIC_NO_OPENGL FALSE )
+SET( ALEMBIC_NO_TESTS TRUE )
+SET( ALEMBIC_NO_BOOTSTRAP TRUE )
+SET( ALEMBIC_NO_OPENGL TRUE )
MESSAGE(STATUS "CMAKE SYSTEM NAME = ${CMAKE_SYSTEM_NAME}" )
@@ -306,15 +306,15 @@
ENDIF()
# Include PyAlembic stuff
-IF(DEFINED USE_PYALEMBIC AND NOT USE_PYALEMBIC)
- MESSAGE(STATUS "Skipping Alembic Python bindings")
-ELSE()
- MESSAGE(STATUS "About to include Python cmake files")
- ADD_SUBDIRECTORY( python )
-ENDIF()
+#IF(DEFINED USE_PYALEMBIC AND NOT USE_PYALEMBIC)
+# MESSAGE(STATUS "Skipping Alembic Python bindings")
+#ELSE()
+# MESSAGE(STATUS "About to include Python cmake files")
+# ADD_SUBDIRECTORY( python )
+#ENDIF()
# Example code not supported
-ADD_SUBDIRECTORY( examples )
+#ADD_SUBDIRECTORY( examples )
# Uncomment to build python docs Makefile (requires Sphinx)
# Run `make docs` from build root
EOF
cat << EOF | patch -p1
--- a/lib/Alembic/Util/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
+++ b/lib/Alembic/Util/CMakeLists.txt Thu Oct 16 15:03:27 2014 +0200
@@ -65,7 +65,7 @@
DESTINATION include/Alembic/Util
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ )
-IF( NOT ALEMBIC_NO_TESTS )
- ADD_SUBDIRECTORY( Tests )
-ENDIF()
+#IF( NOT ALEMBIC_NO_TESTS )
+# ADD_SUBDIRECTORY( Tests )
+#ENDIF()
EOF
cat << EOF | patch -p1
--- a/python/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
+++ b/python/CMakeLists.txt Thu Oct 16 14:20:25 2014 +0200
@@ -35,4 +35,4 @@
ADD_SUBDIRECTORY( PyAlembic )
ADD_SUBDIRECTORY( PyAbcOpenGL )
-ADD_SUBDIRECTORY( examples )
+#ADD_SUBDIRECTORY( examples )
EOF
# Always refresh the whole build!
# XXX 'build' directory is included in Alembic sources, don't touch that
if [ -d blender_build ]; then
rm -rf blender_build
fi
mkdir blender_build
cd blender_build
# XXX Alembic cmake doesn't take these as options
# XXX Alembic creates a subfolder itself ... rather than fix their
# stupid build files, just expect this here by using $INST as prefix
export ALEMBIC_INSTALL_PREFIX=$INST
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$INST"
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
cmake_d="$cmake_d -D BUILD_STATIC_LIBS=ON"
cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
cmake_d="$cmakd_d -D ALEMBIC_PYTHON_INCLUDE_DIR=/use/include/python2.7" # XXX BAD
cmake_d="$cmakd_d -D ALEMBIC_PYTHON_LIBRARY=/use/lib/python2.7" # XXX BAD
cmake_d="$cmake_d -D USE_PYILMBASE=OFF"
cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_HALF_LIB=$INST/openexr/lib/libHalf.la"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_IEX_LIB=$INST/openexr/lib/libIex-2_1.la"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_ILMTHREAD_LIB=$INST/openexr/lib/libIlmThread-2_1.la"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_IMATH_LIB=$INST/openexr/lib/libImath-2_1.la"
cmake $cmake_d ../
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic
cd $CWD
INFO "Done compiling Alembic-$ALEMBIC_VERSION!"
else
INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-alembic option."
fi
}
#### Install on DEB-like ####
get_package_version_DEB() {
@@ -1935,10 +1995,9 @@ install_DEB() {
OGG_DEV="libogg-dev"
THEORA_DEV="libtheora-dev"
_packages="gawk cmake cmake-curses-gui scons build-essential libjpeg-dev libpng-dev \
libfreetype6-dev libx11-dev \
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
_packages="gawk cmake cmake-curses-gui scons mercurial build-essential libjpeg-dev libpng-dev \
libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev"
@@ -2116,7 +2175,8 @@ install_DEB() {
if [ $? -eq 0 ]; then
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
libboost-regex$boost_version-dev libboost-system$boost_version-dev \
libboost-thread$boost_version-dev libboost-wave$boost_version-dev
libboost-thread$boost_version-dev libboost-python$boost_version-dev \
libboost-program-options$boost_version-dev libboost-wave$boost_version-dev
clean_Boost
else
compile_Boost
@@ -2213,20 +2273,6 @@ install_DEB() {
fi
fi
PRINT ""
if $OSD_SKIP; then
WARNING "Skipping OpenSubdiv installation, as requested..."
else
if $have_llvm; then
install_packages_DEB flex bison libtbb-dev
# No package currently!
PRINT ""
compile_OSD
else
WARNING "No LLVM available, cannot build OSD!"
fi
fi
if $WITH_OPENCOLLADA; then
PRINT ""
if $OPENCOLLADA_SKIP; then
@@ -2263,6 +2309,14 @@ install_DEB() {
# fi
compile_FFmpeg
fi
if $ALEMBIC_SKIP; then
WARNING "Skipping Alembic installation, as requested..."
else
install_packages_DEB libhdf5-dev
install_packages_DEB libpython2.7-dev # XXX nasty hack, should be done better ...
compile_alembic
fi
}
@@ -2425,9 +2479,9 @@ install_RPM() {
OGG_DEV="libogg-devel"
THEORA_DEV="libtheora-devel"
_packages="gcc gcc-c++ git make cmake scons libtiff-devel libjpeg-devel\
libpng-devel libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
_packages="gcc gcc-c++ make scons libtiff-devel libjpeg-devel\
libpng-devel libX11-devel libXi-devel wget ncurses-devel \
readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
libxml2-devel yaml-cpp-devel tinyxml-devel"
@@ -2533,7 +2587,7 @@ install_RPM() {
if $NUMPY_SKIP; then
WARNING "Skipping NumPy installation, as requested..."
else
check_package_version_ge_RPM python3-numpy $NUMPY_VERSION_MIN
check_package_version_match_RPM python3-numpy $NUMPY_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM python3-numpy
elif $NUMPY_REQUIRED; then
@@ -2654,7 +2708,7 @@ install_RPM() {
else
if $have_llvm; then
# No package currently!
install_packages_RPM flex bison
install_packages_RPM flex bison git
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
install_packages_RPM tbb-devel
fi
@@ -2665,29 +2719,12 @@ install_RPM() {
fi
fi
PRINT ""
if $OSD_SKIP; then
WARNING "Skipping OpenSubdiv installation, as requested..."
else
if $have_llvm; then
# No package currently!
install_packages_RPM flex bison
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
install_packages_RPM tbb-devel
fi
PRINT ""
compile_OSD
else
WARNING "No LLVM available, cannot build OSD!"
fi
fi
if $WITH_OPENCOLLADA; then
PRINT ""
if $OPENCOLLADA_SKIP; then
WARNING "Skipping OpenCOLLADA installation, as requested..."
else
install_packages_RPM pcre-devel
install_packages_RPM pcre-devel git
# Find path to libxml shared lib...
_XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
# No package...
@@ -2795,8 +2832,7 @@ install_ARCH() {
OGG_DEV="libogg"
THEORA_DEV="libtheora"
_packages="base-devel git scons cmake \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
_packages="base-devel scons cmake libxi glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw \
libxml2 yaml-cpp tinyxml"
@@ -2983,7 +3019,7 @@ install_ARCH() {
clean_OSL
else
#XXX Note: will fail to build with LLVM 3.2!
install_packages_ARCH intel-tbb
install_packages_ARCH git intel-tbb
PRINT ""
compile_OSL
fi
@@ -2992,20 +3028,6 @@ install_ARCH() {
fi
fi
PRINT ""
if $OSD_SKIP; then
WARNING "Skipping OpenSubdiv installation, as requested..."
else
if $have_llvm; then
# No package currently? Just build for now!
install_packages_ARCH intel-tbb
PRINT ""
compile_OSD
else
WARNING "No LLVM available, cannot build OSD!"
fi
fi
if $WITH_OPENCOLLADA; then
PRINT ""
if $OPENCOLLADA_SKIP; then
@@ -3016,7 +3038,7 @@ install_ARCH() {
install_packages_ARCH opencollada
clean_OpenCOLLADA
else
install_packages_ARCH pcre
install_packages_ARCH pcre git
PRINT ""
compile_OpenCOLLADA
fi
@@ -3117,10 +3139,6 @@ print_info() {
PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
PRINT ""
PRINT ""
PRINT "Ran with:"
PRINT " install_deps.sh $COMMANDLINE"
PRINT ""
PRINT ""
PRINT "If you're using CMake add this to your configuration flags:"
_buildargs=""
@@ -3185,14 +3203,6 @@ print_info() {
_buildargs="$_buildargs $_1 $_2"
fi
if [ -d $INST/osd ]; then
_1="-D WITH_OPENSUBDIV=ON"
_2="-D OPENSUBDIV_ROOT_DIR=$INST/osd"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
fi
if $WITH_OPENCOLLADA; then
_1="-D WITH_OPENCOLLADA=ON"
PRINT " $_1"
@@ -3212,6 +3222,12 @@ print_info() {
fi
fi
if [ -d $INST/alembic ]; then
_1="-D ALEMBIC_ROOT_DIR=$INST/alembic"
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi
PRINT ""
PRINT "Or even simpler, just run (in your blender-source dir):"
PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
@@ -3259,13 +3275,6 @@ print_info() {
PRINT "BF_OSL = '$INST/osl'"
fi
if [ "$OSD_SKIP" = false ]; then
PRINT "WITH_BF_OPENSUBDIV = True"
if [ -d $INST/osd ]; then
PRINT "BF_OPENSUBDIV = '$INST/osd'"
fi
fi
if [ "$BOOST_SKIP" = false ]; then
PRINT "WITH_BF_BOOST = True"
if [ -d $INST/boost ]; then
@@ -3288,6 +3297,13 @@ print_info() {
PRINT "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
fi
if [ "$ALEMBIC_SKIP" = false ]; then
PRINT "WITH_BF_ALEMBIC = True"
if [ -d $INST/alembic ]; then
PRINT "BF_ALEMBIC = '$INST/alembic'"
fi
fi
if [ "$WITH_ALL" = false ]; then
PRINT "WITH_BF_3DMOUSE = False"
# No libspacenav in official arch repos...
@@ -3312,27 +3328,7 @@ elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
DISTRO="RPM"
install_RPM
else
ERROR "Failed to detect distribution type."
PRINT ""
PRINT "Your distribution is not supported by this script, you'll have to install dependencies and"
PRINT "dev packages yourself (list non-exhaustive, but should cover most needs):"
PRINT " * Basics of dev environment (cmake or scons, gcc, svn , git, ...)."
PRINT " * Python$PYTHON_VERSION_MIN, numpy."
PRINT " * libboost$BOOST_VERSION_MIN (locale, filesystem, regex, system, thread, wave)."
PRINT " * libjpeg, libpng, libtiff, libopenjpeg, libopenal."
PRINT " * ffmpeg (with libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)."
PRINT " * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed)."
PRINT " * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp."
PRINT " * libsdl1.2, libglew, libglewmx."
PRINT " * libopencolorio$OCIO_VERSION_MIN, libopenexr$OPENEXR_VERSION_MIN, libopenimageio$OIIO_VERSION_MIN."
PRINT " * llvm-$LLVM_VERSION (with clang)."
PRINT ""
PRINT "Most of up-listed packages are available in recent distributions. The following are likely not,"
PRINT "you'll have to build them (they are all optional, though):"
PRINT " * OpenShadingLanguage (from https://github.com/Nazg-Gul/OpenShadingLanguage.git, branch blender-fixes, commit 22ee5ea298fd215430dfbd160b5aefd507f06db0)."
PRINT " * OpenSubDiv (from https://github.com/PixarAnimationStudios/OpenSubdiv.git, branch dev, commit 404659fffa659da075d1c9416e4fc939139a84ee)."
PRINT " * OpenCollada (from https://github.com/KhronosGroup/OpenCOLLADA.git, branch master, commit 3335ac164e68b2512a40914b14c74db260e6ff7d)."
PRINT ""
ERROR "Failed to detect distribution type"
exit 1
fi

View File

@@ -1,12 +0,0 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@
set(LLVM_VERSION_MAJOR 3)
set(LLVM_VERSION_MINOR 1)
-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
+set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

View File

@@ -1,12 +0,0 @@
--- a/src/shaders/CMakeLists.txt
+++ b/src/shaders/CMakeLists.txt
@@ -27,7 +27,7 @@ macro (osl_compile oslsrc objlist headers)
message (STATUS "cmd: ${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc ${oslsrc}")
endif ()
add_custom_command (OUTPUT ${osofile}
- COMMAND "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc" ${oslsrc}
+ COMMAND "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc" "-o" ${osofile} ${oslsrc}
MAIN_DEPENDENCY ${oslsrc}
DEPENDS ${${headers}} ${oslsrc} "${CMAKE_CURRENT_BINARY_DIR}/stdosl.h" "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

View File

@@ -2,5 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-i686'
BF_INSTALLDIR = '../blender-install/linux-glibc211-i686'
BF_NUMJOBS = 1
#BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
BF_CYCLES_CUDA_BINARIES_ARCH = []
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']

View File

@@ -166,14 +166,18 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation
WITH_BF_OCEANSIM = True
# OpenSubdiv
WITH_BF_OPENSUBDIV = True
WITH_BF_STATICOPENSUBDIV = True
BF_OPENSUBDIV = '/opt/lib/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV}/lib/libosdCPU.a ${BF_OPENSUBDIV}/lib/libosdGPU.a'
# Alembic
WITH_BF_HDF5 = False
WITH_BF_ALEMBIC = True
WITH_BF_STATICALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
# Compilation and optimization
BF_DEBUG = False

View File

@@ -166,14 +166,18 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation
WITH_BF_OCEANSIM = True
# OpenSubdiv
WITH_BF_OPENSUBDIV = True
WITH_BF_STATICOPENSUBDIV = True
BF_OPENSUBDIV = '/opt/lib/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV}/lib/libosdCPU.a ${BF_OPENSUBDIV}/lib/libosdGPU.a'
# Alembic
WITH_BF_HDF5 = False
WITH_BF_ALEMBIC = True
WITH_BF_STATICALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
# Compilation and optimization
BF_DEBUG = False

View File

@@ -1,5 +1,5 @@
#CC = "../lib/darwin-9.x.universal/clang-omp-3.5/bin/clang"
#CXX = "../lib/darwin-9.x.universal/clang-omp-3.5/bin/clang++"
CC = "../lib/darwin-9.x.universal/clang-omp-3.5/bin/clang"
CXX = "../lib/darwin-9.x.universal/clang-omp-3.5/bin/clang++"
MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64

View File

@@ -120,6 +120,19 @@ WITH_BF_FFTW3 = True
WITH_BF_STATICFFTW3 = True
WITH_BF_OCEANSIM = True
# Alembic
WITH_BF_HDF5 = False
WITH_BF_ALEMBIC = True
WITH_BF_STATICALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -120,6 +120,19 @@ WITH_BF_FFTW3 = True
WITH_BF_STATICFFTW3 = True
WITH_BF_OCEANSIM = True
# Alembic
WITH_BF_HDF5 = False
WITH_BF_ALEMBIC = True
WITH_BF_STATICALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -4,7 +4,7 @@
# <pep8 compliant>
# List of the branches being built automatically overnight
NIGHT_SCHEDULE_BRANCHES = [None]
NIGHT_SCHEDULE_BRANCHES = [None, "gooseberry"]
# List of the branches available for force build
FORCE_SCHEDULE_BRANCHES = ["master", "gooseberry", "experimental-build"]
@@ -305,12 +305,12 @@ add_builder(c, 'mac_x86_64_10_6_scons', 'darwin-9.x.universal', generic_builder,
add_builder(c, 'mac_i386_10_6_scons', 'darwin-9.x.universal', generic_builder, hour=11)
add_builder(c, 'linux_glibc211_i386_scons', '', generic_builder, hour=1)
add_builder(c, 'linux_glibc211_x86_64_scons', '', generic_builder, hour=2)
#add_builder(c, 'win32_scons_vc2013', 'windows_vc12', generic_builder, hour=1)
#add_builder(c, 'win64_scons_vc2013', 'win64_vc12', generic_builder, hour=2)
add_builder(c, 'win32_scons_vc2013', 'windows_vc12', generic_builder, hour=1)
add_builder(c, 'win64_scons_vc2013', 'win64_vc12', generic_builder, hour=2)
add_builder(c, 'win32_cmake_vc2013', 'windows_vc12', generic_builder, hour=3)
add_builder(c, 'win64_cmake_vc2013', 'win64_vc12', generic_builder, hour=4)
#add_builder(c, 'mingw_win32_scons', 'mingw32', generic_builder, hour=4)
#add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder, hour=3)
add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder, hour=3)
#add_builder(c, 'freebsd_i386_cmake', '', generic_builder, hour=1)
#add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder, hour=2)

View File

@@ -52,18 +52,12 @@ if 'cmake' in builder:
cmake_options.append(['-G', '"Visual Studio 12 2013"'])
cmake_options.append("-C../blender.git/build_files/cmake/config/blender_full.cmake")
if 'win32' not in builder:
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=1")
else:
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=0")
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=1")
# configure and make
retcode = subprocess.call(['cmake', blender_dir] + cmake_options)
if retcode != 0:
sys.exit(retcode)
if 'win32' in builder:
retcode = subprocess.call(['msbuild', 'INSTALL.vcxproj', '/Property:PlatformToolset=v120_xp', '/p:Configuration=Release'])
elif 'win64' in builder:
if 'win' in builder:
retcode = subprocess.call(['msbuild', 'INSTALL.vcxproj', '/p:Configuration=Release'])
else:
retcode = subprocess.call(['make', '-s', '-j4', 'install'])

View File

@@ -123,26 +123,14 @@ else:
os.remove(f)
retcode = subprocess.call(['cpack', '-G', 'ZIP'])
result_file = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')][0]
# TODO(sergey): Such magic usually happens in SCon's packaging bu we don't have it
# in the CMake yet. For until then we do some magic here.
tokens = result_file.split('-')
blender_version = tokens[1].split('.')
blender_full_version = '.'.join(blender_version[0:2])
git_hash = tokens[2].split('.')[1]
platform = builder.split('_')[0]
builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform)
if branch != '':
builderified_name = branch + "-" + builderified_name
os.rename(result_file, "{}.zip".format(builderified_name))
os.rename(result_file, "{}.zip".format(builder))
# create zip file
try:
upload_zip = "buildbot_upload.zip"
if os.path.exists(upload_zip):
os.remove(upload_zip)
z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
z.write("{}.zip".format(builderified_name))
z.write("{}.zip".format(builder))
z.close()
sys.exit(retcode)
except Exception as ex:

View File

@@ -0,0 +1,103 @@
# - Find Alembic library
# Find the native Alembic includes and library
# This module defines
# ALEMBIC_INCLUDE_DIRS, where to find Alembic headers.
# ALEMBIC_LIBRARIES, libraries to link against to use Alembic.
# ALEMBIC_ROOT_DIR, The base directory to search for Alembic.
# This can also be an environment variable.
# ALEMBIC_FOUND, If false, do not try to use Alembic.
# ALEMBIC_HDF5_FOUND, indicates whether Alembic supports HDF5
#=============================================================================
# Copyright 2013 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If ALEMBIC_ROOT_DIR was defined in the environment, use it.
IF(NOT ALEMBIC_ROOT_DIR AND NOT $ENV{ALEMBIC_ROOT_DIR} STREQUAL "")
SET(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
ENDIF()
SET(_alembic_SEARCH_DIRS
${ALEMBIC_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/alembic
)
SET(_alembic_FIND_COMPONENTS
AlembicAbc
AlembicAbcCoreAbstract
AlembicAbcGeom
AlembicAbcCoreOgawa
AlembicOgawa
AlembicUtil
)
FIND_PATH(ALEMBIC_INCLUDE_DIR
NAMES
Alembic/Abc/All.h
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
include
)
SET(_alembic_LIBRARIES)
FOREACH(COMPONENT ${_alembic_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(ALEMBIC_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
lib
lib/static
)
MARK_AS_ADVANCED(ALEMBIC_${UPPERCOMPONENT}_LIBRARY)
LIST(APPEND _alembic_LIBRARIES "${ALEMBIC_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
# Sepcial handling of optional libraries
FIND_LIBRARY(ALEMBIC_ALEMBICABCCOREHDF5_LIBRARY
NAMES
AlembicAbcCoreHDF5
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
lib
lib/static
)
MARK_AS_ADVANCED(ALEMBIC_ALEMBICABCCOREHDF5_LIBRARY)
IF(ALEMBIC_ALEMBICABCCOREHDF5_LIBRARY)
LIST(APPEND _alembic_LIBRARIES "${ALEMBIC_ALEMBICABCCOREHDF5_LIBRARY}")
SET(ALEMBIC_HDF5_FOUND TRUE)
ELSE()
SET(ALEMBIC_HDF5_FOUND FALSE)
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Alembic DEFAULT_MSG
_alembic_LIBRARIES ALEMBIC_INCLUDE_DIR)
IF(ALEMBIC_FOUND)
SET(ALEMBIC_LIBRARIES ${_alembic_LIBRARIES})
SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
ENDIF(ALEMBIC_FOUND)
MARK_AS_ADVANCED(
ALEMBIC_INCLUDE_DIR
ALEMBIC_LIBRARIES
)

View File

@@ -1,113 +0,0 @@
# - Try to find audaspace
# Once done, this will define
#
# AUDASPACE_FOUND - system has audaspace
# AUDASPACE_INCLUDE_DIRS - the audaspace include directories
# AUDASPACE_LIBRARIES - link these to use audaspace
# AUDASPACE_C_FOUND - system has audaspace's C binding
# AUDASPACE_C_INCLUDE_DIRS - the audaspace's C binding include directories
# AUDASPACE_C_LIBRARIES - link these to use audaspace's C binding
# AUDASPACE_PY_FOUND - system has audaspace's python binding
# AUDASPACE_PY_INCLUDE_DIRS - the audaspace's python binding include directories
# AUDASPACE_PY_LIBRARIES - link these to use audaspace's python binding
IF(NOT AUDASPACE_ROOT_DIR AND NOT $ENV{AUDASPACE_ROOT_DIR} STREQUAL "")
SET(AUDASPACE_ROOT_DIR $ENV{AUDASPACE_ROOT_DIR})
ENDIF()
SET(_audaspace_SEARCH_DIRS
${AUDASPACE_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
)
# Use pkg-config to get hints about paths
FIND_PACKAGE(PkgConfig)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(AUDASPACE_PKGCONF audaspace)
ENDIF(PKG_CONFIG_FOUND)
# Include dir
FIND_PATH(AUDASPACE_INCLUDE_DIR
NAMES ISound.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
FIND_LIBRARY(AUDASPACE_LIBRARY
NAMES audaspace
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
# Include dir
FIND_PATH(AUDASPACE_C_INCLUDE_DIR
NAMES AUD_Sound.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
FIND_LIBRARY(AUDASPACE_C_LIBRARY
NAMES audaspace-c
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
# Include dir
FIND_PATH(AUDASPACE_PY_INCLUDE_DIR
NAMES python/PyAPI.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
FIND_LIBRARY(AUDASPACE_PY_LIBRARY
NAMES audaspace-py
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
FIND_PACKAGE(PackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace DEFAULT_MSG AUDASPACE_LIBRARY AUDASPACE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace_C DEFAULT_MSG AUDASPACE_C_LIBRARY AUDASPACE_C_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace_Py DEFAULT_MSG AUDASPACE_PY_LIBRARY AUDASPACE_PY_INCLUDE_DIR)
IF(AUDASPACE_FOUND)
SET(AUDASPACE_LIBRARIES ${AUDASPACE_LIBRARY})
SET(AUDASPACE_INCLUDE_DIRS ${AUDASPACE_INCLUDE_DIR})
ENDIF(AUDASPACE_FOUND)
IF(AUDASPACE_C_FOUND)
SET(AUDASPACE_C_LIBRARIES ${AUDASPACE_C_LIBRARY})
SET(AUDASPACE_C_INCLUDE_DIRS ${AUDASPACE_C_INCLUDE_DIR})
ENDIF(AUDASPACE_C_FOUND)
IF(AUDASPACE_PY_FOUND)
SET(AUDASPACE_PY_LIBRARIES ${AUDASPACE_PY_LIBRARY})
SET(AUDASPACE_PY_INCLUDE_DIRS ${AUDASPACE_PY_INCLUDE_DIR})
ENDIF(AUDASPACE_PY_FOUND)
MARK_AS_ADVANCED(
AUDASPACE_LIBRARY
AUDASPACE_LIBRARIES
AUDASPACE_INCLUDE_DIR
AUDASPACE_INCLUDE_DIRS
AUDASPACE_C_LIBRARY
AUDASPACE_C_LIBRARIES
AUDASPACE_C_INCLUDE_DIR
AUDASPACE_C_INCLUDE_DIRS
AUDASPACE_PY_LIBRARY
AUDASPACE_PY_LIBRARIES
AUDASPACE_PY_INCLUDE_DIR
AUDASPACE_PY_INCLUDE_DIRS
)

View File

@@ -0,0 +1,75 @@
# - Find HDF5 library
# Find the native hdf5 includes and library
# This module defines
# HDF5_INCLUDE_DIRS, where to find hdf5 headers.
# HDF5_LIBRARIES, libraries to link against to use hdf5.
# HDF5_ROOT_DIR, The base directory to search for hdf5.
# This can also be an environment variable.
# HDF5_FOUND, If false, do not try to use hdf5.
#=============================================================================
# Copyright 2013 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If HDF5_ROOT_DIR was defined in the environment, use it.
IF(NOT HDF5_ROOT_DIR AND NOT $ENV{HDF5_ROOT_DIR} STREQUAL "")
SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR})
ENDIF()
SET(_hdf5_SEARCH_DIRS
${HDF5_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/hdf5
)
SET(_hdf5_FIND_COMPONENTS
hdf5
hdf5_hl
)
FIND_PATH(_hdf5_INCLUDE_DIRS
NAMES
hdf5.h
HINTS
${_hdf5_SEARCH_DIRS}
)
SET(_hdf5_LIBRARIES)
FOREACH(COMPONENT ${_hdf5_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(HDF5_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_hdf5_SEARCH_DIRS}
)
MARK_AS_ADVANCED(HDF5_${UPPERCOMPONENT}_LIBRARY)
LIST(APPEND _hdf5_LIBRARIES "${HDF5_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
# handle the QUIETLY and REQUIRED arguments and set HDF5_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(hdf5 DEFAULT_MSG
_hdf5_LIBRARIES _hdf5_INCLUDE_DIRS)
IF(HDF5_FOUND)
SET(HDF5_LIBRARIES ${_hdf5_LIBRARIES})
SET(HDF5_INCLUDE_DIRS ${_hdf5_INCLUDE_DIRS})
ENDIF(HDF5_FOUND)
MARK_AS_ADVANCED(
HDF5_INCLUDE_DIRS
HDF5_LIBRARIES
)

View File

@@ -59,8 +59,7 @@ FIND_LIBRARY(OPENIMAGEIO_LIBRARY
FIND_FILE(OPENIMAGEIO_IDIFF
NAMES
idiff
HINTS
${OPENIMAGEIO_ROOT_DIR}
${OPENIMAGEIO_ROOT_DIR}
PATH_SUFFIXES
bin
)

View File

@@ -1,111 +0,0 @@
# - Find OpenSubdiv library
# Find the native OpenSubdiv includes and library
# This module defines
# OPENSUBDIV_INCLUDE_DIRS, where to find OpenSubdiv headers, Set when
# OPENSUBDIV_INCLUDE_DIR is found.
# OPENSUBDIV_LIBRARIES, libraries to link against to use OpenSubdiv.
# OPENSUBDIV_ROOT_DIR, the base directory to search for OpenSubdiv.
# This can also be an environment variable.
# OPENSUBDIV_FOUND, if false, do not try to use OpenSubdiv.
#
# also defined, but not for general use are
# OPENSUBDIV_LIBRARY, where to find the OpenSubdiv library.
#=============================================================================
# Copyright 2013 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If OPENSUBDIV_ROOT_DIR was defined in the environment, use it.
IF(NOT OPENSUBDIV_ROOT_DIR AND NOT $ENV{OPENSUBDIV_ROOT_DIR} STREQUAL "")
SET(OPENSUBDIV_ROOT_DIR $ENV{OPENSUBDIV_ROOT_DIR})
ENDIF()
SET(_opensubdiv_FIND_COMPONENTS
osdGPU
osdCPU
)
SET(_opensubdiv_SEARCH_DIRS
${OPENSUBDIV_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/opensubdiv
)
FIND_PATH(OPENSUBDIV_INCLUDE_DIR
NAMES
opensubdiv/osd/mesh.h
HINTS
${_opensubdiv_SEARCH_DIRS}
PATH_SUFFIXES
include
)
SET(_opensubdiv_LIBRARIES)
FOREACH(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_opensubdiv_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
LIST(APPEND _opensubdiv_LIBRARIES "${OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
MACRO(OPENSUBDIV_CHECK_CONTROLLER
controller_include_file
variable_name)
IF(EXISTS "${OPENSUBDIV_INCLUDE_DIR}/opensubdiv/osd/${controller_include_file}")
SET(${variable_name} TRUE)
ELSE()
SET(${variable_name} FALSE)
ENDIF()
ENDMACRO()
# handle the QUIETLY and REQUIRED arguments and set OPENSUBDIV_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSubdiv DEFAULT_MSG
_opensubdiv_LIBRARIES OPENSUBDIV_INCLUDE_DIR)
IF(OPENSUBDIV_FOUND)
SET(OPENSUBDIV_LIBRARIES ${_opensubdiv_LIBRARIES})
SET(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
# Find available compute controllers.
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(OPENSUBDIV_HAS_OPENMP TRUE)
ELSE()
SET(OPENSUBDIV_HAS_OPENMP FALSE)
ENDIF()
OPENSUBDIV_CHECK_CONTROLLER("tbbEvaluator.h" OPENSUBDIV_HAS_TBB)
OPENSUBDIV_CHECK_CONTROLLER("clEvaluator.h" OPENSUBDIV_HAS_OPENCL)
OPENSUBDIV_CHECK_CONTROLLER("cudaEvaluator.h" OPENSUBDIV_HAS_CUDA)
OPENSUBDIV_CHECK_CONTROLLER("glXFBEvaluator.h" OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
OPENSUBDIV_CHECK_CONTROLLER("glComputeEvaluator.h" OPENSUBDIV_HAS_GLSL_COMPUTE)
ENDIF(OPENSUBDIV_FOUND)
MARK_AS_ADVANCED(
OPENSUBDIV_INCLUDE_DIR
)
FOREACH(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
MARK_AS_ADVANCED(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY)
ENDFOREACH()

View File

@@ -12,7 +12,7 @@
#
#=============================================================================
macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
if(WITH_GTESTS)
get_property(_current_include_directories
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -40,20 +40,10 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}"
INCLUDE_DIRECTORIES "${TEST_INC}")
if(${DO_ADD_TEST})
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
endif()
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
endif()
endmacro()
macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
BLENDER_SRC_GTEST_EX("${NAME}" "${SRC}" "${EXTRA_LIBS}" "TRUE")
endmacro()
macro(BLENDER_TEST NAME EXTRA_LIBS)
BLENDER_SRC_GTEST_EX("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}" "TRUE")
endmacro()
macro(BLENDER_TEST_PERFORMANCE NAME EXTRA_LIBS)
BLENDER_SRC_GTEST_EX("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}" "FALSE")
BLENDER_SRC_GTEST("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}")
endmacro()

View File

@@ -10,9 +10,9 @@ set(MY_WC_COMMIT_TIMESTAMP 0)
# Guess if this is a git working copy and then look up the revision
if(EXISTS ${SOURCE_DIR}/.git)
# The FindGit.cmake module is part of the standard distribution
find_package(Git)
include(FindGit)
if(GIT_FOUND)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${SOURCE_DIR}
@@ -97,10 +97,6 @@ if(EXISTS ${SOURCE_DIR}/.git)
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_COMMIT_TIMESTAMP
OUTPUT_STRIP_TRAILING_WHITESPACE)
# May fail in rare cases
if(MY_WC_COMMIT_TIMESTAMP STREQUAL "")
set(MY_WC_COMMIT_TIMESTAMP 0)
endif()
# Update GIT index before getting dirty files
execute_process(COMMAND git update-index -q --refresh

View File

@@ -40,7 +40,6 @@ from project_info import (
# is_py,
cmake_advanced_info,
cmake_compiler_defines,
cmake_cache_var,
project_name_get,
)
@@ -50,8 +49,6 @@ from os.path import join, dirname, normpath, relpath, exists
def create_nb_project_main():
from xml.sax.saxutils import escape
files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
files_rel.sort()
@@ -74,10 +71,6 @@ def create_nb_project_main():
# be tricky, get the project name from git if we can!
PROJECT_NAME = project_name_get()
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
make_exe_basename = os.path.basename(make_exe)
# --------------- NB spesific
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
@@ -138,9 +131,9 @@ def create_nb_project_main():
f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w')
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
f.write('<configurationDescriptor version="95">\n')
f.write('<configurationDescriptor version="94">\n')
f.write(' <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">\n')
f.write(' <df root="%s" name="0">\n' % SOURCE_DIR) # base_root_rel
f.write(' <df name="0" root="%s">\n' % SOURCE_DIR) # base_root_rel
# write files!
files_rel_local = [normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel]
@@ -192,27 +185,16 @@ def create_nb_project_main():
f.write(' <toolsSet>\n')
f.write(' <compilerSet>default</compilerSet>\n')
f.write(' <dependencyChecking>false</dependencyChecking>\n')
f.write(' <rebuildPropChanged>false</rebuildPropChanged>\n')
f.write(' </toolsSet>\n')
f.write(' <codeAssistance>\n')
f.write(' </codeAssistance>\n')
f.write(' <dependencyChecking>false</dependencyChecking>\n')
f.write(' <rebuildPropChanged>false</rebuildPropChanged>\n')
f.write(' <makefileType>\n')
f.write(' <makeTool>\n')
f.write(' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n')
if make_exe_basename == "ninja":
build_cmd = "ninja"
clean_cmd = "ninja -t clean"
else:
build_cmd = "${MAKE} -f Makefile"
clean_cmd = "${MAKE} -f Makefile clean"
f.write(' <buildCommand>%s</buildCommand>\n' % escape(build_cmd))
f.write(' <cleanCommand>%s</cleanCommand>\n' % escape(clean_cmd))
f.write(' <buildCommand>${MAKE} -f Makefile</buildCommand>\n')
f.write(' <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>\n')
f.write(' <executablePath>./bin/blender</executablePath>\n')
del build_cmd, clean_cmd
def write_toolinfo():
f.write(' <incDir>\n')
@@ -221,7 +203,7 @@ def create_nb_project_main():
f.write(' </incDir>\n')
f.write(' <preprocessorList>\n')
for cdef in defines:
f.write(' <Elem>%s</Elem>\n' % escape(cdef))
f.write(' <Elem>%s</Elem>\n' % cdef)
f.write(' </preprocessorList>\n')
f.write(' <cTool>\n')
@@ -239,11 +221,10 @@ def create_nb_project_main():
f.write(' \n')
for path in files_rel_local:
is_c = path.endswith(".c")
f.write(' <item path="%s"\n' % path)
f.write(' ex="false"\n')
f.write(' tool="%d"\n' % (0 if is_c else 1))
f.write(' flavor2="%d">\n' % (3 if is_c else 0))
f.write(' tool="1"\n')
f.write(' flavor2="0">\n')
f.write(' </item>\n')
f.write(' <runprofile version="9">\n')

View File

@@ -1,4 +1,5 @@
# Turn everything ON thats expected for an official release builds.
# turn everything OFF except for python which defaults to ON
# and is needed for the UI
#
# Example usage:
# cmake -C../blender/build_files/cmake/config/blender_full.cmake ../blender
@@ -12,7 +13,6 @@ set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE ON CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
@@ -52,18 +52,11 @@ set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
set(WITH_PLAYER ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
# platform dependant options
if(UNIX AND NOT APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif(WIN32)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif (APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
endif()
if(APPLE)
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
endif()

View File

@@ -16,7 +16,6 @@ set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
@@ -48,6 +47,7 @@ set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENNL OFF CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL OFF CACHE BOOL "" FORCE)
set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)

View File

@@ -48,7 +48,7 @@ macro(list_insert_before
unset(_index)
endmacro()
function(list_assert_duplicates
function (list_assert_duplicates
list_id
)
@@ -104,31 +104,21 @@ macro(file_list_suffix
endmacro()
function(target_link_libraries_optimized
TARGET
LIBS
)
macro(target_link_libraries_optimized TARGET LIBS)
foreach(_LIB ${LIBS})
target_link_libraries(${TARGET} optimized "${_LIB}")
endforeach()
endfunction()
function(target_link_libraries_debug
TARGET
LIBS
)
unset(_LIB)
endmacro()
macro(target_link_libraries_debug TARGET LIBS)
foreach(_LIB ${LIBS})
target_link_libraries(${TARGET} debug "${_LIB}")
endforeach()
endfunction()
function(target_link_libraries_decoupled
target
libraries_var
)
unset(_LIB)
endmacro()
macro(target_link_libraries_decoupled target libraries_var)
if(NOT MSVC)
target_link_libraries(${target} ${${libraries_var}})
else()
@@ -137,15 +127,14 @@ function(target_link_libraries_decoupled
file_list_suffix(_libraries_debug "${${libraries_var}}" "_d")
target_link_libraries_debug(${target} "${_libraries_debug}")
target_link_libraries_optimized(${target} "${${libraries_var}}")
unset(_libraries_debug)
endif()
endfunction()
endmacro()
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
# use it instead of include_directories()
function(blender_include_dirs
includes
)
macro(blender_include_dirs
includes)
set(_ALL_INCS "")
foreach(_INC ${ARGV})
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
@@ -156,12 +145,13 @@ function(blender_include_dirs
##endif()
endforeach()
include_directories(${_ALL_INCS})
endfunction()
function(blender_include_dirs_sys
includes
)
unset(_INC)
unset(_ABS_INC)
unset(_ALL_INCS)
endmacro()
macro(blender_include_dirs_sys
includes)
set(_ALL_INCS "")
foreach(_INC ${ARGV})
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
@@ -171,11 +161,13 @@ function(blender_include_dirs_sys
##endif()
endforeach()
include_directories(SYSTEM ${_ALL_INCS})
endfunction()
unset(_INC)
unset(_ABS_INC)
unset(_ALL_INCS)
endmacro()
function(blender_source_group
sources
)
macro(blender_source_group
sources)
# Group by location on disk
source_group("Source Files" FILES CMakeLists.txt)
@@ -185,23 +177,23 @@ function(blender_source_group
if((${_SRC_EXT} MATCHES ".h") OR
(${_SRC_EXT} MATCHES ".hpp") OR
(${_SRC_EXT} MATCHES ".hh"))
set(GROUP_ID "Header Files")
source_group("Header Files" FILES ${_SRC})
else()
set(GROUP_ID "Source Files")
source_group("Source Files" FILES ${_SRC})
endif()
source_group("${GROUP_ID}" FILES ${_SRC})
endforeach()
endfunction()
unset(_SRC)
unset(_SRC_EXT)
endmacro()
# only MSVC uses SOURCE_GROUP
function(blender_add_lib_nolist
macro(blender_add_lib_nolist
name
sources
includes
includes_sys
)
includes_sys)
# message(STATUS "Configuring library ${name}")
@@ -221,24 +213,22 @@ function(blender_add_lib_nolist
# Not for system includes because they can resolve to the same path
# list_assert_duplicates("${includes_sys}")
endfunction()
endmacro()
function(blender_add_lib
macro(blender_add_lib
name
sources
includes
includes_sys
)
includes_sys)
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
endfunction()
endmacro()
function(SETUP_LIBDIRS)
macro(SETUP_LIBDIRS)
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
@@ -298,27 +288,24 @@ function(SETUP_LIBDIRS)
if(WIN32 AND NOT UNIX)
link_directories(${PTHREADS_LIBPATH})
endif()
endfunction()
endmacro()
function(setup_liblinks
target
)
macro(setup_liblinks
target)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
target_link_libraries(
${target}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${FREETYPE_LIBRARY}
)
target_link_libraries(${target}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${FREETYPE_LIBRARY})
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
@@ -343,9 +330,6 @@ function(setup_liblinks
if(WITH_BULLET AND WITH_SYSTEM_BULLET)
target_link_libraries(${target} ${BULLET_LIBRARIES})
endif()
if(WITH_AUDASPACE AND WITH_SYSTEM_AUDASPACE)
target_link_libraries(${target} ${AUDASPACE_C_LIBRARIES} ${AUDASPACE_PY_LIBRARIES})
endif()
if(WITH_OPENAL)
target_link_libraries(${target} ${OPENAL_LIBRARY})
endif()
@@ -373,16 +357,6 @@ function(setup_liblinks
if(WITH_OPENCOLORIO)
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
endif()
if(WITH_OPENSUBDIV)
if(WIN32 AND NOT UNIX)
file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d")
target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}")
target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}")
unset(OPENSUBDIV_LIBRARIES_DEBUG)
else()
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
endif()
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
@@ -428,13 +402,11 @@ function(setup_liblinks
unset(EXPAT_LIB_DEBUG)
endif()
else()
target_link_libraries(
${target}
${OPENCOLLADA_LIBRARIES}
${PCRE_LIBRARIES}
${XML2_LIBRARIES}
${EXPAT_LIB}
)
target_link_libraries(${target}
${OPENCOLLADA_LIBRARIES}
${PCRE_LIBRARIES}
${XML2_LIBRARIES}
${EXPAT_LIB})
endif()
endif()
if(WITH_MEM_JEMALLOC)
@@ -449,6 +421,12 @@ function(setup_liblinks
if(WITH_LLVM)
target_link_libraries(${target} ${LLVM_LIBRARY})
endif()
if(WITH_ALEMBIC)
target_link_libraries(${target} ${ALEMBIC_LIBRARIES})
endif()
if(WITH_HDF5)
target_link_libraries(${target} ${HDF5_LIBRARIES})
endif()
if(WIN32 AND NOT UNIX)
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
endif()
@@ -464,11 +442,9 @@ function(setup_liblinks
${BLENDER_GL_LIBRARIES})
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
endfunction()
function(SETUP_BLENDER_SORTED_LIBS)
endmacro()
macro(SETUP_BLENDER_SORTED_LIBS)
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
list(APPEND BLENDER_LINK_LIBS
@@ -528,6 +504,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_object
bf_editor_armature
bf_editor_physics
bf_editor_hair
bf_editor_render
bf_editor_screen
bf_editor_sculpt_paint
@@ -591,7 +568,8 @@ function(SETUP_BLENDER_SORTED_LIBS)
ge_videotex
bf_dna
bf_blenfont
bf_blentranslation
bf_pointcache_alembic
bf_pointcache
bf_intern_audaspace
bf_intern_mikktspace
bf_intern_dualcon
@@ -609,7 +587,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
extern_libmv
extern_glog
extern_sdlew
extern_eigen3
bf_intern_glew_mx
)
@@ -688,10 +665,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
endif()
if(WITH_OPENSUBDIV)
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
endif()
foreach(SORTLIB ${BLENDER_SORTED_LIBS})
set(REMLIB ${SORTLIB})
foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
@@ -710,12 +683,14 @@ function(SETUP_BLENDER_SORTED_LIBS)
message(STATUS "Blender Skipping: (${REM_MSG})")
endif()
set(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} PARENT_SCOPE)
unset(SEARCHLIB)
unset(SORTLIB)
unset(REMLIB)
unset(REM_MSG)
# for top-level tests
set_property(GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP ${BLENDER_SORTED_LIBS})
endfunction()
endmacro()
macro(TEST_SSE_SUPPORT
_sse_flags
@@ -937,22 +912,19 @@ endmacro()
# utility macro
macro(remove_cc_flag
_flag)
flag)
foreach(flag ${ARGV})
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endforeach()
unset(flag)
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endmacro()
@@ -966,34 +938,28 @@ endmacro()
macro(remove_strict_flags)
if(CMAKE_COMPILER_IS_GNUCC)
remove_cc_flag(
"-Wstrict-prototypes"
"-Wmissing-prototypes"
"-Wmissing-format-attribute"
"-Wunused-local-typedefs"
"-Wunused-macros"
"-Wunused-parameter"
"-Wwrite-strings"
"-Wredundant-decls"
"-Wundef"
"-Wshadow"
"-Wdouble-promotion"
"-Wold-style-definition"
"-Werror=[^ ]+"
"-Werror"
)
remove_cc_flag("-Wstrict-prototypes")
remove_cc_flag("-Wmissing-prototypes")
remove_cc_flag("-Wunused-parameter")
remove_cc_flag("-Wunused-macros")
remove_cc_flag("-Wwrite-strings")
remove_cc_flag("-Wredundant-decls")
remove_cc_flag("-Wundef")
remove_cc_flag("-Wshadow")
remove_cc_flag("-Wdouble-promotion")
remove_cc_flag("-Wold-style-definition")
remove_cc_flag("-Werror=[^ ]+")
remove_cc_flag("-Werror")
# negate flags implied by '-Wall'
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
remove_cc_flag(
"-Wunused-parameter"
"-Wunused-variable"
"-Werror=[^ ]+"
"-Werror"
)
remove_cc_flag("-Wunused-parameter")
remove_cc_flag("-Wunused-variable")
remove_cc_flag("-Werror=[^ ]+")
remove_cc_flag("-Werror")
# negate flags implied by '-Wall'
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
@@ -1007,15 +973,11 @@ endmacro()
macro(remove_extra_strict_flags)
if(CMAKE_COMPILER_IS_GNUCC)
remove_cc_flag(
"-Wunused-parameter"
)
remove_cc_flag("-Wunused-parameter")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
remove_cc_flag(
"-Wunused-parameter"
)
remove_cc_flag("-Wunused-parameter")
endif()
if(MSVC)
@@ -1051,39 +1013,37 @@ macro(remove_strict_flags_file
endmacro()
function(ADD_CHECK_C_COMPILER_FLAG
macro(ADD_CHECK_C_COMPILER_FLAG
_CFLAGS
_CACHE_VAR
_FLAG
)
_FLAG)
include(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
if(${_CACHE_VAR})
# message(STATUS "Using CFLAG: ${_FLAG}")
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}" PARENT_SCOPE)
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}")
else()
message(STATUS "Unsupported CFLAG: ${_FLAG}")
endif()
endfunction()
endmacro()
function(ADD_CHECK_CXX_COMPILER_FLAG
macro(ADD_CHECK_CXX_COMPILER_FLAG
_CXXFLAGS
_CACHE_VAR
_FLAG
)
_FLAG)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
if(${_CACHE_VAR})
# message(STATUS "Using CXXFLAG: ${_FLAG}")
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}" PARENT_SCOPE)
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}")
else()
message(STATUS "Unsupported CXXFLAG: ${_FLAG}")
endif()
endfunction()
endmacro()
function(get_blender_version)
# extracts header vars and defines them in the parent scope:
@@ -1233,7 +1193,7 @@ endmacro()
# pair of macros to allow libraries to be specify files to install, but to
# only install them at the end so the directories don't get cleared with
# the files in them. used by cycles to install addon.
function(delayed_install
macro(delayed_install
base
files
destination)
@@ -1246,7 +1206,8 @@ function(delayed_install
endif()
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_DESTINATIONS ${destination})
endforeach()
endfunction()
unset(f)
endmacro()
# note this is a function instead of a macro so that ${BUILD_TYPE} in targetdir
# does not get expanded in calling but is preserved
@@ -1265,59 +1226,62 @@ function(delayed_do_install
list(GET destinations ${i} d)
install(FILES ${f} DESTINATION ${targetdir}/${d})
endforeach()
unset(f)
endif()
endfunction()
function(data_to_c
file_from file_to
list_to_add
)
macro(data_to_c
file_from file_to
list_to_add)
list(APPEND ${list_to_add} ${file_to})
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
get_filename_component(_file_to_path ${file_to} PATH)
add_custom_command(
OUTPUT ${file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
COMMAND "$<TARGET_FILE:datatoc>" ${file_from} ${file_to}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${file_from} ${file_to}
DEPENDS ${file_from} datatoc)
set_source_files_properties(${file_to} PROPERTIES GENERATED TRUE)
endfunction()
unset(_file_to_path)
endmacro()
# same as above but generates the var name and output automatic.
function(data_to_c_simple
file_from
list_to_add
)
macro(data_to_c_simple
file_from
list_to_add)
# remove ../'s
get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${file_from}.c REALPATH)
list(APPEND ${list_to_add} ${_file_to})
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
get_filename_component(_file_to_path ${_file_to} PATH)
add_custom_command(
OUTPUT ${_file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
COMMAND "$<TARGET_FILE:datatoc>" ${_file_from} ${_file_to}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
DEPENDS ${_file_from} datatoc)
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
endfunction()
unset(_file_from)
unset(_file_to)
unset(_file_to_path)
endmacro()
# macro for converting pixmap directory to a png and then a c file
function(data_to_c_simple_icons
path_from
list_to_add
)
macro(data_to_c_simple_icons
path_from
list_to_add
)
# Conversion steps
# path_from -> _file_from -> _file_to
@@ -1329,7 +1293,6 @@ function(data_to_c_simple_icons
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${path_from}.png.c REALPATH)
list(APPEND ${list_to_add} ${_file_to})
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
get_filename_component(_file_to_path ${_file_to} PATH)
@@ -1340,8 +1303,8 @@ function(data_to_c_simple_icons
OUTPUT ${_file_from} ${_file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
#COMMAND python3 ${CMAKE_SOURCE_DIR}/source/blender/datatoc/datatoc_icon.py ${_path_from_abs} ${_file_from}
COMMAND "$<TARGET_FILE:datatoc_icon>" ${_path_from_abs} ${_file_from}
COMMAND "$<TARGET_FILE:datatoc>" ${_file_from} ${_file_to}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc_icon ${_path_from_abs} ${_file_from}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
DEPENDS
${_icon_files}
datatoc_icon
@@ -1351,22 +1314,27 @@ function(data_to_c_simple_icons
)
set_source_files_properties(${_file_from} ${_file_to} PROPERTIES GENERATED TRUE)
endfunction()
unset(_path_from_abs)
unset(_file_from)
unset(_file_to)
unset(_file_to_path)
unset(_icon_files)
endmacro()
# XXX Not used for now...
function(svg_to_png
file_from
file_to
dpi
list_to_add
)
macro(svg_to_png
file_from
file_to
dpi
list_to_add)
# remove ../'s
get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
get_filename_component(_file_to ${CMAKE_CURRENT_SOURCE_DIR}/${file_to} REALPATH)
list(APPEND ${list_to_add} ${_file_to})
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
find_program(INKSCAPE_EXE inkscape)
mark_as_advanced(INKSCAPE_EXE)
@@ -1389,12 +1357,15 @@ function(svg_to_png
else()
message(WARNING "Inkscape not found, could not re-generate ${_file_to} from ${_file_from}!")
endif()
endfunction()
function(msgfmt_simple
file_from
list_to_add
)
unset(_file_from)
unset(_file_to)
endmacro()
macro(msgfmt_simple
file_from
list_to_add)
# remove ../'s
get_filename_component(_file_from_we ${file_from} NAME_WE)
@@ -1403,22 +1374,25 @@ function(msgfmt_simple
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${_file_from_we}.mo REALPATH)
list(APPEND ${list_to_add} ${_file_to})
set(${list_to_add} ${${list_to_add}} PARENT_SCOPE)
get_filename_component(_file_to_path ${_file_to} PATH)
add_custom_command(
OUTPUT ${_file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
COMMAND "$<TARGET_FILE:msgfmt>" ${_file_from} ${_file_to}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/msgfmt ${_file_from} ${_file_to}
DEPENDS msgfmt ${_file_from})
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
endfunction()
function(find_python_package
package
)
unset(_file_from_we)
unset(_file_from)
unset(_file_to)
unset(_file_to_path)
endmacro()
macro(find_python_package
package)
string(TOUPPER ${package} _upper_package)
@@ -1456,17 +1430,25 @@ function(find_python_package
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${package}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${package}', "
"WITH_PYTHON_INSTALL_${_upper_package} option will be ignored when installing python")
set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE)
set(WITH_PYTHON_INSTALL_${_upper_package} OFF)
else()
message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'")
endif()
unset(_PY_VER_SPLIT)
unset(_PY_VER_MAJOR)
endif()
endfunction()
unset(_upper_package)
endmacro()
# like Python's 'print(dir())'
function(print_all_vars)
macro(print_all_vars)
get_cmake_property(_vars VARIABLES)
foreach(_var ${_vars})
message("${_var}=${${_var}}")
endforeach()
endfunction()
unset(_vars)
unset(_var)
endmacro()

View File

@@ -21,10 +21,10 @@ SET(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
# Get the build revision, note that this can get out-of-sync, so for packaging run cmake first.
set(MY_WC_HASH "unknown")
if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
find_package(Git)
include(FindGit)
if(GIT_FOUND)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse --short HEAD
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse --short @{u}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -37,8 +37,7 @@ unset(MY_WC_HASH)
# Force Package Name
execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE CPACK_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${CMAKE_SYSTEM_PROCESSOR})
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
# RPM packages
@@ -74,7 +73,6 @@ if(WIN32)
set(CPACK_WIX_PRODUCT_ICON ${CMAKE_SOURCE_DIR}/source/icons/winblender.ico)
set(CPACK_WIX_UPGRADE_GUID "B767E4FD-7DE7-4094-B051-3AE62E13A17A")
set(CPACK_WIX_TEMPLATE ${LIBDIR}/package/installer_wix/WIX.template)
set(CPACK_WIX_UI_BANNER ${LIBDIR}/package/installer_wix/WIX_UI_BANNER.bmp)
set(CPACK_WIX_UI_DIALOG ${LIBDIR}/package/installer_wix/WIX_UI_DIALOG.bmp)

View File

@@ -130,7 +130,7 @@ def is_project_file(filename):
def cmake_advanced_info():
""" Extract includes and defines from cmake.
""" Extracr includes and defines from cmake.
"""
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")

View File

@@ -59,21 +59,14 @@ def is_c_any(filename):
CMAKE_DIR = "."
def cmake_cache_var_iter():
import re
re_cache = re.compile(r'([A-Za-z0-9_\-]+)?:?([A-Za-z0-9_\-]+)?=(.*)$')
with open(join(CMAKE_DIR, "CMakeCache.txt"), 'r', encoding='utf-8') as cache_file:
for l in cache_file:
match = re_cache.match(l.strip())
if match is not None:
var, type_, val = match.groups()
yield (var, type_ or "", val)
def cmake_cache_var(var):
for var_iter, type_iter, value_iter in cmake_cache_var_iter():
if var == var_iter:
return value_iter
cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"))
lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
cache_file.close()
for l in lines:
if l.split(":")[0] == var:
return l.split("=", 1)[-1]
return None

View File

@@ -52,8 +52,6 @@ BF_CXX = '/usr'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_AUDASPACE = True
# we use simply jack framework
WITH_BF_JACK = True
BF_JACK = '/Library/Frameworks/Jackmp.framework'
@@ -215,12 +213,6 @@ WITH_BF_FREESTYLE = True
#OpenMP ( will be checked for compiler support and turned off eventually )
WITH_BF_OPENMP = True
WITH_BF_OPENSUBDIV = False
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = []

View File

@@ -26,8 +26,6 @@ BF_CXX = '/usr'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_JACK = '/usr'
BF_JACK_INC = '${BF_JACK}/include/jack'
@@ -54,9 +52,9 @@ BF_OPENEXR = '/usr'
# BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include'
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
BF_OPENEXR_LIB = 'Half IlmImf-2_1 Iex-2_1 Imath-2_1 '
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
WITH_BF_DDS = True
@@ -208,7 +206,7 @@ WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
WITH_BF_OPENMP = True
@@ -228,13 +226,18 @@ BF_3DMOUSE_LIB_STATIC = '${BF_3DMOUSE_LIBPATH}/libspnav.a'
#Freestyle
WITH_BF_FREESTYLE = True
WITH_BF_OPENSUBDIV = False
WITH_BF_STATICOPENSUBDIV = False
BF_OPENSUBDIV = '/usr'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIB_STATIC = '${BF_OPENSUBDIV_LIBPATH}/libosdGPU.a ${BF_OPENSUBDIV_LIBPATH}/libosdCPU.a'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
# HDF5
WITH_BF_HDF5 = True
BF_HDF5 = '/usr'
BF_HDF5_LIB = 'hdf5 hdf5_hl'
BF_HDF5_LIBPATH='${BF_HDF5}/lib'
# Alembic
WITH_BF_ALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_LIB = 'AlembicAbcGeom AlembicAbc AlembicAbcCollection AlembicAbcCoreFactory AlembicAbcCoreHDF5 AlembicAbcCoreAbstract AlembicAbcCoreOgawa AlembicAbcMaterial AlembicOgawa AlembicUtil'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH='${BF_ALEMBIC}/lib/static'
##
CC = 'gcc'

View File

@@ -23,8 +23,6 @@ BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-55.dll ${BF_FFMPEG_LIBPATH}/avcodec-55.dll ${BF_FFMPEG_LIBPATH}/avdevice-55.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include'
@@ -147,7 +145,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
WITH_BF_CYCLES = True
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
@@ -168,12 +166,6 @@ BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_49 boost_filesystem-mgw46-mt-s-1_49
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mgw46-mt-s-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENSUBDIV = False
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']

View File

@@ -42,8 +42,6 @@ BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc'
@@ -210,12 +208,6 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
#Freestyle
WITH_BF_FREESTYLE = True
WITH_BF_OPENSUBDIV = True
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'

View File

@@ -22,8 +22,6 @@ BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll ${BF_FFMPEG_LIBPATH}/swresample-0.dll ${BF_FFMPEG_LIBPATH}/xvidcore.dll'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include'
@@ -146,7 +144,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
WITH_BF_CYCLES = True
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
@@ -167,12 +165,6 @@ BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49
BF_BOOST_LIB_INTERNATIONAL = ' boost_locale-mgw47-mt-s-1_49 boost_locale-mgw47-mt-sd-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENSUBDIV = False
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']

View File

@@ -55,8 +55,6 @@ BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL2.lib'
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_AUDASPACE = True
WITH_BF_JACK = False
BF_PTHREADS = LIBDIR + '/pthreads'
@@ -214,12 +212,6 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['']
#Freestyle
WITH_BF_FREESTYLE = True
WITH_BF_OPENSUBDIV = True
BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
BF_OPENSUBDIV_LIB = 'osdCPU osdGPU'
BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'

View File

@@ -204,10 +204,20 @@ def setup_staticlibs(lenv):
libincs += Split(lenv['BF_OIIO_LIBPATH'])
if lenv['WITH_BF_STATICOIIO']:
statlibs += Split(lenv['BF_OIIO_LIB_STATIC'])
if lenv['WITH_BF_HDF5']:
libincs += Split(lenv['BF_HDF5_LIBPATH'])
if lenv['WITH_BF_ALEMBIC']:
libincs += Split(lenv['BF_ALEMBIC_LIBPATH'])
if lenv['WITH_BF_STATICALEMBIC']:
statlibs += Split(lenv['BF_ALEMBIC_LIB_STATIC'])
if lenv['WITH_BF_OPENEXR']:
libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
if lenv['WITH_BF_STATICOPENEXR']:
statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
if lenv['WITH_BF_ZLIB'] and lenv['WITH_BF_STATICZLIB']:
statlibs += Split(lenv['BF_ZLIB_LIB_STATIC'])
@@ -242,11 +252,6 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_STATIC3DMOUSE']:
statlibs += Split(lenv['BF_3DMOUSE_LIB_STATIC'])
if lenv['WITH_BF_OPENSUBDIV']:
libincs += Split(lenv['BF_OPENSUBDIV_LIBPATH'])
if lenv['WITH_BF_STATICOPENSUBDIV']:
statlibs += Split(lenv['BF_OPENSUBDIV_LIB_STATIC'])
# setting this last so any overriding of manually libs could be handled
if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
# We must remove any previous items defining this path, for same reason stated above!
@@ -288,8 +293,16 @@ def setup_syslibs(lenv):
if not lenv['WITH_BF_STATICOCIO']:
syslibs += Split(lenv['BF_OCIO_LIB'])
if lenv['WITH_BF_HDF5']:
syslibs += Split(lenv['BF_HDF5_LIB'])
if lenv['WITH_BF_ALEMBIC']:
if not lenv['WITH_BF_STATICALEMBIC']:
syslibs += Split(lenv['BF_ALEMBIC_LIB'])
if lenv['WITH_BF_OPENEXR'] and not lenv['WITH_BF_STATICOPENEXR']:
syslibs += Split(lenv['BF_OPENEXR_LIB'])
if lenv['WITH_BF_ZLIB'] and not lenv['WITH_BF_STATICZLIB']:
syslibs += Split(lenv['BF_ZLIB_LIB'])
if lenv['WITH_BF_TIFF'] and not lenv['WITH_BF_STATICTIFF']:
@@ -349,13 +362,6 @@ def setup_syslibs(lenv):
if not lenv['WITH_BF_STATICPNG']:
syslibs += Split(lenv['BF_PNG_LIB'])
if lenv['WITH_BF_OPENSUBDIV']:
if not lenv['WITH_BF_STATICOPENSUBDIV']:
if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
syslibs += [osdlib+'_d' for osdlib in Split(lenv['BF_OPENSUBDIV_LIB'])]
else:
syslibs += Split(lenv['BF_OPENSUBDIV_LIB'])
# Hack to pass OSD libraries to linker before extern_{clew,cuew}
for syslib in create_blender_liblist(lenv, 'system'):
syslibs.append(os.path.basename(syslib))
@@ -384,7 +390,23 @@ def propose_priorities():
def creator(env):
sources = ['creator.c']# + Blender.buildinfo(env, "dynamic") + Blender.resources
incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/depsgraph', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']]
incs = ['#/intern/guardedalloc',
'#/source/blender/blenlib',
'#/source/blender/blenkernel',
'#/source/blender/depsgraph',
'#/source/blender/editors/include',
'#/source/blender/blenloader',
'#/source/blender/imbuf',
'#/source/blender/renderconverter',
'#/source/blender/render/extern/include',
'#/source/blender/windowmanager',
'#/source/blender/makesdna',
'#/source/blender/makesrna',
'#/source/blender/pointcache',
'#/source/gameengine/BlenderRoutines',
'#/extern/glew/include',
'#/source/blender/gpu',
env['BF_OPENGL_INC']]
defs = []
@@ -776,7 +798,7 @@ def AppIt(target=None, source=None, env=None):
commands.getoutput(cmd)
cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir)
commands.getoutput(cmd)
cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/kernel/geom %s/kernel/split %s/kernel/kernels %s/util/util_color.h %s/util/util_half.h %s/util/util_math.h %s/util/util_math_fast.h %s/util/util_transform.h %s/util/util_types.h %s/util/util_atomic.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, cinstalldir)
cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/kernel/geom %s/util/util_color.h %s/util/util_half.h %s/util/util_math.h %s/util/util_math_fast.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, croot, croot, croot, cinstalldir)
commands.getoutput(cmd)
cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir)
commands.getoutput(cmd)
@@ -796,8 +818,6 @@ def AppIt(target=None, source=None, env=None):
commands.getoutput(cmd)
cmd = 'cp -R %s/release/site-packages/ %s/%s.app/Contents/Resources/%s/python/lib/python%s/site-packages/'%(libdir,installdir,binary,VERSION,env['BF_PYTHON_VERSION'])
commands.getoutput(cmd)
cmd = 'cp -r %s/python/bin -d %s/%s.app/Contents/Resources/%s/python/'%(libdir,installdir,binary,VERSION)
commands.getoutput(cmd)
cmd = 'chmod +x %s/%s.app/Contents/MacOS/%s'%(installdir,binary, binary)
commands.getoutput(cmd)

View File

@@ -107,7 +107,6 @@ def print_arguments(args, bc):
def validate_arguments(args, bc):
opts_list = [
'WITH_BF_FREESTYLE', 'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'WITH_BF_PYTHON_SECURITY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LIBPATH_ARCH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS',
'WITH_BF_AUDASPACE', 'BF_AUDASPACE_C_INC', 'BF_AUDASPACE_PY_INC', 'BF_AUDASPACE_DEF',
'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH', 'WITH_BF_SDL_DYNLOAD',
'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH', 'WITH_BF_JACK_DYNLOAD',
@@ -184,7 +183,7 @@ def validate_arguments(args, bc):
'WITH_BF_LIBMV', 'WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS',
'WITH_BF_CYCLES_OSL', 'WITH_BF_STATICOSL', 'BF_OSL', 'BF_OSL_INC', 'BF_OSL_LIB', 'BF_OSL_LIBPATH', 'BF_OSL_LIB_STATIC', 'BF_OSL_COMPILER',
'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS',
'WITH_BF_OPENSUBDIV', 'WITH_BF_STATICOPENSUBDIV', 'BF_OPENSUBDIV', 'BF_OPENSUBDIV_INC', 'BF_OPENSUBDIV_LIB', 'BF_OPENSUBDIV_LIBPATH', 'BF_OPENSUBDIV_LIB_STATIC'
'WITH_BF_ALEMBIC', 'BF_ALEMBIC', 'BF_ALEMBIC_INC', 'BF_ALEMBIC_LIB', 'BF_ALEMBIC_LIBPATH',
]
# Have options here that scons expects to be lists
@@ -299,11 +298,6 @@ def read_opts(env, cfg, args):
('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
(BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
(BoolVariable('WITH_BF_AUDASPACE', 'Build with audaspace if true', True)),
('BF_AUDASPACE_C_INC', 'audaspace-c include path', ''),
('BF_AUDASPACE_PY_INC', 'audaspace-py include path', ''),
('BF_AUDASPACE_DEF', 'audaspace defines', ''),
(BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
('BF_SDL', 'SDL base path', ''),
('BF_SDL_INC', 'SDL include path', ''),
@@ -588,6 +582,19 @@ def read_opts(env, cfg, args):
(BoolVariable('WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS', 'Enable fixed-size schur specializations', True)),
(BoolVariable('WITH_BF_COMPOSITOR', 'Enable the tile based nodal compositor', True)),
(BoolVariable('WITH_BF_HDF5', 'Use HDF5 if true', False)),
('BF_HDF5', 'HDF5 base path', ''),
('BF_HDF5_LIB', 'HDF5 library', ''),
('BF_HDF5_LIBPATH', 'HDF5 library path', ''),
(BoolVariable('WITH_BF_ALEMBIC', 'Use Alembic if true', False)),
(BoolVariable('WITH_BF_STATICALEMBIC', 'Staticly link to Alembic', False)),
('BF_ALEMBIC', 'Alembic base path', ''),
('BF_ALEMBIC_INC', 'Alembic include path', ''),
('BF_ALEMBIC_LIB', 'Alembic library', ''),
('BF_ALEMBIC_LIB_STATIC', 'Alembic static libraries', ''),
('BF_ALEMBIC_LIBPATH', 'Alembic library path', ''),
) # end of opts.AddOptions()
localopts.AddVariables(
@@ -663,14 +670,6 @@ def read_opts(env, cfg, args):
('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', ''),
(BoolVariable('WITH_BF_OPENSUBDIV', 'Build with OpenSubdiv library', False)),
(BoolVariable('WITH_BF_STATICOPENSUBDIV', 'Staticly link to OpenColorIO', False)),
('BF_OPENSUBDIV', 'OpenSubdiv root path', ''),
('BF_OPENSUBDIV_INC', 'OpenSubdiv include path', ''),
('BF_OPENSUBDIV_LIB', 'OpenSubdiv library', ''),
('BF_OPENSUBDIV_LIBPATH', 'OpenSubdiv library path', ''),
('BF_OPENSUBDIV_LIB_STATIC', 'OpenSubdiv static library', ''),
(BoolVariable('WITH_BF_CPP11', '"Build with C++11 standard enabled, for development use only!', False)),
(BoolVariable('WITH_BF_LEGACY_DEPSGRAPH', 'Build Blender with legacy dependency graph', True)),

104
doc/build_systems/cmake.txt Normal file
View File

@@ -0,0 +1,104 @@
Blender CMake build system
============================
Contents
---------------
1. Introduction
2. Obtaining CMake
3. Building Blender
4. Generic Setup
5. Configuring the build after SVN updates
1. Introduction
---------------
This document describes general usage of the new CMake scripts. The
inner workings will be described in blender-cmake-dev.txt (TODO).
2. Obtaining CMake
------------------
CMake for can either be downloaded using your favorite package manager
or is also available from the CMake website at http://www.cmake.org
The website also contains some documentation on CMake usage but I found
the man page alone pretty helpful.
3. Building Blender
-------------------
Building Blender requires obtaining a compiler, library dependencies,
and correct setup depending on the system. For details on how to set
up a build on various operating systems, see the wiki documentation:
http://wiki.blender.org/index.php/Dev:Doc/Building_Blender
4. Generic Setup
----------------
CMake allows one to generate the build project files and binary objects
outside the source tree which can be pretty handy in working and experimenting
with different Blender configurations (Audio/NoAudio, GameEngine/NoGameEngine etc.)
while maintaining a clean source tree. It also makes it possible to generate files
for different build systems on the same source tree. This also has benefits for
general SVN management for the developer as patches and submit logs are much cleaner.
Create a directory outside the blender source tree where you would like to build
Blender (from now on called $BLENDERBUILD). On the commandline you can then run
the cmake command to generate your initial build files. First just run 'cmake' which
will inform you what the available generators are. Thn you can run
'cmake -G generator $BLENDERSOURCE' to generate the build files. Here is an example
of all this for Xcode:
% mkdir $BLENDERBUILD
% cd $BLENDERBUILD
% cmake
...
...
--version [file] = Show program name/version banner and exit.
Generators
The following generators are available on this platform:
KDevelop3 = Generates KDevelop 3 project files.
Unix Makefiles = Generates standard UNIX makefiles.
Xcode = Generate XCode project files.
% cmake -G Xcode $BLENDERSOURCE
...
...
-- Configuring blender
-- Configuring blenderplayer
-- Configuring done
-- Generating done
-- Build files have been written to: $BLENDERBUILD
This will generate the build files with default values. Specific features can
be enabled or disabled by running the ccmake "GUI" from $BLENDERBUILD as follows:
% ccmake $BLENDERSOURCE
A number of options appear which can be changed depending on your needs and
available dependencies (e.g. setting WITH_OPENEXR to OFF will disable support
for OpenEXR). It will also allow you to override default and detected paths
(e.g. Python directories) and compile and link flags. When you are satisfied
used ccmake to re-configure the build files and exit.
It is also possible to use the commandline of 'cmake' to override certain
of these settings.
5. Configuring the build after SVN updates
------------------------------------------
The $BLENDERBUILD directory maintains a file called CMakeCache.txt which
remembers the initial run's settings for subsequent generation runs. After
SVN updates that contain changes to the build system, rebuilding Blender will
automatically invoke CMake to regenerate the CMakeCache.txt and other files
as needed.
/Jacques Beaurain (jbinto)

View File

@@ -7,7 +7,7 @@
* These pages document the source code of blender.
*
* \subsection implinks Important Links
* - <a href="http://developer.blender.org">developer.blender.org</a> with bug tracker.
* - <a href="http://developer.blender.org">developer.blender.org</a> with bug tracker
* - <a href="http://wiki.blender.org/index.php/Dev:Contents">Development documents</a> on our wiki.
*
* \subsection blother Other

View File

@@ -11,6 +11,7 @@
/** \defgroup bmesh BMesh
* \ingroup blender
*/
/** \defgroup texture Texturing */
/** \defgroup compositor Compositing */
/** \defgroup python Python
@@ -94,10 +95,6 @@
/** \defgroup blender Blender */
/** \defgroup blt BlenTranslation
* \ingroup blender
*/
/** \defgroup blf BlenFont
* \ingroup blender
*/
@@ -325,7 +322,7 @@
* \ingroup gui
*/
/** \defgroup externformats External Formats */
/** \defgroup externformats external formats */
/** \defgroup collada COLLADA
* \ingroup externformats

View File

@@ -1,7 +1,6 @@
"""
Basic Sound Playback
++++++++++++++++++++
This script shows how to use the classes: :class:`Device`, :class:`Factory` and
:class:`Handle`.
"""

View File

@@ -1,10 +1,9 @@
"""
Texture Replacement
+++++++++++++++++++
Example of how to replace a texture in game with an external image.
``createTexture()`` and ``removeTexture()`` are to be called from a
module Python Controller.
createTexture() and removeTexture() are to be called from a module Python
Controller.
"""
from bge import logic
from bge import texture

View File

@@ -1,8 +1,7 @@
"""
Basic Video Playback
++++++++++++++++++++
Example of how to replace a texture in game with a video. It needs to run
everyframe.
Example of how to replace a texture in game with a video. It needs to run everyframe
"""
import bge
from bge import texture

View File

@@ -1,7 +1,6 @@
"""
Basic Handler Example
+++++++++++++++++++++
This script shows the most simple example of adding a handler.
"""

View File

@@ -7,9 +7,8 @@ act on specified rather than the selected or active data, or to execute an
operator in the different part of the user interface.
The context overrides are passed as a dictionary, with keys matching the context
member names in bpy.context.
For example to override ``bpy.context.active_object``,
you would pass ``{'active_object': object}``.
member names in bpy.context. For example to override bpy.context.active_object,
you would pass {'active_object': object}.
"""
# remove all objects in scene rather than the selected ones

View File

@@ -3,21 +3,21 @@ Calling Operators
-----------------
Provides python access to calling operators, this includes operators written in
C, Python or macros.
C, Python or Macros.
Only keyword arguments can be used to pass operator properties.
Operators don't have return values as you might expect,
instead they return a set() which is made up of:
``{'RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH'}``.
Common return values are ``{'FINISHED'}`` and ``{'CANCELLED'}``.
Operators don't have return values as you might expect, instead they return a
set() which is made up of: {'RUNNING_MODAL', 'CANCELLED', 'FINISHED',
'PASS_THROUGH'}.
Common return values are {'FINISHED'} and {'CANCELLED'}.
Calling an operator in the wrong context will raise a ``RuntimeError``,
Calling an operator in the wrong context will raise a RuntimeError,
there is a poll() method to avoid this problem.
Note that the operator ID (bl_idname) in this example is ``mesh.subdivide``,
``bpy.ops`` is just the access path for python.
Note that the operator ID (bl_idname) in this example is 'mesh.subdivide',
'bpy.ops' is just the access path for python.
Keywords and Positional Arguments
@@ -32,9 +32,9 @@ There are 3 optional positional arguments (documented in detail below).
bpy.ops.test.operator(override_context, execution_context, undo)
- override_context - ``dict`` type.
- execution_context - ``str`` (enum).
- undo - ``bool`` type.
* override_context - dict type
* execution_context - string (enum)
* undo - boolean
Each of these arguments is optional, but must be given in the order above.

View File

@@ -8,8 +8,7 @@ bl_info = {
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Object",
}
"category": "Object"}
import bpy

View File

@@ -1,7 +1,6 @@
"""
Submenus
++++++++
This menu demonstrates some different functions.
"""
import bpy

View File

@@ -1,7 +1,6 @@
"""
Extending Menus
+++++++++++++++
When creating menus for addons you can't reference menus in Blender's default
scripts.
Instead, the addon can add menu items to existing menus.

View File

@@ -1,7 +1,6 @@
"""
Basic Menu Example
++++++++++++++++++
Here is an example of a simple menu. Menus differ from panels in that they must
reference from a header, panel or another menu.

View File

@@ -7,10 +7,10 @@ for more flexible mesh editing from python see :mod:`bmesh`.
Blender stores 4 main arrays to define mesh geometry.
- :class:`Mesh.vertices` (3 points in space)
- :class:`Mesh.edges` (reference 2 vertices)
- :class:`Mesh.loops` (reference a single vertex and edge)
- :class:`Mesh.polygons`: (reference a range of loops)
* :class:`Mesh.vertices` (3 points in space)
* :class:`Mesh.edges` (reference 2 vertices)
* :class:`Mesh.loops` (reference a single vertex and edge)
* :class:`Mesh.polygons`: (reference a range of loops)
Each polygon reference a slice in the loop array, this way, polygons do not store vertices or corner data such as UV's directly,

View File

@@ -1,7 +1,6 @@
"""
Poll Function
+++++++++++++++
The :class:`NodeTree.poll` function determines if a node tree is visible
in the given context (similar to how :class:`Panel.poll`
and :class:`Menu.poll` define visibility). If it returns False,

View File

@@ -1,7 +1,6 @@
"""
Basic Object Operations Example
+++++++++++++++++++++++++++++++
This script demonstrates basic operations on object like creating new
object, placing it into scene, selecting it and making it active.
"""

View File

@@ -1,7 +1,6 @@
"""
Invoke Function
+++++++++++++++
:class:`Operator.invoke` is used to initialize the operator from the context
at the moment the operator is called.
invoke() is typically used to assign properties which are then used by
@@ -32,7 +31,7 @@ class SimpleMouseOperator(bpy.types.Operator):
y = bpy.props.IntProperty()
def execute(self, context):
# rather than printing, use the report function,
# rather then printing, use the report function,
# this way the message appears in the header,
self.report({'INFO'}, "Mouse coords are %d %d" % (self.x, self.y))
return {'FINISHED'}

View File

@@ -4,7 +4,7 @@ Calling a File Selector
This example shows how an operator can use the file selector.
Notice the invoke function calls a window manager method and returns
``{'RUNNING_MODAL'}``, this means the file selector stays open and the operator does not
RUNNING_MODAL, this means the file selector stays open and the operator does not
exit immediately after invoke finishes.
The file selector runs the operator, calling :class:`Operator.execute` when the

View File

@@ -1,7 +1,6 @@
"""
Dialog Box
++++++++++
This operator uses its :class:`Operator.invoke` function to call a popup.
"""
import bpy

View File

@@ -1,7 +1,6 @@
"""
Custom Drawing
++++++++++++++
By default operator properties use an automatic user interface layout.
If you need more control you can create your own layout with a
:class:`Operator.draw` function.

View File

@@ -1,9 +1,8 @@
"""
Modal Execution
+++++++++++++++
This operator defines a :class:`Operator.modal` function which running,
handling events until it returns ``{'FINISHED'}`` or ``{'CANCELLED'}``.
handling events until it returns {'FINISHED'} or {'CANCELLED'}.
Grab, Rotate, Scale and Fly-Mode are examples of modal operators.
They are especially useful for interactive tools,
@@ -11,9 +10,9 @@ your operator can have its own state where keys toggle options as the operator
runs.
:class:`Operator.invoke` is used to initialize the operator as being by
returning ``{'RUNNING_MODAL'}``, initializing the modal loop.
returning {'RUNNING_MODAL'}, initializing the modal loop.
Notice ``__init__()`` and ``__del__()`` are declared.
Notice __init__() and __del__() are declared.
For other operator types they are not useful but for modal operators they will
be called before the :class:`Operator.invoke` and after the operator finishes.
"""

View File

@@ -1,7 +1,6 @@
"""
Basic Operator Example
++++++++++++++++++++++
This script shows simple operator which prints a message.
Since the operator only has an :class:`Operator.execute` function it takes no

View File

@@ -1,7 +1,6 @@
"""
Simple Object Panel
+++++++++++++++++++
This panel has a :class:`Panel.poll` and :class:`Panel.draw_header` function,
even though the contents is basic this closely resembles blenders panels.
"""

View File

@@ -1,7 +1,6 @@
"""
Basic Panel Example
+++++++++++++++++++
This script is a simple panel which will draw into the object properties
section.

View File

@@ -1,8 +1,7 @@
"""
Advanced UIList Example - Filtering and Reordering
++++++++++++++++++++++++++++++++++++++++++++++++++
This script is an extended version of the ``UIList`` subclass used to show vertex groups. It is not used 'as is',
This script is an extended version of the UIList subclass used to show vertex groups. It is not used 'as is',
because iterating over all vertices in a 'draw' function is a very bad idea for UI performances! However, it's a good
example of how to create/use filtering/reordering callbacks.
"""

View File

@@ -1,7 +1,7 @@
"""
Note that when keying data paths which contain nested properties this must be
done from the :class:`ID` subclass, in this case the :class:`Armature` rather
than the bone.
then the bone.
"""
import bpy

View File

@@ -1,192 +0,0 @@
# Draws an off-screen buffer and display it in the corner of the view.
import bpy
from bgl import *
class OffScreenDraw(bpy.types.Operator):
bl_idname = "view3d.offscreen_draw"
bl_label = "View3D Offscreen Draw"
_handle_calc = None
_handle_draw = None
is_enabled = False
# manage draw handler
@staticmethod
def draw_callback_px(self, context):
scene = context.scene
aspect_ratio = scene.render.resolution_x / scene.render.resolution_y
self._update_offscreen(context, self._offscreen)
self._opengl_draw(context, self._texture, aspect_ratio, 0.2)
@staticmethod
def handle_add(self, context):
OffScreenDraw._handle_draw = bpy.types.SpaceView3D.draw_handler_add(
self.draw_callback_px, (self, context),
'WINDOW', 'POST_PIXEL',
)
@staticmethod
def handle_remove():
if OffScreenDraw._handle_draw is not None:
bpy.types.SpaceView3D.draw_handler_remove(OffScreenDraw._handle_draw, 'WINDOW')
OffScreenDraw._handle_draw = None
# off-screen buffer
@staticmethod
def _setup_offscreen(context):
import gpu
scene = context.scene
aspect_ratio = scene.render.resolution_x / scene.render.resolution_y
try:
offscreen = gpu.offscreen.new(512, int(512 / aspect_ratio))
except Exception as e:
print(e)
offscreen = None
return offscreen
@staticmethod
def _update_offscreen(context, offscreen):
scene = context.scene
render = scene.render
camera = scene.camera
modelview_matrix = camera.matrix_world.inverted()
projection_matrix = camera.calc_matrix_camera(
render.resolution_x,
render.resolution_y,
render.pixel_aspect_x,
render.pixel_aspect_y,
)
offscreen.draw_view3d(
scene,
context.space_data,
context.region,
projection_matrix,
modelview_matrix,
)
@staticmethod
def _opengl_draw(context, texture, aspect_ratio, scale):
"""
OpenGL code to draw a rectangle in the viewport
"""
glDisable(GL_DEPTH_TEST)
# view setup
glMatrixMode(GL_PROJECTION)
glPushMatrix()
glLoadIdentity()
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glLoadIdentity()
glOrtho(-1, 1, -1, 1, -15, 15)
gluLookAt(0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
act_tex = Buffer(GL_INT, 1)
glGetIntegerv(GL_TEXTURE_2D, act_tex)
viewport = Buffer(GL_INT, 4)
glGetIntegerv(GL_VIEWPORT, viewport)
width = int(scale * viewport[2])
height = int(width / aspect_ratio)
glViewport(viewport[0], viewport[1], width, height)
glScissor(viewport[0], viewport[1], width, height)
# draw routine
glEnable(GL_TEXTURE_2D)
glActiveTexture(GL_TEXTURE0)
glBindTexture(GL_TEXTURE_2D, texture)
texco = [(1, 1), (0, 1), (0, 0), (1, 0)]
verco = [(1.0, 1.0), (-1.0, 1.0), (-1.0, -1.0), (1.0, -1.0)]
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
glColor4f(1.0, 1.0, 1.0, 1.0)
glBegin(GL_QUADS)
for i in range(4):
glTexCoord3f(texco[i][0], texco[i][1], 0.0)
glVertex2f(verco[i][0], verco[i][1])
glEnd()
# restoring settings
glBindTexture(GL_TEXTURE_2D, act_tex[0])
glDisable(GL_TEXTURE_2D)
# reset view
glMatrixMode(GL_PROJECTION)
glPopMatrix()
glMatrixMode(GL_MODELVIEW)
glPopMatrix()
glViewport(viewport[0], viewport[1], viewport[2], viewport[3])
glScissor(viewport[0], viewport[1], viewport[2], viewport[3])
# operator functions
@classmethod
def poll(cls, context):
return context.area.type == 'VIEW_3D'
def modal(self, context, event):
if context.area:
context.area.tag_redraw()
return {'PASS_THROUGH'}
def invoke(self, context, event):
if OffScreenDraw.is_enabled:
self.cancel(context)
return {'FINISHED'}
else:
self._offscreen = OffScreenDraw._setup_offscreen(context)
if self._offscreen:
self._texture = self._offscreen.color_texture
else:
self.report({'ERROR'}, "Error initializing offscreen buffer. More details in the console")
return {'CANCELLED'}
OffScreenDraw.handle_add(self, context)
OffScreenDraw.is_enabled = True
if context.area:
context.area.tag_redraw()
context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
def cancel(self, context):
OffScreenDraw.handle_remove()
OffScreenDraw.is_enabled = False
if context.area:
context.area.tag_redraw()
def register():
bpy.utils.register_class(OffScreenDraw)
def unregister():
bpy.utils.unregister_class(OffScreenDraw)
if __name__ == "__main__":
register()

View File

@@ -1,47 +0,0 @@
Application Data (bge.app)
==========================
Module to access application values that remain unchanged during runtime.
.. module:: bge.app
.. data:: version
The Blender/BGE version as a tuple of 3 ints, eg. (2, 75, 1).
.. note:: Version tuples can be compared simply with (in)equality symbols;
for example, ``(2, 74, 5) <= (2, 75, 0)`` returns True (lexical order).
:type: tuple of three ints
.. data:: version_string
The Blender/BGE version formatted as a string, eg. "2.75 (sub 1)".
:type: str
.. data:: version_char
The Blender/BGE version character (for minor releases).
:type: str
.. data:: has_texture_ffmpeg
True if the BGE has been built with FFmpeg support, enabling use of :class:`~bge.texture.ImageFFmpeg` and :class:`~bge.texture.VideoFFmpeg`.
:type: bool
.. data:: has_joystick
True if the BGE has been built with joystick support.
:type: bool
.. data:: has_physics
True if the BGE has been built with physics support.
:type: bool

View File

@@ -4,77 +4,75 @@ Physics Constraints (bge.constraints)
.. module:: bge.constraints
Examples
--------
.. include:: ../examples/bge.constraints.py
:start-line: 1
:end-line: 4
.. literalinclude:: ../examples/bge.constraints.py
:language: rest
:lines: 2-4
.. literalinclude:: ../examples/bge.constraints.py
:lines: 6-
Functions
---------
.. function:: createConstraint( \
physicsid_1, physicsid_2, constraint_type, \
pivot_x=0.0, pivot_y=0.0, pivot_z=0.0, \
axis_x=0.0, axis_y=0.0, axis_z=0.0, flag=0)
.. function:: createConstraint(physicsid_1, physicsid_2, constraint_type, pivot_X, pivot_y, pivot_z, axis_x, axis_y, axis_z, flag)
Creates a constraint.
:arg physicsid_1: The physics id of the first object in constraint.
Constraints types:
- :class:`POINTTOPOINT_CONSTRAINT`
- :class:`LINEHINGE_CONSTRAINT`
- :class:`ANGULAR_CONSTRAINT`
- :class:`CONETWIST_CONSTRAINT`
- :class:`VEHICLE_CONSTRAINT`
- :class:`GENERIC_6DOF_CONSTRAINT`
:arg physicsid_1: the physics id of the first object in constraint.
:type physicsid_1: int
:arg physicsid_2: The physics id of the second object in constraint.
:arg physicsid_2: the physics id of the second object in constraint.
:type physicsid_2: int
:arg constraint_type: The type of the constraint, see `Create Constraint Constants`_.
:arg constrainttype: the type of the constraint.
:type constrainttype: int
:type constraint_type: int
:arg pivot_X: pivot X position (optional).
:type pivot_X: float
:arg pivot_x: Pivot X position. (optional)
:type pivot_x: float
:arg pivot_Y: pivot Y position (optional).
:type pivot_Y: float
:arg pivot_y: Pivot Y position. (optional)
:type pivot_y: float
:arg pivot_Z: pivot Z position (optional).
:type pivot_Z: float
:arg pivot_z: Pivot Z position. (optional)
:type pivot_z: float
:arg axis_X: X axis angle in degrees (optional).
:type axis_X: float
:arg axis_x: X axis angle in degrees. (optional)
:type axis_x: float
:arg axis_Y: Y axis angle in degrees (optional).
:type axis_Y: float
:arg axis_y: Y axis angle in degrees. (optional)
:type axis_y: float
:arg axis_Z: Z axis angle in degrees (optional).
:type axis_Z: float
:arg axis_z: Z axis angle in degrees. (optional)
:type axis_z: float
:arg flag: 128 to disable collision between linked bodies. (optional)
:arg flag: 128 to disable collision between linked bodies (optional).
:type flag: int
:return: A constraint wrapper.
:rtype: :class:`~bge.types.KX_ConstraintWrapper`
:return: a constraint wrapper.
:rtype: :class:`bge.types.KX_ConstraintWrapper`
.. attribute:: error
Symbolic constant string that indicates error.
.. function:: exportBulletFile(filename)
Exports a file representing the dynamics world (usually using ``.bullet`` extension).
export a .bullet file
See `Bullet binary serialization <http://bulletphysics.org/mediawiki-1.5.8/index.php/Bullet_binary_serialization>`__.
:arg filename: File path.
:type filename: str
:arg filename: File name
:type filename: string
.. function:: getAppliedImpulse(constraintId)
:arg constraintId: The id of the constraint.
:type constraintId: int
:return: The most recent applied impulse.
:return: the most recent applied impulse.
:rtype: float
.. function:: getVehicleConstraint(constraintId)
@@ -82,16 +80,16 @@ Functions
:arg constraintId: The id of the vehicle constraint.
:type constraintId: int
:return: A vehicle constraint object.
:rtype: :class:`~bge.types.KX_VehicleWrapper`
:return: a vehicle constraint object.
:rtype: :class:`bge.types.KX_VehicleWrapper`
.. function:: getCharacter(gameobj)
:arg gameobj: The game object with the character physics.
:type gameobj: :class:`~bge.types.KX_GameObject`
:type gameobj: :class:`bge.types.KX_GameObject`
:return: Character wrapper.
:rtype: :class:`~bge.types.KX_CharacterWrapper`
:return: character wrapper
:rtype: :class:`bge.types.KX_CharacterWrapper`
.. function:: removeConstraint(constraintId)
@@ -145,8 +143,23 @@ Functions
Sets the debug mode.
:arg mode: The new debug mode, see `Debug Mode Constants`_.
Debug modes:
- :class:`DBG_NODEBUG`
- :class:`DBG_DRAWWIREFRAME`
- :class:`DBG_DRAWAABB`
- :class:`DBG_DRAWFREATURESTEXT`
- :class:`DBG_DRAWCONTACTPOINTS`
- :class:`DBG_NOHELPTEXT`
- :class:`DBG_DRAWTEXT`
- :class:`DBG_PROFILETIMINGS`
- :class:`DBG_ENABLESATCOMPARISION`
- :class:`DBG_DISABLEBULLETLCP`
- :class:`DBG_ENABLECCD`
- :class:`DBG_DRAWCONSTRAINTS`
- :class:`DBG_DRAWCONSTRAINTLIMITS`
- :class:`DBG_FASTWIREFRAME`
:arg mode: The new debug mode.
:type mode: int
.. function:: setGravity(x, y, z)
@@ -165,8 +178,7 @@ Functions
.. function:: setLinearAirDamping(damping)
.. note::
Not implemented
Not implemented.
Sets the linear air damping for rigidbodies.
@@ -226,111 +238,144 @@ Functions
.. function:: setUseEpa(epa)
.. note::
Not implemented
Constants
+++++++++
.. attribute:: error
Symbolic constant string that indicates error.
:type: str
Debug Mode Constants
^^^^^^^^^^^^^^^^^^^^
Debug mode to be used with :func:`setDebugMode`.
Not implemented.
.. data:: DBG_NODEBUG
.. note::
Debug mode to be used with function :class:`setDebugMode`
No debug.
.. data:: DBG_DRAWWIREFRAME
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw wireframe in debug.
.. data:: DBG_DRAWAABB
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw Axis Aligned Bounding Box in debug.
.. data:: DBG_DRAWFREATURESTEXT
Draw features text in debug.
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw freatures text in debug.
.. data:: DBG_DRAWCONTACTPOINTS
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw contact points in debug.
.. data:: DBG_NOHELPTEXT
.. note::
Debug mode to be used with function :class:`setDebugMode`
Debug without help text.
.. data:: DBG_DRAWTEXT
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw text in debug.
.. data:: DBG_PROFILETIMINGS
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw profile timings in debug.
.. data:: DBG_ENABLESATCOMPARISION
.. note::
Debug mode to be used with function :class:`setDebugMode`
Enable sat comparision in debug.
.. data:: DBG_DISABLEBULLETLCP
.. note::
Debug mode to be used with function :class:`setDebugMode`
Disable Bullet LCP.
.. data:: DBG_ENABLECCD
Enable Continous Collision Detection in debug.
.. note::
Debug mode to be used with function :class:`setDebugMode`
Enable Continous Colision Detection in debug.
.. data:: DBG_DRAWCONSTRAINTS
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw constraints in debug.
.. data:: DBG_DRAWCONSTRAINTLIMITS
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw constraint limits in debug.
.. data:: DBG_FASTWIREFRAME
.. note::
Debug mode to be used with function :class:`setDebugMode`
Draw a fast wireframe in debug.
Create Constraint Constants
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Constraint type to be used with :func:`createConstraint`.
.. data:: POINTTOPOINT_CONSTRAINT
.. note::
Constraint type to be used with function :class:`createConstraint`
.. to do
.. data:: LINEHINGE_CONSTRAINT
.. note::
Constraint type to be used with function :class:`createConstraint`
.. to do
.. data:: ANGULAR_CONSTRAINT
.. note::
Constraint type to be used with function :class:`createConstraint`
.. to do
.. data:: CONETWIST_CONSTRAINT
.. note::
Constraint type to be used with function :class:`createConstraint`
.. to do
.. data:: VEHICLE_CONSTRAINT
.. note::
Constraint type to be used with function :class:`createConstraint`
.. to do
.. data:: GENERIC_6DOF_CONSTRAINT
.. to do
.. note::
Constraint type to be used with function :class:`createConstraint`
.. to do

View File

@@ -258,8 +258,7 @@ General functions
Sets the world gravity.
:arg gravity: gravity vector
:type gravity: Vector((fx, fy, fz))
:type gravity: list [fx, fy, fz]
.. function:: getSpectrum()
@@ -338,28 +337,6 @@ General functions
.. warning: Not implimented yet
.. function:: getAnimRecordFrame()
Gets the current frame number used for recording animations. This
number is incremented automatically by Blender when the "Record
animation" feature is turned on.
:rtype: int
.. function:: setAnimRecordFrame(framenr)
Sets the current frame number used for recording animations. This
number is automatically incremented by Blender when the "Record
animation" feature is turned on.
The frame number Must be non-negative, unless Blender has
:attr:`bpy.types.UserPreferencesEdit.use_negative_frames` enabled
in its user preferences. Only use non-negative numbers to be on
the safe side, unless you know what you are doing.
:arg framenr: The new frame number.
:type framenr: int
.. function:: getExitKey()
Gets the key used to exit the game engine
@@ -917,8 +894,6 @@ Various
2D Filter
---------
.. _Two-D-FilterActuator-mode:
.. data:: RAS_2DFILTER_BLUR
:value: 2
@@ -1313,3 +1288,5 @@ See :class:`bge.types.KX_StateActuator.operation`
Add bits to state mask
:value: 3
.. _Two-D-FilterActuator-mode:

View File

@@ -8,8 +8,7 @@ Intro
.. module:: bge.render
Example of using a :class:`bge.types.SCA_MouseSensor`,
and two :class:`bge.types.KX_ObjectActuator` to implement MouseLook:
Example of using a :class:`bge.types.SCA_MouseSensor`, and two :class:`bge.types.KX_ObjectActuator` to implement MouseLook:
.. note::
This can also be achieved with the :class:`bge.types.KX_MouseActuator`.
@@ -78,9 +77,7 @@ Constants
.. DATA:: VSYNC_ADAPTIVE
Enables adaptive vsync if supported.
Adaptive vsync enables vsync if the framerate is above the monitors refresh rate.
Otherwise, vsync is diabled if the framerate is too low.
Enables adaptive vsync if supported. Adaptive vsync enables vsync if the framerate is above the monitors refresh rate. Otherwise, vsync is diabled if the framerate is too low.
.. data:: LEFT_EYE
@@ -111,55 +108,40 @@ Functions
Set the width and height of the window (in pixels). This also works for fullscreen applications.
.. note:: Only works in the standalone player, not the Blender-embedded player.
:arg width: width in pixels
:type width: integer
:arg height: height in pixels
:type height: integer
.. function:: setFullScreen(enable)
Set whether or not the window should be fullscreen.
.. note:: Only works in the standalone player, not the Blender-embedded player.
:arg enable: ``True`` to set full screen, ``False`` to set windowed.
:type enable: bool
.. function:: getFullScreen()
Returns whether or not the window is fullscreen.
.. note:: Only works in the standalone player, not the Blender-embedded player; there it always returns False.
:rtype: bool
.. function:: getDisplayDimensions()
Get the display dimensions, in pixels, of the display (e.g., the
monitor). Can return the size of the entire view, so the
combination of all monitors; for example, ``(3840, 1080)`` for two
side-by-side 1080p monitors.
Get the actual display dimensions, in pixels, of the physical display (e.g., the monitor).
:rtype: tuple (width, height)
:type dimension: list [width,heigh]
.. function:: makeScreenshot(filename)
Writes an image file with the current displayed frame.
The image is written to *'filename'*.
The path may be absolute (eg. ``/home/foo/image``) or relative when started with
``//`` (eg. ``//image``). Note that absolute paths are not portable between platforms.
If the filename contains a ``#``,
it will be replaced by an incremental index so that screenshots can be taken multiple
times without overwriting the previous ones (eg. ``image-#``).
The image is written to *'filename'*. The path may be absolute (eg. "/home/foo/image") or relative when started with
"//" (eg. "//image"). Note that absolute paths are not portable between platforms.
If the filename contains a "#", it will be replaced by an incremental index so that screenshots can be taken multiple
times without overwriting the previous ones (eg. "image-#").
Settings for the image are taken from the render settings (file format and respective settings,
gamma and colospace conversion, etc).
The image resolution matches the framebuffer, meaning, the window size and aspect ratio.
When running from the standalone player, instead of the embedded player, only PNG files are supported.
Additional color conversions are also not supported.
Settings for the image are taken from the render settings (file format and respective settings, gamma and colospace
conversion, etc). The image resolution matches the framebuffer, meaning, the window size and aspect ratio.
When running from the standalone player, instead of the embedded player, only PNG files are supported. Additional
color conversions are also not supported.
:arg filename: path and name of the file to write
:type filename: string
@@ -167,14 +149,13 @@ Functions
.. function:: enableVisibility(visible)
Deprecated; doesn't do anything.
Doesn't really do anything...
.. function:: showMouse(visible)
Enables or disables the operating system mouse cursor.
:arg visible:
:type visible: boolean
@@ -182,15 +163,15 @@ Functions
Sets the mouse cursor position.
:arg x: X-coordinate in screen pixel coordinates.
:type x: integer
:arg y: Y-coordinate in screen pixel coordinates.
:type y: integer
.. function:: setBackgroundColor(rgba)
Deprecated and no longer functional. Use :py:meth:`bge.types.KX_WorldInfo.backgroundColor` instead.
Sets the window background color. (Deprecated: use KX_WorldInfo.background_color)
:type rgba: list [r, g, b, a]
.. function:: setEyeSeparation(eyesep)
@@ -234,7 +215,6 @@ Functions
Set the material mode to use for OpenGL rendering.
:arg mode: material mode
:type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
.. note:: Changes will only affect newly created scenes.
@@ -251,17 +231,14 @@ Functions
Enables or disables a GLSL material setting.
:arg setting:
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
:arg enable:
:type enable: boolean
.. function:: getGLSLMaterialSetting(setting)
.. function:: getGLSLMaterialSetting(setting, enable)
Get the state of a GLSL material setting.
:arg setting:
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
:rtype: boolean
@@ -322,28 +299,24 @@ Functions
Show or hide the framerate.
:arg enable:
:type enable: boolean
.. function:: showProfile(enable)
Show or hide the profile.
:arg enable:
:type enable: boolean
.. function:: showProperties(enable)
Show or hide the debug properties.
:arg enable:
:type enable: boolean
.. function:: autoDebugList(enable)
Enable or disable auto adding debug properties to the debug list.
:arg enable:
:type enable: boolean
.. function:: clearDebugList()

File diff suppressed because it is too large Load Diff

View File

@@ -7,66 +7,11 @@ base class --- :class:`PyObjectPlus`
.. class:: KX_BlenderMaterial(PyObjectPlus)
This is the interface to materials in the game engine.
Materials define the render state to be applied to mesh objects.
The example below shows a simple GLSL shader setup allowing to dynamically mix two texture channels
in a material. All materials of the object executing this script should have two textures using
separate UV maps in the two first texture channels.
The code works for both Multitexture and GLSL rendering modes.
.. code-block:: python
from bge import logic
vertex_shader = """
void main(void)
{
// simple projection of the vertex position to view space
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// coordinate of the 1st texture channel
gl_TexCoord[0] = gl_MultiTexCoord0;
// coordinate of the 2nd texture channel
gl_TexCoord[1] = gl_MultiTexCoord1;
}
"""
fragment_shader ="""
uniform sampler2D texture_0;
uniform sampler2D texture_1;
uniform float factor;
void main(void)
{
vec4 color_0 = texture2D(texture_0, gl_TexCoord[0].st);
vec4 color_1 = texture2D(texture_1, gl_TexCoord[1].st);
gl_FragColor = mix(color_0, color_1, factor);
}
"""
object = logic.getCurrentController().owner
for mesh in object.meshes:
for material in mesh.materials:
shader = material.getShader()
if shader is not None:
if not shader.isValid():
shader.setSource(vertex_shader, fragment_shader, True)
# get the first texture channel of the material
shader.setSampler('texture_0', 0)
# get the second texture channel of the material
shader.setSampler('texture_1', 1)
# pass another uniform to the shader
shader.setUniform1f('factor', 0.3)
KX_BlenderMaterial
.. attribute:: shader
The material's shader.
The materials shader.
:type: :class:`BL_Shader`
@@ -89,83 +34,39 @@ base class --- :class:`PyObjectPlus`
:return: the material's shader
:rtype: :class:`BL_Shader`
.. attribute:: alpha
The material's alpha transparency.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: hardness
How hard (sharp) the material's specular reflection is.
:type: integer between 1 and 511 inclusive
.. attribute:: emit
Amount of light to emit.
:type: float between 0.0 and 2.0 inclusive
.. attribute:: specularIntensity
How intense (bright) the material's specular reflection is.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: diffuseIntensity
The material's amount of diffuse reflection.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: specularColor
The material's specular color.
:type: :class:`mathutils.Color`
.. attribute:: diffuseColor
The material's diffuse color.
:type: :class:`mathutils.Color`
.. method:: setBlending(src, dest)
Set the pixel color arithmetic functions.
:arg src: Specifies how the red, green, blue, and alpha source blending factors are computed, one of...
* :data:`~bgl.GL_ZERO`
* :data:`~bgl.GL_ONE`
* :data:`~bgl.GL_SRC_COLOR`
* :data:`~bgl.GL_ONE_MINUS_SRC_COLOR`
* :data:`~bgl.GL_DST_COLOR`
* :data:`~bgl.GL_ONE_MINUS_DST_COLOR`
* :data:`~bgl.GL_SRC_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_SRC_ALPHA`
* :data:`~bgl.GL_DST_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_DST_ALPHA`
* :data:`~bgl.GL_SRC_ALPHA_SATURATE`
:type src: int
:arg src: Specifies how the red, green, blue, and alpha source blending factors are computed.
:type src: Value in...
:arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed, one of...
* :data:`~bgl.GL_ZERO`
* :data:`~bgl.GL_ONE`
* :data:`~bgl.GL_SRC_COLOR`
* :data:`~bgl.GL_ONE_MINUS_SRC_COLOR`
* :data:`~bgl.GL_DST_COLOR`
* :data:`~bgl.GL_ONE_MINUS_DST_COLOR`
* :data:`~bgl.GL_SRC_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_SRC_ALPHA`
* :data:`~bgl.GL_DST_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_DST_ALPHA`
* :data:`~bgl.GL_SRC_ALPHA_SATURATE`
:type dest: int
* GL_ZERO,
* GL_ONE,
* GL_SRC_COLOR,
* GL_ONE_MINUS_SRC_COLOR,
* GL_DST_COLOR,
* GL_ONE_MINUS_DST_COLOR,
* GL_SRC_ALPHA,
* GL_ONE_MINUS_SRC_ALPHA,
* GL_DST_ALPHA,
* GL_ONE_MINUS_DST_ALPHA,
* GL_SRC_ALPHA_SATURATE
:arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed.
:type dest: Value in...
* GL_ZERO
* GL_ONE
* GL_SRC_COLOR
* GL_ONE_MINUS_SRC_COLOR
* GL_DST_COLOR
* GL_ONE_MINUS_DST_COLOR
* GL_SRC_ALPHA
* GL_ONE_MINUS_SRC_ALPHA
* GL_DST_ALPHA
* GL_ONE_MINUS_DST_ALPHA
* GL_SRC_ALPHA_SATURATE
.. method:: getMaterialIndex()

View File

@@ -51,18 +51,6 @@ base class --- :class:`KX_GameObject`
:type: float
.. attribute:: shift_x
The camera's horizontal shift.
:type: float
.. attribute:: shift_y
The camera's vertical shift.
:type: float
.. attribute:: perspective
True if this camera has a perspective transform, False for an orthographic projection.

View File

@@ -25,7 +25,7 @@ base class --- :class:`PyObjectPlus`
The maximum number of jumps a character can perform before having to touch the ground. By default this is set to 1. 2 allows for a double jump, etc.
:type: int in [0, 255], default 1
:type: int
.. attribute:: jumpCount

View File

@@ -133,11 +133,10 @@ base class --- :class:`PyObjectPlus`
Returns the contraint type (read only)
:type: integer
- :class:`~bge.constraints.POINTTOPOINT_CONSTRAINT`
- :class:`~bge.constraints.LINEHINGE_CONSTRAINT`
- :class:`~bge.constraints.ANGULAR_CONSTRAINT`
- :class:`~bge.constraints.CONETWIST_CONSTRAINT`
- :class:`~bge.constraints.VEHICLE_CONSTRAINT`
- :class:`~bge.constraints.GENERIC_6DOF_CONSTRAINT`
- 1 = :class:`~bge.constraints.POINTTOPOINT_CONSTRAINT`
- 2 = :class:`~bge.constraints.LINEHINGE_CONSTRAINT`
- 3 = :class:`~bge.constraints.ANGULAR_CONSTRAINT`
- 4 = :class:`~bge.constraints.CONETWIST_CONSTRAINT`
- 11 = :class:`~bge.constraints.VEHICLE_CONSTRAINT`
- 12 = :class:`~bge.constraints.GENERIC_6DOF_CONSTRAINT`

View File

@@ -137,30 +137,7 @@ base class --- :class:`SCA_IObject`
.. note::
A value of 0.0 disables this option (rather than setting it stationary).
.. attribute:: angularVelocityMin
Enforces the object keeps rotating at a minimum velocity. A value of 0.0 disables this.
:type: non-negative float
.. note::
Applies to dynamic and rigid body objects only.
While objects are stationary the minimum velocity will not be applied.
.. attribute:: angularVelocityMax
Clamp the maximum angular velocity to prevent objects rotating beyond a set speed.
A value of 0.0 disables clamping; it does not stop rotation.
:type: non-negative float
.. note::
Applies to dynamic and rigid body objects only.
A value of 0.0 disables this option (rather then setting it stationary).
.. attribute:: localInertia
@@ -799,7 +776,7 @@ base class --- :class:`SCA_IObject`
:return: the first object hit or None if no object or object does not match prop
:rtype: :class:`KX_GameObject`
.. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly, mask)
.. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly)
Look from a point/object to another point/object and find first object hit within dist that matches prop.
if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit.
@@ -851,8 +828,6 @@ base class --- :class:`SCA_IObject`
* 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping.
:type poly: integer
:arg mask: collision mask: The collision mask (16 layers mapped to a 16-bit integer) is combined with each object's collision group, to hit only a subset of the objects in the scene. Only those objects for which ``collisionGroup & mask`` is true can be hit.
:type mask: bitfield
:return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv).
* object, hitpoint and hitnormal are None if no hit.
@@ -974,16 +949,6 @@ base class --- :class:`SCA_IObject`
:return: The current frame of the action
:rtype: float
.. method:: getActionName(layer=0)
Gets the name of the current action playing in the supplied layer.
:arg layer: The layer that you want to get the action name from.
:type layer: integer
:return: The name of the current action
:rtype: string
.. method:: setActionFrame(frame, layer=0)
Set the current frame of the action playing in the supplied layer.

View File

@@ -0,0 +1,65 @@
KX_IpoActuator(SCA_IActuator)
=============================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_IpoActuator(SCA_IActuator)
IPO actuator activates an animation.
.. attribute:: frameStart
Start frame.
:type: float
.. attribute:: frameEnd
End frame.
:type: float
.. attribute:: propName
Use this property to define the Ipo position.
:type: string
.. attribute:: framePropName
Assign this property this action current frame number.
:type: string
.. attribute:: mode
Play mode for the ipo. Can be on of :ref:`these constants <ipo-actuator>`
:type: integer
.. attribute:: useIpoAsForce
Apply Ipo as a global or local force depending on the local option (dynamic objects only).
:type: boolean
.. attribute:: useIpoAdd
Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag.
:type: boolean
.. attribute:: useIpoLocal
Let the ipo acts in local coordinates, used in Force and Add mode.
:type: boolean
.. attribute:: useChildren
Update IPO on all children Objects as well.
:type: boolean

View File

@@ -25,12 +25,6 @@ base class --- :class:`PyObjectPlus`
:type: callable
.. attribute:: finished
The current status of the lib load.
:type: boolean
.. attribute:: progress
The current progress of the lib load as a normalized value from 0.0 to 1.0.

View File

@@ -51,7 +51,7 @@ base class --- :class:`SCA_IObject`
.. attribute:: materials
:type: list of :class:`KX_BlenderMaterial` type
:type: list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types
.. attribute:: numPolygons

View File

@@ -23,7 +23,7 @@ base class --- :class:`SCA_IObject`
The material of the polygon.
:type: :class:`KX_BlenderMaterial`
:type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
.. attribute:: texture_name
@@ -84,7 +84,7 @@ base class --- :class:`SCA_IObject`
.. method:: getMaterial()
:return: The polygon material
:rtype: :class:`KX_BlenderMaterial`
:rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
.. method:: getTextureName()

View File

@@ -0,0 +1,250 @@
KX_PolygonMaterial(PyObjectPlus)
================================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: KX_PolygonMaterial(PyObjectPlus)
This is the interface to materials in the game engine.
Materials define the render state to be applied to mesh objects.
.. warning::
Some of the methods/variables are CObjects. If you mix these up, you will crash blender.
.. code-block:: python
from bge import logic
vertex_shader = """
void main(void)
{
// original vertex position, no changes
gl_Position = ftransform();
// coordinate of the 1st texture channel
gl_TexCoord[0] = gl_MultiTexCoord0;
// coordinate of the 2nd texture channel
gl_TexCoord[1] = gl_MultiTexCoord1;
}
"""
fragment_shader ="""
uniform sampler2D color_0;
uniform sampler2D color_1;
uniform float factor;
void main(void)
{
vec4 color_0 = texture2D(color_0, gl_TexCoord[0].st);
vec4 color_1 = texture2D(color_1, gl_TexCoord[1].st);
gl_FragColor = mix(color_0, color_1, factor);
}
"""
object = logic.getCurrentController().owner
object = cont.owner
for mesh in object.meshes:
for material in mesh.materials:
shader = material.getShader()
if shader != None:
if not shader.isValid():
shader.setSource(vertex_shader, fragment_shader, True)
# get the first texture channel of the material
shader.setSampler('color_0', 0)
# get the second texture channel of the material
shader.setSampler('color_1', 1)
# pass another uniform to the shader
shader.setUniform1f('factor', 0.3)
.. attribute:: texture
Texture name.
:type: string (read-only)
.. attribute:: gl_texture
OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture).
:type: integer (read-only)
.. attribute:: material
Material name.
:type: string (read-only)
.. attribute:: tface
Texture face properties.
:type: CObject (read-only)
.. attribute:: tile
Texture is tiling.
:type: boolean
.. attribute:: tilexrep
Number of tile repetitions in x direction.
:type: integer
.. attribute:: tileyrep
Number of tile repetitions in y direction.
:type: integer
.. attribute:: drawingmode
Drawing mode for the material.
- 2 (drawingmode & 4) Textured
- 4 (drawingmode & 16) Light
- 14 (drawingmode & 16384) 3d Polygon Text.
:type: bitfield
.. attribute:: transparent
This material is transparent. All meshes with this
material will be rendered after non transparent meshes from back
to front.
:type: boolean
.. attribute:: zsort
Transparent polygons in meshes with this material will be sorted back to
front before rendering.
Non-Transparent polygons will be sorted front to back before rendering.
:type: boolean
.. attribute:: diffuse
The diffuse color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
:type: list [r, g, b]
.. attribute:: specular
The specular color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
:type: list [r, g, b]
.. attribute:: shininess
The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0.
:type: float
.. attribute:: specularity
The amount of specular of the material. 0.0 <= specularity <= 1.0.
:type: float
.. method:: updateTexture(tface, rasty)
Updates a realtime animation.
:arg tface: Texture face (eg mat.tface)
:type tface: CObject
:arg rasty: Rasterizer
:type rasty: CObject
.. method:: setTexture(tface)
Sets texture render state.
:arg tface: Texture face
:type tface: CObject
.. code-block:: python
mat.setTexture(mat.tface)
.. method:: activate(rasty, cachingInfo)
Sets material parameters for this object for rendering.
Material Parameters set:
#. Texture
#. Backface culling
#. Line drawing
#. Specular Colour
#. Shininess
#. Diffuse Colour
#. Polygon Offset.
:arg rasty: Rasterizer instance.
:type rasty: CObject
:arg cachingInfo: Material cache instance.
:type cachingInfo: CObject
.. method:: setCustomMaterial(material)
Sets the material state setup object.
Using this method, you can extend or completely replace the gameengine material
to do your own advanced multipass effects.
Use this method to register your material class. Instead of the normal material,
your class's activate method will be called just before rendering the mesh.
This should setup the texture, material, and any other state you would like.
It should return True to render the mesh, or False if you are finished. You should
clean up any state Blender does not set before returning False.
Activate Method Definition:
.. code-block:: python
def activate(self, rasty, cachingInfo, material):
:arg material: The material object.
:type material: instance
.. code-block:: python
class PyMaterial:
def __init__(self):
self.pass_no = -1
def activate(self, rasty, cachingInfo, material):
# Activate the material here.
#
# The activate method will be called until it returns False.
# Every time the activate method returns True the mesh will
# be rendered.
#
# rasty is a CObject for passing to material.updateTexture()
# and material.activate()
# cachingInfo is a CObject for passing to material.activate()
# material is the KX_PolygonMaterial instance this material
# was added to
# default material properties:
self.pass_no += 1
if self.pass_no == 0:
material.activate(rasty, cachingInfo)
# Return True to do this pass
return True
# clean up and return False to finish.
self.pass_no = -1
return False
# Create a new Python Material and pass it to the renderer.
mat.setCustomMaterial(PyMaterial())

View File

@@ -1,4 +1,4 @@
KX_WorldInfo(PyObjectPlus)
KX_WordlInfo(PyObjectPlus)
=============================
.. module:: bge.types
@@ -7,7 +7,7 @@ base class --- :class:`PyObjectPlus`
.. class:: KX_WorldInfo(PyObjectPlus)
A world object.
A wolrd object.
.. code-block:: python
@@ -63,17 +63,17 @@ base class --- :class:`PyObjectPlus`
The color of the mist. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
Mist and background color sould always set to the same color.
:type: :class:`mathutils.Color`
:type: :class:`mathutils.Vector`
.. attribute:: backgroundColor
The color of the background. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
Mist and background color sould always set to the same color.
:type: :class:`mathutils.Color`
:type: :class:`mathutils.Vector`
.. attribute:: ambientColor
The color of the ambient light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
:type: :class:`mathutils.Color`
:type: :class:`mathutils.Vector`

View File

@@ -7,7 +7,7 @@ base class --- :class:`SCA_IActuator`
.. class:: SCA_2DFilterActuator(SCA_IActuator)
Create, enable and disable 2D filters.
Create, enable and disable 2D filters
The following properties don't have an immediate effect.
You must active the actuator to get the result.
@@ -29,7 +29,7 @@ base class --- :class:`SCA_IActuator`
.. attribute:: mode
Type of 2D filter, use one of :ref:`these constants <Two-D-FilterActuator-mode>`.
Type of 2D filter, use one of :ref:`these constants <Two-D-FilterActuator-mode>`
:type: integer

File diff suppressed because it is too large Load Diff

View File

@@ -16,24 +16,24 @@ and in the game engine.
.. warning::
The API provided by this module is subject to change.
The data exposed by the API are are closely related to Blender's internal GLSL code
and may change if the GLSL code is modified (e.g. new uniform type).
The API provided by this module should be consider unstable. The data exposed by the API
are are closely related to Blender's internal GLSL code and may change if the GLSL code
is modified (e.g. new uniform type).
Constants
=========
GLSL Data Type
GLSL data type
--------------
.. _data-type:
Type of GLSL data.
For shader uniforms, the data type determines which ``glUniform`` function
For shader uniforms, the data type determines which glUniform function
variant to use to send the uniform value to the GPU.
For vertex attributes, the data type determines which ``glVertexAttrib`` function
For vertex attributes, the data type determines which glVertexAttrib function
variant to use to send the vertex attribute to the GPU.
See export_shader_
@@ -42,37 +42,53 @@ See export_shader_
one integer
:value: 1
.. data:: GPU_DATA_1F
one float
:value: 2
.. data:: GPU_DATA_2F
two floats
:value: 3
.. data:: GPU_DATA_3F
three floats
:value: 4
.. data:: GPU_DATA_4F
four floats
:value: 5
.. data:: GPU_DATA_9F
matrix 3x3 in column-major order
:value: 6
.. data:: GPU_DATA_16F
matrix 4x4 in column-major order
:value: 7
.. data:: GPU_DATA_4UB
four unsigned byte
:value: 8
GLSL Uniform Types
------------------
GLSL uniform type
-----------------
.. _uniform-type:
@@ -85,7 +101,7 @@ The calculation of some of the uniforms is based on matrices available in the sc
.. _mat4_cam_to_world:
.. _mat4_world_to_cam:
``mat4_cam_to_world``
*mat4_cam_to_world*
Model matrix of the camera. OpenGL 4x4 matrix that converts
camera local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the camera object.
@@ -96,7 +112,7 @@ The calculation of some of the uniforms is based on matrices available in the sc
.. _mat4_object_to_world:
.. _mat4_world_to_object:
``mat4_object_to_world``
*mat4_object_to_world*
Model matrix of the object that is being rendered. OpenGL 4x4 matric that converts
object local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the object.
@@ -106,7 +122,7 @@ The calculation of some of the uniforms is based on matrices available in the sc
.. _mat4_lamp_to_world:
.. _mat4_world_to_lamp:
``mat4_lamp_to_world``
*mat4_lamp_to_world*
Model matrix of the lamp lighting the object. OpenGL 4x4 matrix that converts lamp
local coordinates to world coordinates. In blender this is obtained from the
'matrix_world' attribute of the lamp object.
@@ -114,305 +130,151 @@ The calculation of some of the uniforms is based on matrices available in the sc
Some uniform will need the *mat4_world_to_lamp* matrix
computed as the inverse of this matrix.
.. note::
Any uniforms used for view projections or transformations (object, lamp matrices for eg),
can only be set once per frame.
GLSL Object Uniforms
^^^^^^^^^^^^^^^^^^^^
.. note::
- Object transformations and color must be set before drawing the object.
- There is at most one uniform of these types per shader.
.. data:: GPU_DYNAMIC_OBJECT_VIEWMAT
A matrix that converts world coordinates to camera coordinates (see mat4_world_to_cam_).
The uniform is a 4x4 GL matrix that converts world coordinates to
camera coordinates (see mat4_world_to_cam_). Can be set once per frame.
There is at most one uniform of that type per shader.
:type: matrix4x4
:value: 1
.. data:: GPU_DYNAMIC_OBJECT_MAT
A matrix that converts object coordinates to world coordinates (see mat4_object_to_world_).
The uniform is a 4x4 GL matrix that converts object coordinates
to world coordinates (see mat4_object_to_world_). Must be set before drawing the object.
There is at most one uniform of that type per shader.
:type: matrix4x4
:value: 2
.. data:: GPU_DYNAMIC_OBJECT_VIEWIMAT
The uniform is a 4x4 GL matrix that converts coordinates
in camera space to world coordinates (see mat4_cam_to_world_).
Can be set once per frame.
There is at most one uniform of that type per shader.
:type: matrix4x4
:value: 3
.. data:: GPU_DYNAMIC_OBJECT_IMAT
The uniform is a 4x4 GL matrix that converts world coodinates
to object coordinates (see mat4_world_to_object_).
Must be set before drawing the object.
There is at most one uniform of that type per shader.
:type: matrix4x4
:value: 4
.. data:: GPU_DYNAMIC_OBJECT_COLOR
An RGB color + alpha defined at object level.
Each values between 0.0 and 1.0.
The uniform is a vector of 4 float representing a RGB color + alpha defined at object level.
Each values between 0.0 and 1.0. In blender it corresponds to the 'color' attribute of the object.
Must be set before drawing the object.
There is at most one uniform of that type per shader.
See :class:`bpy.types.Object.color`.
:type: float4
.. data:: GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE
Multiplier for bump-map scaling.
:type: float
GLSL Lamp Uniforms
^^^^^^^^^^^^^^^^^^
.. note::
There is one uniform of that type per lamp lighting the material.
:value: 5
.. data:: GPU_DYNAMIC_LAMP_DYNVEC
Represents the direction of light in camera space.
The uniform is a vector of 3 float representing the direction of light in camera space.
In Blender, this is computed by
Computed as:
mat4_world_to_cam_ * (-vec3_lamp_Z_axis)
mat4_world_to_cam_ * (-vec3_lamp_Z_axis)
.. note::
- The lamp Z axis points to the opposite direction of light.
- The norm of the vector should be unit length.
as the lamp Z axis points to the opposite direction of light.
The norm of the vector should be unity. Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
:type: float3
:value: 6
.. data:: GPU_DYNAMIC_LAMP_DYNCO
Represents the position of the light in camera space.
The uniform is a vector of 3 float representing the position of the light in camera space.
Computed as
Computed as:
mat4_world_to_cam_ * vec3_lamp_pos
mat4_world_to_cam_ * vec3_lamp_pos
:type: float3
Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
:value: 7
.. data:: GPU_DYNAMIC_LAMP_DYNIMAT
Matrix that converts vector in camera space to lamp space.
The uniform is a 4x4 GL matrix that converts vector in camera space to lamp space.
Computed as
Computed as:
mat4_world_to_lamp_ * mat4_cam_to_world_
mat4_world_to_lamp_ * mat4_cam_to_world_
:type: matrix4x4
Can be set once per frame.
There is one uniform of that type per lamp lighting the material.
:value: 8
.. data:: GPU_DYNAMIC_LAMP_DYNPERSMAT
Matrix that converts a vector in camera space to shadow buffer depth space.
The uniform is a 4x4 GL matrix that converts a vector in camera space to shadow buffer depth space.
Computed as
Computed as:
mat4_perspective_to_depth_ * mat4_lamp_to_perspective_ * mat4_world_to_lamp_ * mat4_cam_to_world_.
mat4_perspective_to_depth_ * mat4_lamp_to_perspective_ * mat4_world_to_lamp_ * mat4_cam_to_world_.
.. _mat4_perspective_to_depth:
``mat4_perspective_to_depth`` is a fixed matrix defined as follow::
*mat4_perspective_to_depth* is a fixed matrix defined as follow::
0.5 0.0 0.0 0.5
0.0 0.5 0.0 0.5
0.0 0.0 0.5 0.5
0.0 0.0 0.0 1.0
.. note::
This uniform can be set once per frame. There is one uniform of that type per lamp casting shadow in the scene.
- There is one uniform of that type per lamp casting shadow in the scene.
:type: matrix4x4
:value: 9
.. data:: GPU_DYNAMIC_LAMP_DYNENERGY
See :class:`bpy.types.Lamp.energy`.
The uniform is a single float representing the lamp energy. In blender it corresponds
to the 'energy' attribute of the lamp data block.
There is one uniform of that type per lamp lighting the material.
:type: float
:value: 10
.. data:: GPU_DYNAMIC_LAMP_DYNCOL
See :class:`bpy.types.Lamp.color`.
The uniform is a vector of 3 float representing the lamp color.
Color elements are between 0.0 and 1.0. In blender it corresponds
to the 'color' attribute of the lamp data block.
There is one uniform of that type per lamp lighting the material.
:type: float3
.. data:: GPU_DYNAMIC_LAMP_DISTANCE
See :class:`bpy.types.Lamp.distance`.
:type: float
.. data:: GPU_DYNAMIC_LAMP_ATT1
See
:class:`bpy.types.PointLamp.linear_attenuation`,
:class:`bpy.types.SpotLamp.linear_attenuation`.
:type: float
.. data:: GPU_DYNAMIC_LAMP_ATT2
See
:class:`bpy.types.PointLamp.quadratic_attenuation`,
:class:`bpy.types.SpotLamp.quadratic_attenuation`.
:type: float
.. data:: GPU_DYNAMIC_LAMP_SPOTSIZE
See :class:`bpy.types.SpotLamp.spot_size`.
:type: float
.. data:: GPU_DYNAMIC_LAMP_SPOTBLEND
See :class:`bpy.types.SpotLamp.spot_blend`.
:type: float
.. data:: GPU_DYNAMIC_LAMP_SPOTSCALE
Represents the SpotLamp local scale.
:type: float2
GLSL Sampler Uniforms
^^^^^^^^^^^^^^^^^^^^^
:value: 11
.. data:: GPU_DYNAMIC_SAMPLER_2DBUFFER
Represents an internal texture used for certain effect
The uniform is an integer representing an internal texture used for certain effect
(color band, etc).
:type: integer
:value: 12
.. data:: GPU_DYNAMIC_SAMPLER_2DIMAGE
Represents a texture loaded from an image file.
The uniform is an integer representing a texture loaded from an image file.
:type: integer
:value: 13
.. data:: GPU_DYNAMIC_SAMPLER_2DSHADOW
Represents a texture loaded from a shadow buffer file.
The uniform is an float representing the bumpmap scaling.
:type: integer
:value: 14
.. data:: GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE
The uniform is an integer representing a shadow buffer corresponding to a lamp
casting shadow.
:value: 15
GLSL Mist Uniforms
^^^^^^^^^^^^^^^^^^
.. data:: GPU_DYNAMIC_MIST_ENABLE:
See :class:`bpy.types.WorldMistSettings.use_mist`.
:type: float (0 or 1)
.. data:: GPU_DYNAMIC_MIST_START
See :class:`bpy.types.WorldMistSettings.start`.
:type: float
See :class:`bpy.types.WorldMistSettings.depth`.
.. data:: GPU_DYNAMIC_MIST_DISTANCE
:type: float
See :class:`bpy.types.WorldMistSettings.intensity`.
.. data:: GPU_DYNAMIC_MIST_INTENSITY
:type: float
.. data:: GPU_DYNAMIC_MIST_TYPE
See :class:`bpy.types.WorldMistSettings.falloff`.
:type: float (used as an index into the type)
.. data:: GPU_DYNAMIC_MIST_COLOR
GLSL World Uniforms
^^^^^^^^^^^^^^^^^^^
.. data:: GPU_DYNAMIC_HORIZON_COLOR
See :class:`bpy.types.World.horizon_color`.
:type: float3
.. data:: GPU_DYNAMIC_AMBIENT_COLOR
See :class:`bpy.types.World.ambient_color`.
:type: float3
GLSL Material Uniforms
^^^^^^^^^^^^^^^^^^^^^^
.. data:: GPU_DYNAMIC_MAT_DIFFRGB
See :class:`bpy.types.Material.diffuse_color`.
:type: float3
.. data:: GPU_DYNAMIC_MAT_REF
See :class:`bpy.types.Material.diffuse_intensity`.
:type: float
.. data:: GPU_DYNAMIC_MAT_SPECRGB
See :class:`bpy.types.Material.specular_color`.
:type: float3
.. data:: GPU_DYNAMIC_MAT_SPEC
See :class:`bpy.types.Material.specular_intensity`.
:type: float
.. data:: GPU_DYNAMIC_MAT_HARD
See :class:`bpy.types.Material.specular_hardness`.
:type: float
.. data:: GPU_DYNAMIC_MAT_EMIT
See :class:`bpy.types.Material.emit`.
:type: float
.. data:: GPU_DYNAMIC_MAT_AMB
See :class:`bpy.types.Material.ambient`.
:type: float
.. data:: GPU_DYNAMIC_MAT_ALPHA
See :class:`bpy.types.Material.alpha`.
:type: float
GLSL Attribute Type
GLSL attribute type
-------------------
.. _attribute-type:
@@ -429,7 +291,9 @@ layer that contains the vertex attribute.
.. code-block:: python
mesh.uv_layers[attribute["name"]]
mesh.uv_textures[attribute["name"]]
:value: 5
.. data:: CD_MCOL
@@ -442,6 +306,8 @@ layer that contains the vertex attribute.
mesh.vertex_colors[attribute["name"]]
:value: 6
.. data:: CD_ORCO
Vertex attribute is original coordinates. Data type is vector 3 float.
@@ -453,6 +319,8 @@ layer that contains the vertex attribute.
mesh.vertices
:value: 14
.. data:: CD_TANGENT
Vertex attribute is the tangent vector. Data type is vector 4 float.
@@ -462,6 +330,8 @@ layer that contains the vertex attribute.
C function to compute the tangent layer from the other layers can be obtained from
blender.org.
:value: 18
Functions
=========
@@ -471,12 +341,8 @@ Functions
.. function:: export_shader(scene,material)
Extracts the GLSL shader producing the visual effect of material in scene for the purpose of
reusing the shader in an external engine.
This function is meant to be used in material exporter
so that the GLSL shader can be exported entirely.
The return value is a dictionary containing the
reusing the shader in an external engine. This function is meant to be used in material exporter
so that the GLSL shader can be exported entirely. The return value is a dictionary containing the
shader source code and all associated data.
:arg scene: the scene in which the material in rendered.
@@ -488,91 +354,76 @@ Functions
The dictionary contains the following elements:
- ``["fragment"]``: string
* ["fragment"] : string
fragment shader source code.
- ``["vertex"]``: string
* ["vertex"] : string
vertex shader source code.
- ``["uniforms"]``: sequence
* ["uniforms"] : sequence
list of uniforms used in fragment shader, can be empty list. Each element of the
sequence is a dictionary with the following elements:
- ``["varname"]``: string
* ["varname"] : string
name of the uniform in the fragment shader. Always of the form 'unf<number>'.
- ``["datatype"]``: integer
* ["datatype"] : integer
data type of the uniform variable. Can be one of the following:
.. hlist::
:columns: 2
* :data:`gpu.GPU_DATA_1I` : use glUniform1i
* :data:`gpu.GPU_DATA_1F` : use glUniform1fv
* :data:`gpu.GPU_DATA_2F` : use glUniform2fv
* :data:`gpu.GPU_DATA_3F` : use glUniform3fv
* :data:`gpu.GPU_DATA_4F` : use glUniform4fv
* :data:`gpu.GPU_DATA_9F` : use glUniformMatrix3fv
* :data:`gpu.GPU_DATA_16F` : use glUniformMatrix4fv
- :data:`gpu.GPU_DATA_1I` : use ``glUniform1i``
- :data:`gpu.GPU_DATA_1F` : use ``glUniform1fv``
- :data:`gpu.GPU_DATA_2F` : use ``glUniform2fv``
- :data:`gpu.GPU_DATA_3F` : use ``glUniform3fv``
- :data:`gpu.GPU_DATA_4F` : use ``glUniform4fv``
- :data:`gpu.GPU_DATA_9F` : use ``glUniformMatrix3fv``
- :data:`gpu.GPU_DATA_16F` : use ``glUniformMatrix4fv``
- ``["type"]``: integer
* ["type"] : integer
type of uniform, determines the origin and method of calculation. See uniform-type_.
Depending on the type, more elements will be be present.
- ``["lamp"]``: :class:`bpy.types.Object`
Reference to the lamp object from which the uniforms value are extracted.
Set for the following uniforms types:
* ["lamp"] : :class:`bpy.types.Object`
Reference to the lamp object from which the uniforms value are extracted. Set for the following uniforms types:
.. hlist::
:columns: 2
:columns: 3
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT`
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY`
- :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
- :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY`
* :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
* :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`
Notes:
- The uniforms
:data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`,
:data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`,
:data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT` and
:data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
refer to the lamp object position and orientation,
both of can be derived from the object world matrix:
* The uniforms :data:`gpu.GPU_DYNAMIC_LAMP_DYNVEC`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNCO`, :data:`gpu.GPU_DYNAMIC_LAMP_DYNIMAT` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT`
refer to the lamp object position and orientation, both of can be derived from the object world matrix:
.. code-block:: python
obmat = uniform["lamp"].matrix_world
where obmat is the mat4_lamp_to_world_ matrix of the lamp as a 2 dimensional array,
the lamp world location location is in ``obmat[3]``.
the lamp world location location is in obmat[3].
- The uniform types
:data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY` and
:data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL`
refer to the lamp data bloc that you get from:
* The uniform types :data:`gpu.GPU_DYNAMIC_LAMP_DYNENERGY` and :data:`gpu.GPU_DYNAMIC_LAMP_DYNCOL` refer to the lamp data bloc that you get from:
.. code-block:: python
la = uniform["lamp"].data
from which you get ``lamp.energy`` and ``lamp.color``
from which you get la.energy and la.color
- Lamp duplication is not supported: if you have duplicated lamps in your scene
* Lamp duplication is not supported: if you have duplicated lamps in your scene
(i.e. lamp that are instantiated by dupligroup, etc), this element will only
give you a reference to the orignal lamp and you will not know which instance
of the lamp it is refering too. You can still handle that case in the exporter
by distributing the uniforms amongst the duplicated lamps.
- ``["image"]``: :class:`bpy.types.Image`
Reference to the image databloc.
Set for uniform type
:data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE`.
You can get the image data from:
* ["image"] : :class:`bpy.types.Image`
Reference to the image databloc. Set for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE`. You can get the image data from:
.. code-block:: python
@@ -581,63 +432,60 @@ Functions
# image size as a 2-dimensional array of int
uniform["image"].size
- ``["texnumber"]``: integer
* ["texnumber"] : integer
Channel number to which the texture is bound when drawing the object.
Set for uniform types
:data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`,
:data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE` and
:data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`.
Set for uniform types :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`, :data:`gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE` and :data:`gpu.GPU_DYNAMIC_SAMPLER_2DSHADOW`.
This is provided for information only: when reusing the shader outside blencer,
you are free to assign the textures to the channel of your choice and to pass
that number channel to the GPU in the uniform.
- ``["texpixels"]``: byte array
texture data for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`.
Although the corresponding uniform is a 2D sampler,
the texture is always a 1D texture of n x 1 pixel.
The texture size n is provided in ["texsize"] element.
* ["texpixels"] : byte array
texture data for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`. Although
the corresponding uniform is a 2D sampler, the texture is always a 1D texture
of n x 1 pixel. The texture size n is provided in ["texsize"] element.
These texture are only used for computer generated texture (colorband, etc).
The texture data is provided so that you can make a real image out of it in the exporter.
The texture data is provided so that you can make a real image out of it in the
exporter.
- ``["texsize"]``: integer
* ["texsize"] : integer
horizontal size of texture for uniform type :data:`gpu.GPU_DYNAMIC_SAMPLER_2DBUFFER`.
The texture data is in ["texpixels"].
- ``["attributes"]``: sequence
* ["attributes"] : sequence
list of attributes used in vertex shader, can be empty. Blender doesn't use
standard attributes except for vertex position and normal. All other vertex
attributes must be passed using the generic ``glVertexAttrib`` functions.
attributes must be passed using the generic glVertexAttrib functions.
The attribute data can be found in the derived mesh custom data using RNA.
Each element of the sequence is a dictionary containing the following elements:
- ``["varname"]``: string
* ["varname"] : string
name of the uniform in the vertex shader. Always of the form 'att<number>'.
- ``["datatype"]``: integer
* ["datatype"] : integer
data type of vertex attribute, can be one of the following:
- :data:`gpu.GPU_DATA_2F`: use ``glVertexAttrib2fv``
- :data:`gpu.GPU_DATA_3F`: use ``glVertexAttrib3fv``
- :data:`gpu.GPU_DATA_4F`: use ``glVertexAttrib4fv``
- :data:`gpu.GPU_DATA_4UB`: use ``glVertexAttrib4ubv``
* :data:`gpu.GPU_DATA_2F` : use glVertexAttrib2fv
* :data:`gpu.GPU_DATA_3F` : use glVertexAttrib3fv
* :data:`gpu.GPU_DATA_4F` : use glVertexAttrib4fv
* :data:`gpu.GPU_DATA_4UB` : use glVertexAttrib4ubv
- ``["number"]``: integer
Generic attribute number. This is provided for information only.
Blender doesn't use ``glBindAttribLocation`` to place generic attributes at specific location,
* ["number"] : integer
generic attribute number. This is provided for information only. Blender
doesn't use glBindAttribLocation to place generic attributes at specific location,
it lets the shader compiler place the attributes automatically and query the
placement with ``glGetAttribLocation``.
The result of this placement is returned in this element.
placement with glGetAttribLocation. The result of this placement is returned in
this element.
When using this shader in a render engine, you should either use
``glBindAttribLocation`` to force the attribute at this location or use
``glGetAttribLocation`` to get the placement chosen by the compiler of your GPU.
glBindAttribLocation to force the attribute at this location or use
glGetAttribLocation to get the placement chosen by the compiler of your GPU.
- ``["type"]``: integer
* ["type"] : integer
type of the mesh custom data from which the vertex attribute is loaded.
See attribute-type_.
- ``["name"]``: string or integer
* ["name"] : string or integer
custom data layer name, used for attribute type :data:`gpu.CD_MTFACE` and :data:`gpu.CD_MCOL`.
Example:
@@ -664,14 +512,14 @@ Notes
.. _mat4_lamp_to_perspective:
#. Calculation of the ``mat4_lamp_to_perspective`` matrix for a spot lamp.
1. Calculation of the *mat4_lamp_to_perspective* matrix for a spot lamp.
The following pseudo code shows how the ``mat4_lamp_to_perspective`` matrix is computed
The following pseudo code shows how the *mat4_lamp_to_perspective* matrix is computed
in blender for uniforms of :data:`gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT` type:
.. code-block:: python
# Get the lamp datablock with:
#Get the lamp datablock with:
lamp = bpy.data.objects[uniform["lamp"]].data
# Compute the projection matrix:
@@ -683,11 +531,11 @@ Notes
# The size of the projection plane is computed with the usual formula:
wsize = lamp.clista * tan(lamp.spotsize/2)
# And the projection matrix:
#And the projection matrix:
mat4_lamp_to_perspective = glFrustum(-wsize, wsize, -wsize, wsize, lamp.clista, lamp.clipend)
#. Creation of the shadow map for a spot lamp.
2. Creation of the shadow map for a spot lamp.
The shadow map is the depth buffer of a render performed by placing the camera at the
spot light position. The size of the shadow map is given by the attribute ``lamp.bufsize``:
spot light position. The size of the shadow map is given by the attribute lamp.bufsize :
shadow map size in pixel, same size in both dimensions.

View File

@@ -121,7 +121,7 @@ Here are some more complex examples:
bpy.context.scene.render.layers["RenderLayer"].samples
# access to the current weight paint brush size
bpy.context.tool_settings.weight_paint.brush.size
bpy.context.tool_settings.weight_paint.brush.size
# check if the window is fullscreen
bpy.context.window.screen.show_fullscreen
@@ -141,16 +141,15 @@ When starting out scripting you will often run into the problem where you're not
There are a few ways to do this.
- Use the Python console's auto-complete to inspect properties.
*This can be hit-and-miss but has the advantage
- Use the Python console's auto-complete to inspect properties. *This can be hit-and-miss but has the advantage
that you can easily see the values of properties and assign them to interactively see the results.*
- Copy the Data-Path from the user interface.
*Explained further in :ref:`Copy Data Path <info_data_path_copy>`*
- Using the documentation to follow references.
*Explained further in :ref:`Indirect Data Access <info_data_path_indirect>`*
- Copy the Data-Path from the user interface. *Explained further in :ref:`Copy Data Path <info_data_path_copy>`*
- Using the documentation to follow references. *Explained further in :ref:`Indirect Data Access <info_data_path_indirect>`*
.. _info_data_path_copy:
.. _info_data_path_copy
Copy Data Path
--------------
@@ -173,8 +172,7 @@ you won't be doing collection look-ups on every access and typically you'll want
then access each :class:`bpy.types.ID` instance by name.
Type in the ID path into a Python console :mod:`bpy.context.active_object`.
Include the trailing dot and don't hit "enter", yet.
Type in the ID path into a Python console :mod:`bpy.context.active_object`. Include the trailing dot and don't hit "enter", yet.
Now right-click on the button and select **Copy Data Path**, then paste the result into the console.
@@ -193,7 +191,7 @@ Hit "enter" and you'll get the current value of 1. Now try changing the value to
You can see the value update in the Subdivision-Surface modifier's UI as well as the cube.
.. _info_data_path_indirect:
.. _info_data_path_indirect
Indirect Data Access
--------------------
@@ -203,24 +201,32 @@ For this example we'll go over something more involved, showing the steps to acc
Lets say we want to access the texture of a brush via Python, to adjust its ``contrast`` for example.
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
- From the toolbar expand the **Texture** panel and add a new texture.
*Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
- In the properties button select the Texture context.
- Select the Brush icon to show the brush texture.
- Expand the *Colors* panel to locate the *Contrast* button.
- Right click on the contrast button and select **Online Python Reference**
This takes you to ``bpy.types.Texture.contrast``
- Now we can see that ``contrast`` is a property of texture,
so next we'll check on how to access the texture from the brush.
- Expand the **Colors** panel to locate the **Contrast** button.
- Right click on the contrast button and select **Online Python Reference** This takes you to ``bpy.types.Texture.contrast``
- Now we can see that ``contrast`` is a property of texture, so next we'll check on how to access the texture from the brush.
- Check on the **References** at the bottom of the page, sometimes there are many references, and it may take
some guess work to find the right one, but in this case its obviously ``Brush.texture``.
*Now we know that the texture can be accessed from* ``bpy.data.brushes["BrushName"].texture``
*but normally you won't want to access the brush by name, so we'll see now to access the active brush instead.*
- So the next step is to check on where brushes are accessed from via the **References**.
In this case there is simply ``bpy.context.brush`` which is all we need.
Now you can use the Python console to form the nested properties needed to access brush textures contrast,
logically we now know.
@@ -276,8 +282,7 @@ are interested to check on the source code.
.. note::
Not all operators can be called usefully from Python,
for more on this see :ref:`using operators <using_operators>`.
Not all operators can be called usefully from Python, for more on this see :ref:`using operators <using_operators>`.
Info View
@@ -289,8 +294,7 @@ This is located above the file-menu which can be dragged down to display its con
Select the **Script** screen that comes default with Blender to see its output.
You can perform some actions and see them show up - delete a vertex for example.
Each entry can be selected (Right-Mouse-Button),
then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
Each entry can be selected (Right-Mouse-Button), then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
.. note::

View File

@@ -1,20 +1,16 @@
*************
Best Practice
*************
When writing your own scripts python is great for new developers to pick up and become productive,
but you can also pick up odd habits or at least write scripts that are not easy for others to understand.
When writing your own scripts python is great for new developers to pick up and become productive, but you can also pick up odd habits or at least write scripts that are not easy for others to understand.
For your own work this is of course fine,
but if you want to collaborate with others or have your work included with blender there are practices we encourage.
For your own work this is of course fine, but if you want to collaborate with others or have your work included with blender there are practices we encourage.
Style Conventions
=================
For Blender/Python development we have chosen to follow python suggested style guide to avoid mixing styles
amongst our own scripts and make it easier to use python scripts from other projects.
For Blender/Python development we have chosen to follow python suggested style guide to avoid mixing styles amongst our own scripts and make it easier to use python scripts from other projects.
Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
@@ -22,17 +18,22 @@ This style guide is known as pep8 and can be found `here <http://www.python.org/
A brief listing of pep8 criteria.
- camel caps for class names: MyClass
- all lower case underscore separated module names: my_module
- indentation of 4 spaces (no tabs)
- spaces around operators. ``1 + 1``, not ``1+1``
- only use explicit imports, (no importing ``*``)
- don't use single line: ``if val: body``, separate onto 2 lines instead.
* camel caps for class names: MyClass
* all lower case underscore separated module names: my_module
* indentation of 4 spaces (no tabs)
* spaces around operators. ``1 + 1``, not ``1+1``
* only use explicit imports, (no importing '*')
* don't use single line: ``if val: body``, separate onto 2 lines instead.
As well as pep8 we have other conventions used for blender python scripts.
- Use single quotes for enums, and double quotes for strings.
* Use single quotes for enums, and double quotes for strings.
Both are of course strings but in our internal API enums are unique items from a limited set. eg.
@@ -41,11 +42,9 @@ As well as pep8 we have other conventions used for blender python scripts.
bpy.context.scene.render.image_settings.file_format = 'PNG'
bpy.context.scene.render.filepath = "//render_out"
- pep8 also defines that lines should not exceed 79 characters,
we felt this is too restrictive so this is optional per script.
* pep8 also defines that lines should not exceed 79 characters, we felt this is too restrictive so this is optional per script.
Periodically we run checks for pep8 compliance on blender scripts,
for scripts to be included in this check add this line as a comment at the top of the script.
Periodically we run checks for pep8 compliance on blender scripts, for scripts to be included in this check add this line as a comment at the top of the script.
``# <pep8 compliant>``
@@ -59,75 +58,72 @@ User Interface Layout
Some notes to keep in mind when writing UI layouts:
- UI code is quite simple. Layout declarations are there to easily create a decent layout.
General rule here: If you need more code for the layout declaration,
then for the actual properties, you do it wrong.
* UI code is quite simple. Layout declarations are there to easily create a decent layout.
General rule here: If you need more code for the layout declaration, then for the actual properties, you do it wrong.
Example layouts:
- layout()
The basic layout is a simple Top -> Bottom layout.
* layout()
The basic layout is a simple Top -> Bottom layout.
.. code-block:: python
layout.prop()
layout.prop()
layout.prop()
layout.prop()
- layout.row()
Use row(), when you want more than 1 property in one line.
* layout.row()
Use row(), when you want more than 1 property in one line.
.. code-block:: python
row = layout.row()
row.prop()
row.prop()
row = layout.row()
row.prop()
row.prop()
- layout.column()
* layout.column()
Use column(), when you want your properties in a column.
.. code-block:: python
col = layout.column()
col.prop()
col.prop()
col = layout.column()
col.prop()
col.prop()
* layout.split()
- layout.split()
This can be used to create more complex layouts.
For example you can split the layout and create two column() layouts next to each other.
This can be used to create more complex layouts. For example you can split the layout and create two column() layouts next to each other.
Don't use split, when you simply want two properties in a row. Use row() for that.
.. code-block:: python
split = layout.split()
col = split.column()
col.prop()
col.prop()
col = split.column()
col.prop()
col.prop()
split = layout.split()
col = split.column()
col.prop()
col.prop()
col = split.column()
col.prop()
col.prop()
Declaration names:
Try to only use these variable names for layout declarations:
- row for a row() layout
- col for a column() layout
- split for a split() layout
- flow for a column_flow() layout
- sub for a sub layout (a column inside a column for example)
* row for a row() layout
* col for a column() layout
* split for a split() layout
* flow for a column_flow() layout
* sub for a sub layout (a column inside a column for example)
Script Efficiency
=================
List Manipulation (General Python Tips)
---------------------------------------
@@ -137,8 +133,7 @@ Searching for list items
In Python there are some handy list functions that save you having to search through the list.
Even though you're not looping on the list data **python is**,
so you need to be aware of functions that will slow down your script by searching the whole list.
Even though you're not looping on the list data **python is**, so you need to be aware of functions that will slow down your script by searching the whole list.
.. code-block:: python
@@ -150,16 +145,11 @@ so you need to be aware of functions that will slow down your script by searchin
Modifying Lists
^^^^^^^^^^^^^^^
In python we can add and remove from a list, this is slower when the list length is modified,
especially at the start of the list, since all the data after the index of
modification needs to be moved up or down 1 place.
In python we can add and remove from a list, this is slower when the list length is modified, especially at the start of the list, since all the data after the index of modification needs to be moved up or down 1 place.
The most simple way to add onto the end of the list is to use
``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and the fastest way to
remove an item is ``my_list.pop()`` or ``del my_list[-1]``.
The most simple way to add onto the end of the list is to use ``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and the fastest way to remove an item is ``my_list.pop()`` or ``del my_list[-1]``.
To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)``
for list removal, but these are slower.
To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)`` for list removal, but these are slower.
Sometimes its faster (but more memory hungry) to just rebuild the list.
@@ -203,8 +193,7 @@ Use...
my_list.extend([a, b, c...])
Note that insert can be used when needed,
but it is slower than append especially when inserting at the start of a long list.
Note that insert can be used when needed, but it is slower than append especially when inserting at the start of a long list.
This example shows a very sub-optimal way of making a reversed list.
@@ -216,8 +205,7 @@ This example shows a very sub-optimal way of making a reversed list.
reverse_list.insert(0, list_item)
Python provides more convenient ways to reverse a list using the slice method,
but you may want to time this before relying on it too much:
Python provides more convenient ways to reverse a list using the slice method, but you may want to time this before relying on it too much:
.. code-block:: python
@@ -232,8 +220,7 @@ Use ``my_list.pop(index)`` rather than ``my_list.remove(list_item)``
This requires you to have the index of the list item but is faster since ``remove()`` will search the list.
Here is an example of how to remove items in 1 loop,
removing the last items first, which is faster (as explained above).
Here is an example of how to remove items in 1 loop, removing the last items first, which is faster (as explained above).
.. code-block:: python
@@ -245,9 +232,7 @@ removing the last items first, which is faster (as explained above).
my_list.pop(list_index)
This example shows a fast way of removing items,
for use in cases where you can alter the list order without breaking the scripts functionality.
This works by swapping 2 list items, so the item you remove is always last.
This example shows a fast way of removing items, for use in cases where you can alter the list order without breaking the scripts functionality. This works by swapping 2 list items, so the item you remove is always last.
.. code-block:: python
@@ -266,9 +251,7 @@ When removing many items in a large list this can provide a good speedup.
Avoid Copying Lists
^^^^^^^^^^^^^^^^^^^
When passing a list/dictionary to a function,
it is faster to have the function modify the list rather than returning
a new list so python doesn't have to duplicate the list in memory.
When passing a list/dictionary to a function, it is faster to have the function modify the list rather than returning a new list so python doesn't have to duplicate the list in memory.
Functions that modify a list in-place are more efficient than functions that create new lists.
@@ -313,26 +296,20 @@ Pythons string joining function. To join a list of strings
>>> file.write(" ".join([str1, str2, str3, "\n"]))
join is fastest on many strings,
`string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`__
is quite fast too (better for converting data types). String arithmetic is slowest.
join is fastest on many strings, `string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`_ is quite fast too (better for converting data types). String arithmetic is slowest.
Parsing Strings (Import/Exporting)
----------------------------------
Since many file formats are ASCII,
the way you parse/export strings can make a large difference in how fast your script runs.
Since many file formats are ASCII, the way you parse/export strings can make a large difference in how fast your script runs.
There are a few ways to parse strings when importing them into Blender.
Parsing Numbers
^^^^^^^^^^^^^^^
Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``,
float() will work for an int too but it's faster to read ints with int().
Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``, float() will work for an int too but it's faster to read ints with int().
Checking String Start/End
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -345,8 +322,7 @@ Use...
>>> if line.startswith("vert "):
Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible
error with the slice length not matching the string length.
Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible error with the slice length not matching the string length.
my_string.endswith("foo_bar") can be used for line endings too.
@@ -360,19 +336,15 @@ Use try/except Sparingly
The **try** statement is useful to save time writing error checking code.
However **try** is significantly slower than an **if** since an exception has to be set each time,
so avoid using **try** in areas of your code that execute in a loop and runs many times.
However **try** is significantly slower than an **if** since an exception has to be set each time, so avoid using **try** in areas of your code that execute in a loop and runs many times.
There are cases where using **try** is faster than checking whether the condition will raise an error,
so it is worth experimenting.
There are cases where using **try** is faster than checking whether the condition will raise an error, so it is worth experimenting.
Value Comparison
----------------
Python has two ways to compare values ``a == b`` and ``a is b``,
the difference is that ``==`` may run the objects comparison function ``__cmp__()`` whereas ``is`` compares identity,
that both variables reference the same item in memory.
Python has two ways to compare values ``a == b`` and ``a is b``, the difference is that ``==`` may run the objects comparison function ``__cmp__()`` whereas ``is`` compares identity, that both variables reference the same item in memory.
In cases where you know you are checking for the same value which is referenced from multiple places, ``is`` is faster.
@@ -390,4 +362,3 @@ While developing a script it's good to time it to be aware of any changes in per
# do something...
print("My Script Finished: %.4f sec" % time.time() - time_start)

View File

@@ -2,8 +2,7 @@
Gotchas
*******
This document attempts to help you work with the Blender API in areas
that can be troublesome and avoid practices that are known to give instability.
This document attempts to help you work with the Blender API in areas that can be troublesome and avoid practices that are known to give instability.
.. _using_operators:
@@ -11,15 +10,16 @@ that can be troublesome and avoid practices that are known to give instability.
Using Operators
===============
Blender's operators are tools for users to access, that Python can access them too is very useful
nevertheless operators have limitations that can make them cumbersome to script.
Blender's operators are tools for users to access, that python can access them too is very useful nevertheless operators have limitations that can make them cumbersome to script.
Main limits are...
- Can't pass data such as objects, meshes or materials to operate on (operators use the context instead)
- The return value from calling an operator gives the success (if it finished or was canceled),
* Can't pass data such as objects, meshes or materials to operate on (operators use the context instead)
* The return value from calling an operator gives the success (if it finished or was canceled),
in some cases it would be more logical from an API perspective to return the result of the operation.
- Operators poll function can fail where an API function would raise an exception giving details on exactly why.
* Operators poll function can fail where an API function would raise an exception giving details on exactly why.
Why does an operator's poll fail?
@@ -32,28 +32,20 @@ When calling an operator gives an error like this:
Which raises the question as to what the correct context might be?
Typically operators check for the active area type, a selection or active object they can operate on,
but some operators are more picky about when they run.
Typically operators check for the active area type, a selection or active object they can operate on, but some operators are more picky about when they run.
In most cases you can figure out what context an operator needs
simply be seeing how it's used in Blender and thinking about what it does.
In most cases you can figure out what context an operator needs simply be seeing how it's used in Blender and thinking about what it does.
Unfortunately if you're still stuck - the only way to **really** know
whats going on is to read the source code for the poll function and see what its checking.
Unfortunately if you're still stuck - the only way to **really** know whats going on is to read the source code for the poll function and see what its checking.
For Python operators it's not so hard to find the source
since it's included with Blender and the source file/line is included in the operator reference docs.
For python operators it's not so hard to find the source since it's included with Blender and the source file/line is included in the operator reference docs.
Downloading and searching the C code isn't so simple,
especially if you're not familiar with the C language but by searching the
operator name or description you should be able to find the poll function with no knowledge of C.
Downloading and searching the C code isn't so simple, especially if you're not familiar with the C language but by searching the operator name or description you should be able to find the poll function with no knowledge of C.
.. note::
Blender does have the functionality for poll functions to describe why they fail,
but its currently not used much, if you're interested to help improve our API
feel free to add calls to ``CTX_wm_operator_poll_msg_set`` where its not obvious why poll fails.
Blender does have the functionality for poll functions to describe why they fail, but its currently not used much, if you're interested to help improve our API feel free to add calls to ``CTX_wm_operator_poll_msg_set`` where its not obvious why poll fails.
>>> bpy.ops.gpencil.draw()
RuntimeError: Operator bpy.ops.gpencil.draw.poll() Failed to find Grease Pencil data to draw into
@@ -62,45 +54,36 @@ operator name or description you should be able to find the poll function with n
The operator still doesn't work!
--------------------------------
Certain operators in Blender are only intended for use in a specific context,
some operators for example are only called from the properties window where they check the current material,
modifier or constraint.
Certain operators in Blender are only intended for use in a specific context, some operators for example are only called from the properties window where they check the current material, modifier or constraint.
Examples of this are:
- :mod:`bpy.ops.texture.slot_move`
- :mod:`bpy.ops.constraint.limitdistance_reset`
- :mod:`bpy.ops.object.modifier_copy`
- :mod:`bpy.ops.buttons.file_browse`
* :mod:`bpy.ops.texture.slot_move`
* :mod:`bpy.ops.constraint.limitdistance_reset`
* :mod:`bpy.ops.object.modifier_copy`
* :mod:`bpy.ops.buttons.file_browse`
Another possibility is that you are the first person to attempt to use this operator
in a script and some modifications need to be made to the operator to run in a different context,
if the operator should logically be able to run but fails when accessed from a script
it should be reported to the bug tracker.
Another possibility is that you are the first person to attempt to use this operator in a script and some modifications need to be made to the operator to run in a different context, if the operator should logically be able to run but fails when accessed from a script it should be reported to the bug tracker.
Stale Data
==========
No updates after setting values
-------------------------------
Sometimes you want to modify values from Python and immediately access the updated values, eg:
Sometimes you want to modify values from python and immediately access the updated values, eg:
Once changing the objects :class:`bpy.types.Object.location`
you may want to access its transformation right after from :class:`bpy.types.Object.matrix_world`,
but this doesn't work as you might expect.
Once changing the objects :class:`bpy.types.Object.location` you may want to access its transformation right after from :class:`bpy.types.Object.matrix_world`, but this doesn't work as you might expect.
Consider the calculations that might go into working out the object's final transformation, this includes:
- animation function curves.
- drivers and their Python expressions.
- constraints
- parent objects and all of their f-curves, constraints etc.
* animation function curves.
* drivers and their pythons expressions.
* constraints
* parent objects and all of their f-curves, constraints etc.
To avoid expensive recalculations every time a property is modified,
Blender defers making the actual calculations until they are needed.
To avoid expensive recalculations every time a property is modified, Blender defers making the actual calculations until they are needed.
However, while the script runs you may want to access the updated values.
In this case you need to call :class:`bpy.types.Scene.update` after modifying values, for example:
@@ -111,9 +94,7 @@ In this case you need to call :class:`bpy.types.Scene.update` after modifying va
bpy.context.scene.update()
Now all dependent data (child objects, modifiers, drivers... etc)
has been recalculated and is available to the script.
Now all dependent data (child objects, modifiers, drivers... etc) has been recalculated and is available to the script.
Can I redraw during the script?
-------------------------------
@@ -122,33 +103,23 @@ The official answer to this is no, or... *"You don't want to do that"*.
To give some background on the topic...
While a script executes Blender waits for it to finish and is effectively locked until its done,
while in this state Blender won't redraw or respond to user input.
Normally this is not such a problem because scripts distributed with Blender
tend not to run for an extended period of time,
nevertheless scripts *can* take ages to execute and its nice to see whats going on in the view port.
While a script executes Blender waits for it to finish and is effectively locked until its done, while in this state Blender won't redraw or respond to user input.
Normally this is not such a problem because scripts distributed with Blender tend not to run for an extended period of time, nevertheless scripts *can* take ages to execute and its nice to see whats going on in the view port.
Tools that lock Blender in a loop and redraw are highly discouraged
since they conflict with Blenders ability to run multiple operators
at once and update different parts of the interface as the tool runs.
Tools that lock Blender in a loop and redraw are highly discouraged since they conflict with Blenders ability to run multiple operators at once and update different parts of the interface as the tool runs.
So the solution here is to write a **modal** operator, that is - an operator which defines a modal() function,
See the modal operator template in the text editor.
So the solution here is to write a **modal** operator, that is - an operator which defines a modal() function, See the modal operator template in the text editor.
Modal operators execute on user input or setup their own timers to run frequently,
they can handle the events or pass through to be handled by the keymap or other modal operators.
Modal operators execute on user input or setup their own timers to run frequently, they can handle the events or pass through to be handled by the keymap or other modal operators.
Transform, Painting, Fly-Mode and File-Select are example of a modal operators.
Writing modal operators takes more effort than a simple ``for`` loop
that happens to redraw but is more flexible and integrates better with Blenders design.
Writing modal operators takes more effort than a simple ``for`` loop that happens to redraw but is more flexible and integrates better with Blenders design.
**Ok, Ok! I still want to draw from Python**
**Ok, Ok! I still want to draw from python**
If you insist - yes its possible, but scripts that use this hack wont be considered
for inclusion in Blender and any issues with using it wont be considered bugs,
this is also not guaranteed to work in future releases.
If you insist - yes its possible, but scripts that use this hack wont be considered for inclusion in Blender and any issues with using it wont be considered bugs, this is also not guaranteed to work in future releases.
.. code-block:: python
@@ -158,18 +129,16 @@ this is also not guaranteed to work in future releases.
Modes and Mesh Access
=====================
When working with mesh data you may run into the problem where a script fails to run as expected in edit-mode.
This is caused by edit-mode having its own data which is only written back to the mesh when exiting edit-mode.
When working with mesh data you may run into the problem where a script fails to run as expected in edit-mode. This is caused by edit-mode having its own data which is only written back to the mesh when exiting edit-mode.
A common example is that exporters may access a mesh through ``obj.data`` (a :class:`bpy.types.Mesh`)
but the user is in edit-mode, where the mesh data is available but out of sync with the edit mesh.
A common example is that exporters may access a mesh through ``obj.data`` (a :class:`bpy.types.Mesh`) but the user is in edit-mode, where the mesh data is available but out of sync with the edit mesh.
In this situation you can...
- Exit edit-mode before running the tool.
- Explicitly update the mesh by calling :class:`bmesh.types.BMesh.to_mesh`.
- Modify the script to support working on the edit-mode data directly, see: :mod:`bmesh.from_edit_mesh`.
- Report the context as incorrect and only allow the script to run outside edit-mode.
* Exit edit-mode before running the tool.
* Explicitly update the mesh by calling :class:`bmesh.types.BMesh.to_mesh`.
* Modify the script to support working on the edit-mode data directly, see: :mod:`bmesh.from_edit_mesh`.
* Report the context as incorrect and only allow the script to run outside edit-mode.
.. _info_gotcha_mesh_faces:
@@ -177,55 +146,35 @@ In this situation you can...
NGons and Tessellation Faces
============================
Since 2.63 NGons are supported, this adds some complexity
since in some cases you need to access triangles/quads still (some exporters for example).
Since 2.63 NGons are supported, this adds some complexity since in some cases you need to access triangles/quads still (some exporters for example).
There are now 3 ways to access faces:
- :class:`bpy.types.MeshPolygon` -
this is the data structure which now stores faces in object mode
(access as ``mesh.polygons`` rather than ``mesh.faces``).
- :class:`bpy.types.MeshTessFace` -
the result of triangulating (tessellated) polygons,
the main method of face access in 2.62 or older (access as ``mesh.tessfaces``).
- :class:`bmesh.types.BMFace` -
the polygons as used in editmode.
* :class:`bpy.types.MeshPolygon` - this is the data structure which now stores faces in object mode (access as ``mesh.polygons`` rather then ``mesh.faces``).
* :class:`bpy.types.MeshTessFace` - the result of triangulating (tessellated) polygons, the main method of face access in 2.62 or older (access as ``mesh.tessfaces``).
* :class:`bmesh.types.BMFace` - the polygons as used in editmode.
For the purpose of the following documentation,
these will be referred to as polygons, tessfaces and bmesh-faces respectively.
For the purpose of the following documentation, these will be referred to as polygons, tessfaces and bmesh-faces respectively.
5+ sided faces will be referred to as ``ngons``.
Support Overview
----------------
.. list-table::
:header-rows: 1
:stub-columns: 1
+--------------+------------------------------+--------------------------------+--------------------------------+
|Usage |:class:`bpy.types.MeshPolygon`|:class:`bpy.types.MeshTessFace` |:class:`bmesh.types.BMFace` |
+==============+==============================+================================+================================+
|Import/Create |Bad (inflexible) |Fine (supported as upgrade path)|Best |
+--------------+------------------------------+--------------------------------+--------------------------------+
|Manipulate |Bad (inflexible) |Bad (loses ngons) |Best |
+--------------+------------------------------+--------------------------------+--------------------------------+
|Export/Output |Good (ngons) |Good (When ngons can't be used) |Good (ngons, memory overhead) |
+--------------+------------------------------+--------------------------------+--------------------------------+
* - Usage
- :class:`bpy.types.MeshPolygon`
- :class:`bpy.types.MeshTessFace`
- :class:`bmesh.types.BMFace`
* - Import/Create
- Poor *(inflexible)*
- Good *(supported as upgrade path)*
- Best
* - Manipulate
- Poor *(inflexible)*
- Poor *(loses ngons)*
- Best
* - Export/Output
- Good *(ngon support)*
- Good *(When ngons can't be used)*
- Good *(ngons, extra memory overhead)*
.. note::
Using the :mod:`bmesh` api is completely separate api from :mod:`bpy`,
typically you would would use one or the other based on the level of editing needed,
not simply for a different way to access faces.
Using the :mod:`bmesh` api is completely separate api from :mod:`bpy`, typically you would would use one or the other based on the level of editing needed, not simply for a different way to access faces.
Creating
@@ -233,18 +182,9 @@ Creating
All 3 datatypes can be used for face creation.
- polygons are the most efficient way to create faces but the data structure is _very_ rigid and inflexible,
you must have all your vertes and faces ready and create them all at once.
This is further complicated by the fact that each polygon does not store its own verts (as with tessfaces),
rather they reference an index and size in :class:`bpy.types.Mesh.loops` which are a fixed array too.
- tessfaces ideally should not be used for creating faces since they are really only tessellation cache of polygons,
however for scripts upgrading from 2.62 this is by far the most straightforward option.
This works by creating tessfaces and when finished -
they can be converted into polygons by calling :class:`bpy.types.Mesh.update`.
The obvious limitation is ngons can't be created this way.
- bmesh-faces are most likely the easiest way for new scripts to create faces,
since faces can be added one by one and the api has features intended for mesh manipulation.
While :class:`bmesh.types.BMesh` uses more memory it can be managed by only operating on one mesh at a time.
* polygons are the most efficient way to create faces but the data structure is _very_ rigid and inflexible, you must have all your vertes and faces ready and create them all at once. This is further complicated by the fact that each polygon does not store its own verts (as with tessfaces), rather they reference an index and size in :class:`bpy.types.Mesh.loops` which are a fixed array too.
* tessfaces ideally should not be used for creating faces since they are really only tessellation cache of polygons, however for scripts upgrading from 2.62 this is by far the most straightforward option. This works by creating tessfaces and when finished - they can be converted into polygons by calling :class:`bpy.types.Mesh.update`. The obvious limitation is ngons can't be created this way.
* bmesh-faces are most likely the easiest way for new scripts to create faces, since faces can be added one by one and the api has features intended for mesh manipulation. While :class:`bmesh.types.BMesh` uses more memory it can be managed by only operating on one mesh at a time.
Editing
@@ -252,24 +192,18 @@ Editing
Editing is where the 3 data types vary most.
- Polygons are very limited for editing,
changing materials and options like smooth works but for anything else
they are too inflexible and are only intended for storage.
- Tessfaces should not be used for editing geometry because doing so will cause existing ngons to be tessellated.
- BMesh-Faces are by far the best way to manipulate geometry.
* polygons are very limited for editing, changing materials and options like smooth works but for anything else they are too inflexible and are only intended for storage.
* tessfaces should not be used for editing geometry because doing so will cause existing ngons to be tessellated.
* bmesh-faces are by far the best way to manipulate geometry.
Exporting
---------
All 3 data types can be used for exporting,
the choice mostly depends on whether the target format supports ngons or not.
All 3 data types can be used for exporting, the choice mostly depends on whether the target format supports ngons or not.
- Polygons are the most direct & efficient way to export providing they convert into the output format easily enough.
- Tessfaces work well for exporting to formats which dont support ngons,
in fact this is the only place where their use is encouraged.
- BMesh-Faces can work for exporting too but may not be necessary if polygons can be used
since using bmesh gives some overhead because its not the native storage format in object mode.
* polygons are the most direct & efficient way to export providing they convert into the output format easily enough.
* tessfaces work well for exporting to formats which dont support ngons, in fact this is the only place where their use is encouraged.
* bmesh-faces can work for exporting too but may not be necessary if polygons can be used since using bmesh gives some overhead because its not the native storage format in object mode.
Upgrading Importers from 2.62
@@ -279,9 +213,9 @@ Importers can be upgraded to work with only minor changes.
The main change to be made is used the tessellation versions of each attribute.
- mesh.faces --> :class:`bpy.types.Mesh.tessfaces`
- mesh.uv_textures --> :class:`bpy.types.Mesh.tessface_uv_textures`
- mesh.vertex_colors --> :class:`bpy.types.Mesh.tessface_vertex_colors`
* mesh.faces --> :class:`bpy.types.Mesh.tessfaces`
* mesh.uv_textures --> :class:`bpy.types.Mesh.tessface_uv_textures`
* mesh.vertex_colors --> :class:`bpy.types.Mesh.tessface_vertex_colors`
Once the data is created call :class:`bpy.types.Mesh.update` to convert the tessfaces into polygons.
@@ -289,9 +223,7 @@ Once the data is created call :class:`bpy.types.Mesh.update` to convert the tess
Upgrading Exporters from 2.62
-----------------------------
For exporters the most direct way to upgrade is to use tessfaces as with importing
however its important to know that tessfaces may **not** exist for a mesh,
the array will be empty as if there are no faces.
For exporters the most direct way to upgrade is to use tessfaces as with importing however its important to know that tessfaces may **not** exist for a mesh, the array will be empty as if there are no faces.
So before accessing tessface data call: :class:`bpy.types.Mesh.update` ``(calc_tessface=True)``.
@@ -299,8 +231,7 @@ So before accessing tessface data call: :class:`bpy.types.Mesh.update` ``(calc_t
EditBones, PoseBones, Bone... Bones
===================================
Armature Bones in Blender have three distinct data structures that contain them.
If you are accessing the bones through one of them, you may not have access to the properties you really need.
Armature Bones in Blender have three distinct data structures that contain them. If you are accessing the bones through one of them, you may not have access to the properties you really need.
.. note::
@@ -310,9 +241,7 @@ If you are accessing the bones through one of them, you may not have access to t
Edit Bones
----------
``bpy.context.object.data.edit_bones`` contains a editbones;
to access them you must set the armature mode to edit mode first (editbones do not exist in object or pose mode).
Use these to create new bones, set their head/tail or roll, change their parenting relationships to other bones, etc.
``bpy.context.object.data.edit_bones`` contains a editbones; to access them you must set the armature mode to edit mode first (editbones do not exist in object or pose mode). Use these to create new bones, set their head/tail or roll, change their parenting relationships to other bones, etc.
Example using :class:`bpy.types.EditBone` in armature editmode:
@@ -332,9 +261,7 @@ Returns an editbone only in edit mode.
Bones (Object Mode)
-------------------
``bpy.context.object.data.bones`` contains bones.
These *live* in object mode, and have various properties you can change,
note that the head and tail properties are read-only.
``bpy.context.object.data.bones`` contains bones. These *live* in object mode, and have various properties you can change, note that the head and tail properties are read-only.
Example using :class:`bpy.types.Bone` in object or pose mode:
@@ -354,9 +281,7 @@ Accessible but read-only
Pose Bones
----------
``bpy.context.object.pose.bones`` contains pose bones.
This is where animation data resides, i.e. animatable transformations
are applied to pose bones, as are constraints and ik-settings.
``bpy.context.object.pose.bones`` contains pose bones. This is where animation data resides, i.e. animatable transformations are applied to pose bones, as are constraints and ik-settings.
Examples using :class:`bpy.types.PoseBone` in object or pose mode:
@@ -371,27 +296,19 @@ Examples using :class:`bpy.types.PoseBone` in object or pose mode:
.. note::
Notice the pose is accessed from the object rather than the object data,
this is why blender can have 2 or more objects sharing the same armature in different poses.
Notice the pose is accessed from the object rather than the object data, this is why blender can have 2 or more objects sharing the same armature in different poses.
.. note::
Strictly speaking PoseBone's are not bones, they are just the state of the armature,
stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`,
the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
Strictly speaking PoseBone's are not bones, they are just the state of the armature, stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`, the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
Armature Mode Switching
-----------------------
While writing scripts that deal with armatures you may find you have to switch between modes,
when doing so take care when switching out of edit-mode not to keep references
to the edit-bones or their head/tail vectors.
Further access to these will crash blender so its important the script
clearly separates sections of the code which operate in different modes.
While writing scripts that deal with armatures you may find you have to switch between modes, when doing so take care when switching out of editmode not to keep references to the edit-bones or their head/tail vectors. Further access to these will crash blender so its important the script clearly separates sections of the code which operate in different modes.
This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode,
however for operator access you may still need to enter pose mode.
This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode, however for operator access you may still need to enter pose mode.
Data Names
@@ -426,13 +343,10 @@ Or with name assignment...
Data names may not match the assigned values if they exceed the maximum length, are already used or an empty string.
Its better practice not to reference objects by names at all,
once created you can store the data in a list, dictionary, on a class etc,
there is rarely a reason to have to keep searching for the same data by name.
Its better practice not to reference objects by names at all, once created you can store the data in a list, dictionary, on a class etc, there is rarely a reason to have to keep searching for the same data by name.
If you do need to use name references, its best to use a dictionary to maintain
a mapping between the names of the imported assets and the newly created data,
this way you don't run this risk of referencing existing data from the blend file, or worse modifying it.
If you do need to use name references, its best to use a dictionary to maintain a mapping between the names of the imported assets and the newly created data, this way you don't run this risk of referencing existing data from the blend file, or worse modifying it.
.. code-block:: python
@@ -444,22 +358,18 @@ this way you don't run this risk of referencing existing data from the blend fil
# normally some code, or function calls...
# use own dictionary rather than bpy.data
# use own dictionary rather then bpy.data
mesh = mesh_name_mapping[meshid]
Library Collisions
------------------
Blender keeps data names unique - :class:`bpy.types.ID.name` so you can't name two objects,
meshes, scenes etc the same thing by accident.
Blender keeps data names unique - :class:`bpy.types.ID.name` so you can't name two objects, meshes, scenes etc the same thing by accident.
However when linking in library data from another blend file naming collisions can occur,
so its best to avoid referencing data by name at all.
However when linking in library data from another blend file naming collisions can occur, so its best to avoid referencing data by name at all.
This can be tricky at times and not even blender handles this correctly in some case
(when selecting the modifier object for eg you can't select between multiple objects with the same name),
but its still good to try avoid problems in this area.
This can be tricky at times and not even blender handles this correctly in some case (when selecting the modifier object for eg you can't select between multiple objects with the same name), but its still good to try avoid problems in this area.
If you need to select between local and library data, there is a feature in ``bpy.data`` members to allow for this.
@@ -484,23 +394,21 @@ If you need to select between local and library data, there is a feature in ``bp
Relative File Paths
===================
Blenders relative file paths are not compatible with standard Python modules such as ``sys`` and ``os``.
Blenders relative file paths are not compatible with standard python modules such as ``sys`` and ``os``.
Built in Python functions don't understand blenders ``//`` prefix which denotes the blend file path.
Built in python functions don't understand blenders ``//`` prefix which denotes the blend file path.
A common case where you would run into this problem is when exporting a material with associated image paths.
>>> bpy.path.abspath(image.filepath)
>>> bpy.path.abspath(image.filepath)
When using blender data from linked libraries there is an unfortunate complication
since the path will be relative to the library rather than the open blend file.
When the data block may be from an external blend file pass the library argument from the :class:`bpy.types.ID`.
When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the :class:`bpy.types.ID`.
>>> bpy.path.abspath(image.filepath, library=image.library)
>>> bpy.path.abspath(image.filepath, library=image.library)
These returns the absolute path which can be used with native Python modules.
These returns the absolute path which can be used with native python modules.
Unicode Problems
@@ -541,28 +449,23 @@ Here are 2 ways around filesystem encoding issues:
>>> bpy.context.object.name = filepath_utf8
Unicode encoding/decoding is a big topic with comprehensive Python documentation,
to avoid getting stuck too deep in encoding problems - here are some suggestions:
Unicode encoding/decoding is a big topic with comprehensive python documentation, to avoid getting stuck too deep in encoding problems - here are some suggestions:
- Always use utf-8 encoding or convert to utf-8 where the input is unknown.
- Avoid manipulating filepaths as strings directly, use ``os.path`` functions instead.
- Use ``os.fsencode()`` / ``os.fsdecode()`` instead of built in string decoding functions when operating on paths.
- To print paths or to include them in the user interface use ``repr(path)`` first
or ``"%r" % path`` with string formatting.
* Always use utf-8 encoiding or convert to utf-8 where the input is unknown.
.. note::
* Avoid manipulating filepaths as strings directly, use ``os.path`` functions instead.
Sometimes it's preferrable to avoid string encoding issues by using bytes instead of Python strings,
when reading some input its less trouble to read it as binary data
though you will still need to decide how to treat any strings you want to use with Blender,
some importers do this.
* Use ``os.fsencode()`` / ``os.fsdecode()`` rather then the built in string decoding functions when operating on paths.
* To print paths or to include them in the user interface use ``repr(path)`` first or ``"%r" % path`` with string formatting.
* **Possibly** - use bytes instead of python strings, when reading some input its less trouble to read it as binary data though you will still need to decide how to treat any strings you want to use with Blender, some importers do this.
Strange errors using 'threading' module
=======================================
Python threading with Blender only works properly when the threads finish up before the script does.
By using ``threading.join()`` for example.
Python threading with Blender only works properly when the threads finish up before the script does. By using ``threading.join()`` for example.
Heres an example of threading supported by Blender:
@@ -601,8 +504,7 @@ Heres an example of threading supported by Blender:
t.join()
This an example of a timer which runs many times a second and moves
the default cube continuously while Blender runs **(Unsupported)**.
This an example of a timer which runs many times a second and moves the default cube continuously while Blender runs **(Unsupported)**.
.. code-block:: python
@@ -619,48 +521,38 @@ the default cube continuously while Blender runs **(Unsupported)**.
my_timer()
Use cases like the one above which leave the thread running once the script finishes
may seem to work for a while but end up causing random crashes or errors in Blender's own drawing code.
Use cases like the one above which leave the thread running once the script finishes may seem to work for a while but end up causing random crashes or errors in Blender's own drawing code.
So far, no work has gone into making Blender's Python integration thread safe,
so until its properly supported, best not make use of this.
So far, no work has gone into making Blender's python integration thread safe, so until its properly supported, best not make use of this.
.. note::
Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems,
the ``subprocess`` and ``multiprocess`` modules can be used with Blender and make use of multiple CPU's too.
Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems, the ``subprocess`` and ``multiprocess`` modules can be used with Blender and make use of multiple CPU's too.
Help! My script crashes Blender
===============================
Ideally it would be impossible to crash Blender from Python
however there are some problems with the API where it can be made to crash.
Ideally it would be impossible to crash Blender from python however there are some problems with the API where it can be made to crash.
Strictly speaking this is a bug in the API but fixing it would mean adding memory verification
on every access since most crashes are caused by the Python objects referencing Blenders memory directly,
whenever the memory is freed, further Python access to it can crash the script.
But fixing this would make the scripts run very slow,
or writing a very different kind of API which doesn't reference the memory directly.
Strictly speaking this is a bug in the API but fixing it would mean adding memory verification on every access since most crashes are caused by the python objects referencing Blenders memory directly, whenever the memory is freed, further python access to it can crash the script. But fixing this would make the scripts run very slow, or writing a very different kind of API which doesn't reference the memory directly.
Here are some general hints to avoid running into these problems.
- Be aware of memory limits,
especially when working with large lists since Blender can crash simply by running out of memory.
- Many hard to fix crashes end up being because of referencing freed data,
when removing data be sure not to hold any references to it.
- Modules or classes that remain active while Blender is used,
should not hold references to data the user may remove, instead,
fetch data from the context each time the script is activated.
- Crashes may not happen every time, they may happen more on some configurations/operating-systems.
* Be aware of memory limits, especially when working with large lists since Blender can crash simply by running out of memory.
* Many hard to fix crashes end up being because of referencing freed data, when removing data be sure not to hold any references to it.
* Modules or classes that remain active while Blender is used, should not hold references to data the user may remove, instead, fetch data from the context each time the script is activated.
* Crashes may not happen every time, they may happen more on some configurations/operating-systems.
.. note::
To find the line of your script that crashes you can use the ``faulthandler`` module.
See `faulthandler docs <http://docs.python.org/dev/library/faulthandler.html>`_.
While the crash may be in Blenders C/C++ code,
this can help a lot to track down the area of the script that causes the crash.
While the crash may be in Blenders C/C++ code, this can help a lot to track down the area of the script that causes the crash.
Undo/Redo
@@ -680,36 +572,28 @@ This example shows how you can tell undo changes the memory locations.
>>> hash(bpy.context.object)
-9223372036849951740
As suggested above, simply not holding references to data when Blender is used
interactively by the user is the only way to ensure the script doesn't become unstable.
As suggested above, simply not holding references to data when Blender is used interactively by the user is the only way to ensure the script doesn't become unstable.
Undo & Library Data
^^^^^^^^^^^^^^^^^^^
One of the advantages with Blenders library linking system that undo
can skip checking changes in library data since it is assumed to be static.
One of the advantages with Blenders library linking system that undo can skip checking changes in library data since it is assumed to be static.
Tools in Blender are not allowed to modify library data.
Python however does not enforce this restriction.
This can be useful in some cases, using a script to adjust material values for example.
But its also possible to use a script to make library data point to newly created local data,
which is not supported since a call to undo will remove the local data
but leave the library referencing it and likely crash.
But its also possible to use a script to make library data point to newly created local data, which is not supported since a call to undo will remove the local data but leave the library referencing it and likely crash.
So it's best to consider modifying library data an advanced usage of the API
and only to use it when you know what you're doing.
So it's best to consider modifying library data an advanced usage of the API and only to use it when you know what you're doing.
Edit Mode / Memory Access
-------------------------
Switching edit-mode ``bpy.ops.object.mode_set(mode='EDIT')`` / ``bpy.ops.object.mode_set(mode='OBJECT')``
will re-allocate objects data,
any references to a meshes vertices/polygons/uvs, armatures bones,
curves points etc cannot be accessed after switching edit-mode.
Switching edit-mode ``bpy.ops.object.mode_set(mode='EDIT')`` / ``bpy.ops.object.mode_set(mode='OBJECT')`` will re-allocate objects data, any references to a meshes vertices/polygons/uvs, armatures bones, curves points etc cannot be accessed after switching edit-mode.
Only the reference to the data its self can be re-accessed, the following example will crash.
@@ -724,8 +608,7 @@ Only the reference to the data its self can be re-accessed, the following exampl
print(polygons)
So after switching edit-mode you need to re-access any object data variables,
the following example shows how to avoid the crash above.
So after switching edit-mode you need to re-access any object data variables, the following example shows how to avoid the crash above.
.. code-block:: python
@@ -739,15 +622,13 @@ the following example shows how to avoid the crash above.
print(polygons)
These kinds of problems can happen for any functions which re-allocate
the object data but are most common when switching edit-mode.
These kinds of problems can happen for any functions which re-allocate the object data but are most common when switching edit-mode.
Array Re-Allocation
-------------------
When adding new points to a curve or vertices's/edges/polygons to a mesh,
internally the array which stores this data is re-allocated.
When adding new points to a curve or vertices's/edges/polygons to a mesh, internally the array which stores this data is re-allocated.
.. code-block:: python
@@ -758,20 +639,15 @@ internally the array which stores this data is re-allocated.
# this will crash!
point.co = 1.0, 2.0, 3.0
This can be avoided by re-assigning the point variables after adding the new one or by storing
indices's to the points rather than the points themselves.
This can be avoided by re-assigning the point variables after adding the new one or by storing indices's to the points rather then the points themselves.
The best way is to sidestep the problem altogether add all the points to the curve at once.
This means you don't have to worry about array re-allocation and its faster too
since reallocating the entire array for every point added is inefficient.
The best way is to sidestep the problem altogether add all the points to the curve at once. This means you don't have to worry about array re-allocation and its faster too since reallocating the entire array for every point added is inefficient.
Removing Data
-------------
**Any** data that you remove shouldn't be modified or accessed afterwards,
this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints
along with objects, scenes, groups, bones.. etc.
**Any** data that you remove shouldn't be modified or accessed afterwards, this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints along with objects, scenes, groups, bones.. etc.
The ``remove()`` api calls will invalidate the data they free to prevent common mistakes.
@@ -782,13 +658,12 @@ The following example shows how this precortion works.
mesh = bpy.data.meshes.new(name="MyMesh")
# normally the script would use the mesh here...
bpy.data.meshes.remove(mesh)
print(mesh.name) # <- give an exception rather than crashing:
print(mesh.name) # <- give an exception rather then crashing:
# ReferenceError: StructRNA of type Mesh has been removed
But take care because this is limited to scripts accessing the variable which is removed,
the next example will still crash.
But take care because this is limited to scripts accessing the variable which is removed, the next example will still crash.
.. code-block:: python
@@ -801,11 +676,9 @@ the next example will still crash.
sys.exit
========
Some Python modules will call ``sys.exit()`` themselves when an error occurs,
while not common behavior this is something to watch out for because it may seem
as if Blender is crashing since ``sys.exit()`` will close Blender immediately.
Some python modules will call ``sys.exit()`` themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since ``sys.exit()`` will quit blender immediately.
For example, the ``argparse`` module will print an error and exit if the arguments are invalid.
For example, the ``optparse`` module will print an error and exit if the arguments are invalid.
An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit`` with your own function but manipulating python in this way is bad practice.
An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of Python code is quitting,
you could of course replace ``sys.exit`` with your own function but manipulating Python in this way is bad practice.

View File

@@ -1,25 +1,18 @@
.. _info_overview:
*******************
Python API Overview
*******************
This document is to give an understanding of how Python and Blender fit together,
covering some of the functionality that isn't obvious from reading the API reference and example scripts.
This document is to give an understanding of how python and blender fit together, covering some of the functionality that isn't obvious from reading the API reference and example scripts.
Python in Blender
=================
Blender embeds a Python interpreter which is started with Blender and stays active.
This interpreter runs scripts to draw the user interface and is used for some of Blender's internal tools too.
Blender embeds a python interpreter which is started with blender and stays active. This interpreter runs scripts to draw the user interface and is used for some of Blender's internal tools too.
This is a typical Python environment so tutorials on how to write Python scripts
will work running the scripts in Blender too.
Blender provides the :mod:`bpy` module to the Python interpreter.
This module can be imported in a script and gives access to Blender data, classes, and functions.
Scripts that deal with Blender data will need to import this module.
This is a typical python environment so tutorials on how to write python scripts will work running the scripts in blender too. Blender provides the :mod:`bpy` module to the python interpreter. This module can be imported in a script and gives access to blender data, classes, and functions. Scripts that deal with blender data will need to import this module.
Here is a simple example of moving a vertex of the object named **Cube**:
@@ -28,96 +21,84 @@ Here is a simple example of moving a vertex of the object named **Cube**:
import bpy
bpy.data.objects["Cube"].data.vertices[0].co.x += 1.0
This modifies Blender's internal data directly.
When you run this in the interactive console you will see the 3D viewport update.
This modifies Blender's internal data directly. When you run this in the interactive console you will see the 3D viewport update.
The Default Environment
=======================
When developing your own scripts it may help to understand how Blender sets up its Python environment.
Many Python scripts come bundled with Blender and can be used as a reference
because they use the same API that script authors write tools in.
Typical usage for scripts include: user interface, import/export,
scene manipulation, automation, defining your own toolset and customization.
When developing your own scripts it may help to understand how blender sets up its python environment. Many python scripts come bundled with blender and can be used as a reference because they use the same API that script authors write tools in. Typical usage for scripts include: user interface, import/export, scene manipulation, automation, defining your own toolset and customization.
On startup Blender scans the ``scripts/startup/`` directory for Python modules and imports them.
The exact location of this directory depends on your installation.
`See the directory layout docs
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__
On startup blender scans the ``scripts/startup/`` directory for python modules and imports them. The exact location of this directory depends on your installation. `See the directory layout docs <http://wiki.blender.org/index.php/Doc:2.6/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
Script Loading
==============
This may seem obvious but it's important to note the difference
between executing a script directly or importing it as a module.
This may seem obvious but it's important to note the difference between executing a script directly or importing it as a module.
Scripts that extend Blender - define classes that exist beyond the scripts execution,
this makes future access to these classes (to unregister for example)
more difficult than importing as a module where class instance is kept
in the module and can be accessed by importing that module later on.
Scripts that extend blender - define classes that exist beyond the scripts execution, this makes future access to these classes (to unregister for example) more difficult than importing as a module where class instance is kept in the module and can be accessed by importing that module later on.
For this reason it's preferable to only use directly execute scripts that don't extend Blender by registering classes.
For this reason it's preferable to only use directly execute scripts that don't extend blender by registering classes.
Here are some ways to run scripts directly in Blender.
Here are some ways to run scripts directly in blender.
- Loaded in the text editor and press **Run Script**.
- Typed or pasted into the interactive console.
- Execute a Python file from the command line with Blender, eg:
* Loaded in the text editor and press **Run Script**.
.. code-block:: sh
* Typed or pasted into the interactive console.
blender --python /home/me/my_script.py
* Execute a python file from the command line with blender, eg:
``blender --python /home/me/my_script.py``
To run as modules:
- The obvious way, ``import some_module`` command from the text window or interactive console.
- Open as a text block and tick "Register" option, this will load with the blend file.
- copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
- define as an addon, enabling the addon will load it as a Python module.
* The obvious way, ``import some_module`` command from the text window or interactive console.
* Open as a text block and tick "Register" option, this will load with the blend file.
* copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
* define as an addon, enabling the addon will load it as a python module.
Addons
------
Some of Blenders functionality is best kept optional,
alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``,
and only load on startup if selected from the user preferences.
Some of blenders functionality is best kept optional, alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``, and only load on startup if selected from the user preferences.
The only difference between addons and built-in Python modules is that addons must contain a ``bl_info``
variable which Blender uses to read metadata such as name, author, category and URL.
The only difference between addons and built-in python modules is that addons must contain a **bl_info** variable which blender uses to read metadata such as name, author, category and URL.
The user preferences addon listing uses **bl_info** to display information about each addon.
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`__
for details on the ``bl_info`` dictionary.
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`_ for details on the **bl_info** dictionary.
Integration through Classes
===========================
Running Python scripts in the text editor is useful for testing but you'll
want to extend Blender to make tools accessible like other built-in functionality.
Running python scripts in the text editor is useful for testing but youll want to extend blender to make tools accessible like other built-in functionality.
The Blender Python api allows integration for:
The blender python api allows integration for:
- :class:`bpy.types.Panel`
- :class:`bpy.types.Menu`
- :class:`bpy.types.Operator`
- :class:`bpy.types.PropertyGroup`
- :class:`bpy.types.KeyingSet`
- :class:`bpy.types.RenderEngine`
* :class:`bpy.types.Panel`
* :class:`bpy.types.Menu`
* :class:`bpy.types.Operator`
* :class:`bpy.types.PropertyGroup`
* :class:`bpy.types.KeyingSet`
* :class:`bpy.types.RenderEngine`
This is intentionally limited. Currently, for more advanced features such as mesh modifiers,
object types, or shader nodes, C/C++ must be used.
This is intentionally limited. Currently, for more advanced features such as mesh modifiers, object types, or shader nodes, C/C++ must be used.
For Python integration Blender defines methods which are common to all types.
This works by creating a Python subclass of a Blender class which contains variables and functions
specified by the parent class which are pre-defined to interface with Blender.
For python intergration Blender defines methods which are common to all types. This works by creating a python subclass of a Blender class which contains variables and functions specified by the parent class which are pre-defined to interface with Blender.
For example:
@@ -134,20 +115,15 @@ For example:
bpy.utils.register_class(SimpleOperator)
First note that we subclass a member of :mod:`bpy.types`,
this is common for all classes which can be integrated with Blender and
used so we know if this is an Operator and not a Panel when registering.
First note that we subclass a member of :mod:`bpy.types`, this is common for all classes which can be integrated with blender and used so we know if this is an Operator and not a Panel when registering.
Both class properties start with a ``bl_`` prefix.
This is a convention used to distinguish Blender properties from those you add yourself.
Both class properties start with a **bl_** prefix. This is a convention used to distinguish blender properties from those you add yourself.
Next see the execute function, which takes an instance of the operator and the current context.
A common prefix is not used for functions.
Next see the execute function, which takes an instance of the operator and the current context. A common prefix is not used for functions.
Lastly the register function is called, this takes the class and loads it into Blender. See `Class Registration`_.
Lastly the register function is called, this takes the class and loads it into blender. See `Class Registration`_.
Regarding inheritance, Blender doesn't impose restrictions on the kinds of class inheritance used,
the registration checks will use attributes and functions defined in parent classes.
Regarding inheritance, blender doesn't impose restrictions on the kinds of class inheritance used, the registration checks will use attributes and functions defined in parent classes.
class mix-in example:
@@ -165,20 +141,11 @@ class mix-in example:
bpy.utils.register_class(SimpleOperator)
Notice these classes don't define an ``__init__(self)`` function.
While ``__init__()`` and ``__del__()`` will be called if defined,
the class instances lifetime only spans the execution.
So a panel for example will have a new instance for every redraw,
for this reason there is rarely a cause to store variables in the panel instance.
Instead, persistent variables should be stored in Blenders
ata so that the state can be restored when Blender is restarted.
Notice these classes don't define an ``__init__(self)`` function. While ``__init__()`` and ``__del__()`` will be called if defined, the class instances lifetime only spans the execution. So a panel for example will have a new instance for every redraw, for this reason there is rarely a cause to store variables in the panel instance. Instead, persistent variables should be stored in Blenders data so that the state can be restored when blender is restarted.
.. note::
.. note:: Modal operators are an exception, keeping their instance variable as blender runs, see modal operator template.
Modal operators are an exception, keeping their instance variable as Blender runs, see modal operator template.
So once the class is registered with Blender, instancing the class and calling the functions is left up to Blender.
In fact you cannot instance these classes from the script as you would expect with most Python API's.
So once the class is registered with blender, instancing the class and calling the functions is left up to blender. In fact you cannot instance these classes from the script as you would expect with most python API's.
To run operators you can call them through the operator api, eg:
@@ -187,8 +154,7 @@ To run operators you can call them through the operator api, eg:
import bpy
bpy.ops.object.simple_operator()
User interface classes are given a context in which to draw, buttons window, file header, toolbar etc,
then they are drawn when that area is displayed so they are never called by Python scripts directly.
User interface classes are given a context in which to draw, buttons window, file header, toolbar etc, then they are drawn when that area is displayed so they are never called by python scripts directly.
Registration
@@ -198,10 +164,9 @@ Registration
Module Registration
-------------------
Blender modules loaded at startup require ``register()`` and ``unregister()`` functions.
These are the *only* functions that Blender calls from your code, which is otherwise a regular Python module.
Blender modules loaded at startup require ``register()`` and ``unregister()`` functions. These are the *only* functions that blender calls from your code, which is otherwise a regular python module.
A simple Blender/Python module can look like this:
A simple blender/python module can look like this:
.. code-block:: python
@@ -219,16 +184,12 @@ A simple Blender/Python module can look like this:
if __name__ == "__main__":
register()
These functions usually appear at the bottom of the script containing class registration sometimes adding menu items.
You can also use them for internal purposes setting up data for your own tools but take care
since register won't re-run when a new blend file is loaded.
These functions usually appear at the bottom of the script containing class registration sometimes adding menu items. You can also use them for internal purposes setting up data for your own tools but take care since register won't re-run when a new blend file is loaded.
The register/unregister calls are used so it's possible to toggle addons and reload scripts while Blender runs.
If the register calls were placed in the body of the script, registration would be called on import,
meaning there would be no distinction between importing a module or loading its classes into Blender.
The register/unregister calls are used so it's possible to toggle addons and reload scripts while blender runs.
If the register calls were placed in the body of the script, registration would be called on import, meaning there would be no distinction between importing a module or loading its classes into blender.
This becomes problematic when a script imports classes from another module
making it difficult to manage which classes are being loaded and when.
This becomes problematic when a script imports classes from another module making it difficult to manage which classes are being loaded and when.
The last 2 lines are only for testing:
@@ -238,24 +199,19 @@ The last 2 lines are only for testing:
register()
This allows the script to be run directly in the text editor to test changes.
This ``register()`` call won't run when the script is imported as a module
since ``__main__`` is reserved for direct execution.
This ``register()`` call won't run when the script is imported as a module since ``__main__`` is reserved for direct execution.
Class Registration
------------------
Registering a class with Blender results in the class definition being loaded into Blender,
where it becomes available alongside existing functionality.
Registering a class with blender results in the class definition being loaded into blender, where it becomes available alongside existing functionality.
Once this class is loaded you can access it from :mod:`bpy.types`,
using the bl_idname rather than the classes original name.
Once this class is loaded you can access it from :mod:`bpy.types`, using the bl_idname rather than the classes original name.
When loading a class, Blender performs sanity checks making sure all required properties and functions are found,
that properties have the correct type, and that functions have the right number of arguments.
When loading a class, blender performs sanity checks making sure all required properties and functions are found, that properties have the correct type, and that functions have the right number of arguments.
Mostly you will not need concern yourself with this but if there is a problem
with the class definition it will be raised on registering:
Mostly you will not need concern yourself with this but if there is a problem with the class definition it will be raised on registering:
Using the function arguments ``def execute(self, context, spam)``, will raise an exception:
@@ -269,13 +225,9 @@ Using ``bl_idname = 1`` will raise.
Multiple-Classes
^^^^^^^^^^^^^^^^
Loading classes into Blender is described above,
for simple cases calling :mod:`bpy.utils.register_class` (SomeClass) is sufficient,
but when there are many classes or a packages submodule has its own
classes it can be tedious to list them all for registration.
Loading classes into blender is described above, for simple cases calling :mod:`bpy.utils.register_class` (SomeClass) is sufficient, but when there are many classes or a packages submodule has its own classes it can be tedious to list them all for registration.
For more convenient loading/unloading :mod:`bpy.utils.register_module` (module)
and :mod:`bpy.utils.unregister_module` (module) functions exist.
For more convenient loading/unloading :mod:`bpy.utils.register_module` (module) and :mod:`bpy.utils.unregister_module` (module) functions exist.
A script which defines many of its own operators, panels menus etc. you only need to write:
@@ -287,19 +239,13 @@ A script which defines many of its own operators, panels menus etc. you only nee
def unregister():
bpy.utils.unregister_module(__name__)
Internally Blender collects subclasses on registrable types, storing them by the module in which they are defined.
By passing the module name to :mod:`bpy.utils.register_module`
Blender can register all classes created by this module and its submodules.
Internally blender collects subclasses on registrable types, storing them by the module in which they are defined. By passing the module name to :mod:`bpy.utils.register_module` blender can register all classes created by this module and its submodules.
Inter Classes Dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^
When customizing Blender you may want to group your own settings together,
after all, they will likely have to co-exist with other scripts.
To group these properties classes need to be defined,
for groups within groups or collections within groups
you can find yourself having to deal with order of registration/unregistration.
When customizing blender you may want to group your own settings together, after all, they will likely have to co-exist with other scripts. To group these properties classes need to be defined, for groups within groups or collections within groups you can find yourself having to deal with order of registration/unregistration.
Custom properties groups are themselves classes which need to be registered.
@@ -365,9 +311,7 @@ Say you want to store material settings for a custom engine.
Manipulating Classes
^^^^^^^^^^^^^^^^^^^^
Properties can be added and removed as Blender runs,
normally happens on register or unregister but for some
special cases it may be useful to modify types as the script runs.
Properties can be added and removed as blender runs, normally happens on register or unregister but for some special cases it may be useful to modify types as the script runs.
For example:
@@ -397,8 +341,7 @@ This works just as well for PropertyGroup subclasses you define yourself.
Dynamic Defined-Classes (Advanced)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In some cases the specifier for data may not be in Blender,
renderman shader definitions for example and it may be useful to define types and remove them on the fly.
In some cases the specifier for data may not be in blender, renderman shader definitions for example and it may be useful to define types and remove them on the fly.
.. code-block:: python
@@ -417,8 +360,7 @@ renderman shader definitions for example and it may be useful to define types an
.. note::
``type()`` is called to define the class.
This is an alternative syntax for class creation in Python, better suited to constructing classes dynamically.
Notice ``type()`` is called to define the class. This is an alternative syntax for class creation in python, better suited to constructing classes dynamically.
Calling these operators:

View File

@@ -1,4 +1,3 @@
.. _info_quickstart:
***********************
@@ -33,15 +32,13 @@ The Blender/Python API **can't** (yet)...
Before Starting
===============
This document isn't intended to fully cover each topic.
Rather, its purpose is to familiarize you with Blender Python API.
This document isn't intended to fully cover each topic. Rather, its purpose is to familiarize you with Blender Python API.
A quick list of helpful things to know before starting:
- Blender uses Python 3.x; some online documentation still assumes 2.x.
- The interactive console is great for testing one-liners.
It also has autocompletion so you can inspect the API quickly.
- The interactive console is great for testing one-liners, It also has autocompletion so you can inspect the API quickly.
- Button tool tips show Python attributes and operator names.
- Right clicking on buttons and menu items directly links to API documentation.
- For more examples, the text menu has a templates section where some example operators can be found.
@@ -54,19 +51,15 @@ A quick list of helpful things to know before starting:
Running Scripts
---------------
The two most common ways to execute Python scripts are using the built-in
text editor or entering commands in the Python console.
The two most common ways to execute Python scripts are using the built-in text editor or entering commands in the Python console.
Both the *Text Editor* and *Python Console* are space types you can select from the view header.
Both the **Text Editor** and **Python Console** are space types you can select from the view header.
Rather than manually configuring your spaces for Python development,
you may prefer to use the *Scripting* screen, included default with Blender,
accessible from the top headers screen selector.
Rather then manually configuring your spaces for Python development, you may prefer to use the **Scripting** screen, included default with Blender, accessible from the top headers screen selector.
From the text editor you can open ``.py`` files or paste then from the clipboard, then test using *Run Script*.
From the text editor you can open ``.py`` files or paste then from the clipboard, then test using **Run Script**.
The Python Console is typically used for typing in snippets and for testing to get immediate feedback,
but can also have entire scripts pasted into it.
The Python Console is typically used for typing in snippets and for testing to get immediate feedback, but can also have entire scripts pasted into it.
Scripts can also run from the command line with Blender but to learn Blender/Python this isn't essential.
@@ -80,11 +73,9 @@ Data Access
Accessing DataBlocks
^^^^^^^^^^^^^^^^^^^^
Python accesses Blender's data in the same way as the animation system and user interface;
this implies that any setting that can be changed via a button can also be changed from Python.
Python accesses Blender's data in the same way as the animation system and user interface; this implies that any setting that can be changed via a button can also be changed from Python.
Accessing data from the currently loaded blend file is done with the module :mod:`bpy.data`.
This gives access to library data. For example:
Accessing data from the currently loaded blend file is done with the module :mod:`bpy.data`. This gives access to library data. For example:
>>> bpy.data.objects
<bpy_collection[3], BlendDataObjects>
@@ -101,8 +92,7 @@ About Collections
You'll notice that an index as well as a string can be used to access members of the collection.
Unlike Python's dictionaries, both methods are acceptable;
however, the index of a member may change while running Blender.
Unlike Python's dictionaries, both methods are acceptable; however, the index of a member may change while running Blender.
>>> list(bpy.data.objects)
[bpy.data.objects["Cube"], bpy.data.objects["Plane"]]
@@ -117,10 +107,7 @@ however, the index of a member may change while running Blender.
Accessing Attributes
^^^^^^^^^^^^^^^^^^^^
Once you have a data block, such as a material, object, groups etc.,
its attributes can be accessed much like you would change a setting using the graphical interface.
In fact, the tooltip for each button also displays the Python attribute
which can help in finding what settings to change in a script.
Once you have a data block, such as a material, object, groups etc., its attributes can be accessed much like you would change a setting using the graphical interface. In fact, the tooltip for each button also displays the Python attribute which can help in finding what settings to change in a script.
>>> bpy.data.objects[0].name
'Camera'
@@ -132,8 +119,7 @@ which can help in finding what settings to change in a script.
bpy.data.materials['MyMaterial']
For testing what data to access it's useful to use the "Console", which is its own space type.
This supports auto-complete, giving you a fast way to dig into different data in your file.
For testing what data to access it's useful to use the "Console", which is its own space type. This supports auto-complete, giving you a fast way to dig into different data in your file.
Example of a data path that can be quickly found via the console:
@@ -146,8 +132,7 @@ Example of a data path that can be quickly found via the console:
Data Creation/Removal
^^^^^^^^^^^^^^^^^^^^^
Those of you familiar with other Python API's may be surprised that
new datablocks in the bpy API can't be created by calling the class:
Those of you familiar with other Python API's may be surprised that new datablocks in the bpy API can't be created by calling the class:
>>> bpy.types.Mesh()
Traceback (most recent call last):
@@ -156,8 +141,7 @@ new datablocks in the bpy API can't be created by calling the class:
This is an intentional part of the API design.
The Blender/Python API can't create Blender data that exists outside the main Blender database
(accessed through :mod:`bpy.data`), because this data is managed by Blender (save/load/undo/append... etc).
The Blender/Python API can't create Blender data that exists outside the main Blender database (accessed through :mod:`bpy.data`), because this data is managed by Blender (save/load/undo/append... etc).
Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
@@ -171,10 +155,8 @@ Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
Custom Properties
^^^^^^^^^^^^^^^^^
Python can access properties on any datablock that has an ID
(data that can be linked in and accessed from :mod:`bpy.data`.
When assigning a property, you can make up your own names,
these will be created when needed or overwritten if they exist.
Python can access properties on any datablock that has an ID (data that can be linked in and accessed from :mod:`bpy.data`.
When assigning a property, you can make up your own names, these will be created when needed or overwritten if they exist.
This data is saved with the blend file and copied with objects.
@@ -210,10 +192,8 @@ These properties are valid outside of Python. They can be animated by curves or
Context
-------
While it's useful to be able to access data directly by name or as a list,
it's more common to operate on the user's selection.
The context is always available from ``bpy.context`` and can be used to get the active object, scene,
tool settings along with many other attributes.
While it's useful to be able to access data directly by name or as a list, it's more common to operate on the user's selection.
The context is always available from ``bpy.context`` and can be used to get the active object, scene, tool settings along with many other attributes.
Common-use cases:
@@ -221,9 +201,7 @@ Common-use cases:
>>> bpy.context.selected_objects
>>> bpy.context.visible_bones
Note that the context is read-only.
These values cannot be modified directly,
though they may be changed by running API functions or by using the data API.
Note that the context is read-only. These values cannot be modified directly, though they may be changed by running API functions or by using the data API.
So ``bpy.context.object = obj`` will raise an error.
@@ -231,8 +209,7 @@ But ``bpy.context.scene.objects.active = obj`` will work as expected.
The context attributes change depending on where they are accessed.
The 3D view has different context members than the console,
so take care when accessing context attributes that the user state is known.
The 3D view has different context members than the console, so take care when accessing context attributes that the user state is known.
See :mod:`bpy.context` API reference.
@@ -240,9 +217,7 @@ See :mod:`bpy.context` API reference.
Operators (Tools)
-----------------
Operators are tools generally accessed by the user from buttons, menu items or key shortcuts.
From the user perspective they are a tool but Python can run these with its own settings
through the :mod:`bpy.ops` module.
Operators are tools generally accessed by the user from buttons, menu items or key shortcuts. From the user perspective they are a tool but Python can run these with its own settings through the :mod:`bpy.ops` module.
Examples:
@@ -255,16 +230,14 @@ Examples:
.. note::
The menu item: :menuselection:`Help --> Operator Cheat Sheet`
gives a list of all operators and their default values in Python syntax, along with the generated docs.
The menu item: :menuselection:`Help --> Operator Cheat Sheet` gives a list of all operators and their default values in Python syntax, along with the generated docs.
This is a good way to get an overview of all Blender's operators.
Operator Poll()
^^^^^^^^^^^^^^^
Many operators have a "poll" function which may check that the cursor
is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
Many operators have a "poll" function which may check that the mouse is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
When an operator's poll function fails within Python, an exception is raised.
For example, calling ``bpy.ops.view3d.render_border()`` from the console raises the following error:
@@ -275,8 +248,7 @@ For example, calling ``bpy.ops.view3d.render_border()`` from the console raises
In this case the context must be the 3d view with an active camera.
To avoid using try/except clauses wherever operators are called you can call the operators
own ``poll()`` function to check if it can run in the current context.
To avoid using try/except clauses wherever operators are called you can call the operators own .poll() function to check if it can run in the current context.
.. code-block:: python
@@ -303,8 +275,7 @@ Example Operator
.. literalinclude:: ../../../release/scripts/templates_py/operator_simple.py
Once this script runs, ``SimpleOperator`` is registered with Blender
and can be called from the operator search popup or added to the toolbar.
Once this script runs, ``SimpleOperator`` is registered with Blender and can be called from the operator search popup or added to the toolbar.
To run the script:
@@ -314,23 +285,19 @@ To run the script:
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
#. Press :kbd:`Ctrl-V` to paste the code into the text panel (the upper left frame).
#. Click on the button **Run Script**.
#. Move your cursor into the 3D view, press spacebar for the operator search menu, and type "Simple".
#. Move your mouse into the 3D view, press spacebar for the operator search menu, and type "Simple".
#. Click on the "Simple Operator" item found in search.
.. seealso:: The class members with the ``bl_`` prefix are documented in the API
reference :class:`bpy.types.Operator`
.. note::
The output from the ``main`` function is sent to the terminal;
in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
.. note:: The output from the ``main`` function is sent to the terminal; in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
Example Panel
-------------
Panels register themselves as a class, like an operator.
Notice the extra ``bl_`` variables used to set the context they display in.
Panels register themselves as a class, like an operator. Notice the extra ``bl_`` variables used to set the context they display in.
.. literalinclude:: ../../../release/scripts/templates_py/ui_panel_simple.py
@@ -367,8 +334,7 @@ Blender's Python API can be split up into 3 categories.
Native Types
------------
In simple cases returning a number or a string as a custom type would be cumbersome,
so these are accessed as normal Python types.
In simple cases returning a number or a string as a custom type would be cumbersome, so these are accessed as normal Python types.
- Blender float/int/boolean -> float/int/boolean
- Blender enumerator -> string
@@ -393,8 +359,7 @@ Used for Blender datablocks and collections: :class:`bpy.types.bpy_struct`
For data that contains its own attributes groups/meshes/bones/scenes... etc.
There are 2 main types that wrap Blenders data, one for datablocks
(known internally as ``bpy_struct``), another for properties.
There are 2 main types that wrap Blenders data, one for datablocks (known internally as ``bpy_struct``), another for properties.
>>> bpy.context.object
bpy.data.objects['Cube']
@@ -410,9 +375,7 @@ Mathutils Types
Used for vectors, quaternion, eulers, matrix and color types, accessible from :mod:`mathutils`
Some attributes such as :class:`bpy.types.Object.location`,
:class:`bpy.types.PoseBone.rotation_euler` and :class:`bpy.types.Scene.cursor_location`
can be accessed as special math types which can be used together and manipulated in various useful ways.
Some attributes such as :class:`bpy.types.Object.location`, :class:`bpy.types.PoseBone.rotation_euler` and :class:`bpy.types.Scene.cursor_location` can be accessed as special math types which can be used together and manipulated in various useful ways.
Example of a matrix, vector multiplication:
@@ -447,9 +410,7 @@ Animation
There are 2 ways to add keyframes through Python.
The first is through key properties directly, which is similar to inserting a keyframe from the button as a user.
You can also manually create the curves and keyframe data, then set the path to the property.
Here are examples of both methods.
The first is through key properties directly, which is similar to inserting a keyframe from the button as a user. You can also manually create the curves and keyframe data, then set the path to the property. Here are examples of both methods.
Both examples insert a keyframe on the active object's Z axis.

View File

@@ -1,12 +1,10 @@
***************
Tips and Tricks
***************
Here are various suggestions that you might find useful when writing scripts.
Some of these are just Python features that scripters may not have thought to use with Blender,
others are Blender specific.
Some of these are just python features that scripters may not have thought to use with blender, others are blender specific.
.. _use_the_terminal:
@@ -14,21 +12,18 @@ others are Blender specific.
Use The Terminal
================
When writing Python scripts, it's useful to have a terminal open,
this is not the built-in Python console but a terminal application which is used to start Blender.
When writing python scripts, it's useful to have a terminal open, this is not the built-in python console but a terminal application which is used to start blender.
There are 3 main uses for the terminal, these are:
- You can see the output of ``print()`` as your script runs, which is useful to view debug info.
- The error trace-back is printed in full to the terminal which won't always generate an error popup in
Blender's user interface (depending on how the script is executed).
- If the script runs for too long or you accidentally enter an infinite loop,
:kbd:`Ctrl-C` in the terminal (:kbd:`Ctrl-Break` on Windows) will quit the script early.
* You can see the output of ``print()`` as your script runs, which is useful to view debug info.
* The error trace-back is printed in full to the terminal which won't always generate an error popup in blender's user interface (depending on how the script is executed).
* If the script runs for too long or you accidentally enter an infinite loop, Ctrl+C in the terminal (Ctrl+Break on Windows) will quit the script early.
.. note::
For Linux and OSX users this means starting the terminal first, then running Blender from within it.
On Windows the terminal can be enabled from the help menu.
For Linux and OSX users this means starting the terminal first, then running blender from within it. On Windows the terminal can be enabled from the help menu.
Interface Tricks
@@ -38,56 +33,43 @@ Interface Tricks
Access Operator Commands
------------------------
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops.[...])`` command
to run that button, a handy (hidden) feature is that you can press :kbd:`Ctrl-C` over
any menu item/button to copy this command into the clipboard.
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops``... command to run that button, a handy (hidden) feature is that you can press Ctrl+C over any menu item/button to copy this command into the clipboard.
Access Data Path
----------------
To find the path from an :class:`ID` datablock to its setting isn't always so simple since it may be nested away.
To get this quickly you can right click on the setting and select select **Copy Data Path**,
To find the path from an :class:`ID` datablock to its setting isn't always so simple since it may be nested away. To get this quickly you can right click on the setting and select select **Copy Data Path**,
if this can't be generated, only the property name is copied.
.. note::
This uses the same method for creating the animation path used by
:class:`bpy.types.FCurve.data_path` and
:class:`bpy.types.DriverTarget.data_path` drivers.
This uses the same method for creating the animation path used by :class:`bpy.types.FCurve.data_path` and :class:`bpy.types.DriverTarget.data_path` drivers.
.. _info_show_all_operators:
.. _info_show_all_operators
Show All Operators
==================
While Blender logs operators in the Info space,
this only reports operators with the ``REGISTER`` option enabeld so as not to flood the *Info* view
with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
While blender logs operators in the Info space, this only reports operators with the ``REGISTER`` option enabeld so as not to flood the Info view with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
However, for testing it can be useful to see **every** operator called in a terminal,
do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting Blender
or by setting :mod:`bpy.app.debug_wm` to ``True`` while Blender is running.
However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting blender or by setting :mod:`bpy.app.debug_wm` to True while blender is running.
Use an External Editor
======================
Blenders text editor is fine for small changes and writing tests but its not full featured,
for larger projects you'll probably want to use a standalone editor or Python IDE.
Blenders text editor is fine for small changes and writing tests but its not full featured, for larger projects you'll probably want to use a standalone editor or python IDE.
Editing a text file externally and having the same text open in Blender does work but isn't that optimal
so here are 2 ways you can easily use an external file from Blender.
Using the following examples you'll still need textblock in Blender to execute,
but reference an external file rather than including it directly.
Editing a text file externally and having the same text open in blender does work but isn't that optimal so here are 2 ways you can easily use an external file from blender.
Using the following examples you'll still need textblock in blender to execute, but reference an external file rather then including it directly.
Executing External Scripts
--------------------------
This is the equivalent to running the script directly, referencing a scripts path from a 2 line text-block.
This is the equivalent to running the script directly, referencing a scripts path from a 2 line textblock.
.. code-block:: python
@@ -114,23 +96,18 @@ This example shows loading a script in as a module and executing a module functi
.. code-block:: python
import myscript
import importlib
import imp
importlib.reload(myscript)
imp.reload(myscript)
myscript.main()
Notice that the script is reloaded every time, this forces use of the modified version,
otherwise the cached one in ``sys.modules`` would be used until Blender was restarted.
Notice that the script is reloaded every time, this forces use of the modified version, otherwise the cached one in ``sys.modules`` would be used until blender was restarted.
The important difference between this and executing the script directly is it
has to call a function in the module, in this case ``main()`` but it can be any function,
an advantage with this is you can pass arguments to the function from this
small script which is often useful for testing different settings quickly.
The important difference between this and executing the script directly is it has to call a function in the module, in this case ``main()`` but it can be any function, an advantage with this is you can pass arguments to the function from this small script which is often useful for testing different settings quickly.
The other issue with this is the script has to be in Pythons module search path.
While this is not best practice - for testing you can extend the search path,
this example adds the current blend files directory to the search path, then loads the script as a module.
The other issue with this is the script has to be in pythons module search path.
While this is not best practice - for testing you can extend the search path, this example adds the current blend files directory to the search path, then loads the script as a module.
.. code-block:: python
@@ -143,94 +120,79 @@ this example adds the current blend files directory to the search path, then loa
sys.path.append(blend_dir)
import myscript
import importlib
importlib.reload(myscript)
import imp
imp.reload(myscript)
myscript.main()
Don't Use Blender!
==================
While developing your own scripts Blenders interface can get in the way,
manually reloading, running the scripts, opening file import etc. adds overhead.
While developing your own scripts blenders interface can get in the way, manually reloading, running the scripts, opening file import etc. adds overhead.
For scripts that are not interactive it can end up being more efficient not to use
Blenders interface at all and instead execute the script on the command line.
For scripts that are not interactive it can end up being more efficient not to use blenders interface at all and instead execute the script on the command line.
.. code-block:: sh
.. code-block:: python
blender --background --python myscript.py
You might want to run this with a blend file so the script has some data to operate on.
.. code-block:: sh
.. code-block:: python
blender myscene.blend --background --python myscript.py
.. note::
Depending on your setup you might have to enter the full path to the Blender executable.
Depending on your setup you might have to enter the full path to the blender executable.
Once the script is running properly in background mode, you'll want to check the output of the script,
this depends completely on the task at hand however here are some suggestions.
Once the script is running properly in background mode, you'll want to check the output of the script, this depends completely on the task at hand however here are some suggestions.
- render the output to an image, use an image viewer and keep writing over the same image each time.
- save a new blend file, or export the file using one of Blenders exporters.
- if the results can be displayed as text - print them or write them to a file.
* render the output to an image, use an image viewer and keep writing over the same image each time.
* save a new blend file, or export the file using one of blenders exporters.
* if the results can be displayed as text - print them or write them to a file.
While this can take a little time to setup, it can be well worth the effort
to reduce the time it takes to test changes - you can even have
Blender running the script every few seconds with a viewer updating the results,
so no need to leave your text editor to see changes.
This can take a little time to setup, but it can be well worth the effort to reduce the time it takes to test changes - you can even have blender running the script ever few seconds with a viewer updating the results, so no need to leave your text editor to see changes.
Use External Tools
==================
When there are no readily available Python modules to perform specific tasks it's
worth keeping in mind you may be able to have Python execute an external command
on your data and read the result back in.
When there are no readily available python modules to perform specific tasks it's worth keeping in mind you may be able to have python execute an external command on your data and read the result back in.
Using external programs adds an extra dependency and may limit who can use the script
but to quickly setup your own custom pipeline or writing one-off scripts this can be handy.
Using external programs adds an extra dependency and may limit who can use the script but to quickly setup your own custom pipeline or writing one-off scripts this can be handy.
Examples include:
- Run The Gimp in batch mode to execute custom scripts for advanced image processing.
- Write out 3D models to use external mesh manipulation tools and read back in the results.
- Convert files into recognizable formats before reading.
* Run The Gimp in batch mode to execute custom scripts for advanced image processing.
* Write out 3D models to use external mesh manipulation tools and read back in the results.
* Convert files into recognizable formats before reading.
Bundled Python & Extensions
===========================
The Blender releases distributed from blender.org include a complete Python installation on all platforms,
this has the disadvantage that any extensions you have installed in your systems Python wont be found by Blender.
The Blender releases distributed from blender.org include a complete python installation on all platforms, this has the disadvantage that any extensions you have installed in your systems python wont be found by blender.
There are 2 ways around this:
- remove Blender Python sub-directory, Blender will then fallback on the systems Python and use that instead
.. warning::
* remove blender python sub-directory, blender will then fallback on the systems python and use that instead **python version must match the one that blender comes with**.
The Python version must match the one that Blender comes with.
- copy the extensions into Blender's Python sub-directory so Blender can access them,
you could also copy the entire Python installation into Blenders sub-directory,
replacing the one Blender comes with.
This works as long as the Python versions match and the paths are created in the same relative locations.
Doing this has the advantage that you can redistribute this bundle to others with Blender and/or the game player,
including any extensions you rely on.
* copy the extensions into blender's python sub-directory so blender can access them, you could also copy the entire python installation into blenders sub-directory, replacing the one blender comes with. This works as long as the python versions match and the paths are created in the same relative locations. Doing this has the advantage that you can redistribute this bundle to others with blender and/or the game player, including any extensions you rely on.
Drop Into a Python Interpreter in Your Script
=============================================
In the middle of a script you may want to inspect some variables,
run some function and generally dig about to see whats going on.
In the middle of a script you may want to inspect some variables, run some function and generally dig about to see whats going on.
.. code-block:: python
@@ -255,13 +217,10 @@ The next example is an equivalent single line version of the script above which
__import__('code').interact(local=dict(globals(), **locals()))
``code.interact`` can be added at any line in the script
and will pause the script an launch an interactive interpreter in the terminal,
when you're done you can quit the interpreter and the script will continue execution.
``code.interact`` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution.
If you have **IPython** installed you can use its ``embed()`` function which uses the current namespace.
The IPython prompt has auto-complete and some useful features that the standard Python eval-loop doesn't have.
If you have **IPython** installed you can use their ``embed()`` function which will implicitly use the current namespace, this has autocomplete and some useful features that the standard python eval-loop doesn't have.
.. code-block:: python
@@ -269,7 +228,7 @@ The IPython prompt has auto-complete and some useful features that the standard
IPython.embed()
Admittedly this highlights the lack of any Python debugging support built into Blender, but its still handy to know.
Admittedly this highlights the lack of any python debugging support built into blender, but its still handy to know.
.. note::
@@ -283,32 +242,27 @@ Advanced
Blender as a module
-------------------
From a Python perspective it's nicer to have everything as an extension
which lets the Python script combine many components.
From a python perspective it's nicer to have everything as an extension which lets the python script combine many components.
Advantages include:
- you can use external editors/IDE's with Blenders Python API and execute scripts within the IDE
(step over code, inspect variables as the script runs).
- editors/IDE's can auto complete Blender modules & variables.
- existing scripts can import Blender API's without having to run inside Blender.
* you can use external editors/IDE's with blenders python API and execute scripts within the IDE (step over code, inspect variables as the script runs).
* editors/IDE's can auto complete blender modules & variables.
* existing scripts can import blender API's without having to run inside blender.
This is marked advanced because to run Blender as a Python module requires a special build option.
This is marked advanced because to run blender as a python module requires a special build option.
For instructions on building see
`Building Blender as a Python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
For instructions on building see `Building blender as a python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
Python Safety (Build Option)
----------------------------
Since it's possible to access data which has been removed (see Gotcha's),
this can be hard to track down the cause of crashes.
Since it's possible to access data which has been removed (see Gotcha's), this can be hard to track down the cause of crashes.
To raise Python exceptions on accessing freed data (rather than crashing),
enable the CMake build option ``WITH_PYTHON_SAFETY``.
This enables data tracking which makes data access about 2x slower
which is why the option isn't enabled in release builds.
To raise python exceptions on accessing freed data (rather then crashing), enable the CMake build option WITH_PYTHON_SAFETY.
This enables data tracking which makes data access about 2x slower which is why the option is not enabled in release builds.

View File

@@ -208,7 +208,6 @@ The objects should move as before.
*Keep this addon open in Blender for the next step - Installing.*
Install The Addon
-----------------
@@ -222,11 +221,10 @@ restrictions that apply to Python modules and end with a ``.py`` extension.
Once the file is on disk, you can install it as you would for an addon downloaded online.
Open the user :menuselection:`File -> User Preferences`,
Select the *Addon* section, press *Install Addon...* and select the file.
Open the user **File -> User Preferences**, Select the **Addon** section, press **Install Addon...** and select the file.
Now the addon will be listed and you can enable it by pressing the check-box,
if you want it to be enabled on restart, press *Save as Default*.
Now the addon will be listed and you can enable it by pressing the check-box, if you want it to be enabled on restart,
press **Save as Default**.
.. note::
@@ -240,7 +238,7 @@ if you want it to be enabled on restart, press *Save as Default*.
print(addon_utils.paths())
More is written on this topic here:
`Directory Layout <https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`_
`Directory Layout <http://wiki.blender.org/index.php/Doc:2.6/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
Your Second Addon

View File

@@ -163,9 +163,6 @@ def main():
for i, l in enumerate(b):
l = l.strip()
# casts
l = l.replace("(int)", "")
l = l.replace("{", "(")
l = l.replace("}", ")")

View File

@@ -234,7 +234,6 @@ else:
EXCLUDE_MODULES = [
"aud",
"bge",
"bge.app"
"bge.constraints",
"bge.events",
"bge.logic",
@@ -261,10 +260,8 @@ else:
"bpy.utils.previews",
"bpy_extras",
"gpu",
"gpu.offscreen",
"mathutils",
"mathutils.geometry",
"mathutils.bvhtree",
"mathutils.kdtree",
"mathutils.noise",
"freestyle",
@@ -473,18 +470,6 @@ else:
_BPY_PROP_COLLECTION_ID = "collection"
def escape_rst(text):
""" Escape plain text which may contain characters used by RST.
"""
return text.translate(escape_rst.trans)
escape_rst.trans = str.maketrans({
"`": "\\`",
"|": "\\|",
"*": "\\*",
"\\": "\\\\",
})
def is_struct_seq(value):
return isinstance(value, tuple) and type(tuple) != tuple and hasattr(value, "n_fields")
@@ -645,7 +630,7 @@ def pyfunc2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_cla
if type(py_func) == MethodType:
return
arg_str = inspect.formatargspec(*inspect.getfullargspec(py_func))
arg_str = inspect.formatargspec(*inspect.getargspec(py_func))
if not is_class:
func_type = "function"
@@ -1152,7 +1137,7 @@ def pycontext2sphinx(basepath):
def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
""" write a bullet point list of enum + descriptions
""" write a bullet point list of enum + descrptons
"""
if use_empty_descriptions:
@@ -1167,7 +1152,7 @@ def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
if ok:
return "".join(["* ``%s`` %s.\n" %
(identifier,
", ".join(escape_rst(val) for val in (name, description) if val),
", ".join(val for val in (name, description) if val),
)
for identifier, name, description in prop.enum_items
])
@@ -1613,7 +1598,7 @@ def write_rst_contents(basepath):
fw("\n")
# fw("`A PDF version of this document is also available <%s>`_\n" % BLENDER_PDF_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files) <%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("`A compressed ZIP file of this site is available <%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("\n")
@@ -1658,11 +1643,9 @@ def write_rst_contents(basepath):
standalone_modules = (
# mathutils
"mathutils", "mathutils.geometry", "mathutils.bvhtree", "mathutils.kdtree", "mathutils.noise",
"mathutils", "mathutils.geometry", "mathutils.kdtree", "mathutils.noise",
# misc
"freestyle", "bgl", "blf",
"gpu", "gpu.offscreen",
"aud", "bpy_extras",
"freestyle", "bgl", "blf", "gpu", "aud", "bpy_extras",
# bmesh, submodules are in own page
"bmesh",
)
@@ -1686,7 +1669,6 @@ def write_rst_contents(basepath):
fw(" bge.texture.rst\n\n")
fw(" bge.events.rst\n\n")
fw(" bge.constraints.rst\n\n")
fw(" bge.app.rst\n\n")
# rna generated change log
fw(title_string("API Info", "=", double=True))
@@ -1802,7 +1784,6 @@ def write_rst_importable_modules(basepath):
# C_modules
"aud" : "Audio System",
"blf" : "Font Drawing",
"gpu.offscreen" : "GPU Off-Screen Buffer",
"bmesh" : "BMesh Module",
"bmesh.types" : "BMesh Types",
"bmesh.utils" : "BMesh Utilities",
@@ -1813,7 +1794,6 @@ def write_rst_importable_modules(basepath):
"bpy.props" : "Property Definitions",
"mathutils" : "Math Types & Utilities",
"mathutils.geometry" : "Geometry Utilities",
"mathutils.bvhtree" : "BVHTree Utilities",
"mathutils.kdtree" : "KDTree Utilities",
"mathutils.noise" : "Noise Utilities",
"freestyle" : "Freestyle Module",
@@ -1845,7 +1825,6 @@ def copy_handwritten_rsts(basepath):
"bge.texture",
"bge.events",
"bge.constraints",
"bge.app",
"bgl", # "Blender OpenGl wrapper"
"gpu", # "GPU Shader Module"

View File

@@ -18,10 +18,8 @@ DO_OUT_HTML=true
DO_OUT_HTML_ZIP=true
DO_OUT_PDF=false
if [ -z $BLENDER_BIN ] ; then
BLENDER_BIN="./blender.bin"
fi
BLENDER="./blender.bin"
SSH_USER=$1
SSH_HOST=$SSH_USER"@blender.org"
SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after
@@ -54,7 +52,7 @@ SPHINXBASE=doc/python_api
if $DO_EXE_BLENDER ; then
# dont delete existing docs, now partial updates are used for quick builds.
$BLENDER_BIN --background -noaudio --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py
$BLENDER --background -noaudio --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py
fi

View File

@@ -29,7 +29,6 @@ remove_strict_flags()
add_subdirectory(rangetree)
add_subdirectory(wcwidth)
add_subdirectory(libmv)
add_subdirectory(Eigen3)
if(WITH_OPENNL)
add_subdirectory(colamd)
@@ -78,7 +77,7 @@ if(WITH_LZMA)
add_subdirectory(lzma)
endif()
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
if(WITH_CYCLES OR WITH_COMPOSITOR)
add_subdirectory(clew)
add_subdirectory(cuew)
endif()

View File

@@ -1,70 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Blender Foundation,
* Bastien Montagne
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __EIGEN3_EIGENVALUES_C_API_CC__
#define __EIGEN3_EIGENVALUES_C_API_CC__
/* Eigen gives annoying huge amount of warnings here, silence them! */
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wlogical-op"
#endif
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include "eigenvalues.h"
using Eigen::SelfAdjointEigenSolver;
using Eigen::MatrixXf;
using Eigen::VectorXf;
using Eigen::Map;
using Eigen::Success;
bool EG3_self_adjoint_eigen_solve(const int size, const float *matrix, float *r_eigen_values, float *r_eigen_vectors)
{
SelfAdjointEigenSolver<MatrixXf> eigen_solver;
/* Blender and Eigen matrices are both column-major. */
eigen_solver.compute(Map<MatrixXf>((float *)matrix, size, size));
if (eigen_solver.info() != Success) {
return false;
}
if (r_eigen_values) {
Map<VectorXf>(r_eigen_values, size) = eigen_solver.eigenvalues().transpose();
}
if (r_eigen_vectors) {
Map<MatrixXf>(r_eigen_vectors, size, size) = eigen_solver.eigenvectors();
}
return true;
}
#endif /* __EIGEN3_EIGENVALUES_C_API_CC__ */

View File

@@ -1,72 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Blender Foundation,
* Bastien Montagne
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __EIGEN3_SVD_C_API_CC__
#define __EIGEN3_SVD_C_API_CC__
/* Eigen gives annoying huge amount of warnings here, silence them! */
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wlogical-op"
#endif
#include <Eigen/Core>
#include <Eigen/SVD>
#include "svd.h"
using Eigen::JacobiSVD;
using Eigen::NoQRPreconditioner;
using Eigen::ComputeThinU;
using Eigen::ComputeThinV;
using Eigen::MatrixXf;
using Eigen::VectorXf;
using Eigen::Map;
void EG3_svd_square_matrix(const int size, const float *matrix, float *r_U, float *r_S, float *r_V)
{
/* Since our matrix is squared, we can use thinU/V. */
unsigned int flags = (r_U ? ComputeThinU : 0) | (r_V ? ComputeThinV : 0);
/* Blender and Eigen matrices are both column-major. */
JacobiSVD<MatrixXf, NoQRPreconditioner> svd(Map<MatrixXf>((float *)matrix, size, size), flags);
if (r_U) {
Map<MatrixXf>(r_U, size, size) = svd.matrixU();
}
if (r_S) {
Map<VectorXf>(r_S, size) = svd.singularValues();
}
if (r_V) {
Map<MatrixXf>(r_V, size, size) = svd.matrixV();
}
}
#endif /* __EIGEN3_SVD_C_API_CC__ */

3
extern/SConscript vendored
View File

@@ -11,7 +11,6 @@ SConscript(['colamd/SConscript'])
SConscript(['rangetree/SConscript'])
SConscript(['wcwidth/SConscript'])
SConscript(['libmv/SConscript'])
SConscript(['Eigen3/SConscript'])
if env['WITH_BF_GAMEENGINE']:
SConscript(['recastnavigation/SConscript'])
@@ -25,7 +24,7 @@ if env['WITH_BF_ELTOPO']:
if env['WITH_BF_BULLET']:
SConscript(['bullet2/src/SConscript'])
if env['WITH_BF_COMPOSITOR'] or env['WITH_BF_CYCLES'] or env['WITH_BF_OPENSUBDIV']:
if env['WITH_BF_COMPOSITOR'] or env['WITH_BF_CYCLES']:
SConscript (['clew/SConscript'])
SConscript (['cuew/SConscript'])

View File

@@ -78,13 +78,13 @@ extern "C" {
#define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#define CL_API_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
#define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
#define CL_API_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK
#define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK
#define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#define CL_API_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
#define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
#define CL_API_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK
#define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK
#else
#define CL_EXTENSION_WEAK_LINK
#define CL_API_SUFFIX__VERSION_1_0
@@ -2484,7 +2484,7 @@ PFNCLCREATEFROMGLTEXTURE3D)(cl_context /* context */,
#ifdef __APPLE__
# pragma GCC diagnostic pop // ignored "-Wignored-attributes"
#endif
/* cl_khr_gl_sharing extension */
#define cl_khr_gl_sharing 1
@@ -2781,7 +2781,7 @@ CLEW_FUN_EXPORT PFNCLGETGLCONTEXTINFOKHR __clewGetGLContextInfoKH
#define CLEW_ERROR_ATEXIT_FAILED -2 //!< Error code for failing to queue the closing of the dynamic library to atexit()
//! \brief Load OpenCL dynamic library and set function entry points
int clewInit (void);
int clewInit ();
//! \brief Convert an OpenCL error code to its string equivalent
const char* clewErrorString (cl_int error);

View File

@@ -378,15 +378,5 @@ const char* clewErrorString(cl_int error)
, "CL_INVALID_DEVICE_PARTITION_COUNT" // -68
};
static const int num_errors = sizeof(strings) / sizeof(strings[0]);
if (error == -1001) {
return "CL_PLATFORM_NOT_FOUND_KHR";
}
if (error > 0 || -error >= num_errors) {
return "Unknown OpenCL error";
}
return strings[-error];
}

View File

@@ -6,9 +6,7 @@ Import('env')
sources = ['src/glew.c']
defs = []
defs += env['BF_GL_DEFINITIONS']
defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_GLEW_MX']:
defs += ['GLEW_MX']
incs = ['include']

Some files were not shown because too many files have changed in this diff Show More