Proof of concept multi-object edit-mode
Needs ReviewPublic

Authored by Campbell Barton (campbellbarton) on Mon, Mar 12, 5:01 AM.



Current Patch State

Entering edit-mode uses all selected mesh objects,
this patch is a test to help plan full featured support (see T54242 design task).

What Works:

3D View:

  • drawing.
  • select (all, picking, circle, border, lasso).
  • select mode vert/edge/face switching.
  • handful of tools: subdivide, delete, select(all)
  • transform (crazy-space and islands aren't currently working).

UV Editing:

  • select(all, circle, border, lasso, linked, pick-linked)
  • mouse picking (vert/edge/face/island)
  • transform
  • uv project & unwrap

What doesn't work:

  • everything not in the list above, but notably...
  • Undo: needs a refactor to be able to store multiple objects undo steps in a single UndoStepGroup.
  • Transform: needs to support multiple transformation's at once (note that this patch fills transform data with the selection, which wont work long term because of the objects matrix being used in transform calculations).


  • Enter/exit modes without touching workspace->mode was needed, this is currently done using EM_NO_CONTEXT - however we will need this for all modes, so more general solution is needed.
  • Handling the case when some objects fail to create edit-mode data is needed (while it's not a common case, it can happen).
  • Selecting a vertex/edge/face currently makes that object active too.

    We might want to reconsider this, although I think we want a way to change the active object since this is used for the UI (UV layers, groups etc).
  • Currently looping over view layer objects everywhere. In most cases I'd prefer to use utility function that allocates an array instead (although it's an extra thing to remember to free).

    It has the following advantages:
    • More expensive checks for duplicate data can be done only once.
    • Error checks (such as skipping objects not compatible with the mode or tool in use only need to be done once, and don't need to be repeated in every loop afterwards - with possibility they get out of sync between different functions, causing hard to track down bugs).
    • When having single/multi-versions of a function. We can more easily have a single version that constructs an array of one. Then we can creating a fake view-layer (which could backfire later with unintended consequences).
  • Currently duplicate object data occurring multiple times in the list isn't checked for (some users will want to disallow that - subdivide tool for eg).
  • Syncing vert/edge/face changes to all other object's is quite awkward, I'd like to redo this as a single function which is called on each object.


  • I found adding support for multi-edit while not especially difficult (in most cases) is often awkward design-wise because the level at which you handle all objects depends on the use case, so there is no rule-of-thumb which applies to all tools, sometimes needing to act on different levels within the same tool.

    Mostly this can be managed by having *_multi(..) versions of utility functions, but it's still not as clear cut as I'd like.

    • select all/none: simply operate on all objects.
    • select toggle: needs to check all objects first.
    • uv unwrap: operate on all _except_ for packing which needs to group UV's.
    • uv project bounds: operator on all, _except_ for clamping to bounds.
    • many tools that use notifiers will need to do a loop on all objects at the end to add a notifier to each .. or, we could move notifiers inside utility functions - currently they're mostly in the operators which makes it easier to tell which notifiers are being triggered by am operator (we could have utility function for this: WM_event_add_notifier_objects_in_mode & WM_event_add_notifier_objects_data_in_mode).

      Quite a few tools need refactoring to split logic into multiple functions.

Known Bugs

  • Exiting currently leaks memory.
  • Scale/Rotate doesn't work properly if objects are in different places.

Diff Detail

rB Blender
Build Status
Buildable 1298
Build 1298: arc lint + arc unit
Campbell Barton (campbellbarton) retitled this revision from Initial proof of concept multi-mode to Proof of concept multi-object edit-mode.Mon, Mar 12, 5:02 AM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Fix blenderplayer (tm)
  • Merge branch '28' into temp-object-multi-mode
  • Fix index offset (uv unwrap works now)
  • Merge branch '28' into temp-object-multi-mode
  • Fix assert entering edit mode w/ multiple objects
  • Correct assert adding new object
  • Add array utilities for getting objects in mode
  • Move to using arrays of objects/bases (avoid handling same object-data w/ linked duplicates).
  • Multi-edit-support for Select Linked Mesh
  • Filtering support w/ BKE_view_layer_array_from_*

    Fixes crashes for UV tools/selection/drawing when only some objects have UV's.
  • Move layer utility functions into own file
  • Merge branch 'blender2.8' into temp-object-multi-mode
  • Merge branch 'blender2.8' into temp-object-multi-mode