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-03-07Fix T96180: driver in node tree not updating in real timeJacques Lucke
Differential Revision: https://developer.blender.org/D14260
2022-03-02Fix T94609: geometry nodes always re-evaluated with image texture nodesBrecht Van Lommel
previously_visible_components_mask was not preserved for Image ID nodes, which meant it was always detected as newly visible and tagged to be updated, which in turn caused the geometry nodes using it to be always updated also. Reviewed By: sergey, JacquesLucke Maniphest Tasks: T94609 Differential Revision: https://developer.blender.org/D14217
2022-02-28Fix T96054: Switching vertex group does not update displaySergey Sharybin
Caused by 0f89bcdbebf5 and was not fully addressed by 6f9828289f39: tagging an ID with flag 0 is to be seen as an explicit tag for copy on write. Would be nice to either consolidate code paths of flag 0 and explicit component tag, or get rid of tagging with 0 flag, but that is above of what we can do for the upcoming release.
2022-02-18Fix part of T95848: missing updates editing light object nodesBrecht Van Lommel
Make relation match material and world nodes. Does not address the reported issue regarding muted nodes, but another missing update found investigating.
2022-02-10Fix T95624: video texture not refreshing when changing offset in nodeJacques Lucke
The main issue is that the image and image user is not updated correctly in `rna_ImageUser_update`. `BKE_image_user_frame_calc` does not set the correct frame, because the image is null. Also `IMA_GPU_REFRESH` is not set for the same reason. When gpu materials are first created, it is expected that the frame is set correctly, and the flag is set if necessary. Therefore, somewhere during depsgraph evaluation, those have to be updated. The depsgraph node to do the update existed already. Now there is a new relation so that it is executed when the node tree changed, not only when the frame changed.
2022-02-03Fix T66913: undo after frame-change doesn't refresh properlyCampbell Barton
Use the ID.recalc flag to detect when updates after frame-change is needed. Since comparing the last calculated frame doesn't take undo into account (see code-comment for details). `ID_RECALC_AUDIO_SEEK` has been renamed to `ID_RECALC_FRAME_CHANGE` since this is not only related to audio however internally this flag is still categorized in `NodeType::AUDIO`. Reviewed By: sergey Ref D13942
2022-02-03Fix assert in original modifiers pointer update functionSergey Sharybin
The issue was happening with a specific file where the ID management code was not fully copying all modifiers because of the extra check in the `BKE_object_support_modifier_type_check()`. While it is arguable that copy-on-write should be a 1:1 copy there is no real need to maintain the per-modifier pointer to its original. Use its SessionUUID to perform lookup in the original datablock. Downside of this approach is that it is a linear lookup instead of direct pointer access, but the upside is that there is less pointers to manage and that the file with unsupported modifiers does behave correct without any asserts. Differential Revision: https://developer.blender.org/D13993
2022-02-03Despgraph: Remove asserts from object modifier backupSergey Sharybin
The modifiers are mapped between original and evaluated objects based on their session IDs. The pointer to original modifier is no longer needed for the backup: it remained from the initial implementation which was rewritten at some point. This is a preparation for removal of the pointer to original modifier.
2022-02-01Fix T95356: Crash in armature edit mode and certain conditionSergey Sharybin
Blender would have crashed when renaming bone in Edit Mode, Saving, and than selecting/deselecting. Caused by a mistake in the 0f89bcdbebf5: can not "short-circuit" the CoW update if it was explicitly requested. Safest for now solution seems to be to store whether the CoW component has been explicitly tagged, so that the following configuration can be supported: DEG_id_tag_update(id, ID_RECALC_GEOMETRY); DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE); Differential Revision: https://developer.blender.org/D13966
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-24Cleanup: sort struct forward declarationsCampbell Barton
2022-01-18Fix T95006: missing modifier update after frame changeJacques Lucke
The previous optimization did not work in general yet, unfortunately. This change makes the code more correct, but also brings back some unnecessary updates (e.g. when creating a node group).
2022-01-13Fix T94874: Drivers using bone custom properties don't work on modifiersSergey Sharybin
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Includes unwanted changes This reverts commit 46e049d0ce2bce2f53ddc41a0dbbea2969d00a5d.
2022-01-12BLI: Refactor vector types & functions to use templatesClment Foucault
This patch implements the vector types (i.e:`float2`) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the `blender::math` namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. ####Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: `float3::reflect()`). ####Upsides: - Still support `.x, .y, .z, .w` for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. ####Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call `len_squared_v3v3` in `math::length_squared()` and call it a day. - Type cast does not work with the template version of the `math::` vector functions. Meaning you need to manually cast `float *` and `(float *)[3]` to `float3` for the function calls. i.e: `math::distance_squared(float3(nearest.co), positions[i]);` - Some parts might loose in readability: `float3::dot(v1.normalized(), v2.normalized())` becoming `math::dot(math::normalize(v1), math::normalize(v2))` But I propose, when appropriate, to use `using namespace blender::math;` on function local or file scope to increase readability. `dot(normalize(v1), normalize(v2))` ####Consideration: - Include back `.length()` method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches `delaunay_2d.cc` and the intersection code. I would like to know @howardt opinion on the matter. - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed. But according to @JacquesLucke it is not a real problem for now. I would like to give a huge thanks to @JacquesLucke who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: https://developer.blender.org/D13791
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Reverted because the commit removes a lot of commits. This reverts commit a2c1c368af48644fa8995ecbe7138cc0d7900c30.
2022-01-12BLI: Refactor vector types & functions to use templatesClément Foucault
This patch implements the vector types (i.e:float2) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the blender::math namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: float3::reflect()). Upsides: - Still support .x, .y, .z, .w for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call len_squared_v3v3 in math::length_squared() and call it a day. - Type cast does not work with the template version of the math:: vector functions. Meaning you need to manually cast float * and (float *)[3] to float3 for the function calls. i.e: math::distance_squared(float3(nearest.co), positions[i]); - Some parts might loose in readability: float3::dot(v1.normalized(), v2.normalized()) becoming math::dot(math::normalize(v1), math::normalize(v2)) But I propose, when appropriate, to use using namespace blender::math; on function local or file scope to increase readability. dot(normalize(v1), normalize(v2)) Consideration: - Include back .length() method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches delaunay_2d.cc and the intersection code. I would like to know @Howard Trickey (howardt) opinion on the matter. - The noexcept on the copy constructor of mpq(2|3) is being removed. But according to @Jacques Lucke (JacquesLucke) it is not a real problem for now. I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: http://developer.blender.org/D13791
2022-01-12Fix T94797: crash when playing animation in eevee rendered viewJacques Lucke
The issue was caused by rBd09b1d2759861aa012ab2e7e4ce2ffa2. Since this commit, the image users in gpu materials were updated during depsgraph evaluation as well. However, there was a race condition when one thread is deleting gpu materials in `BKE_material_eval` while another thread is updating the image users at the same time. The solution is to make sure that deleting gpu materials is done before iterating over all gpu materials, by adding a new depsgraph relation.
2022-01-12Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
2022-01-10Fix T94766: texture coordinates from other object do not refreshJacques Lucke
The core issue is that flushing dependencies are created from an object to a node tree when it contains e.g. a Texture Coordinate node. That is an issue because the evaluation of the node tree itself does not depend on the object (node tree evaluation is essentially a no-op). Only other systems that parse and evaluate the node tree in a specific context actually depend on e.g. the position of the referenced object. It can even be the case that the node tree depends on objects that the actual evaluator (geometry nodes modifier/material) does not depend on, because a node is not connected to the output. Geometry nodes makes the distinction between dependencies to the node tree and to the evaluator already. Shader nodes do not. Therefore, shader nodes need a flushing relation from node groups to their parent node groups. This brings back some unnecessary updates from rB7e712b2d6a0d (e.g. when creating a node group from nodes that are not connected to the output). This is a bit unfortunate, but refactoring how dependencies work with shader nodes is a out of scope for this fix.
2022-01-07Fix T94078: Wrong Bound Box calculated for curvesGermano Cavalcante
`DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN` creates temporary objects that correspond to duplicates or instances. These temporary objects can share same pointers with the original object as in the case of Bounding Box. Bound Box of temporary objects is marked dirty in `BKE_object_replace_data_on_shallow_copy` since `ob->data` is different. This causes the original Bounding Box, calculated for the evaluated geometry, to be lost. The solution in this commit is to change the boundbox reference of the temporary objects, so the boundbox of the non-temporary object (with the data curve) is not marked dirty. Differential Revision: https://developer.blender.org/D13581
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-06Depsgraph: only link 'IK Constraint -> Init IK Tree' if animated.Alexander Gavrilov
This relation is intended to ensure that the properties of the IK constraint are ready by the time the IK solver tree is built. This however can cause spurious dependency cycles, because there is only one init tree node for the whole armature, and the relation actually implies dependency on all properties of the bone. This patch reduces spurious dependencies by only creating the relation if any properties of the IK constraint specifically are animated. Differential Revision: https://developer.blender.org/D13714
2022-01-06Depsgraph: fix spurious cycles with identically named idprops on bones.Alexander Gavrilov
If multiple bones have a custom property with the same name, depsgraph didn't distinguish between them, potentially leading to spurious cycles. This patch moves ID_PROPERTY operation nodes for bone custom properties from the parameters component to individual bone components, thus decoupling them. Differential Revision: https://developer.blender.org/D13729
2022-01-06Cleanup: spelling in commentsCampbell Barton
2022-01-03Depsgraph: Remove object-level visibility from geometry buildersSergey Sharybin
Continuation of the D13404 which finished the design of not having geometry-level nodes dependent on object-level. Differential Revision: https://developer.blender.org/D13405
2021-12-31Fix T94464: video texture is not refreshingJacques Lucke
In the past that worked because the `GPUMaterial` referenced the `ImageUser` from the image node. However, that design was incompatible with the recent node tree update refactor (rB7e712b2d6a0d257d272e). Also, in general it is a bad idea to have references between data that is owned by two different data blocks. This incompatibility was resolved by copying the image user from the node to the `GPUMaterial` (rB28df0107d4a8). Unfortunately, eevee depended on this reference, because the image user on the node was update when the frame changed. Because the image user was copied, the image user in the `GPUMaterial` did not receive the frame update anymore. This frame update is added back by this commit. The main change is that the image user iterator now also iterates over image users in `GPUMaterial`s on material and world data blocks. An issue is that these materials don't exist on the original data blocks and that caused the check in `build_animation_images` in the depsgraph to give the wrong answer. Therefore the check is extended. Right now the check is not optimal, because it results in more depsgraph nodes than are necessary. This can be improved when it becomes cheaper to check if a node tree contains any references to a video texture. The node tree update refactor mentioned before makes it much easier to construct this kind of run-time data from the bottom up, instead of scanning the entire node tree recursively every time some information is needed.
2021-12-21Nodes: refactor node tree update handlingJacques Lucke
Goals of this refactor: * More unified approach to updating everything that needs to be updated after a change in a node tree. * The updates should happen in the correct order and quadratic or worse algorithms should be avoided. * Improve detection of changes to the output to avoid tagging the depsgraph when it's not necessary. * Move towards a more declarative style of defining nodes by having a more centralized update procedure. The refactor consists of two main parts: * Node tree tagging and update refactor. * Generally, when changes are done to a node tree, it is tagged dirty until a global update function is called that updates everything in the correct order. * The tagging is more fine-grained compared to before, to allow for more precise depsgraph update tagging. * Depsgraph changes. * The shading specific depsgraph node for node trees as been removed. * Instead, there is a new `NTREE_OUTPUT` depsgrap node, which is only tagged when the output of the node tree changed (e.g. the Group Output or Material Output node). * The copy-on-write relation from node trees to the data block they are embedded in is now non-flushing. This avoids e.g. triggering a material update after the shader node tree changed in unrelated ways. Instead the material has a flushing relation to the new `NTREE_OUTPUT` node now. * The depsgraph no longer reports data block changes through to cycles through `Depsgraph.updates` when only the node tree changed in ways that do not affect the output. Avoiding unnecessary updates seems to work well for geometry nodes and cycles. The situation is a bit worse when there are drivers on the node tree, but that could potentially be improved separately in the future. Avoiding updates in eevee and the compositor is more tricky, but also less urgent. * Eevee updates are triggered by calling `DRW_notify_view_update` in `ED_render_view3d_update` indirectly from `DEG_editors_update`. * Compositor updates are triggered by `ED_node_composite_job` in `node_area_refresh`. This is triggered by calling `ED_area_tag_refresh` in `node_area_listener`. Removing updates always has the risk of breaking some dependency that no one was aware of. It's not unlikely that this will happen here as well. Adding back missing updates should be quite a bit easier than getting rid of unnecessary updates though. Differential Revision: https://developer.blender.org/D13246
2021-12-14Cleanup: resolve parameter mis-matches in doc-stringsCampbell Barton
Renamed or removed parameters which no longer exist.
2021-12-10Cleanup: move public doc-strings into headers for 'depsgraph'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. Ref T92709
2021-12-08Cleanup: Clang-Tidy modernize-redundant-void-argAaron Carlisle
2021-11-30Depsgraph: remove shading parameters componentJacques Lucke
This component served no purpose anymore. It was technical dept from the early 2.80 days. Differential Revision: https://developer.blender.org/D13422
2021-11-30Cleanup: spelling in comments & stringsCampbell Barton
2021-11-29Fix T93439: Armature widgets from hidden collections are invisibleSergey Sharybin
The are few things in the dependency graph which lead to the issue: - IDs are only built once. - Object-data level (Armature, i,e,) builder dependent on the object visibility. This caused issues when an armature is first built as not directly visible (via driver, i.e.) and then was built as a directly visible. This did not update visibility flag on the node for the custom shape object. The idea behind the fix is to go away form passing object visibility flag to the geometry-level builders and instead rely on the common visibility flush post-processing to make sure certain objects are fully visible when needed. This is the safest minimal part of the change for 3.0 release which acts as an additional way to ensure visibility. This means that it might not be a complete fix (if some configuration was overseen) but it should not make currently working cases to not work. The fix should also make modifiers used on rigify widgets to work. The more complete fix will have `is_object_visible` argument removed from the geometry-level builder functions. Differential Revision: https://developer.blender.org/D13404
2021-11-02Fix T89487: Crash adding Rigid Body to object with shared mesh dataSergey Sharybin
Not sure why this bug was only discovered by such an elaborate steps and why it took so long to be discovered. The root of the issue is that in the 956c539e597a the typical flow of tag+flush+evaluate was violated and tagging for visibility change happened after flush.
2021-10-13Fix T92136: Leak accessing evaluated depsgraph data from PythonCampbell Barton
Copy-on-write data blocks could be referenced from python but were not properly managing python reference counting. This would leak memory for any evaluated data-blocks accessed by Python. Reviewed By: sergey Ref D12850
2021-10-13Cleanup: Remove unused code paths in the depsgraph copy-on-writeSergey Sharybin
Seems to be residue from an early 2.80 days: the placeholder code path is no longer used. Remove all the tricky code for this, and make it clear that the `deg_expand_copy_on_write_datablock` is used on an non-expanded datablock. Should be no functional changes. And should help simplify D12850. Differential Revision: https://developer.blender.org/D12852
2021-10-13Revert "Fix T92136: Leak accessing evaluated depsgraph data from Python"Campbell Barton
This reverts commit 0558907ae674ebe81dc8910a6615fc32ce675d70. Based on discussion with Sergey, having Python references to un-expanded data should not happen - this change needs to be reconsidered.
2021-10-13Fix T92136: Leak accessing evaluated depsgraph data from PythonCampbell Barton
2021-10-03Cleanup: spelling in stringsCampbell Barton
2021-09-29Cleanup: use C comments for plain textCampbell Barton
2021-09-24Geometry Nodes: String to Curves NodeErik Abrahamsson
This commit adds a node that generates a text paragraph as curve instances. The inputs on the node control the overall shape of the paragraph, and other nodes can be used to move the individual instances afterwards. To output more than one line, the "Special Characters" node can be used. The node outputs instances instead of real geometry so that it doesn't have to duplicate work for every character afterwards. This is much more efficient, because all of the curve evaluation and nodes like fill curve don't have to repeat the same calculation for every instance of the same character. In the future, the instances component will support attributes, and the node can output attribute fields like "Word Index" and "Line Index". Differential Revision: https://developer.blender.org/D11522
2021-09-11Geometry Nodes: Support modifier on curve objectsHans Goudey
With this commit, curve objects support the geometry nodes modifier. Curves objects now evaluate to `CurveEval` unless there was a previous implicit conversion (tessellating modifiers, mesh modifiers, or the settings in the curve "Geometry" panel). In the new code, curves are only considered to be the wire edges-- any generated surface is a mesh instead, stored in the evaluated geometry set. The consolidation of concepts mentioned above allows remove a lot of code that had to do with maintaining the `DispList` type temporarily for modifiers and rendering. Instead, render engines see a separate object for the mesh from the mesh geometry component, and when the curve object evaluates to a curve, the `CurveEval` is always used for drawing wire edges. However, currently the `DispList` type is still maintained and used as an intermediate step in implicit mesh conversion. In the future, more uses of it could be changed to use `CurveEval` and `Mesh` instead. This is mostly not changed behavior, it is just a formalization of existing logic after recent fixes for 2.8 versions last year and two years ago. Also, in the future more functionality can be converted to nodes, removing cases of implicit conversions. For more discussion on that topic, see T89676. The `use_fill_deform` option is removed. It has not worked properly since 2.62, and the choice for filling a curve before or after deformation will work much better and be clearer with a node system. Applying the geometry nodes modifier to generate a curve is not implemented with this commit, so applying the modifier won't work at all. This is a separate technical challenge, and should be solved in a separate step. Differential Revision: https://developer.blender.org/D11597
2021-09-10Depsgraph: release GIL when evaluating the depsgraphSybren A. Stüvel
Evaluating the dependency graph potentially executes Python code when evaluating drivers. In specific situations (see T91046) this could deadlock Blender entirely. Temporarily releasing the GIL when evaluating the depsgraph resolves this. This is an improved version of rBfc460351170478e712740ae1917a2e24803eba3b, thanks @brecht for the diff! Manifest task: T91046
2021-09-09Revert "Depsgraph: release GIL when evaluating the depsgraph"Brecht Van Lommel
It is causing crashes in rendering, when releasing the GIL in render threads while the main thread is holding it. Ref T91046 This reverts commit fc460351170478e712740ae1917a2e24803eba3b.
2021-09-09Depsgraph: release GIL when evaluating the depsgraphSybren A. Stüvel
Evaluating the dependency graph potentially executes Python code when evaluating drivers. In specific situations (see T91046) this could deadlock Blender entirely. Temporarily releasing the GIL when evaluating the depsgraph resolves this. Calling the `BPy_BEGIN_ALLOW_THREADS` macro is relatively safe, as it's a no-op when the current thread does not have the GIL. Developed in collaboration with @sergey Manifest task: T91046
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-09-03Depsgraph: skip parentbone relation if bone prop is emptyPhilipp Oeser
Clearing the Parent Bone field in relations would result in something like this: ``` add_relation(Bone Parent) - Could not find op_from (ComponentKey(OBArmature, BONE)) add_relation(Bone Parent) - Failed, but op_to (ComponentKey(OBEmpty, TRANSFORM)) was ok ERROR (bke.object): /source/blender/blenkernel/intern\object.c:3330 ob_parbone: Object Empty with Bone parent: bone doesn't exist ``` Now skip creation of a depsgraph relation if the Parent Bone field is empty (since this would be invalid anyways). ref. T91101 Maniphest Tasks: T91101 Differential Revision: https://developer.blender.org/D12389
2021-08-31Fix T88433: no greaspencil depsgraph evaluation with certain driversPhilipp Oeser
When the same stroke was used as a driver variable, this could make this stroke already tagged as built in the course of building driver variables (via `build_gpencil`), but then important stuff from `build_object_data_geometry_datablock` could be missed later on (because both of these funtions use `checkIsBuiltAndTag`). Most importantly, setting up operations such as GEOMETRY_EVAL would be skipped entirely. `build_object_data_geometry_datablock` seems to cover greasepencil just fine (does the same as `build_gpencil` and more). Proposed solution is to remove `build_gpencil` entirely. In `build_id` it would then also call `build_object_data_geometry_datablock` for `ID_GD` IDs. Now the covered types that _call_ `build_object_data_geometry_datablock` match exactly to what is covered _inside_ `build_object_data_geometry_datablock`. Think this "duplication" of functionality was just overseen in rB66da2f537ae8 [`build_gpencil` existed long before and said commit made greasepencil a real object with geometry and such]. thx @JacquesLucke for additional input! Maniphest Tasks: T88433 Differential Revision: https://developer.blender.org/D12324
2021-08-26Cleanup: use C style comments for descriptive textCampbell Barton