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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-04-16 17:27:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-16 18:56:50 +0300
commitbfc9d426bb95e2bc0dd4541d6b4c5f802909149c (patch)
tree37702887bc3185309a13612613efd2752ebe0639 /source/blender/editors/undo/ed_undo.c
parent80bb4254c6fb638cee0d33868c81c76c104817bf (diff)
Multi-Object Editing
This adds initial multi-object editing support. - Selected objects are used when entering edit & pose modes. - Selection & tools work on all objects however many tools need porting See: T54641 for remaining tasks. Indentation will be done separately. See patch: D3101
Diffstat (limited to 'source/blender/editors/undo/ed_undo.c')
-rw-r--r--source/blender/editors/undo/ed_undo.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index d8b194e3336..0b77006afb7 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -36,6 +36,7 @@
#include "CLG_log.h"
#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
#include "BLI_utildefines.h"
@@ -46,6 +47,7 @@
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_screen.h"
+#include "BKE_layer.h"
#include "BKE_undo_system.h"
#include "ED_gpencil.h"
@@ -495,3 +497,24 @@ void ED_OT_undo_history(wmOperatorType *ot)
}
/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Undo Helper Functions
+ * \{ */
+
+void ED_undo_object_set_active_or_warn(ViewLayer *view_layer, Object *ob, const char *info, CLG_LogRef *log)
+{
+ Object *ob_prev = OBACT(view_layer);
+ if (ob_prev != ob) {
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+ if (base != NULL) {
+ view_layer->basact = base;
+ }
+ else {
+ /* Should never fail, may not crash but can give odd behavior. */
+ CLOG_WARN(log, "'%s' failed to restore active object: '%s'", info, ob->id.name + 2);
+ }
+ }
+}
+
+/** \} */