Compare commits

...

222 Commits

Author SHA1 Message Date
9282d305bd Merge branch 'master' into texture_nodes_refactor
Conflicts:
	source/blender/nodes/texture/nodes/node_texture_math.c
2014-12-23 10:04:03 +05:00
646a96bf8e Fix T42952: Curve modifier not taken into account when curve is created from mesh
Curve and array modifiers requires curve path to be evaluated, dependency graph
will make sure that curve eval would create such a path, but if curve was already
evaluated we might miss path.

So what we do now is: if path was not calculated for target curve we tag it for
update.
2014-12-22 19:05:56 +05:00
f78490182e partial revert ab6417aa9f was too strict 2014-12-22 13:26:35 +01:00
abf39fa31f Quick fix for UI themes, by meta-androcto (Brendon Murphy), thanks. 2014-12-22 09:57:56 +01:00
cd4fedb285 Fix T42966: Py_Initialize: Unable to get the locale encoding
This only happened for SCons builds and caused by pure human stupidnes.
2014-12-22 13:43:23 +05:00
julianeisel
59a0c11ecc GPencil: Correction to rB071ec918f4cd
* correct API convention: in rB071ec918f4cd gp_draw_data drew mulitple data blocks, I added gp_draw_data_all which now calles gp_draw_data multiple times (if needed). This follows our normal convention, e.g. see UI_panel_category_draw_all
* Draw scene data first, users may expect it like this

Points raised by @aligorith, thanks for this!
2014-12-21 15:48:30 +01:00
1fe7b84c73 Fix T42973: Render viewport not updating when switching materials in Outliner
For now, do as RNA material update functions - tag object for update too.
2014-12-21 12:40:02 +01:00
julianeisel
071ec918f4 Fix T42961: GPencil - Refactor object/scene data behaviour
D937 with minor edits (whitespace only)

@aligorith, I double checked everything runs smoothly, blame me if I missed something ;). Sorry for just taking the initiative and committing without talking to you, but I wasn't able to catch you the last days. This should be fixed before the release IMHO, but I don't think it's important enough to be committed during BCon5, so sorry again, but hopefully everything is okay :)
2014-12-20 16:18:18 +01:00
c2e56a5267 RNA Object.matrix_local: Add a big warning this matrix is only relative to parent object.
So 'advanced' parenting like e.g. bones or vertices need further processing
to get a real parent-relative matrix...
2014-12-20 14:16:06 +01:00
296a92f5f3 Fix T42972: fcurve lasso select crash 2014-12-20 13:48:36 +01:00
93c4ba7b70 Force phony targets to build (even if file exists)
This is a convenience makefile only,
files if they exist by accident shouldn't ever be used.
2014-12-20 02:15:14 +01:00
7a04c7f6d0 Ensure no integer overflow happens in SuperLU solver on memory allocation
x
2014-12-20 00:23:42 +05:00
3b639b8b3d Minor cleanup to previous commit 2014-12-19 14:43:29 +01:00
3e0ff35b4b Fix for bad file name string matching in point caches, leading to
deletion of baked caches.

This happens when objects use file names with matching prefixes:

"CubeX"   -> not baked
"CubeXYZ" -> baked

The first objects cache should be discarded up to the current frame on
file load, but the second should be left intact. But because the cache
file names for both use the same prefix as well (based on hex name
representation) they both match the "CubeX" name and get discarded.
Adding the underscore terminator solves this issue, because it is never
part of the hex file name string.

WARNING: this solution does not work with custom names for point caches.
This feature is pretty much broken, users have to ensure their names
are unique themselves. Due to the possibility of underscores in names
and the ambiguity of point cache suffixes there is no reliable way to
encode filenames in that case.
2014-12-19 13:34:50 +01:00
ef5c036d1c Fix T42543 projection painting fails when faces are perpendicular to screen.
This is UV barycentric interpolation failing for triangles where vertices are
colinear in screen space. To fix this, we detect this early on so we do the
interpolation on edges instead of triangles.

Such triangles will never be painted on unless we have occlusion and culling
off (since, arguably they are self occluded and almost back-facing).

The code still does not fill the whole area but this can be checked separately.
2014-12-19 12:27:29 +01:00
76ccc1d26b Fix reversed args in function call (float, bool vs. bool, float).
Note 'same' values are kept for now, even though it was probably meant the
other way around, it's safer to keep current behavior for now.
2014-12-19 10:15:10 +01:00
5cc199e495 Fix T42945: rv3d->gridview was not set correctly in view3d_draw_objects.
This fixes both transform snapping in persp views, and 'snap cursor to grid' feature.

Was only really visible with Imperial units.
2014-12-19 10:09:17 +01:00
5e67779d80 Code cleanup: include directory for scons
This directory does not exist even.
2014-12-19 13:43:52 +05:00
27b58f0eb2 Fix mathutils docstring typos. 2014-12-19 00:43:41 +09:00
de0b9f34d7 Flood fill in projection painting does not do bounds checking anymore.
It should now fill the whole mesh with color even if parts of it are
outside the screen - still need to be in fron of the camera though.

Thanks @Campbell for the trick :)
2014-12-18 16:28:43 +01:00
85f6fc501c Fix T42943: Crash with multiple calls to rna_info.BuildRNAInfo()
Thanks to @nesse for the fix
2014-12-18 14:31:33 +01:00
f0f1c7995b PyAPI: disallow assigning members to 'bpy.ops' 2014-12-18 13:52:31 +01:00
9f61350a05 Sequener: Move waveform-draw option into view menu
also simplify preview/sequencer checks
2014-12-18 13:47:40 +01:00
d4aaa4f9b6 cleanup: use const for smallhash & minor edits 2014-12-18 13:12:25 +01:00
c1eec5582a Fix/workaround T42944: Crash adding a shortcut in properties space 2014-12-18 12:49:48 +01:00
8627d65951 Correction to previous render border commit
Was using wrong bitfield check.
2014-12-18 14:43:08 +05:00
20006e4a67 Cycles: Do some logging when motion is detected in the scene 2014-12-18 14:40:14 +05:00
2bdd44c87a Correction to set border from render image view
It did not fully support cases when setting border from a cropped render result
and it's not totally clear how it should behave. So for now just do nothing and
inform users about this.
2014-12-18 13:24:21 +05:00
0c5eb88451 Quiet warning (harmless) 2014-12-18 02:15:42 +01:00
0ae4d7d405 Fix for GPU_materials_free accessing NULL pointer 2014-12-18 02:14:51 +01:00
3da1a75b74 correct recent cleanup for id-property types 2014-12-18 02:06:57 +01:00
b3b9e08423 Sequencer: Select sideof failed for strips touching the playhead 2014-12-17 23:11:41 +01:00
3820d44979 Cycles: Add missing entries in the Integrator constructor and some updates
to the XML API.

(Changes from the standalone repo)
2014-12-17 22:28:33 +01:00
cd4d5dcb46 Fix T42932: Drag&Drop of groups from the outliner was using undefined
event->mval.

Calculating from event->x/y like object drag/drop does works. Also fixed
a missing notifier of the object instancing operator.
2014-12-17 13:50:31 +01:00
a56e31c89c Fix triangulating concave quads
Resulting triangles could be pointing in opposing directions.
2014-12-17 11:34:16 +01:00
dc2617130b Fix: Never write previews for undo steps.
This may eat quite q bit of mem in the end (though nothing critical),
and icons (material ones e.g.) often ended up out of sync after undo.
2014-12-17 10:23:34 +01:00
b04d2f99f2 Fix T42927: Triangulate-beauty fails on quads
Regressions since 2.69.
2014-12-17 10:09:47 +01:00
15bde0dbea Docs: comments (hash table & beauty fill) 2014-12-17 09:58:23 +01:00
3e61478b1b Fix T42917 shadow maps not working on ATIs.
This is yet another issue with framebuffers. There are two issues: We
need the framebuffer fully bound to check for completeness and when we
bind a depth texture as frame buffer we need to disable read/write.
2014-12-16 21:52:55 +01:00
1b2fc74792 Fix typo in VBO 2014-12-16 20:20:41 +01:00
72330b97a2 Fix nasty typo in CPP RNA that would break on int or bool dynarrays... 2014-12-16 16:57:41 +01:00
1549fea999 Fix T42888: Separate and Combine HSV distorts the hue value
These nodes were assuming sRGB input/output which is for sure wrong for the
shader pipeline which works in the linear space.

So now conversion to/from linear space happens in these nodes which makes them
making sence in the shader context but which might change look and feel of
existing scenes.
2014-12-16 20:06:25 +05:00
137f557246 Remove NULL checking variable after using it. 2014-12-16 12:09:33 +01:00
72341537e8 Fix T42864: Knife-project fails with 'cut-through'
Removing edge-hit-doubles could incorrectly de-duplicate intersections between different edges.

Gave noticeable errors cutting through geometry that overlapped exactly.
2014-12-15 21:17:10 +01:00
76f50cd17a Fix for clip proxies builder reloading original footage frames
This isn't needed if the source is the image sequence.
2014-12-15 22:20:06 +05:00
f51b583ea0 Improve tip for simple deform origin 2014-12-15 16:10:17 +01:00
db0e2e7347 Fix T42864 (partial): knife-project included uncut backfaces
When knife-project ran with cut-through disabled,
it would still try to select faces behind the cut.

Now check if the faces are obscured.
2014-12-15 15:10:49 +01:00
2329b58fd3 Fix T42864 (partial): Knife-project had too-low precision 2014-12-15 15:10:49 +01:00
090ab750b3 Fix missing UI ID messages and/or I18N contexts for MovieClip/Mask/Palette/PaintCurve ID types. 2014-12-15 11:53:35 +01:00
c167ac1556 Tracking: Fix wrong logic in tracks synchronization
There was some stupidness in the way how tracks are synchronized from the job
to actual DNA data leading to all sort of weird and wonderful failures again.
2014-12-15 14:39:59 +05:00
06ea819c0d Tracking: Avoid possible treading issue reading the frame to sync 2014-12-15 14:34:47 +05:00
ca25fe98fc Tracking: Fix possible race condition accessing the tracks
Writing to the tracks was already inside the lock section, but
reading was not. This could have lead to race condition leading
to all sorts of weird and wonderful artifacts.
2014-12-15 14:31:19 +05:00
Severin
ae6f62c4e2 IME fix: Quit two assert failures
We could now also remove the win->ime_data assert in wm_window_IME_end,
but think it's better to leave it for further development.
2014-12-14 18:51:14 +01:00
c1d3532d2c Fix for idproperty comparison
comparing arrays had flipped logic
2014-12-14 18:24:13 +01:00
17253bec06 Fix T42892: UV pixel snap with negative values 2014-12-14 12:36:32 +01:00
9c81833430 Fix T42885: We still had a few wrong doc in mathutils about methods returning
instance of self while actually returning None...
2014-12-13 14:07:46 +01:00
d6beaad01c Fix T42875 GLSL display not correct in vertex array mode.
GLSL used a global variable to store the enabled vertex attributes which
were not set for vertex arrays after the VBO refactor.
2014-12-12 17:59:06 +01:00
28a0e1dae5 Fix T42883: ID-Prop arrays longer than 'shot' fail 2014-12-12 16:25:32 +01:00
fbd25174d1 Amend to previous 'append warning' commit.
Actually, append/link *is* converted/updated, issue here is IPO-to-FCurves
code is not called from our do_version code, but later, directly from BKE_blender's
setup_app_data. This is bad but not easily fixed it seems, so for now
keep a warning in this case.

thanks Sergey for the headup.
2014-12-12 12:38:54 +01:00
a6343696c1 Fix T42882: Now warn user when trying to append/link from older blender files.
Since we do not make any conversion in this case, worth warning user about
potential issues!
2014-12-12 12:13:30 +01:00
cea086dd97 cleanup: disallow NULL arg to uvedit_aspect
also some typo's
2014-12-12 11:18:03 +01:00
19eb700fef Fix blenderplayer compilation (tm) 2014-12-11 20:34:53 +01:00
f1ddf99580 Fix T42859 smart UV unwrap does not support aspect correction.
Can be considered TODO but it's not bad to support either. Also added
RNA api to get aspect ratio of assigned UV image - returns aspect
corrected image dimensions so needs adjustments for uv editing.
2014-12-11 19:46:35 +01:00
2309def874 Fix crash when changing worlds with world background active.
Freeing the preview will free the original gpu material so NULL that out
on copy.
2014-12-11 14:43:15 +01:00
754bdbe4b4 Cycles: Fix more wrong usages of RNA_id_pointer_create
Title says it all, just be more careful in the future.
2014-12-11 17:11:23 +05:00
cb7cf523e5 Fix T42829: Cycles crash rendering when file is saved to specific location
The issue was caused by the way how RNA pointer was created for the bMain:
namely Cycles was using RNA_id_pointer_create to create the pointer, which
would then try to refine the poniter based on the ID type.

This is just wrong and worked so far just because of co-incident, with the
file path from the bug report first letters in the ID name happened to be
NT which corresponds to NodeTree, and for sure refining such pointer will
fail.

Simple solution -- use proper way to create RNA pointer for non-ID block.
2014-12-11 16:55:10 +05:00
1999b5a814 Fix ping-pong actions when using the Action Actuator. 2014-12-11 00:05:11 -08:00
2617d37034 Libmv: Reshuffle CMake and SCons configuration files
The main idea is to share as much code between cases when feature-full built
is done and only logging is needed, so all the defines and include directories
are guaranteed to be the same.

This would hopefully make it so MinGW compilation is all happy about Cycles
logging for both CMake and SCons.
2014-12-11 11:58:03 +05:00
julianeisel
c71c7f0e0b Correction for non-Windows SCons compiling fix after IME Merge
As discussed in rB983c71931b1886d4, we should print a warning in case of building on non-Windows and WITH_BF_IME enabled. We also terminate build in this case, so the warning isn't scrolled away. Was worked out together with @sergey.
2014-12-11 00:22:17 +01:00
1e02a5ff43 Fix for object_utils.object_data_add: Now supports None obdata for
creating empties.

The documentation says None is a valid argument for obdata (making
empties), but this would cause an exception. Now obdata is only used
when it is defined. An optional name argument can be passed to override
obdata.name as well.
2014-12-10 17:22:26 +01:00
d7e4944e5b UI: add Shift-Drag to multiselect expanded enum items too.
Differential Revision: https://developer.blender.org/D928
2014-12-10 17:04:36 +01:00
aaa02bd490 startup.blend, update movie-tracking layout T41660
Layout by @sebastian_k, now includes 3D view.
2014-12-10 16:49:00 +01:00
bce0dc8cf7 cleanup: comment unused defines 2014-12-10 15:55:40 +01:00
d9ddc99a27 Fix T42184: Normal not displayed correctly in Material Viewport
There was a differences between how Cycles and BI treats Normal shader:

- Different normal direction assumption
- Different policy about vector normalization

Previous idea of trying to use single function and flip the output if
needed becomes more tricky, so i've just added new GLSL function which
corresponds to how Cycles deals with the Normal shader.
2014-12-10 19:12:54 +05:00
d68521df7b Cycles: Fix difference between SVM and OSL implementation of Normal node
SVM was normalizing the input normal, OSL did not. This lead to render
result differences across this shading systems.
2014-12-10 19:07:50 +05:00
668ffcd6e9 Fix for wrong flip of Normal node Dot output for new shading system
It was wrong to use invert(), we need to multiply by -1 instead.
2014-12-10 18:50:30 +05:00
01bda15832 Fix T42472: Undoing/Redoing repeated transform operator gives wrong final matrix on objects with no geom data.
This hack should not be needed here, quoting Sergey, the actual issue comes from BKE_object_handle_update_ex,
which is calling BKE_object_where_is_calc_ex when it shouldn't.

Propper fix is depsgraph refactor topic, though.
2014-12-10 13:57:16 +01:00
7366283c01 Fix T42818: Cycles SSS passes are incorrect for SSS size of 0
This was caused by some internal optimization which evaluated SSS with
size of zero as BSDF but used different ID so the evaluation result
didn't appear in regular diffuse pass.

This lead to situation when SSS data was nowhere stored if the
size was zero.

Now SSS with zero size and close-to-zero sizes will be handled in the
same way from the passes point of view.
2014-12-10 17:28:44 +05:00
602250d9fe Fix T42748: Crash in subsurf, threaded access
Allocating the iterator from a BLI_memarena wasn't threadsafe.
Change the API to use stack memory for iterators.

Thanks to @mont29 for finding exact cause of the bug.
2014-12-10 11:16:42 +01:00
47788b5e68 Switch to numpy 1.9 for windows platform 2014-12-10 13:50:51 +05:00
1807dcf619 Fix numpy installation on windows+cmake
The was caused by numpy never unpackign because of no
dpependnecy of any targets from the unpacked numpy.

Tried making it so blender target dpeends on it, but for
some reason it didn't work. For now added dedicated target
for unpacked numpy. A bit dirty but much better than just
totally failing.
2014-12-10 13:45:45 +05:00
8555595d17 Fixes for compilation with msvc
MSVC doesn't like caling macro argument f when using float values
in the macro, it simply replaces the f in the float value with the
argument..

CMake compilation still fails because of 77785ce708, numpy is never
getting unpacked.
2014-12-10 13:39:24 +05:00
9783d9297c cleanup: pep8 2014-12-09 21:49:46 +01:00
117a7e3545 Sequencer: optionally show strip offsets
was disabled in recent sequencer refactor, enable with view menu option.
2014-12-09 21:42:25 +01:00
17f0a01a56 Correct last commit checking knife edges 2014-12-09 20:57:37 +01:00
e77b25fabb Cycles: Code cleanup, typo 2014-12-10 00:08:33 +05:00
6fb1e1680b Knife: cuts along existing edges are now selected
This means cuts along existing edges don't have gaps in the selection.

Fixes T42616
2014-12-09 19:51:08 +01:00
2efc3211ab Knife: rename vert & edge 'draw' to 'is_cut'
More logical for checking if the edge is a cut into the mesh.
2014-12-09 17:24:19 +01:00
4d9f2f7e86 Knife: fix edge aligned cuts, could add redundant verts 2014-12-09 17:23:10 +01:00
d5abe8419d Smallhash: add support for iterating value pointers
also add reinsert function
2014-12-09 17:18:05 +01:00
233c650d55 Gooseberry request, circle select for graph editor 2014-12-09 16:54:15 +01:00
491839b3c8 Fix T42857: Inconsistency between cache line visibility and ability to change frame from image space 2014-12-09 20:34:28 +05:00
781db5f8a6 Knife: test if an edge is on the face boundary
Was checking if an edges midpoint was inside the face,
giving random results (point-inside for an edge location).
2014-12-09 15:57:59 +01:00
171a6bb5dc Fix T42488: Knife (selected_only + occlude) failed 2014-12-09 15:51:58 +01:00
8fe336ce7e Fix T4284: Drawing modified curves crashes 2014-12-09 14:38:32 +01:00
ebee593f26 Fix bug reported by kopias on irc, crash when attempting to set canvas
with a non-mesh object selected
2014-12-09 14:36:24 +01:00
59f1585d02 Fix T42175: Modifiers don't render in sculpt mode using multires
Modifier stack should ignore sculpt restrictions when creating derived render.
2014-12-09 17:21:02 +05:00
a5c3de2e49 Fix T42630: Triangulate returns invalid face-map
Triangulate with beautify caused a bug when there were existing edges
could make the bmesh-operator return an invalid face-map.

Now the beauty is calculated on the 2d-tri's resulting from polyfill,
its simpler and faster.
2014-12-09 13:08:28 +01:00
6076bedec0 Cleanup: remove scanfill define for polyfill code
also rename vars which were previously used for scanfill.
2014-12-09 12:19:26 +01:00
83cbcefac8 Add edgehash remove, clear functions, Heap clear
Edgehash was missing removal functions (remove, popkey, clear),
since it wasn't needed so far, but is based on same code as ghash which has them.

also add heap clear() method so we can reuse heaps.

(needed for upcoming fix).
2014-12-09 00:32:20 +01:00
55812e3acd Cleanup: simplify heap popmin 2014-12-09 00:13:35 +01:00
03760fed0d Cleanup: remove unused pointer in Heap 2014-12-09 00:02:50 +01:00
ab6417aa9f Fix Mesh Objects with missing textures or wrong texture path now import without texture 2014-12-08 19:57:50 +01:00
8545fb516e Fix T42824: Proxy bone custom-shape lost on undo 2014-12-08 16:46:42 +01:00
252bfc6f65 Fix T42838: Make dupli's real use_hierarchy fails
Regression since the dupli-object refactor.
2014-12-08 16:15:53 +01:00
7b6c9d23cf Cycles: Fix compilation error with MinGW and logging enabled 2014-12-08 19:37:41 +05:00
c07f6c02b3 Docs: reference the new manual 2014-12-08 11:18:58 +01:00
3e7e97f127 BMesh: ensure iterator macros assign to valid types
note, this is for C++ code which expects a cast, (will be added later)
also add a macro for nop-expressions (EXPR_NOP),
when we never want an expression to be evaluated, but it should still be valid.
2014-12-08 10:54:56 +01:00
690345a826 Cleanup: spelling 2014-12-08 09:46:21 +01:00
7ba2b37a8a Cleanup: remove unused operator-type member 2014-12-08 09:45:47 +01:00
julianeisel
b88e700df4 Cleanup: Minor edits to widget emboss code
* Rename "emboss" to "widget_emboss"
* Remove duplicated UI_GetThemeColor4ubv function

I made sure version bump and Save User Settings are working correctly ;P
2014-12-08 00:38:36 +01:00
julianeisel
983c71931b Fix non-Windows SCons compiling error after IME merge 2014-12-07 23:57:51 +01:00
Severin
12e5a32557 Forgot to add new files in recent IME commit
Sorry, my bad :/
2014-12-07 18:23:02 +01:00
fe4d0c234e Bugfix T42774: BSurface addon doesn't work on new builds
It turns out that several important modelling addons depend on the assumption
that Grease Pencil data gets created on the active object instead of on scene
level. This commit adds a toggle for setting whether new Grease Pencil data
is created on scene or object level.

These work as follows:
* "Scene" = The behaviour originally introduced as part of the GPencil_EditStrokes
  changes. New strokes are added to the scene instead of the active object, making
  it easier to manage things when working with Grease Pencil in general.
* "Object" = The previous behaviour (from 2.50 to 2.72), where new strokes are added
  to the active object. This is now being reintroduced to soften the transition
  for addons out there which have been doing this in a lazy/lax way so far.


Now, what may be slightly confusing are the "fallback" measures in place:
* "Scene" - To ensure that loading old files goes ok without needing a version patch,
   if the active object has GPencil data, that will be used in place of the scene's
   own GPencil data.
* "Object" - If there was no active object at the time of creating strokes
  (for instance, if you delete the active object immediately before drawing),
  GPencil data gets attached to the current scene instead.

Since some tweaks may still be needed here, I've decided to bump the subversion
number so that we have a reference point when doing version patches.
2014-12-08 02:42:45 +13:00
e67fd7a2cb Correct defines for binreloc
After recent moving path functions to appdir.c

patch T42826: by ldo (Lawrence D'Oliveiro)
2014-12-07 13:53:42 +01:00
Severin
e81d077c85 Input Method Editor (IME) support for text buttons
Original patch by @random (D765) with some minor work done by @campbell
and me.

At this place, I'd like call out a number of people who were involved and
deserve a big "Thank you!":
* At the first place @randon who developed and submitted the patch
* The Blendercn community which helped a lot with testing - espacially
* @yuzukyo, @leon_cheung and @kjym3
* @campbellbarton, @mont29 and @sergey for their help and advises during
* review
* @ton who realized the importance of this early on and asked me for
* reviewing

We are still not finished, as this is only the first part of the
implementaion, but there's more to come!
2014-12-07 00:58:17 +01:00
06515475b9 CMake: remove redundant include dir 2014-12-06 13:39:46 +01:00
81ae71fcd3 Fix crash in RE_AcquiredResultGet32 on debug builds introduced yesterday 2014-12-06 12:30:59 +01:00
6e8a8a72a3 OSX: change previous commit to not only make animation-player window frontmost but whole process 2014-12-06 12:13:28 +01:00
036f4e7a38 Cleanup: style from my previous commit 2014-12-06 03:48:41 -05:00
c077f5fa08 Fix T42789: support 3Dconnexion wireless devices
SpaceMouse Wireless
SpaceMouse Pro Wireless

Device info is from user reports. I don’t yet have the new devices, so
these are untested but likely to work :D
2014-12-06 02:48:51 -05:00
c8995ecc83 Fix inbetween mousemove event getting detected in hotkey buttons. 2014-12-06 02:28:05 +01:00
871cf70144 Fix playercompile after ecc03c8ed 2014-12-05 18:51:19 +01:00
825d6adef5 OSX: make sure window of new blender instance is front when playing animation 2014-12-05 18:42:10 +01:00
0493879401 Cycles: Report error via the new engine API
This way CUDA errors are visible in the image info line,
which makes things to behave the same across viewport and
final rendering.

That's right, we've got error reported via reports and info
line now. This is based on the feedback from our gooseberry
team.
2014-12-05 22:15:09 +05:00
ecc03c8ed0 Render API: Add RenderEngine.error_set() function
This function sets an error message which would be displayed after
rendering is over and info space lost the link to the engine.
2014-12-05 22:15:05 +05:00
2b4eeb79cd Cycles: Report error to the blender using report API
This way when something goes wrong in Cycles (for example out of VRAM, timelimit
launching the kernel etc) we'll have a nice report in the Info space header.

Sure it'll be nice to have mention of error in the image editor's information
line, but that's for the future.

This fixes T42747: "CUDA error" appears only momentarily, then disappears
2014-12-05 22:15:04 +05:00
bd0b9ed0c0 Cycles: Add dedicated Progress::set_error() call
Currently it acts the same as set_cancel(), but this way we're able to
distinguish situations when rendering was aborted by user demand (for
example pressing Esc in standalone renderer) or if something went horribly
wrong (for example out of VRAM error).
2014-12-05 22:15:04 +05:00
716890e864 Cycles: Early output from Scene::device_update when device error occurs
This way for example we wouldn't wait a fortune while BVH is building after
GPU run out of memory when loading images just to see the render failure
message.
2014-12-05 22:15:04 +05:00
0b67102bd6 Cycles: Code cleanup, whitespace 2014-12-05 22:15:04 +05:00
e1e984e437 Fix T42807, variance shadow map broken afterFBO changes.
This code was a bit do-it-yourself instead of relying on the API. Should
be OK now.
2014-12-05 16:01:18 +01:00
e54d571176 Amendment to previous commit: Add an option to scene strips to disable GPencil
On second thought, it is probably still worthwhile to be able to disable GPencil
drawing on strips. By default, GPencil strokes are still shown by default now,
but they can be turned off using this option if it turns out that they are
getting in the way (e.g. a director/animator make some planning notes in the shot
at an earlier stage which are hidden for normal display now, but are still there
popping up sproadically during the animatic).
2014-12-05 16:39:49 +13:00
3673a03226 Grease Pencil sketches get included when doing OpenGL previews for scene strips in sequencer
After double checking the sequencer code, there doesn't seem to be any reason to
exclude these from the sequencer previews. This makes it possible to use the
sequencer to non-destructively chain together difference Grease Pencil animated
shots together without having to render each image sequence first, allowing for
a smoother workflow.

Just in case the initial assumption isn't entirely correct, I've put in place
an extra arg to the relevant functions which can be hooked up to a suitable
option on the scene strip later to turn this on/off as needed.
2014-12-05 15:47:23 +13:00
844909b294 Fix for typo + memory leak 2014-12-05 14:15:46 +13:00
e93990dfc5 Bugfix T42697: Hiding/unhiding NLA strip doesn't update the 3D Viewport
The Toggle Muting operator was missing code to tag the animation to get recalculated.

This was also missing from a few other operators too, including Snap, and
Add/Paste FModifiers .
2014-12-05 14:14:50 +13:00
abab4f19e6 Fix scons+mingw64 compiling - Ensure WITH_BF_CYCLES_LOGGING is defined and turned off 2014-12-05 13:13:34 +13:00
030b694c7a To make Strokes Edit Mode a bit more "solid", Tab key can be used to toggle out of it 2014-12-05 12:12:03 +13:00
d87ff752af Selectmouse-drag now works to move GPencil verts 2014-12-05 12:12:03 +13:00
cf7bdb42ac BGE VideoTexture: refresh() on ImageFFmpeg should have no effect.
ImageFFmpeg objects will not refresh properly because the image
file is closed immediately after creation. Therefore refresh()
should have no effect on them.
This was causing problems with ImageMix using ImageFFmpeg as
sources: refreshing the ImageMix object is required to update
the mix but it has the side effect of refreshing the underlying
sources, hence the need to skip refresh on fixed images.
2014-12-04 23:55:53 +01:00
226eb53bc7 Fix T41883 proxy sizes not correct.
Really bad issue which meant code could fetch an image buffer from the
stored cache and modify it. Generally sequence image buffers could come
from the cache and should not be modified directly. Easily solved by
scaling a copy of the original.
2014-12-04 16:37:56 +01:00
c57d9c05d6 Gray out keyframe selection option when modal solver is used 2014-12-04 20:09:51 +05:00
8600dc6365 Fix T42800: Blender suddenly closes after pressing solve camera motion
Couple of issues:

- Fist/last frame calculation was wrong

- Keyframe selection might silently fail leading to unpredictable math
  errors all over the place. Now if keyframe selection fails solver wouldn't
  run.
2014-12-04 20:02:05 +05:00
2f637004d5 Buildbot: Enable sm_52 for OSX
This actually enables it in the darwin scons config, that's how it always
used to be configured there.
2014-12-04 19:30:35 +05:00
4fe2b45d3d Cycles: Fix compilation error after recent logging changes
Forbid OSL from polluting current conext with obscure stuff from
windows.h, it's not useful and unhealthy anyway.

Maybe we sohuld also forbid using abbreviated Glog constants as
well tho.
2014-12-04 16:59:31 +05:00
12e9ccb256 Cleanup and fix for uninitialized output buffer of the sunbeams node.
Buffers should actually be cleared before running operations on them,
but this doesn't work for some reason.

Note also that the sunbeams node can show some creases and hard aliasing
when the source point is close to a bright area with strong gradient.
To fix this a better filtering algorithm, dithering or ray sampling
would need to be implemented. In the meantime simply blurring the
sunbeams result a bit should help (or simply avoid putting the source on
a bright spot).
2014-12-04 12:46:45 +01:00
cf15147053 Cleanup: minor int->bool cleanup. 2014-12-04 11:18:27 +01:00
2420a3c189 Fix T42797: -Werror=sign-conversion Triggered in blf_glyph.c
Very minor, but since it was reported...
2014-12-04 10:23:21 +01:00
3c1d286ca5 Fix building on OSX when OMP is enabled.
Reported by sebastian_k over IRC, thanks!
2014-12-04 09:55:17 +01:00
Dalai Felinto
409043c69d GPU: code cleanup, no fundamental changes 2014-12-03 17:56:20 -02:00
a6bb564c99 Another crappy mistake in VBO code. 2014-12-03 20:20:04 +01:00
4afd5db47e Only annoy coders with warnings, not users. 2014-12-03 19:49:48 +01:00
87471874a9 Fix really crappy bug after vertex array refactor commit, it used vertex
arrays offset when VBOs were active and could cause a crash in driver.

Thanks to Dalai again for finding this out.
2014-12-03 19:22:56 +01:00
0762451e86 Cycles: Synchronize SCons with CMake in regard of logging 2014-12-03 23:04:57 +05:00
9ae458362a Cycles: Enable logging by default
Default configuration already includes libmv and glog, so all
the dependencies are met. And logging is nice to have anyway.

This wouldn't give any slowdown, because all the logging is
silenced unless '--debug-cycles', plus no logging is done
from the speed critical code.
2014-12-03 22:46:56 +05:00
627f27502f Cycles: Support logging when building with SCons
Basically, title says ti all, the option is called WITH_BF_CYCLES_LOGGING
2014-12-03 22:46:56 +05:00
f96fd4430a Fix typos. 2014-12-04 02:38:20 +09:00
76bfce231a Make sure materials are updated before passing to renderer in game
engine - report by Dalai on irc.
2014-12-03 18:12:31 +01:00
58005e135b Cycles: Remove workaround in ShaderClosure
Since the aligned allocation of shader closures in OSL memory pool
this workaround is no longer needed.

Also put a comment which describes the desired layout of the structure
so array of shader closures is all nicely aligned.
2014-12-03 20:50:25 +05:00
4cb0e25678 Cycles: Use 16 bytes aligned closures in OSL
This solves bugs like T42210 which are caused by compiler being
smart and using some SSE instructions to operate with closure
classes, which was failing because those classes are not allocated
by the regular allocator but allocated in memory pool in OSL.

With newer versions of OSL it is now possible to force closure
classes being aligned to a given boundary and this commit uses
this new functionality.

Unfortunately, it means we're no longer compatible with older
versions of OSL, only latest git version from upstream and our
branch at github are supported:

  https://github.com/Nazg-Gul/OpenShadingLanguage/tree/blender-fixes

For OSX and Windows it's not an issue because libraries are
already updated there, Linux users would need to run install_deps
script.
2014-12-03 20:34:03 +05:00
894dbda575 Fix potential bug (though rather unlikely) - MAX_ID_NAME is 66 now! 2014-12-03 10:42:15 +01:00
47ebf96de4 BGE: Fix Rigid body constraint deletion
Fix for T41294.
Rigid body constraints are not deleted, if the corresponding game objects are deleted.

Reviewers: moguri

Differential Revision: https://developer.blender.org/D701
2014-12-02 19:26:06 -08:00
5996ad2fd4 Fixes for T41168
after the completion of the action in "Flipper", layer is removed and the actuator mistakenly receive zero when trying to get the current frame

Patch Author: avrprj

Reviewers: moguri

Projects: #game_logic

Differential Revision: https://developer.blender.org/D906
2014-12-02 19:12:03 -08:00
af92f3d325 Tex Paint: hide selected face-mask edges
Internal selected edges were distracting when painting images.

Also remove unused flag.
2014-12-02 17:59:03 +01:00
e1f5e19eee Freestyle: Avoid quietly ignoring errors in parameter_editor.lineset_pre callbacks. 2014-12-02 23:08:22 +09:00
9345d2d723 Fix T42767: Subsurfacing union boolean with same-named UVs crashes Blender
Was own mistake in handling custom data layers in boolean modifier.

Campbell, do you mind double-checking if it's all correct?
2014-12-02 17:50:34 +05:00
e3a6f1c152 Cycles: Remove workaround for missing sm_52 kernel, now we require it for Maxwell cards. 2014-12-02 13:45:39 +01:00
4649f17c38 Cycles: Enable native sm_52 kernel for Windows. 2014-12-02 13:41:43 +01:00
b5399deac3 Enable sm52 for linux buildbot
Status of other builders:
- Windows are not known for me, would ask Martijn to look into
- OSX buildbot still needs a CUDA toolkit update
2014-12-02 17:30:59 +05:00
c751055513 Cycles: Tweak to the include paths after recent atomics change
Who could knew that include directories are not inherited in scons..
2014-12-02 16:53:22 +05:00
18d08ede22 Fixes for atomic operations when building with MSVC 2014-12-02 16:38:09 +05:00
4e60462881 Followup to previous linked list commit
Windows doesn't have __func__ and utildefines was never included.
2014-12-02 16:09:12 +05:00
ed935ae5ad Cycles: Use lock in the memory statistics
CPU rendering is allowed to allocate memory from multiple threads,
which means statistics need to be avare of this.
2014-12-02 15:50:46 +05:00
e177c51430 Use atomic operations in task pool
This ensures proper values of currently running tasks in the pool
(previously difference between mutex locks when acquiring new job
and releasing it might in theory give wrong values).
2014-12-02 15:23:58 +05:00
a42638d265 No need to free GPU images from BKE_image_free_buffers when in background mode
OpenGL in background mode is not used, so we can skip mutex lock and filling in
the list which later is never used.

This gives unmeasurable speedup by skipping mutex lock, plus solves memory leak
in the background mode.
2014-12-02 14:54:00 +05:00
a5cd6a029f Cleanup: style & de-duplicate 2014-12-02 10:30:29 +01:00
f86fd544c1 Use more unique allocation strings for new links in the list 2014-12-02 14:27:18 +05:00
7de1efd274 Fix: Grease Pencil strokes rendered with blotched colours/alpha in OpenGL Playblasts
Thanks to an anonymous tip (or shall we say, a tip from "Anonymous" - thank you
whoever you are :) it is now possible to render out Grease Pencil shots from
the viewport with correct colours again! This has been broken for a few releases
now, so it's great that this works again now, completing the last part of the
pipeline again.
2014-12-02 19:13:45 +13:00
367204a063 Lasso Select for GPencil Strokes 2014-12-02 13:52:48 +13:00
8b6759a4a9 GPencil Drawing: Enable polygon smoothing
This helps to reduce jaggies from thin lines, while also resulting in nicer
lines elsewhere.

I'm not sure if it's just me, but it seems to render slightly differently to
before for 3d strokes too (i.e. they seem a bit softer). Hopefully the
difference isn't big enough to affect/degrade the art style of any projects.
2014-12-02 12:51:55 +13:00
0efa41e996 Fix rare crash dragging number-buttons
Could happen dragging shape-keys UIList & the lower slider at once.
2014-12-01 23:39:06 +01:00
44df4242fa UI messages: Minor typo fix. 2014-12-01 22:25:54 +01:00
e35b4bac0a Collada Importer: Separated finding bone chains and fixing leaf bone orientations into 2 functions and added a separated import option 2014-12-01 20:31:59 +01:00
670f5deda6 Fix for potential bug in paint brush RNA updates, was casting to wrong
DNA type.

The update function is for the Paint struct, containing a Brush pointer
property, not Brush itself. Probably went fine so far because was only
used for a notifier pointer, but still ...
2014-12-01 19:54:19 +01:00
ee010650f6 Python: add 'render_write' callback
This is useful for addons which intend to write data next to the rendered image/movie,
but not for preview renders.
2014-12-01 18:47:39 +01:00
20a1778148 Cleanup: more int->bool. 2014-12-01 17:11:55 +01:00
9c782c17ba Cleanup: hopefully last int->bool one in this area! 2014-12-01 17:11:55 +01:00
f2c3b5a384 CMake: Warning re: editing windows/py extraction 2014-12-01 16:25:20 +01:00
4ee53074aa Dim down default (no) material for cycles so it matches default material
in blender internal
2014-12-01 16:21:02 +01:00
72f75927f5 Fix T42588: Absolute paths not cleaned on win32
Making paths absolute would leave in "\..\" part on windows.
2014-12-01 16:01:08 +01:00
7d88f0ce4d CMake: fix for msvc (take2) 2014-12-01 15:36:35 +01:00
3bd46904be Cleanup: warnings 2014-12-01 14:54:13 +01:00
22ecceec4a CMake: fix for MSVC, installing Python 2014-12-01 14:54:13 +01:00
4ad0d33d69 UI: auto-run error could push buttons off the visible header 2014-12-01 14:54:13 +01:00
e7de96f5eb Fix: Strokes in image editor can finally be drawn using "fancy" 2D stroke tesslation
Inspired by the previous commit, I've finally found a way to fix a long standing
limitation/bug which meant that Grease Pencil strokes in the Image Editor could
not be drawn using the fancy stroke tesselation code, and were instead done using
the plain old OpenGL strokes instead.
2014-12-02 01:19:49 +13:00
dfc56f1776 Fix: Volumetric strokes now draw correctly in the Image Editor
This needed a correction factor (currently hardcoded to be 1 / 1000)
as it seems that the image editor uses 1 unit as its MAXIMUM dimension
whereas everything else uses 1 unit = 1 pixel.
2014-12-02 01:19:48 +13:00
965a49a3e6 Fix: Forgot to set fill colour when drawing 2D filled strokes 2014-12-02 01:19:48 +13:00
11ad517536 Fix: Changing Grease Pencil datablocks updates the view 2014-12-02 01:19:46 +13:00
8d42c2f3ea Improved Collada Armature Import
Collada does not support Bone length. It has only Joints.
This patch tries to improve the necessary "guesswork" for
importing Rigs.

Differential Revision: https://developer.blender.org/D920
2014-12-01 12:08:26 +01:00
e240bd3932 Re-enabling keymappings for straight line and poly drawing
These are no longer blocked by the pie hotkeys, so they shouldn't be a problem
2014-12-01 12:37:20 +13:00
2334e5ecd4 Bugfix T42763: In GPencil Edit Strokes: Proportional edit mode hidden when there is no active object in scene 2014-12-01 12:36:05 +13:00
Alexandr Kuznetsov
dc199369d1 Fix T42426. Add support for UK "`" key.
Because key == OEM_8, there no clear conversion for different keyboard layouts.
Also, we must map key to GhostKey for shortcuts.
2014-11-30 14:44:53 -05:00
Alexandr Kuznetsov
29c2b70a2c Fixed T35128. Progress bar sync on Windows.
Apply for all windows instead of active, otherwise progress doesn't update.
2014-11-30 13:33:51 -05:00
b7d053beaa Cleanup: warnings & space 2014-11-30 19:28:59 +01:00
fd4cd626be More fixes related to D&D:
* Same issue as T42760 was also reproducible in some cases in 3DView.
* You got an error message about missing RNA prop in some drop-called operators.
* You could not drop a movie file in nodes, (some cases of) 3DView, nor ImageEditor.
2014-11-30 17:21:39 +01:00
503dbb65c0 Fix T42760: Drag-to-add feature fails in a case.
We have to unset 'name' when we set 'filepath', and vice-versa.
2014-11-30 17:21:39 +01:00
b12dbdd93b Minor tweaks to quick palettes to avoid conflicts
For now, let's move the GPencil pies to avoid conflicts with dyntopo and other things
* DQ = Main pie (previously Ctrl-D; DD was too unpredictable)
* DW = Settings pie
2014-12-01 02:49:36 +13:00
f0278387e8 Typo fix for comment 2014-12-01 02:49:35 +13:00
9ddc4b1fba Cleanup: tag unused args as such. 2014-11-30 14:39:11 +01:00
5f4c99e66f Fix for wrong RNA type causing asserts to fail in debug mode 2014-12-01 02:28:41 +13:00
75aaa476cb Removing last vestigial remains of old C-based UI for Grease Pencil
I'd kept the code around in the codebase until after the merge back to master
to avoid having too many conflicts if things changed there (or in case we
needed to roll back). Now, it's safe to jettison this!
2014-12-01 02:24:55 +13:00
14b951747f Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.

The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
   - Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
     to enter "Stroke Edit Mode". In this mode, many common editing tools will
     operate on Grease Pencil stroke points instead.
   - Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
     Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
   - Proportional Editing works when using the transform tools

2) Grease Pencil stroke settings can now be animated
   NOTE: Currently drivers don't work, but if time allows, this may still be
         added before the release.

3) Strokes can be drawn with "filled" interiors, using a separate set of
   colour/opacity settings to the ones used for the lines themselves.

   This makes use of OpenGL filled polys, which has the limitation of only
   being able to fill convex shapes. Some artifacts may be visible on concave
   shapes (e.g. pacman's mouth will be overdrawn)

4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
   has been added which draws strokes as a series of screen-aligned discs.

   While this was originally a partial experimental technique at getting better
   quality 3D lines, the effects possible using this technique were interesting
   enough to warrant making this a dedicated feature. Best results when partial
   opacity and large stroke widths are used.

5) Improved Onion Skinning Support
   - Different colours can be selected for the before/after ghosts. To do so,
     enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
     the colours accordingly.
   - Different numbers of ghosts can be shown before/after the current frame

6) Grease Pencil datablocks are now attached to the scene by default instead of
   the active object.
   - For a long time, the object-attachment has proved to be quite problematic
     for users to keep track of. Now that this is done at scene level, it is
     easier for most users to use.
   - An exception for old files (and for any addons which may benefit from object
     attachment instead), is that if the active object has a Grease Pencil datablock,
     that will be used instead.
   - It is not currently possible to choose object-attachment from the UI, but
     it is simple to do this from the console instead, by doing:
     context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]

7) Various UI Cleanups
   - The layers UI has been cleaned up to use a list instead of the nested-panels
     design. Apart from saving space, this is also much nicer to look at now.

   - The UI code is now all defined in Python. To support this, it has been necessary
     to add some new context properties to make it easier to access these settings.
     e.g. "gpencil_data" for the datablock
          "active_gpencil_layer" and "active_gpencil_frame" for active data,
          "editable_gpencil_strokes" for the strokes that can be edited

   - The "stroke placement/alignment" settings (previously "Drawing Settings" at the
     bottom of the Grease Pencil panel in the Properties Region) is now located in
     the toolbar. These were more toolsettings than properties for how GPencil got drawn.

   - "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
     suggestion for an earlier discussion on developer.blender.org

   - By default, the painting operator will wait for a mouse button to be pressed
     before it starts creating the stroke. This is to make it easier to include
     this operator in various toolbars/menus/etc.   To get it immediately starting
     (as when you hold down DKEy to draw), set "wait_for_input" to False.

   - GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor

   - Toolbar panels have been added to all the other editors which support these.

8) Pie menus for quick-access to tools
   A set of experimental pie menus has been included for quick access to many
   tools and settings. It is not necessary to use these to get things done,
   but they have been designed to help make certain common tasks easier.

   - Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
              spatially stable manner.
   - D Q    = "Quick Settings" pie. This allows quick access to the active
              layer's settings. Notably, colours, thickness, and turning
              onion skinning on/off.
2014-12-01 01:52:06 +13:00
de724a258e Merge branch 'master' into texture_nodes_refactor 2014-10-14 10:36:27 +02:00
a4ba73311b Port some more nodes
Now only node group remained to be ported, all the rest of the nodes
cant' be actually supported and will be removed.

As a replacement for them we'll bring some more control by adding
some mapping sockets to the input nodes.
2014-10-14 00:50:26 +06:00
b35aafab6a Port procedural texture nodes to new framework 2014-10-13 21:09:38 +06:00
94dd73b995 Support some more nodes 2014-10-11 22:57:53 +06:00
e9e555fb85 Port several more nodes to the new system
Need to switch to some other work now, maybe someone will want to play
around with the code meanwhile.
2014-10-11 21:50:15 +06:00
5c50820e6a Bring back image input, checker, viewer and output nodes
This more like a prove-of-concept change because well, we've got
a dependency solver in the nodes already which seems to work just
fine for the shading nodes. So want to see if this is something we
can use for texture nodes now.

This isn't that far away from the original idea of having some
SVM-like machine for texture nodes.

Hell of a lot of nodes are not gonna to work yet,
2014-10-11 21:01:16 +06:00
f5c526f29c Port texture nodes to the exec pool in renderer
This only makes it so renderer uses the proper API to deal with the
tree evaluation. Tree nodes still does nothing because all the delegate
system has been just removed.

Painting and sculpting will also fail and abort .
2014-10-11 19:22:54 +06:00
4bd79aca12 Revert "Cycles: Implement an area preserving parameterization sampling for area lamps"
This reverts commit c4235ce820.
2014-10-11 19:05:09 +06:00
b2d6cd2e33 Bring material nodes back to the render engine
The idea is to make make it so per-tree execution data is owned by
the renderer and being passed to the tree evaluation routines.
2014-10-11 19:03:37 +06:00
98bd0b4027 Get rid of old legacy stuff happening all over the place
Basically get rid of texture nodes deligates and exec data stored
in the DNA node tree structure.

Blender is pretty much unusable now, because there are whole areas
to be ported over.
2014-10-11 17:01:16 +06:00
c4235ce820 Cycles: Implement an area preserving parameterization sampling for area lamps
Replace old code for area lamps which was more like incorrect with more correct
one using the following paper as a reference:

  Carlos Urena et al.
  An Area-Preserving Parametrization for Spherical Rectangles.
  https://www.solidangle.com/research/egsr2013_spherical_rectangle.pdf

Implementation is straight from the paper, currently the rectangle contants are
calculated for each of the samples. Ideally we need to pre-calculate them.

The old PDF is still used, which makes difference real subtle. This is to be
corrected before final commit.

Reviewers: brecht, juicyfruit

Subscribers: dingto, ton

Differential Revision: https://developer.blender.org/D823
2014-10-11 15:53:23 +06:00
391 changed files with 10331 additions and 3194 deletions

View File

@@ -318,6 +318,9 @@ mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# Misc
if(WIN32)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
endif()
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ${_init_INPUT_NDOF})
option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
option(WITH_OPENNL "Enable use of Open Numerical Library" ON)
@@ -351,7 +354,7 @@ option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_50 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build cycles with logging support" OFF)
option(WITH_CYCLES_LOGGING "Build cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build cycles with extra debug capabilities" OFF)
mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG)
@@ -1151,6 +1154,10 @@ elseif(WIN32)
list(APPEND PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi)
if(WITH_INPUT_IME)
list(APPEND PLATFORM_LINKLIBS imm32)
endif()
add_definitions(
-D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE
@@ -1506,6 +1513,11 @@ elseif(WIN32)
endif()
list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi)
if(WITH_INPUT_IME)
list(APPEND PLATFORM_LINKLIBS -limm32)
endif()
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
if(WITH_MINGW64)

View File

@@ -113,7 +113,7 @@ endif
# -----------------------------------------------------------------------------
# Build Blender
all:
all: FORCE
@echo
@echo Configuring Blender ...
@@ -142,13 +142,13 @@ bpy: all
# -----------------------------------------------------------------------------
# Configuration (save some cd'ing around)
config:
config: FORCE
$(CMAKE_CONFIG_TOOL) "$(BUILD_DIR)"
# -----------------------------------------------------------------------------
# Help for build targets
help:
help: FORCE
@echo ""
@echo "Convenience targets provided for building blender, (multiple at once can be used)"
@echo " * debug - build a debug binary"
@@ -214,13 +214,13 @@ help:
# -----------------------------------------------------------------------------
# Packages
#
package_debian:
package_debian: FORCE
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
package_pacman:
package_pacman: FORCE
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg --asroot
package_archive:
package_archive: FORCE
make -C "$(BUILD_DIR)" -s package_archive
@echo archive in "$(BUILD_DIR)/release"
@@ -228,24 +228,24 @@ package_archive:
# -----------------------------------------------------------------------------
# Tests
#
test:
test: FORCE
cd $(BUILD_DIR) ; ctest . --output-on-failure
# run pep8 check check on scripts we distribute.
test_pep8:
test_pep8: FORCE
python3 tests/python/pep8.py > test_pep8.log 2>&1
@echo "written: test_pep8.log"
# run some checks on our cmakefiles.
test_cmake:
test_cmake: FORCE
python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
@echo "written: test_cmake_consistency.log"
# run deprecation tests, see if we have anything to remove.
test_deprecated:
test_deprecated: FORCE
python3 tests/check_deprecated.py
test_style_c:
test_style_c: FORCE
# run our own checks on C/C++ style
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
@@ -253,7 +253,7 @@ test_style_c:
"$(BLENDER_DIR)/source/creator" \
--no-length-check
test_style_c_qtc:
test_style_c_qtc: FORCE
# run our own checks on C/C++ style
USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 python3 \
@@ -266,7 +266,7 @@ test_style_c_qtc:
@echo "written: test_style.tasks"
test_style_osl:
test_style_osl: FORCE
# run our own checks on C/C++ style
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
@@ -274,7 +274,7 @@ test_style_osl:
"$(BLENDER_DIR)/release/scripts/templates_osl"
test_style_osl_qtc:
test_style_osl_qtc: FORCE
# run our own checks on C/C++ style
USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 python3 \
@@ -289,13 +289,13 @@ test_style_osl_qtc:
# Project Files
#
project_qtcreator:
project_qtcreator: FORCE
python3 build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
project_netbeans:
project_netbeans: FORCE
python3 build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
project_eclipse:
project_eclipse: FORCE
cmake -G"Eclipse CDT4 - Unix Makefiles" -H"$(BLENDER_DIR)" -B"$(BUILD_DIR)"
@@ -303,40 +303,40 @@ project_eclipse:
# Static Checking
#
check_cppcheck:
check_cppcheck: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt"
check_clang_array:
check_clang_array: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
check_splint:
check_splint: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
check_sparse:
check_sparse: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
check_smatch:
check_smatch: FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
check_spelling_py:
check_spelling_py: FORCE
cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/release/scripts"
check_spelling_c:
check_spelling_c: FORCE
cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
@@ -345,7 +345,7 @@ check_spelling_c:
"$(BLENDER_DIR)/intern/guardedalloc" \
"$(BLENDER_DIR)/intern/ghost" \
check_spelling_c_qtc:
check_spelling_c_qtc: FORCE
cd "$(BUILD_DIR)" ; USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
@@ -356,13 +356,13 @@ check_spelling_c_qtc:
> \
"$(BLENDER_DIR)/check_spelling_c.tasks"
check_spelling_osl:
check_spelling_osl: FORCE
cd "$(BUILD_DIR)" ;\
PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
check_descriptions:
check_descriptions: FORCE
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python \
"$(BLENDER_DIR)/source/tools/check_source/check_descriptions.py"
@@ -370,14 +370,14 @@ check_descriptions:
# Utilities
#
tgz:
tgz: FORCE
./build_files/utils/build_tgz.sh
icons:
icons: FORCE
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
update:
update: FORCE
if [ -d "../lib" ]; then \
svn update ../lib/* ; \
fi
@@ -390,23 +390,23 @@ update:
#
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py:
doc_py: FORCE
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py
cd doc/python_api ; sphinx-build -b html sphinx-in sphinx-out
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
doc_doxy:
doc_doxy: FORCE
cd doc/doxygen; doxygen Doxyfile
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna:
doc_dna: FORCE
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man:
doc_man: FORCE
python3 doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
help_features:
help_features: FORCE
@python3 -c \
"import re; \
print('\n'.join([ \
@@ -417,7 +417,9 @@ help_features:
if w.startswith('WITH_')]))" | uniq
clean:
clean: FORCE
$(MAKE) -C "$(BUILD_DIR)" clean
.PHONY: all
FORCE:

View File

@@ -266,6 +266,7 @@ if 'blenderlite' in B.targets:
target_env_defs['WITH_BF_BOOLEAN'] = False
target_env_defs['WITH_BF_REMESH'] = False
target_env_defs['WITH_BF_PYTHON'] = False
target_env_defs['WITH_BF_IME'] = False
target_env_defs['WITH_BF_3DMOUSE'] = False
target_env_defs['WITH_BF_LIBMV'] = False
target_env_defs['WITH_BF_FREESTYLE'] = False

View File

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

View File

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

View File

@@ -83,6 +83,9 @@ ENDIF(OPENCOLORIO_FOUND)
MARK_AS_ADVANCED(
OPENCOLORIO_INCLUDE_DIR
OPENCOLORIO_LIBRARY
OPENCOLORIO_OPENCOLORIO_LIBRARY
OPENCOLORIO_TINYXML_LIBRARY
OPENCOLORIO_YAML-CPP_LIBRARY
)
UNSET(COMPONENT)

View File

@@ -205,7 +205,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
#Freestyle
WITH_BF_FREESTYLE = True

View File

@@ -170,6 +170,8 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
WITH_BF_IME = True
WITH_BF_OPENMP = True
#CUDA
@@ -198,6 +200,9 @@ CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi']
if WITH_BF_IME:
LLIBS.append('-limm32')
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
## DISABLED, causes linking errors!

View File

@@ -151,6 +151,8 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
WITH_BF_IME = True
WITH_BF_3DMOUSE = True
WITH_BF_OPENMP = True
@@ -197,7 +199,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
@@ -237,6 +239,9 @@ CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
if WITH_BF_IME:
LLIBS.append('imm32')
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
# # Todo

View File

@@ -169,6 +169,8 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']
WITH_BF_IME = True
WITH_BF_OPENMP = True
#Freestyle
@@ -192,6 +194,9 @@ CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread']
if WITH_BF_IME:
LLIBS.append('-limm32')
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
## DISABLED, causes linking errors!

View File

@@ -154,6 +154,8 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
WITH_BF_IME = True
WITH_BF_3DMOUSE = True
WITH_BF_OPENMP = True
@@ -200,7 +202,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
@@ -244,6 +246,9 @@ CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
if WITH_BF_IME:
LLIBS.append('imm32')
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
BF_CYCLES_CUDA_ENV="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd"

View File

@@ -390,6 +390,10 @@ def creator(env):
incs.append('#/extern/libmv')
defs.append('WITH_LIBMV')
if env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']:
incs.append('#/intern/cycles/blender')
defs.append('WITH_CYCLES_LOGGING')
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')
@@ -650,7 +654,7 @@ def WinPyBundle(target=None, source=None, env=None):
# Extract Numpy
if env['WITH_BF_PYTHON_INSTALL_NUMPY']:
py_tar = env.subst(env['LCGDIR']).lstrip("#")
py_tar += '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_numpy_1.8.tar.gz'
py_tar += '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_numpy_1.9.tar.gz'
py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#")
py_target = os.path.join(py_target, VERSION, 'python', 'lib', 'site-packages')

View File

@@ -174,6 +174,7 @@ def validate_arguments(args, bc):
'WITH_BF_CXX_GUARDEDALLOC',
'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
'BUILDBOT_BRANCH',
'WITH_BF_IME',
'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC',
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'BF_CYCLES_CUDA_ENV',
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
@@ -197,7 +198,7 @@ def validate_arguments(args, bc):
'C_WARN', 'CC_WARN', 'CXX_WARN',
'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID',
'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET',
'WITH_BF_CYCLES_DEBUG'
'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING'
]
@@ -507,6 +508,8 @@ def read_opts(env, cfg, args):
(BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
(BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
(BoolVariable('WITH_BF_IME', 'Enable Input Method Editor (IME) for complex Asian character input', False)),
(BoolVariable('WITH_BF_3DMOUSE', 'Build blender with support of 3D mouses', False)),
(BoolVariable('WITH_BF_STATIC3DMOUSE', 'Staticly link to 3d mouse library', False)),
('BF_3DMOUSE', '3d mouse library base path', ''),
@@ -605,6 +608,7 @@ def read_opts(env, cfg, args):
('BF_CYCLES_CUDA_ENV', 'preset environement nvcc will execute in', ''),
('BF_CYCLES_CUDA_BINARIES_ARCH', 'CUDA architectures to compile binaries for', []),
(BoolVariable('WITH_BF_CYCLES_DEBUG', 'Build Cycles engine with extra debugging capabilities', False)),
(BoolVariable('WITH_BF_CYCLES_LOGGING', 'Build Cycles engine with logging support', True)),
(BoolVariable('WITH_BF_OIIO', 'Build with OpenImageIO', False)),
(BoolVariable('WITH_BF_STATICOIIO', 'Statically link to OpenImageIO', False)),

View File

@@ -37,13 +37,42 @@ set(SRC
libmv-capi.h
)
if(WITH_LIBMV)
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
list(APPEND INC
third_party/gflags
third_party/glog/src
third_party/ceres/include
third_party/ceres/config
../../intern/guardedalloc
)
list(APPEND
INC_SYS
../Eigen3
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
if(WIN32)
list(APPEND INC
third_party/glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
endif()
add_definitions(
-DWITH_LIBMV_GUARDED_ALLOC
-DGOOGLE_GLOG_DLL_DECL=
-DLIBMV_NO_FAST_DETECTOR=
)
endif()
if(WITH_LIBMV)
TEST_SHARED_PTR_SUPPORT()
if(SHARED_PTR_FOUND)
if(SHARED_PTR_TR1_MEMORY_HEADER)
@@ -56,20 +85,6 @@ if(WITH_LIBMV)
message(FATAL_ERROR "Unable to find shared_ptr.")
endif()
list(APPEND INC
third_party/gflags
third_party/glog/src
third_party/ceres/include
third_party/ceres/config
../../intern/guardedalloc
)
list(APPEND INC_SYS
../Eigen3
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
list(APPEND SRC
intern/autotrack.cc
intern/camera_intrinsics.cc
@@ -202,17 +217,6 @@ if(WITH_LIBMV)
third_party/msinttypes/stdint.h
)
if(WIN32)
list(APPEND INC
third_party/glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
endif()
if(WITH_GTESTS)
blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "" "")
@@ -262,7 +266,7 @@ if(WITH_LIBMV)
endif()
# make GLog a separate target, so it can be used for gtest as well.
if(WITH_LIBMV OR WITH_GTESTS OR WITH_CYCLES_LOGGING)
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
# We compile GLog together with GFlag so we don't worry about
# adding extra lib to linker.
set(GLOG_SRC
@@ -338,13 +342,5 @@ if(WITH_LIBMV OR WITH_GTESTS OR WITH_CYCLES_LOGGING)
)
endif()
set(GLOG_INC
third_party/gflags
third_party/glog/src
)
set(GLOG_INC_SYS
)
blender_add_lib(extern_glog "${GLOG_SRC}" "${GLOG_INC}" "${GLOG_INC_SYS}")
blender_add_lib(extern_glog "${GLOG_SRC}" "${INC}" "${INC_SYS}")
endif()

View File

@@ -12,6 +12,22 @@ Import('env')
defs = []
incs = '.'
if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
incs += ' ../Eigen3 third_party/gflags third_party/glog/src third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
else:
incs += ' ./third_party/glog/src'
if env['WITH_BF_LIBMV']:
if not env['WITH_SHARED_PTR_SUPPORT']:
print("-- Unable to find shared_ptr which is required for compilation.")
@@ -22,10 +38,6 @@ if env['WITH_BF_LIBMV']:
if env['SHARED_PTR_NAMESPACE'] == 'std::tr1':
defs.append('CERES_TR1_SHARED_PTR')
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
src = env.Glob('intern/*.cc')
src.remove('intern' + os.sep + 'stub.cc')
src += env.Glob('libmv/autotrack/*.cc')
@@ -36,27 +48,22 @@ if env['WITH_BF_LIBMV']:
src += env.Glob('libmv/simple_pipeline/*.cc')
src += env.Glob('libmv/tracking/*.cc')
src += env.Glob('third_party/gflags/*.cc')
incs += ' ../Eigen3 third_party/gflags third_party/glog/src third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
src += ['./third_party/glog/src/windows/port.cc']
else:
src += env.Glob("third_party/glog/src/*.cc")
incs += ' ./third_party/glog/src'
else:
src = env.Glob("intern/stub.cc")
src = [src for src in src if src.find('_test.cc') == -1]
env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] )
env.BlenderLib(libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])
if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
glog_src = []
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
glog_src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
glog_src += ['./third_party/glog/src/windows/port.cc']
else:
glog_src += env.Glob("third_party/glog/src/*.cc")
env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])
if env['WITH_BF_LIBMV']:
SConscript(['third_party/SConscript'])

124
extern/libmv/bundle.sh vendored
View File

@@ -130,25 +130,7 @@ set(SRC
libmv-capi.h
)
if(WITH_LIBMV)
add_definitions(
-DWITH_LIBMV_GUARDED_ALLOC
-DGOOGLE_GLOG_DLL_DECL=
-DLIBMV_NO_FAST_DETECTOR=
)
TEST_SHARED_PTR_SUPPORT()
if(SHARED_PTR_FOUND)
if(SHARED_PTR_TR1_MEMORY_HEADER)
add_definitions(-DCERES_TR1_MEMORY_HEADER)
endif()
if(SHARED_PTR_TR1_NAMESPACE)
add_definitions(-DCERES_TR1_SHARED_PTR)
endif()
else()
message(FATAL_ERROR "Unable to find shared_ptr.")
endif()
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
list(APPEND INC
third_party/gflags
third_party/glog/src
@@ -163,6 +145,38 @@ if(WITH_LIBMV)
\${ZLIB_INCLUDE_DIRS}
)
if(WIN32)
list(APPEND INC
third_party/glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
endif()
add_definitions(
-DWITH_LIBMV_GUARDED_ALLOC
-DGOOGLE_GLOG_DLL_DECL=
-DLIBMV_NO_FAST_DETECTOR=
)
endif()
if(WITH_LIBMV)
TEST_SHARED_PTR_SUPPORT()
if(SHARED_PTR_FOUND)
if(SHARED_PTR_TR1_MEMORY_HEADER)
add_definitions(-DCERES_TR1_MEMORY_HEADER)
endif()
if(SHARED_PTR_TR1_NAMESPACE)
add_definitions(-DCERES_TR1_SHARED_PTR)
endif()
else()
message(FATAL_ERROR "Unable to find shared_ptr.")
endif()
list(APPEND SRC
intern/autotrack.cc
intern/camera_intrinsics.cc
@@ -194,17 +208,6 @@ ${headers}
${third_headers}
)
if(WIN32)
list(APPEND INC
third_party/glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
endif()
if(WITH_GTESTS)
blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "${INC}" "${INC_SYS}")
@@ -213,7 +216,7 @@ ${tests}
endif()
else()
list(APPEND SRC
libmv-capi_stub.cc
intern/stub.cc
)
endif()
@@ -224,7 +227,7 @@ if(WITH_LIBMV)
endif()
# make GLog a separate target, so it can be used for gtest as well.
if(WITH_LIBMV OR WITH_GTESTS OR WITH_CYCLES_LOGGING)
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
# We compile GLog together with GFlag so we don't worry about
# adding extra lib to linker.
set(GLOG_SRC
@@ -267,15 +270,7 @@ ${third_glog_headers}
)
endif()
set(GLOG_INC
third_party/gflags
third_party/glog/src
)
set(GLOG_INC_SYS
)
blender_add_lib(extern_glog "\${GLOG_SRC}" "\${GLOG_INC}" "\${GLOG_INC_SYS}")
blender_add_lib(extern_glog "\${GLOG_SRC}" "\${INC}" "\${INC_SYS}")
endif()
EOF
@@ -294,6 +289,22 @@ Import('env')
defs = []
incs = '.'
if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
incs += ' ../Eigen3 third_party/gflags third_party/glog/src third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
else:
incs += ' ./third_party/glog/src'
if env['WITH_BF_LIBMV']:
if not env['WITH_SHARED_PTR_SUPPORT']:
print("-- Unable to find shared_ptr which is required for compilation.")
@@ -304,34 +315,25 @@ if env['WITH_BF_LIBMV']:
if env['SHARED_PTR_NAMESPACE'] == 'std::tr1':
defs.append('CERES_TR1_SHARED_PTR')
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
src = env.Glob('intern/*.cc')
src.remove('intern' + os.sep + 'stub.cc')
$src
incs += ' ../Eigen3 third_party/gflags third_party/glog/src third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
${win_src}
src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
src += ['./third_party/glog/src/windows/port.cc']
else:
src += env.Glob("third_party/glog/src/*.cc")
incs += ' ./third_party/glog/src'
else:
src = env.Glob("intern/stub.cc")
src = [src for src in src if src.find('_test.cc') == -1]
env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] )
env.BlenderLib(libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])
if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
glog_src = []
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
glog_src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
glog_src += ['./third_party/glog/src/windows/port.cc']
else:
glog_src += env.Glob("third_party/glog/src/*.cc")
env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])
if env['WITH_BF_LIBMV']:
SConscript(['third_party/SConscript'])

View File

@@ -61,6 +61,7 @@ struct libmv_Reconstruction {
CameraIntrinsics *intrinsics;
double error;
bool is_valid;
};
namespace {
@@ -289,6 +290,12 @@ libmv_Reconstruction *libmv_solveReconstruction(
LG << "number of markers for init: " << keyframe_markers.size();
if (keyframe_markers.size() < 8) {
LG << "No enough markers to initialize from";
libmv_reconstruction->is_valid = false;
return libmv_reconstruction;
}
update_callback.invoke(0, "Initial reconstruction");
EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction);
@@ -319,6 +326,7 @@ libmv_Reconstruction *libmv_solveReconstruction(
progress_update_callback,
callback_customdata);
libmv_reconstruction->is_valid = true;
return (libmv_Reconstruction *) libmv_reconstruction;
}
@@ -377,9 +385,14 @@ libmv_Reconstruction *libmv_solveModal(
progress_update_callback,
callback_customdata);
libmv_reconstruction->is_valid = true;
return (libmv_Reconstruction *) libmv_reconstruction;
}
int libmv_reconstructionIsValid(libmv_Reconstruction *libmv_reconstruction) {
return libmv_reconstruction->is_valid;
}
void libmv_reconstructionDestroy(libmv_Reconstruction *libmv_reconstruction) {
LIBMV_OBJECT_DELETE(libmv_reconstruction->intrinsics, CameraIntrinsics);
LIBMV_OBJECT_DELETE(libmv_reconstruction, libmv_Reconstruction);

View File

@@ -68,6 +68,8 @@ libmv_Reconstruction* libmv_solveModal(
reconstruct_progress_update_cb progress_update_callback,
void* callback_customdata);
int libmv_reconstructionIsValid(libmv_Reconstruction *libmv_reconstruction);
void libmv_reconstructionDestroy(libmv_Reconstruction* libmv_reconstruction);
int libmv_reprojectionPointForTrack(

View File

@@ -138,6 +138,10 @@ libmv_Reconstruction *libmv_solveModal(
return NULL;
}
int libmv_reconstructionIsValid(libmv_Reconstruction * /*libmv_reconstruction*/) {
return 0;
}
int libmv_reprojectionPointForTrack(
const libmv_Reconstruction * /*libmv_reconstruction*/,
int /*track*/,

View File

@@ -34,6 +34,11 @@
#if defined (__APPLE__)
# include <libkern/OSAtomic.h>
#elif defined(_MSC_VER)
# define NOGDI
# ifndef NOMINMAX
# define NOMINMAX
# endif
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#elif defined(__arm__)
/* Attempt to fix compilation error on Debian armel kernel.
@@ -97,13 +102,13 @@ atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new)
ATOMIC_INLINE uint64_t
atomic_add_uint64(uint64_t *p, uint64_t x)
{
return InterlockedExchangeAdd64(p, x);
return InterlockedExchangeAdd64((int64_t *)p, (int64_t)x);
}
ATOMIC_INLINE uint64_t
atomic_sub_uint64(uint64_t *p, uint64_t x)
{
return InterlockedExchangeAdd64(p, -((int64_t)x));
return InterlockedExchangeAdd64((int64_t *)p, -((int64_t)x));
}
ATOMIC_INLINE uint64_t

View File

@@ -163,6 +163,10 @@ include_directories(
${OPENEXR_INCLUDE_DIRS}
)
# TODO(sergey): Adjust so standalone repository is also happy.
include_directories(
../atomic
)
# Warnings
if(CMAKE_COMPILER_IS_GNUCXX)

View File

@@ -62,12 +62,23 @@ if env['WITH_BF_CYCLES_OSL']:
if env['WITH_BF_CYCLES_DEBUG']:
defs.append('WITH_CYCLES_DEBUG')
if env['WITH_BF_CYCLES_LOGGING']:
defs.append('WITH_CYCLES_LOGGING')
defs.append('GOOGLE_GLOG_DLL_DECL=')
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs.append('#extern/libmv/third_party/glog/src/windows')
incs.append('#extern/libmv/third_party/gflags')
else:
incs.append('#extern/libmv/third_party/glog/src')
incs.append('#extern/libmv/third_party/gflags')
incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna #source/blender/blenlib'.split())
incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split())
incs.append(env['BF_GLEW_INC'])
incs.append('#/intern/glew-mx')
incs.append('#/intern/atomic')
incs.append('#intern/mikktspace')
incs.extend('#extern/glew/include #extern/clew/include #extern/cuew/include #intern/mikktspace'.split())

View File

@@ -825,6 +825,14 @@ static void xml_read_background(const XMLReadState& state, pugi::xml_node node)
Shader *shader = state.scene->shaders[state.scene->default_background];
xml_read_bool(&shader->heterogeneous_volume, node, "heterogeneous_volume");
xml_read_int(&shader->volume_interpolation_method, node, "volume_interpolation_method");
if(xml_equal_string(node, "volume_sampling_method", "distance"))
shader->volume_sampling_method = VOLUME_SAMPLING_DISTANCE;
else if(xml_equal_string(node, "volume_sampling_method", "equiangular"))
shader->volume_sampling_method = VOLUME_SAMPLING_EQUIANGULAR;
else if(xml_equal_string(node, "volume_sampling_method", "multiple_importance"))
shader->volume_sampling_method = VOLUME_SAMPLING_MULTIPLE_IMPORTANCE;
xml_read_shader_graph(state, shader, node);
}

View File

@@ -20,6 +20,8 @@
#include "blender_sync.h"
#include "blender_util.h"
#include "util_logging.h"
CCL_NAMESPACE_BEGIN
/* Blender Camera Intermediate: we first convert both the offline and 3d view
@@ -400,6 +402,7 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, float motion_time)
tfm = blender_camera_matrix(tfm, cam->type);
if(tfm != cam->matrix) {
VLOG(1) << "Camera " << b_ob.name() << " motion detected.";
if(motion_time == -1.0f) {
cam->motion.pre = tfm;
cam->use_motion = true;

View File

@@ -27,6 +27,7 @@
#include "subd_split.h"
#include "util_foreach.h"
#include "util_logging.h"
#include "mikktspace.h"
@@ -761,11 +762,13 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion
if(new_attribute) {
if(i != numverts || memcmp(mP, &mesh->verts[0], sizeof(float3)*numverts) == 0) {
/* no motion, remove attributes again */
VLOG(1) << "No actual motion for mesh " << b_mesh.name();
mesh->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
if(attr_mN)
mesh->attributes.remove(ATTR_STD_MOTION_VERTEX_NORMAL);
}
else if(time_index > 0) {
VLOG(1) << "Filling motion for mesh " << b_mesh.name();
/* motion, fill up previous steps that we might have skipped because
* they had no motion, but we need them anyway now */
float3 *P = &mesh->verts[0];

View File

@@ -30,6 +30,7 @@
#include "util_foreach.h"
#include "util_hash.h"
#include "util_logging.h"
CCL_NAMESPACE_BEGIN
@@ -251,6 +252,7 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
if(object && (scene->need_motion() == Scene::MOTION_PASS || object_use_motion(b_ob))) {
/* object transformation */
if(tfm != object->tfm) {
VLOG(1) << "Object " << b_ob.name() << " motion detected.";
if(motion_time == -1.0f) {
object->motion.pre = tfm;
object->use_motion = true;

View File

@@ -105,7 +105,7 @@ static PyObject *create_func(PyObject *self, PyObject *args)
BL::UserPreferences userpref(userprefptr);
PointerRNA dataptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydata), &dataptr);
RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData data(dataptr);
PointerRNA sceneptr;
@@ -113,15 +113,15 @@ static PyObject *create_func(PyObject *self, PyObject *args)
BL::Scene scene(sceneptr);
PointerRNA regionptr;
RNA_id_pointer_create((ID*)pylong_as_voidptr_typesafe(pyregion), &regionptr);
RNA_pointer_create(NULL, &RNA_Region, pylong_as_voidptr_typesafe(pyregion), &regionptr);
BL::Region region(regionptr);
PointerRNA v3dptr;
RNA_id_pointer_create((ID*)pylong_as_voidptr_typesafe(pyv3d), &v3dptr);
RNA_pointer_create(NULL, &RNA_SpaceView3D, pylong_as_voidptr_typesafe(pyv3d), &v3dptr);
BL::SpaceView3D v3d(v3dptr);
PointerRNA rv3dptr;
RNA_id_pointer_create((ID*)pylong_as_voidptr_typesafe(pyrv3d), &rv3dptr);
RNA_pointer_create(NULL, &RNA_RegionView3D, pylong_as_voidptr_typesafe(pyrv3d), &rv3dptr);
BL::RegionView3D rv3d(rv3dptr);
/* create session */
@@ -196,7 +196,7 @@ static PyObject *bake_func(PyObject *self, PyObject *args)
void *b_result = PyLong_AsVoidPtr(pyresult);
PointerRNA bakepixelptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pypixel_array), &bakepixelptr);
RNA_pointer_create(NULL, &RNA_BakePixel, PyLong_AsVoidPtr(pypixel_array), &bakepixelptr);
BL::BakePixel b_bake_pixel(bakepixelptr);
python_thread_state_save(&session->python_thread_state);
@@ -238,7 +238,7 @@ static PyObject *reset_func(PyObject *self, PyObject *args)
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
PointerRNA dataptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydata), &dataptr);
RNA_main_pointer_create((Main*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData b_data(dataptr);
PointerRNA sceneptr;

View File

@@ -92,6 +92,7 @@ void BlenderSession::create_session()
/* reset status/progress */
last_status = "";
last_error = "";
last_progress = -1.0f;
start_resize_time = 0.0;
@@ -826,10 +827,8 @@ void BlenderSession::update_status_progress()
get_status(status, substatus);
get_progress(progress, total_time);
if(background) {
if(progress>0)
if(progress > 0)
remaining_time = (1.0 - (double)progress) * (total_time / (double)progress);
scene += " | " + b_scene.name();
@@ -843,12 +842,12 @@ void BlenderSession::update_status_progress()
if(samples > 0 && total_samples != USHRT_MAX)
remaining_time = (total_samples - samples) * (total_time / samples);
}
if(remaining_time>0) {
if(remaining_time > 0) {
BLI_timestr(remaining_time, time_str, sizeof(time_str));
timestatus += "Remaining:" + string(time_str) + " | ";
}
timestatus += string_printf("Mem:%.2fM, Peak:%.2fM", (double)mem_used, (double)mem_peak);
if(status.size() > 0)
@@ -865,6 +864,21 @@ void BlenderSession::update_status_progress()
b_engine.update_progress(progress);
last_progress = progress;
}
if (session->progress.get_error()) {
string error = session->progress.get_error_message();
if(error != last_error) {
/* TODO(sergey): Currently C++ RNA API doesn't let us to
* use mnemonic name for the variable. Would be nice to
* have this figured out.
*
* For until then, 1 << 5 means RPT_ERROR.
*/
b_engine.report(1 << 5, error.c_str());
b_engine.error_set(error.c_str());
last_error = error;
}
}
}
void BlenderSession::tag_update()

View File

@@ -91,6 +91,7 @@ public:
string b_rlay_name;
string last_status;
string last_error;
float last_progress;
int width, height;

View File

@@ -400,7 +400,7 @@ BVHNode* BVHBuild::build_node(const BVHRange& range, int level)
progress_total += left.size() + right.size() - range.size();
size_t total = progress_total;
/* leaft node */
/* left node */
BVHNode *leftnode = build_node(left, level + 1);
/* right node (modify start for splits) */

View File

@@ -76,7 +76,7 @@ public:
{
if(first_error) {
fprintf(stderr, "\nRefer to the Cycles GPU rendering documentation for possible solutions:\n");
fprintf(stderr, "http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/GPU_Rendering\n\n");
fprintf(stderr, "http://www.blender.org/manual/render/cycles/gpu_rendering.html\n\n");
first_error = false;
}
}
@@ -202,24 +202,8 @@ public:
/* compute cubin name */
int major, minor;
cuDeviceComputeCapability(&major, &minor, cuDevId);
string cubin;
/* ToDo: We don't bundle sm_52 kernel yet */
if(major == 5 && minor == 2) {
if(experimental)
cubin = path_get(string_printf("lib/kernel_experimental_sm_%d%d.cubin", major, minor));
else
cubin = path_get(string_printf("lib/kernel_sm_%d%d.cubin", major, minor));
if(path_exists(cubin))
/* self build sm_52 kernel? Use it. */
return cubin;
else
/* use 5.0 kernel as workaround */
minor = 0;
}
/* attempt to use kernel provided with blender */
if(experimental)
cubin = path_get(string_printf("lib/kernel_experimental_sm_%d%d.cubin", major, minor));

View File

@@ -681,7 +681,7 @@ ccl_device float3 shader_bsdf_subsurface(KernelGlobals *kg, ShaderData *sd)
for(int i = 0; i< sd->num_closure; i++) {
ShaderClosure *sc = &sd->closure[i];
if(CLOSURE_IS_BSSRDF(sc->type))
if(CLOSURE_IS_BSSRDF(sc->type) || CLOSURE_IS_BSDF_BSSRDF(sc->type))
eval += sc->weight;
}

View File

@@ -539,34 +539,25 @@ typedef enum AttributeStandard {
#define MAX_CLOSURE 1
#endif
/* TODO(sergey): This is rather nasty bug happening in here, which
* could be simply a compilers bug for which we can't find a generic
* platform independent workaround. Also even if it's a compiler
* issue, it's not so simple to upgrade the compiler in the release
* environment for Linux and doing it so closer to the release is
* rather a risky business.
*
* For this release it's probably safer to stick with such a rather
* dirty solution, and look for a cleaner fix during the next release
* cycle.
/* This struct is to be 16 bytes aligned, we also keep some extra precautions:
* - All the float3 members are in the beginning of the struct, so compiler
* does not put own padding trying to align this members.
* - We make sure OSL pointer is also 16 bytes aligned.
*/
typedef struct ShaderClosure {
ClosureType type;
float3 weight;
#ifndef __APPLE__
float3 N;
float3 T;
ClosureType type;
float sample_weight;
#endif
float data0;
float data1;
float data2;
int pad1, pad2, pad3;
float3 N;
float3 T;
#ifdef __APPLE__
float sample_weight;
#endif
#ifdef __OSL__
void *prim;
void *prim, *pad4;
#endif
} ShaderClosure;

View File

@@ -38,6 +38,7 @@ incs.append(env['BF_OIIO_INC'])
incs.append(env['BF_BOOST_INC'])
incs.append(env['BF_OSL_INC'])
incs.append(env['BF_OPENEXR_INC'].split())
incs.append('#/intern/atomic')
defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {')
defs.append('CCL_NAMESPACE_END=}')
@@ -46,6 +47,16 @@ defs.append('WITH_OSL')
if env['WITH_BF_CYCLES_DEBUG']:
defs.append('WITH_CYCLES_DEBUG')
if env['WITH_BF_CYCLES_LOGGING']:
defs.append('WITH_CYCLES_LOGGING')
defs.append('GOOGLE_GLOG_DLL_DECL=')
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs.append('#extern/libmv/third_party/glog/src/windows')
incs.append('#extern/libmv/third_party/gflags')
else:
incs.append('#extern/libmv/third_party/glog/src')
incs.append('#extern/libmv/third_party/gflags')
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
cxxflags.append('-DBOOST_NO_RTTI -DBOOST_NO_TYPEID /fp:fast'.split())
incs.append(env['BF_PTHREADS_INC'])

View File

@@ -189,7 +189,7 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O
/* optimization: it's possible to not use a prepare function at all and
* only initialize the actual class when accessing the closure component
* data, but then we need to map the id to the class somehow */
ss->register_closure(name, id, params, prepare, NULL);
ss->register_closure(name, id, params, prepare, NULL, 16);
}
void OSLShader::register_closures(OSLShadingSystem *ss_)

View File

@@ -15,6 +15,7 @@
*/
#include "stdosl.h"
#include "node_color.h"
shader node_combine_hsv(
float H = 0.0,
@@ -22,6 +23,6 @@ shader node_combine_hsv(
float V = 0.0,
output color Color = 0.8)
{
Color = color("hsv", H, S, V);
Color = color_srgb_to_scene_linear(color("hsv", H, S, V));
}

View File

@@ -23,6 +23,6 @@ shader node_normal(
output float Dot = 1.0)
{
NormalOut = normalize(Direction);
Dot = dot(NormalOut, NormalIn);
Dot = dot(NormalOut, normalize(NormalIn));
}

View File

@@ -23,7 +23,7 @@ shader node_separate_hsv(
output float S = 0.0,
output float V = 0.0)
{
color col = rgb_to_hsv(Color);
color col = rgb_to_hsv(color_scene_linear_to_srgb(Color));
H = col[0];
S = col[1];

View File

@@ -26,7 +26,8 @@ ccl_device void svm_node_combine_hsv(KernelGlobals *kg, ShaderData *sd, float *s
float value = stack_load_float(stack, value_in);
/* Combine, and convert back to RGB */
float3 color = hsv_to_rgb(make_float3(hue, saturation, value));
float3 color = color_srgb_to_scene_linear(
hsv_to_rgb(make_float3(hue, saturation, value)));
if (stack_valid(color_out))
stack_store_float3(stack, color_out, color);
@@ -40,7 +41,7 @@ ccl_device void svm_node_separate_hsv(KernelGlobals *kg, ShaderData *sd, float *
float3 color = stack_load_float3(stack, color_in);
/* Convert to HSV */
color = rgb_to_hsv(color);
color = rgb_to_hsv(color_scene_linear_to_srgb(color));
if (stack_valid(hue_out))
stack_store_float(stack, hue_out, color.x);

View File

@@ -59,6 +59,10 @@ Integrator::Integrator()
mesh_light_samples = 1;
subsurface_samples = 1;
volume_samples = 1;
sample_all_lights_direct = true;
sample_all_lights_indirect = true;
method = PATH;
sampling_pattern = SAMPLING_PATTERN_SOBOL;

View File

@@ -153,81 +153,83 @@ void Scene::device_update(Device *device_, Progress& progress)
progress.set_status("Updating Shaders");
shader_manager->device_update(device, &dscene, this, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Images");
image_manager->device_update(device, &dscene, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Background");
background->device_update(device, &dscene, this);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Objects");
object_manager->device_update(device, &dscene, this, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Meshes");
mesh_manager->device_update(device, &dscene, this, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Objects Flags");
object_manager->device_update_flags(device, &dscene, this, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Hair Systems");
curve_system_manager->device_update(device, &dscene, this, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Lookup Tables");
lookup_tables->device_update(device, &dscene);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
/* TODO(sergey): Make sure camera is not needed above. */
progress.set_status("Updating Camera");
camera->device_update(device, &dscene, this);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Lights");
light_manager->device_update(device, &dscene, this, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Particle Systems");
particle_system_manager->device_update(device, &dscene, this, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Film");
film->device_update(device, &dscene, this);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Integrator");
integrator->device_update(device, &dscene, this);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Lookup Tables");
lookup_tables->device_update(device, &dscene);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Baking");
bake_manager->device_update(device, &dscene, this, progress);
if(progress.get_cancel()) return;
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating Device", "Writing constant memory");
device->const_copy_to("__data", &dscene.data, sizeof(dscene.data));
if(device->have_error() == false) {
progress.set_status("Updating Device", "Writing constant memory");
device->const_copy_to("__data", &dscene.data, sizeof(dscene.data));
}
}
Scene::MotionType Scene::need_motion(bool advanced_shading)

View File

@@ -251,7 +251,7 @@ void Session::run_gpu()
update_scene();
if(!device->error_message().empty())
progress.set_cancel(device->error_message());
progress.set_error(device->error_message());
if(progress.get_cancel())
break;
@@ -292,7 +292,7 @@ void Session::run_gpu()
}
if(!device->error_message().empty())
progress.set_cancel(device->error_message());
progress.set_error(device->error_message());
tiles_written = update_progressive_refine(progress.get_cancel());
@@ -540,7 +540,7 @@ void Session::run_cpu()
update_scene();
if(!device->error_message().empty())
progress.set_cancel(device->error_message());
progress.set_error(device->error_message());
if(progress.get_cancel())
break;
@@ -558,7 +558,7 @@ void Session::run_cpu()
need_tonemap = true;
if(!device->error_message().empty())
progress.set_cancel(device->error_message());
progress.set_error(device->error_message());
}
device->task_wait();
@@ -580,7 +580,7 @@ void Session::run_cpu()
}
if(!device->error_message().empty())
progress.set_cancel(device->error_message());
progress.set_error(device->error_message());
tiles_written = update_progressive_refine(progress.get_cancel());
}
@@ -604,7 +604,7 @@ void Session::load_kernels()
if(message.empty())
message = "Failed loading render kernel, see console for errors";
progress.set_cancel(message);
progress.set_error(message);
progress.set_status("Error", message);
progress.set_update();
return;

View File

@@ -18,6 +18,15 @@
#define __SHADER_H__
#ifdef WITH_OSL
# if defined(_MSC_VER)
/* Prevent OSL from polluting the context with weird macros from windows.h.
* TODO(sergey): Ideally it's only enough to have class/struct declarations in
* the header and skip header include here.
*/
# define NOGDI
# define NOMINMAX
# define WIN32_LEAN_AND_MEAN
# endif
# include <OSL/oslexec.h>
#endif

View File

@@ -30,6 +30,7 @@ endif()
set(SRC_HEADERS
util_algorithm.h
util_args.h
util_atomic.h
util_boundbox.h
util_cache.h
util_debug.h

View File

@@ -0,0 +1,33 @@
/*
* Copyright 2014 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
#ifndef __UTIL_ATOMIC_H__
#define __UTIL_ATOMIC_H__
/* Using atomic ops header from Blender. */
#include "atomic_ops.h"
ATOMIC_INLINE void atomic_update_max_z(size_t *maximum_value, size_t value)
{
size_t prev_value = *maximum_value;
while (prev_value < value) {
if (atomic_cas_z(maximum_value, prev_value, value) != prev_value) {
break;
}
}
}
#endif /* __UTIL_ATOMIC_H__ */

View File

@@ -130,6 +130,9 @@
/* MinGW64 has conflicting declarations for these SSE headers in <windows.h>.
* Since we can't avoid including <windows.h>, better only include that */
#define NOGDI
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

View File

@@ -46,6 +46,8 @@ public:
update_cb = NULL;
cancel = false;
cancel_message = "";
error = false;
error_message = "";
cancel_cb = NULL;
}
@@ -79,6 +81,8 @@ public:
sync_substatus = "";
cancel = false;
cancel_message = "";
error = false;
error_message = "";
}
/* cancel */
@@ -108,6 +112,28 @@ public:
cancel_cb = function;
}
/* error */
void set_error(const string& error_message_)
{
thread_scoped_lock lock(progress_mutex);
error_message = error_message_;
error = true;
/* If error happens we also stop rendering. */
cancel_message = error_message_;
cancel = true;
}
bool get_error()
{
return error;
}
string get_error_message()
{
thread_scoped_lock lock(progress_mutex);
return error_message;
}
/* tile and timing information */
void set_start_time(double start_time_)
@@ -259,6 +285,9 @@ protected:
volatile bool cancel;
string cancel_message;
volatile bool error;
string error_message;
};
CCL_NAMESPACE_END

View File

@@ -17,6 +17,8 @@
#ifndef __UTIL_STATS_H__
#define __UTIL_STATS_H__
#include "util_atomic.h"
CCL_NAMESPACE_BEGIN
class Stats {
@@ -24,14 +26,13 @@ public:
Stats() : mem_used(0), mem_peak(0) {}
void mem_alloc(size_t size) {
mem_used += size;
if(mem_used > mem_peak)
mem_peak = mem_used;
atomic_add_z(&mem_used, size);
atomic_update_max_z(&mem_peak, mem_used);
}
void mem_free(size_t size) {
assert(mem_used >= size);
mem_used -= size;
atomic_sub_z(&mem_used, size);
}
size_t mem_used;

View File

@@ -280,6 +280,16 @@ elseif(WIN32)
)
endif()
if(WITH_INPUT_IME)
add_definitions(-DWITH_INPUT_IME)
list(APPEND SRC
intern/GHOST_ImeWin32.cpp
intern/GHOST_ImeWin32.h
)
endif()
if(WITH_INPUT_NDOF)
list(APPEND SRC
intern/GHOST_NDOFManagerWin32.cpp

View File

@@ -897,6 +897,30 @@ extern int GHOST_UseNativePixels(void);
*/
extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
/**
* Enable IME attached to the given window, i.e. allows user-input
* events to be dispatched to the IME.
* \param windowhandle Window handle of the caller
* \param x Requested x-coordinate of the rectangle
* \param y Requested y-coordinate of the rectangle
* \param w Requested width of the rectangle
* \param h Requested height of the rectangle
* \param complete Whether or not to complete the ongoing composition
* true: Start a new composition
* false: Move the IME windows to the given position without finishing it.
*/
extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 w,
GHOST_TInt32 h,
int complete);
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input
* events from being dispatched to the IME.
* \param windowhandle The window handle of the caller
*/
extern void GHOST_EndIME(GHOST_WindowHandle windowhandle);
#ifdef __cplusplus
}

View File

@@ -331,6 +331,29 @@ public:
virtual float getNativePixelSize(void) = 0;
#ifdef WITH_INPUT_IME
/**
* Enable IME attached to the given window, i.e. allows user-input
* events to be dispatched to the IME.
* \param x Requested x-coordinate of the rectangle
* \param y Requested y-coordinate of the rectangle
* \param w Requested width of the rectangle
* \param h Requested height of the rectangle
* \param complete Whether or not to complete the ongoing composition
* true: Start a new composition
* false: Move the IME windows to the given position without finishing it.
*/
virtual void beginIME(
GHOST_TInt32 x, GHOST_TInt32 y,
GHOST_TInt32 w, GHOST_TInt32 h,
int completed) = 0;
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input
* events from being dispatched to the IME.
*/
virtual void endIME() = 0;
#endif /* WITH_INPUT_IME */
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IWindow")

View File

@@ -190,6 +190,10 @@ typedef enum {
GHOST_kEventTimer,
GHOST_kEventImeCompositionStart,
GHOST_kEventImeComposition,
GHOST_kEventImeCompositionEnd,
GHOST_kNumEventTypes
} GHOST_TEventType;
@@ -436,6 +440,22 @@ typedef struct {
GHOST_TEventDataPtr data;
} GHOST_TEventDragnDropData;
/** similar to wmImeData */
typedef struct {
/** size_t */
GHOST_TUserDataPtr result_len, composite_len;
/** char * utf8 encoding */
GHOST_TUserDataPtr result, composite;
/** Cursor position in the IME composition. */
int cursor_position;
/** Represents the position of the beginning of the selection */
int target_start;
/** Represents the position of the end of the selection */
int target_end;
/** custom temporal data */
GHOST_TUserDataPtr tmp;
} GHOST_TEventImeData;
typedef struct {
int count;
GHOST_TUns8 **strings;

View File

@@ -154,6 +154,14 @@ if env['BF_GHOST_DEBUG']:
else:
sources.remove('intern' + os.sep + 'GHOST_EventPrinter.cpp')
if env['WITH_BF_IME'] and window_system in ('win32-vc', 'win32-mingw', 'win64-vc', 'win64-mingw'):
defs.append('WITH_INPUT_IME')
elif env['WITH_BF_IME']:
print "IME input is only supported on Windows! Please disable WITH_BF_IME!"
Exit()
else:
sources.remove('intern' + os.sep + 'GHOST_ImeWin32.cpp')
if env['WITH_BF_3DMOUSE']:
defs.append('WITH_INPUT_NDOF')

View File

@@ -915,3 +915,21 @@ float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
return 1.0f;
}
#ifdef WITH_INPUT_IME
void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x, GHOST_TInt32 y,
GHOST_TInt32 w, GHOST_TInt32 h,
int complete)
{
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
window->beginIME(x, y, w, h, complete);
}
void GHOST_EndIME(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
window->endIME();
}
#endif /* WITH_INPUT_IME */

View File

@@ -0,0 +1,517 @@
/*
* ***** 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) 2010 The Chromium Authors. All rights reserved.
* All rights reserved.
*
* The Original Code is: some of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file ghost/intern/GHOST_ImeWin32.cpp
* \ingroup GHOST
*/
#include "GHOST_C-api.h"
#include "GHOST_ImeWin32.h"
#include "GHOST_WindowWin32.h"
#include "utfconv.h"
GHOST_ImeWin32::GHOST_ImeWin32()
: ime_status_(false),
input_language_id_(LANG_USER_DEFAULT),
is_composing_(false),
system_caret_(false),
caret_rect_(-1, -1, 0, 0),
is_first(true),
is_enable(true)
{
}
GHOST_ImeWin32::~GHOST_ImeWin32()
{
}
bool GHOST_ImeWin32::SetInputLanguage()
{
/**
* Retrieve the current keyboard layout from Windows and determine whether
* or not the current input context has IMEs.
* Also save its input language for language-specific operations required
* while composing a text.
*/
HKL keyboard_layout = ::GetKeyboardLayout(0);
input_language_id_ = reinterpret_cast<LANGID>(keyboard_layout);
ime_status_ = ::ImmIsIME(keyboard_layout);
return ime_status_;
}
void GHOST_ImeWin32::CreateImeWindow(HWND window_handle)
{
/**
* When a user disables TSF (Text Service Framework) and CUAS (Cicero
* Unaware Application Support), Chinese IMEs somehow ignore function calls
* to ::ImmSetCandidateWindow(), i.e. they do not move their candidate
* window to the position given as its parameters, and use the position
* of the current system caret instead, i.e. it uses ::GetCaretPos() to
* retrieve the position of their IME candidate window.
* Therefore, we create a temporary system caret for Chinese IMEs and use
* it during this input context.
* Since some third-party Japanese IME also uses ::GetCaretPos() to determine
* their window position, we also create a caret for Japanese IMEs.
*/
if (PRIMARYLANGID(input_language_id_) == LANG_CHINESE ||
PRIMARYLANGID(input_language_id_) == LANG_JAPANESE) {
if (!system_caret_) {
if (::CreateCaret(window_handle, NULL, 1, 1)) {
system_caret_ = true;
}
}
}
/* Restore the positions of the IME windows. */
UpdateImeWindow(window_handle);
}
void GHOST_ImeWin32::SetImeWindowStyle(HWND window_handle, UINT message, WPARAM wparam, LPARAM lparam, BOOL *handled)
{
/**
* To prevent the IMM (Input Method Manager) from displaying the IME
* composition window, Update the styles of the IME windows and EXPLICITLY
* call ::DefWindowProc() here.
* NOTE(hbono): We can NEVER let WTL call ::DefWindowProc() when we update
* the styles of IME windows because the 'lparam' variable is a local one
* and all its updates disappear in returning from this function, i.e. WTL
* does not call ::DefWindowProc() with our updated 'lparam' value but call
* the function with its original value and over-writes our window styles.
*/
*handled = TRUE;
lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
::DefWindowProc(window_handle, message, wparam, lparam);
}
void GHOST_ImeWin32::DestroyImeWindow(HWND window_handle)
{
/* Destroy the system caret if we have created for this IME input context. */
if (system_caret_) {
::DestroyCaret();
system_caret_ = false;
}
}
void GHOST_ImeWin32::MoveImeWindow(HWND window_handle, HIMC imm_context)
{
int x = caret_rect_.m_l;
int y = caret_rect_.m_t;
const int kCaretMargin = 1;
/**
* As written in a comment in GHOST_ImeWin32::CreateImeWindow(),
* Chinese IMEs ignore function calls to ::ImmSetCandidateWindow()
* when a user disables TSF (Text Service Framework) and CUAS (Cicero
* Unaware Application Support).
* On the other hand, when a user enables TSF and CUAS, Chinese IMEs
* ignore the position of the current system caret and uses the
* parameters given to ::ImmSetCandidateWindow() with its 'dwStyle'
* parameter CFS_CANDIDATEPOS.
* Therefore, we do not only call ::ImmSetCandidateWindow() but also
* set the positions of the temporary system caret if it exists.
*/
CANDIDATEFORM candidate_position = { 0, CFS_CANDIDATEPOS, { x, y },
{ 0, 0, 0, 0 } };
::ImmSetCandidateWindow(imm_context, &candidate_position);
if (system_caret_) {
switch (PRIMARYLANGID(input_language_id_)) {
case LANG_JAPANESE:
::SetCaretPos(x, y + caret_rect_.getHeight());
break;
default:
::SetCaretPos(x, y);
break;
}
}
if (PRIMARYLANGID(input_language_id_) == LANG_KOREAN) {
/**
* Chinese IMEs and Japanese IMEs require the upper-left corner of
* the caret to move the position of their candidate windows.
* On the other hand, Korean IMEs require the lower-left corner of the
* caret to move their candidate windows.
*/
y += kCaretMargin;
}
/**
* Japanese IMEs and Korean IMEs also use the rectangle given to
* ::ImmSetCandidateWindow() with its 'dwStyle' parameter CFS_EXCLUDE
* to move their candidate windows when a user disables TSF and CUAS.
* Therefore, we also set this parameter here.
*/
CANDIDATEFORM exclude_rectangle = { 0, CFS_EXCLUDE, { x, y },
{ x, y, x + caret_rect_.getWidth(), y + caret_rect_.getHeight() } };
::ImmSetCandidateWindow(imm_context, &exclude_rectangle);
}
void GHOST_ImeWin32::UpdateImeWindow(HWND window_handle)
{
/* Just move the IME window attached to the given window. */
if (caret_rect_.m_l >= 0 && caret_rect_.m_t >= 0) {
HIMC imm_context = ::ImmGetContext(window_handle);
if (imm_context) {
MoveImeWindow(window_handle, imm_context);
::ImmReleaseContext(window_handle, imm_context);
}
}
}
void GHOST_ImeWin32::CleanupComposition(HWND window_handle)
{
/**
* Notify the IMM attached to the given window to complete the ongoing
* composition, (this case happens when the given window is de-activated
* while composing a text and re-activated), and reset the omposition status.
*/
if (is_composing_) {
HIMC imm_context = ::ImmGetContext(window_handle);
if (imm_context) {
::ImmNotifyIME(imm_context, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
::ImmReleaseContext(window_handle, imm_context);
}
ResetComposition(window_handle);
}
}
void GHOST_ImeWin32::CheckFirst(HWND window_handle)
{
if (is_first) {
this->EndIME(window_handle);
is_first = false;
}
}
void GHOST_ImeWin32::ResetComposition(HWND window_handle)
{
/* Currently, just reset the composition status. */
is_composing_ = false;
}
void GHOST_ImeWin32::CompleteComposition(HWND window_handle, HIMC imm_context)
{
/**
* We have to confirm there is an ongoing composition before completing it.
* This is for preventing some IMEs from getting confused while completing an
* ongoing composition even if they do not have any ongoing compositions.)
*/
if (is_composing_) {
::ImmNotifyIME(imm_context, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
ResetComposition(window_handle);
}
}
void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *composition)
{
/**
* This operation is optional and language-dependent because the caret
* style is depended on the language, e.g.:
* * Korean IMEs: the caret is a blinking block,
* (It contains only one hangul character);
* * Chinese IMEs: the caret is a blinking line,
* (i.e. they do not need to retrieve the target selection);
* * Japanese IMEs: the caret is a selection (or underlined) block,
* (which can contain one or more Japanese characters).
*/
int target_start = -1;
int target_end = -1;
switch (PRIMARYLANGID(input_language_id_)) {
case LANG_KOREAN:
if (lparam & CS_NOMOVECARET) {
target_start = 0;
target_end = 1;
}
break;
case LANG_CHINESE:
{
int clause_size = ImmGetCompositionStringW(imm_context, GCS_COMPCLAUSE, NULL, 0);
if (clause_size) {
static std::vector<unsigned long> clauses;
clause_size = clause_size / sizeof(clauses[0]);
clauses.resize(clause_size);
ImmGetCompositionStringW(imm_context, GCS_COMPCLAUSE, &clauses[0],
sizeof(clauses[0]) *clause_size);
if (composition->cursor_position == composition->ime_string.size()) {
target_start = clauses[clause_size - 2];
target_end = clauses[clause_size - 1];
}
else {
for (int i = 0; i < clause_size - 1; i++) {
if (clauses[i] == composition->cursor_position) {
target_start = clauses[i];
target_end = clauses[i + 1];
break;
}
}
}
}
else {
if (composition->cursor_position != -1) {
target_start = composition->cursor_position;
target_end = composition->ime_string.size();
}
}
break;
}
case LANG_JAPANESE:
/**
* For Japanese IMEs, the robustest way to retrieve the caret
* is scanning the attribute of the latest composition string and
* retrieving the begining and the end of the target clause, i.e.
* a clause being converted.
*/
if (lparam & GCS_COMPATTR) {
int attribute_size = ::ImmGetCompositionStringW(imm_context,
GCS_COMPATTR,
NULL, 0);
if (attribute_size > 0) {
char *attribute_data = new char[attribute_size];
if (attribute_data) {
::ImmGetCompositionStringW(imm_context, GCS_COMPATTR,
attribute_data, attribute_size);
for (target_start = 0; target_start < attribute_size;
++target_start) {
if (IsTargetAttribute(attribute_data[target_start]))
break;
}
for (target_end = target_start; target_end < attribute_size;
++target_end) {
if (!IsTargetAttribute(attribute_data[target_end]))
break;
}
if (target_start == attribute_size) {
/**
* This composition clause does not contain any target clauses,
* i.e. this clauses is an input clause.
* We treat whole this clause as a target clause.
*/
target_end = target_start;
target_start = 0;
}
if (target_start != -1 && target_start < attribute_size &&
attribute_data[target_start] == ATTR_TARGET_NOTCONVERTED)
{
composition->cursor_position = target_start;
}
}
delete[] attribute_data;
}
}
break;
}
composition->target_start = target_start;
composition->target_end = target_end;
}
bool GHOST_ImeWin32::GetString(HIMC imm_context, WPARAM lparam, int type, ImeComposition *composition)
{
bool result = false;
if (lparam & type) {
int string_size = ::ImmGetCompositionStringW(imm_context, type, NULL, 0);
if (string_size > 0) {
int string_length = string_size / sizeof(wchar_t);
wchar_t *string_data = new wchar_t[string_length + 1];
string_data[string_length] = '\0';
if (string_data) {
/* Fill the given ImeComposition object. */
::ImmGetCompositionStringW(imm_context, type,
string_data, string_size);
composition->string_type = type;
composition->ime_string = string_data;
result = true;
}
delete[] string_data;
}
}
return result;
}
bool GHOST_ImeWin32::GetResult(HWND window_handle, LPARAM lparam, ImeComposition *composition)
{
bool result = false;
HIMC imm_context = ::ImmGetContext(window_handle);
if (imm_context) {
/* Copy the result string to the ImeComposition object. */
result = GetString(imm_context, lparam, GCS_RESULTSTR, composition);
/**
* Reset all the other parameters because a result string does not
* have composition attributes.
*/
composition->cursor_position = -1;
composition->target_start = -1;
composition->target_end = -1;
::ImmReleaseContext(window_handle, imm_context);
}
return result;
}
bool GHOST_ImeWin32::GetComposition(HWND window_handle, LPARAM lparam, ImeComposition *composition)
{
bool result = false;
HIMC imm_context = ::ImmGetContext(window_handle);
if (imm_context) {
/* Copy the composition string to the ImeComposition object. */
result = GetString(imm_context, lparam, GCS_COMPSTR, composition);
/* Retrieve the cursor position in the IME composition. */
int cursor_position = ::ImmGetCompositionStringW(imm_context, GCS_CURSORPOS, NULL, 0);
composition->cursor_position = cursor_position;
composition->target_start = -1;
composition->target_end = -1;
/* Retrieve the target selection and Update the ImeComposition object. */
GetCaret(imm_context, lparam, composition);
/* Mark that there is an ongoing composition. */
is_composing_ = true;
::ImmReleaseContext(window_handle, imm_context);
}
return result;
}
void GHOST_ImeWin32::EndIME(HWND window_handle)
{
/**
* A renderer process have moved its input focus to a password input
* when there is an ongoing composition, e.g. a user has clicked a
* mouse button and selected a password input while composing a text.
* For this case, we have to complete the ongoing composition and
* clean up the resources attached to this object BEFORE DISABLING THE IME.
*/
if (!is_enable) return;
is_enable = false;
CleanupComposition(window_handle);
::ImmAssociateContextEx(window_handle, NULL, 0);
eventImeData.composite_len = 0;
}
void GHOST_ImeWin32::BeginIME(HWND window_handle, const GHOST_Rect &caret_rect, bool complete)
{
if (is_enable && complete) return;
is_enable = true;
/**
* Load the default IME context.
* NOTE(hbono)
* IMM ignores this call if the IME context is loaded. Therefore, we do
* not have to check whether or not the IME context is loaded.
*/
::ImmAssociateContextEx(window_handle, NULL, IACE_DEFAULT);
/* Complete the ongoing composition and move the IME windows. */
HIMC imm_context = ::ImmGetContext(window_handle);
if (imm_context) {
if (complete) {
/**
* A renderer process have moved its input focus to another edit
* control when there is an ongoing composition, e.g. a user has
* clicked a mouse button and selected another edit control while
* composing a text.
* For this case, we have to complete the ongoing composition and
* hide the IME windows BEFORE MOVING THEM.
*/
CompleteComposition(window_handle, imm_context);
}
/**
* Save the caret position, and Update the position of the IME window.
* This update is used for moving an IME window when a renderer process
* resize/moves the input caret.
*/
if (caret_rect.m_l >= 0 && caret_rect.m_t >= 0) {
caret_rect_ = caret_rect;
MoveImeWindow(window_handle, imm_context);
}
::ImmReleaseContext(window_handle, imm_context);
}
}
static void convert_utf16_to_utf8_len(std::wstring s, int &len)
{
if (len >= 0 && len <= s.size())
len = count_utf_8_from_16(s.substr(0, len).c_str()) - 1;
else
len = -1;
}
static size_t updateUtf8Buf(ImeComposition &info)
{
size_t len = count_utf_8_from_16(info.ime_string.c_str());
info.utf8_buf.resize(len);
conv_utf_16_to_8(info.ime_string.c_str(), &info.utf8_buf[0], len);
convert_utf16_to_utf8_len(info.ime_string, info.cursor_position);
convert_utf16_to_utf8_len(info.ime_string, info.target_start);
convert_utf16_to_utf8_len(info.ime_string, info.target_end);
return len - 1;
}
void GHOST_ImeWin32::UpdateInfo(HWND window_handle)
{
int res = this->GetResult(window_handle, GCS_RESULTSTR, &resultInfo);
int comp = this->GetComposition(window_handle, GCS_COMPSTR | GCS_COMPATTR, &compInfo);
/* convert wchar to utf8 */
if (res) {
eventImeData.result_len = (GHOST_TUserDataPtr)updateUtf8Buf(resultInfo);
eventImeData.result = &resultInfo.utf8_buf[0];
}
else {
eventImeData.result = 0;
eventImeData.result_len = 0;
}
if (comp) {
eventImeData.composite_len = (GHOST_TUserDataPtr)updateUtf8Buf(compInfo);
eventImeData.composite = &compInfo.utf8_buf[0];
eventImeData.cursor_position = compInfo.cursor_position;
eventImeData.target_start = compInfo.target_start;
eventImeData.target_end = compInfo.target_end;
}
else {
eventImeData.composite = 0;
eventImeData.composite_len = 0;
eventImeData.cursor_position = -1;
eventImeData.target_start = -1;
eventImeData.target_end = -1;
}
}

View File

@@ -0,0 +1,401 @@
/*
* ***** 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) 2010 The Chromium Authors. All rights reserved.
* All rights reserved.
*
* The Original Code is: some of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file ghost/intern/GHOST_ImeWin32.h
* \ingroup GHOST
*/
#ifndef __GHOST_IME_H__
#define __GHOST_IME_H__
#include <windows.h>
#include <string>
#include "GHOST_Event.h"
#include "GHOST_Rect.h"
#include <vector>
class GHOST_EventIME : public GHOST_Event
{
public:
/**
* Constructor.
* \param msec The time this event was generated.
* \param type The type of key event.
* \param key The key code of the key.
*/
GHOST_EventIME(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window, void *customdata)
: GHOST_Event(msec, type, window)
{
this->m_data = customdata;
}
};
/**
* This header file defines a struct and a class used for encapsulating IMM32
* APIs, controls IMEs attached to a window, and enables the 'on-the-spot'
* input without deep knowledge about the APIs, i.e. knowledge about the
* language-specific and IME-specific behaviors.
* The following items enumerates the simplest steps for an (window)
* application to control its IMEs with the struct and the class defined
* this file.
* 1. Add an instance of the GHOST_ImeWin32 class to its window class.
* (The GHOST_ImeWin32 class needs a window handle.)
* 2. Add messages handlers listed in the following subsections, follow the
* instructions written in each subsection, and use the GHOST_ImeWin32 class.
* 2.1. WM_IME_SETCONTEXT (0x0281)
* Call the functions listed below:
* - GHOST_ImeWin32::CreateImeWindow();
* - GHOST_ImeWin32::CleanupComposition(), and;
* - GHOST_ImeWin32::SetImeWindowStyle().
* An application MUST prevent from calling ::DefWindowProc().
* 2.2. WM_IME_STARTCOMPOSITION (0x010D)
* Call the functions listed below:
* - GHOST_ImeWin32::CreateImeWindow(), and;
* - GHOST_ImeWin32::ResetComposition().
* An application MUST prevent from calling ::DefWindowProc().
* 2.3. WM_IME_COMPOSITION (0x010F)
* Call the functions listed below:
* - GHOST_ImeWin32::UpdateImeWindow();
* - GHOST_ImeWin32::GetResult();
* - GHOST_ImeWin32::GetComposition(), and;
* - GHOST_ImeWin32::ResetComposition() (optional).
* An application MUST prevent from calling ::DefWindowProc().
* 2.4. WM_IME_ENDCOMPOSITION (0x010E)
* Call the functions listed below:
* - GHOST_ImeWin32::ResetComposition(), and;
* - GHOST_ImeWin32::DestroyImeWindow().
* An application CAN call ::DefWindowProc().
* 2.5. WM_INPUTLANGCHANGE (0x0051)
* Call the functions listed below:
* - GHOST_ImeWin32::SetInputLanguage().
* An application CAN call ::DefWindowProc().
*/
/* This struct represents the status of an ongoing composition. */
struct ImeComposition {
/* Represents the cursor position in the IME composition. */
int cursor_position;
/* Represents the position of the beginning of the selection */
int target_start;
/* Represents the position of the end of the selection */
int target_end;
/**
* Represents the type of the string in the 'ime_string' parameter.
* Its possible values and description are listed below:
* Value Description
* 0 The parameter is not used.
* GCS_RESULTSTR The parameter represents a result string.
* GCS_COMPSTR The parameter represents a composition string.
*/
int string_type;
/* Represents the string retrieved from IME (Input Method Editor) */
std::wstring ime_string;
std::vector<char> utf8_buf;
std::vector<unsigned char> format;
};
/**
* This class controls the IMM (Input Method Manager) through IMM32 APIs and
* enables it to retrieve the string being controled by the IMM. (I wrote
* a note to describe the reason why I do not use 'IME' but 'IMM' below.)
* NOTE(hbono):
* Fortunately or unfortunately, TSF (Text Service Framework) and
* CUAS (Cicero Unaware Application Support) allows IMM32 APIs for
* retrieving not only the inputs from IMEs (Input Method Editors), used
* only for inputting East-Asian language texts, but also the ones from
* tablets (on Windows XP Tablet PC Edition and Windows Vista), voice
* recognizers (e.g. ViaVoice and Microsoft Office), etc.
* We can disable TSF and CUAS in Windows XP Tablet PC Edition. On the other
* hand, we can NEVER disable either TSF or CUAS in Windows Vista, i.e.
* THIS CLASS IS NOT ONLY USED ON THE INPUT CONTEXTS OF EAST-ASIAN
* LANGUAGES BUT ALSO USED ON THE INPUT CONTEXTS OF ALL LANGUAGES.
*/
class GHOST_ImeWin32 {
public:
GHOST_ImeWin32();
~GHOST_ImeWin32();
/* Retrieves whether or not there is an ongoing composition. */
bool is_composing() const {return is_composing_;}
/**
* Retrieves the input language from Windows and update it.
* Return values
* * true
* The given input language has IMEs.
* * false
* The given input language does not have IMEs.
*/
bool SetInputLanguage();
/**
* Create the IME windows, and allocate required resources for them.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
*/
void CreateImeWindow(HWND window_handle);
/**
* Update the style of the IME windows.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
* * message [in] (UINT)
* * wparam [in] (WPARAM)
* * lparam [in] (LPARAM)
* Represent the windows message of the caller.
* These parameters are used for verifying if this function is called
* in a handler function for WM_IME_SETCONTEXT messages because this
* function uses ::DefWindowProc() to update the style.
* A caller just has to pass the input parameters for the handler
* function without modifications.
* * handled [out] (BOOL*)
* Returns ::DefWindowProc() is really called in this function.
* PLEASE DO NOT CALL ::DefWindowProc() IF THIS VALUE IS TRUE!
* All the window styles set in this function are over-written when
* calling ::DefWindowProc() after returning this function.
*/
void SetImeWindowStyle(HWND window_handle, UINT message,
WPARAM wparam, LPARAM lparam, BOOL* handled);
/**
* Destroy the IME windows and all the resources attached to them.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
*/
void DestroyImeWindow(HWND window_handle);
/**
* Update the position of the IME windows.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
*/
void UpdateImeWindow(HWND window_handle);
/**
* Clean up the all resources attached to the given GHOST_ImeWin32 object, and
* reset its composition status.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
*/
void CleanupComposition(HWND window_handle);
/**
* Reset the composition status.
* Cancel the ongoing composition if it exists.
* NOTE(hbono): This method does not release the allocated resources.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
*/
void ResetComposition(HWND window_handle);
/**
* Retrieve a composition result of the ongoing composition if it exists.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
* * lparam [in] (LPARAM)
* Specifies the updated members of the ongoing composition, and must be
* the same parameter of a WM_IME_COMPOSITION message handler.
* This parameter is used for checking if the ongoing composition has
* its result string,
* * composition [out] (ImeComposition)
* Represents the struct contains the composition result.
* Return values
* * true
* The ongoing composition has a composition result.
* * false
* The ongoing composition does not have composition results.
* Remarks
* This function is designed for being called from WM_IME_COMPOSITION
* message handlers.
*/
bool GetResult(HWND window_handle, LPARAM lparam,
ImeComposition* composition);
/**
* Retrieve the current composition status of the ongoing composition.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
* * lparam [in] (LPARAM)
* Specifies the updated members of the ongoing composition, and must be
* the same parameter of a WM_IME_COMPOSITION message handler.
* This parameter is used for checking if the ongoing composition has
* its result string,
* * composition [out] (ImeComposition)
* Represents the struct contains the composition status.
* Return values
* * true
* The status of the ongoing composition is updated.
* * false
* The status of the ongoing composition is not updated.
* Remarks
* This function is designed for being called from WM_IME_COMPOSITION
* message handlers.
*/
bool GetComposition(HWND window_handle, LPARAM lparam,
ImeComposition* composition);
/**
* Enable the IME attached to the given window, i.e. allows user-input
* events to be dispatched to the IME.
* In Chrome, this function is used when:
* * a renderer process moves its input focus to another edit control, or;
* * a renrerer process moves the position of the focused edit control.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
* * caret_rect [in] (const gfx::Rect&)
* Represent the rectangle of the input caret.
* This rectangle is used for controlling the positions of IME windows.
* * complete [in] (bool)
* Represents whether or not to complete the ongoing composition.
* + true
* After finishing the ongoing composition and close its IME windows,
* start another composition and display its IME windows to the given
* position.
* + false
* Just move the IME windows of the ongoing composition to the given
* position without finishing it.
*/
void BeginIME(HWND window_handle,
const GHOST_Rect& caret_rect,
bool complete);
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input
* events from being dispatched to the IME.
* In Chrome, this function is used when:
* * a renreder process sets its input focus to a password input.
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
*/
void EndIME(HWND window_handle);
/* Updatg resultInfo and compInfo */
void UpdateInfo(HWND window_handle);
/* disable ime when start up */
void CheckFirst(HWND window_handle);
ImeComposition resultInfo, compInfo;
GHOST_TEventImeData eventImeData;
protected:
/* Determines whether or not the given attribute represents a target (a.k.a. a selection). */
bool IsTargetAttribute(char attribute) const {
return (attribute == ATTR_TARGET_CONVERTED ||
attribute == ATTR_TARGET_NOTCONVERTED);
}
/* Retrieve the target area. */
void GetCaret(HIMC imm_context, LPARAM lparam,
ImeComposition* composition);
/* Update the position of the IME windows. */
void MoveImeWindow(HWND window_handle, HIMC imm_context);
/* Complete the ongoing composition if it exists. */
void CompleteComposition(HWND window_handle, HIMC imm_context);
/* Retrieve a string from the IMM. */
bool GetString(HIMC imm_context, WPARAM lparam, int type,
ImeComposition* composition);
private:
/**
* Represents whether or not there is an ongoing composition in a browser
* process, i.e. whether or not a browser process is composing a text.
*/
bool is_composing_;
/**
* This value represents whether or not the current input context has IMEs.
* The following table shows the list of IME status:
* Value Description
* false The current input language does not have IMEs.
* true The current input language has IMEs.
*/
bool ime_status_;
/**
* The current input Language ID retrieved from Windows, which consists of:
* * Primary Language ID (bit 0 to bit 9), which shows a natunal language
* (English, Korean, Chinese, Japanese, etc.) and;
* * Sub-Language ID (bit 10 to bit 15), which shows a geometrical region
* the language is spoken (For English, United States, United Kingdom,
* Australia, Canada, etc.)
* The following list enumerates some examples for the Language ID:
* * "en-US" (0x0409)
* MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
* * "ko-KR" (0x0412)
* MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN);
* * "zh-TW" (0x0404)
* MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL);
* * "zh-CN" (0x0804)
* MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED);
* * "ja-JP" (0x0411)
* MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN), etc.
* (See <winnt.h> for other available values.)
* This Language ID is used for processing language-specific operations in
* IME functions.
*/
LANGID input_language_id_;
/**
* Represents whether or not the current input context has created a system
* caret to set the position of its IME candidate window.
* * true: it creates a system caret.
* * false: it does not create a system caret.
*/
bool system_caret_;
/* The rectangle of the input caret retrieved from a renderer process. */
GHOST_Rect caret_rect_;
/* used for disable ime when start up */
bool is_first, is_enable;
};
#endif * __GHOST_IME_H__

View File

@@ -146,8 +146,8 @@ static const NDOF_ButtonT SpaceExplorer_HID_map[] = {
NDOF_BUTTON_ROTATE
};
/* this is the older SpacePilot (sans Pro)
* thanks to polosson for info about this device */
// this is the older SpacePilot (sans Pro)
// thanks to polosson for info about this device
static const NDOF_ButtonT SpacePilot_HID_map[] = {
NDOF_BUTTON_1,
NDOF_BUTTON_2,
@@ -190,17 +190,17 @@ static const NDOF_ButtonT Generic_HID_map[] = {
static const int genericButtonCount = sizeof(Generic_HID_map) / sizeof(NDOF_ButtonT);
GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys)
: m_system(sys),
m_deviceType(NDOF_UnknownDevice), /* each platform has its own device detection code */
m_buttonCount(genericButtonCount),
m_buttonMask(0),
m_hidMap(Generic_HID_map),
m_buttons(0),
m_motionTime(0),
m_prevMotionTime(0),
m_motionState(GHOST_kNotStarted),
m_motionEventPending(false),
m_deadZone(0.0f)
: m_system(sys),
m_deviceType(NDOF_UnknownDevice), // each platform has its own device detection code
m_buttonCount(genericButtonCount),
m_buttonMask(0),
m_hidMap(Generic_HID_map),
m_buttons(0),
m_motionTime(0),
m_prevMotionTime(0),
m_motionState(GHOST_kNotStarted),
m_motionEventPending(false),
m_deadZone(0.0f)
{
// to avoid the rare situation where one triple is updated and
// the other is not, initialize them both here:
@@ -228,7 +228,7 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
// that I don't have access to. Thanks!
switch (vendor_id) {
case 0x046D: // Logitech (3Dconnexion)
case 0x046D: // Logitech (3Dconnexion was a subsidiary)
switch (product_id) {
// -- current devices --
case 0xC626: // full-size SpaceNavigator
@@ -281,6 +281,29 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
printf("ndof: unknown Logitech product %04hx\n", product_id);
}
break;
case 0x256F: // 3Dconnexion
switch (product_id) {
case 0xC62E: // plugged in
case 0xC62F: // wireless
puts("ndof: using SpaceMouse Wireless");
m_deviceType = NDOF_SpaceMouseWireless;
m_buttonCount = 2;
m_hidMap = Modern3Dx_HID_map;
break;
case 0xC631: // plugged in
case 0xC632: // wireless
puts("ndof: using SpaceMouse Pro Wireless");
m_deviceType = NDOF_SpaceMouseProWireless;
m_buttonCount = 27;
// ^^ actually has 15 buttons, but their HID codes range from 0 to 26
m_buttonMask = 0x07C0F137;
m_hidMap = Modern3Dx_HID_map;
break;
default:
printf("ndof: unknown 3Dconnexion product %04hx\n", product_id);
}
break;
default:
printf("ndof: unknown device %04hx:%04hx\n", vendor_id, product_id);
}
@@ -390,9 +413,9 @@ void GHOST_NDOFManager::updateButtons(int button_bits, GHOST_TUns64 time)
void GHOST_NDOFManager::setDeadZone(float dz)
{
if (dz < 0.f) {
if (dz < 0.0f) {
// negative values don't make sense, so clamp at zero
dz = 0.f;
dz = 0.0f;
}
else if (dz > 0.5f) {
// warn the rogue user/developer, but allow it
@@ -405,14 +428,14 @@ void GHOST_NDOFManager::setDeadZone(float dz)
static bool atHomePosition(GHOST_TEventNDOFMotionData *ndof)
{
#define HOME(foo) (ndof->foo == 0.f)
#define HOME(foo) (ndof->foo == 0.0f)
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
#undef HOME
}
static bool nearHomePosition(GHOST_TEventNDOFMotionData *ndof, float threshold)
{
if (threshold == 0.f) {
if (threshold == 0.0f) {
return atHomePosition(ndof);
}
else {
@@ -442,7 +465,7 @@ bool GHOST_NDOFManager::sendMotionEvent()
// scale axis values here to normalize them to around +/- 1
// they are scaled again for overall sensitivity in the WM based on user prefs
const float scale = 1.f / 350.f; // 3Dconnexion devices send +/- 350 usually
const float scale = 1.0f / 350.0f; // 3Dconnexion devices send +/- 350 usually
data->tx = scale * m_translation[0];
data->ty = scale * m_translation[1];

View File

@@ -20,7 +20,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __GHOST_NDOFMANAGER_H__
#define __GHOST_NDOFMANAGER_H__
@@ -38,6 +38,8 @@ typedef enum {
NDOF_SpaceExplorer,
NDOF_SpacePilotPro,
NDOF_SpaceMousePro,
NDOF_SpaceMouseWireless,
NDOF_SpaceMouseProWireless,
// older devices
NDOF_SpacePilot,

View File

@@ -508,6 +508,7 @@ GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const &raw
//! note: this function can be extended to include other exotic cases as they arise.
// This function was added in response to bug [#25715]
// This is going to be a long list [T42426]
GHOST_TKey GHOST_SystemWin32::processSpecialKey(GHOST_IWindow *window, short vKey, short scanCode) const
{
GHOST_TKey key = GHOST_kKeyUnknown;
@@ -515,6 +516,10 @@ GHOST_TKey GHOST_SystemWin32::processSpecialKey(GHOST_IWindow *window, short vKe
case LANG_FRENCH:
if (vKey == VK_OEM_8) key = GHOST_kKeyF13; // oem key; used purely for shortcuts .
break;
case LANG_ENGLISH:
if (SUBLANGID(m_langId) == SUBLANG_ENGLISH_UK && vKey == VK_OEM_8) // "`¬"
key = GHOST_kKeyAccentGrave;
break;
}
return key;
@@ -787,6 +792,15 @@ GHOST_Event *GHOST_SystemWin32::processWindowEvent(GHOST_TEventType type, GHOST_
return new GHOST_Event(system->getMilliSeconds(), type, window);
}
#ifdef WITH_INPUT_IME
GHOST_Event *GHOST_SystemWin32::processImeEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TEventImeData *data)
{
GHOST_System *system = (GHOST_System *)getSystem();
return new GHOST_EventIME(system->getMilliSeconds(), type, window, data);
}
#endif
GHOST_TSuccess GHOST_SystemWin32::pushDragDropEvent(
GHOST_TEventType eventType,
GHOST_TDragnDropTypes draggedObjectType,
@@ -899,6 +913,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
LRESULT lResult = 0;
GHOST_SystemWin32 *system = ((GHOST_SystemWin32 *)getSystem());
GHOST_EventManager *eventManager = system->getEventManager();
GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized");
if (hwnd) {
@@ -907,8 +922,13 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
switch (msg) {
// we need to check if new key layout has AltGr
case WM_INPUTLANGCHANGE:
{
system->handleKeyboardChange();
#ifdef WITH_INPUT_IME
window->getImeInput()->SetInputLanguage();
#endif
break;
}
////////////////////////////////////////////////////////////////////////
// Keyboard events, processed
////////////////////////////////////////////////////////////////////////
@@ -944,6 +964,56 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
break;
}
#ifdef WITH_INPUT_IME
////////////////////////////////////////////////////////////////////////
// IME events, processed, read more in GHOST_IME.h
////////////////////////////////////////////////////////////////////////
case WM_IME_SETCONTEXT:
{
window->getImeInput()->SetInputLanguage();
window->getImeInput()->CreateImeWindow(window->getHWND());
window->getImeInput()->CleanupComposition(window->getHWND());
window->getImeInput()->CheckFirst(window->getHWND());
break;
}
case WM_IME_STARTCOMPOSITION:
{
eventHandled = true;
/* remove input event before start comp event, avoid redundant input */
eventManager->removeTypeEvents(GHOST_kEventKeyDown, window);
window->getImeInput()->CreateImeWindow(window->getHWND());
window->getImeInput()->ResetComposition(window->getHWND());
event = processImeEvent(
GHOST_kEventImeCompositionStart,
window,
&window->getImeInput()->eventImeData);
break;
}
case WM_IME_COMPOSITION:
{
eventHandled = true;
window->getImeInput()->UpdateImeWindow(window->getHWND());
window->getImeInput()->UpdateInfo(window->getHWND());
event = processImeEvent(
GHOST_kEventImeComposition,
window,
&window->getImeInput()->eventImeData);
break;
}
case WM_IME_ENDCOMPOSITION:
{
eventHandled = true;
/* remove input event after end comp event, avoid redundant input */
eventManager->removeTypeEvents(GHOST_kEventKeyDown, window);
window->getImeInput()->ResetComposition(window->getHWND());
window->getImeInput()->DestroyImeWindow(window->getHWND());
event = processImeEvent(
GHOST_kEventImeCompositionEnd,
window,
&window->getImeInput()->eventImeData);
break;
}
#endif /* WITH_INPUT_IME */
////////////////////////////////////////////////////////////////////////
// Keyboard events, ignored
////////////////////////////////////////////////////////////////////////

View File

@@ -306,6 +306,15 @@ protected:
*/
static GHOST_Event *processWindowEvent(GHOST_TEventType type, GHOST_IWindow *window);
/**
* Creates a IME event.
* \param type The type of event to create.
* \param window The window receiving the event (the active window).
* \param data IME data.
* \return The event created.
*/
static GHOST_Event *processImeEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TEventImeData *data);
/**
* Handles minimum window size.
* \param minmax The MINMAXINFO structure.

View File

@@ -295,6 +295,22 @@ public:
return 1.0f;
}
#ifdef WITH_INPUT_IME
virtual void beginIME(GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 w,
GHOST_TInt32 h,
int completed)
{
/* do nothing temporarily if not in windows */
}
virtual void endIME()
{
/* do nothing temporarily if not in windows */
}
#endif /* WITH_INPUT_IME */
protected:
/**
* Tries to install a rendering context in this window.

View File

@@ -645,6 +645,8 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
m_lionStyleFullScreen = true;
}
[NSApp activateIgnoringOtherApps:YES]; // raise application to front, important for new blender instance animation play case
[pool drain];
}

View File

@@ -1050,3 +1050,16 @@ GHOST_TSuccess GHOST_WindowWin32::endProgressBar()
return GHOST_kFailure;
}
#ifdef WITH_INPUT_IME
void GHOST_WindowWin32::beginIME(GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed)
{
this->getImeInput()->BeginIME(this->getHWND(), GHOST_Rect(x, y - h , x, y), (bool)completed);
}
void GHOST_WindowWin32::endIME()
{
this->getImeInput()->EndIME(this->getHWND());
}
#endif /* WITH_INPUT_IME */

View File

@@ -39,6 +39,9 @@
#include "GHOST_Window.h"
#include "GHOST_TaskbarWin32.h"
#ifdef WITH_INPUT_IME
# include "GHOST_ImeWin32.h"
#endif
#include <wintab.h>
#define PACKETDATA (PK_BUTTONS | PK_NORMAL_PRESSURE | PK_ORIENTATION | PK_CURSOR)
@@ -253,6 +256,17 @@ public:
/** if the window currently resizing */
bool m_inLiveResize;
#ifdef WITH_INPUT_IME
GHOST_ImeWin32 *getImeInput() {return &m_imeImput;}
virtual void beginIME(
GHOST_TInt32 x, GHOST_TInt32 y,
GHOST_TInt32 w, GHOST_TInt32 h,
int completed);
virtual void endIME();
#endif /* WITH_INPUT_IME */
private:
/**
@@ -339,6 +353,11 @@ private:
/** Hwnd to parent window */
GHOST_TEmbedderWindowID m_parentWindowHwnd;
#ifdef WITH_INPUT_IME
/** Handle input method editors event */
GHOST_ImeWin32 m_imeImput;
#endif
};
#endif // __GHOST_WINDOWWIN32_H__

View File

@@ -483,7 +483,7 @@ void
else lword = sizeof(double);
if ( Glu->MemModel == SYSTEM ) {
new_mem = (void *) SUPERLU_MALLOC(new_len * lword);
new_mem = (void *) SUPERLU_MALLOC((size_t)new_len * (size_t)lword);
/* new_mem = (void *) calloc(new_len, lword); */
if ( no_expand != 0 ) {
tries = 0;
@@ -494,7 +494,7 @@ void
if ( ++tries > 10 ) return (NULL);
alpha = Reduce(alpha);
new_len = alpha * *prev_len;
new_mem = (void *) SUPERLU_MALLOC(new_len * lword);
new_mem = (void *) SUPERLU_MALLOC((size_t)new_len * (size_t)lword);
/* new_mem = (void *) calloc(new_len, lword); */
}
}
@@ -509,7 +509,7 @@ void
} else { /* MemModel == USER */
if ( no_expand == 0 ) {
new_mem = suser_malloc(new_len * lword, HEAD);
new_mem = suser_malloc((size_t)new_len * (size_t)lword, HEAD);
if ( NotDoubleAlign(new_mem) &&
(type == LUSUP || type == UCOL) ) {
old_mem = new_mem;

Binary file not shown.

View File

@@ -916,10 +916,7 @@ def process(layer_name, lineset_name):
# execute line set pre-processing callback functions
for fn in callbacks_lineset_pre:
try:
fn(scene, layer, lineset)
except Exception as e:
print(e)
fn(scene, layer, lineset)
selection_criteria = []
# prepare selection criteria by visibility

View File

@@ -38,10 +38,10 @@ __all__ = (
from _bpy import types, props, app, data, context
# python modules
from . import utils, path, ops
from . import utils, path
# fake operator module
ops = ops.ops_fake_module
from .ops import ops_fake_module as ops
def main():

View File

@@ -36,6 +36,7 @@ class BPyOps:
bpy.ops
"""
__slots__ = ()
def __getattr__(self, module):
"""

View File

@@ -32,7 +32,10 @@ KM_HIERARCHY = [
('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region)
('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation
('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region)
('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region)
('Grease Pencil', 'EMPTY', 'WINDOW', [ # grease pencil stuff (per region)
('Grease Pencil Stroke Edit Mode', 'EMPTY', 'WINDOW', []),
]),
('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform)
('Object Mode', 'EMPTY', 'WINDOW', []),

View File

@@ -99,7 +99,7 @@ def add_object_align_init(context, operator):
return location * rotation
def object_data_add(context, obdata, operator=None, use_active_layer=True):
def object_data_add(context, obdata, operator=None, use_active_layer=True, name=None):
"""
Add an object using the view context and preference to to initialize the
location, rotation and layer.
@@ -110,6 +110,8 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True):
:type obdata: valid object data type or None.
:arg operator: The operator, checked for location and rotation properties.
:type operator: :class:`bpy.types.Operator`
:arg name: Optional name
:type name: string
:return: the newly created object in the scene.
:rtype: :class:`bpy.types.ObjectBase`
"""
@@ -119,7 +121,10 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True):
for ob in scene.objects:
ob.select = False
obj_new = bpy.data.objects.new(obdata.name, obdata)
if name is None:
name = "Object" if obdata is None else obdata.name
obj_new = bpy.data.objects.new(name, obdata)
base = scene.objects.link(obj_new)
base.select = True
@@ -150,7 +155,7 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True):
obj_act.mode == 'EDIT' and
obj_act.type == obj_new.type):
_obdata = bpy.data.meshes.new(obdata.name)
_obdata = bpy.data.meshes.new(name)
obj_act = bpy.data.objects.new(_obdata.name, _obdata)
obj_act.matrix_world = obj_new.matrix_world
scene.objects.link(obj_act)
@@ -169,7 +174,8 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True):
#scene.objects.active = obj_new
bpy.ops.object.join() # join into the active.
bpy.data.meshes.remove(obdata)
if obdata:
bpy.data.meshes.remove(obdata)
# base is freed, set to active object
base = scene.object_bases.active

View File

@@ -487,6 +487,12 @@ def GetInfoOperatorRNA(bl_rna):
def BuildRNAInfo():
# needed on successive calls to prevent stale data access
for cls in (InfoStructRNA, InfoFunctionRNA, InfoOperatorRNA, InfoPropertyRNA):
cls.global_lookup.clear()
del cls
# Use for faster lookups
# use rna_struct.identifier as the key for each dict
rna_struct_dict = {} # store identifier:rna lookups

View File

@@ -5,7 +5,7 @@
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
emboss="#ffffff05"
widget_emboss="#ffffff05"
axis_x="#dc0000"
axis_y="#00dc00"
axis_z="#0000dc">

View File

@@ -5,7 +5,7 @@
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
emboss="#ffffff05"
widget_emboss="#ffffff05"
axis_x="#dc0000"
axis_y="#00dc00"
axis_z="#0000dc">

View File

@@ -5,7 +5,7 @@
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
emboss="#ffffff05"
widget_emboss="#ffffff05"
axis_x="#dc0000"
axis_y="#00dc00"
axis_z="#0000dc">

View File

@@ -5,7 +5,7 @@
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
emboss="#ffffff05"
widget_emboss="#ffffff05"
axis_x="#dc0000"
axis_y="#00dc00"
axis_z="#0000dc">

View File

@@ -5,7 +5,7 @@
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
emboss="#ffffff05"
widget_emboss="#ffffff05"
axis_x="#dc0000"
axis_y="#00dc00"
axis_z="#0000dc">

View File

@@ -5,7 +5,7 @@
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
emboss="#ffffff05"
widget_emboss="#ffffff05"
axis_x="#dc4800"
axis_y="#73dc00"
axis_z="#00c2ff">

View File

@@ -5,7 +5,7 @@
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
emboss="#ffffff05"
widget_emboss="#ffffff05"
axis_x="#ff5a5a"
axis_y="#58ff58"
axis_z="#6262ff">

View File

@@ -5,7 +5,7 @@
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
emboss="#ffffff05"
widget_emboss="#ffffff05"
axis_x="#dc0000"
axis_y="#00dc00"
axis_z="#0000dc">

View File

@@ -708,6 +708,7 @@ def main(context,
island_margin,
projection_limit,
user_area_weight,
use_aspect
):
global USER_FILL_HOLES
global USER_FILL_HOLES_QUALITY
@@ -720,7 +721,6 @@ def main(context,
global dict_matrix
dict_matrix = {}
# Constants:
# Takes a list of faces that make up a UV island and rotate
# until they optimally fit inside a square.
@@ -992,9 +992,31 @@ def main(context,
print("Smart Projection time: %.2f" % (time.time() - time1))
# Window.DrawProgressBar(0.9, "Smart Projections done, time: %.2f sec" % (time.time() - time1))
# aspect correction is only done in edit mode - and only smart unwrap supports currently
if is_editmode:
bpy.ops.object.mode_set(mode='EDIT')
if use_aspect:
import bmesh
aspect = context.scene.uvedit_aspect(context.active_object)
if aspect[0] > aspect[1]:
aspect[0] = aspect[1]/aspect[0];
aspect[1] = 1.0
else:
aspect[1] = aspect[0]/aspect[1];
aspect[0] = 1.0
bm = bmesh.from_edit_mesh(me)
uv_act = bm.loops.layers.uv.active
faces = [f for f in bm.faces if f.select]
for f in faces:
for l in f.loops:
l[uv_act].uv[0] *= aspect[0]
l[uv_act].uv[1] *= aspect[1]
dict_matrix.clear()
#XXX Window.DrawProgressBar(1.0, "")
@@ -1017,7 +1039,7 @@ def main(context,
]
"""
from bpy.props import FloatProperty
from bpy.props import FloatProperty, BoolProperty
class SmartProject(Operator):
@@ -1046,6 +1068,11 @@ class SmartProject(Operator):
min=0.0, max=1.0,
default=0.0,
)
use_aspect = BoolProperty(
name="Correct Aspect",
description="Map UVs taking image aspect ratio into account",
default=True
)
@classmethod
def poll(cls, context):
@@ -1056,6 +1083,7 @@ class SmartProject(Operator):
self.island_margin,
self.angle_limit,
self.user_area_weight,
self.use_aspect
)
return {'FINISHED'}

View File

@@ -19,11 +19,34 @@
# <pep8 compliant>
class GreasePencilPanel():
from bpy.types import Menu, UIList
def gpencil_stroke_placement_settings(context, layout, gpd):
col = layout.column(align=True)
col.label(text="Stroke Placement:")
row = col.row(align=True)
row.prop_enum(gpd, "draw_mode", 'VIEW')
row.prop_enum(gpd, "draw_mode", 'CURSOR')
if context.space_data.type == 'VIEW_3D':
row = col.row(align=True)
row.prop_enum(gpd, "draw_mode", 'SURFACE')
row.prop_enum(gpd, "draw_mode", 'STROKE')
row = col.row(align=False)
row.active = gpd.draw_mode in {'SURFACE', 'STROKE'}
row.prop(gpd, "use_stroke_endpoints")
class GreasePencilDrawingToolsPanel():
# subclass must set
# bl_space_type = 'IMAGE_EDITOR'
# bl_region_type = 'TOOLS'
bl_label = "Grease Pencil"
bl_category = "Grease Pencil"
bl_region_type = 'TOOLS'
@staticmethod
def draw(self, context):
@@ -31,19 +54,421 @@ class GreasePencilPanel():
col = layout.column(align=True)
col.label(text="Draw:")
row = col.row(align=True)
row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
row = col.row(align=True)
row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
row = col.row(align=True)
row.prop(context.tool_settings, "use_grease_pencil_sessions")
row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
row = col.row(align=True)
row.prop(context.tool_settings, "use_grease_pencil_sessions", text="Continuous Drawing")
if context.space_data.type in {'VIEW_3D', 'CLIP_EDITOR'}:
col.separator()
col.label("Data Source:")
row = col.row(align=True)
if context.space_data.type == 'VIEW_3D':
row.prop(context.tool_settings, "grease_pencil_source", expand=True)
elif context.space_data.type == 'CLIP_EDITOR':
row.prop(context.space_data, "grease_pencil_source", expand=True)
gpd = context.gpencil_data
if gpd:
col.separator()
gpencil_stroke_placement_settings(context, col, gpd)
if context.space_data.type == 'VIEW_3D':
col.separator()
col.separator()
col.label(text="Measure:")
col.label(text="Tools:")
col.operator("gpencil.convert", text="Convert...")
col.operator("view3d.ruler")
class GreasePencilStrokeEditPanel():
# subclass must set
# bl_space_type = 'IMAGE_EDITOR'
bl_label = "Edit Strokes"
bl_category = "Grease Pencil"
bl_region_type = 'TOOLS'
@classmethod
def poll(cls, context):
return (context.gpencil_data is not None)
@staticmethod
def draw(self, context):
layout = self.layout
gpd = context.gpencil_data
edit_ok = bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode)
col = layout.column(align=True)
col.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True)
col.separator()
col.label(text="Select:")
subcol = col.column(align=True)
subcol.active = edit_ok
subcol.operator("gpencil.select_all", text="Select All")
subcol.operator("gpencil.select_border")
subcol.operator("gpencil.select_circle")
col.separator()
subcol = col.column(align=True)
subcol.active = edit_ok
subcol.operator("gpencil.select_linked")
subcol.operator("gpencil.select_more")
subcol.operator("gpencil.select_less")
col.separator()
col.label(text="Edit:")
subcol = col.column(align=True)
subcol.active = edit_ok
subcol.operator("gpencil.delete", text="Delete")
subcol.operator("gpencil.duplicate_move", text="Duplicate")
subcol.operator("transform.mirror", text="Mirror").gpencil_strokes = True
col.separator()
subcol = col.column(align=True)
subcol.active = edit_ok
subcol.operator("transform.translate").gpencil_strokes = True # icon='MAN_TRANS'
subcol.operator("transform.rotate").gpencil_strokes = True # icon='MAN_ROT'
subcol.operator("transform.resize", text="Scale").gpencil_strokes = True # icon='MAN_SCALE'
col.separator()
subcol = col.column(align=True)
subcol.active = edit_ok
subcol.operator("transform.bend", text="Bend").gpencil_strokes = True
subcol.operator("transform.shear", text="Shear").gpencil_strokes = True
subcol.operator("transform.tosphere", text="To Sphere").gpencil_strokes = True
###############################
class GPENCIL_PIE_tool_palette(Menu):
"""A pie menu for quick access to Grease Pencil tools"""
bl_label = "Grease Pencil Tools"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
gpd = context.gpencil_data
# W - Drawing Types
col = pie.column()
col.operator("gpencil.draw", text="Draw", icon='GREASEPENCIL').mode = 'DRAW'
col.operator("gpencil.draw", text="Straight Lines", icon='LINE_DATA').mode = 'DRAW_STRAIGHT'
col.operator("gpencil.draw", text="Poly", icon='MESH_DATA').mode = 'DRAW_POLY'
# E - Eraser
# XXX: needs a dedicated icon...
col = pie.column()
col.operator("gpencil.draw", text="Eraser", icon='FORCE_CURVE').mode = 'ERASER'
# E - "Settings" Palette is included here too, since it needs to be in a stable position...
if gpd and gpd.layers.active:
col.separator()
col.operator("wm.call_menu_pie", text="Settings...", icon='SCRIPTWIN').name = "GPENCIL_PIE_settings_palette"
# Editing tools
if gpd:
if gpd.use_stroke_edit_mode and context.editable_gpencil_strokes:
# S - Exit Edit Mode
pie.prop(gpd, "use_stroke_edit_mode", text="Exit Edit Mode", icon='EDIT')
# N - Transforms
col = pie.column()
row = col.row(align=True)
row.operator("transform.translate", icon='MAN_TRANS').gpencil_strokes = True
row.operator("transform.rotate", icon='MAN_ROT').gpencil_strokes = True
row.operator("transform.resize", text="Scale", icon='MAN_SCALE').gpencil_strokes = True
row = col.row(align=True)
row.label("Proportional Edit:")
row.prop(context.tool_settings, "proportional_edit", text="", icon_only=True)
row.prop(context.tool_settings, "proportional_edit_falloff", text="", icon_only=True)
# NW - Select (Non-Modal)
col = pie.column()
col.operator("gpencil.select_all", text="Select All", icon='PARTICLE_POINT')
col.operator("gpencil.select_all", text="Select Inverse", icon='BLANK1')
col.operator("gpencil.select_linked", text="Select Linked", icon='LINKED')
# NE - Select (Modal)
col = pie.column()
col.operator("gpencil.select_border", text="Border Select", icon='BORDER_RECT')
col.operator("gpencil.select_circle", text="Circle Select", icon='META_EMPTY')
col.operator("gpencil.select_lasso", text="Lasso Select", icon='BORDER_LASSO')
# SW - Edit Tools
col = pie.column()
col.operator("gpencil.duplicate_move", icon='PARTICLE_PATH', text="Duplicate")
col.operator("gpencil.delete", icon='X', text="Delete...")
# SE - More Tools
pie.operator("wm.call_menu_pie", text="More...").name = "GPENCIL_PIE_tools_more"
else:
# Toggle Edit Mode
pie.prop(gpd, "use_stroke_edit_mode", text="Enable Stroke Editing", icon='EDIT')
class GPENCIL_PIE_settings_palette(Menu):
"""A pie menu for quick access to Grease Pencil settings"""
bl_label = "Grease Pencil Settings"
@classmethod
def poll(cls, context):
return bool(context.gpencil_data and context.active_gpencil_layer)
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# gpd = context.gpencil_data
gpl = context.active_gpencil_layer
# W - Stroke draw settings
col = pie.column(align=True)
col.label(text="Stroke")
col.prop(gpl, "color", text="")
col.prop(gpl, "alpha", text="", slider=True)
# E - Fill draw settings
col = pie.column(align=True)
col.label(text="Fill")
col.prop(gpl, "fill_color", text="")
col.prop(gpl, "fill_alpha", text="", slider=True)
# S - Layer settings
col = pie.column()
col.prop(gpl, "line_width", slider=True)
# col.prop(gpl, "use_volumetric_strokes")
col.prop(gpl, "use_onion_skinning")
# N - Active Layer
# XXX: this should show an operator to change the active layer instead
col = pie.column()
col.label("Active Layer: ")
col.prop(gpl, "info", text="")
# col.prop(gpd, "layers")
row = col.row()
row.prop(gpl, "lock")
row.prop(gpl, "hide")
class GPENCIL_PIE_tools_more(Menu):
"""A pie menu for accessing more Grease Pencil tools"""
bl_label = "More Grease Pencil Tools"
@classmethod
def poll(cls, context):
gpd = context.gpencil_data
return bool(gpd and gpd.use_stroke_edit_mode and context.editable_gpencil_strokes)
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# gpd = context.gpencil_data
pie.operator("gpencil.select_more", icon='ZOOMIN')
pie.operator("gpencil.select_less", icon='ZOOMOUT')
pie.operator("transform.mirror", icon='MOD_MIRROR').gpencil_strokes = True
pie.operator("transform.bend", icon='MOD_SIMPLEDEFORM').gpencil_strokes = True
pie.operator("transform.shear", icon='MOD_TRIANGULATE').gpencil_strokes = True
pie.operator("transform.tosphere", icon='MOD_MULTIRES').gpencil_strokes = True
pie.operator("gpencil.convert", icon='OUTLINER_OB_CURVE')
pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_PIE_tool_palette"
class GPENCIL_UL_layer(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# assert(isinstance(item, bpy.types.GPencilLayer)
gpl = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
if gpl.lock:
layout.active = False
split = layout.split(percentage=0.2)
split.prop(gpl, "color", text="")
split.prop(gpl, "info", text="", emboss=False)
row = layout.row(align=True)
row.prop(gpl, "lock", text="", emboss=False)
row.prop(gpl, "hide", text="", emboss=False)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label(text="", icon_value=icon)
class GreasePencilDataPanel():
# subclass must set
# bl_space_type = 'IMAGE_EDITOR'
bl_label = "Grease Pencil"
bl_region_type = 'UI'
@staticmethod
def draw_header(self, context):
self.layout.prop(context.space_data, "show_grease_pencil", text="")
@staticmethod
def draw(self, context):
layout = self.layout
# owner of Grease Pencil data
gpd_owner = context.gpencil_data_owner
gpd = context.gpencil_data
# Owner Selector
if context.space_data.type == 'VIEW_3D':
layout.prop(context.tool_settings, "grease_pencil_source", expand=True)
elif context.space_data.type == 'CLIP_EDITOR':
layout.prop(context.space_data, "grease_pencil_source", expand=True)
# Grease Pencil data selector
layout.template_ID(gpd_owner, "grease_pencil", new="gpencil.data_add", unlink="gpencil.data_unlink")
# Grease Pencil data...
if gpd:
self.draw_layers(context, layout, gpd)
def draw_layers(self, context, layout, gpd):
row = layout.row()
col = row.column()
col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index", rows=5)
col = row.column()
sub = col.column(align=True)
sub.operator("gpencil.layer_add", icon='ZOOMIN', text="")
sub.operator("gpencil.layer_remove", icon='ZOOMOUT', text="")
gpl = context.active_gpencil_layer
if gpl:
col.separator()
sub = col.column(align=True)
sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
if gpl:
self.draw_layer(layout, gpl)
def draw_layer(self, layout, gpl):
# layer settings
split = layout.split(percentage=0.5)
split.active = not gpl.lock
# Column 1 - Stroke
col = split.column(align=True)
col.label(text="Stroke:")
col.prop(gpl, "color", text="")
col.prop(gpl, "alpha", slider=True)
# Column 2 - Fill
col = split.column(align=True)
col.label(text="Fill:")
col.prop(gpl, "fill_color", text="")
col.prop(gpl, "fill_alpha", text="Opacity", slider=True)
# Options
split = layout.split(percentage=0.5)
split.active = not gpl.lock
col = split.column(align=True)
col.prop(gpl, "line_width", slider=True)
col.prop(gpl, "use_volumetric_strokes")
col = split.column(align=True)
col.prop(gpl, "show_x_ray")
# if debug:
# layout.prop(gpl, "show_points")
layout.separator()
# Full-Row - Frame Locking (and Delete Frame)
row = layout.row(align=True)
row.active = not gpl.lock
if gpl.active_frame:
lock_status = "Locked" if gpl.lock_frame else "Unlocked"
lock_label = "Frame: %d (%s)" % (gpl.active_frame.frame_number, lock_status)
else:
lock_label = "Lock Frame"
row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED')
row.operator("gpencil.active_frame_delete", text="", icon='X')
layout.separator()
# Onion skinning
col = layout.column(align=True)
col.active = not gpl.lock
row = col.row()
row.prop(gpl, "use_onion_skinning")
row.prop(gpl, "use_ghost_custom_colors", text="", icon='COLOR')
split = col.split(percentage=0.5)
split.active = gpl.use_onion_skinning
# - Before Frames
sub = split.column(align=True)
row = sub.row(align=True)
row.active = gpl.use_ghost_custom_colors
row.prop(gpl, "before_color", text="")
sub.prop(gpl, "ghost_before_range", text="Before")
# - After Frames
sub = split.column(align=True)
row = sub.row(align=True)
row.active = gpl.use_ghost_custom_colors
row.prop(gpl, "after_color", text="")
sub.prop(gpl, "ghost_after_range", text="After")
class GreasePencilToolsPanel():
# subclass must set
# bl_space_type = 'IMAGE_EDITOR'
# bl_options = {'DEFAULT_CLOSED'}
bl_label = "Grease Pencil Settings"
bl_region_type = 'UI'
@classmethod
def poll(cls, context):
return (context.gpencil_data is not None)
@staticmethod
def draw(self, context):
layout = self.layout
# gpd_owner = context.gpencil_data_owner
gpd = context.gpencil_data
layout.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True)
layout.separator()
layout.label("Proportional Edit:")
row = layout.row()
row.prop(context.tool_settings, "proportional_edit", text="")
row.prop(context.tool_settings, "proportional_edit_falloff", text="")
layout.separator()
layout.separator()
gpencil_stroke_placement_settings(context, layout, gpd)

View File

@@ -21,7 +21,11 @@
import bpy
from bpy.types import Panel, Header, Menu, UIList
from bpy.app.translations import pgettext_iface as iface_
from bl_ui.properties_grease_pencil_common import GreasePencilPanel
from bl_ui.properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilDataPanel
)
class CLIP_UL_tracking_objects(UIList):
@@ -422,7 +426,9 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
col = layout.column()
row = col.row()
row.prop(settings, "use_tripod_solver", text="Tripod")
row.prop(settings, "use_keyframe_selection", text="Keyframe")
sub = row.row()
sub.active = not settings.use_tripod_solver
sub.prop(settings, "use_keyframe_selection", text="Keyframe")
col = layout.column(align=True)
col.active = (not settings.use_tripod_solver and
@@ -1050,12 +1056,6 @@ class CLIP_PT_tools_mask(MASK_PT_tools, Panel):
# --- end mask ---
class CLIP_PT_tools_grease_pencil(GreasePencilPanel, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
bl_category = "Grease Pencil"
class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
@@ -1110,6 +1110,26 @@ class CLIP_PT_tools_scenesetup(Panel):
layout.operator("clip.setup_tracking_scene")
# Grease Pencil properties
class CLIP_PT_grease_pencil(GreasePencilDataPanel, CLIP_PT_clip_view_panel, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
bl_options = {'DEFAULT_CLOSED'}
# NOTE: this is just a wrapper around the generic GP Panel
# But, this should only be visible in "clip" view
# Grease Pencil drawing tools
class CLIP_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
bl_space_type = 'CLIP_EDITOR'
# Grease Pencil stroke editing tools
class CLIP_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
bl_space_type = 'CLIP_EDITOR'
class CLIP_MT_view(Menu):
bl_label = "View"

View File

@@ -91,6 +91,8 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False):
row.prop(dopesheet, "show_speakers", text="")
if bpy.data.linestyles:
row.prop(dopesheet, "show_linestyles", text="")
if bpy.data.grease_pencil:
row.prop(dopesheet, "show_gpencil", text="")
#######################################
@@ -365,14 +367,16 @@ class DOPESHEET_MT_gpencil_frame(Menu):
layout = self.layout
layout.menu("DOPESHEET_MT_key_transform", text="Transform")
#layout.operator_menu_enum("action.snap", "type", text="Snap")
#layout.operator_menu_enum("action.mirror", "type", text="Mirror")
layout.operator_menu_enum("action.snap", "type", text="Snap")
layout.operator_menu_enum("action.mirror", "type", text="Mirror")
layout.separator()
layout.operator("action.duplicate")
layout.operator("action.delete")
layout.separator()
layout.operator("action.keyframe_type")
#layout.separator()
#layout.operator("action.copy")
#layout.operator("action.paste")

View File

@@ -25,7 +25,11 @@ from bl_ui.properties_paint_common import (
brush_texpaint_common,
brush_mask_texture_settings,
)
from bl_ui.properties_grease_pencil_common import GreasePencilPanel
from bl_ui.properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilDataPanel
)
from bpy.app.translations import pgettext_iface as iface_
@@ -1149,10 +1153,21 @@ class IMAGE_PT_scope_sample(Panel):
sub.prop(sima.scopes, "accuracy")
class IMAGE_PT_tools_grease_pencil(GreasePencilPanel, Panel):
# Grease Pencil properties
class IMAGE_PT_grease_pencil(GreasePencilDataPanel, Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
# NOTE: this is just a wrapper around the generic GP Panel
# Grease Pencil drawing tools
class IMAGE_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
bl_space_type = 'IMAGE_EDITOR'
# Grease Pencil stroke editing tools
class IMAGE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'TOOLS'
bl_category = "Grease Pencil"
if __name__ == "__main__": # only for live edit.

View File

@@ -57,12 +57,15 @@ class INFO_HT_header(Header):
row = layout.row(align=True)
if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False:
row.label("Auto-run disabled: %s" % bpy.app.autoexec_fail_message, icon='ERROR')
row.label("Auto-run disabled", icon='ERROR')
if bpy.data.is_saved:
props = row.operator("wm.revert_mainfile", icon='SCREEN_BACK', text="Reload Trusted")
props.use_scripts = True
row.operator("script.autoexec_warn_clear", text="Ignore")
# include last so text doesn't push buttons out of the header
row.label(bpy.app.autoexec_fail_message)
return
row.operator("wm.splash", text="", icon='BLENDER', emboss=False)
@@ -276,7 +279,7 @@ class INFO_MT_help(Menu):
def draw(self, context):
layout = self.layout
layout.operator("wm.url_open", text="Manual", icon='HELP').url = "http://wiki.blender.org/index.php/Doc:2.6/Manual"
layout.operator("wm.url_open", text="Manual", icon='HELP').url = "http://www.blender.org/manual"
layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/%d.%d" % bpy.app.version[:2]
layout.separator()

View File

@@ -19,6 +19,12 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
from bl_ui.properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel,
GreasePencilDataPanel,
GreasePencilToolsPanel,
)
class NODE_HT_header(Header):
@@ -439,6 +445,45 @@ class NODE_UL_interface_sockets(bpy.types.UIList):
layout.template_node_socket(color)
# Grease Pencil properties
class NODE_PT_grease_pencil(GreasePencilDataPanel, Panel):
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'
# NOTE: this is just a wrapper around the generic GP Panel
@classmethod
def poll(cls, context):
snode = context.space_data
return snode is not None and snode.node_tree is not None
class NODE_PT_grease_pencil_tools(GreasePencilToolsPanel, Panel):
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'
bl_options = {'DEFAULT_CLOSED'}
# NOTE: this is just a wrapper around the generic GP tools panel
# It contains access to some essential tools usually found only in
# toolbar, but which may not necessarily be open
# Tool Shelf ------------------
# Grease Pencil drawing tools
class NODE_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'TOOLS'
# Grease Pencil stroke editing tools
class NODE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'TOOLS'
# -----------------------------
def node_draw_tree_view(layout, context):
pass

View File

@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel, GreasePencilToolsPanel
from bpy.app.translations import pgettext_iface as iface_
@@ -71,7 +72,6 @@ class SEQUENCER_HT_header(Header):
row.prop(scene, "lock_frame_selection_to_range", text="", toggle=True)
layout.prop(st, "view_type", expand=True, text="")
layout.prop(st, "waveform_draw_type", text="")
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
layout.prop(st, "display_mode", expand=True, text="")
@@ -103,6 +103,17 @@ class SEQUENCER_HT_header(Header):
row = layout.row()
row.prop(st, "overlay_type", text="")
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
gpd = context.gpencil_data
toolsettings = context.tool_settings
# Proportional editing
if gpd and gpd.use_stroke_edit_mode:
row = layout.row(align=True)
row.prop(toolsettings, "proportional_edit", icon_only=True)
if toolsettings.proportional_edit != 'DISABLED':
row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
row = layout.row(align=True)
row.operator("render.opengl", text="", icon='RENDER_STILL').sequencer = True
props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
@@ -151,8 +162,10 @@ class SEQUENCER_MT_view(Menu):
layout = self.layout
st = context.space_data
is_preview = st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}
is_sequencer_view = st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}
if st.view_type in {'PREVIEW'}:
if st.view_type == 'PREVIEW':
# Specifying the REGION_PREVIEW context is needed in preview-only
# mode, else the lookup for the shortcut will fail in
# wm_keymap_item_find_props() (see #32595).
@@ -162,10 +175,10 @@ class SEQUENCER_MT_view(Menu):
layout.separator()
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
if is_sequencer_view:
layout.operator("sequencer.view_all", text="View all Sequences")
layout.operator("sequencer.view_selected")
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
if is_preview:
layout.operator_context = 'INVOKE_REGION_PREVIEW'
layout.operator("sequencer.view_all_preview", text="Fit preview in window")
@@ -183,11 +196,14 @@ class SEQUENCER_MT_view(Menu):
# # XXX, invokes in the header view
# layout.operator("sequencer.view_ghost_border", text="Overlay Border")
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
if is_sequencer_view:
layout.prop(st, "show_seconds")
layout.prop(st, "show_frame_indicator")
layout.prop(st, "show_strip_offset")
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
layout.prop_menu_enum(st, "waveform_draw_type")
if is_preview:
if st.display_mode == 'IMAGE':
layout.prop(st, "show_safe_margin")
elif st.display_mode == 'WAVEFORM':
@@ -195,7 +211,7 @@ class SEQUENCER_MT_view(Menu):
layout.separator()
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
if is_sequencer_view:
layout.prop(st, "use_marker_sync")
layout.separator()
@@ -781,6 +797,8 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
layout.label(text="Camera Override")
layout.template_ID(strip, "scene_camera")
layout.prop(strip, "use_grease_pencil", text="Show Grease Pencil")
if scene:
layout.prop(scene, "audio_volume", text="Audio Volume")
@@ -1017,5 +1035,22 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):
col.prop(mod, "contrast")
class SEQUENCER_PT_grease_pencil(GreasePencilDataPanel, SequencerButtonsPanel_Output, Panel):
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
# NOTE: this is just a wrapper around the generic GP Panel
# But, it should only show up when there are images in the preview region
class SEQUENCER_PT_grease_pencil_tools(GreasePencilToolsPanel, SequencerButtonsPanel_Output, Panel):
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
# NOTE: this is just a wrapper around the generic GP tools panel
# It contains access to some essential tools usually found only in
# toolbar, which doesn't exist here...
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)

View File

@@ -776,7 +776,7 @@ class USERPREF_PT_theme(Panel):
padding = subsplit.split(percentage=0.15)
colsub = padding.column()
colsub = padding.column()
colsub.row().prop(ui, "emboss")
colsub.row().prop(ui, "widget_emboss")
col.separator()
col.separator()

View File

@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel
from bl_ui.properties_paint_common import UnifiedPaintPanel
from bpy.app.translations import contexts as i18n_contexts
@@ -56,7 +57,12 @@ class VIEW3D_HT_header(Header):
row.prop(view, "use_occlude_geometry", text="")
# Proportional editing
if mode in {'EDIT', 'PARTICLE_EDIT'}:
if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
row = layout.row(align=True)
row.prop(toolsettings, "proportional_edit", icon_only=True)
if toolsettings.proportional_edit != 'DISABLED':
row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
elif mode in {'EDIT', 'PARTICLE_EDIT'}:
row = layout.row(align=True)
row.prop(toolsettings, "proportional_edit", icon_only=True)
if toolsettings.proportional_edit != 'DISABLED':
@@ -66,6 +72,13 @@ class VIEW3D_HT_header(Header):
row.prop(toolsettings, "use_proportional_edit_objects", icon_only=True)
if toolsettings.use_proportional_edit_objects:
row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
else:
# Proportional editing
if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
row = layout.row(align=True)
row.prop(toolsettings, "proportional_edit", icon_only=True)
if toolsettings.proportional_edit != 'DISABLED':
row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
# Snap
if not obj or mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}:
@@ -2703,6 +2716,12 @@ class VIEW3D_MT_edit_armature_roll(Menu):
# ********** Panel **********
class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
# NOTE: this is just a wrapper around the generic GP Panel
class VIEW3D_PT_view3d_properties(Panel):
bl_space_type = 'VIEW_3D'

View File

@@ -19,7 +19,10 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Panel, UIList
from bl_ui.properties_grease_pencil_common import GreasePencilPanel
from bl_ui.properties_grease_pencil_common import (
GreasePencilDrawingToolsPanel,
GreasePencilStrokeEditPanel
)
from bl_ui.properties_paint_common import (
UnifiedPaintPanel,
brush_texture_settings,
@@ -1805,11 +1808,14 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
sub.prop(pe, "fade_frames", slider=True)
# Grease Pencil tools
class VIEW3D_PT_tools_grease_pencil(GreasePencilPanel, Panel):
# Grease Pencil drawing tools
class VIEW3D_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
bl_space_type = 'VIEW_3D'
# Grease Pencil stroke editing tools
class VIEW3D_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = "Grease Pencil"
# Note: moved here so that it's always in last position in 'Tools' panels!

View File

@@ -57,7 +57,7 @@
<p class="p5"><span class="s3">General information <a href="http://www.blender.org/"><span class="s4">www.blender.org</span></a> <br>
Full release log <a href="http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.73"><span class="s4">wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.73</span></a><br>
Tutorials <a href="http://www.blender.org/support/tutorials/"><span class="s4">www.blender.org/support/tutorials/</span></a> <br>
Manual <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual"><span class="s4">wiki.blender.org/index.php/Doc:2.6/Manual</span></a><br>
Manual <a href="http://www.blender.org/manual"><span class="s4">www.blender.org/manual</span></a><br>
User Forum <a href="http://www.blenderartists.org/"><span class="s4">www.blenderartists.org</span></a><br>
IRC <a href="irc://irc.freenode.net/#blenderchat"><span class="s4">#blenderchat</span></a> or <a href="irc://irc.freenode.net/#blender"><span class="s4">#blender</span></a> on irc.freenode.net</span></p>
<p class="p4">Developers:</p>

View File

@@ -163,6 +163,8 @@ const char *BLF_translate_do_new_dataname(const char *msgctxt, const char *msgid
#define BLF_I18NCONTEXT_ID_MESH "Mesh"
#define BLF_I18NCONTEXT_ID_NODETREE "NodeTree"
#define BLF_I18NCONTEXT_ID_OBJECT "Object"
#define BLF_I18NCONTEXT_ID_PAINTCURVE "PaintCurve"
#define BLF_I18NCONTEXT_ID_PALETTE "Palette"
#define BLF_I18NCONTEXT_ID_PARTICLESETTINGS "ParticleSettings"
#define BLF_I18NCONTEXT_ID_SCENE "Scene"
#define BLF_I18NCONTEXT_ID_SCREEN "Screen"
@@ -207,11 +209,15 @@ typedef struct
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_LAMP, "id_lamp"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_LIBRARY, "id_library"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_LATTICE, "id_lattice"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MASK, "id_mask"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MATERIAL, "id_material"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_METABALL, "id_metaball"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MESH, "id_mesh"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MOVIECLIP, "id_movieclip"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_NODETREE, "id_nodetree"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_OBJECT, "id_object"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_PAINTCURVE, "id_paintcurve"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_PALETTE, "id_palette"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_PARTICLESETTINGS, "id_particlesettings"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_SCENE, "id_scene"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_SCREEN, "id_screen"), \
@@ -223,8 +229,6 @@ typedef struct
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_VFONT, "id_vfont"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_WORLD, "id_world"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_WINDOWMANAGER, "id_windowmanager"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MOVIECLIP, "id_movieclip"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_MASK, "id_mask"), \
{NULL, NULL, NULL} \
}

View File

@@ -262,8 +262,8 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
g->xoff = -1;
g->yoff = -1;
bitmap = slot->bitmap;
g->width = bitmap.width;
g->height = bitmap.rows;
g->width = (int)bitmap.width;
g->height = (int)bitmap.rows;
if (g->width && g->height) {
if (sharp) {

View File

@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 272
#define BLENDER_SUBVERSION 2
#define BLENDER_SUBVERSION 3
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 5

View File

@@ -56,6 +56,9 @@ struct Text;
struct ImBuf;
struct EditBone;
struct bPoseChannel;
struct bGPdata;
struct bGPDlayer;
struct bGPDframe;
struct wmWindow;
struct wmWindowManager;
struct SpaceText;
@@ -275,6 +278,14 @@ struct bPoseChannel *CTX_data_active_pose_bone(const bContext *C);
int CTX_data_selected_pose_bones(const bContext *C, ListBase *list);
int CTX_data_visible_pose_bones(const bContext *C, ListBase *list);
struct bGPdata *CTX_data_gpencil_data(const bContext *C);
struct bGPDlayer *CTX_data_active_gpencil_layer(const bContext *C);
struct bGPDframe *CTX_data_active_gpencil_frame(const bContext *C);
int CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list);
int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list);
int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list);
#ifdef __cplusplus
}
#endif

View File

@@ -35,6 +35,7 @@ struct ListBase;
struct bGPdata;
struct bGPDlayer;
struct bGPDframe;
struct bGPDstroke;
/* ------------ Grease-Pencil API ------------------ */
@@ -43,6 +44,8 @@ void free_gpencil_frames(struct bGPDlayer *gpl);
void free_gpencil_layers(struct ListBase *list);
void BKE_gpencil_free(struct bGPdata *gpd);
void gpencil_stroke_sync_selection(struct bGPDstroke *gps);
struct bGPDframe *gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe);
struct bGPDlayer *gpencil_layer_addnew(struct bGPdata *gpd, const char *name, int setactive);
struct bGPdata *gpencil_data_addnew(const char name[]);

View File

@@ -41,13 +41,13 @@ typedef union IDPropertyTemplate {
double d;
struct {
char *str;
short len;
int len;
char subtype;
} string;
struct ID *id;
struct {
short type;
short len;
int len;
char type;
} array;
struct {
int matvec_size;
@@ -110,7 +110,7 @@ bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is
bool IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2) ATTR_WARN_UNUSED_RESULT;
struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
struct IDProperty *IDP_New(const char type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void IDP_FreeProperty(struct IDProperty *prop);

View File

@@ -36,6 +36,7 @@
extern "C" {
#endif
struct bNodeTreeExecPool;
struct Main;
struct Material;
struct ID;
@@ -96,10 +97,16 @@ struct Material *BKE_material_pop_id(struct ID *id, int index, bool update_data)
void BKE_material_clear_id(struct ID *id, bool update_data);
/* rendering */
void init_render_material(struct Material *, int, float *);
void init_render_materials(struct Main *, int, float *);
void end_render_material(struct Material *);
void end_render_materials(struct Main *);
void init_render_material(struct Material *mat,
struct bNodeTreeExecPool *exec_tree_pool,
int render_mode, float *amb);
void init_render_materials(struct Main *bmain,
struct bNodeTreeExecPool *exec_tree_pool,
int render_mode, float *amb);
void end_render_material(struct bNodeTreeExecPool *exec_tree_pool,
struct Material *mat);
void end_render_materials(struct Main *bmain,
struct bNodeTreeExecPool *exec_tree_pool);
bool material_in_material(struct Material *parmat, struct Material *mat);

View File

@@ -46,6 +46,7 @@ void BKE_movieclip_unlink(struct Main *bmain, struct MovieClip *clip);
struct MovieClip *BKE_movieclip_file_add(struct Main *bmain, const char *name);
void BKE_movieclip_reload(struct MovieClip *clip);
void BKE_movieclip_clear_cache(struct MovieClip *clip);
void BKE_movieclip_clear_proxy_cache(struct MovieClip *clip);
struct ImBuf *BKE_movieclip_get_ibuf(struct MovieClip *clip, struct MovieClipUser *user);
struct ImBuf *BKE_movieclip_get_postprocessed_ibuf(struct MovieClip *clip, struct MovieClipUser *user, int postprocess_flag);

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