This is the parent task for the **copy-on-write operator** porting taskforce.
With copy-on-write in place we have clear separation between original data and evaluated state: dependency graph gets original data, goes through all the animation systems, drivers, constraints and modifiers stack and gets evaluated state of that data within the current context.
This means that now operators should read from an evaluated state and write to original data, and to inform dependency graph about changes.
Practical example: if operator need to get object matrix, it should read it from evaluated version. But if operator needs to update object’s location, it should write to the original object and tag that it was updated.
Copy-on-write can be enabled by passing `--enable-copy-on-write` argument to the Blender binary at startup.
# How this works:
1) Find an operator you want to port in the linked sub-tasks below.
2) Leave a comment stating what operator(s) you're working on (and/or links to patches when available).
3) Submit patches for review using [[ https://wiki.blender.org/index.php/Dev:Doc/Tools/Code_Review#Use_Arcanist | arcanist ]] - tagging @sergey and @aligorith as reviewers.
**Note**: Not all operators will actually need fixing (many should be fine already, without needing further changes). In that case:
* If you can edit the task description, mark the operator as "done" (i.e. by doing `~~ DUMMY_OT_working_operator_name ~~`)
* Otherwise, leave a comment noting that the operator works.
## What to do:
The code work is tedious but rather straightforward. Here are some knowledge which will help migrating operators.
* To go from original object to evaluated, use `DEG_get_evaluated_object()`.
To go from original ID to evaluated use `DEG_get_evaluated_id()`.
Keep in mind, these functions do hash lookup based on ID, so if multiple lookups of same object is needed try to store result of this lookup.
* To go from evaluated to original object use `DEG_get_original_object()`.
To go from evaluated to original ID use `DEG_get_original_id()`.
These functions are cheap.
* If some operator changes interface-only data (example: scene’s 3d cursor location) apart form notifier also use `DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE)` (e.g., rB6a75a1a669d2).
Run Blender with copy-on-write enabled (`--enable-copy-on-write`).
* If the operator works as well as it did in 2.7, it works!
* If there are problems (e.g. things won't update, invalid results, etc.) the operator (still) needs some more fixes applied.
## Design Notes:
1) Context (`bContext`) contains original non-evaluated data. This means `CTX_data_scene` will give original scene, not evaluated.
This is also valid for context in Python.
2) Main structure is always holding original datablocks.
3) Naming is very important to keep things clear. Agreed convention is: for evaluated versions of data we add `_eval` suffix to variables.
4) Where possible, mark evaluated data variables as `const`
# Sub-tasks for each module's operators:
## Stuff you can do now:
**Major Changes Required (High Priority - for Blender Studio Migration to 2.8):**
- View3D - T54829
- Transform - T54831
- Object - T54817
- Pose Tools - T54812
- Physics - T54818
- Sculpt - T54821
- Render - T54819
**Major Changes Required (Lower Priority):**
- Armature Edit Mode - T54811
- IO - T54813
- Mask - T54814
- Paint - T54820
- Sound - T54822
- Movie Clip Editor - T54823
- Image Editor - T54824
- UV Editor - T54830
**Likely Only Minor Changes Needed:**
- User Interface Stuff - T54832
- Mesh - T54815
- Node Editor - T54825
- Outliner - T54827
- Sequencer - T54828
## Postponed (Blocking/Pending Issues need resolving first)
#### Waiting for Sergey to test/check first
- Curve/Surface (`CURVE_OT_*`)
- Font (`FONT_OT_*`)
- Metaballs (`META_OT_*`)
- Lattices (`LATTICE_OT_*`)
#### Waiting for Grease Pencil branch merge
Grease Pencil module (`editors/gpencil`)
#### Should be fine without needing fixes
- Text Editor
#### May need fixes at some point (but aren't operators/for taskforce work)