Compare commits

..

1064 Commits

Author SHA1 Message Date
bcc020b1bc Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/readfile.c
2016-07-25 19:33:55 +02:00
3f36cd3f33 Changed most of ID_IS_LINKED_foo checks as needed.
Basically, due to new 'virtual' libraries & 'path' assets, we consider those 'virtualmy  linked' IDs as:
* Local for editing purpose (i.e. they are editable).
* Linked for datablock management purposes (i.e. they can be made local, etc.).

Note: all this is more like a quick hack to test 'file-based' asset repositories (like cloud)
in comming weeks. I really do not think we should use that in the end, an full-featured
'overriding ID' system (as proposed in replacement of proxies for 2.8) would be much saner imho.
2016-07-25 17:37:34 +02:00
521222b545 Merge branch 'master' into asset-engine 2016-07-25 16:42:35 +02:00
4a298b10ec Merge branch 'master' into asset-engine 2016-07-25 15:07:44 +02:00
784f7f3264 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
2016-07-24 18:13:36 +02:00
70e3f86809 Some more small fixes regarding ID/library asset handling. 2016-07-24 15:58:16 +02:00
d8da816a7c Add more macros to differentiate actual linked datablocks from 'virtually' linked ones (assets only).
Not yet used in code.
2016-07-16 15:54:46 +02:00
5e469bbd95 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_init_exit.c
2016-07-16 15:39:50 +02:00
99bb1accbb Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/intern/wm_init_exit.c
2016-07-12 09:15:49 +02:00
b0760a5c8f Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/readfile.c
2016-07-07 15:15:48 +02:00
581a819432 Merge branch 'master' into asset-engine 2016-07-02 15:30:54 +02:00
6ba8498307 Fix memleak whene deleting IDs with uuid! 2016-06-30 13:02:09 +02:00
b18270f43a Add utility to print UUID (could make it nicer, but for now will do). 2016-06-30 10:44:10 +02:00
3db91def28 Reduce re-allocation while fetching UUIDs per asset engine (asset reload area). 2016-06-30 10:41:03 +02:00
4dd6ffaf37 Split Library/ID asset-related management into own library_asset file.
This is specific enough to deserve its own file imho, and though rather small
currently, it's likely to grow...
2016-06-29 22:38:49 +02:00
4137cc79f2 Cleanup: rename BKE_asset to BKE_asset_engine.
Since this file mostly defines/handles interactions with asset engines...

Asset handling itself is more done in library area (will split it too in next commit).
2016-06-29 22:09:37 +02:00
b25c224d90 Merge branch 'master' into asset-engine 2016-06-29 18:01:35 +02:00
732cd96737 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/writefile.c
2016-06-28 18:21:53 +02:00
71278cc22a Merge branch 'master' into asset-experiments 2016-06-27 17:44:15 +02:00
99869dab7c Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/intern/brush.c
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/library_remap.c
	source/blender/blenkernel/intern/mesh.c
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/writefile.c
	source/blender/editors/space_action/space_action.c
	source/blender/editors/space_clip/space_clip.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_graph/space_graph.c
	source/blender/editors/space_image/space_image.c
	source/blender/editors/space_logic/space_logic.c
	source/blender/editors/space_nla/space_nla.c
	source/blender/editors/space_node/space_node.c
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_sequencer/space_sequencer.c
	source/blender/editors/space_text/space_text.c
	source/blender/editors/space_view3d/space_view3d.c
	source/blender/makesrna/intern/rna_ID.c
	source/blender/makesrna/intern/rna_main_api.c
	source/blender/windowmanager/intern/wm_files_link.c
	source/blender/windowmanager/wm_files.h
2016-06-27 17:29:09 +02:00
d012380cae Merge branch 'asset-engine' into asset-experiments 2016-06-16 23:45:02 +02:00
4c086f6b80 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/intern/library.c
2016-06-16 23:44:43 +02:00
56677f4f14 Fix remaining cases of datablocks' BKE_foo_free() touching usercount of their IDs.
Note that a few sub-data (like animdata) needs to keep option to unlink their
own ID usages themselves for now, this is not ideal, but need some more time
to mumble on this and find an elegant fix. Nothing blocking here anyway.
2016-06-16 22:06:32 +02:00
bb4c87a130 Merge branch 'master' into asset-engine 2016-06-16 21:17:45 +02:00
4853f75073 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-06-16 21:13:15 +02:00
04ee81a081 Merge branch 'master' into id-remap 2016-06-16 19:24:14 +02:00
42dda95e89 Merge branch 'master' into id-remap 2016-06-16 18:12:53 +02:00
21b5ce57f5 Fix bad handling of RegionView3Ds in View3D ID remap callback. 2016-06-16 18:10:44 +02:00
c24ba18d7a Found more id-remap missing cases in spaces (new(?) ads of anim editors). 2016-06-16 17:16:25 +02:00
1eac4fde27 Fix missing mask ID pointer update in Clip/Image spaces' remap callbacks. 2016-06-16 16:56:20 +02:00
fc10e42de3 Finish TODOs related to buttons space and ID remapping. 2016-06-16 16:47:32 +02:00
0256d5dde9 Fix reload/relocate trying to use invalid lib path. 2016-06-16 16:06:10 +02:00
7cbe356c4f Fix broken compilation after recent refactor. 2016-06-16 15:59:30 +02:00
bde19b57d6 Cleanup from review comments. 2016-06-16 15:54:22 +02:00
dbf7d30744 Merge branch 'master' into id-remap 2016-06-16 15:39:54 +02:00
d430237282 Cleanup: headers 2016-06-16 20:43:34 +10:00
5fd97c6e85 Move remapping functions into BKE_library_remap.h
This is done since remapping is quite an involved process.
2016-06-16 20:28:54 +10:00
1880cb6c75 Merge branch 'master' into id-remap 2016-06-16 20:03:53 +10:00
25e0f5e9f2 Fixes/updates needed to make asset reload work with new virtual lib stuff. 2016-06-14 17:41:29 +02:00
b74ad975fd Merge branch 'id-remap' into asset-experiments 2016-06-14 16:39:53 +02:00
0d8e70600b Merge branch 'asset-engine' into asset-experiments 2016-06-14 16:39:47 +02:00
beaf33dfb2 Merge branch 'master' into id-remap 2016-06-14 16:36:42 +02:00
46cf8ba269 Cleanup. 2016-06-14 16:36:15 +02:00
f7b21186b5 Merge branch 'master' into asset-engine 2016-06-14 16:31:58 +02:00
fe41942a90 Cleanup: move 'virtual lib' linking code into own helper. 2016-06-14 15:56:32 +02:00
c6d3f76e69 Fix save/load issues with new virtual-lib assets. 2016-06-14 15:47:54 +02:00
69ae86193c Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/writefile.c
2016-06-14 15:07:18 +02:00
5aaf18c39c WIP experimental support of direct image-as-linkeddata.
Works okish, but break on load (or save) of .blend file currently...
2016-06-13 21:40:48 +02:00
cbf241510d First step towards supporting non-blender-data as assets.
Idea is to avoid the need for asset engines to generate whole .blend files
with relevant datablocks in case they just need/want to provide files (images, videos, sounds...).

This commit introduces the concept of 'virtual' library, which in fact only exists to store
asset repository data. Datablocks from those virtual libs are then fully written in .blend file.

Much to do still, this is only preliminary/experimental work.
2016-06-13 17:39:02 +02:00
088d32d159 Some minor fixes/enhancements.
Asset engines are now only selectable and used in link/append case. Makes no real sense to have
those in other cases (like regular file opening, or even worse when saving a file!).
Also allows to get back asset engine persistance accross filebrowser usage.
2016-06-13 15:06:52 +02:00
d24c85fc12 Merge branch 'asset-engine' into asset-experiments 2016-06-13 12:54:44 +02:00
595159614f Merge branch 'id-remap' into asset-experiments 2016-06-13 12:54:38 +02:00
98654a9c9a Merge branch 'master' into asset-experiments 2016-06-13 12:54:32 +02:00
4286b606b3 Merge branch 'master' into asset-engine 2016-06-13 12:50:06 +02:00
09df8bd2e0 Merge branch 'master' into id-remap 2016-06-13 12:47:09 +02:00
836ecc6142 Merge branch 'asset-engine' into asset-experiments 2016-06-07 10:17:23 +02:00
0f5642b155 Merge branch 'id-remap' into asset-experiments 2016-06-07 10:17:16 +02:00
b1171ea31c Merge branch 'master' into asset-engine 2016-06-07 10:12:59 +02:00
3f4113ce3e Merge branch 'master' into id-remap 2016-06-07 10:10:14 +02:00
aa5f4d98fc Merge branch 'asset-engine' into asset-experiments 2016-06-07 09:44:08 +02:00
6f20d64f3a Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/makesdna/DNA_ID.h
2016-06-07 09:43:56 +02:00
fd12edebf4 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/makesdna/DNA_ID.h
2016-06-07 09:42:52 +02:00
18f87c8dcb Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenloader/intern/readfile.c
2016-06-07 09:27:56 +02:00
434a851703 Merge branch 'asset-engine' into asset-experiments 2016-05-31 09:58:19 +02:00
7282c6592a Merge branch 'id-remap' into asset-experiments 2016-05-31 09:58:08 +02:00
77cdf1fb49 Merge branch 'master' into asset-engine 2016-05-31 09:53:40 +02:00
2c9f6714a7 Fix merge error. 2016-05-31 09:53:16 +02:00
9400ea0647 Merge branch 'master' into id-remap 2016-05-31 09:38:38 +02:00
8346805963 Merge branch 'asset-engine' into asset-experiments 2016-05-24 15:49:11 +02:00
050209d16e Merge branch 'id-remap' into asset-experiments 2016-05-24 15:49:03 +02:00
0929283ddc Merge branch 'master' into asset-experiments 2016-05-24 15:48:55 +02:00
5afc102357 Fix alignement issues in some DNA struct due to ID one now being properly aligned. 2016-05-24 15:48:15 +02:00
6bae015985 Merge branch 'master' into asset-engine 2016-05-24 14:44:13 +02:00
ba1af2e1bf Some cleanup. 2016-05-24 14:43:48 +02:00
adbd9cb1de Better name handling in case we remap an ID adn cannot replace it totally. 2016-05-24 14:10:28 +02:00
16641d4c02 Merge branch 'master' into id-remap 2016-05-24 12:29:07 +02:00
4795d6bdb1 Merge branch 'master' into id-remap 2016-05-23 18:18:36 +02:00
542302e3f6 Revert "Squashed commit of the atomic-operations branch."
This reverts commit ffe7f4175a.
2016-05-09 15:12:16 +02:00
ffe7f4175a Squashed commit of the atomic-operations branch. 2016-05-09 15:11:40 +02:00
cb530ad07e Merge branch 'asset-engine' into asset-experiments 2016-05-06 13:34:15 +02:00
084f5e9a4d Merge branch 'id-remap' into asset-experiments 2016-05-06 13:34:06 +02:00
4c8e2ebde2 Merge branch 'master' into asset-experiments 2016-05-06 13:33:59 +02:00
d27bae4432 Merge branch 'master' into asset-engine 2016-05-06 13:30:37 +02:00
cbe6475383 Merge branch 'master' into id-remap 2016-05-06 13:28:20 +02:00
93c9ff858a First 'working' version of asset reload.
Dead dummy simplistic test runs (nearly) OK here (only have a memleak from versionning code...),
but obviously will need much serious tests to validate everything.

Also, many things in code will need cleanup/refactor. Not to mention UI/UX.

But we do have asset version check & reload on file opening now! :D

Process summary:
I) Open .blend file exactly as in master, load assets just like any other linked data (add placeholders in case not found).
II) Check all asset engines and ask them whether each asset is OK, needs to be updated/reloaded, is missing...
III) User then can decide to actually reload the asset, or not.

Step II) happens in an async job (since engines using remote storage/database could take some time to answer),
step III) is a locking task (just like initial linking). This should allow user to not be blocked at all by that
asset update process.
2016-05-06 13:16:24 +02:00
7cf890e126 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/readfile.c
2016-05-06 13:05:49 +02:00
961ebfa8c4 Set a main's version to current one after do_version is done.
With current master this is not an issue, but with all the reload stuff,
a same main could end up going several time into 'do_version', which is absolutely
not desired (multi-allocations, repeating conversions over some values, etc.).
2016-05-06 13:03:31 +02:00
341237035f Merge branch 'asset-engine' into asset-experiments 2016-05-06 11:09:56 +02:00
82359a7997 Do not update asset repo info inside link code.
Whole 'database' is rebuilt later anyway, and in more complex 'asset reload' cases
(where we may actually be reloading same asset with same uuid from same lib file),
this creates confusion...
2016-05-06 11:07:53 +02:00
4a429f1525 Merge branch 'asset-engine' into asset-experiments 2016-05-05 17:20:10 +02:00
fa21019745 Add global 'asset search by uuid' helper. 2016-05-05 17:19:27 +02:00
f4e4575e3c Merge branch 'asset-engine' into asset-experiments 2016-05-03 17:52:31 +02:00
a6f085f3c9 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
2016-05-03 17:52:19 +02:00
39da83e974 Merge branch 'master' into asset-experiments 2016-05-03 17:45:25 +02:00
783d63f6af Merge branch 'master' into asset-engine 2016-05-03 17:45:05 +02:00
a6a8ff103d Lib relocate/reload: serious rework of code.
Idea here is to both factorize it seriously (reload and relocate are very similar, let's
avoid as much as possible twice the same code...), and make new `lib_relocate_do()`
much more flexible - now it should be able to reload individual IDs as well
(plan is to use it to reload assets in relelvant branch too).
2016-05-03 17:42:23 +02:00
a97da9842c Merge branch 'master' into id-remap 2016-05-03 16:58:34 +02:00
861318bbb9 Merge branch 'master' into asset-engine 2016-05-03 15:32:30 +02:00
41c5ec21b3 Merge branch 'master' into id-remap 2016-05-03 15:32:05 +02:00
b7525de284 Merge branch 'asset-engine' into asset-experiments 2016-05-03 09:57:24 +02:00
071a27f918 Amber: Fix load_pre not using correct repo! 2016-05-03 09:56:44 +02:00
90af45d5b5 Merge branch 'asset-engine' into asset-experiments 2016-05-02 20:51:58 +02:00
56ea898ade Merge branch 'id-remap' into asset-experiments 2016-05-02 20:51:51 +02:00
d95671442d Merge branch 'master' into asset-experiments 2016-05-02 20:51:44 +02:00
26658afad1 Amber: fix missing '..' parent dir entry when inside a repo. 2016-05-02 20:50:57 +02:00
70eb04328c Change how Amber (and all other engines) are expected to work.
So far, we were accepting the idea of several repositories per asset engine (e.g. different
directories in case of Amber). However, if this works OK during listing/initial linking,
it makes things way more complicated later in asset management, since asset uuid is no more
enough to unically indentify an asset!

Now an asset UUID is assumed to be really unique inside an asset engine.

For Amber, we 'salt' assets' uuids with new repo uuids (both being only 2 ints long now),
and keep a config 'cache' of mapping repo uuid -> path to repo.
2016-05-02 20:35:08 +02:00
a47653e5d4 Merge branch 'master' into asset-engine 2016-05-02 14:31:25 +02:00
dd63b849f8 Merge branch 'master' into id-remap 2016-05-02 14:28:49 +02:00
266d99ee42 More WIP code for actual assets reload.
Nothing working yet, need to solve some issue with rootpath actually...
2016-04-28 23:15:46 +02:00
5ad251770b Merge branch 'asset-engine' into asset-experiments 2016-04-28 22:40:03 +02:00
6c478490ea Refactor load_pre helper to work from both DirEntries and uuids... 2016-04-28 22:39:12 +02:00
e451d9b56a WIP (mostly empty for now) code to actually reload assets reported as needing it by update_check. 2016-04-28 21:44:59 +02:00
8bf511ef0b Merge branch 'asset-engine' into asset-experiments 2016-04-28 21:34:46 +02:00
ef14700089 Cleanup: get rid of blocking asset update_check code. 2016-04-28 21:32:32 +02:00
20bf7d949f Some refactor in asset update_check code.
Fetching assets' uuids by engines is now in own func (will be used by update op itself too).

Also, each AssetRef has only *one* asset ID, the first one, avoids us a useless loop!

And early out of update_check op in case we have no asset in current Main, no need to start
job in this case.
2016-04-28 21:30:14 +02:00
60cd55692d Merge branch 'asset-engine' into asset-experiments 2016-04-27 13:16:04 +02:00
b3be710e19 Some tweaks to flags & versionning handling for assets update check. 2016-04-27 13:15:39 +02:00
03d23c42a2 Merge branch 'master' into asset-experiments 2016-04-27 11:02:04 +02:00
42ea7490e5 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
	source/blender/windowmanager/wm_files.h
2016-04-27 11:01:48 +02:00
d4a9111f08 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-04-27 10:58:41 +02:00
e812fb4825 Add some header info about asset errors or reload needs.
Again, rather rough UI but enough to be useful for now.
2016-04-26 16:42:00 +02:00
cf08eec187 Add simple dummy code in outliner to show assets and their status.
This is purely WIP helper stuff, final UI will need real work - but that's for later.
2016-04-26 16:02:51 +02:00
32c83ba950 Merge branch 'master' into asset-engine 2016-04-26 14:42:05 +02:00
c2a5f95122 Merge branch 'master' into id-remap 2016-04-26 14:33:54 +02:00
b1c715a5fa Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/blender.c
	source/blender/windowmanager/intern/wm_files.c
	source/blender/windowmanager/intern/wm_init_exit.c
2016-04-25 16:55:41 +02:00
60474d11c7 Merge branch 'master' into id-remap 2016-04-25 16:41:26 +02:00
6e1fdd6f2d Actually hook async job of asset updating! 2016-04-20 17:11:14 +02:00
6cdc7c9587 Add 'ensure_uuids' callback to API, fix some flags in RNA code. 2016-04-20 17:08:42 +02:00
8154ee7bb2 Make opening .blend file use new async 'check asset updates' operator.
Nothing much exciting really, just not blocking anymore.
2016-04-20 16:44:07 +02:00
68eaa00290 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-04-19 23:21:05 +02:00
8055eae905 Merge branch 'master' into id-remap
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-04-19 23:03:53 +02:00
7cb1438035 Asset update: WIP proof-of-concept async (job-based) update code.
Builds, but not tested nor hoocked to anything yet!
2016-04-19 13:07:33 +02:00
e1c0b2ff25 Merge branch 'master' into asset-engine 2016-04-16 15:02:16 +02:00
54307d778d Merge branch 'master' into id-remap 2016-04-16 14:59:16 +02:00
1d40cfafea Move core of update check to BKE's asset area, add an operator for that too. 2016-04-15 10:38:49 +02:00
f36307db4b Merge branch 'master' into asset-engine 2016-04-12 12:30:40 +02:00
9437647f5d Merge branch 'master' into id-remap 2016-04-12 12:21:00 +02:00
9804f9181f Make 'check update' async, and add possibilities for engines to make async callbacks 'immediate'.
So now, jobs callback (async ones) of asset may return a specific job id value in case they actually
complete (or fail) on the first run.

This allows engines that do not need slow async stuff to perform an action to use simpler code
(e.g. imagine an engine able to list its assets from a cached DB, in most cases its list_dir
callback can execute instantaneously (from a user PoV), no need for a listing job then).
2016-04-11 17:35:31 +02:00
09f134aa6c Make asset engine's load_pre callback mandatory now.
Reason is, even if paths returned by `list_dir` are OK, we will also use `load_pre`
during 'reload'/'update' scenarii, where we only have uuids, to retrieve final
.blend datablock paths.
2016-04-11 16:14:05 +02:00
cb926ab6c9 Merge branch 'master' into asset-engine 2016-04-09 15:44:26 +02:00
28382bad00 Merge branch 'master' into id-remap 2016-04-09 15:41:46 +02:00
5b67ec9c9f Always reset to default asset engine (i.e. regular filebrowser code) when opening a new browser.
Else we'd have the last used engine even when saving a .blend or picture, ugly!
2016-04-07 16:35:34 +02:00
7dea5c2462 Finish implementing 'reports' in asset engine (not used yet). 2016-04-07 16:18:42 +02:00
f53c4dd29e Some minor fixes/updates of AE API comments. 2016-04-07 15:50:53 +02:00
1e3d75604d Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/blender.c
2016-04-07 15:26:32 +02:00
897249b254 Merge branch 'id-remap' into asset-experiments 2016-04-07 15:25:42 +02:00
718f8fe55f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_library_query.h
	source/blender/blenkernel/intern/blender.c
	source/blender/blenkernel/intern/library_query.c
2016-04-07 15:25:23 +02:00
698b15538b Fix issue with uuid generation in Amber. 2016-04-06 18:05:02 +02:00
aec80da8f8 More or less finished shell of 'update' code.
Code only reports which datablocks/assets shall be reloaded etc. so far, actual
reloading needs id-remap code (and hence will be implemented in asset-experiment
branch later).
2016-04-06 17:38:12 +02:00
9a31359e07 Merge branch 'master' into asset-engine 2016-04-06 15:23:45 +02:00
b111e0f645 Merge branch 'master' into id-remap 2016-04-06 15:16:39 +02:00
8b81b71cf2 Merge branch 'master' into asset-engine 2016-04-04 14:45:52 +02:00
46206fd9a5 Merge branch 'master' into id-remap 2016-04-04 14:39:59 +02:00
96aa445527 Add a 'check_dir' callback to asset engines, allowing them to control current 'root dir'.
Note that this is hacked around bpyrna incapacity to handle strings as return values of functions callbacks...
2016-03-31 20:50:29 +02:00
d63895ee30 Merge branch 'master' into asset-engine 2016-03-30 21:39:09 +02:00
f820643e9f Merge branch 'master' into id-remap 2016-03-30 21:37:49 +02:00
e9d7c741ca Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-03-30 21:31:21 +02:00
826ba124b6 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-03-30 21:10:10 +02:00
0ab784332a Merge branch 'libquery-recursive' into asset-engine 2016-03-23 17:16:52 +01:00
cab4bd90c1 Merge branch 'master' into asset-engine 2016-03-23 17:16:45 +01:00
c1452617fb Merge branch 'libquery-recursive' into id-remap 2016-03-23 17:08:32 +01:00
50d2c7f8f4 Merge branch 'master' into id-remap 2016-03-23 17:08:26 +01:00
f0f46e9ef6 Rework library_query foreach looper - add optional recursivity.
This commit:
* Fixes bad handling of 'stop iteration' (by adding a status flag, so that we can actually
  stop in helper functions too, and jumping to a finalize label instead of raw return, to
  allow propper clean up).
* Adds optional recursion into 'ID tree' - callback can also decide to exclude current id_pp
  from recursion. Note that this implies 'readonly', modifying IDs while recursing is not
  something we want to support!
* Changes callback signature/expected behavior: return behavior is now handled through flags,
  and 'parent' ID of id_pp is also passed (since it may not always be root id anymore).

Used this new recursive behavior in ID preview generation as an example, would obviously be committed separately.

Reviewers: sergey, campbellbarton

Differential Revision: https://developer.blender.org/D1869
2016-03-23 13:15:41 +01:00
be5c2a5266 Finish RNA flags for asset UUIDs! 2016-03-17 14:54:29 +01:00
484f1bc226 Merge branch 'libquery-recursive' into asset-engine 2016-03-17 12:52:10 +01:00
97cb96720c Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/blender.c
2016-03-17 12:51:53 +01:00
37c4db1125 Merge branch 'libquery-recursive' into id-remap 2016-03-17 12:26:34 +01:00
cb770e58ad Merge branch 'master' into id-remap 2016-03-17 12:26:25 +01:00
09444bca5f Merge branch 'master' into libquery-recursive 2016-03-17 12:23:42 +01:00
a639446614 More WIP work towards designing Updated feature for assets/engines. 2016-03-09 20:33:38 +01:00
22f5772b44 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/creator/creator.c
2016-03-07 16:42:19 +01:00
8403577397 Merge branch 'id-remap' into asset-experiments 2016-03-07 15:37:43 +01:00
ebe52b71a5 Merge branch 'libquery-recursive' into asset-experiments 2016-03-07 15:37:35 +01:00
59aeb07895 Merge branch 'master' into asset-experiments
Conflicts:
	source/creator/creator.c
2016-03-07 15:37:22 +01:00
b0a541a76c Slightly modified way to check for assets on loadfile.
Since we now build a list of assets and their dependencies in Library datablocks, use it!
2016-03-07 15:03:28 +01:00
c93a86909c Merge branch 'libquery-recursive' into asset-engine 2016-03-06 14:57:20 +01:00
204ec489b8 Merge branch 'master' into asset-engine 2016-03-06 14:57:10 +01:00
873e90be65 Merge branch 'libquery-recursive' into id-remap 2016-03-06 14:54:06 +01:00
30b90cbb01 Merge branch 'master' into id-remap 2016-03-06 14:53:57 +01:00
f500019eac Merge branch 'master' into libquery-recursive 2016-03-06 14:51:03 +01:00
3cfea6eadc Merge branch 'libquery-recursive' into asset-engine 2016-03-04 14:35:18 +01:00
304cdfa476 Merge branch 'master' into asset-engine 2016-03-04 14:35:05 +01:00
cea847738a Merge branch 'libquery-recursive' into id-remap 2016-03-04 14:25:27 +01:00
bb3d3cc9cf Merge branch 'master' into id-remap 2016-03-04 14:25:20 +01:00
3d4ac80157 Merge branch 'master' into libquery-recursive 2016-03-04 14:24:59 +01:00
8b4997c6c7 WIP dummy code to update assets on file (re)load.
Actual code will be implemented in asset-experiment (we need id-remap code for this),
but will first try to define dummy API in this branch.
2016-03-01 16:58:31 +01:00
beff4ca725 Merge branch 'libquery-recursive' into asset-engine 2016-02-29 15:33:21 +01:00
982dd93357 Merge branch 'master' into asset-engine 2016-02-29 15:33:07 +01:00
2fa8db4ec6 Merge branch 'libquery-recursive' into id-remap 2016-02-29 15:21:54 +01:00
fa4d7deac0 Merge branch 'master' into id-remap 2016-02-29 15:21:39 +01:00
2a09cb62e2 Merge branch 'master' into libquery-recursive 2016-02-29 15:15:49 +01:00
0588ca9c08 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/intern/wm_operators.c
2016-02-25 15:07:27 +01:00
bb75900289 Merge branch 'id-remap' into asset-experiments 2016-02-25 14:55:56 +01:00
49e2a441cb Merge branch 'libquery-recursive' into asset-engine 2016-02-25 14:45:49 +01:00
ae9ae24c95 Merge branch 'libquery-recursive' into id-remap 2016-02-25 14:43:04 +01:00
d1dd9b6261 Merge branch 'master' into id-remap 2016-02-25 14:42:55 +01:00
5b5f55067b Merge branch 'master' into libquery-recursive 2016-02-25 14:21:30 +01:00
37f58ffec9 Forgot to include AnimationData into new recursive libquery foreach... 2016-02-25 14:20:58 +01:00
59a1340714 Add asset dependencies (re)build.
Is rebuilt when we link a new asset, or when we (re)load a .blend file.
Runtime data only, not saved in .blend file.
2016-02-24 20:42:58 +01:00
adfd89d9bd Merge branch 'libquery-recursive' into asset-engine 2016-02-24 10:35:00 +01:00
85959e8b4a Merge branch 'master' into asset-engine 2016-02-24 10:34:50 +01:00
c448d4422e Merge branch 'libquery-recursive' into id-remap 2016-02-24 10:34:14 +01:00
3dfd063697 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-02-24 10:26:50 +01:00
e714e1c5ef Merge branch 'master' into libquery-recursive 2016-02-24 10:18:38 +01:00
3054a8a91b Merge branch 'master' into libquery-recursive 2016-02-20 18:06:13 +01:00
dc34313dc9 Merge branch 'libquery-recursive' into asset-engine 2016-02-19 10:53:52 +01:00
afdf2a3fb2 Merge branch 'master' into asset-engine 2016-02-19 10:53:38 +01:00
aabe83d4c0 Merge branch 'libquery-recursive' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-02-19 10:50:26 +01:00
9bb32dd445 Merge branch 'master' into id-remap 2016-02-19 10:48:24 +01:00
87a385b838 Cleanup (remove some useless diff compared to master). 2016-02-19 10:47:32 +01:00
3652a0e7da Merge branch 'master' into libquery-recursive 2016-02-19 10:29:18 +01:00
b6022f1488 Fix for new libquery callback API. 2016-02-18 23:11:03 +01:00
6a951054d0 Merge branch 'libquery-recursive' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-02-18 18:10:57 +01:00
6ec0026f8d Merge branch 'libquery-recursive' into asset-engine 2016-02-18 17:56:58 +01:00
827b1457ca Rework library_query foreach looper - add optional recursivity.
This commit:
* Fixes bad handling of 'stop iteration' (by adding a status flag, so that we can actually
  stop in helper functions too, and jumping to a finalize label instead of raw return, to
  allow propper clean up).
* Adds optional recursion into 'ID tree' - callback can also decide to exclude current id_pp
  from recursion. Note that this implies 'readonly', modifying IDs while recursing is not
  something we want to support!
* Changes callback signature/expected behavior: return behavior is now handled through flags,
  and 'parent' ID of id_pp is also passed (since it may not always be root id anymore).

Used this new recursive behavior in ID preview generation as an example, still needs more testing!
2016-02-18 17:53:42 +01:00
40562d0e11 Merge branch 'master' into asset-engine 2016-02-18 17:35:12 +01:00
cd43bd241f Merge branch 'master' into asset-engine 2016-02-16 14:35:54 +01:00
a9054360c6 Merge branch 'master' into id-remap 2016-02-15 19:46:24 +01:00
66375326b4 Merge branch 'master' into asset-engine 2016-02-15 19:39:57 +01:00
3eefdc0ed7 WIP Add asset sub-data dependency info.
We need that info (knowing which non-asset IDs are used by which asset-IDs),
otherwise managing reloading, updates etc. of assets would be impossible
(or rather, would leave a mess of unused IDs behind them).
Only partially done, non-functional yet.

This commit also adds asset repository references in libraries.
2016-02-15 16:52:12 +01:00
14d11c1609 Merge branch 'asset-engine' into asset-experiments 2016-02-14 20:31:37 +01:00
6b61c25815 Merge branch 'id-remap' into asset-experiments 2016-02-14 20:31:31 +01:00
576eca8ab3 Merge branch 'master' into asset-engine 2016-02-14 20:27:48 +01:00
ad72025611 Merge branch 'master' into id-remap 2016-02-14 20:24:53 +01:00
65e357fe56 Merge branch 'asset-engine' into asset-experiments 2016-02-12 10:06:03 +01:00
46903fbccf Merge branch 'id-remap' into asset-experiments 2016-02-12 10:05:56 +01:00
ac2e25986c Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-02-12 10:05:28 +01:00
71b65b417c Merge branch 'master' into id-remap 2016-02-12 09:55:22 +01:00
30db6e0cb7 Merge branch 'master' into asset-engine 2016-02-03 10:06:45 +01:00
2ca8421987 Assets: add uuid to linked data, write and read it from file.
Note that this is only very first steps, I think we'll need to 'propagate'
uuid to all data used/linked by asset itself, otherwise most things won't get
updated/reloaded. Still have to think about this.
2016-02-02 14:14:15 +01:00
11c6fed3ee Merge branch 'master' into asset-engine 2016-02-02 14:10:27 +01:00
f3de9752fd Merge branch 'id-remap' into asset-experiments 2016-02-01 14:05:11 +01:00
1b34246af2 Merge branch 'master' into id-remap 2016-02-01 14:04:48 +01:00
dded3bb21f Merge branch 'asset-engine' into asset-experiments 2016-01-31 15:09:24 +01:00
3f63cb8843 Merge branch 'id-remap' into asset-experiments 2016-01-31 15:09:17 +01:00
d1b4471012 Merge branch 'master' into asset-engine 2016-01-31 15:05:09 +01:00
5b16d59ffc Merge branch 'master' into id-remap 2016-01-31 14:59:57 +01:00
f1fc8959db Assets: add uuid to linked data, write and read it from file.
Note that this is only very first steps, I think we'll need to 'propagate'
uuid to all data used/linked by asset itself, otherwise most things won't get
updated/reloaded. Still have to think about this.
2016-01-21 16:12:08 +01:00
955cb4a8db Merge branch 'asset-engine' into asset-experiments 2016-01-21 09:46:46 +01:00
351f74dee9 Merge branch 'id-remap' into asset-experiments 2016-01-21 09:46:39 +01:00
da81c78fc7 Merge branch 'master' into asset-engine 2016-01-21 09:45:52 +01:00
911095d372 Merge branch 'master' into id-remap
Conflicts:
	source/blender/editors/space_outliner/outliner_tools.c
2016-01-21 09:45:18 +01:00
d9a93eb3bd Merge branch 'asset-engine' into asset-experiments 2016-01-20 15:31:01 +01:00
27470754b6 Merge branch 'id-remap' into asset-experiments 2016-01-20 15:30:53 +01:00
6b1065b11c Merge branch 'master' into asset-engine 2016-01-20 15:02:49 +01:00
1705fd66d8 Merge branch 'master' into id-remap 2016-01-20 15:02:29 +01:00
28adc7d248 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-01-20 14:27:45 +01:00
f4214d1d1c Merge branch 'asset-engine' into asset-experiments 2016-01-15 16:31:13 +01:00
48f9931257 Merge branch 'id-remap' into asset-experiments 2016-01-15 16:31:06 +01:00
a0803fabfe Merge branch 'master' into asset-engine 2016-01-15 16:24:55 +01:00
6eec8eaa57 Merge branch 'master' into id-remap 2016-01-15 15:26:34 +01:00
498b712a37 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-01-14 20:32:03 +01:00
0fa187e4b5 Fix handling of asset uuid in WMLinkAppendDataItem helper struct.
We need a pointer here (reduces mem footprint, and allows to say 'we have no uuid' with a NULL value!).
2016-01-14 20:29:40 +01:00
a9284fd093 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-01-12 16:23:06 +01:00
8af7d783c7 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-01-12 16:21:34 +01:00
a7cfb5fc22 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-01-12 16:08:05 +01:00
a414edc0af Merge branch 'master' into id-remap 2016-01-12 16:01:17 +01:00
4c535c07c6 Fix & cleanup in outliner area.
Now all new entries in items' menus should behave correctly!
2016-01-07 21:47:47 +01:00
22f5a17b9c Fix some bad id->flag/tag mismatch from not-so-recent merge with master... 2016-01-07 16:14:16 +01:00
07b8b90f39 Fix assert when deleting obdata.
Issue here is again with NEVER_NULL usages: obdata (& co) would be dereferenced twice.

I'm not totally happy with this solution, ideally remap should never leave Main
in invalid state, but for now it will do...
2016-01-07 16:11:14 +01:00
5a65830830 Fix a crash when deleting a lib featuring some proxyob source... 2016-01-07 14:51:37 +01:00
f2db96fbaf Merge branch 'master' into id-remap 2016-01-07 10:28:55 +01:00
2e8297108d Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/BKE_library_query.h
	source/blender/blenkernel/intern/library_query.c
	source/blender/makesrna/intern/rna_ID.c
2016-01-06 21:40:12 +01:00
eaa892c14f Merge branch 'asset-engine' into asset-experiments 2016-01-04 20:41:15 +01:00
f3077f411d Merge branch 'id-remap' into asset-experiments 2016-01-04 20:41:08 +01:00
46e6f3b420 Merge branch 'master' into asset-engine 2016-01-04 20:35:05 +01:00
fc7f086f4b Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-01-04 20:34:31 +01:00
74393f8f15 Merge branch 'asset-engine' into asset-experiments 2016-01-04 12:10:26 +01:00
9c3e0b558c Merge branch 'id-remap' into asset-experiments 2016-01-04 12:10:19 +01:00
e49966dd96 Merge branch 'master' into asset-engine 2016-01-04 11:55:56 +01:00
e921ecabaf Merge branch 'master' into id-remap 2016-01-04 10:58:39 +01:00
e58cae1b7a Merge branch 'asset-engine' into asset-experiments 2015-12-31 12:56:53 +01:00
e28986aa8f Merge branch 'id-remap' into asset-experiments 2015-12-31 12:56:45 +01:00
19e6c23b75 Merge branch 'master' into asset-engine 2015-12-31 12:50:34 +01:00
9ae928ff9d Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/BKE_material.h
2015-12-31 12:50:08 +01:00
b40d4ba517 Merge branch 'asset-engine' into asset-experiments 2015-12-27 13:09:54 +01:00
8d3129cba2 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/windowmanager/intern/wm_operators.c
2015-12-27 13:09:42 +01:00
009ccfecb6 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/windowmanager/intern/wm_operators.c
2015-12-27 13:06:34 +01:00
f4e7fec73c Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/makesdna/DNA_ID.h
2015-12-27 12:54:57 +01:00
a6e9aba17f Merge branch 'master' into id-remap 2015-12-20 15:41:27 +01:00
b9c5da9ba8 Merge branch 'master' into id-remap
Conflicts:
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/editors/space_outliner/outliner_tools.c
2015-12-18 22:17:25 +01:00
4eaa6c4a7b Merge branch 'master' into id-remap 2015-12-18 21:23:27 +01:00
b46b921738 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
2015-12-17 19:39:05 +01:00
dab1a1dd5f Merge main remap funcs' bool parameters into a single bitflag.
Too much bools kill bools.
2015-12-17 19:32:33 +01:00
24556b3c3d More cleanup - remove unused stuff, some simplifications. 2015-12-17 14:56:15 +01:00
817fee305f Cleanup: mostly removes useless diff from master. 2015-12-17 13:21:18 +01:00
613bf6755e Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/intern/wm_operators.c
2015-12-16 22:28:31 +01:00
f2ce01f844 Merge branch 'asset-engine' into asset-experiments 2015-12-16 21:50:17 +01:00
3de18048b3 Merge branch 'master' into asset-experiments 2015-12-16 21:50:02 +01:00
d02c201814 Merge branch 'master' into asset-engine 2015-12-16 21:39:49 +01:00
c089f28504 Merge branch 'master' into id-remap 2015-12-16 21:34:04 +01:00
cddbeaeec8 Merge branch 'master' into asset-engine 2015-12-14 16:26:49 +01:00
d0b037d0ef Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/text.c
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_outliner/outliner_tools.c
2015-12-14 16:26:14 +01:00
8bbfd2729a Merge branch 'master' into id-remap 2015-12-07 17:45:41 +01:00
6dffedc75e Fix several issues with logic of core id-remap:
* We need to clear the 'user-one' flags and potential usercount for old_id.
* We need to consider ID usages inside a same lib as **never** being indirect ones.

Also re-enabled proxy checking for now (not sure why I commented it, think testing stuff or so...).
2015-12-07 17:33:35 +01:00
49b67b58aa Fix id-remap looper not 'freeing' 'use-one' id usercount. 2015-12-07 15:54:03 +01:00
67cc51d32d Merge branch 'master' into id-remap 2015-12-07 11:01:09 +01:00
574d63cf65 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_intern.h
	source/blender/editors/space_file/file_ops.c
2015-12-07 11:00:38 +01:00
05bd9572a6 Some more fixes, and make Outliner's delete available for all IDs, not only libraries! 2015-12-04 17:48:00 +01:00
56679ae31c Merge branch 'master' into id-remap 2015-12-04 17:24:43 +01:00
705a247e2e Better handling of usercount during ID deletion, also add this to ID RNA API.
Seems to work for simple cases, but deletion of complex libs from complex files
(Gooseberry ones) still generates lots of assert failures, and crashes in some cases.
2015-12-03 16:34:11 +01:00
e8b46461e6 Merge branch 'master' into id-remap 2015-12-03 14:25:05 +01:00
9584c88b6b Fix a bunch of more stuff, more correct handling of ID/Lib deletion...
Still have some usercount issues here, though things seems to start working...
2015-12-01 21:37:25 +01:00
84d25cb87a Merge branch 'master' into id-remap.
Also, changing how library delete works (not functional currently).

Conflicts:
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_outliner/outliner_ops.c
	source/blender/editors/space_outliner/outliner_tools.c
2015-12-01 17:45:22 +01:00
1da2edfb25 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2015-11-30 15:38:42 +01:00
6f90aa2016 Fix issue when reloading a lib with selected object. 2015-11-30 10:48:55 +01:00
81edad9966 Merge branch 'master' into id-remap 2015-11-28 21:45:12 +01:00
3319e460e6 Merge branch 'master' into id-remap 2015-11-28 15:00:57 +01:00
f66e14611d Attempt to fix RNA nightmare with ListBase used as Collection return type for functions.
This is hacky to make work on Linux, and seems to totally break on Windows.

So now, instead, we define a CollectionListBase (exact copy of ListBase), to be used inside RNA...

Seems to work nicely on Linux, lets see what win buildbot says.
2015-11-26 15:26:05 +01:00
7ce594b544 Merge branch 'master' into id-remap 2015-11-26 15:04:45 +01:00
a0df6ce03b Merge branch 'master' into id-remap 2015-11-26 12:42:56 +01:00
df10b4d7a8 Fix mysterious AC IDs refcount issue when reloading some gooseberry files' libs.
Turned out our libquery ID looper was ignoring constraints' 'reference' parameter in callback, grrr...
2015-11-26 12:00:50 +01:00
bfad4bba7a Add helpers to BKE_library_query to find which datablocks are using/referencing a given ID.
Also expose this in RNA. Priceless to debug ID usages...
2015-11-25 20:48:22 +01:00
d35d72893e Merge branch 'master' into id-remap 2015-11-25 16:23:22 +01:00
b47b035f57 Merge branch 'master' into id-remap 2015-11-25 15:16:26 +01:00
0c161e23d9 Merge branch 'master' into id-remap 2015-11-25 12:48:38 +01:00
a6df054b02 Merge branch 'master' into id-remap 2015-11-24 15:52:04 +01:00
7fa92ad950 Merge branch 'master' into id-remap 2015-11-24 09:50:29 +01:00
91be63e127 Merge branch 'master' into id-remap 2015-11-23 14:21:50 +01:00
387b120579 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenloader/intern/readfile.c
2015-11-19 22:39:11 +01:00
f1a7118c04 Add missing AnimData ID to foreach_ID_loop.
Atempt to fix missing action remapping, but no luck so far. :|
2015-11-12 11:50:01 +01:00
c9df632175 Merge branch 'master' into id-remap 2015-11-12 09:54:20 +01:00
11d4cbb04c Merge branch 'master' into id-remap 2015-11-11 20:22:02 +01:00
e74ce5bd86 Merge branch 'master' into id-remap 2015-11-11 19:53:14 +01:00
ab5a591f91 Do not try to reload directly non-linkable datablocks (shapekeys),
those will get reloaded by 'owner' mesh anyway.

Why, why, why are shapekeys datablocks???
2015-11-11 18:12:08 +01:00
483247d756 Fix Text usage by TextEditor (USER_REAL, not USER_ONE). 2015-11-11 17:43:26 +01:00
ded1333f3c Rework a bit IDRemap struct to separate input flags from output status, and fix
issues with unlinking ParticleSettings.

We now have the option to still decrement user count of old_id, even if we could not
replace it with NULL new_id (aka unlinking), needed to keep proper user count when
unlinking and ID from datablocks it uses, to delete it.
2015-11-11 16:52:15 +01:00
4cf00de7d4 Merge branch 'master' into id-remap 2015-11-11 16:15:53 +01:00
61bad3cfe0 Merge branch 'master' into id-remap 2015-11-11 15:06:32 +01:00
75c5f6135c Silence a bit debug prints! 2015-11-11 12:44:47 +01:00
73c8d3abcc Merge branch 'master' into id-remap 2015-11-11 12:43:51 +01:00
12292d441d Merge branch 'master' into id-remap 2015-11-11 11:49:33 +01:00
9e6cdd8e3a Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/intern/library.c

Also clears now useless 'bool is_user_one' flag from editors' ID remap callback.
2015-11-11 10:48:11 +01:00
7a62ac4127 Some minor tweaks. 2015-11-10 20:15:01 +01:00
d2913c1409 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/object.c
2015-11-10 19:59:44 +01:00
5f0299898d Hopefully fix the 'real user' nightmare.
Idea is to add two new flags, one saying 'we need to ensure a real user exists',
the other 'we had to increment user count to ensure we have a real user'.

This allows us to easily control the extra user in release/delete/remap cases,
and also fixes the infamous 'add new image to texture, open image in ImageEditor,
delete image from texture, have a zero-user red image in Image Editor' issue.

There is still much to be done here, more places where we can use those flags,
also clear them when we force usercount to zero, etc.

All this allows us to fix unsolvable issues (like Group being ensure_user'ed
in loading code, but only if they do have objects in them), and to avoid returning
ugly bool from editors' callbacks (this is still to be cleaned up in the branch too).

Bad news - this means we cannot use short ID->flag anymore (not enough flags), for now
added a new int ID->flag2 (replacing pad int), not sure how to best manage change here,
maybe for 2.8 we can totally wipe ID->flag? But this would totally break forward compat.
2015-11-10 16:56:54 +01:00
9ddc60bc10 Merge branch 'master' into id-remap 2015-11-10 16:21:37 +01:00
959e2e8cfe Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library.c
2015-11-10 14:51:42 +01:00
965d9649c4 Minor update/cleanup on usercount, from work done in master. 2015-11-10 14:47:38 +01:00
033a89957c Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/curve.c
	source/blender/blenkernel/intern/linestyle.c
	source/blender/blenkernel/intern/material.c
	source/blender/blenkernel/intern/mball.c
	source/blender/blenkernel/intern/mesh.c
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/scene.c
	source/blender/blenkernel/intern/world.c
2015-11-10 12:45:42 +01:00
e43d70a60f Merge branch 'master' into id-remap 2015-11-08 17:59:08 +01:00
7f53cbb556 Cleanup: get rid of bmain in foreach ID callback.
messing with depsgraph here is not a good idea I think... and makes things simpler!
2015-11-07 11:31:28 +01:00
8b6928b2fb Merge branch 'master' into id-remap 2015-11-07 10:54:48 +01:00
f0c6c85788 Attempt to fix the 'user_one' mess...
Seems to work (though will need much more tests), but makes code more ugly. :|
2015-11-06 18:00:09 +01:00
0c8b1a8c37 Merge branch 'master' into id-remap 2015-11-06 12:35:45 +01:00
77231eeb2f Merge branch 'master' into asset-engine 2015-11-02 19:27:48 +01:00
9521d71735 Merge branch 'master' into id-remap 2015-11-02 19:22:14 +01:00
3ad17b9405 Merge branch 'master' into asset-engine 2015-10-27 15:05:17 +01:00
6bf915e925 Merge branch 'master' into id-remap 2015-10-27 15:04:51 +01:00
c7f48be47c Merge branch 'master' into asset-engine 2015-10-17 11:47:35 +02:00
2d7bc36462 Merge branch 'missing-libs' into id-remap 2015-10-17 11:39:48 +02:00
177295f856 Merge branch 'master' into missing-libs 2015-10-17 11:34:29 +02:00
06b38491f1 Merge branch 'master' into asset-engine 2015-10-15 17:13:29 +02:00
de71f7ab8a Fix deadlock. Would be really cool if Main spinlock could be re-entrant. :| 2015-10-15 17:03:54 +02:00
6da735e81c Merge branch 'missing-libs' into id-remap 2015-10-15 16:55:43 +02:00
59ff3b5498 Merge branch 'master' into missing-libs 2015-10-15 16:12:57 +02:00
9a9796564a Fix broken ID placeholder code (from recent merges).
Here we need a bit different handling than in missing-lib branch...
2015-10-15 15:33:24 +02:00
a2aafbe656 Merge branch 'master' into asset-engine 2015-10-15 14:29:50 +02:00
d899710952 Merge branch 'missing-libs' into id-remap
Huge load of conflicts, hope it did not break too much things...
Current code build, but crashes easily :|
2015-10-14 21:24:14 +02:00
a6028f8e6b Merge branch 'master' into id-remap 2015-10-14 20:38:27 +02:00
3ffc5c9209 Moar cleanup. 2015-10-14 20:24:05 +02:00
f15741f830 Merge branch 'master' into missing-libs 2015-10-14 17:17:30 +02:00
b89530845a Cleanup. 2015-10-14 16:22:57 +02:00
4dac0afa9c Merge branch 'free-refcount-ids' into missing-libs 2015-10-13 15:48:18 +02:00
168604ecbe Revert to master - those changes are globally valid, but remain incomplete,
and total new code is being done in id-remap anyway, not worth bothering with this for now...
2015-10-13 15:44:58 +02:00
9d5cdf92b2 Merge branch 'master' into free-refcount-ids 2015-10-13 15:41:54 +02:00
67d922f61a Merge branch 'master' into free-refcount-ids 2015-10-13 14:41:33 +02:00
4ed3a36e31 Merge branch 'missing-libs' into id-remap 2015-10-12 21:01:53 +02:00
9442a43853 Merge branch 'free-refcount-ids' into id-remap 2015-10-12 21:00:47 +02:00
13faefaf6a Merge branch 'master' into id-remap 2015-10-12 21:00:02 +02:00
5f2276a553 Merge branch 'free-refcount-ids' into missing-libs 2015-10-12 20:46:28 +02:00
e95ba11ce6 Merge branch 'master' into free-refcount-ids 2015-10-12 20:31:39 +02:00
7d1e429d7c Attempt to fix the NodeTree issue.
So, idea is, since mat/tex/scene/etc. nodetrees are owned by their respective IDs
(those nodetree do not exist in Main, they are systematically freed with their ower IDs, etc.),
we should not treat them as IDs in IDlooper, but rather as mere sub-data, and hence directly
loop over the IDs of those nodetrees.

From quick check it seems to work, but this needs to be confirmed as a valid idea!
2015-10-08 20:35:47 +02:00
cb08f47121 Merge branch 'master' into id-remap 2015-10-08 15:18:08 +02:00
84c6bcac0d Merge branch 'master' into id-remap 2015-10-08 13:15:29 +02:00
74ac2beba2 Again, fix for stupid broken relinking of Objects... 2015-10-08 13:07:06 +02:00
741ceed378 Fix stupid crash... 2015-10-08 12:54:10 +02:00
f0ffe42858 Merge branch 'missing-libs' into id-remap 2015-10-08 12:45:48 +02:00
d8a171f8a7 Merge branch 'lib-link-rework-temp' into id-remap 2015-10-08 12:44:35 +02:00
d4b5b8f1bc Merge branch 'free-refcount-ids' into id-remap 2015-10-08 12:44:28 +02:00
e0c7dcba5b Merge branch 'master' into id-remap 2015-10-08 12:43:41 +02:00
6188d17623 Merge branch 'lib-link-rework-temp' into missing-libs 2015-10-08 12:13:43 +02:00
a219728914 Merge branch 'free-refcount-ids' into missing-libs 2015-10-08 12:13:28 +02:00
92bcc7dd19 Merge branch 'master' into missing-libs 2015-10-08 12:08:29 +02:00
32d9f75660 Merge branch 'master' into lib-link-rework-temp 2015-10-08 12:06:57 +02:00
249aa6c649 Merge branch 'master' into free-refcount-ids 2015-10-08 12:03:03 +02:00
f2293df9a6 Replace 'do_id_user' param of BKE_xxx_free() funcs by generic BKE_libblock_relink().
Heavily simplfies that freeing area, but again a rather risky and likely-to-break change.

At least, NodeTree is known to be a trouble-maker here, due to how it seems to be
'owned' by its mat/tex/sce/etc. Have to dig deeper here, this is still quite unclear
what exactly happens with those, and how to handle them correctly.
2015-10-07 23:15:03 +02:00
1daa502f87 Add BKE_libblock_relink(), which works as _libblock_remap(), but only over one given ID
(instead of whole Main content).

Could replace maybe things like constraint, rigisbody world, etc. '_relink' func,
but for now it's only intended to replace custom 'id releasing' code in _free()
funcs of all IDs!
2015-10-07 21:56:27 +02:00
06c6492d7d Avoid fexplicit conversion to ID * for remap parameters (use void pointers instead).
Also found another missing ID in foreach_id (sound pointer of sequences).
2015-10-07 21:10:50 +02:00
6ed0fcc187 Merge branch 'master' into id-remap 2015-10-07 20:56:54 +02:00
dca705d1c3 Huuuuuuuge commit - replace ugly scene/object/group_unlink by new generic libblock_unlink.
Previous situation was pretty much horrible, a few data types having their own coocking to
unlink, often doing more than only unlinking, often doing the same thing two times or more,
often messing with areas they should not have touched (like editors from withing BKE)...

Now we hope to have something generic, working the same way for all ID types
(we do have to add some specific handling for groups/objects/scene unfortunately,
but this remains reasonable).

Needless to say such a change is calling for troubles - I tried to follow and reproduce
as best as I could previous code, but most likely some areas will become buggy. Do not think
previous code was 100% correct anyway, things like Objects have a really big and complicated
usage of IDs...

Also, foreach_id tool has been enhanced, again for complex types like objects & co, we should
cover much better all possible IDs now (e.g. rigidbody & logic bricks were
totally missing from there).

And there is more to come...
2015-10-07 20:32:59 +02:00
ad8fa268a4 Adding game sensors/controllers/actuators to foreachid libquery.
Those were totally missing, cannot see a good reason for it...
Seems to work OK, but only very quickly tested code.
2015-10-07 10:31:36 +02:00
34c608d010 Make use of new IDWALK_REFCOUNTED flag in our ID remap code.
Think core of the system is getting pretty much OK, now we'll likely have to deal
with tons of specific cases, given how Blender is totally inconsistent when it comes to
handling user counts (e.g. spaceimage...).

Also, still have to make generic ID_unlink and ID_release_datablocks func to replace
redundant code in BKE we have currently.
2015-10-06 14:47:35 +02:00
b8e224507f Merge branch 'missing-libs' into id-remap 2015-10-06 12:25:56 +02:00
f3e2e92f5c Merge branch 'lib-link-rework-temp' into id-remap 2015-10-06 12:25:49 +02:00
64f0cd7b33 Merge branch 'free-refcount-ids' into id-remap 2015-10-06 12:25:38 +02:00
7a7b5bc6d3 Merge branch 'master' into missing-libs 2015-10-06 12:23:50 +02:00
2a3e261554 Merge branch 'master' into lib-link-rework-temp 2015-10-06 12:20:57 +02:00
913938514d Merge branch 'master' into free-refcount-ids 2015-10-06 12:19:29 +02:00
bb6da9cbea ID foreach: add support for modifiers to indicate whether given ID pointer is refcounted or not. 2015-10-05 16:30:33 +02:00
45b83f6fd5 Merge branch 'master' into id-remap 2015-10-05 16:00:33 +02:00
650efcf2d9 Update foreach ID (add a few missing IDs, and add new flag, REFCOUNTED, to indicate when a given ID pointer affects id->us count).
Still missing: at least modifiers (have to change all modifiers callbacks, yuck).
AFAIK constraints never refcount thier IDs so we can keep current code here.
2015-10-05 15:04:39 +02:00
09dcfbbe46 Merge branch 'free-refcount-ids' into id-remap 2015-10-05 13:58:49 +02:00
a33cc08a99 Fix for object freeing. 2015-10-05 13:58:21 +02:00
5327de0f40 Merge branch 'missing-libs' into id-remap 2015-10-05 12:32:19 +02:00
e0adc0b705 Merge branch 'lib-link-rework-temp' into id-remap 2015-10-05 12:32:10 +02:00
0548a1dc6f Merge branch 'free-refcount-ids' into id-remap 2015-10-05 12:32:00 +02:00
3b37921e01 Merge branch 'master' into id-remap 2015-10-05 12:31:52 +02:00
8bb7031dec Minor cleanup. 2015-10-05 12:17:51 +02:00
d7d236ce5c Merge branch 'master' into lib-link-rework-temp 2015-10-05 12:09:19 +02:00
a5d1709771 Merge branch 'master' into missing-libs 2015-10-05 12:05:50 +02:00
794a977bad Merge branch 'master' into free-refcount-ids 2015-10-05 12:05:00 +02:00
44e62635c5 Cleanup , and remove public '_release_datablocks' funcs for now.
On second thaought, will end up doing this differently in id-remap branch,
so for now just make this branch a cleanup, consistency-fixing one.
2015-10-05 10:59:38 +02:00
f00f3496a0 Merge branch 'master' into free-refcount-ids 2015-10-05 09:23:08 +02:00
d5f35c6c4e Merge branch 'free-refcount-ids' into id-remap 2015-10-03 19:22:35 +02:00
e2aab5750b Merge branch 'master' into asset-engine 2015-10-03 19:03:38 +02:00
a4c3d645ed Add note about object release func... 2015-10-01 17:44:02 +02:00
b63872cd5e Free IDs: MovieClip & Mask.
Mask freeing was doing really bad (as in, not consistent with other ID freeing code) things (unlinking, and even not freeing animdata!).
2015-10-01 17:38:04 +02:00
e734bef9d6 Free IDs: Nodes & Groups. 2015-10-01 17:13:16 +02:00
105c6a6c26 Free IDs: Action & Armature. 2015-10-01 16:57:28 +02:00
45f25c6241 Free IDs: Sound & Speaker.
Also cleanup, removed horrible `BKE_sound_delete()`!
2015-10-01 16:47:12 +02:00
1a8727fea0 Free IDs: vfont & text. 2015-10-01 16:34:09 +02:00
ad6495d14b ID free: another round of cleanup & fixes (mostly insconsitancies among IDs code)... 2015-09-30 21:59:24 +02:00
fe3c796c31 Free ID: Brush & World. 2015-09-30 21:34:57 +02:00
099eb3111e ID free: GP & particles... 2015-09-30 21:15:20 +02:00
dd266202b0 ID free: freestylelinestyle & other minor types, some cleanups (mostly use MEM_SAFE_FREE where possible). 2015-09-30 20:52:33 +02:00
1636b12d4d Merge branch 'master' into free-refcount-ids 2015-09-30 20:23:47 +02:00
9e64ad1ad5 Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-30 20:23:14 +02:00
6fb87bc545 Merge branch 'master' into missing-libs 2015-09-30 20:23:07 +02:00
919a887399 Merge branch 'master' into lib-link-rework-temp 2015-09-30 20:22:37 +02:00
921a86b51f Free IDs; lattice & camera. 2015-09-27 15:50:28 +02:00
5b02b2429a Free IDs: images & lamps. 2015-09-27 15:28:57 +02:00
2282a80697 ID freeing: materials and textures. 2015-09-27 15:12:27 +02:00
931570b480 ID free: tackle Scene (and Library, but not much to do there). 2015-09-27 14:43:49 +02:00
063aea9124 Merge branch 'asset-experiments' into asset-engine 2015-09-27 11:30:21 +02:00
b5ee93c1a3 Merge branch 'master' into asset-engine 2015-09-27 11:30:08 +02:00
e6fa18cebf Merge branch 'master' into asset-experiments 2015-09-27 11:29:39 +02:00
0b4439994f Merge branch 'missing-libs' into id-remap 2015-09-27 11:28:20 +02:00
f330da10db Merge branch 'lib-link-rework-temp' into id-remap 2015-09-27 11:28:15 +02:00
53c28a790b Merge branch 'master' into id-remap 2015-09-27 11:28:07 +02:00
ff7b6d36e3 Merge branch 'master' into free-refcount-ids 2015-09-27 11:26:46 +02:00
0b8a47d1b0 Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-27 11:24:50 +02:00
9960295484 Merge branch 'master' into missing-libs 2015-09-27 11:24:42 +02:00
113979e658 Merge branch 'master' into lib-link-rework-temp 2015-09-27 11:19:31 +02:00
c4a3c9d006 Merge branch 'free-refcount-ids' into id-remap 2015-09-24 20:49:58 +02:00
a7e540d7c8 Clean up BKE_object_free() and add BKE_object_release_datablocks().
Similar changed to those done for mesh/curve/mball.

Also, systematically nullify pointers in `_free()` functions, this does not cost
much and can help troubleshooting later.

And tag `BKE_object_unlink()` as an horrible piece of code...
2015-09-24 20:43:35 +02:00
56dae06c56 Cleanup of free/unlink/release of ID: mesh/curve/mball.
Renamed their `_unlink()` functions to `_release_datablocks()`, since they do not
unlink anything (not in the sense `BKE_object_unklink()` does, at least)!

Also, added a `const bool do_id_user` to their `_free()`, for consistency, now
relevant `_release_datablocks()` func only gets called when this option is set.
2015-09-24 19:53:38 +02:00
2cdd19de0b Merge branch 'missing-libs' into id-remap 2015-09-24 13:19:08 +02:00
96092913fb Merge branch 'lib-link-rework-temp' into id-remap 2015-09-24 13:18:59 +02:00
6e88990a4b Merge branch 'master' into id-remap 2015-09-24 13:18:51 +02:00
19f05f274a Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-24 13:15:24 +02:00
4c486c075e Merge branch 'master' into missing-libs 2015-09-24 13:14:48 +02:00
6b49cc1221 Merge branch 'master' into lib-link-rework-temp 2015-09-24 13:13:02 +02:00
4058333c49 Half-working workaround for image refcount in SpaceImage.
Our ID refcount handling is really flacky in many places, this is going to be a serious
issue for this work I'm afraid... :/
2015-09-24 13:10:20 +02:00
d5c69ffeb9 Fix bad handling of non-linkable IDs on reload.
They would be removed from bmain, but never added again nor freed - in this case
we can simply explicitely reload them in fact, non-linkable is only a user-related status...
2015-09-22 21:26:41 +02:00
8da4413ba3 Merge branch 'missing-libs' into id-remap 2015-09-22 10:03:37 +02:00
fc3822988c Merge branch 'lib-link-rework-temp' into id-remap 2015-09-22 10:03:23 +02:00
2665b3ee83 Merge branch 'master' into id-remap 2015-09-22 10:01:20 +02:00
5186e5a0c9 Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-22 10:00:28 +02:00
cf7e75ad53 Merge branch 'master' into missing-libs 2015-09-22 10:00:20 +02:00
1b75f74086 We do not require anymore linking datablocks grouped by types, makes code even simpler. 2015-09-22 09:58:59 +02:00
7a5edf3b45 Merge branch 'master' into lib-link-rework-temp 2015-09-22 09:49:24 +02:00
2c0faad6d5 Minor picky fix... 2015-09-22 09:44:14 +02:00
a508d49e33 Better handling of missing datablocks in reload case.
We need to generate a placeholder for those here... Also, enhances handling
of direct/indirect flags & co.
2015-09-21 21:57:54 +02:00
5bc6608ea5 Merge branch 'missing-libs' into id-remap 2015-09-21 21:37:49 +02:00
06eb69b892 Correct handling of name in placeholder generator (this is a name, not an idname...). 2015-09-21 21:37:05 +02:00
9b9dbb5865 Merge branch 'missing-libs' into id-remap 2015-09-21 21:27:25 +02:00
f0d843cf56 Sort placeholder in its listbase! 2015-09-21 21:25:28 +02:00
47328499cb Merge branch 'missing-libs' into id-remap 2015-09-21 21:09:21 +02:00
62fdf030c6 Change ID placeholder generator to not need an ID as reference (we only need type, name and flag here). 2015-09-21 21:08:25 +02:00
db33f64a89 Fix cases where previously indirect lib becomes direct one after some relocate... 2015-09-21 20:48:31 +02:00
3f9a6f9fea Unlock around core of linking code in reload/relocate context too, for now. 2015-09-21 20:40:46 +02:00
d990888686 Fix for recent merges. 2015-09-21 18:11:26 +02:00
37e21ea855 Merge branch 'missing-libs' into id-remap 2015-09-21 18:04:38 +02:00
1d75fe5b95 Merge branch 'lib-link-rework-temp' into id-remap 2015-09-21 18:04:17 +02:00
5a53d20efc Merge branch 'master' into id-remap 2015-09-21 18:04:08 +02:00
bcf4cc37ff Make placeholder ID creation its own function (we'll need it too in reload context...). 2015-09-21 18:02:56 +02:00
e6a84d5a48 Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-21 17:50:27 +02:00
3391a5ed2f Merge branch 'master' into missing-libs 2015-09-21 17:48:12 +02:00
e91d614e4e Merge branch 'master' into lib-link-rework-temp 2015-09-21 17:46:09 +02:00
ac797f03ef Fix broken multi-lib linking, and remove Main locking around core linking code for now.
We need to append to linklist, or our library indices would be reversed compared to lib list...

As for locking, we need reentrant one here if we want to use it. :(
2015-09-21 17:42:32 +02:00
c18849bb1b Lock bmain around core part of linking code now, this is much safer imho!
This also means we need to ensure no code called from there tries to lock again bmain
(no reentrant spinlock, arg :/).
2015-09-21 16:35:29 +02:00
8cbc05c1cd Add reload lib code, and various fixes (some to be backported to other working branches actually). 2015-09-21 16:15:21 +02:00
99008d4841 Merge branch 'lib-link-rework-temp' into id-remap 2015-09-21 15:11:17 +02:00
d02aa8c4fd Merge branch 'missing-libs' into id-remap 2015-09-21 15:11:10 +02:00
0e62a00bc4 Merge branch 'master' into id-remap 2015-09-21 15:11:00 +02:00
33b7772563 Merge branch 'master' into missing-libs 2015-09-21 15:10:39 +02:00
f7a3ead1c7 Merge branch 'master' into lib-link-rework-temp 2015-09-21 15:10:20 +02:00
c7d931b6d2 Merge branch 'lib-link-rework-temp' into id-remap 2015-09-20 15:46:38 +02:00
2e564ce19c Merge branch 'missing-libs' into id-remap 2015-09-20 15:46:30 +02:00
1d4e36a4c9 Merge branch 'master' into lib-link-rework-temp 2015-09-20 15:41:37 +02:00
bcbbee4f73 Merge branch 'master' into missing-libs 2015-09-20 14:54:33 +02:00
f5b0c53531 Relocate: remove old lib datablocks after relocate, if no ID comes from it anymore. 2015-09-19 20:03:25 +02:00
aaab73d54d Attempt to handle correctly LIB_EXTERN vs. LIB_INDIRECT ID flags.
This is far from simple, and most likely not yet fully working, but we have a base...
2015-09-19 19:56:43 +02:00
38670bc9a9 Some fixes, add basic wrapper code needed for reload feature (not yet implemented). 2015-09-19 18:26:36 +02:00
98efbb312c Merge branch 'lib-link-rework-temp' into id-remap
Also, fix some issues in previous code.
2015-09-18 22:42:05 +02:00
5ac9844083 Some naming cleanup. 2015-09-18 22:27:35 +02:00
856ef065b2 Rework a bit new liblink code, to use our beloved memarena instead of ugly pile of malloc.
Performances are not an issue at all here, but it makes code slightly simpler, avoids
a loop over ghash of libs, avoids some potential mem fragmentation, and will be easier
with lib relocate code too in future...
2015-09-18 22:22:56 +02:00
f011cdcc11 Consider proxy objects as 'linked' ones when it comes to ID remapping.
Reason is, on next fileread, proxy will be assigned with its target's data again...
Note that this may not be true about all its datablocks pointers - but proxy objects
are really brittle in current code anyway, they could use a serious work as well.
2015-09-18 21:31:56 +02:00
32ea612fcc Moar cleanup, some fixes towards sanier handling of remap & indirect data...
Proxy are still not correctly handled here though.
2015-09-18 18:09:13 +02:00
80ddd9afd9 Merge branch 'master' into asset-engine 2015-09-18 16:20:21 +02:00
5d8b0a8bcc Merge branch 'lib-link-rework-temp' into id-remap 2015-09-18 16:12:58 +02:00
33a4a4ed8f Merge branch 'missing-libs' into id-remap 2015-09-18 16:12:40 +02:00
7df45b2a49 Merge branch 'master' into id-remap 2015-09-18 16:12:31 +02:00
1ba2646706 Some cleanup & tweaks. 2015-09-18 16:11:55 +02:00
c7e14ac1f8 Merge branch 'master' into lib-link-rework-temp 2015-09-18 15:47:07 +02:00
87a3de5852 Merge branch 'master' into missing-libs 2015-09-18 15:44:10 +02:00
f9eef9a678 Some cleanup & tweaks. 2015-09-18 15:01:59 +02:00
185c216743 Relocate library: first working code.
Basics seem to be working, proving idea is valid. There is much to do yet though,
handling correctly all possible scenarii (especially those including indirect libs
used by several libraries, or libs used both directly and indirectly, etc.)
is not going to be a piece of cake...
2015-09-18 14:44:08 +02:00
4ee210857a Merge branch 'lib-link-rework-temp' into id-remap 2015-09-17 21:00:55 +02:00
49156ee77b Serious rework (again) of append/link code, to make it more generic.
Making the code in WM area more generic (will be used by relocate libs feature too in future).
And multi-append/link shall no more close & re-open lib files for each and every idcode!

Also, serious cleanup of BLO_append_... API (renamed BLO_link_..., since it links and never appends!),
main real changes there are removing the bContext arg in favor of scene/v3d (a bit more verbose, but does
not requires a valid context anymore to be able to instanciate ob/groups!). And logic behind instanciating
or not has been simplified, previous code was really obscure and sometimes redondant, from quick tests
it still works as expected.

This is temp branch for until 2.76 is over, shall be merged in master asap then.
2015-09-17 20:45:51 +02:00
0df9a4ae3d Merge branch 'master' into id-remap 2015-09-17 19:12:01 +02:00
18cddb58c4 Merge branch 'master' into id-remap 2015-09-17 13:54:36 +02:00
3cce86e4d3 Merge branch 'master' into id-remap 2015-09-16 17:46:32 +02:00
ab9126b7b5 Move most of (currently NoP) relocate code to WM area. 2015-09-16 15:28:19 +02:00
2622e4b208 More work towards relocate operator for libraries (still pretty much empty shell).
Note that this op will have to be moved to WM area in fact, it's way too generic for Outliner only...
and we need to re-use most of append/link operator code!
2015-09-15 22:14:35 +02:00
258725cf49 Merge branch 'master' into id-remap 2015-09-15 14:24:44 +02:00
962751c1a0 Outliner: add a dedicated ID_LI operation handler, and add skeletton for 'relocate' tool... 2015-09-14 22:30:48 +02:00
2f43d7a099 Merge branch 'master' into id-remap 2015-09-14 15:55:15 +02:00
648ce6a080 Some minor fixes and refactor of core id-remap code. Will also allow us to call it when bmain is already locked higher in code. 2015-09-13 15:41:13 +02:00
b428df5408 Merge branch 'missing-libs' into id-remap 2015-09-13 15:19:53 +02:00
6fda73fe0e Merge branch 'master' into missing-libs 2015-09-13 15:19:31 +02:00
68096bb8e8 Merge branch 'missing-libs' into id-remap 2015-09-13 15:19:11 +02:00
8f496e7ebf Add remaining missing id_remap editors' callbacks.
This is far from being done though... :/
2015-09-12 17:15:06 +02:00
8ae125e946 Merge branch 'master' into id-remap 2015-09-12 15:40:35 +02:00
5c029b1628 Add support id-remap for 3Dview bgpic and Image space.
SpaceImage seems to have a weird handling of image ID user count :/
2015-09-11 17:22:40 +02:00
15f08697e7 Rework our 'space id remapping' code by adding a new 'id_remap' callback to SpaceType, and add one for View3D.
Think it's much cleaner this way.

View3D new id_remap only handles camera/ob_center pointers for now, images will need some more work I think...
2015-09-11 16:27:42 +02:00
efb2d755c1 Merge branch 'master' into id-remap 2015-09-11 15:53:37 +02:00
07136e6176 Merge branch 'master' into id-remap 2015-09-10 22:47:25 +02:00
0abb0ee156 Merge branch 'master' into missing-libs 2015-09-10 22:39:39 +02:00
1fd6979bdb Some minor UI updates... 2015-09-10 14:35:49 +02:00
13d9d33158 Merge branch 'asset-experiments' into asset-engine 2015-09-10 14:14:25 +02:00
93fb699e20 Merge branch 'master' into asset-experiments 2015-09-10 14:13:57 +02:00
6d2519250a Add some (mostly commented) debug prints... 2015-09-10 14:13:18 +02:00
06f937c9b1 Fix nasty hidden RNA/bool related bug.
**NEVER** pass a boolean as address (pointer) to a RNA property function - it will read (or write) it as an integer!
2015-09-10 14:08:36 +02:00
8094de89ce Fix filelist_file_create_entry() adding the generated entry twice to the cached list in AE case. 2015-09-10 13:01:37 +02:00
b4861a9ec1 Merge branch 'asset-experiments' into asset-engine 2015-09-09 21:45:37 +02:00
283da2a596 Merge branch 'master' into asset-experiments 2015-09-09 21:38:07 +02:00
2d861d68a7 Merge branch 'asset-experiments' into asset-engine 2015-09-09 17:25:22 +02:00
ec99859c44 Merge branch 'master' into asset-experiments 2015-09-09 17:20:14 +02:00
a77cd3e953 Fix 3DView and others not updating after ID remapping.
Notifiers usage could really use a good cleanup imho...
2015-09-03 17:56:03 +02:00
3f22fbf32b Merge branch 'master' into id-remap 2015-09-03 16:16:50 +02:00
65a108cf35 Merge branch 'master' into missing-libs 2015-09-03 16:16:26 +02:00
62ff31971a Merge branch 'master' into id-remap 2015-08-30 12:06:02 +02:00
75db37e80f Merge branch 'master' into missing-libs 2015-08-30 11:55:38 +02:00
baa1513603 Merge branch 'asset-experiments' into asset-engine 2015-08-30 11:44:35 +02:00
2420f8a32e Merge branch 'master' into asset-experiments 2015-08-30 11:40:49 +02:00
e8af25479d Merge branch 'asset-experiments' into asset-engine 2015-08-30 11:29:03 +02:00
aa4896317d Merge branch 'master' into id-remap 2015-08-23 18:45:13 +02:00
031aab8d0c Some minor tweaks & cleanup. 2015-08-23 16:34:19 +02:00
317474e231 Merge branch 'master' into id-remap 2015-08-23 15:08:17 +02:00
b9110048f9 Merge branch 'master' into id-remap 2015-08-22 15:38:58 +02:00
6711e9d15f Merge branch 'master' into missing-libs 2015-08-22 15:11:32 +02:00
173ffb140a Minor tweak: adjust icon size to thumbnail size.
Avoids too big 'data type' icon in tiny display...
2015-08-19 22:38:27 +02:00
211ef292ba Merge branch 'master' into asset-experiments 2015-08-19 21:54:20 +02:00
f5140d4e82 Merge branch 'asset-experiments' into asset-engine 2015-08-18 14:51:52 +02:00
03829f7c48 Merge branch 'master' into asset-experiments 2015-08-18 14:35:56 +02:00
9fc2d1e35b Merge branch 'master' into asset-experiments 2015-08-18 13:24:09 +02:00
f5f06db832 Merge branch 'master' into asset-experiments 2015-08-18 12:43:35 +02:00
3a21279bc8 Merge branch 'master' into asset-experiments 2015-08-18 12:24:06 +02:00
0baa1469d0 Merge branch 'master' into asset-experiments 2015-08-11 12:01:12 +02:00
dc659c05d4 Merge branch 'master' into asset-experiments 2015-08-10 18:04:13 +02:00
47e73e6b72 Merge branch 'master' into asset-experiments 2015-08-10 17:47:00 +02:00
67282959af Fix bug in preview generator. 2015-08-10 17:21:11 +02:00
979d22b361 Some cleanup re master... 2015-08-10 15:52:18 +02:00
53312d1fac Merge branch 'master' into asset-experiments 2015-08-10 15:44:20 +02:00
a2a3e40cf1 Merge branch 'master' into asset-experiments 2015-08-10 15:10:16 +02:00
2aab8c7a95 Some ultimate cleanups. 2015-08-10 14:36:39 +02:00
14786d653a Merge branch 'master' into asset-experiments 2015-08-10 14:18:23 +02:00
386efee483 Minor tweak - adapt a bit number of preview workers to number of available physical threads! 2015-08-09 18:08:33 +02:00
9ebdab0e17 Merge branch 'master' into asset-experiments 2015-08-09 16:09:23 +02:00
6b34b4f066 Merge branch 'master' into id-remap 2015-08-02 18:02:16 +02:00
d2bdc66143 Merge branch 'master' into missing-libs 2015-08-02 17:50:29 +02:00
231237f1b5 Merge branch 'asset-experiments' into asset-engine 2015-08-02 17:17:57 +02:00
37e679772e Merge branch 'master' into asset-experiments 2015-08-02 17:13:42 +02:00
574a7da03e Fix several issues, add a quick and dirty new action in Outliner to remap IDs.
We have to take care of Object->data aside from main foreach loop, since we can
only replace that pointer if object is **not** in Edit mode!

Also, added a "Remap" action to ID context menu of outliner. This is **very far**
from nice and pretty code/feature, but it allows to quickly test the code.

Only did very quick tests with meshes so far...
2015-07-21 22:42:06 +02:00
1ebdfb4d45 Fix some dummy mistake, add simple RNA callback to 'remap' IDs.
Also, added Object.data to BKE_library_foreach_ID_link(), wonder if there was a good reason
for this to not be here???
2015-07-21 22:42:06 +02:00
df50b8cabf Add main 'ID remap' function.
Theoretical code, compiles, but needs to be tested!
2015-07-21 22:42:06 +02:00
f2d6e85212 ID remapping: first step - modify some editors callback to not only support ID freeing, but also ID remapping.
This seems to be OK, but will obviously need much more testing - and is useless as-is, we need
the big ID remapping code itself still.

Also, Nodetrees' remapping of Scene IDs is still TODO, not sure yet how to do this.
2015-07-21 22:42:06 +02:00
313fabd310 Merge branch 'master' into missing-libs 2015-07-21 08:07:42 +02:00
93563c5522 Merge branch 'asset-experiments' into asset-engine 2015-07-21 08:01:47 +02:00
c1589b71c5 Merge branch 'master' into asset-experiments 2015-07-21 07:55:51 +02:00
aee44d5070 Merge branch 'master' into missing-libs 2015-07-17 21:13:03 +02:00
09787f03b7 Merge branch 'master' into missing-libs 2015-07-16 19:53:31 +02:00
4e2f5a6461 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-07-16 19:46:35 +02:00
f37adc4312 Merge branch 'master' into asset-experiments 2015-07-16 19:45:22 +02:00
2bfd60e54f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-07-16 16:53:55 +02:00
610a04ab5d Fix rebase mess :/ 2015-07-15 20:38:51 +02:00
222a199f99 Add outliner's visualization for broken libs, and also tag lib ID itself as missing. 2015-07-15 20:36:22 +02:00
82d166df72 Add remaning 'init' callbacks for needed ID types.
Note all this remains a bit theoretical, some cases (ID types) are a bit delicate to handle here.7
Time and tests will say if it's OK as is.
2015-07-15 20:36:22 +02:00
83dd16a6d6 Add some checks in BKE_xxx_init() that data is really NULLified.
Needed, since trying to (re)init data already set could lead to many issues,
and handling this is not in the scope of this function.

Note that definition of BLI_memcmp_null stuff is rather bad currently, no good idea where to place this. :|
2015-07-15 20:36:22 +02:00
4181f35014 Handling missing libs: changed idea, now adding 'real' empty data.
Just having 'NULL' data as placeholder is not really possible, too much places
to check against that.

WIP commit, still much to be done!

See T43351 for details.

Differential Revision: https://developer.blender.org/D1394
2015-07-15 20:36:22 +02:00
266f0d3e77 Very first step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.

That way, you can work on your file, save it, and find again your missing data once
lib becomes available again.

Plans are also to be able to locate missing libs and reload them at runtime.

To support all that, we must be able to make Blender survive those missing data
(i.e. empty datablocks) all over the place. This commit contains some early work
in that direction, but this will need much much more work!
2015-07-15 20:36:21 +02:00
9a2ae72156 Icons: Add new 'library_data_broken' one. 2015-07-15 20:36:21 +02:00
37a6a92f76 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-07-11 23:00:56 +02:00
5a16f29700 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
2015-07-11 22:51:30 +02:00
80acaa3009 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2015-07-04 13:16:30 +02:00
05017bc9a3 Merge branch 'master' into asset-experiments 2015-07-04 12:59:37 +02:00
047525019a Expose fewest more generic ID filtering options.
Full precise filtering remains possible in new 'Advanced filter' panel.
2015-07-04 12:56:09 +02:00
6cb2f6e870 UI-fix (bad 'recusion level' value in RNA enum, 1 is only valid in library listing case). 2015-07-04 01:48:43 +02:00
9f176db5ea Merge branch 'master' into asset-experiments 2015-07-04 01:42:37 +02:00
c2049e740e Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/BLI_ghash.h
2015-07-02 21:22:07 +02:00
665ac71aee Add API to IMB_thumb to enable thread safety.
Indeed, though rather unlucky, we may end up handling same source file from
different preview threads, which could lead to conflicts and bugs.

So idea is to add a simple way of locking a given source file path, since
thumb handling of different paths shall never conflict.

Note that this adds some 'generic' stuff to GHash and Threads area, that are to
be committed separately of course.
2015-07-02 13:31:38 +02:00
dd15ef2528 Previews: do not keep preview task and timer running continuously in 'Preview' mode.
The task was not so annoying (workers are just sleeping anyway), but having the timer
always checking for updates was not so nice. This remains quite minor optimization probably...

So now, we do not start anymore preview task when enabling previews. This is deferred
to the moment we really need it (i.e. when we cache block of entries currently visible).
Preview timer is started at the same time.

Further more, when preview task has been inactive for about one second (i.e. all
queued previews have been handled, and no new one have been queued), we free it
(switching to some kind of 'standby' mode).

This also allows to avoid stoping/restarting preview tasks on each redraw when user is scrolling.
2015-07-02 12:01:09 +02:00
effabf0ce7 Remove queing TODO previews when starting preview task, this is already handled
(in a better way) by filelist_file_cache_block().
2015-07-01 17:43:49 +02:00
a1c8d693a8 Fix windows bug with scons builds.
Classical bool vs char value mismatch... Here it was leading to a constant re-filtering
of the list, which invalidates cached previews.

Strange thing is, it would look as if Windows CMake builds are using 'real' bool,
while scons ones are using fake char-based one?
2015-07-01 16:40:07 +02:00
2cac2ec784 Merge branch 'master' into asset-experiments 2015-07-01 16:28:57 +02:00
23c81d8990 Merge branch 'master' into asset-experiments 2015-06-30 19:17:34 +02:00
633e3d2545 Merge branch 'master' into asset-experiments 2015-06-29 14:55:38 +02:00
cd980e85d7 Merge branch 'master' into asset-experiments 2015-06-28 20:22:14 +02:00
857d5f3580 Be much smarter with file size display... 2015-06-28 00:16:14 +02:00
b5a65fd7be Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
2015-06-27 23:42:06 +02:00
9379b7f968 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/editors/space_file/filelist.c
2015-06-27 23:26:32 +02:00
fb43c07681 Merge branch 'master' into asset-experiments 2015-06-27 23:15:58 +02:00
6c8e34e59b Filebrowser internal listing & UUIDs: simpler & safer UUIDs generation.
Instead of computing MD5sum of paths, just use incremental UUIDs!
There meaning and lifetime for internal listing is very limited anyway,
they shall only be unique for a given listing.

Note about using atomic op here: did it because it's nice use case,
not sure it's worth adding atomic stuff to /editors area though?
2015-06-19 14:31:00 +02:00
011061ab5e Remove copying of preview data for objects and groups datablocks.
Those get temporarily duplicated by renderers (Cycles, Freestyle),
not nice to have useless memory usage here.
2015-06-19 13:04:04 +02:00
7b84fa5927 Various minor cleanup & fixes from review. 2015-06-19 13:01:39 +02:00
6f236221c6 Merge branch 'master' into asset-experiments 2015-06-19 12:33:18 +02:00
c3492716ee Merge branch 'master' into asset-experiments 2015-06-19 11:44:23 +02:00
ae569a4e76 Merge branch 'master' into asset-experiments 2015-06-18 11:53:14 +02:00
924ff970cc Merge branch 'asset-experiments' into asset-engine 2015-06-17 14:28:53 +02:00
d6b5f82bae Merge branch 'master' into asset-experiments 2015-06-17 14:28:24 +02:00
1e1cc1409b Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_file/space_file.c
2015-06-16 18:11:21 +02:00
9a7d5130ec Cleanup: get rid of ugly bool in structs, replaced by bitflags. 2015-06-16 17:32:46 +02:00
649b09debb Make selection & co really working even during listing process.
This commit replaces `filelist_numfiles()` by `filelist_files_ensure()`. The later
also returns number of visible files (i.e. filtered ones), but also ensures filelist
is filetered and sorted.

Otherwise, during listing process, operators could be executed between an update of the listing job,
and the refresh from the file space - i.e. at a time filelist is virtually empty (from filebrowser PoV).

Also, got rid of 'need_refresh', this ended up being unused...
2015-06-16 16:59:29 +02:00
f616871e62 Selection/UUIDs handling enhancements:
* Do not systematically clear selection_state's uuids GHash when updating filelist
  during listing process - uuids used here should remain valid.
  Allows to not lose selections during listing background job!
* Use new BLI_ghash_lookup_p to handle selection state setting, symbolic optimization but...
2015-06-16 16:19:06 +02:00
3d9da00815 Make imbuf_thumb for .blend a bit less stupid & noisy regarding missing previews.
A file which does not have *any* preview is perfectly valid, error is only when there
are some previews, but not the same number as actual datablocks...
2015-06-16 15:45:52 +02:00
bfb6155466 Fix some fileops operators that could try to get out-of-bound indices.
Also, some minor reordering in full-block-recaching, currently could not create
issues but better be safe & logic here.
2015-06-16 15:40:58 +02:00
edb87ecd75 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-06-16 14:24:05 +02:00
bc43854651 Merge branch 'asset-experiments' into asset-engine 2015-06-12 10:43:14 +02:00
5fbd8997c2 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
2015-06-12 10:42:44 +02:00
27ed6ef95c Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-06-11 20:17:30 +02:00
c3866a0fe1 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-06-11 20:07:29 +02:00
04f7493588 Fix/adapt new 'keyboard select' code to changes from branch. 2015-06-11 19:58:23 +02:00
a4965036a7 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/space_file.c

NOTE: Tagged some parts in new code to be fixed, rather do that in a separate commit.
      This means this commit is broken and won't compile.
2015-06-11 18:16:43 +02:00
22abc19145 Merge branch 'asset-experiments' into asset-engine 2015-06-11 16:35:53 +02:00
b5635fb70d Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/idcode.c
2015-06-11 16:31:30 +02:00
7793df2491 Merge branch 'asset-experiments' into asset-engine 2015-06-03 17:11:27 +02:00
edf50e3a5d Fix error when batch-rendering preview of scene with no world. 2015-06-03 17:07:48 +02:00
7cc52cc8dd Fix bad ID preview clearing in RNA API.
Logic here was piece of crap... sigh.
2015-06-03 16:55:35 +02:00
44adb244bc Merge branch 'master' into asset-experiments 2015-06-03 16:48:17 +02:00
e1a3c1d4e7 Arg, missed those in previous 'review' commit. 2015-06-03 16:29:03 +02:00
aab3ec8624 Merge branch 'asset-experiments' into asset-engine 2015-06-03 15:49:33 +02:00
89db98c0be Address new review points. 2015-06-03 15:47:43 +02:00
221142275c Merge branch 'master' into asset-experiments 2015-06-03 14:15:53 +02:00
c436a00372 Fix broken behavior e.g. for 'save as' operator...
We need to set filename/filepath from sfile->params in case operator does not support multi-files!
2015-06-02 15:34:10 +02:00
f2f4c4c93d WIP more work towards inclusion of asset engine/asset uuids in linking process. 2015-06-02 14:04:06 +02:00
d4e5cad70e Merge branch 'asset-experiments' into asset-engine 2015-06-02 10:20:13 +02:00
0f285b566d Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/imbuf/intern/thumbs.c
2015-06-02 10:19:50 +02:00
b57abacd8c Merge branch 'asset-experiments' into asset-engine 2015-05-29 10:56:19 +02:00
7f59c846a7 Add comment about why we need to store fileselection state outside of filelist items now. 2015-05-29 10:38:55 +02:00
21e498acdd Tweaks and fixes in py part (preview handling). 2015-05-29 10:32:31 +02:00
5301ea7b96 Address most points from first reviewing pass.
Nothing new here, just some cleanup and refactor.
2015-05-29 10:12:46 +02:00
2a5d07773e Merge branch 'master' into asset-experiments 2015-05-29 09:30:08 +02:00
ab049a335d More WIP towards integrating AE/assets_uuids in append/link process... 2015-05-28 19:51:25 +02:00
74aeb8ef11 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2015-05-28 14:46:10 +02:00
99a3e09088 Refactor code in multi-append/link operator.
Avoid writing a big chunck of code doing nearly the same thing twice...
2015-05-28 14:42:12 +02:00
b87e275429 WIP more AE/uuid in append/link operator. 2015-05-28 10:37:01 +02:00
a4c5aa208d Merge branch 'asset-experiments' into asset-engine 2015-05-27 15:47:19 +02:00
bae3805edb Merge branch 'master' into asset-experiments 2015-05-27 15:44:38 +02:00
9ab309901d Add asset engine version to uuids list struct. 2015-05-26 21:18:28 +02:00
bd0e78bb23 Add needed asset-related data to Library and ID structs. 2015-05-26 20:47:43 +02:00
f34c098f0c Add 'bl_version' to asset engine type, needed to support asset engine in file read/write! 2015-05-26 17:21:10 +02:00
23beab242a Fix asset engine resetting on every resize!
Only reset AE type to default in `file_init()` if current type is invalid!

Also, better handling of getting default AE type now.
2015-05-26 17:02:45 +02:00
99cf8b2188 Merge branch 'asset-experiments' into asset-engine 2015-05-26 16:32:36 +02:00
180958cb2c Merge branch 'master' into asset-experiments 2015-05-26 15:50:19 +02:00
f6dc0573f8 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/makesrna/intern/rna_space.c
2015-05-25 15:58:24 +02:00
ac516fddb2 Merge branch 'master' into asset-experiments 2015-05-25 15:38:14 +02:00
a5c580c9e4 Some tweaking to UI, try to make filebrowser header a bit more compact... 2015-05-21 15:20:53 +02:00
b5db0c903c Merge branch 'asset-experiments' into asset-engine 2015-05-21 14:37:02 +02:00
59a8cbc49b Merge branch 'master' into asset-experiments 2015-05-21 14:36:41 +02:00
0a52a358fa Better handling of tags in Amber.
Also adds some 'state' flags to AssetEngine, so that custom AE's setting changes
can be notified to filebrowser, as default internal ones are.

For now, we only have 'dirty filtering' and 'dirty sorting'.
2015-05-21 14:15:46 +02:00
223e098ca1 Some minor cleanup in Amber code. 2015-05-20 10:28:46 +02:00
7f7f296475 Merge branch 'asset-experiments' into asset-engine 2015-05-20 09:39:06 +02:00
a9efb6a5ae Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-05-20 09:19:23 +02:00
b5c72b15ed Merge branch 'master' into asset-experiments 2015-05-13 17:14:46 +02:00
85499bb5e8 Fix crash in append/link on windows (sigh). 2015-05-13 17:06:44 +02:00
952ef0fedf Fix newly created dir not going into rename state anymore.
Due to async dir listing...
2015-05-13 14:07:49 +02:00
044398c786 Merge branch 'master' into asset-experiments 2015-05-13 13:58:39 +02:00
b0f1a9e27f Merge branch 'master' into asset-experiments 2015-05-13 12:52:11 +02:00
3bef09f672 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/blenkernel/CMakeLists.txt
2015-05-12 19:39:44 +02:00
9706ec852d Restore drag'n'drop from filebrowser.
We need to store non-static data here, so had to tweak drag and drop button code...
2015-05-12 19:21:13 +02:00
ade786b30c Some cleanup and reducing diff from master. 2015-05-12 17:00:12 +02:00
63d52d7bb1 Merge branch 'master' into asset-experiments 2015-05-12 15:33:32 +02:00
113c17ea76 Merge branch 'asset-experiments' into asset-engine 2015-05-11 17:25:43 +02:00
9346891c3c Merge branch 'master' into asset-experiments 2015-05-11 17:24:24 +02:00
acd076a9f3 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_icons.h
	source/blender/blenkernel/intern/icons.c
	source/blender/editors/include/UI_interface_icons.h
	source/blender/editors/interface/interface_icons.c
	source/blender/makesrna/intern/rna_ID.c
2015-05-11 17:09:53 +02:00
51a3024f33 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-05-11 09:46:17 +02:00
bf583c8c95 Merge branch 'master' into asset-experiments 2015-05-11 09:36:20 +02:00
f2ceb38ce8 Add variable sliding window for cached filebrowser items.
With big screens and tiny drawing, we can show much more than 1k items at once...
Also allows to reduce number of cached items in case we show few things big!
2015-05-10 17:15:59 +02:00
47a7246a5c Merge branch 'master' into asset-experiments 2015-05-10 15:26:26 +02:00
dd2034623c Merge branch 'asset-experiments' into asset-engine 2015-05-09 16:43:22 +02:00
b1ce5e6772 Fix bad behavior in case of 'refresh' while still listing.
Mismatch in 'owner' of job, not giving right one to stoping helper, sigh.

Note that this was also affecting any 'interrupting' task (like changing level of flat listing...).
2015-05-09 16:42:13 +02:00
c77f3b57bc Fix flickering of previews during listing process.
We cannot keep 'stable' list of items during listing process (each time new
entries are added, we have to filter and sort the whole lot again, which
means rebuilding 'draw' data from scratch - previews included).

Just wait until our filelist is complete to generate/use previews.
2015-05-09 16:06:30 +02:00
abed546672 Fix crash due to some missing final jop update in some rare cases. 2015-05-09 16:00:07 +02:00
71a061bc1a Merge branch 'master' into asset-experiments 2015-05-09 14:29:46 +02:00
6cae0ccded Merge branch 'asset-experiments' into asset-engine 2015-05-07 19:31:48 +02:00
4767de15b8 Fix win build... 2015-05-07 19:30:56 +02:00
97798c6125 Merge branch 'master' into asset-experiments 2015-05-07 19:17:45 +02:00
9d9ee6699a Get rid of nice 'static' in array args of functions, MSVC does not like them. :( 2015-05-06 19:59:02 +02:00
b943f6fd28 Merge branch 'master' into asset-experiments 2015-05-06 18:13:20 +02:00
3745062bf9 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2015-05-05 17:23:32 +02:00
0e5789c43c Some cleanup and addressing TODOs in ID preview generation module. 2015-05-05 17:18:49 +02:00
ef484c7a59 Expose preview/icon render sizes in bpy.app 2015-05-05 17:18:30 +02:00
d0799901f7 Merge branch 'master' into asset-experiments 2015-05-05 14:26:58 +02:00
fc5adb63a0 Merge branch 'master' into asset-experiments 2015-05-04 21:14:47 +02:00
85406569e1 FileBrowser: enhance handling of most compact drawing by also reducing size of static strings like file size. 2015-05-04 17:00:45 +02:00
54e753f85e Fix size of files not showing in default Filebrowser mode. 2015-05-04 16:23:54 +02:00
0bdf85afde FileBrowser: make (fixed) column size user-configurable (re[ab]using new thumbnail size). 2015-05-04 16:15:12 +02:00
1ca9c549f9 Merge branch 'asset-experiments' into asset-engine 2015-05-04 15:55:56 +02:00
056f11ec8d Merge branch 'master' into asset-engine 2015-05-04 15:55:45 +02:00
bc8ad4c739 Cleanup/reduce needless diff with master. 2015-05-04 15:54:48 +02:00
870c2040bc Merge branch 'master' into asset-experiments 2015-05-04 14:59:13 +02:00
2f477065a0 Merge branch 'asset-experiments' into asset-engine 2015-05-02 17:05:17 +02:00
cc02a0a7e5 Merge branch 'master' into asset-experiments 2015-05-02 17:03:45 +02:00
e0c275e239 Merge branch 'master' into asset-engine 2015-05-02 17:03:22 +02:00
92123e578a Fix T44586: Viet language problem for Blender Interface
We were missing many of the complex diacritics combinations in latin extended additional code block...

Alawyas a pleasure to edit this font... :|
2015-05-02 16:49:12 +02:00
56b3d8d273 Fix stupid crash. 2015-05-02 15:25:35 +02:00
40dd7cbe21 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2015-05-02 15:10:31 +02:00
756bb6b404 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
	source/blender/makesrna/intern/rna_space.c
2015-05-02 15:01:34 +02:00
839cc7b2a1 Merge branch 'asset-experiments' into asset-engine 2015-04-27 18:25:48 +02:00
59d5f5c253 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/object.c
	source/blender/windowmanager/intern/wm_operators.c
2015-04-27 18:21:59 +02:00
c31c62c7ec Merge branch 'asset-experiments' into asset-engine 2015-04-18 12:20:18 +02:00
863f19431d Merge branch 'master' into asset-experiments 2015-04-18 12:05:23 +02:00
45164ac6e3 WIP work to pass asset data to operator.
Asset engine ID, asset/variant/revision uuids, root path...
First goal is link code!
2015-04-16 18:28:59 +02:00
eca9cb2adb Merge branch 'asset-experiments' into asset-engine 2015-04-16 14:55:58 +02:00
31e89b1fcf Merge branch 'master' into asset-experiments 2015-04-16 14:49:04 +02:00
ba20e06227 Merge branch 'asset-experiments' into asset-engine 2015-04-16 10:46:37 +02:00
b3c8192715 Merge branch 'master' into asset-experiments 2015-04-16 10:45:24 +02:00
00e451015b Merge branch 'asset-experiments' into asset-engine 2015-04-15 19:21:11 +02:00
399b2927df Merge branch 'master' into asset-experiments 2015-04-15 19:18:57 +02:00
a9d5eddc52 Rename RNA's 'IDPreview' to 'Preview' - there is no reason to keep that for IDs only,
we likely will want to use it in other cases...
2015-04-15 19:17:34 +02:00
eb9784dea2 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-15 17:48:26 +02:00
b239c249ac FileBrowser: only generate size/date/time strings when needed!
Also, cleanup remaining cruft from modes/owner stuff.
2015-04-15 17:43:05 +02:00
ab9f937bd8 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/makesrna/intern/rna_space.c
2015-04-15 16:45:35 +02:00
8124e69a91 Backport some changes from asset-engine branch:
* uuids as int[4] instead of char[16];
* move use_library_browsing to params instead of spacefile.
2015-04-15 16:40:52 +02:00
5ffbf49439 AssetEngine: Various fixes and new features:
* Let asset engine draw most of header bar itself!
* Pass whole FileSelectParams to AE's sort_filter function.
* Move 'use_library_browsing' to params level (this way AE's sort_filter can be ware of it too).

Amber:
* Now supports real basic sorting/filtering modes
* Also basic support of tags (needs a way to refresh though, currently).
2015-04-15 16:26:33 +02:00
fde14db489 Switch definitively to int32[4] for uuid's, mixing mixing it with char[16] is confusing at least.
This is only on human-level anyway... And endianess should not be an issue
either, hopefully, that way!
2015-04-15 12:50:04 +02:00
c4a1d5143e Merge branch 'asset-experiments' into asset-engine 2015-04-15 12:23:00 +02:00
163ad29b58 Merge branch 'master' into asset-experiments 2015-04-15 12:20:32 +02:00
52db10355b WIP better/fixed support of uuid's in asset engines.
Still not working as expected it seems... Not having a real bytes type in RNA is a real PITA. :/
2015-04-14 22:49:28 +02:00
68bab334e0 More fixes...
Amber engine seems to be running nice again in new system, pfew!
2015-04-14 16:58:38 +02:00
18f18ec8b3 Fix issue in final selection in some cases. 2015-04-14 16:23:26 +02:00
80c0f3da22 Merge branch 'asset-experiments' into asset-engine 2015-04-14 16:10:00 +02:00
63318a2a4c Merge branch 'master' into asset-experiments 2015-04-14 16:07:04 +02:00
476a1b9eff Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-13 22:13:16 +02:00
2842949e13 Add uuids ghash to filelist's cache. 2015-04-13 21:54:37 +02:00
b3ad658b45 Merge branch 'master' into asset-experiments 2015-04-13 21:19:53 +02:00
449e1d8074 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c

... And fixes for code specific to that branch.
2015-04-13 20:22:27 +02:00
11ef8d9797 Small refactor (will allow better factorization with AE listing code). 2015-04-13 17:40:32 +02:00
2feeea8328 Caching of FileDirEntry: simplify things, fix some more mem bugs. 2015-04-13 17:36:11 +02:00
026f967dff Various fixes with asset engine and new code...
Still not working completely, and need small rework in asset-experiments first.
2015-04-13 17:27:06 +02:00
6adc839e40 Fix stupid freeing issues. 2015-04-13 16:20:24 +02:00
e39242c4ce Merge branch 'asset-experiments' into asset-engine 2015-04-13 15:55:30 +02:00
0e3a9530da Merge branch 'master' into asset-experiments 2015-04-13 15:53:37 +02:00
23bba70da5 Merge branch 'asset-experiments' into asset-engine 2015-04-10 23:43:20 +02:00
bf19bf0110 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
	source/blender/imbuf/IMB_thumbs.h
	source/blender/imbuf/intern/thumbs.c
2015-04-10 23:42:43 +02:00
eb8b2413de Merge branch 'master' into asset-experiments 2015-04-10 14:27:18 +02:00
336c7f9ba5 AssetEngine WIP support of new filelisting behavior in filebrowser...
Nearly working, still have some mem issues to fix.
2015-04-09 20:35:36 +02:00
96f060d32d Merge branch 'asset-experiments' into asset-engine 2015-04-09 12:05:47 +02:00
126e1aa60a Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
	source/blender/editors/space_file/filelist.c
2015-04-09 12:05:09 +02:00
bfb977534f Merge branch 'asset-experiments' into asset-engine 2015-04-08 14:38:44 +02:00
57786fda42 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-08 14:38:18 +02:00
9763ba8f72 Merge branch 'asset-experiments' into asset-engine 2015-04-08 14:21:32 +02:00
990598e60c Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/filelist.c
	source/blender/imbuf/IMB_thumbs.h
	source/blender/imbuf/intern/thumbs.c
	source/blender/imbuf/intern/thumbs_blend.c
2015-04-08 14:21:00 +02:00
485a9abf29 Merge branch 'asset-experiments' into asset-engine 2015-04-07 15:40:34 +02:00
d9c690b559 Misc cleanup, fix previews memleak. 2015-04-07 15:38:06 +02:00
a2b4d96b65 Merge branch 'asset-experiments' into asset-engine 2015-04-07 15:07:47 +02:00
b3de44cc01 Cleanup: get rid of preview handling in lib listing code. 2015-04-07 15:07:09 +02:00
6e8cc0bc05 Move handling of ID blocks previews in thumbnail handler.
this is mandatory, since we do not keep previews for all listed items anymore
(with 10k datablocks would start to take too much mem). So we now generate (read)
them from thumbnailing threaded task as any other image, has several advantages:
* Quicker initial listing of data from .blend files.
* Since thumbnails are cached on disk, re-generating them is rather quick.
* General consistency!

Note thumbnail generation of datablocks could (should!) be enhanced, right now
it reads all previews for a given datatype in a file each time it has to generate
a single datablock thumbnail, we should generate all of those previews in a single
run. But this means handling cache dirty things (TBH_FAIL, outdating, etc.) on another
level so need some more work.

Also, still some memleaks issues with thumbnails, have to track those dose!
2015-04-07 15:00:40 +02:00
b6ef6da231 Merge branch 'master' into asset-experiments 2015-04-07 09:30:50 +02:00
fc543da843 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-06 20:27:04 +02:00
eaf71f7f17 Some minor tweaks for asset-engine branch... 2015-04-06 20:23:22 +02:00
bdf2e64255 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-06 20:15:29 +02:00
5cee945744 Merge branch 'master' into asset-experiments 2015-04-06 19:51:34 +02:00
c539aaf19d FileBrowser: internal listing: use own, much lighter struct to store whole list.
Since with internal listing we have no choice but to list everything, store
those data in the smallest possible struct - note we do not even store preview
here, these are only handled in full FileDirEntry cache (re-loading them from
cached thumbnails is really quick anyway).

Still not complete, have to re-do ID previews now, among other things...
And some memleaks again with previews, ugh.
2015-04-06 19:51:07 +02:00
979d16e52f BLI filelist: get rid of strings for size/time/mode/etc.
Those were eating quite a bit of bites, not neglectable with thousands of entries...
Also, useless to print those info most of the time, they are not used!

So now, we only store 'raw' stat data, and expose funcs to convert them to readable
strings on demand.
2015-04-05 15:47:59 +02:00
718e84201a Merge branch 'master' into asset-experiments 2015-04-05 11:49:35 +02:00
5e593dd851 Resurrect filelist_selection_get()...
Still not working though.
2015-04-04 15:14:03 +02:00
75ef507e70 Merge branch 'asset-experiments' into asset-engine 2015-04-04 15:07:21 +02:00
51bb1cef39 FileBrowser: add dummy accessor to entries from their uuid.
Needed for assets branch, to be rework seriously later of course.
2015-04-04 15:06:23 +02:00
6704abce7f Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-04 13:19:25 +02:00
868a4288ab FileBrowser: block caching: minor tweak (mostly needed in ae branch actually). 2015-04-04 13:17:43 +02:00
4696bce257 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
2015-04-04 13:15:17 +02:00
bbfe0652eb FileBrowser: rewrite 'entry selection' code.
Since we do not store anymore ell entries, we cannot use them to hold selection status.

So we now use a ghash in FileList struct, with entry UUID's as keys.

Also cleanuped up / refactored selection handling, filelist.c now features a nice intern
api and all other code uses it instead of accessing directly entries' selflag!
2015-04-04 12:43:53 +02:00
c0748c4292 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/storage.c
	source/blender/editors/space_file/filesel.c
2015-04-04 10:50:17 +02:00
e836c116ac Internal FileListing: generate a valid UUID, we'll need this for things like selection state... 2015-04-02 20:12:18 +02:00
f2e55db040 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-02 17:34:47 +02:00
e75c5c35cc FileBrowser Preview: enhance handling of previews when modifying cache of entries... 2015-04-02 17:29:31 +02:00
744c029d01 AssetEngine: Add needed API for new 'on demand' entries listing from FileBrowser.
Also use that new API in filebrowser - only partially for now, at least
it does not crash anymore even if 100% empty...
2015-04-02 17:11:33 +02:00
0d4ac96da0 Fixes needed to make it compile again. Remains broken though! 2015-04-02 15:29:21 +02:00
e70139964d Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/makesrna/intern/rna_internal.h

Notes:
* asset-experiments branch still needs some work (e.g. entires selection is to be reworked too),
  but was more than time to do a first merge...
* This is raw merge, code is hence broken and needs more fixes to take into account new changes!
2015-04-02 15:20:52 +02:00
6ec52ce5eb Merge branch 'master' into asset-experiments 2015-04-02 14:53:27 +02:00
d07aeb2fce FileBrowser: cleanup.
Get rid of cache iterator code (not needed, and don't think we'll need it later,
easy to add back if needed). Also comment some debug prints.

New preview (thumbnails) handling seems to be working pretty nice now.
2015-04-02 14:41:19 +02:00
7bfe994093 FileBrowser: Fix stupid cache clear on each redraw while previews where updating.
Missing 'need filter' flag clearing...
2015-04-02 14:06:56 +02:00
d8169c2db7 FileBrowser - fix two crashers.
* Full path is no more static, so we need dynamic tooltips to use it (still an
  issue with drag stuff here :| ).
* Remove timer would attempt to free timer's customdata, which is mere int-in-pointer
  in case of new notifier timer, so we need a special tweak on remove here.
2015-04-02 13:51:13 +02:00
a592525a7e FileBrowser: cleanup (remove) all the thumbnails job stuff, no more needed. 2015-04-02 10:38:19 +02:00
c61d6e36ba FileBrowser: Fix sorting/filtering (we need to clear the cache in those cases!). 2015-04-02 10:27:07 +02:00
49951df23d Merge branch 'master' into asset-experiments 2015-04-02 10:17:11 +02:00
0dc6b92fe6 FileBrowser new preview code: bunch of fixes.
Start to looks good... This commit adds a new timer helper, that only send notifiers
(kind of very restricted subset of wm_job stuff), since using jobs for previews
would be now counter-productive and way too much heavy.

Also fix/enhance how previews are generated (order), etc. etc.

Still WIP though, having some weird crashes and such lurking around.
2015-04-01 22:26:25 +02:00
ce3a8f9f5b Merge branch 'master' into asset-experiments 2015-04-01 15:07:24 +02:00
46d777f017 FileBrowser previews: first fixing round.
Nearly working now (no more freeze or huge mem leak), still need to
find a way to get refresh as long as all previews have not been generated...
2015-03-31 16:44:46 +02:00
fd5e70fc99 Merge branch 'master' into asset-experiments 2015-03-31 15:43:06 +02:00
f970994cd3 Some minor cleanups. 2015-03-31 15:42:51 +02:00
982fdbf506 FileBrowser: Various fixes...
Stupid useless allocations, memleaks, etc.

WIP, thumbnails still not working.
2015-03-31 15:41:04 +02:00
c1617cccd1 Merge branch 'master' into asset-experiments 2015-03-30 22:02:34 +02:00
e7c7b00fe0 WIP FileBrowser thumbnails: get rid of job here, use lighter threaded tasks.
Fully WIP, compiles but not yet working!
2015-03-30 21:35:56 +02:00
8093c5c2a8 Merge branch 'master' into asset-experiments 2015-03-30 14:59:25 +02:00
bf3bba802d Quick attempt to resume thumbnails generation on cache.
Note this is rather stupid anyway, we need to rewrite this from scratch,
using a	 job for that makes no sense now, we should stick to a lighter
threading schema with a queue, or something like that!
2015-03-30 14:54:31 +02:00
2984d39a46 Fix and use block caching from UI draw code.
Seems to work nice now.
2015-03-30 12:24:00 +02:00
11df07e53f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/include/UI_interface_icons.h
	source/blender/editors/space_file/filelist.h
2015-03-30 11:56:35 +02:00
ef0367d094 Merge branch 'master' into asset-experiments 2015-03-27 22:23:47 +01:00
188419ac3d WIP cache system for filebrowser entries.
Core part seems to be working, but this is still heavy WIP, much to do
to resume complete features from existing code. Mainly:

* Previews (those should only be ran on cached items now).
* Use block-caching to load in-display entries.
* Rework things like selection (cannot store selected states in entires anymore).

Also, internal listing is stupid currently (since it still stores everything
as FileDirEntry & co), not really crucial currently, but ultimately it'll
use its own, compact struct to keep full listing!

Also did some minor cleanup/renaming.
2015-03-27 22:05:36 +01:00
7a749ebbcf BLI listbase: add an helper to remove a constinuous chunk of the list in a single call. 2015-03-26 17:49:15 +01:00
e7dbb4b217 FileBrowser: First step towards allowing partial "storage" of entries.
That code is currently pretty stupid, but we need to clearly separate
what is handled by filebrowser itself, and what is by listing code
(be it internal one or future asset engines).

Plan/idea is to have a dual cache system (one 'block' of entries - centered
on currently viewed ones -, and one 'random' FIFO for random access to any entry).

This implies filebrowser itself shall now only be aware of the number of (filtered)
entries, and it then requests entries as needed.

Also, made size of columns in filebrowser fixed (ultimately, user configurable),
since it has no more access to the whole list of entries!

Still heavy WIP.
2015-03-26 15:24:03 +01:00
fca4cda7f9 Merge branch 'master' into asset-experiments 2015-03-26 11:04:37 +01:00
26d28b755b Reduce uuids size to 16 (as 'official' ones), more than enough! 2015-03-23 15:55:52 +01:00
9fbec44247 Merge branch 'master' into asset-experiments 2015-03-23 15:25:21 +01:00
a9f02fda07 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/makesdna/DNA_space_types.h
2015-03-21 16:48:34 +01:00
8834875281 Merge branch 'master' into asset-experiments 2015-03-21 16:44:40 +01:00
8bc8015657 WIP Amber: very quick, dirty, primitive and broken first implementation of tags handling.
We cannot do that correctly with current listdir system, have to rework again
in asset-experiments brnach first, so that listing, filtering and sorting is
completely "delocalized" to asset engine (will also try to solve scalability issues).
2015-03-21 16:42:00 +01:00
9553016ec1 WIP 2015-03-19 16:15:42 +01:00
01b6fd1f3e Merge branch 'master' into asset-experiments 2015-03-19 14:01:16 +01:00
3f860e0e73 AssetEngine: add IDProps, and RNA access to actual asset engine from filespace.
Also, some quick dummy test/demo code for that in Amber.
2015-03-17 21:07:57 +01:00
cdfd3c17f5 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-03-17 16:27:39 +01:00
bc40f4852d Fix broken 'sort by type' in filebrowser.
Also, take advantage of blentype stored in entries now,
this greatly simplifies (and make quicker) that sorting
for blendlib items!
2015-03-17 16:02:12 +01:00
99373c918f Add a 'comment' field to listdir revisions.
Also, make clear tags are only informative here.

Reason is, if the project is a success, we have to think big and
imagine asset engines managing catalogs of tens or hundreds of thousands
of entries (web ones e.g.), we cannot hold list of those in filebrowser!
So most of filetring will be 'deffered' to asset-engine.

We'll also probably have to implement a 'chunck listing' behavior
(to only list at most n entries in a row), for same reasons.

This will make things slightly more complicated :|
2015-03-17 15:39:20 +01:00
920bf9f2f3 Merge branch 'master' into asset-experiments 2015-03-17 14:47:54 +01:00
18baac2502 Amber: Some cleanup and atempt to fix repeated entries, not yet working. 2015-03-16 21:23:43 +01:00
9cf2583126 I18n: update for new akward algo names in UI messages... 2015-03-16 20:51:35 +01:00
0661b80aa0 Continue fleshing out Amber.
Start to add real asset engine behavior. Still completely uncomplete and not even half working.
2015-03-16 20:18:42 +01:00
0473ff213e Merge branch 'asset-experiments' into asset-engine 2015-03-16 13:51:42 +01:00
025b502f98 Merge branch 'master' into asset-experiments 2015-03-16 13:48:19 +01:00
f3c6cc9f32 Fix nasty bug preventing any navigation in directories!
Think issue also exists in master code actually, where some op properties
could be left uninitialized in 'params_to_op' helper func... But it does not
backfire like that for sure.
2015-03-15 20:34:42 +01:00
60783fd64e Amber: only list dirs from real filesystem.
Actual data (assets) are to be 'listed' by another way!

Also, fix mem leak.
2015-03-15 17:28:10 +01:00
7059cd538f Merge branch 'asset-experiments' into asset-engine 2015-03-15 15:48:40 +01:00
4621ac3ac1 Merge branch 'master' into asset-experiments 2015-03-15 15:31:10 +01:00
f9adc7fbac Start to make Amber a bit more serious!
Still useless - behaves more or less like a very basic, broken filebrowser.

But basics are here, and listing process seems to be working pretty well.
2015-03-13 22:26:22 +01:00
e615009ae4 Revert "Revert "Merge branch 'asset-engine' into asset-experiments""
This reverts commit f751e34f91.
2015-03-13 15:21:55 +01:00
f751e34f91 Revert "Merge branch 'asset-engine' into asset-experiments"
This reverts commit ccd1479200, reversing
changes made to 8da3bb3885.

Conflicts:
	release/scripts/startup/bl_operators/__init__.py
	release/scripts/startup/bl_operators/amber.py
	source/blender/blenkernel/BKE_asset.h
	source/blender/blenkernel/intern/asset.c
	source/blender/editors/space_file/file_ops.c
	source/blender/makesrna/intern/rna_asset.c
2015-03-13 15:18:24 +01:00
47ce2c5574 Merge branch 'master' into asset-experiments 2015-03-13 14:45:08 +01:00
ec3eec1ac5 Add load_pre callback to RNA, and stupid dummy code in Amber to make quick test of it. 2015-03-12 19:41:12 +01:00
47e3d34d94 RNA listdir: add some more accessors, and ability to remove/clear list of entries (assets). 2015-03-12 15:19:27 +01:00
ab463cb324 Rename 'Flame' to 'Amber'! 2015-03-12 11:07:10 +01:00
ccd1479200 Merge branch 'asset-engine' into asset-experiments 2015-03-12 11:03:40 +01:00
8da3bb3885 Merge branch 'master' into asset-experiments 2015-03-12 11:00:14 +01:00
473e702d5d First step to add 'load_pre' behavior.
This will allow asset engines to:
* Actually ensure requested data is available (downloading it, generating it, etc. as needed).
* Change entries generated for user by actual data paths (allows e.g. to present
  a set of different paths to load as a single 'asset' to user).

As usual, had to change existing filebrowser code... Seems to be working fine
from quick tests (i.e. regular filebrowser not being broken).
2015-03-12 10:59:10 +01:00
da53656be1 Add refcounting and shallow copy to AssetEngine.
Reason is, we want operator to 'inherit' ae instance from spacefile too.
2015-03-10 12:52:25 +01:00
99404d3a70 Fix initialization of AssetEngine type in new filebrowser. 2015-03-10 12:11:07 +01:00
4504d50012 Merge branch 'asset-experiments' into asset-engine 2015-03-09 16:26:04 +01:00
9c6abdff3a Merge branch 'master' into asset-experiments 2015-03-09 15:32:52 +01:00
8f0709f9eb Add more stuff to filelist RNA. 2015-03-05 10:08:33 +01:00
32f4fb952a Cleanup - remove big commented blocks from renderengine initial copy/paste. 2015-03-05 10:08:33 +01:00
5d732ddcae Add some asset engine-aware stuff in filebrowser.
Basically, filelisting code in space_file becomes default, internal 'asset engine',
and user can switch to any other available engine instead.

Note filelisting with asset engines is fully main-thread from C code PoV,
parallelization/asynchronism is responsability of the py code!

Also, added a basic (dummy currently) AssetEngine py implementation.
Not much there, but helps checking things works as expected before
writing whole interface!

All this is very basic early code yet, much much to do before we get anything really usable...
2015-03-05 10:08:33 +01:00
9f61207b23 Minor updates to asset engine API, and add some more basic file listing stuff to RNA. 2015-03-05 10:08:33 +01:00
1dcff09045 Further rework of file listing handling - complete decouple from OS-related direntry.
Remove everything not really related to OS representation of file entries.

FileBrowser will now use a complete decoupled version of file representation,
much easier to keep sane behavior this way, easy integration with RNA, etc.
2015-03-05 10:08:33 +01:00
7142e653b6 Add RNA structs for assets listing (with variants, revisions, etc.). 2015-03-05 10:08:33 +01:00
f6c3f08690 WIP start defining asset engine API. 2015-03-05 10:08:33 +01:00
beee21d045 Void skeleton of asset engine.
Mostly copied from RenderEngines code. Compiles, now we have to flesh this!
2015-03-05 10:08:33 +01:00
c5fde2845e Merge branch 'master' into asset-experiments 2015-03-05 09:48:28 +01:00
f2bff41cd5 Merge branch 'master' into asset-experiments 2015-03-03 17:10:30 +01:00
65b49051fb Add name/description fields to entries themselves too.
This allows us to greatly simplifies sorting (and avoid recomputing UI name each and everytime!).
Also, correctly free entries/variants names/descriptions.
2015-03-01 11:42:28 +01:00
de58d865b6 Spread (future assets) uuid over entries/variants/revisions.
Makes more sense this way, and will probably save memory in the end even.
2015-03-01 11:21:01 +01:00
6771aeeff5 Merge branch 'master' into asset-experiments 2015-03-01 10:54:02 +01:00
02c09be238 Merge branch 'master' into asset-experiments 2015-02-28 15:21:44 +01:00
25e0d0d63d Filelisting: switch from mere arrays to listbases.
Was not sure about that (adds two pointers to entries, variants **and** revisions :/ ),
but with the incremental process of listing we are using now, it makes things sooooo
much easy to handle (and also avoids tons of (deep)copy and mem (re)alloc), that it's
definitively worth it.

And since most (if not all) of 'public' access to filelist is done through filtered ones,
we can easily keep this a mere array of pointers, and hence keep quick index lookup.

Also, quite noticiably simplified the whole listing code (less functions, less levels of subcalls...).

Note: for now we stick to mere alloc, we may benefit from either memarena or mempool,
but those are not threadsafe (which means we could not so easily pass mem from worker
thread to main one), so not quite sure it would be worth it.

Note: thumbnail stuff is to be reworked from scratch too, have the feeling it's not yet
100% thread safe, and using a job here is probably way overkill, since we do not show
any progress in UI.
2015-02-27 19:18:33 +01:00
543984ffff Merge branch 'master' into asset-experiments 2015-02-27 14:23:37 +01:00
a35de360d0 Merge branch 'master' into asset-experiments 2015-02-26 15:38:59 +01:00
ae294763aa Merge branch 'master' into asset-experiments 2015-02-24 20:15:13 +01:00
52d3e71302 Move back path, image etc. to FileDirEntry.
Also, reduce revision's uuid to 64bytes, should be more than enough!

Thing is, we can expect tens (if not hundreds) of thousands of revisions from a
big assets repository with history storage (vcs). So we want that struct
to be as small as possible.

Also, we do not expect to handle several variants/revisions of a same asset within
a same 'context' (there is always only one active variant & rev). So storing
path & co at entry level shall be enough. And helps make code simpler/nicer.
2015-02-24 16:20:19 +01:00
21ae02a327 Get rid of abspath storage, this is storing twice the same data, not nice memory-wise.
We may suffer a little performance loss here, but would not expect it to be really important,
since rebuilding a full abspath is not needed that often.
2015-02-24 14:46:45 +01:00
da7092ff7d Restore size/date sorting.
Also, get rid of modes/owner crap, this is quite advanced UNIX fs info, not much to
do in our filebrowser imho, and takes time, UI space and Mem space!
2015-02-24 14:14:27 +01:00
cf89c7aa28 Merge branch 'master' into asset-experiments 2015-02-24 12:48:23 +01:00
f7f71bb152 Merge branch 'master' into asset-experiments 2015-02-23 16:13:26 +01:00
fb94004e6f Merge branch 'master' into asset-experiments 2015-02-23 15:08:14 +01:00
29d3cbc6f9 Filelisting: First step of sanitanization...
Move typeflag and selflag back to FileDirEntry, and add blentype there too,
this will be needed by asset engines, and avoids rechecking lib ID types over and over!

There's much more to do here though. Also, FileDirEntryRevision is going to be
used quite higly, we want to keep it as light as possible (much lighter than
its current state for sure!). Think we can move back to FileDirEntry paths
(and try to get rid of abspath on the run, too), but also most likely
preview (we won't store a preview for all possible revisions anyway),
owner/permissions, etc.

Rev should probably only have its uuid, and date/time.

Also, simplified filetype generation (from extensions for real files, and BLO helpers
for libdata), now it's nicely encapsulated into each reading callback.
2015-02-23 14:47:34 +01:00
156c5bc41e Merge branch 'master' into asset-experiments 2015-02-23 12:27:29 +01:00
e08fd1ebe5 Merge branch 'master' into asset-experiments 2015-02-22 15:21:38 +01:00
b32de3eaff Merge branch 'master' into asset-experiments 2015-02-19 15:30:51 +01:00
a759d0190b Big refactor of filelisting in filebrowser - decouple os/fs-related direntry from actual blender listing.
Main idea is that direntry had quite a bit of things already absolutely useless
in the mere 'file listing' context (image pointer, void 'data' pointer, etc.).

On the other end, to handle future asset stuff, we need *more* 'meta data' for our 'files'
(tags, variants, revisions...).

Further more, we need all this to be easily usable through RNA, i.e. we need it to
be defined in DNA.

So instead of trying to use direntry in DNA, mixing low-level system stuff like stat
where we do not want to see it, we define our own 'file' representation,
with only what we really need (who cares about chars or block or dev files in filebrowser?
we only need to know whether it's a regular file or a directory, period).

That way, low-level dirlisting remains clean, and we can easily extend our own
data as needed.

Note this new code works, does not crash (so far...) nor memleak, but it
needs quite a bit of work still, we are still storing useless stuff in direntry
(all those strings representing modes, size etc.!), and mem handling
during dir/lib listing is confusing at best (would like to use a memarena
or mempool here, but it's not that easy).
2015-02-18 21:36:48 +01:00
3e6aa7bd08 Merge branch 'master' into asset-experiments 2015-02-18 19:30:06 +01:00
a35ced0b97 Merge branch 'master' into asset-experiments 2015-02-17 15:37:20 +01:00
14ff7cdf76 Merge branch 'master' into asset-experiments 2015-02-16 16:21:28 +01:00
ecb79a5bd5 Preview generation on Windows: attempt to fix mysterious error by using even more ID's names.
Passing around ID's themselves is not safe - they may change their mem addresses.

Yet, I had no issue on linux, but on win build this is still not enough,
have to use a super strange hack (add an 'import sys' line just before where error happens)
to get things running...
2015-02-16 14:54:19 +01:00
d893c9f198 Merge branch 'master' into asset-experiments 2015-02-16 14:01:44 +01:00
07042a8d5d Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/filelist.c
2015-02-15 16:54:08 +01:00
d78819caf9 Cleanup of ugly allocation stuff (cast of void pointer, not-so-safe sizeof()'s, etc.). 2015-02-15 15:28:43 +01:00
ec071eb76a Merge branch 'master' into asset-experiments 2015-02-15 15:10:34 +01:00
5e25fdd514 Merge branch 'master' into asset-experiments 2015-02-15 10:39:38 +01:00
fb2c646dee Rework job multi-level listing - factorize even more and avoid recursion.
This is much cleaner than previous code...
2015-02-13 22:28:36 +01:00
3e603b606c Merge branch 'master' into asset-experiments 2015-02-13 19:47:00 +01:00
4c02644a58 Merge branch 'master' into asset-experiments 2015-02-12 19:45:25 +01:00
c6ea9e8f48 Merge branch 'master' into asset-experiments 2015-02-12 19:35:41 +01:00
05390dc4b5 Cleanup. 2015-02-12 18:01:02 +01:00
09a09c1010 Merge branch 'master' into asset-experiments 2015-02-12 17:55:07 +01:00
5144dcaeab Add previews to scenes, and enhance batch preview generation.
Batch preview generation can now also generate 'internal' previews (materials, textures etc.),
as well as scene ones. Also, some basic Cycles handling is there now.
You can now chose which kind of data to generate previews for, and whether the files are
trusted or not (for py autorun and drivers).
And rendering happens in background again, issue was actually a bug in creator.c, fixed in master.
Main TODOs reamining here: OpenGL rendering, and find a way to prevent '.blend1' when
saving over (either as a new option of save op, or simply by removing those files in script?).

Added a batch cleanup of previews too.

Also, added path of files as their tooltip 'image' button in main filebrowser view,
quite useful with the 'recursive' option...
2015-02-12 17:53:00 +01:00
e9484fa25e Merge branch 'master' into asset-experiments 2015-02-11 17:32:41 +01:00
92ef1b997b Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/space_file.c
2015-02-11 11:18:42 +01:00
6f603ea0d2 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_fileselect.h
	source/blender/editors/interface/interface_intern.h
	source/blender/editors/interface/interface_templates.c
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/fsmenu.c
	source/blender/editors/space_file/space_file.c
	source/blender/makesrna/intern/rna_space.c
2015-02-11 11:14:42 +01:00
67eb234783 Merge branch 'master' into asset-experiments 2015-02-10 12:40:24 +01:00
ec4b79fb60 Merge branch 'master' into asset-experiments 2015-02-09 10:15:02 +01:00
08bccfed6c Merge branch 'master' into asset-experiments 2015-02-09 09:20:39 +01:00
d8567fc45d Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-02-06 17:31:55 +01:00
51bc0a2b5d Fix crash when appending/linking (double free...). 2015-02-04 20:41:13 +01:00
8374fe855e Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-02-04 20:14:04 +01:00
399ae5d41a Make 'recursion' work as expected.
Now, recursion  0 = previous behavior,
     recursion  1 = only show content of immediate .blend files, do not recurse in actual dir hierarchy,
     recursion >1 = complete recursion!
2015-02-03 21:47:51 +01:00
ad1399acc4 Flat listing of libs: do not show the 'categories' directories unless we are
inside a single .blend lib in this case, useless and heavily clutters space.
2015-02-03 21:18:07 +01:00
d04a0baae7 Merge branch 'master' into asset-experiments 2015-02-03 20:45:25 +01:00
c0d0b3db66 Merge branch 'master' into asset-experiments 2015-02-02 12:16:00 +01:00
8b19837b83 Cleanup: add 'ED_' prefix to public fsmenu functions... 2015-02-01 21:02:29 +01:00
f6b9cad064 Cleanup: get rid of unused stuff! 2015-02-01 20:49:45 +01:00
9a4eb983be Merge branch 'master' into asset-experiments 2015-02-01 20:35:48 +01:00
93da0a8187 Prepare assets UI: switch filebrowser to tools + tool props areas, instead of channels.
This will allow us to keep op panel independent, and have tabs for future assets tools!

Note 'conversion' from previous file area (channels) is not perfect, you have to hit 'T'
twice currently if you had a filebrowser in your .blend file...
2015-01-30 18:38:02 +01:00
b3cd561032 Merge branch 'master' into asset-experiments 2015-01-30 13:58:45 +01:00
8ebe85f733 Merge branch 'master' into asset-experiments
Conflicts:
	release/scripts/startup/bl_operators/wm.py
2015-01-29 19:37:50 +01:00
9efd36bac0 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2015-01-27 19:51:35 +01:00
d41e1c00e6 Merge branch 'master' into asset-experiments 2015-01-27 12:02:40 +01:00
1c83d9ddbb Fix filtering in new UIList bookmarks & co. 2015-01-26 21:41:31 +01:00
ce765ad441 Better sorting when we are displaying several levels at once, for 'lib' append/link.
Consider blendfiles and 'categories' inside them as regular dirs, but with this hierachy:
    real dir > blende file lib > category in a blend lib.

This gives a much better sorting (among other things, gives more importance to
blend files!).
2015-01-26 21:30:00 +01:00
b3c0b59825 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
2015-01-26 17:38:16 +01:00
6f1e2e562d Merge branch 'master' into asset-experiments 2015-01-26 12:28:00 +01:00
6199ce89a8 Reworked from scratch 'icon over previews' feature.
Previous implementation was horribly complicated in the end... sigh.
2015-01-25 15:30:46 +01:00
bdda315260 Fix crasher (Looks like PointerRNA->type can be NULL...). 2015-01-25 14:59:04 +01:00
50d25aa395 Merge branch 'master' into asset-experiments 2015-01-25 12:43:36 +01:00
b1a885ab16 Merge branch 'master' into asset-experiments 2015-01-20 14:07:41 +01:00
8ff6e455fa Merge branch 'master' into asset-experiments 2015-01-18 18:50:31 +01:00
f1d1073046 Merge branch 'master' into asset-experiments 2015-01-17 20:09:37 +01:00
956d8e0ddd Fix for Windows - 'foobar.blend\' is a valid file path to that OS, sigh...
Also, store temp nullified pathsep in chars now, better.
2015-01-17 20:08:12 +01:00
03b7104b72 Fix stupid UI/py bug after recent refactor. 2015-01-17 00:04:06 +01:00
2d98ce2e72 Merge branch 'master' into asset-experiments 2015-01-17 00:03:33 +01:00
de3fd8a45c Merge branch 'master' into asset-experiments 2015-01-15 16:23:19 +01:00
d7b0bc9522 Merge branch 'master' into asset-experiments 2015-01-13 16:44:36 +01:00
548029c000 Merge branch 'master' into asset-experiments
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2015-01-13 16:42:33 +01:00
0715b73e18 Recursive listdir: let user set level of recursion... 2015-01-13 15:41:10 +01:00
912cdb2acb Merge branch 'master' into asset-experiments 2015-01-13 14:57:27 +01:00
5fccc64f6d Merge branch 'master' into asset-experiments 2015-01-13 14:15:01 +01:00
c944362fcd Merge branch 'master' into asset-experiments 2015-01-12 19:58:43 +01:00
27ce761880 Reorganization:
* Make 'clear preview' a C operator;
* Move 'object preview generator' op in wm namespace;
* Add those two to file-> data preview submenu.
2015-01-12 17:45:45 +01:00
517b06c296 Reorganization: move ID filters to DNA_ID.h, and add helpers in bke's idcode.c to convert between idcode and idfilter. 2015-01-12 17:44:44 +01:00
3118756854 Merge branch 'master' into asset-experiments 2015-01-12 15:50:35 +01:00
d35bbc2a15 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/group.c
	source/blender/blenkernel/intern/object.c
2015-01-10 10:18:23 +01:00
2c7ee72167 Add moving around bookmarks (same system as for vgroups etc.). 2015-01-07 21:13:45 +01:00
884603573a Merge branch 'master' into asset-experiments 2015-01-07 14:22:12 +01:00
67231a22a2 Merge branch 'master' into asset-experiments 2015-01-07 12:47:51 +01:00
e53cdbf62f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/include/UI_interface_icons.h
	source/blender/editors/interface/interface_icons.c
	source/blender/windowmanager/intern/wm_files.c
2015-01-07 12:44:45 +01:00
d46c9b876c Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-01-07 12:05:23 +01:00
dbd766f827 Nearly finished 'UIList for bookmarks'.
Got completely rid of C code for those panels.

Added full path in ttips of each 'bookmark' entry, as in current master.
Note this forced me to make tip in uiBut dynamic (like label). Not so sure
about this, but seems to me forcing tooltips to be static is actually quite
bad and limitating? we'll see...

Only remaining TODO (new feature) is reordering of bookmarks, should be easy now.

Also fixed some stupid (again!) mistake with RNA access to paths of bookmark entries.
2015-01-05 21:12:23 +01:00
de229b4085 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/space_file.c
2015-01-05 16:15:37 +01:00
3993965bd7 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filesel.c
	source/blender/makesdna/DNA_space_types.h
	source/blender/windowmanager/intern/wm_operators.c
2015-01-04 18:43:08 +01:00
97a00b9199 Merge branch 'master' into asset-experiments
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_file/space_file.c
	source/blender/makesdna/DNA_space_types.h
	source/blender/makesrna/intern/rna_space.c
2015-01-03 22:05:01 +01:00
d237ac45fe Get rid of this stupid string len def, RNA knows this better! 2015-01-03 21:34:17 +01:00
0f44f5506f Fix some issues with image previews.
* When overlaying icon, we have to also ensure background pict is always the same size
  (else you get usgly icon size changes). Still not perfect though, suspect some more issues
  in filrdraw code, probably should systematiacally run the 'ensure size' code during thumbnail
  generation?
* Sharing of img ImBuf between thumbnail job and main thread could still happen,
  leading to random crashes.
2015-01-03 18:43:51 +01:00
d730ff663b Fix py script generating obj/group previews after recent merge. 2015-01-03 17:39:23 +01:00
8f4d6f62ea Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_camera.h
	source/blender/blenkernel/intern/camera.c
	source/blender/blenlib/BLI_fileops.h
	source/blender/blenlib/intern/storage.c
	source/blender/editors/space_file/filelist.c
	source/blender/makesrna/intern/rna_object_api.c
	tests/gtests/blenlib/BLI_path_util_test.cc
2015-01-03 17:07:16 +01:00
55c792df8e Add 'dup_poin' callback param to new BLI_duplicate_filelist() func, to allow handling direntry's poin if needed. 2015-01-02 17:38:25 +01:00
7b05fd5830 Merge branch 'master' into asset-experiments 2015-01-02 17:24:39 +01:00
67040e08d3 Fix issues when giving a non-existent dir to filebrowser.
Note: unlike in current master, path is checked immediately when setting it
into filelist (simpler now that filelist building itself is threaded).
`filelist_setdir()` modifies in place given path if this one is not valid.
2015-01-01 16:58:30 +01:00
87518faa20 Use new BLI fnmatch helpers to fix wrong update in some cases when editing
string search filter.
2015-01-01 15:30:02 +01:00
e660793896 Add BLI helpers for fnmatch head/tail wildcards handling.
`BLI_fnmatch_strncpy_add_endswildcards()` will copy and add '*' wildcards on both ends of given string, if needed.

`BLI_fnmatch_strcmp_ignore_endswildcards()` is same as strcmp, but ignores any '*' wildcards on both ends of given strings.
2015-01-01 15:23:16 +01:00
224eb0025f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/interface/interface_icons.c
2015-01-01 15:18:38 +01:00
31043d87cd Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_file/space_file.c
2015-01-01 11:35:21 +01:00
de0b270014 Merge branch 'master' into asset-experiments 2015-01-01 11:11:10 +01:00
0fa91e1723 SpaceFile: Cleanup: fix stupid indices in filelist_from_main()
Dead code (currently), but still...
2015-01-01 11:10:12 +01:00
aa336809fa Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_file/space_file.c
2015-01-01 11:08:21 +01:00
425e8119de SpaceFile: Tweak thumbnail to avoid restarting the job needlessly. 2014-12-31 20:45:39 +01:00
4f241d3d36 SpaceFile: Refactor sorting and filtering of filelist.
New code shall be more easy to maintain and extend.
Sorting is now handled quite the same as filtering, and all filtering parameters
are now packed into a sub-struct to help extending it later.

Also done some optimizations in filelist refresh, and sorting/filtering area.
Now we should avoid re-sorting and re-filtering too often, also removed
calls to those in read_xxx funcs.

Note thumbnail job is still started basically on each call to `file_refresh()`,
will be addressed in next commit.
2014-12-31 20:13:21 +01:00
6a7076c9d4 SpaceFile: Filelist: reorder a bit things, also cleanup some unused and pure-private funcs. 2014-12-31 19:25:41 +01:00
ba0294cfe0 Merge branch 'master' into asset-experiments 2014-12-31 12:00:06 +01:00
0350111424 Merge branch 'master' into asset-experiments 2014-12-29 16:50:37 +01:00
8fa24594ce Merge branch 'master' into asset-experiments 2014-12-28 12:52:52 +01:00
1d42f07d58 Change timer of readdir job to 10ms, this gives an 'immediate' listing for most
usual cases, as in current master.
2014-12-28 12:49:24 +01:00
dc0a4fde63 Merge branch 'master' into asset-experiments 2014-12-27 17:26:17 +01:00
00cb0035a7 Fix one more issue - we need a string length callback too, for pure 'virtual' RNA strings... 2014-12-26 21:50:36 +01:00
4e19102964 Fix a mem leak in file listing threaded code, and another bug in fsmenu.c (new named bookmarks). 2014-12-26 19:58:08 +01:00
3c52c4ab0a Merge branch 'master' into asset-experiments
Conflicts:
	release/scripts/startup/bl_ui/__init__.py
	source/blender/editors/interface/interface_utils.c
2014-12-26 18:37:01 +01:00
0357a4928f Fix some 'minor' errors in fsmenuentry RNA name handling.
Still have a nice mem leak somewhere too... :/
2014-12-22 16:01:19 +01:00
4b1f410012 Add buttons to add/remove bookmarks, and to reset recent list. 2014-12-22 15:20:33 +01:00
cfc61a9337 Filebrowser uilist bookmarks: add icons as expected. 2014-12-22 14:47:12 +01:00
acaa5b2748 You can now edit bookmarks (and recent) names... 2014-12-22 14:39:54 +01:00
aa87764d13 WIP UILists for filebrowser: add access to three remaining types.
This also change update of active bookmark indices to happen in file_refresh().

Still not fully working, of course.
2014-12-22 12:25:40 +01:00
1a5caea321 Merge branch 'master' into asset-experiments 2014-12-22 10:26:07 +01:00
242fdf5e60 WIP: merge work on local branch about using UILists for bookmarks, be able to rename them, etc.
Doing it mostly because I need some update work done here so far to get py uilists/bookmarks working.

This exposes/moves part of bookmark code to ED_ area, so that it becomes available from e.g. RNA.
And adds RNA struct and such to represent a bookmark entry.

Also, Bookmark format is ammended to store optional custom names.

All this is still *very* crappy, should probably take some time soon to cleanup the whole branch!

See also T42777.
2014-12-21 16:02:12 +01:00
b734d9bf17 Merge branch 'master' into asset-experiments 2014-12-21 15:20:21 +01:00
4478ddc3d9 Add group preview generation too. 2014-12-20 16:47:41 +01:00
aa24a7d0a5 Merge branch 'master' into asset-experiments 2014-12-20 13:44:41 +01:00
d1743e3783 Fix stupid error (CMake install does not clean removed files it seems :/ ) 2014-12-19 14:54:35 +01:00
1dab208eb8 Various improvements to obj preview generation:
* Do not render cameras, lamps etc. for now.
* Generate bbox in camera local space, gives much better results.
* Add an op to clear previews from files.
2014-12-19 14:29:06 +01:00
db9310ac67 Merge branch 'master' into asset-experiments 2014-12-19 13:59:13 +01:00
d0187bf624 Merge branch 'master' into asset-experiments 2014-12-18 19:38:29 +01:00
baeeacc62d First basic pyscripts to generate previews for objects.
Much to be done still, but with it you can select some blender file,
and generate a basic rendered preview of each object.
2014-12-18 19:36:51 +01:00
88ffc9767c Finalized working new 'fit in camera view' code.
Now for any object, we have an rna func to call with a set of (flatten :/)
coordinates, and we get back location this object should be to 'see'
all given points.

Would need more refinements, but will do for now.
2014-12-18 15:26:34 +01:00
95b103c73b Merge branch 'master' into asset-experiments 2014-12-18 12:37:32 +01:00
a79a8fa111 Full WIP work to get better control regarding 'camera' aspect of objects.
First expose a method in Object RNA to get camera projection matrix (done).

Then, expose a method to get camera position (and scale for ortho) so that
it fits a given set of coordinates (still unfinished).

this among other things implied rewriting `BKE_camera_view_frame_fit_to_scene()`
underlying logic so that it uses `CameraParams` system, instead of `BKE_camera_view_frame()` one.
2014-12-17 21:56:09 +01:00
5cc7df849f Fix stupid merge error. 2014-12-17 10:43:31 +01:00
12e3347a5a Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/writefile.c
2014-12-17 10:42:52 +01:00
c440c22d18 RNA access to previews (image and icons).
Note since this gives python possibility to change those previews,
we add flags to PreviewImage to tag as user_defined.

TODO: replace all those shorts-used-as-bools by bitflags!
2014-12-16 18:03:28 +01:00
46d6d74386 Merge branch 'master' into asset-experiments 2014-12-16 16:59:01 +01:00
e1a345b3fe Ensure previews are up to date when saving .blend file.
Previuosly, we would only write existing data - and big previews were
nearly never generated by default.

Now, if saving previews is enabled, `wm_file_write()` will ensure
all 'common' previewable datablocks do have up-to-date previews
(brushes remain TODO here for now, they have both a preview **and**
an icon_imbuf, sigh...).

This implied adding an 'immediate' non-job-background version of
`ED_preview_icon_job()`.

Note this does not include objects/groups/etc. It's not simple to generate
previews for those, will probably go for a user-launched py operator here...

Also, cleanup some debug prints!
2014-12-16 14:41:44 +01:00
3c738b301f Never write preview data when doing memsave (i.e. undo).
Takes useless space, and they even could easily get out of sync.

Also, some minor preparative work to (re)generate previews on file write,
if needed!
2014-12-16 11:50:15 +01:00
b3b362a212 Reshufle a bit icon/preview size defines.
We now have a _RENDER_ variant of those, used when creating the previews,
so that we create 32x32 icons needed for those special screens...
2014-12-16 11:12:14 +01:00
9516d3fafc Some minor refinement regarding overlayed icons.
Note, even when unpremultiplying alpha, we still have 'breadcrumbs' around
icons, not sure why...
2014-12-16 09:56:57 +01:00
ddf519096d Merge branch 'master' into asset-experiments 2014-12-16 09:18:45 +01:00
02290ec582 A bit crappy, but working 'ID icons' over previews. 2014-12-15 19:55:15 +01:00
b36d5570c8 Refactor 'immediate search'
Previous implementation was uglyly relying on button using a specific
icon (VIEWZOOM) to enable this feature. Now we have a dedicated button flag
(UI_BUT_TEXTEDIT_UPDATE) and a dedicated RNA subtype (PROP_SEARCH) for that.

Also, if no icon is specified, it automatically set VIEWZOOM for it,
which saves us explicitely defining it in UI py code!

NOTE: this is to be committed asap in master, but has to wait for
after 2.73, so storing it here for now.
2014-12-15 14:52:10 +01:00
66f3def3b4 Cleanup: use ICON_DEFAULT_HEIGHT everywhere for ICON_SIZE_ICON
If we need bigger icon size for previews (like 32 instead of 16), then
it should be handled everywhere!
2014-12-15 13:02:54 +01:00
05926f7253 Do not set filetype to IMAGEFILE when we get a preview, this is absolutely stupid! 2014-12-15 12:28:17 +01:00
002e71f255 Merge branch 'master' into asset-experiments 2014-12-15 12:02:07 +01:00
f12f6ddd04 Fix stupid buggy behavior when init (root) dir had no trailing slash. 2014-12-15 11:19:43 +01:00
dfe8884e7a Add missing 'ID' icons, and a 'blenlib' filter to filetypes. 2014-12-15 11:03:44 +01:00
4f2e8c0315 Merge branch 'master' into asset-experiments 2014-12-15 09:37:56 +01:00
812f40c493 More borring boiling code for ob/group previews.
Also, try to make brushes also save their previews.

Anyway, something fishy is going on here, in theory we should get
previews for brushes, worlds, lamps... for free, but so far looks like
lib 'peek' code only handles mat/texture previews correctly?
2014-12-13 15:48:18 +01:00
3c634400a0 Add preview pointers to Object and Group, with read/write logic.
Doing nothing useful yet, though!

Note: ultimately we may want to move that preview stuff to ID struct,
so that we get a real basic generic handling of it, but for now
simpler to keep it as is.
2014-12-13 15:14:04 +01:00
8058d7d04f Merge branch 'master' into asset-experiments 2014-12-13 14:25:59 +01:00
35554d43b1 Merge branch 'master' into asset-experiments 2014-12-11 20:10:47 +01:00
8644862fac Add progressbar to dirlist job.
Progressbar value is quite chaotic currently, will check that later.

Also, fixed G.main still being used in job, and factorized once more time code.
2014-12-11 20:07:32 +01:00
5cf39b228d More cleanup, rename and commentting.
Also, definitively removed 'G.main.name protection' from lib reading
code. I do absolutely not see how listing a separate blend file handle
could possibly affect that anyway - and we do not want to access
G from non-main thread I'd bet...
2014-12-11 18:37:58 +01:00
b81d5a194a Atomic Cleanup: get rid of 'old' stuff no more used (mostly non-job read/list funcs)! 2014-12-11 18:16:32 +01:00
d211c58856 Merge branch 'master' into asset-experiments 2014-12-11 17:49:47 +01:00
7cb8a89aa0 Fix that stupid memleak in job-dir-listing code. 2014-12-11 17:46:46 +01:00
cb0272ceab Full rework of job (background) filereading code.
Now it works reasonably OK for filesystem, and also for .blend libs.

Code is even quite simpler than previous one. Now it needs some serious cleanup,
and find where (new) memleak comes from too.
2014-12-11 17:33:16 +01:00
9a7ff0f4fe Merge branch 'master' into asset-experiments 2014-12-11 09:57:06 +01:00
769de4ff1e Merge branch 'master' into asset-experiments 2014-12-10 21:16:42 +01:00
5d3ee3d695 WIP code to make readfilelists jobs.
Only very partially working in this state, still needs some work.
Proof of concept seems rather interesting though.

Also, only pure filesystem stuff is implemented for now.
2014-12-10 21:14:26 +01:00
3ff51cd5df Merge branch 'master' into asset-experiments 2014-12-10 17:05:04 +01:00
e4d9f9b772 Merge branch 'master' into asset-experiments 2014-12-10 15:58:39 +01:00
09b3e44b22 Reduce recursion to one level (.blend libs do not take that into account anyway).
Quicker, and in most cases I think this will be enough for libs and file browsing.

Real asset handling is another question.
2014-12-10 11:51:25 +01:00
c5fccb7caf Merge branch 'master' into asset-experiments 2014-12-10 11:40:01 +01:00
0add26e60b Merge branch 'master' into asset-experiments 2014-12-09 17:46:10 +01:00
c725d868af Filter completely 'dot-files', even when hidden in paths. 2014-12-09 17:44:29 +01:00
8f1df9fbba Fix wrong update when switching 'flat' state, also fix remaining memleak. 2014-12-09 17:23:32 +01:00
f06ed97ce7 Do not show ID-types filtering when we are not browsing libs! 2014-12-09 14:56:30 +01:00
f13f85676d Merge branch 'master' into asset-experiments 2014-12-09 14:15:35 +01:00
21030e3ae6 Merge branch 'master' into asset-experiments 2014-12-09 11:10:35 +01:00
677c716c0f Fix two very stupid bugs! 2014-12-08 19:21:39 +01:00
e28fb66186 More sorting fixes and tweaks (things should work rather OK now). 2014-12-08 18:51:38 +01:00
da7f20e385 Merge branch 'master' into asset-experiments 2014-12-08 17:37:49 +01:00
6b07e8e31d Take IDTypes into account when sorting by types.
Also:
* Changed BLO_library_path_explode, now r_group and r_name must be pointers of char pointer,
  if found they will point to right place in r_dir 'memspace'.
* Select everything in IDTypes filtering by default.
2014-12-08 16:40:43 +01:00
ffb0fc35a9 Get rid of BLO_is_a_library. 2014-12-08 13:59:32 +01:00
4e96fe77b1 Add ID-types filtering. 2014-12-08 12:45:54 +01:00
337d7b2a6a Merge branch 'master' into asset-experiments 2014-12-08 10:56:15 +01:00
f92e64f207 Merge branch 'master' into asset-experiments 2014-12-06 18:12:09 +01:00
5eaa8739c5 Moar fixes (re ;ostly filtering mixed lib/data and regular files). 2014-12-06 18:10:59 +01:00
c689af14d8 Make 'append/link' code handle data from several different sources at once.
Nothing really magic here, just grouping the imports by libfile/grouptype.
We could probably get better code (loop less on given list of 'files' to import)
but not sure it'd be worth it, this is not supposed to be a performance-critical point.
2014-12-06 18:05:54 +01:00
951dbff60e Moar fixes to sorting code and such. 2014-12-06 15:40:00 +01:00
53148b5ebc Some flatmode fixes:
* Delete filelist when changing flat setting (so that we get immediate update when changing that setting).
* Disable flat when going up in tree (we ;ight actually want to do this everytime).
2014-12-06 14:50:03 +01:00
429cc6072f Merge branch 'master' into asset-experiments 2014-12-06 12:57:54 +01:00
b3e2cbac79 Merge branch 'master' into asset-experiments 2014-12-05 16:47:05 +01:00
9939e783a9 Reworked 'flat' mode, added it outside of blendfiles (libraries).
Note this is WIP, it 'breaks' load/append/etc. operators to some points,
and many other 'details' that need to be addressed.
2014-12-05 16:43:57 +01:00
276286aa85 Merge branch 'master' into asset-experiments 2014-12-05 12:45:31 +01:00
5ceec532b7 Merge branch 'master' into asset-experiments 2014-12-04 18:46:11 +01:00
9ea42ae3ba Add basic 'glob' filter by name feature.
Not much to add, we'll likely add more filtering options (tags, categories...) later,
maybe for now we just need an 'exclude' option for name filter...
2014-12-04 18:43:17 +01:00
f8f82821ef Refactor: do not filter each item twice! Mem usage here is not really an issue anyway. 2014-12-04 17:45:55 +01:00
d9b4186e6e Refactor filtering code, should be easier to add new filter options now. 2014-12-04 17:30:51 +01:00
c728f537ae Fix issues when data name have slash inside.
Adding `BLO_library_path_explode` simplies things. We might end getting rid of
`BLO_is_a_library` (or rather, merge back both things) later, though.
2014-12-04 16:51:46 +01:00
1089d97f04 Fix stupid mistake preventing 'traditional' append/link 2014-12-04 15:23:56 +01:00
d00d1d5622 Cleanup: more. 2014-12-04 15:03:33 +01:00
f02bc0cda8 Cleanup, remove tons of debug prints 2014-12-04 14:53:55 +01:00
b65d8de56a Add icons to datatypes (IDs) in browser, when appending/linking.
Not yet previews, but still better than anonymous icon!
2014-12-04 14:48:56 +01:00
158e6fd7f3 Merge branch 'master' into asset-experiments 2014-12-04 11:19:31 +01:00
ff1ff9823d Merge branch 'master' into asset-experiments 2014-12-04 11:11:33 +01:00
ca70271876 Append/link from 'global' level works.
Note I had to implement 'relative' path handling for 'filenames' in
append/link op, we may want to do this a bit differently later?
2014-12-03 18:55:07 +01:00
b29258922f Fix name issue (stupid really), show them better in UI. 2014-12-03 16:39:05 +01:00
99a1f8172b Do not shoz/consider at all inner '..'
Also more debug code that'll need to be cleaned up
2014-12-03 16:07:28 +01:00
74ae847cfa First (awful) tests to get a whole blend file content shown flat
Main goal is to see whether we can use existing filelist to handle that
(by default it is 100% tree-oriented).

Also, getting some strange issues with ID name currently...
2014-12-03 15:29:18 +01:00
1646 changed files with 54530 additions and 192462 deletions

6
.gitignore vendored
View File

@@ -33,9 +33,3 @@ Desktop.ini
/doc/python_api/sphinx-in-tmp/
/doc/python_api/sphinx-in/
/doc/python_api/sphinx-out/
/doc/python_api/rst/bmesh.ops.rst
/doc/python_api/rst/in_menu.png
/doc/python_api/rst/menu_id.png
/doc/python_api/rst/op_prop.png
/doc/python_api/rst/run_script.png
/doc/python_api/rst/spacebar.png

File diff suppressed because it is too large Load Diff

View File

@@ -25,18 +25,17 @@
ARGS=$( \
getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
with-all,with-opencollada,\
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,with-all,with-opencollada,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
force-all,force-python,force-numpy,force-boost,\
force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
force-ffmpeg,force-opencollada,force-alembic,\
force-ffmpeg,force-opencollada,\
build-all,build-python,build-numpy,build-boost,\
build-ocio,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
build-ffmpeg,build-opencollada,build-alembic,\
build-ffmpeg,build-opencollada,\
skip-python,skip-numpy,skip-boost,\
skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
skip-ffmpeg,skip-opencollada,skip-alembic \
skip-ffmpeg,skip-opencollada \
-- "$@" \
)
@@ -168,9 +167,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--build-openvdb
Force the build of OpenVDB.
--build-alembic
Force the build of Alembic.
--build-opencollada
Force the build of OpenCOLLADA.
@@ -220,9 +216,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--force-openvdb
Force the rebuild of OpenVDB.
--force-alembic
Force the rebuild of Alembic.
--force-opencollada
Force the rebuild of OpenCOLLADA.
@@ -265,9 +258,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--skip-openvdb
Unconditionally skip OpenVDB installation/building.
--skip-alembic
Unconditionally skip Alembic installation/building.
--skip-opencollada
Unconditionally skip OpenCOLLADA installation/building.
@@ -282,9 +272,8 @@ SUDO="sudo"
NO_BUILD=false
NO_CONFIRM=false
USE_CXX11=true # Mandatory in blender2.8
PYTHON_VERSION="3.5.2"
PYTHON_VERSION="3.5.1"
PYTHON_VERSION_MIN="3.5"
PYTHON_FORCE_BUILD=false
PYTHON_FORCE_REBUILD=false
@@ -317,7 +306,7 @@ OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false
_with_built_openexr=false
OIIO_VERSION="1.7.8"
OIIO_VERSION="1.6.9"
OIIO_VERSION_MIN="1.6.0"
OIIO_VERSION_MAX="1.9.0" # UNKNOWN currently # Not supported by current OSL...
OIIO_FORCE_BUILD=false
@@ -332,14 +321,14 @@ LLVM_FORCE_REBUILD=false
LLVM_SKIP=false
# OSL needs to be compiled for now!
OSL_VERSION="1.7.5"
OSL_VERSION="1.7.3"
OSL_VERSION_MIN=$OSL_VERSION
OSL_FORCE_BUILD=false
OSL_FORCE_REBUILD=false
OSL_SKIP=false
# OpenSubdiv needs to be compiled for now
OSD_VERSION="3.1.1"
OSD_VERSION="3.0.2"
OSD_VERSION_MIN=$OSD_VERSION
OSD_FORCE_BUILD=false
OSD_FORCE_REBUILD=false
@@ -354,20 +343,13 @@ OPENVDB_FORCE_BUILD=false
OPENVDB_FORCE_REBUILD=false
OPENVDB_SKIP=false
# Alembic needs to be compiled for now
ALEMBIC_VERSION="1.6.0"
ALEMBIC_VERSION_MIN=$ALEMBIC_VERSION
ALEMBIC_FORCE_BUILD=false
ALEMBIC_FORCE_REBUILD=false
ALEMBIC_SKIP=false
# Version??
OPENCOLLADA_VERSION="1.3"
OPENCOLLADA_FORCE_BUILD=false
OPENCOLLADA_FORCE_REBUILD=false
OPENCOLLADA_SKIP=false
FFMPEG_VERSION="3.2.1"
FFMPEG_VERSION="2.8.4"
FFMPEG_VERSION_MIN="2.8.4"
FFMPEG_FORCE_BUILD=false
FFMPEG_FORCE_REBUILD=false
@@ -543,7 +525,6 @@ while true; do
OPENVDB_FORCE_BUILD=true
OPENCOLLADA_FORCE_BUILD=true
FFMPEG_FORCE_BUILD=true
ALEMBIC_FORCE_BUILD=true
shift; continue
;;
--build-python)
@@ -586,9 +567,6 @@ while true; do
--build-ffmpeg)
FFMPEG_FORCE_BUILD=true; shift; continue
;;
--build-alembic)
ALEMBIC_FORCE_BUILD=true; shift; continue
;;
--force-all)
PYTHON_FORCE_REBUILD=true
NUMPY_FORCE_REBUILD=true
@@ -602,7 +580,6 @@ while true; do
OPENVDB_FORCE_REBUILD=true
OPENCOLLADA_FORCE_REBUILD=true
FFMPEG_FORCE_REBUILD=true
ALEMBIC_FORCE_REBUILD=true
shift; continue
;;
--force-python)
@@ -643,9 +620,6 @@ while true; do
--force-ffmpeg)
FFMPEG_FORCE_REBUILD=true; shift; continue
;;
--force-alembic)
ALEMBIC_FORCE_REBUILD=true; shift; continue
;;
--skip-python)
PYTHON_SKIP=true; shift; continue
;;
@@ -682,9 +656,6 @@ while true; do
--skip-ffmpeg)
FFMPEG_SKIP=true; shift; continue
;;
--skip-alembic)
ALEMBIC_SKIP=true; shift; continue
;;
--)
# no more arguments to parse
break
@@ -705,21 +676,6 @@ if [ "$WITH_ALL" = true -a "$OPENCOLLADA_SKIP" = false ]; then
fi
WARNING "****WARNING****"
PRINT "If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!"
PRINT "The same goes for install_deps itself, if you encounter issues, please first erase everything in $SRC and $INST"
PRINT "(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!"
PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
PRINT ""
PRINT "You may also try to use the '--build-foo' options to bypass your distribution's packages"
PRINT "for some troublesome/buggy libraries..."
PRINT ""
PRINT ""
PRINT "Ran with:"
PRINT " install_deps.sh $COMMANDLINE"
PRINT ""
PRINT ""
# This has to be done here, because user might force some versions...
PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
@@ -727,7 +683,7 @@ NUMPY_SOURCE=( "http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" )
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options"
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams"
OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
@@ -756,7 +712,7 @@ OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
OSL_SOURCE_REPO_UID="7d40ff5fe8e47b030042afb92d0e955f5aa96f48"
OSL_SOURCE_REPO_BRANCH="blender-fixes"
OSD_USE_REPO=false
OSD_USE_REPO=true
# Script foo to make the version string compliant with the archive name:
# ${Varname//SearchForThisChar/ReplaceWithThisChar}
OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
@@ -771,32 +727,13 @@ OPENVDB_SOURCE=( "https://github.com/dreamworksanimation/openvdb/archive/v${OPEN
#~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
ALEMBIC_USE_REPO=false
ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz" )
# ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" )
# ALEMBIC_SOURCE_REPO_UID="e6c90d4faa32c4550adeaaf3f556dad4b73a92bb"
# ALEMBIC_SOURCE_REPO_BRANCH="master"
OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
OPENCOLLADA_REPO_BRANCH="master"
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
CXXFLAGS_BACK=$CXXFLAGS
if [ "$USE_CXX11" = true ]; then
WARNING "C++11 is now mandatory for blender2.8, this *should* go smoothly with any very recent distribution.
However, if you are experiencing linking errors (also when building Blender itself), please try the following:
* Re-run this script with '--build-all --force-all' options.
* Ensure your gcc version is at the very least 4.8, if possible you should really rather use gcc-5.1 or above.
Please note that until the transition to C++11-built libraries if completed in your distribution, situation will
remain fuzzy and incompatibilities may happen..."
PRINT ""
PRINT ""
CXXFLAGS="$CXXFLAGS -std=c++11"
export CXXFLAGS
fi
#### Show Dependencies ####
@@ -809,7 +746,7 @@ Those libraries should be available as packages in all recent distributions (opt
* libjpeg, libpng, libtiff, [libopenjpeg], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libsdl1.2, libglew, [libglewmx].\""
* libsdl1.2, libglew, libglewmx.\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -830,8 +767,7 @@ You may also want to build them yourself (optional ones are [between brackets]):
* [OpenShadingLanguage $OSL_VERSION_MIN] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID).
* [OpenSubDiv $OSD_VERSION_MIN] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID).
* [OpenVDB $OPENVDB_VERSION_MIN] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE).
* [OpenCollada] (from $OPENCOLLADA_SOURCE, branch $OPENCOLLADA_REPO_BRANCH, commit $OPENCOLLADA_REPO_UID).
* [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).\""
* [OpenCollada] (from $OPENCOLLADA_SOURCE, branch $OPENCOLLADA_REPO_BRANCH, commit $OPENCOLLADA_REPO_UID).\""
if [ "$DO_SHOW_DEPS" = true ]; then
PRINT ""
@@ -983,7 +919,7 @@ prepare_opt() {
# Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
magic_compile_check() {
if [ -f $INST/.$1-magiccheck-$2-$USE_CXX11 ]; then
if [ -f $INST/.$1-magiccheck-$2 ]; then
return 0
else
return 1
@@ -992,7 +928,7 @@ magic_compile_check() {
magic_compile_set() {
rm -f $INST/.$1-magiccheck-*
touch $INST/.$1-magiccheck-$2-$USE_CXX11
touch $INST/.$1-magiccheck-$2
}
# Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib...
@@ -1182,7 +1118,7 @@ compile_Boost() {
fi
# To be changed each time we make edits that would modify the compiled result!
boost_magic=11
boost_magic=10
_init_boost
@@ -1652,10 +1588,6 @@ compile_OIIO() {
# fi
cmake_d="$cmake_d -D USE_OCIO=OFF"
if [ "$USE_CXX11" = true ]; then
cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
fi
if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686"
else
@@ -1867,9 +1799,6 @@ compile_OSL() {
cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D USE_SIMD=sse2"
if [ "$USE_CXX11" = true ]; then
cmake_d="$cmake_d -D OSL_BUILD_CPP11=1"
fi
#~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
@@ -1944,7 +1873,7 @@ compile_OSD() {
fi
# To be changed each time we make edits that would modify the compiled result!
osd_magic=2
osd_magic=1
_init_osd
# Clean install if needed!
@@ -2209,102 +2138,6 @@ compile_OPENVDB() {
run_ldconfig "openvdb"
}
#### Build Alembic ####
_init_alembic() {
_src=$SRC/alembic-$ALEMBIC_VERSION
_git=false
_inst=$INST/alembic-$ALEMBIC_VERSION
_inst_shortcut=$INST/alembic
}
clean_ALEMBIC() {
_init_alembic
_clean
}
compile_ALEMBIC() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, Alembic will not be compiled!"
return
fi
compile_HDF5
PRINT ""
# To be changed each time we make edits that would modify the compiled result!
alembic_magic=2
_init_alembic
# Clean install if needed!
magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
if [ $? -eq 1 -o "$ALEMBIC_FORCE_REBUILD" = true ]; then
clean_ALEMBIC
fi
if [ ! -d $_inst ]; then
INFO "Building Alembic-$ALEMBIC_VERSION"
prepare_opt
if [ ! -d $_src -o true ]; then
mkdir -p $SRC
download ALEMBIC_SOURCE[@] "$_src.tar.gz"
INFO "Unpacking Alembic-$ALEMBIC_VERSION"
tar -C $SRC -xf $_src.tar.gz
fi
cd $_src
cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst"
if [ -d $INST/boost ]; then
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
cmake_d="$cmake_d -D USE_STATIC_BOOST=ON"
else
cmake_d="$cmake_d -D USE_STATIC_BOOST=OFF"
fi
if [ "$_with_built_openexr" = true ]; then
cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
cmake_d="$cmake_d -D USE_ARNOLD=OFF"
cmake_d="$cmake_d -D USE_BINARIES=OFF"
cmake_d="$cmake_d -D USE_EXAMPLES=OFF"
cmake_d="$cmake_d -D USE_HDF5=OFF"
cmake_d="$cmake_d -D USE_MAYA=OFF"
cmake_d="$cmake_d -D USE_PRMAN=OFF"
cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
cmake_d="$cmake_d -D USE_STATIC_HDF5=OFF"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_LINK_STATIC=OFF"
cmake_d="$cmake_d -D ALEMBIC_SHARED_LIBS=OFF"
cmake_d="$cmake_d -D ALEMBIC_LIB_USES_BOOST=ON"
cmake_d="$cmake_d -D ALEMBIC_LIB_USES_TR1=OFF"
INFO "ILMBASE_ROOT=$INST/openexr"
fi
cmake $cmake_d ./
make -j$THREADS install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic
cd $CWD
INFO "Done compiling Alembic-$ALEMBIC_VERSION!"
else
INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-alembic option."
fi
run_ldconfig "alembic"
}
#### Build OpenCOLLADA ####
_init_opencollada() {
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
@@ -2472,7 +2305,7 @@ compile_FFmpeg() {
--enable-avfilter --disable-vdpau \
--disable-bzlib --disable-libgsm --disable-libspeex \
--enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
--disable-vaapi --disable-nonfree --enable-gpl \
--disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
--disable-postproc --disable-librtmp --disable-libopencore-amrnb \
--disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
--disable-libxcb \
@@ -2599,9 +2432,8 @@ install_DEB() {
git libfreetype6-dev libx11-dev flex bison libtbb-dev libxxf86vm-dev \
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
# libglewmx-dev (broken in deb testing currently...)
OPENJPEG_USE=true
VORBIS_USE=true
@@ -2914,17 +2746,6 @@ install_DEB() {
fi
fi
PRINT ""
if [ "$ALEMBIC_SKIP" = true ]; then
WARNING "Skipping Alembic installation, as requested..."
elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
INFO "Forced Alembic building, as requested..."
compile_ALEMBIC
else
# No package currently, only HDF5!
compile_ALEMBIC
fi
if [ "$WITH_OPENCOLLADA" = true ]; then
_do_compile_collada=false
@@ -3462,17 +3283,6 @@ install_RPM() {
compile_OPENVDB
fi
PRINT ""
if [ "$ALEMBIC_SKIP" = true ]; then
WARNING "Skipping Alembic installation, as requested..."
elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
INFO "Forced Alembic building, as requested..."
compile_ALEMBIC
else
# No package currently!
compile_ALEMBIC
fi
if [ "$WITH_OPENCOLLADA" = true ]; then
PRINT ""
@@ -3883,16 +3693,6 @@ install_ARCH() {
fi
fi
PRINT ""
if [ "$ALEMBIC_SKIP" = true ]; then
WARNING "Skipping Alembic installation, as requested..."
elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
INFO "Forced Alembic building, as requested..."
compile_ALEMBIC
else
compile_ALEMBIC
fi
if [ "$WITH_OPENCOLLADA" = true ]; then
PRINT ""
@@ -4035,6 +3835,9 @@ install_OTHER() {
fi
if [ "$_do_compile_llvm" = true ]; then
install_packages_DEB libffi-dev
# LLVM can't find the debian ffi header dir
_FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
PRINT ""
compile_LLVM
have_llvm=true
@@ -4053,6 +3856,7 @@ install_OTHER() {
if [ "$_do_compile_osl" = true ]; then
if [ "$have_llvm" = true ]; then
install_packages_DEB flex bison libtbb-dev
PRINT ""
compile_OSL
else
@@ -4071,6 +3875,7 @@ install_OTHER() {
fi
if [ "$_do_compile_osd" = true ]; then
install_packages_DEB flex bison libtbb-dev
PRINT ""
compile_OSD
fi
@@ -4087,6 +3892,10 @@ install_OTHER() {
fi
if [ "$_do_compile_collada" = true ]; then
install_packages_DEB libpcre3-dev
# Find path to libxml shared lib...
_XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
# No package
PRINT ""
compile_OpenCOLLADA
fi
@@ -4171,6 +3980,16 @@ print_info_ffmpeglink() {
}
print_info() {
PRINT ""
PRINT ""
WARNING "****WARNING****"
PRINT "If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!"
PRINT "The same goes for install_deps itself, if you encounter issues, please first erase everything in $SRC and $INST"
PRINT "(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!"
PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
PRINT ""
PRINT "You may also try to use the '--build-foo' options to bypass your distribution's packages"
PRINT "for some troublesome/buggy libraries..."
PRINT ""
PRINT ""
PRINT "Ran with:"
@@ -4181,13 +4000,7 @@ print_info() {
_buildargs="-U *SNDFILE* -U *PYTHON* -U *BOOST* -U *Boost*"
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*"
if [ "$USE_CXX11" = true ]; then
_1="-D WITH_CXX11=ON"
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG*"
_1="-D WITH_CODEC_SNDFILE=ON"
PRINT " $_1"
@@ -4293,17 +4106,6 @@ print_info() {
_buildargs="$_buildargs $_1"
fi
if [ "$ALEMBIC_SKIP" = false ]; then
_1="-D WITH_ALEMBIC=ON"
PRINT " $_1"
_buildargs="$_buildargs $_1"
if [ -d $INST/alembic ]; then
_1="-D ALEMBIC_ROOT_DIR=$INST/alembic"
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi
fi
if [ "$NO_SYSTEM_GLEW" = true ]; then
_1="-D WITH_SYSTEM_GLEW=OFF"
PRINT " $_1"
@@ -4352,6 +4154,3 @@ PRINT ""
# Switch back to user language.
LANG=LANG_BACK
export LANG
CXXFLAGS=$CXXFLAGS_BACK
export CXXFLAGS

View File

@@ -94,7 +94,6 @@ all_repositories = {
r'git://git.blender.org/blender-translations.git': 'blender-translations',
r'git://git.blender.org/blender-addons.git': 'blender-addons',
r'git://git.blender.org/blender-addons-contrib.git': 'blender-addons-contrib',
r'git://git.blender.org/blender-dev-tools.git': 'blender-dev-tools',
r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
}
@@ -129,7 +128,6 @@ def schedule_force_build(name):
forcesched.CodebaseParameter(hide=True, codebase="blender-translations"),
forcesched.CodebaseParameter(hide=True, codebase="blender-addons"),
forcesched.CodebaseParameter(hide=True, codebase="blender-addons-contrib"),
forcesched.CodebaseParameter(hide=True, codebase="blender-dev-tools"),
forcesched.CodebaseParameter(hide=True, codebase="lib svn")],
properties=[]))
@@ -145,7 +143,6 @@ def schedule_build(name, hour, minute=0):
"blender-translations": {"repository": "", "branch": "master"},
"blender-addons": {"repository": "", "branch": "master"},
"blender-addons-contrib": {"repository": "", "branch": "master"},
"blender-dev-tools": {"repository": "", "branch": "master"},
"lib svn": {"repository": "", "branch": "trunk"}},
branch=current_branch,
builderNames=[name],
@@ -267,8 +264,7 @@ def generic_builder(id, libdir='', branch='', rsync=False):
for submodule in ('blender-translations',
'blender-addons',
'blender-addons-contrib',
'blender-dev-tools'):
'blender-addons-contrib'):
f.addStep(git_submodule_step(submodule))
f.addStep(git_step(branch))
@@ -297,14 +293,13 @@ def generic_builder(id, libdir='', branch='', rsync=False):
# Builders
add_builder(c, 'mac_x86_64_10_6_cmake', 'darwin-9.x.universal', generic_builder, hour=5)
# add_builder(c, 'linux_glibc211_i686_cmake', '', generic_builder, hour=1)
# add_builder(c, 'linux_glibc211_x86_64_cmake', '', generic_builder, hour=2)
add_builder(c, 'linux_glibc211_i686_cmake', '', generic_builder, hour=1)
add_builder(c, 'linux_glibc211_x86_64_cmake', '', generic_builder, hour=2)
add_builder(c, 'linux_glibc219_i686_cmake', '', generic_builder, hour=3)
add_builder(c, 'linux_glibc219_x86_64_cmake', '', generic_builder, hour=4)
add_builder(c, 'win32_cmake_vc2013', 'windows_vc12', generic_builder, hour=3)
add_builder(c, 'win64_cmake_vc2013', 'win64_vc12', generic_builder, hour=4)
add_builder(c, 'win32_cmake_vc2015', 'windows_vc14', generic_builder, hour=5)
add_builder(c, 'win64_cmake_vc2015', 'win64_vc14', generic_builder, hour=6)
add_builder(c, 'win64_cmake_vc2015', 'win64_vc14', generic_builder, hour=5)
# STATUS TARGETS
#

View File

@@ -72,11 +72,7 @@ if 'cmake' in builder:
# Set up OSX architecture
if builder.endswith('x86_64_10_6_cmake'):
cmake_extra_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda8-hack/bin/nvcc')
cmake_extra_options.append('-DWITH_CODEC_QUICKTIME=OFF')
cmake_extra_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.6')
build_cubins = False
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/bin/nvcc')
elif builder.startswith('win'):
if builder.endswith('_vc2015'):
@@ -93,7 +89,6 @@ if 'cmake' in builder:
elif builder.startswith('win32'):
bits = 32
cmake_options.extend(['-G', 'Visual Studio 12 2013'])
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/nvcc.exe')
elif builder.startswith('linux'):
tokens = builder.split("_")
@@ -113,13 +108,10 @@ if 'cmake' in builder:
cuda_chroot_name = 'buildbot_' + deb_name + '_x86_64'
targets = ['player', 'blender', 'cuda']
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-8.0/bin/nvcc')
cmake_options.append("-C" + os.path.join(blender_dir, cmake_config_file))
# Prepare CMake options needed to configure cuda binaries compilation.
cuda_cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=%s" % ('ON' if build_cubins else 'OFF'))
cuda_cmake_options.append("-DCYCLES_CUDA_BINARIES_ARCH=sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61")
if build_cubins or 'cuda' in targets:
if bits == 32:
cuda_cmake_options.append("-DCUDA_64_BIT_DEVICE_CODE=OFF")
@@ -183,8 +175,10 @@ if 'cmake' in builder:
print('Condifuration FAILED!')
sys.exit(retcode)
if 'win32' in builder or 'win64' in builder:
command = ['cmake', '--build', '.', '--target', target_name, '--config', 'Release']
if 'win32' in builder:
command = ['msbuild', 'INSTALL.vcxproj', '/Property:PlatformToolset=v120_xp', '/p:Configuration=Release']
elif 'win64' in builder:
command = ['msbuild', 'INSTALL.vcxproj', '/p:Configuration=Release']
else:
command = target_chroot_prefix + ['make', '-s', '-j2', target_name]

View File

@@ -1,70 +0,0 @@
# - Find Alembic library
# Find the native Alembic includes and libraries
# This module defines
# ALEMBIC_INCLUDE_DIRS, where to find Alembic headers, Set when
# ALEMBIC_INCLUDE_DIR is found.
# ALEMBIC_LIBRARIES, libraries to link against to use Alembic.
# ALEMBIC_ROOT_DIR, The base directory to search for Alembic.
# This can also be an environment variable.
# ALEMBIC_FOUND, If false, do not try to use Alembic.
#
#=============================================================================
# Copyright 2016 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If ALEMBIC_ROOT_DIR was defined in the environment, use it.
IF(NOT ALEMBIC_ROOT_DIR AND NOT $ENV{ALEMBIC_ROOT_DIR} STREQUAL "")
SET(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
ENDIF()
SET(_alembic_SEARCH_DIRS
${ALEMBIC_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/alembic
)
FIND_PATH(ALEMBIC_INCLUDE_DIR
NAMES
Alembic/Abc/All.h
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(ALEMBIC_LIBRARY
NAMES
Alembic
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib lib/static
)
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
IF(ALEMBIC_FOUND)
SET(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY})
SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
ENDIF(ALEMBIC_FOUND)
MARK_AS_ADVANCED(
ALEMBIC_INCLUDE_DIR
ALEMBIC_LIBRARY
)
UNSET(_alembic_SEARCH_DIRS)

View File

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

View File

@@ -1,15 +1,15 @@
# - Find JACK library
# Find the native JACK includes and library
# - Find Jack library
# Find the native Jack includes and library
# This module defines
# JACK_INCLUDE_DIRS, where to find jack.h, Set when
# JACK_INCLUDE_DIR is found.
# JACK_LIBRARIES, libraries to link against to use JACK.
# JACK_ROOT_DIR, The base directory to search for JACK.
# JACK_LIBRARIES, libraries to link against to use Jack.
# JACK_ROOT_DIR, The base directory to search for Jack.
# This can also be an environment variable.
# JACK_FOUND, If false, do not try to use JACK.
# JACK_FOUND, If false, do not try to use Jack.
#
# also defined, but not for general use are
# JACK_LIBRARY, where to find the JACK library.
# JACK_LIBRARY, where to find the Jack library.
#=============================================================================
# Copyright 2011 Blender Foundation.

View File

@@ -23,7 +23,6 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
${CMAKE_SOURCE_DIR}/extern/glog/src
${CMAKE_SOURCE_DIR}/extern/gflags/src
${CMAKE_SOURCE_DIR}/extern/gtest/include
${CMAKE_SOURCE_DIR}/extern/gmock/include
)
unset(_current_include_directories)
@@ -34,7 +33,6 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
bf_testing_main
bf_intern_guardedalloc
extern_gtest
extern_gmock
# needed for glog
${PTHREADS_LIBRARIES}
extern_glog
@@ -45,7 +43,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}"
INCLUDE_DIRECTORIES "${TEST_INC}")
if(${DO_ADD_TEST})
add_test(NAME ${NAME}_test COMMAND ${TESTS_OUTPUT_DIR}/${NAME}_test WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>)
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
endif()
endif()
endmacro()

View File

@@ -27,12 +27,13 @@ if(EXISTS ${SOURCE_DIR}/.git)
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND git branch --list master blender-v* --contains ${MY_WC_HASH}
execute_process(COMMAND git branch --list master --contains ${MY_WC_HASH}
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE _git_contains_check
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _git_contains_check STREQUAL "")
STRING(REGEX REPLACE "^[ \t]+" "" _git_contains_check "${_git_contains_check}")
if(_git_contains_check STREQUAL "master")
set(MY_WC_BRANCH "master")
else()
execute_process(COMMAND git show-ref --tags -d
@@ -47,22 +48,6 @@ if(EXISTS ${SOURCE_DIR}/.git)
if(_git_tag_hashes MATCHES "${_git_head_hash}")
set(MY_WC_BRANCH "master")
else()
execute_process(COMMAND git branch --contains ${MY_WC_HASH}
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE _git_contains_branches
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^\\*[ \t]+" "" _git_contains_branches "${_git_contains_branches}")
string(REGEX REPLACE "[\r\n]+" ";" _git_contains_branches "${_git_contains_branches}")
string(REGEX REPLACE ";[ \t]+" ";" _git_contains_branches "${_git_contains_branches}")
foreach(_branch ${_git_contains_branches})
if (NOT "${_branch}" MATCHES "\\(HEAD.*")
set(MY_WC_BRANCH "${_branch}")
break()
endif()
endforeach()
unset(_branch)
unset(_git_contains_branches)
endif()
unset(_git_tag_hashes)

View File

@@ -239,8 +239,8 @@ def file_check_arg_sizes(tu):
if 0:
print("---",
" <~> ".join(
[" ".join([t.spelling for t in C.get_tokens()])
for C in node.get_children()]
[" ".join([t.spelling for t in C.get_tokens()])
for C in node.get_children()]
))
# print(node.location)

View File

@@ -29,11 +29,11 @@ if not sys.version.startswith("3"):
sys.exit(1)
from cmake_consistency_check_config import (
IGNORE,
UTF8_CHECK,
SOURCE_DIR,
BUILD_DIR,
)
IGNORE,
UTF8_CHECK,
SOURCE_DIR,
BUILD_DIR,
)
import os

View File

@@ -31,7 +31,7 @@ IGNORE = (
"extern/carve/patches/files/random.h",
"intern/audaspace/SRC/AUD_SRCResampleFactory.h",
"intern/audaspace/SRC/AUD_SRCResampleReader.h",
)
)
UTF8_CHECK = True

View File

@@ -37,19 +37,19 @@ if not project_info.init(sys.argv[-1]):
sys.exit(1)
from project_info import (
SIMPLE_PROJECTFILE,
SOURCE_DIR,
CMAKE_DIR,
PROJECT_DIR,
source_list,
is_project_file,
is_c_header,
# is_py,
cmake_advanced_info,
cmake_compiler_defines,
cmake_cache_var,
project_name_get,
)
SIMPLE_PROJECTFILE,
SOURCE_DIR,
CMAKE_DIR,
PROJECT_DIR,
source_list,
is_project_file,
is_c_header,
# is_py,
cmake_advanced_info,
cmake_compiler_defines,
cmake_cache_var,
project_name_get,
)
import os

View File

@@ -43,17 +43,17 @@ def quote_define(define):
def create_qtc_project_main(name):
from project_info import (
SIMPLE_PROJECTFILE,
SOURCE_DIR,
# CMAKE_DIR,
PROJECT_DIR,
source_list,
is_project_file,
is_c_header,
cmake_advanced_info,
cmake_compiler_defines,
project_name_get,
)
SIMPLE_PROJECTFILE,
SOURCE_DIR,
# CMAKE_DIR,
PROJECT_DIR,
source_list,
is_project_file,
is_c_header,
cmake_advanced_info,
cmake_compiler_defines,
project_name_get,
)
files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
@@ -69,7 +69,7 @@ def create_qtc_project_main(name):
with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') as f:
f.write("\n".join(sorted(list(set(os.path.dirname(f)
for f in files_rel if is_c_header(f))))))
for f in files_rel if is_c_header(f))))))
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
with open(qtc_prj, 'w') as f:
@@ -87,7 +87,7 @@ def create_qtc_project_main(name):
# for some reason it doesnt give all internal includes
includes = list(set(includes) | set(os.path.dirname(f)
for f in files_rel if is_c_header(f)))
for f in files_rel if is_c_header(f)))
includes.sort()
# be tricky, get the project name from CMake if we can!
@@ -125,13 +125,13 @@ def create_qtc_project_main(name):
def create_qtc_project_python(name):
from project_info import (
SOURCE_DIR,
# CMAKE_DIR,
PROJECT_DIR,
source_list,
is_py,
project_name_get,
)
SOURCE_DIR,
# CMAKE_DIR,
PROJECT_DIR,
source_list,
is_py,
project_name_get,
)
files = list(source_list(SOURCE_DIR, filename_check=is_py))
files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
@@ -161,24 +161,24 @@ def argparse_create():
import argparse
parser = argparse.ArgumentParser(
description="This script generates Qt Creator project files for Blender",
)
description="This script generates Qt Creator project files for Blender",
)
parser.add_argument(
"-n", "--name",
dest="name",
metavar='NAME', type=str,
help="Override default project name (\"Blender\")",
required=False,
)
"-n", "--name",
dest="name",
metavar='NAME', type=str,
help="Override default project name (\"Blender\")",
required=False,
)
parser.add_argument(
"-b", "--build-dir",
dest="build_dir",
metavar='BUILD_DIR', type=str,
help="Specify the build path (or fallback to the $PWD)",
required=False,
)
"-b", "--build-dir",
dest="build_dir",
metavar='BUILD_DIR', type=str,
help="Specify the build path (or fallback to the $PWD)",
required=False,
)
return parser

View File

@@ -32,7 +32,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "python2"
@@ -42,7 +42,7 @@ CHECKER_ARGS = [
"-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"),
# stupid but needed
"-Dbool=char"
]
]
def main():

View File

@@ -32,7 +32,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "cppcheck"
@@ -43,7 +43,7 @@ CHECKER_ARGS = [
"--max-configs=1", # speeds up execution
# "--check-config", # when includes are missing
"--enable=all", # if you want sixty hundred pedantic suggestions
]
]
if USE_QUIET:
CHECKER_ARGS.append("--quiet")

View File

@@ -25,13 +25,13 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "smatch"
CHECKER_ARGS = [
"--full-path",
"--two-passes",
]
]
import project_source_info
import subprocess

View File

@@ -25,11 +25,11 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "sparse"
CHECKER_ARGS = [
]
]
import project_source_info
import subprocess

View File

@@ -25,7 +25,7 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "splint"
@@ -61,7 +61,7 @@ CHECKER_ARGS = [
# dummy, witjout this splint complains with:
# /usr/include/bits/confname.h:31:27: *** Internal Bug at cscannerHelp.c:2428: Unexpanded macro not function or constant: int _PC_MAX_CANON
"-D_PC_MAX_CANON=0",
]
]
import project_source_info

View File

@@ -4,7 +4,6 @@
# cmake -C../blender/build_files/cmake/config/blender_full.cmake ../blender
#
set(WITH_ALEMBIC ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO ON CACHE BOOL "" FORCE)
set(WITH_BULLET ON CACHE BOOL "" FORCE)
set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
@@ -12,7 +11,6 @@ set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)

View File

@@ -8,7 +8,6 @@
set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
set(WITH_SYSTEM_GLEW ON CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
set(WITH_CODEC_AVI OFF CACHE BOOL "" FORCE)
@@ -16,7 +15,6 @@ set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
@@ -49,7 +47,6 @@ set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)

View File

@@ -1,79 +0,0 @@
# Turn everything ON thats expected for an official release builds.
#
# Example usage:
# cmake -C../blender/build_files/cmake/config/blender_release.cmake ../blender
#
set(WITH_ALEMBIC ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO ON CACHE BOOL "" FORCE)
set(WITH_BULLET ON CACHE BOOL "" FORCE)
set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE ON CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
set(WITH_GHOST_XDND ON CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_FRAMESERVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_LZMA ON CACHE BOOL "" FORCE)
set(WITH_LZO ON CACHE BOOL "" FORCE)
set(WITH_MOD_BOOLEAN ON CACHE BOOL "" FORCE)
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
set(WITH_MOD_SMOKE ON CACHE BOOL "" FORCE)
set(WITH_MOD_OCEANSIM ON CACHE BOOL "" FORCE)
set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
set(WITH_OPENMP ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)
set(WITH_RAYOPTIMIZATION ON CACHE BOOL "" FORCE)
set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
set(WITH_PLAYER ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
set(CYCLES_CUDA_BINARIES_ARCH sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61 CACHE STRING "" FORCE)
# platform dependent options
if(UNIX AND NOT APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif(WIN32)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
if(NOT CMAKE_COMPILER_IS_GNUCC)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
else()
# MinGW exceptions
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
endif()
elseif(APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
endif()

View File

@@ -32,4 +32,3 @@ set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)

View File

@@ -74,7 +74,7 @@ def main():
"rebuild_cache",
"depend",
"cmake_check_build_system",
])
])
targets -= set(bad)

View File

@@ -333,11 +333,6 @@ function(SETUP_LIBDIRS)
link_directories(${LLVM_LIBPATH})
endif()
if(WITH_ALEMBIC)
link_directories(${ALEMBIC_LIBPATH})
link_directories(${HDF5_LIBPATH})
endif()
if(WIN32 AND NOT UNIX)
link_directories(${PTHREADS_LIBPATH})
endif()
@@ -359,6 +354,7 @@ function(setup_liblinks
target_link_libraries(
${target}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${FREETYPE_LIBRARY}
)
@@ -415,8 +411,15 @@ function(setup_liblinks
if(WITH_OPENCOLORIO)
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
if(WITH_OPENSUBDIV)
if(WIN32 AND NOT UNIX)
file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d")
target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}")
target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}")
unset(OPENSUBDIV_LIBRARIES_DEBUG)
else()
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
endif()
if(WITH_OPENVDB)
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES})
@@ -431,9 +434,6 @@ function(setup_liblinks
endif()
endif()
target_link_libraries(${target} ${JPEG_LIBRARIES})
if(WITH_ALEMBIC)
target_link_libraries(${target} ${ALEMBIC_LIBRARIES} ${HDF5_LIBRARIES})
endif()
if(WITH_IMAGE_OPENEXR)
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
endif()
@@ -502,17 +502,11 @@ function(setup_liblinks
endif()
endif()
target_link_libraries(
${target}
${ZLIB_LIBRARIES}
)
#system libraries with no dependencies such as platform link libs or opengl should go last
target_link_libraries(${target}
${BLENDER_GL_LIBRARIES})
#target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
target_link_libraries(${target} ${PLATFORM_LINKLIBS})
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
endfunction()
@@ -566,7 +560,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_space_userpref
bf_editor_space_view3d
bf_editor_space_clip
bf_editor_space_collections
bf_editor_transform
bf_editor_util
@@ -598,7 +591,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_modifiers
bf_bmesh
bf_gpu
bf_draw
bf_blenloader
bf_blenkernel
bf_physics
@@ -615,7 +607,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_imbuf_openimageio
bf_imbuf_dds
bf_collada
bf_alembic
bf_intern_elbeem
bf_intern_memutil
bf_intern_guardedalloc
@@ -741,7 +732,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
if(WITH_OPENSUBDIV)
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
endif()
@@ -1574,26 +1565,3 @@ macro(openmp_delayload
endif(WITH_OPENMP)
endif(MSVC)
endmacro()
MACRO(WINDOWS_SIGN_TARGET target)
if (WITH_WINDOWS_CODESIGN)
if (!SIGNTOOL_EXE)
error("Codesigning is enabled, but signtool is not found")
else()
if (WINDOWS_CODESIGN_PFX_PASSWORD)
set(CODESIGNPASSWORD /p ${WINDOWS_CODESIGN_PFX_PASSWORD})
else()
if ($ENV{PFXPASSWORD})
set(CODESIGNPASSWORD /p $ENV{PFXPASSWORD})
else()
message( FATAL_ERROR "WITH_WINDOWS_CODESIGN is on but WINDOWS_CODESIGN_PFX_PASSWORD not set, and environment variable PFXPASSWORD not found, unable to sign code.")
endif()
endif()
add_custom_command(TARGET ${target}
POST_BUILD
COMMAND ${SIGNTOOL_EXE} sign /f ${WINDOWS_CODESIGN_PFX} ${CODESIGNPASSWORD} $<TARGET_FILE:${target}>
VERBATIM
)
endif()
endif()
ENDMACRO()

View File

@@ -38,21 +38,7 @@ unset(MY_WC_HASH)
# Force Package Name
execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE CPACK_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
if (MSVC)
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(PACKAGE_ARCH windows64)
else()
set(PACKAGE_ARCH windows32)
endif()
else(MSVC)
set(PACKAGE_ARCH ${CMAKE_SYSTEM_PROCESSOR})
endif()
if (CPACK_OVERRIDE_PACKAGENAME)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_OVERRIDE_PACKAGENAME}-${PACKAGE_ARCH})
else()
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${PACKAGE_ARCH})
endif()
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${CMAKE_SYSTEM_PROCESSOR})
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
# RPM packages
@@ -97,8 +83,6 @@ if(WIN32)
endif()
set(CPACK_PACKAGE_EXECUTABLES "blender" "blender")
set(CPACK_CREATE_DESKTOP_LINKS "blender" "blender")
include(CPack)
# Target for build_archive.py script, to automatically pass along

View File

@@ -1,468 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Apple.
if(NOT DEFINED LIBDIR)
if(WITH_CXX11)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
else()
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
endif()
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
endif()
if(WITH_OPENAL)
find_package(OpenAL)
if(OPENAL_FOUND)
set(WITH_OPENAL ON)
set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
else()
set(WITH_OPENAL OFF)
endif()
endif()
if(WITH_ALEMBIC)
set(ALEMBIC ${LIBDIR}/alembic)
set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
set(ALEMBIC_LIBRARIES Alembic)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
set(OPENSUBDIV ${LIBDIR}/opensubdiv)
set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
find_library(OSD_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
find_library(OSD_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
list(APPEND OPENSUBDIV_LIBRARIES ${OSD_LIB_CPU} ${OSD_LIB_GPU})
endif()
if(WITH_JACK)
find_library(JACK_FRAMEWORK
NAMES jackmp
)
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
if(NOT JACK_FRAMEWORK)
set(WITH_JACK OFF)
endif()
endif()
if(WITH_CODEC_SNDFILE)
set(SNDFILE ${LIBDIR}/sndfile)
set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
set(SNDFILE_LIBPATH ${SNDFILE}/lib ${LIBDIR}/ffmpeg/lib) # TODO, deprecate
endif()
if(WITH_PYTHON)
# we use precompiled libraries for py 3.5 and up by default
set(PYTHON_VERSION 3.5)
if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
# normally cached but not since we include them with blender
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}m")
set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
else()
# module must be compiled against Python framework
set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}")
set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}m")
set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}m")
set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
#set(PYTHON_LIBRARY python${PYTHON_VERSION})
#set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python") # won't build with this enabled
unset(_py_framework)
endif()
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
if(NOT EXISTS "${PYTHON_EXECUTABLE}")
message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
endif()
endif()
if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
set(FFTW3_LIBRARIES fftw3)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif()
set(PNG_LIBRARIES png)
set(JPEG_LIBRARIES jpeg)
set(ZLIB /usr)
set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
set(ZLIB_LIBRARIES z bz2)
set(FREETYPE ${LIBDIR}/freetype)
set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
set(FREETYPE_LIBPATH ${FREETYPE}/lib)
set(FREETYPE_LIBRARY freetype)
if(WITH_IMAGE_OPENEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
if(WITH_CXX11)
set(OPENEXR_POSTFIX -2_2)
else()
set(OPENEXR_POSTFIX)
endif()
set(OPENEXR_LIBRARIES
Iex${OPENEXR_POSTFIX}
Half
IlmImf${OPENEXR_POSTFIX}
Imath${OPENEXR_POSTFIX}
IlmThread${OPENEXR_POSTFIX})
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
endif()
if(WITH_CODEC_FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg)
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
set(FFMPEG_LIBRARIES
avcodec avdevice avformat avutil
mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg
)
if(WITH_CXX11)
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} schroedinger orc vpx webp swresample)
endif()
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif()
if(WITH_OPENJPEG OR WITH_CODEC_FFMPEG)
# use openjpeg from libdir that is linked into ffmpeg
if(WITH_CXX11)
set(OPENJPEG ${LIBDIR}/openjpeg)
set(WITH_SYSTEM_OPENJPEG ON)
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include)
set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/libopenjpeg.a)
endif()
endif()
find_library(SYSTEMSTUBS_LIBRARY
NAMES
SystemStubs
PATHS
)
mark_as_advanced(SYSTEMSTUBS_LIBRARY)
if(SYSTEMSTUBS_LIBRARY)
list(APPEND PLATFORM_LINKLIBS SystemStubs)
endif()
set(PLATFORM_CFLAGS "-pipe -funsigned-char")
set(PLATFORM_LINKFLAGS
"-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio"
)
if(WITH_CODEC_QUICKTIME)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
# libSDL still needs 32bit carbon quicktime
endif()
endif()
if(WITH_CXX11)
list(APPEND PLATFORM_LINKLIBS c++)
else()
list(APPEND PLATFORM_LINKLIBS stdc++)
endif()
if(WITH_JACK)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
endif()
if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
# force cmake to link right framework
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
endif()
if(WITH_OPENCOLLADA)
set(OPENCOLLADA ${LIBDIR}/opencollada)
set(OPENCOLLADA_INCLUDE_DIRS
${LIBDIR}/opencollada/include/COLLADAStreamWriter
${LIBDIR}/opencollada/include/COLLADABaseUtils
${LIBDIR}/opencollada/include/COLLADAFramework
${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
${LIBDIR}/opencollada/include/GeneratedSaxParser
)
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
set(OPENCOLLADA_LIBRARIES
OpenCOLLADASaxFrameworkLoader
-lOpenCOLLADAFramework
-lOpenCOLLADABaseUtils
-lOpenCOLLADAStreamWriter
-lMathMLSolver
-lGeneratedSaxParser
-lxml2 -lbuffer -lftoa
)
# Use UTF functions from collada if LLVM is not enabled
if(NOT WITH_LLVM)
list(APPEND OPENCOLLADA_LIBRARIES -lUTF)
endif()
# pcre is bundled with openCollada
#set(PCRE ${LIBDIR}/pcre)
#set(PCRE_LIBPATH ${PCRE}/lib)
set(PCRE_LIBRARIES pcre)
#libxml2 is used
#set(EXPAT ${LIBDIR}/expat)
#set(EXPAT_LIBPATH ${EXPAT}/lib)
set(EXPAT_LIB)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBRARY SDL2)
set(SDL_LIBPATH ${SDL}/lib)
if(WITH_CXX11)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
else()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lazy_framework ForceFeedback")
endif()
endif()
set(PNG "${LIBDIR}/png")
set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib)
set(JPEG "${LIBDIR}/jpeg")
set(JPEG_INCLUDE_DIR "${JPEG}/include")
set(JPEG_LIBPATH ${JPEG}/lib)
if(WITH_IMAGE_TIFF)
set(TIFF ${LIBDIR}/tiff)
set(TIFF_INCLUDE_DIR ${TIFF}/include)
set(TIFF_LIBRARY tiff)
set(TIFF_LIBPATH ${TIFF}/lib)
endif()
if(WITH_BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
if(WITH_CXX11)
set(BOOST_POSTFIX)
else()
set(BOOST_POSTFIX -mt)
endif()
set(BOOST_LIBRARIES
boost_date_time${BOOST_POSTFIX}
boost_filesystem${BOOST_POSTFIX}
boost_regex${BOOST_POSTFIX}
boost_system${BOOST_POSTFIX}
boost_thread${BOOST_POSTFIX}
boost_wave${BOOST_POSTFIX}
)
if(WITH_INTERNATIONAL)
list(APPEND BOOST_LIBRARIES boost_locale${BOOST_POSTFIX})
endif()
if(WITH_CYCLES_NETWORK)
list(APPEND BOOST_LIBRARIES boost_serialization${BOOST_POSTFIX})
endif()
if(WITH_OPENVDB)
list(APPEND BOOST_LIBRARIES boost_iostreams${BOOST_POSTFIX})
endif()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_DEFINITIONS)
endif()
if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale and ffmpeg needs it !
endif()
if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
set(OPENIMAGEIO_LIBRARIES
${OPENIMAGEIO}/lib/libOpenImageIO.a
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${TIFF_LIBRARY}
${OPENEXR_LIBRARIES}
${ZLIB_LIBRARIES}
)
if(WITH_CXX11)
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${LIBDIR}/ffmpeg/lib/libwebp.a)
endif()
set(OPENIMAGEIO_LIBPATH
${OPENIMAGEIO}/lib
${JPEG_LIBPATH}
${PNG_LIBPATH}
${TIFF_LIBPATH}
${OPENEXR_LIBPATH}
${ZLIB_LIBPATH}
)
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
endif()
if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openvdb)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(TBB_INCLUDE_DIRS ${LIBDIR}/tbb/include)
set(TBB_LIBRARIES ${LIBDIR}/tbb/lib/libtbb.a)
set(OPENVDB_LIBRARIES openvdb blosc ${TBB_LIBRARIES})
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
set(OPENVDB_DEFINITIONS)
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config")
else()
set(LLVM_CONFIG llvm-config)
endif()
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIBPATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_library(LLVM_LIBRARY
NAMES LLVMAnalysis # first of a whole bunch of libs to get
PATHS ${LLVM_LIBPATH})
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
if(LLVM_STATIC)
# if static LLVM libraries were requested, use llvm-config to generate
# the list of what libraries we need, and substitute that in the right
# way for LLVM_LIBRARY.
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
OUTPUT_VARIABLE LLVM_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
else()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4")
endif()
else()
message(FATAL_ERROR "LLVM not found.")
endif()
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
# WARNING! depends on correct order of OSL libs linking
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE)
else()
message(STATUS "OSL not found")
set(WITH_CYCLES_OSL OFF)
endif()
endif()
if(WITH_OPENMP)
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VENDOR)
string(SUBSTRING "${COMPILER_VENDOR}" 0 5 VENDOR_NAME) # truncate output
if(${VENDOR_NAME} MATCHES "Apple") # Apple does not support OpenMP reliable with gcc and not with clang
set(WITH_OPENMP OFF)
else() # vanilla gcc or clang_omp support OpenMP
message(STATUS "Using special OpenMP enabled compiler !") # letting find_package(OpenMP) module work for gcc
if(CMAKE_C_COMPILER_ID MATCHES "Clang") # clang-omp in darwin libs
set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "C compiler flags for OpenMP parallization" FORCE)
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE)
include_directories(${LIBDIR}/openmp/include)
link_directories(${LIBDIR}/openmp/lib)
# This is a workaround for our helperbinaries ( datatoc, masgfmt, ... ),
# They are linked also to omp lib, so we need it in builddir for runtime exexcution,
# TODO: remove all unneeded dependencies from these
# for intermediate binaries, in respect to lib ID
execute_process(
COMMAND ditto -arch ${CMAKE_OSX_ARCHITECTURES}
${LIBDIR}/openmp/lib/libiomp5.dylib
${CMAKE_BINARY_DIR}/Resources/lib/libiomp5.dylib)
endif()
endif()
endif()
set(EXETYPE MACOSX_BUNDLE)
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
endif()
else()
set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
endif()
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
endif()
# Get rid of eventually clashes, we export some symbols explicite as local
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker ${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map"
)
if(WITH_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
endif()
# Suppress ranlib "has no symbols" warnings (workaround for T48250)
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")

View File

@@ -1,428 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for any *nix system including Linux and Unix.
macro(find_package_wrapper)
if(WITH_STATIC_LIBS)
find_package_static(${ARGV})
else()
find_package(${ARGV})
endif()
endmacro()
find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Freetype REQUIRED)
if(WITH_LZO AND WITH_SYSTEM_LZO)
find_package_wrapper(LZO)
if(NOT LZO_FOUND)
message(FATAL_ERROR "Failed finding system LZO version!")
endif()
endif()
if(WITH_SYSTEM_EIGEN3)
find_package_wrapper(Eigen3)
if(NOT EIGEN3_FOUND)
message(FATAL_ERROR "Failed finding system Eigen3 version!")
endif()
endif()
# else values are set below for all platforms
if(WITH_PYTHON)
# No way to set py35, remove for now.
# find_package(PythonLibs)
# Use our own instead, since without py is such a rare case,
# require this package
# XXX Linking errors with debian static python :/
# find_package_wrapper(PythonLibsUnix REQUIRED)
find_package(PythonLibsUnix REQUIRED)
endif()
if(WITH_IMAGE_OPENEXR)
find_package_wrapper(OpenEXR) # our own module
if(NOT OPENEXR_FOUND)
set(WITH_IMAGE_OPENEXR OFF)
endif()
endif()
if(WITH_IMAGE_OPENJPEG)
find_package_wrapper(OpenJPEG)
if(NOT OPENJPEG_FOUND)
set(WITH_IMAGE_OPENJPEG OFF)
endif()
endif()
if(WITH_IMAGE_TIFF)
# XXX Linking errors with debian static tiff :/
# find_package_wrapper(TIFF)
find_package(TIFF)
if(NOT TIFF_FOUND)
set(WITH_IMAGE_TIFF OFF)
endif()
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
find_package_wrapper(Audaspace)
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
message(FATAL_ERROR "Audaspace external library not found!")
endif()
endif()
if(WITH_OPENAL)
find_package_wrapper(OpenAL)
if(NOT OPENAL_FOUND)
set(WITH_OPENAL OFF)
endif()
endif()
if(WITH_SDL)
if(WITH_SDL_DYNLOAD)
set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2")
set(SDL_LIBRARY)
else()
find_package_wrapper(SDL2)
if(SDL2_FOUND)
# Use same names for both versions of SDL until we move to 2.x.
set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}")
set(SDL_LIBRARY "${SDL2_LIBRARY}")
set(SDL_FOUND "${SDL2_FOUND}")
else()
find_package_wrapper(SDL)
endif()
mark_as_advanced(
SDL_INCLUDE_DIR
SDL_LIBRARY
)
# unset(SDLMAIN_LIBRARY CACHE)
if(NOT SDL_FOUND)
set(WITH_SDL OFF)
endif()
endif()
endif()
if(WITH_JACK)
find_package_wrapper(Jack)
if(NOT JACK_FOUND)
set(WITH_JACK OFF)
endif()
endif()
# Codecs
if(WITH_CODEC_SNDFILE)
find_package_wrapper(SndFile)
if(NOT SNDFILE_FOUND)
set(WITH_CODEC_SNDFILE OFF)
endif()
endif()
if(WITH_CODEC_FFMPEG)
set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
mark_as_advanced(FFMPEG)
# lame, but until we have proper find module for ffmpeg
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
if(EXISTS "${FFMPEG}/include/ffmpeg/")
list(APPEND FFMPEG_INCLUDE_DIRS "${FFMPEG}/include/ffmpeg")
endif()
# end lameness
mark_as_advanced(FFMPEG_LIBRARIES)
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif()
if(WITH_FFTW3)
find_package_wrapper(Fftw3)
if(NOT FFTW3_FOUND)
set(WITH_FFTW3 OFF)
endif()
endif()
if(WITH_OPENCOLLADA)
find_package_wrapper(OpenCOLLADA)
if(OPENCOLLADA_FOUND)
find_package_wrapper(XML2)
find_package_wrapper(PCRE)
else()
set(WITH_OPENCOLLADA OFF)
endif()
endif()
if(WITH_MEM_JEMALLOC)
find_package_wrapper(JeMalloc)
if(NOT JEMALLOC_FOUND)
set(WITH_MEM_JEMALLOC OFF)
endif()
endif()
if(WITH_INPUT_NDOF)
find_package_wrapper(Spacenav)
if(SPACENAV_FOUND)
# use generic names within blenders buildsystem.
set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
else()
set(WITH_INPUT_NDOF OFF)
endif()
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
if(NOT OSL_ROOT)
set(OSL_ROOT ${CYCLES_OSL})
endif()
find_package_wrapper(OpenShadingLanguage)
if(OSL_FOUND)
if(${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6")
# Note: --whole-archive is needed to force loading of all symbols in liboslexec,
# otherwise LLVM is missing the osl_allocate_closure_component function
set(OSL_LIBRARIES
${OSL_OSLCOMP_LIBRARY}
-Wl,--whole-archive ${OSL_OSLEXEC_LIBRARY}
-Wl,--no-whole-archive ${OSL_OSLQUERY_LIBRARY}
)
endif()
else()
message(STATUS "OSL not found, disabling it from Cycles")
set(WITH_CYCLES_OSL OFF)
endif()
endif()
if(WITH_OPENVDB)
find_package_wrapper(OpenVDB)
find_package_wrapper(TBB)
if(NOT OPENVDB_FOUND OR NOT TBB_FOUND)
set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "OpenVDB not found, disabling it")
endif()
endif()
if(WITH_ALEMBIC)
find_package_wrapper(Alembic)
if(WITH_ALEMBIC_HDF5)
set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
find_package_wrapper(HDF5)
endif()
if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
set(WITH_ALEMBIC OFF)
set(WITH_ALEMBIC_HDF5 OFF)
endif()
endif()
if(WITH_BOOST)
# uses in build instructions to override include and library variables
if(NOT BOOST_CUSTOM)
if(WITH_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
set(Boost_USE_MULTITHREADED ON)
set(__boost_packages filesystem regex thread date_time)
if(WITH_CYCLES_OSL)
if(NOT (${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6"))
list(APPEND __boost_packages wave)
else()
endif()
endif()
if(WITH_INTERNATIONAL)
list(APPEND __boost_packages locale)
endif()
if(WITH_CYCLES_NETWORK)
list(APPEND __boost_packages serialization)
endif()
if(WITH_OPENVDB)
list(APPEND __boost_packages iostreams)
endif()
list(APPEND __boost_packages system)
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
if(NOT Boost_FOUND)
# try to find non-multithreaded if -mt not found, this flag
# doesn't matter for us, it has nothing to do with thread
# safety, but keep it to not disturb build setups
set(Boost_USE_MULTITHREADED OFF)
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
endif()
unset(__boost_packages)
if(Boost_USE_STATIC_LIBS AND WITH_BOOST_ICU)
find_package(IcuLinux)
endif()
mark_as_advanced(Boost_DIR) # why doesnt boost do this?
endif()
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
if(WITH_OPENIMAGEIO)
find_package_wrapper(OpenImageIO)
if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE)
find_package_wrapper(PugiXML)
else()
set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
set(PUGIXML_LIBRARIES "")
endif()
set(OPENIMAGEIO_LIBRARIES
${OPENIMAGEIO_LIBRARIES}
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${ZLIB_LIBRARIES}
${BOOST_LIBRARIES}
)
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
set(OPENIMAGEIO_DEFINITIONS "")
if(WITH_IMAGE_TIFF)
list(APPEND OPENIMAGEIO_LIBRARIES "${TIFF_LIBRARY}")
endif()
if(WITH_IMAGE_OPENEXR)
list(APPEND OPENIMAGEIO_LIBRARIES "${OPENEXR_LIBRARIES}")
endif()
if(NOT OPENIMAGEIO_FOUND)
set(WITH_OPENIMAGEIO OFF)
message(STATUS "OpenImageIO not found, disabling WITH_CYCLES")
endif()
endif()
if(WITH_OPENCOLORIO)
find_package_wrapper(OpenColorIO)
set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
set(OPENCOLORIO_DEFINITIONS)
if(NOT OPENCOLORIO_FOUND)
set(WITH_OPENCOLORIO OFF)
message(STATUS "OpenColorIO not found")
endif()
endif()
if(WITH_LLVM)
find_package_wrapper(LLVM)
if(NOT LLVM_FOUND)
set(WITH_LLVM OFF)
message(STATUS "LLVM not found")
endif()
endif()
if(WITH_LLVM OR WITH_SDL_DYNLOAD)
# Fix for conflict with Mesa llvmpipe
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'"
)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
find_package_wrapper(OpenSubdiv)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
set(OPENSUBDIV_LIBPATH) # TODO, remove and reference the absolute path everywhere
if(NOT OPENSUBDIV_FOUND)
set(WITH_OPENSUBDIV OFF)
set(WITH_CYCLES_OPENSUBDIV OFF)
message(STATUS "OpenSubdiv not found")
endif()
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
find_package(Threads REQUIRED)
list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT})
# used by other platforms
set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
if(CMAKE_DL_LIBS)
list(APPEND PLATFORM_LINKLIBS ${CMAKE_DL_LIBS})
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(NOT WITH_PYTHON_MODULE)
# binreloc is linux only
set(BINRELOC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/binreloc/include)
set(WITH_BINRELOC ON)
endif()
endif()
# lfs on glibc, all compilers should use
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
# GNU Compiler
if(CMAKE_COMPILER_IS_GNUCC)
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
if(WITH_LINKER_GOLD)
execute_process(
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
else()
message(STATUS "GNU gold linker isn't available, using the default system linker.")
endif()
unset(LD_VERSION)
endif()
# CLang is the same as GCC for now.
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
# Solaris CC
elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro")
set(PLATFORM_CFLAGS "-pipe -features=extensions -fPIC -D__FUNCTION__=__func__")
# Intel C++ Compiler
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
# think these next two are broken
find_program(XIAR xiar)
if(XIAR)
set(CMAKE_AR "${XIAR}")
endif()
mark_as_advanced(XIAR)
find_program(XILD xild)
if(XILD)
set(CMAKE_LINKER "${XILD}")
endif()
mark_as_advanced(XILD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
# set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
endif()

View File

@@ -1,87 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Windows.
add_definitions(-DWIN32)
if(MSVC)
include(platform_win32_msvc)
elseif(CMAKE_COMPILER_IS_GNUCC)
include(platform_win32_mingw)
endif()
# Things common to both mingw and MSVC should go here
set(WINTAB_INC ${LIBDIR}/wintab/include)
if(WITH_OPENAL)
set(OPENAL ${LIBDIR}/openal)
set(OPENALDIR ${LIBDIR}/openal)
set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
if(MSVC)
set(OPENAL_LIBRARY openal32)
else()
set(OPENAL_LIBRARY wrap_oal)
endif()
set(OPENAL_LIBPATH ${OPENAL}/lib)
endif()
if(WITH_CODEC_SNDFILE)
set(SNDFILE ${LIBDIR}/sndfile)
set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
set(SNDFILE_LIBRARIES libsndfile-1)
set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
endif()
if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
add_definitions(-D__SSE__ -D__MMX__)
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_EXEC_DEBUG NAMES oslexec_d PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP_DEBUG NAMES oslcomp_d PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY_DEBUG NAMES oslquery_d PATHS ${CYCLES_OSL}/lib)
list(APPEND OSL_LIBRARIES
optimized ${OSL_LIB_COMP}
optimized ${OSL_LIB_EXEC}
optimized ${OSL_LIB_QUERY}
debug ${OSL_LIB_EXEC_DEBUG}
debug ${OSL_LIB_COMP_DEBUG}
debug ${OSL_LIB_QUERY_DEBUG}
)
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE)
else()
message(STATUS "OSL not found")
set(WITH_CYCLES_OSL OFF)
endif()
endif()

View File

@@ -1,302 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Windows when compiling with MinGW.
# keep GCC specific stuff here
include(CheckCSourceCompiles)
# Setup 64bit and 64bit windows systems
CHECK_C_SOURCE_COMPILES("
#ifndef __MINGW64__
#error
#endif
int main(void) { return 0; }
"
WITH_MINGW64
)
if(NOT DEFINED LIBDIR)
if(WITH_MINGW64)
message(STATUS "Compiling for 64 bit with MinGW-w64.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
else()
message(STATUS "Compiling for 32 bit with MinGW-w32.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
if(WITH_RAYOPTIMIZATION)
message(WARNING "MinGW-w32 is known to be unstable with 'WITH_RAYOPTIMIZATION' option enabled.")
endif()
endif()
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
endif()
list(APPEND PLATFORM_LINKLIBS
-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32
-lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -ldbghelp
)
if(WITH_INPUT_IME)
list(APPEND PLATFORM_LINKLIBS -limm32)
endif()
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
if(WITH_MINGW64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
list(APPEND PLATFORM_LINKLIBS -lpthread)
add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
endif()
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
add_definitions(-DFREE_WINDOWS)
set(PNG "${LIBDIR}/png")
set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
if(WITH_MINGW64)
set(JPEG_LIBRARIES jpeg)
else()
set(JPEG_LIBRARIES libjpeg)
endif()
set(PNG_LIBRARIES png)
set(ZLIB ${LIBDIR}/zlib)
set(ZLIB_INCLUDE_DIRS ${ZLIB}/include)
set(ZLIB_LIBPATH ${ZLIB}/lib)
set(ZLIB_LIBRARIES z)
set(JPEG "${LIBDIR}/jpeg")
set(JPEG_INCLUDE_DIR "${JPEG}/include")
set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
# comes with own pthread library
if(NOT WITH_MINGW64)
set(PTHREADS ${LIBDIR}/pthreads)
#set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
set(PTHREADS_LIBPATH ${PTHREADS}/lib)
set(PTHREADS_LIBRARIES pthreadGC2)
endif()
set(FREETYPE ${LIBDIR}/freetype)
set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
set(FREETYPE_LIBPATH ${FREETYPE}/lib)
set(FREETYPE_LIBRARY freetype)
if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_LIBRARIES fftw3)
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif()
if(WITH_OPENCOLLADA)
set(OPENCOLLADA ${LIBDIR}/opencollada)
set(OPENCOLLADA_INCLUDE_DIRS
${OPENCOLLADA}/include/opencollada/COLLADAStreamWriter
${OPENCOLLADA}/include/opencollada/COLLADABaseUtils
${OPENCOLLADA}/include/opencollada/COLLADAFramework
${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
)
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib/opencollada)
set(OPENCOLLADA_LIBRARIES
OpenCOLLADAStreamWriter
OpenCOLLADASaxFrameworkLoader
OpenCOLLADAFramework
OpenCOLLADABaseUtils
GeneratedSaxParser
UTF MathMLSolver buffer ftoa xml
)
set(PCRE_LIBRARIES pcre)
endif()
if(WITH_CODEC_FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg)
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
if(WITH_MINGW64)
set(FFMPEG_LIBRARIES avcodec.dll avformat.dll avdevice.dll avutil.dll swscale.dll swresample.dll)
else()
set(FFMPEG_LIBRARIES avcodec-55 avformat-55 avdevice-55 avutil-52 swscale-2)
endif()
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif()
if(WITH_IMAGE_OPENEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
endif()
if(WITH_IMAGE_TIFF)
set(TIFF ${LIBDIR}/tiff)
set(TIFF_LIBRARY tiff)
set(TIFF_INCLUDE_DIR ${TIFF}/include)
set(TIFF_LIBPATH ${TIFF}/lib)
endif()
if(WITH_JACK)
set(JACK ${LIBDIR}/jack)
set(JACK_INCLUDE_DIRS ${JACK}/include/jack ${JACK}/include)
set(JACK_LIBRARIES jack)
set(JACK_LIBPATH ${JACK}/lib)
# TODO, gives linking errors, force off
set(WITH_JACK OFF)
endif()
if(WITH_PYTHON)
# normally cached but not since we include them with blender
set(PYTHON_VERSION 3.5) # CACHE STRING)
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") # CACHE PATH)
set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}mw.lib") # CACHE FILEPATH)
unset(_PYTHON_VERSION_NO_DOTS)
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
endif()
if(WITH_BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
if(WITH_MINGW64)
set(BOOST_POSTFIX "mgw47-mt-s-1_49")
set(BOOST_DEBUG_POSTFIX "mgw47-mt-sd-1_49")
else()
set(BOOST_POSTFIX "mgw46-mt-s-1_49")
set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_49")
endif()
set(BOOST_LIBRARIES
optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX}
boost_regex-${BOOST_POSTFIX}
boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX}
debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
boost_regex-${BOOST_DEBUG_POSTFIX}
boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized boost_locale-${BOOST_POSTFIX}
debug boost_locale-${BOOST_DEBUG_POSTFIX}
)
endif()
if(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized boost_wave-${BOOST_POSTFIX}
debug boost_wave-${BOOST_DEBUG_POSTFIX}
)
endif()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
endif()
if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
set(OPENIMAGEIO_LIBRARIES OpenImageIO)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS "")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_LIBPATH ${LLVM_ROOT_DIR}/lib)
# Explicitly set llvm lib order.
#---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
LLVMAsmParser LLVMAsmPrinter
LLVMBitReader LLVMBitWriter
LLVMDebugInfo LLVMExecutionEngine
LLVMInstCombine LLVMInstrumentation
LLVMInterpreter LLVMJIT
LLVMLinker LLVMMC
LLVMMCDisassembler LLVMMCJIT
LLVMMCParser LLVMObject
LLVMRuntimeDyld
LLVMSupport
LLVMTableGen LLVMTarget
LLVMTransformUtils LLVMVectorize
LLVMX86AsmParser LLVMX86AsmPrinter
LLVMX86CodeGen LLVMX86Desc
LLVMX86Disassembler LLVMX86Info
LLVMX86Utils LLVMipa
LLVMipo LLVMCore)
# imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
list(APPEND PLATFORM_LINKLIBS -limagehlp)
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
set(OPENCOLORIO_DEFINITIONS)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBRARY SDL)
set(SDL_LIBPATH ${SDL}/lib)
endif()
if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openvdb)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
set(OPENVDB_DEFINITIONS)
endif()
if(WITH_ALEMBIC)
# TODO(sergey): For until someone drops by and compiles libraries for
# MinGW we allow users to compile their own Alembic library and use
# that via find_package(),
#
# Once precompiled libraries are there we'll use hardcoded locations.
find_package_wrapper(Alembic)
if(WITH_ALEMBIC_HDF5)
set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
find_package_wrapper(HDF5)
endif()
if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
set(WITH_ALEMBIC OFF)
set(WITH_ALEMBIC_HDF5 OFF)
endif()
endif()
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
## DISABLE - causes linking errors
## for re-distribution, so users dont need mingw installed
# set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++")

View File

@@ -1,500 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Windows when compiling with MSVC.
macro(warn_hardcoded_paths package_name
)
if(WITH_WINDOWS_FIND_MODULES)
message(WARNING "Using HARDCODED ${package_name} locations")
endif(WITH_WINDOWS_FIND_MODULES)
endmacro()
macro(windows_find_package package_name
)
if(WITH_WINDOWS_FIND_MODULES)
find_package( ${package_name})
endif(WITH_WINDOWS_FIND_MODULES)
endmacro()
add_definitions(-DWIN32)
# Minimum MSVC Version
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
if(MSVC_VERSION EQUAL 1800)
set(_min_ver "18.0.31101")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
message(FATAL_ERROR
"Visual Studio 2013 (Update 4, ${_min_ver}) required, "
"found (${CMAKE_CXX_COMPILER_VERSION})")
endif()
endif()
if(MSVC_VERSION EQUAL 1900)
set(_min_ver "19.0.24210")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
message(FATAL_ERROR
"Visual Studio 2015 (Update 3, ${_min_ver}) required, "
"found (${CMAKE_CXX_COMPILER_VERSION})")
endif()
endif()
endif()
unset(_min_ver)
# needed for some MSVC installations
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
list(APPEND PLATFORM_LINKLIBS
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp
)
if(WITH_INPUT_IME)
list(APPEND PLATFORM_LINKLIBS imm32)
endif()
add_definitions(
-D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
-D_CONSOLE
-D_LIB
)
# MSVC11 needs _ALLOW_KEYWORD_MACROS to build
add_definitions(-D_ALLOW_KEYWORD_MACROS)
# We want to support Vista level ABI
add_definitions(-D_WIN32_WINNT=0x600)
# Make cmake find the msvc redistributables
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
# Ignore meaningless for us linker warnings.
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
# MSVC only, Mingw doesnt need
if(CMAKE_CL_64)
set(PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}")
else()
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
endif()
set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
if(NOT DEFINED LIBDIR)
# Setup 64bit and 64bit windows systems
if(CMAKE_CL_64)
message(STATUS "64 bit compiler detected.")
set(LIBDIR_BASE "win64")
else()
message(STATUS "32 bit compiler detected.")
set(LIBDIR_BASE "windows")
endif()
if(MSVC_VERSION EQUAL 1910)
message(STATUS "Visual Studio 2017 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
elseif(MSVC_VERSION EQUAL 1900)
message(STATUS "Visual Studio 2015 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
else()
message(STATUS "Visual Studio 2013 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc12)
endif()
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
endif()
# Add each of our libraries to our cmake_prefix_path so find_package() could work
file(GLOB children RELATIVE ${LIBDIR} ${LIBDIR}/*)
foreach(child ${children})
if(IS_DIRECTORY ${LIBDIR}/${child})
list(APPEND CMAKE_PREFIX_PATH ${LIBDIR}/${child})
endif()
endforeach()
set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
set(ZLIB_LIBRARY ${LIBDIR}/zlib/lib/libz_st.lib)
set(ZLIB_DIR ${LIBDIR}/zlib)
windows_find_package(zlib) # we want to find before finding things that depend on it like png
windows_find_package(png)
if(NOT PNG_FOUND)
warn_hardcoded_paths(libpng)
set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
set(PNG_LIBRARIES libpng)
set(PNG "${LIBDIR}/png")
set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
endif()
set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
windows_find_package(jpeg REQUIRED)
if(NOT JPEG_FOUND)
warn_hardcoded_paths(jpeg)
set(JPEG_INCLUDE_DIR ${LIBDIR}/jpeg/include)
set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib)
endif()
set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
set(FREETYPE ${LIBDIR}/freetype)
set(FREETYPE_INCLUDE_DIRS
${LIBDIR}/freetype/include
${LIBDIR}/freetype/include/freetype2
)
set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
windows_find_package(freetype REQUIRED)
if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_LIBRARIES libfftw)
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif()
if(WITH_OPENCOLLADA)
set(OPENCOLLADA ${LIBDIR}/opencollada)
set(OPENCOLLADA_INCLUDE_DIRS
${OPENCOLLADA}/include/opencollada/COLLADAStreamWriter
${OPENCOLLADA}/include/opencollada/COLLADABaseUtils
${OPENCOLLADA}/include/opencollada/COLLADAFramework
${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
)
set(OPENCOLLADA_LIBRARIES
${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib
${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework.lib
${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils.lib
${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter.lib
${OPENCOLLADA}/lib/opencollada/MathMLSolver.lib
${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser.lib
${OPENCOLLADA}/lib/opencollada/xml.lib
${OPENCOLLADA}/lib/opencollada/buffer.lib
${OPENCOLLADA}/lib/opencollada/ftoa.lib
)
if(NOT WITH_LLVM)
list(APPEND OPENCOLLADA_LIBRARIES ${OPENCOLLADA}/lib/opencollada/UTF.lib)
endif()
set(PCRE_LIBRARIES
${OPENCOLLADA}/lib/opencollada/pcre.lib
)
endif()
if(WITH_CODEC_FFMPEG)
set(FFMPEG_INCLUDE_DIRS
${LIBDIR}/ffmpeg/include
${LIBDIR}/ffmpeg/include/msvc
)
windows_find_package(FFMPEG)
if(NOT FFMPEG_FOUND)
warn_hardcoded_paths(ffmpeg)
set(FFMPEG_LIBRARY_VERSION 57)
set(FFMPEG_LIBRARY_VERSION_AVU 55)
set(FFMPEG_LIBRARIES
${LIBDIR}/ffmpeg/lib/avcodec.lib
${LIBDIR}/ffmpeg/lib/avformat.lib
${LIBDIR}/ffmpeg/lib/avdevice.lib
${LIBDIR}/ffmpeg/lib/avutil.lib
${LIBDIR}/ffmpeg/lib/swscale.lib
)
endif()
endif()
if(WITH_IMAGE_OPENEXR)
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
set(OPENEXR_VERSION "2.1")
windows_find_package(OPENEXR REQUIRED)
if(NOT OPENEXR_FOUND)
warn_hardcoded_paths(OpenEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
set(OPENEXR_LIBRARIES
optimized ${OPENEXR_LIBPATH}/Iex-2_2.lib
optimized ${OPENEXR_LIBPATH}/Half.lib
optimized ${OPENEXR_LIBPATH}/IlmImf-2_2.lib
optimized ${OPENEXR_LIBPATH}/Imath-2_2.lib
optimized ${OPENEXR_LIBPATH}/IlmThread-2_2.lib
debug ${OPENEXR_LIBPATH}/Iex-2_2_d.lib
debug ${OPENEXR_LIBPATH}/Half_d.lib
debug ${OPENEXR_LIBPATH}/IlmImf-2_2_d.lib
debug ${OPENEXR_LIBPATH}/Imath-2_2_d.lib
debug ${OPENEXR_LIBPATH}/IlmThread-2_2_d.lib
)
endif()
endif()
if(WITH_IMAGE_TIFF)
# Try to find tiff first then complain and set static and maybe wrong paths
windows_find_package(TIFF)
if(NOT TIFF_FOUND)
warn_hardcoded_paths(libtiff)
set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
endif()
endif()
if(WITH_JACK)
set(JACK_INCLUDE_DIRS
${LIBDIR}/jack/include/jack
${LIBDIR}/jack/include
)
set(JACK_LIBRARIES optimized ${LIBDIR}/jack/lib/libjack.lib debug ${LIBDIR}/jack/lib/libjack_d.lib)
endif()
if(WITH_PYTHON)
set(PYTHON_VERSION 3.5) # CACHE STRING)
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
# Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
unset(_PYTHON_VERSION_NO_DOTS)
# Shared includes for both vc2008 and vc2010
set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
endif()
if(WITH_BOOST)
if(WITH_CYCLES_OSL)
set(boost_extra_libs wave)
endif()
if(WITH_INTERNATIONAL)
list(APPEND boost_extra_libs locale)
endif()
if(WITH_OPENVDB)
list(APPEND boost_extra_libs iostreams)
endif()
set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
set(Boost_USE_MULTITHREADED ON) # suffix -mt
set(Boost_USE_STATIC_LIBS ON) # suffix -s
if (WITH_WINDOWS_FIND_MODULES)
find_package(Boost COMPONENTS date_time filesystem thread regex system ${boost_extra_libs})
endif (WITH_WINDOWS_FIND_MODULES)
if(NOT Boost_FOUND)
warn_hardcoded_paths(BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
if(MSVC12)
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_POSTFIX "vc120-mt-s-1_60.lib")
set(BOOST_DEBUG_POSTFIX "vc120-mt-sgd-1_60.lib")
else()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_POSTFIX "vc140-mt-s-1_60.lib")
set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-1_60.lib")
endif()
set(BOOST_LIBRARIES
optimized libboost_date_time-${BOOST_POSTFIX}
optimized libboost_filesystem-${BOOST_POSTFIX}
optimized libboost_regex-${BOOST_POSTFIX}
optimized libboost_system-${BOOST_POSTFIX}
optimized libboost_thread-${BOOST_POSTFIX}
debug libboost_date_time-${BOOST_DEBUG_POSTFIX}
debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
debug libboost_regex-${BOOST_DEBUG_POSTFIX}
debug libboost_system-${BOOST_DEBUG_POSTFIX}
debug libboost_thread-${BOOST_DEBUG_POSTFIX}
)
if(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized libboost_wave-${BOOST_POSTFIX}
debug libboost_wave-${BOOST_DEBUG_POSTFIX})
endif()
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized libboost_locale-${BOOST_POSTFIX}
debug libboost_locale-${BOOST_DEBUG_POSTFIX})
endif()
else() # we found boost using find_package
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
endif()
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
if(WITH_OPENIMAGEIO)
windows_find_package(OpenImageIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
set(OIIO_OPTIMIZED optimized OpenImageIO optimized OpenImageIO_Util)
set(OIIO_DEBUG debug OpenImageIO_d debug OpenImageIO_Util_d)
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_BUILD)
add_definitions(-DOIIO_NO_SSE=1)
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib)
if(EXISTS ${LLVM_ROOT_DIR}/debug/lib)
foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED})
get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE)
list(APPEND LLVM_LIBS optimized ${LIBNAME})
endforeach(LLVM_OPTIMIZED_LIB)
file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_ROOT_DIR}/debug/lib/*.lib)
foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG})
get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE)
list(APPEND LLVM_LIBS debug ${LIBNAME})
endforeach(LLVM_DEBUG_LIB)
set(LLVM_LIBRARY ${LLVM_LIBS})
else()
message(WARNING "LLVM debug libs not present on this system. Using release libs for debug builds.")
set(LLVM_LIBRARY ${LLVM_LIBRARY_OPTIMIZED})
endif()
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO)
set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
set(OPENCOLORIO_DEFINITIONS)
endif()
if(WITH_OPENVDB)
set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
set(OPENVDB ${LIBDIR}/openvdb)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
set(OPENVDB_LIBRARIES optimized openvdb debug openvdb_d ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
endif()
if(WITH_ALEMBIC)
set(ALEMBIC ${LIBDIR}/alembic)
set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
set(ALEMBIC_LIBRARIES optimized alembic debug alembic_d)
endif()
if(WITH_MOD_CLOTH_ELTOPO)
set(LAPACK ${LIBDIR}/lapack)
# set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
set(LAPACK_LIBPATH ${LAPACK}/lib)
set(LAPACK_LIBRARIES
${LIBDIR}/lapack/lib/libf2c.lib
${LIBDIR}/lapack/lib/clapack_nowrap.lib
${LIBDIR}/lapack/lib/BLAS_nowrap.lib
)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
set(OPENSUBDIV_LIBRARIES optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib
optimized ${OPENSUBDIV_LIBPATH}/osdGPU.lib
debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib
debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib
)
set(OPENSUBDIV_HAS_OPENMP TRUE)
set(OPENSUBDIV_HAS_TBB FALSE)
set(OPENSUBDIV_HAS_OPENCL TRUE)
set(OPENSUBDIV_HAS_CUDA FALSE)
set(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK TRUE)
set(OPENSUBDIV_HAS_GLSL_COMPUTE TRUE)
windows_find_package(OpenSubdiv)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBPATH ${SDL}/lib)
# MinGW TODO: Update MinGW to SDL2
if(NOT CMAKE_COMPILER_IS_GNUCC)
set(SDL_LIBRARY SDL2)
else()
set(SDL_LIBRARY SDL)
endif()
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace.lib)
set(AUDASPACE_C_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_C_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-c.lib)
set(AUDASPACE_PY_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
endif()
# used in many places so include globally, like OpenGL
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
#find signtool
SET(ProgramFilesX86_NAME "ProgramFiles(x86)") #env dislikes the ( )
find_program(SIGNTOOL_EXE signtool
HINTS
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/bin/x86/"
"$ENV{ProgramFiles}/Windows Kits/10/bin/x86/"
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.1/bin/x86/"
"$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86/"
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.0/bin/x86/"
"$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86/"
)

View File

@@ -39,7 +39,7 @@ __all__ = (
"is_py",
"cmake_advanced_info",
"cmake_compiler_defines",
"project_name_get",
"project_name_get"
"init",
)
@@ -214,12 +214,7 @@ def cmake_advanced_info():
def cmake_cache_var(var):
cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"), encoding='utf-8')
lines = [
l_strip for l in cache_file
for l_strip in (l.strip(),)
if l_strip
if not l_strip.startswith(("//", "#"))
]
lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
cache_file.close()
for l in lines:

View File

@@ -23,7 +23,7 @@
__all__ = (
"build_info",
"SOURCE_DIR",
)
)
import sys

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# <pep8 compliant>

View File

@@ -6,10 +6,10 @@
BASE_DIR="$PWD"
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
if [ "$blender_version_cycle" = "release" ] ; then
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char

View File

@@ -187,7 +187,7 @@ The next table describes the information in the file-header.
</table>
<p>
<a href="https://en.wikipedia.org/wiki/Endianness">Endianness</a> addresses the way values are ordered in a sequence of bytes(see the <a href="#example-endianess">example</a> below):
<a href="http://en.wikipedia.org/wiki/Endianness">Endianness</a> addresses the way values are ordered in a sequence of bytes(see the <a href="#example-endianess">example</a> below):
</p>
<ul>

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "V2.8x"
PROJECT_NUMBER = "V2.7x"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -699,7 +699,7 @@ LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
# extension is automatically appended if omitted. This requires the bibtex tool
# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
@@ -1145,7 +1145,7 @@ HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
# Minimum value: 0, maximum value: 359, default value: 220.
@@ -1752,7 +1752,7 @@ LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# The default value is: plain.
# This tag requires that the tag GENERATE_LATEX is set to YES.

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# ##### BEGIN GPL LICENSE BLOCK #####
#

View File

@@ -0,0 +1,132 @@
class IDGroup:
"""
The IDGroup Type
================
This type supports both iteration and the []
operator to get child ID properties.
You can also add new properties using the [] operator.
For example::
group['a float!'] = 0.0
group['an int!'] = 0
group['a string!'] = "hi!"
group['an array!'] = [0, 0, 1.0, 0]
group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2],
"another subgroup": {"a": 0.0, "str": "bleh"}}
Note that for arrays, the array type defaults to int unless a float is found
while scanning the template list; if any floats are found, then the whole
array is float. Note that double-precision floating point numbers are used for
python-created float ID properties and arrays (though the internal C api does
support single-precision floats, and the python code will read them).
You can also delete properties with the del operator. For example:
del group['property']
To get the type of a property, use the type() operator, for example::
if type(group['bleh']) == str: pass
To tell if the property is a group or array type, import the Blender.Types module and test
against IDGroupType and IDArrayType, like so::
from Blender.Types import IDGroupType, IDArrayType.
if type(group['bleghr']) == IDGroupType:
(do something)
@ivar name: The name of the property
@type name: string
"""
def pop(item):
"""
Pop an item from the group property.
@type item: string
@param item: The item name.
@rtype: can be dict, list, int, float or string.
@return: The removed property.
"""
def update(updatedict):
"""
Updates items in the dict, similar to normal python
dictionary method .update().
@type updatedict: dict
@param updatedict: A dict of simple types to derive updated/new IDProperties from.
@rtype: None
@return: None
"""
def keys():
"""
Returns a list of the keys in this property group.
@rtype: list of strings.
@return: a list of the keys in this property group.
"""
def values():
"""
Returns a list of the values in this property group.
Note that unless a value is itself a property group or an array, you
cannot change it by changing the values in this list, you must change them
in the parent property group.
For example,
group['some_property'] = new_value
. . .is correct, while,
values = group.values()
values[0] = new_value
. . .is wrong.
@rtype: list of strings.
@return: a list of the values in this property group.
"""
def iteritems():
"""
Implements the python dictionary iteritmes method.
For example::
for k, v in group.iteritems():
print "Property name: " + k
print "Property value: " + str(v)
@rtype: an iterator that spits out items of the form [key, value]
@return: an iterator.
"""
def convert_to_pyobject():
"""
Converts the entire property group to a purely python form.
@rtype: dict
@return: A python dictionary representing the property group
"""
class IDArray:
"""
The IDArray Type
================
@ivar type: returns the type of the array, can be either IDP_Int or IDP_Float
"""
def __getitem__(index):
pass
def __setitem__(index, value):
pass
def __len__():
pass

View File

@@ -4,7 +4,7 @@ Persistent Handler Example
By default handlers are freed when loading new files, in some cases you may
wan't the handler stay running across multiple files (when the handler is
part of an add-on for example).
part of an addon for example).
For this the :data:`bpy.app.handlers.persistent` decorator needs to be used.
"""

View File

@@ -5,7 +5,7 @@ Intro
.. warning::
Most of this object should only be useful if you actually manipulate i18n stuff from Python.
If you are a regular add-on, you should only bother about :const:`contexts` member,
If you are a regular addon, you should only bother about :const:`contexts` member,
and the :func:`register`/:func:`unregister` functions! The :func:`pgettext` family of functions
should only be used in rare, specific cases (like e.g. complex "composited" UI strings...).
@@ -21,11 +21,11 @@ Intro
Then, call ``bpy.app.translations.register(__name__, your_dict)`` in your ``register()`` function, and
``bpy.app.translations.unregister(__name__)`` in your ``unregister()`` one.
The ``Manage UI translations`` add-on has several functions to help you collect strings to translate, and
The ``Manage UI translations`` addon has several functions to help you collect strings to translate, and
generate the needed python code (the translation dictionary), as well as optional intermediary po files
if you want some... See
`How to Translate Blender <https://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender>`_ and
`Using i18n in Blender Code <https://wiki.blender.org/index.php/Dev:Source/Interface/Internationalization>`_
`How to Translate Blender <http://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender>`_ and
`Using i18n in Blender Code <http://wiki.blender.org/index.php/Dev:Source/Interface/Internationalization>`_
for more info.
Module References

View File

@@ -1,10 +1,10 @@
bl_info = {
"name": "Example Add-on Preferences",
"name": "Example Addon Preferences",
"author": "Your Name Here",
"version": (1, 0),
"blender": (2, 65, 0),
"location": "SpaceBar Search -> Add-on Preferences Example",
"description": "Example Add-on",
"location": "SpaceBar Search -> Addon Preferences Example",
"description": "Example Addon",
"warning": "",
"wiki_url": "",
"tracker_url": "",
@@ -18,7 +18,7 @@ from bpy.props import StringProperty, IntProperty, BoolProperty
class ExampleAddonPreferences(AddonPreferences):
# this must match the add-on name, use '__package__'
# this must match the addon name, use '__package__'
# when defining this in a submodule of a python package.
bl_idname = __name__
@@ -37,7 +37,7 @@ class ExampleAddonPreferences(AddonPreferences):
def draw(self, context):
layout = self.layout
layout.label(text="This is a preferences view for our add-on")
layout.label(text="This is a preferences view for our addon")
layout.prop(self, "filepath")
layout.prop(self, "number")
layout.prop(self, "boolean")
@@ -46,7 +46,7 @@ class ExampleAddonPreferences(AddonPreferences):
class OBJECT_OT_addon_prefs_example(Operator):
"""Display example preferences"""
bl_idname = "object.addon_prefs_example"
bl_label = "Add-on Preferences Example"
bl_label = "Addon Preferences Example"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):

View File

@@ -2,9 +2,9 @@
Extending Menus
+++++++++++++++
When creating menus for add-ons you can't reference menus
in Blender's default scripts.
Instead, the add-on can add menu items to existing menus.
When creating menus for addons you can't reference menus in Blender's default
scripts.
Instead, the addon can add menu items to existing menus.
The function menu_draw acts like :class:`Menu.draw`.
"""

View File

@@ -13,7 +13,7 @@ be animated, accessed from the user interface and from python.
definitions are not, this means whenever you load blender the class needs
to be registered too.
This is best done by creating an add-on which loads on startup and registers
This is best done by creating an addon which loads on startup and registers
your properties.
.. note::

View File

@@ -49,7 +49,7 @@ vec2d[:] = vec3d[:2]
# Vectors support 'swizzle' operations
# See https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
# See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
vec.xyz = vec.zyx
vec.xy = vec4d.zw
vec.xyz = vec4d.wzz

View File

@@ -405,7 +405,7 @@ base class --- :class:`SCA_IObject`
.. note::
This attribute is experimental and may be removed (but probably wont be).
This attribute is experemental and may be removed (but probably wont be).
.. note::
@@ -419,7 +419,7 @@ base class --- :class:`SCA_IObject`
.. note::
This attribute is experimental and may be removed (but probably wont be).
This attribute is experemental and may be removed (but probably wont be).
.. note::
@@ -453,7 +453,7 @@ base class --- :class:`SCA_IObject`
.. attribute:: childrenRecursive
all children of this object including children's children, (read-only).
all children of this object including childrens children, (read-only).
:type: :class:`CListValue` of :class:`KX_GameObject`'s
@@ -536,7 +536,7 @@ base class --- :class:`SCA_IObject`
.. method:: getAxisVect(vect)
Returns the axis vector rotates by the object's worldspace orientation.
Returns the axis vector rotates by the objects worldspace orientation.
This is the equivalent of multiplying the vector by the orientation matrix.
:arg vect: a vector to align the axis.
@@ -596,7 +596,7 @@ base class --- :class:`SCA_IObject`
Gets the game object's linear velocity.
This method returns the game object's velocity through it's center of mass, ie no angular velocity component.
This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
:arg local:
* False: you get the "global" velocity ie: relative to world orientation.
@@ -609,7 +609,7 @@ base class --- :class:`SCA_IObject`
Sets the game object's linear velocity.
This method sets game object's velocity through it's center of mass,
This method sets game object's velocity through it's centre of mass,
ie no angular velocity component.
This requires a dynamic object.
@@ -814,7 +814,7 @@ base class --- :class:`SCA_IObject`
# do something
pass
The face parameter determines the orientation of the normal.
The face paremeter determines the orientation of the normal.
* 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
* 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
@@ -911,7 +911,7 @@ base class --- :class:`SCA_IObject`
.. note::
The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as the Subdivision Surface modifier).
The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
.. warning::
@@ -919,7 +919,7 @@ base class --- :class:`SCA_IObject`
.. warning::
If the object is a part of a compound object it will fail (parent or child)
If the object is a part of a combound object it will fail (parent or child)
.. warning::

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@ The features exposed closely follow the C API,
giving python access to the functions used by blenders own mesh editing tools.
For an overview of BMesh data types and how they reference each other see:
`BMesh Design Document <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`_ .
`BMesh Design Document <http://wiki.blender.org/index.php/Dev:2.6/Source/Modeling/BMesh/Design>`_ .
.. note::
@@ -31,12 +31,13 @@ For an overview of BMesh data types and how they reference each other see:
**Disk** and **Radial** data is not exposed by the python api since this is for internal use only.
.. warning:: TODO items are...
.. warning::
TODO items are...
* add access to BMesh **walkers**
* add custom-data manipulation functions add/remove/rename.
Example Script
--------------

View File

@@ -204,7 +204,7 @@ Lets say we want to access the texture of a brush via Python, to adjust its ``co
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
- From the toolbar expand the **Texture** panel and add a new texture.
*Notice the texture button its self doesn't have very useful links (you can check the tooltips).*
*Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
- In the properties button select the Texture context.

View File

@@ -18,7 +18,7 @@ amongst our own scripts and make it easier to use python scripts from other proj
Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
This style guide is known as pep8 and can be found `here <https://www.python.org/dev/peps/pep-0008/>`_
This style guide is known as pep8 and can be found `here <http://www.python.org/dev/peps/pep-0008>`_
A brief listing of pep8 criteria.
@@ -316,7 +316,7 @@ use to join a list of strings (the list may be temporary). In the following exam
Join is fastest on many strings,
`string formatting <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`__
`string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`__
is quite fast too (better for converting data types). String arithmetic is slowest.

View File

@@ -1,4 +1,3 @@
*******
Gotchas
*******
@@ -39,6 +38,7 @@ but some operators are more picky about when they run.
In most cases you can figure out what context an operator needs
simply be seeing how it's used in Blender and thinking about what it does.
Unfortunately if you're still stuck - the only way to **really** know
whats going on is to read the source code for the poll function and see what its checking.
@@ -82,6 +82,7 @@ it should be reported to the bug tracker.
Stale Data
==========
No updates after setting values
-------------------------------
@@ -173,8 +174,8 @@ In this situation you can...
.. _info_gotcha_mesh_faces:
N-Gons and Tessellation Faces
=============================
NGons and Tessellation Faces
============================
Since 2.63 NGons are supported, this adds some complexity
since in some cases you need to access triangles/quads still (some exporters for example).
@@ -508,7 +509,7 @@ Unicode Problems
Python supports many different encodings so there is nothing stopping you from
writing a script in ``latin1`` or ``iso-8859-15``.
See `pep-0263 <https://www.python.org/dev/peps/pep-0263/>`_
See `pep-0263 <http://www.python.org/dev/peps/pep-0263/>`_
However this complicates matters for Blender's Python API because ``.blend`` files don't have an explicit encoding.
@@ -656,7 +657,7 @@ Here are some general hints to avoid running into these problems.
.. note::
To find the line of your script that crashes you can use the ``faulthandler`` module.
See the `faulthandler docs <https://docs.python.org/dev/library/faulthandler.html>`_.
See `faulthandler docs <http://docs.python.org/dev/library/faulthandler.html>`_.
While the crash may be in Blenders C/C++ code,
this can help a lot to track down the area of the script that causes the crash.

View File

@@ -19,7 +19,7 @@ This is a typical Python environment so tutorials on how to write Python scripts
will work running the scripts in Blender too.
Blender provides the :mod:`bpy` module to the Python interpreter.
This module can be imported in a script and gives access to Blender data, classes, and functions.
Scripts that deal with Blender data will need to import this module.
Scripts that deal with Blender data will need to import this module.
Here is a simple example of moving a vertex of the object named **Cube**:
@@ -43,7 +43,8 @@ scene manipulation, automation, defining your own toolset and customization.
On startup Blender scans the ``scripts/startup/`` directory for Python modules and imports them.
The exact location of this directory depends on your installation.
See the :ref:`directory layout docs <blender_manual:getting-started_installing-config-directories>`.
`See the directory layout docs
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__
Script Loading
@@ -76,22 +77,22 @@ To run as modules:
- The obvious way, ``import some_module`` command from the text window or interactive console.
- Open as a text block and tick "Register" option, this will load with the blend file.
- copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
- define as an add-on, enabling the add-on will load it as a Python module.
- define as an addon, enabling the addon will load it as a Python module.
Add-ons
-------
Addons
------
Some of Blenders functionality is best kept optional,
alongside scripts loaded at startup we have add-ons which are kept in their own directory ``scripts/addons``,
alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``,
and only load on startup if selected from the user preferences.
The only difference between add-ons and built-in Python modules is that add-ons must contain a ``bl_info``
The only difference between addons and built-in Python modules is that addons must contain a ``bl_info``
variable which Blender uses to read metadata such as name, author, category and URL.
The User Preferences add-on listing uses **bl_info** to display information about each add-on.
The user preferences addon listing uses **bl_info** to display information about each addon.
`See Add-ons <https://wiki.blender.org/index.php/Dev:Py/Scripts/Guidelines/Addons>`__
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`__
for details on the ``bl_info`` dictionary.
@@ -213,7 +214,7 @@ A simple Blender/Python module can look like this:
bpy.utils.register_class(SimpleOperator)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
bpy.utils.unregister_class(SimpleOperator)
if __name__ == "__main__":
register()
@@ -222,7 +223,7 @@ These functions usually appear at the bottom of the script containing class regi
You can also use them for internal purposes setting up data for your own tools but take care
since register won't re-run when a new blend file is loaded.
The register/unregister calls are used so it's possible to toggle add-ons and reload scripts while Blender runs.
The register/unregister calls are used so it's possible to toggle addons and reload scripts while Blender runs.
If the register calls were placed in the body of the script, registration would be called on import,
meaning there would be no distinction between importing a module or loading its classes into Blender.
@@ -327,7 +328,7 @@ Say you want to store material settings for a custom engine.
.. note::
*The class must be registered before being used in a property, failing to do so will raise an error:*
``ValueError: bpy_struct "Material" registration error: my_custom_props could not register``
@@ -429,3 +430,4 @@ Calling these operators:
>>> bpy.ops.object.operator_2()
Hello World OBJECT_OT_operator_2
{'FINISHED'}

View File

@@ -51,7 +51,8 @@ A quick list of helpful things to know before starting:
| ``scripts/startup/bl_operators`` for operators.
Exact location depends on platform, see:
:ref:`Configuration and Data Paths <blender_manual:getting-started_installing-config-directories>`.
`Configuration and Data Paths
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__.
Running Scripts

View File

@@ -27,7 +27,7 @@ There are 3 main uses for the terminal, these are:
.. note::
For Linux and macOS users this means starting the terminal first, then running Blender from within it.
For Linux and OSX users this means starting the terminal first, then running Blender from within it.
On Windows the terminal can be enabled from the help menu.
@@ -306,7 +306,7 @@ Advantages include:
This is marked advanced because to run Blender as a Python module requires a special build option.
For instructions on building see
`Building Blender as a Python module <https://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
`Building Blender as a Python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
Python Safety (Build Option)

View File

@@ -1,6 +1,6 @@
Add-on Tutorial
###############
Addon Tutorial
##############
************
Introduction
@@ -36,7 +36,6 @@ Suggested reading before starting this tutorial.
To best troubleshoot any error message Python prints while writing scripts you run blender with from a terminal,
see :ref:`Use The Terminal <use_the_terminal>`.
Documentation Links
===================
@@ -47,48 +46,51 @@ While going through the tutorial you may want to look into our reference documen
- :mod:`bpy.context` api reference. -
*Handy to have a list of available items your script may operate on.*
- :class:`bpy.types.Operator`. -
*The following add-ons define operators, these docs give details and more examples of operators.*
*The following addons define operators, these docs give details and more examples of operators.*
*******
Add-ons
*******
******
Addons
******
What is an Add-on?
==================
An add-on is simply a Python module with some additional requirements so Blender can display it in a list with useful
What is an Addon?
=================
An addon is simply a Python module with some additional requirements so Blender can display it in a list with useful
information.
To give an example, here is the simplest possible add-on.
To give an example, here is the simplest possible addon.
.. code-block:: python
bl_info = {"name": "My Test Add-on", "category": "Object"}
bl_info = {"name": "My Test Addon", "category": "Object"}
def register():
print("Hello World")
def unregister():
print("Goodbye World")
- ``bl_info`` is a dictionary containing add-on metadata such as the title,
version and author to be displayed in the user preferences add-on list.
- ``register`` is a function which only runs when enabling the add-on,
this means the module can be loaded without activating the add-on.
- ``unregister`` is a function to unload anything setup by ``register``, this is called when the add-on is disabled.
- ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the
user preferences addon list.
- ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without
activating the addon.
- ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled.
Notice this add-on does not do anything related to Blender, (the :mod:`bpy` module is not imported for example).
This is a contrived example of an add-on that serves to illustrate the point
that the base requirements of an add-on are simple.
Notice this addon does not do anything related to Blender, (the :mod:`bpy` module is not imported for example).
An add-on will typically register operators, panels, menu items etc, but its worth noting that _any_ script can do this,
This is a contrived example of an addon that serves to illustrate the point
that the base requirements of an addon are simple.
An addon will typically register operators, panels, menu items etc, but its worth noting that _any_ script can do this,
when executed from the text editor or even the interactive console - there is nothing inherently different about an
add-on that allows it to integrate with Blender, such functionality is just provided by the :mod:`bpy` module for any
addon that allows it to integrate with Blender, such functionality is just provided by the :mod:`bpy` module for any
script to access.
So an add-on is just a way to encapsulate a Python module in a way a user can easily utilize.
So an addon is just a way to encapsulate a Python module in a way a user can easily utilize.
.. note::
@@ -97,14 +99,14 @@ So an add-on is just a way to encapsulate a Python module in a way a user can ea
Messages will be printed when enabling and disabling.
Your First Add-on
=================
Your First Addon
================
The simplest possible add-on above is useful as an example but not much else.
This next add-on is simple but shows how to integrate a script into Blender using an ``Operator``
The simplest possible addon above was useful as an example but not much else.
This next addon is simple but shows how to integrate a script into Blender using an ``Operator``
which is the typical way to define a tool accessed from menus, buttons and keyboard shortcuts.
For the first example we will make a script that simply moves all objects in a scene.
For the first example we'll make a script that simply moves all objects in a scene.
Write The Script
@@ -121,14 +123,20 @@ Add the following script to the text editor in Blender.
obj.location.x += 1.0
Click the :ref:`Run Script button <blender_manual:editors-text-run-script>`,
all objects in the active scene are moved by 1.0 Blender unit.
.. image:: run_script.png
:width: 924px
:align: center
:height: 574px
:alt: Run Script button
Click the Run Script button, all objects in the active scene are moved by 1.0 Blender unit.
Next we'll make this script into an addon.
Write the Add-on (Simple)
-------------------------
Write the Addon (Simple)
------------------------
This add-on takes the body of the script above, and adds them to an operator's ``execute()`` function.
This addon takes the body of the script above, and adds them to an operator's ``execute()`` function.
.. code-block:: python
@@ -165,7 +173,7 @@ This add-on takes the body of the script above, and adds them to an operator's `
# This allows you to run the script directly from blenders text editor
# to test the add-on without having to install it.
# to test the addon without having to install it.
if __name__ == "__main__":
register()
@@ -198,33 +206,33 @@ Do this by pressing :kbd:`Spacebar` to bring up the operator search dialog and t
The objects should move as before.
*Keep this add-on open in Blender for the next step - Installing.*
*Keep this addon open in Blender for the next step - Installing.*
Install The Add-on
------------------
Install The Addon
-----------------
Once you have your add-on within in Blender's text editor,
Once you have your addon within in Blender's text editor,
you will want to be able to install it so it can be enabled in the user preferences to load on startup.
Even though the add-on above is a test, lets go through the steps anyway so you know how to do it for later.
Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later.
To install the Blender text as an add-on you will first have to save it to disk, take care to obey the naming
To install the Blender text as an addon you will first have to save it to disk, take care to obey the naming
restrictions that apply to Python modules and end with a ``.py`` extension.
Once the file is on disk, you can install it as you would for an add-on downloaded online.
Once the file is on disk, you can install it as you would for an addon downloaded online.
Open the user :menuselection:`File --> User Preferences`,
Select the *Add-on* section, press *Install Add-on...* and select the file.
Open the user :menuselection:`File -> User Preferences`,
Select the *Addon* section, press *Install Addon...* and select the file.
Now the add-on will be listed and you can enable it by pressing the check-box,
Now the addon will be listed and you can enable it by pressing the check-box,
if you want it to be enabled on restart, press *Save as Default*.
.. note::
The destination of the add-on depends on your Blender configuration.
When installing an add-on the source and destination path are printed in the console.
You can also find add-on path locations by running this in the Python console.
The destination of the addon depends on your Blender configuration.
When installing an addon the source and destination path are printed in the console.
You can also find addon path locations by running this in the Python console.
.. code-block:: python
@@ -232,20 +240,20 @@ if you want it to be enabled on restart, press *Save as Default*.
print(addon_utils.paths())
More is written on this topic here:
:ref:`Directory Layout <blender_manual:getting-started_installing-config-directories>`.
`Directory Layout <https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`_
Your Second Add-on
==================
Your Second Addon
=================
For our second add-on, we will focus on object instancing - this is - to make linked copies of an object in a
For our second addon, we will focus on object instancing - this is - to make linked copies of an object in a
similar way to what you may have seen with the array modifier.
Write The Script
----------------
As before, first we will start with a script, develop it, then convert into an add-on.
As before, first we will start with a script, develop it, then convert into an addon.
.. code-block:: python
@@ -316,17 +324,17 @@ allows vectors to be multiplied by numbers and matrices.
If you are interested in this area, read into :class:`mathutils.Vector` - there are many handy utility functions
such as getting the angle between vectors, cross product, dot products
as well as more advanced functions in :mod:`mathutils.geometry` such as zier Spline interpolation and
as well as more advanced functions in :mod:`mathutils.geometry` such as bezier spline interpolation and
ray-triangle intersection.
For now we will focus on making this script an add-on, but its good to know that this 3D math module is available and
For now we'll focus on making this script an addon, but its good to know that this 3D math module is available and
can help you with more advanced functionality later on.
Write the Add-on
----------------
Write the Addon
---------------
The first step is to convert the script as-is into an add-on.
The first step is to convert the script as-is into an addon.
.. code-block:: python
@@ -373,7 +381,7 @@ The first step is to convert the script as-is into an add-on.
register()
Everything here has been covered in the previous steps, you may want to try run the add-on still
Everything here has been covered in the previous steps, you may want to try run the addon still
and consider what could be done to make it more useful.
@@ -426,7 +434,7 @@ however the link above includes examples of more advanced property usage.
Menu Item
^^^^^^^^^
Add-ons can add to the user interface of existing panels, headers and menus defined in Python.
Addons can add to the user interface of existing panels, headers and menus defined in Python.
For this example we'll add to an existing menu.
@@ -456,7 +464,7 @@ For docs on extending menus see: :doc:`bpy.types.Menu`.
Keymap
^^^^^^
In Blender, add-ons have their own keymaps so as not to interfere with Blenders built in key-maps.
In Blender addons have their own key-maps so as not to interfere with Blenders built in key-maps.
In the example below, a new object-mode :class:`bpy.types.KeyMap` is added,
then a :class:`bpy.types.KeyMapItem` is added to the key-map which references our newly added operator,
@@ -494,7 +502,7 @@ this allows you to have multiple keys accessing the same operator with different
.. note::
While :kbd:`Ctrl-Shift-Space` isn't a default Blender key shortcut, its hard to make sure add-ons won't
While :kbd:`Ctrl-Shift-Space` isn't a default Blender key shortcut, its hard to make sure addons won't
overwrite each others keymaps, At least take care when assigning keys that they don't
conflict with important functionality within Blender.
@@ -598,14 +606,14 @@ After selecting it from the menu, you can choose how many instance of the cube y
.. note::
Directly executing the script multiple times will add the menu each time too.
While not useful behavior, theres nothing to worry about since add-ons won't register them selves multiple
While not useful behavior, theres nothing to worry about since addons won't register them selves multiple
times when enabled through the user preferences.
Conclusions
===========
Add-ons can encapsulate certain functionality neatly for writing tools to improve your work-flow or for writing utilities
Addons can encapsulate certain functionality neatly for writing tools to improve your work-flow or for writing utilities
for others to use.
While there are limits to what Python can do within Blender, there is certainly a lot that can be achieved without
@@ -628,8 +636,8 @@ Here are some sites you might like to check on after completing this tutorial.
*For more background details on Blender/Python integration.*
- `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
*Great info for those who are still learning Python.*
- `Blender Development (Wiki) <https://wiki.blender.org/index.php/Dev:Contents>`_ -
- `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
*Blender Development, general information and helpful links.*
- `Blender Artists (Coding Section) <https://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
- `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
*forum where people ask Python development questions*

View File

@@ -27,7 +27,7 @@ output from this tool should be added into "doc/python_api/rst/change_log.rst"
blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump
# create changelog
blender --background --factory-startup --python doc/python_api/sphinx_changelog_gen.py -- \
blender --background --python doc/python_api/sphinx_changelog_gen.py -- \
--api_from blender_2_63_0.py \
--api_to blender_2_64_0.py \
--api_out changes.rst
@@ -48,8 +48,7 @@ python doc/python_api/sphinx_changelog_gen.py -- \
'''
{"module.name":
{"parent.class":
{"basic_type", "member_name":
("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
{"basic_type", "member_name": ("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
}, ...
}
'''
@@ -100,34 +99,34 @@ def api_dump():
prop_range = None
dump_class[prop_id] = (
"prop_rna", # basic_type
prop.name, # name
prop_type, # type
prop_range, # range
prop_length, # length
prop.default, # default
prop.description, # descr
Ellipsis, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
"prop_rna", # basic_type
prop.name, # name
prop_type, # type
prop_range, # range
prop_length, # length
prop.default, # default
prop.description, # descr
Ellipsis, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
del props
# python props, tricky since we dont know much about them.
for prop_id, attr in struct_info.get_py_properties():
dump_class[prop_id] = (
"prop_py", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
attr.__doc__, # descr
Ellipsis, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
"prop_py", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
attr.__doc__, # descr
Ellipsis, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
# kludge func -> props
funcs = [(func.identifier, func) for func in struct_info.functions]
@@ -138,17 +137,17 @@ def api_dump():
func_args_type = tuple([prop.type for prop in func.args])
dump_class[func_id] = (
"func_rna", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
func.description, # descr
func_args_ids, # f_args
func_args_type, # f_arg_types
func_ret_types, # f_ret_types
)
"func_rna", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
func.description, # descr
func_args_ids, # f_args
func_args_type, # f_arg_types
func_ret_types, # f_ret_types
)
del funcs
# kludge func -> props
@@ -159,17 +158,17 @@ def api_dump():
func_args_ids = tuple(inspect.getargspec(attr).args)
dump_class[func_id] = (
"func_py", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
attr.__doc__, # descr
func_args_ids, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
"func_py", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
attr.__doc__, # descr
func_args_ids, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
del funcs
import pprint
@@ -331,25 +330,21 @@ def main():
# When --help or no args are given, print this help
usage_text = "Run blender in background mode with this script: "
"blender --background --factory-startup --python %s -- [options]" % os.path.basename(__file__)
"blender --background --python %s -- [options]" % os.path.basename(__file__)
epilog = "Run this before releases"
parser = argparse.ArgumentParser(description=usage_text, epilog=epilog)
parser.add_argument(
"--dump", dest="dump", action='store_true',
help="When set the api will be dumped into blender_version.py")
parser.add_argument("--dump", dest="dump", action='store_true',
help="When set the api will be dumped into blender_version.py")
parser.add_argument(
"--api_from", dest="api_from", metavar='FILE',
help="File to compare from (previous version)")
parser.add_argument(
"--api_to", dest="api_to", metavar='FILE',
help="File to compare from (current)")
parser.add_argument(
"--api_out", dest="api_out", metavar='FILE',
help="Output sphinx changelog")
parser.add_argument("--api_from", dest="api_from", metavar='FILE',
help="File to compare from (previous version)")
parser.add_argument("--api_to", dest="api_to", metavar='FILE',
help="File to compare from (current)")
parser.add_argument("--api_out", dest="api_out", metavar='FILE',
help="Output sphinx changelog")
args = parser.parse_args(argv) # In this example we wont use the args

View File

@@ -24,18 +24,18 @@ SCRIPT_HELP_MSG = """
API dump in RST files
---------------------
Run this script from Blender's root path once you have compiled Blender
Run this script from blenders root path once you have compiled blender
blender --background --factory-startup -noaudio --python doc/python_api/sphinx_doc_gen.py
./blender.bin --background -noaudio --python doc/python_api/sphinx_doc_gen.py
This will generate python files in doc/python_api/sphinx-in/
providing ./blender is or links to the blender executable
providing ./blender.bin is or links to the blender executable
To choose sphinx-in directory:
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
For quick builds:
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
Sphinx: HTML generation
@@ -46,6 +46,8 @@ Sphinx: HTML generation
cd doc/python_api
sphinx-build sphinx-in sphinx-out
This requires sphinx 1.0.7 to be installed.
Sphinx: PDF generation
----------------------
@@ -59,14 +61,14 @@ Sphinx: PDF generation
"""
try:
import bpy # Blender module
import bpy # blender module
except ImportError:
print("\nERROR: this script must run from inside Blender")
print(SCRIPT_HELP_MSG)
import sys
sys.exit()
import rna_info # Blender module
import rna_info # blender module
def rna_info_BuildRNAInfo_cache():
@@ -84,7 +86,7 @@ import shutil
import logging
from platform import platform
PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows'
PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows'
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
@@ -179,13 +181,15 @@ def handle_args():
dest="log",
default=False,
action='store_true',
help="Log the output of the api dump and sphinx|latex "
"warnings and errors (default=False).\n"
"If given, save logs in:\n"
"* OUTPUT_DIR/.bpy.log\n"
"* OUTPUT_DIR/.sphinx-build.log\n"
"* OUTPUT_DIR/.sphinx-build_pdf.log\n"
"* OUTPUT_DIR/.latex_make.log",
help=(
"Log the output of the api dump and sphinx|latex "
"warnings and errors (default=False).\n"
"If given, save logs in:\n"
"* OUTPUT_DIR/.bpy.log\n"
"* OUTPUT_DIR/.sphinx-build.log\n"
"* OUTPUT_DIR/.sphinx-build_pdf.log\n"
"* OUTPUT_DIR/.latex_make.log",
),
required=False)
# parse only the args passed after '--'
@@ -206,12 +210,12 @@ BPY_LOGGER.setLevel(logging.DEBUG)
"""
# for quick rebuilds
rm -rf /b/doc/python_api/sphinx-* && \
./blender -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
./blender.bin -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
or
./blender -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
./blender.bin -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
"""
# Switch for quick testing so doc-builds don't take so long
@@ -220,12 +224,12 @@ if not ARGS.partial:
FILTER_BPY_OPS = None
FILTER_BPY_TYPES = None
EXCLUDE_INFO_DOCS = False
EXCLUDE_MODULES = []
EXCLUDE_MODULES = ()
else:
# can manually edit this too:
# FILTER_BPY_OPS = ("import.scene", ) # allow
# FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
#FILTER_BPY_OPS = ("import.scene", ) # allow
#FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
EXCLUDE_INFO_DOCS = True
EXCLUDE_MODULES = [
"aud",
@@ -258,7 +262,6 @@ else:
"bpy_extras",
"gpu",
"gpu.offscreen",
"idprop.types",
"mathutils",
"mathutils.bvhtree",
"mathutils.geometry",
@@ -272,7 +275,7 @@ else:
"freestyle.shaders",
"freestyle.types",
"freestyle.utils",
]
]
# ------
# Filter
@@ -298,9 +301,7 @@ else:
del m
del fnmatch
BPY_LOGGER.debug(
"Partial Doc Build, Skipping: %s\n" %
"\n ".join(sorted(EXCLUDE_MODULES)))
BPY_LOGGER.debug("Partial Doc Build, Skipping: %s\n" % "\n ".join(sorted(EXCLUDE_MODULES)))
#
# done filtering
@@ -310,21 +311,19 @@ try:
__import__("aud")
except ImportError:
BPY_LOGGER.debug("Warning: Built without 'aud' module, docs incomplete...")
EXCLUDE_MODULES.append("aud")
EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["aud"]
try:
__import__("freestyle")
except ImportError:
BPY_LOGGER.debug("Warning: Built without 'freestyle' module, docs incomplete...")
EXCLUDE_MODULES.extend([
"freestyle",
"freestyle.chainingiterators",
"freestyle.functions",
"freestyle.predicates",
"freestyle.shaders",
"freestyle.types",
"freestyle.utils",
])
EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["freestyle",
"freestyle.chainingiterators",
"freestyle.functions",
"freestyle.predicates",
"freestyle.shaders",
"freestyle.types",
"freestyle.utils"]
# Source files we use, and need to copy to the OUTPUT_DIR
# to have working out-of-source builds.
@@ -341,7 +340,7 @@ EXTRA_SOURCE_FILES = (
"../examples/bge.texture.py",
"../examples/bmesh.ops.1.py",
"../examples/bpy.app.translations.py",
)
)
# examples
@@ -358,59 +357,52 @@ RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst"))
# extra info, not api reference docs
# stored in ./rst/info_*
INFO_DOCS = (
("info_quickstart.rst",
"Blender/Python Quickstart: new to Blender/scripting and want to get your feet wet?"),
("info_overview.rst",
"Blender/Python API Overview: a more complete explanation of Python integration"),
("info_tutorial_addon.rst",
"Blender/Python Add-on Tutorial: a step by step guide on how to write an add-on from scratch"),
("info_api_reference.rst",
"Blender/Python API Reference Usage: examples of how to use the API reference docs"),
("info_best_practice.rst",
"Best Practice: Conventions to follow for writing good scripts"),
("info_tips_and_tricks.rst",
"Tips and Tricks: Hints to help you while writing scripts for Blender"),
("info_gotcha.rst",
"Gotcha's: some of the problems you may come up against when writing scripts"),
)
("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get your feet wet?"),
("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"),
("info_tutorial_addon.rst", "Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch"),
("info_api_reference.rst", "Blender/Python API Reference Usage: examples of how to use the API reference docs"),
("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"),
("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writing scripts for blender"),
("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"),
)
# only support for properties atm.
RNA_BLACKLIST = {
# XXX messes up PDF!, really a bug but for now just workaround.
"UserPreferencesSystem": {"language", }
}
}
MODULE_GROUPING = {
"bmesh.types": (
("Base Mesh Type", '-'),
"BMesh",
("Mesh Elements", '-'),
"BMVert",
"BMEdge",
"BMFace",
"BMLoop",
("Sequence Accessors", '-'),
"BMElemSeq",
"BMVertSeq",
"BMEdgeSeq",
"BMFaceSeq",
"BMLoopSeq",
"BMIter",
("Selection History", '-'),
"BMEditSelSeq",
"BMEditSelIter",
("Custom-Data Layer Access", '-'),
"BMLayerAccessVert",
"BMLayerAccessEdge",
"BMLayerAccessFace",
"BMLayerAccessLoop",
"BMLayerCollection",
"BMLayerItem",
("Custom-Data Layer Types", '-'),
"BMLoopUV",
"BMDeformVert"
)
}
("Base Mesh Type", '-'),
"BMesh",
("Mesh Elements", '-'),
"BMVert",
"BMEdge",
"BMFace",
"BMLoop",
("Sequence Accessors", '-'),
"BMElemSeq",
"BMVertSeq",
"BMEdgeSeq",
"BMFaceSeq",
"BMLoopSeq",
"BMIter",
("Selection History", '-'),
"BMEditSelSeq",
"BMEditSelIter",
("Custom-Data Layer Access", '-'),
"BMLayerAccessVert",
"BMLayerAccessEdge",
"BMLayerAccessFace",
"BMLayerAccessLoop",
"BMLayerCollection",
"BMLayerItem",
("Custom-Data Layer Types", '-'),
"BMLoopUV",
"BMDeformVert"
)
}
# --------------------configure compile time options----------------------------
@@ -418,7 +410,7 @@ MODULE_GROUPING = {
blender_version_strings = [str(v) for v in bpy.app.version]
# converting bytes to strings, due to T30154
# converting bytes to strings, due to #30154
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
BLENDER_DATE = str(bpy.app.build_date, 'utf_8')
@@ -486,10 +478,10 @@ MethodDescriptorType = type(dict.get)
GetSetDescriptorType = type(int.real)
StaticMethodType = type(staticmethod(lambda: None))
from types import (
MemberDescriptorType,
MethodType,
FunctionType,
)
MemberDescriptorType,
MethodType,
FunctionType,
)
_BPY_STRUCT_FAKE = "bpy_struct"
_BPY_PROP_COLLECTION_FAKE = "bpy_prop_collection"
@@ -509,7 +501,7 @@ escape_rst.trans = str.maketrans({
"|": "\\|",
"*": "\\*",
"\\": "\\\\",
})
})
def is_struct_seq(value):
@@ -754,7 +746,7 @@ def py_c_func2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_
def pyprop2sphinx(ident, fw, identifier, py_prop):
'''
Python property to sphinx
python property to sphinx
'''
# readonly properties use "data" directive, variables use "attribute" directive
if py_prop.fset is None:
@@ -854,8 +846,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
# naughty, we also add getset's into PyStructs, this is not typical py but also not incorrect.
# type_name is only used for examples and messages
# "<class 'bpy.app.handlers'>" --> bpy.app.handlers
type_name = str(type(module)).strip("<>").split(" ", 1)[-1][1:-1]
type_name = str(type(module)).strip("<>").split(" ", 1)[-1][1:-1] # "<class 'bpy.app.handlers'>" --> bpy.app.handlers
if type(descr) == types.GetSetDescriptorType:
py_descr2sphinx("", fw, descr, module_name, type_name, key)
attribute_set.add(key)
@@ -916,8 +907,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
for attribute, value, value_type in module_dir_value_type:
if value_type == FunctionType:
pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False)
# both the same at the moment but to be future proof
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}:
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}: # both the same at the moment but to be future proof
# note: can't get args from these, so dump the string as is
# this means any module used like this must have fully formatted docstrings.
py_c_func2sphinx("", fw, module_name, None, attribute, value, is_class=False)
@@ -983,7 +973,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
if type(descr) == ClassMethodDescriptorType:
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
# needed for pure Python classes
# needed for pure python classes
for key, descr in descr_items:
if type(descr) == FunctionType:
pyfunc2sphinx(" ", fw, module_name, type_name, key, descr, is_class=True)
@@ -1006,15 +996,12 @@ def pymodule2sphinx(basepath, module_name, module, title):
file.close()
# Changes in Blender will force errors here
# Changes in blender will force errors here
context_type_map = {
"active_base": ("ObjectBase", False),
"active_bone": ("EditBone", False),
"active_gpencil_frame": ("GreasePencilLayer", True),
"active_gpencil_layer": ("GPencilLayer", True),
"active_gpencil_brush": ("GPencilSculptBrush", False),
"active_gpencil_palette": ("GPencilPalette", True),
"active_gpencil_palettecolor": ("GPencilPaletteColor", True),
"active_node": ("Node", False),
"active_object": ("Object", False),
"active_operator": ("Operator", False),
@@ -1097,10 +1084,9 @@ def pycontext2sphinx(basepath):
fw(title_string("Context Access (bpy.context)", "="))
fw(".. module:: bpy.context\n")
fw("\n")
fw("The context members available depend on the area of Blender which is currently being accessed.\n")
fw("The context members available depend on the area of blender which is currently being accessed.\n")
fw("\n")
fw("Note that all context values are readonly,\n")
fw("but may be modified through the data api or by running operators\n\n")
fw("Note that all context values are readonly, but may be modified through the data api or by running operators\n\n")
def write_contex_cls():
@@ -1123,8 +1109,7 @@ def pycontext2sphinx(basepath):
if prop.identifier in struct_blacklist:
continue
type_descr = prop.get_type_description(
class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
type_descr = prop.get_type_description(class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
fw(".. data:: %s\n\n" % prop.identifier)
if prop.description:
fw(" %s\n\n" % prop.description)
@@ -1144,7 +1129,7 @@ def pycontext2sphinx(basepath):
del write_contex_cls
# end
# nasty, get strings directly from Blender because there is no other way to get it
# nasty, get strings directly from blender because there is no other way to get it
import ctypes
context_strings = (
@@ -1180,9 +1165,7 @@ def pycontext2sphinx(basepath):
# for member in sorted(unique):
# print(' "%s": ("", False),' % member)
if len(context_type_map) > len(unique):
raise Exception(
"Some types are not used: %s" %
str([member for member in context_type_map if member not in unique]))
raise Exception("Some types are not used: %s" % str([member for member in context_type_map if member not in unique]))
else:
pass # will have raised an error above
@@ -1261,11 +1244,11 @@ def pyrna2sphinx(basepath):
fw(ident + ":%s%s: %s\n" % (id_type, identifier, type_descr))
def write_struct(struct):
# if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"):
# return
#if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"):
# return
# if not struct.identifier == "Object":
# return
#if not struct.identifier == "Object":
# return
filepath = os.path.join(basepath, "bpy.types.%s.rst" % struct.identifier)
file = open(filepath, "w", encoding="utf-8")
@@ -1306,11 +1289,7 @@ def pyrna2sphinx(basepath):
fw(", ".join((":class:`%s`" % base_id) for base_id in base_ids))
fw("\n\n")
subclass_ids = [
s.identifier for s in structs.values()
if s.base is struct
if not rna_info.rna_id_ignore(s.identifier)
]
subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)]
subclass_ids.sort()
if subclass_ids:
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n")
@@ -1361,7 +1340,7 @@ def pyrna2sphinx(basepath):
fw(" :type: %s\n\n" % type_descr)
# Python attributes
# python attributes
py_properties = struct.get_py_properties()
py_prop = None
for identifier, py_prop in py_properties:
@@ -1371,8 +1350,7 @@ def pyrna2sphinx(basepath):
for func in struct.functions:
args_str = ", ".join(prop.get_arg_default(force=False) for prop in func.args)
fw(" .. %s:: %s(%s)\n\n" %
("classmethod" if func.is_classmethod else "method", func.identifier, args_str))
fw(" .. %s:: %s(%s)\n\n" % ("classmethod" if func.is_classmethod else "method", func.identifier, args_str))
fw(" %s\n\n" % func.description)
for prop in func.args:
@@ -1383,10 +1361,8 @@ def pyrna2sphinx(basepath):
elif func.return_values: # multiple return values
fw(" :return (%s):\n" % ", ".join(prop.identifier for prop in func.return_values))
for prop in func.return_values:
# TODO, pyrna_enum2sphinx for multiple return values... actually dont
# think we even use this but still!!!
type_descr = prop.get_type_description(
as_ret=True, class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
# TODO, pyrna_enum2sphinx for multiple return values... actually dont think we even use this but still!!!
type_descr = prop.get_type_description(as_ret=True, class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
descr = prop.description
if not descr:
descr = prop.name
@@ -1399,7 +1375,7 @@ def pyrna2sphinx(basepath):
fw("\n")
# Python methods
# python methods
py_funcs = struct.get_py_functions()
py_func = None
@@ -1422,10 +1398,7 @@ def pyrna2sphinx(basepath):
del lines[:]
if _BPY_STRUCT_FAKE:
descr_items = [
(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items())
if not key.startswith("__")
]
descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")]
if _BPY_STRUCT_FAKE:
for key, descr in descr_items:
@@ -1521,28 +1494,19 @@ def pyrna2sphinx(basepath):
fw("\n")
if use_subclasses:
subclass_ids = [
s.identifier for s in structs.values()
if s.base is None
if not rna_info.rna_id_ignore(s.identifier)
]
subclass_ids = [s.identifier for s in structs.values() if s.base is None if not rna_info.rna_id_ignore(s.identifier)]
if subclass_ids:
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in sorted(subclass_ids)) + "\n\n")
fw(".. class:: %s\n\n" % class_name)
fw(" %s\n\n" % descr_str)
fw(" .. note::\n\n")
fw(" Note that bpy.types.%s is not actually available from within Blender,\n"
" it only exists for the purpose of documentation.\n\n" % class_name)
fw(" Note that bpy.types.%s is not actually available from within blender, it only exists for the purpose of documentation.\n\n" % class_name)
descr_items = [
(key, descr) for key, descr in sorted(class_value.__dict__.items())
if not key.startswith("__")
]
descr_items = [(key, descr) for key, descr in sorted(class_value.__dict__.items()) if not key.startswith("__")]
for key, descr in descr_items:
# GetSetDescriptorType, GetSetDescriptorType's are not documented yet
if type(descr) == MethodDescriptorType:
if type(descr) == MethodDescriptorType: # GetSetDescriptorType, GetSetDescriptorType's are not documented yet
py_descr2sphinx(" ", fw, descr, "bpy.types", class_name, key)
for key, descr in descr_items:
@@ -1553,21 +1517,17 @@ def pyrna2sphinx(basepath):
# write fake classes
if _BPY_STRUCT_FAKE:
class_value = bpy.types.Struct.__bases__[0]
fake_bpy_type(
class_value, _BPY_STRUCT_FAKE,
"built-in base class for all classes in bpy.types.", use_subclasses=True)
fake_bpy_type(class_value, _BPY_STRUCT_FAKE, "built-in base class for all classes in bpy.types.", use_subclasses=True)
if _BPY_PROP_COLLECTION_FAKE:
class_value = bpy.data.objects.__class__
fake_bpy_type(
class_value, _BPY_PROP_COLLECTION_FAKE,
"built-in class used for all collections.", use_subclasses=False)
fake_bpy_type(class_value, _BPY_PROP_COLLECTION_FAKE, "built-in class used for all collections.", use_subclasses=False)
# operators
def write_ops():
API_BASEURL = "https://developer.blender.org/diffusion/B/browse/master/release/scripts "
API_BASEURL_ADDON = "https://developer.blender.org/diffusion/BA"
API_BASEURL_ADDON_CONTRIB = "https://developer.blender.org/diffusion/BAC"
API_BASEURL = "http://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts"
API_BASEURL_ADDON = "http://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts"
API_BASEURL_ADDON_CONTRIB = "http://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts"
op_modules = {}
for op in ops.values():
@@ -1632,9 +1592,6 @@ def write_sphinx_conf_py(basepath):
file = open(filepath, "w", encoding="utf-8")
fw = file.write
fw("import sys, os\n\n")
fw("extensions = ['sphinx.ext.intersphinx']\n\n")
fw("intersphinx_mapping = {'blender_manual': ('https://docs.blender.org/manual/en/dev/', None)}\n\n")
fw("project = 'Blender'\n")
# fw("master_doc = 'index'\n")
fw("copyright = u'Blender Foundation'\n")
@@ -1646,21 +1603,16 @@ def write_sphinx_conf_py(basepath):
if ARGS.sphinx_theme == "blender-org":
fw("html_theme_path = ['../']\n")
# copied with the theme, exclude else we get an error [T28873]
# copied with the theme, exclude else we get an error [#28873]
fw("html_favicon = 'favicon.ico'\n") # in <theme>/static/
# not helpful since the source is generated, adds to upload size.
fw("html_copy_source = False\n")
fw("html_show_sphinx = False\n")
fw("html_split_index = True\n")
fw("\n")
# needed for latex, pdf gen
fw("latex_elements = {\n")
fw(" 'papersize': 'a4paper',\n")
fw("}\n\n")
fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n")
fw("latex_paper_size = 'a4paper'\n")
file.close()
@@ -1681,13 +1633,11 @@ def write_rst_contents(basepath):
fw(title_string("Blender Documentation Contents", "%", double=True))
fw("\n")
fw("Welcome, this document is an API reference for Blender %s, built %s.\n" %
(BLENDER_VERSION_DOTS, BLENDER_DATE))
fw("Welcome, this document is an API reference for Blender %s, built %s.\n" % (BLENDER_VERSION_DOTS, BLENDER_DATE))
fw("\n")
# fw("`A PDF version of this document is also available <%s>`_\n" % BLENDER_PDF_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files) <%s>`_\n" %
BLENDER_ZIP_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files) <%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("\n")
@@ -1720,7 +1670,7 @@ def write_rst_contents(basepath):
# C modules
"bpy.props",
)
)
for mod in app_modules:
if mod not in EXCLUDE_MODULES:
@@ -1741,10 +1691,9 @@ def write_rst_contents(basepath):
"freestyle", "bgl", "blf",
"gpu", "gpu.offscreen",
"aud", "bpy_extras",
"idprop.types",
# bmesh, submodules are in own page
"bmesh",
)
)
for mod in standalone_modules:
if mod not in EXCLUDE_MODULES:
@@ -1782,8 +1731,7 @@ def write_rst_contents(basepath):
fw(" * mesh creation and editing functions\n")
fw(" \n")
fw(" These parts of the API are relatively stable and are unlikely to change significantly\n")
fw(" * data API, access to attributes of Blender data such as mesh verts, material color,\n")
fw(" timeline frames and scene objects\n")
fw(" * data API, access to attributes of blender data such as mesh verts, material color, timeline frames and scene objects\n")
fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n")
fw(" * render engine integration\n")
fw(" * modules: bgl, mathutils & game engine.\n")
@@ -1855,11 +1803,11 @@ def write_rst_data(basepath):
fw(title_string("Data Access (bpy.data)", "="))
fw(".. module:: bpy\n")
fw("\n")
fw("This module is used for all Blender/Python access.\n")
fw("This module is used for all blender/python access.\n")
fw("\n")
fw(".. data:: data\n")
fw("\n")
fw(" Access to Blender's internal data\n")
fw(" Access to blenders internal data\n")
fw("\n")
fw(" :type: :class:`bpy.types.BlendData`\n")
fw("\n")
@@ -1874,38 +1822,37 @@ def write_rst_importable_modules(basepath):
Write the rst files of importable modules
'''
importable_modules = {
# Python_modules
"bpy.path": "Path Utilities",
"bpy.utils": "Utilities",
"bpy_extras": "Extra Utilities",
# python_modules
"bpy.path" : "Path Utilities",
"bpy.utils" : "Utilities",
"bpy_extras" : "Extra Utilities",
# C_modules
"aud": "Audio System",
"blf": "Font Drawing",
"gpu.offscreen": "GPU Off-Screen Buffer",
"bmesh": "BMesh Module",
"bmesh.types": "BMesh Types",
"bmesh.utils": "BMesh Utilities",
"bmesh.geometry": "BMesh Geometry Utilities",
"bpy.app": "Application Data",
"bpy.app.handlers": "Application Handlers",
"bpy.app.translations": "Application Translations",
"bpy.props": "Property Definitions",
"idprop.types": "ID Property Access",
"mathutils": "Math Types & Utilities",
"mathutils.geometry": "Geometry Utilities",
"mathutils.bvhtree": "BVHTree Utilities",
"mathutils.kdtree": "KDTree Utilities",
"aud" : "Audio System",
"blf" : "Font Drawing",
"gpu.offscreen" : "GPU Off-Screen Buffer",
"bmesh" : "BMesh Module",
"bmesh.types" : "BMesh Types",
"bmesh.utils" : "BMesh Utilities",
"bmesh.geometry" : "BMesh Geometry Utilities",
"bpy.app" : "Application Data",
"bpy.app.handlers" : "Application Handlers",
"bpy.app.translations" : "Application Translations",
"bpy.props" : "Property Definitions",
"mathutils" : "Math Types & Utilities",
"mathutils.geometry" : "Geometry Utilities",
"mathutils.bvhtree" : "BVHTree Utilities",
"mathutils.kdtree" : "KDTree Utilities",
"mathutils.interpolate": "Interpolation Utilities",
"mathutils.noise": "Noise Utilities",
"freestyle": "Freestyle Module",
"freestyle.types": "Freestyle Types",
"freestyle.predicates": "Freestyle Predicates",
"freestyle.functions": "Freestyle Functions",
"freestyle.chainingiterators": "Freestyle Chaining Iterators",
"freestyle.shaders": "Freestyle Shaders",
"freestyle.utils": "Freestyle Utilities",
}
"mathutils.noise" : "Noise Utilities",
"freestyle" : "Freestyle Module",
"freestyle.types" : "Freestyle Types",
"freestyle.predicates" : "Freestyle Predicates",
"freestyle.functions" : "Freestyle Functions",
"freestyle.chainingiterators" : "Freestyle Chaining Iterators",
"freestyle.shaders" : "Freestyle Shaders",
"freestyle.utils" : "Freestyle Utilities",
}
for mod_name, mod_descr in importable_modules.items():
if mod_name not in EXCLUDE_MODULES:
module = __import__(mod_name,
@@ -1920,7 +1867,7 @@ def copy_handwritten_rsts(basepath):
for info, info_desc in INFO_DOCS:
shutil.copy2(os.path.join(RST_DIR, info), basepath)
# TODO put this docs in Blender's code and use import as per modules above
# TODO put this docs in blender's code and use import as per modules above
handwritten_modules = [
"bge.logic",
"bge.render",

View File

@@ -1,186 +0,0 @@
#!/usr/bin/env python3
# ##### 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.
#
# Contributor(s): Bastien Montagne
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""
This is a helper script to generate Blender Python API documentation (using Sphinx), and update server data using rsync.
You'll need to specify your user login and password, obviously.
Example usage:
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
"""
import os
import shutil
import subprocess
import sys
import tempfile
import zipfile
DEFAULT_RSYNC_SERVER = "docs.blender.org"
DEFAULT_RSYNC_ROOT = "/api/"
DEFAULT_SYMLINK_ROOT = "/data/www/vhosts/docs.blender.org/api"
def argparse_create():
import argparse
global __doc__
# When --help or no args are given, print this help
usage_text = __doc__
parser = argparse.ArgumentParser(description=usage_text,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument(
"--mirror", dest="mirror_dir",
metavar='PATH', required=True,
help="Path to local rsync mirror of api doc server")
parser.add_argument(
"--source", dest="source_dir",
metavar='PATH', required=True,
help="Path to Blender git repository")
parser.add_argument(
"--blender", dest="blender",
metavar='PATH', required=True,
help="Path to Blender executable")
parser.add_argument(
"--rsync-server", dest="rsync_server", default=DEFAULT_RSYNC_SERVER,
metavar='RSYNCSERVER', type=str, required=False,
help=("rsync server address"))
parser.add_argument(
"--rsync-root", dest="rsync_root", default=DEFAULT_RSYNC_ROOT,
metavar='RSYNCROOT', type=str, required=False,
help=("Root path of API doc on rsync server"))
parser.add_argument(
"--user", dest="user",
metavar='USER', type=str, required=True,
help=("User to login on rsync server"))
parser.add_argument(
"--password", dest="password",
metavar='PASSWORD', type=str, required=True,
help=("Password to login on rsync server"))
return parser
def main():
# ----------
# Parse Args
args = argparse_create().parse_args()
rsync_base = "rsync://%s@%s:%s" % (args.user, args.rsync_server, args.rsync_root)
# I) Update local mirror using rsync.
rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", rsync_base, args.mirror_dir)
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
with tempfile.TemporaryDirectory() as tmp_dir:
# II) Generate doc source in temp dir.
doc_gen_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
"--output", tmp_dir)
subprocess.run(doc_gen_cmd)
# III) Get Blender version info.
blenver = blenver_zip = ""
getver_file = os.path.join(tmp_dir, "blendver.txt")
getver_script = (""
"import sys, bpy\n"
"with open(sys.argv[-1], 'w') as f:\n"
" f.write('%d_%d%s_release\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if bpy.app.version_cycle in {'rc', 'release'} else '%d_%d_%d\\n' % bpy.app.version)\n"
" f.write('%d_%d_%d' % bpy.app.version)\n")
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python-expr", getver_script, "--", getver_file)
subprocess.run(get_ver_cmd)
with open(getver_file) as f:
blenver, blenver_zip = f.read().split("\n")
os.remove(getver_file)
# IV) Build doc.
curr_dir = os.getcwd()
os.chdir(tmp_dir)
sphinx_cmd = ("sphinx-build", "-b", "html", "sphinx-in", "sphinx-out")
subprocess.run(sphinx_cmd)
shutil.rmtree(os.path.join("sphinx-out", ".doctrees"))
os.chdir(curr_dir)
# V) Cleanup existing matching dir in server mirror (if any), and copy new doc.
api_name = "blender_python_api_%s" % blenver
api_dir = os.path.join(args.mirror_dir, api_name)
if os.path.exists(api_dir):
shutil.rmtree(api_dir)
os.rename(os.path.join(tmp_dir, "sphinx-out"), api_dir)
# VI) Create zip archive.
zip_name = "blender_python_reference_%s" % blenver_zip # We can't use 'release' postfix here...
zip_path = os.path.join(args.mirror_dir, zip_name)
with zipfile.ZipFile(zip_path, 'w') as zf:
for dirname, _, filenames in os.walk(api_dir):
for filename in filenames:
filepath = os.path.join(dirname, filename)
zip_filepath = os.path.join(zip_name, os.path.relpath(filepath, api_dir))
zf.write(filepath, arcname=zip_filepath)
os.rename(zip_path, os.path.join(api_dir, "%s.zip" % zip_name))
# VII) Create symlinks and html redirects.
#~ os.symlink(os.path.join(DEFAULT_SYMLINK_ROOT, api_name, "contents.html"), os.path.join(api_dir, "index.html"))
os.symlink("./contents.html", os.path.join(api_dir, "index.html"))
if blenver.endswith("release"):
symlink = os.path.join(args.mirror_dir, "blender_python_api_current")
os.remove(symlink)
os.symlink("./%s" % api_name, symlink)
with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f:
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
else:
symlink = os.path.join(args.mirror_dir, "blender_python_api_master")
os.remove(symlink)
os.symlink("./%s" % api_name, symlink)
with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f:
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
# VIII) Upload (first do a dry-run so user can ensure everything is OK).
print("Doc generated in local mirror %s, please check it before uploading "
"(hit [Enter] to continue, [Ctrl-C] to exit):" % api_dir)
sys.stdin.read(1)
rsync_mirror_cmd = ("rsync", "--dry-run", "--delete-after", "-avzz", args.mirror_dir, rsync_base)
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
print("Rsync upload simulated, please check every thing is OK (hit [Enter] to continue, [Ctrl-C] to exit):")
sys.stdin.read(1)
rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", args.mirror_dir, rsync_base)
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
if __name__ == "__main__":
main()

View File

@@ -105,7 +105,6 @@ endif()
if(WITH_GTESTS)
add_subdirectory(gtest)
add_subdirectory(gmock)
endif()
if(WITH_SDL AND WITH_SDL_DYNLOAD)

View File

@@ -77,7 +77,7 @@ namespace std {
void resize(size_type new_size)
{ resize(new_size, T()); }
#if defined(_VECTOR_) && (_MSC_VER<1910)
#if defined(_VECTOR_)
// workaround MSVC std::vector implementation
void resize(size_type new_size, const value_type& x)
{
@@ -110,7 +110,7 @@ namespace std {
vector_base::insert(vector_base::end(), new_size - vector_base::size(), x);
}
#else
// either GCC 4.1, MSVC2017 or non-GCC
// either GCC 4.1 or non-GCC
// default implementation which should always work.
void resize(size_type new_size, const value_type& x)
{

View File

@@ -151,8 +151,8 @@ static btScalar EdgeSeparation(const btBox2dShape* poly1, const btTransform& xf1
int index = 0;
btScalar minDot = BT_LARGE_FLOAT;
if( count2 > 0 )
index = (int) normal1.minDot( vertices2, count2, minDot);
if( count2 > 0 )
index = (int) normal1.minDot( vertices2, count2, minDot);
btVector3 v1 = b2Mul(xf1, vertices1[edge1]);
btVector3 v2 = b2Mul(xf2, vertices2[index]);
@@ -174,9 +174,9 @@ static btScalar FindMaxSeparation(int* edgeIndex,
// Find edge normal on poly1 that has the largest projection onto d.
int edge = 0;
btScalar maxDot;
if( count1 > 0 )
edge = (int) dLocal1.maxDot( normals1, count1, maxDot);
btScalar maxDot;
if( count1 > 0 )
edge = (int) dLocal1.maxDot( normals1, count1, maxDot);
// Get the separation for the edge normal.
btScalar s = EdgeSeparation(poly1, xf1, edge, poly2, xf2);

View File

@@ -232,8 +232,8 @@ void btCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrap
m_compoundShapeRevision = compoundShape->getUpdateRevision();
}
if (m_childCollisionAlgorithms.size()==0)
return;
if (m_childCollisionAlgorithms.size()==0)
return;
const btDbvt* tree = compoundShape->getDynamicAabbTree();
//use a dynamic aabb tree to cull potential child-overlaps

View File

@@ -73,12 +73,10 @@ set(SRC
internal/ceres/file.cc
internal/ceres/generated/partitioned_matrix_view_d_d_d.cc
internal/ceres/generated/schur_eliminator_d_d_d.cc
internal/ceres/gradient_checker.cc
internal/ceres/gradient_checking_cost_function.cc
internal/ceres/gradient_problem.cc
internal/ceres/gradient_problem_solver.cc
internal/ceres/implicit_schur_complement.cc
internal/ceres/is_close.cc
internal/ceres/iterative_schur_complement_solver.cc
internal/ceres/lapack.cc
internal/ceres/levenberg_marquardt_strategy.cc
@@ -118,7 +116,6 @@ set(SRC
internal/ceres/triplet_sparse_matrix.cc
internal/ceres/trust_region_minimizer.cc
internal/ceres/trust_region_preprocessor.cc
internal/ceres/trust_region_step_evaluator.cc
internal/ceres/trust_region_strategy.cc
internal/ceres/types.cc
internal/ceres/wall_time.cc
@@ -207,7 +204,6 @@ set(SRC
internal/ceres/householder_vector.h
internal/ceres/implicit_schur_complement.h
internal/ceres/integral_types.h
internal/ceres/is_close.h
internal/ceres/iterative_schur_complement_solver.h
internal/ceres/lapack.h
internal/ceres/levenberg_marquardt_strategy.h
@@ -252,7 +248,6 @@ set(SRC
internal/ceres/triplet_sparse_matrix.h
internal/ceres/trust_region_minimizer.h
internal/ceres/trust_region_preprocessor.h
internal/ceres/trust_region_step_evaluator.h
internal/ceres/trust_region_strategy.h
internal/ceres/visibility_based_preconditioner.h
internal/ceres/wall_time.h

1091
extern/ceres/ChangeLog vendored

File diff suppressed because it is too large Load Diff

View File

@@ -173,5 +173,26 @@ if(WITH_OPENMP)
)
endif()
TEST_UNORDERED_MAP_SUPPORT()
if(HAVE_STD_UNORDERED_MAP_HEADER)
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
add_definitions(-DCERES_STD_UNORDERED_MAP)
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
else()
add_definitions(-DCERES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCERES_TR1_UNORDERED_MAP)
else()
add_definitions(-DCERES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}")
EOF

View File

@@ -149,7 +149,6 @@ internal/ceres/generated/schur_eliminator_4_4_d.cc
internal/ceres/generated/schur_eliminator_d_d_d.cc
internal/ceres/generate_eliminator_specialization.py
internal/ceres/generate_partitioned_matrix_view_specializations.py
internal/ceres/gradient_checker.cc
internal/ceres/gradient_checking_cost_function.cc
internal/ceres/gradient_checking_cost_function.h
internal/ceres/gradient_problem.cc
@@ -161,8 +160,6 @@ internal/ceres/householder_vector.h
internal/ceres/implicit_schur_complement.cc
internal/ceres/implicit_schur_complement.h
internal/ceres/integral_types.h
internal/ceres/is_close.cc
internal/ceres/is_close.h
internal/ceres/iterative_schur_complement_solver.cc
internal/ceres/iterative_schur_complement_solver.h
internal/ceres/lapack.cc
@@ -246,8 +243,6 @@ internal/ceres/trust_region_minimizer.cc
internal/ceres/trust_region_minimizer.h
internal/ceres/trust_region_preprocessor.cc
internal/ceres/trust_region_preprocessor.h
internal/ceres/trust_region_step_evaluator.cc
internal/ceres/trust_region_step_evaluator.h
internal/ceres/trust_region_strategy.cc
internal/ceres/trust_region_strategy.h
internal/ceres/types.cc

View File

@@ -130,8 +130,7 @@ class CostFunctionToFunctor {
const int num_parameter_blocks =
(N0 > 0) + (N1 > 0) + (N2 > 0) + (N3 > 0) + (N4 > 0) +
(N5 > 0) + (N6 > 0) + (N7 > 0) + (N8 > 0) + (N9 > 0);
CHECK_EQ(static_cast<int>(parameter_block_sizes.size()),
num_parameter_blocks);
CHECK_EQ(parameter_block_sizes.size(), num_parameter_blocks);
CHECK_EQ(N0, parameter_block_sizes[0]);
if (parameter_block_sizes.size() > 1) CHECK_EQ(N1, parameter_block_sizes[1]); // NOLINT

View File

@@ -357,28 +357,6 @@ class CERES_EXPORT Covariance {
const double*> >& covariance_blocks,
Problem* problem);
// Compute a part of the covariance matrix.
//
// The vector parameter_blocks contains the parameter blocks that
// are used for computing the covariance matrix. From this vector
// all covariance pairs are generated. This allows the covariance
// estimation algorithm to only compute and store these blocks.
//
// parameter_blocks cannot contain duplicates. Bad things will
// happen if they do.
//
// Note that the list of covariance_blocks is only used to determine
// what parts of the covariance matrix are computed. The full
// Jacobian is used to do the computation, i.e. they do not have an
// impact on what part of the Jacobian is used for computation.
//
// The return value indicates the success or failure of the
// covariance computation. Please see the documentation for
// Covariance::Options for more on the conditions under which this
// function returns false.
bool Compute(const std::vector<const double*>& parameter_blocks,
Problem* problem);
// Return the block of the cross-covariance matrix corresponding to
// parameter_block1 and parameter_block2.
//
@@ -416,40 +394,6 @@ class CERES_EXPORT Covariance {
const double* parameter_block2,
double* covariance_block) const;
// Return the covariance matrix corresponding to all parameter_blocks.
//
// Compute must be called before calling GetCovarianceMatrix and all
// parameter_blocks must have been present in the vector
// parameter_blocks when Compute was called. Otherwise
// GetCovarianceMatrix returns false.
//
// covariance_matrix must point to a memory location that can store
// the size of the covariance matrix. The covariance matrix will be
// a square matrix whose row and column count is equal to the sum of
// the sizes of the individual parameter blocks. The covariance
// matrix will be a row-major matrix.
bool GetCovarianceMatrix(const std::vector<const double *> &parameter_blocks,
double *covariance_matrix);
// Return the covariance matrix corresponding to parameter_blocks
// in the tangent space if a local parameterization is associated
// with one of the parameter blocks else returns the covariance
// matrix in the ambient space.
//
// Compute must be called before calling GetCovarianceMatrix and all
// parameter_blocks must have been present in the vector
// parameters_blocks when Compute was called. Otherwise
// GetCovarianceMatrix returns false.
//
// covariance_matrix must point to a memory location that can store
// the size of the covariance matrix. The covariance matrix will be
// a square matrix whose row and column count is equal to the sum of
// the sizes of the tangent spaces of the individual parameter
// blocks. The covariance matrix will be a row-major matrix.
bool GetCovarianceMatrixInTangentSpace(
const std::vector<const double*>& parameter_blocks,
double* covariance_matrix);
private:
internal::scoped_ptr<internal::CovarianceImpl> impl_;
};

View File

@@ -85,6 +85,22 @@ class DynamicNumericDiffCostFunction : public CostFunction {
options_(options) {
}
// Deprecated. New users should avoid using this constructor. Instead, use the
// constructor with NumericDiffOptions.
DynamicNumericDiffCostFunction(
const CostFunctor* functor,
Ownership ownership,
double relative_step_size)
: functor_(functor),
ownership_(ownership),
options_() {
LOG(WARNING) << "This constructor is deprecated and will be removed in "
"a future version. Please use the NumericDiffOptions "
"constructor instead.";
options_.relative_step_size = relative_step_size;
}
virtual ~DynamicNumericDiffCostFunction() {
if (ownership_ != TAKE_OWNERSHIP) {
functor_.release();
@@ -122,19 +138,19 @@ class DynamicNumericDiffCostFunction : public CostFunction {
std::vector<double> parameters_copy(parameters_size);
std::vector<double*> parameters_references_copy(block_sizes.size());
parameters_references_copy[0] = &parameters_copy[0];
for (size_t block = 1; block < block_sizes.size(); ++block) {
for (int block = 1; block < block_sizes.size(); ++block) {
parameters_references_copy[block] = parameters_references_copy[block - 1]
+ block_sizes[block - 1];
}
// Copy the parameters into the local temp space.
for (size_t block = 0; block < block_sizes.size(); ++block) {
for (int block = 0; block < block_sizes.size(); ++block) {
memcpy(parameters_references_copy[block],
parameters[block],
block_sizes[block] * sizeof(*parameters[block]));
}
for (size_t block = 0; block < block_sizes.size(); ++block) {
for (int block = 0; block < block_sizes.size(); ++block) {
if (jacobians[block] != NULL &&
!NumericDiff<CostFunctor, method, DYNAMIC,
DYNAMIC, DYNAMIC, DYNAMIC, DYNAMIC, DYNAMIC,

View File

@@ -27,121 +27,194 @@
// POSSIBILITY OF SUCH DAMAGE.
// Copyright 2007 Google Inc. All Rights Reserved.
//
// Authors: wjr@google.com (William Rucklidge),
// keir@google.com (Keir Mierle),
// dgossow@google.com (David Gossow)
// Author: wjr@google.com (William Rucklidge)
//
// This file contains a class that exercises a cost function, to make sure
// that it is computing reasonable derivatives. It compares the Jacobians
// computed by the cost function with those obtained by finite
// differences.
#ifndef CERES_PUBLIC_GRADIENT_CHECKER_H_
#define CERES_PUBLIC_GRADIENT_CHECKER_H_
#include <cstddef>
#include <algorithm>
#include <vector>
#include <string>
#include "ceres/cost_function.h"
#include "ceres/dynamic_numeric_diff_cost_function.h"
#include "ceres/internal/eigen.h"
#include "ceres/internal/fixed_array.h"
#include "ceres/internal/macros.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/local_parameterization.h"
#include "ceres/numeric_diff_cost_function.h"
#include "glog/logging.h"
namespace ceres {
// GradientChecker compares the Jacobians returned by a cost function against
// derivatives estimated using finite differencing.
// An object that exercises a cost function, to compare the answers that it
// gives with derivatives estimated using finite differencing.
//
// The condition enforced is that
//
// (J_actual(i, j) - J_numeric(i, j))
// ------------------------------------ < relative_precision
// max(J_actual(i, j), J_numeric(i, j))
//
// where J_actual(i, j) is the jacobian as computed by the supplied cost
// function (by the user) multiplied by the local parameterization Jacobian
// and J_numeric is the jacobian as computed by finite differences, multiplied
// by the local parameterization Jacobian as well.
// The only likely usage of this is for testing.
//
// How to use: Fill in an array of pointers to parameter blocks for your
// CostFunction, and then call Probe(). Check that the return value is 'true'.
// CostFunction, and then call Probe(). Check that the return value is
// 'true'. See prober_test.cc for an example.
//
// This is templated similarly to NumericDiffCostFunction, as it internally
// uses that.
template <typename CostFunctionToProbe,
int M = 0, int N0 = 0, int N1 = 0, int N2 = 0, int N3 = 0, int N4 = 0>
class GradientChecker {
public:
// This will not take ownership of the cost function or local
// parameterizations.
//
// function: The cost function to probe.
// local_parameterization: A vector of local parameterizations for each
// parameter. May be NULL or contain NULL pointers to indicate that the
// respective parameter does not have a local parameterization.
// options: Options to use for numerical differentiation.
GradientChecker(
const CostFunction* function,
const std::vector<const LocalParameterization*>* local_parameterizations,
const NumericDiffOptions& options);
// Here we stash some results from the probe, for later
// inspection.
struct GradientCheckResults {
// Computed cost.
Vector cost;
// Contains results from a call to Probe for later inspection.
struct ProbeResults {
// The return value of the cost function.
bool return_value;
// Computed residual vector.
Vector residuals;
// The sizes of the Jacobians below are dictated by the cost function's
// parameter block size and residual block sizes. If a parameter block
// has a local parameterization associated with it, the size of the "local"
// Jacobian will be determined by the local parameterization dimension and
// residual block size, otherwise it will be identical to the regular
// Jacobian.
// The sizes of these matrices are dictated by the cost function's
// parameter and residual block sizes. Each vector's length will
// term->parameter_block_sizes().size(), and each matrix is the
// Jacobian of the residual with respect to the corresponding parameter
// block.
// Derivatives as computed by the cost function.
std::vector<Matrix> jacobians;
std::vector<Matrix> term_jacobians;
// Derivatives as computed by the cost function in local space.
std::vector<Matrix> local_jacobians;
// Derivatives as computed by finite differencing.
std::vector<Matrix> finite_difference_jacobians;
// Derivatives as computed by nuerical differentiation in local space.
std::vector<Matrix> numeric_jacobians;
// Derivatives as computed by nuerical differentiation in local space.
std::vector<Matrix> local_numeric_jacobians;
// Contains the maximum relative error found in the local Jacobians.
double maximum_relative_error;
// If an error was detected, this will contain a detailed description of
// that error.
std::string error_log;
// Infinity-norm of term_jacobians - finite_difference_jacobians.
double error_jacobians;
};
// Call the cost function, compute alternative Jacobians using finite
// differencing and compare results. If local parameterizations are given,
// the Jacobians will be multiplied by the local parameterization Jacobians
// before performing the check, which effectively means that all errors along
// the null space of the local parameterization will be ignored.
// Returns false if the Jacobians don't match, the cost function return false,
// or if the cost function returns different residual when called with a
// Jacobian output argument vs. calling it without. Otherwise returns true.
// Checks the Jacobian computed by a cost function.
//
// parameters: The parameter values at which to probe.
// relative_precision: A threshold for the relative difference between the
// Jacobians. If the Jacobians differ by more than this amount, then the
// probe fails.
// results: On return, the Jacobians (and other information) will be stored
// here. May be NULL.
// probe_point: The parameter values at which to probe.
// error_tolerance: A threshold for the infinity-norm difference
// between the Jacobians. If the Jacobians differ by more than
// this amount, then the probe fails.
//
// term: The cost function to test. Not retained after this call returns.
//
// results: On return, the two Jacobians (and other information)
// will be stored here. May be NULL.
//
// Returns true if no problems are detected and the difference between the
// Jacobians is less than error_tolerance.
bool Probe(double const* const* parameters,
double relative_precision,
ProbeResults* results) const;
static bool Probe(double const* const* probe_point,
double error_tolerance,
CostFunctionToProbe *term,
GradientCheckResults* results) {
CHECK_NOTNULL(probe_point);
CHECK_NOTNULL(term);
LOG(INFO) << "-------------------- Starting Probe() --------------------";
// We need a GradientCheckeresults, whether or not they supplied one.
internal::scoped_ptr<GradientCheckResults> owned_results;
if (results == NULL) {
owned_results.reset(new GradientCheckResults);
results = owned_results.get();
}
// Do a consistency check between the term and the template parameters.
CHECK_EQ(M, term->num_residuals());
const int num_residuals = M;
const std::vector<int32>& block_sizes = term->parameter_block_sizes();
const int num_blocks = block_sizes.size();
CHECK_LE(num_blocks, 5) << "Unable to test functions that take more "
<< "than 5 parameter blocks";
if (N0) {
CHECK_EQ(N0, block_sizes[0]);
CHECK_GE(num_blocks, 1);
} else {
CHECK_LT(num_blocks, 1);
}
if (N1) {
CHECK_EQ(N1, block_sizes[1]);
CHECK_GE(num_blocks, 2);
} else {
CHECK_LT(num_blocks, 2);
}
if (N2) {
CHECK_EQ(N2, block_sizes[2]);
CHECK_GE(num_blocks, 3);
} else {
CHECK_LT(num_blocks, 3);
}
if (N3) {
CHECK_EQ(N3, block_sizes[3]);
CHECK_GE(num_blocks, 4);
} else {
CHECK_LT(num_blocks, 4);
}
if (N4) {
CHECK_EQ(N4, block_sizes[4]);
CHECK_GE(num_blocks, 5);
} else {
CHECK_LT(num_blocks, 5);
}
results->term_jacobians.clear();
results->term_jacobians.resize(num_blocks);
results->finite_difference_jacobians.clear();
results->finite_difference_jacobians.resize(num_blocks);
internal::FixedArray<double*> term_jacobian_pointers(num_blocks);
internal::FixedArray<double*>
finite_difference_jacobian_pointers(num_blocks);
for (int i = 0; i < num_blocks; i++) {
results->term_jacobians[i].resize(num_residuals, block_sizes[i]);
term_jacobian_pointers[i] = results->term_jacobians[i].data();
results->finite_difference_jacobians[i].resize(
num_residuals, block_sizes[i]);
finite_difference_jacobian_pointers[i] =
results->finite_difference_jacobians[i].data();
}
results->cost.resize(num_residuals, 1);
CHECK(term->Evaluate(probe_point, results->cost.data(),
term_jacobian_pointers.get()));
NumericDiffCostFunction<CostFunctionToProbe, CENTRAL, M, N0, N1, N2, N3, N4>
numeric_term(term, DO_NOT_TAKE_OWNERSHIP);
CHECK(numeric_term.Evaluate(probe_point, results->cost.data(),
finite_difference_jacobian_pointers.get()));
results->error_jacobians = 0;
for (int i = 0; i < num_blocks; i++) {
Matrix jacobian_difference = results->term_jacobians[i] -
results->finite_difference_jacobians[i];
results->error_jacobians =
std::max(results->error_jacobians,
jacobian_difference.lpNorm<Eigen::Infinity>());
}
LOG(INFO) << "========== term-computed derivatives ==========";
for (int i = 0; i < num_blocks; i++) {
LOG(INFO) << "term_computed block " << i;
LOG(INFO) << "\n" << results->term_jacobians[i];
}
LOG(INFO) << "========== finite-difference derivatives ==========";
for (int i = 0; i < num_blocks; i++) {
LOG(INFO) << "finite_difference block " << i;
LOG(INFO) << "\n" << results->finite_difference_jacobians[i];
}
LOG(INFO) << "========== difference ==========";
for (int i = 0; i < num_blocks; i++) {
LOG(INFO) << "difference block " << i;
LOG(INFO) << (results->term_jacobians[i] -
results->finite_difference_jacobians[i]);
}
LOG(INFO) << "||difference|| = " << results->error_jacobians;
return results->error_jacobians < error_tolerance;
}
private:
CERES_DISALLOW_IMPLICIT_CONSTRUCTORS(GradientChecker);
std::vector<const LocalParameterization*> local_parameterizations_;
const CostFunction* function_;
internal::scoped_ptr<CostFunction> finite_diff_cost_function_;
};
} // namespace ceres

View File

@@ -33,8 +33,9 @@
// This file needs to compile as c code.
#ifdef __cplusplus
#include <cstddef>
#include "ceres/internal/config.h"
#if defined(CERES_TR1_MEMORY_HEADER)
#include <tr1/memory>
#else
@@ -49,25 +50,6 @@ using std::tr1::shared_ptr;
using std::shared_ptr;
#endif
// We allocate some Eigen objects on the stack and other places they
// might not be aligned to 16-byte boundaries. If we have C++11, we
// can specify their alignment anyway, and thus can safely enable
// vectorization on those matrices; in C++99, we are out of luck. Figure out
// what case we're in and write macros that do the right thing.
#ifdef CERES_USE_CXX11
namespace port_constants {
static constexpr size_t kMaxAlignBytes =
// Work around a GCC 4.8 bug
// (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56019) where
// std::max_align_t is misplaced.
#if defined (__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8
alignof(::max_align_t);
#else
alignof(std::max_align_t);
#endif
} // namespace port_constants
#endif
} // namespace ceres
#endif // __cplusplus

View File

@@ -69,7 +69,7 @@ struct CERES_EXPORT IterationSummary {
// Step was numerically valid, i.e., all values are finite and the
// step reduces the value of the linearized model.
//
// Note: step_is_valid is always true when iteration = 0.
// Note: step_is_valid is false when iteration = 0.
bool step_is_valid;
// Step did not reduce the value of the objective function
@@ -77,7 +77,7 @@ struct CERES_EXPORT IterationSummary {
// acceptance criterion used by the non-monotonic trust region
// algorithm.
//
// Note: step_is_nonmonotonic is always false when iteration = 0;
// Note: step_is_nonmonotonic is false when iteration = 0;
bool step_is_nonmonotonic;
// Whether or not the minimizer accepted this step or not. If the
@@ -89,7 +89,7 @@ struct CERES_EXPORT IterationSummary {
// relative decrease is not sufficient, the algorithm may accept the
// step and the step is declared successful.
//
// Note: step_is_successful is always true when iteration = 0.
// Note: step_is_successful is false when iteration = 0.
bool step_is_successful;
// Value of the objective function.

View File

@@ -164,7 +164,6 @@
#include "Eigen/Core"
#include "ceres/fpclassify.h"
#include "ceres/internal/port.h"
namespace ceres {
@@ -228,23 +227,21 @@ struct Jet {
T a;
// The infinitesimal part.
// We allocate Jets on the stack and other places they
// might not be aligned to 16-byte boundaries. If we have C++11, we
// can specify their alignment anyway, and thus can safely enable
// vectorization on those matrices; in C++99, we are out of luck. Figure out
// what case we're in and do the right thing.
#ifndef CERES_USE_CXX11
// fall back to safe version:
//
// Note the Eigen::DontAlign bit is needed here because this object
// gets allocated on the stack and as part of other arrays and
// structs. Forcing the right alignment there is the source of much
// pain and suffering. Even if that works, passing Jets around to
// functions by value has problems because the C++ ABI does not
// guarantee alignment for function arguments.
//
// Setting the DontAlign bit prevents Eigen from using SSE for the
// various operations on Jets. This is a small performance penalty
// since the AutoDiff code will still expose much of the code as
// statically sized loops to the compiler. But given the subtle
// issues that arise due to alignment, especially when dealing with
// multiple platforms, it seems to be a trade off worth making.
Eigen::Matrix<T, N, 1, Eigen::DontAlign> v;
#else
static constexpr bool kShouldAlignMatrix =
16 <= ::ceres::port_constants::kMaxAlignBytes;
static constexpr int kAlignHint = kShouldAlignMatrix ?
Eigen::AutoAlign : Eigen::DontAlign;
static constexpr size_t kAlignment = kShouldAlignMatrix ? 16 : 1;
alignas(kAlignment) Eigen::Matrix<T, N, 1, kAlignHint> v;
#endif
};
// Unary +
@@ -391,8 +388,6 @@ inline double atan (double x) { return std::atan(x); }
inline double sinh (double x) { return std::sinh(x); }
inline double cosh (double x) { return std::cosh(x); }
inline double tanh (double x) { return std::tanh(x); }
inline double floor (double x) { return std::floor(x); }
inline double ceil (double x) { return std::ceil(x); }
inline double pow (double x, double y) { return std::pow(x, y); }
inline double atan2(double y, double x) { return std::atan2(y, x); }
@@ -487,51 +482,10 @@ Jet<T, N> tanh(const Jet<T, N>& f) {
return Jet<T, N>(tanh_a, tmp * f.v);
}
// The floor function should be used with extreme care as this operation will
// result in a zero derivative which provides no information to the solver.
//
// floor(a + h) ~= floor(a) + 0
template <typename T, int N> inline
Jet<T, N> floor(const Jet<T, N>& f) {
return Jet<T, N>(floor(f.a));
}
// The ceil function should be used with extreme care as this operation will
// result in a zero derivative which provides no information to the solver.
//
// ceil(a + h) ~= ceil(a) + 0
template <typename T, int N> inline
Jet<T, N> ceil(const Jet<T, N>& f) {
return Jet<T, N>(ceil(f.a));
}
// Bessel functions of the first kind with integer order equal to 0, 1, n.
//
// Microsoft has deprecated the j[0,1,n]() POSIX Bessel functions in favour of
// _j[0,1,n](). Where available on MSVC, use _j[0,1,n]() to avoid deprecated
// function errors in client code (the specific warning is suppressed when
// Ceres itself is built).
inline double BesselJ0(double x) {
#if defined(_MSC_VER) && defined(_j0)
return _j0(x);
#else
return j0(x);
#endif
}
inline double BesselJ1(double x) {
#if defined(_MSC_VER) && defined(_j1)
return _j1(x);
#else
return j1(x);
#endif
}
inline double BesselJn(int n, double x) {
#if defined(_MSC_VER) && defined(_jn)
return _jn(n, x);
#else
return jn(n, x);
#endif
}
inline double BesselJ0(double x) { return j0(x); }
inline double BesselJ1(double x) { return j1(x); }
inline double BesselJn(int n, double x) { return jn(n, x); }
// For the formulae of the derivatives of the Bessel functions see the book:
// Olver, Lozier, Boisvert, Clark, NIST Handbook of Mathematical Functions,
@@ -789,15 +743,7 @@ template<typename T, int N> inline Jet<T, N> ei_pow (const Jet<T, N>& x,
// strange compile errors.
template <typename T, int N>
inline std::ostream &operator<<(std::ostream &s, const Jet<T, N>& z) {
s << "[" << z.a << " ; ";
for (int i = 0; i < N; ++i) {
s << z.v[i];
if (i != N - 1) {
s << ", ";
}
}
s << "]";
return s;
return s << "[" << z.a << " ; " << z.v.transpose() << "]";
}
} // namespace ceres
@@ -811,7 +757,6 @@ struct NumTraits<ceres::Jet<T, N> > {
typedef ceres::Jet<T, N> Real;
typedef ceres::Jet<T, N> NonInteger;
typedef ceres::Jet<T, N> Nested;
typedef ceres::Jet<T, N> Literal;
static typename ceres::Jet<T, N> dummy_precision() {
return ceres::Jet<T, N>(1e-12);
@@ -832,21 +777,6 @@ struct NumTraits<ceres::Jet<T, N> > {
HasFloatingPoint = 1,
RequireInitialization = 1
};
template<bool Vectorized>
struct Div {
enum {
#if defined(EIGEN_VECTORIZE_AVX)
AVX = true,
#else
AVX = false,
#endif
// Assuming that for Jets, division is as expensive as
// multiplication.
Cost = 3
};
};
};
} // namespace Eigen

View File

@@ -211,28 +211,6 @@ class CERES_EXPORT QuaternionParameterization : public LocalParameterization {
virtual int LocalSize() const { return 3; }
};
// Implements the quaternion local parameterization for Eigen's representation
// of the quaternion. Eigen uses a different internal memory layout for the
// elements of the quaternion than what is commonly used. Specifically, Eigen
// stores the elements in memory as [x, y, z, w] where the real part is last
// whereas it is typically stored first. Note, when creating an Eigen quaternion
// through the constructor the elements are accepted in w, x, y, z order. Since
// Ceres operates on parameter blocks which are raw double pointers this
// difference is important and requires a different parameterization.
//
// Plus(x, delta) = [sin(|delta|) delta / |delta|, cos(|delta|)] * x
// with * being the quaternion multiplication operator.
class EigenQuaternionParameterization : public ceres::LocalParameterization {
public:
virtual ~EigenQuaternionParameterization() {}
virtual bool Plus(const double* x,
const double* delta,
double* x_plus_delta) const;
virtual bool ComputeJacobian(const double* x,
double* jacobian) const;
virtual int GlobalSize() const { return 4; }
virtual int LocalSize() const { return 3; }
};
// This provides a parameterization for homogeneous vectors which are commonly
// used in Structure for Motion problems. One example where they are used is

View File

@@ -206,6 +206,29 @@ class NumericDiffCostFunction
}
}
// Deprecated. New users should avoid using this constructor. Instead, use the
// constructor with NumericDiffOptions.
NumericDiffCostFunction(CostFunctor* functor,
Ownership ownership,
int num_residuals,
const double relative_step_size)
:functor_(functor),
ownership_(ownership),
options_() {
LOG(WARNING) << "This constructor is deprecated and will be removed in "
"a future version. Please use the NumericDiffOptions "
"constructor instead.";
if (kNumResiduals == DYNAMIC) {
SizedCostFunction<kNumResiduals,
N0, N1, N2, N3, N4,
N5, N6, N7, N8, N9>
::set_num_residuals(num_residuals);
}
options_.relative_step_size = relative_step_size;
}
~NumericDiffCostFunction() {
if (ownership_ != TAKE_OWNERSHIP) {
functor_.release();

View File

@@ -309,9 +309,6 @@ class CERES_EXPORT Problem {
// Allow the indicated parameter block to vary during optimization.
void SetParameterBlockVariable(double* values);
// Returns true if a parameter block is set constant, and false otherwise.
bool IsParameterBlockConstant(double* values) const;
// Set the local parameterization for one of the parameter blocks.
// The local_parameterization is owned by the Problem by default. It
// is acceptable to set the same parameterization for multiple
@@ -464,10 +461,6 @@ class CERES_EXPORT Problem {
// parameter block has a local parameterization, then it contributes
// "LocalSize" entries to the gradient vector (and the number of
// columns in the jacobian).
//
// Note 3: This function cannot be called while the problem is being
// solved, for example it cannot be called from an IterationCallback
// at the end of an iteration during a solve.
bool Evaluate(const EvaluateOptions& options,
double* cost,
std::vector<double>* residuals,

View File

@@ -48,6 +48,7 @@
#include <algorithm>
#include <cmath>
#include <limits>
#include "glog/logging.h"
namespace ceres {
@@ -417,6 +418,7 @@ template <typename T>
inline void EulerAnglesToRotationMatrix(const T* euler,
const int row_stride_parameter,
T* R) {
CHECK_EQ(row_stride_parameter, 3);
EulerAnglesToRotationMatrix(euler, RowMajorAdapter3x3(R));
}
@@ -494,6 +496,7 @@ void QuaternionToRotation(const T q[4],
QuaternionToScaledRotation(q, R);
T normalizer = q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3];
CHECK_NE(normalizer, T(0));
normalizer = T(1) / normalizer;
for (int i = 0; i < 3; ++i) {

View File

@@ -134,7 +134,7 @@ class CERES_EXPORT Solver {
trust_region_problem_dump_format_type = TEXTFILE;
check_gradients = false;
gradient_check_relative_precision = 1e-8;
gradient_check_numeric_derivative_relative_step_size = 1e-6;
numeric_derivative_relative_step_size = 1e-6;
update_state_every_iteration = false;
}
@@ -701,22 +701,12 @@ class CERES_EXPORT Solver {
// this number, then the jacobian for that cost term is dumped.
double gradient_check_relative_precision;
// WARNING: This option only applies to the to the numeric
// differentiation used for checking the user provided derivatives
// when when Solver::Options::check_gradients is true. If you are
// using NumericDiffCostFunction and are interested in changing
// the step size for numeric differentiation in your cost
// function, please have a look at
// include/ceres/numeric_diff_options.h.
// Relative shift used for taking numeric derivatives. For finite
// differencing, each dimension is evaluated at slightly shifted
// values; for the case of central difference, this is what gets
// evaluated:
//
// Relative shift used for taking numeric derivatives when
// Solver::Options::check_gradients is true.
//
// For finite differencing, each dimension is evaluated at
// slightly shifted values; for the case of central difference,
// this is what gets evaluated:
//
// delta = gradient_check_numeric_derivative_relative_step_size;
// delta = numeric_derivative_relative_step_size;
// f_initial = f(x)
// f_forward = f((1 + delta) * x)
// f_backward = f((1 - delta) * x)
@@ -733,7 +723,7 @@ class CERES_EXPORT Solver {
// theory a good choice is sqrt(eps) * x, which for doubles means
// about 1e-8 * x. However, I have found this number too
// optimistic. This number should be exposed for users to change.
double gradient_check_numeric_derivative_relative_step_size;
double numeric_derivative_relative_step_size;
// If true, the user's parameter blocks are updated at the end of
// every Minimizer iteration, otherwise they are updated when the
@@ -811,13 +801,6 @@ class CERES_EXPORT Solver {
// Number of times inner iterations were performed.
int num_inner_iteration_steps;
// Total number of iterations inside the line search algorithm
// across all invocations. We call these iterations "steps" to
// distinguish them from the outer iterations of the line search
// and trust region minimizer algorithms which call the line
// search algorithm as a subroutine.
int num_line_search_steps;
// All times reported below are wall times.
// When the user calls Solve, before the actual optimization

View File

@@ -32,7 +32,7 @@
#define CERES_PUBLIC_VERSION_H_
#define CERES_VERSION_MAJOR 1
#define CERES_VERSION_MINOR 12
#define CERES_VERSION_MINOR 11
#define CERES_VERSION_REVISION 0
// Classic CPP stringifcation; the extra level of indirection allows the

View File

@@ -46,7 +46,6 @@ namespace internal {
using std::make_pair;
using std::pair;
using std::vector;
using std::adjacent_find;
void CompressedRowJacobianWriter::PopulateJacobianRowAndColumnBlockVectors(
const Program* program, CompressedRowSparseMatrix* jacobian) {
@@ -141,21 +140,12 @@ SparseMatrix* CompressedRowJacobianWriter::CreateJacobian() const {
// Sort the parameters by their position in the state vector.
sort(parameter_indices.begin(), parameter_indices.end());
if (adjacent_find(parameter_indices.begin(), parameter_indices.end()) !=
parameter_indices.end()) {
std::string parameter_block_description;
for (int j = 0; j < num_parameter_blocks; ++j) {
ParameterBlock* parameter_block = residual_block->parameter_blocks()[j];
parameter_block_description +=
parameter_block->ToString() + "\n";
}
LOG(FATAL) << "Ceres internal error: "
<< "Duplicate parameter blocks detected in a cost function. "
<< "This should never happen. Please report this to "
<< "the Ceres developers.\n"
<< "Residual Block: " << residual_block->ToString() << "\n"
<< "Parameter Blocks: " << parameter_block_description;
}
CHECK(unique(parameter_indices.begin(), parameter_indices.end()) ==
parameter_indices.end())
<< "Ceres internal error: "
<< "Duplicate parameter blocks detected in a cost function. "
<< "This should never happen. Please report this to "
<< "the Ceres developers.";
// Update the row indices.
const int num_residuals = residual_block->NumResiduals();

View File

@@ -38,7 +38,6 @@
namespace ceres {
using std::make_pair;
using std::pair;
using std::vector;
@@ -55,12 +54,6 @@ bool Covariance::Compute(
return impl_->Compute(covariance_blocks, problem->problem_impl_.get());
}
bool Covariance::Compute(
const vector<const double*>& parameter_blocks,
Problem* problem) {
return impl_->Compute(parameter_blocks, problem->problem_impl_.get());
}
bool Covariance::GetCovarianceBlock(const double* parameter_block1,
const double* parameter_block2,
double* covariance_block) const {
@@ -80,20 +73,4 @@ bool Covariance::GetCovarianceBlockInTangentSpace(
covariance_block);
}
bool Covariance::GetCovarianceMatrix(
const vector<const double*>& parameter_blocks,
double* covariance_matrix) {
return impl_->GetCovarianceMatrixInTangentOrAmbientSpace(parameter_blocks,
true, // ambient
covariance_matrix);
}
bool Covariance::GetCovarianceMatrixInTangentSpace(
const std::vector<const double *>& parameter_blocks,
double *covariance_matrix) {
return impl_->GetCovarianceMatrixInTangentOrAmbientSpace(parameter_blocks,
false, // tangent
covariance_matrix);
}
} // namespace ceres

View File

@@ -36,8 +36,6 @@
#include <algorithm>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <utility>
#include <vector>
@@ -45,7 +43,6 @@
#include "Eigen/SparseQR"
#include "Eigen/SVD"
#include "ceres/collections_port.h"
#include "ceres/compressed_col_sparse_matrix_utils.h"
#include "ceres/compressed_row_sparse_matrix.h"
#include "ceres/covariance.h"
@@ -54,7 +51,6 @@
#include "ceres/map_util.h"
#include "ceres/parameter_block.h"
#include "ceres/problem_impl.h"
#include "ceres/residual_block.h"
#include "ceres/suitesparse.h"
#include "ceres/wall_time.h"
#include "glog/logging.h"
@@ -65,7 +61,6 @@ namespace internal {
using std::make_pair;
using std::map;
using std::pair;
using std::sort;
using std::swap;
using std::vector;
@@ -91,38 +86,8 @@ CovarianceImpl::CovarianceImpl(const Covariance::Options& options)
CovarianceImpl::~CovarianceImpl() {
}
template <typename T> void CheckForDuplicates(vector<T> blocks) {
sort(blocks.begin(), blocks.end());
typename vector<T>::iterator it =
std::adjacent_find(blocks.begin(), blocks.end());
if (it != blocks.end()) {
// In case there are duplicates, we search for their location.
map<T, vector<int> > blocks_map;
for (int i = 0; i < blocks.size(); ++i) {
blocks_map[blocks[i]].push_back(i);
}
std::ostringstream duplicates;
while (it != blocks.end()) {
duplicates << "(";
for (int i = 0; i < blocks_map[*it].size() - 1; ++i) {
duplicates << blocks_map[*it][i] << ", ";
}
duplicates << blocks_map[*it].back() << ")";
it = std::adjacent_find(it + 1, blocks.end());
if (it < blocks.end()) {
duplicates << " and ";
}
}
LOG(FATAL) << "Covariance::Compute called with duplicate blocks at "
<< "indices " << duplicates.str();
}
}
bool CovarianceImpl::Compute(const CovarianceBlocks& covariance_blocks,
ProblemImpl* problem) {
CheckForDuplicates<pair<const double*, const double*> >(covariance_blocks);
problem_ = problem;
parameter_block_to_row_index_.clear();
covariance_matrix_.reset(NULL);
@@ -132,20 +97,6 @@ bool CovarianceImpl::Compute(const CovarianceBlocks& covariance_blocks,
return is_valid_;
}
bool CovarianceImpl::Compute(const vector<const double*>& parameter_blocks,
ProblemImpl* problem) {
CheckForDuplicates<const double*>(parameter_blocks);
CovarianceBlocks covariance_blocks;
for (int i = 0; i < parameter_blocks.size(); ++i) {
for (int j = i; j < parameter_blocks.size(); ++j) {
covariance_blocks.push_back(make_pair(parameter_blocks[i],
parameter_blocks[j]));
}
}
return Compute(covariance_blocks, problem);
}
bool CovarianceImpl::GetCovarianceBlockInTangentOrAmbientSpace(
const double* original_parameter_block1,
const double* original_parameter_block2,
@@ -169,17 +120,9 @@ bool CovarianceImpl::GetCovarianceBlockInTangentOrAmbientSpace(
ParameterBlock* block2 =
FindOrDie(parameter_map,
const_cast<double*>(original_parameter_block2));
const int block1_size = block1->Size();
const int block2_size = block2->Size();
const int block1_local_size = block1->LocalSize();
const int block2_local_size = block2->LocalSize();
if (!lift_covariance_to_ambient_space) {
MatrixRef(covariance_block, block1_local_size, block2_local_size)
.setZero();
} else {
MatrixRef(covariance_block, block1_size, block2_size).setZero();
}
MatrixRef(covariance_block, block1_size, block2_size).setZero();
return true;
}
@@ -297,94 +240,6 @@ bool CovarianceImpl::GetCovarianceBlockInTangentOrAmbientSpace(
return true;
}
bool CovarianceImpl::GetCovarianceMatrixInTangentOrAmbientSpace(
const vector<const double*>& parameters,
bool lift_covariance_to_ambient_space,
double* covariance_matrix) const {
CHECK(is_computed_)
<< "Covariance::GetCovarianceMatrix called before Covariance::Compute";
CHECK(is_valid_)
<< "Covariance::GetCovarianceMatrix called when Covariance::Compute "
<< "returned false.";
const ProblemImpl::ParameterMap& parameter_map = problem_->parameter_map();
// For OpenMP compatibility we need to define these vectors in advance
const int num_parameters = parameters.size();
vector<int> parameter_sizes;
vector<int> cum_parameter_size;
parameter_sizes.reserve(num_parameters);
cum_parameter_size.resize(num_parameters + 1);
cum_parameter_size[0] = 0;
for (int i = 0; i < num_parameters; ++i) {
ParameterBlock* block =
FindOrDie(parameter_map, const_cast<double*>(parameters[i]));
if (lift_covariance_to_ambient_space) {
parameter_sizes.push_back(block->Size());
} else {
parameter_sizes.push_back(block->LocalSize());
}
}
std::partial_sum(parameter_sizes.begin(), parameter_sizes.end(),
cum_parameter_size.begin() + 1);
const int max_covariance_block_size =
*std::max_element(parameter_sizes.begin(), parameter_sizes.end());
const int covariance_size = cum_parameter_size.back();
// Assemble the blocks in the covariance matrix.
MatrixRef covariance(covariance_matrix, covariance_size, covariance_size);
const int num_threads = options_.num_threads;
scoped_array<double> workspace(
new double[num_threads * max_covariance_block_size *
max_covariance_block_size]);
bool success = true;
// The collapse() directive is only supported in OpenMP 3.0 and higher. OpenMP
// 3.0 was released in May 2008 (hence the version number).
#if _OPENMP >= 200805
# pragma omp parallel for num_threads(num_threads) schedule(dynamic) collapse(2)
#else
# pragma omp parallel for num_threads(num_threads) schedule(dynamic)
#endif
for (int i = 0; i < num_parameters; ++i) {
for (int j = 0; j < num_parameters; ++j) {
// The second loop can't start from j = i for compatibility with OpenMP
// collapse command. The conditional serves as a workaround
if (j >= i) {
int covariance_row_idx = cum_parameter_size[i];
int covariance_col_idx = cum_parameter_size[j];
int size_i = parameter_sizes[i];
int size_j = parameter_sizes[j];
#ifdef CERES_USE_OPENMP
int thread_id = omp_get_thread_num();
#else
int thread_id = 0;
#endif
double* covariance_block =
workspace.get() +
thread_id * max_covariance_block_size * max_covariance_block_size;
if (!GetCovarianceBlockInTangentOrAmbientSpace(
parameters[i], parameters[j], lift_covariance_to_ambient_space,
covariance_block)) {
success = false;
}
covariance.block(covariance_row_idx, covariance_col_idx,
size_i, size_j) =
MatrixRef(covariance_block, size_i, size_j);
if (i != j) {
covariance.block(covariance_col_idx, covariance_row_idx,
size_j, size_i) =
MatrixRef(covariance_block, size_i, size_j).transpose();
}
}
}
}
return success;
}
// Determine the sparsity pattern of the covariance matrix based on
// the block pairs requested by the user.
bool CovarianceImpl::ComputeCovarianceSparsity(
@@ -397,28 +252,18 @@ bool CovarianceImpl::ComputeCovarianceSparsity(
vector<double*> all_parameter_blocks;
problem->GetParameterBlocks(&all_parameter_blocks);
const ProblemImpl::ParameterMap& parameter_map = problem->parameter_map();
HashSet<ParameterBlock*> parameter_blocks_in_use;
vector<ResidualBlock*> residual_blocks;
problem->GetResidualBlocks(&residual_blocks);
for (int i = 0; i < residual_blocks.size(); ++i) {
ResidualBlock* residual_block = residual_blocks[i];
parameter_blocks_in_use.insert(residual_block->parameter_blocks(),
residual_block->parameter_blocks() +
residual_block->NumParameterBlocks());
}
constant_parameter_blocks_.clear();
vector<double*>& active_parameter_blocks =
evaluate_options_.parameter_blocks;
active_parameter_blocks.clear();
for (int i = 0; i < all_parameter_blocks.size(); ++i) {
double* parameter_block = all_parameter_blocks[i];
ParameterBlock* block = FindOrDie(parameter_map, parameter_block);
if (!block->IsConstant() && (parameter_blocks_in_use.count(block) > 0)) {
active_parameter_blocks.push_back(parameter_block);
} else {
if (block->IsConstant()) {
constant_parameter_blocks_.insert(parameter_block);
} else {
active_parameter_blocks.push_back(parameter_block);
}
}
@@ -541,8 +386,8 @@ bool CovarianceImpl::ComputeCovarianceValues() {
switch (options_.algorithm_type) {
case DENSE_SVD:
return ComputeCovarianceValuesUsingDenseSVD();
case SUITE_SPARSE_QR:
#ifndef CERES_NO_SUITESPARSE
case SUITE_SPARSE_QR:
return ComputeCovarianceValuesUsingSuiteSparseQR();
#else
LOG(ERROR) << "SuiteSparse is required to use the "
@@ -779,10 +624,7 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingDenseSVD() {
if (automatic_truncation) {
break;
} else {
LOG(ERROR) << "Error: Covariance matrix is near rank deficient "
<< "and the user did not specify a non-zero"
<< "Covariance::Options::null_space_rank "
<< "to enable the computation of a Pseudo-Inverse. "
LOG(ERROR) << "Cholesky factorization of J'J is not reliable. "
<< "Reciprocal condition number: "
<< singular_value_ratio * singular_value_ratio << " "
<< "min_reciprocal_condition_number: "

View File

@@ -55,21 +55,12 @@ class CovarianceImpl {
const double*> >& covariance_blocks,
ProblemImpl* problem);
bool Compute(
const std::vector<const double*>& parameter_blocks,
ProblemImpl* problem);
bool GetCovarianceBlockInTangentOrAmbientSpace(
const double* parameter_block1,
const double* parameter_block2,
bool lift_covariance_to_ambient_space,
double* covariance_block) const;
bool GetCovarianceMatrixInTangentOrAmbientSpace(
const std::vector<const double*>& parameters,
bool lift_covariance_to_ambient_space,
double *covariance_matrix) const;
bool ComputeCovarianceSparsity(
const std::vector<std::pair<const double*,
const double*> >& covariance_blocks,

View File

@@ -1,276 +0,0 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2016 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Authors: wjr@google.com (William Rucklidge),
// keir@google.com (Keir Mierle),
// dgossow@google.com (David Gossow)
#include "ceres/gradient_checker.h"
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include "ceres/is_close.h"
#include "ceres/stringprintf.h"
#include "ceres/types.h"
namespace ceres {
using internal::IsClose;
using internal::StringAppendF;
using internal::StringPrintf;
using std::string;
using std::vector;
namespace {
// Evaluate the cost function and transform the returned Jacobians to
// the local space of the respective local parameterizations.
bool EvaluateCostFunction(
const ceres::CostFunction* function,
double const* const * parameters,
const std::vector<const ceres::LocalParameterization*>&
local_parameterizations,
Vector* residuals,
std::vector<Matrix>* jacobians,
std::vector<Matrix>* local_jacobians) {
CHECK_NOTNULL(residuals);
CHECK_NOTNULL(jacobians);
CHECK_NOTNULL(local_jacobians);
const vector<int32>& block_sizes = function->parameter_block_sizes();
const int num_parameter_blocks = block_sizes.size();
// Allocate Jacobian matrices in local space.
local_jacobians->resize(num_parameter_blocks);
vector<double*> local_jacobian_data(num_parameter_blocks);
for (int i = 0; i < num_parameter_blocks; ++i) {
int block_size = block_sizes.at(i);
if (local_parameterizations.at(i) != NULL) {
block_size = local_parameterizations.at(i)->LocalSize();
}
local_jacobians->at(i).resize(function->num_residuals(), block_size);
local_jacobians->at(i).setZero();
local_jacobian_data.at(i) = local_jacobians->at(i).data();
}
// Allocate Jacobian matrices in global space.
jacobians->resize(num_parameter_blocks);
vector<double*> jacobian_data(num_parameter_blocks);
for (int i = 0; i < num_parameter_blocks; ++i) {
jacobians->at(i).resize(function->num_residuals(), block_sizes.at(i));
jacobians->at(i).setZero();
jacobian_data.at(i) = jacobians->at(i).data();
}
// Compute residuals & jacobians.
CHECK_NE(0, function->num_residuals());
residuals->resize(function->num_residuals());
residuals->setZero();
if (!function->Evaluate(parameters, residuals->data(),
jacobian_data.data())) {
return false;
}
// Convert Jacobians from global to local space.
for (size_t i = 0; i < local_jacobians->size(); ++i) {
if (local_parameterizations.at(i) == NULL) {
local_jacobians->at(i) = jacobians->at(i);
} else {
int global_size = local_parameterizations.at(i)->GlobalSize();
int local_size = local_parameterizations.at(i)->LocalSize();
CHECK_EQ(jacobians->at(i).cols(), global_size);
Matrix global_J_local(global_size, local_size);
local_parameterizations.at(i)->ComputeJacobian(
parameters[i], global_J_local.data());
local_jacobians->at(i) = jacobians->at(i) * global_J_local;
}
}
return true;
}
} // namespace
GradientChecker::GradientChecker(
const CostFunction* function,
const vector<const LocalParameterization*>* local_parameterizations,
const NumericDiffOptions& options) :
function_(function) {
CHECK_NOTNULL(function);
if (local_parameterizations != NULL) {
local_parameterizations_ = *local_parameterizations;
} else {
local_parameterizations_.resize(function->parameter_block_sizes().size(),
NULL);
}
DynamicNumericDiffCostFunction<CostFunction, CENTRAL>*
finite_diff_cost_function =
new DynamicNumericDiffCostFunction<CostFunction, CENTRAL>(
function, DO_NOT_TAKE_OWNERSHIP, options);
finite_diff_cost_function_.reset(finite_diff_cost_function);
const vector<int32>& parameter_block_sizes =
function->parameter_block_sizes();
const int num_parameter_blocks = parameter_block_sizes.size();
for (int i = 0; i < num_parameter_blocks; ++i) {
finite_diff_cost_function->AddParameterBlock(parameter_block_sizes[i]);
}
finite_diff_cost_function->SetNumResiduals(function->num_residuals());
}
bool GradientChecker::Probe(double const* const * parameters,
double relative_precision,
ProbeResults* results_param) const {
int num_residuals = function_->num_residuals();
// Make sure that we have a place to store results, no matter if the user has
// provided an output argument.
ProbeResults* results;
ProbeResults results_local;
if (results_param != NULL) {
results = results_param;
results->residuals.resize(0);
results->jacobians.clear();
results->numeric_jacobians.clear();
results->local_jacobians.clear();
results->local_numeric_jacobians.clear();
results->error_log.clear();
} else {
results = &results_local;
}
results->maximum_relative_error = 0.0;
results->return_value = true;
// Evaluate the derivative using the user supplied code.
vector<Matrix>& jacobians = results->jacobians;
vector<Matrix>& local_jacobians = results->local_jacobians;
if (!EvaluateCostFunction(function_, parameters, local_parameterizations_,
&results->residuals, &jacobians, &local_jacobians)) {
results->error_log = "Function evaluation with Jacobians failed.";
results->return_value = false;
}
// Evaluate the derivative using numeric derivatives.
vector<Matrix>& numeric_jacobians = results->numeric_jacobians;
vector<Matrix>& local_numeric_jacobians = results->local_numeric_jacobians;
Vector finite_diff_residuals;
if (!EvaluateCostFunction(finite_diff_cost_function_.get(), parameters,
local_parameterizations_, &finite_diff_residuals,
&numeric_jacobians, &local_numeric_jacobians)) {
results->error_log += "\nFunction evaluation with numerical "
"differentiation failed.";
results->return_value = false;
}
if (!results->return_value) {
return false;
}
for (int i = 0; i < num_residuals; ++i) {
if (!IsClose(
results->residuals[i],
finite_diff_residuals[i],
relative_precision,
NULL,
NULL)) {
results->error_log = "Function evaluation with and without Jacobians "
"resulted in different residuals.";
LOG(INFO) << results->residuals.transpose();
LOG(INFO) << finite_diff_residuals.transpose();
return false;
}
}
// See if any elements have relative error larger than the threshold.
int num_bad_jacobian_components = 0;
double& worst_relative_error = results->maximum_relative_error;
worst_relative_error = 0;
// Accumulate the error message for all the jacobians, since it won't get
// output if there are no bad jacobian components.
string error_log;
for (int k = 0; k < function_->parameter_block_sizes().size(); k++) {
StringAppendF(&error_log,
"========== "
"Jacobian for " "block %d: (%ld by %ld)) "
"==========\n",
k,
static_cast<long>(local_jacobians[k].rows()),
static_cast<long>(local_jacobians[k].cols()));
// The funny spacing creates appropriately aligned column headers.
error_log +=
" block row col user dx/dy num diff dx/dy "
"abs error relative error parameter residual\n";
for (int i = 0; i < local_jacobians[k].rows(); i++) {
for (int j = 0; j < local_jacobians[k].cols(); j++) {
double term_jacobian = local_jacobians[k](i, j);
double finite_jacobian = local_numeric_jacobians[k](i, j);
double relative_error, absolute_error;
bool bad_jacobian_entry =
!IsClose(term_jacobian,
finite_jacobian,
relative_precision,
&relative_error,
&absolute_error);
worst_relative_error = std::max(worst_relative_error, relative_error);
StringAppendF(&error_log,
"%6d %4d %4d %17g %17g %17g %17g %17g %17g",
k, i, j,
term_jacobian, finite_jacobian,
absolute_error, relative_error,
parameters[k][j],
results->residuals[i]);
if (bad_jacobian_entry) {
num_bad_jacobian_components++;
StringAppendF(
&error_log,
" ------ (%d,%d,%d) Relative error worse than %g",
k, i, j, relative_precision);
}
error_log += "\n";
}
}
}
// Since there were some bad errors, dump comprehensive debug info.
if (num_bad_jacobian_components) {
string header = StringPrintf("\nDetected %d bad Jacobian component(s). "
"Worst relative error was %g.\n",
num_bad_jacobian_components,
worst_relative_error);
results->error_log = header + "\n" + error_log;
return false;
}
return true;
}
} // namespace ceres

View File

@@ -26,8 +26,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Authors: keir@google.com (Keir Mierle),
// dgossow@google.com (David Gossow)
// Author: keir@google.com (Keir Mierle)
#include "ceres/gradient_checking_cost_function.h"
@@ -37,7 +36,7 @@
#include <string>
#include <vector>
#include "ceres/gradient_checker.h"
#include "ceres/cost_function.h"
#include "ceres/internal/eigen.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/parameter_block.h"
@@ -60,25 +59,55 @@ using std::vector;
namespace {
// True if x and y have an absolute relative difference less than
// relative_precision and false otherwise. Stores the relative and absolute
// difference in relative/absolute_error if non-NULL.
bool IsClose(double x, double y, double relative_precision,
double *relative_error,
double *absolute_error) {
double local_absolute_error;
double local_relative_error;
if (!absolute_error) {
absolute_error = &local_absolute_error;
}
if (!relative_error) {
relative_error = &local_relative_error;
}
*absolute_error = abs(x - y);
*relative_error = *absolute_error / max(abs(x), abs(y));
if (x == 0 || y == 0) {
// If x or y is exactly zero, then relative difference doesn't have any
// meaning. Take the absolute difference instead.
*relative_error = *absolute_error;
}
return abs(*relative_error) < abs(relative_precision);
}
class GradientCheckingCostFunction : public CostFunction {
public:
GradientCheckingCostFunction(
const CostFunction* function,
const std::vector<const LocalParameterization*>* local_parameterizations,
const NumericDiffOptions& options,
double relative_precision,
const string& extra_info,
GradientCheckingIterationCallback* callback)
GradientCheckingCostFunction(const CostFunction* function,
const NumericDiffOptions& options,
double relative_precision,
const string& extra_info)
: function_(function),
gradient_checker_(function, local_parameterizations, options),
relative_precision_(relative_precision),
extra_info_(extra_info),
callback_(callback) {
CHECK_NOTNULL(callback_);
extra_info_(extra_info) {
DynamicNumericDiffCostFunction<CostFunction, CENTRAL>*
finite_diff_cost_function =
new DynamicNumericDiffCostFunction<CostFunction, CENTRAL>(
function,
DO_NOT_TAKE_OWNERSHIP,
options);
const vector<int32>& parameter_block_sizes =
function->parameter_block_sizes();
for (int i = 0; i < parameter_block_sizes.size(); ++i) {
finite_diff_cost_function->AddParameterBlock(parameter_block_sizes[i]);
}
*mutable_parameter_block_sizes() = parameter_block_sizes;
set_num_residuals(function->num_residuals());
finite_diff_cost_function->SetNumResiduals(num_residuals());
finite_diff_cost_function_.reset(finite_diff_cost_function);
}
virtual ~GradientCheckingCostFunction() { }
@@ -91,92 +120,133 @@ class GradientCheckingCostFunction : public CostFunction {
return function_->Evaluate(parameters, residuals, NULL);
}
GradientChecker::ProbeResults results;
bool okay = gradient_checker_.Probe(parameters,
relative_precision_,
&results);
int num_residuals = function_->num_residuals();
// If the cost function returned false, there's nothing we can say about
// the gradients.
if (results.return_value == false) {
// Make space for the jacobians of the two methods.
const vector<int32>& block_sizes = function_->parameter_block_sizes();
vector<Matrix> term_jacobians(block_sizes.size());
vector<Matrix> finite_difference_jacobians(block_sizes.size());
vector<double*> term_jacobian_pointers(block_sizes.size());
vector<double*> finite_difference_jacobian_pointers(block_sizes.size());
for (int i = 0; i < block_sizes.size(); i++) {
term_jacobians[i].resize(num_residuals, block_sizes[i]);
term_jacobian_pointers[i] = term_jacobians[i].data();
finite_difference_jacobians[i].resize(num_residuals, block_sizes[i]);
finite_difference_jacobian_pointers[i] =
finite_difference_jacobians[i].data();
}
// Evaluate the derivative using the user supplied code.
if (!function_->Evaluate(parameters,
residuals,
&term_jacobian_pointers[0])) {
LOG(WARNING) << "Function evaluation failed.";
return false;
}
// Copy the residuals.
const int num_residuals = function_->num_residuals();
MatrixRef(residuals, num_residuals, 1) = results.residuals;
// Evaluate the derivative using numeric derivatives.
finite_diff_cost_function_->Evaluate(
parameters,
residuals,
&finite_difference_jacobian_pointers[0]);
// Copy the original jacobian blocks into the jacobians array.
const vector<int32>& block_sizes = function_->parameter_block_sizes();
// See if any elements have relative error larger than the threshold.
int num_bad_jacobian_components = 0;
double worst_relative_error = 0;
// Accumulate the error message for all the jacobians, since it won't get
// output if there are no bad jacobian components.
string m;
for (int k = 0; k < block_sizes.size(); k++) {
// Copy the original jacobian blocks into the jacobians array.
if (jacobians[k] != NULL) {
MatrixRef(jacobians[k],
results.jacobians[k].rows(),
results.jacobians[k].cols()) = results.jacobians[k];
term_jacobians[k].rows(),
term_jacobians[k].cols()) = term_jacobians[k];
}
StringAppendF(&m,
"========== "
"Jacobian for " "block %d: (%ld by %ld)) "
"==========\n",
k,
static_cast<long>(term_jacobians[k].rows()),
static_cast<long>(term_jacobians[k].cols()));
// The funny spacing creates appropriately aligned column headers.
m += " block row col user dx/dy num diff dx/dy "
"abs error relative error parameter residual\n";
for (int i = 0; i < term_jacobians[k].rows(); i++) {
for (int j = 0; j < term_jacobians[k].cols(); j++) {
double term_jacobian = term_jacobians[k](i, j);
double finite_jacobian = finite_difference_jacobians[k](i, j);
double relative_error, absolute_error;
bool bad_jacobian_entry =
!IsClose(term_jacobian,
finite_jacobian,
relative_precision_,
&relative_error,
&absolute_error);
worst_relative_error = max(worst_relative_error, relative_error);
StringAppendF(&m, "%6d %4d %4d %17g %17g %17g %17g %17g %17g",
k, i, j,
term_jacobian, finite_jacobian,
absolute_error, relative_error,
parameters[k][j],
residuals[i]);
if (bad_jacobian_entry) {
num_bad_jacobian_components++;
StringAppendF(
&m, " ------ (%d,%d,%d) Relative error worse than %g",
k, i, j, relative_precision_);
}
m += "\n";
}
}
}
if (!okay) {
std::string error_log = "Gradient Error detected!\nExtra info for "
"this residual: " + extra_info_ + "\n" + results.error_log;
callback_->SetGradientErrorDetected(error_log);
// Since there were some bad errors, dump comprehensive debug info.
if (num_bad_jacobian_components) {
string header = StringPrintf("Detected %d bad jacobian component(s). "
"Worst relative error was %g.\n",
num_bad_jacobian_components,
worst_relative_error);
if (!extra_info_.empty()) {
header += "Extra info for this residual: " + extra_info_ + "\n";
}
LOG(WARNING) << "\n" << header << m;
}
return true;
}
private:
const CostFunction* function_;
GradientChecker gradient_checker_;
internal::scoped_ptr<CostFunction> finite_diff_cost_function_;
double relative_precision_;
string extra_info_;
GradientCheckingIterationCallback* callback_;
};
} // namespace
GradientCheckingIterationCallback::GradientCheckingIterationCallback()
: gradient_error_detected_(false) {
}
CallbackReturnType GradientCheckingIterationCallback::operator()(
const IterationSummary& summary) {
if (gradient_error_detected_) {
LOG(ERROR)<< "Gradient error detected. Terminating solver.";
return SOLVER_ABORT;
}
return SOLVER_CONTINUE;
}
void GradientCheckingIterationCallback::SetGradientErrorDetected(
std::string& error_log) {
mutex_.Lock();
gradient_error_detected_ = true;
error_log_ += "\n" + error_log;
mutex_.Unlock();
}
CostFunction* CreateGradientCheckingCostFunction(
const CostFunction* cost_function,
const std::vector<const LocalParameterization*>* local_parameterizations,
CostFunction *CreateGradientCheckingCostFunction(
const CostFunction *cost_function,
double relative_step_size,
double relative_precision,
const std::string& extra_info,
GradientCheckingIterationCallback* callback) {
const string& extra_info) {
NumericDiffOptions numeric_diff_options;
numeric_diff_options.relative_step_size = relative_step_size;
return new GradientCheckingCostFunction(cost_function,
local_parameterizations,
numeric_diff_options,
relative_precision, extra_info,
callback);
relative_precision,
extra_info);
}
ProblemImpl* CreateGradientCheckingProblemImpl(
ProblemImpl* problem_impl,
double relative_step_size,
double relative_precision,
GradientCheckingIterationCallback* callback) {
CHECK_NOTNULL(callback);
ProblemImpl* CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
double relative_step_size,
double relative_precision) {
// We create new CostFunctions by wrapping the original CostFunction
// in a gradient checking CostFunction. So its okay for the
// ProblemImpl to take ownership of it and destroy it. The
@@ -190,9 +260,6 @@ ProblemImpl* CreateGradientCheckingProblemImpl(
gradient_checking_problem_options.local_parameterization_ownership =
DO_NOT_TAKE_OWNERSHIP;
NumericDiffOptions numeric_diff_options;
numeric_diff_options.relative_step_size = relative_step_size;
ProblemImpl* gradient_checking_problem_impl = new ProblemImpl(
gradient_checking_problem_options);
@@ -227,26 +294,19 @@ ProblemImpl* CreateGradientCheckingProblemImpl(
string extra_info = StringPrintf(
"Residual block id %d; depends on parameters [", i);
vector<double*> parameter_blocks;
vector<const LocalParameterization*> local_parameterizations;
parameter_blocks.reserve(residual_block->NumParameterBlocks());
local_parameterizations.reserve(residual_block->NumParameterBlocks());
for (int j = 0; j < residual_block->NumParameterBlocks(); ++j) {
ParameterBlock* parameter_block = residual_block->parameter_blocks()[j];
parameter_blocks.push_back(parameter_block->mutable_user_state());
StringAppendF(&extra_info, "%p", parameter_block->mutable_user_state());
extra_info += (j < residual_block->NumParameterBlocks() - 1) ? ", " : "]";
local_parameterizations.push_back(problem_impl->GetParameterization(
parameter_block->mutable_user_state()));
}
// Wrap the original CostFunction in a GradientCheckingCostFunction.
CostFunction* gradient_checking_cost_function =
new GradientCheckingCostFunction(residual_block->cost_function(),
&local_parameterizations,
numeric_diff_options,
relative_precision,
extra_info,
callback);
CreateGradientCheckingCostFunction(residual_block->cost_function(),
relative_step_size,
relative_precision,
extra_info);
// The const_cast is necessary because
// ProblemImpl::AddResidualBlock can potentially take ownership of

View File

@@ -26,8 +26,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Authors: keir@google.com (Keir Mierle),
// dgossow@google.com (David Gossow)
// Author: keir@google.com (Keir Mierle)
#ifndef CERES_INTERNAL_GRADIENT_CHECKING_COST_FUNCTION_H_
#define CERES_INTERNAL_GRADIENT_CHECKING_COST_FUNCTION_H_
@@ -35,76 +34,50 @@
#include <string>
#include "ceres/cost_function.h"
#include "ceres/iteration_callback.h"
#include "ceres/local_parameterization.h"
#include "ceres/mutex.h"
namespace ceres {
namespace internal {
class ProblemImpl;
// Callback that collects information about gradient checking errors, and
// will abort the solve as soon as an error occurs.
class GradientCheckingIterationCallback : public IterationCallback {
public:
GradientCheckingIterationCallback();
// Will return SOLVER_CONTINUE until a gradient error has been detected,
// then return SOLVER_ABORT.
virtual CallbackReturnType operator()(const IterationSummary& summary);
// Notify this that a gradient error has occurred (thread safe).
void SetGradientErrorDetected(std::string& error_log);
// Retrieve error status (not thread safe).
bool gradient_error_detected() const { return gradient_error_detected_; }
const std::string& error_log() const { return error_log_; }
private:
bool gradient_error_detected_;
std::string error_log_;
// Mutex protecting member variables.
ceres::internal::Mutex mutex_;
};
// Creates a CostFunction that checks the Jacobians that cost_function computes
// with finite differences. This API is only intended for unit tests that intend
// to check the functionality of the GradientCheckingCostFunction
// implementation directly.
CostFunction* CreateGradientCheckingCostFunction(
const CostFunction* cost_function,
const std::vector<const LocalParameterization*>* local_parameterizations,
double relative_step_size,
double relative_precision,
const std::string& extra_info,
GradientCheckingIterationCallback* callback);
// Create a new ProblemImpl object from the input problem_impl, where all
// cost functions are wrapped so that each time their Evaluate method is called,
// an additional check is performed that compares the Jacobians computed by
// the original cost function with alternative Jacobians computed using
// numerical differentiation. If local parameterizations are given for any
// parameters, the Jacobians will be compared in the local space instead of the
// ambient space. For details on the gradient checking procedure, see the
// documentation of the GradientChecker class. If an error is detected in any
// iteration, the respective cost function will notify the
// GradientCheckingIterationCallback.
// Creates a CostFunction that checks the jacobians that cost_function computes
// with finite differences. Bad results are logged; required precision is
// controlled by relative_precision and the numeric differentiation step size is
// controlled with relative_step_size. See solver.h for a better explanation of
// relative_step_size. Caller owns result.
//
// The caller owns the returned ProblemImpl object.
// The condition enforced is that
//
// (J_actual(i, j) - J_numeric(i, j))
// ------------------------------------ < relative_precision
// max(J_actual(i, j), J_numeric(i, j))
//
// where J_actual(i, j) is the jacobian as computed by the supplied cost
// function (by the user) and J_numeric is the jacobian as computed by finite
// differences.
//
// Note: This is quite inefficient and is intended only for debugging.
CostFunction* CreateGradientCheckingCostFunction(
const CostFunction* cost_function,
double relative_step_size,
double relative_precision,
const std::string& extra_info);
// Create a new ProblemImpl object from the input problem_impl, where
// each CostFunctions in problem_impl are wrapped inside a
// GradientCheckingCostFunctions. This gives us a ProblemImpl object
// which checks its derivatives against estimates from numeric
// differentiation everytime a ResidualBlock is evaluated.
//
// relative_step_size and relative_precision are parameters to control
// the numeric differentiation and the relative tolerance between the
// jacobian computed by the CostFunctions in problem_impl and
// jacobians obtained by numerically differentiating them. See the
// documentation of 'numeric_derivative_relative_step_size' in solver.h for a
// better explanation.
ProblemImpl* CreateGradientCheckingProblemImpl(
ProblemImpl* problem_impl,
double relative_step_size,
double relative_precision,
GradientCheckingIterationCallback* callback);
// jacobians obtained by numerically differentiating them. For more
// details see the documentation for
// CreateGradientCheckingCostFunction above.
ProblemImpl* CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
double relative_step_size,
double relative_precision);
} // namespace internal
} // namespace ceres

View File

@@ -84,12 +84,6 @@ Solver::Options GradientProblemSolverOptionsToSolverOptions(
} // namespace
bool GradientProblemSolver::Options::IsValid(std::string* error) const {
const Solver::Options solver_options =
GradientProblemSolverOptionsToSolverOptions(*this);
return solver_options.IsValid(error);
}
GradientProblemSolver::~GradientProblemSolver() {
}
@@ -105,6 +99,8 @@ void GradientProblemSolver::Solve(const GradientProblemSolver::Options& options,
using internal::SetSummaryFinalCost;
double start_time = WallTimeInSeconds();
Solver::Options solver_options =
GradientProblemSolverOptionsToSolverOptions(options);
*CHECK_NOTNULL(summary) = Summary();
summary->num_parameters = problem.NumParameters();
@@ -116,16 +112,14 @@ void GradientProblemSolver::Solve(const GradientProblemSolver::Options& options,
summary->nonlinear_conjugate_gradient_type = options.nonlinear_conjugate_gradient_type; // NOLINT
// Check validity
if (!options.IsValid(&summary->message)) {
if (!solver_options.IsValid(&summary->message)) {
LOG(ERROR) << "Terminating: " << summary->message;
return;
}
// TODO(sameeragarwal): This is a bit convoluted, we should be able
// to convert to minimizer options directly, but this will do for
// now.
Minimizer::Options minimizer_options =
Minimizer::Options(GradientProblemSolverOptionsToSolverOptions(options));
// Assuming that the parameter blocks in the program have been
Minimizer::Options minimizer_options;
minimizer_options = Minimizer::Options(solver_options);
minimizer_options.evaluator.reset(new GradientProblemEvaluator(problem));
scoped_ptr<IterationCallback> logging_callback;

View File

@@ -1,59 +0,0 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2016 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Authors: keir@google.com (Keir Mierle), dgossow@google.com (David Gossow)
#include "ceres/is_close.h"
#include <algorithm>
#include <cmath>
namespace ceres {
namespace internal {
bool IsClose(double x, double y, double relative_precision,
double *relative_error,
double *absolute_error) {
double local_absolute_error;
double local_relative_error;
if (!absolute_error) {
absolute_error = &local_absolute_error;
}
if (!relative_error) {
relative_error = &local_relative_error;
}
*absolute_error = std::fabs(x - y);
*relative_error = *absolute_error / std::max(std::fabs(x), std::fabs(y));
if (x == 0 || y == 0) {
// If x or y is exactly zero, then relative difference doesn't have any
// meaning. Take the absolute difference instead.
*relative_error = *absolute_error;
}
return *relative_error < std::fabs(relative_precision);
}
} // namespace internal
} // namespace ceres

View File

@@ -1,51 +0,0 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2016 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Authors: keir@google.com (Keir Mierle), dgossow@google.com (David Gossow)
//
// Utility routine for comparing two values.
#ifndef CERES_INTERNAL_IS_CLOSE_H_
#define CERES_INTERNAL_IS_CLOSE_H_
namespace ceres {
namespace internal {
// Returns true if x and y have a relative (unsigned) difference less than
// relative_precision and false otherwise. Stores the relative and absolute
// difference in relative/absolute_error if non-NULL. If one of the two values
// is exactly zero, the absolute difference will be compared, and relative_error
// will be set to the absolute difference.
bool IsClose(double x,
double y,
double relative_precision,
double *relative_error,
double *absolute_error);
} // namespace internal
} // namespace ceres
#endif // CERES_INTERNAL_IS_CLOSE_H_

View File

@@ -191,7 +191,6 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options,
options.line_search_sufficient_curvature_decrease;
line_search_options.max_step_expansion =
options.max_line_search_step_expansion;
line_search_options.is_silent = options.is_silent;
line_search_options.function = &line_search_function;
scoped_ptr<LineSearch>
@@ -342,12 +341,10 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options,
"as the step was valid when it was selected by the line search.";
LOG_IF(WARNING, is_not_silent) << "Terminating: " << summary->message;
break;
}
if (!Evaluate(evaluator,
x_plus_delta,
&current_state,
&summary->message)) {
} else if (!Evaluate(evaluator,
x_plus_delta,
&current_state,
&summary->message)) {
summary->termination_type = FAILURE;
summary->message =
"Step failed to evaluate. This should not happen as the step was "
@@ -355,17 +352,15 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options,
summary->message;
LOG_IF(WARNING, is_not_silent) << "Terminating: " << summary->message;
break;
} else {
x = x_plus_delta;
}
// Compute the norm of the step in the ambient space.
iteration_summary.step_norm = (x_plus_delta - x).norm();
x = x_plus_delta;
iteration_summary.gradient_max_norm = current_state.gradient_max_norm;
iteration_summary.gradient_norm = sqrt(current_state.gradient_squared_norm);
iteration_summary.cost_change = previous_state.cost - current_state.cost;
iteration_summary.cost = current_state.cost + summary->fixed_cost;
iteration_summary.step_norm = delta.norm();
iteration_summary.step_is_valid = true;
iteration_summary.step_is_successful = true;
iteration_summary.step_size = current_state.step_size;
@@ -381,13 +376,6 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options,
WallTimeInSeconds() - start_time
+ summary->preprocessor_time_in_seconds;
// Iterations inside the line search algorithm are considered
// 'steps' in the broader context, to distinguish these inner
// iterations from from the outer iterations of the line search
// minimizer. The number of line search steps is the total number
// of inner line search iterations (or steps) across the entire
// minimization.
summary->num_line_search_steps += line_search_summary.num_iterations;
summary->line_search_cost_evaluation_time_in_seconds +=
line_search_summary.cost_evaluation_time_in_seconds;
summary->line_search_gradient_evaluation_time_in_seconds +=

View File

@@ -30,8 +30,6 @@
#include "ceres/local_parameterization.h"
#include <algorithm>
#include "Eigen/Geometry"
#include "ceres/householder_vector.h"
#include "ceres/internal/eigen.h"
#include "ceres/internal/fixed_array.h"
@@ -89,17 +87,28 @@ bool IdentityParameterization::MultiplyByJacobian(const double* x,
}
SubsetParameterization::SubsetParameterization(
int size, const vector<int>& constant_parameters)
: local_size_(size - constant_parameters.size()), constancy_mask_(size, 0) {
int size,
const vector<int>& constant_parameters)
: local_size_(size - constant_parameters.size()),
constancy_mask_(size, 0) {
CHECK_GT(constant_parameters.size(), 0)
<< "The set of constant parameters should contain at least "
<< "one element. If you do not wish to hold any parameters "
<< "constant, then do not use a SubsetParameterization";
vector<int> constant = constant_parameters;
std::sort(constant.begin(), constant.end());
CHECK_GE(constant.front(), 0)
<< "Indices indicating constant parameter must be greater than zero.";
CHECK_LT(constant.back(), size)
<< "Indices indicating constant parameter must be less than the size "
<< "of the parameter block.";
CHECK(std::adjacent_find(constant.begin(), constant.end()) == constant.end())
sort(constant.begin(), constant.end());
CHECK(unique(constant.begin(), constant.end()) == constant.end())
<< "The set of constant parameters cannot contain duplicates";
CHECK_LT(constant_parameters.size(), size)
<< "Number of parameters held constant should be less "
<< "than the size of the parameter block. If you wish "
<< "to hold the entire parameter block constant, then a "
<< "efficient way is to directly mark it as constant "
<< "instead of using a LocalParameterization to do so.";
CHECK_GE(*min_element(constant.begin(), constant.end()), 0);
CHECK_LT(*max_element(constant.begin(), constant.end()), size);
for (int i = 0; i < constant_parameters.size(); ++i) {
constancy_mask_[constant_parameters[i]] = 1;
}
@@ -120,10 +129,6 @@ bool SubsetParameterization::Plus(const double* x,
bool SubsetParameterization::ComputeJacobian(const double* x,
double* jacobian) const {
if (local_size_ == 0) {
return true;
}
MatrixRef m(jacobian, constancy_mask_.size(), local_size_);
m.setZero();
for (int i = 0, j = 0; i < constancy_mask_.size(); ++i) {
@@ -138,10 +143,6 @@ bool SubsetParameterization::MultiplyByJacobian(const double* x,
const int num_rows,
const double* global_matrix,
double* local_matrix) const {
if (local_size_ == 0) {
return true;
}
for (int row = 0; row < num_rows; ++row) {
for (int col = 0, j = 0; col < constancy_mask_.size(); ++col) {
if (!constancy_mask_[col]) {
@@ -183,39 +184,6 @@ bool QuaternionParameterization::ComputeJacobian(const double* x,
return true;
}
bool EigenQuaternionParameterization::Plus(const double* x_ptr,
const double* delta,
double* x_plus_delta_ptr) const {
Eigen::Map<Eigen::Quaterniond> x_plus_delta(x_plus_delta_ptr);
Eigen::Map<const Eigen::Quaterniond> x(x_ptr);
const double norm_delta =
sqrt(delta[0] * delta[0] + delta[1] * delta[1] + delta[2] * delta[2]);
if (norm_delta > 0.0) {
const double sin_delta_by_delta = sin(norm_delta) / norm_delta;
// Note, in the constructor w is first.
Eigen::Quaterniond delta_q(cos(norm_delta),
sin_delta_by_delta * delta[0],
sin_delta_by_delta * delta[1],
sin_delta_by_delta * delta[2]);
x_plus_delta = delta_q * x;
} else {
x_plus_delta = x;
}
return true;
}
bool EigenQuaternionParameterization::ComputeJacobian(const double* x,
double* jacobian) const {
jacobian[0] = x[3]; jacobian[1] = x[2]; jacobian[2] = -x[1]; // NOLINT
jacobian[3] = -x[2]; jacobian[4] = x[3]; jacobian[5] = x[0]; // NOLINT
jacobian[6] = x[1]; jacobian[7] = -x[0]; jacobian[8] = x[3]; // NOLINT
jacobian[9] = -x[0]; jacobian[10] = -x[1]; jacobian[11] = -x[2]; // NOLINT
return true;
}
HomogeneousVectorParameterization::HomogeneousVectorParameterization(int size)
: size_(size) {
CHECK_GT(size_, 1) << "The size of the homogeneous vector needs to be "
@@ -364,9 +332,9 @@ bool ProductParameterization::ComputeJacobian(const double* x,
if (!param->ComputeJacobian(x + x_cursor, buffer.get())) {
return false;
}
jacobian.block(x_cursor, delta_cursor, global_size, local_size)
= MatrixRef(buffer.get(), global_size, local_size);
delta_cursor += local_size;
x_cursor += global_size;
}

View File

@@ -67,7 +67,7 @@ FindOrDie(const Collection& collection,
// If the key is present in the map then the value associated with that
// key is returned, otherwise the value passed as a default is returned.
template <class Collection>
const typename Collection::value_type::second_type
const typename Collection::value_type::second_type&
FindWithDefault(const Collection& collection,
const typename Collection::value_type::first_type& key,
const typename Collection::value_type::second_type& value) {

View File

@@ -161,34 +161,25 @@ class ParameterBlock {
// does not take ownership of the parameterization.
void SetParameterization(LocalParameterization* new_parameterization) {
CHECK(new_parameterization != NULL) << "NULL parameterization invalid.";
// Nothing to do if the new parameterization is the same as the
// old parameterization.
if (new_parameterization == local_parameterization_) {
return;
}
CHECK(local_parameterization_ == NULL)
<< "Can't re-set the local parameterization; it leads to "
<< "ambiguous ownership. Current local parameterization is: "
<< local_parameterization_;
CHECK(new_parameterization->GlobalSize() == size_)
<< "Invalid parameterization for parameter block. The parameter block "
<< "has size " << size_ << " while the parameterization has a global "
<< "size of " << new_parameterization->GlobalSize() << ". Did you "
<< "accidentally use the wrong parameter block or parameterization?";
CHECK_GT(new_parameterization->LocalSize(), 0)
<< "Invalid parameterization. Parameterizations must have a positive "
<< "dimensional tangent space.";
local_parameterization_ = new_parameterization;
local_parameterization_jacobian_.reset(
new double[local_parameterization_->GlobalSize() *
local_parameterization_->LocalSize()]);
CHECK(UpdateLocalParameterizationJacobian())
<< "Local parameterization Jacobian computation failed for x: "
<< ConstVectorRef(state_, Size()).transpose();
if (new_parameterization != local_parameterization_) {
CHECK(local_parameterization_ == NULL)
<< "Can't re-set the local parameterization; it leads to "
<< "ambiguous ownership.";
local_parameterization_ = new_parameterization;
local_parameterization_jacobian_.reset(
new double[local_parameterization_->GlobalSize() *
local_parameterization_->LocalSize()]);
CHECK(UpdateLocalParameterizationJacobian())
<< "Local parameterization Jacobian computation failed for x: "
<< ConstVectorRef(state_, Size()).transpose();
} else {
// Ignore the case that the parameterizations match.
}
}
void SetUpperBound(int index, double upper_bound) {

View File

@@ -174,10 +174,6 @@ void Problem::SetParameterBlockVariable(double* values) {
problem_impl_->SetParameterBlockVariable(values);
}
bool Problem::IsParameterBlockConstant(double* values) const {
return problem_impl_->IsParameterBlockConstant(values);
}
void Problem::SetParameterization(
double* values,
LocalParameterization* local_parameterization) {

View File

@@ -249,11 +249,10 @@ ResidualBlock* ProblemImpl::AddResidualBlock(
// Check for duplicate parameter blocks.
vector<double*> sorted_parameter_blocks(parameter_blocks);
sort(sorted_parameter_blocks.begin(), sorted_parameter_blocks.end());
const bool has_duplicate_items =
(std::adjacent_find(sorted_parameter_blocks.begin(),
sorted_parameter_blocks.end())
!= sorted_parameter_blocks.end());
if (has_duplicate_items) {
vector<double*>::const_iterator duplicate_items =
unique(sorted_parameter_blocks.begin(),
sorted_parameter_blocks.end());
if (duplicate_items != sorted_parameter_blocks.end()) {
string blocks;
for (int i = 0; i < parameter_blocks.size(); ++i) {
blocks += StringPrintf(" %p ", parameter_blocks[i]);
@@ -573,16 +572,6 @@ void ProblemImpl::SetParameterBlockConstant(double* values) {
parameter_block->SetConstant();
}
bool ProblemImpl::IsParameterBlockConstant(double* values) const {
const ParameterBlock* parameter_block =
FindWithDefault(parameter_block_map_, values, NULL);
CHECK(parameter_block != NULL)
<< "Parameter block not found: " << values << ". You must add the "
<< "parameter block to the problem before it can be queried.";
return parameter_block->IsConstant();
}
void ProblemImpl::SetParameterBlockVariable(double* values) {
ParameterBlock* parameter_block =
FindWithDefault(parameter_block_map_, values, NULL);

View File

@@ -128,8 +128,6 @@ class ProblemImpl {
void SetParameterBlockConstant(double* values);
void SetParameterBlockVariable(double* values);
bool IsParameterBlockConstant(double* values) const;
void SetParameterization(double* values,
LocalParameterization* local_parameterization);
const LocalParameterization* GetParameterization(double* values) const;

View File

@@ -142,11 +142,6 @@ void OrderingForSparseNormalCholeskyUsingSuiteSparse(
ordering);
}
VLOG(2) << "Block ordering stats: "
<< " flops: " << ss.mutable_cc()->fl
<< " lnz : " << ss.mutable_cc()->lnz
<< " anz : " << ss.mutable_cc()->anz;
ss.Free(block_jacobian_transpose);
#endif // CERES_NO_SUITESPARSE
}

View File

@@ -127,7 +127,7 @@ class ResidualBlock {
int index() const { return index_; }
void set_index(int index) { index_ = index; }
std::string ToString() const {
std::string ToString() {
return StringPrintf("{residual block; index=%d}", index_);
}

View File

@@ -33,7 +33,6 @@
#include <algorithm>
#include <ctime>
#include <set>
#include <sstream>
#include <vector>
#include "ceres/block_random_access_dense_matrix.h"
@@ -564,12 +563,6 @@ SparseSchurComplementSolver::SolveReducedLinearSystemUsingEigen(
// worse than the one computed using the block version of the
// algorithm.
simplicial_ldlt_->analyzePattern(eigen_lhs);
if (VLOG_IS_ON(2)) {
std::stringstream ss;
simplicial_ldlt_->dumpMemory(ss);
VLOG(2) << "Symbolic Analysis\n"
<< ss.str();
}
event_logger.AddEvent("Analysis");
if (simplicial_ldlt_->info() != Eigen::Success) {
summary.termination_type = LINEAR_SOLVER_FATAL_ERROR;

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