Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-04Fix T101686: WPaint + Pose select fails with GPU depth-picking disabledCampbell Barton
Regression in [0], however the primary purpose of that code was to cycle away from the active object (behavior which was intentionally removed, see: T96752). This broke weight-paint + pose-selection (Ctrl-LMB) when the GPU depth picking preference was disabled. Causing selection to pick the mesh object instead of the pose bones. This de-selected the armature, making the pose bones unselectable instead of selecting the pose bone as intended. Adding the old code back (restricting it to weight-paint mode) fixes the bug but reintroduces fairly involved logic unnecessarily. Instead, prioritize bone selecting when in weight-paint & pose mode (previously this was only done in pose-mode). [0]: b1908f2e0b23988627772f6a6d968d8351dca6d7
2022-11-01Refactor: Rename Object->obmat to Object->object_to_worldSergey Sharybin
Motivation is to disambiguate on the naming level what the matrix actually means. It is very easy to understand the meaning backwards, especially since in Python the name goes the opposite way (it is called `world_matrix` in the Python API). It is important to disambiguate the naming without making developers to look into the comment in the header file (which is also not super clear either). Additionally, more clear naming facilitates the unit verification (or, in this case, space validation) when reading an expression. This patch calls the matrix `object_to_world` which makes it clear from the local code what is it exactly going on. This is only done on DNA level, and a lot of local variables still follow the old naming. A DNA rename is setup in a way that there is no change on the file level, so there should be no regressions at all. The possibility is to add `_matrix` or `_mat` suffix to the name to make it explicit that it is a matrix. Although, not sure if it really helps the readability, or is it something redundant. Differential Revision: https://developer.blender.org/D16328
2022-09-14ViewLayer: Lazy sync of scene data.Monique Dewanchand
When a change happens which invalidates view layers the syncing will be postponed until the first usage. This will improve importing or adding many objects in a single operation/script. `BKE_view_layer_need_resync_tag` is used to tag the view layer to be out of sync. Before accessing `BKE_view_layer_active_base_get`, `BKE_view_layer_active_object_get`, `BKE_view_layer_active_collection` or `BKE_view_layer_object_bases` the caller should call `BKE_view_layer_synced_ensure`. Having two functions ensures that partial syncing could be added as smaller patches in the future. Tagging a view layer out of sync could be replaced with a partial sync. Eventually the number of full resyncs could be reduced. After all tagging has been replaced with partial syncs the ensure_sync could be phased out. This patch has been added to discuss the details and consequences of the current approach. For clarity the call to BKE_view_layer_ensure_sync is placed close to the getters. In the future this could be placed in more strategical places to reduce the number of calls or improve performance. Finding those strategical places isn't that clear. When multiple operations are grouped in a single script you might want to always check for resync. Some areas found that can be improved. This list isn't complete. These areas aren't addressed by this patch as these changes would be hard to detect to the reviewer. The idea is to add changes to these areas as a separate patch. It might be that the initial commit would reduce performance compared to master, but will be fixed by the additional patches. **Object duplication** During object duplication the syncing is temporarily disabled. With this patch this isn't useful as when disabled the view_layer is accessed to locate bases. This can be improved by first locating the source bases, then duplicate and sync and locate the new bases. Will be solved in a separate patch for clarity reasons ({D15886}). **Object add** `BKE_object_add` not only adds a new object, but also selects and activates the new base. This requires the view_layer to be resynced. Some callers reverse the selection and activation (See `get_new_constraint_target`). We should make the selection and activation optional. This would make it possible to add multiple objects without having to resync per object. **Postpone Activate Base** Setting the basact is done in many locations. They follow a rule as after an action find the base and set the basact. Finding the base could require a resync. The idea is to store in the view_layer the object which base will be set in the basact during the next sync, reducing the times resyncing needs to happen. Reviewed By: mont29 Maniphest Tasks: T73411 Differential Revision: https://developer.blender.org/D15885
2022-09-14Adding `const Scene*` parameter in many areas.Monique Dewanchand
Related to {D15885} that requires scene parameter to be added in many places. To speed up the review process the adding of the scene parameter was added in a separate patch. Reviewed By: mont29 Maniphest Tasks: T73411 Differential Revision: https://developer.blender.org/D15930
2022-08-17Cleanup: Fix outdated comments referring to DispListHans Goudey
2022-08-09Cleanup: Remove unused object batch cache API functionHans Goudey
Remove the "tag batch cache dirty" function specifically for object data, since it isn't used. Ref D14593
2022-07-08Cleanup: spelling in commentsCampbell Barton
Also move mis-placed doc-string.
2022-07-07Fix T99386: Driven modifiers are always re-evaluated during animationSergey Sharybin
Even if the driver is not dependent on time the modifiers were always re-evaluated during playback. This is due to the legacy nature of the check whether modifier depends on time or not: it was simply checking for sub-string match for modifier in the F-Curve and drivers RNA paths. Nowadays such dependencies are created by the dependency graph builder, which allows to have more granular control over what depends on what. The code is now simplified to only check for "static" dependency of the modifier form time: for example, Wave modifier which always depends on time (even without explicit animation involved). This change also fixes missing relation from the animation component to the shader_fx modifiers, fixing race condition. Additional files used to verify relations: - Geometry: F13257368 - Grease Pencil: F13257369 - Shader FX: F13257370 In these files different types of modifiers have an animated property, and the purpose of the test is to verify that the modifiers do react to the animation and that there is a relation between animation and geometry components of the object. The latter one can only be checked using the dependency graph relation visualization. The drivers are not tested by these files. Those are not typically depend on time, and if there were missing relation from driver to the modifier we'd receive a bug report already. As well as if there was a bug in missing time relation to a driver we'd also receive a report. Differential Revision: https://developer.blender.org/D15358
2022-07-07Fix T99270: bones using empties as custom shapes can't be selectedCampbell Barton
Regression in [0] which didn't account for the bounds of empty objects. Add support support calculating bounds from empty draw-type to use in pose-bone culling. [0]: 3267c91b4d5caab7da8aef071a446dd2e86f86a9
2022-04-15Object: Set Parent (Keep Transform Without Inverse)Wayde Moss
**Relevant to Artists:** This patch adds an option to the Parenting menu, `Object (Keep Transform Without Inverse)`, and Apply menu, `Parent Inverse`. The operators preserve the child's world transform without using the parent inverse matrix. Effectively, we set the child's origin to the parent. When the child has an identity local transform, then the child is world-space aligned with its parent (scale excluded). **Technical:** In both cases, the hidden parent inverse matrix is generally set to identity (cleared or "not used") as long as the parent has no shear. If the parent has shear, then this matrix will not be entirely cleared. It will contain shear to counter the parent's shear. This is required, otherwise the object's local matrix cannot be properly decomposed into location, rotation and scale, and thus cannot preserve the world transform. If the child's world transform has shear, then its world transform is not preserved. This is currently not supported for consistency in the handling of shear during the other parenting ops: Parent (Keep Transform), Clear [Parent] and Keep Transform. If it should work, then another patch should add the support for all of them. Reviewed By: sybren, RiggingDojo Differential Revision: https://developer.blender.org/D14581
2022-04-05Curves: fix edit mode detectionKévin Dietrich
This adds missing cases to detect edit mode for Curves objects. Unlike other object types, Curves do not have specific edit data, rather we edit the original data directly, and rely on `Object.mode`. For this, `BKE_object_data_is_in_editmode` had to be modified to take a pointer to the object. This affects two places: the outliner and the dependency graph. For the former place, the object pointer is readily available, and we can use it. For the latter, the object pointer is not available, however since it is used to update edit mode pointers, and since Curves do not have such data, we can safely pass null to the function here. This also fixes the assertion failure that happens when closing a file in edit mode. Differential Revision: https://developer.blender.org/D14330
2022-04-02Cleanup: Further use of const for object bounding boxesHans Goudey
Also solves two warnings from the previous similar commit, f688e3cc3130e70e77f0bb0. The change to the grease pencil modifier is quite suspicious, but doesn't change the behavior, which was already broken.
2022-04-01Cleanup: Remove object bounding box functionHans Goudey
This abstraction doesn't serve any purpose after 11c6d4e88eb919. The flag on bounding boxes isn't used, except for the dirty tag.
2022-04-01Cycles: enable Alembic procedural for final rendersKévin Dietrich
The Alembic procedural was only enabled during viewport renders originally because it did not have any caching strategy. Now that is does, we can allow its usage in final renders. This also removes the `dag_eval_mode` argument passing to `ModifierTypeInfo.dependsOnTime` which was originally added to detect if we are doing a viewport render for enabling the procedural. Differential Revision: https://developer.blender.org/D14520
2022-03-29Assets: Support automatic collection previewsJulian Eisel
Adds supports for collection previews that are rendered automatically when collections are marked as assets. (Or when preview rendering is triggered differently, e.g. through the //Refresh Data-Block Previews// operator). Idea in this patch is to create a collection instance empty outside of main for the collection, and then reuse the object rendering code to render the preview. This keeps things very simple and works just fine. Differential Revision: https://developer.blender.org/D14460 Reviewed by: Bastien Montagne
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-02-10Cleanup: Clang tidy, unused variabel warningsHans Goudey
2022-02-04Remove internal proxy code, and deprecate related DNA data.Bastien Montagne
Part of T91671. Not much else to say, this is mainly a massive deletion of code. Note that a few cleanups possible after this proxy removal were kept out of this commit to try to reduce a bit its size. Reviewed By: sergey, brecht Maniphest Tasks: T91671 Differential Revision: https://developer.blender.org/D13995
2022-01-25Fix depsgraphs sharing IDs via evaluated edit meshSergey Sharybin
The evaluated mesh is a result of evaluated modifiers, and referencing other evaluated IDs such as materials. It can not be stored in the EditMesh structure which is intended to be re-used by many areas. Such sharing was causing ownership errors causing bugs like T93855: Cycles crash with edit mode and simultaneous viewport and final render The proposed solution is to store the evaluated edit mesh and its cage in the object's runtime field. The motivation goes as following: - It allows to avoid ownership problems like the ones in the linked report. - Object level is chosen over mesh level is because the evaluated mesh is affected by modifiers, which are on the object level. This patch allows to have modifier stack of an object which shares mesh with an object which is in edit mode to be properly taken into account (before the change the modifier stack from the active object will be used for all objects which share the mesh). There is a change in the way how copy-on-write is handled in the edit mode to allow proper state update when changing active scene (or having two windows with different scenes). Previously, the copt-on-write would have been ignored by skipping tagging CoW component. Now it is ignored from within the CoW operation callback. This allows to update edit pointers for objects which are not from the current depsgraph and where the edit_mesh was never assigned in the case when the depsgraph was evaluated prior the active depsgraph. There is no user level changes changes expected with the CoW handling changes: should not affect on neither performance, nor memory consumption. Tested scenarios: - Various modifiers configurations of objects sharing mesh and be part of the same scene. - Steps from the reports: T93855, T82952, T77359 This also fixes T76609, T72733 and perhaps other reports. Differential Revision: https://developer.blender.org/D13824
2022-01-07Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
MSVC used to warn about const mismatch for arguments passed by value. Remove these as newer versions of MSVC no longer show this warning.
2022-01-06Cleanup: spelling in commentsCampbell Barton
2021-12-27OpenSubDiv: add support for an OpenGL evaluatorKévin Dietrich
This evaluator is used in order to evaluate subdivision at render time, allowing for faster renders of meshes with a subdivision surface modifier placed at the last position in the modifier list. When evaluating the subsurf modifier, we detect whether we can delegate evaluation to the draw code. If so, the subdivision is first evaluated on the GPU using our own custom evaluator (only the coarse data needs to be initially sent to the GPU), then, buffers for the final `MeshBufferCache` are filled on the GPU using a set of compute shaders. However, some buffers are still filled on the CPU side, if doing so on the GPU is impractical (e.g. the line adjacency buffer used for x-ray, whose logic is hardly GPU compatible). This is done at the mesh buffer extraction level so that the result can be readily used in the various OpenGL engines, without having to write custom geometry or tesselation shaders. We use our own subdivision evaluation shaders, instead of OpenSubDiv's vanilla one, in order to control the data layout, and interpolation. For example, we store vertex colors as compressed 16-bit integers, while OpenSubDiv's default evaluator only work for float types. In order to still access the modified geometry on the CPU side, for use in modifiers or transform operators, a dedicated wrapper type is added `MESH_WRAPPER_TYPE_SUBD`. Subdivision will be lazily evaluated via `BKE_object_get_evaluated_mesh` which will create such a wrapper if possible. If the final subdivision surface is not needed on the CPU side, `BKE_object_get_evaluated_mesh_no_subsurf` should be used. Enabling or disabling GPU subdivision can be done through the user preferences (under Viewport -> Subdivision). See patch description for benchmarks. Reviewed By: campbellbarton, jbakker, fclem, brecht, #eevee_viewport Differential Revision: https://developer.blender.org/D12406
2021-12-14Cleanup: remove oudated comment from early COW developmentCampbell Barton
Added in 161ab6109e265ea906e0308ab404f95282534770
2021-12-10Cleanup/Docs: Add comments to Mesh header, rearrange fieldsHans Goudey
Most of the fields in Mesh had no comments, or outdated misleading comments. For example, "BMESH ONLY" referred to the BMesh project, not the data structure. Given how much these structs are used, it should save a lot of time to have proper comments. I also rearranged the fields in mesh to have a more logical order. Now the most important fields come first. In the process I was able to remove 19 bytes of unnecessary padding (31->12). I just had to change a `short` flag to `char`. Differential Revision: https://developer.blender.org/D13454
2021-12-07Cleanup: move public doc-strings into headers for 'blenkernel'Campbell Barton
- Added space below non doc-string comments to make it clear these aren't comments for the symbols directly below them. - Use doxy sections for some headers. - Minor improvements to doc-strings. Ref T92709
2021-11-24Fix T90808: wrong BoundBox after undo curve selectionGermano Cavalcante
There are two functions that recalculate the boundbox of an object: - One that considers the evaluated geometry - Another that only considers the object's `data`. Most of the time, the bound box is calculated on the final object (with modifiers), so it doesn't seem right to just rely on `ob->data` to recalculate the `ob->runtime.bb`. Be sure to calculate the BoundBox based on the final geometry and only use `ob->data` as a fallback Differential Revision: https://developer.blender.org/D12282
2021-11-04Cleanup: Move object.c to C++Germano Cavalcante
This is useful to allow the use of features made in C++. Differential Revision: https://developer.blender.org/D13115
2021-09-08Asset: Dropping Material assets on material slot under mouse cursor.Jeroen Bakker
This patch allows dropping material assets from material slot under the mouse cursor. Before this change the material slot had to be hand-picked from the properties panel. For consistency it is chosen to do this in any shading mode as the tooltip shows what is exactly going to happen during release. The feature also works for other object types than Meshes as it uses the drawn surface on the GPU to detect the material slots. Performance of this patch has been tested with AMD GCN3.0 cards and are very responsive. Reviewed By: fclem, Severin Differential Revision: https://developer.blender.org/D12190
2021-09-06Geometry Nodes: support for geometry instancingJacques Lucke
Previously, the Point Instance node in geometry nodes could only instance existing objects or collections. The reason was that large parts of Blender worked under the assumption that objects are the main unit of instancing. Now we also want to instance geometry within an object, so a slightly larger refactor was necessary. This should not affect files that do not use the new kind of instances. The main change is a redefinition of what "instanced data" is. Now, an instances is a cow-object + object-data (the geometry). This can be nicely seen in `struct DupliObject`. This allows the same object to generate multiple geometries of different types which can be instanced individually. A nice side effect of this refactor is that having multiple geometry components is not a special case in the depsgraph object iterator anymore, because those components are integrated with the `DupliObject` system. Unfortunately, different systems that work with instances in Blender (e.g. render engines and exporters) often work under the assumption that objects are the main unit of instancing. So those have to be updated as well to be able to handle the new instances. This patch updates Cycles, EEVEE and other viewport engines. Exporters have not been updated yet. Some minimal (not master-ready) changes to update the obj and alembic exporters can be found in P2336 and P2335. Different file formats may want to handle these new instances in different ways. For users, the only thing that changed is that the Point Instance node now has a geometry mode. This also fixes T88454. Differential Revision: https://developer.blender.org/D11841
2021-08-19Cycles: experimental integration of Alembic procedural in viewport renderingKévin Dietrich
This patch exposes the Cycles Alembic Procedural through the MeshSequenceCache modifier in order to use and test it from Blender. To enable it, one has to switch the render feature set to experimental and activate the Procedural in the modifier. An Alembic Procedural is then created for each CacheFile from Blender set to use the Procedural, and each Blender object having a MeshSequenceCache modifier is added to list of objects of the right procedural. The procedural's parameters derive from the CacheFile's properties which are already exposed in the UI through the modifier, although more Cycles specific options might be added in the future. As there is currently no cache controls and since we load all the data at the beginning of the render session, the procedural is only available during viewport renders at the moment. When an Alembic procedural is rendered, data from the archive are not read on the Blender side. If a Cycles render is not active and the CacheFile is set to use the Cycles Procedural, bounding boxes are used to display the objects in the scene as a signal that the objects are not processed by Blender anymore. This is standard in other DCCs. However this does not reduce the memory usage from Blender as the Alembic data was already loaded either during an import or during a .blend file read. This is mostly a hack to test the Cycles Alembic procedural until we have a better Blender side mechanism for letting renderers load their own geometry, which will be based on import and export settings on Collections (T68933). Ref T79174, D3089 Reviewed By: brecht, sybren Maniphest Tasks: T79174 Differential Revision: https://developer.blender.org/D10197
2021-07-19Revert "Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'"Germano Cavalcante
This reverts commits bfa3dc91b75407b063f2ac991b176d98c050f92d, 52b94049f2a71a74f52247f83657cf3a5c8712b4, ae379714e4f1eca74f5f77532a6e959f29445236, a770faa811ee62837eb540b0bd83ca0770f16663, 4ed029fc02b022cb5ff28ed3ce70992c450d2be5, 101a493ab556c6597ac91fba204059be67b35990 and 62a2faa7ef39130446716d7a06215cd1df1eb2ac. And fixes T89955. Changing the dependency graph is a can of worms and the result is a kind of unpredictable. A different solution will be planned.
2021-07-13Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'Germano Cavalcante
During a mesh transformation in edit mode (Move, Rotate...), only part of the batch cache needs to be updated. This commit allows only update only the drawn batches seen in `BKE_object_data_eval_batch_cache_deform_tag` if the new `ID_RECALC_GEOMETRY_DEFORM` flag is used. This new flag is used in the transforms operation for edit-mesh and results in 1.6x overall speedup in heavy subdiv cube. Differential Revision: https://developer.blender.org/D11599
2021-07-07Geometry Nodes: refactor logging during geometry nodes evaluationJacques Lucke
Many ui features for geometry nodes need access to information generated during evaluation: * Node warnings. * Attribute search. * Viewer node. * Socket inspection (not in master yet). The way we logged the required information before had some disadvantages: * Viewer node used a completely separate system from node warnings and attribute search. * Most of the context of logged information is lost when e.g. the same node group is used multiple times. * A global lock was needed every time something is logged. This new implementation solves these problems: * All four mentioned ui features use the same underlying logging system. * All context information for logged values is kept intact. * Every thread has its own local logger. The logged informatiton is combined in the end. Differential Revision: https://developer.blender.org/D11785
2021-07-02Cleanup: Use const variables for object's evaluated meshHans Goudey
Generally the evaluated mesh should not be changed, since that is the job of the modifier stack. Current code is far from const correct in that regard. This commit uses a const variable for the reult of `BKE_object_get_evaluated_mesh` in some cases. The most common remaining case is retrieving a BVH tree from the mesh.
2021-06-26Cleanup: full sentences in comments, improve comment formattingCampbell Barton
2021-06-24Cleanup: comment blocks, trailing space in commentsCampbell Barton
2021-06-22Cleanup: split BKE_object_batch_cache_dirty_tagGermano Cavalcante
Create a more specialized function `BKE_object_data_batch_cache_dirty_tag`
2021-06-21Cleanup: pass objects as const argumentsCampbell Barton
2021-04-30Object: rename BKE_object_runtime_free, leave data clearedCampbell Barton
Rename BKE_object_runtime_free -> BKE_object_runtime_free_data, since the runtime pointer is part of the object, only the data is freed. Leave the data cleared to avoid accidental use, this is in keeping with other `*_free_data()` functions.
2021-04-30Object: improve on fix for Object.to_mesh() crash T86871Campbell Barton
While fa7ddd0f43ea15dd19d81e7808de2bfe8cfc89ee fixed the reported issue, the possibility of reusing runtime data during curve-to-mesh conversion remained. Instead of treating the bounding-box as a special case, clear all run-time data for temporary objects. Ref D11026 Reviewed By: sergey
2021-04-15Spreadsheet: breadcrumbs and node pinningJacques Lucke
This introduces a context path to the spreadsheet editor, which contains information about what data is shown in the spreadsheet. The context path (breadcrumbs) can reference a specific node in a node group hierarchy. During object evaluation, the geometry nodes modifier checks what data is currently requested by visible spreadsheets and stores the corresponding geometry sets separately for later access. The context path can be updated by the user explicitely, by clicking on the new icon in the header of nodes. Under some circumstances, the context path is updated automatically based on Blender's context. This patch also consolidates the "Node" and "Final" object evaluation mode to just "Evaluated". Based on the current context path, either the final geometry set of an object will be displayed, or the data at a specific node. The new preview icon in geometry nodes now behaves more like a toggle. It can be clicked again to clear the context path in an open spreadsheet editor. Previously, only an object could be pinned in the spreadsheet editor. Now it is possible to pin the entire context path. That allows two different spreadsheets to display geometry data from two different nodes. The breadcrumbs in the spreadsheet header can be collapsed by clicking on the arrow icons. It's not ideal but works well for now. This might be changed again, if we get a data set region on the left. Differential Revision: https://developer.blender.org/D10931
2021-04-08Spreadsheet: support showing data of specific nodeJacques Lucke
Previously, the spreadsheet editor could only show data of the original and of the final evaluated object. Now it is possible to show the data at some intermediate stages too. For that the mode has to be set to "Node" in the spreadsheet editor. Furthermore, the preview of a specific node has to be activated by clicking the new icon in the header of geometry nodes. The exact ui of this feature might be refined in upcoming commits. It is already very useful for debugging node groups in it's current state though. Differential Revision: https://developer.blender.org/D10875
2021-03-29Fix T78650: Lattice evaluation writes to shared dataSybren A. Stüvel
Fix the data management bug where evaluation of lattice objects would write back to the CoW copy of the Lattice ID, even when that copy was shared between objects. Each lattice object evaluation now stores its own evaluated data copy via `BKE_object_eval_assign_data()`. Reviewed By: sergey Maniphest Tasks: T78650 Differential Revision: https://developer.blender.org/D10790
2021-02-20Python: Add to_curve method to the object APIOmar Emara
This patch adds a to_curve method to the Object ID. This method is analogous to the to_mesh method. The method can operate on curve and text objects. For text objects, the text is converted into a 3D Curve ID and that curve is returned. For curve objects, if apply_modifiers is true, the spline deform modifiers will be applied and a Curve ID with the result will be returned, otherwise a copy of the curve will be returned. The goal of this addition is to allow the developer to access the splines of text objects and to get the result of modifier applications which was otherwise not possible. Reviewed By: Brecht Differential Revision: https://developer.blender.org/D10354
2021-01-19Refactor modifier copying code.Bastien Montagne
Things like pointers to particle systems, or softbody data being stored outside of its modifier, make it impossible for internal modifier copy data code to be self-contained currently. It requires extra processing. In existing code this was handled in several different places, in several ways, and alltogether fairly inconsistently. Some cases were even not properly handled, causing e.g. crashes as in T82945. This commit addresses those issues by: * Adding comments about the hackish/unsafe parts `psys` implies when copying some modifier data (since we need to ensure particle system copying and remapping of those pointers separately). * Adding as-best-as-possible handling of those cases to `BKE_object_copy_modifier` (note that it remains fragile, but is expected to behave 'good enough' in any practical usecase). * Remove special handling for specific editor code (`copy_or_reuse_particle_system`). This should never have been accepted in ED code area, and is now handled by `BKE_object_copy_modifier`. * Factorize copying of the whole modifier stack into new `BKE_object_modifier_stack_copy`, now used by both `object_copy_data` and `BKE_object_link_modifiers`. Note that this implies that `BKE_object_copy_modifier` and `BKE_object_copy_gpencil_modifier` are now to be used exclusively to copy single modifiers. Full modifier stack copy should always use `BKE_object_modifier_stack_copy` instead. Fix T82945: Crash when dragging modifiers in Outliner. Maniphest Tasks: T82945 Differential Revision: https://developer.blender.org/D10148
2021-01-11Fix T83422: Dimensions incorrect after undoing if it has modified geometry.Bastien Montagne
Root of the issue is that `BKE_object_eval_boundbox` (that ports back evaluated bbox to orig object during active depsgraph evaluation) is only called when object's geometry actually is evaluated. However, with new undo, often Object itself can be changed by undo, without requiring its geometry to be re-evaluated, which was leading to the evaluated bbox not being copied back into orig object anymore. Fixing that by moving bbox copying-to-orig code into `BKE_object_sync_to_original` instead, which is always executed when object is evaluated (as hinted by the comment above `BKE_object_eval_boundbox` actually). Also allows to cleanup code for armature eval, apparently. Maniphest Tasks: T83422 Differential Revision: https://developer.blender.org/D9789
2020-12-28Add operator to copy a modifier to all selected objectsErik Abrahamsson
These two operators (one for grease pencil, one for other objects) copy a single modifier from the active object to all selected objects. The operators are exposed in the dropdown menus in modifier headers. Note that It's currently possible to drag and drop modifiers between objects in the outliner, but that only works for dragging to one object at a time. Modifiers can also be copied with the "Make Links" operator, but that copies *all* modifiers rather than just one. The placement and scope of these new operators allow for more useful poll messages and error messages as well. Every object type that supports modifiers is supported. Although hook and collision modifiers aren't supported because of an unexplained comment in `BKE_object_copy_modifier`, other than that, every modifier type is supported, including particle systems, nodes modifiers, etc. The new modifiers are set active, which required two small tweaks to `object.c` and `particle.c`. Reviewed By: Hans Goudey (with additional edits) Differential Revision: https://developer.blender.org/D9537
2020-12-02Geometry Nodes: active modifier + geometry nodes editorHans Goudey
This commit adds functions to set and get the object's active modifier, which is stored as a flag in the ModifierData struct, similar to constraints. This will be used to set the context in the node editor. There are no visible changes in this commit. Similar to how the node editor context works for materials, this commit makes the node group displayed in the node editor depend on the active object and its active modifier. To keep the node group from changing, just pin the node group in the header. * Shortcuts performed while there is an active modifier will affect only that modifier (the exception is the A to expand the modifiers). * Clicking anywhere on the empty space in a modifier's panel will make it active. These changes require some refactoring of object modifier code. First is splitting up the modifier property invoke callback, which now needs to be able to get the active modifier separately from the hovered modifier for the different operators. Second is a change to removing modifiers, where there is now a separate function to remove a modifier from an object's list, in order to handle changing the active. Finally, the panel handler needs a small tweak so that this "click in panel" event can be handled afterwards.
2020-11-06Refactor: move Object .blend I/O to IDTypeInfo callbacksJacques Lucke
2020-11-06Refactor: move ShaderFx .blend I/O to blenkernelJacques Lucke
Ref T76372.