Commit Graph

143 Commits

Author SHA1 Message Date
Campbell Barton 1c24c04e60 Remove workspace object mode, reverts changes w/ 2.8
This caused too many problems syncing object modes
with multiple objects/windows/workspaces, see: D3130 for details.
2018-04-05 18:21:14 +02:00
Bastien Montagne 160e62b88c Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/BKE_object.h
2018-04-04 15:03:55 +02:00
Bastien Montagne d59c2d12b1 Fix modifier freeing code re. ID refcounting.
Free code should not handle ID refcounting at all. This has to be done
at higher level, since in some case we want to free (temp) data that
actually did not refcount at all its IDs.

This change seems to be working OK, but as usual in that area, only
lots of testing in real-case situation will say whether there are some
hidden bugs or not.
2018-04-04 14:58:52 +02:00
Campbell Barton 171c756f20 Merge branch 'master' into blender2.8 2018-02-23 13:10:39 +11:00
Campbell Barton dd77e45151 Cleanup: header guards & style 2018-02-23 12:59:55 +11:00
Sergey Sharybin 4a0d8f92f6 Remove old depsgraph from modifiers relations update context 2018-02-22 14:09:45 +01:00
Sergey Sharybin 539987766b Merge branch 'master' into blender2.8 2018-02-22 14:08:27 +01:00
Sergey Sharybin 3d1c0afe0e Depsgraph: Remove unused bmain from modifiers relations update context 2018-02-22 14:07:08 +01:00
Sergey Sharybin 6e860bef28 Merge branch 'master' into blender2.8 2018-02-22 13:05:00 +01:00
Sergey Sharybin df04520602 Depsgraph: Wrap all arguments foe modifiers relations update into a struct
Makes it easier to add or remove fields needed to update relations.
2018-02-22 12:54:06 +01:00
Campbell Barton ce0cb4de8d Object Mode: use eval_ctx for modifiers_isCorrectableDeformed
Some other minor changes from D3037 as well
2018-02-06 19:35:06 +11:00
Dalai Felinto 3abe8b3292 Rename any instance of scene layer or render layer in code with view layer
The RenderResult struct still has a listbase of RenderLayer, but that's ok
since this is strictly for rendering.

* Subversion bump (to 2.80.2)
* DNA low level doversion (renames) - only for .blend created since 2.80 started

Note: We can't use DNA_struct_elem_find or get file version in init_structDNA,
so we are manually iterating over the array of the SDNA elements instead.

Note 2: This doversion change with renames can be reverted in a few months. But
so far it's required for 2.8 files created between October 2016 and now.

Reviewers: campbellbarton, sergey

Differential Revision: https://developer.blender.org/D2927
2017-11-23 07:48:23 -02:00
Campbell Barton 1b462e5a51 Pass EvaluationContext instead of bContext
2.8x branch added bContext arg in many places,
pass eval-context instead since its not simple to reason about what
what nested functions do when they can access and change almost anything.

Also use const to prevent unexpected modifications.

This fixes crash loading files with shadows,
since off-screen buffers use a NULL context for rendering.
2017-08-16 12:46:04 +10:00
Bastien Montagne 41830cc432 Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).

This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.

It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).

Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!

As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.

Design task : T51804
Phab Diff: D2714
2017-08-07 20:34:36 +02:00
Bastien Montagne 9da7dfa158 Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).

This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.

It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).

Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!

As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.

Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
Luca Rood 1c4c288727 Pass EvaluationContext argument everywhere
Note that some little parts of code have been dissabled because eval_ctx
was not available there. This should be resolved once DerivedMesh is
replaced.
2017-07-21 14:47:26 +02:00
Sergey Sharybin e5ee6cb448 Depsgraph: Remove meaningless comment
We are already on the new depsgraph only for quite some time now.
2017-07-12 11:08:51 +02:00
Luca Rood 913e9350a5 Convert BaseLegacy to Base (part) 2017-04-24 16:09:04 +02:00
Bastien Montagne 3e9ade6e31 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/depsgraph.c
	source/blender/blenkernel/intern/library_query.c
2017-01-31 10:47:43 +01:00
Bastien Montagne b5682a6fdd Cleanup: use 'cb_flag', not 'cd_flag' for library_query callbacks.
`cd_flag` tends to be used for CustomData flags in mesh area, while for
library_query those are rather callback flags...
2017-01-31 10:41:25 +01:00
Sergey Sharybin 5be2a62ca3 Merge branch 'master' into blender2.8 2017-01-24 14:56:56 +01:00
Sergey Sharybin b6ccba9241 Fix typo in comment 2017-01-24 14:56:35 +01:00
Sergey Sharybin 218b06eb83 Depsgraph: Remove legacy updateDepgraph callbacks from modifiers 2017-01-24 12:49:23 +01:00
Lukas Tönne 6ecab6dd8e Revert particle system and point cache removal in blender2.8 branch.
This reverts commit 5aa19be912 and b4a721af69.

Due to postponement of particle system rewrite it was decided to put particle code
back into the 2.8 branch for the time being.
2016-12-28 17:30:58 +01:00
Bastien Montagne faec430914 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/blender_curves.cpp
	source/blender/blenkernel/intern/dynamicpaint.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/physics/particle_edit.c
	source/blender/editors/transform/transform_snap_object.c
	source/blender/editors/util/undo.c
	source/blender/makesrna/intern/rna_object_force.c
2016-05-24 16:48:10 +02:00
Philipp Oeser 7a8bd2eaea Fix T47737: Lattice crashes w/ smooth modifier
Add flag for modifiers that support lattice
2016-05-18 22:46:29 +10:00
Lukas Tönne d8d49befa0 Removed particle system and particle instance modifiers. 2016-04-13 11:45:15 +02:00
Bastien Montagne f375028a25 Modifiers: add 'cd_flag' parameter to their ID looping callbacks, needed
since some IDs (objects) are not 'refcounted' while others (textures) are...

Partial merge from id-remap branch.
2015-10-08 15:05:37 +02:00
Bastien Montagne e5552f8241 Cleanup: use proper `ObjectWalkFunc` typedef in modifiers' object callback func.
Also, fix own stupidity, no need to define ID callback in case we only have objects,
calling code knows to fallback to `foreachObjectLink()` when `foreachIDLink()` is missing...
2015-10-05 15:57:10 +02:00
Sergey Sharybin 3d36489672 OpenSubdiv: Commit of OpenSubdiv integration into Blender
This commit contains all the remained parts needed for initial integration of
OpenSubdiv into Blender's subdivision surface code. Includes both GPU and CPU
backends which works in the following way:

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

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

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

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

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

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

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

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

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

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

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

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

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

There are some patches applied in there which we're working on on getting
into upstream.
2015-07-20 22:29:26 +02:00
Sergey Sharybin bac7353801 Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:

- More granular dependency relation nature, which solves issues with fake cycles
  in the dependencies.

- Move towards all-animatable, by better integration of drivers into the system.

- Lay down some basis for upcoming copy-on-write, overrides and so on.

The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.

It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.

There are number of assorted documents related on the design of the new system:

* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph

There are also some user-related information online:

* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/

Kudos to everyone who was involved into the project:

- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
  project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
  issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 16:06:37 +05:00
Campbell Barton 268524c025 Cleanup: use const for typeinfo 2015-03-30 21:18:49 +11:00
Campbell Barton b1d758ae6b Cleanup: redundant struct declarations 2015-03-29 03:56:39 +11:00
Sergey Sharybin aa4cb95a5c Pass proper bmain to the updateDepgraph() of modifiers
This is mainly to make physics modifiers being able to work
with it. For other cases this main is not needed.
2015-03-13 12:03:23 +05:00
Sergey Sharybin 67fa545ed0 Make modifier_unique_name return whether modifier was renamed or not 2015-02-13 13:46:51 +05:00
Sergey Sharybin 20550d6f7f Fix T40582: issues with apply scale when having multires and scene simplify
Reshape and applying scale matrix on multires needs to create DM with simplify
setting disabled. Added a special flag to modifier apply for this now.
2014-06-12 13:49:46 +06:00
Campbell Barton 7b7196e3ad Code cleanup: modifier_skin_customdata_ensure was a bad level call 2014-03-16 21:55:30 +11:00
Campbell Barton 2097e621ed Code cleanup: use r_ prefix for return args 2014-03-16 03:26:23 +11:00
Campbell Barton 158b4e61a0 Mesh Modifiers: refactor copying using a generic function 2013-12-22 04:37:26 +11:00
Thomas Dinges f372758257 Interface / Modifiers: Don't show cage placeholder in modifier header, if the current modifier does not support it or the cage is disabled (like Subsurf 0).
This way we save some space but still avoid the jumping around while changing settings in the header itself.

Thanks to Brecht for help on this. :)
2013-12-13 20:57:54 +01:00
Bastien Montagne b375388959 Fix [#37266] Skin modifier can't be copied.
Patch by Martin Felke, many thanks.

When copying that modifier across objects, we also have to ensure that a skin CDLayer is present in dest objects (just as when adding it).
2013-11-01 08:31:36 +00:00
Campbell Barton 9794c70f65 modifiers_isCorrectableDeformed now checks a modifier is enabled before returning true,
also check deformMatricesEM callback for modifier_isCorrectableDeformed() rather then checking modifier types.
2013-09-24 00:56:47 +00:00
Sergey Sharybin 35b61a7512 Move GCC attributes into a centraized defines
Instead of having ifdef __GNUC__ all over the headers
to use special compiler's hints use a special file where
all things like this are concentrated.

Makes code easier to follow and allows to manage special
attributes in more efficient way.

Thanks Campbell for review!
2013-09-01 15:01:15 +00:00
Sergey Sharybin beffaa293e Made modifiers_getVirtualModifierList safe for threading
Move static variables to context filling in by this fcuntion
and owned by a callee function. This ensures no conflicts
between threads happens because of static variables used in
this function.

Also moved modifier types and virtual modifiers data to a
function called from creator. This is needed to be sure all
the information is properly initialied to the time when
threads starts to use this data.

--
svn merge -r57899:57900 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:05:34 +00:00
Campbell Barton 418011907c remove nan copyrights from code added since blender become opensource (copy paste errors), also remove BKE_script.h 2013-07-02 10:14:59 +00:00
Campbell Barton d9ec2efe8f move modifier callback wrappers into modifier.c 2013-06-19 08:00:20 +00:00
Campbell Barton 532503e0cb fix for problem with creating weight-paint preview.
In the case where the modifier stack didnt need deform-verts to calculate,
they would not be available for the preview either.

This fixes a bug caused by r57206 which set mirror to preview so the mirrored
weights would be displayed, but it only worked when there was an armature after it, see [#35545].
2013-06-13 00:33:48 +00:00
Campbell Barton e648ca8862 use booleans for modifiers and api callbacks. 2013-06-02 03:59:19 +00:00
Brecht Van Lommel 4a4f091155 Fix #35174: dynamic paint displacement missing in render.
A previous bugfix disabled the dynamic paint modifier for orco texture
coordinate evaluation of the modifier stack. However the MOD_APPLY_USECACHE
flag is not a good way to check if the modifier is evaluated for orcos.

Instead I've added a MOD_APPLY_ORCO flag. Also removed a bunch of
applyModifierEM callbacks, none of them served a purpose except for the
subsurf modifier.
2013-05-02 14:42:05 +00:00
Miika Hamalainen 511e3466da Fix [#35110]: Dynamic Paint does not paint accurately in baked "Image Sequence" on Armature-Posed-Mesh
Dynamic Paint was also being calculated during "orco" mesh generation, causing image sequence baking to use orco derived mesh instead. This likely affected vertex type surfaces too in some cases.
2013-04-29 15:02:54 +00:00