Compare commits

..

567 Commits

Author SHA1 Message Date
34498dbe56 Mod-bskin: Fix 0 radius hang out 2015-10-06 22:51:21 +07:00
ea5054ba5a Mob-bskin: Fix degenerate adjcent edges. Fix wrong winding order in cyclic cases. Fix wrong radius interpolation in cyclic cases 2015-10-06 22:15:36 +07:00
fbbfa43d75 Merge branch 'master' into mod-bskin 2015-10-04 15:16:29 +11:00
5884a0d66e Correct last commit, picky type warnings 2015-10-04 15:11:38 +11:00
a3cf661108 Correct last commit, check before freeing 2015-10-04 15:02:29 +11:00
74a2fa3095 BLI_Buffer: add BLI_buffer_reinit
Useful for re-using a buffer when the existing data can be thrown away.
2015-10-04 14:29:27 +11:00
9f046e95c0 BLI_Buffer: support over 2gb allocations
Also move comment to C-source and enumerate useful features.
2015-10-04 14:10:26 +11:00
38f4aeb2d3 BLI_Buffer: fix BLI_buffer_resize w/ calloc flag
When resizing, zero memory when the calloc flag is set,
even when no realloc is done.
2015-10-04 13:52:13 +11:00
0dc3984924 Cleanup: warnings/style 2015-10-04 11:15:17 +11:00
5443d41882 InstallDeps: Fix broken OSL (would not generate valid default names for its .oso pre-compiled files).
Also, externalize temp/hacky patches in own dir, much much cleaner than integrating them in bash script!
2015-10-03 16:28:09 +02:00
344cf0ad24 Cleanup/warnings 2015-10-03 21:43:38 +10:00
01c1e6b9ff Merge branch 'master' into mod-bskin 2015-10-03 21:26:16 +10:00
d9d3a2a500 Fix T44605: OS X continuous grab issues. 2015-10-03 13:08:37 +02:00
ffe03cd264 Fix Broken Font Preview (reported over IRC by kopias, thanks).
Broken by font wrap commit rBf2341f829654c4dc97, there was actually two things here:
* Using non-initialized color (which lead to transparent drawing...), we need to use new
  `blf_draw_buffer__start/end` helpers here too, made them shared internally.
* Using `draw_str_i18n_nbr` as `draw_str[i]` length, ugh! That's the number of utf8 glyphs of
  translated string, not the length of untranslated string!

This fix must be backported to final 2.76.
2015-10-03 09:29:37 +02:00
41d0547490 Cleanup: style 2015-10-03 08:22:48 +10:00
caf98e29c5 rename ui_but_dragedit_poll
This isnt only checking, its initializing draglock
2015-10-03 08:19:50 +10:00
e6bc4da2ad Bskin: Remove debug code 2015-10-02 22:26:35 +07:00
aacc54d533 Bskin: Reduce flickering at connection nodes. Add isolated mesh part support. Clean code 2015-10-02 22:00:04 +07:00
e49b934955 Fix T46346: Hide/Mask menu, Hotkey for lasso mask in sculpt mode unchangeable.
One can only edit keyboard shortcuts from that menu, others will now show a short
info about that instead of stupid 'Add' option!
2015-10-02 13:11:27 +02:00
550527bed0 Fix memory leak in compositor code with RGB curve nodes. 2015-10-01 18:11:12 +02:00
9ad829da7b Cycles: Correction to point density with particle source and world mapping 2015-10-01 19:34:37 +05:00
066df84f73 Fix T46340: Auto scrolling in text editor with upward selection not work.
Cleanup and rework a bit text_cursor_set_to_pos_wrapped(), it did not handle correctly negative y valuesi,
because it was only checking lines starting from first visible one.

Mostly, we now directly get line matching given y position (be it an invisible one) from the helper
(renamed `get_line_pos_wrapped()`), instead of first visible one, which allows us to get rid of
additional complexity of looping over next lines until we find correct one.

This code remains rather complex to follow, added some asserts to ensure everything works as expected,
and tested it rather seriously, but DO NOT backport this to 2.76!
2015-10-01 15:34:24 +02:00
29c2a64694 BGE: Fix T46302: abort call for unnormalized quaterions. 2015-10-01 13:06:57 +02:00
0f43fbcd8c Fix T46339: Edge sliding when there is only one vertex in the mesh crashes blender.
If t->mode remains edge/vert slide, restoreTransObjects() ends up calling
projectVert/EdgeSlideData(), which tries to access invalid customdata...

Not sure why we call again restoreTransObjects() and resetTransRestrictions() here tbh,
but safer not to change that for now.

Should be backported to 2.76 if possible.
2015-10-01 12:06:57 +02:00
83a94cb3f2 Fix T46321: 3D view not refreshed immediatelly after pasting keyframe in dope sheet (for a single channel) 2015-10-01 18:47:37 +13:00
e5117108aa Fix potential memory leak baking 2015-10-01 17:21:08 +10:00
22ec991e6b Fix T46331: File open does not show thumbnails, when a filter_glob is provided by python scripts.
No reason to exclude usual file-type 'guessing' for operator-filtered extensions...

Safe for 2.76, should we need to merge more fixes.
2015-09-30 20:20:44 +02:00
fabde2ab43 Fix T46332: Can't select an object with OpenSubdiv enabled
The issue was introduced by a wrong fix for T46247. Now both reports should
be properly solved.
2015-09-30 20:59:19 +05:00
95763b8c8a Revert "Fix T46247: Side-reported, bbox for zero-verts object with OSD subsurf and GPU compute would be -INF."
This reverts commit b278e8742b.
2015-09-30 20:57:02 +05:00
de360c4090 Fix T46313: Cycles bake normal map
Regression moving to bake to looptri
caused by mismatch w/ MFace and MLoopTri when the 3rd index was 0.
2015-10-01 07:25:45 +10:00
1030b22b0a Fix T46325: Armature: No more possible to rotate a bone with only its tip selected, in EditMode.
Regression from rB312cb0a957b81233ea, now we make an exception for TFM_ROTATION mode...
2015-09-30 10:51:16 +02:00
Julian Eisel
491b1899de Fix T46306: Cursor sometimes jumps with num-slider buttons & Continuous Grab
More precise description of the issue: Clicking on the right side of a num-slider button with Continuous Grab enabled sometimes caused cursor to jump to the inner value indicator even though text editing was started.

Happened because data->ungrab_mval wasn't reset correctly after dragging.
2015-09-30 01:58:59 +02:00
Julian Eisel
32365bb06c Add drag-threshold for number slider buttons
Was already used for normal number buttons for ages, makes sense to use here too.
2015-09-30 01:58:59 +02:00
7d2a62ef65 Fix T46299: Windows: File Browser Crash while listing big folders in preview mode (fonts, images...).
Windows-only bug, mmap & co are not threadsafe by default on this platform, so we have to add a dedicated
spinlock for them in win32.

Note that we may try to get rid of those mmap later, but not for 2.76!

To be backported to final 2.76...
2015-09-29 19:54:25 +02:00
2eb0c990f1 i18n extraction tools: keep even better order of entries in PO files.
Important to avoid too much changes, especially on the git repo (we are still getting
way too much changes there currently...).
2015-09-28 20:32:09 +02:00
3a58de3bf1 Blender Internal: Fix regression in point density texture
The issue was introduced by original Cycles point density support commit,
it lead to a constant density of 1 for object verticies point density source.
2015-09-28 21:33:45 +05:00
4c09f47a99 Cycles: Fix wrong particles min/max calculation for point density
Solves wrong object mapping reported in T46301.
2015-09-28 21:33:45 +05:00
fc97204742 Fix T46293: Text Editor: Convert to spaces/to tabs was totally broken with non-ASCII strings.
Code was totally unaware of UTF8, also it was needlessly complicated...
2015-09-28 10:04:37 +02:00
1a6d45527f BGE docs fix: link to the correct method name 2015-09-27 17:20:10 +02:00
8ea5cfd448 BGE documentation updates
Mostly added missing :arg: clauses -- these caused the :type:-clauses
that were already in the RST files to be hidden from the output HTML.

I also fixed some argument types from 'list' to 'Vector' where applicable
and corrected some obvious mistakes.
2015-09-27 16:32:16 +02:00
d187c6d8d6 Fix T46285: "Select parent" if there is no parent doesn't work correctly. 2015-09-27 10:24:11 +02:00
14bac995f3 Fix T46268: All Hotkey "C" are unexpectedly translated in menus.
We need custom context here, those are often very short names so context collision is pretty easy.

Also some minor changes (and avoid shadowing varnames)...
2015-09-27 09:51:56 +02:00
3bc16c3362 Fix T46271: switching between textures in texture buttons not updating preview. 2015-09-27 02:40:30 +02:00
b0951f4954 Fix T46212: blender internal lights in exclusive light group wrong in viewport. 2015-09-27 02:20:16 +02:00
97b1b6775f Fix crash reporting render errors during baking. 2015-09-27 02:18:42 +02:00
Julian Eisel
5a16c85a53 Fix file browser not sorting file list when opened from editor menu 2015-09-26 13:40:13 +02:00
4aad17c622 Use PyThreadState_GetDict, avoid Python internals
Works around problems caused by exposing Py internals (Py_BUILD_CORE).

- Build error with GCC, Py3.6 & OpenMP
- Linking error on MSVC
2015-09-26 12:02:17 +10:00
02b7896423 Fix T46260: Shadeless option ignores Object-Color 2015-09-26 01:37:39 +10:00
Julian Eisel
0419d3bb01 Fix node auto-offset to left broken
Own, really stupid mistake in rBc653077bf56 :| Kids, don't commit at night!
2015-09-25 17:08:33 +02:00
cf12e51eba Fix T46249: Boid goal object that has a force field set to 'Every Point' shape causes crash.
This is a mere bandage, that whole area is known broken anyway, but at least it should prevent the crash.

Note that that kind of stuff (the efd->index being a pointer) is really bad practice imho...

Should be backported to final 2.76.
2015-09-25 15:53:14 +02:00
a4a6e9b3f5 Fix T46239: Cross effect strip input fields can't be changed (in its properties panel).
Those shall not be editable in UI...
2015-09-25 10:54:38 +02:00
7967da2515 Fix T46263: bpy api - assigning to object.matrix_basis with AXIS_ANGLE rotation mode does not work correctly.
Drot in axis angle does not make that much sense anyway (it's even disabled in UI), but let's apply
it correctly at least!
2015-09-25 09:03:30 +02:00
b278e8742b Fix T46247: Side-reported, bbox for zero-verts object with OSD subsurf and GPU compute would be -INF.
Trivial fix, to be backported to final 2.76 if possible.
2015-09-25 08:38:45 +02:00
c216d345aa Merge branch 'master' into mod-bskin 2015-09-25 02:18:00 +10:00
112f665a43 Resolve minor issues for gcc 2015-09-25 02:17:46 +10:00
de80e68768 Cleanup: And one more commit... (BVH Cache). 2015-09-24 17:01:58 +02:00
97a3fa17d6 Cleanup: Remove some more BVH cache code, for reading/writing the cache. 2015-09-24 16:49:10 +02:00
5bcdc5513b Mod_bskin:remove unused functions 2015-09-24 21:37:14 +07:00
a5646b2d5b Bskin: add ununiform scaling. add hole support. add bulging effect support at branch verts. reduce triangles at stiching region 2015-09-24 21:19:16 +07:00
dfadf18659 Cleanup: Remove some underlying code for the BVH disk cache.
Notes:
- There is still some bvh cache code, but that is from the engines initial commit, we might clean this up further or keep it.
- Changes in util_cache.h/.c are kept, this might be re-used in the future.
2015-09-24 15:47:27 +02:00
3804a3660e Cleanup: Typo fixes in OpenCL log messages. 2015-09-24 15:34:41 +02:00
3e59691df5 Cycles: Remove the BVH cache feature
This removes the BVH cache feature from the UI, underlying code will be removed in a separate commit.

The BVH cache was added before we had a multi-threaded BVH build, and a lot of other optimizations were done since then, which makes this not useful anymore.

Fix T46162.
2015-09-24 15:30:15 +02:00
Dalai Felinto
6aed771fac Multiview: fix Image Editor not showing Views menu when rendering
non-stereo Multi-View camera rigs (unreported)
2015-09-24 09:15:18 -03:00
fc6f4c11ae Add test scripts to ctest & rename 2015-09-24 20:52:58 +10:00
81f64312d2 Fix T46226: Bake normals multi-res crash 2015-09-24 20:14:51 +10:00
4269c56904 Fix T45865: NLA: Auto Blend is not recalculated when adjusting repeat. 2015-09-24 10:53:09 +02:00
f26a3f4bc5 Fix T46227: ShapeKeys Lattice by the driver, problem updates in new depsgraph
The issue was caused by driver referencing path outside of the key datablock.
2015-09-24 13:13:00 +05:00
3352b56d05 Fix T46232: Boids crash w/ random rule selection 2015-09-24 16:07:30 +10:00
ecf0529efd Quiet warning 2015-09-24 15:17:02 +10:00
741cf193f1 Knife: Improve clamping extents in ortho view
- measure extents from mesh center instead of origin.
- use clamping method, guaranteed not to flip the input vectors direction.
- use cage coords when available (since knife operates on the cage).
2015-09-24 13:34:26 +10:00
4493cac21a Fix T46219: Knife cuts fail away from center 2015-09-24 03:00:52 +10:00
Dalai Felinto
1827f99a78 Fix T46225: Crash when rendering halo flare
Error introduced in the multiview commit.
Also bringing back the "continue" statement instead of "return", as it
was before multiview.
2015-09-23 13:37:01 -03:00
d0a2a8086c Fix T46222: Eyedrop picking objects inconsistently 2015-09-24 01:45:19 +10:00
c34993160d Fix T46220: Add torus has no 'layers' option
Add layers property for all operators using AddObjectHelper
2015-09-24 01:05:55 +10:00
Julian Eisel
982a06ac22 Fix UV editor scope background color not correct after theme reset
Missed to do that in rBcbeb76da952cd.
2015-09-23 16:01:44 +02:00
365d8ceac0 Workaround for linking Python on win32 2015-09-23 23:20:15 +10:00
f964334b88 Fix T46215: Explode modifier looses textures 2015-09-23 22:57:00 +10:00
abfc9e59e2 Fix T46217: Make normal artifacts 2015-09-23 20:19:46 +10:00
0ec814c91d Cycles: Support building with latest OSL-1.7dev
So now the following OSL versions are supported (at least for compilation):

- 1.5 with closure alignment patch applied
- 1.6.8 release
- 1.7 development version from latest git
2015-09-23 12:27:02 +05:00
1cae9c4af4 Fix T46202: OS X (and Windows?) crash when going fullscreen.
Calling event handling recursively during window live resize is problematic,
the code wasn't designed to do that. Instead postpone event handling until
after live resize.
2015-09-22 23:20:17 +02:00
0cf842a989 Update module test to pass w/o freestyle enabled 2015-09-23 03:36:32 +10:00
7615073e77 Update test to RNA API 2015-09-23 03:11:17 +10:00
1a59b63e1c Show error when unsupported movie format used
Was silently failing.
2015-09-23 03:02:07 +10:00
ad873ca92d prevent assert: select-linked UV delimit w/o UV's 2015-09-23 03:00:30 +10:00
c3ebab3e45 OpenSubdiv: Fix crash with empty mesh
Reported by newbz in IRC, thanks!
2015-09-22 21:11:17 +05:00
dc9f906d42 FFmpeg: Solve memory leak happening on encoding video 2015-09-22 21:11:17 +05:00
c6049d1371 Fix T46194: Crash rendering particles
Off by one error in 38940662
2015-09-22 22:16:40 +10:00
a1e2b292bb Install_deps: Hopefully fix broken checks for numpy package in fedora-like distro. 2015-09-22 11:00:35 +02:00
f2418f48fa Install_deps: Add command line options to saved BUILD_NOTES.txt.
Requested by Daniel Salazar (zanqdo) over IRC.
2015-09-22 09:45:01 +02:00
e51272f663 Fix report banner text width 2015-09-22 17:18:43 +10:00
e29f8c600b Reporting was done before before addons were loaded
On the very first start, reporting of missing engines wasn't working.
2015-09-22 16:53:07 +10:00
b87cb9ad2c Remove arbitrary simulation time limit in liquid sim. Tested and works fine with more than 100s 2015-09-22 00:35:22 -06:00
70f0499139 Fix for error reporting w/ a new-file
Reports are now initialized before reading startup.blend
2015-09-22 15:56:03 +10:00
9a62164d94 Cleanup: indentation 2015-09-22 15:02:11 +10:00
98807ca751 Report loading file with no matching engine
Re-enable old code, now show in header instead of popup.
2015-09-22 13:30:12 +10:00
28fa49f168 Cleanup: de-duplicate post file read update calls 2015-09-22 12:50:41 +10:00
12ea90b707 Fix T46201: Popup menu in post_load handler crash
Match regular file loading logic for new-file operator.
2015-09-22 12:26:24 +10:00
32578db1bd Fix bplayer (c). 2015-09-21 17:40:50 +02:00
b53eb9e18b Cleanup: use malloc when calloc is overwritten 2015-09-22 01:03:32 +10:00
e4d016ce48 Makefile: show build dir when configuring 2015-09-22 00:16:53 +10:00
894fd0c2fc Sequencer: show X,Y in text effect location 2015-09-22 00:15:37 +10:00
84b074baed Armature drawing: custom shape scale options
- Custom scale:
  Avoids having multiple custom-shapes at different sizes.
- Option not to use bones length:
  So changes in edit-mode don't resize the custom-shape.
2015-09-21 23:57:08 +10:00
0dbde559cf Render: Free persistent image storage when loading new file 2015-09-21 18:42:48 +05:00
7b9bd5b546 Recent change for Py3.6 compat caused fatal-error
Revert back to old method, and define Py_BUILD_CORE to expose internals.
2015-09-21 23:08:18 +10:00
df80aeb162 Fix (unreported) Append/link code: All library datablocks could end with same name.
This was broken since ages I think, did not really hurt since we usually never use libs' names
to access them. Rather bad behavior however, breaking a ground rule of our ID system!

And no real reason to add new libraries to new (split) Main at all, libraries are
never considered linked datablocks, which means they should always be in 'main' Main->library list.

Not a regression, but should be included in 2.76 imho.
2015-09-21 15:06:07 +02:00
8da3c5c1b9 Fix T46159: OpenSubdiv does not always give same results as Blender own subsurf code with crease edges 2015-09-21 17:53:21 +05:00
dbdb1064e7 Small fix for depsgraph debug graphviz: empty labels for edges require an explicit id. 2015-09-21 12:46:07 +02:00
1ee9c5d6a3 Some minor tweaks to depsgraph debug graphviz output.
- Removed relation labels, since these mostly just reflect connected nodes, and also appear too far off the edge lines
- Draw cyclic links in dark red
- Slightly thicker edges and larger margins
2015-09-21 12:16:30 +02:00
ff3c7460e5 Fix view-selected w/ custom bone shapes
Was ignoring bone-length, also check that drawing shapes is enabled.
2015-09-21 15:15:59 +10:00
034cc855f0 Fix T46186: Panel doesn't update on brush change 2015-09-21 10:32:14 +10:00
5031dbcee5 Fix linker warning about zero length memset. 2015-09-21 01:59:52 +02:00
726727191a Fix T43715: IK pole target + stretch not working for a single bone chain. 2015-09-21 01:59:50 +02:00
0b714abacc RNA: angle step-sizes were too small
These were ignored previously, so it wasn't noticeable.
2015-09-21 09:49:13 +10:00
Julian Eisel
c653077bf5 Fix node auto-offset failing during heavy compositing (sometimes)
Compositing might make main thread so busy that animation is considered done due to duration before final position is reached.

Also added check to avoid unnecessary redraws.
2015-09-21 01:03:36 +02:00
8f25c12110 Fix T46050: blender internal geometry node UV not working inside node group. 2015-09-20 23:15:34 +02:00
196d26fb14 Fix T46144: blender internal face texture color wrong in raytraced reflection. 2015-09-20 23:14:55 +02:00
Julian Eisel
5ad8489c1d Fix compiling with GE
Enabled Freestyle instead of GE :| Sry
2015-09-20 21:11:08 +02:00
Julian Eisel
cbeb76da95 Fix T46180: Theme > UV Image editor > Scope Background does not have any effect 2015-09-20 20:17:19 +02:00
Julian Eisel
28da385ac2 Cleanup: Use new vector transform functions 2015-09-20 18:11:25 +02:00
Julian Eisel
a28a1f11d6 GL-utils: Add vector transform functions
Might also be useful to have _neg versions of these (done quite often),
but decided to keep it simple for now.
2015-09-20 18:03:36 +02:00
605a2c8490 Cleanup: warning, style 2015-09-21 06:59:50 +10:00
d0017eb5f2 fix build error w/ clang 2015-09-20 20:27:09 +10:00
fa19af6a93 Word wrap support for frame node 2015-09-20 18:17:34 +10:00
c0d5523e6c Fix T46169: Link to bpy API in addons tab of user preferences is outdated.
Now use auto-generated one, like e.g. for link in Help main menu...
2015-09-20 09:49:36 +02:00
cfc109eb92 Fix T46161: Rotate around selection changes bezier curve handle type.
Issue is, when 'Rotate Aroud Selection' is set, in Edit mode we do a fake transform operation
to get center point around which to rotate. For curves, most transform operations involve
a check of handle types. For now, added 'TFM_DUMMY' as an exception here.

Think it would be best to actually undo those changes in case of cancelled operation,
but this is much more involved, while this fix is safe enough to be included in final 2.76.
2015-09-19 11:08:21 +02:00
6844b02a71 Fix for building w/ Python3.6 2015-09-19 17:49:38 +10:00
631d08aaed Fix leak in UI Panels
Switching screens quickly didn't free the panels activedata.
2015-09-19 17:49:04 +10:00
cbeab360f1 UI: tooltip layout tweaks
- enable word-wrap for all tip text to align vertically.
- draw enum identifier at the end of the last line, not first.
2015-09-19 15:22:03 +10:00
cb27d38cf4 BLF: correct ResultBLF.width value when wrapping 2015-09-19 15:22:03 +10:00
e6a413b1ec UI: word-wrap for tooltips, broke text alignment
This wasn't visible with default settings,
but caused problems w/ pie-menu's & manually adjusted theme font-size.

Now only draw from the bound-box top w/ word-wrap enabled.
2015-09-19 15:22:03 +10:00
Julian Eisel
36d64240e6 File Browser: Scroll view on normal selection too
Adjusts view after mouse/border selection if some selected items are out of view bounds.
To get as much of the selection into view as possible, this adjusts view first for the last, then for the first element in the selection.
Also, if region is pretty small, view adjustment is skipped, as otherwise the view is focused on the first element only, which isn't really useful IMHO.

Maybe not so nice: Since we do two view alignment iterations, UI_view2d_curRect_validate, which is a rather big function *might* be called twice under certain circumstances (border select & total size of selected elements is exceeds view bounds). I think that's totally acceptable though.
2015-09-19 04:24:48 +02:00
Julian Eisel
d7e88fe1fd File Browser: Scroll view with arrow keys navigation
Adjusts view to display active file after using arrow keys to navigate through files.
2015-09-19 03:34:00 +02:00
Julian Eisel
bc5238e3cc Correction to previous commit 2015-09-19 03:17:06 +02:00
Julian Eisel
1bb89a6028 Fix file key select using wrong file after border select in scrolled view
Basically, after border selecting, a wrong file was selected by using arrow keys if the screen was scrolled a bit vertically. Reason was that we didn't use correct view space coordinates but region space coordinates for measuring distance from mouse to first/last file in selection after border select.
2015-09-19 03:12:46 +02:00
6e19aa42bf Fix T46155: Sequencer Text Effect: wrong vertical 'TOP' alignment.
Logic was broken for this vertical alignment option - we need to remove one line height here...
2015-09-18 23:01:31 +02:00
de7b7572c2 Fix T46030: Strange behavior of Cycles Brick Texture
Added some extra seed to the hash, so it's now less likely to give repetitive
patters at values around zero.

This will change distribution of bricks for existing files. but it's something
inevitable.
2015-09-18 17:32:17 +05:00
910aaa3951 Image Stamp: word-wrap support for 'note' text 2015-09-18 20:44:06 +10:00
0aa0a1a966 Sequencer: word-wrap support for sequencer text
Also add vertical alignment option,
default align to bottom for subtitles.
2015-09-18 20:44:06 +10:00
d435b0d24d UI: word-wrap support for tooltips
Tooltips will automatically wrap when exceeding UI_TIP_MAXWIDTH.
2015-09-18 20:44:06 +10:00
f2341f8296 BLF: initial word-wrap support
- Adds support for word wrapping to Blender's BLF font library.
- Splits lines when width limit is reached or on explicit \n newlines.

Details:

- Word wrapping is used when `BLF_WORD_WRAP` flag is enabled.
- There is a single loop to handle line wrapping,
  this runs callback, passing in a substring,
  this way we can avoid code-duplication for all word-wrapped
  versions of functions... OR... avoid having to add support
  for word-wrapping directly into each function.
- The `ResultBLF` struct was added to be able to get the number
  of wrapped lines, when calling otherwise unrelated functions
  such as `BLF_draw/BLF_width/BLF_boundbox`,
  which can be passed as the last argument to `BLF_*_ex()` functions.
- The `ResultBLF` struct is used to store the result of drawing
  (currently only the number of lines wrapped, and the width).
2015-09-18 20:43:52 +10:00
e9dd060102 Doc: remove todo's from BMesh code
These were out of date and better have outside the source.

Also clarify BMLoop description.
2015-09-18 16:40:55 +10:00
803d1563ec Minor edits to sys-info
- remove byte b''
- remove always false check for missing buildinfo.
- use textwrap module
2015-09-18 16:40:55 +10:00
247b68476b Cycles: simplify logic for calculating dof-dist
Matches change from BKE_camera
2015-09-18 16:40:55 +10:00
f1422c40af Use squared length where possible 2015-09-18 16:40:55 +10:00
2eb50d450c Cleanup: simplify PyBMesh customdata API use 2015-09-18 16:40:54 +10:00
b2e206a0af Cleanup: remove unused WriteFile members 2015-09-18 16:40:54 +10:00
1d6c1e90aa Support relative frames w/ start/end args 2015-09-18 16:40:54 +10:00
be73170bf6 Fix UI crash entering very long strings
Strings exceeding UI_MAX_DRAW_STR weren't null terminated.
2015-09-18 16:40:54 +10:00
f7239e9084 Fix T46148: Sculpt view-clip fails in ortho mode 2015-09-18 16:40:54 +10:00
276732ee62 Address request from T46136: make softrange for 'simple deform' angle from -360 to 360 degrees...
This should be safe enough for final 2.76, sould we make other RC.
2015-09-18 08:27:04 +02:00
208e064721 Doc: escape enum name & description
Needed since key enum now uses many characters as they're typed.
2015-09-18 01:47:58 +10:00
a9c5e1d9b7 2.75 splash
by The Alike Team
2015-09-18 00:10:19 +10:00
Julian Eisel
7238ae1df4 Fix hidden auto-offset glitch
Steps to reproduce were: Open F233831, insert floating node into nearby link (so that it's not attached to frame).
2015-09-17 16:00:04 +02:00
174a1f1a45 Fix for broken tree offset after recent change for cyclic nodes support 2015-09-17 17:28:13 +05:00
3cee28ebf3 Fix T46143: Faces missing with GPU render
Epsilon was quite arbitrary for GPU, replaced with checking for zero-sized faces.

It should solve both original report and the new one. After the release we can check
why GPU doesn't produce accurate math here and go to the root of the issue.
2015-09-17 17:21:17 +05:00
c4bcb6a479 Fix T46134: units degrees increment are too small
The user interface was ignoring the precision step size for degrees,
making all rotation inputs drag by a 100th of a degree.

Now use a 10th of a degree instead.
2015-09-17 22:09:18 +10:00
209ca1e746 Fix T46139: Crash when inserting a node in a looped node structure 2015-09-17 16:17:04 +05:00
7fcaa7feac Fix for recent regression clamping materials
Mixup between gpu/derivedMesh total materials, fix and name more clearly to avoid confusion.
thanks to Sergey for finding root cause!
2015-09-17 20:46:38 +10:00
9744c8ca58 CMake: Another attempt to solve compilation error on Windows 2015-09-17 14:29:56 +05:00
a712459603 CMake: Attempt to fix compilation error on Windows after recent changes 2015-09-17 14:17:00 +05:00
eca704f579 Fix T46090: Blender game embedded player crash
SCons didn't pass `-DWITH_AUDASPACE` to the compiler, so it skipped the
instantiation of the "aud" Python module. This caused a crash of the BGE,
which did get the `-DWITH_AUDASPACE` directive, and expected that module
to exist.

Reviewed by: lukastoenne
2015-09-17 10:14:08 +02:00
79c668dbec Correction to previous commit.
Mostly styling, but also str_exec would often remain undefined...
2015-09-16 22:23:05 +02:00
4fb9cc24a8 Fix (unreported): Filebrowser key navigation entry did not change caption correctly
As of this release we're able to navigate with the keyboard in the filebrowsing area. The button caption is changing to an appropriate string whenever a new entry is selected. In @Severins original code a different method was used to determine if a directory was choosen or not, but this got lost while merging the filebrowser rework.

Thanks to @mont29 for review!
2015-09-16 22:08:04 +02:00
9d087ad0b5 Fix T46130: Vertex/wire no visible with OpenSubdiv in edit mode
For now simply show warning in the interface and fallback to regular subsurf
code. Supporting OpenSubdiv in edit mode in possible but not high priority
currently.
2015-09-16 23:02:41 +05:00
1fa3bd6148 Fix T46128: High Quality DoF broken
The issue was caused by some special tricks needed to compile OpenSubdiv shader
which was using stupid check whether geometry shader is used or not.

Now made it more explicit call whether special OpenSubdiv trickery is needed or
not.

Its not ideal solution, but it's not really easy to do a proper solution for
this, because while we can do half of the work with if-defs in the shader code
but we'll still need to somewhat define layout of the input blocks which isn't
really doable with current shader version we're using.
2015-09-16 22:38:46 +05:00
89de6e9eac OpenSubdiv: Fix crash caused by accessing OpenGL vendor from non-main thread 2015-09-16 22:25:13 +05:00
f0023b0dbe Comment unused sequencer prefetch 2015-09-17 03:00:32 +10:00
5a13f8a750 UI: Curve clipping didn't enforce zoom. 2015-09-17 02:55:30 +10:00
cb4e358735 Fix T46126: Anchored sculpt fail when cursor leaves mesh 2015-09-17 02:14:56 +10:00
cf4711bdf9 OpenSubdiv: Attempt to solve crash in background mode 2015-09-16 20:33:16 +05:00
0f19e6d1a7 Code cleanup, whitespace 2015-09-16 20:26:58 +05:00
7b3491f2c6 OpenSubdiv: Fix for missing caching of vendor string parsing result 2015-09-16 20:23:32 +05:00
19d17c8d90 Fllowup to previous commit, remove unused code 2015-09-16 20:20:16 +05:00
3f05d72a98 Fix T45708: OpenSubdiv crashes on Windows with Intel cards
Disable Intel cards for until we'll go to the root of the issue of the crash.
This will take a bit, so being so close to the release we go safe and disable
unstable GPU, so blender at least doesn't crash.

This could be bypassed by setting OPENSUBDIV_ALLOW_INTEL environment variable.
2015-09-16 19:28:40 +05:00
182b5736fb Get rid of leftover from refactor of VBO code. Thanks to severin for
noticing
2015-09-16 17:23:27 +03:00
0b959458ff CMake: Don't modify global CFlags when enabling/disabling OpenJpeg 2015-09-16 19:10:41 +05:00
2d16622068 Fix T46105, disable viewport compositing when non power of two texture
support is missing.

Supporting those (really) old GPUs requires us to make shaders more
expensive by converting between real and scaled coordinates and be wary
of such conversion caveats when handling uv coordinates in shaders. Not
worth the cost for supporting hardware that old.
2015-09-16 17:04:12 +03:00
96282b866d Correct for building with gcc 2015-09-16 14:23:15 +10:00
b7c2199583 Merge branch 'master' into mod-bskin 2015-09-16 14:12:53 +10:00
e3ff9b2044 Fix T46073: crash w/ out-of-bounds material 2015-09-16 07:49:59 +10:00
7f63eaafd6 Fix T45389 Windows thumbnails not working.
Also they did not work when using blender -R from
command line in 64-bit systems.
Issue was checking for wrong define which would
cause code to detect if the blender executable
functions under 32 bit emulation.
For 64bit executables this is false, leading
blender to believe we are operating under a 32bit
system, and registration would try to register
the 32bit thumbnailer.

This 32 bit dll is (correctly) missing for local
installs and from the new installer, thus no thumbnails.
2015-09-16 00:28:09 +03:00
b8a8059e21 Fix for text editor un-indent undo
Same issue as T44381, re-use logic for indent.
2015-09-16 03:35:25 +10:00
860e25fe29 Fix T46093: Thumbnails/previews of materials/textures not displaying in Blender filebrowser when only one thread is available.
Using the global scheduler here is not a really good idea - `filelist_cache_previewf()` is not a short task
that run once, but it's a loop that keeps cheking for work in a TODO queue. This means it won't quickly allow other tasks
to start, so it should not be in the global scheduler.

In fact, asynchronous tasks (that is, tasks that will live for quite a bit of time, and often sleep a lot) should never use
global scheduler, they would steal computing resources from heavy-duty, short-time living ones - and possibly even completely
stall threaded tasks (if all worker threads are executing long-life tasks...).

We could probably even completely bypass the scheduler/task thing here (and directly use threads), but it does not have
that much of an over-head, and still offers easy handling of threading stuff...
2015-09-15 13:57:47 +02:00
0c2be4d8e8 Fix T46113: Color picker erratic outside 0-1 range 2015-09-15 21:28:21 +10:00
745510844b Cleanup: hide clnors warning prints behind G.debug, those can get annoyingly verbose... 2015-09-15 12:03:58 +02:00
841202fd06 Fix wm leak loading factory-startup 2015-09-15 19:31:17 +10:00
Dalai Felinto
07a7d64c06 BGE: make error message more clear when trying to de/activate actuator from non-active controller 2015-09-15 00:01:32 -03:00
dbe1829183 Fix T46114: paint face-mask hide clears sharp flag 2015-09-15 05:55:42 +10:00
0271414aad Fix T46109: Bitmap font objects leads to unfreed memory. 2015-09-14 17:12:40 +02:00
3056add0e0 Fix T45699: BGE auto-run exits immediately 2015-09-14 23:39:58 +10:00
34843a855e Fix T46099: snapping failed on objects with some NULL-dimension in their bbox.
Added a helper that ensures a bbox has some non-NULL dimension along all its axes.

Also, fixed some (rather unlikely) NULL dereference cases (though it should not in this context,
`BKE_object_boundbox_get()` can return NULL).
2015-09-14 12:53:52 +02:00
2db71782e7 Fix T46106: Hidden socket w/ node link from Py API
Internally this was OK, but an invalid state from the users POV.
2015-09-14 20:39:20 +10:00
5611237391 Fix T45699: own regression w/ looptri update
Baking was still checking tessface in parts.
2015-09-14 15:55:43 +10:00
bfea087d96 Alternate fix for offscreen render w/o npot
Store the original texture size,
since its needed for reading pixels and passing to glViewport.
2015-09-14 13:18:43 +10:00
754fb6b907 Revert "Fix crash in opengl render caused..."
This reverts commit d64b1221c6.

While this prevents the crash, offscreen renders still aren't working right.
2015-09-14 13:13:48 +10:00
d64b1221c6 Fix crash in opengl render caused by gfx being blacklisted for
non-power-of-2 texture support.  Note that all I did was pass
the correct width/height into glReadPixels; the result may not
be the same as if non2 textures were enabled.
2015-09-13 14:52:31 -07:00
e443dd4d97 Fix T43033: VideoTexture module repeated loading of images causes memory leak
Fix proposal for memory leak caused by png decoding in videoFFmpeg.cpp

T43033

Author: Ulysse MARTIN (youle)

Reviewers: dfelinto, ben2610, moguri, lordloki, panzergame

Reviewed By: lordloki, panzergame

Subscribers: panzergame, lordloki

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1396
2015-09-13 20:59:24 +02:00
09e40a4956 Cleanup: spelling 2015-09-14 02:22:22 +10:00
7900d697f0 Fix T46089: Text from Effect Strip is invisible in VSE Preview.
Deviding two ints together never yields a float... Also, logic of various proxies size corrections was quite broken.
Now we should always get the same (relative) size of text whatever proxy setting/render scale is chosen.
2015-09-13 14:51:50 +02:00
8324750899 Bskin: Add cyclic mesh support. Use RNG random generator instread rand. Some optimizations 2015-09-13 17:13:24 +07:00
0e8a3f8439 Revert "C:/Program Files (x86)/Git/*"
This reverts commit 2e5b5cc5f2.
2015-09-13 17:09:58 +07:00
2e5b5cc5f2 C:/Program Files (x86)/Git/* 2015-09-13 17:06:06 +07:00
c486ae82a5 Revert "Add cyclic mesh support. Use RNG random generator instead of rand. Disable subdivision level. Some optimizations"
This reverts commit 67c4ffcbef.
2015-09-13 16:54:36 +07:00
67c4ffcbef Add cyclic mesh support. Use RNG random generator instead of rand. Disable subdivision level. Some optimizations 2015-09-13 15:08:14 +07:00
0cb67c60fa Reduce MIN_VALENCE to 6 2015-09-13 15:00:01 +07:00
45a875fec4 Fix T46091: Video Sequencer rewrite *.png to _.png
Own mistake when adding filename safety check...
2015-09-13 08:20:48 +02:00
c56deb132e Cleanup: Quiet some picky warning from Coverity. 2015-09-12 16:46:27 +02:00
26041f9357 File Bookmarks: use volume label on Windows, and set name of recent entries
from system/user bookmarks' name if possible.

Volume label on Windows was request from T46083, makes Blender more in line
with 'common' filebrowsing on this OS.

And now, we automatically set name of recent entries from the bookmarks, if path
can be found there, more consistent too from user PoV.
2015-09-11 22:33:13 +02:00
a79c519e5d Fix T45755: Bad NLA text alignment 2015-09-11 23:32:15 +10:00
6212eb2845 Fix T45579: Custom Hotkeys Dissapear.
Due to how we find kmi to remove and kmi to add when patching final keymap with user defines,
we could actually end up with same kmi for both, see comments in code for details.

Note that it may be a good idea to make user-defined customizations specific to a given base keymap,
instead of applying them blindly?
2015-09-11 15:01:37 +02:00
21826af5f7 Fix T45165, OSX quicktime fails with diacriticals in filename.
Since Blender internal strings are UTF8, changed the initialization
of the string to use initWithUTF8String from default encoding.
Fix worked on OSX 10.5.5.
2015-09-11 07:32:05 -04:00
bb20c96da5 Fix memory leaks in collada import 2015-09-11 19:12:54 +10:00
42825dc1fc Fix T46074: Collada crashes importing animation
double-frees and freeing memory already inserted into Blender.
2015-09-11 18:46:08 +10:00
2f1e51a1f3 Fix T46058: Modifiers on curve shows different results on OpenGL and cycles render
Not really ideal fix, but should make Cycles behave same as BI. For some details
please refer to inline comment.
2015-09-11 12:02:17 +05:00
5a284e1b62 Merge branch 'master' into mod-bskin 2015-09-11 15:58:32 +10:00
9355446716 Fix T46070: Content of folders with a .blend extension aren't listed until filtering is disabled.
Own stupid mistake somewhere during filebrowser revamp...
2015-09-10 22:09:42 +02:00
d1dcf91955 UI: increase threshold for color-band select
Was quite small, especially with hi-dpi displays.
Increase to 50 since theres no benefit to not select when clicking.
2015-09-11 05:57:55 +10:00
0d568e4186 Fix T46048: Custom properties UI redraw issue
Adding/removing custom properties didn't refresh elsewhere in the UI.
2015-09-11 04:29:31 +10:00
54daeb185f PyAPI: add an update method for properties
This is called when modifying an RNA property,
however it can be useful to be able to make a properties
update callback run without having to change it.
2015-09-11 04:29:31 +10:00
477e81128d Show correct syntax for id-properties 2015-09-11 04:29:31 +10:00
Julian Eisel
d234bf21b9 Correction to last commit
Did a fullscreen check in a function that should only be called in fullscreen mode. Not a big deal, but bad API practice.
2015-09-10 20:23:17 +02:00
Julian Eisel
487705d60a Fix T46069: Crash when saving a render with non-fullscreen file editor
IMAGE_OT_save_as assumes that active area is an Image Editor and the logic that should return to image editor after saving didn't run after fullscreen was manually exited.
2015-09-10 19:54:20 +02:00
37f4660637 Fix T44344: paint bleed fails in perspective view 2015-09-11 02:33:51 +10:00
84c44e026e Fix leak in ContextGLX 2015-09-11 01:48:31 +10:00
1d1b8bb196 Fix T46067: ShrinkWrap + Threaded depsgraph crash
Note that allocating DM arrays from an editmesh is currently not threadsafe,
however even if were resolved, its more efficient to avoid having to do it in the first place.
2015-09-10 18:33:24 +10:00
ac0e511619 Fix T46064: Sequencer view-selected does nothing 2015-09-10 15:31:37 +10:00
3225261f13 Fix incorrect textbox use w/ scaled fonts 2015-09-10 14:13:14 +10:00
e4baa9fb86 Fix broken logic in new FileBrowser caching of entries.
We were still using main borwser's FileDirEntryArr to own memory of entries currently in cache.

That was OK for common caching operation, but if was not released when clearing cache!
Nothing dramatic, since that was cleared too, but less often, so e.g. by changing sorting
options you could pile up more and more no-more-used entries there...

Anyway, there is no reason to do that, much more sound and clean to keep everything
cache-related in dedicated FileDirEntryCache struct.

This means main borwser's FileDirEntryArr is now always expected to not store any actual entry!

Note: this can probably be cleaned up a bit more, but would wait after 2.76 for this!
2015-09-09 21:36:10 +02:00
02b9921b75 bgl: fix implicit overflow 2015-09-10 03:59:18 +10:00
d4ca74c227 bgl: disable some defines not found in mesa 7 2015-09-10 03:54:40 +10:00
a9b0390bff Fix T45880: Texture Paint mask random angle fails
Random mask failed when the paint brush didn't have random angle enabled too.
2015-09-10 03:34:57 +10:00
4e759d6735 Fixes T46060 Regenerated the full list of constants we should expose 2015-09-09 18:35:05 +02:00
a2a0e7aed9 Add button for H.264 lossless output 2015-09-10 01:06:24 +10:00
8ff0d35744 Fix crash viewing passes w/ scopes
Scopes assumed all passes were RGBA, but some passes have 1-3 channels.
2015-09-10 00:41:10 +10:00
Dalai Felinto
5317dc716e Fix T45839 : Regression - Multi-layer image issues when using non-standard names
This was introduced in the fix for T44336 .
The code is now what it should have been in the first place at the time
of multiview commit.

ImageUser->passtype is being removed in favour of bringing
ImageUser->pass back.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D1504
2015-09-09 19:42:35 +05:00
c028b5980b Fix (unreported) crash with undo/outliner and drivers.
To reproduce the crash:
* Add some shapekeys to default cube.
* Add at least on driver (can be default empty one) to a shapekey value.
* **Make this driver visible in Outliner**.
* Delete all shapekeys.
* Undo.
* Crash.

Root of the issue is outliner reading code in `blo_lib_link_screen_restore()`,
which would try to `restore_pointer_by_name()` for all `TreeStoreElement->id` pointers.
Thing is, those id pointers are not always IDs, they can be animdata, sequence, RNA struct/property...

That's really not so great design, but also has reasons like size of the struct, we have to live with it.

So now:
* TreeStoreElement->type defines are braught back into DNA.
* There we also define a `TSE_IS_REAL_ID` macro to check whether a given TreeStoreElement actually stores an ID pointer or not.
* And in Outliner read code we only try to retore pointers by name for actual ID ones, and set the others to default NULL value.

Also, added clear comment to TSE types that do not store a real ID pointer!
2015-09-09 16:36:23 +02:00
12e4103bdd Cycles: Attempt to fix 32bit CUDA kernels 2015-09-09 18:23:49 +05:00
0899f47d78 Formatting fix.
Reviewed by: Severin
2015-09-09 14:39:21 +02:00
a9b9478247 Fix: VSE text strip size was wrong when preview render size != 100%
Reviewed by: sergei
2015-09-09 14:36:12 +02:00
145617c5eb OpenSubdiv: More graceful handling of shader compile/linking errors 2015-09-09 17:27:08 +05:00
4f29613894 Buildbot: Test enable CUDA binaries for Win32
Linux 32bit seems to work fine now, let's see if Win32 also works.
2015-09-09 16:38:44 +05:00
42e15b9dd3 Fix T46051: Loading certain Jpeg causes system alert sound (Win32)
The issue was caused by RedCode library printing binary string to the terminal.
2015-09-09 16:18:37 +05:00
9307f08986 Fix (unreported) Outliner letting you edit path of indirect linked lib shown at 'first level'.
From Gooseberry team request indirect libs were also added at root of 'BlendFile' Outliner view,
but that allowed edition of their path, which is useless...
2015-09-09 12:26:58 +02:00
6ddf77f1c0 Fix crash in preview render w/ too small border 2015-09-09 19:43:39 +10:00
1a04179802 Cycles: Cleanup, typo
Spotted by Campbell, thanks!
2015-09-09 14:25:43 +05:00
ad86d6ebdc Fix T46056: User Preferences-> install from File freezes Blender.
Own stupid error in recent fix for buffer overflow in `BLI_testextensie_glob()`...
Also found & fixed another potential buffer overflow in this func.
2015-09-09 11:02:32 +02:00
c87ee8da2c Fix T46055: Volume doesn't render when PANORAMIC Camera is inside volume mesh 2015-09-09 13:57:54 +05:00
d13a0e8f4a Cycles: Limit triangle magnitude check for only GPU
Found a way to make AVX2 CPUs happy by reshuffling instructions a bit,
so now there's no weird precision errors happening in there.

This solves some render speed regressions on CPU, but unfortunately
this doesn't help for GPU rendering.
2015-09-09 13:39:36 +05:00
46d2abf78f Cycles: Only use ascii in comments 2015-09-09 13:39:36 +05:00
7fab7b63f9 Assert CustomData_from_bmeshpoly is used correctly
Follow up to last commit, since bugs here aren't so obvious.
2015-09-09 16:48:56 +10:00
1e7a8ab5e8 Fix T45733: Crash w/ VColor + BlenderInternal
Tessface CustomData layers were added multiple times when tangents were used.
This made BI crash accessing layers missing elsewhere.
2015-09-09 16:48:21 +10:00
1b98ece49d Buildbot: Enable 32bit kernels for linux builders
This is more an experiment, not guaranteed to work but at the same time
building of kernels seems to work manually in the same chroot. Perhaps
latest changes helped compiler to optimize registers usage.
2015-09-09 11:05:17 +05:00
3b10f500c2 Cleanup: warnings 2015-09-09 04:54:02 +10:00
c26a9eed92 Error in last commit
Had warnings disabled.
2015-09-09 02:39:40 +10:00
a2b80d4c48 Fix T46003: Scale w/ script ignores axis-align 2015-09-09 02:05:10 +10:00
91264cfdd0 Revert "Fix T45191 Speed strip behaviour not easy to predict."
This reverts commit 0e83b0854f.

Fixes T46038
2015-09-09 00:36:15 +10:00
d5f1f66f06 typo in last commit 2015-09-08 23:46:56 +10:00
a93e15aee3 Fix T45771: Walk mode fails on OSX 2015-09-08 23:39:37 +10:00
9d8aaf77ac Fix T45981: BGE, 2D filters leak memory 2015-09-08 19:42:59 +10:00
d1d0f8eb1a Cleanup: quiet warnings 2015-09-08 19:42:58 +10:00
abb63be099 Use C++ guarded alloc for FilterBase 2015-09-08 19:42:58 +10:00
5f120f7723 Fix for building with C++ guarded alloc
KX_WorldInfo is already inherits the overrides
2015-09-08 19:42:58 +10:00
f184202a9a Cleanup: API docs 2015-09-08 19:42:58 +10:00
2cdfa3ea5b Cycles: Support building with latest upstream OSL
Only affects standalone part.
2015-09-08 13:10:00 +05:00
cb7c61ad54 Fix T46006: Issue with Equirectangular image rendering in Standalone Cycles
Issue was caused by wrong viewplane used for standalone camera.
2015-09-08 13:07:08 +05:00
310764603a Cycles: Add missing initialization of fov for prev/next frames 2015-09-08 13:06:17 +05:00
92d12ab38b Cycles: Correction to integrator's transparent shadows
It was possible that deleting transparent BSDF from shader wouldn't
disable transparent shadows in integrator when doing viewport render.
2015-09-08 11:47:39 +05:00
6b0544eaaf Cycles: Update TODO, camera in volume is supported already 2015-09-08 11:29:14 +05:00
0e12228bd9 Fix T46045: Missing viewport update when adding transparent shader to material 2015-09-08 11:28:02 +05:00
946b850b3e Fix T46040: Bake action cleans existing keyframes 2015-09-08 04:01:03 +10:00
9de20963cd Fix beautiful textbook case of string overflow in BLI_testextensie_glob... 2015-09-07 19:23:11 +02:00
0c275ea18a Fix large branch node assert. Clone amarture create, mark root, equalize radius from the old modifier 2015-09-07 21:50:49 +07:00
04e12c617d Fix T46029. Center ngon in bevel got no attributes or interpolation data. 2015-09-07 09:33:42 -03:00
1a7eca3c54 Fix T46034: OpenCL kernel compilation error in latest buildbot
Simply expanded expression, so no float4->float3 conversion happens.
2015-09-07 15:02:44 +05:00
77b0b661dd Doc: PyAPI docs, quiet warnings, fix URL's 2015-09-07 18:23:16 +10:00
e106a212e8 Fix T46032: Crash w/ file-browser preview 2015-09-07 17:20:09 +10:00
1c5b15eab3 Doc: update Python 'gpu' module reference
- add missing uniforms.
- add uniform types.
- link to RNA equivalent.
- remove 'value' from uniforms (they were wrong, better use module members anyway).
- various corrections & edits.

Fixes T45505
2015-09-07 16:11:05 +10:00
7038c2c489 Cleanup: gpu constants weren't so clearly arranged
Also reminder to update docs w/ the API.
2015-09-07 16:11:05 +10:00
4ae181543f Fix viewport camera dof object distance
Also use simpler method to calculate the depth.
2015-09-07 02:32:34 +10:00
e54fb3f78f Build with GCC strict warnings 2015-09-07 02:27:26 +10:00
Julian Eisel
14dd88e817 Add icon for incremental grid snapping
As decided in D910, we use a new icon for incremental grid snapping and use its old one for absolute grid snapping.

This also touches the library_data_broken icon .dat files, seems some changes on its .svg entry landed in upstream without updating the other icon files (already noticed this when committing icon for auto-offset, but removed it from commit - leaving it in now to avoid further confusion)

Icon by @plyczkowski (made a tiny edit as it looked a bit blurry in 16x16). Thx!
2015-09-05 23:36:52 +02:00
Julian Eisel
b529b82830 Fix T45944: Ctrl+Wheel to cycle values failes in toolshelf
Now, ctrl+wheel for cycling tabs is passed to hovered button if it supports cycling values (RNA menus, color/row/number/slider buttons, list boxes)

This might feel a bit glitchy if ctrl+wheel is used to cycle tabs and in newly opened tab, a button with cycling support is under the mouse, which will get mouse input from this point on instead of region. Think this is still better than old behavior.
2015-09-05 19:42:05 +02:00
1478ac35c7 Depsgraph: Don't use legacy function when building without legacy depsgraph 2015-09-05 17:52:29 +05:00
9683807459 Fix T45938: Ocean modifier animation not working with NLA action-strip (old depsgraph only)
When a modifier was animated by a NLA strip, this animation was not working when using
the old depsgraph. This was because the code which checks if a NLA strip affects any
modifiers was missing - specifically, it was originally left out as it was thought
that it was unlikely that many users would need this, but adding in those checks
would have a (slight) negative effect files where there are heaps of NLA strips
but modifiers animated this way were absent.

The new depsgraph however doesn't suffer from this problem, as these sorts of checks
need ot be built into the graph-building stage for everything to work, so these links
had already been added.
2015-09-06 00:07:06 +12:00
b8e0b2db56 Math Lib: isect_plane_*_v3 avoid negation
Unmeasurable speedup for plane intersection.
2015-09-05 17:44:02 +10:00
ba188cf98d Math Lib: simplify isect_plane_plane_v3
Unlike the 3 plane method, the 2 planes squared cross-product _is_ the determinant.
2015-09-05 17:10:07 +10:00
ac51e2f326 Fix T46015: normals_split_custom_set_from_vertices doesn't work with zero vectors
This was simply broken for vertex case (indexing loop normals with vert indices...).

Turns out to be rather verbose to replace on-the-fly zero normals by default ones correctly,
and do not want to make a full copy of the given custom normals array, so now this one is
editied in place (replacing zero vectors by correct default normals). Don't think this
could be a serious issue anyway.
2015-09-04 22:41:10 +02:00
83a36b2829 Cycles: Fix for wrong optimization of bump node
It can't be simply removed in cases when it's connected to input which is
different from Normal. This is because the input wouldn't be connected to
default Normal geometry input, possibly breaking shading setup.

The fix is not really ideal, but should work at least.

This fixes skin having too much glossy reflection in the file from T46013.
2015-09-04 20:06:31 +05:00
713ce037ab Cycles: Fix wrong check for zero-sized triangles
Initial idea was to optimize calculation a bit by skipping calculation of actual
triangle edges and use vector from ray origin to triangles. In practice this
optimization didn't quite work in cases when origin point is too close to the
triangle.

Let's do 2.76 with a bit more complicated calculation, still looking into exact
reasons why watertight intersections fails in certain cases, but actual fix might
bit be ready so soon.

This fixes wrong eyes on the lady from T46013.
2015-09-04 20:06:31 +05:00
65a80708d4 Fix T46010: Bone offset between Rest Pose and Edit mode.
That one was hairy... To summarize:
* We were setting Bone.head/tail (aka **local** rest location of bone) from EditBone data, using **EditBone's parent computed armature space**.
* We use those local head/tail to define Bone's restpose (in `BKE_armature_where_is_bone()`), using **Bone's parent armature space** (aka parent's arm_mat).
* Because of bone's roll nightmare, the two above parent's matrices will often not be the same.
  In an ideal world, this should not affect locations (head/tail), but in real world of float it does - noticeably, in some extreme cases.

So! This commit cleans up things a bit (`fix_bonelist_roll()` was already doing much more than just fixing roll mess, has been renamed
to `armature_finalize_restpose()`), and ensures we do use (final!) parent's arm_mat local space to compute children's local head/tail as well.
This allows us to avoid too much imprecision here.

Checked the patch also with a complete Victor's rig from Gooseberry, seems to have no nasty side effects - fingers crossed!
2015-09-04 16:50:29 +02:00
c882cbd37c Cleanup: Better to assert over bad condition (which shall never happen anyway), than just return with un-initialized mat... 2015-09-04 16:50:29 +02:00
c73a009bfc Cleanup & build with gcc 2015-09-05 00:40:43 +10:00
38ed9107cd Merge branch 'master' into mod-bskin 2015-09-05 00:26:29 +10:00
e132af62e1 Fix incorrect convex hull building in case of plannar vertex set. Add some check 2015-09-04 20:56:59 +07:00
39752eb912 Fix for isect_tri_tri_epsilon_v3 w/ small faces
tris with ~1e-05 edge lengths would fail
2015-09-04 22:29:12 +10:00
1d71ad2eaa Math Lib: Use plane intersect from graphics-gems 2015-09-04 22:13:20 +10:00
d0e7ba3fd1 Math Lib: avoid sqrt w/ triangle intersection 2015-09-04 22:06:36 +10:00
2ea96df159 Correct own error in line_point_factor
Passing zero epsilon allowed divide by zero.
2015-09-04 22:06:36 +10:00
f79c748246 Armature: Cheap edit-to-object mode speedup.
`fix_bonelist_roll()` is already recursive, and was calling recursive `BKE_armature_where_is_bone()` twice!

Changed `BKE_armature_where_is_bone()` to controll whether we recurse over children or not.

With full Victor's rig, we gain 16% in `ED_armature_from_edit()` (from 31ms to 26ms).
With a dummy test-case 100 bones chain, we gain 80% in `ED_armature_from_edit()` (from 1.25ms to 0.25ms).

Not crucial, but still worth it. ;)
2015-09-04 12:26:52 +02:00
52fda9b0db Fix T45019: Cycles wrong render of motion blur mesh
The issue was caused by wrong detection whether number of verticies
changed or not. Basically, it wasn't working correct in cases when
number of verticies is increasing compared to the current frame.
2015-09-04 15:19:22 +05:00
3e63c604e3 Partial revert of warning cleanup
These warnings are false-positives
2015-09-04 14:40:03 +10:00
Julian Eisel
ef629e0d50 Quiet warnings
We had too many warnings lately... was awaiting that someone would kill them - didn't happen -> goes to my commit ratio! :P
2015-09-04 01:04:37 +02:00
c3fef001ee View-Selected: use custom bones boundbox
Support using custom pose-bone transform and object when calculating view bounds.
2015-09-04 04:23:18 +10:00
54ad576666 Small tri intersect fails when not normalized
Logic was ok, but would run into precision issues.
2015-09-04 01:59:44 +10:00
e709da3def Cleanup: minor RST edits 2015-09-04 01:11:26 +10:00
727b88fa67 Use priority queue for better triangle merging at branch nodes 2015-09-03 21:42:18 +07:00
10c93a582b Check for no-op edge separates to quiet asserts when inset individual.
This causes no change in behavior, since code was alreadying doing
a no-op in bmesh_edge_separate if the edge is a boundary.
But it tripped an assert, annoying in debug builds.
We want to leave assert in bmesh_edge_separate in case callers
expect there to be separate loops after this always.
So putting test in caller.
(Same worry about bmesh_urmv_loop? I checked callers and they
appear OK to me - they deal with the no-op return.)
2015-09-03 10:42:16 -04:00
8cd121ecaa Reduce quad resolution at skeleton limbs 2015-09-03 20:57:55 +07:00
b899114a7e Fix T45937: Cycles hair not rendered if children count set to zero 2015-09-03 18:54:50 +05:00
129e0b8ab5 Reduce mesh resolution in the middle region of skeleton limbs 2015-09-03 20:54:15 +07:00
a4bcd9bc96 Cycles: Fix missing packed images with newer versions of OSL
This isn't really complete fix, complete fix would require calculating
derivatives via OIIO API, but supporting this will either end up with
some code duplication or will require some non really safe changes at
this release cycle.
2015-09-03 18:16:30 +05:00
0bc4bc2e61 Fix T45946: Cycles texture interpolation bug
Coordinate clamping was done in the wrong order.
2015-09-03 18:16:30 +05:00
2c2f075929 BGE docs: resolution & fullscreen changes don't work in the embedded player
The documentation for bge.render.{setWindowSize,setFullScreen,getFullScreen}
did not mention that those functions are no-ops when using the Blender-
embedded player.
2015-09-03 15:05:36 +02:00
73b34ad06b PyAPI: tweak to ensure_ext don't lower entire path 2015-09-03 21:58:11 +10:00
8383a2d4cc Fix: Made bpy.path.ensure_ext compatible with compound extensions.
Extensions such as ".tar.gz" are now also supported. Before this patch,
ensure_ext('demo.tar.gz', '.tar.gz') would return 'demo.tar.tar.gz'.

This results in issues with the `ExportHelper` mix-in class; clicking
an existing file in the file dialogue warns about overwriting it
(highlighting the input box in red), but then saves to a different
file.

Also added a unit test for the new behaviour.

Reviewers: mont29, campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D1498
2015-09-03 13:09:16 +02:00
e5e65b1099 Fix T45984: Setting custom normals properly requires multiple calls to normals_split_custom_set()
The detection of needed sharp edges (based on given loop normals) would not fully work
on first run in case we started with a complete smooth cyclic loop fan (edge between
first and last loop of the fan would not get checked).
2015-09-03 12:20:50 +02:00
8e8aed9efa Cleanup: now warning free w/ GCC 2015-09-03 19:52:35 +10:00
d1640d5fab Quiet compiler warnings 2015-09-03 19:45:16 +10:00
913cfc4d1a Cleanup: style 2015-09-03 19:27:55 +10:00
357e749957 Cycles: Fix nondeterministic pass ordering when using baker 2015-09-03 13:52:56 +05:00
f387fe2b65 Cycles: Fix for uninitialized closure data
This might confuse closure merger.

Spotted by Campbell Barton, thanks!
2015-09-03 13:48:43 +05:00
8e75abd29a ImBuf: Fix crash generating preview for really huge image
In fact, any user of IMB_scalefastImBuf() is now robust against working
with really hires images.
2015-09-03 12:49:04 +05:00
2ed4f98548 Compositor: Support changing distortion models in movie distortion node
Previously only polynomial model worked correct. now changing it to divisions
will work nicely as well.
2015-09-03 12:19:47 +05:00
6789d02112 Fix T45959: DistanceKey preview used wrong colors
Same issue as recent fix in ChannelMatte
2015-09-03 12:28:27 +10:00
46d731612d Animplayer passed -a, then warned its unknown
Also modify a copy of argv
2015-09-03 04:27:44 +10:00
1f16b3280f Fix T45979: animplayer crashes w/ DND and audio
Issues re-initializing audaspace
2015-09-03 04:15:08 +10:00
390bc05b32 Fix second part of T45987: Node preview was still using wrong color space 2015-09-02 22:46:06 +05:00
39a437181c Quiet -Wdeclaration-after-statement warnings 2015-09-03 03:07:48 +10:00
06e61746f2 Merge branch 'master' into mod-bskin 2015-09-03 01:59:09 +10:00
c8cc664ce3 Fix T45995: Auto-set preview range sets superfluous end key.
get_keyframe_extents() would add an extra frame in case of mono-key fcurves in selected set...

Now do the 'not same start/end frames' check later, and also use floor/ceil instead of round
(we want to start at frame 3 if first key is at frame 3.8, reversed-same goes for end frame).
2015-09-02 17:50:55 +02:00
5671611c40 CMake: use generator expressions 2015-09-03 01:26:28 +10:00
c8ebc8736e CMake: Fix building w/o FindGit 2015-09-03 01:24:25 +10:00
0ddc05a07e Fix sphere projection while splitting polyhedra 2015-09-02 22:17:39 +07:00
6f5d1e257e Add missing spin-lock to IMB_makeSingleUser 2015-09-02 23:23:44 +10:00
525d7e02d4 Fix T45991: Transfer Weight tool UI is inconsistent and crashes blender.
Since data transfer when called from this tool has reversed behavior (it transfers **towards**
active object, as previous tool), we have to also reverse source/destination layers selection options.

Also fix 'reverse' option being saved, otherwise calling regular operator after 'transfer weights'
would stay in reverse mode, ugly!
2015-09-02 13:10:29 +02:00
2387e1629a fix flickering problem 2015-09-02 16:54:14 +07:00
5fe9b36aa6 Cleanup: style 2015-09-02 18:39:19 +10:00
41b99e40c0 b5287b1 removed important CCG_key_top_level call
Caused subsurf to crash w/o OSD
2015-09-02 15:39:17 +10:00
f6e0262a83 Enable guarded-alloc when --debug-all is passed 2015-09-02 13:41:12 +10:00
b3e1edf7f8 Correct help message for debug options 2015-09-02 13:38:55 +10:00
881047de88 Fix snapping edit-gpencil to edit-mesh
Reported in T45978

Was checking mesh selection state.
2015-09-02 11:29:04 +10:00
4b1f3a7819 Fix T45931: Blender Fails to generate previews.
Root of the issue was, preview generator was filling ID preview with unsigned int,
when RNA only knows of signed integers (and thus generates a python exception
when converting uint outside of int range)...

Using the brand new and much simple float pixels accessor to PreviewImage now.

Why this was working perfectly OK (it seems...) under Linux, and why error (py exception)
was so badly and misleadingly reported on Windows, remains pitch black mystery to me.
2015-09-01 19:15:06 +02:00
a2714c9e4f RNA PreviewImage: add float pixels accessors.
Raw int pixels can be nice in some cases (much less memory used), but converting to/from float values
(as e.g. expected by/from Image) is not simple in py, error prone and rather slow.
2015-09-01 19:15:06 +02:00
b5287b1b81 Avoid reupdating pbvh data in upload functions, these should have been
taken care of in draw functions.

Those iterate the whole PBVH tree so better avoid doing them, twice or
thrice.
2015-09-01 19:56:32 +03:00
45eb406748 Fix T45978: Ruler ignores new edit-mesh data 2015-09-02 02:28:16 +10:00
312cb0a957 Fix T45974: Bones fail to snap to verts
Was an issue with individual-origins + snap
2015-09-02 01:34:03 +10:00
ef931fecc3 Fix uninitialized normal var w/ objects snapping 2015-09-02 01:25:13 +10:00
2fcc38ad54 Assert vec_roll_to_mat3_normalized's gets a normalized vector 2015-09-02 00:43:53 +10:00
282811f8b8 Fix projection painting normal culling operating on individual
triangles.

This made the normal-related artifacts of projection painting much more
apparent. Now we do culling based on
whole polygons. Pure backface culling still uses individual
triangles.
2015-09-01 16:00:07 +03:00
a660f27527 Don't use GCC-only pragma for all compilers 2015-09-01 17:40:10 +05:00
5b02f8006a Add Python UI 2015-09-01 21:44:33 +10:00
a6409f3cb4 Minor changes needed for building on linux 2015-09-01 21:37:18 +10:00
36a9ae9c11 new skin modifier implementation, diff D1465 by @(khanh_ha 2015-09-01 21:24:35 +10:00
1140238acf Fix T45976: Crash accessing BMesh customdata
Layers returned from items() and values() could have an invalid index.
2015-09-01 19:59:26 +10:00
55f87590f0 Depsgraph: Fix compilation error with legacy depsgraph disabled
Reported by Campbell on IRC, partial patch by him as well.
2015-09-01 14:48:08 +05:00
74fae33ee5 Fix T45825: Macro redo disable options incorrectly
A non repeatable operator would disable editing options for all operators after it.
2015-09-01 18:43:29 +10:00
9304df5182 Fix T45939: Crash w/ BMesh.*.sort() 2015-09-01 16:07:34 +10:00
6db978f6d1 BMesh: add asserts for BMesh sort ghash lookups 2015-09-01 15:43:49 +10:00
a7b349d03c Cleanup: redundant cast 2015-09-01 15:01:13 +10:00
c86a519898 Use qsort_r for BMesh Py API 2015-09-01 13:56:08 +10:00
922d72355d Cleanup: pep8 2015-09-01 13:03:38 +10:00
b3f4bf87b4 Trade-marked BPlayer Fix (c) 2015-08-31 22:03:51 +02:00
333feea6e9 Fix T45258, impossible to select brush when removing it from 2d
painting.

Also system added a brush every time it found no paint brush in the
system which is not what we would want.

Solution:
* Brush panel stays visible always, regardless of whether there is a
brush or not.
* We search for first available brush when we find no brush in paint
struct instead of always generating a new one.
* Generating and searching for a brush take a mode argument now. Needed
some refactoring to users of BKE_paint_init as well.
* Did some style cleanups for paint mode enums.

Patch is big but it's mostly argument refactoring.
2015-08-31 22:00:30 +03:00
0018483dfa error in last commit 2015-09-01 03:02:14 +10:00
705776db1f Fix T45954: Inset w/ interpolated vertex color
Accumulating ubyte color was overflowing.

Thanks to @mont29 for suggested fix.
2015-09-01 02:51:30 +10:00
879c5d4568 Cycles: Make the max value for World MIS Map Resolution a power of two.
Old value likely was a copy / paste error.
2015-08-31 18:17:16 +02:00
26bad9e8f0 Cleanup: Fix some typos in volume code comments. 2015-08-31 18:14:51 +02:00
929db33828 Write thumbnail directly
BlendThumbnail matches the on-disk format, so just write directly.
2015-09-01 01:52:27 +10:00
5f64b77ca5 Fix T45955: Python's pdb can't show script source 2015-08-31 23:41:13 +10:00
a603a3470c Revert fix for T45849 (part 2, tsk!) 2015-08-31 22:47:14 +10:00
06b14aa5f9 error in comments 2015-08-31 22:26:05 +10:00
6a53e658d3 Alternate fix for T45849: tri-tri intersect error
Project both triangles onto the same plane to simplify calculations.
2015-08-31 22:15:27 +10:00
e503e37333 Revert fix for T45849, alternate fix coming up
epsilon check here didn't account for scale, causing T45919
2015-08-31 22:12:19 +10:00
96fa58e22c Math Lib: Add closest_to_plane helper functions
- closest_to_plane3 (for float3 planes)
- closest_to_plane*_normalized_v3 (for unit length planes)

Use when the plane is known to be unit length
2015-08-31 20:10:36 +10:00
489a5d34b7 Fix T45959: DistanceKey output incorrect 2015-08-31 16:22:16 +10:00
d9e71d5e16 Fix uninitialized vars in DistanceKey node 2015-08-31 16:22:06 +10:00
d267739be7 Fix incorrect cast 2015-08-31 13:47:32 +10:00
4ac5859f05 Cycles: Avoid copying objects in some places of BVH build
Gives barely measurable speedup of Spatial Split BVH build.
2015-08-30 16:48:16 +02:00
00d12ec04f Preview generation module: explicitly exclude any lib item.
Thanks to campbell for raising that point!
2015-08-30 15:49:26 +02:00
d8291ed88a missing NULL pointer check 2015-08-30 20:20:26 +10:00
6a80c2c48b Audaspace: fix for building with scons.
Removed duplicated code.
CMake so far built only the now removed version and scons tried to build both.
2015-08-29 22:42:20 +02:00
0952a8e44a Cleanup: set fd->mainlist to NULL at the end of blo_read_file_internal().
This is a local var, do not try to use it later!
2015-08-29 16:47:32 +02:00
95ed5d4437 Add some more missing ID types to TREESTORE_ID_TYPE... 2015-08-29 15:51:11 +02:00
db25b33973 Fix missing 'case idx' line in (debug-only & disabled) valgrind-friendly BKE_main_free() code. 2015-08-29 15:07:09 +02:00
c749fe4031 Fix T45736: Channel key error: color spaces modes
Was missing conversion back to RGB space.
2015-08-28 18:44:27 +02:00
36c408d861 Fix remaining parts of T44881, missing update on loading file 2015-08-28 18:29:27 +02:00
a068629abe Fix UI font drawing getting width w/o kerning 2015-08-29 02:10:11 +10:00
a0a7d92cc4 Partial fix of T44881: Fix for missing particles update when changing seed
Was only visible with new dependency graph.

Changing emit_from still doesn't behave fully reliably tho, that needs some
closer investigation.
2015-08-28 17:35:51 +02:00
a08d039e59 Fix assigning flag to bool 2015-08-29 01:05:43 +10:00
982533eb39 Revert "Blind attempt to fix T45931: Blender Fails to generate previews."
This reverts commit c4ab521e26, since it does not actually fix the issue...
2015-08-28 17:01:37 +02:00
b024ccd619 Fix T45929: OpenSubdiv was doing extra object recalc tags 2015-08-28 14:55:21 +02:00
c53b1e2a93 Readfile: Minor optimization in undo/redo case: do not call do_versions_userdef either. 2015-08-28 14:06:01 +02:00
c4ab521e26 Blind attempt to fix T45931: Blender Fails to generate previews.
Cannot reproduce the issue here on linux, but have the feeling windows builds are much
more easily broken with referencing bad data from bpy. So here guessing direct loop
over bpy.data.xxx when you do add and remove stuff from said xxx inside the loop
is not a good idea - which seems logical in the end. :P
2015-08-28 13:24:30 +02:00
a560122c4b OpenSubdiv: Remove some dead code 2015-08-28 12:46:52 +02:00
bf88428b7e Fix T45930 weights not appearing in editmode when show weights option
was enabled.

Caused by an -unneeded now- fix for opensubdiv. Code caused the vertex
colors to be uninitialized. Thanks to Sergey for confirming that initial
issue is no longer a problem.
2015-08-28 13:40:52 +03:00
e515d64c3e UI: Panels shared same class-name 2015-08-28 15:33:01 +10:00
85edd8fc82 Fix T45933: Can't select scaled camera in camera view 2015-08-28 12:10:21 +10:00
6bdf1d6dde Sequence/Scene render fixes
- wasn't checking subframe to see if the scene needed to be re-evaluated.
- unneeded int/float conversion storing original frame.
- moved cleanup block into one place to avoid confusion.
2015-08-28 11:28:01 +10:00
43a4aaf8e6 Compositor: Reduce number of divisions in EWA filtering 2015-08-27 19:43:33 +02:00
3ec81b814c Fix T45617: Map UV node produces image artifacts
Basically filtering was happening twice, first time by applying weights of EWA
filter itself and then by applying subpixel offset while reading pixel values.
2015-08-27 18:50:40 +02:00
9b3fa880a5 Support subframe evaluation for scene strips
Useful when used with the speed effect.
2015-08-28 01:25:23 +10:00
8d1f9b9f51 Update of our *nix .desktop file.
Based on patch by Alex (AlexL) (T45927), thanks.
2015-08-27 16:31:13 +02:00
59b2acc71b Make .blend file thumbnail reading simpler and more coherent, read/store them when reading in background mode.
Primary goal of this commit is to fix an annoying issue - when processing and saving .blend
files in background mode you lose their thumbnails, since it can only be generated with
an OpenGL context.

Solution to that is to read .blend thumbnail while reading .blend file (only done in background
mode currently), and store it in Main struct.

Also, this lead to removing .blend file reading code from thumb_blend (no need to have doublons).
We now have a small interface in regular reading code area, which keeps it reasonbaly light
by only reading/parsing header info, and first few BHead blocks.

This makes code reading .blend thumbnail about 3 to 4 times slower than previous highly specialized
one in blend_thumb.c, but overall thumbnail generation of a big .blend files folder only grows
of about 1%, think we can bare with it.

Finally, since thumbnail is now optionally stored in Main struct, it makes it easy to allow user
to define their own custom one (instead of auto-generated one). RNA API for this was not added though,
accessing that kind of .blend meta-data has to be rethought a bit on a bigger level first.

Reviewers: sergey, campbellbarton

Subscribers: Severin, psy-fi

Differential Revision: https://developer.blender.org/D1469
2015-08-27 16:00:46 +02:00
987b3df9c0 Missed version update loading in background mode 2015-08-27 23:12:40 +10:00
2112bd892b Fix T45926: Drivers fail in background mode
Scene evaluation was done before text blocks were registered.
2015-08-27 23:12:40 +10:00
90f667576f Buildbot: Correction to previous commit
Previous commit didn't really disable cuda binaries for some reason.
2015-08-27 12:22:44 +02:00
067fe2719a Fix T45702: Editing smoke while viewport render and blender bug
Issue was caused by blender internal accessing data from DNA during rendering.

There's no simple solution to make stuff thread safe, so for now simply restart
rendering on frame update.
2015-08-27 12:10:01 +02:00
43dab7833a OpenSubdiv: Fix crash toggling edit mode with new depsgraph 2015-08-27 12:01:20 +02:00
efc6f9438f OpenSubdiv: Tweaks to detecting whether geometry data is needed on GPU with new DEG 2015-08-27 11:47:56 +02:00
8cd4966722 Buildbot: Disable CUDA binaries on win32
They started to give issues as well, need some dedicated time to look
into the issues.
2015-08-27 11:43:29 +02:00
c5f9255eed Fix T45921: Screw modifier flips vertex normals 2015-08-27 19:29:42 +10:00
5908340f79 OpenSubdiv: Attempt to solve crash on certain GPUs/drivers 2015-08-27 11:05:23 +02:00
74c3ebad12 Fix T45920: Loopcut w/ shrinkwrap crash 2015-08-27 17:45:56 +10:00
72aadc3597 Use correct size for BVH insertion 2015-08-27 17:45:56 +10:00
a8be746609 OpenSubdiv: Fix error found by PerfectionCat,
Use glew, not gl constants to detect presence of extensions.
glProgramParameterEXTi is part of GLEW_EXT_geometry_shader4
2015-08-27 10:05:58 +03:00
512f631af6 Fix T43826: Sculpt grab anchored fails
Regression caused by GSOC2013 merge f745564
2015-08-27 15:22:08 +10:00
e9a6effa95 DNA/IO: struct ghash lookup didn't set 'lastfind'
Internal inconsistency: lastfind was being checked
on every DNA_struct_find_nr call, but never set.

Gives minor speedup reading files.
2015-08-27 13:29:57 +10:00
a32a4059da Fix crash switching to rotate from edge-slide
Caused by own fix for T45458
2015-08-27 11:11:09 +10:00
2633928e1d Fix T45232: Cycles bake artifacts with transparent textures
The issue was caused by uninitialized ray used for composite and AO evaluation.

Can;t really think of "proper" ray configuration here, it's all a bit arbitrary
but think initializing the ray in a way so we look at the surface in a negative
normal direction is much better alternative to uninitialized ray.

Open for alternative suggestions tho.
2015-08-26 17:51:54 +02:00
f62748f10a Fix T45912: Opensubdiv meshes don't properly center when using <numpad .> 2015-08-26 17:12:08 +02:00
9cc75bc524 Fix T44945: Blender crashes when using multiple domains and multiple flow objects with subframes
This is more like a workaround to prevent obvious cases fail, but in theory
if some other area will start updating object for subframes blender will
crash again.

Perhaps proper way to solve this will be to copy objects for subframe updates.
2015-08-26 15:27:22 +02:00
3e4a7f4366 Fix T45275: F-Curve normalization might corrupt animation 2015-08-26 15:06:45 +02:00
76df0ec93a Fix T45631: Ambient update rendered bug
The issue was in fact caused by both preview and viewport renderers affecting
on the default material, conflicting with each other.

Preview render doesn't really need default material, so we can safely skip it's
initialization in the render pipeline for preview rendering.
2015-08-26 14:52:28 +02:00
d33557c52e Correct fix for T39161: Scaling & snap 2015-08-26 22:26:28 +10:00
2f766f8ad2 Fix T45709: Cached Hair system is not seen in 2.75
Don't force re-distribution of cached particle systems, this doesn't
cause actual evaluation of particles and there was a reason why particles
are baked actually..
2015-08-26 14:28:41 +02:00
3dd16946aa Fix T39161: Scaling fails w/ snap-to-point 2015-08-26 20:42:27 +10:00
fed0448f92 Fix for error in recent smooth-view commit
Was assuming there was a camera
2015-08-26 20:42:26 +10:00
6ca12d157f Fix T45909: Garbage output in Viewport with OpenSubdiv device set to GLSL Compute
This isn't a Blender issue and the same bug happens with official OpenSubdiv
examples. For until it's either worked around from OpenSubdiv side or fixed
in the driver we'll force disable GLSL Compute for AMD hardware.
2015-08-26 12:10:24 +02:00
bcc0d2fb1d OpenSubdiv: Fix/workaround bad shading on AMD devices
Uniform block data layout was different on CPU and GPU which caused wrong
data being used from shader.

In theory using layout(std140) is what we need to do, but for some reason
such layout specifier is being ignored. This is probably caused by the way
how we exploit extensions from older version of glsl.

For until we've upgraded our glsl pipeline used different approach which
is basically about removing unused fields form the struct manual in hope
that it'll keep memory layout consistent for both CPU and GPU.

This seems to work so far for both NVidia GTX580 and AMD FirePro W8000
here in the studio.
2015-08-26 12:07:38 +02:00
77ce7eb541 Revert "BGE: Fix T44557 GameLogic module memory leak."
This reverts commit cd24871706.
The commit re-introduced problems with starting the game engine
multiple times in the same run of Blender.
2015-08-26 11:13:50 +02:00
3699ab1843 Fix T45711: Color spill average algorithm broken
Thanks to @kevindietrich for finding the cause!
2015-08-26 18:38:55 +10:00
df9f4c2e4f OpenSubdiv: Add extra checks whether GPU compute available or not 2015-08-26 09:16:35 +02:00
207c360900 Fix T45793: ChromaMatte incorrect output
Port to new node system missed important step.
2015-08-26 16:49:34 +10:00
1d34f0feed Smooth-view: Ignored camera-viewpoint on exit to user-view 2015-08-26 15:13:19 +10:00
cc60f35a18 Delete could assign a temp screen 2015-08-26 14:14:50 +10:00
0b21657897 Fix T45369: Temp screen locks UI
It was possible to navigate into an unused temp screen
(using Ctrl+Arrow keys), but there was no way to navigate back out.

Now Ctrl+Arrows skips temp screens, and remove the ability to navigate away from a temp screen from RNA.
2015-08-26 14:04:03 +10:00
67970da107 Disallow navigating away from a full-temp screen 2015-08-26 13:51:41 +10:00
acb99cfd7b Return success when a screen was added/removed
Currently unused, but useful for screen-operators.
2015-08-26 13:49:58 +10:00
3ee74feb2b Fix for deleting screen w/ temp screens in list
If the next screen to use was temporary, deleting the screen would fail.
2015-08-26 12:41:23 +10:00
e066a33314 Fix crash setting the screen when one is maximized 2015-08-26 11:27:13 +10:00
2e6cbd9bda Fix T45901: Smooth-view w/ bg-image glitch
It was possible to rotate the view while the view was already moving
causing background images to show when they shouldn't.
2015-08-26 10:15:20 +10:00
2f0eb2bfc6 Revert "Increase Smooth_View limit to 10.000"
This reverts commit 1ed1f2f3ab.

Waiting 10 seconds to change view isn't practical.
Further it expose issues where users can attempt to activate tools during view motion,
Some work, others give issues, this just isn't going to be properly supported.

View animation features are fine, but this isn't the purpose of the smooth-view option.
2015-08-26 09:53:58 +10:00
c62ebefcfc Usual i18n messages fixes. Also had to update i18n scripts to new BLT module... 2015-08-25 21:12:36 +02:00
a879dd368c FileBrowser: Fix broken 'extend' behavior of walk select mode.
Glitch when I merged new walk code in asset-experiments most likely...
Thanks to Dalai (dfelinto) who notified that on IRC.
2015-08-25 19:36:51 +02:00
7dc75ea8f4 Fix T45904: Cycles bug after recent triangle intersect changes
Calculated cross product from wrong vectors by accident.
2015-08-25 18:32:11 +02:00
Dalai Felinto
9e188fdd53 Fix walk navigation: scene unit used even when unit not set 2015-08-25 13:31:04 -03:00
ad0c2d6cbb Fix T45789: Materials with transparency not properly rendered in viewport in Material Render mode
This is a bit tricky one -- ideally viewport should detect whether alpha is used
in the shader tree and if so do separate viewport pass for that objects. But in
practice it's really tricky to detect whether alpha is affected by shader or not
without evaluating the tree for all possible input values. We also can't assume
that alpha might always be affected because it'll slow viewport drawing down.

For until some smart solution is found simply expose alpha blending mode used
by the viewport. It could be found below the Viewport Color settings.
2015-08-25 18:12:35 +02:00
79af9b1260 Action Management Feature Request/Regression T45535
By popular request, restored the ability to shift-click on the X (unlink) button
to unlink the action (from the active action slot), clear the Fake User, and
also remove the NLA-stashed copy (only works for the current object/NLA stack though).
2015-08-26 02:30:09 +12:00
27bdc1a984 Preemptive fix for search-buffer size issues
Forgot to increase the size of the string buffer in b88d8916e4
While this wouldn't have caused problems in most cases (since most modifier names
are short), in the rare event that a long modifier name exists, the buffer may have
ended up being truncated prematurely, causing the wrong FCurves to get matched.
2015-08-26 02:30:08 +12:00
f4b65577ff Fix T45776: Rotate around selected fails in texture-paint mode w/ armature
Only rotate around the active pose bone when in weight-paint mode too.
2015-08-25 23:32:55 +10:00
af9838accb OpenSubdiv: Fix/workaround shader compilation when going to GLSL mode 2015-08-25 15:34:34 +02:00
41ae6d7829 OpenSubdiv: Support multiple materials for GLSL view 2015-08-25 15:22:26 +02:00
669f2f0088 OpenSubdiv: Remove partitioned mesh interface
It's hopefully no longer needed, at least not needed for as long as
single ptex face corresponds to a single patch which should be always
correct for uniform subdivisions as far as i know.
2015-08-25 15:12:12 +02:00
f1e68474e0 OpenSubdiv: Support for multiple materials in solid shading mode
Implementation is less optimal compared to non-opensubdiv drawing but
it is now as good as we can do it without affecting on how patches are
being created by OpenSubdiv.
2015-08-25 15:11:56 +02:00
50917edad5 Fix T45853: Edge-slide UV-correct jitter 2015-08-25 22:57:03 +10:00
ba5807c271 BGE: added bge.logic.{get,set}AnimRecordFrame functions
By using getAnimRecordFrame(), game developers have access to the frame
number used by the "Record animation" feature. This enables them to
record additional information in Blender's F-Curves and ensuring perfect
synchronization with the information already recorded by Blender.

The setAnimRecordFrame() can be used to change the frame number at which
animations are recorded, for example to introduce delays the recording that
do not require delays in the actual game/simulation run.

The getter/setter functions in KX_KetsjiEngine are not directly named after
property they access (m_currentFrame). I found "current frame" to be too
vague for a public interface, hence chose a more descriptive name.

Reviewers: moguri, hg1, campbellbarton, panzergame, aligorith

Reviewed By: panzergame, aligorith

Differential Revision: https://developer.blender.org/D1449
2015-08-25 13:42:09 +02:00
6f7eb623d3 Avoid include header from previous commit when building without OpenSubdiv 2015-08-25 13:24:02 +02:00
3db3145c33 OpenSubdiv: Make it more obvious that None compute type actually disables OpenSubdiv 2015-08-25 13:23:06 +02:00
0d33d30cc6 OpenSubdiv: Fill in some missing drawing callbacks of CCGDM 2015-08-25 13:16:55 +02:00
5cf519ac51 OpenSubdiv: Better approximation of vertex normals
Use vertex varying data which gives better approximation of normals.
Still not ideal but should be closer for higher poly meshes to correct
normal.

The only way to have proper smooth normals seems to be to implement
patch evaluation in tessellation shader, but that's a bit PITA with
current GLSL usage in our draw code.
2015-08-25 13:16:55 +02:00
51d969c6a9 Fix T45891: Crash generating previews 2015-08-25 18:34:44 +10:00
c6d7562896 Fix T45729: Cycles Bake break when building a special mesh
The issue was caused by CD_SHAPEKEY_INDEX layer being added to edge data,
now we make sure all the layers are nicely re-allocated.
2015-08-25 10:30:46 +02:00
540f9a3b11 Quiet warning with arg types 2015-08-25 17:27:18 +10:00
a7dd20983a Fix T45814: Writing MP4, h.264 not supported 2015-08-25 08:51:04 +10:00
1080a7d5e1 Cleanup: style 2015-08-25 08:50:53 +10:00
7d516f11f7 Fix for previous commit
uint is only used in Cycles, Blender is not really ready for this.

Pointed out by Thomas Szepe, thanks!
2015-08-24 23:11:45 +02:00
c5018c65b9 BLI_fileops: Some fixes and cleanup.
* Fix BLI_file_touch, used to add one dummy byte ((unsigned char)EOF) to empty files!
* Get rid of static global temp string in WIN32 area (very bad, and useless!).
* Get rid of paranoid NULL checks in WIN32's BLI_gzopen().
* Add non-relative filename asserts to WIN32 file operations too.
* ifdef-out BLI_move and BLI_create_symlink, unused (and the later is not even implemented for windows).

Partly based on patch and points raised by Jason Wilkins (jwilkins) in T32870, thanks!
2015-08-24 22:14:38 +02:00
e8a0478c63 Fix T45833: Light group instances are not rendered in the 3D viewport
The issue was introduced in c9ac51e by trying to use original's objects layers
for light visibility check instead of using duplicator's layers.
2015-08-24 22:02:41 +02:00
2fb639deed Fix T45778: Objects scaled to 0 cause black artifacts with Static BVH
The issue was caused by some numeric instability in triangle intersection which
was visible on avx2 CPUs and GPUs (at least sm_20 here) but maybe some others
too.

Committing rather a workaround for now to be safe for the release, still need
some investigation.

From tests with grass field from Gooseberry project didn't see measurable
slowdown.
2015-08-24 21:23:49 +02:00
3633499f4e Fix T45737: Vertex colors show washed-out
Blender-Internal and GLSL-nodes missed converting sRGB to linear color.
2015-08-25 01:02:28 +10:00
46d275b626 Fix DM_get_loop_array, was checking edge-data
Fixes T45728
2015-08-25 00:47:27 +10:00
68a9328a58 Fix T45084 correcting bending_damping for cloth stiffness, by Martin Norris. 2015-08-24 14:09:01 +02:00
70b7dc993e Fix T45823: PSD files save as JPG without warning
Don't allow image save (which overwrites without asking),
unless the input format can be written to.
2015-08-24 21:34:49 +10:00
aac6ee6b87 Fix T45885: Cycles coordinate extension modes not working as expected
Fix T45769: Image Texture Node clipping bug

Simple mistakes in the normalized/pixel-space coordinates handling.

Render tests for this feature are coming.
2015-08-24 10:40:37 +02:00
8cc8ce3d46 Fix some issues from lates coverity scan.
Unlikely, but still valid.
2015-08-24 09:59:50 +02:00
8031f36261 Tests: Ignore preview render script in module loading tests 2015-08-24 09:46:41 +02:00
2960630b7b Cycles: Use better policy for primitive array resize for spatial split
Gives around 50% of spatial split BVH build speedup with grass field from
cassette player shot from Gooseberry.
2015-08-24 09:46:41 +02:00
7be6dba091 Cycles: Implement reseve() for aligned array class
The title says it all actually, just support reserving memory in the array class.
2015-08-24 09:46:40 +02:00
2230130099 Cycles: Speedup of Spatial BVH split code
Avoid memmove() happening on every insert of duplicated node to the references
list. Temporary pre-allocated vector is used for new references which is then
being inserted into actual array in one go later.

Gives around 4x speedup building spatially split BVH for the grass field in the
cassette player shot from Gooseberry.
2015-08-24 09:46:40 +02:00
334208e670 Cycles: Implementation of object reference nodes spatial split
This commit implements object reference node spatial split making it possible
to use spatial split for top-level BVH.

The code is not in use yet because enabling spatial split on top level BVH is
not coming for free and it needs to be investigated if it's worth in terms of
improved render times.
2015-08-24 09:46:40 +02:00
c88c5db360 Cycles: Make primitive split code easier for re-use by reference splitting function 2015-08-24 09:46:40 +02:00
99c1870ad5 Cycles: Move primitive splitting into own functions
This way it's easy to add more reference types allowed for splitting to the
BVH reference split function without making this function too much big. This
way it's possible to experiment with such features as splitting object instance
references.

So far should not be any functional changes.
2015-08-24 09:46:40 +02:00
9b57d70f3b Cycles: BVH statistics print was missing for spatially split BVH tree 2015-08-24 09:46:40 +02:00
30067b499a Fix editmesh GLSL tangent drawing
The generic tangent calculation relied on CDDM arrays which aren't available in edit-mode.

Add a tangent calculation callback, which has its own implementation for editmesh data.
2015-08-24 15:20:23 +10:00
4f61de6588 Fix T45884: Crash copying keyframes
BLI_str_quoted_substrN could crash if the prefix wasn't found
2015-08-24 09:29:00 +10:00
231ee60ab5 mathutils.BVHTree: support overlap self-intersect
Use same logic as BKE_bmbvh_overlap
2015-08-24 08:23:24 +10:00
8a623b066e BVHTree.FromBMesh() missed epsilon arg 2015-08-24 08:23:24 +10:00
2ee0187ed2 Fix T45882: Sudden shutdown if the filebrowser is part of the area layout.
There is no guarantee in sfile's listener that FileList has already been created...
2015-08-23 20:27:59 +02:00
25bb5cb30c Fix T45860, missing extension in GLSL after recent own fix. 2015-08-23 18:20:08 +03:00
8444f7ba2b BGE: Fix T42679: Python physics environment not setted for python control script. 2015-08-23 14:34:04 +02:00
2672ee77a0 Cleanup: spelling/style 2015-08-23 21:12:48 +10:00
83e16a4a87 This commit makes it possible to select the sort mode whenever we invoke an operator.
It's needed especially for the menu entry "recover auto save" where you'd like to have the files sorted by date most of the time but it could be useful in other places too.
There should be no functional change in other areas, I just added the missing parameter (FILE_SORT_ALPHA).

Was a request from @sebastian_k at #BCon13, so at least one guy needs it ;)

Reviewers: mont29

Reviewed By: mont29

Subscribers: sebastian_k

Differential Revision: https://developer.blender.org/D1476
2015-08-23 12:40:21 +02:00
b88d8916e4 Fix T45633 - Animated modifiers don't update in new depsgraph
* Resolved some todo's where FModifier paths were getting identified using the
  wrong pattern.
* Added the missing animation -> modifier link. The "hacky" part here is just
  to do with how we check if that link is needed; the link though should exist
  in the graph.
2015-08-23 22:23:25 +12:00
e7775833a7 Math Lib: Use same logic for 2d/3d functions
dist_squared_to_line_v2, dist_to_line_v2
2015-08-23 19:10:37 +10:00
0cb23fafe7 Math Lib: minor optimization interp_weights_poly 2015-08-23 17:07:35 +10:00
58c9a0b11a Cleanup: spelling 2015-08-22 21:17:32 +10:00
c1c07b68b8 Use epsilon for line-intersect collinear test
Also remove 2x vector normalize since other parts of the code already check this.

Fixes T45849
2015-08-22 21:12:46 +10:00
6c8db9fd5f FileBrowser: Tweak display of size/time of entries.
We have no size for blenlib entries, nor do we have time for those and 'parent' entry.

Thanks to Sergey for notifying this on IRC.
2015-08-22 11:02:12 +02:00
86690915f1 outliner: tweak GPLayer color button overlap 2015-08-22 16:49:58 +10:00
a22f3cccec Fix outliner grease pencil color button 2015-08-22 16:49:57 +10:00
4d146bdf13 Fix T45689: Pose Libraries cannot be used when using lib-linked actions as poselibs
This commit makes some tweaks that make it at least possible to use lib-linked
actions as Pose Libraries. Specifically:
* The apply poses button is no longer greyed out

* It is possible to select different poses from the list of poses

* All pose library operators which edit the poses stored in the poselib
  now have improved poll callbacks which perform extra checks for lib-linked
  actions (which cannot be edited, as all those changes will be lost)


Caveats:
* Due to the way the UI list template works, it doesn't seem to be possible to
  make it not grey out the items in the list. (While the double-click to rename
  thing shouldn't be allowed, items should at least look like they can be clicked on)

* The difference between clickable vs not-clickable isn't too great, making it hard
  to tell that that while the Add/Remove/Sanitise toggles are not usable,
  the Apply Poses is actually functional. But, this is a more of a  UI-toolbox
  level issue
2015-08-22 18:16:55 +12:00
79e3a27c7a Typo fix 2015-08-22 16:53:58 +12:00
24e56d4c39 BGE: Fix constraint free crash in RemoveConstraint.
Fix silly error getRigidBodyA() instead of getRigidBodyB()
2015-08-21 22:17:35 +02:00
7d0b29be69 Fix T45658: linked library object loses particle settings.
Simply make ParticleSettings datablock linkable, see absolutely no reason why those
were the only 'real data' ID type not linkable so far...
2015-08-21 18:31:23 +02:00
94c8f5a447 Anim Editors: All keyframe selection operators now perform undo pushes
This brings them into line with other editing tools (e.g. object/mesh selection),
and should help fix bugs like T45374 and T45846
2015-08-22 02:48:02 +12:00
b617dec065 Fix T45864: Wrong NLA Control Curves keyed when using the Graph Editor sliders
This commit simplifies the logic for finding the control curves for NLA strips,
thus eliminating a whole bunch of weird errors that were happening here. It should
also fix a number of other related issues here.
2015-08-22 02:48:01 +12:00
09b7ec1864 Fix T45865: Auto Blend is not recalculated when adjusting start/end/scale etc. of strip through RNA. 2015-08-21 16:18:20 +02:00
59e166c568 BVH-raycast: Use watertight intersections
By default watertight intersections are used,
For callbacks where its not needed,
BLI_bvhtree_ray_cast_ex can be called without the BVH_RAYCAST_WATERTIGHT flag.

Fixes T45286
2015-08-21 17:48:33 +10:00
71919efd78 Math Lib: watertight intersection function
From Cycles with some very minor differences.
2015-08-21 17:45:04 +10:00
7e3781179e Math Lib: Add float/int conversion functions 2015-08-21 17:42:40 +10:00
c727fc59ab BVH-raycast: ensure input direction is unit-length
This was already the case for most users of ray-cast.
Doing this avoids 2x normalize calls per ray-cast in many places.
2015-08-21 17:09:18 +10:00
a98b02ff94 Fix uninitialized var use 2015-08-21 14:46:30 +10:00
aa746677cf Docs: correct some comments 2015-08-21 09:07:52 +10:00
10edaff5c1 Fix ATI part of T45708, crash when enabling opensubdiv.
In fact exit was getting called because we
had an error in shader compilation:

Uniform buffer objects are in fact required.

Since it looks like original intent was to
write the shader against older GLSL version,
I will be adding an extension here instead
of a version.

Thanks to Anshu Arya for letting me borrow his machine through
VPN to do the debugging :)
2015-08-20 16:23:33 +03:00
3fd89df6e7 Fix T45491 not all GPUs support those extensions, use check for
opensubdiv to enable.
2015-08-20 16:05:24 +03:00
f9791155e4 Minor cleanup (BLI_cleanup_dir already adds trailing slash, and correct a false-positive assert). 2015-08-20 12:45:20 +02:00
cd24871706 BGE: Fix T44557 GameLogic module memory leak.
This reverts commit 7a28ca4398.
2015-08-20 12:06:54 +02:00
f4d8ce9781 Fix T43654: Radial distance for force fields was computed using the vec_to_point
vector, which already has the radial component removed.
2015-08-20 11:58:11 +02:00
3ec9ff16f8 Resolve MSVC/OpenMP compat issue 2015-08-20 19:37:14 +10:00
179a2e1b98 Use BVH-overlap for mesh self-intersection display
Add BKE_bmbvh_overlap, remove BKE_bmbvh_find_face_segment
2015-08-20 19:13:14 +10:00
66365589ff Hopefully fix mingw building after filebrowser rewrite.
The mystery here is, how MSVC could not break on such error? :(
2015-08-20 10:15:08 +02:00
176b806626 BVH-overlap: add callback to BLI_bvhtree_overlap
The callback checks if 2 nodes intersect (not just their AABB).

Advantages:
- theres no need to allocate overlaps which are later ignored.
- expensive intersection tests will run multi-threaded.

Currently only used for Python API.
2015-08-20 17:52:26 +10:00
67e32b3195 Fix T45514 crash entering texpaint mode.
In the file of the report, stencil and clone indices
have fallen out of synch with the uv/mtexpoly layers.

Looks like the file has a long history, coming from 2.49
even. Unfortunately reporter cannot recall exact steps
to reproduce, so "fix" is to patch mesh.validate to
fix those indices.
2015-08-20 10:35:14 +03:00
e9f432f73c BVH-overlap: use stack for overlap data array
This is known to be <32, so no need to malloc every item.
2015-08-20 16:31:05 +10:00
6b53b4afb9 Avoid redundant normal calculation in heat-weight 2015-08-20 15:09:25 +10:00
a2c9d87a99 Cleanup: de-duplicate ray-cast initialization 2015-08-20 13:25:21 +10:00
a6457f283e Cleanup: comment out isect_ray_tri_threshold_v3
Also define epsilon var for ray-cast functions.
2015-08-20 12:50:39 +10:00
5b6deea647 Transform: Use BVH for volume-snap (optimization)
Was performing ray-tri intersection checks on all faces.

Note, this isn't using isect_ray_tri_threshold_v3
which was used to prevent ray-casts slipping through between faces.

Instead we'll move to using watertight intersections by default.
2015-08-20 12:22:54 +10:00
023b1a3843 Cleanup: remove unused BVH_ONQUAD flag 2015-08-20 11:03:34 +10:00
4224d22039 Fix drawing subsurf & auto-smooth
Error caused by recent MFace removal from subsurf.
2015-08-20 09:20:41 +10:00
a64819b735 Cleanup: unused vars 2015-08-20 09:20:11 +10:00
6c0cdda8e1 Cleanup: whitespace 2015-08-20 08:51:50 +10:00
5c3b95e1a8 FileBrowser: Fix some minor issue with fileentries creation.
An entry could already exist in misc cache, when creating it for block cache, leading to double-creation.
Issue was not that serious (no memleak or so), but nasty still. Thanks to Severin for notifying the assert.
2015-08-20 00:51:21 +02:00
c11222e31a Fix 32bit builds... :/ 2015-08-19 23:54:49 +02:00
f69e9681fa Final 'FileBrowser First Stage' merge.
It basically rewrites most of filelist.c, with some more limited changes in other areas of filebrowser.

From user perspective, it:
* Removes some info in 'long' drawing mode (owner, permissions) - OS-specific data that do not really matter in Blender!
* Makes short/long display 'fixed' size (among four choices, like thumbnails mode).
* Allows to list several layers of dirtree at once, in a flat way (inside .blend files and/or real directories).
* Consequently, adds datablocks types filtering.
* Uses way less RAM when listing big directories, especially in thumbnail mode (we are talking of several hundred of MiB spared).
* Generates thumbnails way faster.

From code perspective, it:
* Is ready for asset engine needs (on data structure level in filebrowser's listing).
* Simplifies and makes 'generic' file listing much lighter.
* Separates file listing in three different aspects:
** 'generic' filelisting (in BLI), which becomes a shallow wrapper around stat struct.
** 'filebrowser drawing' filelisting, which only contains current visible subset of the whole list (sliding window), with extra drawing data (strings for size, date/time, preview, etc.).
** 'asset-ready' filelisting, which is used for operations common to 'basic' filehandling and future asset-related one.
* Uses uuid's to handle file selection/state in the browser, instead of using flags in filelisting items.
* Uses much lighter BLI_task handling for previews, instead of heavy 'job' system (using the new 'notifier' timer to handle UI refresh, in similar way to jobs).
* Moves .blend datablocks preview handling to IMB_thumbnail (necessary to avoid storing all datablock previews at once, and gives better consistency and performances too).

Revision: https://developer.blender.org/D1316

Thanks to Campbell & Sergey for the reviews. :)
2015-08-19 22:41:39 +02:00
Julian Eisel
5c659574e6 Fix T45847: Pie looses focus when mouse cursor passes through a pie button 2015-08-19 20:53:16 +02:00
5668fc0938 More BLT/Windows fixes... :/ 2015-08-19 11:01:52 +02:00
314e40b6ce Hopefully fix broken windows after recent i18n split.
We need to include BLI_utildefines.h when using __func__...
2015-08-19 10:10:29 +02:00
a3b151f341 Fix for accessing looptri's from subsurf
Use poly count since tessfaces may be zero
2015-08-19 17:26:32 +10:00
Dalai Felinto
bb479704d0 Multi-View: fix Multi-View camera suffix test
If we had ambiguity in the SceneRenderView > Suffix matching test, the
first match would be used. And this would happen everytime a
SceneRenderView had an empty camera suffix.

We now take the longest matching suffix instead.
2015-08-19 03:41:02 -03:00
cd8581af8e Fix T45706: Axis aligned tri-tri intersection 2015-08-19 12:20:39 +10:00
7c352ed43a Cleanup: style + doxy 2015-08-19 08:49:12 +10:00
6a5303ab43 Fix error in recent library API updates 2015-08-19 08:49:12 +10:00
1ed1f2f3ab Increase Smooth_View limit to 10.000
Request from @zuggamasta: For turntable like view rotations a very slow and smooth turn is needed. This is now possible with the new limit.
2015-08-18 20:41:21 +02:00
a67a51ed55 IMB_thumb: Allow blen-handling func to also load datablock previews from .blend file.
Notes:
* Not yet used, this is the last piece of 'side changes' before the big filebrowser commit.
* We can probably be more effective here (like e.g. reading and storing all previews for a given
  group in thumbnails cache at once, instead of re-opening and parsing the whole file each time),
  but will do this later.
2015-08-18 14:32:13 +02:00
2735f6fda6 Replace 'BLO_is_a_library' by 'BLO_library_path_explode'.
This new func will be fully used by upcomming code (it mostly adds
the extraction of library item name as well as library file and ID group).
2015-08-18 13:18:50 +02:00
d85e94da07 IMB_thumb: add thread locking API.
General idea is that, if several threads are handling thumbnails at the same time,
they can end working on the same file at some point, which will generate conflict.

To avoid this, threads can now lock a given filepath.

Note that locking data is allocated on a ref-count basis, to avoid keeping the GSet
in memory when not needed. Also, we are using global LOCK_IMAGE mutex for now.

Needed for upcomming filebrowser rework.
2015-08-18 12:39:45 +02:00
81afa2953c BGE: Fix mesh not registered in scene libload. 2015-08-18 12:24:38 +02:00
3a8e73943e Fix T45824: Pie's no longer show enum icons 2015-08-18 19:18:16 +10:00
1190da3ad9 UI: avoid property lookup w/ expanded enums 2015-08-18 19:04:06 +10:00
92fe4e52fd system-info.txt was quoting ffmpeg lib names 2015-08-18 16:09:51 +10:00
6cee6607a2 UI: avoid subtracting shadow from winrct
For popup interactions we need to know if events are in the region or not,
however subtracting the shadow isn't so reliable, since its not always added to all sides of a popup.

Instead, get the winrct value from a popup using the block rect, otherwise the winrct as-is.
2015-08-18 14:16:58 +10:00
a08f8a4708 Readfile: more efficient OldNewMap lookups
Even when lasthit can't be used to find the next address,
use it as a starting point for the full array search.
Gives approx 1/3 less array searching in own tests.
2015-08-18 11:39:23 +10:00
ac62d44e4f Docs: function comments 2015-08-18 07:11:55 +10:00
2e2dc9b9e3 Refactor translation code out of blenfont
- Add blentranslation `BLT_*` module.
- moved & split `BLF_translation.h` into (`BLT_translation.h`, `BLT_lang.h`).
- moved `BLF_*_unifont` functions from `blf_translation.c` to new source file `blf_font_i18n.c`.
2015-08-18 07:01:26 +10:00
3047b96eaa Lattice min_max: add a version of the func using lattice's final DispList,
and use it for bbox computing.

Revision: https://developer.blender.org/D1462
2015-08-17 17:02:22 +02:00
ad43262fdb BGE: Fix T45817 Convert curve object in group instance.
Now group instance conversion allow unconverted object like curve, meta ball ect…
2015-08-17 16:51:35 +02:00
cb7f7b9abd Subsurf: don't reserve MFace by default
Instead, the cache can be calculated only when its needed (fixes T45787).
2015-08-17 18:14:54 +10:00
6e65185854 Fix for Ghost/OSX w/ core profile 2015-08-17 16:17:22 +10:00
ce2d342df5 Fix T45802: View Lock w/ Curve-Parent fails 2015-08-17 14:58:03 +10:00
c58757006d Cleanup: remove unused Object.ipoflag 2015-08-17 14:24:47 +10:00
709a31da93 Simplify thumbnail blend parser
No need to convert the BHead code to an int, just compare the bytes.
2015-08-17 12:37:38 +10:00
0c420a2e49 Fix T39486, screwed object bevel made bevel amount go out of control.
There is an adjustment pass in bevel that tries to make the bevel
widths at either end of a beveled edge as equal as possible.
When there are hundreds of beveled edges end-to-end, these adjustments
can accumulate out of control and result looks awful.
Yet the adjustment pass is sometimes needed to avoid equally awful
appearances in other cases (see the "Bent test" in the bevel regression
tests).
This change uses the 'Clamp overlap' flag of bevel (on by default in
the modifier, not in the tool) to limit the amount of adjustment to within
10% of the desired width. When the flag is off, there is no limit to the
adjustment.
2015-08-16 15:15:13 -04:00
9b43fce3c1 Fix T45795, bevel treated one-edge-beveled case inconsistently.
When one edge is beveled at a vertex among more than 1 other unbeveled
edges, the code makes a polygon around the vertex. The position of the
vertices on the non-adjacent-to-beveled-edge edges depended on the
ordering of edges, which leads to inconsistent-looking results in seeming
symmetrical situations.  Changed to use the bevel amount as slide
distance, which fixes this.
2015-08-16 11:13:53 -04:00
493f9b9155 Fix for numpy with nmake and missing directory
When using the nmake generator from cmake, numpy fails to extract during build because the working directory doesn't exist yet.

Reviewers: juicyfruit

Differential Revision: https://developer.blender.org/D1466
2015-08-16 14:34:45 +02:00
9437acb7f3 BGE: Fix memory leak and crash with certain physic types
Fixing crash if the physic type is set sensor or character. Caused by a790e172d0.
Fixing memory leak, if the constraint is deleted with Python API removeConstraint().
Add RemoveConstraint() method to avoid code duplication.
Rename old RemoveConstraint() to RemoveConstraintById() which is more suitable name for this method.
2015-08-16 11:38:25 +02:00
Julian Eisel
19cc75d642 Fix T45807: Instant crash adding any modifier to NLA track
Caused by rBcbf936a3327282
2015-08-15 14:48:38 +02:00
755 changed files with 21860 additions and 10945 deletions

View File

@@ -2320,9 +2320,14 @@ endif()
if(WITH_IMAGE_OPENJPEG)
if(WITH_SYSTEM_OPENJPEG)
# dealt with above
set(OPENJPEG_DEFINES "")
else()
set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
add_definitions(-DOPJ_STATIC)
set(OPENJPEG_DEFINES "-DOPJ_STATIC")
endif()
# Special handling of Windows platform where openjpeg is always static.
if(WIN32)
set(OPENJPEG_DEFINES "-DOPJ_STATIC")
endif()
endif()

View File

@@ -122,7 +122,7 @@ endif
# Build Blender
all: FORCE
@echo
@echo Configuring Blender ...
@echo Configuring Blender in \"$(BUILD_DIR)\" ...
# # if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
# # $(CMAKE_CONFIG); \

View File

@@ -35,6 +35,8 @@ required-numpy: \
-- "$@" \
)
COMMANDLINE=$@
DISTRO=""
RPM=""
SRC="$HOME/src/blender-deps"
@@ -42,6 +44,7 @@ INST="/opt/lib"
TMP="/tmp"
CWD=$PWD
INFO_PATH=$CWD
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Do not install some optional, potentially conflicting libs by default...
WITH_ALL=false
@@ -1376,19 +1379,7 @@ compile_LLVM() {
cd $_src
# XXX Ugly patching hack!
cat << EOF | patch -p1
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@
set(LLVM_VERSION_MAJOR 3)
set(LLVM_VERSION_MINOR 1)
-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
+set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
EOF
patch -p1 -i "$SCRIPT_DIR/install_deps_patches/llvm.patch"
cd $CWD
@@ -1458,10 +1449,10 @@ compile_OSL() {
# Clean install if needed!
magic_compile_check osl-$OSL_VERSION $osl_magic
#~ if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
#~ rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically
#~ clean_OSL
#~ fi
clean_OSL
fi
if [ ! -d $_inst ]; then
INFO "Building OpenShadingLanguage-$OSL_VERSION"
@@ -1490,6 +1481,9 @@ compile_OSL() {
# Stick to same rev as windows' libs...
git checkout $OSL_SOURCE_REPO_UID
git reset --hard
# XXX Ugly patching hack!
patch -p1 -i "$SCRIPT_DIR/install_deps_patches/osl.patch"
fi
# Always refresh the whole build!
@@ -1531,6 +1525,9 @@ compile_OSL() {
fi
fi
#~ cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
#~ cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
cmake $cmake_d ..
make -j$THREADS && make install
@@ -2536,7 +2533,7 @@ install_RPM() {
if $NUMPY_SKIP; then
WARNING "Skipping NumPy installation, as requested..."
else
check_package_version_match_RPM python3-numpy $NUMPY_VERSION_MIN
check_package_version_ge_RPM python3-numpy $NUMPY_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM python3-numpy
elif $NUMPY_REQUIRED; then
@@ -3120,6 +3117,10 @@ print_info() {
PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
PRINT ""
PRINT ""
PRINT "Ran with:"
PRINT " install_deps.sh $COMMANDLINE"
PRINT ""
PRINT ""
PRINT "If you're using CMake add this to your configuration flags:"
_buildargs=""

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ set(MY_WC_COMMIT_TIMESTAMP 0)
# Guess if this is a git working copy and then look up the revision
if(EXISTS ${SOURCE_DIR}/.git)
# The FindGit.cmake module is part of the standard distribution
include(FindGit)
find_package(Git)
if(GIT_FOUND)
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")

View File

@@ -591,6 +591,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
ge_videotex
bf_dna
bf_blenfont
bf_blentranslation
bf_intern_audaspace
bf_intern_mikktspace
bf_intern_dualcon
@@ -1281,7 +1282,7 @@ function(data_to_c
add_custom_command(
OUTPUT ${file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${file_from} ${file_to}
COMMAND "$<TARGET_FILE:datatoc>" ${file_from} ${file_to}
DEPENDS ${file_from} datatoc)
set_source_files_properties(${file_to} PROPERTIES GENERATED TRUE)
@@ -1306,7 +1307,7 @@ function(data_to_c_simple
add_custom_command(
OUTPUT ${_file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
COMMAND "$<TARGET_FILE:datatoc>" ${_file_from} ${_file_to}
DEPENDS ${_file_from} datatoc)
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
@@ -1339,8 +1340,8 @@ function(data_to_c_simple_icons
OUTPUT ${_file_from} ${_file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
#COMMAND python3 ${CMAKE_SOURCE_DIR}/source/blender/datatoc/datatoc_icon.py ${_path_from_abs} ${_file_from}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc_icon ${_path_from_abs} ${_file_from}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
COMMAND "$<TARGET_FILE:datatoc_icon>" ${_path_from_abs} ${_file_from}
COMMAND "$<TARGET_FILE:datatoc>" ${_file_from} ${_file_to}
DEPENDS
${_icon_files}
datatoc_icon
@@ -1409,7 +1410,7 @@ function(msgfmt_simple
add_custom_command(
OUTPUT ${_file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/msgfmt ${_file_from} ${_file_to}
COMMAND "$<TARGET_FILE:msgfmt>" ${_file_from} ${_file_to}
DEPENDS msgfmt ${_file_from})
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)

View File

@@ -21,7 +21,7 @@ SET(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
# Get the build revision, note that this can get out-of-sync, so for packaging run cmake first.
set(MY_WC_HASH "unknown")
if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
include(FindGit)
find_package(Git)
if(GIT_FOUND)
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse --short HEAD

View File

@@ -94,6 +94,10 @@
/** \defgroup blender Blender */
/** \defgroup blt BlenTranslation
* \ingroup blender
*/
/** \defgroup blf BlenFont
* \ingroup blender
*/

View File

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

View File

@@ -1,6 +1,7 @@
"""
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.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,7 @@
"""
Invoke Function
+++++++++++++++
:class:`Operator.invoke` is used to initialize the operator from the context
at the moment the operator is called.
invoke() is typically used to assign properties which are then used by

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -258,7 +258,8 @@ General functions
Sets the world gravity.
:type gravity: list [fx, fy, fz]
:arg gravity: gravity vector
:type gravity: Vector((fx, fy, fz))
.. function:: getSpectrum()
@@ -337,6 +338,28 @@ General functions
.. warning: Not implimented yet
.. function:: getAnimRecordFrame()
Gets the current frame number used for recording animations. This
number is incremented automatically by Blender when the "Record
animation" feature is turned on.
:rtype: int
.. function:: setAnimRecordFrame(framenr)
Sets the current frame number used for recording animations. This
number is automatically incremented by Blender when the "Record
animation" feature is turned on.
The frame number Must be non-negative, unless Blender has
:attr:`bpy.types.UserPreferencesEdit.use_negative_frames` enabled
in its user preferences. Only use non-negative numbers to be on
the safe side, unless you know what you are doing.
:arg framenr: The new frame number.
:type framenr: int
.. function:: getExitKey()
Gets the key used to exit the game engine

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -472,6 +472,18 @@ else:
_BPY_PROP_COLLECTION_ID = "collection"
def escape_rst(text):
""" Escape plain text which may contain characters used by RST.
"""
return text.translate(escape_rst.trans)
escape_rst.trans = str.maketrans({
"`": "\\`",
"|": "\\|",
"*": "\\*",
"\\": "\\\\",
})
def is_struct_seq(value):
return isinstance(value, tuple) and type(tuple) != tuple and hasattr(value, "n_fields")
@@ -1139,7 +1151,7 @@ def pycontext2sphinx(basepath):
def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
""" write a bullet point list of enum + descrptons
""" write a bullet point list of enum + descriptions
"""
if use_empty_descriptions:
@@ -1154,7 +1166,7 @@ def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
if ok:
return "".join(["* ``%s`` %s.\n" %
(identifier,
", ".join(val for val in (name, description) if val),
", ".join(escape_rst(val) for val in (name, description) if val),
)
for identifier, name, description in prop.enum_items
])
@@ -1600,7 +1612,7 @@ def write_rst_contents(basepath):
fw("\n")
# fw("`A PDF version of this document is also available <%s>`_\n" % BLENDER_PDF_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files)<%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files) <%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("\n")

View File

@@ -31,9 +31,7 @@ set(INC_SYS
)
if(WIN32)
add_definitions(-DOPJ_STATIC)
endif()
add_definitions(${OPENJPEG_DEFINES})
set(SRC
bio.c

View File

@@ -41,4 +41,6 @@ set(SRC
format.h
)
add_definitions(${OPENJPEG_DEFINES})
blender_add_lib(extern_redcode "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -78,7 +78,7 @@ static unsigned char* read_packet(FILE * fp, char * expect)
len = read_be32(len);
if (strcmp(expect, head) != 0) {
fprintf(stderr, "Read: %s, expect: %s\n", head, expect);
/* fprintf(stderr, "Read: %s, expect: %s\n", head, expect); */
return NULL;
}

View File

@@ -164,6 +164,8 @@ set(SRC
intern/AUD_SequencerHandle.h
intern/AUD_SequencerReader.cpp
intern/AUD_SequencerReader.h
intern/AUD_Set.cpp
intern/AUD_Set.h
intern/AUD_SilenceFactory.cpp
intern/AUD_SilenceFactory.h
intern/AUD_SilenceReader.cpp

View File

@@ -41,7 +41,6 @@
# include "AUD_PyAPI.h"
#endif
#include <set>
#include <cstdlib>
#include <cstring>
#include <cmath>
@@ -1224,44 +1223,6 @@ void AUD_Handle_free(AUD_Handle *handle)
delete handle;
}
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 NULL;
}
const char *AUD_mixdown(AUD_Sound *sound, unsigned int start, unsigned int length, unsigned int buffersize, const char *filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
{
try {

View File

@@ -30,8 +30,8 @@ def _is_using_buggy_driver():
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.
# in the version string, but those cards do not quite work and
# causing crashes.
return True
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\.[0-9]+)+)$")
if not regex.match(version):
@@ -49,12 +49,13 @@ def _workaround_buggy_drivers():
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
# Workaround possibly buggy legacy drivers which crashes on the OpenCL
# device enumeration.
#
# This checks are not really correct because they might still fail

View File

@@ -463,11 +463,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Use BVH spatial splits: longer builder time, faster render",
default=False,
)
cls.use_cache = BoolProperty(
name="Cache BVH",
description="Cache last built BVH to disk for faster re-render if no geometry changed",
default=False,
)
cls.tile_order = EnumProperty(
name="Tile Order",
description="Tile order for rendering",
@@ -743,7 +738,7 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
name="Map Resolution",
description="Importance map size is resolution x resolution; "
"higher values potentially produce less noise, at the cost of memory and speed",
min=4, max=8096,
min=4, max=8192,
default=256,
)
cls.samples = IntProperty(

View File

@@ -332,7 +332,6 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
col.separator()
col.label(text="Final Render:")
col.prop(cscene, "use_cache")
col.prop(rd, "use_persistent_data", text="Persistent Images")
col.separator()
@@ -1164,13 +1163,17 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
col.prop(mat, "alpha")
col.separator()
col.prop(mat, "pass_index")
col.label("Viewport Alpha:")
col.prop(mat.game_settings, "alpha_blend", text="")
col = split.column(align=True)
col.label("Viewport Specular:")
col.prop(mat, "specular_color", text="")
col.prop(mat, "specular_hardness", text="Hardness")
col.separator()
col.prop(mat, "pass_index")
class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
bl_label = ""

View File

@@ -107,9 +107,9 @@ static float blender_camera_focal_distance(BL::RenderEngine b_engine, BL::Object
b_engine.camera_model_matrix(b_ob, b_ob_matrix);
Transform obmat = get_transform(b_ob_matrix);
Transform dofmat = get_transform(b_dof_object.matrix_world());
Transform mat = transform_inverse(obmat) * dofmat;
return fabsf(transform_get_column(&mat, 3).z);
float3 view_dir = normalize(transform_get_column(&obmat, 2));
float3 dof_dir = transform_get_column(&obmat, 3) - transform_get_column(&dofmat, 3);
return fabsf(dot(view_dir, dof_dir));
}
static void blender_camera_from_object(BlenderCamera *bcam, BL::RenderEngine b_engine, BL::Object b_ob, bool skip_panorama = false)

View File

@@ -145,7 +145,7 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0)
if(b_part.child_type() == 0 || totchild == 0)
totcurves += totparts;
if(totcurves == 0)
@@ -169,7 +169,7 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
CData->psys_closetip.push_back(get_boolean(cpsys, "use_closetip"));
int pa_no = 0;
if(!(b_part.child_type() == 0))
if(!(b_part.child_type() == 0) && totchild != 0)
pa_no = totparts;
int num_add = (totparts+totchild - pa_no);
@@ -233,14 +233,14 @@ bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Parti
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0)
if(b_part.child_type() == 0 || totchild == 0)
totcurves += totparts;
if(totcurves == 0)
continue;
int pa_no = 0;
if(!(b_part.child_type() == 0))
if(!(b_part.child_type() == 0) && totchild != 0)
pa_no = totparts;
int num_add = (totparts+totchild - pa_no);
@@ -287,14 +287,14 @@ bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0)
if(b_part.child_type() == 0 || totchild == 0)
totcurves += totparts;
if(totcurves == 0)
continue;
int pa_no = 0;
if(!(b_part.child_type() == 0))
if(!(b_part.child_type() == 0) && totchild != 0)
pa_no = totparts;
int num_add = (totparts+totchild - pa_no);

View File

@@ -842,6 +842,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion
return;
}
/* TODO(sergey): Perform preliminary check for number of verticies. */
if(numverts) {
/* find attributes */
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
@@ -873,7 +874,9 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion
/* in case of new attribute, we verify if there really was any motion */
if(new_attribute) {
if(i != numverts || memcmp(mP, &mesh->verts[0], sizeof(float3)*numverts) == 0) {
if(b_mesh.vertices.length() != numverts ||
memcmp(mP, &mesh->verts[0], sizeof(float3)*numverts) == 0)
{
/* no motion, remove attributes again */
VLOG(1) << "No actual deformation motion for object " << b_ob.name();
mesh->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);

View File

@@ -1176,7 +1176,7 @@ void BlenderSync::sync_world(bool update_all)
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
/* when doing preview render check for BI's transparency settings,
* this is so because bledner's preview render routines are not able
* this is so because Blender's preview render routines are not able
* to tweak all cycles's settings depending on different circumstances
*/
if(b_engine.is_preview() == false)

View File

@@ -427,7 +427,6 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background, bo
params.bvh_type = (SceneParams::BVHType)RNA_enum_get(&cscene, "debug_bvh_type");
params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
params.use_bvh_cache = (background)? RNA_boolean_get(&cscene, "use_cache"): false;
if(background && params.shadingsystem != SHADINGSYSTEM_OSL)
params.persistent_data = r.use_persistent_data();

View File

@@ -68,10 +68,12 @@ static void density_particle_system_texture_space(
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);
if (particle.alive_state() == BL::Particle::alive_state_ALIVE) {
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;

View File

@@ -25,7 +25,6 @@
#include "bvh_node.h"
#include "bvh_params.h"
#include "util_cache.h"
#include "util_debug.h"
#include "util_foreach.h"
#include "util_logging.h"
@@ -70,125 +69,12 @@ BVH *BVH::create(const BVHParams& params, const vector<Object*>& objects)
return new RegularBVH(params, objects);
}
/* Cache */
bool BVH::cache_read(CacheData& key)
{
key.add(system_cpu_bits());
key.add(&params, sizeof(params));
foreach(Object *ob, objects) {
Mesh *mesh = ob->mesh;
key.add(mesh->verts);
key.add(mesh->triangles);
key.add(mesh->curve_keys);
key.add(mesh->curves);
key.add(&ob->bounds, sizeof(ob->bounds));
key.add(&ob->visibility, sizeof(ob->visibility));
key.add(&mesh->transform_applied, sizeof(bool));
if(mesh->use_motion_blur) {
Attribute *attr = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if(attr)
key.add(attr->buffer);
attr = mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if(attr)
key.add(attr->buffer);
}
}
CacheData value;
if(Cache::global.lookup(key, value)) {
cache_filename = key.get_filename();
if(!(value.read(pack.root_index) &&
value.read(pack.SAH) &&
value.read(pack.nodes) &&
value.read(pack.leaf_nodes) &&
value.read(pack.object_node) &&
value.read(pack.tri_woop) &&
value.read(pack.prim_type) &&
value.read(pack.prim_visibility) &&
value.read(pack.prim_index) &&
value.read(pack.prim_object)))
{
/* Clear the pack if load failed. */
pack.root_index = 0;
pack.SAH = 0.0f;
pack.nodes.clear();
pack.leaf_nodes.clear();
pack.object_node.clear();
pack.tri_woop.clear();
pack.prim_type.clear();
pack.prim_visibility.clear();
pack.prim_index.clear();
pack.prim_object.clear();
return false;
}
return true;
}
return false;
}
void BVH::cache_write(CacheData& key)
{
CacheData value;
value.add(pack.root_index);
value.add(pack.SAH);
value.add(pack.nodes);
value.add(pack.leaf_nodes);
value.add(pack.object_node);
value.add(pack.tri_woop);
value.add(pack.prim_type);
value.add(pack.prim_visibility);
value.add(pack.prim_index);
value.add(pack.prim_object);
Cache::global.insert(key, value);
cache_filename = key.get_filename();
}
void BVH::clear_cache_except()
{
set<string> except;
if(!cache_filename.empty())
except.insert(cache_filename);
foreach(Object *ob, objects) {
Mesh *mesh = ob->mesh;
BVH *bvh = mesh->bvh;
if(bvh && !bvh->cache_filename.empty())
except.insert(bvh->cache_filename);
}
Cache::global.clear_except("bvh", except);
}
/* Building */
void BVH::build(Progress& progress)
{
progress.set_substatus("Building BVH");
/* cache read */
CacheData key("bvh");
if(params.use_cache) {
progress.set_substatus("Looking in BVH cache");
if(cache_read(key))
return;
}
/* build nodes */
BVHBuild bvh_build(objects,
pack.prim_type,
@@ -227,18 +113,6 @@ void BVH::build(Progress& progress)
/* free build nodes */
root->deleteSubtree();
if(progress.get_cancel()) return;
/* cache write */
if(params.use_cache) {
progress.set_substatus("Writing BVH cache");
cache_write(key);
/* clear other bvh files from cache */
if(params.top_level)
clear_cache_except();
}
}
/* Refitting */

View File

@@ -20,7 +20,6 @@
#include "bvh_params.h"
#include "util_string.h"
#include "util_types.h"
#include "util_vector.h"
@@ -30,7 +29,6 @@ class BVHNode;
struct BVHStackEntry;
class BVHParams;
class BoundBox;
class CacheData;
class LeafNode;
class Object;
class Progress;
@@ -87,7 +85,6 @@ public:
PackedBVH pack;
BVHParams params;
vector<Object*> objects;
string cache_filename;
static BVH *create(const BVHParams& params, const vector<Object*>& objects);
virtual ~BVH() {}
@@ -95,15 +92,9 @@ public:
void build(Progress& progress);
void refit(Progress& progress);
void clear_cache_except();
protected:
BVH(const BVHParams& params, const vector<Object*>& objects);
/* cache */
bool cache_read(CacheData& key);
void cache_write(CacheData& key);
/* triangles and strands*/
void pack_primitives();
void pack_triangle(int idx, float4 woop[3]);

View File

@@ -76,8 +76,8 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
prefetch_L2(&prims[start() + i + 8]);
/* map even and odd primitive to bin */
BVHReference prim0 = prims[start() + i + 0];
BVHReference prim1 = prims[start() + i + 1];
const BVHReference& prim0 = prims[start() + i + 0];
const BVHReference& prim1 = prims[start() + i + 1];
int4 bin0 = get_bin(prim0.bounds());
int4 bin1 = get_bin(prim1.bounds());
@@ -96,7 +96,7 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
/* for uneven number of primitives */
if(i < ssize_t(size())) {
/* map primitive to bin */
BVHReference prim0 = prims[start() + i];
const BVHReference& prim0 = prims[start() + i];
int4 bin0 = get_bin(prim0.bounds());
/* increase bounds of bins */

View File

@@ -234,8 +234,14 @@ BVHNode* BVHBuild::run()
return NULL;
/* init spatial splits */
if(params.top_level) /* todo: get rid of this */
if(params.top_level) {
/* NOTE: Technically it is supported by the builder but it's not really
* optimized for speed yet and not really clear yet if it has measurable
* improvement on render time. Needs some extra investigation before
* enabling spatial split for top level BVH.
*/
params.use_spatial_split = false;
}
spatial_min_overlap = root.bounds().safe_area() * params.spatial_split_alpha;
spatial_right_bounds.clear();
@@ -276,6 +282,8 @@ BVHNode* BVHBuild::run()
else if(!params.use_spatial_split) {
/*rotate(rootnode, 4, 5);*/
rootnode->update_visibility();
}
if(rootnode != NULL) {
VLOG(1) << "BVH build statistics:\n"
<< " Build time: " << time_dt() - build_start_time << "\n"
<< " Total number of nodes: "
@@ -525,11 +533,9 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range)
/* Extend an array when needed. */
if(prim_type.size() < range.end()) {
assert(params.use_spatial_split);
/* TODO(sergey): We might want to look into different policies of
* re-allocation here, so on the one hand we would not do as much
* re-allocations and on the other hand will have small memory
* overhead.
*/
prim_type.reserve(references.size());
prim_index.reserve(references.size());
prim_object.reserve(references.size());
prim_type.resize(range.end());
prim_index.resize(range.end());
prim_object.resize(range.end());

View File

@@ -43,9 +43,6 @@ public:
/* object or mesh level bvh */
bool top_level;
/* disk cache */
bool use_cache;
/* QBVH */
bool use_qbvh;
@@ -71,7 +68,6 @@ public:
max_curve_leaf_size = 2;
top_level = false;
use_cache = false;
use_qbvh = false;
}

View File

@@ -191,11 +191,16 @@ void BVHSpatialSplit::split(BVHBuild *builder, BVHRange& left, BVHRange& right,
}
}
/* duplicate or unsplit references intersecting both sides. */
/* Duplicate or unsplit references intersecting both sides.
*
* Duplication happens into a temporary pre-allocated vector in order to
* reduce number of memmove() calls happening in vector.insert().
*/
vector<BVHReference> new_refs;
new_refs.reserve(right_start - left_end);
while(left_end < right_start) {
/* split reference. */
BVHReference lref, rref;
split_reference(builder, lref, rref, refs[left_end], this->dim, this->pos);
/* compute SAH for duplicate/unsplit candidates. */
@@ -234,61 +239,36 @@ void BVHSpatialSplit::split(BVHBuild *builder, BVHRange& left, BVHRange& right,
left_bounds = ldb;
right_bounds = rdb;
refs[left_end++] = lref;
refs.insert(refs.begin() + right_end, rref);
new_refs.push_back(rref);
right_end++;
}
}
/* Insert duplicated references into actual array in one go. */
if(new_refs.size() != 0) {
refs.insert(refs.begin() + right_end - new_refs.size(),
new_refs.begin(),
new_refs.end());
}
left = BVHRange(left_bounds, left_start, left_end - left_start);
right = BVHRange(right_bounds, right_start, right_end - right_start);
}
void BVHSpatialSplit::split_reference(BVHBuild *builder, BVHReference& left, BVHReference& right, const BVHReference& ref, int dim, float pos)
void BVHSpatialSplit::split_triangle_primitive(const Mesh *mesh,
const Transform *tfm,
int prim_index,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds)
{
/* initialize boundboxes */
BoundBox left_bounds = BoundBox::empty;
BoundBox right_bounds = BoundBox::empty;
/* loop over vertices/edges. */
Object *ob = builder->objects[ref.prim_object()];
const Mesh *mesh = ob->mesh;
if(ref.prim_type() & PRIMITIVE_ALL_TRIANGLE) {
const int *inds = mesh->triangles[ref.prim_index()].v;
const float3 *verts = &mesh->verts[0];
const float3* v1 = &verts[inds[2]];
for(int i = 0; i < 3; i++) {
const float3* v0 = v1;
int vindex = inds[i];
v1 = &verts[vindex];
float v0p = (*v0)[dim];
float v1p = (*v1)[dim];
/* insert vertex to the boxes it belongs to. */
if(v0p <= pos)
left_bounds.grow(*v0);
if(v0p >= pos)
right_bounds.grow(*v0);
/* edge intersects the plane => insert intersection to both boxes. */
if((v0p < pos && v1p > pos) || (v0p > pos && v1p < pos)) {
float3 t = lerp(*v0, *v1, clamp((pos - v0p) / (v1p - v0p), 0.0f, 1.0f));
left_bounds.grow(t);
right_bounds.grow(t);
}
}
}
else {
/* curve split: NOTE - Currently ignores curve width and needs to be fixed.*/
const int k0 = mesh->curves[ref.prim_index()].first_key + PRIMITIVE_UNPACK_SEGMENT(ref.prim_type());
const int k1 = k0 + 1;
const float4 key0 = mesh->curve_keys[k0];
const float4 key1 = mesh->curve_keys[k1];
const float3 v0 = float4_to_float3(key0);
const float3 v1 = float4_to_float3(key1);
const int *inds = mesh->triangles[prim_index].v;
const float3 *verts = &mesh->verts[0];
float3 v1 = tfm ? transform_point(tfm, verts[inds[2]]) : verts[inds[2]];
for(int i = 0; i < 3; i++) {
float3 v0 = v1;
int vindex = inds[i];
v1 = tfm ? transform_point(tfm, verts[vindex]) : verts[vindex];
float v0p = v0[dim];
float v1p = v1[dim];
@@ -299,12 +279,6 @@ void BVHSpatialSplit::split_reference(BVHBuild *builder, BVHReference& left, BVH
if(v0p >= pos)
right_bounds.grow(v0);
if(v1p <= pos)
left_bounds.grow(v1);
if(v1p >= pos)
right_bounds.grow(v1);
/* edge intersects the plane => insert intersection to both boxes. */
if((v0p < pos && v1p > pos) || (v0p > pos && v1p < pos)) {
float3 t = lerp(v0, v1, clamp((pos - v0p) / (v1p - v0p), 0.0f, 1.0f));
@@ -312,6 +286,159 @@ void BVHSpatialSplit::split_reference(BVHBuild *builder, BVHReference& left, BVH
right_bounds.grow(t);
}
}
}
void BVHSpatialSplit::split_curve_primitive(const Mesh *mesh,
const Transform *tfm,
int prim_index,
int segment_index,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds)
{
/* curve split: NOTE - Currently ignores curve width and needs to be fixed.*/
const int k0 = mesh->curves[prim_index].first_key + segment_index;
const int k1 = k0 + 1;
const float4& key0 = mesh->curve_keys[k0];
const float4& key1 = mesh->curve_keys[k1];
float3 v0 = float4_to_float3(key0);
float3 v1 = float4_to_float3(key1);
if(tfm != NULL) {
v0 = transform_point(tfm, v0);
v1 = transform_point(tfm, v1);
}
float v0p = v0[dim];
float v1p = v1[dim];
/* insert vertex to the boxes it belongs to. */
if(v0p <= pos)
left_bounds.grow(v0);
if(v0p >= pos)
right_bounds.grow(v0);
if(v1p <= pos)
left_bounds.grow(v1);
if(v1p >= pos)
right_bounds.grow(v1);
/* edge intersects the plane => insert intersection to both boxes. */
if((v0p < pos && v1p > pos) || (v0p > pos && v1p < pos)) {
float3 t = lerp(v0, v1, clamp((pos - v0p) / (v1p - v0p), 0.0f, 1.0f));
left_bounds.grow(t);
right_bounds.grow(t);
}
}
void BVHSpatialSplit::split_triangle_reference(const BVHReference& ref,
const Mesh *mesh,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds)
{
split_triangle_primitive(mesh,
NULL,
ref.prim_index(),
dim,
pos,
left_bounds,
right_bounds);
}
void BVHSpatialSplit::split_curve_reference(const BVHReference& ref,
const Mesh *mesh,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds)
{
split_curve_primitive(mesh,
NULL,
ref.prim_index(),
PRIMITIVE_UNPACK_SEGMENT(ref.prim_type()),
dim,
pos,
left_bounds,
right_bounds);
}
void BVHSpatialSplit::split_object_reference(const Object *object,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds)
{
Mesh *mesh = object->mesh;
for(int tri_idx = 0; tri_idx < mesh->triangles.size(); ++tri_idx) {
split_triangle_primitive(mesh,
&object->tfm,
tri_idx,
dim,
pos,
left_bounds,
right_bounds);
}
for(int curve_idx = 0; curve_idx < mesh->curves.size(); ++curve_idx) {
Mesh::Curve &curve = mesh->curves[curve_idx];
for(int segment_idx = 0;
segment_idx < curve.num_keys - 1;
++segment_idx)
{
split_curve_primitive(mesh,
&object->tfm,
curve_idx,
segment_idx,
dim,
pos,
left_bounds,
right_bounds);
}
}
}
void BVHSpatialSplit::split_reference(BVHBuild *builder,
BVHReference& left,
BVHReference& right,
const BVHReference& ref,
int dim,
float pos)
{
/* initialize boundboxes */
BoundBox left_bounds = BoundBox::empty;
BoundBox right_bounds = BoundBox::empty;
/* loop over vertices/edges. */
Object *ob = builder->objects[ref.prim_object()];
const Mesh *mesh = ob->mesh;
if(ref.prim_type() & PRIMITIVE_ALL_TRIANGLE) {
split_triangle_reference(ref,
mesh,
dim,
pos,
left_bounds,
right_bounds);
}
else if(ref.prim_type() & PRIMITIVE_ALL_CURVE) {
split_curve_reference(ref,
mesh,
dim,
pos,
left_bounds,
right_bounds);
}
else {
split_object_reference(ob,
dim,
pos,
left_bounds,
right_bounds);
}
/* intersect with original bounds. */
left_bounds.max[dim] = pos;

View File

@@ -55,7 +55,58 @@ public:
BVHSpatialSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH);
void split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range);
void split_reference(BVHBuild *builder, BVHReference& left, BVHReference& right, const BVHReference& ref, int dim, float pos);
void split_reference(BVHBuild *builder,
BVHReference& left,
BVHReference& right,
const BVHReference& ref,
int dim,
float pos);
protected:
/* Lower-level functions which calculates boundaries of left and right nodes
* needed for spatial split.
*
* Operates directly with primitive specified by it's index, reused by higher
* level splitting functions.
*/
void split_triangle_primitive(const Mesh *mesh,
const Transform *tfm,
int prim_index,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds);
void split_curve_primitive(const Mesh *mesh,
const Transform *tfm,
int prim_index,
int segment_index,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds);
/* Lower-level functions which calculates boundaries of left and right nodes
* needed for spatial split.
*
* Operates with BVHReference, internally uses lower level API functions.
*/
void split_triangle_reference(const BVHReference& ref,
const Mesh *mesh,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds);
void split_curve_reference(const BVHReference& ref,
const Mesh *mesh,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds);
void split_object_reference(const Object *object,
int dim,
float pos,
BoundBox& left_bounds,
BoundBox& right_bounds);
};
/* Mixed Object-Spatial Split */

View File

@@ -86,6 +86,13 @@ if(CYCLES_STANDALONE_REPOSITORY)
# but don't make it required.
find_package(OpenEXR)
####
# OpenShadingLanguage
if(WITH_CYCLES_OSL)
find_package(OpenShadingLanguage REQUIRED)
find_package(LLVM REQUIRED)
endif()
####
# Boost
set(__boost_packages filesystem regex system thread date_time)
@@ -97,6 +104,8 @@ if(CYCLES_STANDALONE_REPOSITORY)
# libraries works, could be different for someone's else libs..
if(APPLE OR MSVC)
list(APPEND __boost_packages wave)
elseif(NOT (${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6"))
list(APPEND __boost_packages wave)
endif()
endif()
find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED)
@@ -113,13 +122,6 @@ if(CYCLES_STANDALONE_REPOSITORY)
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
####
# OpenShadingLanguage
if(WITH_CYCLES_OSL)
find_package(OpenShadingLanguage REQUIRED)
find_package(LLVM REQUIRED)
endif()
####
# Logging
if(WITH_CYCLES_LOGGING)

View File

@@ -313,7 +313,7 @@ void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
continue;
}
if(!opencl_device_version_check(device_id)) {
FIRST_VLOG(2) << "Ignoting device " << device_name
FIRST_VLOG(2) << "Ignoring device " << device_name
<< " due to old compiler version.";
continue;
}
@@ -327,8 +327,8 @@ void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
&device_type,
NULL) != CL_SUCCESS)
{
FIRST_VLOG(2) << "Ignoting device " << device_name
<< ", faield to fetch device type.";
FIRST_VLOG(2) << "Ignoring device " << device_name
<< ", failed to fetch device type.";
continue;
}
FIRST_VLOG(2) << "Adding new device " << device_name << ".";
@@ -339,7 +339,7 @@ void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
device_name));
}
else {
FIRST_VLOG(2) << "Ignoting device " << device_name
FIRST_VLOG(2) << "Ignoring device " << device_name
<< ", not officially supported yet.";
}
}
@@ -1606,7 +1606,7 @@ protected:
* 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.
* enabled as possible to keep performance at it's max.
*/
return "";
}

View File

@@ -98,7 +98,7 @@ void triangle_intersect_precalc(float3 dir,
}
/* TODO(sergey): Make it general utility function. */
ccl_device_inline float xor_signmast(float x, int y)
ccl_device_inline float xor_signmask(float x, int y)
{
return __int_as_float(__float_as_int(x) ^ y);
}
@@ -140,13 +140,15 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
/* Calculate scaled barycentric coordinates. */
float U = Cx * By - Cy * Bx;
int sign_mask = (__float_as_int(U) & 0x80000000);
float V = Ax * Cy - Ay * Cx;
if(sign_mask != (__float_as_int(V) & 0x80000000)) {
return false;
}
float W = Bx * Ay - By * Ax;
if(sign_mask != (__float_as_int(W) & 0x80000000)) {
const int sign_mask = (__float_as_int(U) & 0x80000000);
/* TODO(sergey): Check if multiplication plus sign check is faster
* or at least same speed (but robust for endian types).
*/
if(sign_mask != (__float_as_int(V) & 0x80000000) ||
sign_mask != (__float_as_int(W) & 0x80000000))
{
return false;
}
@@ -156,13 +158,13 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
return false;
}
/* Calculate scaled zcoordinates of vertices and use them to calculate
/* Calculate scaled z-coordinates of vertices and use them to calculate
* the hit distance.
*/
const float T = (U * A_kz + V * B_kz + W * C_kz) * Sz;
const float sign_T = xor_signmast(T, sign_mask);
const float sign_T = xor_signmask(T, sign_mask);
if((sign_T < 0.0f) ||
(sign_T > isect->t * xor_signmast(det, sign_mask)))
(sign_T > isect->t * xor_signmask(det, sign_mask)))
{
return false;
}
@@ -173,6 +175,16 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
if(kernel_tex_fetch(__prim_visibility, triAddr) & visibility)
#endif
{
#ifdef __KERNEL_GPU__
float4 a = tri_b - tri_a, b = tri_c - tri_a;
if(len_squared(make_float3(a.y*b.z - a.z*b.y,
a.z*b.x - a.x*b.z,
a.x*b.y - a.y*b.x)) == 0.0f)
{
return false;
}
#endif
/* Normalize U, V, W, and T. */
const float inv_det = 1.0f / det;
isect->prim = triAddr;
@@ -253,9 +265,9 @@ ccl_device_inline void triangle_intersect_subsurface(
* the hit distance.
*/
const float T = (U * A_kz + V * B_kz + W * C_kz) * Sz;
const float sign_T = xor_signmast(T, sign_mask);
const float sign_T = xor_signmask(T, sign_mask);
if((sign_T < 0.0f) ||
(sign_T > tmax * xor_signmast(det, sign_mask)))
(sign_T > tmax * xor_signmask(det, sign_mask)))
{
return;
}

View File

@@ -31,6 +31,13 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
float3 throughput = make_float3(1.0f, 1.0f, 1.0f);
bool is_sss_sample = is_sss;
ray.P = sd->P + sd->Ng;
ray.D = -sd->Ng;
ray.t = FLT_MAX;
#ifdef __CAMERA_MOTION__
ray.time = TIME_INVALID;
#endif
/* init radiance */
path_radiance_init(&L_sample, kernel_data.film.use_light_pass);

View File

@@ -144,7 +144,7 @@ template<typename T> struct texture_image {
iy = wrap_periodic(iy, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
@@ -168,16 +168,16 @@ template<typename T> struct texture_image {
niy = wrap_periodic(iy+1, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
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);
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
break;
}
@@ -190,8 +190,8 @@ template<typename T> struct texture_image {
}
else {
/* Bicubic b-spline interpolation. */
const float tx = frac(x*(float)width - 0.5f, &ix);
const float ty = frac(y*(float)height - 0.5f, &iy);
float tx = frac(x*(float)width - 0.5f, &ix);
float ty = frac(y*(float)height - 0.5f, &iy);
int pix, piy, nnix, nniy;
switch(extension) {
case EXTENSION_REPEAT:
@@ -208,14 +208,11 @@ template<typename T> struct texture_image {
nniy = wrap_periodic(iy+2, height);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
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);
@@ -224,6 +221,9 @@ template<typename T> struct texture_image {
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
break;
}
@@ -279,7 +279,7 @@ template<typename T> struct texture_image {
iz = wrap_periodic(iz, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
@@ -308,18 +308,18 @@ template<typename T> struct texture_image {
niz = wrap_periodic(iz+1, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
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);
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
break;
}
@@ -363,15 +363,11 @@ template<typename T> struct texture_image {
nniz = wrap_periodic(iz+2, depth);
break;
case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x >= width || y >= height) {
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
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);
@@ -383,6 +379,10 @@ template<typename T> struct texture_image {
nnix = wrap_clamp(ix+2, width);
nniy = wrap_clamp(iy+2, height);
nniz = wrap_clamp(iz+2, depth);
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
break;
}

View File

@@ -620,7 +620,12 @@ ccl_device void lamp_light_sample(KernelGlobals *kg, int lamp,
}
}
ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D, float t, LightSample *ls)
#if defined(__KERNEL_CUDA__) && (__CUDA_ARCH__ >= 500) && (defined(i386) || defined(_M_IX86))
ccl_device_noinline
#else
ccl_device
#endif
bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D, float t, LightSample *ls)
{
float4 data0 = kernel_tex_fetch(__light_data, lamp*LIGHT_SIZE + 0);
float4 data1 = kernel_tex_fetch(__light_data, lamp*LIGHT_SIZE + 1);

View File

@@ -1036,7 +1036,7 @@ enum QueueNumber {
* 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.
* contributing for direct lighting are enqueued here.
*/
};

View File

@@ -374,7 +374,7 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_homogeneous(KernelGloba
/* distance sampling */
sample_t = kernel_volume_distance_sample(ray->t, sigma_t, channel, xi, &transmittance, &pdf);
/* modifiy pdf for hit/miss decision */
/* modify pdf for hit/miss decision */
if(probalistic_scatter)
pdf *= make_float3(1.0f, 1.0f, 1.0f) - volume_color_transmittance(sigma_t, t);
@@ -422,7 +422,7 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_homogeneous(KernelGloba
/* heterogeneous volume distance sampling: integrate stepping through the
* volume until we reach the end, get absorbed entirely, or run out of
* iterations. this does probalistically scatter or get transmitted through
* iterations. this does probabilistically scatter or get transmitted through
* for path tracing where we don't want to branch. */
ccl_device VolumeIntegrateResult kernel_volume_integrate_heterogeneous_distance(KernelGlobals *kg,
PathState *state, Ray *ray, ShaderData *sd, PathRadiance *L, float3 *throughput, RNG *rng)
@@ -610,7 +610,7 @@ typedef struct VolumeSegment {
/* record volume steps to the end of the volume.
*
* it would be nice if we could only record up to the point that we need to scatter,
* but the entire segment is needed to do always scattering, rather than probalistically
* but the entire segment is needed to do always scattering, rather than probabilistically
* hitting or missing the volume. if we don't know the transmittance at the end of the
* volume we can't generate stratified distance samples up to that transmittance */
ccl_device void kernel_volume_decoupled_record(KernelGlobals *kg, PathState *state,
@@ -766,7 +766,7 @@ ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter(
sd->randb_closure = rphase*3.0f - channel;
float xi = rscatter;
/* probalistic scattering decision based on transmittance */
/* probabilistic scattering decision based on transmittance */
if(probalistic_scatter) {
float sample_transmittance = kernel_volume_channel_get(segment->accum_transmittance, channel);
@@ -846,7 +846,7 @@ ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter(
float3 distance_pdf;
sample_t = prev_t + kernel_volume_distance_sample(step_t, step->sigma_t, channel, xi, &transmittance, &distance_pdf);
/* modifiy pdf for hit/miss decision */
/* modify pdf for hit/miss decision */
if(probalistic_scatter)
distance_pdf *= make_float3(1.0f, 1.0f, 1.0f) - segment->accum_transmittance;
@@ -942,7 +942,7 @@ ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter(
/* decide if we need to use decoupled or not */
ccl_device bool kernel_volume_use_decoupled(KernelGlobals *kg, bool heterogeneous, bool direct, int sampling_method)
{
/* decoupled ray marching for heterogenous volumes not supported on the GPU,
/* decoupled ray marching for heterogeneous volumes not supported on the GPU,
* which also means equiangular and multiple importance sampling is not
* support for that case */
#ifdef __KERNEL_GPU__

View File

@@ -77,7 +77,7 @@ public:
ClosureParam *closure_background_params()
{
static ClosureParam params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_STRING_KEYPARAM(GenericBackgroundClosure, label, "label"),
CLOSURE_FINISH_PARAM(GenericBackgroundClosure)
};
return params;
@@ -98,7 +98,7 @@ CCLOSURE_PREPARE(closure_holdout_prepare, HoldoutClosure)
ClosureParam *closure_ambient_occlusion_params()
{
static ClosureParam params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_STRING_KEYPARAM(AmbientOcclusionClosure, label, "label"),
CLOSURE_FINISH_PARAM(AmbientOcclusionClosure)
};
return params;

View File

@@ -93,7 +93,7 @@ ClosureParam *closure_bsdf_diffuse_ramp_params()
static ClosureParam params[] = {
CLOSURE_FLOAT3_PARAM(DiffuseRampClosure, sc.N),
CLOSURE_COLOR_ARRAY_PARAM(DiffuseRampClosure, colors, 8),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_STRING_KEYPARAM(DiffuseRampClosure, label, "label"),
CLOSURE_FINISH_PARAM(DiffuseRampClosure)
};
return params;

View File

@@ -93,7 +93,7 @@ ClosureParam *closure_bsdf_phong_ramp_params()
CLOSURE_FLOAT3_PARAM(PhongRampClosure, sc.N),
CLOSURE_FLOAT_PARAM(PhongRampClosure, sc.data0),
CLOSURE_COLOR_ARRAY_PARAM(PhongRampClosure, colors, 8),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_STRING_KEYPARAM(PhongRampClosure, label, "label"),
CLOSURE_FINISH_PARAM(PhongRampClosure)
};
return params;

View File

@@ -77,7 +77,7 @@ public:
ClosureParam *closure_emission_params()
{
static ClosureParam params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_STRING_KEYPARAM(GenericEmissiveClosure, label, "label"),
CLOSURE_FINISH_PARAM(GenericEmissiveClosure)
};
return params;

View File

@@ -69,7 +69,7 @@ ClosureParam *closure_bssrdf_cubic_params()
CLOSURE_FLOAT3_PARAM(CubicBSSRDFClosure, radius),
CLOSURE_FLOAT_PARAM(CubicBSSRDFClosure, sc.data1),
CLOSURE_FLOAT_PARAM(CubicBSSRDFClosure, sc.T.x),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_STRING_KEYPARAM(CubicBSSRDFClosure, label, "label"),
CLOSURE_FINISH_PARAM(CubicBSSRDFClosure)
};
return params;
@@ -97,7 +97,7 @@ ClosureParam *closure_bssrdf_gaussian_params()
CLOSURE_FLOAT3_PARAM(GaussianBSSRDFClosure, sc.N),
CLOSURE_FLOAT3_PARAM(GaussianBSSRDFClosure, radius),
CLOSURE_FLOAT_PARAM(GaussianBSSRDFClosure, sc.data1),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_STRING_KEYPARAM(GaussianBSSRDFClosure, label, "label"),
CLOSURE_FINISH_PARAM(GaussianBSSRDFClosure)
};
return params;

View File

@@ -78,6 +78,11 @@ void name(RendererServices *, int id, void *data) \
#define TO_COLOR3(v) OSL::Color3(v.x, v.y, v.z)
#define TO_FLOAT3(v) make_float3(v[0], v[1], v[2])
#if OSL_LIBRARY_VERSION_CODE < 10700
# undef CLOSURE_STRING_KEYPARAM
# define CLOSURE_STRING_KEYPARAM(st, fld, key) { TypeDesc::TypeString, 0, key, 0 }
#endif
/* Closure */
class CClosurePrimitive {
@@ -97,6 +102,10 @@ public:
virtual void setup() {}
Category category;
#if OSL_LIBRARY_VERSION_CODE >= 10700
OSL::ustring label;
#endif
};
/* BSDF */
@@ -175,7 +184,7 @@ static ClosureParam *bsdf_##lower##_params() \
/* parameters */
#define BSDF_CLOSURE_CLASS_END(Upper, lower) \
CLOSURE_STRING_KEYPARAM("label"), \
CLOSURE_STRING_KEYPARAM(Upper##Closure, label, "label"), \
CLOSURE_FINISH_PARAM(Upper##Closure) \
}; \
return params; \
@@ -223,7 +232,7 @@ static ClosureParam *volume_##lower##_params() \
/* parameters */
#define VOLUME_CLOSURE_CLASS_END(Upper, lower) \
CLOSURE_STRING_KEYPARAM("label"), \
CLOSURE_STRING_KEYPARAM(Upper##Closure, label, "label"), \
CLOSURE_FINISH_PARAM(Upper##Closure) \
}; \
return params; \

View File

@@ -104,6 +104,53 @@ public:
const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy,
const OSL::Vec3 &dPdz, int nchannels, float *result);
#if OSL_LIBRARY_VERSION_CODE >= 10700
bool texture(ustring filename,
TextureHandle * /*texture_handle*/,
TexturePerthread * /*texture_thread_info*/,
TextureOpt &options,
OSL::ShaderGlobals *sg,
float s, float t,
float dsdx, float dtdx, float dsdy, float dtdy,
int nchannels,
float *result,
float * /*dresultds*/,
float * /*dresultdt*/)
{
return texture(filename,
options,
sg,
s, t,
dsdx, dtdx, dsdy, dtdy,
nchannels,
result);
}
bool texture3d(ustring filename,
TextureHandle * /*texture_handle*/,
TexturePerthread * /*texture_thread_info*/,
TextureOpt &options,
OSL::ShaderGlobals *sg,
const OSL::Vec3 &P,
const OSL::Vec3 &dPdx,
const OSL::Vec3 &dPdy,
const OSL::Vec3 &dPdz,
int nchannels,
float *result,
float * /*dresultds*/,
float * /*dresultdt*/,
float * /*dresultdr*/)
{
return texture3d(filename,
options,
sg,
P,
dPdx, dPdy, dPdz,
nchannels,
result);
}
#endif
bool environment(ustring filename, TextureOpt &options,
OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy,

View File

@@ -146,165 +146,175 @@ static void flatten_surface_closure_tree(ShaderData *sd, int path_flag,
/* OSL gives us a closure tree, we flatten it into arrays per
* closure type, for evaluation, sampling, etc later on. */
if(closure->type == OSL::ClosureColor::COMPONENT) {
OSL::ClosureComponent *comp = (OSL::ClosureComponent *)closure;
CClosurePrimitive *prim = (CClosurePrimitive *)comp->data();
#if OSL_LIBRARY_VERSION_CODE < 10700
switch(closure->type) {
#else
switch(closure->id) {
#endif
case OSL::ClosureColor::MUL: {
OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
flatten_surface_closure_tree(sd, path_flag, mul->closure, TO_FLOAT3(mul->weight) * weight);
break;
}
case OSL::ClosureColor::ADD: {
OSL::ClosureAdd *add = (OSL::ClosureAdd *)closure;
flatten_surface_closure_tree(sd, path_flag, add->closureA, weight);
flatten_surface_closure_tree(sd, path_flag, add->closureB, weight);
break;
}
default: {
OSL::ClosureComponent *comp = (OSL::ClosureComponent *)closure;
CClosurePrimitive *prim = (CClosurePrimitive *)comp->data();
if(prim) {
ShaderClosure sc;
if(prim) {
ShaderClosure sc;
#ifdef OSL_SUPPORTS_WEIGHTED_CLOSURE_COMPONENTS
weight = weight*TO_FLOAT3(comp->w);
weight = weight*TO_FLOAT3(comp->w);
#endif
sc.weight = weight;
sc.weight = weight;
prim->setup();
prim->setup();
switch (prim->category) {
case CClosurePrimitive::BSDF: {
CBSDFClosure *bsdf = (CBSDFClosure *)prim;
int scattering = bsdf->scattering();
switch(prim->category) {
case CClosurePrimitive::BSDF: {
CBSDFClosure *bsdf = (CBSDFClosure *)prim;
int scattering = bsdf->scattering();
/* caustic options */
if((scattering & LABEL_GLOSSY) && (path_flag & PATH_RAY_DIFFUSE)) {
KernelGlobals *kg = sd->osl_globals;
/* caustic options */
if((scattering & LABEL_GLOSSY) && (path_flag & PATH_RAY_DIFFUSE)) {
KernelGlobals *kg = sd->osl_globals;
if((!kernel_data.integrator.caustics_reflective && (scattering & LABEL_REFLECT)) ||
(!kernel_data.integrator.caustics_refractive && (scattering & LABEL_TRANSMIT))) {
return;
if((!kernel_data.integrator.caustics_reflective && (scattering & LABEL_REFLECT)) ||
(!kernel_data.integrator.caustics_refractive && (scattering & LABEL_TRANSMIT)))
{
return;
}
}
}
/* sample weight */
float sample_weight = fabsf(average(weight));
/* sample weight */
float sample_weight = fabsf(average(weight));
sc.sample_weight = sample_weight;
sc.type = bsdf->sc.type;
sc.N = bsdf->sc.N;
sc.T = bsdf->sc.T;
sc.data0 = bsdf->sc.data0;
sc.data1 = bsdf->sc.data1;
sc.data2 = bsdf->sc.data2;
sc.prim = bsdf->sc.prim;
/* add */
if(sc.sample_weight > CLOSURE_WEIGHT_CUTOFF && sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= bsdf->shaderdata_flag();
}
break;
}
case CClosurePrimitive::Emissive: {
/* sample weight */
float sample_weight = fabsf(average(weight));
sc.sample_weight = sample_weight;
sc.type = CLOSURE_EMISSION_ID;
sc.data0 = 0.0f;
sc.data1 = 0.0f;
sc.data2 = 0.0f;
sc.prim = NULL;
/* flag */
if(sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= SD_EMISSION;
}
break;
}
case CClosurePrimitive::AmbientOcclusion: {
/* sample weight */
float sample_weight = fabsf(average(weight));
sc.sample_weight = sample_weight;
sc.type = CLOSURE_AMBIENT_OCCLUSION_ID;
sc.data0 = 0.0f;
sc.data1 = 0.0f;
sc.data2 = 0.0f;
sc.prim = NULL;
if(sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= SD_AO;
}
break;
}
case CClosurePrimitive::Holdout: {
sc.sample_weight = 0.0f;
sc.type = CLOSURE_HOLDOUT_ID;
sc.data0 = 0.0f;
sc.data1 = 0.0f;
sc.data2 = 0.0f;
sc.prim = NULL;
if(sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= SD_HOLDOUT;
}
break;
}
case CClosurePrimitive::BSSRDF: {
CBSSRDFClosure *bssrdf = (CBSSRDFClosure *)prim;
float sample_weight = fabsf(average(weight));
if(sample_weight > CLOSURE_WEIGHT_CUTOFF && sd->num_closure+2 < MAX_CLOSURE) {
sc.sample_weight = sample_weight;
sc.type = bssrdf->sc.type;
sc.N = bssrdf->sc.N;
sc.data1 = bssrdf->sc.data1;
sc.T.x = bssrdf->sc.T.x;
sc.type = bsdf->sc.type;
sc.N = bsdf->sc.N;
sc.T = bsdf->sc.T;
sc.data0 = bsdf->sc.data0;
sc.data1 = bsdf->sc.data1;
sc.data2 = bsdf->sc.data2;
sc.prim = bsdf->sc.prim;
/* add */
if(sc.sample_weight > CLOSURE_WEIGHT_CUTOFF && sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= bsdf->shaderdata_flag();
}
break;
}
case CClosurePrimitive::Emissive: {
/* sample weight */
float sample_weight = fabsf(average(weight));
sc.sample_weight = sample_weight;
sc.type = CLOSURE_EMISSION_ID;
sc.data0 = 0.0f;
sc.data1 = 0.0f;
sc.data2 = 0.0f;
sc.prim = NULL;
/* disable in case of diffuse ancestor, can't see it well then and
* adds considerably noise due to probabilities of continuing path
* getting lower and lower */
if(path_flag & PATH_RAY_DIFFUSE_ANCESTOR)
bssrdf->radius = make_float3(0.0f, 0.0f, 0.0f);
/* create one closure for each color channel */
if(fabsf(weight.x) > 0.0f) {
sc.weight = make_float3(weight.x, 0.0f, 0.0f);
sc.data0 = bssrdf->radius.x;
sc.data1 = 0.0f;
sd->flag |= bssrdf_setup(&sc, sc.type);
sd->closure[sd->num_closure++] = sc;
}
if(fabsf(weight.y) > 0.0f) {
sc.weight = make_float3(0.0f, weight.y, 0.0f);
sc.data0 = bssrdf->radius.y;
sc.data1 = 0.0f;
sd->flag |= bssrdf_setup(&sc, sc.type);
sd->closure[sd->num_closure++] = sc;
}
if(fabsf(weight.z) > 0.0f) {
sc.weight = make_float3(0.0f, 0.0f, weight.z);
sc.data0 = bssrdf->radius.z;
sc.data1 = 0.0f;
sd->flag |= bssrdf_setup(&sc, sc.type);
/* flag */
if(sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= SD_EMISSION;
}
break;
}
break;
case CClosurePrimitive::AmbientOcclusion: {
/* sample weight */
float sample_weight = fabsf(average(weight));
sc.sample_weight = sample_weight;
sc.type = CLOSURE_AMBIENT_OCCLUSION_ID;
sc.data0 = 0.0f;
sc.data1 = 0.0f;
sc.data2 = 0.0f;
sc.prim = NULL;
if(sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= SD_AO;
}
break;
}
case CClosurePrimitive::Holdout: {
sc.sample_weight = 0.0f;
sc.type = CLOSURE_HOLDOUT_ID;
sc.data0 = 0.0f;
sc.data1 = 0.0f;
sc.data2 = 0.0f;
sc.prim = NULL;
if(sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= SD_HOLDOUT;
}
break;
}
case CClosurePrimitive::BSSRDF: {
CBSSRDFClosure *bssrdf = (CBSSRDFClosure *)prim;
float sample_weight = fabsf(average(weight));
if(sample_weight > CLOSURE_WEIGHT_CUTOFF && sd->num_closure+2 < MAX_CLOSURE) {
sc.sample_weight = sample_weight;
sc.type = bssrdf->sc.type;
sc.N = bssrdf->sc.N;
sc.data1 = bssrdf->sc.data1;
sc.T.x = bssrdf->sc.T.x;
sc.prim = NULL;
/* disable in case of diffuse ancestor, can't see it well then and
* adds considerably noise due to probabilities of continuing path
* getting lower and lower */
if(path_flag & PATH_RAY_DIFFUSE_ANCESTOR)
bssrdf->radius = make_float3(0.0f, 0.0f, 0.0f);
/* create one closure for each color channel */
if(fabsf(weight.x) > 0.0f) {
sc.weight = make_float3(weight.x, 0.0f, 0.0f);
sc.data0 = bssrdf->radius.x;
sc.data1 = 0.0f;
sd->flag |= bssrdf_setup(&sc, sc.type);
sd->closure[sd->num_closure++] = sc;
}
if(fabsf(weight.y) > 0.0f) {
sc.weight = make_float3(0.0f, weight.y, 0.0f);
sc.data0 = bssrdf->radius.y;
sc.data1 = 0.0f;
sd->flag |= bssrdf_setup(&sc, sc.type);
sd->closure[sd->num_closure++] = sc;
}
if(fabsf(weight.z) > 0.0f) {
sc.weight = make_float3(0.0f, 0.0f, weight.z);
sc.data0 = bssrdf->radius.z;
sc.data1 = 0.0f;
sd->flag |= bssrdf_setup(&sc, sc.type);
sd->closure[sd->num_closure++] = sc;
}
}
break;
}
case CClosurePrimitive::Background:
case CClosurePrimitive::Volume:
break; /* not relevant */
}
case CClosurePrimitive::Background:
case CClosurePrimitive::Volume:
break; /* not relevant */
}
break;
}
}
else if(closure->type == OSL::ClosureColor::MUL) {
OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
flatten_surface_closure_tree(sd, path_flag, mul->closure, TO_FLOAT3(mul->weight) * weight);
}
else if(closure->type == OSL::ClosureColor::ADD) {
OSL::ClosureAdd *add = (OSL::ClosureAdd *)closure;
flatten_surface_closure_tree(sd, path_flag, add->closureA, weight);
flatten_surface_closure_tree(sd, path_flag, add->closureB, weight);
}
}
void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, int path_flag, ShaderContext ctx)
@@ -335,27 +345,33 @@ static float3 flatten_background_closure_tree(const OSL::ClosureColor *closure)
* is only one supported closure type at the moment, which has no evaluation
* functions, so we just sum the weights */
if(closure->type == OSL::ClosureColor::COMPONENT) {
OSL::ClosureComponent *comp = (OSL::ClosureComponent *)closure;
CClosurePrimitive *prim = (CClosurePrimitive *)comp->data();
if(prim && prim->category == CClosurePrimitive::Background)
#ifdef OSL_SUPPORTS_WEIGHTED_CLOSURE_COMPONENTS
return TO_FLOAT3(comp->w);
#if OSL_LIBRARY_VERSION_CODE < 10700
switch(closure->type) {
#else
return make_float3(1.0f, 1.0f, 1.0f);
switch(closure->id) {
#endif
}
else if(closure->type == OSL::ClosureColor::MUL) {
OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
case OSL::ClosureColor::MUL: {
OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
return TO_FLOAT3(mul->weight) * flatten_background_closure_tree(mul->closure);
}
else if(closure->type == OSL::ClosureColor::ADD) {
OSL::ClosureAdd *add = (OSL::ClosureAdd *)closure;
return TO_FLOAT3(mul->weight) * flatten_background_closure_tree(mul->closure);
}
case OSL::ClosureColor::ADD: {
OSL::ClosureAdd *add = (OSL::ClosureAdd *)closure;
return flatten_background_closure_tree(add->closureA) +
flatten_background_closure_tree(add->closureB);
return flatten_background_closure_tree(add->closureA) +
flatten_background_closure_tree(add->closureB);
}
default: {
OSL::ClosureComponent *comp = (OSL::ClosureComponent *)closure;
CClosurePrimitive *prim = (CClosurePrimitive *)comp->data();
if(prim && prim->category == CClosurePrimitive::Background)
#ifdef OSL_SUPPORTS_WEIGHTED_CLOSURE_COMPONENTS
return TO_FLOAT3(comp->w);
#else
return make_float3(1.0f, 1.0f, 1.0f);
#endif
}
}
return make_float3(0.0f, 0.0f, 0.0f);
@@ -390,76 +406,84 @@ static void flatten_volume_closure_tree(ShaderData *sd,
/* OSL gives us a closure tree, we flatten it into arrays per
* closure type, for evaluation, sampling, etc later on. */
if(closure->type == OSL::ClosureColor::COMPONENT) {
OSL::ClosureComponent *comp = (OSL::ClosureComponent *)closure;
CClosurePrimitive *prim = (CClosurePrimitive *)comp->data();
#if OSL_LIBRARY_VERSION_CODE < 10700
switch(closure->type) {
#else
switch(closure->id) {
#endif
case OSL::ClosureColor::MUL: {
OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
flatten_volume_closure_tree(sd, mul->closure, TO_FLOAT3(mul->weight) * weight);
break;
}
case OSL::ClosureColor::ADD: {
OSL::ClosureAdd *add = (OSL::ClosureAdd *)closure;
flatten_volume_closure_tree(sd, add->closureA, weight);
flatten_volume_closure_tree(sd, add->closureB, weight);
break;
}
default: {
OSL::ClosureComponent *comp = (OSL::ClosureComponent *)closure;
CClosurePrimitive *prim = (CClosurePrimitive *)comp->data();
if(prim) {
ShaderClosure sc;
if(prim) {
ShaderClosure sc;
#ifdef OSL_SUPPORTS_WEIGHTED_CLOSURE_COMPONENTS
weight = weight*TO_FLOAT3(comp->w);
weight = weight*TO_FLOAT3(comp->w);
#endif
sc.weight = weight;
sc.weight = weight;
prim->setup();
prim->setup();
switch (prim->category) {
case CClosurePrimitive::Volume: {
CVolumeClosure *volume = (CVolumeClosure *)prim;
/* sample weight */
float sample_weight = fabsf(average(weight));
switch(prim->category) {
case CClosurePrimitive::Volume: {
CVolumeClosure *volume = (CVolumeClosure *)prim;
/* sample weight */
float sample_weight = fabsf(average(weight));
sc.sample_weight = sample_weight;
sc.type = volume->sc.type;
sc.data0 = volume->sc.data0;
sc.data1 = volume->sc.data1;
sc.sample_weight = sample_weight;
sc.type = volume->sc.type;
sc.data0 = volume->sc.data0;
sc.data1 = volume->sc.data1;
/* add */
if((sc.sample_weight > CLOSURE_WEIGHT_CUTOFF) &&
(sd->num_closure < MAX_CLOSURE))
{
sd->closure[sd->num_closure++] = sc;
sd->flag |= volume->shaderdata_flag();
/* add */
if((sc.sample_weight > CLOSURE_WEIGHT_CUTOFF) &&
(sd->num_closure < MAX_CLOSURE))
{
sd->closure[sd->num_closure++] = sc;
sd->flag |= volume->shaderdata_flag();
}
break;
}
break;
}
case CClosurePrimitive::Emissive: {
/* sample weight */
float sample_weight = fabsf(average(weight));
case CClosurePrimitive::Emissive: {
/* sample weight */
float sample_weight = fabsf(average(weight));
sc.sample_weight = sample_weight;
sc.type = CLOSURE_EMISSION_ID;
sc.data0 = 0.0f;
sc.data1 = 0.0f;
sc.prim = NULL;
sc.sample_weight = sample_weight;
sc.type = CLOSURE_EMISSION_ID;
sc.data0 = 0.0f;
sc.data1 = 0.0f;
sc.prim = NULL;
/* flag */
if(sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= SD_EMISSION;
/* flag */
if(sd->num_closure < MAX_CLOSURE) {
sd->closure[sd->num_closure++] = sc;
sd->flag |= SD_EMISSION;
}
break;
}
break;
case CClosurePrimitive::Holdout:
break; /* not implemented */
case CClosurePrimitive::Background:
case CClosurePrimitive::BSDF:
case CClosurePrimitive::BSSRDF:
case CClosurePrimitive::AmbientOcclusion:
break; /* not relevant */
}
case CClosurePrimitive::Holdout:
break; /* not implemented */
case CClosurePrimitive::Background:
case CClosurePrimitive::BSDF:
case CClosurePrimitive::BSSRDF:
case CClosurePrimitive::AmbientOcclusion:
break; /* not relevant */
}
}
}
else if(closure->type == OSL::ClosureColor::MUL) {
OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
flatten_volume_closure_tree(sd, mul->closure, TO_FLOAT3(mul->weight) * weight);
}
else if(closure->type == OSL::ClosureColor::ADD) {
OSL::ClosureAdd *add = (OSL::ClosureAdd *)closure;
flatten_volume_closure_tree(sd, add->closureA, weight);
flatten_volume_closure_tree(sd, add->closureB, weight);
}
}
void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, int path_flag, ShaderContext ctx)

View File

@@ -22,6 +22,7 @@
float brick_noise(int n) /* fast integer noise */
{
int nn;
n = (n + 1013) & 2147483647;
n = (n >> 13) ^ n;
nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 2147483647;
return 0.5 * ((float)nn / 1073741824.0);

View File

@@ -31,7 +31,7 @@
* Un-initialized Ray --------------| |--- Initialized Ray
* Un-initialized PathState --------| |--- Initialized PathState
* Un-initialized QueueData --------| |--- Initialized QueueData (to QUEUE_EMPTY_SLOT)
* Un-initilaized QueueIndex -------| |--- Initialized QueueIndex (to 0)
* Un-initialized QueueIndex -------| |--- Initialized QueueIndex (to 0)
* Un-initialized use_queues_flag---| |--- Initialized use_queues_flag (to false)
* Un-initialized ray_state --------| |--- Initialized ray_state
* parallel_samples --------------- | |--- Initialized per_sample_output_buffers
@@ -383,7 +383,7 @@ ccl_device void kernel_data_init(
&Ray_coop[ray_index]);
if(Ray_coop[ray_index].t != 0.0f) {
/* Initialize throuput, L_transparent, Ray, PathState;
/* Initialize throughput, L_transparent, Ray, PathState;
* These rays proceed with path-iteration.
*/
throughput_coop[ray_index] = make_float3(1.0f, 1.0f, 1.0f);

View File

@@ -21,6 +21,7 @@ CCL_NAMESPACE_BEGIN
ccl_device_noinline float brick_noise(int n) /* fast integer noise */
{
int nn;
n = (n + 1013) & 0x7fffffff;
n = (n >> 13) ^ n;
nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
return 0.5f * ((float)nn / 1073741824.0f);

View File

@@ -63,6 +63,9 @@ ccl_device_inline ShaderClosure *svm_node_closure_get_non_bsdf(ShaderData *sd, C
if(ccl_fetch(sd, num_closure) < MAX_CLOSURE) {
sc->weight *= mix_weight;
sc->type = type;
sc->data0 = 0.0f;
sc->data1 = 0.0f;
sc->data2 = 0.0f;
#ifdef __OSL__
sc->prim = NULL;
#endif

View File

@@ -46,7 +46,7 @@ CCL_NAMESPACE_BEGIN
#define NODE_FEATURE_HAIR (1 << 1)
#define NODE_FEATURE_BUMP (1 << 2)
/* TODO(sergey): Consider using something like ((uint)(-1)).
* Need to ceck carefully operand types around usage of this
* Need to check carefully operand types around usage of this
* define first.
*/
#define NODE_FEATURE_ALL (NODE_FEATURE_VOLUME|NODE_FEATURE_HAIR|NODE_FEATURE_BUMP)

View File

@@ -53,6 +53,7 @@ Camera::Camera()
longitude_min = -M_PI_F;
longitude_max = M_PI_F;
fov = M_PI_4_F;
fov_pre = fov_post = fov;
sensorwidth = 0.036f;
sensorheight = 0.024f;
@@ -91,19 +92,26 @@ Camera::~Camera()
void Camera::compute_auto_viewplane()
{
float aspect = (float)width/(float)height;
if(width >= height) {
viewplane.left = -aspect;
viewplane.right = aspect;
viewplane.bottom = -1.0f;
if(type == CAMERA_PANORAMA) {
viewplane.left = 0.0f;
viewplane.right = 1.0f;
viewplane.bottom = 0.0f;
viewplane.top = 1.0f;
}
else {
viewplane.left = -1.0f;
viewplane.right = 1.0f;
viewplane.bottom = -1.0f/aspect;
viewplane.top = 1.0f/aspect;
float aspect = (float)width/(float)height;
if(width >= height) {
viewplane.left = -aspect;
viewplane.right = aspect;
viewplane.bottom = -1.0f;
viewplane.top = 1.0f;
}
else {
viewplane.left = -1.0f;
viewplane.right = 1.0f;
viewplane.bottom = -1.0f/aspect;
viewplane.top = 1.0f/aspect;
}
}
}
@@ -417,9 +425,9 @@ BoundBox Camera::viewplane_bounds_get()
BoundBox bounds = BoundBox::empty;
if(type == CAMERA_PANORAMA) {
bounds.grow(make_float3(cameratoworld.w.x,
cameratoworld.w.y,
cameratoworld.w.z));
bounds.grow(make_float3(cameratoworld.x.w,
cameratoworld.y.w,
cameratoworld.z.w));
}
else {
bounds.grow(transform_raster_to_world(0.0f, 0.0f));

View File

@@ -144,7 +144,13 @@ void Pass::add(PassType type, vector<Pass>& passes)
pass.exposure = false;
break;
case PASS_LIGHT:
/* ignores */
/* This isn't a real pass, used by baking to see whether
* light data is needed or not.
*
* Set components to 0 so pass sort below happens in a
* determined way.
*/
pass.components = 0;
break;
#ifdef WITH_CYCLES_DEBUG
case PASS_BVH_TRAVERSAL_STEPS:

View File

@@ -336,6 +336,8 @@ void ShaderGraph::remove_unneeded_nodes()
vector<bool> removed(num_node_ids, false);
bool any_node_removed = false;
ShaderNode *geom = NULL;
/* find and unlink proxy nodes */
foreach(ShaderNode *node, nodes) {
if(node->special_type == SHADER_SPECIAL_TYPE_PROXY) {
@@ -423,12 +425,19 @@ void ShaderGraph::remove_unneeded_nodes()
BumpNode *bump = static_cast<BumpNode*>(node);
if(bump->outputs[0]->links.size()) {
/* Height input not connected */
/* ToDo: Strength zero? */
if(!bump->inputs[0]->link) {
/* Height inputs is not connected. */
/* TODO(sergey): Ignore bump with zero strength. */
if(bump->inputs[0]->link == NULL) {
vector<ShaderInput*> inputs = bump->outputs[0]->links;
relink(bump->inputs, inputs, NULL);
if(bump->inputs[4]->link == NULL) {
if(geom == NULL) {
geom = new GeometryNode();
}
relink(bump->inputs, inputs, geom->output("Normal"));
}
else {
relink(bump->inputs, inputs, bump->input("Normal")->link);
}
removed[bump->id] = true;
any_node_removed = true;
}
@@ -511,6 +520,10 @@ void ShaderGraph::remove_unneeded_nodes()
nodes = newnodes;
}
if(geom != NULL) {
add(geom);
}
}
void ShaderGraph::break_cycles(ShaderNode *node, vector<bool>& visited, vector<bool>& on_stack)

View File

@@ -100,6 +100,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
* transparent shaders in the scene. Otherwise we can disable it
* to improve performance a bit. */
if(transparent_shadows) {
kintegrator->transparent_shadows = false;
foreach(Shader *shader, scene->shaders) {
/* keep this in sync with SD_HAS_TRANSPARENT_SHADOW in shader.cpp */
if((shader->has_surface_transparent && shader->use_transparent_shadow) || shader->has_volume) {

View File

@@ -513,7 +513,6 @@ void Mesh::compute_bvh(SceneParams *params, Progress *progress, int n, int total
progress->set_status(msg, "Building BVH");
BVHParams bparams;
bparams.use_cache = params->use_bvh_cache;
bparams.use_spatial_split = params->use_bvh_spatial_split;
bparams.use_qbvh = params->use_qbvh;
@@ -1084,7 +1083,6 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
bparams.top_level = true;
bparams.use_qbvh = scene->params.use_qbvh;
bparams.use_spatial_split = scene->params.use_bvh_spatial_split;
bparams.use_cache = scene->params.use_bvh_cache;
delete bvh;
bvh = BVH::create(bparams, scene->objects);

View File

@@ -18,6 +18,7 @@
#include "camera.h"
#include "device.h"
#include "graph.h"
#include "integrator.h"
#include "light.h"
#include "mesh.h"
#include "nodes.h"
@@ -338,6 +339,7 @@ void ShaderManager::device_update_common(Device *device,
uint *shader_flag = dscene->shader_flag.resize(shader_flag_size);
uint i = 0;
bool has_volumes = false;
bool has_transparent_shadow = false;
foreach(Shader *shader, scene->shaders) {
uint flag = 0;
@@ -355,8 +357,8 @@ void ShaderManager::device_update_common(Device *device,
flag |= SD_HAS_ONLY_VOLUME;
/* todo: this could check more fine grained, to skip useless volumes
* enclosed inside an opaque bsdf, although we still need to handle
* the case with camera inside volumes too */
* enclosed inside an opaque bsdf.
*/
flag |= SD_HAS_TRANSPARENT_SHADOW;
}
if(shader->heterogeneous_volume && shader->has_heterogeneous_volume)
@@ -382,6 +384,8 @@ void ShaderManager::device_update_common(Device *device,
shader_flag[i++] = flag;
shader_flag[i++] = shader->pass_id;
has_transparent_shadow |= (flag & SD_HAS_TRANSPARENT_SHADOW);
}
device->tex_alloc("__shader_flag", dscene->shader_flag);
@@ -404,6 +408,10 @@ void ShaderManager::device_update_common(Device *device,
/* integrator */
KernelIntegrator *kintegrator = &dscene->data.integrator;
kintegrator->use_volumes = has_volumes;
/* TODO(sergey): De-duplicate with flags set in integrator.cpp. */
if(scene->integrator->transparent_shadows) {
kintegrator->transparent_shadows = has_transparent_shadow;
}
}
void ShaderManager::device_free_common(Device *device, DeviceScene *dscene, Scene *scene)

View File

@@ -105,6 +105,7 @@ public:
{
data = NULL;
datasize = 0;
capacity = 0;
}
array(size_t newsize)
@@ -112,10 +113,12 @@ public:
if(newsize == 0) {
data = NULL;
datasize = 0;
capacity = 0;
}
else {
data = (T*)util_aligned_malloc(sizeof(T)*newsize, alignment);
datasize = newsize;
capacity = datasize;
}
}
@@ -129,11 +132,13 @@ public:
if(from.datasize == 0) {
data = NULL;
datasize = 0;
capacity = 0;
}
else {
data = (T*)util_aligned_malloc(sizeof(T)*from.datasize, alignment);
memcpy(data, from.data, from.datasize*sizeof(T));
datasize = from.datasize;
capacity = datasize;
}
return *this;
@@ -142,6 +147,7 @@ public:
array& operator=(const vector<T>& from)
{
datasize = from.size();
capacity = datasize;
data = NULL;
if(datasize > 0) {
@@ -163,13 +169,15 @@ public:
clear();
}
else if(newsize != datasize) {
T *newdata = (T*)util_aligned_malloc(sizeof(T)*newsize, alignment);
if(data) {
memcpy(newdata, data, ((datasize < newsize)? datasize: newsize)*sizeof(T));
util_aligned_free(data);
if(newsize > capacity) {
T *newdata = (T*)util_aligned_malloc(sizeof(T)*newsize, alignment);
if(data) {
memcpy(newdata, data, ((datasize < newsize)? datasize: newsize)*sizeof(T));
util_aligned_free(data);
}
data = newdata;
capacity = newsize;
}
data = newdata;
datasize = newsize;
}
}
@@ -179,6 +187,7 @@ public:
util_aligned_free(data);
data = NULL;
datasize = 0;
capacity = 0;
}
size_t size() const
@@ -192,9 +201,22 @@ public:
return data[i];
}
void reserve(size_t newcapacity) {
if(newcapacity > capacity) {
T *newdata = (T*)util_aligned_malloc(sizeof(T)*newcapacity, alignment);
if(data) {
memcpy(newdata, data, ((datasize < newcapacity)? datasize: newcapacity)*sizeof(T));
util_aligned_free(data);
}
data = newdata;
capacity = newcapacity;
}
}
protected:
T *data;
size_t datasize;
size_t capacity;
};
CCL_NAMESPACE_END

View File

@@ -358,27 +358,20 @@ GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
int bounds[4], const int mouse_ungrab_xy[2])
{
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
GHOST_Rect bounds_rect, bounds_win;
GHOST_TInt32 mouse_ungrab_xy_global[2];
GHOST_Rect bounds_rect;
GHOST_TInt32 mouse_xy[2];
if (bounds) {
/* if this is X11 specific we need a function that converts */
window->getClientBounds(bounds_win);
window->clientToScreen(bounds[0], bounds_win.getHeight() - bounds[1], bounds_rect.m_l, bounds_rect.m_t);
window->clientToScreen(bounds[2], bounds_win.getHeight() - bounds[3], bounds_rect.m_r, bounds_rect.m_b);
bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]);
}
if (mouse_ungrab_xy) {
if (bounds == NULL)
window->getClientBounds(bounds_win);
window->clientToScreen(mouse_ungrab_xy[0], bounds_win.getHeight() - mouse_ungrab_xy[1],
mouse_ungrab_xy_global[0], mouse_ungrab_xy_global[1]);
mouse_xy[0] = mouse_ungrab_xy[0];
mouse_xy[1] = mouse_ungrab_xy[1];
}
return window->setCursorGrab(mode,
bounds ? &bounds_rect : NULL,
mouse_ungrab_xy ? mouse_ungrab_xy_global : NULL);
mouse_ungrab_xy ? mouse_xy : NULL);
}

View File

@@ -246,6 +246,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
if (framebuffer_config) {
m_context = glXCreateContextAttribsARB(m_display, framebuffer_config[0], s_sharedContext, True, attribs);
XFree(framebuffer_config);
}
}
else {
@@ -404,5 +405,7 @@ int GHOST_X11_GL_GetAttributes(
GHOST_ASSERT(i <= attribs_max, "attribute size too small");
(void)attribs_max;
return i;
}

View File

@@ -117,7 +117,7 @@ getDisplaySetting(
if (dpy == NULL)
return GHOST_kFailure;
(void) display;
(void)display;
#ifdef WITH_X11_XF86VMODE
int majorVersion, minorVersion;
@@ -149,6 +149,7 @@ getDisplaySetting(
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
(void)index;
setting.xPixels = DisplayWidth(dpy, DefaultScreen(dpy));
setting.yPixels = DisplayHeight(dpy, DefaultScreen(dpy));
@@ -267,6 +268,8 @@ setCurrentDisplaySetting(
return GHOST_kSuccess;
#else
(void)setting;
/* Just pretend the request was successful. */
return GHOST_kSuccess;
#endif

View File

@@ -1317,6 +1317,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y;
window->getCursorGrabInitPos(x_warp, y_warp);
window->screenToClientIntern(x_warp, y_warp, x_warp, y_warp);
window->getCursorGrabAccum(x_accum, y_accum);
x_accum += [event deltaX];
@@ -1368,6 +1369,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
//Post event
window->getCursorGrabInitPos(x_cur, y_cur);
window->screenToClientIntern(x_cur, y_cur, x_cur, y_cur);
window->clientToScreenIntern(x_cur + x_accum, y_cur + y_accum, x, y);
pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
break;

View File

@@ -1195,18 +1195,18 @@ GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType ty
#if defined(WITH_GL_PROFILE_CORE)
GHOST_Context *context = new GHOST_ContextCGL(
m_initStereoVisual,
m_initNumOfAASamples,
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_openGLView,
CGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
GL_CONTEXT_CORE_PROFILE_BIT,
3, 2,
GHOST_OPENGL_CGL_CONTEXT_FLAGS,
GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY);
#elif defined(WITH_GL_PROFILE_ES20)
GHOST_Context *context = new GHOST_ContextCGL(
m_initStereoVisual,
m_initNumOfAASamples,
m_wantStereoVisual,
m_wantNumOfAASamples,
m_window,
m_openGLView,
CGL_CONTEXT_ES2_PROFILE_BIT_EXT,
@@ -1463,12 +1463,9 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
if (mode != GHOST_kGrabDisable) {
//No need to perform grab without warp as it is always on in OS X
if (mode != GHOST_kGrabNormal) {
GHOST_TInt32 x_old,y_old;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
m_systemCocoa->getCursorPosition(x_old,y_old);
screenToClientIntern(x_old, y_old, m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
//Warp position is stored in client (window base) coordinates
m_systemCocoa->getCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
setCursorGrabAccum(0, 0);
if (mode == GHOST_kGrabHide) {
@@ -1486,7 +1483,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
}
else {
if (m_cursorGrab==GHOST_kGrabHide) {
//No need to set again cursor position, as it has not changed for Cocoa
m_systemCocoa->setCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
setWindowCursorVisibility(true);
}

View File

@@ -292,6 +292,7 @@ void IK_SolverAddGoal(IK_Solver *solver, IK_Segment *tip, float goal[3], float w
IK_QSolver *qsolver = (IK_QSolver *)solver;
IK_QSegment *qtip = (IK_QSegment *)tip;
// in case of composite segment the second segment is the tip
if (qtip->Composite())
qtip = qtip->Composite();
@@ -310,6 +311,7 @@ void IK_SolverAddGoalOrientation(IK_Solver *solver, IK_Segment *tip, float goal[
IK_QSolver *qsolver = (IK_QSolver *)solver;
IK_QSegment *qtip = (IK_QSegment *)tip;
// in case of composite segment the second segment is the tip
if (qtip->Composite())
qtip = qtip->Composite();
@@ -331,6 +333,10 @@ void IK_SolverSetPoleVectorConstraint(IK_Solver *solver, IK_Segment *tip, float
IK_QSolver *qsolver = (IK_QSolver *)solver;
IK_QSegment *qtip = (IK_QSegment *)tip;
// in case of composite segment the second segment is the tip
if (qtip->Composite())
qtip = qtip->Composite();
MT_Vector3 qgoal(goal);
MT_Vector3 qpolegoal(polegoal);

View File

@@ -47,7 +47,6 @@ set(SRC
opensubdiv_device_context_cuda.h
opensubdiv_device_context_opencl.h
opensubdiv_intern.h
opensubdiv_partitioned.h
)
if(WITH_SUBSURF_WERROR)

View File

@@ -28,6 +28,7 @@
#extension GL_EXT_geometry_shader4 : enable
#extension GL_ARB_gpu_shader5 : enable
#extension GL_ARB_explicit_attrib_location : require
#extension GL_ARB_uniform_buffer_object : require
struct VertexData {
vec4 position;
@@ -51,6 +52,10 @@ void main()
{
outpt.v.position = modelViewMatrix * position;
outpt.v.normal = normalize(normalMatrix * normal);
/* Some compilers expects gl_Position to be written.
* It's not needed once we explicitly switch to GLSL 1.40 or above.
*/
gl_Position = outpt.v.position;
}
#endif /* VERTEX_SHADER */
@@ -197,15 +202,17 @@ struct LightSource {
vec4 diffuse;
vec4 specular;
vec4 spotDirection;
#ifdef SUPPORT_COLOR_MATERIAL
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
float spotCutoff;
float spotExponent;
float spotCosCutoff;
#endif
};
uniform Lighting {
layout(std140) uniform Lighting {
LightSource lightSource[MAX_LIGHTS];
int num_enabled_lights;
};

View File

@@ -30,6 +30,7 @@
# include "iso646.h"
#endif
#include <stdlib.h>
#include <GL/glew.h>
#include <opensubdiv/osd/glMesh.h>
@@ -68,7 +69,6 @@
#include <opensubdiv/far/stencilTable.h>
#include "opensubdiv_intern.h"
#include "opensubdiv_partitioned.h"
#include "MEM_guardedalloc.h"
@@ -80,22 +80,22 @@ using OpenSubdiv::Osd::MeshBitset;
using OpenSubdiv::Far::StencilTable;
using OpenSubdiv::Osd::GLPatchTable;
using OpenSubdiv::Osd::PartitionedMesh;
using OpenSubdiv::Osd::Mesh;
/* CPU backend */
using OpenSubdiv::Osd::CpuGLVertexBuffer;
using OpenSubdiv::Osd::CpuEvaluator;
typedef PartitionedMesh<CpuGLVertexBuffer,
StencilTable,
CpuEvaluator,
GLPatchTable> OsdCpuMesh;
typedef Mesh<CpuGLVertexBuffer,
StencilTable,
CpuEvaluator,
GLPatchTable> OsdCpuMesh;
#ifdef OPENSUBDIV_HAS_OPENMP
using OpenSubdiv::Osd::OmpEvaluator;
typedef PartitionedMesh<CpuGLVertexBuffer,
StencilTable,
OmpEvaluator,
GLPatchTable> OsdOmpMesh;
typedef Mesh<CpuGLVertexBuffer,
StencilTable,
OmpEvaluator,
GLPatchTable> OsdOmpMesh;
#endif /* OPENSUBDIV_HAS_OPENMP */
#ifdef OPENSUBDIV_HAS_OPENCL
@@ -103,11 +103,11 @@ using OpenSubdiv::Osd::CLEvaluator;
using OpenSubdiv::Osd::CLGLVertexBuffer;
using OpenSubdiv::Osd::CLStencilTable;
/* TODO(sergey): Use CLDeviceCOntext similar to OSD examples? */
typedef PartitionedMesh<CLGLVertexBuffer,
CLStencilTable,
CLEvaluator,
GLPatchTable,
CLDeviceContext> OsdCLMesh;
typedef Mesh<CLGLVertexBuffer,
CLStencilTable,
CLEvaluator,
GLPatchTable,
CLDeviceContext> OsdCLMesh;
static CLDeviceContext g_clDeviceContext;
#endif /* OPENSUBDIV_HAS_OPENCL */
@@ -115,10 +115,10 @@ static CLDeviceContext g_clDeviceContext;
using OpenSubdiv::Osd::CudaEvaluator;
using OpenSubdiv::Osd::CudaGLVertexBuffer;
using OpenSubdiv::Osd::CudaStencilTable;
typedef PartitionedMesh<CudaGLVertexBuffer,
CudaStencilTable,
CudaEvaluator,
GLPatchTable> OsdCudaMesh;
typedef Mesh<CudaGLVertexBuffer,
CudaStencilTable,
CudaEvaluator,
GLPatchTable> OsdCudaMesh;
static CudaDeviceContext g_cudaDeviceContext;
#endif /* OPENSUBDIV_HAS_CUDA */
@@ -126,20 +126,20 @@ static CudaDeviceContext g_cudaDeviceContext;
using OpenSubdiv::Osd::GLXFBEvaluator;
using OpenSubdiv::Osd::GLStencilTableTBO;
using OpenSubdiv::Osd::GLVertexBuffer;
typedef PartitionedMesh<GLVertexBuffer,
GLStencilTableTBO,
GLXFBEvaluator,
GLPatchTable> OsdGLSLTransformFeedbackMesh;
typedef Mesh<GLVertexBuffer,
GLStencilTableTBO,
GLXFBEvaluator,
GLPatchTable> OsdGLSLTransformFeedbackMesh;
#endif /* OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK */
#ifdef OPENSUBDIV_HAS_GLSL_COMPUTE
using OpenSubdiv::Osd::GLComputeEvaluator;
using OpenSubdiv::Osd::GLStencilTableSSBO;
using OpenSubdiv::Osd::GLVertexBuffer;
typedef PartitionedMesh<GLVertexBuffer,
GLStencilTableSSBO,
GLComputeEvaluator,
GLPatchTable> OsdGLSLComputeMesh;
typedef Mesh<GLVertexBuffer,
GLStencilTableSSBO,
GLComputeEvaluator,
GLPatchTable> OsdGLSLComputeMesh;
#endif
struct OpenSubdiv_GLMesh *openSubdiv_createOsdGLMeshFromTopologyRefiner(
@@ -156,14 +156,12 @@ struct OpenSubdiv_GLMesh *openSubdiv_createOsdGLMeshFromTopologyRefiner(
*/
bits.set(OpenSubdiv::Osd::MeshAdaptive, 0);
bits.set(OpenSubdiv::Osd::MeshUseSingleCreasePatch, 0);
bits.set(OpenSubdiv::Osd::MeshInterleaveVarying, 0);
bits.set(OpenSubdiv::Osd::MeshInterleaveVarying, 1);
bits.set(OpenSubdiv::Osd::MeshFVarData, 1);
bits.set(OpenSubdiv::Osd::MeshEndCapBSplineBasis, 1);
// bits.set(Osd::MeshEndCapGregoryBasis, 1);
// bits.set(Osd::MeshEndCapLegacyGregory, 1);
const int num_vertex_elements = 6;
const int num_varying_elements = 0;
const int num_vertex_elements = 3;
const int num_varying_elements = 3;
GLMeshInterface *mesh = NULL;
TopologyRefiner *refiner = (TopologyRefiner*)topology_refiner;
@@ -297,7 +295,29 @@ const struct OpenSubdiv_TopologyRefinerDescr *openSubdiv_getGLMeshTopologyRefine
int openSubdiv_supportGPUDisplay(void)
{
return GL_EXT_geometry_shader4 &&
GL_ARB_gpu_shader5 &&
glProgramParameteriEXT;
{
/* Currently Intel GPUs has hard time working on Windows.
*
* For until we've got access to a hardware which demonstrates
* the issue we disable OpenSubdiv on Intel GPUs.
*/
static bool vendor_checked = false;
static bool is_intel = false;
if (!vendor_checked) {
vendor_checked = true;
const char *vendor = (const char *)glGetString(GL_VENDOR);
if (vendor != NULL && strstr(vendor, "Intel")) {
if(getenv("OPENSUBDIV_ALLOW_INTEL") == NULL) {
is_intel = true;
}
}
}
if (is_intel) {
return false;
}
}
return GLEW_EXT_geometry_shader4 &&
GLEW_ARB_gpu_shader5 &&
GLEW_ARB_uniform_buffer_object;
}

View File

@@ -85,7 +85,7 @@ const struct OpenSubdiv_TopologyRefinerDescr *openSubdiv_getGLMeshTopologyRefine
OpenSubdiv_GLMesh *gl_mesh);
/* ** Initialize/Deinitialize global OpenGL drawing buffers/GLSL programs ** */
void openSubdiv_osdGLDisplayInit(void);
bool openSubdiv_osdGLDisplayInit(void);
void openSubdiv_osdGLDisplayDeinit(void);
/* ** Evaluator API ** */
@@ -132,15 +132,16 @@ void openSubdiv_evaluateVarying(OpenSubdiv_EvaluatorDescr *evaluator_descr,
void openSubdiv_osdGLMeshDisplayPrepare(int use_osd_glsl,
int active_uv_index);
/* Draw patches which corresponds to a given partition. */
/* Draw specified patches. */
void openSubdiv_osdGLMeshDisplay(OpenSubdiv_GLMesh *gl_mesh,
int fill_quads,
int start_partition,
int num_partitions);
int start_patch,
int num_patches);
/* ** Utility functions ** */
int openSubdiv_supportGPUDisplay(void);
int openSubdiv_getAvailableEvaluators(void);
void openSubdiv_init(void);
void openSubdiv_cleanup(void);
#ifdef __cplusplus

View File

@@ -467,6 +467,14 @@ inline bool TopologyRefinerFactory<OpenSubdiv_Converter>::assignComponentTags(
break;
}
}
if (vert_edges.size() == 2) {
int edge0 = vert_edges[0],
edge1 = vert_edges[1];
float sharpness0 = conv.get_edge_sharpness(&conv, edge0),
sharpness1 = conv.get_edge_sharpness(&conv, edge1);
float sharpness = std::min(sharpness0, sharpness1);
setBaseVertexSharpness(refiner, vert, sharpness);
}
}
return true;
@@ -574,6 +582,17 @@ int openSubdiv_topologyRefinerGetNumFaces(
return base_level.GetNumFaces();
}
int openSubdiv_topologyRefinerGetNumFaceVerts(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner,
int face)
{
using OpenSubdiv::Far::TopologyLevel;
using OpenSubdiv::Far::TopologyRefiner;
const TopologyRefiner *refiner = (const TopologyRefiner *)topology_refiner;
const TopologyLevel &base_level = refiner->GetLevel(0);
return base_level.GetFaceVertices(face).size();
}
int openSubdiv_topologyRefnerCompareConverter(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner,
OpenSubdiv_Converter *converter)

View File

@@ -94,7 +94,7 @@ void openSubdiv_deleteTopologyRefinerDescr(
OpenSubdiv_TopologyRefinerDescr *topology_refiner);
/* TODO(sergey): Those calls are not strictly related on conversion.
* needs some dedicated fiel perhaps.
* needs some dedicated file perhaps.
*/
int openSubdiv_topologyRefinerGetSubdivLevel(
@@ -109,6 +109,10 @@ int openSubdiv_topologyRefinerGetNumEdges(
int openSubdiv_topologyRefinerGetNumFaces(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
int openSubdiv_topologyRefinerGetNumFaceVerts(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner,
int face);
int openSubdiv_topologyRefnerCompareConverter(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner,
OpenSubdiv_Converter *converter);

View File

@@ -47,11 +47,7 @@
#include <opensubdiv/osd/cpuGLVertexBuffer.h>
#include <opensubdiv/osd/cpuEvaluator.h>
#include "opensubdiv_partitioned.h"
//using OpenSubdiv::FarPatchTables;
using OpenSubdiv::Osd::GLMeshInterface;
//sing OpenSubdiv::PartitionedGLMeshInterface;
extern "C" char datatoc_gpu_shader_opensubd_display_glsl[];
@@ -62,19 +58,19 @@ typedef struct Light {
float diffuse[4];
float specular[4];
float spot_direction[4];
#ifdef SUPPORT_COLOR_MATERIAL
float constant_attenuation;
float linear_attenuation;
float quadratic_attenuation;
float spot_cutoff;
float spot_exponent;
float spot_cos_cutoff;
float pad[2];
#endif
} Light;
typedef struct Lighting {
Light lights[MAX_LIGHTS];
int num_enabled;
int pad[3];
} Lighting;
typedef struct Transform {
@@ -218,7 +214,7 @@ GLuint compileShader(GLenum shaderType,
fprintf(stderr, "Section: %s\n", sdefine);
fprintf(stderr, "Defines: %s\n", define);
fprintf(stderr, "Source: %s\n", sources[2]);
exit(1);
return 0;
}
return shader;
@@ -229,12 +225,21 @@ GLuint linkProgram(const char *define)
GLuint vertexShader = compileShader(GL_VERTEX_SHADER,
"VERTEX_SHADER",
define);
if (vertexShader == 0) {
return 0;
}
GLuint geometryShader = compileShader(GL_GEOMETRY_SHADER,
"GEOMETRY_SHADER",
define);
if (geometryShader == 0) {
return 0;
}
GLuint fragmentShader = compileShader(GL_FRAGMENT_SHADER,
"FRAGMENT_SHADER",
define);
if (fragmentShader == 0) {
return 0;
}
GLuint program = glCreateProgram();
@@ -283,7 +288,8 @@ GLuint linkProgram(const char *define)
glGetProgramInfoLog(program, sizeof(emsg), 0, emsg);
fprintf(stderr, "Error linking GLSL program : %s\n", emsg);
fprintf(stderr, "Defines: %s\n", define);
exit(1);
glDeleteProgram(program);
return 0;
}
glUniformBlockBinding(program,
@@ -301,7 +307,7 @@ GLuint linkProgram(const char *define)
return program;
}
void bindProgram(PartitionedGLMeshInterface * /*mesh*/,
void bindProgram(GLMeshInterface * /*mesh*/,
int program)
{
glUseProgram(program);
@@ -367,9 +373,10 @@ void bindProgram(PartitionedGLMeshInterface * /*mesh*/,
} /* namespace */
void openSubdiv_osdGLDisplayInit(void)
bool openSubdiv_osdGLDisplayInit(void)
{
static bool need_init = true;
static bool init_success = false;
if (need_init) {
g_flat_fill_solid_program = linkProgram("#define FLAT_SHADING\n");
g_flat_fill_texture2d_program = linkProgram("#define USE_TEXTURE_2D\n#define FLAT_SHADING\n");
@@ -383,7 +390,13 @@ void openSubdiv_osdGLDisplayInit(void)
sizeof(g_lighting_data), NULL, GL_STATIC_DRAW);
need_init = false;
init_success = g_flat_fill_solid_program != 0 &&
g_flat_fill_texture2d_program != 0 &&
g_smooth_fill_solid_program != 0 &&
g_smooth_fill_texture2d_program != 0 &&
g_wireframe_program;
}
return init_success;
}
void openSubdiv_osdGLDisplayDeinit(void)
@@ -447,6 +460,7 @@ void openSubdiv_osdGLMeshDisplayPrepare(int use_osd_glsl,
glGetLightfv(GL_LIGHT0 + i,
GL_SPOT_DIRECTION,
g_lighting_data.lights[i].spot_direction);
#ifdef SUPPORT_COLOR_MATERIAL
glGetLightfv(GL_LIGHT0 + i,
GL_CONSTANT_ATTENUATION,
&g_lighting_data.lights[i].constant_attenuation);
@@ -464,10 +478,11 @@ void openSubdiv_osdGLMeshDisplayPrepare(int use_osd_glsl,
&g_lighting_data.lights[i].spot_exponent);
g_lighting_data.lights[i].spot_cos_cutoff =
cos(g_lighting_data.lights[i].spot_cutoff);
#endif
}
}
static GLuint preapre_patchDraw(PartitionedGLMeshInterface *mesh,
static GLuint preapre_patchDraw(GLMeshInterface *mesh,
bool fill_quads)
{
GLint program = 0;
@@ -545,13 +560,11 @@ static void perform_drawElements(GLuint program,
int num_elements,
int start_element)
{
int mode = GL_QUADS;
if (program) {
glUniform1i(glGetUniformLocation(program, "PrimitiveIdBase"),
patch_index);
}
mode = GL_LINES_ADJACENCY;
glDrawElements(mode,
glDrawElements(GL_LINES_ADJACENCY,
num_elements,
GL_UNSIGNED_INT,
(void *)(start_element * sizeof(unsigned int)));
@@ -575,48 +588,43 @@ static void finish_patchDraw(bool fill_quads)
}
}
#if 0
static void draw_partition_patches_range(PartitionedGLMeshInterface *mesh,
static void draw_partition_patches_range(GLMeshInterface *mesh,
GLuint program,
int start_partition,
int num_partitions)
int start_patch,
int num_patches)
{
/* Glue patches from all partitions in the range together. */
int patch_index = -1, start_element = -1, num_elements = 0;
for (int partition = start_partition;
partition < start_partition + num_partitions;
++partition)
{
OsdDrawContext::PatchArrayVector const &patches =
mesh->GetPatchArrays(partition);
for (int i = 0; i < (int)patches.size(); ++i) {
OsdDrawContext::PatchArray const &patch = patches[i];
OsdDrawContext::PatchDescriptor desc = patch.GetDescriptor();
OpenSubdiv::FarPatchTables::Type patchType = desc.GetType();
if (patchType == OpenSubdiv::FarPatchTables::QUADS) {
if (start_element == -1) {
patch_index = patch.GetPatchIndex();
start_element = patch.GetVertIndex();
}
int traversed_patches = 0, num_remained_patches = num_patches;
const OpenSubdiv::Osd::PatchArrayVector& patches =
mesh->GetPatchTable()->GetPatchArrays();
for (int i = 0; i < (int)patches.size(); ++i) {
const OpenSubdiv::Osd::PatchArray& patch = patches[i];
OpenSubdiv::Far::PatchDescriptor desc = patch.GetDescriptor();
OpenSubdiv::Far::PatchDescriptor::Type patchType = desc.GetType();
assert(patch.GetVertIndex() == start_element + num_elements);
num_elements += patch.GetNumIndices();
if (patchType == OpenSubdiv::Far::PatchDescriptor::QUADS) {
const int num_block_patches = patch.GetNumPatches();
if (start_patch >= traversed_patches &&
start_patch < traversed_patches + num_block_patches)
{
const int num_control_verts = desc.GetNumControlVertices();
const int start_draw_patch = start_patch - traversed_patches;
const int num_draw_patches = std::min(num_remained_patches,
num_block_patches - start_draw_patch);
perform_drawElements(program,
i,
num_draw_patches * num_control_verts,
patch.GetIndexBase() + start_draw_patch * num_control_verts);
num_remained_patches -= num_draw_patches;
}
else {
assert(!"Discontinuitied are not supported yet.");
if (num_remained_patches == 0) {
break;
}
traversed_patches += num_block_patches;
}
}
/* Perform actual draw. */
perform_drawElements(program,
patch_index,
num_elements,
start_element);
}
}
#endif
static void draw_all_patches(PartitionedGLMeshInterface *mesh,
static void draw_all_patches(GLMeshInterface *mesh,
GLuint program)
{
const OpenSubdiv::Osd::PatchArrayVector& patches =
@@ -637,30 +645,25 @@ static void draw_all_patches(PartitionedGLMeshInterface *mesh,
void openSubdiv_osdGLMeshDisplay(OpenSubdiv_GLMesh *gl_mesh,
int fill_quads,
int start_partition,
int num_partitions)
int start_patch,
int num_patches)
{
PartitionedGLMeshInterface *mesh =
(PartitionedGLMeshInterface *)(gl_mesh->descriptor);
GLMeshInterface *mesh =
(GLMeshInterface *)(gl_mesh->descriptor);
/* Make sure all global invariants are initialized. */
openSubdiv_osdGLDisplayInit();
if (!openSubdiv_osdGLDisplayInit()) {
return;
}
/* Setup GLSL/OpenGL to draw patches in current context. */
GLuint program = preapre_patchDraw(mesh, fill_quads != 0);
if (start_partition != -1) {
#if 0
if (start_patch != -1) {
draw_partition_patches_range(mesh,
program,
start_partition,
num_partitions);
#else
(void)num_partitions;
if(start_partition == 0) {
draw_all_patches(mesh, program);
}
#endif
start_patch,
num_patches);
}
else {
draw_all_patches(mesh, program);

View File

@@ -1,77 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Sergey Sharybin
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __OPENSUBDIV_PATITIONED_H__
#define __OPENSUBDIV_PATITIONED_H__
#include <opensubdiv/osd/glMesh.h>
#include <opensubdiv/osd/cpuEvaluator.h>
#include <opensubdiv/osd/glVertexBuffer.h>
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
namespace Osd {
/* TODO(sergey): Re-implement partitioning. */
#if 0
template <class PATCH_TABLE>
class PartitionedMeshInterface : public MeshInterface<PATCH_TABLE> {
typedef PATCH_TABLE PatchTable;
typedef typename PatchTable::VertexBufferBinding VertexBufferBinding;
public:
};
typedef PartitionedMeshInterface<GLPatchTable> PartitionedGLMeshInterface;
#endif
#if 0
template <typename VERTEX_BUFFER,
typename STENCIL_TABLE,
typename EVALUATOR,
typename PATCH_TABLE,
typename DEVICE_CONTEXT = void>
class PartitionedMesh : public Mesh<VERTEX_BUFFER,
STENCIL_TABLE,
EVALUATOR,
PATCH_TABLE,
DEVICE_CONTEXT>
{
};
#endif
#define PartitionedGLMeshInterface GLMeshInterface
#define PartitionedMesh Mesh
} /* namespace Osd */
} /* namespace OPENSUBDIV_VERSION */
using namespace OPENSUBDIV_VERSION;
} /* namespace OpenSubdiv */
#endif /* __OPENSUBDIV_PATITIONED_H__ */

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