Compare commits

..

742 Commits

Author SHA1 Message Date
Julian Eisel
8d09ca96a7 Some tweaks for introduction of draw-styles 2015-08-15 01:56:54 +02:00
Julian Eisel
d693aa3590 Merge branch 'master' into temp-ui-widget-refactor
Conflicts:
	source/blender/editors/interface/interface_widgets.c
2015-08-15 01:00:03 +02:00
Julian Eisel
119cda0a0d Cleanup: Avoid calling function twice
Own stupidness from rB17422124eca332
2015-08-14 22:23:06 +02:00
Julian Eisel
9b729adb6e Remove redundant workaround for T41548
Reverts 7a026971dc which isn't needed anymore after b347f523cececdf
2015-08-14 22:23:06 +02:00
Julian Eisel
d9a720a709 Fix T45750: Closing search menu by clicking root button doesn't work when clicking on lower half 2015-08-14 22:23:06 +02:00
fa86efdc97 Fix T40070, Bevel didn't bend as expected sometimes.
Two problems fixed. One, the comparison of angles to
'almost straight' or 'almost zero' needed a bigger epsilon.
Two, using the corner normal instead of the average face normal
is usually the right thing to do, and what the code was doing,
but in some cases the corner normal could be very wrong.
2015-08-14 15:51:27 -04:00
18648bef7b Fix dyntopo not warning anymore when vertex colors or uvs are present.
We check against loop data now, not tessface data
2015-08-14 17:11:31 +02:00
Julian Eisel
5fafd493c2 Fix unnecessarily added undo steps when deleting only scene
Steps to reproduce were: startup.blend, move any object, delete active scene (nothing happens), undo (nothing happens), second undo is needed to revert object transformation
2015-08-14 15:54:58 +02:00
a662980f31 Remove already-ifdef'ed out PRE_275_ALGORITHM code from bevel.
The new algorithm has soaked enough that we are unlikely to go back now.
2015-08-14 09:46:49 -04:00
d94137ee7d Outliner: Context menu for scenes
Adds context menu for scenes in the outliner, for now, with only a 'Delete' entry.

D1448 by @lichtwerk, review by @aligorith and @Severin
2015-08-14 15:22:52 +02:00
8b286bf35a Cleanup: style 2015-08-14 17:46:26 +10:00
fdfd87f2f4 Docs: comment BHead.code values 2015-08-14 17:40:55 +10:00
3fa0a1a5bc Add real boundbox support to lattice, and update armature one.
* draw lattice boundingboxes in 3dView [if "show_bounds" is used -- an option previously pretty useless for lattices]
* give proper values for lattice objects ".bound_box" in bpy
* give proper values for armature objects ".bound_box" in bpy
* lets users use "Dimensions" [in 3dView Transform panel] on lattices and armatures
* remove redundant calculations in "boundbox_armature()"

Armatures boundingboxes were already drawn in 3dView, if "show_bounds" was used.

Based on report T45735: Lattice's bounding_box doesn't update,
and a comment in code by @campbellbarton ("later we may want to add dimensions for lattice, armature etc too").

Revision: https://developer.blender.org/D1460
2015-08-13 18:12:08 +02:00
d2383ec6c0 Fix T45783: Problem selecting all objects on a layer from a script if any 3d view is in local mode.
Do not take into account lay bits used for local view, when doing exact match.
2015-08-13 14:25:26 +02:00
828710d2ac Fix T45782: bpy.ops.object.select_by_layer match='SHARED' option is not working.
Looks like some half-done change from enum to bool (or vice-versa), that op was just broken!
2015-08-13 13:18:45 +02:00
c62eb919ec Fix T45775: Bad 'Normal' transform space for edge of non-uniformed scaled object.
Non-uniform scaled obmat will lead to transformation not preserving angles, so
we must ensure our normal is orthogonal to the edge **after** applying obmat.
2015-08-13 12:45:13 +02:00
487d2cb4f3 Displace Modifier: add an option to displace along (averaged) custom normals, instead of vertex normals.
User suggestion/request from 'boby'.
2015-08-12 18:21:41 +02:00
883b420a51 Fix T45739: Number slider precision handling inconsistent between unit systems.
When using unit system, step was multiplied by 100, could really not find any good reason to that.
Easy to revert anyway if needed, but in this case please explain why in code. ;)

Investigated and patch by Thomas Radeke (ThomasR), thanks.
2015-08-12 16:43:41 +02:00
39ce0a9916 Fix T44049, edge bevel with sometimes breaks UVs.
Fairly large changes to bevel code to do a better job
of keeping UVs from crossing islands, etc.
Updated http://wiki.blender.org/index.php/Dev:2.5/Source/Modeling/Bevel
to explain algorithm used for maintaining UVs.
Updated the bevel_regression.blend tests in lib tests.
2015-08-12 10:18:58 -04:00
4eefba091d Fix 'hard crash' part of T45768 (when merging all vertices of a mesh, we have no more edges to draw). 2015-08-12 11:42:35 +02:00
8a2371e408 Usual UI message cleanup/fixes. 2015-08-11 22:29:16 +02:00
253ee0b490 install_deps: fix broken force/skip-osd options.
Bash scripts are such a PITA, having to redefine the options in three different places... :(
2015-08-11 22:08:01 +02:00
b36c6b9c47 BGE: Fix delete constraint for replicated physics controllers.
Replicated controllers didn't free constraints list before.
2015-08-11 21:49:54 +02:00
d22153425a Cycles: Enable some extra debug prints for OpenCL kernel loading 2015-08-11 18:03:54 +02:00
a790e172d0 BGE: Fix T38448: Bullet constraint memory leak. 2015-08-11 13:02:17 +02:00
10dbe966e1 Add WM_event_add/remove_timer_notifier() helpers.
This basically does the 'timer' part of Jobs system: it sends a given notifier on every timer step.

This is needed for background tasks (not full-fledged jobs, lighter BLI_tasks based) that want to update UI
(like for up-comming new thumbnail handling in filebrowser).
2015-08-11 12:11:48 +02:00
bccc6c393c BGE: Fix T33187 constraints replication for libloaded objects.
Reviewers: Moguri
2015-08-11 11:30:23 +02:00
c1506454ec UI drag&drop: make code able to free dragpoin if needed.
Only for image and strings for now. Needed for incomming filebrowser work.
2015-08-10 18:01:11 +02:00
8d37aaeca1 Data previews: add utils to generate/clear previews.
Not much to add, you can now clear previews from current .blend file, or a set of non-opened files.
Likewise, you can generate previews (for mat/tex, objects, groups, scenes, ...).
2015-08-10 17:45:16 +02:00
8f837e0ac5 BGE: Fix T33564: UI obstacle panel disable for character and no collision objects. 2015-08-10 17:32:09 +02:00
7b467a6fea Cycles: Fix for typo in previous commit 2015-08-10 17:24:14 +02:00
3c77822f96 BGE: Fix T19377 restore dynamics after unparenting object.
Reviewers: scorpion81
2015-08-10 17:08:11 +02:00
0c82ba4213 Data previews: add preview to Object, Group and Scene.
This commit does not add anything yet to users, it’s purely internal one.
Useful commit is next. ;)
2015-08-10 15:41:28 +02:00
d70ffd375f BLI_threads: add an helper to wait on a condition using a global mutex.
Also, factorized internal code to get global mutex from its ID.
2015-08-10 15:03:31 +02:00
c6d13716c1 Install_deps: add basic listing of needed dependencies to error message for unsupported distro. 2015-08-10 13:09:57 +02:00
65c3207517 BGE: Fix T44782 suspend/restore dynamics on inactive object. 2015-08-09 19:17:24 +02:00
49f3998a0f Install_deps: add (non-tested) OSD-building code.
Not tested for fedora-like and arch distro, would expect it to work though. Please report otherwise.

Also, always inatll git now (and a few other XOrg -dev packages).
2015-08-09 15:58:53 +02:00
64dc38f089 install_deps: Add libxcursor packages, seems to be needed now? 2015-08-09 15:42:27 +02:00
ded665a2c9 Compile fix cycles network. This code is crusty and not super
functional. But is should compile.
2015-08-09 15:31:32 +02:00
Dalai Felinto
63265fd0c3 Cycles: Follow up on cc0bbc28 (Collapse multiview panel) 2015-08-09 00:25:34 -03:00
d9fc9882dc Optimize reading of fcurves
Reading fcurves wasn't really optimal because restoring fcu->group pointer was
changing lasthit pointer, which required full lookup over the oldnewmap happened
at the next call to newdatadr().

This reduces loading franck_sheep.blend file from ~2.2sec to 1.5sec.
2015-08-08 22:17:03 +02:00
cc0bbc28e2 Collapse multiview panel in render layers by default
This is not so much common panel to access to and having it fully
visible just adds clutterness in cases when one only need to work
with render passes.
2015-08-08 20:55:51 +02:00
f4ba4c6826 Fix for SeqCache hash ignoring multi-view
Thanks to @chadf for finding
2015-08-09 13:53:36 +10:00
115c867190 Fix: opening missing file didnt remove in recent-files.txt
Refactor recent-file.txt handling, split into smaller functions.
It wasn't possible to write the current state to disk (depended on current context).
2015-08-09 13:12:21 +10:00
281f4eb964 SPeedup for particle point cache reading
Order of saving and reading particle point cache was totally different which
made newdataadr() falling back to full data block list traversal for every
point cache entry.

This commit makes it so reading code uses the same order of reading structs
and lists ad the writing code. This required to add special version of list
linking which is capable of running a callback after linking a list element.
This seems to be more robust approach than splitting writing code into
several loops.
2015-08-08 19:54:20 +02:00
Dalai Felinto
e1cea53066 Fix T45705: Selected to Active Cycles Baking no longer working 2015-08-08 14:40:41 -03:00
a9f6b27281 Use polygon normals for baking 2015-08-09 11:05:25 +10:00
e229d66e99 Fix crash baking in cycles
Error in recent move to looptri
2015-08-09 08:29:23 +10:00
dbdc55ab6a Support building OpenSubdiv libraries under Debian (Ubuntu) with our build_deps.sh script.
Use --skip-osd to skip building opensubdiv libs,
use --force-osd to force a rebuild of the libs.

I added all needed user information (where to find the include dir, which -D options to set) to the print_info method that is called at the end too, so it should be pretty intuitive to use.

Reviewers: sergey, mont29

Reviewed By: mont29

Subscribers: mont29

Differential Revision: https://developer.blender.org/D1452
2015-08-08 14:12:02 +02:00
Julian Eisel
fef31aadc4 Remove leftover from sticky keys 2015-08-08 02:37:03 +02:00
8af8bab0c5 Fix T45726: Wrong handling of 'failed to generate' audio waveform data in VSE strip draw code. 2015-08-07 23:42:32 +02:00
Dalai Felinto
e96e0ddbee Fix T45715: Blender crashes when creating Environment Map textures in Multi-View mode 2015-08-07 15:46:18 -03:00
Dalai Felinto
58133d4ab2 Fix T45721: Panoramic render in Cycles camera : depth of field issue with bump maps - patch by Brecht Van Lommel 2015-08-07 15:04:12 -03:00
96f20c34a2 Data Transfer operator: Add a 'freeze' setting to prevent operator from re-running when changing settings.
This is likely weak design, but allows people to change several settings without having to wait
several tenth of seconds each time, when e.g. transferring UVs between heavy geometries.
2015-08-07 16:35:39 +02:00
c677bd44ce Fix (unreported) crash in mesh remap (i.e. data transfer).
Issue from rBabbd82a50, loops data were not correctly protected against multi-freeing in bvhtree data.
2015-08-07 16:35:38 +02:00
930fc7d157 Mesh remap: Fix two potential numeric issues in corner cases, and enhance poly projection.
Null-area face could generate an int overflow, and potential numerical imprecision in face area computation
could lead to negative number of rays-to-cast (though highly unlikely).

Also, use domnant axis of poly normal as 'flattening' one, instead of always using Z axis.

Points raised by Campbell, thanks!
2015-08-07 16:35:38 +02:00
c30c3fde51 Attempt to fix T45718, crash when enabling GLSL mode with UV layers.
I can't  reproduce issue here but crash is most likely caused by passing
a NULL pointer to glUniform2fv.

This is caused by OpenSubdiv changes to the codegen module, which pass
mtex layers to the uniform system
even when not needed.

Since Sergey is demoing OpenSubdiv in a few days, I'll
go with the easy fix for now which is just checking for NULL pointer, but
this needs to be fixed properly at some point.
2015-08-07 16:16:23 +02:00
9becee445e Fix scrubbing only treated as animation for sequencer
Intent was to act as animation everywhere
2015-08-07 15:39:32 +02:00
Julian Eisel
20bd253809 Fix T45713: Numselect for confirm popup not working anymore 2015-08-07 14:39:50 +02:00
44384c698d BGe: Fix T45597 wrong object layer for linked object in blenderplayer. 2015-08-06 17:07:26 +02:00
f5a333fe65 Fix: Sliders in animeditors were getting drawn too far left
Sliders in for FCurves in the animation editors were leaving space for
one extra setting that they didn't need to be accounting for (and which
wasn't shown, as it isn't valid for FCurves).
2015-08-07 02:46:38 +12:00
599d8291ad AnimEditors FModifiers toggle: Add a bit more space beside it so that it doesn't seem to collide with the mute toggle 2015-08-07 02:46:37 +12:00
579329388a Fix T45166: Keyframes pasted at wrong position when NLA strip has offset
Paste keyframes code seemed to have overlooked the NLA mapping issue, causing
keyframes to get pasted in the wrong places.
2015-08-07 02:46:37 +12:00
0e80e3d20c No need to count layers to check empty 2015-08-07 00:00:28 +10:00
b9ce21fd0f GPencil UI: Streamline the data panel workflow
Restored the "New Layer" button in the NKEY Grease Pencil panel (as was found
pre-2.73) for two cases:
 1) When no Grease Pencil datablock is active - This shortcut makes it possible to
    add a new layer to start drawing in with a single click again (instead of two
    clicks - one to add a datablock, and a second to add the layer)

 2) When there are no layers - There is no need to display the UI list in this case,
    thus saving a bit more space in the rare cases where this applies.
2015-08-07 01:48:27 +12:00
376e729de0 T44932: Disable pressure handling for "poly" mode too 2015-08-07 01:48:27 +12:00
e660079e47 StopGap Fix for T44932: Ignore pressure values when drawing straight line segments with GPencil
After some testing of the behaviour of this stuff, it became clear that the current
pressure handling here isn't very useful. The initial point would invariably get a
low pressure value (due to the way that the initial tap needs time to "take"), while
the end of the stroke suffers from similar issues (i.e. when the pen is released).
Meanwhile, the line thickness would flicker while drawing the stroke, as the endpoint
pressure varied.

So, until we find a better way, all straight line segments are now drawn without
pressure sensitivity.
2015-08-07 01:48:26 +12:00
c587302ea1 Timeline: Make GPencil keyframes slightly taller than normal keyframes to make them easier to distinguish
This commit makes GPencil keyframes in the timeline slightly taller (80% height
vs 60% height) so that they will not be that easily confused.
2015-08-07 01:48:26 +12:00
03b2bccca8 Remove MFace use w/ fluidsim 2015-08-06 22:33:45 +10:00
8f45e1156f Docs: comment BKE_scene_set_background 2015-08-06 21:03:35 +10:00
2c5efd5b3f Fix typo in cmake when OpenSubdiv is not found 2015-08-06 11:51:18 +02:00
be1a684755 Fix T45695: Assigning material reverts MaterialSlot.link
Setting the material was resetting the link bit, this is OK from the UI,
confusing for scripts.
2015-08-06 18:07:44 +10:00
fa4172c28c OpenSubdiv: Make sure faces are exported with consistent normal
This is currently a requirement of OpenSudiv and original orientation code
was depending on this quite a lot.

This makes mesh conversion and comparison slower but solves some crashes.
With some trickery it could be optimized and become closer to original
performance.

Probably Campbell has some nice ideas here as well :)
2015-08-06 09:49:13 +02:00
ced9381e20 Simplify defvert_remove_group(), use realloc
Patch by @chadf
2015-08-06 16:52:39 +10:00
c2cfec64e3 Cleanup: unused warning 2015-08-06 16:52:28 +10:00
43c756ac95 CMake: AUDASPACE_ROOT_DIR wasn't working 2015-08-06 13:03:07 +10:00
300f33a8ea Cleanup: style (match other find modules) 2015-08-06 13:03:07 +10:00
fdc8b12726 Cleanup: whitespace, unused var 2015-08-06 13:03:07 +10:00
5af7257309 Cleanup: whitespace 2015-08-06 13:03:07 +10:00
89edddb26c Fix T45691 crash on material view
Call glProgramUniform1i only when OpenSubdiv is requested and only when
the GPU supports it.
2015-08-06 01:09:07 +02:00
868d3605ee Fix T45693: Fix for using 4-component vector as 3 component in osd shader 2015-08-05 21:35:38 +02:00
4140312c36 OpenSubdiv: Make sure normals passed to OSD are all up to date
Solves shading artifacts with animated characters.
2015-08-05 19:19:05 +02:00
02f553cc7a OpenSubdiv: Changes to texturing
Use first material slot for until multiple materials are fully supported.

Also respect setMaterial()'s return value to avoid drawing unnecessary
geometry.
2015-08-05 18:29:43 +02:00
9a995c11d3 OpenSubdiv: Initial OsdMesh construction missed clearing out-of-date coords flag 2015-08-05 16:07:32 +02:00
5fe5118845 Cleanup: unused warning 2015-08-05 23:50:22 +10:00
5e050918d8 Fix dereference before NULL check 2015-08-05 23:47:13 +10:00
11bfeb45ce OpenSubdiv: Completely avoid possible access to non-existing CPU data
Make it so CCGDM reports 0 number of geometry when it uses GPU backend for
drawing. This screws up a bit statistics in info header and requires to have
some special handle of CCGDM in the drawing code, but makes it so non of the
areas will try to access non-existing geometry.
2015-08-05 15:11:50 +02:00
6146fdc7b0 OpenSubdiv: Edit mode was not checking for Use OpenSubdiv flag 2015-08-05 14:51:08 +02:00
0208c95986 OpenSubdiv: Correction to previous commit 2015-08-05 14:46:27 +02:00
6cba20a8e6 OpenSubdiv: Tweaks to AABB calculation when using opensubdiv for subsurf
Use coarse coordinates to calculate AABB which gives much better approximation
of AABB than using unity AABB size.
2015-08-05 14:43:51 +02:00
5b76f72904 Mirror modifier: Fix for wrong dependency relations
Mirror modifier was reporting that it depends on geometry of the object
used for mirror center which is incorrect -- only object matrix is needed
for modifier evaluation.
2015-08-05 14:29:18 +02:00
8d179e3c1f OpenSubdiv: Resolve regression with unity AABB for CCGDM calculated on CPU 2015-08-05 14:20:40 +02:00
0ea45676d0 OpenSubdiv: Fix crash happening when disabling Use OpenSubdiv option
The issue was caused by the changes from this morning.
2015-08-05 14:15:46 +02:00
a474409f0b OpenSubdiv: Enable by default on the supported platforms
This commit makes sure Linux and Windows buildbots are using OpenSubdiv
and also enables OpenSubdiv by default on Windows.

OSX is kept disabled still, this is due to OpenGL restrictions which are
not solved in any way yet.

Linux is defaults to OpenSubdiv disabled because it needs precompiled
library.

The documentation could be found there:

  http://wiki.blender.org/index.php/User:Nazg-gul/OpenSubdiv
2015-08-05 13:29:39 +02:00
c54df2ad47 Remove files from recent-files list on failed open 2015-08-05 21:26:10 +10:00
cae25ff240 Fix T45647: Incorrect results w/ color spill node 2015-08-05 21:26:10 +10:00
d4a9da28e8 Doc fix: rather then -> rather than 2015-08-05 12:48:04 +02:00
7742926403 Only show interpolation buttons w/ bezier splines 2015-08-05 20:28:31 +10:00
7853cb3c5a Remove redundant addition in BKE_mesh_calc_volume 2015-08-05 20:26:52 +10:00
a7442bef59 Fix selecting linked edges 2015-08-05 20:24:27 +10:00
25f381a9b2 Fix T45641: crash cutting meta-strips 2015-08-05 20:18:57 +10:00
80c50a1d49 OpenSubdiv: Make subsurf behavior closer to original one when built with OpenSubdiv but without enabling option 2015-08-05 11:55:06 +02:00
b5c602c9c2 Buildbot config: disable gooseberry branch from nightly builds
There's no updates happening in the gooseberry branch, so no really reason
to waste time on rebuilding the branch overnight.
2015-08-05 11:45:52 +02:00
864c154a41 Buildbot config: remove windows scons and mingw builders
They are defunct at this moment, no reason to try scheduling builds on them.
2015-08-05 11:44:36 +02:00
Julian Eisel
d39e18853f Nodes: Link lines & link arrows not scaling to DPI/pixelsize correctly 2015-08-04 21:56:43 +02:00
c18e6fd87c Cycles: Remove 32bit cuda workaroudn and disable cubins for buildbot
Recent changes to kernel broke compilation of the kernels again, need some
other kind of solution for this issue.

Don't have much time for this currently, but will be addressed before the
release.

Meanwhile it's better to have some buildbot builds instead of totally failing
one.
2015-08-04 18:50:37 +02:00
8bd425188c OpenSubdiv: Preparation for enabling it for linux buildbot 2015-08-04 18:33:55 +02:00
687a321be3 OpenSubdiv: Modifiers module missed WITH_OPENSUBDIV define 2015-08-04 18:32:21 +02:00
ea40df582f OpenSubdiv: Fix for missing OpenMP device when building with SCons 2015-08-04 18:25:34 +02:00
16b619b77d OpenSubdiv: Correction for compute devices detection in SCons
SCons was still using file names from 2.x branch.
2015-08-04 18:18:21 +02:00
dfc672f8bb SCons: Fix for really nasty bug with polluting configuration environment
The issue was caused by the following construction:

  def = env['SOMETHING']
  defs.append('SOMETHING_MORE')

Since first assignment was actually referencing environment option it was totally
polluted hawing weird and wonderful side effects on all other areas of Blender.
2015-08-04 18:06:28 +02:00
1fc32249f5 Fix fast navigate winding being incorrect (apparent when backface
culling was on)
2015-08-04 16:03:20 +02:00
Julian Eisel
4041e654cd Nodes: Make method to detect hovered link during transform more predictable/responsive
The old method:
The "old" method used the node dimensions to get a number of lines and checked if they intersect with the node link. Issue with this is that only a small part of the actual node surface is checked, making the method a bit unpredictable or unresponsive.

The new method:
The new method checks for intersections within the entire node surface. If multiple links are intersected, the node with the smallest distance from the *upper left corner* to the link is chosen.

Reviewed by @campbellbarton (tm)
2015-08-04 15:25:19 +02:00
07b525ffe2 Remove alloc checks in laplaciansmooth
These arrays aren't especially big or likely to fail.
2015-08-04 22:34:29 +10:00
4b6fba355c Remesh modifier has unnecessary MFace calculation 2015-08-04 22:11:43 +10:00
ae9ccec7c4 Missed from last commit 2015-08-04 22:08:21 +10:00
f1a9a8cbfd Remove MFace use w/ laplacian smooth
Use polygons for calculation
2015-08-04 21:58:35 +10:00
c1938eb127 OpenSubdiv: Report when OSD can't be enabled due to dependencies
Should be useful for debugging cases when enabling the option doesn't
cause any performance improvements.
2015-08-04 12:23:53 +02:00
b50916d172 OpenSubdiv: forgot this in the previous commit
Need to find better approach for dealing with shadeless materials.
2015-08-04 11:04:27 +02:00
abb976ae88 OpenSubdiv: Optimize drawing shader
The idea is to cut as much code as possible and use compile-time
ifdefs rather than runtime if() statements.

Gives about 2x speedup on catmark_car model from OpenSubdiv repository
making our FPS much closer to what glViewer is capable of.
2015-08-04 10:52:50 +02:00
cff288cf3a Use PyC_ParseBool to parse bools
This could cause problems since they could be any int,
then passed directly to internal functions that assume bools.
2015-08-04 18:49:42 +10:00
62c8f46ab6 Docs: comment functions in BLI & Py API 2015-08-05 02:09:03 +10:00
Mateo de Mayo
23f54076db BGE: Added getActionName() function to KX_GameObject()
It works similar to getActionFrame(), you have to give a layer or not (for layer 0) as the argument and it returns the name of the animation that the object is currently playing.

Example:

```
import bge
own = bge.logic.getCurrentController().owner
own.playAction("SomeAction",0,20)
print(own.getActionName())
```
>> SomeAction

Here is an example file, just open the blend file with the terminal opened
and press P, you can see how the current animation is being printed:
{F217484}

Reviewers: moguri, hg1, panzergame, campbellbarton

Reviewed By: panzergame

Subscribers: campbellbarton, hg1, #game_engine

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1443
2015-08-04 00:10:33 +02:00
Julian Eisel
8dbe598192 Merge branch 'master' into temp-ui-widget-refactor 2015-08-03 23:50:08 +02:00
73522e1157 OpenSubdiv: Fix/workaround for missing generated coordinates in viewport
This actually requires some bigger work to make it fully supported but
for now at least avoid breaking shading with OpenSundiv option disabled.
2015-08-03 20:39:00 +02:00
0951ea2c6d OpenSubdiv: Support shadeless shading 2015-08-03 20:18:33 +02:00
c2dc6aa946 OpenSubdiv: Smooth shading became broken in recent commit 2015-08-03 19:47:40 +02:00
9b51a9e885 Sculpt: Fix tiling with brushes that use a locked plane
Patch by Tilman Blumhagen, thanks!
2015-08-03 19:41:34 +02:00
2411027a79 Multires sculpting drawing optimization:
Use OpenGL 3.2 extension ARB_draw_elements_base_vertex, which allows us
to add offset in index buffer indices automatically. This should reduce
the number of draw calls significantly.

We may have some errors on the Mac with VBO setting off.
OSX OpenGL extensions don't play well with vertex arrays.
Will test that more later.

We might also use a full element buffer here, like we do when hiding
some quads, but this approach keeps the memory savings intended
originally.
2015-08-03 19:09:21 +02:00
7667ad2d4e OpenSubdiv: Made it a modifier option to enable OSD for viewport
The idea of this commit is to make it so we can enable OpenSubdiv by default
for the release builds but keep it limited to the viewport only for a specific
meshes. This is a temporary solution for until all the needed features are
supported on the OpenSubdiv side.

Flag itself is done as a dedicated field in modifier DNA so we can easily
remove it in the future without ending up with some temporary flag hanging
around forever.
2015-08-03 17:51:18 +02:00
e90fea72c1 Fix T45654 fast navigate artifacts.
Was overdrawing the buffer, in case of fast drawing just use one
draw call. Should also make performance quite smoother.

Note:
Just discovered we are doing one draw call - per grid - in multires
apparently to keep reusing the same element buffer.
This is horribly, dreadfully slow and will check about fixing it later.
2015-08-03 17:47:03 +02:00
e5f7b0f330 OpenSubdiv: Avoid crashes when GPU subsurf is tried to be used on CPU
The issue was caused by CCG code being confused by number of geometry returned
by utility functions in the case of the skipped grids.

Made it so that code is always only working with CCG data and handled drawing
code in a bit special way now.

This solves such crashes as i.e. snapping.
2015-08-03 16:44:46 +02:00
Julian Eisel
76a74e2c58 Merge branch 'master' into temp-ui-widget-refactor 2015-08-03 16:18:15 +02:00
Julian Eisel
ae50da6ea6 Cleanup: Naming, get rid of a XXX 2015-08-03 16:17:02 +02:00
4a0f3bece3 OpenSubdiv: Make new geometry relations ensures dependent data exists on CPU 2015-08-03 16:04:33 +02:00
7cfb05dcb0 OpenSubdiv: Resolve crashes when other object depends on subsurf-ed object
Cases like using subsurfed object as a boolean operand can't be evaluated
on GPU and needs to have all the CCG on CPU.

This commit resolves existing configuration to survive, but new configurations
would need to have some sort of forced object update so all the data is being
moved on CPU if it was previously on GPU.
2015-08-03 15:57:22 +02:00
b4e1b7b18c OpenSubdiv: Remove workaround for simple subdivision mode
This case is now supposed to be supported by OpenSubdiv.
2015-08-03 15:30:25 +02:00
b26eb47961 OpenSubdiv: Corrections to GLSL version
Was own mistake in the last minute fixes, now matcaps should
work just fine.
2015-08-03 15:27:42 +02:00
9036fa6b2e Fix buffer overrun lofting nurbs 2015-08-03 23:18:09 +10:00
1d549530d8 Fix own mistake in curve refactor 2015-08-03 23:06:03 +10:00
8d945bf3cb OpenSubdiv: More proper loop for UV map evaluation on CPU
This is just updating code from our side, actual evaluation is still
disabled because it doesn't support face farying data evaluation.
2015-08-03 14:50:31 +02:00
3a9897f8ce OpenSubdiv: Fix crash caused by applying subsurf on non-mesh object 2015-08-03 14:33:03 +02:00
3aa2dd74b5 OpenSubdiv: Correction to vert edge/face orientation code
non-manifold case didn't start ordering from the correct edge.
2015-08-03 14:27:34 +02:00
60c8cdf763 OpenSubdiv: Switch CPU evaluator to use uniform refinement
This way the result matches GPU viewport and becomes really close to out
legacy subsurf code.
2015-08-03 14:27:31 +02:00
4bf26fda97 OpenSubdiv: Mark non-manifold verts as sharp 2015-08-03 14:27:31 +02:00
11ad18c82a OpenSubdiv: Disable topology check happening from OpenSubdiv side
This check doesn't handle multiple non-manifolds cases which is rather
really annoying currently.
2015-08-03 14:27:31 +02:00
dd1e7f16ca OpenSubdiv: Work on better vert edge/face orientation code
Previous version of code didn't handle cases like hourglass connectivity
with loose edge. The new code is supposed to handle all this cases.
2015-08-03 14:27:31 +02:00
c2c4e02d41 Fix T45620: Coplanar faces w/ flipped normals not selected 2015-08-03 20:47:37 +10:00
1b8afac652 Cleanup: remove redundant normalize 2015-08-03 20:47:36 +10:00
Martijn Berger
230d93ad54 Fix bgl so that get-methods that take a string use strings instead of bgl buffer objects again 2015-08-03 12:20:08 +02:00
42d65ef5cc Add bool parser for PyArg_ParseTuple
Use for mathutils.bvhtree
2015-08-03 20:00:16 +10:00
0f690e2186 Fix T45625: Unpredictable grid fill
Detect when there are < 3 corners & automatically calculating the span isn't useful.
2015-08-03 17:44:50 +10:00
1dd4e933d8 Fix grid-fill offset option
Wasn't applied relative to the active vertex.
2015-08-03 16:14:22 +10:00
88d63905a8 Fix T45644: bpy.utils.smpte_from_frame drops frame
D1444 by @lichtwerk, with minor fix & docstring updates
2015-08-03 14:01:24 +10:00
Julian Eisel
73310f25fe Add widget type for search menu back 2015-08-03 01:02:05 +02:00
Julian Eisel
4db51cf00e Add widget type for preview widget 2015-08-03 00:29:31 +02:00
Julian Eisel
e28f359007 Merge branch 'master' into temp-ui-widget-refactor 2015-08-02 23:58:23 +02:00
Julian Eisel
e022e44af0 Minor Cleanup 2015-08-02 23:57:51 +02:00
00857bec52 Fix T45649: Adding Point Density Texture to World Color Crashes Blender.
Crash was caused by missing field in NodeShaderTexPointDensity.

Committed with @dingto blessings.
2015-08-02 23:46:38 +02:00
Julian Eisel
e896f4e77d Use auto-offset after adding node from search menu as well 2015-08-02 15:42:16 +02:00
93d1acfb5c correct ifdef 2015-08-02 23:36:42 +10:00
4cf92c4831 Aduaspace: fixing playback in the game engine. 2015-08-02 11:27:02 +02:00
559e1434d8 parenthisize macro args to avoid errors 2015-08-02 13:54:06 +10:00
a4f55617d1 Cleanup: quiet int overflow warnings 2015-08-02 12:53:12 +10:00
Julian Eisel
3b4a8f1cfa Fix VSE showing FPS during scrubbing
Was intended to be disabled in rBa3b86611a8182, but disabled 3D View FPS drawing instead of VSE drawing. Triple checked but 3D View doesn't draw FPS now, so everything seems fine now.

Note: To recreate this you had to play animation once before scrubbing.
2015-08-02 00:10:52 +02:00
Julian Eisel
2ec0d53034 Fix VSE not able to playback after scrubbing (and a couple of crashes)
After scrubbing, Blender kept thinking an animation is played (see animation "Play" button), even after mouse release. This resulted in a couple of crashes, e.g. by pressing Alt+a and then Esc.

(Also minor cleanup)
2015-08-01 23:59:39 +02:00
Julian Eisel
a3c5de3e3c Use Auto-offset for move_detach_links (alt+D) operator too 2015-08-01 21:01:14 +02:00
Julian Eisel
6098e48d0c Correction to previous commit, git messed up icon binaries :/ 2015-08-01 18:35:42 +02:00
Julian Eisel
47bc66fc8d Note Editor: Auto-offset nodes on insertion
Implements "Auto-offset" (called "insert offset" in code) feature for Node Editor, developed during and after LSOC :)
Idea and sponsoring by Sebastian König, blendFX, Mathias Eimann, Mikavaa, Knick Design

When you drop a node with at least one input and one output socket onto a an existing connection between two nodes, Auto-offset will, depending on the direction setting, automatically and animated move the left or right and all of its following nodes away to make room for the new node.
The direction for offsetting can be toggled while you are moving the node by pressing „T“.

The auto-offset is enabled by default but can be disabled in the header of the node-editor. The offset margin can be changed in the editing section of the User Preferences.

Thanks a lot to the sponsors, and especially to Sebastian who helped *a lot* with this. That's how users can help developing Blender!
2015-08-01 17:56:44 +02:00
Julian Eisel
31bf82c17d Node Editor: A bunch of new utility functions
Needed for node insert offset (Auto-offset in UI), but kept separate so people notice it without having to check insert offset commit (not for commit ratio of course ;) )
2015-08-01 17:23:32 +02:00
Julian Eisel
fa1945c9e5 Allow accessing modal keymap strings directly from keymap
Previously you had to pass operator which in some cases might not be available or hard to get.
2015-08-01 13:01:30 +02:00
2904007d31 Docs: Python API, minor edits to download link 2015-08-01 20:10:25 +10:00
e31f8e756f Fix T45582: Connect vertex hangs
With multiple branches it was possible the search could run for a long time,
especially when there was no possible path to the target.

Now use a heap to keep track of the best path and finish immediately once its reached.
2015-08-01 19:04:09 +10:00
0e9051fbfe BMesh connect pair, fallback to identity matrix
For overlapping vertices, a matrix for the operation can't be calculated.
2015-08-01 15:11:45 +10:00
d894fcb799 Replace checks for tessface w/ polygons
In these cases we're only checking the mesh has faces.
2015-08-01 14:42:14 +10:00
c851d1d045 Missed when updating effects to looptri 2015-08-01 14:37:20 +10:00
c4b2bef163 Remove MFace use w/ cloth 2015-08-01 14:13:59 +10:00
49f88326af Docs: doxy cleanup/minor edits 2015-08-01 12:37:52 +10:00
1c626f823d Complete fix for T45618
Two issues here, normal update was not happening due to own sillyness in
viewport refactor, also normal update code still used triangles.
Now reused Campbell's poly normal recalculation code.
2015-07-31 22:52:37 +02:00
Dalai Felinto
527ee3f1f1 Fix T45632: motion blur (2d filter) not working - in OSX at least
This regression was introduced in Blende 2.73a when we went through a
ghost context refactoring :(
2015-07-31 16:45:05 -03:00
03f00eb91d Docs: doxy corrections 2015-07-31 23:44:37 +10:00
12b7850d4f Cycles: Fix for transmissive microfacet sampling
This is an alternate fix for T40964 which resolves bad handling of
caustics reported in T45609.

There were too much transmission rays being discarded by the original
fix, which caused by caustic light being totally disabled. There is
still some room for investigation why exactly original paper didn't
work that well, could be caused by the way how the pdf is calculated.

In any case current results seems rather correct now.
2015-07-31 13:46:58 +02:00
Julian Eisel
6cad17291c Merge branch 'master' into temp-ui-widget-refactor 2015-07-31 13:46:37 +02:00
55fead4767 Use polygon normals for sculpt drawing
Wasn't working correctly since using MLoopTri,
this is improved over 2.75 which only handled tris & quads.
2015-07-31 21:04:23 +10:00
31fe49626f Remove MFace use w/ softbody 2015-07-31 19:17:39 +10:00
63215aea6f Use looptri's for softbody face collision 2015-07-31 19:01:51 +10:00
70f8b5b1ff Don't calculate tessface before sculpting 2015-07-31 16:19:58 +10:00
7575dbaf2a Docs: MLoopTri info and example usage 2015-07-31 15:41:07 +10:00
c582e186d9 Replace MFace w/ vert-tri's for collision modifier
Note that the collision modifier doesn't have any use for Loop indices,
so to avoid duplicating the loop array too,
MVertTri has been added which simply stores vertex indices (runtime only).
2015-07-31 14:00:07 +10:00
6b7313be94 Don't initialize CDDM with MFace from Meshes
Caused crash because MFace is no longer a layer which is added unless requested,
causing CDDM to have numTessFaceData nonzero, but mface set to NULL.
2015-07-31 11:57:50 +10:00
4d4c3b36a7 Cleanup: Remove unused variable in PathState. 2015-07-30 21:07:37 +02:00
2ec00ea0c1 Move tangents and baking to looptris:
Notes:

* Code in rendering and in game engine will still convert
tangents to a tessface representation. Added code that
takes care of tangent layer only, might be removed
when BGE and rendering goes full mlooptri mode.

* Baking should work discovered some dead code while
I was working on the patch, also tangents are broken
when baking from multires (also in master), but those
are separate issues that can be fixed later.

This should fix T45491 as well
2015-07-30 14:43:58 +02:00
9d335d29c7 CustomData: quiet error on 0 element copy 2015-07-30 22:14:59 +10:00
2ae67de944 Fix T45577 tiled sculpting not working with brushes requiring a sculpt
plane.

Make sure sculpt plane is recalculated for every tiled dab.

Note this is not the optimum thing to do, we could cache the original
sculpt plane and reuse that, but this would require us to rearrange the
logic of tiled sculpting somewhat. This can be a TODO, but for now this
will fix the issue.
2015-07-30 14:10:54 +02:00
820d191626 OpenSubdiv: Add CMake option to enable -Werror in subsurf code 2015-07-30 10:31:22 +02:00
5c7cdfcb42 OpenSubdiv: Remove debug-only leftover 2015-07-30 10:22:31 +02:00
7b8230898e Cleanup: safe-free macro for collision modifier 2015-07-30 15:44:03 +10:00
5fabcd099b Use looptri for smoke bvhtree
Missed from D1424
2015-07-30 14:52:55 +10:00
75e387d6c5 error reordering args 2015-07-30 09:58:00 +10:00
4737b12462 Cycles: Fix issue in closure merge function.
* Did not check data2, this partially fixes T45583.
* Initialize data2 in some closures to avoid potential problems.

Differential Revision: https://developer.blender.org/D1436
2015-07-29 22:04:36 +02:00
d49703b298 Fix SCons path issue on Windows. 2015-07-29 21:48:24 +02:00
7380166db2 OpenSubdiv: Workaround for vertices which are adjacent to several manifold islands 2015-07-29 18:41:05 +02:00
26c1ae81be OpenSubdiv: Proper detection of crease changes 2015-07-29 18:05:29 +02:00
48c2f7b288 OpenSubdiv: Some debug-only code sneaked into previous commit 2015-07-29 17:43:43 +02:00
51c1927ccb OpenSubdiv: Make topology orientation optional 2015-07-29 17:41:57 +02:00
717a303a18 OpenSubdiv: Fixes for crease in non-manifold meshes
Basically non-manifold edges are expected to be sharp by OpenSubdiv.

There\s still some work required, see the inlined comment.
2015-07-29 17:38:06 +02:00
ce5e62b78a OpenSubdiv: Typo fixes in comments 2015-07-29 17:13:15 +02:00
b8e2b8ae8a OpenSubdiv: Rework vert-edge and vert-face ordering
Now the code survives multiple non-manifolds happening on the vert.

Still not totally optimal but at least gives much better mesh support.
2015-07-29 17:13:15 +02:00
af6bbab5b4 OpenSubdiv: Fix for weirdly ordered lines 2015-07-29 17:13:15 +02:00
becf20e29f Fix T45605 crash with editmode selection on solidify modifier.
Looks like derivedmesh draw code always assumed a mesh is available.
Make sure that if we use a bmesh, a flag is used to control that.
2015-07-29 16:22:01 +02:00
30679179dd Audaspace: fixes for building with Quicktime on Mac. 2015-07-29 16:13:22 +02:00
a3b86611a8 Do not show fps while scrubbing. 2015-07-29 15:15:55 +02:00
cbf936a332 Gooseberry animation feature: Add toggle that disables modifiers on fcurves.
Feature is found as per channel option in graph editor.
2015-07-29 14:56:03 +02:00
ce1bc1838b Clean channels tool for Hwoozeberry.
Basically it's a clean keyframes 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 was used to help with performance of keyframe-heavy scenes in
gooseberry.

Note, as always the curve left after the clean tool is used is not the
same as the original, so this tool is better used before doing custom
editing of fcurves and after initial keyframe insertion, to get rid
of any unwanted keyframes inserted while doing mass keyframe insertion
(by selecting all bones and pressing I for instance)
2015-07-29 14:45:50 +02:00
18af73e461 Add mathutils.bvhtree API
Originally D966 by @lukastoenne, with own additions

- trees can be initialized from Object's, BMesh,
  or passed in as vert+polygon arrays.
- original indices of ngons/faces are used. (instead of tessellated indices).
- ray_cast, find_nearest methods
- find overlapping faces between 2 trees
2015-07-29 21:24:12 +10:00
ba32d9d4cd Expose bvhtree_sphereray_tri_intersection for general use 2015-07-29 21:22:28 +10:00
8e9534a850 OpenSubdiv: Make empty meshes supported and not crashing 2015-07-29 13:10:19 +02:00
8b84c5f9de Port optimization from gooseberry branch:
Treat scrubbing as animation.

This is checked during various updates to avoid
some costly calculations.
2015-07-29 12:52:03 +02:00
18c0a15e1e Cleanup 2015-07-29 20:18:22 +10:00
90655d06d4 Math Lib: add isect_tri_tri_epsilon_v3 function 2015-07-29 20:11:54 +10:00
792d66527b Remove not really helpful debug print
If it's still considered useful please move it inside G.debug or ifdef code.
2015-07-29 12:01:41 +02:00
d4b5dd31a3 ImBuf: Fixes for openexr images
- Fixed crash loading multilayer EXR
- Fixed another memory leak loading multilayer EXR
2015-07-29 11:59:29 +02:00
32157d8d01 Triangulate wasn't clearing arena after each use 2015-07-29 12:01:55 +10:00
339915a962 Optimize PySequence_Fast usage
Access arrays directly, avoiding type-check every time.
2015-07-29 10:49:35 +10:00
96f08bf9a8 Fix leaks in mathutils PySequence_Fast usage 2015-07-29 10:49:35 +10:00
376e4c945e Fix leak in BPy_BMElem_PySeq_As_Array
Also add BPy_BMElem_PySeq_As_Array_FAST
2015-07-29 10:49:34 +10:00
d226a4ba6d Fix leak in PyC_AsArray
Would only happen when the list-length was an unexpected size.

Also add PyC_AsArray_FAST
2015-07-29 10:49:34 +10:00
31cb14f5de Cleanup: check exact error w/ mathutils functions 2015-07-29 10:49:34 +10:00
cff71fee21 Cleanup: style 2015-07-29 10:49:34 +10:00
Dalai Felinto
c6688aeddd Fix build with Quicktime after Audaspace update 2015-07-28 21:48:13 -03:00
335c3013f4 Sequencer: Disable Refresh Sequencer button while rendering
This code is not thread-safe and there's no easy way to synchronize
render and viewport threads for this operation, so for until we've
got some nicer solution we just disable dangerous buttons.
2015-07-28 18:28:35 +02:00
79a51f0839 cdderivedmesh: don't prepare a normal buffer when selecting, even
if we skip creating the selection color layer.
2015-07-28 18:24:21 +02:00
1e6e3dcbd7 Fix T45529: Texture Compositor node composition artifact (random pixels)
The issue was caused by the non-threaded texture API used by the node.
While the node itself is single threaded there might be texture nodes
in different execution groups running in parallel.
2015-07-28 17:56:04 +02:00
20c5c5e14b Audaspace: fixing a memory access violation in the audio device list. 2015-07-28 17:40:36 +02:00
a6b2650c7d Cycles: Correction to image extension type commits
Clipping wasn't working totally correct, need to check original coordinates,
not the integer ones,

Now CPU gives the same exact results for both SVM and OSL, CUDA is still doing
something crazy with edges.
2015-07-28 16:31:27 +02:00
971affb436 Fix T45590: Some more missing glsl functions
Also SSS node was using wrong Normal input index.
2015-07-28 15:57:14 +02:00
be047fe455 Audaspace: building without audaspace.
- Fixed building without for cmake.
- Scons can now build without audaspace too.
2015-07-28 14:53:06 +02:00
f29625922f Cycles: Expose Clip image extension type
This type causes pixels outside of 0..1 coordinate range to become transparent.
2015-07-28 14:39:53 +02:00
4690281b17 Cycles: Add implementation of clip extension mode
For now there's no OpenCL support, it'll come later.
2015-07-28 14:36:08 +02:00
3fba620858 Cycles: Prepare for more image extension types support
Basically just replace boolean periodic flag with extension type enum in the
device API.
2015-07-28 14:14:24 +02:00
29ebb56f4d Audaspace: support the device list returned by the new audaspace library.
- use the device names returned from the library.
- system settings UI changed as new audaspace might contain longer and more device names.
2015-07-28 14:01:53 +02:00
a0cbebf404 Audaspace: fixing problems for the merge to master suggested by Campbell and Sergey.
- rename WITH_EXTERNAL_AUDASPACE to WITH_SYSTEM_AUDASPACE.
- rename C/PYAUDASPACE to AUDASPACE_C/PY
- simplifying cmake defines and includes.
- fixing include paths and enabling WITH_SYSTEM_AUDASPACE for windows.
- fixing scons building.
- other minor build system fixes.
2015-07-28 14:01:53 +02:00
58956f3b91 Audaspace: fix the new wm_playanim.c (from gooseberry branch) to use the new API. 2015-07-28 14:01:52 +02:00
f700c1f3a8 Audaspace: name fixes and external library update. 2015-07-28 14:01:52 +02:00
009bb9e5c9 Audaspace: adapt internal C-API naming to external audaspace library. 2015-07-28 14:01:52 +02:00
8528d76dad Audaspace: external audaspace library update. 2015-07-28 14:01:52 +02:00
733073550f Audaspace: use standalone library.
- Added the cmake configuration option WITH_EXTERNAL_AUDASPACE.
- Fixes to build without standalone library as well.
2015-07-28 14:01:52 +02:00
96dd213e7e Audaspace: preparing to use standalone library.
- Renamed some functions.
- Using C API instead of C++ in the game engine, as the standalone is C++11.
2015-07-28 14:01:52 +02:00
d3acfa1d87 BGE: Navmesh fixes and improvements
The navigation mesh functionality was broken for quite a while. This patch
contains fixes: recalculating tesselations before getting the number of
tesselation faces (it otherwise returned 0) before calculating the navmesh,
and calling `DM_ensure_tessface()` on the navmesh's `DerivedMesh` object
(which fixes visualisation in Blender). This allows one to create a new
navmesh, which also works in the BGE.

Furthermore, the patch adds several return values, and shows more error
messages when things go wrong. In several places in the navmesh creation
code, return codes weren't checked and errors silently ignored.

Reviewers: nicks, brita_, campbellbarton, lordloki, moguri, panzergame

Reviewed By: panzergame

Differential Revision: https://developer.blender.org/D1435
2015-07-28 13:54:41 +02:00
038d6ce2cc Cycles: Correction to image extension setting commit
Technically it was all wrong and it should have been called Extend instead
of Clip. Got confused by the naming in different libraries.

More options are still to come.
2015-07-28 13:41:09 +02:00
c6396d9204 Fix for file unpack checking existing files
Wasn't expanding the path '//' before checking the path on-disk.
2015-07-28 21:35:35 +10:00
cd324654b0 Fix T45581: GPU failed to find function node_bsdf_refraction
This commit fixes shader tree compilation, but the shading result wouldn't be
doing actual refraction because it's a bit involved change which isn't really
considered a bug for now. There are more closures which are falling back to
diffuse BSDF currently.
2015-07-28 11:17:18 +02:00
ad7e3c302e CMake: modify recent platform defaults
Now only disable Jack and NDof on OSX

Also comment main block for platform checks
2015-07-28 17:58:47 +10:00
33bac1f401 CMake: use same defaults on all-platforms
Previously Linux had disabled libs that were enabled on other platforms.
Use a reduced feature set on all, since libs such as Jack & OSL aren't totally reliable on Win/OSX.

Keep 'option_defaults_init' since platform maintainers may want to adjust later.
2015-07-28 14:48:12 +10:00
6df3e3a959 Jpeg2000: Fixed for DCP pipeline
Profile and color space were not properly set.
2015-07-27 22:35:24 +02:00
2b632dd8c2 BGE: Fix T37074: GLSL max texture units limit
Actually for the the amount of GLSL textures units is limited by the amount of multitexture units (GL_MAX_TEXTURE_UNITS_ARB).
Most of the Nvidia graphic cards supports only 4 multitexture units, so Nvidia users can not use more then 4 GLSL textures for a custom shader.
This patch removes this limitation by using GL_MAX_TEXTURE_IMAGE_UNITS_ARB if GLSL is supported, but still limit the amount to the maximum texture limit of 8.

Reviewers: lordloki, agoose77, danielstokes, panzergame, sybren, moguri

Reviewed By: panzergame, sybren, moguri

Projects: #game_engine, #game_rendering

Maniphest Tasks: T37074

Differential Revision: https://developer.blender.org/D1389
2015-07-27 20:34:13 +02:00
7973363e34 Cycles: Final-ish tweaks for 32bit cubin compilation 2015-07-27 16:55:50 +02:00
40a866dad4 Doc fix: wolrd -> world
The documentation for bge.types.KX_WorldInfo had two typos.
2015-07-27 15:53:15 +02:00
168bb36bc9 Buildbot: Include branch name to the cmake builds 2015-07-27 14:21:20 +02:00
61e4800b45 Cycles: One more attempt to fix compilation of 32bit CUDA kernels 2015-07-27 14:18:20 +02:00
79ffa03620 Compositor: Add note that bilateral blur is not really correct
The code does stupid box filter which doesn't give nice results and doesn't
match old compositor at all. Need some better gaussian weighting here. Will
look into it later.
2015-07-27 14:15:50 +02:00
c61e4f2683 Don't allocate MFace's by default
This removes CD_MASK_MFACE from CD_MASK_BAREMESH, CD_MASK_DERIVEDMESH and others.

Callers that need it must explicitly add it to their data-masks.
2015-07-27 21:47:41 +10:00
67fe5726af Use loop data instead of face data
Replace checks in various places
2015-07-27 21:47:40 +10:00
15676bcc85 Error in looptri update, was checking wrong layer-type 2015-07-27 21:47:40 +10:00
76beb7b7d4 BGE: Fix T19241: draw debug shape with overlay/background scene.
It's for the function render.drawLine and physics debug.
2015-07-27 13:49:06 +02:00
ba146899c8 Image painting 2D:
Deprecate wrap (BRUSH_TORUS) option, we now have paint flags for tiling
and we can reuse those. Also allows seperate tiling in X/Y
direction for 2D painting now.

Only one tiling is allowed for now.

Options can be found in new "Tiling" panel under the tools tab.

For version patching, we just turn off brush wrapping,
to allow reuse of the flag in the future.
New option is paint mode wide instead of per brush so
a brush having the old wrap option will not enable it
for the whole mode in the version patch.
2015-07-27 12:55:57 +02:00
e355d557f8 CPack: Use hash of the head for the file name
Upstream is not always configured ad might give empty results.

Ideally we need to re-use the same code as we use for buildinfo,
but it's also a bit of a question which exact hash we want to put
to the name by default.
2015-07-27 12:20:16 +02:00
ce092a58a2 Buildbot: Missed this in the previous commit 2015-07-27 11:49:05 +02:00
e5d7cbd191 Buildbot: Attempt to make windows cmake builds names matching buldbot's names
Did this in packaging buildbot rule because of several reasons:

- CMake doesn't deliver name of package which we expect it to be for buildbot
- CMake doesn't really know that building happens for buildbot
- Making default CPAck name matching buildbot's naming is kinda stupid

Probably we can pass CPack name via command line arguments, but i'm happy with
the current state and one might change things in the future.
2015-07-27 11:17:57 +02:00
20ec508ca3 Replace MFace with MLoopTri in laplacian_deform 2015-07-27 18:03:09 +10:00
b74fa38581 Missed last commit 2015-07-27 16:46:12 +10:00
e48c4d73d3 Replace MFace with looptri for dynamicpaint
D1429 by @lichtwerk, with edits
2015-07-27 16:01:56 +10:00
cdf2dbeb1f Cleanup: deprecate some G.fileflags comment others 2015-07-27 10:55:19 +10:00
2fe7e60633 Fix T45563: Crash rendering hair dupli's 2015-07-27 10:04:20 +10:00
Martijn Berger
27a20c2c60 Make cmake windows 32 bit buildbot use the 120xp toolkit, restoring
windows XP compatibility

Fixes T45559
2015-07-26 21:14:24 +02:00
fb7281fb6a Fix T26141: render setting affects only first scene. 2015-07-26 18:01:56 +02:00
c27a1cfd63 Fix bug in particle API accessing the emitter 2015-07-26 12:22:23 +10:00
Julian Eisel
88ebffec96 Fix T45510: Animation channel textbox field to small
It now takes (almost) the whole available width of the region. Icons on the right hand side are hidden during text input now, they can't be used then anyway. Using this space for the text input button makes more sense.
2015-07-26 02:12:16 +02:00
Julian Eisel
1fab327fdf Fix T45562: Crashing pre 2.5 file with grid subdivisions set to 0
Seems like the original version patch for this wasn't made correctly.
2015-07-26 00:18:44 +02:00
8fa1da9213 minor cleanup, reuse existing variable 2015-07-25 22:32:55 +02:00
f1f4a16eab Convert CCGSubsurf VBO system to also sort hidden and visible faces.
It's not actually used during drawing though.
2015-07-25 22:02:43 +02:00
53f6a31c4d GPU Buffers:
This commit begins implementation of the idea about hidden face
separation outlined in

http://code.blender.org/2015/06/optimizing-blenders-real-time-mesh-

We split hidden and visible faces to different parts of the triangle
buffer.
Mapped drawing will now skip iterating through hidden polys.
Of course the final target, when all derived mesh types use
VBO sorting, is to skip checking for hide flag per face
completely. All faces will be pre-sorted anyway and we'll
be able to draw them with one draw call.
2015-07-25 20:00:49 +02:00
17e3f905e1 Style cleanup + fix sign on previous commit. 2015-07-25 18:02:07 +02:00
a6b1e281eb Cleanup - we don't need a bogus enable material function, just pass
NULL.

All derivedmesh types check if we have an enable function, we can get
rid of this.
2015-07-25 17:18:45 +02:00
e2652bc5ad Fix tile feature not working outside mesh boundaries.
We need to generate strokes up to a brush radius around the bounding
box.
2015-07-25 16:21:09 +02:00
5878050a4b Fix T45515, dynamic paint not displaying colors correctly.
Looptri refactor artifact
2015-07-25 16:16:37 +02:00
50a46a5973 GPU buffer materials:
Separate and reuse some shared code.

Also avoid counting for information we already know,
such as total loop triangles etc.
2015-07-25 14:42:26 +02:00
38e19536bf Fix compile warning in 04b369 2015-07-25 14:00:46 +02:00
04b3694d93 BGE: Fix T35454: Soft body joints crash.
Constraint on soft bodies are special and return 0 as constraint id.
So we have to check that the id is not 0 in function setParam, getParam, getAppliedImpulse and removeConstraint.
2015-07-25 13:50:15 +02:00
221aee7ecd BGE: Fix T45278 sleeping deactivation with overlay scene.
this commit fix also angular and linear threshold sleeping value update via bge.constraints.
2015-07-25 13:09:01 +02:00
9ff869e4fb Fix T45555 crash with subsurf edge drawing.
Loose edge count was double. It didn't fail on own
tests because they had a small number of loose edges,
but for bigger meshes it hit garbage indices at draw time
and crashed.

Also cleaned up the code to make it less verbose and easier to
understand how indices are counted.

Hope it's the last edge-related fix (fingers crossed)
2015-07-25 12:51:35 +02:00
9dc0fed877 Fix grease pencil selection
When zoomed in could int overflow and select the wrong vertex.

also correct clipping check.
2015-07-25 20:36:12 +10:00
8cd14d421e Fix T45553: Object parent_type 'ARMATURE' disappeared in Blender 2.75.
Own stupid mistake in rBb318795c3b3d (ideally we should really not have that kind of ugly hacks :/ ).
2015-07-25 10:39:04 +02:00
9939c18900 BGE: Fix T35288 Touch/Ray/Mouse sensor and Constraint actuator with material check doesn't work.
Now we look at all materials instead of the first. So m_auxilary_info is useless and removed.
2015-07-25 09:43:06 +02:00
e301cf3ec2 Cleanup: double-promotion warnings 2015-07-25 13:26:20 +10:00
2a286829f7 Correct check for angle-rake stroke 2015-07-25 13:07:05 +10:00
Julian Eisel
b284667681 Merge branch 'master' into temp-ui-widget-refactor 2015-07-25 00:53:16 +02:00
e4b716a03f Cleanup: warnings, style 2015-07-25 07:44:25 +10:00
5acce60d37 Compositor: Fixes for the debug pass
This commit fixes issues with wrong socket type being added to the Cycles debug
pass compositor operation, which lead to crashes with non-value pass types.

This commit also reverts socket renaming thing because while it's was behaving
ok on runtime file reload might have loose the links which is annoying.
2015-07-24 23:05:11 +02:00
7c5c7b5ef6 Fix T45537: cycles bake crashes with motionblur on
The crash was due to baking with motion blur but without a camera.

Reviewed by Brecht.
2015-07-24 21:18:17 +02:00
75f8f1907a Experiment with setting proper socket name for debug pass 2015-07-24 18:41:54 +02:00
33bd2c1597 Deduplicate some logic around debug passes 2015-07-24 17:45:14 +02:00
68a9d80739 Compositor: Make it work for debug passes other than float 2015-07-24 17:16:29 +02:00
d2fac7df32 BGE: Fix T45544 Adding Armatures takes an increasing amount of logic time
Armatures were not totaly freed (only the armature object not the armature) and the original armature user count was not decrease after replication.
2015-07-24 17:08:55 +02:00
dc80ff9b56 Fix T45541 crash when mixing flat and smooth shaded faces in sculpt
mode.

Issue from looptri merge.
2015-07-24 16:28:38 +02:00
a028575c4a Compositor: Allow using debug pass output in the compositor
Currently only works correct with single float output, RGBA and vector are not
supported so if one need to use this passes he'll need to wait a bit still.

It is coming, don't worry.
2015-07-24 15:39:09 +02:00
54e6413d67 Make it easier to create debug passes with more than 1 channel 2015-07-24 15:39:09 +02:00
6322867e54 Cycles: Don't explicitly add debug passes, this is now handled via RNA 2015-07-24 15:39:09 +02:00
eff1b54362 Fix subsurf edge drawing when more than one loose edge vert exists 2015-07-24 14:39:52 +02:00
b55ed89b66 Fix yet another issue caused by my recent changes. 2015-07-24 14:32:11 +02:00
2dce6dccbb Fix out of bounds memory access when copying loose vertices in cddm
Caused by own fix for too much allocated memory not taking all code
into account.
2015-07-24 12:24:57 +02:00
95f698f840 Adjust CMake platform dependant release options 2015-07-24 19:39:36 +10:00
d6ebf72f9f Fix for building with OpenSubdiv 2015-07-24 17:11:50 +10:00
dc6153453a Cleanup: comments (remove outdated & update) 2015-07-24 16:59:39 +10:00
7f32601159 PyAPI: update bgl to OpenGL 3.3
Adds (currently unused) deprecated option
so we can remove support for older API versions.
2015-07-24 16:48:40 +10:00
07fa1b49d9 parenthisize macro args to avoid errors 2015-07-24 15:53:52 +10:00
8d237503c5 Compile Fix: setenv() is not defined for mingw either 2015-07-24 15:08:43 +12:00
20d516dc35 Fix: Autokeying of buttons doesn't work on NLA Strip properties 2015-07-24 14:20:16 +12:00
15cb94c65a Fix: NLA Strip properties cannot be keyframed if Visual Keying/Only Needed options are enabled 2015-07-24 14:20:15 +12:00
ea3dae74d8 Cleanup: remove redundant __doc__ from bgl 2015-07-24 09:45:25 +10:00
3b362950e9 Cleanup: move defines inside bgl C source
- remove number-of-args arg from BGL_Wrap.
- use doxy groups.
2015-07-24 09:35:39 +10:00
b8481f4683 Minor cleanup - use integers for counters. 2015-07-23 23:21:19 +02:00
0c0db92d7a Sculpt Tiling Feature
Adds 3D-Tiling options to the sculpt tool. This is very similar to the
symmetry options in the sense that it replicates the strokes. For tiling
this replication happens with a linear offset to fill the whole object
along one or more axis.
This allows to create geometry that can be tiled seamless. One use case
is the creation of tileable textures by sculpting high resolution
geometry and then rendering it with an orthographic camera to create
maps for diffuse, normal, etc

Notes:

Patch by Tilman Blumhagen with minor changes (move tile flags to paint
symmetry flags).

After some feedback from artists, leaving tiling value to constant
offset, though I suspect that some method that uses the object
bounding box dynamically might be good to have too. It can
be added later though :)

Thanks a lot for the patch!

Patch: D1426
2015-07-23 22:52:27 +02:00
36630b7e85 Fix memory leaks mesh w/ mesh remapping 2015-07-24 05:04:33 +10:00
d47e565598 Subsurf: Optimize edge drawing, now it uses VBOs.
Also the refactor exposed an error where we requested too much
memory from the video memory in general for all mesh types.

Now we are back to normal :)
2015-07-23 20:02:57 +02:00
b3ac7c07ff Added NlaStrip.fcurves.find(data_path, array_index=0)
This is the same as D1427 / 89e5c75666
except for NlaStrip.fcurves instead of Action.fcurves. It makes finding
a specific fcurve in Python much easier, as you don't need a Python-side
loop any more.

Reviewers: aligorith

Reviewed By: aligorith

Differential Revision: https://developer.blender.org/D1430
2015-07-23 15:38:25 +02:00
0e2bbd0904 Freestyle: Fix for round/square stroke caps causing line thinning.
This is a regression introduced in rBce729677db3e and rBb408d8af31c9.

RoundCapShader and SquareCapsShader had to remove (almost) overlapping
stroke vertices to avoid sudden thinning of line thickness.  For instance,
the test .blend file from https://developer.blender.org/T36425#231460
suffered from the reported line thinning (although T36425 was originally
caused by a different bug).
2015-07-23 20:29:23 +09:00
6ee2f79f33 Cycles: Previous commit broke compilation on Windows
Apparently MSVC doesn't have setenv() function.
2015-07-23 12:53:23 +05:00
1788293a01 Fix T45381: Crash Blender 2.75 in Win7 x64 AMD card
Previous fix didn't work well enough because on Windows Python has different
environment than Blender ans setting variables in there made no effect from
Blender point of view.
2015-07-23 12:10:38 +02:00
cc5d48e8dd Use looptri for sampling UV's in smoke.c
D1424 by @scorpion81
2015-07-23 20:08:26 +10:00
253f416a36 Fix regression of custom nodes not triggering material preview re-render
Issue was introduced in b0df196.It's not the nicest ever solution but it's
quite close to be as nice as we can do it with current custom nodes and
notifier system design.
2015-07-23 11:50:13 +02:00
08fbc303e1 Cycles: Resolve compilation error of avx2 kernel with certain compilers
It was redefined macro happening with Clang 3.6 here.
2015-07-23 11:48:54 +02:00
4be7fb7651 ImBuf: Fix OpenExr leaking memory when reading file with IB_test flag 2015-07-23 09:11:26 +02:00
b6cf4f777d Use looptri for smoke collisions & particle edit 2015-07-23 17:07:14 +10:00
5c98848895 Use looptri for RNA BVH functions 2015-07-23 15:40:47 +10:00
6aabc1bde4 Cleanup; duplicate header 2015-07-23 15:40:47 +10:00
0a249f9853 Cleanup: arg names 2015-07-23 15:17:26 +10:00
abbd82a504 Use looptri for mesh remapping 2015-07-23 15:10:12 +10:00
8155d25d39 Utility function to get poly -> looptri mapping 2015-07-23 15:08:27 +10:00
60822ec183 Use looptri for BVH raycast (simple cases) 2015-07-23 14:41:09 +10:00
717046ad2a Use looptri for volume snapping 2015-07-23 14:41:09 +10:00
748899a50a Missed adding BVH callbacks in recent commit 2015-07-23 14:41:09 +10:00
0bf2b207e2 Add missing break checking for tangents 2015-07-23 11:51:03 +10:00
368bd34573 Mesh Deform: support for ngons when binding
Weights were calculated using tessellation data, giving slightly uneven weighting.
Now only use tessellation for ray-cast but weight the influences from the original polygons.

Also cache arrays from derived-mesh, they we're called each intersection.
2015-07-23 11:30:47 +10:00
0b7d0f913d Fix weight painting + mask not drawing in latest master.
Same issue as vertex painting - though one might wonder if we really
need to set material on such occasions.
2015-07-22 16:58:18 +02:00
0795f62ddf GPU debug: Only flush stderr if needed. 2015-07-22 13:57:57 +02:00
5983280b4f Use looptri for MeshDeform modifier 2015-07-22 21:40:45 +10:00
b604d5ade0 Add bvhtree_from_mesh_looptri utility function 2015-07-22 21:40:45 +10:00
b305041ce6 Add DM_get_looptri_array utility function 2015-07-22 21:40:41 +10:00
a6f00bb75c Use doxy sections in bvhutils 2015-07-22 21:32:14 +10:00
df41f7bf4f Use const for BVH mesh arrays 2015-07-22 21:32:14 +10:00
f9a6780dc6 Cleanup: use struct for storing callback data 2015-07-22 21:32:14 +10:00
75d1723518 OpenSubdiv: Optimize speed of topology refiner construction
Now the conversion code uses mesh element mapping to speed up lookups.
Gives really nice speed improvement here, but the cost is higher memory
usage during refiner construction.

On the dragon scene here topology refiner construction time goes down
from 5 seconds to around 0.01.

It's possible to reduce the memory footprint by allocating mapping in
stages (don't allocate all of them at once, but do it on demand only
and free them after they're not needed anymore).
2015-07-22 12:51:10 +02:00
461340525e OpenSubdiv: Resolve crash when trying to do weight mcol 2015-07-22 12:01:38 +02:00
945f32e66d Fix crash with recent refactor of customdata writing.
Caused by own rBff3d535bc2a6309 - since we now only write the exact amount of layers
needed to store saved customdata, we have to adjust CustomData->maxlayer too.

Otherwise, on next read, customdata code believes it has more layers allocated than
actual number.

Issue reported by Campbell over IRC, thanks.
2015-07-22 11:58:18 +02:00
cf6002737d Don't make Python classes of StructRNA on startup
This gives small start time speedup, classes are lazy loaded instead.

Keep existing behavior in debug builds to catch any errors early.
2015-07-22 19:51:03 +10:00
3dd8f287e1 Render preview: Make preview render database lazily loaded
Gives about 5-10% of startup time improvement here.
2015-07-22 11:25:21 +02:00
ec8b7edf53 Fix: solved issue with "make doc_py"
The error was "ValueError: Function <function normal_at_I0D at 0x7f2aad1feb70>
has keyword-only arguments or annotations, use getfullargspec() API which can
support them", and was first seen in eeeb845d33
2015-07-22 10:31:31 +02:00
e3461a02ac Fix T43779: Cycles texture interpolation issues
That was basically not an issue with interpolation, but rather missing wrapping
options and periodic wrapping was always used.

It's still a bit questionable why certain graphics cards were doing clamping in
the file from the report, that's not something what is expected to happen from
the settings of textures being passed to GPU. In any case this issue i still
didn't manage to reproduce on any of the available GPUs, might be something
related on driver glitch or so.

In any case CPU now should behave just fine, rest of the issues we'll need to be
able to reproduce first.
2015-07-21 22:13:25 +02:00
f2c54df625 Cycles: Expose image image extension mapping to the image manager
Currently only two mappings are supported by API, which is Repeat (old behavior)
and new Clip behavior. Internally this extension is being converted to periodic
flag which was already supported but wasn't exposed.

There's no support for OpenCL yet because of the way how we pack images into a
single texture.

Those settings are not exposed to UI or anywhere else and there should be no
functional changes so far.
2015-07-21 21:58:19 +02:00
dc3563ff48 Cycles: Implement camera zoom motion blur
Works totally similar to camera motion blur and majority of the changes are
related on just passing extra arguments to sync() functions.

Couple of things still to look into:

- Motion pass will not include motion caused by the zoom.
- Only perspective cameras are supported currently.
- Motion is being interpolated on projected coordinates, which might give
  different results from constructing projection matrix from interpolated
  field of view.

  This could be good enough for us, but we need to consider improving this
  at some point.

Reviewers: juicyfruit, dingto

Reviewed By: dingto

Differential Revision: https://developer.blender.org/D1383
2015-07-21 17:40:03 +02:00
1df42798d4 Try to remap buffer before rejecting.
I suspect code here can be cleaned up but for now try this.
Alternatively we can check for errors around buffer allocation
but this needs bigger changes.
2015-07-21 16:41:13 +02:00
89e5c75666 Added Action.fcurves.find(data_path, array_index=0)
Finding a specific F-Curve is often needed in Python, and usually
consists of a construct like:

```
 [fcurve
  for fcurve in ob.animation_data.action.fcurves
  if fcurve.data_path == "location"][1]
```

This can now be written as
`ob.animation_data.action.fcurves.find('location', 1)`

This new function `Action.fcurves.find()` is still O(N) in the number
of FCurves in the Action, but at least it allows us to remove
boiler-plate code. It is also faster than the Python equivalent, as
only the found F-Curve is converted to Python.

Reviewers: campbellbarton, aligorith

Reviewed By: aligorith

Differential Revision: https://developer.blender.org/D1427
2015-07-21 16:01:26 +02:00
e7fc8d98f5 Failure to alllocate vertex buffer would not fall back to vertex array
properly.

This should fix failure to use vertex arrays in OSX with high
polycounts.

Note this will not suffice as a fix when we move to VBOs exclusively
(GL 3+), we'll have to think of some way to separate huge meshes to many
VBOs.
2015-07-21 15:42:11 +02:00
78041fa14a Fix: fixed UI description of Action.new() function 2015-07-21 14:44:48 +02:00
9ae39a1312 Math Lib: use vector funcs for isect_line_line_v2_point 2015-07-21 21:49:29 +10:00
ff3d535bc2 Fix T45471: Blend file: Bad old_addr handling in mesh's customdata writing.
Issue is rather well explained in T45471: our current customdata writing code easily generates several different blocks in blend file with same 'old' address. This is bad, because those addresses are used as 'uid' during reading process (it kind of work in Blender's own reading process, by mere luck mostly, but breaks the file specs).

Solution (suggested by Campbell, thanks) implemented by this patch is to avoid duplicating everything, and instead just overwrite what we needs to skip some cdlayers on write:
* the CustomData's `totlayer` number;
* the CustomData's `layers` array of CustomDataLayer (keeping its original address using the `writestruct_at_address` helper).

New design allows us to get completely rid of the no_free flag stuff in `write_customdata()`.

Note that this implies written data is **not** directly valid from Blend PoV, since its written typemap does not match written layers (this is not an issue because typemap is rebuilt on read anyway - and it's easy to fix this if really needed).

Also, the backward compatibility saving of mface data remains an issue here, see comment in code.

Reviewers: sergey, campbellbarton

Projects: #bf_blender

Maniphest Tasks: T45471

Differential Revision: https://developer.blender.org/D1425
2015-07-21 12:02:11 +02:00
b91d64a3d1 Cycles: Another attempt to solve CUDA compilation errors on 32bit platforms 2015-07-21 11:42:59 +02:00
b0df19667f Fix T45317: Cycles material preview unnecessarily re-rendering
The issue was caused by wrong fix for T22741 which forced redraws on any window
event, like Expose. Use proper NV_WM | ND_UNDO listener instead,
2015-07-21 11:26:42 +02:00
b23c6c430f Fix assert in Outliner. 2015-07-21 10:43:22 +02:00
7ae44e8a30 Cycles: Workaround for sm_50 on 32bit platform
Basically this commit totally disables new SVN Voxel node, which solves some
of the compiler's issues.
2015-07-21 10:18:04 +02:00
23831b2161 Cleanup: style 2015-07-21 17:29:23 +10:00
ae00011956 Fix T45496: Crash loading file during preview
Regression from multi-view
2015-07-21 16:02:27 +10:00
9eb6dcbb46 Fix T45453: Driver button's ignore DPI 2015-07-21 15:30:34 +10:00
a48db0894a Fix T45363: Bone attrs ignore editing all selected 2015-07-21 15:22:32 +10:00
39cf1de33d Fix Clear vertex group ignoring selected option
Thanks to @chadf for spotting
2015-07-21 14:35:48 +10:00
9dc9f84740 Fix T45458: Edge Slide Mirror doesn't preserve UVs 2015-07-21 14:15:31 +10:00
5e1a8055f4 Fix T45361: Camera does not rotate in walk mode 2015-07-21 13:02:11 +10:00
3c911ff8a5 Fix T45450: Loop-select fails to cycle between overlapping edges 2015-07-21 12:27:41 +10:00
1d9fbdc9a0 Fix T45455: Select linked issue w/ hidden faces 2015-07-21 12:02:11 +10:00
1d02d34de9 Fix T45434: GPencil on editmode surface fails
Z-offset use for drawing & picking was problematic for extracting locations from depth values.

Use flag to optionally disable.
2015-07-21 11:12:39 +10:00
ef950d6937 Fix T45502: Crash showing thumbnails 2015-07-21 10:01:42 +10:00
2bfa950438 Cleanup: warning 2015-07-21 09:54:23 +10:00
b5f282b211 Remove nonnull attribute, NULL arg is valid here. 2015-07-21 09:41:48 +10:00
30772b6f09 SCons: Weirdly enough at some point scons became broken in OpenSubdiv branch 2015-07-20 22:43:13 +02:00
3d36489672 OpenSubdiv: Commit of OpenSubdiv integration into Blender
This commit contains all the remained parts needed for initial integration of
OpenSubdiv into Blender's subdivision surface code. Includes both GPU and CPU
backends which works in the following way:

- When SubSurf modifier is the last in the modifiers stack then GPU pipeline
  of OpenSubdiv is used, making viewport performance as fast as possible.

  This also requires graphscard with GLSL 1.5 support. If this requirement is
  not met, then no GPU pipeline is used at all.

- If SubSurf is not a last modifier or if DerivesMesh is being evaluated for
  rendering then CPU limit evaluation API from OpenSubdiv is used. This only
  replaces the legacy evaluation code from CCGSubSurf_legacy, but keeps CCG
  structures exactly the same as they used to be for ages now.

This integration is fully covered with ifdef and not enabled by default
because there are several TODOs to be solved first:

- Face varying data interpolation is not really cleanly implemented for GPU
  in OpenSubdiv 3.0. It is also not implemented for limit evaluation API.

  This basically means we'll have really hard time supporting UVs.

- Limit evaluation only works with adaptivly subdivided meshes so far, which
  basically means all the points of CCG are pushed to the limit. This gives
  different result from old code.

- There are some serious optimizations possible on the topology refiner
  creation, which would speed up initial OpenSubdiv mesh creation.

- There are some hardcoded asumptions in the GPU and DerivedMesh areas which
  could be generalized.

  That's something where Antony and Campbell can help, making it so the code
  is structured in a way which is reusable by all planned viewport projects.

- There are also some workarounds in the dependency graph to make sure OpenGL
  buffers are only freed from the main thread.

Those who'll be wanting to make experiments with this code should grab dev
branch (NOT master) from

  https://github.com/Nazg-Gul/OpenSubdiv/tree/dev

There are some patches applied in there which we're working on on getting
into upstream.
2015-07-20 22:29:26 +02:00
2466c4f8ce OpenSubdiv: Add OpenSubdiv files which are related on the CCGSubSurf and GPU
Those files are still not in use (SCons will tyr to compile new CCGSubSurf files
but no code will be in use at all because those new files are fully wrapped by
ifdef WITH_OPENSUBDIV check).
2015-07-20 22:29:25 +02:00
a040157e5d OpenSubdiv: Add new OpenSubdiv related files
This includes C-API bindings in intern/opensubdiv and CMAke module
which finds the OpenSubdiv library. This filea are not in use so
far, making it a separate commit to make actual integration commit
more clear.
2015-07-20 22:29:25 +02:00
ccc3c2dbda CCGSubSurf: Split file into several smaller ones
This is a preparation commit for having OpenSubdiv integrated into Blender
and new layout is the following:

- CCGSubSurf.c contains implementation of common functions used by both
  legacy subdivisions code and by the new code in the future.

- CCGSubSurf_inline.h contains internal functions which are to be inlined
  due to the performance reasons. Those functions are only ment to be used
  bu CCGSubSurf* files.

- CCGSubSurf_intern.h contains declarations of private functions and data
  structures used by CCGSubSurf module.

- CCGSubSurf_legacy.c contains legacy implementation of subdivision algorithm.

- CCHSubSurf_util.c contains utility functions which are not directly related
  on the subdivision code (i.e. debug functions, hash implementation etc).

There should be no functional changes so far.
2015-07-20 22:29:25 +02:00
6190d75b5a Usual UI messages fixes. 2015-07-20 22:22:31 +02:00
a4a3d5650d Minor optimization in CustomData_update_typemap(). 2015-07-20 17:28:29 +02:00
66dd9fbf22 Fix (unreported) broken MixWeight modifier in debug builds.
defvert_find_index() & co now assert when '-1' invalid vgroup index is passed.
We used to rely on NULL value returned in this case, but with the assert...

The assert completely stalls blender actually (repeated for every vertex!).
So much better to not call that func when vgroup index is invalid.
2015-07-20 16:55:46 +02:00
9ee1f96a0f Fix (unreported) potential serious bug in CustomData_merge().
It was always only using the flags from the first source layer of a given type, not from
the layer actually being handled.

This was (probably) more or less harmless for the CD_FLAG_NOCOPY test,
but could be really bad when checking CD_FLAG_NOFREE, and when
copying the flags over to new copied data!
2015-07-20 16:25:01 +02:00
40d4da829c Fix/Workaround for CMake buildinfo error
Correcting the paths for buildinfo to point to the real header,
ended up breaking buildinfo (by not running every build).

It turns out we relied on the output _never_ existing,
so CMake generates a new buildinfo each time.
This is quite bad, but I didn't see a way for CMake to do this,
so explicitly point to a missing file and comment whats going on.
2015-07-20 23:27:56 +10:00
432d24f998 Fix recent own stupidity with indexed sculpt drawing. 2015-07-20 15:28:05 +02:00
ed3b19f46d Ugly hack to avoid GLEW context error printing when initializing GLX. 2015-07-20 14:56:36 +02:00
db38a65b02 Filter the debug callback to only report errors unless debug value is
20.

stderr was getting flooded with too many error messages, most of which
were not really relevant.
2015-07-20 14:46:11 +02:00
2e2164d5d4 Resolve compiler warning for clang 2015-07-20 22:31:19 +10:00
Julian Eisel
f2c6b7cdda Fix search menus being drawn transparent
Reverts rBb22061e98946a. Don't think it's worth using an extra widget type for this.
2015-07-20 13:33:45 +02:00
Julian Eisel
d2fc12d73e Add widget type for separator line 2015-07-20 12:50:57 +02:00
87328bde47 Fix T45218: Crash when trying to open System in the User preferences
Fix T45381: Crash Blender 2.75 in Win7 x64 AMD card

The issue is basically caused by graphics card driver which crashes when
querying OpenCL platforms. This isn't something we can really solve from
the CLEW side, because opencl.dll does exist in old driver and even has
all the needed symbols, but first ever call to clGetPlatformIDs crashes.

While rest of the blender works fine with those older ATI/AMD cards it's
really needed to solve crashes of OpenCL device enumeration.

Solution here is to force disable OpenCL platforms if we've detected that
display card is using old ATI/AMD driver. It's not really proper solution
so it's done in the python side where it's easy to do tweaks. Reasoning
behind this change is:

- If one uses really old driver it's likely because it's the latest one
  he/she can ever to install (because of discontinued support from AMD).

- If old card is used it's likely to not have dedicated GPUs for rendering.

- Even if there's a dedicated GPU device enumeration is likely to crash
  because of attempt to query OpenCL from the old card.

There are still some tweaks needed likely, but this commit should make
some of the configurations to work.
2015-07-20 12:46:56 +02:00
bd28c25f9b Fix broken GLEW initialization. Initialize GLEW twice, once to get GLX
extensions, once to get final context extensions.

Not so nice because we get a warning on startup from GLEW, but at least
it GL extensions should work now.
2015-07-20 12:35:58 +02:00
5f25b91b65 Dyntopo should be supported on systems without VBOs now. 2015-07-20 12:18:39 +02:00
Julian Eisel
50bd598a17 Correct prev commit: Remove unused functions and quiet warning 2015-07-20 12:14:49 +02:00
cb6fc9d141 Use abstraction to unbind buffers, should avoid crashes in systems that
don't support VBOs.

Exposed by initialization error in GLEW, which should be fixed
seperately.
2015-07-20 12:12:28 +02:00
Julian Eisel
bd46a92deb New widget type for colorband 2015-07-20 12:07:09 +02:00
Julian Eisel
b2e18d25b0 Merge branch 'master' into temp-ui-widget-refactor 2015-07-20 11:11:27 +02:00
Julian Eisel
08b3e9a49c New widget types for HSV circle and cube 2015-07-20 11:09:46 +02:00
422ffd252a Pixel format selection now favours a format with a number of samples
closer to the one requested on Windows.

Patch D1384 by Benoit Bolsee.
2015-07-20 10:59:30 +02:00
05ee9d2dd0 Minor edits for consistency 2015-07-20 17:07:40 +10:00
bf6ac302cd Correct own error w/ recent changes to triangulate 2015-07-20 16:12:30 +10:00
e3f86c6580 Replace MFace use by MLoopTri w/ heat-weighting
D1418 by @scorpion81 with edits
2015-07-20 14:42:48 +10:00
e5e9fbfaf0 Replace MFace use by MLoopTri w/ remash modifier
D1419 by @lichtwerk
2015-07-20 14:42:35 +10:00
86e6d6695e GHOST/X11: Support GLX-Context flags
GHOST_ContextGLX was incomplete, ignoring profile-mask and profile-flags.
2015-07-20 13:32:20 +10:00
b368724464 Fix define issues w/ WITH_GL_PROFILE_COMPAT off
This still fails to build, but at least fail where its supposed to (using unsupported API's).
2015-07-20 13:08:26 +10:00
cd91fd655d GHOST: use simple stack array for glx attributes 2015-07-20 11:45:42 +10:00
98bf205c39 GHOST: correct GLX flag w/ WITH_GL_PROFILE_CORE
note that this is currently ignored, but better at least build for now.
2015-07-20 11:32:49 +10:00
b3e7a51ebd Freestyle: disabled debug code in ViewMapBuilder::ComputeIntersections(). 2015-07-20 06:18:03 +09:00
ee263c2566 Freestyle: Removed tesselated forms of silhouettes for displaying in the UI.
The tesselated silhouettes were not used in Freestyle for Blender at all.
2015-07-20 06:18:01 +09:00
1f748d2324 Freestyle: code cleanup.
Removed unnecessary header files and replaced some other heade files with
forward class declarations.
2015-07-20 06:18:00 +09:00
160c65845d Freestyle: minor optimization for space in the FEdgeXDetector.
Member variables and auto variables were changed from real (double) to float
in most part of the FEdgeXDetector (except for curvature computations).
2015-07-20 06:17:59 +09:00
86572dd7c9 Freestyle: commented part of FEdgeXDetector::ProcessRidgeFace() that has no effect. 2015-07-20 06:17:57 +09:00
b9895df36f Freestyle: internal switch from double to float in mesh loading and construction of winged edges. 2015-07-20 06:17:55 +09:00
6705786540 Freestyle: minor optimization for space from mesh importing to feature edge detection.
Several class member variables were removed (at the cost of computing their values
when retrieved) or changed to a type of smaller size.  Also fixed whitespace.
2015-07-20 06:17:54 +09:00
431cee2ba0 Freestyle: minor code cleanup. 2015-07-20 06:17:53 +09:00
66423364ca Freestyle: removed redundant instantiation of vector objects. 2015-07-20 06:17:51 +09:00
be980c4ee4 Freestyle: minor optimization for space by using a pointer to a const char array instead of std::string. 2015-07-20 06:17:50 +09:00
e58d788340 Cleanup: style
Also 'com' as abbreviation for center-of-mass is a bit confusing, rename to 'center'.
2015-07-20 05:30:08 +10:00
23a4f547e7 Convert rigidbody conversion to looptri.
Patch D1417 by Martin Felke, with minor edits thanks!
2015-07-19 19:10:41 +02:00
a597a380bb Properly fix T45477
Code was actually skipping setting color selection indices and previous
commit actually broke mask selection in texture painting.
All should work now.
2015-07-19 18:35:09 +02:00
8f1c1ef3a9 Fix T45477 wrong edge selection.
Caused by own changes to framebuffer selection code, code was not
packing color ids correctly.
2015-07-19 18:04:21 +02:00
d712dc5a1d Fix T45495: Armatures using the iTaSC IK solver causes UI truncation in bone constraints panel.
Caused by rB404f9ddc37fc, cleanup is OK but please double-check changes before committing. :(
2015-07-19 16:25:48 +02:00
Julian Eisel
74eb56fe7e New widget type for vertical HSV slider 2015-07-19 14:39:56 +02:00
23c76039d9 CMake: correct generated location for buildinfo.h 2015-07-19 09:53:38 +10:00
1e10e4e2e3 Fix error when getting the commit time fails
While this should work, allow the build to succeed if for some reason the command fails.
2015-07-19 09:51:49 +10:00
4bca8a6bc5 Fix T45484: Regression OpenCL split: access violation
That was a primary school error caused by moving statements inside assert()
which effectivly disabled crucial code in release builds.
2015-07-18 23:30:19 +02:00
faeac63f68 Cycles: Fix compilation of OpenCL kernel after point density commit 2015-07-18 23:10:46 +02:00
003b56801c Point density: Workaround for possible race condition
There was possible race condition in the point density sampling caused
by access to the same data in particle system from sampling thread and
sampling initialization.

Could have happened when two different point density textures were using
same particle system
2015-07-18 22:57:02 +02:00
9b40616249 Cycles: Point density texture support
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.

Particle color support is done by Lukas, thanks!
2015-07-18 22:49:10 +02:00
7d10798af2 Cycles: Add voxel texture sampler shader node
The idea of this node is to sampling of 3D voxels at a given coordinate
supporting different mapping strategies (world space mapping, object
local space etc).

Currently not in use, it's a preparation step for supporting point density
textures.
2015-07-18 22:09:20 +02:00
2f15a1f66e Point density: Add utility function to sample density outside of render pipeline
Not currently used, it's a preparation for the further work.

Should not be functional changes.
2015-07-18 21:42:39 +02:00
92a37993a5 Cycles: Camera frustum space object culling scene simplification
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
object is visible in the frame or not.

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

- Enable Simplify in scene settings

- Enable Camera Cull option in the Simplify panel

- Set camera cull margin (measured in relative value to the render resolution)
  This setting is used to avoid possible flickering caused by changes in shadow
  which are cast by objects outside of the frame.

- Enable Camera Cull for objects which are desired to be culled
  (object culling option could be found in Option panel in object buttons).

There is still room for improvements, but this worked quite well during
Gooseberry open movie project, so think it's useful feature even in it's current
non-ideal state.
2015-07-18 18:17:22 +02:00
Julian Eisel
2b73dff7cf Add and use widget API function for draw callback routine
Had to make some further tweaks to make this work nicely, but everything should work fine.
2015-07-18 16:39:01 +02:00
2ccfbf2f81 Cycles: Commit file missing from conditionally compiling baking kernel 2015-07-18 16:26:41 +02:00
cf14437ac9 Cycles: Log requested device features
Useful to have this always logged because otherwise it's needed to remove cached
kernels and check build flags to see which features are enabled.
2015-07-18 16:02:09 +02:00
45b5bf034b Cycles; Make baking a feature-specific option
This means render devices now might skip building baking kernels in cases when
only actual render-related functionality is used.

For now it's only implemented for OpenCL split kernel device and mainly needed
to work around some compiler-specific bugs which crashes on building the kernel.

Using OpenCL for baking might still crash the driver, but at least there is now
higher probability of that GPU will be usable to render the scene.

Real fix should actually be done in the driver side.
2015-07-18 16:02:08 +02:00
36a952e3e4 Cycles: Use feature-selective base kernel compilation when using split kernel
The idea is to make all kernels as small as possible to work around possible
issues with buggy drivers which might fail building feature-complete kernels.

It's indeed just a workaround to make at last simple test scenes to render
on OpenCL. Real fix should happen from the driver side.
2015-07-18 16:02:08 +02:00
5e4a8c6a87 Cycles: Some cleanup if OpenCL base kernel load_kernel()
Hopefully makes it less clumzy, should be no functional changes still.
2015-07-18 16:02:08 +02:00
025eda57da Cycles: Make OpenCL cache follow out code style a bit closer 2015-07-18 16:02:08 +02:00
2ad3a1d41e Use gpu-buffers for UV-edge drawing 2015-07-18 23:51:44 +10:00
f5629b7265 Fix/enhance behavior of VES's 'alt-rmb' selection.
Main issue in previous code was that you could not shift-alt-rmb select several
contiguous strips, result was pretty much unusable.

Also, enhanced general behavior of this selection mode, now (similar to alt-rm clicking
on handles), when you alt-rmb click on a same strip several times, you alternate between:
* Strip is selected, neighbor handles are selected;
* Strip and its handles are selected, neighbor handles are selected.
…which allows you to either grab or slide the strip.

And refactored a bit code too, linked_handle has a complete different logic
than without this option, simpler and clearer to completely separate them in code.

Initial issue reported by Leon Cheung on IRC, thanks!
2015-07-18 14:45:11 +02:00
cdd1be44c5 Replace MFace w/ MLoopTri in imapaint_pick_uv
D1415 by @scorpion81, with minor edits
2015-07-18 22:10:58 +10:00
df4d25991e Fix (IRC reported) inverted behavior of select more/less in VSE.
Also, cleaned up a bit that code, and added releavnt entries in Select menu.

Reported on IRC by Leon Cheung, thanks!
2015-07-18 11:55:08 +02:00
bbed6af857 CMake: Disable Werror in extern/libmv for now
It gives issues with Glog compiled in release mode.

Need to revisit the directory layout here and compiler flag, because technically
libmv is now more an intern/ library and i'll actually prefer it to be covered
with strict flags as well. But it's a bit tricky because of libraries which we
don't maintain are in the libmv subfolder.
2015-07-18 11:16:25 +02:00
ecb3e0fe73 Cleanup: whitespace & break placement 2015-07-18 19:03:22 +10:00
2199a3e38b CMake: Add option to enable -Werror cflag in some areas
It is rather annoying attitude nowadays to use const qualifier all over the
place, including using it for multi-dimensional arrays. This isn't really
supported in GCC prior to version 5.0 because it considers such an arrays
to be a "pointer to a const pointer" which gives implicit casting errors.

It's not possible to disable this particular type of warnings treated as
errors in any GCC version prior to 5.0 as well, meaning currently usage of
-Werror globally in Blender code is not possible at all.

This commit makes it possible to use -Werror in areas which are complaint
with older GCC versions. New advanced CMake options are:

- WITH_COMPOSITOR_WERROR
- WITH_LIBMV_WERROR
- WITH_CYCLES_WERROR
2015-07-18 10:49:51 +02:00
086ae3ea04 Cleanup: whitespace, wrong indent level 2015-07-18 18:42:59 +10:00
752eb64d60 Cleanup: whitespace (CMake) 2015-07-18 18:42:35 +10:00
Julian Eisel
eba5bd3340 Merge branch 'master' into temp-ui-widget-refactor 2015-07-18 10:00:09 +02:00
Julian Eisel
b22061e989 Remove redundant draw call 2015-07-18 09:59:11 +02:00
Julian Eisel
5d021e3331 Fix uninitialized usage of uiWidgetDrawBase 2015-07-18 09:56:49 +02:00
7c5dd14689 CMake: Fix indentation around LLVM detection code 2015-07-18 09:40:33 +02:00
3e83a0d92d Cleanup: ws 2015-07-18 06:01:38 +10:00
7b30e2386b Only use material callback when enabled
Vert/Face select in painting modes weren't drawing after recent changes.
2015-07-18 05:39:01 +10:00
b45749727c Add check for GPU materials enable state 2015-07-18 05:30:13 +10:00
32f7b4a358 Avoid getting the original index if its not needed 2015-07-18 04:57:58 +10:00
e6711119f2 Absent-mindedness...Remove testing code 2015-07-17 19:13:22 +02:00
712098b1c8 Fix GLSL code not working correctly for Macs without VBO, again report
by scorpion81 on irc
2015-07-17 19:12:24 +02:00
c1290e441e Fix T45469: Vertex Group weight = 0.0 in scene 2. 2015-07-17 18:49:58 +02:00
20de6f01ed Fix T45464: Blender Sequencer "Select Strips to the Left" produces opposite behavior to what is intended.
Logic was just broken for the LEFT case here.

Also cleaned up and made behavior more consistant between strips and markers.
2015-07-17 18:32:59 +02:00
3a15ec337e Fix issue reported by scorpion81 on irc: material mode + flat shading
artifacts in cycles textured mode.
2015-07-17 18:30:40 +02:00
85809e836e Avoid double index lookup mesh/selection drawing 2015-07-18 00:01:44 +10:00
d4c0617496 Avoid accessing MTFace drawing subsurf 2015-07-17 23:52:41 +10:00
955c13d614 Fix another index error, made multimaterial mapped meshes draw
incorrectly.
2015-07-17 15:15:53 +02:00
7c06167982 Change winding of looptris in subsurf so they point to the same
direction as the surface.
2015-07-17 14:56:10 +02:00
5f09348fe8 Fix crash texpainting on subsurfed meshes.
Unfortunately, loops and polys are generated, therefore we need to keep
copies. Still not painting after this commit but at least no crash now.
2015-07-17 14:46:05 +02:00
82e27f5093 Cleanup: ws & correct comment 2015-07-17 22:09:30 +10:00
416d164fec Projection Paint: move to looptri data 2015-07-17 21:59:07 +10:00
e1606e8c87 Don't create MFace's when calculating normals
Instead only create MFace layer when its requested
2015-07-17 21:59:07 +10:00
19614f4395 Add macro BKE_MESH_TESSTRI_VINDEX_ORDER
gives the index of a vertex in a looptri
2015-07-17 21:59:07 +10:00
c23d29c58e Fix T45465
Easy one, we don't draw quads anymore. Also normal
didn't use polygon index
2015-07-17 13:27:46 +02:00
1b8e0d03d4 Fix no longer being possible to display a suzanne with 8 levels of
subdivision.

Classic integet overflow/size_t substitution case. Machines are getting
powerful enough to easily expose these kinds of error now.
2015-07-17 12:25:44 +02:00
0b121d6a5d Cleanup image's poll funcs.
Checking space returned from CTX_wm_space_image() is SPACE_IMAGE type... tssst. :)
2015-07-17 12:19:57 +02:00
1255ac12a6 Fix T45462: Do not enale 'replace image' op with packed images. 2015-07-17 12:19:57 +02:00
37017d149e Let's use proper helpers for debug-only vars... 2015-07-17 12:19:57 +02:00
9bcf1bb266 Fix for nodeitems module using the NODE_MT_add menu types from bl_ui.
This is basically a bad-level call: ui scripts are registered *after*
the modules. It only works for addons because those are loaded even
later.

Now the nodeitems_utils module just defines a function which is then
called by the UI script, rather than the other way around.
2015-07-17 11:59:24 +02:00
4052384be3 Make strict flags happy in release builds 2015-07-17 09:54:21 +02:00
Julian Eisel
b947998a51 New widget types for drawing scrollbars using widget pipeline
Had to add UI_WTYPE_SCROLL_BACK and UI_WTYPE_SCROLL_INNER since they need different rectangles, drawing and states. Also renamed UI_WTYPE_SCROLL to UI_WTYPE_LISTSCROLL as it's only used for lists.
2015-07-17 02:48:25 +02:00
Julian Eisel
2a325a0eb9 Cleanup: Naming, comments, redundant defines, ... 2015-07-17 00:50:00 +02:00
Julian Eisel
94adf2cc5f Cleanup: Move widget_type function to widgets.c and widget type enum to widget.h
And suddenly, things are soooo much nicer ;)
2015-07-16 23:22:48 +02:00
Julian Eisel
80af1f10fc Merge branch 'master' into temp-ui-widget-refactor 2015-07-16 21:55:59 +02:00
Julian Eisel
56c6bd646a New widget type for preview menu items
Also to avoid special draw calls.

Note: This adds iconid and str args to uiWidgetDrawType->text callback, which is currently only needed for preview menu items (could also be done differently), but in future this might be handy to get rid of uiBut usage on this level.
2015-07-16 21:44:42 +02:00
40936307dd Remove MTFace DM_paint_uvlayer_active_get func 2015-07-17 04:26:17 +10:00
67acde92bb Fix for error in looptri commit
Sculpting w/ subsurf crashed
2015-07-17 04:22:24 +10:00
9d090c4717 Split ray_face_intersection into quad/tri versions
Since many callers only need a single triangle
2015-07-17 04:15:24 +10:00
595a491e63 Add tessellation data to DerivedMesh (LoopTri)
This stores loop indices into the loop array giving easier acess
to data such as vertex-colors and UV's,
removing the need to store an MFace duplicate of custom-data.

This doesn't yet move all internal code from MFace to LoopTri just yet.

Only applies to:
- opengl drawing
- sculpting (pbvh)
- vertex/weight paint

Thanks to @psy-fi for review, fixes and improvements to drawing!
2015-07-17 03:55:14 +10:00
Julian Eisel
85eb2ea3bb Avoid special drawing calls for labels within menus by adding a widget type for them 2015-07-16 19:50:21 +02:00
Julian Eisel
f45c2a9cb5 Aaaand finally: Use new pipeline for text drawing as well 2015-07-16 19:09:51 +02:00
Dalai Felinto
c8f6313487 Fix T45428: Sometimes in a dupligroup linked actuators are not triggered
Revert "BGE: Cleanup : merge 3 loop in 1 in function DupliGroupRecurse."

This reverts commit 371e5f25a0.

The fix is basically to revert the cleanup commit 371e5f25 (and 3d658bf7)
Also 5dc22fbbf had to be adapted to the reverted code.

Conflicts:
	source/gameengine/Ketsji/KX_Scene.cpp
2015-07-16 12:53:20 -03:00
2fe9224375 Fix T45459: Edge Length with Separate Units Displayed As 1m 100cm.
Our 'unit epsilon' was too small, given the fact we only display up to four digits usually...
2015-07-16 17:45:51 +02:00
f2087b4830 Fix T45451: File Browser crash on 16bits PNG image previews.
Issue was that with those files, Blender generate a float image by default, not a byte one...

Now, we ensure in two places we only get a byte imbuf for our thumbnails!
2015-07-16 17:28:25 +02:00
4feef7d4f8 Fix for the previous commit: overallocation of an array 2015-07-16 17:26:20 +02:00
247d922ce5 Fix T45446: Crash when baking a certain object
Issue was caused by deform vert layer existing in the mesh.
Solved in quite simple way, but it still might be missing
some other layers.

Any custom data experts around to check if it's correct?
2015-07-16 17:25:13 +02:00
3e3e7ee41c Sculpt draw code:
Remove legacy code completely, now dyntopo, multires et al even work on
GL 1.1 for really hardcore users :p

Real purpose here though is to be able to have fast multires drawing
even with VBO off, since it requires using indices for vertex buffers.

Also made own code elf puke an eaten normal update function which
made multires not update normals in solid mode...sorry.
2015-07-16 17:12:03 +02:00
6568b6d1cd Fix T45456: Error's in splash don't restore cursor 2015-07-16 17:28:20 +10:00
01a8216a4b Disable check for recent-files.txt existing
slows startup on remote, network fs... etc.
2015-07-16 17:15:00 +10:00
Stefan Werner
51385f6fe8 Fix T45447: Area light importance sampling improvement
Turning on importance sampling on area lights increases noise on diffuse
surfaces. This was caused by PDF calculated for an intersected point on
light instead of original light position.

Patch by Stefan with some own modifications.
2015-07-16 08:33:13 +02:00
b00c49838a Optimize Vertex Color update
Avoid recalculating the material color when its the same as the last.
2015-07-16 15:49:15 +10:00
Julian Eisel
a3a56d9aaf Time to use new pipeline for widget states
Still don't really like having this on low draw level, think a better solution would be to handle this via flags and update widgets based on these flags before drawing, but old logic is pretty confusing and spaghettiish here, so would prefer to rework states from scratch at some point.
2015-07-16 03:43:59 +02:00
Julian Eisel
03bfc42f74 Merge branch 'master' into temp-ui-widget-refactor 2015-07-16 01:20:35 +02:00
e6364c64f2 Icons: Add new 'library_data_broken' one. 2015-07-15 20:28:09 +02:00
13c39e90b3 VBO offscreen selection drawing, cdderivedmesh
Get rid of legacy drawing, it's only used for selection,
    in which case we can prepare a temporary color buffer and draw
    at once. Code is not complete here because we still redundantly
    set the draw color in the draw function and don't ommit hidden
    faces automatically. Still it works 100% without immediate mode
    now.
2015-07-15 18:50:02 +02:00
2daa4db8a0 Fix own stupid error in yesterday's refactor of recursive dir creation.
Missed adding return value in one place.

Thanks a lot to Thomas Szepe for reporting the issue and finding the solution!

Question remains: how could MSVC allow such a code to compile in some cases
(own win64 + scons buildbot win32 were OK with that it seems!).
Crappy compiler, not comming to the rescue of stupid dev...
2015-07-15 17:43:04 +02:00
548e650252 Cycles: Merging of patch from OSX went wrong in the previous change
That's what happens when you can't commit from a system you're making
changes at and someone is behind your back...

Sorry for the noise.
2015-07-15 15:12:19 +02:00
2b97ad348c Cycles: Missed this in the previous commit 2015-07-15 15:11:02 +02:00
32c6d92cb0 Fix T45439 crash with subsurf when many materials present.
Silly oversight on the viewport patch
2015-07-15 14:58:10 +02:00
56bf25d219 Cycles: Enable OpenCL rendering on Apple OSX
Requires having latest El Capitan beta 3 OSX due to ome crucial fixes made in the
compiler. Supports same features as NVidia OpenCL apart from CMJ (there's no
experimental feature set support in megakernel yet).

Uses megakernel internally, which works much better than the split kernel. Split
kernel is not supported on OSX still, needs to be investigated still.

Some more details can be found there:

  http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles/OpenCL#AMD_on_OSX
2015-07-15 14:20:59 +02:00
4143b8a6c7 Fix autosmooth with recent DM optimizations
Also avoid multiple float->short conversions for the same normal.
2015-07-15 14:34:56 +10:00
72c7e12a5d DerivedMesh: minor changes to callback use
- use void instead of float for array arg (cast in the switch statement)
- remove unused args
- use const for poly-mapping and user_data args
2015-07-15 12:42:41 +10:00
7407ed7637 Cleanup: ws 2015-07-15 12:08:32 +10:00
52fa5b12e1 Cleanup: ws 2015-07-15 11:43:23 +10:00
Nikolaus Leopold
f2620c9df1 Minor English grammar typo fixes.
This fixes T45433.

Reviewers: Severin, kevindietrich

Reviewed By: kevindietrich

Projects: #bf_blender, #user_interface

Differential Revision: https://developer.blender.org/D1408
2015-07-15 03:33:10 +02:00
dfd383ca00 Fix overdrawing and errors with textured and mapped drawing 2015-07-14 23:49:03 +02:00
9cc1953210 Usual i18n messages fixes... 2015-07-14 21:41:24 +02:00
Julian Eisel
e50904f9c9 Merge branch 'master' into temp-ui-widget-refactor 2015-07-14 21:09:26 +02:00
Julian Eisel
0e06f4c491 Fix weirdly appearing and disappearing compile error 2015-07-14 21:06:59 +02:00
8a17918555 Fix T45424: Blender able to create folders with invalid characters at the end of the name.
In fact, filebrowser was not making any checks for invalid file/dir names here!

Added checks in the three places that should be protected:
* Renaming.
* Creating dirs.
* Typing in filename field.
2015-07-14 18:57:38 +02:00
d7b9202567 BLI_path_utils: fix/enhance BLI_filename_make_safe(), add BLI_path_make_safe().
BLI_filename_make_safe had several issues:
* Would replace all dots ('.'), not a great idea since it would break extensions.
* Was not checking for 'control' ASCII chars (though unlikely, better to be safe here).
* Win32 only: was not checking for forbidden names (con, aux, ltp0, com0, etc.).

New BLI_path_make_safe() simply checks each path's item with BLI_filename_make_safe().
2015-07-14 18:57:38 +02:00
d0c5eac4b7 BLI_fileops: Make BLI_dir_create_recursive() return success/error status.
Handy to know directly whether a file creation succeeded or not.

Also, made a few more changes in this func, and harmonized a bit win32/*nix versions.
2015-07-14 18:57:38 +02:00
38940662e5 Particle Info node support for GLSL mode and the internal render.
With this patch "Particle Info" node from Cycles works in GLSL and BI

Alexander (Blend4Web Team)

Reviewers: psy-fi
Note: moved particle info to object render instance instead of
shadeinput during review - Antony.

Differential Revision: https://developer.blender.org/D1313
2015-07-14 18:52:29 +02:00
107e34407d Display optimizations part 1.
This patch changes the way we draw meshes by introducing
indexed drawing. This makes it possible to easily
upload and rearrange faces ad lib according to any criteria.

Currently we use material sorting but textured sorting and
hiding will be added to optimize textured drawing and skip
per face testing.

It also adds support for vertex buffers for subsurf
modifiers (Except from GLSL drawing), making drawing of
subsurf much faster without need for bogus modifiers.

Tests show that we gain approximately 20-25% performance
by that for solid mode drawing with up to 50% gains for
material drawing. Textured drawing should also have a
small performance gain, but more substantial optimizations
are possible there.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1406
2015-07-14 16:48:23 +02:00
1b8b9063f8 Correct last commit 2015-07-14 23:37:11 +10:00
0918461d61 Move from MTFace to MTexPoly w/ texture checks
Part of moving away from MFace.
2015-07-14 22:36:00 +10:00
2cffd6649b Match face tessellation order in edimode
add a negated version of axis_dominant_v3_to_m3
2015-07-14 22:29:31 +10:00
655f498ca7 Cleanup: headers (wm) 2015-07-14 22:29:31 +10:00
cba0858ccd Fix for recent optimization commit in endian switch
Pre-4.8 GCC had a bug which lead to non-exposed __builtin_bswap16() symbol.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 for details.
2015-07-14 11:33:50 +02:00
82740cd282 Fix T45423: depsgraph: crash in IDDepsNode::tag_update
Two issues fixed in this commit:

- Clearing or adding animation via python should ensure relations are valid.
- Animation component animation data might be null caused by removing animation
  from python.
2015-07-14 11:21:04 +02:00
9c80e52a89 Make tooltip parsable by human compilers (thanks to Pablo for
suggestion)
2015-07-14 11:19:13 +02:00
6ba4a917a3 Data Transfer: very minor cleanup... 2015-07-14 11:13:56 +02:00
85004461ea Workaround for non-bleeding edge compilers and const cast of pointer arrays. 2015-07-14 09:56:00 +02:00
a79d47b14e Cycles: Add logging to detected OpenCL platforms and devices
Happens on verbosity level 2, should help looking into some of the
bug reports in the tracker.
2015-07-14 09:56:00 +02:00
Julian Eisel
52ce543f4d Merge branch 'master' into temp-ui-widget-refactor 2015-07-14 02:11:52 +02:00
Julian Eisel
0a202fdfce Get rid of uiWidgetType drawing callbacks (which are now used on a lower level) 2015-07-14 02:07:45 +02:00
Julian Eisel
d032de3bae Let's not use default callbacks for uiWidgetType->draw 2015-07-14 01:49:08 +02:00
7ad9ca72dd Cleanup: replace BLI_split_file_part w/ BLI_path_basename 2015-07-14 09:34:53 +10:00
b7c42ef93e Cleanup: use ascii as suffix (as with utf8) 2015-07-14 09:17:00 +10:00
2de497eee0 BKE_deform: assert on invalid args
Will phase these out eventually
2015-07-14 08:41:15 +10:00
Julian Eisel
29166b3ae3 Fix drawing glitch with menu items 2015-07-13 23:45:00 +02:00
8c0b5c02de Draw emboss when area is full but in quad-split 2015-07-14 07:31:46 +10:00
Julian Eisel
d6c93298b5 Use new pipeline for link line drawing as well 2015-07-13 23:31:33 +02:00
9f78aa4c36 Fix T45348: Collapse gives sel verts in face mode 2015-07-14 07:02:35 +10:00
55374426c6 EditMesh: show angles of adjacent selected verts
Useful since moving vertices will change angles on adjacent,
unselected face-corners too.
2015-07-14 06:30:02 +10:00
eee2d8e45c Fix T45247: Softbody ignores lattice weight
Now multiply the lattice wight by the goal weight too.
2015-07-14 06:20:31 +10:00
240646f506 Softbody goal weights cleanup
- avoid searching for vertex group for each vertex.
- add support for mass and spring weights to lattice.
- multiply the vertex group weight by the overall goal weight value.
2015-07-14 06:20:30 +10:00
6a982a080c Add some pedantic casts, since some guys around like to take all warnings from their compilers as errors, even the stupidest ones! 2015-07-13 22:00:49 +02:00
Dalai Felinto
4050b49f97 increase mathutils callback count (BGE devs, read the log)
This was causing the BGE to crash on Debug mode when built with "break on asserts", meaning the BGE was not debuggeable.
Please make sure to test patches in debug mode with the proper flags enabled before committing
2015-07-13 16:11:59 -03:00
Dalai Felinto
34a7156705 RNA assert: make object game state to comply with RNA_property_boolean_get_index() 1/0 requirement 2015-07-13 15:52:05 -03:00
406b9aa7b1 Fix T45402: Transform crash w/ project+align snap
Only euler rotations were checked for.
Also delta rotations caused random/unusable output.
2015-07-14 04:30:16 +10:00
6f7926c61c Fix T45394: Motion tracking constraints did not work with Cycles motion blur 2015-07-13 18:17:46 +02:00
dd44754c5f Data Transfer: Add an option to 'auto-transform' destination mesh so that it matches best the source one.
This allows to match and transfer data between two meshes with similar shape but complete arbitrary different transform.

Note that the result will be best if the meshes (more precisely, their vertices) are exact copies of each other.
Otherwise, method used can only perform an approximated best match, which means you'll likely get better
results if you 'visually' make them match in 3D space (and use 'Object Transform') instead.
2015-07-13 18:05:38 +02:00
e93b969ac9 Add BLI_math_statistics, where stats tool shall be!
For now, only contains some 3x3 matrix covariance computing.
2015-07-13 18:05:38 +02:00
0e9842dd04 Add BLI_math_solver, where non-linear solvers should be.
For now, only has an eigen solver for 3×3 (symmetric) matrix.
2015-07-13 18:05:38 +02:00
582e7a6347 Add a skeleton of C API for Eigen3.
Title says pretty much everything. For now, only thing available is a solver of eigen
values/vectors for self-adjoint matrices.

We can easily add more when needed.

Thanks to Sergey and Campbell for quick review.
2015-07-13 18:05:38 +02:00
0119539e4b Add icon scale argument for ui-template-previews 2015-07-14 01:46:25 +10:00
e7b3803317 Allow spin/screw to run outside 3D view
This lets scripts call them
2015-07-14 00:55:04 +10:00
b16bf6da80 Fix T45364: NEW DEPSGRAPH: New Torus created can't be transformed
Linking objects to a scene via python should ensure relations are properly
updated for that scene.
2015-07-13 16:00:39 +02:00
9f63cbf4a7 Fix T45333: Volume Scatter crash blender 2015-07-13 18:54:26 +05:00
a2f7997e05 Freestyle: Fix compilation error with strict compiler flags 2015-07-13 15:24:56 +02:00
686e8e452c Fix T45390: Cycles experimental displacement method ignores scaling when render
From artists perspective it makes sense to always apply displacement in a local
space.

TODO: Double-check that BVH is being packed properly. From quick tests seems it's
all fine, but might be missing some obvious failure still.
2015-07-13 15:24:56 +02:00
2d32b92d77 Cleanup: IMB prefix for ImBuf defines 2015-07-13 22:00:07 +10:00
e142ae77ca Imbuf types refactor.
ImBuf types were getting stored as bitflags in a 32bit integer which had
    already run out of space. Solved the problem by separating file type to
    an ftype enum, and file specific options to foptions.

    Reviewed by Campbell, thanks a lot!
2015-07-13 13:58:17 +02:00
107bbee4c7 Use regex for cmake config parsing 2015-07-13 20:05:26 +10:00
5201748f5f Fix T45397: Frameserver rendering no longer works in 2.75 or 2.75a
Issue was caused by a typo in original multiview commit.
2015-07-13 11:10:33 +02:00
1dd92f352b Fix T45385: Crash on render occurring when two hair modifiers are active that both use a UV mapped material for render
Not sure it's totally correct solution, but seems reasonable because it's
possible dmcache is set to ISCHILD.

Someone more familiar with the particles code might want to revisit this :)
2015-07-13 11:01:34 +02:00
f4f7348c41 Minor tweaking to Knife header text.
Confirm/cancel shall always be first, and also makes more sense to have
define cut/close cut/new cut together.
2015-07-12 21:52:59 +02:00
c1a5e6b2fd Shortcut-to-string converter: add 'dbl-' in front of key when expecting a double-click.
I think this is the only Keymap value we really need to handle here...
2015-07-12 21:39:59 +02:00
c2bcf2dc05 Add new modalkeymap usage in helper header message to Knife tool. 2015-07-12 21:32:16 +02:00
36c15f4194 Add new modalkeymap usage in helper header message to Fly mode. 2015-07-12 21:14:06 +02:00
1b297567c0 Cleanup: style 2015-07-13 03:48:08 +10:00
feffbe974b Remove redundant string copy 2015-07-13 03:43:41 +10:00
1893e5e4c2 Missed essential part in previous commit.
Or how to epic fail a fix when working on two different systems.
Or how to increase your commit rate.
2015-07-12 19:04:31 +02:00
7e9c347c8c Fix T45375: Cant clear temp fluid cache after closing Blender (Windows).
There was two different issues here actually:
* Own (very high) stupidity only gave 8 chars to file name (sic).
* list dir returns dirpaths without a trailing slahs, but expects them to have it it seems. :|
2015-07-12 18:49:02 +02:00
d54e77b66d Cycles: Expose "Max Bounces" for the world light.
When using MIS, the world is treated as regular light and in this case
we can now also limit the maximum amount of bounces, the background light
will contribute to the scene.

This can improve performance in some cases, where it's e.g. sufficient to
only have a contribution on first 1-2 bounces.
Examples can be found in the differential.

Differential revision: https://developer.blender.org/D1399
2015-07-12 17:56:54 +02:00
6ffc988ae3 BGE Clean-up: New EXP prefix for the BGE Expression module
The expression module now uses an EXP prefix and it follows a
distribution similar to blender.

Additionally the hash function in EXP_HashedPtr.h was simplified and the
files EXP_C-Api.h &.EXP_C-Api.cpp were deleted because were unused.

Reviewers: campbellbarton, moguri, sybren, hg1

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1221
2015-07-12 16:58:12 +02:00
5b0f674e09 Fix crash in redraw timer
Was modifying wrong regions flag, that could also be NULL.
2015-07-13 00:21:08 +10:00
8d48f8e0b0 Add ability for redraw timer to run for fixed time
Also avoid accessing context vars in timer loop.
2015-07-12 22:57:35 +10:00
2fd3b9ad84 PyAPI: Use separate writes for operator reports
This allows us to temp override the stdout and extract individual reports
2015-07-12 22:26:14 +10:00
532b735ee8 Docs; Py API gotcha's section
Minor corrections and cleanup
2015-07-12 20:50:44 +10:00
5c8fc8e505 Use const for direntry strings 2015-07-12 05:50:07 +10:00
Julian Eisel
8c67b8ffe9 File Browser: Fix possible bug and some minor tweaks
BLI_add_slash appended to a char *, a potential buffer overflow

Also partially removed an assert, which failed after changing file format of a saved image. We need a better way to handle such cases.
2015-07-11 21:44:42 +02:00
7b1489b93b Error in last commit 2015-07-12 05:35:44 +10:00
968351d916 Minor changes for more efficient endian switching 2015-07-12 05:33:04 +10:00
17ebbc06e2 Use const for sculpt vars
resolves building with gcc4.9
2015-07-12 03:50:39 +10:00
5a19d9d8f3 ImBuf: Fix compilation error with older libpng
Older libpng library does not use const pointer to a memory.

The exact version is a bit of a guess here, maybe needs tweaks to it tho.
2015-07-11 19:18:20 +02:00
3a810bfed6 remove redundant casts 2015-07-12 02:53:37 +10:00
eed7efa151 error in own last commit 2015-07-12 02:31:46 +10:00
b610ec50de Add Thai and Khmer charsets to our i18n font. 2015-07-11 18:03:18 +02:00
a6259d4290 Avoid static var for OpenEXR 2015-07-12 01:45:30 +10:00
e42e01875e Make Iris image loading thread-safe
Needed for thumbnails
2015-07-12 01:13:33 +10:00
2410797ab1 ImBuf: cleanup, use const for memory passed in 2015-07-12 01:07:59 +10:00
03d8907ca7 Add some basic report/timing/logging tool as util py module progress_report.
It supports any level of sub-steps, timing, messaging, and uses WindowManage.progress API
to report progress in UI, in addition to console printing.
2015-07-11 16:50:22 +02:00
114e7eaa09 Add WM_framebuffer_to_index_array
Convert buffer to index in one loop,
also minor cleanup to backbuf/selection functions.

- Use IMB_rectcpy instead of inline pixel copy.
- Redundant WM_framebuffer_to_index call.
2015-07-11 23:21:41 +10:00
Julian Eisel
02b3618873 File Browser: Keep file name after changing directory
Actually this was an intentional change in rBaeeb23efa28dc to prevent Blender from trying to open the old file from the new directory. Issue is that this is really bad for saving and basically breaks "Save As".

Some more tweaks were needed to make it work like before, so now it keeps the name of the last selected file, but clears it when selecting a folder.
2015-07-11 05:48:02 +02:00
909fa34c5f BLI_matrix space_transform: Add a 'local-invariant' setter.
`BLI_space_transform_from_matrices()` defines a 'global-invariant' transform
(same point in global space, two different coordinates in local and target spaces).

New `BLI_space_transform_global_from_matrices()` is kind of opposite, it defines
a 'local-invariant' transform (two different points in global space, same coordinates in local and target spaces).

Useful to 'match' meshes.
2015-07-11 00:04:27 +02:00
Julian Eisel
bf3fe67862 Fix T45405: Crash on opening a file (in filebrowser code)
Quoting Bastien from IRC: "Filebrowser is a nest of bad surprises" -- indeed :S
2015-07-10 22:09:14 +02:00
f3d5af4172 Cleanup: use const for mesh functions 2015-07-11 04:39:27 +10:00
0875cb07cc Cleanup: use const for gpu buffer 2015-07-11 03:25:28 +10:00
78cae5bad9 Cleanup: remove redundant includes 2015-07-11 02:49:04 +10:00
3443686399 Sequencer: changes to text effect strip
- default alignment to lower center.
- placement is now relative,
  so changing output size keeps correct placement.
- instead of center override, add align option (left/right/center).

Also don't use pixel-size for setting the font size, on new strips.
Better not have UI prefs impact low level API's.
2015-07-11 02:30:26 +10:00
Julian Eisel
9a3dfa1f21 Fix crash when appending from File Browser
Again own mistake in rBaeeb23efa28dc1
2015-07-10 17:49:58 +02:00
e7a48113a9 Freestyle: Missing __all__ symbols added in D963. 2015-07-10 23:15:59 +09:00
25638a9656 Code cleanup: White space and dead code. 2015-07-10 23:15:57 +09:00
Folkert de Vries
eeeb845d33 Freestyle: new stroke modifiers
This patch introduces a couple new stroke modifiers. The ones currently implemented are based on prototypes by @kjym3 and myself.

The new modifiers:
  - Tangent
  - Thickness noise
  - Crease Angle
  - Simplification
  - Curvature 3D

The documentation for these new modifier types can be found [[ http://www.blender.org/manual/render/freestyle/parameter_editor/index.html | in the manual ]]:

{F134441}
(left: AnisotropicThicknessShader, right: NoiseThicknessShader)

{F140499}
(left: Curvature 3D, right: Simplification)

Author: Folkert de Vries (flokkievids)

Reviewers: kjym3

Subscribers: #user_interface, plasmasolutions, kjym3

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D963
2015-07-10 23:15:56 +09:00
7837f0e833 BLI_math 'compare' cleanup & enhancements.
This commit:
* Adds a 'compare_ff' function for absolute 'almost equal' comparison of floats.
* Makes 'compare_vxvx' functions use that new 'compare_ff' one.
* Adds a 'compare_ff_relative' function for secured ulp-based relative comparison of floats.
* Adds matching 'compare_vxvx_relative' functions.
* Adds some basic tests for compare_ff_relative.

See https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

Note that we could replace our python/mathutils' EXPP_FloatsAreEqual() by BLI's compare_ff_relative
(using a very small absolute max_diff), but these do not have exact same behavior...
Left a comment there for now, we can do it later if/when we are sure it won't break anything!
2015-07-10 15:02:43 +02:00
bbcbd2eed9 REmove stupid apple check on OMP in weightvg modifier.
This is handled in build files...
2015-07-10 09:56:10 +02:00
a8b8d60c50 CustomData: deprecate CD_ID_MCOL 2015-07-10 16:47:39 +10:00
a7ed374459 makesrna: use int64 for rounding check
Harmless but larger values would overflow
2015-07-10 16:42:36 +10:00
66f1c3b882 DNA: replace GCC poison with ifdef for enums 2015-07-10 15:58:50 +10:00
Julian Eisel
9ebe875dcc Porting second half of widgets to new drawing pipeline 2015-07-10 03:31:22 +02:00
Julian Eisel
58c50e786a Merge branch 'master' into temp-ui-widget-refactor 2015-07-10 01:10:03 +02:00
Julian Eisel
5513fdc629 Fix T45398: Saving file from File Browser doesn't work if no file is selected
Own mistake in rBaeeb23efa28dc16e20
2015-07-09 23:48:55 +02:00
Julian Eisel
f766a61626 File Browser: (Re-)Allow selecting '..' parent entry for file navigation
Selecting '..' entry was intentionally disabled in rB76b4fad6dbda1b10c, however, for file navigation this can be really useful. So this basically allows selecting '..' entry again, *if it is the only entry to select*. It won't be selected using box select, select all or when expanding selection.
2015-07-09 19:48:03 +02:00
Julian Eisel
aeeb23efa2 File Browser: Improve usage of Enter-key to open files/directories
From a user-POV this makes following changes:
* Adds support for using the Enter-key to open directories
* Updates the upper text-buttons for file and directory on selection
* Last selected file/directory is opened now (in sync with upper text-buttons)
* Changes text in open button to "Open Directory" if a directory is selected

D1349, Reviewed by @mont29
2015-07-09 18:40:34 +02:00
26bd1a766a Cleanup: warnings 2015-07-09 19:39:37 +10:00
a837797740 Cleanup: quiet warning 2015-07-09 19:33:02 +10:00
980ea4e54f Use it->second instead of (*it).second in KX_BlenderSceneConverter. 2015-07-09 09:45:21 +02:00
cdbb60b0a3 Select Shortest Path for edit-curve
D1391 by @pink.vertex with own fixes/edits
2015-07-09 17:03:00 +10:00
ee1b1b9e59 Curve: change rules wrt active bezier
Activate the vertex even if only a single handle is selected
2015-07-09 14:52:01 +10:00
bbc4a92318 Curve selection, de-duplicate & cleanup 2015-07-09 14:39:24 +10:00
Julian Eisel
0d3a3347f0 Port first half of the widgets to new pipeline (drawing only)
Also lots of structuring and cleanup.

Tested each button individually, seems everything is fine (menu items are doing weird things though, didn't investigate yet).
2015-07-09 04:19:41 +02:00
Julian Eisel
db5e89ad5c Initial refactor of interface widget architecture
Initial refactor of interface widget architecture towards the following goals:
* Widget Draw Styles (see T45025 - heavily overlaps with this)
* Isolating widget code to make it more future proof
* Adding callback based widgets handling module (currently handled in interface_handler.c)

Adds the following folders/files:
interface/widgets/
interface/widgets/widgets.c
interface/widgets/widgets.h
interface/widgets/widgets_draw/
interface/widgets/widgets_draw/drawstyle_classic.c
interface/widgets/widgets_draw/widgets_draw.c
interface/widgets/widgets_draw/widgets_draw_intern.h

Not sure if editors/interface/ is the right place for this, but depends on some further decisions.
2015-07-09 01:13:22 +02:00
ec64bf17e3 Select Similar for edit-curve
D1381 by @johnroper100 with edits
2015-07-09 03:03:19 +10:00
161bbfcd19 Add BKE_nurb_bpoint_calc_normal 2015-07-09 02:56:04 +10:00
4a328a7689 EditCurve: move selection into own file 2015-07-09 00:09:26 +10:00
de6b4dc7f7 Fix/Cleanup mesh remap dest transformation in tree/source space.
In org work, bvhtree helpers were modifying passed co/no in place according to given transform.

However, during review pass we decided this was bad, and made them modify copies. But this broke
some cases where we'd do extra tests after bvhtree query, expecting tmp_co to be in tree (aka source) space!

Further more, since in quite a few cases we were already doing that transform outside of bvhtree helpers,
decided to remove this alltogether from the helpers - makes things more clear and easy to follow,
avoids needless copy of vector, and ensures we are always using tmp_co in its transformed version!
2015-07-07 19:29:17 +02:00
30b7aafe33 Correct default enum values
Had assert creating cheat sheet
2015-07-07 23:10:08 +10:00
3dc86f586c Cycles: Add debug print about CLEW initialization status 2015-07-07 14:37:12 +02:00
37539962fe Cycles: Add an option to force disable all OpenCL devices
This way it's possible to disable OpenCL devices for AMD devices
which are considered whitelisted.
2015-07-07 14:18:45 +02:00
0c14a897dd BGE: Fix wrong current logic manager in collision callback. 2015-07-07 13:37:27 +02:00
1d021956f5 Remove redundant lists, link instead 2015-07-07 21:25:51 +10:00
86f09e58d4 Remove unnecessary constant info
Noting every constant as an int isnt helping,
this is only meant to be passed to only.
2015-07-07 21:17:33 +10:00
5af1daa2dc Fix for recent error, ngons now flipped correctly 2015-07-07 20:29:13 +10:00
23aa425cd9 Using proper subtype in game object velocity clamping properties.
The game.velocity_{min,max} and game.angular_velocity_{min,max} object
RNA properties did not use a subtype, and thus velocity was always
displayed as radians or blender units instead of the configured units.

Reviewed by: campbellbarton
2015-07-07 11:59:28 +02:00
afa25b1136 Minor simplification for uv edge drawing 2015-07-07 15:08:45 +10:00
Quentin Wenger
6ed1a1abe2 BGE: bge.texture API documentation enhancement
This patch attempts to improve and review the documentation of bge.texture, as requested in the [[ http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/GameEngine#Video_Texture | TODO list ]].

More specifically, it

  - fixes the rst syntax, including titles of the examples bge.texture.py and bge.texture.1.py;

  - adds, standardizes and reviews description of the API elements, particularly signatures, types, etc.

  - adds SOURCE_* constants to the doc

  - splits the doc into thematical parts (Video, Image, Texture, and Filter Classes, Functions, Constants).

Notes:

  - The parameter "mode" of ImageBuff.plot has to be described better. Actually, the whole set of IMB_BLEND_* constants (from IMB_imbuf.h) should be exposed to Python. I'll do that in a future diff, and complete the doc at the same moment (adding those IMB_BLEND_* constants to the Constants part of this doc).

  - The option of using webcams in VideoFFmpeg is still particularly not well documented. I am planning to make a proposal about fixing T18634 (and its corresponding TODO in the list) by integrating OpenCV in the BGE (and Blender?). The idea would then probably be to add a new class, f.ex. ImageWebcam, making this functionnality more specialized. So for now I don't think it is worth to document that part much.

This patch fixes T44284 too.

Reviewers: moguri, kupoman, campbellbarton, panzergame, lordloki

Reviewed By: panzergame, lordloki

Subscribers: hg1

Projects: #game_engine, #game_python, #documentation

Maniphest Tasks: T44284

Differential Revision: https://developer.blender.org/D1352
2015-07-06 21:48:25 +02:00
791b5fe9d0 Fix T45331, a bevel regression for 2.75.
Got bad results when two beveled edges form straight line
and there are two or more unbeveled edges attached to either
side of the connecting vertex.
2015-07-06 13:27:01 -04:00
Dalai Felinto
93608e4f3b Fix T45237: Dither does not work 2015-07-06 11:51:40 -03:00
Dalai Felinto
6a132aa65d Fix T45290: Selecting passes in image editor does no longer work
This issue was introduced with the wrong fix I committed for dither (rB56ca7f34)
Which also means T45237 has to be re-open
2015-07-06 11:15:16 -03:00
12583287e7 BGE: Fix T45341: Crash when camera is eliminated
A null check is added to avoid crashes when the camera is removed during
the game and no other is available
2015-07-06 15:40:50 +02:00
266459c7da Fix T45328: Crash upon finishing render with 'Cache Result' enabled 2015-07-06 12:35:11 +02:00
be07ab58c6 BGE Fix T45207: Camera actuator shakes with low height
The camera-aiming code was using a near-zero-length cross product, which
caused oscillations. Thresholding on the cross product length seems to
fix this.

Reviewers: lucky3, Matpi, lordloki

Reviewed By: lordloki

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1387
2015-07-06 12:20:29 +02:00
28d712b238 Remove redundant face-flipping check 2015-07-06 19:21:19 +10:00
72565fbf30 Cleanup: style, spelling 2015-07-06 17:45:11 +10:00
499308d079 CMake: use cmake commands where possible 2015-07-06 13:34:32 +10:00
15c301f533 Change default for bevel to match previous behavior.
Have reconsidered and feel it best to try matching previous behavior
(doing "loop slides" where possible) as default. This will avoid the
need to change regression tests, among other things.
2015-07-05 13:31:26 -04:00
12aff8d783 Add 'loop slide' option to bevel. See T45260
Current behavior of bevel is to 'loop slide' along unbeveled edges
when possible, but this produces uneven bevel widths sometimes,
so this option lets user choose between having the loop slide effect
or having more even bevel widths. Trying it out with default being
'no loop slide', so different from current behavior. May reverse this
choice later, depending on user reactions.
2015-07-05 09:53:17 -04:00
51e9a814c9 Correct vert-slide helper-line scale
Was invalid in perspective view
2015-07-05 22:35:04 +10:00
6022bfbc05 Correct comment 2015-07-05 22:19:01 +10:00
2b63ec2894 Fix T45319: Set same precision for 3D cursor location as other locations (objects', vertices', etc.). 2015-07-05 10:55:59 +02:00
6de7f3c747 GPencil: use ctrl+x/del for dissolve
Move dissolve into own operator (as with mesh/armature)
2015-07-05 14:34:17 +10:00
68d72e2164 Add key toggle (V) to bevel tool to turn vertex-only on/off. 2015-07-04 10:14:47 -04:00
8d15cad449 Cleanup: Typo in comment. 2015-07-04 13:17:29 +02:00
631b53bad4 RNA: Match enum string to UI name
Having different terminology for enum's is confusing for scripters.
2015-07-04 13:02:59 +10:00
b997bda9f9 BGE: Fix T45259 collision sensor registration. 2015-07-03 23:48:26 +02:00
749f346ce0 BGE: Add alpha to coverage render mode.
This patch add a new option for transparency meshes : Alpha to coverage, in the game setting panel in material.
The alpha to coverage request a multisample, the best is 8x but 4x and 2x can also give nice render.

4x alpha clip : http://www.pasteall.org/pic/show.php?id=89464
4x alpha to coverage : http://www.pasteall.org/pic/show.php?id=89463

Reviewers: moguri, kupoman, campbellbarton, psy-fi

Reviewed By: psy-fi

Subscribers: lordloki, rdb

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1354
2015-07-03 19:03:29 +02:00
c503d17353 Fix T45281: IOR Value Slider with "Ctrl" modifier does not increment as intended.
Looks like a typo in rB1b8069bd?
2015-07-03 18:56:59 +02:00
e42609db49 Fix T45283: Blender crashes on some grayscale PNGs with alpha.
PNG_COLOR_TYPE_GRAY colortype can have some values for alpha, in the same way as
PNG_COLOR_TYPE_PALETTE colortype.

In this case, we need two channels (grayscale and alpha), not one.
2015-07-03 18:30:58 +02:00
97b431e42d BGE: Add integer uniforms for 2D Filter
Actually it is only possible to pass float properties to a 2D filter (GLSL fragment shader).
This patch allows also to use integer properties for the 2D filter.

Reviewers: sybren, agoose77, kupoman, moguri, lordloki, panzergame

Reviewed By: lordloki, panzergame

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1370
2015-07-03 17:07:31 +02:00
1ace3272aa Walk mode: Add modal shortcuts in UI (header help message). 2015-07-03 15:55:22 +02:00
9133f5a357 Cleanup: 'return' parameters to the end of functions, and use 'r_' prefix for them. 2015-07-03 15:55:22 +02:00
947cdb3acd UI: add ability to access/generate 'shortcuts strings' of modal keymaps.
We already had that for global keymaps (used e.g. to generate shortcuts for menu entries),
but this wasn’t possible for modal keymaps yet (e.g. help message in header during
transforms and other modal operation).

This commit only adds needing background code, it does not change anything from user PoV.
Modal operators will be updated to use it in comming weeks.

Thanks to Campbell for revisions & suggestions. :)

Differential Revision: https://developer.blender.org/D780
2015-07-03 15:55:22 +02:00
36426c3ee2 Cycles: Code cleanup, double semicolon 2015-07-03 15:44:57 +02:00
3129685f38 Sequencer: srt export support.
This commit adds a new operator that will compile the list of text
strips into an srt file. No positioning is supported yet but will
be added later.

The operator can be found in the effect panel in the strip properties.
2015-07-03 12:38:43 +02:00
c864f5d140 Cycles: Error enqueueing split kernels should no longer cause infinite loop 2015-07-03 12:13:38 +02:00
145ab8c49e BGE: Extend Python API for KX_BlenderMaterial (specular, diffuse…)
Add support for material diffuse, specular… in KX_BlenderMaterial python proxy. And use mathutils in KX_BlenderMaterial for the specular and diffuse color in KX_BlenderMaterial.

Reviewers: sybren, brita_, kupoman, agoose77, dfelinto, moguri, campbellbarton, hg1

Reviewed By: moguri, campbellbarton, hg1

Subscribers: dfelinto

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1298
2015-07-03 11:47:48 +02:00
659e5234af Cycles: Use explicit indices for split kernel queues 2015-07-03 11:05:28 +02:00
b9f89b1647 Cycles: Code cleanup in split kernel, whitespaces 2015-07-03 11:03:56 +02:00
Dalai Felinto
80f344fd95 Multi-View UI: convergence is only useless for the parallel camera (toe-in still uses it) 2015-07-03 01:11:35 -03:00
c702dabc3d Fix vertex slide regression w/ rotated objects
This could only be done with certain rotations.
2015-07-03 10:57:38 +10:00
2b5e150db0 BLI_GHash: add BLI_gset_str_new helpers. 2015-07-02 20:35:05 +02:00
626a287c89 Support debug contexts on win32 2015-07-02 20:06:02 +02:00
00808eb39a Make OpenGL debug contexts a flag --debug-gpu instead of a compile time
option.

This makes sense, since contexts get created at runtime, there is little
reason to require recompilation for this.

Only works on linux currently, will be doing more OSs later
2015-07-02 19:30:17 +02:00
Dalai Felinto
a5b2841aa0 RNA Doc: Camera shift affects all cameras (perspective, orthographic and even panoramic) 2015-07-02 13:53:36 -03:00
Dalai Felinto
fdb474fc8a Game Engine: Camera Lens Shift: support to change it during game 2015-07-02 13:51:30 -03:00
145d3540b3 Text effect strip for sequencer.
Is pretty much what it says :)
Easy subtitles for everyone!

Supports size, positioning,
a cheap shadow effect (probably will need more work),
and autocentering on x axis.

Now you can go wild with long spanish names
in your soap opera videos.

Will probably be refined as days go by,
but at least it's now ready for testing.
2015-07-02 18:46:46 +02:00
2723d10704 Render: Solve wrong vertex parent in linked objects with Locked UI
The cleanup function was a bit too much aggressive here, made it much more
conservative. It means memory usage will not be so low anymore, and to
address this we'll need to make this function depsgraph aware.
2015-07-02 16:12:08 +02:00
84b8ce32a4 Fix crash in background mode after the NDof deadzone commit 2015-07-02 15:59:12 +02:00
d96842bf19 Fix: Keyframe indicators for NLA Strip properties fails if the AnimData has an active action 2015-07-02 23:39:34 +12:00
fabc4fc720 BGE: remove check for area in start-game operator
This prevented the BGE from being started from the command-line,
the exec() function checked already.

Also use API calls to find area, region.
2015-07-02 21:31:39 +10:00
e61ead7d4c BGE: Fix T45267 Lib load without material caching. 2015-07-02 12:27:14 +02:00
db8ccc18f7 Fix T45269: Blender 2.75 crashes when I run my the game
Velocity clamping on static objects caused a crash.
2015-07-02 12:05:49 +02:00
e80e4c937b BGE: Fix T45196 armature action on libloading. 2015-07-02 11:56:49 +02:00
1393695145 Linux desktop spec: Add a 'Keyword' field. 2015-07-02 08:53:45 +02:00
1844160a22 DerivedMesh: cleanup & minor edirs
- place return args last position
- move crazyspace function out of DerivedMesh header
- use bool for args
- flow control on own lines to ease debugging
2015-07-02 16:20:22 +10:00
10c1f208b7 Minor edits to --help 2015-07-02 13:17:06 +10:00
Julian Eisel
b05cf040cb Cleanup: Use bool instead of int 2015-07-01 21:48:42 +02:00
5edff01920 Transform: use snap-to-grid behavior from D910
Excuse the trashing here, but seems users prefer this most (though both can be useful).

Note that the UI remains the same,
so this is an option for 'Incremental' snapping instead of a new snapping mode.
2015-07-02 02:20:54 +10:00
19da2d4124 Linux XDesktop spec: add '%f' file specifier to 'Exec' field.
Also reorder alphabetically generic names & comments, and add french comment.
2015-07-01 17:40:34 +02:00
12a8d7e6c4 Cleanup: Make select grouped effect code a bit more readable 2015-07-01 17:37:14 +02:00
6781cf0049 Refactoring:
Make sure SEQ_TYPE_EFFECT is only used as a flag, not as number
comparison.
This should allow us to add new non-effect types in between
effect types (every 8 indices).

Dirty, but alternative of separating type/subtype means we lose
forward compatibility.
2015-07-01 17:33:10 +02:00
607dca0705 BGE: Fix T44069 playing action during libfree. 2015-07-01 16:51:48 +02:00
d3709f4e79 Correct --help message 2015-07-02 00:24:10 +10:00
1a44237d82 Removing gaps will now also move the scene markers, unless markers are
locked
2015-07-01 16:25:28 +02:00
f525483d83 Sequencer metadata:
Add option to render strip metadata to final result, bypassing current
scene metadata.
2015-07-01 15:23:21 +02:00
0e084f93d9 BGE: Remove KX_PolygonMaterial reference in documentation. 2015-07-01 14:56:02 +02:00
d3109a1937 BPlayer compile fix © 2015-07-01 12:34:04 +02:00
53d12bbe04 atomic_ops: Fix MSVC versions of add/sub returning original value instead of result of operation.
Thanks to Brecht for tip about how to fix this!
2015-07-01 12:25:32 +02:00
174d5cf627 atomic_ops: fix typo in func names (uint32 instead of uint64). 2015-07-01 12:25:31 +02:00
78de47ca24 Cycles: Fix zero-size buffer allocation with OpenCL devices
This is not really supported by OpenCL but might happen in certain
configurations. There might be some remained cases when this happens
but so far can not find any,
2015-07-01 11:56:48 +02:00
9b64ebc605 Fix T45253: Particle emitter volume mode and grid mode broken in 2.75.x
This is a regression since dced56f and root of the issue comes to the fact
that grid distribution sets UNEXIST flag during distribution, which is then
being reset in initialize_all_particles().

This commit solves the issue, but it's not really nice and some smart guy
might want to revisit it.
2015-07-01 10:32:30 +02:00
95a1e99909 Particles: Code cleanup, whitespace 2015-07-01 09:33:52 +02:00
a77edab320 Cleanup: use bools 2015-07-01 16:57:18 +10:00
58d65dd976 Cleanup: use cross_v2v2 function 2015-07-01 16:37:05 +10:00
d9046ccbd4 Cleanup: doxygen comments 2015-07-01 16:30:26 +10:00
1779452eb4 Cleanup: use swap math funcs 2015-07-01 16:02:30 +10:00
45b2218341 User Prefs for NDOF dead-zone
D1344 with edits
2015-07-01 13:45:19 +10:00
b71c27a446 Use macro for user-prefs version checks 2015-07-01 12:48:53 +10:00
cf1bac3f69 Cycles: Solve some harmless NULL pointer magic
Was harmless but confused some sanity checks, also kinda makes sense
to be more verbose about what's going on there.
2015-06-30 23:41:19 +02:00
Julian Eisel
5e9b43cc61 Fix 1px gap in regions drawn with region overlap 2015-06-30 21:04:25 +02:00
6510e40500 Fix T45240: New depsgraph ignores animation applied on the curve data 2015-06-30 18:11:21 +02:00
21db9fff12 Fix T45238: New depsgraph flickers with the lattice modifier 2015-06-30 18:00:24 +02:00
00bfca2178 Fix T45241: New depsgraph was lacking update of python drivers on time change
It's quite tricky to see if the driver actually depends on time or not,
so currently used approach when we'll be doing some extra updates.

This seems to correspond to how old depsgraph was dealing with this.
2015-06-30 17:34:57 +02:00
c1d6a26842 Fix T45239: New depsgraph does not work with IK pole target 2015-06-30 16:48:43 +02:00
7039808899 Fix T45251 custom directory not taken into account for image proxies. 2015-06-30 16:31:30 +02:00
72d21fbd34 Fix for mistake in grid-snap patch 2015-06-30 23:55:14 +10:00
6de17c60bf Select flush deleting edgeloop in edge mode too 2015-06-30 22:50:32 +10:00
df19da3a8b CMake: remove helper text
Its out of date, better use the wiki building docs.
2015-06-30 22:46:55 +10:00
3bb698646a CMake: minor edits 2015-06-30 22:44:27 +10:00
c07bba1b05 Transform: add back absolute snapping option
This ensures that vertices are grid-aligned while transforming,
instead of just snapping the input values for translate.
2015-06-30 19:14:46 +10:00
5d3ba4fb80 Cleanup: transform grid snap round, not floor 2015-06-30 18:26:37 +10:00
cec0138bcc Note that closest_point_on_mesh is in object space 2015-06-30 15:47:44 +10:00
cfd36476a1 Cleanup: use const for screen functions 2015-06-30 15:31:55 +10:00
d59721e47a Cleanup: move BLI_char_switch into BLI_string 2015-06-30 15:18:03 +10:00
d17cb3f75f Cleanup: use BLI_str prefix for BLI_replacestrN 2015-06-30 14:50:34 +10:00
8bef305b6d Cleanup: move BLI_timestr to BLI_timecode 2015-06-30 14:47:31 +10:00
Dalai Felinto
56ca7f34dd Fix T45237: Dither dosn't work in Blender Internal Renderer after Multi-View 2015-06-29 18:10:15 -03:00
Julian Eisel
40d19b519d Node Editor: Use Smaller Factor for Grid Snapping
An attempt to treat @sebastian_k's blood pressure a bit.
2015-06-29 22:05:13 +02:00
079b41dd37 Remove WITH_TESTS_PERFORMANCE option.
Performance tests now have their own CMake macro, which ensures they do not get
added to ctest list, so we do not have to bother about them anymore, and can always
build them (when GTests are enabled, of course).
2015-06-29 20:26:58 +02:00
117bcfe039 GTests: do not add 'performance' tests to auto-ran tests (with ctest or 'make test')... 2015-06-29 18:15:02 +02:00
a8bc5f0cdb Fix .obj testing. 2015-06-29 18:14:27 +02:00
Dalai Felinto
f12b1790a0 Fix 73841 : Game Engine - Camera Lens Shift
This is essential for video projection, and the alternative until now was to manually change the projection matrix via Python.
( http://www.blender.org/manual/game_engine/camera/introduction.html#camera-lens-shift
- this page will be removed as soon as I commit this)

Also this is working for perspective and orto cameras BUT if the sensor is not AUTO it will only look correct in blenderplayer (this is an unrelated bug, but just in case someone runs into it while testing this, now you know why you got the issue).

Kudos for the BlenderVR project for supporting this feature development.

Differential Revision: https://developer.blender.org/D1379
2015-06-29 10:45:27 -03:00
Dalai Felinto
3d12d4b94f Fix T45234: Stereo Parallel vs. Off-Axis
Parallel rendering was not working.

The idea of having parallel convergence mode to render as parallel but
visualize as off-axis was good, but it was leading to some complications
in the code.

I think it's more clear to the user if parallel looks and render as
parallel, and if she wants to pre-visualize the converged planes, simply
temporarily set the camera to off-axis.
2015-06-29 10:24:25 -03:00
1042 changed files with 46956 additions and 23225 deletions

View File

@@ -158,25 +158,30 @@ 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_GAMEENGINE 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)
endif()
@@ -221,7 +226,15 @@ 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})
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
# 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)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -239,7 +252,13 @@ 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)
@@ -318,9 +337,11 @@ 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)
@@ -354,18 +375,20 @@ 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_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)
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)
@@ -395,7 +418,6 @@ 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
@@ -412,7 +434,6 @@ 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
@@ -421,7 +442,6 @@ mark_as_advanced(
WITH_GL_PROFILE_COMPAT
WITH_GL_PROFILE_CORE
WITH_GL_PROFILE_ES20
WITH_GPU_DEBUG
)
if(WITH_GL_PROFILE_COMPAT)
@@ -697,6 +717,34 @@ 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.
@@ -798,6 +846,14 @@ if(WITH_X11)
endif()
# ----------------------------------------------------------------------------
# Main Platform Checks
#
# - UNIX
# - WIN32
# - APPLE
if(UNIX AND NOT APPLE)
macro(find_package_wrapper)
if(WITH_STATIC_LIBS)
@@ -866,6 +922,13 @@ 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)
@@ -1066,9 +1129,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()
@@ -1079,6 +1142,18 @@ 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")
endif()
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
@@ -1116,12 +1191,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(INFO "GNU gold linker isn't available, using the default system linker.")
endif ()
else()
message(STATUS "GNU gold linker isn't available, using the default system linker.")
endif()
unset(LD_VERSION)
# CLang is the same as GCC for now.
@@ -1499,6 +1574,13 @@ 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)
@@ -1506,6 +1588,16 @@ 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}")
@@ -1825,6 +1917,17 @@ 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
@@ -2352,10 +2455,6 @@ 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)
@@ -2863,7 +2962,6 @@ 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

@@ -514,6 +514,10 @@ 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
@@ -540,13 +544,25 @@ 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']:
@@ -766,6 +782,8 @@ 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")
@@ -789,6 +807,7 @@ 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")

View File

@@ -27,9 +27,10 @@ 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-opencollada,\
force-ffmpeg,\
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,skip-opencollada,\
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,\
required-numpy: \
-- "$@" \
)
@@ -138,6 +139,9 @@ 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.
@@ -174,6 +178,9 @@ 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.
@@ -233,6 +240,12 @@ 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
@@ -375,6 +388,11 @@ 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
@@ -384,6 +402,7 @@ 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
@@ -417,6 +436,9 @@ 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
;;
@@ -447,6 +469,9 @@ while true; do
--skip-osl)
OSL_SKIP=true; shift; continue
;;
--skip-osd)
OSD_SKIP=true; shift; continue
;;
--skip-opencollada)
OPENCOLLADA_SKIP=true; shift; continue
;;
@@ -509,6 +534,14 @@ 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" )
@@ -1522,6 +1555,99 @@ 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
@@ -1813,8 +1939,9 @@ install_DEB() {
THEORA_DEV="libtheora-dev"
_packages="gawk cmake cmake-curses-gui scons 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 \
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 \
libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev"
@@ -2089,6 +2216,20 @@ 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
@@ -2287,9 +2428,9 @@ install_RPM() {
OGG_DEV="libogg-devel"
THEORA_DEV="libtheora-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 \
_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 \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
libxml2-devel yaml-cpp-devel tinyxml-devel"
@@ -2516,7 +2657,7 @@ install_RPM() {
else
if $have_llvm; then
# No package currently!
install_packages_RPM flex bison git
install_packages_RPM flex bison
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
install_packages_RPM tbb-devel
fi
@@ -2527,12 +2668,29 @@ 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 git
install_packages_RPM pcre-devel
# Find path to libxml shared lib...
_XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
# No package...
@@ -2640,7 +2798,8 @@ install_ARCH() {
OGG_DEV="libogg"
THEORA_DEV="libtheora"
_packages="base-devel scons cmake libxi glew libpng libtiff wget openal \
_packages="base-devel git scons cmake \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw \
libxml2 yaml-cpp tinyxml"
@@ -2827,7 +2986,7 @@ install_ARCH() {
clean_OSL
else
#XXX Note: will fail to build with LLVM 3.2!
install_packages_ARCH git intel-tbb
install_packages_ARCH intel-tbb
PRINT ""
compile_OSL
fi
@@ -2836,6 +2995,20 @@ 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
@@ -2846,7 +3019,7 @@ install_ARCH() {
install_packages_ARCH opencollada
clean_OpenCOLLADA
else
install_packages_ARCH pcre git
install_packages_ARCH pcre
PRINT ""
compile_OpenCOLLADA
fi
@@ -3011,6 +3184,14 @@ 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"
@@ -3077,6 +3258,13 @@ 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
@@ -3123,7 +3311,27 @@ elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
DISTRO="RPM"
install_RPM
else
ERROR "Failed to detect distribution type"
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 ""
exit 1
fi

View File

@@ -2,4 +2,5 @@ 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 = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
BF_CYCLES_CUDA_BINARIES_ARCH = []

View File

@@ -166,6 +166,15 @@ 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'
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -166,6 +166,15 @@ 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'
# 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, "gooseberry"]
NIGHT_SCHEDULE_BRANCHES = [None]
# 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

@@ -57,7 +57,10 @@ if 'cmake' in builder:
retcode = subprocess.call(['cmake', blender_dir] + cmake_options)
if retcode != 0:
sys.exit(retcode)
if 'win' in builder:
if 'win32' in builder:
retcode = subprocess.call(['msbuild', 'INSTALL.vcxproj', '/Property:PlatformToolset=v120_xp', '/p:Configuration=Release'])
elif 'win64' in builder:
retcode = subprocess.call(['msbuild', 'INSTALL.vcxproj', '/p:Configuration=Release'])
else:
retcode = subprocess.call(['make', '-s', '-j4', 'install'])

View File

@@ -123,14 +123,26 @@ 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]
os.rename(result_file, "{}.zip".format(builder))
# 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))
# 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(builder))
z.write("{}.zip".format(builderified_name))
z.close()
sys.exit(retcode)
except Exception as ex:

View File

@@ -0,0 +1,113 @@
# - 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,111 @@
# - 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 NAME SRC EXTRA_LIBS)
macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
if(WITH_GTESTS)
get_property(_current_include_directories
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -40,10 +40,20 @@ macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}"
INCLUDE_DIRECTORIES "${TEST_INC}")
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
if(${DO_ADD_TEST})
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
endif()
endif()
endmacro()
macro(BLENDER_TEST NAME EXTRA_LIBS)
BLENDER_SRC_GTEST("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}")
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")
endmacro()

View File

@@ -97,6 +97,10 @@ 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

@@ -1,5 +1,4 @@
# turn everything OFF except for python which defaults to ON
# and is needed for the UI
# Turn everything ON thats expected for an official release builds.
#
# Example usage:
# cmake -C../blender/build_files/cmake/config/blender_full.cmake ../blender
@@ -13,6 +12,7 @@ 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,11 +52,18 @@ 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)
endif()
if(APPLE)
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()

View File

@@ -48,7 +48,7 @@ macro(list_insert_before
unset(_index)
endmacro()
function (list_assert_duplicates
function(list_assert_duplicates
list_id
)
@@ -343,6 +343,9 @@ 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()
@@ -370,6 +373,16 @@ 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()
@@ -595,6 +608,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
extern_libmv
extern_glog
extern_sdlew
extern_eigen3
bf_intern_glew_mx
)
@@ -673,6 +687,10 @@ 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})

View File

@@ -24,7 +24,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
include(FindGit)
if(GIT_FOUND)
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse --short @{u}
execute_process(COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE

View File

@@ -59,14 +59,21 @@ def is_c_any(filename):
CMAKE_DIR = "."
def cmake_cache_var(var):
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()
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)
for l in lines:
if l.split(":")[0] == var:
return l.split("=", 1)[-1]
def cmake_cache_var(var):
for var_iter, type_iter, value_iter in cmake_cache_var_iter():
if var == var_iter:
return value_iter
return None

View File

@@ -52,6 +52,8 @@ 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'
@@ -213,6 +215,12 @@ 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,6 +26,8 @@ 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'
@@ -226,6 +228,14 @@ 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'
##
CC = 'gcc'
CXX = 'g++'

View File

@@ -23,6 +23,8 @@ 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'
@@ -166,6 +168,12 @@ 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,6 +42,8 @@ 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'
@@ -208,6 +210,12 @@ 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,6 +22,8 @@ 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'
@@ -165,6 +167,12 @@ 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,6 +55,8 @@ 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'
@@ -212,6 +214,12 @@ 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

@@ -242,6 +242,11 @@ 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!
@@ -344,6 +349,13 @@ 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))

View File

@@ -107,6 +107,7 @@ 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',
@@ -182,7 +183,8 @@ def validate_arguments(args, bc):
'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_INTERNATIONAL', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
'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_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'
]
# Have options here that scons expects to be lists
@@ -297,6 +299,11 @@ 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', ''),
@@ -656,6 +663,14 @@ 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)),

View File

@@ -1,104 +0,0 @@
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,7 +11,6 @@
/** \defgroup bmesh BMesh
* \ingroup blender
*/
/** \defgroup texture Texturing */
/** \defgroup compositor Compositing */
/** \defgroup python Python
@@ -322,7 +321,7 @@
* \ingroup gui
*/
/** \defgroup externformats external formats */
/** \defgroup externformats External Formats */
/** \defgroup collada COLLADA
* \ingroup externformats

View File

@@ -2,8 +2,8 @@
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,7 +1,8 @@
"""
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

@@ -31,7 +31,7 @@ class SimpleMouseOperator(bpy.types.Operator):
y = bpy.props.IntProperty()
def execute(self, context):
# rather then printing, use the report function,
# rather than 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

@@ -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
then the bone.
than the bone.
"""
import bpy

View File

@@ -32,14 +32,7 @@ Functions
:arg physicsid_2: The physics id of the second object in constraint.
:type physicsid_2: int
:arg constraint_type: The type of the constraint, one of...
- :class:`POINTTOPOINT_CONSTRAINT`
- :class:`LINEHINGE_CONSTRAINT`
- :class:`ANGULAR_CONSTRAINT`
- :class:`CONETWIST_CONSTRAINT`
- :class:`VEHICLE_CONSTRAINT`
- :class:`GENERIC_6DOF_CONSTRAINT`
:arg constraint_type: The type of the constraint, see `Create Constraint Constants`_.
:type constraint_type: int
@@ -152,22 +145,7 @@ Functions
Sets the debug mode.
:arg mode: The new debug mode.
- :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, see `Debug Mode Constants`_.
:type mode: int

File diff suppressed because it is too large Load Diff

View File

@@ -89,6 +89,48 @@ 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.

View File

@@ -51,6 +51,18 @@ 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

@@ -137,7 +137,7 @@ base class --- :class:`SCA_IObject`
.. note::
A value of 0.0 disables this option (rather then setting it stationary).
A value of 0.0 disables this option (rather than setting it stationary).
.. attribute:: angularVelocityMin
@@ -972,6 +972,16 @@ 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

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

View File

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

View File

@@ -1,4 +1,4 @@
KX_WordlInfo(PyObjectPlus)
KX_WorldInfo(PyObjectPlus)
=============================
.. module:: bge.types
@@ -7,7 +7,7 @@ base class --- :class:`PyObjectPlus`
.. class:: KX_WorldInfo(PyObjectPlus)
A wolrd object.
A world object.
.. code-block:: python

View File

@@ -2,7 +2,8 @@
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:
@@ -10,16 +11,15 @@ This document attempts to help you work with the Blender API in areas that can b
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,20 +32,28 @@ 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
@@ -54,36 +62,45 @@ Downloading and searching the C code isn't so simple, especially if you're not f
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 pythons expressions.
* constraints
* parent objects and all of their f-curves, constraints etc.
- animation function curves.
- drivers and their Python 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:
@@ -94,7 +111,9 @@ 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?
-------------------------------
@@ -103,23 +122,33 @@ 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
@@ -129,16 +158,18 @@ If you insist - yes its possible, but scripts that use this hack wont be conside
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:
@@ -146,35 +177,55 @@ 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 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.
- :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.
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
----------------
+--------------+------------------------------+--------------------------------+--------------------------------+
|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) |
+--------------+------------------------------+--------------------------------+--------------------------------+
.. list-table::
:header-rows: 1
:stub-columns: 1
* - 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
@@ -182,9 +233,18 @@ 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
@@ -192,18 +252,24 @@ 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
@@ -213,9 +279,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.
@@ -223,7 +289,9 @@ 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)``.
@@ -231,7 +299,8 @@ 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::
@@ -241,7 +310,9 @@ Armature Bones in Blender have three distinct data structures that contain them.
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:
@@ -261,7 +332,9 @@ 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:
@@ -281,7 +354,9 @@ 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:
@@ -296,19 +371,27 @@ 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 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.
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.
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
@@ -343,10 +426,13 @@ 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
@@ -358,18 +444,22 @@ If you do need to use name references, its best to use a dictionary to maintain
# normally some code, or function calls...
# use own dictionary rather then bpy.data
# use own dictionary rather than 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.
@@ -394,21 +484,23 @@ 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 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`.
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`.
>>> 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
@@ -449,23 +541,28 @@ 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 encoiding or convert to utf-8 where the input is unknown.
- 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.
* Avoid manipulating filepaths as strings directly, use ``os.path`` functions instead.
.. note::
* 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.
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.
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:
@@ -504,7 +601,8 @@ 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
@@ -521,38 +619,48 @@ This an example of a timer which runs many times a second and moves the default
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
@@ -572,28 +680,36 @@ 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.
@@ -608,7 +724,8 @@ 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
@@ -622,13 +739,15 @@ So after switching edit-mode you need to re-access any object data variables, th
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
@@ -639,15 +758,20 @@ When adding new points to a curve or vertices's/edges/polygons to a mesh, intern
# 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 then 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 than 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.
@@ -658,12 +782,13 @@ 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 then crashing:
print(mesh.name) # <- give an exception rather than 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
@@ -676,9 +801,11 @@ But take care because this is limited to scripts accessing the variable which is
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 quit 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 close Blender immediately.
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.
For example, the ``argparse`` 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.

View File

@@ -59,7 +59,7 @@ 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.
Rather then manually configuring your spaces for Python development,
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.

View File

@@ -81,7 +81,7 @@ Editing a text file externally and having the same text open in Blender does wor
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.
but reference an external file rather than including it directly.
Executing External Scripts
@@ -306,7 +306,7 @@ 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.
To raise Python exceptions on accessing freed data (rather then crashing),
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

View File

@@ -263,6 +263,7 @@ else:
"gpu",
"mathutils",
"mathutils.geometry",
"mathutils.bvhtree",
"mathutils.kdtree",
"mathutils.noise",
"freestyle",
@@ -631,7 +632,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.getargspec(py_func))
arg_str = inspect.formatargspec(*inspect.getfullargspec(py_func))
if not is_class:
func_type = "function"
@@ -1599,7 +1600,7 @@ def write_rst_contents(basepath):
fw("\n")
# fw("`A PDF version of this document is also available <%s>`_\n" % BLENDER_PDF_FILENAME)
fw("`A compressed ZIP file of this site is available <%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files)<%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("\n")
@@ -1644,7 +1645,7 @@ def write_rst_contents(basepath):
standalone_modules = (
# mathutils
"mathutils", "mathutils.geometry", "mathutils.kdtree", "mathutils.noise",
"mathutils", "mathutils.geometry", "mathutils.bvhtree", "mathutils.kdtree", "mathutils.noise",
# misc
"freestyle", "bgl", "blf", "gpu", "aud", "bpy_extras",
# bmesh, submodules are in own page
@@ -1796,6 +1797,7 @@ 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",

View File

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

41
extern/Eigen3/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,41 @@
# ***** 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.
#
# The Original Code is: all of this file.
#
# Contributor(s): Bastien Montagne.
#
# ***** END GPL LICENSE BLOCK *****
set(INC
.
)
set(INC_SYS
)
set(SRC
eigen3_capi.h
intern/eigenvalues.cc
intern/eigenvalues.h
)
blender_add_lib(extern_eigen3 "${SRC}" "${INC}" "${INC_SYS}")

35
extern/Eigen3/SConscript vendored Normal file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python
#
# ***** 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.
#
# The Original Code is: all of this file.
#
# Contributor(s): Bastien Montagne.
#
# ***** END GPL LICENSE BLOCK *****
Import('env')
sources = env.Glob('intern/*.cc')
incs = '.'
defs = []
env.BlenderLib('extern_eigen3', sources, Split(incs), defs, libtype=['extern','player'], priority=[10, 185])

32
extern/Eigen3/eigen3_capi.h vendored Normal file
View File

@@ -0,0 +1,32 @@
/*
* ***** 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_C_API_H__
#define __EIGEN3_C_API_H__
#include "intern/eigenvalues.h"
#endif /* __EIGEN3_C_API_H__ */

70
extern/Eigen3/intern/eigenvalues.cc vendored Normal file
View File

@@ -0,0 +1,70 @@
/*
* ***** 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__ */

40
extern/Eigen3/intern/eigenvalues.h vendored Normal file
View File

@@ -0,0 +1,40 @@
/*
* ***** 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_H__
#define __EIGEN3_EIGENVALUES_C_API_H__
#ifdef __cplusplus
extern "C" {
#endif
bool EG3_self_adjoint_eigen_solve(const int size, const float *matrix, float *r_eigen_values, float *r_eigen_vectors);
#ifdef __cplusplus
}
#endif
#endif /* __EIGEN3_EIGENVALUES_C_API_H__ */

3
extern/SConscript vendored
View File

@@ -11,6 +11,7 @@ SConscript(['colamd/SConscript'])
SConscript(['rangetree/SConscript'])
SConscript(['wcwidth/SConscript'])
SConscript(['libmv/SConscript'])
SConscript(['Eigen3/SConscript'])
if env['WITH_BF_GAMEENGINE']:
SConscript(['recastnavigation/SConscript'])
@@ -24,7 +25,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']:
if env['WITH_BF_COMPOSITOR'] or env['WITH_BF_CYCLES'] or env['WITH_BF_OPENSUBDIV']:
SConscript (['clew/SConscript'])
SConscript (['cuew/SConscript'])

View File

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

View File

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

View File

@@ -77,8 +77,11 @@ if(WITH_OPENNL)
add_subdirectory(opennl)
endif()
if(WITH_OPENSUBDIV)
add_subdirectory(opensubdiv)
endif()
# only windows needs utf16 converter
if(WIN32)
add_subdirectory(utfconv)
endif()

View File

@@ -27,8 +27,7 @@
Import ('env')
SConscript(['audaspace/SConscript',
'string/SConscript',
SConscript(['string/SConscript',
'ghost/SConscript',
'glew-mx/SConscript',
'guardedalloc/SConscript',
@@ -45,6 +44,9 @@ SConscript(['audaspace/SConscript',
# currently only contains headers
# SConscript('container/SConscript')
if env['WITH_BF_AUDASPACE']:
SConscript(['audaspace/SConscript'])
if env ['WITH_BF_REMESH']:
SConscript(['dualcon/SConscript'])
@@ -63,3 +65,5 @@ if env['WITH_BF_BULLET']:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
SConscript(['utfconv/SConscript'])
if env['WITH_BF_OPENSUBDIV']:
SConscript (['opensubdiv/SConscript'])

View File

@@ -123,13 +123,13 @@ atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new)
ATOMIC_INLINE uint64_t
atomic_add_uint64(uint64_t *p, uint64_t x)
{
return InterlockedExchangeAdd64((int64_t *)p, (int64_t)x);
return InterlockedExchangeAdd64((int64_t *)p, (int64_t)x) + x;
}
ATOMIC_INLINE uint64_t
atomic_sub_uint64(uint64_t *p, uint64_t x)
{
return InterlockedExchangeAdd64((int64_t *)p, -((int64_t)x));
return InterlockedExchangeAdd64((int64_t *)p, -((int64_t)x)) - x;
}
ATOMIC_INLINE uint64_t
@@ -215,7 +215,7 @@ atomic_sub_uint64(uint64_t *p, uint64_t x)
}
ATOMIC_INLINE uint64_t
atomic_cas_uint32(uint64_t *v, uint64_t old, uint64_t _new)
atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new)
{
assert(sizeof(uint64_t) == sizeof(unsigned long));
@@ -235,7 +235,7 @@ atomic_sub_uint64(uint64_t *p, uint64_t x)
}
ATOMIC_INLINE uint64_t
atomic_cas_uint32(uint64_t *v, uint64_t old, uint64_t _new)
atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new)
{
return __sync_val_compare_and_swap(v, old, _new);
}
@@ -268,13 +268,13 @@ atomic_cas_uint32(uint32_t *v, uint32_t old, uint32_t _new)
ATOMIC_INLINE uint32_t
atomic_add_uint32(uint32_t *p, uint32_t x)
{
return InterlockedExchangeAdd(p, x);
return InterlockedExchangeAdd(p, x) + x;
}
ATOMIC_INLINE uint32_t
atomic_sub_uint32(uint32_t *p, uint32_t x)
{
return InterlockedExchangeAdd(p, -((int32_t)x));
return InterlockedExchangeAdd(p, -((int32_t)x)) - x;
}
ATOMIC_INLINE uint32_t

View File

@@ -21,6 +21,35 @@
remove_extra_strict_flags()
if(WITH_SYSTEM_AUDASPACE)
set(INC
.
)
set(INC_SYS
${AUDASPACE_C_INCLUDE_DIRS}
${AUDASPACE_PY_INCLUDE_DIRS}
)
set(SRC
intern/AUD_Set.cpp
intern/AUD_Set.h
)
if(WITH_PYTHON)
list(APPEND INC_SYS
${PYTHON_INCLUDE_DIRS}
)
list(APPEND SRC
intern/AUD_PyInit.cpp
intern/AUD_PyInit.h
)
add_definitions(-DWITH_PYTHON)
endif()
else()
set(INC
.
FX
@@ -316,5 +345,6 @@ if(WITH_PYTHON)
)
add_definitions(-DWITH_PYTHON)
endif()
endif()
blender_add_lib(bf_intern_audaspace "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -21,9 +21,15 @@
#
# ***** END LGPL LICENSE BLOCK *****
from os import path
Import ('env')
sources = env.Glob('intern/*.cpp') + env.Glob('FX/*.cpp')
# AUD_PyInit is for external audaspace only
sources.remove(path.join('intern', 'AUD_PyInit.cpp'))
incs = '. intern FX ' + env['BF_PTHREADS_INC'] + ' ' + env['BF_BOOST_INC']
defs = []

View File

@@ -99,7 +99,7 @@ extern "C" {
#include <cassert>
typedef boost::shared_ptr<AUD_IFactory> AUD_Sound;
typedef boost::shared_ptr<AUD_ReadDevice> AUD_Device;
typedef boost::shared_ptr<AUD_IDevice> AUD_Device;
typedef boost::shared_ptr<AUD_IHandle> AUD_Handle;
typedef boost::shared_ptr<AUD_SequencerEntry> AUD_SEntry;
@@ -130,70 +130,69 @@ void AUD_exitOnce()
#endif
}
int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
AUD_Device* AUD_init(const char* device, AUD_DeviceSpecs specs, int buffersize, const char* name)
{
boost::shared_ptr<AUD_IDevice> dev;
if (AUD_device.get()) {
AUD_exit();
AUD_exit(NULL);
}
std::string dname = device;
try {
switch(device) {
case AUD_NULL_DEVICE:
if(dname == "Null") {
dev = boost::shared_ptr<AUD_IDevice>(new AUD_NULLDevice());
break;
}
#ifdef WITH_SDL
case AUD_SDL_DEVICE:
if (SDL_Init == (void *)0) {
printf("Warning: SDL libraries are not installed\n");
// No break, fall through to default, to return false
}
else {
dev = boost::shared_ptr<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize));
break;
}
else if(dname == "SDL")
{
dev = boost::shared_ptr<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize));
}
#endif
#ifdef WITH_OPENAL
case AUD_OPENAL_DEVICE:
else if(dname == "OpenAL")
{
dev = boost::shared_ptr<AUD_IDevice>(new AUD_OpenALDevice(specs, buffersize));
break;
}
#endif
#ifdef WITH_JACK
case AUD_JACK_DEVICE:
else if(dname == "Jack")
{
#ifdef __APPLE__
struct stat st;
if (stat("/Library/Frameworks/Jackmp.framework", &st) != 0) {
printf("Warning: Jack Framework not installed\n");
// No break, fall through to default, to return false
return NULL;
}
else
#endif
if (!AUD_jack_supported()) {
printf("Warning: Jack client not installed\n");
// No break, fall through to default, to return false
printf("Warning: Jack cllient not installed\n");
return NULL;
}
else {
dev = boost::shared_ptr<AUD_IDevice>(new AUD_JackDevice("Blender", specs, buffersize));
break;
dev = boost::shared_ptr<AUD_IDevice>(new AUD_JackDevice(name, specs, buffersize));
}
}
#endif
default:
return false;
else
{
return NULL;
}
AUD_device = dev;
AUD_3ddevice = dynamic_cast<AUD_I3DDevice *>(AUD_device.get());
return true;
return (AUD_Device*)1;
}
catch(AUD_Exception&)
{
return false;
return NULL;
}
}
void AUD_exit()
void AUD_exit(AUD_Device* device)
{
AUD_device = boost::shared_ptr<AUD_IDevice>();
AUD_3ddevice = NULL;
@@ -266,7 +265,7 @@ PyObject *AUD_initPython()
return module;
}
void *AUD_getPythonFactory(AUD_Sound *sound)
void *AUD_getPythonSound(AUD_Sound *sound)
{
if (sound) {
Factory *obj = (Factory *) Factory_empty();
@@ -279,7 +278,7 @@ void *AUD_getPythonFactory(AUD_Sound *sound)
return NULL;
}
AUD_Sound *AUD_getPythonSound(void *sound)
AUD_Sound *AUD_getSoundFromPython(void *sound)
{
Factory *factory = checkFactory((PyObject *)sound);
@@ -291,16 +290,26 @@ AUD_Sound *AUD_getPythonSound(void *sound)
#endif
void AUD_lock()
void AUD_Device_lock(AUD_Device* device)
{
AUD_device->lock();
}
void AUD_unlock()
void AUD_Device_unlock(AUD_Device* device)
{
AUD_device->unlock();
}
AUD_Channels AUD_Device_getChannels(AUD_Device* device)
{
return AUD_device->getSpecs().channels;
}
AUD_SampleRate AUD_Device_getRate(AUD_Device* device)
{
return AUD_device->getSpecs().rate;
}
AUD_SoundInfo AUD_getInfo(AUD_Sound *sound)
{
assert(sound);
@@ -326,19 +335,19 @@ AUD_SoundInfo AUD_getInfo(AUD_Sound *sound)
return info;
}
AUD_Sound *AUD_load(const char *filename)
AUD_Sound *AUD_Sound_file(const char *filename)
{
assert(filename);
return new AUD_Sound(new AUD_FileFactory(filename));
}
AUD_Sound *AUD_loadBuffer(unsigned char *buffer, int size)
AUD_Sound *AUD_Sound_bufferFile(unsigned char *buffer, int size)
{
assert(buffer);
return new AUD_Sound(new AUD_FileFactory(buffer, size));
}
AUD_Sound *AUD_bufferSound(AUD_Sound *sound)
AUD_Sound *AUD_Sound_cache(AUD_Sound *sound)
{
assert(sound);
@@ -351,13 +360,13 @@ AUD_Sound *AUD_bufferSound(AUD_Sound *sound)
}
}
AUD_Sound *AUD_monoSound(AUD_Sound *sound)
AUD_Sound *AUD_Sound_rechannel(AUD_Sound *sound, AUD_Channels channels)
{
assert(sound);
try {
AUD_DeviceSpecs specs;
specs.channels = AUD_CHANNELS_MONO;
specs.channels = channels;
specs.rate = AUD_RATE_INVALID;
specs.format = AUD_FORMAT_INVALID;
return new AUD_Sound(new AUD_ChannelMapperFactory(*sound, specs));
@@ -368,7 +377,7 @@ AUD_Sound *AUD_monoSound(AUD_Sound *sound)
}
}
AUD_Sound *AUD_delaySound(AUD_Sound *sound, float delay)
AUD_Sound *AUD_Sound_delay(AUD_Sound *sound, float delay)
{
assert(sound);
@@ -381,7 +390,7 @@ AUD_Sound *AUD_delaySound(AUD_Sound *sound, float delay)
}
}
AUD_Sound *AUD_limitSound(AUD_Sound *sound, float start, float end)
AUD_Sound *AUD_Sound_limit(AUD_Sound *sound, float start, float end)
{
assert(sound);
@@ -394,7 +403,7 @@ AUD_Sound *AUD_limitSound(AUD_Sound *sound, float start, float end)
}
}
AUD_Sound *AUD_pingpongSound(AUD_Sound *sound)
AUD_Sound *AUD_Sound_pingpong(AUD_Sound *sound)
{
assert(sound);
@@ -407,7 +416,7 @@ AUD_Sound *AUD_pingpongSound(AUD_Sound *sound)
}
}
AUD_Sound *AUD_loopSound(AUD_Sound *sound)
AUD_Sound *AUD_Sound_loop(AUD_Sound *sound)
{
assert(sound);
@@ -420,7 +429,7 @@ AUD_Sound *AUD_loopSound(AUD_Sound *sound)
}
}
int AUD_setLoop(AUD_Handle *handle, int loops)
int AUD_Handle_setLoopCount(AUD_Handle *handle, int loops)
{
assert(handle);
@@ -447,13 +456,13 @@ AUD_Sound *AUD_rectifySound(AUD_Sound *sound)
}
}
void AUD_unload(AUD_Sound *sound)
void AUD_Sound_free(AUD_Sound *sound)
{
assert(sound);
delete sound;
}
AUD_Handle *AUD_play(AUD_Sound *sound, int keep)
AUD_Handle *AUD_Device_play(AUD_Device* device, AUD_Sound *sound, int keep)
{
assert(sound);
try {
@@ -468,19 +477,19 @@ AUD_Handle *AUD_play(AUD_Sound *sound, int keep)
return NULL;
}
int AUD_pause(AUD_Handle *handle)
int AUD_Handle_pause(AUD_Handle *handle)
{
assert(handle);
return (*handle)->pause();
}
int AUD_resume(AUD_Handle *handle)
int AUD_Handle_resume(AUD_Handle *handle)
{
assert(handle);
return (*handle)->resume();
}
int AUD_stop(AUD_Handle *handle)
int AUD_Handle_stop(AUD_Handle *handle)
{
assert(handle);
int result = (*handle)->stop();
@@ -488,31 +497,36 @@ int AUD_stop(AUD_Handle *handle)
return result;
}
int AUD_setKeep(AUD_Handle *handle, int keep)
void AUD_Device_stopAll(void* device)
{
AUD_device->stopAll();
}
int AUD_Handle_setKeep(AUD_Handle *handle, int keep)
{
assert(handle);
return (*handle)->setKeep(keep);
}
int AUD_seek(AUD_Handle *handle, float seekTo)
int AUD_Handle_setPosition(AUD_Handle *handle, float seekTo)
{
assert(handle);
return (*handle)->seek(seekTo);
}
float AUD_getPosition(AUD_Handle *handle)
float AUD_Handle_getPosition(AUD_Handle *handle)
{
assert(handle);
return (*handle)->getPosition();
}
AUD_Status AUD_getStatus(AUD_Handle *handle)
AUD_Status AUD_Handle_getStatus(AUD_Handle *handle)
{
assert(handle);
return (*handle)->getStatus();
}
int AUD_setListenerLocation(const float location[3])
int AUD_Device_setListenerLocation(const float location[3])
{
if (AUD_3ddevice) {
AUD_Vector3 v(location[0], location[1], location[2]);
@@ -523,7 +537,7 @@ int AUD_setListenerLocation(const float location[3])
return false;
}
int AUD_setListenerVelocity(const float velocity[3])
int AUD_Device_setListenerVelocity(const float velocity[3])
{
if (AUD_3ddevice) {
AUD_Vector3 v(velocity[0], velocity[1], velocity[2]);
@@ -534,7 +548,7 @@ int AUD_setListenerVelocity(const float velocity[3])
return false;
}
int AUD_setListenerOrientation(const float orientation[4])
int AUD_Device_setListenerOrientation(const float orientation[4])
{
if (AUD_3ddevice) {
AUD_Quaternion q(orientation[3], orientation[0], orientation[1], orientation[2]);
@@ -545,7 +559,7 @@ int AUD_setListenerOrientation(const float orientation[4])
return false;
}
int AUD_setSpeedOfSound(float speed)
int AUD_Device_setSpeedOfSound(void* device, float speed)
{
if (AUD_3ddevice) {
AUD_3ddevice->setSpeedOfSound(speed);
@@ -555,7 +569,7 @@ int AUD_setSpeedOfSound(float speed)
return false;
}
int AUD_setDopplerFactor(float factor)
int AUD_Device_setDopplerFactor(void* device, float factor)
{
if (AUD_3ddevice) {
AUD_3ddevice->setDopplerFactor(factor);
@@ -565,7 +579,7 @@ int AUD_setDopplerFactor(float factor)
return false;
}
int AUD_setDistanceModel(AUD_DistanceModel model)
int AUD_Device_setDistanceModel(void* device, AUD_DistanceModel model)
{
if (AUD_3ddevice) {
AUD_3ddevice->setDistanceModel(model);
@@ -575,7 +589,7 @@ int AUD_setDistanceModel(AUD_DistanceModel model)
return false;
}
int AUD_setSourceLocation(AUD_Handle *handle, const float location[3])
int AUD_Handle_setLocation(AUD_Handle *handle, const float location[3])
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -588,7 +602,7 @@ int AUD_setSourceLocation(AUD_Handle *handle, const float location[3])
return false;
}
int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3])
int AUD_Handle_setVelocity(AUD_Handle *handle, const float velocity[3])
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -601,7 +615,7 @@ int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3])
return false;
}
int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4])
int AUD_Handle_setOrientation(AUD_Handle *handle, const float orientation[4])
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -614,7 +628,7 @@ int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4])
return false;
}
int AUD_setRelative(AUD_Handle *handle, int relative)
int AUD_Handle_setRelative(AUD_Handle *handle, int relative)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -626,7 +640,7 @@ int AUD_setRelative(AUD_Handle *handle, int relative)
return false;
}
int AUD_setVolumeMaximum(AUD_Handle *handle, float volume)
int AUD_Handle_setVolumeMaximum(AUD_Handle *handle, float volume)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -638,7 +652,7 @@ int AUD_setVolumeMaximum(AUD_Handle *handle, float volume)
return false;
}
int AUD_setVolumeMinimum(AUD_Handle *handle, float volume)
int AUD_Handle_setVolumeMinimum(AUD_Handle *handle, float volume)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -650,7 +664,7 @@ int AUD_setVolumeMinimum(AUD_Handle *handle, float volume)
return false;
}
int AUD_setDistanceMaximum(AUD_Handle *handle, float distance)
int AUD_Handle_setDistanceMaximum(AUD_Handle *handle, float distance)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -662,7 +676,7 @@ int AUD_setDistanceMaximum(AUD_Handle *handle, float distance)
return false;
}
int AUD_setDistanceReference(AUD_Handle *handle, float distance)
int AUD_Handle_setDistanceReference(AUD_Handle *handle, float distance)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -674,7 +688,7 @@ int AUD_setDistanceReference(AUD_Handle *handle, float distance)
return false;
}
int AUD_setAttenuation(AUD_Handle *handle, float factor)
int AUD_Handle_setAttenuation(AUD_Handle *handle, float factor)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -686,7 +700,7 @@ int AUD_setAttenuation(AUD_Handle *handle, float factor)
return false;
}
int AUD_setConeAngleOuter(AUD_Handle *handle, float angle)
int AUD_Handle_setConeAngleOuter(AUD_Handle *handle, float angle)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -698,7 +712,7 @@ int AUD_setConeAngleOuter(AUD_Handle *handle, float angle)
return false;
}
int AUD_setConeAngleInner(AUD_Handle *handle, float angle)
int AUD_Handle_setConeAngleInner(AUD_Handle *handle, float angle)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -710,7 +724,7 @@ int AUD_setConeAngleInner(AUD_Handle *handle, float angle)
return false;
}
int AUD_setConeVolumeOuter(AUD_Handle *handle, float volume)
int AUD_Handle_setConeVolumeOuter(AUD_Handle *handle, float volume)
{
assert(handle);
boost::shared_ptr<AUD_I3DHandle> h = boost::dynamic_pointer_cast<AUD_I3DHandle>(*handle);
@@ -722,7 +736,7 @@ int AUD_setConeVolumeOuter(AUD_Handle *handle, float volume)
return false;
}
int AUD_setSoundVolume(AUD_Handle *handle, float volume)
int AUD_Handle_setVolume(AUD_Handle *handle, float volume)
{
assert(handle);
try {
@@ -732,7 +746,7 @@ int AUD_setSoundVolume(AUD_Handle *handle, float volume)
return false;
}
int AUD_setSoundPitch(AUD_Handle *handle, float pitch)
int AUD_Handle_setPitch(AUD_Handle *handle, float pitch)
{
assert(handle);
try {
@@ -784,13 +798,13 @@ int AUD_setDeviceVolume(AUD_Device *device, float volume)
return false;
}
int AUD_readDevice(AUD_Device *device, data_t *buffer, int length)
int AUD_Device_read(AUD_Device *device, data_t *buffer, int length)
{
assert(device);
assert(buffer);
try {
return (*device)->read(buffer, length);
return boost::dynamic_pointer_cast<AUD_ReadDevice>(*device)->read(buffer, length);
}
catch(AUD_Exception&)
{
@@ -798,12 +812,11 @@ int AUD_readDevice(AUD_Device *device, data_t *buffer, int length)
}
}
void AUD_closeReadDevice(AUD_Device *device)
void AUD_Device_free(AUD_Device *device)
{
assert(device);
try {
delete device;
if(device != &AUD_device)
delete device;
}
catch(AUD_Exception&)
{
@@ -901,7 +914,7 @@ AUD_Handle *AUD_pauseAfter(AUD_Handle *handle, float seconds)
return NULL;
}
AUD_Sound *AUD_createSequencer(float fps, int muted)
AUD_Sound *AUD_Sequence_create(float fps, int muted)
{
// specs are changed at a later point!
AUD_Specs specs;
@@ -911,22 +924,22 @@ AUD_Sound *AUD_createSequencer(float fps, int muted)
return sequencer;
}
void AUD_destroySequencer(AUD_Sound *sequencer)
void AUD_Sequence_free(AUD_Sound *sequencer)
{
delete sequencer;
}
void AUD_setSequencerMuted(AUD_Sound *sequencer, int muted)
void AUD_Sequence_setMuted(AUD_Sound *sequencer, int muted)
{
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->mute(muted);
}
void AUD_setSequencerFPS(AUD_Sound *sequencer, float fps)
void AUD_Sequence_setFPS(AUD_Sound *sequencer, float fps)
{
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->setFPS(fps);
}
AUD_SEntry *AUD_addSequence(AUD_Sound *sequencer, AUD_Sound *sound,
AUD_SEntry *AUD_Sequence_add(AUD_Sound *sequencer, AUD_Sound *sound,
float begin, float end, float skip)
{
if (!sound)
@@ -934,28 +947,23 @@ AUD_SEntry *AUD_addSequence(AUD_Sound *sequencer, AUD_Sound *sound,
return new AUD_SEntry(((AUD_SequencerFactory *)sequencer->get())->add(*sound, begin, end, skip));
}
void AUD_removeSequence(AUD_Sound *sequencer, AUD_SEntry *entry)
void AUD_Sequence_remove(AUD_Sound *sequencer, AUD_SEntry *entry)
{
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->remove(*entry);
delete entry;
}
void AUD_moveSequence(AUD_SEntry *entry, float begin, float end, float skip)
void AUD_SequenceEntry_move(AUD_SEntry *entry, float begin, float end, float skip)
{
(*entry)->move(begin, end, skip);
}
void AUD_muteSequence(AUD_SEntry *entry, char mute)
void AUD_SequenceEntry_setMuted(AUD_SEntry *entry, char mute)
{
(*entry)->mute(mute);
}
void AUD_setRelativeSequence(AUD_SEntry *entry, char relative)
{
(*entry)->setRelative(relative);
}
void AUD_updateSequenceSound(AUD_SEntry *entry, AUD_Sound *sound)
void AUD_SequenceEntry_setSound(AUD_SEntry *entry, AUD_Sound *sound)
{
if (sound)
(*entry)->setSound(*sound);
@@ -963,7 +971,7 @@ void AUD_updateSequenceSound(AUD_SEntry *entry, AUD_Sound *sound)
(*entry)->setSound(AUD_Sound());
}
void AUD_setSequenceAnimData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
void AUD_SequenceEntry_setAnimationData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
{
AUD_AnimateableProperty *prop = (*entry)->getAnimProperty(type);
if (animated) {
@@ -975,7 +983,7 @@ void AUD_setSequenceAnimData(AUD_SEntry *entry, AUD_AnimateablePropertyType type
}
}
void AUD_setSequencerAnimData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
void AUD_Sequence_setAnimationData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated)
{
AUD_AnimateableProperty *prop = dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->getAnimProperty(type);
if (animated) {
@@ -988,21 +996,76 @@ void AUD_setSequencerAnimData(AUD_Sound *sequencer, AUD_AnimateablePropertyType
}
}
void AUD_updateSequenceData(AUD_SEntry *entry, float volume_max, float volume_min,
float distance_max, float distance_reference, float attenuation,
float cone_angle_outer, float cone_angle_inner, float cone_volume_outer)
void AUD_Sequence_setDistanceModel(AUD_Sound* sequence, AUD_DistanceModel value)
{
(*entry)->updateAll(volume_max, volume_min, distance_max, distance_reference, attenuation,
cone_angle_outer, cone_angle_inner, cone_volume_outer);
assert(sequence);
dynamic_cast<AUD_SequencerFactory *>(sequence->get())->setDistanceModel(static_cast<AUD_DistanceModel>(value));
}
void AUD_updateSequencerData(AUD_Sound *sequencer, float speed_of_sound,
float factor, AUD_DistanceModel model)
void AUD_Sequence_setDopplerFactor(AUD_Sound* sequence, float value)
{
AUD_SequencerFactory *f = dynamic_cast<AUD_SequencerFactory *>(sequencer->get());
f->setSpeedOfSound(speed_of_sound);
f->setDopplerFactor(factor);
f->setDistanceModel(model);
assert(sequence);
dynamic_cast<AUD_SequencerFactory *>(sequence->get())->setDopplerFactor(value);
}
void AUD_Sequence_setSpeedOfSound(AUD_Sound* sequence, float value)
{
assert(sequence);
dynamic_cast<AUD_SequencerFactory *>(sequence->get())->setSpeedOfSound(value);
}
void AUD_SequenceEntry_setAttenuation(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setAttenuation(value);
}
void AUD_SequenceEntry_setConeAngleInner(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setConeAngleInner(value);
}
void AUD_SequenceEntry_setConeAngleOuter(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setConeAngleOuter(value);
}
void AUD_SequenceEntry_setConeVolumeOuter(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setConeVolumeOuter(value);
}
void AUD_SequenceEntry_setDistanceMaximum(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setDistanceMaximum(value);
}
void AUD_SequenceEntry_setDistanceReference(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setDistanceReference(value);
}
void AUD_SequenceEntry_setRelative(AUD_SEntry* sequence_entry, int value)
{
assert(sequence_entry);
(*sequence_entry)->setRelative(value);
}
void AUD_SequenceEntry_setVolumeMaximum(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setVolumeMaximum(value);
}
void AUD_SequenceEntry_setVolumeMinimum(AUD_SEntry* sequence_entry, float value)
{
assert(sequence_entry);
(*sequence_entry)->setVolumeMinimum(value);
}
void AUD_setSequencerDeviceSpecs(AUD_Sound *sequencer)
@@ -1010,12 +1073,12 @@ void AUD_setSequencerDeviceSpecs(AUD_Sound *sequencer)
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->setSpecs(AUD_device->getSpecs().specs);
}
void AUD_setSequencerSpecs(AUD_Sound *sequencer, AUD_Specs specs)
void AUD_Sequence_setSpecs(AUD_Sound *sequencer, AUD_Specs specs)
{
dynamic_cast<AUD_SequencerFactory *>(sequencer->get())->setSpecs(specs);
}
void AUD_seekSequencer(AUD_Handle *handle, float time)
void AUD_seekSynchronizer(AUD_Handle *handle, float time)
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1030,7 +1093,7 @@ void AUD_seekSequencer(AUD_Handle *handle, float time)
}
}
float AUD_getSequencerPosition(AUD_Handle *handle)
float AUD_getSynchronizerPosition(AUD_Handle *handle)
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1045,7 +1108,7 @@ float AUD_getSequencerPosition(AUD_Handle *handle)
}
}
void AUD_startPlayback()
void AUD_playSynchronizer()
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1055,7 +1118,7 @@ void AUD_startPlayback()
#endif
}
void AUD_stopPlayback()
void AUD_stopSynchronizer()
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1066,7 +1129,7 @@ void AUD_stopPlayback()
}
#ifdef WITH_JACK
void AUD_setSyncCallback(AUD_syncFunction function, void *data)
void AUD_setSynchronizerCallback(AUD_syncFunction function, void *data)
{
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
if (device) {
@@ -1075,7 +1138,7 @@ void AUD_setSyncCallback(AUD_syncFunction function, void *data)
}
#endif
int AUD_doesPlayback()
int AUD_isSynchronizerPlaying()
{
#ifdef WITH_JACK
AUD_JackDevice *device = dynamic_cast<AUD_JackDevice *>(AUD_device.get());
@@ -1151,12 +1214,12 @@ int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_pe
return length;
}
AUD_Sound *AUD_copy(AUD_Sound *sound)
AUD_Sound *AUD_Sound_copy(AUD_Sound *sound)
{
return new boost::shared_ptr<AUD_IFactory>(*sound);
}
void AUD_freeHandle(AUD_Handle *handle)
void AUD_Handle_free(AUD_Handle *handle)
{
delete handle;
}
@@ -1283,14 +1346,9 @@ AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *sequencer, f
}
}
boost::shared_ptr<AUD_IDevice> AUD_getDevice()
AUD_Device *AUD_Device_getCurrent(void)
{
return AUD_device;
}
AUD_I3DDevice *AUD_get3DDevice()
{
return AUD_3ddevice;
return &AUD_device;
}
int AUD_isJackSupported(void)

View File

@@ -77,22 +77,26 @@ extern void AUD_exitOnce(void);
* \param buffersize The buffersize for the device.
* \return Whether the device has been initialized.
*/
extern int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize);
extern AUD_Device* AUD_init(const char* device, AUD_DeviceSpecs specs, int buffersize, const char* name);
/**
* Unitinitializes an audio device.
*/
extern void AUD_exit(void);
extern void AUD_exit(AUD_Device* device);
/**
* Locks the playback device.
*/
extern void AUD_lock(void);
extern void AUD_Device_lock(AUD_Device* device);
/**
* Unlocks the device.
*/
extern void AUD_unlock(void);
extern void AUD_Device_unlock(AUD_Device* device);
extern AUD_Channels AUD_Device_getChannels(AUD_Device* device);
extern AUD_SampleRate AUD_Device_getRate(AUD_Device* device);
/**
* Returns information about a sound.
@@ -106,7 +110,7 @@ extern AUD_SoundInfo AUD_getInfo(AUD_Sound *sound);
* \param filename The filename of the sound file.
* \return A handle of the sound file.
*/
extern AUD_Sound *AUD_load(const char *filename);
extern AUD_Sound *AUD_Sound_file(const char *filename);
/**
* Loads a sound file.
@@ -114,21 +118,21 @@ extern AUD_Sound *AUD_load(const char *filename);
* \param size The size of the buffer.
* \return A handle of the sound file.
*/
extern AUD_Sound *AUD_loadBuffer(unsigned char *buffer, int size);
extern AUD_Sound *AUD_Sound_bufferFile(unsigned char *buffer, int size);
/**
* Buffers a sound.
* \param sound The sound to buffer.
* \return A handle of the sound buffer.
*/
extern AUD_Sound *AUD_bufferSound(AUD_Sound *sound);
extern AUD_Sound *AUD_Sound_cache(AUD_Sound *sound);
/**
* Rechannels the sound to be mono.
* \param sound The sound to rechannel.
* \return The mono sound.
*/
extern AUD_Sound *AUD_monoSound(AUD_Sound *sound);
extern AUD_Sound *AUD_Sound_rechannel(AUD_Sound *sound, AUD_Channels channels);
/**
* Delays a sound.
@@ -136,7 +140,7 @@ extern AUD_Sound *AUD_monoSound(AUD_Sound *sound);
* \param delay The delay in seconds.
* \return A handle of the delayed sound.
*/
extern AUD_Sound *AUD_delaySound(AUD_Sound *sound, float delay);
extern AUD_Sound *AUD_Sound_delay(AUD_Sound *sound, float delay);
/**
* Limits a sound.
@@ -145,21 +149,21 @@ extern AUD_Sound *AUD_delaySound(AUD_Sound *sound, float delay);
* \param end The stop time in seconds.
* \return A handle of the limited sound.
*/
extern AUD_Sound *AUD_limitSound(AUD_Sound *sound, float start, float end);
extern AUD_Sound *AUD_Sound_limit(AUD_Sound *sound, float start, float end);
/**
* Ping pongs a sound.
* \param sound The sound to ping pong.
* \return A handle of the ping pong sound.
*/
extern AUD_Sound *AUD_pingpongSound(AUD_Sound *sound);
extern AUD_Sound *AUD_Sound_pingpong(AUD_Sound *sound);
/**
* Loops a sound.
* \param sound The sound to loop.
* \return A handle of the looped sound.
*/
extern AUD_Sound *AUD_loopSound(AUD_Sound *sound);
extern AUD_Sound *AUD_Sound_loop(AUD_Sound *sound);
/**
* Sets a remaining loop count of a looping sound that currently plays.
@@ -167,7 +171,7 @@ extern AUD_Sound *AUD_loopSound(AUD_Sound *sound);
* \param loops The count of remaining loops, -1 for infinity.
* \return Whether the handle is valid.
*/
extern int AUD_setLoop(AUD_Handle *handle, int loops);
extern int AUD_Handle_setLoopCount(AUD_Handle *handle, int loops);
/**
* Rectifies a sound.
@@ -180,7 +184,7 @@ extern AUD_Sound *AUD_rectifySound(AUD_Sound *sound);
* Unloads a sound of any type.
* \param sound The handle of the sound.
*/
extern void AUD_unload(AUD_Sound *sound);
extern void AUD_Sound_free(AUD_Sound *sound);
/**
* Plays back a sound file.
@@ -189,28 +193,30 @@ extern void AUD_unload(AUD_Sound *sound);
* paused when its end has been reached.
* \return A handle to the played back sound.
*/
extern AUD_Handle *AUD_play(AUD_Sound *sound, int keep);
extern AUD_Handle *AUD_Device_play(AUD_Device* device, AUD_Sound *sound, int keep);
/**
* Pauses a played back sound.
* \param handle The handle to the sound.
* \return Whether the handle has been playing or not.
*/
extern int AUD_pause(AUD_Handle *handle);
extern int AUD_Handle_pause(AUD_Handle *handle);
/**
* Resumes a paused sound.
* \param handle The handle to the sound.
* \return Whether the handle has been paused or not.
*/
extern int AUD_resume(AUD_Handle *handle);
extern int AUD_Handle_resume(AUD_Handle *handle);
/**
* Stops a playing or paused sound.
* \param handle The handle to the sound.
* \return Whether the handle has been valid or not.
*/
extern int AUD_stop(AUD_Handle *handle);
extern int AUD_Handle_stop(AUD_Handle *handle);
extern void AUD_Device_stopAll(void* device);
/**
* Sets the end behaviour of a playing or paused sound.
@@ -219,7 +225,7 @@ extern int AUD_stop(AUD_Handle *handle);
* paused when its end has been reached.
* \return Whether the handle has been valid or not.
*/
extern int AUD_setKeep(AUD_Handle *handle, int keep);
extern int AUD_Handle_setKeep(AUD_Handle *handle, int keep);
/**
* Seeks a playing or paused sound.
@@ -227,7 +233,7 @@ extern int AUD_setKeep(AUD_Handle *handle, int keep);
* \param seekTo From where the sound file should be played back in seconds.
* \return Whether the handle has been valid or not.
*/
extern int AUD_seek(AUD_Handle *handle, float seekTo);
extern int AUD_Handle_setPosition(AUD_Handle *handle, float seekTo);
/**
* Retrieves the playback position of a handle.
@@ -235,39 +241,39 @@ extern int AUD_seek(AUD_Handle *handle, float seekTo);
* \return The current playback position in seconds or 0.0 if the handle is
* invalid.
*/
extern float AUD_getPosition(AUD_Handle *handle);
extern float AUD_Handle_getPosition(AUD_Handle *handle);
/**
* Returns the status of a playing, paused or stopped sound.
* \param handle The handle to the sound.
* \return The status of the sound behind the handle.
*/
extern AUD_Status AUD_getStatus(AUD_Handle *handle);
extern AUD_Status AUD_Handle_getStatus(AUD_Handle *handle);
/**
* Sets the listener location.
* \param location The new location.
*/
extern int AUD_setListenerLocation(const float location[3]);
extern int AUD_Device_setListenerLocation(const float location[3]);
/**
* Sets the listener velocity.
* \param velocity The new velocity.
*/
extern int AUD_setListenerVelocity(const float velocity[3]);
extern int AUD_Device_setListenerVelocity(const float velocity[3]);
/**
* Sets the listener orientation.
* \param orientation The new orientation as quaternion.
*/
extern int AUD_setListenerOrientation(const float orientation[4]);
extern int AUD_Device_setListenerOrientation(const float orientation[4]);
/**
* Sets the speed of sound.
* This value is needed for doppler effect calculation.
* \param speed The new speed of sound.
*/
extern int AUD_setSpeedOfSound(float speed);
extern int AUD_Device_setSpeedOfSound(void* device, float speed);
/**
* Sets the doppler factor.
@@ -275,13 +281,13 @@ extern int AUD_setSpeedOfSound(float speed);
* listener which is used while calculating the doppler effect.
* \param factor The new doppler factor.
*/
extern int AUD_setDopplerFactor(float factor);
extern int AUD_Device_setDopplerFactor(void* device, float factor);
/**
* Sets the distance model.
* \param model distance model.
*/
extern int AUD_setDistanceModel(AUD_DistanceModel model);
extern int AUD_Device_setDistanceModel(void* device, AUD_DistanceModel model);
/**
* Sets the location of a source.
@@ -289,7 +295,7 @@ extern int AUD_setDistanceModel(AUD_DistanceModel model);
* \param location The new location.
* \return Whether the action succeeded.
*/
extern int AUD_setSourceLocation(AUD_Handle *handle, const float location[3]);
extern int AUD_Handle_setLocation(AUD_Handle *handle, const float location[3]);
/**
* Sets the velocity of a source.
@@ -297,7 +303,7 @@ extern int AUD_setSourceLocation(AUD_Handle *handle, const float location[3]);
* \param velocity The new velocity.
* \return Whether the action succeeded.
*/
extern int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3]);
extern int AUD_Handle_setVelocity(AUD_Handle *handle, const float velocity[3]);
/**
* Sets the orientation of a source.
@@ -305,7 +311,7 @@ extern int AUD_setSourceVelocity(AUD_Handle *handle, const float velocity[3]);
* \param orientation The new orientation as quaternion.
* \return Whether the action succeeded.
*/
extern int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[4]);
extern int AUD_Handle_setOrientation(AUD_Handle *handle, const float orientation[4]);
/**
* Sets whether the source location, velocity and orientation are relative
@@ -314,7 +320,7 @@ extern int AUD_setSourceOrientation(AUD_Handle *handle, const float orientation[
* \param relative Whether the source is relative.
* \return Whether the action succeeded.
*/
extern int AUD_setRelative(AUD_Handle *handle, int relative);
extern int AUD_Handle_setRelative(AUD_Handle *handle, int relative);
/**
* Sets the maximum volume of a source.
@@ -322,7 +328,7 @@ extern int AUD_setRelative(AUD_Handle *handle, int relative);
* \param volume The new maximum volume.
* \return Whether the action succeeded.
*/
extern int AUD_setVolumeMaximum(AUD_Handle *handle, float volume);
extern int AUD_Handle_setVolumeMaximum(AUD_Handle *handle, float volume);
/**
* Sets the minimum volume of a source.
@@ -330,7 +336,7 @@ extern int AUD_setVolumeMaximum(AUD_Handle *handle, float volume);
* \param volume The new minimum volume.
* \return Whether the action succeeded.
*/
extern int AUD_setVolumeMinimum(AUD_Handle *handle, float volume);
extern int AUD_Handle_setVolumeMinimum(AUD_Handle *handle, float volume);
/**
* Sets the maximum distance of a source.
@@ -340,7 +346,7 @@ extern int AUD_setVolumeMinimum(AUD_Handle *handle, float volume);
* \param distance The new maximum distance.
* \return Whether the action succeeded.
*/
extern int AUD_setDistanceMaximum(AUD_Handle *handle, float distance);
extern int AUD_Handle_setDistanceMaximum(AUD_Handle *handle, float distance);
/**
* Sets the reference distance of a source.
@@ -348,7 +354,7 @@ extern int AUD_setDistanceMaximum(AUD_Handle *handle, float distance);
* \param distance The new reference distance.
* \return Whether the action succeeded.
*/
extern int AUD_setDistanceReference(AUD_Handle *handle, float distance);
extern int AUD_Handle_setDistanceReference(AUD_Handle *handle, float distance);
/**
* Sets the attenuation of a source.
@@ -357,7 +363,7 @@ extern int AUD_setDistanceReference(AUD_Handle *handle, float distance);
* \param factor The new attenuation.
* \return Whether the action succeeded.
*/
extern int AUD_setAttenuation(AUD_Handle *handle, float factor);
extern int AUD_Handle_setAttenuation(AUD_Handle *handle, float factor);
/**
* Sets the outer angle of the cone of a source.
@@ -365,7 +371,7 @@ extern int AUD_setAttenuation(AUD_Handle *handle, float factor);
* \param angle The new outer angle of the cone.
* \return Whether the action succeeded.
*/
extern int AUD_setConeAngleOuter(AUD_Handle *handle, float angle);
extern int AUD_Handle_setConeAngleOuter(AUD_Handle *handle, float angle);
/**
* Sets the inner angle of the cone of a source.
@@ -373,7 +379,7 @@ extern int AUD_setConeAngleOuter(AUD_Handle *handle, float angle);
* \param angle The new inner angle of the cone.
* \return Whether the action succeeded.
*/
extern int AUD_setConeAngleInner(AUD_Handle *handle, float angle);
extern int AUD_Handle_setConeAngleInner(AUD_Handle *handle, float angle);
/**
* Sets the outer volume of the cone of a source.
@@ -383,7 +389,7 @@ extern int AUD_setConeAngleInner(AUD_Handle *handle, float angle);
* \param volume The new outer volume of the cone.
* \return Whether the action succeeded.
*/
extern int AUD_setConeVolumeOuter(AUD_Handle *handle, float volume);
extern int AUD_Handle_setConeVolumeOuter(AUD_Handle *handle, float volume);
/**
* Sets the volume of a played back sound.
@@ -391,7 +397,7 @@ extern int AUD_setConeVolumeOuter(AUD_Handle *handle, float volume);
* \param volume The new volume, must be between 0.0 and 1.0.
* \return Whether the action succeeded.
*/
extern int AUD_setSoundVolume(AUD_Handle *handle, float volume);
extern int AUD_Handle_setVolume(AUD_Handle *handle, float volume);
/**
* Sets the pitch of a played back sound.
@@ -399,7 +405,7 @@ extern int AUD_setSoundVolume(AUD_Handle *handle, float volume);
* \param pitch The new pitch.
* \return Whether the action succeeded.
*/
extern int AUD_setSoundPitch(AUD_Handle *handle, float pitch);
extern int AUD_Handle_setPitch(AUD_Handle *handle, float pitch);
/**
* Opens a read device, with which audio data can be read.
@@ -434,13 +440,13 @@ extern AUD_Handle *AUD_playDevice(AUD_Device *device, AUD_Sound *sound, float se
* played back currently, in that case the buffer is filled with
* silence.
*/
extern int AUD_readDevice(AUD_Device *device, data_t *buffer, int length);
extern int AUD_Device_read(AUD_Device *device, data_t *buffer, int length);
/**
* Closes a read device.
* \param device The read device.
*/
extern void AUD_closeReadDevice(AUD_Device *device);
extern void AUD_Device_free(AUD_Device *device);
/**
* Reads a sound file into a newly created float buffer.
@@ -466,27 +472,27 @@ extern AUD_Handle *AUD_pauseAfter(AUD_Handle *handle, float seconds);
* \param muted Whether the scene is muted.
* \return The new sound scene.
*/
extern AUD_Sound *AUD_createSequencer(float fps, int muted);
extern AUD_Sound *AUD_Sequence_create(float fps, int muted);
/**
* Deletes a sound scene.
* \param sequencer The sound scene.
*/
extern void AUD_destroySequencer(AUD_Sound *sequencer);
extern void AUD_Sequence_free(AUD_Sound *sequencer);
/**
* Sets the muting state of the scene.
* \param sequencer The sound scene.
* \param muted Whether the scene is muted.
*/
extern void AUD_setSequencerMuted(AUD_Sound *sequencer, int muted);
extern void AUD_Sequence_setMuted(AUD_Sound *sequencer, int muted);
/**
* Sets the scene's FPS.
* \param sequencer The sound scene.
* \param fps The new FPS.
*/
extern void AUD_setSequencerFPS(AUD_Sound *sequencer, float fps);
extern void AUD_Sequence_setFPS(AUD_Sound *sequencer, float fps);
/**
* Adds a new entry to the scene.
@@ -497,7 +503,7 @@ extern void AUD_setSequencerFPS(AUD_Sound *sequencer, float fps);
* \param skip How much seconds should be skipped at the beginning.
* \return The entry added.
*/
extern AUD_SEntry *AUD_addSequence(AUD_Sound *sequencer, AUD_Sound *sound,
extern AUD_SEntry *AUD_Sequence_add(AUD_Sound *sequencer, AUD_Sound *sound,
float begin, float end, float skip);
/**
@@ -505,7 +511,7 @@ extern AUD_SEntry *AUD_addSequence(AUD_Sound *sequencer, AUD_Sound *sound,
* \param sequencer The sound scene.
* \param entry The entry to remove.
*/
extern void AUD_removeSequence(AUD_Sound *sequencer, AUD_SEntry *entry);
extern void AUD_Sequence_remove(AUD_Sound *sequencer, AUD_SEntry *entry);
/**
* Moves the entry.
@@ -514,30 +520,21 @@ extern void AUD_removeSequence(AUD_Sound *sequencer, AUD_SEntry *entry);
* \param end The new end time or a negative value if unknown.
* \param skip How many seconds to skip at the beginning.
*/
extern void AUD_moveSequence(AUD_SEntry *entry, float begin, float end, float skip);
extern void AUD_SequenceEntry_move(AUD_SEntry *entry, float begin, float end, float skip);
/**
* Sets the muting state of the entry.
* \param entry The sequenced entry.
* \param mute Whether the entry should be muted or not.
*/
extern void AUD_muteSequence(AUD_SEntry *entry, char mute);
/**
* Sets whether the entrie's location, velocity and orientation are relative
* to the listener.
* \param entry The sequenced entry.
* \param relative Whether the source is relative.
* \return Whether the action succeeded.
*/
extern void AUD_setRelativeSequence(AUD_SEntry *entry, char relative);
extern void AUD_SequenceEntry_setMuted(AUD_SEntry *entry, char mute);
/**
* Sets the sound of the entry.
* \param entry The sequenced entry.
* \param sound The new sound.
*/
extern void AUD_updateSequenceSound(AUD_SEntry *entry, AUD_Sound *sound);
extern void AUD_SequenceEntry_setSound(AUD_SEntry *entry, AUD_Sound *sound);
/**
* Writes animation data to a sequenced entry.
@@ -547,7 +544,7 @@ extern void AUD_updateSequenceSound(AUD_SEntry *entry, AUD_Sound *sound);
* \param data The data to write.
* \param animated Whether the attribute is animated.
*/
extern void AUD_setSequenceAnimData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated);
extern void AUD_SequenceEntry_setAnimationData(AUD_SEntry *entry, AUD_AnimateablePropertyType type, int frame, float *data, char animated);
/**
* Writes animation data to a sequenced entry.
@@ -557,33 +554,90 @@ extern void AUD_setSequenceAnimData(AUD_SEntry *entry, AUD_AnimateablePropertyTy
* \param data The data to write.
* \param animated Whether the attribute is animated.
*/
extern void AUD_setSequencerAnimData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated);
extern void AUD_Sequence_setAnimationData(AUD_Sound *sequencer, AUD_AnimateablePropertyType type, int frame, float *data, char animated);
/**
* Updates all non-animated parameters of the entry.
* \param entry The sequenced entry.
* \param volume_max The maximum volume.
* \param volume_min The minimum volume.
* \param distance_max The maximum distance.
* \param distance_reference The reference distance.
* \param attenuation The attenuation.
* \param cone_angle_outer The outer cone opening angle.
* \param cone_angle_inner The inner cone opening angle.
* \param cone_volume_outer The volume outside the outer cone.
* Sets the distance model of a sequence.
* param sequence The sequence to set the distance model from.
* param value The new distance model to set.
*/
extern void AUD_updateSequenceData(AUD_SEntry *entry, float volume_max, float volume_min,
float distance_max, float distance_reference, float attenuation,
float cone_angle_outer, float cone_angle_inner, float cone_volume_outer);
extern void AUD_Sequence_setDistanceModel(AUD_Sound* sequence, AUD_DistanceModel value);
/**
* Updates all non-animated parameters of the entry.
* \param sequencer The sound scene.
* \param speed_of_sound The speed of sound for doppler calculation.
* \param factor The doppler factor to control the effect's strength.
* \param model The distance model for distance calculation.
* Sets the doppler factor of a sequence.
* param sequence The sequence to set the doppler factor from.
* param value The new doppler factor to set.
*/
extern void AUD_updateSequencerData(AUD_Sound *sequencer, float speed_of_sound,
float factor, AUD_DistanceModel model);
extern void AUD_Sequence_setDopplerFactor(AUD_Sound* sequence, float value);
/**
* Sets the speed of sound of a sequence.
* param sequence The sequence to set the speed of sound from.
* param value The new speed of sound to set.
*/
extern void AUD_Sequence_setSpeedOfSound(AUD_Sound* sequence, float value);
/**
* Sets the attenuation of a sequence_entry.
* param sequence_entry The sequence_entry to set the attenuation from.
* param value The new attenuation to set.
*/
extern void AUD_SequenceEntry_setAttenuation(AUD_SEntry* sequence_entry, float value);
/**
* Sets the cone angle inner of a sequence_entry.
* param sequence_entry The sequence_entry to set the cone angle inner from.
* param value The new cone angle inner to set.
*/
extern void AUD_SequenceEntry_setConeAngleInner(AUD_SEntry* sequence_entry, float value);
/**
* Sets the cone angle outer of a sequence_entry.
* param sequence_entry The sequence_entry to set the cone angle outer from.
* param value The new cone angle outer to set.
*/
extern void AUD_SequenceEntry_setConeAngleOuter(AUD_SEntry* sequence_entry, float value);
/**
* Sets the cone volume outer of a sequence_entry.
* param sequence_entry The sequence_entry to set the cone volume outer from.
* param value The new cone volume outer to set.
*/
extern void AUD_SequenceEntry_setConeVolumeOuter(AUD_SEntry* sequence_entry, float value);
/**
* Sets the distance maximum of a sequence_entry.
* param sequence_entry The sequence_entry to set the distance maximum from.
* param value The new distance maximum to set.
*/
extern void AUD_SequenceEntry_setDistanceMaximum(AUD_SEntry* sequence_entry, float value);
/**
* Sets the distance reference of a sequence_entry.
* param sequence_entry The sequence_entry to set the distance reference from.
* param value The new distance reference to set.
*/
extern void AUD_SequenceEntry_setDistanceReference(AUD_SEntry* sequence_entry, float value);
/**
* Sets the relative of a sequence_entry.
* param sequence_entry The sequence_entry to set the relative from.
* param value The new relative to set.
*/
extern void AUD_SequenceEntry_setRelative(AUD_SEntry* sequence_entry, int value);
/**
* Sets the volume maximum of a sequence_entry.
* param sequence_entry The sequence_entry to set the volume maximum from.
* param value The new volume maximum to set.
*/
extern void AUD_SequenceEntry_setVolumeMaximum(AUD_SEntry* sequence_entry, float value);
/**
* Sets the volume minimum of a sequence_entry.
* param sequence_entry The sequence_entry to set the volume minimum from.
* param value The new volume minimum to set.
*/
extern void AUD_SequenceEntry_setVolumeMinimum(AUD_SEntry* sequence_entry, float value);
/**
* Sets the audio output specification of the sound scene to the specs of the
@@ -597,31 +651,31 @@ extern void AUD_setSequencerDeviceSpecs(AUD_Sound *sequencer);
* \param sequencer The sound scene.
* \param specs The new specification.
*/
extern void AUD_setSequencerSpecs(AUD_Sound *sequencer, AUD_Specs specs);
extern void AUD_Sequence_setSpecs(AUD_Sound *sequencer, AUD_Specs specs);
/**
* Seeks sequenced sound scene playback.
* \param handle Playback handle.
* \param time Time in seconds to seek to.
*/
extern void AUD_seekSequencer(AUD_Handle *handle, float time);
extern void AUD_seekSynchronizer(AUD_Handle *handle, float time);
/**
* Returns the current sound scene playback time.
* \param handle Playback handle.
* \return The playback time in seconds.
*/
extern float AUD_getSequencerPosition(AUD_Handle *handle);
extern float AUD_getSynchronizerPosition(AUD_Handle *handle);
/**
* Starts the playback of jack transport if possible.
*/
extern void AUD_startPlayback(void);
extern void AUD_playSynchronizer(void);
/**
* Stops the playback of jack transport if possible.
*/
extern void AUD_stopPlayback(void);
extern void AUD_stopSynchronizer(void);
#ifdef WITH_JACK
/**
@@ -629,14 +683,14 @@ extern void AUD_stopPlayback(void);
* \param function The callback function.
* \param data The data parameter for the callback.
*/
extern void AUD_setSyncCallback(AUD_syncFunction function, void *data);
extern void AUD_setSynchronizerCallback(AUD_syncFunction function, void *data);
#endif
/**
* Returns whether jack transport is currently playing.
* \return Whether jack transport is currently playing.
*/
extern int AUD_doesPlayback(void);
extern int AUD_isSynchronizerPlaying(void);
/**
* Reads a sound into a buffer for drawing at a specific sampling rate.
@@ -653,13 +707,13 @@ extern int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int sam
* \param sound Sound to copy.
* \return Copied sound.
*/
extern AUD_Sound *AUD_copy(AUD_Sound *sound);
extern AUD_Sound *AUD_Sound_copy(AUD_Sound *sound);
/**
* Frees a handle.
* \param channel Handle to free.
*/
extern void AUD_freeHandle(AUD_Handle *channel);
extern void AUD_Handle_free(AUD_Handle *channel);
/**
* Creates a new set.
@@ -747,36 +801,22 @@ extern AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *seque
* \param sound The sound factory.
* \return The python factory.
*/
extern void *AUD_getPythonFactory(AUD_Sound *sound);
extern void *AUD_getPythonSound(AUD_Sound *sound);
/**
* Retrieves the sound factory of a python factory.
* \param sound The python factory.
* \return The sound factory.
*/
extern AUD_Sound *AUD_getPythonSound(void *sound);
extern AUD_Sound *AUD_getSoundFromPython(void *sound);
#endif
extern AUD_Device *AUD_Device_getCurrent(void);
extern int AUD_isJackSupported(void);
#ifdef __cplusplus
}
#include <boost/shared_ptr.hpp>
class AUD_IDevice;
class AUD_I3DDevice;
/**
* Returns the current playback device.
* \return The playback device.
*/
boost::shared_ptr<AUD_IDevice> AUD_getDevice();
/**
* Returns the current playback 3D device.
* \return The playback 3D device.
*/
AUD_I3DDevice *AUD_get3DDevice();
#endif
#endif //__AUD_C_API_H__

View File

@@ -0,0 +1,78 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2009-2011 Jörg Hermann Müller
*
* This file is part of AudaSpace.
*
* Audaspace 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.
*
* AudaSpace 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 Audaspace; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file audaspace/intern/AUD_PyInit.cpp
* \ingroup audaspaceintern
*/
#include "AUD_PyInit.h"
#include <AUD_Sound.h>
#include <python/PySound.h>
#include <python/PyAPI.h>
extern "C" {
extern void *BKE_sound_get_factory(void *sound);
}
static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
{
long int lptr;
if (PyArg_Parse(args, "l:_sound_from_pointer", &lptr)) {
if (lptr) {
AUD_Sound* sound = BKE_sound_get_factory((void *) lptr);
if (sound) {
Sound *obj = (Sound *)Sound_empty();
if (obj) {
obj->sound = AUD_Sound_copy(sound);
return (PyObject *) obj;
}
}
}
}
Py_RETURN_NONE;
}
static PyMethodDef meth_sound_from_pointer[] = {
{"_sound_from_pointer", (PyCFunction)AUD_getSoundFromPointer, METH_O,
"_sound_from_pointer(pointer)\n\n"
"Returns the corresponding :class:`Factory` object.\n\n"
":arg pointer: The pointer to the bSound object as long.\n"
":type pointer: long\n"
":return: The corresponding :class:`Factory` object.\n"
":rtype: :class:`Factory`"}
};
PyObject *AUD_initPython(void)
{
PyObject *module = PyInit_aud();
PyModule_AddObject(module, "_sound_from_pointer", (PyObject *)PyCFunction_New(meth_sound_from_pointer, NULL));
PyDict_SetItemString(PyImport_GetModuleDict(), "aud", module);
return module;
}

View File

@@ -0,0 +1,69 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2009-2011 Jörg Hermann Müller
*
* This file is part of AudaSpace.
*
* Audaspace 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.
*
* AudaSpace 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 Audaspace; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file audaspace/intern/AUD_Set.cpp
* \ingroup audaspaceintern
*/
#include <set>
#include "AUD_Set.h"
void *AUD_createSet()
{
return new std::set<void *>();
}
void AUD_destroySet(void *set)
{
delete reinterpret_cast<std::set<void *>*>(set);
}
char AUD_removeSet(void *set, void *entry)
{
if (set)
return reinterpret_cast<std::set<void *>*>(set)->erase(entry);
return 0;
}
void AUD_addSet(void *set, void *entry)
{
if (entry)
reinterpret_cast<std::set<void *>*>(set)->insert(entry);
}
void *AUD_getSet(void *set)
{
if (set) {
std::set<void *>* rset = reinterpret_cast<std::set<void *>*>(set);
if (!rset->empty()) {
std::set<void *>::iterator it = rset->begin();
void *result = *it;
rset->erase(it);
return result;
}
}
return (void*) 0;
}

View File

@@ -0,0 +1,74 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2009-2011 Jörg Hermann Müller
*
* This file is part of AudaSpace.
*
* Audaspace 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.
*
* AudaSpace 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 Audaspace; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file AUD_Set.h
* \ingroup audaspace
*/
#ifndef __AUD_SET_H__
#define __AUD_SET_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* Creates a new set.
* \return The new set.
*/
extern void *AUD_createSet(void);
/**
* Deletes a set.
* \param set The set to delete.
*/
extern void AUD_destroySet(void *set);
/**
* Removes an entry from a set.
* \param set The set work on.
* \param entry The entry to remove.
* \return Whether the entry was in the set or not.
*/
extern char AUD_removeSet(void *set, void *entry);
/**
* Adds a new entry to a set.
* \param set The set work on.
* \param entry The entry to add.
*/
extern void AUD_addSet(void *set, void *entry);
/**
* Removes one entry from a set and returns it.
* \param set The set work on.
* \return The entry or NULL if the set is empty.
*/
extern void *AUD_getSet(void *set);
#ifdef __cplusplus
}
#endif
#endif //__AUD_SET_H__

View File

@@ -14,6 +14,11 @@ include(cmake/external_libs.cmake)
# todo: refactor this code to match scons
# note: CXX_HAS_SSE is needed in case passing SSE flags fails altogether (gcc-arm)
if(WITH_CYCLES_WERROR)
ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WERROR -Werror)
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS C_WERROR -Werror)
endif()
if(NOT WITH_CPU_SSE)
set(CXX_HAS_SSE FALSE)
set(CXX_HAS_AVX FALSE)
@@ -154,23 +159,23 @@ add_definitions(
TEST_UNORDERED_MAP_SUPPORT()
if(HAVE_STD_UNORDERED_MAP_HEADER)
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
add_definitions(-DCYCLES_STD_UNORDERED_MAP)
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
else()
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
add_definitions(-DCYCLES_STD_UNORDERED_MAP)
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
else()
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCYCLES_TR1_UNORDERED_MAP)
else()
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCYCLES_TR1_UNORDERED_MAP)
else()
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
# Logging capabilities using GLog library.

View File

@@ -31,10 +31,12 @@ set(SRC
blender_session.cpp
blender_shader.cpp
blender_sync.cpp
blender_texture.cpp
CCL_api.h
blender_sync.h
blender_session.h
blender_texture.h
blender_util.h
)

View File

@@ -17,11 +17,56 @@
# <pep8 compliant>
def _is_using_buggy_driver():
import bgl
# We need to be conservative here because in multi-GPU systems display card
# might be quite old, but others one might be just good.
#
# So We shouldn't disable possible good dedicated cards just because display
# card seems weak. And instead we only blacklist configurations which are
# proven to cause problems.
if bgl.glGetString(bgl.GL_VENDOR) == "ATI Technologies Inc.":
import re
version = bgl.glGetString(bgl.GL_VERSION)
if version.endswith("Compatibility Profile Context"):
# Old HD 4xxx and 5xxx series drivers did not have driver version
# in the version string, but thsoe cards do not quite work and
# cusing crashes.
return True
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\.[0-9]+)+)$")
if not regex.match(version):
# Skip cards like FireGL
return False
version = regex.sub("\\1", version).split('.')
return int(version[0]) == 8
return False
def _workaround_buggy_drivers():
if _is_using_buggy_driver():
import _cycles
if hasattr(_cycles, "opencl_disable"):
print("Cycles: OpenGL driver known to be buggy, disabling OpenCL platform.")
_cycles.opencl_disable()
def init():
import bpy
import _cycles
import os.path
# Workaroud posibly buggy legacy drivers which crashes on the OpenCL
# device enumeration.
#
# This checks are not really correct because they might still fail
# in the case of multiple GPUs. However, currently buggy drivers
# are really old and likely to be used in single GPU systems only
# anyway.
#
# Can't do it in the background mode, so we hope OpenCL is no enabled
# in the user preferences.
if not bpy.app.background:
_workaround_buggy_drivers()
path = os.path.dirname(__file__)
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))

View File

@@ -511,6 +511,19 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
),
)
cls.use_camera_cull = BoolProperty(
name="Use Camera Cull",
description="Allow objects to be culled based on the camera frustum",
default=False,
)
cls.camera_cull_margin = FloatProperty(
name="Camera Cull Margin",
description="Margin for the camera space culling",
default=0.1,
min=0.0, max=5.0
)
@classmethod
def unregister(cls):
del bpy.types.Scene.cycles
@@ -739,6 +752,12 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
min=1, max=10000,
default=4,
)
cls.max_bounces = IntProperty(
name="Max Bounces",
description="Maximum number of bounces the background light will contribute to the render",
min=0, max=1024,
default=1024,
)
cls.homogeneous_volume = BoolProperty(
name="Homogeneous Volume",
description="When using volume rendering, assume volume has the same density everywhere"
@@ -890,6 +909,12 @@ class CyclesObjectBlurSettings(bpy.types.PropertyGroup):
default=1,
)
cls.use_camera_cull = BoolProperty(
name="Use Camera Cull",
description="Allow this object and its duplicators to be culled by camera space culling",
default=False,
)
@classmethod
def unregister(cls):
del bpy.types.Object.cycles

View File

@@ -438,6 +438,7 @@ class CyclesRender_PT_layer_passes(CyclesButtonsPanel, Panel):
class CyclesRender_PT_views(CyclesButtonsPanel, Panel):
bl_label = "Views"
bl_context = "render_layer"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
rd = context.scene.render
@@ -687,8 +688,8 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel):
sub.prop(cob, "motion_steps", text="Steps")
class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
bl_label = "Ray Visibility"
class CyclesObject_PT_cycles_settings(CyclesButtonsPanel, Panel):
bl_label = "Cycles Settings"
bl_context = "object"
bl_options = {'DEFAULT_CLOSED'}
@@ -702,9 +703,13 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
scene = context.scene
cscene = scene.cycles
ob = context.object
cob = ob.cycles
visibility = ob.cycles_visibility
layout.label(text="Ray Visibility:")
flow = layout.column_flow()
flow.prop(visibility, "camera")
@@ -716,6 +721,12 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
if ob.type != 'LAMP':
flow.prop(visibility, "shadow")
col = layout.column()
col.label(text="Performance:")
row = col.row()
row.active = scene.render.use_simplify and cscene.use_camera_cull
row.prop(cob, "use_camera_cull")
class CYCLES_OT_use_shading_nodes(Operator):
"""Enable nodes on a material, world or lamp"""
@@ -1040,6 +1051,7 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
sub.prop(cworld, "sample_map_resolution")
if use_branched_path(context):
sub.prop(cworld, "samples")
sub.prop(cworld, "max_bounces")
col = split.column()
col.label(text="Volume:")
@@ -1225,7 +1237,8 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
node = context.texture_node
return node and CyclesButtonsPanel.poll(context)
# TODO(sergey): perform a faster/nicer check?
return node and hasattr(node, 'texture_mapping') and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
@@ -1449,7 +1462,9 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
rd = context.scene.render
scene = context.scene
rd = scene.render
cscene = scene.cycles
layout.active = rd.use_simplify
split = layout.split()
@@ -1464,6 +1479,12 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
col.prop(rd, "simplify_subdivision_render", text="Subdivision")
col.prop(rd, "simplify_child_particles_render", text="Child Particles")
col = layout.column()
col.prop(cscene, "use_camera_cull")
subsub = col.column()
subsub.active = cscene.use_camera_cull
subsub.prop(cscene, "camera_cull_margin")
def draw_device(self, context):
scene = context.scene

View File

@@ -244,8 +244,11 @@ static Transform blender_camera_matrix(const Transform& tfm,
return transform_clear_scale(result);
}
static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
BoundBox2D *viewplane, float *aspectratio, float *sensor_size)
static void blender_camera_viewplane(BlenderCamera *bcam,
int width, int height,
BoundBox2D *viewplane,
float *aspectratio,
float *sensor_size)
{
/* dimensions */
float xratio = (float)width*bcam->pixelaspect.x;
@@ -258,24 +261,34 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
/* sensor fitting */
if(bcam->sensor_fit == BlenderCamera::AUTO) {
horizontal_fit = (xratio > yratio);
*sensor_size = bcam->sensor_width;
if(sensor_size != NULL) {
*sensor_size = bcam->sensor_width;
}
}
else if(bcam->sensor_fit == BlenderCamera::HORIZONTAL) {
horizontal_fit = true;
*sensor_size = bcam->sensor_width;
if(sensor_size != NULL) {
*sensor_size = bcam->sensor_width;
}
}
else {
horizontal_fit = false;
*sensor_size = bcam->sensor_height;
if(sensor_size != NULL) {
*sensor_size = bcam->sensor_height;
}
}
if(horizontal_fit) {
*aspectratio = xratio/yratio;
if(aspectratio != NULL) {
*aspectratio = xratio/yratio;
}
xaspect = *aspectratio;
yaspect = 1.0f;
}
else {
*aspectratio = yratio/xratio;
if(aspectratio != NULL) {
*aspectratio = yratio/xratio;
}
xaspect = 1.0f;
yaspect = *aspectratio;
}
@@ -284,31 +297,37 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
if(bcam->type == CAMERA_ORTHOGRAPHIC) {
xaspect = xaspect*bcam->ortho_scale/(*aspectratio*2.0f);
yaspect = yaspect*bcam->ortho_scale/(*aspectratio*2.0f);
*aspectratio = bcam->ortho_scale/2.0f;
if(aspectratio != NULL) {
*aspectratio = bcam->ortho_scale/2.0f;
}
}
if(bcam->type == CAMERA_PANORAMA) {
/* set viewplane */
*viewplane = bcam->pano_viewplane;
if(viewplane != NULL) {
*viewplane = bcam->pano_viewplane;
}
}
else {
/* set viewplane */
viewplane->left = -xaspect;
viewplane->right = xaspect;
viewplane->bottom = -yaspect;
viewplane->top = yaspect;
if(viewplane != NULL) {
viewplane->left = -xaspect;
viewplane->right = xaspect;
viewplane->bottom = -yaspect;
viewplane->top = yaspect;
/* zoom for 3d camera view */
*viewplane = (*viewplane) * bcam->zoom;
/* zoom for 3d camera view */
*viewplane = (*viewplane) * bcam->zoom;
/* modify viewplane with camera shift and 3d camera view offset */
float dx = 2.0f*(*aspectratio*bcam->shift.x + bcam->offset.x*xaspect*2.0f);
float dy = 2.0f*(*aspectratio*bcam->shift.y + bcam->offset.y*yaspect*2.0f);
/* modify viewplane with camera shift and 3d camera view offset */
float dx = 2.0f*(*aspectratio*bcam->shift.x + bcam->offset.x*xaspect*2.0f);
float dy = 2.0f*(*aspectratio*bcam->shift.y + bcam->offset.y*yaspect*2.0f);
viewplane->left += dx;
viewplane->right += dx;
viewplane->bottom += dy;
viewplane->top += dy;
viewplane->left += dx;
viewplane->right += dx;
viewplane->bottom += dy;
viewplane->top += dy;
}
}
}
@@ -386,7 +405,10 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
cam->motion.pre = cam->matrix;
cam->motion.post = cam->matrix;
cam->use_motion = false;
cam->use_perspective_motion = false;
cam->shuttertime = bcam->shuttertime;
cam->fov_pre = cam->fov;
cam->fov_post = cam->fov;
/* border */
cam->border = bcam->border;
@@ -435,8 +457,14 @@ void BlenderSync::sync_camera(BL::RenderSettings b_render, BL::Object b_override
blender_camera_sync(cam, &bcam, width, height);
}
void BlenderSync::sync_camera_motion(BL::Object b_ob, float motion_time)
void BlenderSync::sync_camera_motion(BL::RenderSettings b_render,
BL::Object b_ob,
int width, int height,
float motion_time)
{
if(!b_ob)
return;
Camera *cam = scene->camera;
BL::Array<float, 16> b_ob_matrix;
b_engine.camera_model_matrix(b_ob, b_ob_matrix);
@@ -454,6 +482,31 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, float motion_time)
cam->use_motion = true;
}
}
if(cam->type == CAMERA_PERSPECTIVE) {
BlenderCamera bcam;
float aspectratio, sensor_size;
blender_camera_init(&bcam, b_render);
blender_camera_from_object(&bcam, b_engine, b_ob);
blender_camera_viewplane(&bcam,
width, height,
NULL,
&aspectratio,
&sensor_size);
/* TODO(sergey): De-duplicate calculation with camera sync. */
float fov = 2.0f * atanf((0.5f * sensor_size) / bcam.lens / aspectratio);
if(fov != cam->fov) {
VLOG(1) << "Camera " << b_ob.name() << " FOV change detected.";
if(motion_time == -1.0f) {
cam->fov_pre = fov;
cam->use_perspective_motion = true;
}
else if(motion_time == 1.0f) {
cam->fov_post = fov;
cam->use_perspective_motion = true;
}
}
}
}
/* Sync 3D View Camera */

View File

@@ -242,8 +242,16 @@ static void create_mesh_volume_attribute(BL::Object b_ob, Mesh *mesh, ImageManag
bool animated = false;
volume_data->manager = image_manager;
volume_data->slot = image_manager->add_image(Attribute::standard_name(std),
b_ob.ptr.data, animated, frame, is_float, is_linear, INTERPOLATION_LINEAR, true);
volume_data->slot = image_manager->add_image(
Attribute::standard_name(std),
b_ob.ptr.data,
animated,
frame,
is_float,
is_linear,
INTERPOLATION_LINEAR,
EXTENSION_REPEAT,
true);
}
static void create_mesh_volume_attributes(Scene *scene, BL::Object b_ob, Mesh *mesh, float frame)

View File

@@ -215,6 +215,7 @@ void BlenderSync::sync_background_light(bool use_portal)
light->map_resolution = get_int(cworld, "sample_map_resolution");
light->shader = scene->default_background;
light->use_mis = sample_as_light;
light->max_bounces = get_int(cworld, "max_bounces");
int samples = get_int(cworld, "samples");
if(get_boolean(cscene, "use_square_samples"))
@@ -234,8 +235,56 @@ void BlenderSync::sync_background_light(bool use_portal)
/* Object */
Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal)
/* TODO(sergey): Not really optimal, consider approaches based on k-DOP in order
* to reduce number of objects which are wrongly considered visible.
*/
static bool object_boundbox_clip(Scene *scene,
BL::Object b_ob,
Transform& tfm,
float margin)
{
Camera *cam = scene->camera;
Transform& worldtondc = cam->worldtondc;
BL::Array<float, 24> boundbox = b_ob.bound_box();
float3 bb_min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
bb_max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
bool all_behind = true;
for(int i = 0; i < 8; ++i) {
float3 p = make_float3(boundbox[3 * i + 0],
boundbox[3 * i + 1],
boundbox[3 * i + 2]);
p = transform_point(&tfm, p);
p = transform_point(&worldtondc, p);
if(p.z >= -margin) {
all_behind = false;
}
p /= p.z;
bb_min = min(bb_min, p);
bb_max = max(bb_max, p);
}
if(!all_behind) {
if(bb_min.x >= 1.0f + margin ||
bb_min.y >= 1.0f + margin ||
bb_max.x <= -margin ||
bb_max.y <= -margin)
{
return true;
}
return false;
}
return true;
}
Object *BlenderSync::sync_object(BL::Object b_parent,
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
BL::DupliObject b_dupli_ob,
Transform& tfm,
uint layer_flag,
float motion_time,
bool hide_tris,
bool use_camera_cull,
float camera_cull_margin,
bool *use_portal)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
bool motion = motion_time != 0.0f;
@@ -253,6 +302,11 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
if(!object_is_mesh(b_ob))
return NULL;
/* Perform camera space culling. */
if(use_camera_cull && object_boundbox_clip(scene, b_ob, tfm, camera_cull_margin)) {
return NULL;
}
/* key to lookup object */
ObjectKey key(b_parent, persistent_id, b_ob);
Object *object;
@@ -480,6 +534,18 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
mesh_motion_synced.clear();
}
bool allow_camera_cull = false;
float camera_cull_margin = 0.0f;
if(b_scene.render().use_simplify()) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
allow_camera_cull = scene->camera->type != CAMERA_PANORAMA &&
!b_scene.render().use_multiview() &&
get_boolean(cscene, "use_camera_cull");
if(allow_camera_cull) {
camera_cull_margin = get_float(cscene, "camera_cull_margin");
}
}
/* object loop */
BL::Scene::object_bases_iterator b_base;
BL::Scene b_sce = b_scene;
@@ -502,6 +568,12 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
if(!hide) {
progress.set_sync_status("Synchronizing object", b_ob.name());
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
bool use_camera_cull = allow_camera_cull && get_boolean(cobject, "use_camera_cull");
if(use_camera_cull) {
/* Need to have proper projection matrix. */
scene->camera->update();
}
if(b_ob.is_duplicator() && !object_render_hide_duplis(b_ob)) {
/* dupli objects */
b_ob.dupli_list_create(b_scene, dupli_settings);
@@ -521,7 +593,16 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
/* sync object and mesh or light data */
Object *object = sync_object(b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion_time, hide_tris, &use_portal);
Object *object = sync_object(b_ob,
persistent_id.data,
*b_dup,
tfm,
ob_layer,
motion_time,
hide_tris,
use_camera_cull,
camera_cull_margin,
&use_portal);
/* sync possible particle data, note particle_id
* starts counting at 1, first is dummy particle */
@@ -541,7 +622,16 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
if(!object_render_hide(b_ob, true, true, hide_tris)) {
/* object itself */
Transform tfm = get_transform(b_ob.matrix_world());
sync_object(b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, motion_time, hide_tris, &use_portal);
sync_object(b_ob,
NULL,
PointerRNA_NULL,
tfm,
ob_layer,
motion_time,
hide_tris,
use_camera_cull,
camera_cull_margin,
&use_portal);
}
}
@@ -569,7 +659,11 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
mesh_motion_synced.clear();
}
void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override, void **python_thread_state)
void BlenderSync::sync_motion(BL::RenderSettings b_render,
BL::SpaceView3D b_v3d,
BL::Object b_override,
int width, int height,
void **python_thread_state)
{
if(scene->need_motion() == Scene::MOTION_NONE)
return;
@@ -589,6 +683,9 @@ void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override, void
/* note iteration over motion_times set happens in sorted order */
foreach(float relative_time, motion_times) {
VLOG(1) << "Synchronizing motion for the relative time "
<< relative_time << ".";
/* fixed shutter time to get previous and next frame for motion pass */
float shuttertime;
@@ -608,8 +705,12 @@ void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override, void
python_thread_state_save(python_thread_state);
/* sync camera, only supports two times at the moment */
if(relative_time == -1.0f || relative_time == 1.0f)
sync_camera_motion(b_cam, relative_time);
if(relative_time == -1.0f || relative_time == 1.0f) {
sync_camera_motion(b_render,
b_cam,
width, height,
relative_time);
}
/* sync object */
sync_objects(b_v3d, relative_time);

View File

@@ -22,6 +22,7 @@
#include "blender_session.h"
#include "util_foreach.h"
#include "util_logging.h"
#include "util_md5.h"
#include "util_opengl.h"
#include "util_path.h"
@@ -486,6 +487,19 @@ static PyObject *system_info_func(PyObject * /*self*/, PyObject * /*value*/)
return PyUnicode_FromString(system_info.c_str());
}
#ifdef WITH_OPENCL
static PyObject *opencl_disable_func(PyObject * /*self*/, PyObject * /*value*/)
{
VLOG(2) << "Disabling OpenCL platform.";
#ifdef WIN32
putenv("CYCLES_OPENCL_TEST=NONE");
#else
setenv("CYCLES_OPENCL_TEST", "NONE", 1);
#endif
Py_RETURN_NONE;
}
#endif
static PyMethodDef methods[] = {
{"init", init_func, METH_VARARGS, ""},
{"create", create_func, METH_VARARGS, ""},
@@ -501,6 +515,9 @@ static PyMethodDef methods[] = {
#endif
{"available_devices", available_devices_func, METH_NOARGS, ""},
{"system_info", system_info_func, METH_NOARGS, ""},
#ifdef WITH_OPENCL
{"opencl_disable", opencl_disable_func, METH_NOARGS, ""},
#endif
{NULL, NULL, 0, NULL},
};

View File

@@ -122,7 +122,12 @@ void BlenderSession::create_session()
if(session_pause == false) {
/* full data sync */
sync->sync_view(b_v3d, b_rv3d, width, height);
sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state);
sync->sync_data(b_render,
b_v3d,
b_engine.camera_override(),
width, height,
&python_thread_state,
b_rlay_name.c_str());
}
}
else {
@@ -442,10 +447,6 @@ void BlenderSession::render()
/* add passes */
vector<Pass> passes;
Pass::add(PASS_COMBINED, passes);
#ifdef WITH_CYCLES_DEBUG
Pass::add(PASS_BVH_TRAVERSAL_STEPS, passes);
/* Pass::add(PASS_RAY_BOUNCES, passes); */
#endif
if(session_params.device.advanced_shading) {
@@ -477,7 +478,12 @@ void BlenderSession::render()
/* update scene */
sync->sync_camera(b_render, b_engine.camera_override(), width, height);
sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state, b_rlay_name.c_str());
sync->sync_data(b_render,
b_v3d,
b_engine.camera_override(),
width, height,
&python_thread_state,
b_rlay_name.c_str());
/* update number of samples per layer */
int samples = sync->get_layer_samples();
@@ -543,6 +549,11 @@ void BlenderSession::bake(BL::Object b_object, const string& pass_type, const in
size_t object_index = OBJECT_NONE;
int tri_offset = 0;
/* Set baking flag in advance, so kernel loading can check if we need
* any baking capabilities.
*/
scene->bake_manager->set_baking(true);
/* ensure kernels are loaded before we do any scene updates */
session->load_kernels();
@@ -565,14 +576,18 @@ void BlenderSession::bake(BL::Object b_object, const string& pass_type, const in
/* update scene */
sync->sync_camera(b_render, b_engine.camera_override(), width, height);
sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state);
sync->sync_data(b_render,
b_v3d,
b_engine.camera_override(),
width, height,
&python_thread_state,
b_rlay_name.c_str());
/* get buffer parameters */
SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_v3d, b_rv3d, scene->camera, width, height);
scene->bake_manager->set_shader_limit((size_t)b_engine.tile_x(), (size_t)b_engine.tile_y());
scene->bake_manager->set_baking(true);
/* set number of samples */
session->tile_manager.set_samples(session_params.samples);
@@ -708,7 +723,12 @@ void BlenderSession::synchronize()
}
/* data and camera synchronize */
sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state);
sync->sync_data(b_render,
b_v3d,
b_engine.camera_override(),
width, height,
&python_thread_state,
b_rlay_name.c_str());
if(b_rv3d)
sync->sync_view(b_v3d, b_rv3d, width, height);
@@ -874,12 +894,12 @@ void BlenderSession::update_status_progress()
scene += ", " + b_rview_name;
}
else {
BLI_timestr(total_time, time_str, sizeof(time_str));
BLI_timecode_string_from_time_simple(time_str, sizeof(time_str), total_time);
timestatus = "Time:" + string(time_str) + " | ";
}
if(remaining_time > 0) {
BLI_timestr(remaining_time, time_str, sizeof(time_str));
BLI_timecode_string_from_time_simple(time_str, sizeof(time_str), remaining_time);
timestatus += "Remaining:" + string(time_str) + " | ";
}
@@ -1012,6 +1032,18 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
is_float = true;
}
else {
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
channels = 4;
width = height = depth = b_point_density_node.resolution();
is_float = true;
}
}
}
bool BlenderSession::builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels)
@@ -1154,6 +1186,17 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
}
else {
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
int length;
b_point_density_node.calc_point_density(b_scene, &length, &pixels);
}
}
return false;
}

View File

@@ -22,6 +22,7 @@
#include "scene.h"
#include "shader.h"
#include "blender_texture.h"
#include "blender_sync.h"
#include "blender_util.h"
@@ -589,14 +590,17 @@ static ShaderNode *add_node(Scene *scene,
/* TODO(sergey): Does not work properly when we change builtin type. */
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(image->filename,
image->builtin_data,
(InterpolationType)b_image_node.interpolation());
scene->image_manager->tag_reload_image(
image->filename,
image->builtin_data,
(InterpolationType)b_image_node.interpolation(),
(ExtensionType)b_image_node.extension());
}
}
image->color_space = ImageTextureNode::color_space_enum[(int)b_image_node.color_space()];
image->projection = ImageTextureNode::projection_enum[(int)b_image_node.projection()];
image->interpolation = (InterpolationType)b_image_node.interpolation();
image->extension = (ExtensionType)b_image_node.extension();
image->projection_blend = b_image_node.projection_blend();
get_tex_mapping(&image->tex_mapping, b_image_node.texture_mapping());
node = image;
@@ -629,7 +633,8 @@ static ShaderNode *add_node(Scene *scene,
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(env->filename,
env->builtin_data,
INTERPOLATION_LINEAR);
INTERPOLATION_LINEAR,
EXTENSION_REPEAT);
}
}
env->color_space = EnvironmentTextureNode::color_space_enum[(int)b_env_node.color_space()];
@@ -736,6 +741,36 @@ static ShaderNode *add_node(Scene *scene,
uvm->from_dupli = b_uvmap_node.from_dupli();
node = uvm;
}
else if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
PointDensityTextureNode *point_density = new PointDensityTextureNode();
point_density->filename = b_point_density_node.name();
point_density->space =
PointDensityTextureNode::space_enum[(int)b_point_density_node.space()];
point_density->interpolation =
(InterpolationType)b_point_density_node.interpolation();
point_density->builtin_data = b_point_density_node.ptr.data;
/* Transformation form world space to texture space. */
BL::Object b_ob(b_point_density_node.object());
if(b_ob) {
float3 loc, size;
point_density_texture_space(b_point_density_node, loc, size);
point_density->tfm =
transform_translate(-loc) * transform_scale(size) *
transform_inverse(get_transform(b_ob.matrix_world()));
}
/* TODO(sergey): Use more proper update flag. */
if(true) {
scene->image_manager->tag_reload_image(
point_density->filename,
point_density->builtin_data,
point_density->interpolation,
EXTENSION_REPEAT);
}
node = point_density;
}
if(node)
graph->add(node);

View File

@@ -145,7 +145,12 @@ bool BlenderSync::sync_recalc()
return recalc;
}
void BlenderSync::sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, void **python_thread_state, const char *layer)
void BlenderSync::sync_data(BL::RenderSettings b_render,
BL::SpaceView3D b_v3d,
BL::Object b_override,
int width, int height,
void **python_thread_state,
const char *layer)
{
sync_render_layers(b_v3d, layer);
sync_integrator();
@@ -157,7 +162,11 @@ void BlenderSync::sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, void *
mesh_synced.clear(); /* use for objects and motion sync */
sync_objects(b_v3d);
sync_motion(b_v3d, b_override, python_thread_state);
sync_motion(b_render,
b_v3d,
b_override,
width, height,
python_thread_state);
mesh_synced.clear();
}

View File

@@ -53,7 +53,12 @@ public:
/* sync */
bool sync_recalc();
void sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, void **python_thread_state, const char *layer = 0);
void sync_data(BL::RenderSettings b_render,
BL::SpaceView3D b_v3d,
BL::Object b_override,
int width, int height,
void **python_thread_state,
const char *layer = 0);
void sync_render_layers(BL::SpaceView3D b_v3d, const char *layer);
void sync_integrator();
void sync_camera(BL::RenderSettings b_render, BL::Object b_override, int width, int height);
@@ -75,7 +80,11 @@ private:
void sync_lamps(bool update_all);
void sync_materials(bool update_all);
void sync_objects(BL::SpaceView3D b_v3d, float motion_time = 0.0f);
void sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override, void **python_thread_state);
void sync_motion(BL::RenderSettings b_render,
BL::SpaceView3D b_v3d,
BL::Object b_override,
int width, int height,
void **python_thread_state);
void sync_film();
void sync_view();
void sync_world(bool update_all);
@@ -85,12 +94,23 @@ private:
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool motion, int time_index = 0);
Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal);
Object *sync_object(BL::Object b_parent,
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
BL::DupliObject b_dupli_ob,
Transform& tfm,
uint layer_flag,
float motion_time,
bool hide_tris,
bool use_camera_cull,
float camera_cull_margin,
bool *use_portal);
void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool *use_portal);
void sync_background_light(bool use_portal);
void sync_mesh_motion(BL::Object b_ob, Object *object, float motion_time);
void sync_camera_motion(BL::Object b_ob, float motion_time);
void sync_camera_motion(BL::RenderSettings b_render,
BL::Object b_ob,
int width, int height,
float motion_time);
/* particles */
bool sync_dupli_particle(BL::Object b_ob, BL::DupliObject b_dup, Object *object);

View File

@@ -0,0 +1,116 @@
/*
* Copyright 2011-2015 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "blender_texture.h"
CCL_NAMESPACE_BEGIN
namespace {
/* Point density helpers. */
static void density_texture_space_invert(float3& loc,
float3& size)
{
if(size.x != 0.0f) size.x = 0.5f/size.x;
if(size.y != 0.0f) size.y = 0.5f/size.y;
if(size.z != 0.0f) size.z = 0.5f/size.z;
loc = loc*size - make_float3(0.5f, 0.5f, 0.5f);
}
static void density_object_texture_space(BL::Object b_ob,
float radius,
float3& loc,
float3& size)
{
if(b_ob.type() == BL::Object::type_MESH) {
BL::Mesh b_mesh(b_ob.data());
loc = get_float3(b_mesh.texspace_location());
size = get_float3(b_mesh.texspace_size());
}
else {
/* TODO(sergey): Not supported currently. */
}
/* Adjust texture space to include density points on the boundaries. */
size = size + make_float3(radius, radius, radius);
density_texture_space_invert(loc, size);
}
static void density_particle_system_texture_space(
BL::Object b_ob,
BL::ParticleSystem b_particle_system,
float radius,
float3& loc,
float3& size)
{
if(b_particle_system.settings().type() == BL::ParticleSettings::type_HAIR) {
/* TODO(sergey): Not supported currently. */
return;
}
Transform tfm = get_transform(b_ob.matrix_world());
Transform itfm = transform_inverse(tfm);
float3 min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
float3 particle_size = make_float3(radius, radius, radius);
for(int i = 0; i < b_particle_system.particles.length(); ++i) {
BL::Particle particle = b_particle_system.particles[i];
float3 location = get_float3(particle.location());
location = transform_point(&itfm, location);
min = ccl::min(min, location - particle_size);
max = ccl::max(max, location + particle_size);
}
/* Calculate texture space from the particle bounds. */
loc = (min + max) * 0.5f;
size = (max - min) * 0.5f;
density_texture_space_invert(loc, size);
}
} /* namespace */
void point_density_texture_space(BL::ShaderNodeTexPointDensity b_point_density_node,
float3& loc,
float3& size)
{
/* Fallback values. */
loc = make_float3(0.0f, 0.0f, 0.0f);
size = make_float3(0.0f, 0.0f, 0.0f);
BL::Object b_ob(b_point_density_node.object());
if(!b_ob) {
return;
}
if(b_point_density_node.point_source() ==
BL::ShaderNodeTexPointDensity::point_source_PARTICLE_SYSTEM)
{
BL::ParticleSystem b_particle_system(
b_point_density_node.particle_system());
if(b_particle_system) {
density_particle_system_texture_space(b_ob,
b_particle_system,
b_point_density_node.radius(),
loc,
size);
}
}
else {
density_object_texture_space(b_ob,
b_point_density_node.radius(),
loc,
size);
}
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2011-2015 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __BLENDER_TEXTURE_H__
#define __BLENDER_TEXTURE_H__
#include <stdlib.h>
#include "blender_sync.h"
CCL_NAMESPACE_BEGIN
void point_density_texture_space(BL::ShaderNodeTexPointDensity b_point_density_node,
float3& loc,
float3& size);
CCL_NAMESPACE_END
#endif /* __BLENDER_TEXTURE_H__ */

View File

@@ -28,7 +28,7 @@
* todo: clean this up ... */
extern "C" {
void BLI_timestr(double _time, char *str, size_t maxlen);
size_t BLI_timecode_string_from_time_simple(char *str, size_t maxlen, double time_seconds);
void BKE_image_user_frame_calc(void *iuser, int cfra, int fieldnr);
void BKE_image_user_file_path(void *iuser, void *ima, char *path);
unsigned char *BKE_image_get_pixels_for_frame(void *image, int frame);

View File

@@ -31,6 +31,29 @@
CCL_NAMESPACE_BEGIN
/* Device Requested Features */
std::ostream& operator <<(std::ostream &os,
const DeviceRequestedFeatures& requested_features)
{
os << "Experimental features: "
<< (requested_features.experimental ? "On" : "Off") << std::endl;
os << "Max closure count: " << requested_features.max_closure << std::endl;
os << "Max nodes group: " << requested_features.max_nodes_group << std::endl;
/* TODO(sergey): Decode bitflag into list of names. */
os << "Nodes features: " << requested_features.nodes_features << std::endl;
/* TODO(sergey): Make it utility function to convert bool to string. */
os << "Use hair: "
<< (requested_features.use_hair ? "True" : "False") << std::endl;
os << "Use object motion: "
<< (requested_features.use_object_motion ? "True" : "False") << std::endl;
os << "Use camera motion: "
<< (requested_features.use_camera_motion ? "True" : "False") << std::endl;
os << "Use Baking: "
<< (requested_features.use_baking ? "True" : "False") << std::endl;
return os;
}
/* Device */
Device::~Device()

View File

@@ -97,6 +97,9 @@ public:
bool use_object_motion;
bool use_camera_motion;
/* Denotes whether baking functionality is needed. */
bool use_baking;
DeviceRequestedFeatures()
{
/* TODO(sergey): Find more meaningful defaults. */
@@ -107,6 +110,7 @@ public:
use_hair = false;
use_object_motion = false;
use_camera_motion = false;
use_baking = false;
}
bool modified(const DeviceRequestedFeatures& requested_features)
@@ -114,10 +118,18 @@ public:
return !(experimental == requested_features.experimental &&
max_closure == requested_features.max_closure &&
max_nodes_group == requested_features.max_nodes_group &&
nodes_features == requested_features.nodes_features);
nodes_features == requested_features.nodes_features &&
use_hair == requested_features.use_hair &&
use_object_motion == requested_features.use_object_motion &&
use_camera_motion == requested_features.use_camera_motion &&
use_baking == requested_features.use_baking);
}
};
std::ostream& operator <<(std::ostream &os,
const DeviceRequestedFeatures& requested_features);
/* Device */
struct DeviceDrawParams {
@@ -161,10 +173,10 @@ public:
virtual void tex_alloc(const char * /*name*/,
device_memory& /*mem*/,
InterpolationType interpolation = INTERPOLATION_NONE,
bool periodic = false)
ExtensionType extension = EXTENSION_REPEAT)
{
(void)interpolation; /* Ignored. */
(void)periodic; /* Ignored. */
(void)extension; /* Ignored. */
};
virtual void tex_free(device_memory& /*mem*/) {};

View File

@@ -123,10 +123,20 @@ public:
kernel_const_copy(&kernel_globals, name, host, size);
}
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool /*periodic*/)
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType interpolation,
ExtensionType extension)
{
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
kernel_tex_copy(&kernel_globals, name, mem.data_pointer, mem.data_width, mem.data_height, mem.data_depth, interpolation);
kernel_tex_copy(&kernel_globals,
name,
mem.data_pointer,
mem.data_width,
mem.data_height,
mem.data_depth,
interpolation,
extension);
mem.device_pointer = mem.data_pointer;
mem.device_size = mem.memory_size();
stats.mem_alloc(mem.device_size);

View File

@@ -416,7 +416,10 @@ public:
cuda_pop_context();
}
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType interpolation,
ExtensionType extension)
{
/* todo: support 3D textures, only CPU for now */
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
@@ -510,13 +513,19 @@ public:
cuda_assert(cuTexRefSetFlags(texref, CU_TRSF_READ_AS_INTEGER));
}
if(periodic) {
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_WRAP));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_WRAP));
}
else {
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_CLAMP));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_CLAMP));
switch(extension) {
case EXTENSION_REPEAT:
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_WRAP));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_WRAP));
break;
case EXTENSION_EXTEND:
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_CLAMP));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_CLAMP));
break;
case EXTENSION_CLIP:
cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_BORDER));
cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_BORDER));
break;
}
cuda_assert(cuTexRefSetFormat(texref, format, mem.data_elements));

View File

@@ -212,11 +212,14 @@ public:
{
data_size = width * ((height == 0)? 1: height) * ((depth == 0)? 1: depth);
data.resize(data_size);
data_pointer = (device_ptr)&data[0];
data_width = width;
data_height = height;
data_depth = depth;
if(data_size == 0) {
data_pointer = 0;
return NULL;
}
data_pointer = (device_ptr)&data[0];
return &data[0];
}

View File

@@ -169,13 +169,17 @@ public:
sub.device->const_copy_to(name, host, size);
}
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType
interpolation,
ExtensionType extension)
{
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
foreach(SubDevice& sub, devices) {
mem.device_pointer = 0;
sub.device->tex_alloc(name, mem, interpolation, periodic);
sub.device->tex_alloc(name, mem, interpolation, extension);
sub.ptr_map[unique_ptr] = mem.device_pointer;
}

View File

@@ -163,7 +163,10 @@ public:
snd.write_buffer(host, size);
}
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType interpolation,
ExtensionType extension)
{
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
@@ -178,7 +181,7 @@ public:
snd.add(name_string);
snd.add(mem);
snd.add(interpolation);
snd.add(periodic);
snd.add(extension);
snd.write();
snd.write_buffer((void*)mem.data_pointer, mem.memory_size());
}
@@ -571,13 +574,13 @@ protected:
network_device_memory mem;
string name;
InterpolationType interpolation;
bool periodic;
ExtensionType extension_type;
device_ptr client_pointer;
rcv.read(name);
rcv.read(mem);
rcv.read(interpolation);
rcv.read(periodic);
rcv.read(extension_type);
lock.unlock();
client_pointer = mem.device_pointer;
@@ -593,7 +596,7 @@ protected:
rcv.read_buffer((uint8_t*)mem.data_pointer, data_size);
device->tex_alloc(name.c_str(), mem, interpolation, periodic);
device->tex_alloc(name.c_str(), mem, interpolation, extension_type);
pointer_mapping_insert(client_pointer, mem.device_pointer);
}

View File

@@ -64,10 +64,20 @@ CCL_NAMESPACE_BEGIN
struct OpenCLPlatformDevice {
OpenCLPlatformDevice(cl_platform_id platform_id,
cl_device_id device_id)
: platform_id(platform_id), device_id(device_id) {}
const string& platform_name,
cl_device_id device_id,
cl_device_type device_type,
const string& device_name)
: platform_id(platform_id),
platform_name(platform_name),
device_id(device_id),
device_type(device_type),
device_name(device_name) {}
cl_platform_id platform_id;
string platform_name;
cl_device_id device_id;
cl_device_type device_type;
string device_name;
};
namespace {
@@ -77,6 +87,8 @@ cl_device_type opencl_device_type()
char *device = getenv("CYCLES_OPENCL_TEST");
if(device) {
if(strcmp(device, "NONE") == 0)
return 0;
if(strcmp(device, "ALL") == 0)
return CL_DEVICE_TYPE_ALL;
else if(strcmp(device, "DEFAULT") == 0)
@@ -103,12 +115,14 @@ bool opencl_kernel_use_advanced_shading(const string& platform)
if(platform == "NVIDIA CUDA")
return true;
else if(platform == "Apple")
return false;
return true;
else if(platform == "AMD Accelerated Parallel Processing")
return true;
else if(platform == "Intel(R) OpenCL")
return true;
/* Make sure officially unsupported OpenCL platforms
* does not set up to use advanced shading.
*/
return false;
}
@@ -141,7 +155,10 @@ bool opencl_device_supported(const string& platform_name,
if(platform_name == "AMD Accelerated Parallel Processing" &&
device_type == CL_DEVICE_TYPE_GPU)
{
return true;;
return true;
}
if(platform_name == "Apple" && device_type == CL_DEVICE_TYPE_GPU) {
return true;
}
return false;
}
@@ -210,39 +227,66 @@ void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
(getenv("CYCLES_OPENCL_TEST") != NULL) ||
(getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST")) != NULL;
const cl_device_type device_type = opencl_device_type();
static bool first_time = true;
#define FIRST_VLOG(severity) if(first_time) VLOG(severity)
usable_devices->clear();
if(device_type == 0) {
FIRST_VLOG(2) << "OpenCL devices are forced to be disabled.";
first_time = false;
return;
}
vector<cl_device_id> device_ids;
cl_uint num_devices = 0;
vector<cl_platform_id> platform_ids;
cl_uint num_platforms = 0;
/* Number of the devices added to the device info list. */
cl_uint num_added_devices = 0;
/* Get devices. */
if(clGetPlatformIDs(0, NULL, &num_platforms) != CL_SUCCESS ||
num_platforms == 0)
{
FIRST_VLOG(2) << "No OpenCL platforms were found.";
first_time = false;
return;
}
platform_ids.resize(num_platforms);
if(clGetPlatformIDs(num_platforms, &platform_ids[0], NULL) != CL_SUCCESS) {
FIRST_VLOG(2) << "Failed to fetch platform IDs from the driver..";
first_time = false;
return;
}
/* Devices are numbered consecutively across platforms. */
int num_base = 0;
for(int platform = 0;
platform < num_platforms;
platform++, num_base += num_added_devices)
{
for(int platform = 0; platform < num_platforms; platform++) {
cl_platform_id platform_id = platform_ids[platform];
num_devices = num_added_devices = 0;
char pname[256];
if(clGetPlatformInfo(platform_id,
CL_PLATFORM_NAME,
sizeof(pname),
&pname,
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Failed to get platform name, ignoring.";
continue;
}
string platform_name = pname;
FIRST_VLOG(2) << "Enumerating devices for platform "
<< platform_name << ".";
if(!opencl_platform_version_check(platform_id)) {
FIRST_VLOG(2) << "Ignoring platform " << platform_name
<< " due to too old compiler version.";
continue;
}
num_devices = 0;
if(clGetDeviceIDs(platform_id,
device_type,
0,
NULL,
&num_devices) != CL_SUCCESS || num_devices == 0)
{
FIRST_VLOG(2) << "Ignoring platform " << platform_name
<< ", failed to fetch number of devices.";
continue;
}
device_ids.resize(num_devices);
@@ -252,36 +296,64 @@ void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
&device_ids[0],
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Ignoring platform " << platform_name
<< ", failed to fetch devices list.";
continue;
}
if(!opencl_platform_version_check(platform_ids[platform])) {
continue;
}
char pname[256];
clGetPlatformInfo(platform_id,
CL_PLATFORM_NAME,
sizeof(pname),
&pname,
NULL);
string platform_name = pname;
for(int num = 0; num < num_devices; num++) {
cl_device_id device_id = device_ids[num];
char device_name[1024] = "\0";
if(clGetDeviceInfo(device_id,
CL_DEVICE_NAME,
sizeof(device_name),
&device_name,
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Failed to fetch device name, ignoring.";
continue;
}
if(!opencl_device_version_check(device_id)) {
FIRST_VLOG(2) << "Ignoting device " << device_name
<< " due to old compiler version.";
continue;
}
if(force_all_platforms ||
opencl_device_supported(platform_name, device_id))
{
cl_device_type device_type;
if(clGetDeviceInfo(device_id,
CL_DEVICE_TYPE,
sizeof(cl_device_type),
&device_type,
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Ignoting device " << device_name
<< ", faield to fetch device type.";
continue;
}
FIRST_VLOG(2) << "Adding new device " << device_name << ".";
usable_devices->push_back(OpenCLPlatformDevice(platform_id,
device_id));
platform_name,
device_id,
device_type,
device_name));
}
else {
FIRST_VLOG(2) << "Ignoting device " << device_name
<< ", not officially supported yet.";
}
}
}
first_time = false;
}
} /* namespace */
/* thread safe cache for contexts and programs */
/* Thread safe cache for contexts and programs.
*
* TODO(sergey): Make it more generous, so it can contain any type of program
* without hardcoding possible program types in the slot.
*/
class OpenCLCache
{
struct Slot
@@ -293,13 +365,16 @@ class OpenCLCache
/* cl_program for megakernel (used in OpenCLDeviceMegaKernel) */
cl_program ocl_dev_megakernel_program;
Slot() : mutex(NULL), context(NULL), ocl_dev_base_program(NULL), ocl_dev_megakernel_program(NULL) {}
Slot() : mutex(NULL),
context(NULL),
ocl_dev_base_program(NULL),
ocl_dev_megakernel_program(NULL) {}
Slot(const Slot &rhs)
: mutex(rhs.mutex)
, context(rhs.context)
, ocl_dev_base_program(rhs.ocl_dev_base_program)
, ocl_dev_megakernel_program(rhs.ocl_dev_megakernel_program)
Slot(const Slot& rhs)
: mutex(rhs.mutex),
context(rhs.context),
ocl_dev_base_program(rhs.ocl_dev_base_program),
ocl_dev_megakernel_program(rhs.ocl_dev_megakernel_program)
{
/* copy can only happen in map insert, assert that */
assert(mutex == NULL);
@@ -346,12 +421,14 @@ class OpenCLCache
* will be holding a lock for the cache. slot_locker should refer to a
* default constructed thread_scoped_lock */
template<typename T>
static T get_something(cl_platform_id platform, cl_device_id device,
T Slot::*member, thread_scoped_lock &slot_locker)
static T get_something(cl_platform_id platform,
cl_device_id device,
T Slot::*member,
thread_scoped_lock& slot_locker)
{
assert(platform != NULL);
OpenCLCache &self = global_instance();
OpenCLCache& self = global_instance();
thread_scoped_lock cache_lock(self.cache_lock);
@@ -384,8 +461,11 @@ class OpenCLCache
/* store something in the cache. you MUST have tried to get the item before storing to it */
template<typename T>
static void store_something(cl_platform_id platform, cl_device_id device, T thing,
T Slot::*member, thread_scoped_lock &slot_locker)
static void store_something(cl_platform_id platform,
cl_device_id device,
T thing,
T Slot::*member,
thread_scoped_lock& slot_locker)
{
assert(platform != NULL);
assert(device != NULL);
@@ -417,10 +497,14 @@ public:
};
/* see get_something comment */
static cl_context get_context(cl_platform_id platform, cl_device_id device,
thread_scoped_lock &slot_locker)
static cl_context get_context(cl_platform_id platform,
cl_device_id device,
thread_scoped_lock& slot_locker)
{
cl_context context = get_something<cl_context>(platform, device, &Slot::context, slot_locker);
cl_context context = get_something<cl_context>(platform,
device,
&Slot::context,
slot_locker);
if(!context)
return NULL;
@@ -434,19 +518,29 @@ public:
}
/* see get_something comment */
static cl_program get_program(cl_platform_id platform, cl_device_id device, ProgramName program_name,
thread_scoped_lock &slot_locker)
static cl_program get_program(cl_platform_id platform,
cl_device_id device,
ProgramName program_name,
thread_scoped_lock& slot_locker)
{
cl_program program = NULL;
if(program_name == OCL_DEV_BASE_PROGRAM) {
/* Get program related to OpenCLDeviceBase */
program = get_something<cl_program>(platform, device, &Slot::ocl_dev_base_program, slot_locker);
}
else if(program_name == OCL_DEV_MEGAKERNEL_PROGRAM) {
/* Get program related to megakernel */
program = get_something<cl_program>(platform, device, &Slot::ocl_dev_megakernel_program, slot_locker);
} else {
switch(program_name) {
case OCL_DEV_BASE_PROGRAM:
/* Get program related to OpenCLDeviceBase */
program = get_something<cl_program>(platform,
device,
&Slot::ocl_dev_base_program,
slot_locker);
break;
case OCL_DEV_MEGAKERNEL_PROGRAM:
/* Get program related to megakernel */
program = get_something<cl_program>(platform,
device,
&Slot::ocl_dev_megakernel_program,
slot_locker);
break;
default:
assert(!"Invalid program name");
}
@@ -462,10 +556,16 @@ public:
}
/* see store_something comment */
static void store_context(cl_platform_id platform, cl_device_id device, cl_context context,
thread_scoped_lock &slot_locker)
static void store_context(cl_platform_id platform,
cl_device_id device,
cl_context context,
thread_scoped_lock& slot_locker)
{
store_something<cl_context>(platform, device, context, &Slot::context, slot_locker);
store_something<cl_context>(platform,
device,
context,
&Slot::context,
slot_locker);
/* increment reference count in OpenCL.
* The caller is going to release the object when done with it. */
@@ -475,28 +575,41 @@ public:
}
/* see store_something comment */
static void store_program(cl_platform_id platform, cl_device_id device, cl_program program, ProgramName program_name,
thread_scoped_lock &slot_locker)
static void store_program(cl_platform_id platform,
cl_device_id device,
cl_program program,
ProgramName program_name,
thread_scoped_lock& slot_locker)
{
if(program_name == OCL_DEV_BASE_PROGRAM) {
store_something<cl_program>(platform, device, program, &Slot::ocl_dev_base_program, slot_locker);
}
else if(program_name == OCL_DEV_MEGAKERNEL_PROGRAM) {
store_something<cl_program>(platform, device, program, &Slot::ocl_dev_megakernel_program, slot_locker);
} else {
assert(!"Invalid program name\n");
return;
switch (program_name) {
case OCL_DEV_BASE_PROGRAM:
store_something<cl_program>(platform,
device,
program,
&Slot::ocl_dev_base_program,
slot_locker);
break;
case OCL_DEV_MEGAKERNEL_PROGRAM:
store_something<cl_program>(platform,
device,
program,
&Slot::ocl_dev_megakernel_program,
slot_locker);
break;
default:
assert(!"Invalid program name\n");
return;
}
/* increment reference count in OpenCL.
* The caller is going to release the object when done with it. */
/* Increment reference count in OpenCL.
* The caller is going to release the object when done with it.
*/
cl_int ciErr = clRetainProgram(program);
assert(ciErr == CL_SUCCESS);
(void)ciErr;
}
/* discard all cached contexts and programs
* the parameter is a temporary workaround. See OpenCLCache::~OpenCLCache */
/* Discard all cached contexts and programs. */
static void flush()
{
OpenCLCache &self = global_instance();
@@ -610,9 +723,10 @@ public:
OpenCLPlatformDevice& platform_device = usable_devices[info.num];
cpPlatform = platform_device.platform_id;
cdDevice = platform_device.device_id;
char name[256];
clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(name), &name, NULL);
platform_name = name;
platform_name = platform_device.platform_name;
VLOG(2) << "Creating new Cycles device for OpenCL platform "
<< platform_name << ", device "
<< platform_device.device_name << ".";
{
/* try to use cached context */
@@ -822,79 +936,109 @@ public:
return md5.get_hex();
}
bool load_kernels(const DeviceRequestedFeatures& /*requested_features*/)
bool load_kernels(const DeviceRequestedFeatures& requested_features)
{
/* verify if device was initialized */
/* Verify if device was initialized. */
if(!device_initialized) {
fprintf(stderr, "OpenCL: failed to initialize device.\n");
return false;
}
/* try to use cached kernel */
/* Try to use cached kernel. */
thread_scoped_lock cache_locker;
cpProgram = OpenCLCache::get_program(cpPlatform, cdDevice, OpenCLCache::OCL_DEV_BASE_PROGRAM, cache_locker);
cpProgram = load_cached_kernel(requested_features,
OpenCLCache::OCL_DEV_BASE_PROGRAM,
cache_locker);
if(!cpProgram) {
/* verify we have right opencl version */
VLOG(2) << "No cached OpenCL kernel.";
/* Verify we have right opencl version. */
if(!opencl_version_check())
return false;
/* md5 hash to detect changes */
string build_flags = build_options_for_base_program(requested_features);
/* Calculate md5 hashes to detect changes. */
string kernel_path = path_get("kernel");
string kernel_md5 = path_files_md5_hash(kernel_path);
string device_md5 = device_md5_hash();
string device_md5 = device_md5_hash(build_flags);
/* path to cached binary */
string clbin = string_printf("cycles_kernel_%s_%s.clbin", device_md5.c_str(), kernel_md5.c_str());
/* Path to cached binary.
*
* TODO(sergey): Seems we could de-duplicate all this string_printf()
* calls with some utility function which will give file name for a
* given hashes..
*/
string clbin = string_printf("cycles_kernel_%s_%s.clbin",
device_md5.c_str(),
kernel_md5.c_str());
clbin = path_user_get(path_join("cache", clbin));
/* path to preprocessed source for debugging */
string clsrc, *debug_src = NULL;
if(opencl_kernel_use_debug()) {
clsrc = string_printf("cycles_kernel_%s_%s.cl", device_md5.c_str(), kernel_md5.c_str());
clsrc = string_printf("cycles_kernel_%s_%s.cl",
device_md5.c_str(),
kernel_md5.c_str());
clsrc = path_user_get(path_join("cache", clsrc));
debug_src = &clsrc;
}
/* if exists already, try use it */
if(path_exists(clbin) && load_binary(kernel_path, clbin, "", &cpProgram)) {
/* kernel loaded from binary */
/* If binary kernel exists already, try use it. */
if(path_exists(clbin) && load_binary(kernel_path,
clbin,
build_flags,
&cpProgram)) {
/* Kernel loaded from binary, nothing to do. */
VLOG(2) << "Loaded kernel from " << clbin << ".";
}
else {
VLOG(2) << "Kernel file " << clbin << " either doesn't exist or failed to be loaded by driver.";
string init_kernel_source = "#include \"kernels/opencl/kernel.cl\" // " + kernel_md5 + "\n";
/* if does not exist or loading binary failed, compile kernel */
if(!compile_kernel(kernel_path, init_kernel_source, "", &cpProgram, debug_src))
/* If does not exist or loading binary failed, compile kernel. */
if(!compile_kernel(kernel_path,
init_kernel_source,
build_flags,
&cpProgram,
debug_src))
{
return false;
}
/* save binary for reuse */
if(!save_binary(&cpProgram, clbin))
/* Save binary for reuse. */
if(!save_binary(&cpProgram, clbin)) {
return false;
}
}
/* cache the program */
OpenCLCache::store_program(cpPlatform, cdDevice, cpProgram, OpenCLCache::OCL_DEV_BASE_PROGRAM, cache_locker);
/* Cache the program. */
store_cached_kernel(cpPlatform,
cdDevice,
cpProgram,
OpenCLCache::OCL_DEV_BASE_PROGRAM,
cache_locker);
}
else {
VLOG(2) << "Found cached OpenCL kernel.";
}
/* find kernels */
ckFilmConvertByteKernel = clCreateKernel(cpProgram, "kernel_ocl_convert_to_byte", &ciErr);
if(opencl_error(ciErr))
return false;
/* Find kernels. */
#define FIND_KERNEL(kernel_var, kernel_name) \
do { \
kernel_var = clCreateKernel(cpProgram, "kernel_ocl_" kernel_name, &ciErr); \
if(opencl_error(ciErr)) \
return false; \
} while(0)
ckFilmConvertHalfFloatKernel = clCreateKernel(cpProgram, "kernel_ocl_convert_to_half_float", &ciErr);
if(opencl_error(ciErr))
return false;
ckShaderKernel = clCreateKernel(cpProgram, "kernel_ocl_shader", &ciErr);
if(opencl_error(ciErr))
return false;
ckBakeKernel = clCreateKernel(cpProgram, "kernel_ocl_bake", &ciErr);
if(opencl_error(ciErr))
return false;
FIND_KERNEL(ckFilmConvertByteKernel, "convert_to_byte");
FIND_KERNEL(ckFilmConvertHalfFloatKernel, "convert_to_half_float");
FIND_KERNEL(ckShaderKernel, "shader");
FIND_KERNEL(ckBakeKernel, "bake");
#undef FIND_KERNEL
return true;
}
@@ -912,9 +1056,9 @@ public:
}
if(ckFilmConvertByteKernel)
clReleaseKernel(ckFilmConvertByteKernel);
clReleaseKernel(ckFilmConvertByteKernel);
if(ckFilmConvertHalfFloatKernel)
clReleaseKernel(ckFilmConvertHalfFloatKernel);
clReleaseKernel(ckFilmConvertHalfFloatKernel);
if(ckShaderKernel)
clReleaseKernel(ckShaderKernel);
if(ckBakeKernel)
@@ -941,9 +1085,22 @@ public:
else
mem_flag = CL_MEM_READ_WRITE;
mem.device_pointer = (device_ptr)clCreateBuffer(cxContext, mem_flag, size, mem_ptr, &ciErr);
opencl_assert_err(ciErr, "clCreateBuffer");
/* Zero-size allocation might be invoked by render, but not really
* supported by OpenCL. Using NULL as device pointer also doesn't really
* work for some reason, so for the time being we'll use special case
* will null_mem buffer.
*/
if(size != 0) {
mem.device_pointer = (device_ptr)clCreateBuffer(cxContext,
mem_flag,
size,
mem_ptr,
&ciErr);
opencl_assert_err(ciErr, "clCreateBuffer");
}
else {
mem.device_pointer = null_mem;
}
stats.mem_alloc(size);
mem.device_size = size;
@@ -953,15 +1110,31 @@ public:
{
/* this is blocking */
size_t size = mem.memory_size();
opencl_assert(clEnqueueWriteBuffer(cqCommandQueue, CL_MEM_PTR(mem.device_pointer), CL_TRUE, 0, size, (void*)mem.data_pointer, 0, NULL, NULL));
if(size != 0){
opencl_assert(clEnqueueWriteBuffer(cqCommandQueue,
CL_MEM_PTR(mem.device_pointer),
CL_TRUE,
0,
size,
(void*)mem.data_pointer,
0,
NULL, NULL));
}
}
void mem_copy_from(device_memory& mem, int y, int w, int h, int elem)
{
size_t offset = elem*y*w;
size_t size = elem*w*h;
opencl_assert(clEnqueueReadBuffer(cqCommandQueue, CL_MEM_PTR(mem.device_pointer), CL_TRUE, offset, size, (uchar*)mem.data_pointer + offset, 0, NULL, NULL));
assert(size != 0);
opencl_assert(clEnqueueReadBuffer(cqCommandQueue,
CL_MEM_PTR(mem.device_pointer),
CL_TRUE,
offset,
size,
(uchar*)mem.data_pointer + offset,
0,
NULL, NULL));
}
void mem_zero(device_memory& mem)
@@ -975,7 +1148,9 @@ public:
void mem_free(device_memory& mem)
{
if(mem.device_pointer) {
opencl_assert(clReleaseMemObject(CL_MEM_PTR(mem.device_pointer)));
if(mem.device_pointer != null_mem) {
opencl_assert(clReleaseMemObject(CL_MEM_PTR(mem.device_pointer)));
}
mem.device_pointer = 0;
stats.mem_free(mem.device_size);
@@ -1005,7 +1180,7 @@ public:
void tex_alloc(const char *name,
device_memory& mem,
InterpolationType /*interpolation*/,
bool /*periodic*/)
ExtensionType /*extension*/)
{
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
mem_alloc(mem, MEM_READ_ONLY);
@@ -1203,7 +1378,6 @@ public:
virtual void thread_run(DeviceTask * /*task*/) = 0;
protected:
string kernel_build_options(const string *debug_src = NULL)
{
string build_options = " -cl-fast-relaxed-math ";
@@ -1393,8 +1567,49 @@ protected:
if(!requested_features.use_camera_motion) {
build_options += " -D__NO_CAMERA_MOTION__";
}
if(!requested_features.use_baking) {
build_options += " -D__NO_BAKING__";
}
return build_options;
}
/* ** Those guys are for workign around some compiler-specific bugs ** */
virtual cl_program load_cached_kernel(
const DeviceRequestedFeatures& /*requested_features*/,
OpenCLCache::ProgramName program_name,
thread_scoped_lock& cache_locker)
{
return OpenCLCache::get_program(cpPlatform,
cdDevice,
program_name,
cache_locker);
}
virtual void store_cached_kernel(cl_platform_id platform,
cl_device_id device,
cl_program program,
OpenCLCache::ProgramName program_name,
thread_scoped_lock& cache_locker)
{
OpenCLCache::store_program(platform,
device,
program,
program_name,
cache_locker);
}
virtual string build_options_for_base_program(
const DeviceRequestedFeatures& /*requested_features*/)
{
/* TODO(sergey): By default we compile all features, meaning
* mega kernel is not getting feature-based optimizations.
*
* Ideally we need always compile kernel with as less features
* enabed as possible to keep performance at it's max.
*/
return "";
}
};
class OpenCLDeviceMegaKernel : public OpenCLDeviceBase
@@ -2818,16 +3033,25 @@ public:
/* Macro for Enqueuing split kernels. */
#define GLUE(a, b) a ## b
#define ENQUEUE_SPLIT_KERNEL(kernelName, globalSize, localSize) \
opencl_assert(clEnqueueNDRangeKernel(cqCommandQueue, \
GLUE(ckPathTraceKernel_, \
kernelName), \
2, \
NULL, \
globalSize, \
localSize, \
0, \
NULL, \
NULL))
{ \
ciErr = clEnqueueNDRangeKernel(cqCommandQueue, \
GLUE(ckPathTraceKernel_, \
kernelName), \
2, \
NULL, \
globalSize, \
localSize, \
0, \
NULL, \
NULL); \
opencl_assert_err(ciErr, "clEnqueueNDRangeKernel"); \
if(ciErr != CL_SUCCESS) { \
string message = string_printf("OpenCL error: %s in clEnqueueNDRangeKernel()", \
clewErrorString(ciErr)); \
opencl_error(message); \
return; \
} \
} (void) 0
/* Enqueue ckPathTraceKernel_data_init kernel. */
ENQUEUE_SPLIT_KERNEL(data_init, global_size, local_size);
@@ -3325,12 +3549,39 @@ protected:
cl_mem mem_alloc(size_t bufsize, cl_mem_flags mem_flag = CL_MEM_READ_WRITE)
{
cl_mem ptr;
assert(bufsize != 0);
ptr = clCreateBuffer(cxContext, mem_flag, bufsize, NULL, &ciErr);
if(opencl_error(ciErr)) {
assert(0);
}
opencl_assert_err(ciErr, "clCreateBuffer");
return ptr;
}
/* ** Those guys are for workign around some compiler-specific bugs ** */
cl_program load_cached_kernel(
const DeviceRequestedFeatures& /*requested_features*/,
OpenCLCache::ProgramName /*program_name*/,
thread_scoped_lock /*cache_locker*/)
{
VLOG(2) << "Skip loading kernel from cache, "
<< "not supported by split kernel.";
return NULL;
}
void store_cached_kernel(cl_platform_id /*platform*/,
cl_device_id /*device*/,
cl_program /*program*/,
OpenCLCache::ProgramName /*program_name*/,
thread_scoped_lock& /*slot_locker*/)
{
VLOG(2) << "Skip storing kernel in cache, "
<< "not supported by split kernel.";
}
string build_options_for_base_program(
const DeviceRequestedFeatures& requested_features)
{
return build_options_from_requested_features(requested_features);
}
};
Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
@@ -3338,28 +3589,9 @@ Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
vector<OpenCLPlatformDevice> usable_devices;
opencl_get_usable_devices(&usable_devices);
assert(info.num < usable_devices.size());
OpenCLPlatformDevice& platform_device = usable_devices[info.num];
char name[256];
if(clGetPlatformInfo(platform_device.platform_id,
CL_PLATFORM_NAME,
sizeof(name),
&name,
NULL) != CL_SUCCESS)
{
VLOG(1) << "Failed to retrieve platform name, using mega kernel.";
return new OpenCLDeviceMegaKernel(info, stats, background);
}
string platform_name = name;
cl_device_type device_type;
if(clGetDeviceInfo(platform_device.device_id,
CL_DEVICE_TYPE,
sizeof(cl_device_type),
&device_type,
NULL) != CL_SUCCESS)
{
VLOG(1) << "Failed to retrieve device type, using mega kernel,";
return new OpenCLDeviceMegaKernel(info, stats, background);
}
const OpenCLPlatformDevice& platform_device = usable_devices[info.num];
const string& platform_name = platform_device.platform_name;
const cl_device_type device_type = platform_device.device_type;
if(opencl_kernel_use_split(platform_name, device_type)) {
VLOG(1) << "Using split kernel.";
return new OpenCLDeviceSplitKernel(info, stats, background);
@@ -3379,7 +3611,23 @@ bool device_opencl_init(void)
initialized = true;
result = clewInit() == CLEW_SUCCESS;
if(opencl_device_type() != 0) {
int clew_result = clewInit();
if(clew_result == CLEW_SUCCESS) {
VLOG(1) << "CLEW initialization succeeded.";
result = true;
}
else {
VLOG(1) << "CLEW initialization failed: "
<< ((clew_result == CLEW_ERROR_ATEXIT_FAILED)
? "Error setting up atexit() handler"
: "Error opening the library");
}
}
else {
VLOG(1) << "Skip initializing CLEW, platform is force disabled.";
result = false;
}
return result;
}
@@ -3391,43 +3639,13 @@ void device_opencl_info(vector<DeviceInfo>& devices)
/* Devices are numbered consecutively across platforms. */
int num_devices = 0;
foreach(OpenCLPlatformDevice& platform_device, usable_devices) {
cl_platform_id platform_id = platform_device.platform_id;
cl_device_id device_id = platform_device.device_id;
/* We always increment the device number, so there;s 1:1 mapping from
* info.num to indexinside usable_devices vector.
*/
++num_devices;
char platform_name[256];
if(clGetPlatformInfo(platform_id,
CL_PLATFORM_NAME,
sizeof(platform_name),
&platform_name,
NULL) != CL_SUCCESS)
{
continue;
}
char device_name[1024] = "\0";
if(clGetDeviceInfo(device_id,
CL_DEVICE_NAME,
sizeof(device_name),
&device_name,
NULL) != CL_SUCCESS)
{
continue;
}
cl_device_type device_type;
if(clGetDeviceInfo(device_id,
CL_DEVICE_TYPE,
sizeof(cl_device_type),
&device_type,
NULL) != CL_SUCCESS)
{
continue;
}
const string& platform_name = platform_device.platform_name;
const cl_device_type device_type = platform_device.device_type;
const string& device_name = platform_device.device_name;
DeviceInfo info;
info.type = DEVICE_OPENCL;
info.description = string_remove_trademark(string(device_name));
info.num = num_devices - 1;
info.num = num_devices;
info.id = string_printf("OPENCL_%d", info.num);
/* We don't know if it's used for display, but assume it is. */
info.display_device = true;
@@ -3436,11 +3654,15 @@ void device_opencl_info(vector<DeviceInfo>& devices)
info.use_split_kernel = opencl_kernel_use_split(platform_name,
device_type);
devices.push_back(info);
num_devices++;
}
}
string device_opencl_capabilities(void)
{
if(opencl_device_type() == 0) {
return "All OpenCL devices are forced to be OFF";
}
string result = "";
string error_msg = ""; /* Only used by opencl_assert(), but in the future
* it could also be nicely reported to the console.

View File

@@ -125,6 +125,7 @@ set(SRC_SVM_HEADERS
svm/svm_value.h
svm/svm_vector_transform.h
svm/svm_voronoi.h
svm/svm_voxel.h
svm/svm_wave.h
)
@@ -188,7 +189,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
endif()
# CUDA version
execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT})
string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")

View File

@@ -382,10 +382,6 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con
float cosHO = dot(Ht, I);
float cosHI = dot(Ht, omega_in);
/* those situations makes chi+ terms in eq. 33, 34 be zero */
if(dot(Ht, N) <= 0.0f || cosHO * cosNO <= 0.0f || cosHI * cosNI <= 0.0f)
return make_float3(0.0f, 0.0f, 0.0f);
float D, G1o, G1i;
/* eq. 33: first we calculate D(m) with m=Ht: */
@@ -412,7 +408,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con
* pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2 */
float common = D * (m_eta * m_eta) / (cosNO * Ht2);
float out = G * fabsf(cosHI * cosHO) * common;
*pdf = G1o * cosHO * fabsf(cosHI) * common;
*pdf = G1o * fabsf(cosHO * cosHI) * common;
return make_float3(out, out, out);
}
@@ -735,10 +731,6 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc
float cosHO = dot(Ht, I);
float cosHI = dot(Ht, omega_in);
/* those situations makes chi+ terms in eq. 25, 27 be zero */
if(dot(Ht, N) <= 0.0f || cosHO * cosNO <= 0.0f || cosHI * cosNI <= 0.0f)
return make_float3(0.0f, 0.0f, 0.0f);
/* eq. 25: first we calculate D(m) with m=Ht: */
float alpha2 = alpha_x * alpha_y;
float cosThetaM = min(dot(N, Ht), 1.0f);
@@ -764,7 +756,7 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc
* pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2 */
float common = D * (m_eta * m_eta) / (cosNO * Ht2);
float out = G * fabsf(cosHI * cosHO) * common;
*pdf = G1o * cosHO * fabsf(cosHI) * common;
*pdf = G1o * fabsf(cosHO * cosHI) * common;
return make_float3(out, out, out);
}

View File

@@ -58,6 +58,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
Transform ob_tfm;
#endif
*num_hits = 0;
isect_array->t = tmax;
#ifndef __KERNEL_SSE41__
if(!isfinite(P.x)) {
return false;
@@ -68,9 +71,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
int num_hits_in_instance = 0;
#endif
*num_hits = 0;
isect_array->t = tmax;
ssef tnear(0.0f), tfar(tmax);
sse3f idir4(ssef(idir.x), ssef(idir.y), ssef(idir.z));

View File

@@ -60,6 +60,9 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
Transform ob_tfm;
#endif
uint num_hits = 0;
isect_array->t = tmax;
#ifndef __KERNEL_SSE41__
if(!isfinite(P.x)) {
return false;
@@ -70,9 +73,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
int num_hits_in_instance = 0;
#endif
uint num_hits = 0;
isect_array->t = tmax;
ssef tnear(0.0f), tfar(isect_t);
sse3f idir4(ssef(idir.x), ssef(idir.y), ssef(idir.z));

View File

@@ -32,7 +32,14 @@ void *kernel_osl_memory(KernelGlobals *kg);
bool kernel_osl_use(KernelGlobals *kg);
void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t size);
void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t width, size_t height, size_t depth, InterpolationType interpolation=INTERPOLATION_LINEAR);
void kernel_tex_copy(KernelGlobals *kg,
const char *name,
device_ptr mem,
size_t width,
size_t height,
size_t depth,
InterpolationType interpolation=INTERPOLATION_LINEAR,
ExtensionType extension = EXTENSION_REPEAT);
void kernel_cpu_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
int sample, int x, int y, int offset, int stride);

View File

@@ -43,7 +43,30 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo
{
/* create ray form raster position */
Transform rastertocamera = kernel_data.cam.rastertocamera;
float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
float3 raster = make_float3(raster_x, raster_y, 0.0f);
float3 Pcamera = transform_perspective(&rastertocamera, raster);
#ifdef __CAMERA_MOTION__
if(kernel_data.cam.have_perspective_motion) {
/* TODO(sergey): Currently we interpolate projected coordinate which
* gives nice looking result and which is simple, but is in fact a bit
* different comparing to constructing projective matrix from an
* interpolated field of view.
*/
if(ray->time < 0.5f) {
Transform rastertocamera_pre = kernel_data.cam.perspective_motion.pre;
float3 Pcamera_pre =
transform_perspective(&rastertocamera_pre, raster);
Pcamera = interp(Pcamera_pre, Pcamera, ray->time * 2.0f);
}
else {
Transform rastertocamera_post = kernel_data.cam.perspective_motion.post;
float3 Pcamera_post =
transform_perspective(&rastertocamera_post, raster);
Pcamera = interp(Pcamera, Pcamera_post, (ray->time - 0.5f) * 2.0f);
}
}
#endif
ray->P = make_float3(0.0f, 0.0f, 0.0f);
ray->D = Pcamera;
@@ -244,11 +267,14 @@ ccl_device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float
/* ray differential */
ray->dP = differential3_zero();
Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
float3 Ddiff = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y)));
Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
ray->dD.dx = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
ray->dD.dx = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - Ddiff;
Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
ray->dD.dy = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
ray->dD.dy = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - Ddiff;
#endif
}

View File

@@ -128,7 +128,7 @@ template<typename T> struct texture_image {
return x - (float)i;
}
ccl_always_inline float4 interp(float x, float y, bool periodic = true)
ccl_always_inline float4 interp(float x, float y)
{
if(UNLIKELY(!data))
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
@@ -138,14 +138,20 @@ template<typename T> struct texture_image {
if(interpolation == INTERPOLATION_CLOSEST) {
frac(x*(float)width, &ix);
frac(y*(float)height, &iy);
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
break;
}
return read(data[ix + iy*width]);
}
@@ -153,19 +159,26 @@ template<typename T> struct texture_image {
float tx = frac(x*(float)width - 0.5f, &ix);
float ty = frac(y*(float)height - 0.5f, &iy);
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
break;
}
float4 r = (1.0f - ty)*(1.0f - tx)*read(data[ix + iy*width]);
@@ -176,36 +189,44 @@ template<typename T> struct texture_image {
return r;
}
else {
/* Tricubic b-spline interpolation. */
/* Bicubic b-spline interpolation. */
const float tx = frac(x*(float)width - 0.5f, &ix);
const float ty = frac(y*(float)height - 0.5f, &iy);
int pix, piy, nnix, nniy;
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
pix = wrap_periodic(ix-1, width);
piy = wrap_periodic(iy-1, height);
pix = wrap_periodic(ix-1, width);
piy = wrap_periodic(iy-1, height);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
nnix = wrap_periodic(ix+2, width);
nniy = wrap_periodic(iy+2, height);
nnix = wrap_periodic(ix+2, width);
nniy = wrap_periodic(iy+2, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
break;
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
}
const int xc[4] = {pix, ix, nix, nnix};
const int yc[4] = {width * piy,
width * iy,
@@ -233,14 +254,13 @@ template<typename T> struct texture_image {
}
}
ccl_always_inline float4 interp_3d(float x, float y, float z, bool periodic = false)
ccl_always_inline float4 interp_3d(float x, float y, float z)
{
return interp_3d_ex(x, y, z, interpolation, periodic);
return interp_3d_ex(x, y, z, interpolation);
}
ccl_always_inline float4 interp_3d_ex(float x, float y, float z,
int interpolation = INTERPOLATION_LINEAR,
bool periodic = false)
int interpolation = INTERPOLATION_LINEAR)
{
if(UNLIKELY(!data))
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
@@ -252,15 +272,22 @@ template<typename T> struct texture_image {
frac(y*(float)height, &iy);
frac(z*(float)depth, &iz);
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
break;
}
return read(data[ix + iy*width + iz*width*height]);
@@ -270,23 +297,30 @@ template<typename T> struct texture_image {
float ty = frac(y*(float)height - 0.5f, &iy);
float tz = frac(z*(float)depth - 0.5f, &iz);
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
niz = wrap_periodic(iz+1, depth);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
niz = wrap_periodic(iz+1, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
niz = wrap_clamp(iz+1, depth);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
niz = wrap_clamp(iz+1, depth);
break;
}
float4 r;
@@ -310,39 +344,46 @@ template<typename T> struct texture_image {
const float tz = frac(z*(float)depth - 0.5f, &iz);
int pix, piy, piz, nnix, nniy, nniz;
if(periodic) {
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
switch(extension) {
case EXTENSION_REPEAT:
ix = wrap_periodic(ix, width);
iy = wrap_periodic(iy, height);
iz = wrap_periodic(iz, depth);
pix = wrap_periodic(ix-1, width);
piy = wrap_periodic(iy-1, height);
piz = wrap_periodic(iz-1, depth);
pix = wrap_periodic(ix-1, width);
piy = wrap_periodic(iy-1, height);
piz = wrap_periodic(iz-1, depth);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
niz = wrap_periodic(iz+1, depth);
nix = wrap_periodic(ix+1, width);
niy = wrap_periodic(iy+1, height);
niz = wrap_periodic(iz+1, depth);
nnix = wrap_periodic(ix+2, width);
nniy = wrap_periodic(iy+2, height);
nniz = wrap_periodic(iz+2, depth);
}
else {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
nnix = wrap_periodic(ix+2, width);
nniy = wrap_periodic(iy+2, height);
nniz = wrap_periodic(iz+2, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
piz = wrap_clamp(iz-1, depth);
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
piz = wrap_clamp(iz-1, depth);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
niz = wrap_clamp(iz+1, depth);
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
niz = wrap_clamp(iz+1, depth);
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
nniz = wrap_clamp(iz+2, depth);
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
nniz = wrap_clamp(iz+2, depth);
break;
}
const int xc[4] = {pix, ix, nix, nnix};
@@ -393,6 +434,7 @@ template<typename T> struct texture_image {
T *data;
int interpolation;
ExtensionType extension;
int width, height, depth;
#undef SET_CUBIC_SPLINE_WEIGHTS
};

View File

@@ -728,15 +728,15 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
if(dot(D, Ng) >= 0.0f)
return false;
ls->P = make_float3(data0.y, data0.z, data0.w);
float3 light_P = make_float3(data0.y, data0.z, data0.w);
if(!ray_quad_intersect(P, D, t,
ls->P, axisu, axisv, &ls->P, &ls->t))
light_P, axisu, axisv, &ls->P, &ls->t))
return false;
ls->D = D;
ls->Ng = Ng;
ls->pdf = area_light_sample(P, &ls->P, axisu, axisv, 0, 0, false);
ls->pdf = area_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
ls->eval_fac = 0.25f*invarea;
}
else

View File

@@ -27,15 +27,14 @@
/*
* Enqueue ray index into the queue
*/
ccl_device void enqueue_ray_index (
int ray_index, /* Ray index to be enqueued */
int queue_number, /* Queue in which the ray index should be enqueued*/
ccl_global int *queues, /* Buffer of all queues */
int queue_size, /* Size of each queue */
ccl_global int *queue_index /* Array of size num_queues; Used for atomic increment */
)
ccl_device void enqueue_ray_index(
int ray_index, /* Ray index to be enqueued. */
int queue_number, /* Queue in which the ray index should be enqueued. */
ccl_global int *queues, /* Buffer of all queues. */
int queue_size, /* Size of each queue. */
ccl_global int *queue_index) /* Array of size num_queues; Used for atomic increment. */
{
/* This thread's queue index */
/* This thread's queue index. */
int my_queue_index = atomic_inc(&queue_index[queue_number]) + (queue_number * queue_size);
queues[my_queue_index] = ray_index;
}
@@ -47,52 +46,48 @@ ccl_device void enqueue_ray_index (
* i.e All ray's in the queue has been successfully allocated and there
* is no more ray to allocate to other threads.
*/
ccl_device int get_ray_index (
int thread_index, /* Global thread index */
int queue_number, /* Queue to operate on */
ccl_global int *queues, /* Buffer of all queues */
int queuesize, /* Size of a queue */
int empty_queue /* Empty the queue slot as soon as we fetch the ray index */
)
ccl_device int get_ray_index(
int thread_index, /* Global thread index. */
int queue_number, /* Queue to operate on. */
ccl_global int *queues, /* Buffer of all queues. */
int queuesize, /* Size of a queue. */
int empty_queue) /* Empty the queue slot as soon as we fetch the ray index. */
{
int ray_index = queues[queue_number * queuesize + thread_index];
if(empty_queue && ray_index != QUEUE_EMPTY_SLOT) {
queues[queue_number * queuesize + thread_index] = QUEUE_EMPTY_SLOT;
}
return ray_index;
}
/* The following functions are to realize Local memory variant of enqueue ray index function */
/* The following functions are to realize Local memory variant of enqueue ray index function. */
/* All threads should call this function */
/* All threads should call this function. */
ccl_device void enqueue_ray_index_local(
int ray_index, /* Ray index to enqueue*/
int queue_number, /* Queue in which to enqueue ray index */
char enqueue_flag, /* True for threads whose ray index has to be enqueued */
int queuesize, /* queue size */
ccl_local unsigned int *local_queue_atomics, /* To to local queue atomics */
ccl_global int *Queue_data, /* Queues */
ccl_global int *Queue_index /* To do global queue atomics */
)
int ray_index, /* Ray index to enqueue. */
int queue_number, /* Queue in which to enqueue ray index. */
char enqueue_flag, /* True for threads whose ray index has to be enqueued. */
int queuesize, /* queue size. */
ccl_local unsigned int *local_queue_atomics, /* To to local queue atomics. */
ccl_global int *Queue_data, /* Queues. */
ccl_global int *Queue_index) /* To do global queue atomics. */
{
int lidx = get_local_id(1) * get_local_size(0) + get_local_id(0);
/* Get local queue id */
/* Get local queue id .*/
unsigned int lqidx;
if(enqueue_flag) {
lqidx = atomic_inc(local_queue_atomics);
}
barrier(CLK_LOCAL_MEM_FENCE);
/* Get global queue offset */
/* Get global queue offset. */
if(lidx == 0) {
*local_queue_atomics = atomic_add(&Queue_index[queue_number], *local_queue_atomics);
}
barrier(CLK_LOCAL_MEM_FENCE);
/* Get global queue index and enqueue ray */
/* Get global queue index and enqueue ray. */
if(enqueue_flag) {
unsigned int my_gqidx = queue_number * queuesize + (*local_queue_atomics) + lqidx;
Queue_data[my_gqidx] = ray_index;
@@ -100,30 +95,28 @@ ccl_device void enqueue_ray_index_local(
}
ccl_device unsigned int get_local_queue_index(
int queue_number, /* Queue in which to enqueue the ray; -1 if no queue */
ccl_local unsigned int *local_queue_atomics
)
int queue_number, /* Queue in which to enqueue the ray; -1 if no queue */
ccl_local unsigned int *local_queue_atomics)
{
int my_lqidx = atomic_inc(&local_queue_atomics[queue_number]);
return my_lqidx;
}
ccl_device unsigned int get_global_per_queue_offset(
int queue_number,
ccl_local unsigned int *local_queue_atomics,
ccl_global int* global_queue_atomics
)
int queue_number,
ccl_local unsigned int *local_queue_atomics,
ccl_global int* global_queue_atomics)
{
unsigned int queue_offset = atomic_add((&global_queue_atomics[queue_number]), local_queue_atomics[queue_number]);
unsigned int queue_offset = atomic_add(&global_queue_atomics[queue_number],
local_queue_atomics[queue_number]);
return queue_offset;
}
ccl_device unsigned int get_global_queue_index(
int queue_number,
int queuesize,
unsigned int lqidx,
ccl_local unsigned int * global_per_queue_offset
)
int queue_number,
int queuesize,
unsigned int lqidx,
ccl_local unsigned int * global_per_queue_offset)
{
int my_gqidx = queuesize * queue_number + lqidx + global_per_queue_offset[queue_number];
return my_gqidx;

View File

@@ -459,7 +459,7 @@ ccl_device void shader_merge_closures(ShaderData *sd)
continue;
#endif
if(!(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1))
if(!(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1 && sci->data2 == scj->data2))
continue;
if(CLOSURE_IS_BSDF_OR_BSSRDF(sci->type)) {

View File

@@ -105,7 +105,14 @@ CCL_NAMESPACE_BEGIN
#ifdef __KERNEL_OPENCL_APPLE__
# define __KERNEL_SHADING__
//#define __KERNEL_ADV_SHADING__
# define __KERNEL_ADV_SHADING__
/* TODO(sergey): Currently experimental section is ignored here,
* this is because megakernel in device_opencl does not support
* custom cflags depending on the scene features.
*/
# ifdef __KERNEL_EXPERIMENTAL__
# define __CMJ__
# endif
#endif
#ifdef __KERNEL_OPENCL_AMD__
@@ -713,7 +720,6 @@ typedef struct PathState {
/* random number generator state */
int rng_offset; /* dimension offset */
int rng_offset_bsdf; /* dimension offset for picking bsdf */
int sample; /* path sample number */
int num_samples; /* total number of times this path will be sampled */
@@ -771,7 +777,7 @@ typedef struct KernelCamera {
/* motion blur */
float shuttertime;
int have_motion;
int have_motion, have_perspective_motion;
/* clipping */
float nearclip;
@@ -789,7 +795,6 @@ typedef struct KernelCamera {
float inv_aperture_ratio;
int is_inside_volume;
int pad2;
/* more matrices */
Transform screentoworld;
@@ -803,6 +808,11 @@ typedef struct KernelCamera {
Transform worldtocamera;
MotionTransform motion;
/* Denotes changes in the projective matrix, namely in rastertocamera.
* Used for camera zoom motion blur,
*/
PerspectiveMotionTransform perspective_motion;
} KernelCamera;
typedef struct KernelFilm {
@@ -1015,16 +1025,19 @@ typedef ccl_addr_space struct DebugData {
/* Queue names */
enum QueueNumber {
QUEUE_ACTIVE_AND_REGENERATED_RAYS, /* All active rays and regenerated rays are enqueued here */
QUEUE_HITBG_BUFF_UPDATE_TOREGEN_RAYS, /* All
* 1.Background-hit rays,
* 2.Rays that has exited path-iteration but needs to update output buffer
* 3.Rays to be regenerated
* are enqueued here */
QUEUE_SHADOW_RAY_CAST_AO_RAYS, /* All rays for which a shadow ray should be cast to determine radiance
contribution for AO are enqueued here */
QUEUE_SHADOW_RAY_CAST_DL_RAYS, /* All rays for which a shadow ray should be cast to determine radiance
contributuin for direct lighting are enqueued here */
QUEUE_ACTIVE_AND_REGENERATED_RAYS = 0, /* All active rays and regenerated rays are enqueued here. */
QUEUE_HITBG_BUFF_UPDATE_TOREGEN_RAYS = 1, /* All
* 1. Background-hit rays,
* 2. Rays that has exited path-iteration but needs to update output buffer
* 3. Rays to be regenerated
* are enqueued here.
*/
QUEUE_SHADOW_RAY_CAST_AO_RAYS = 2, /* All rays for which a shadow ray should be cast to determine radiance
* contribution for AO are enqueued here.
*/
QUEUE_SHADOW_RAY_CAST_DL_RAYS = 3, /* All rays for which a shadow ray should be cast to determine radiance
* contributuin for direct lighting are enqueued here.
*/
};
/* We use RAY_STATE_MASK to get ray_state (enums 0 to 5) */

View File

@@ -578,7 +578,7 @@ ccl_device_noinline VolumeIntegrateResult kernel_volume_integrate(KernelGlobals
/* Decoupled Volume Sampling
*
* VolumeSegment is list of coefficients and transmittance stored at all steps
* through a volume. This can then latter be used for decoupled sampling as in:
* through a volume. This can then later be used for decoupled sampling as in:
* "Importance Sampling Techniques for Path Tracing in Participating Media"
*
* On the GPU this is only supported (but currently not enabled)

View File

@@ -38,7 +38,14 @@ void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t s
assert(0);
}
void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t width, size_t height, size_t depth, InterpolationType interpolation)
void kernel_tex_copy(KernelGlobals *kg,
const char *name,
device_ptr mem,
size_t width,
size_t height,
size_t depth,
InterpolationType interpolation,
ExtensionType extension)
{
if(0) {
}
@@ -64,6 +71,7 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t
tex->data = (float4*)mem;
tex->dimensions_set(width, height, depth);
tex->interpolation = interpolation;
tex->extension = extension;
}
}
else if(strstr(name, "__tex_image")) {
@@ -79,6 +87,7 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t
tex->data = (uchar4*)mem;
tex->dimensions_set(width, height, depth);
tex->interpolation = interpolation;
tex->extension = extension;
}
}
else

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