Page MenuHome

Multi-object mode support (edit-mode, pose-mode)
AbandonedPublic

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

Details

Reviewers
Dalai Felinto (dfelinto)
Bastien Montagne (mont29)
Sergey Sharybin (sergey)
Julian Eisel (Severin)
Maniphest Tasks
T54242: Multi-Object mode support (design overview)
Commits
rBSde15fa84025c: Merge branch '28' into temp-object-multi-mode
rBSd67d85771f65: Merge branch '28' into temp-object-multi-mode
rBS7ba6684f3e2c: Merge branch '28' into temp-object-multi-mode
rBSdaff986b8256: Fix flipped flag check
rBScd1ea736244b: Merge branch '28' into temp-object-multi-mode
rBSa9d3a6fc1ff5: Merge branch '28' into temp-object-multi-mode
rB269e4e9b81c0: Undo support for multi edit-mode
rBSf8700c483f44: Pose mode multi-object border select now works
rBSa2f183fa7d32: Fix exiting edit-mode which failed to leave editmode for non-active objects
rBS0ae714f08211: Merge branch '28' into temp-object-multi-mode
rBS8a20cd92a9cb: Merge branch '28' into temp-object-multi-mode
rBSad58a423ea43: Merge branch '28' into temp-object-multi-mode
rBSb91185d6af18: Correct assert adding new object
rBSb31a3ffc252d: BMesh: fix bug where indices weren't set /w offset
rBS04e76696f918: Merge branch 'blender2.8' into temp-object-multi-mode
rBS77925809793b: Fix selection updating
rBS8651ddeb0eac: Lasso Select support for multi-object edit
rBSe5e686a66789: Fix build (BLI_array_len/_count)
rBSfc2974b06db6: Merge branch '28' into temp-object-multi-mode
rBcf8028e4a95f: Merge branch 'blender2.8' into temp-object-multi-mode
rBSb45a464794d4: Fix index offset (uv unwrap works now)
rBSca83078ad771: EditMode & PoseMode multi-object selection, visible_bones & editable_bones now…
rBScb3fb8b25967: Fix blenderplayer (tm)
rBSe9173a0389ba: Merge branch 'blender2.8' into temp-object-multi-mode
rBSae42dd53274d: Center now works for multiple objects
rBS4aab63d23eaa: Move layer utility functions into own file
rBS1f94830d6e4d: Move to using arrays of objects/bases
rBS269e4e9b81c0: Undo support for multi edit-mode
rBS1440840228fc: Context selected bones now uses multi-pose mode
rBSabe59ac7760d: Fix undo with active object's changing
rBSedb8eb13c31c: Fix selection updating
rBSe7b4e4a94a1b: Add array utilities for getting objects in mode
rBSebcd24e8785d: Cleanup: minor edits
rBS5855d4051f2b: Filtering suppoert w/ BKE_view_layer_array_from_*
rBSf9cdf4e20d6d: Multi-edit-support for Select Linked Mesh
rBS93989296b56c: Merge branch '28' into temp-object-multi-mode
rBS6de9d14cfb32: Merge branch '28' into temp-object-multi-mode
rBS7ed100f13f2b: Merge branch 'blender2.8' into temp-object-multi-mode
rBSd897d52659bd: Muli-Edit: UV select(all) / circle / border / lasso
rBScb49e77eb1f9: Initial proof of concept multi-mode
rBS08af1743da00: Avoid memmove when removing items from list.
rBScf8028e4a95f: Merge branch 'blender2.8' into temp-object-multi-mode
rBSf011daef45b7: Fix pose bone picking, deselecting other objects
rBS965bc714424e: Fix median center calculation
rB7ed100f13f2b: Merge branch 'blender2.8' into temp-object-multi-mode
rBS8a410572c295: Merge branch '28' into temp-object-multi-mode
rBSaf8744ac9ef2: Fix double transformation of snap target
rBSe426838798d4: Fix assert entering edit mode w/ multiple objects
rBSacfc5f7820ab: Multi-Edit UV select
rBSc73d408ed824: Merge branch '28' into temp-object-multi-mode
rBS3b910260cd66: Fix missing free
rBSd25fea66e210: Quiet warning
rBS37573632f034: Merge branch '28' into temp-object-multi-mode
rBSfb5fca81d668: Fix bend tool w/ multi-object edit mode
rBS9ba4dae02e22: Pose lasso select and picking
Summary

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:

General:

  • Undo

3D View:

  • Edit Mesh:
    • drawing.
    • select (all, picking, circle, border, lasso).
    • select mode vert/edge/face switching.
    • handful of tools: subdivide, delete, select(all)
    • transform.
    • undo.
  • Edit Armature;
    • drawing.
    • select (all, picking, circle, border, lasso).
    • handful of tools: subdivide, delete, select(all)
    • transform.
    • undo.
  • Edit Curve/Lattice/Metaball
    • transform.
    • undo.
  • Pose Mode
    • drawing.
    • select (all, picking, circle, border, lasso).
    • some keyframe of tools: insert/remove.
    • transform.
    • undo.

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...
  • Live UV unwrap is limited to single objects (uses static variables internally)
  • Vertex/edge slide currently only use the active object to get reference vert/edge when dragging.

Details

  • 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.

Observations

  • 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.

    eg:
    • 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

  • Select linked in pose mode while mixed with weight paint mode no longer works.

Merging into 2.8

Bare minimum requirements for merging into 2.8

  • No existing tools, workflows should be broken (single-object modes must work as expected).
  • All basic select tools should support multi-object for all modes: (de)select-all, select-pick.
  • Another developer needs to review the general API's and approaches used (@Bastien Montagne (mont29) ?)

Once merged, tasks for all non working features need to be created, One parent task per object-type / mode combination: Edit-mesh, edit-lattice, pose-armature... etc. Each parent task will have many sub-tasks, only grouped when they are closely related (eg: rotate UV's, rotate vertex colors).

Diff Detail

Repository
rBS Blender Staging
Branch
temp-object-multi-mode
Build Status
Buildable 1424
Build 1424: arc lint + arc unit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
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
  • Merge branch 'blender2.8' into temp-object-multi-mode
  • Merge branch '28' into temp-object-multi-mode
  • Fix build (BLI_array_len/_count)
  • Merge branch '28' into temp-object-multi-mode
  • Undo support for multi edit-mode
  • Merge branch 'blender2.8' into temp-object-multi-mode
  • Merge branch '28' into temp-object-multi-mode

Re-worked transform system to support multiple transform instances at once (each with their own transform matrices).

  • Revert transform changes, in favor of more comprehensive ones
  • Transform with local center's center now works for multiple meshes in edit-mode
  • Fix selection updating
  • Fix median center calculation
  • Fixes for transform (prepare pose-mode mulit-object support)
  • Check types match before entering editmode
  • Multi-Object support for pose mode switching
  • Pose mode multi-editing: draw all objects in pose mode at once
  • Pose object multi-edit is now working
  • Fix multi-object editing breaking other non object-modes
  • Multi-armature edit-mode now works
  • Remove macros that used confusing named args
  • Rename dupe -> dup
  • Cleanup: rename TransHandle -> TransDataContainer
  • Add custom data back to TransInfo (for params that aren't connected to the data container)
  • Missing free
  • Use multi-object edit for all object types
  • Draw Manager: show multi-editmode data for meta/curve/lattice types
  • Fix leak in UV select
  • Fix proportional edit-mode
  • Fix for UV editing
  • Pose lasso select and picking
  • Context selected bones now uses multi-pose mode (now keying actions are supported)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Merge branch '28' into temp-object-multi-mode
  • Fix undo with active object's changing
  • Correct mode argument
  • Fix missing NULL check in mode switch
  • Log warning
  • Correct visible bones checking selection
  • Fix pose selection not updating all objects for each bone
  • Fix pose bone picking, deselecting other objects
Campbell Barton (campbellbarton) retitled this revision from Proof of concept multi-object edit-mode to Multi-object mode support (edit-mode, pose-mode).Apr 13 2018, 1:49 PM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Fix flipped flag check
  • Fix double transformation of snap target
  • Fix bend tool w/ multi-object edit mode
  • UV project now checks for changes before running updates
  • Merge branch '28' into temp-object-multi-mode

Support undo for other object types, this shares common logic.

  • Multi-object armature undo support
  • Multi-object curve undo support
  • Multi-object lattice undo support
  • Multi-object metaball undo support
  • Merge branch '28' into temp-object-multi-mode

Initial armature multi-mode selection, implemented 16 bits offset to mix object and bone selection (matching pose mode).

  • EditMode multi-object selection now works (border, lasso & picking)
  • PoseMode multi-object selection API improvements.
  • Context edit-bones loop over all edit-objects (so tools like subdivide & select all & linked now work).
  • EditArmature delete now works
  • Merge branch '28' into temp-object-multi-mode
  • Pose mode multi-object border select now works
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
source/blender/blenkernel/BKE_context.h
250

Some space between id and data id. data

source/blender/blenkernel/intern/object_update.c
175–183

Don't think this is needed anymore, since BKE_editmesh_from_object has already be changed?

source/blender/editors/mesh/meshtools.c
1304

shouldn't those be r_totelem etc?

  • Avoid memmove when removing items from list.
  • Add back subsurf UV checks