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:
authorDalai Felinto <dfelinto@gmail.com>2019-03-12 23:42:37 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-03-12 23:44:06 +0300
commite37e105fedb3258df80963573a7c830bb57b3ca4 (patch)
treebd6cd5e859082d9ce6c6daa6d078f980e9e14e05 /source/blender/editors/object/object_hook.c
parent9054b39b27c4198f436329f78af43fe3f3175508 (diff)
Fix Hook to New Object won't appear in Local View
Reported as part of T62436 (although the bug was a different one).
Diffstat (limited to 'source/blender/editors/object/object_hook.c')
-rw-r--r--source/blender/editors/object/object_hook.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index f65abb2f269..401260df406 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -442,7 +442,7 @@ static bool hook_op_edit_poll(bContext *C)
return 0;
}
-static Object *add_hook_object_new(Main *bmain, Scene *scene, ViewLayer *view_layer, Object *obedit)
+static Object *add_hook_object_new(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, Object *obedit)
{
Base *basedit;
Object *ob;
@@ -452,6 +452,10 @@ static Object *add_hook_object_new(Main *bmain, Scene *scene, ViewLayer *view_la
basedit = BKE_view_layer_base_find(view_layer, obedit);
BLI_assert(view_layer->basact->object == ob);
+ if (v3d && v3d->localvd) {
+ view_layer->basact->local_view_bits |= v3d->local_view_uuid;
+ }
+
/* icky, BKE_object_add sets new base as active.
* so set it back to the original edit object */
view_layer->basact = basedit;
@@ -459,7 +463,16 @@ static Object *add_hook_object_new(Main *bmain, Scene *scene, ViewLayer *view_la
return ob;
}
-static int add_hook_object(const bContext *C, Main *bmain, Scene *scene, ViewLayer *view_layer, Object *obedit, Object *ob, int mode, ReportList *reports)
+static int add_hook_object(
+ const bContext *C,
+ Main *bmain,
+ Scene *scene,
+ ViewLayer *view_layer,
+ View3D *v3d,
+ Object *obedit,
+ Object *ob,
+ int mode,
+ ReportList *reports)
{
ModifierData *md = NULL;
HookModifierData *hmd = NULL;
@@ -477,7 +490,7 @@ static int add_hook_object(const bContext *C, Main *bmain, Scene *scene, ViewLay
if (mode == OBJECT_ADDHOOK_NEWOB && !ob) {
- ob = add_hook_object_new(bmain, scene, view_layer, obedit);
+ ob = add_hook_object_new(bmain, scene, view_layer, v3d, obedit);
/* transform cent to global coords for loc */
mul_v3_m4v3(ob->loc, obedit->obmat, cent);
@@ -576,7 +589,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (add_hook_object(C, bmain, scene, view_layer, obedit, obsel, mode, op->reports)) {
+ if (add_hook_object(C, bmain, scene, view_layer, NULL, obedit, obsel, mode, op->reports)) {
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
return OPERATOR_FINISHED;
}
@@ -608,9 +621,10 @@ static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
+ View3D *v3d = CTX_wm_view3d(C);
Object *obedit = CTX_data_edit_object(C);
- if (add_hook_object(C, bmain, scene, view_layer, obedit, NULL, OBJECT_ADDHOOK_NEWOB, op->reports)) {
+ if (add_hook_object(C, bmain, scene, view_layer, v3d, obedit, NULL, OBJECT_ADDHOOK_NEWOB, op->reports)) {
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);