diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2013-01-26 07:30:21 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2013-01-26 07:30:21 +0400 |
commit | 27eeb89bd994553c953a0bcb5b64d28f420c5926 (patch) | |
tree | 8a4579458d66cc2fa54c1001ceff09280ab02ec1 | |
parent | a8644deeef91ed425d71e76242dd9ab455980822 (diff) |
real fix for Logic Bricks UI smart controller (#33746)
previous commit (54102) actually reintroduces an old bug where Blender sigfaults when
the sensor and controllers are not from the active object.
The real fix for report #33746 is to clear the "object" property after the operator ran.
I'm not sure why when I call the operator from command line the property is cleared, but not
when I called it from C. Either way all should be working now.
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_logic/logic_ops.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 30b95b0e9dc..0d65cd19034 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -880,6 +880,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to) RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); WM_operator_properties_create(&props_ptr, "LOGIC_OT_controller_add"); + RNA_string_set(&props_ptr, "object", ob->id.name + 2); /* (3) add a new controller */ if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, &props_ptr) & OPERATOR_FINISHED) { diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index e9139271f18..f28757bb431 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -423,6 +423,10 @@ static int controller_add_exec(bContext *C, wmOperator *op) ob->scaflag |= OB_SHOWCONT; WM_event_add_notifier(C, NC_LOGIC, NULL); + + /* prevent the operator to get stuck with the "object" of the previous call - + * it only happens when it's called from the "smart controller", see bug #54102 */ + RNA_string_set(op->ptr, "object", ""); return OPERATOR_FINISHED; } |