Layers: Scene->basact > SceneLayer->basact (more work)
This brings back adding hooks among other areas
This commit is contained in:
@@ -231,6 +231,7 @@ void ED_object_editmode_exit(bContext *C, int flag)
|
||||
/* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the flag */
|
||||
/* Note! if 'EM_FREEDATA' isn't in the flag, use ED_object_editmode_load directly */
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
const bool freedata = (flag & EM_FREEDATA) != 0;
|
||||
|
||||
@@ -239,8 +240,8 @@ void ED_object_editmode_exit(bContext *C, int flag)
|
||||
if (ED_object_editmode_load_ex(CTX_data_main(C), obedit, freedata) == false) {
|
||||
/* in rare cases (background mode) its possible active object
|
||||
* is flagged for editmode, without 'obedit' being set [#35489] */
|
||||
if (UNLIKELY(scene->basact && (scene->basact->object->mode & OB_MODE_EDIT))) {
|
||||
scene->basact->object->mode &= ~OB_MODE_EDIT;
|
||||
if (UNLIKELY(sl->basact && (sl->basact->object->mode & OB_MODE_EDIT))) {
|
||||
sl->basact->object->mode &= ~OB_MODE_EDIT;
|
||||
}
|
||||
if (flag & EM_WAITCURSOR) waitcursor(0);
|
||||
return;
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object.h"
|
||||
@@ -447,19 +448,19 @@ static int hook_op_edit_poll(bContext *C)
|
||||
|
||||
static Object *add_hook_object_new(Main *bmain, Scene *scene, SceneLayer *sl, Object *obedit)
|
||||
{
|
||||
BaseLegacy *base, *basedit;
|
||||
Base *base, *basedit;
|
||||
Object *ob;
|
||||
|
||||
ob = BKE_object_add(bmain, scene, sl, OB_EMPTY, NULL);
|
||||
|
||||
basedit = BKE_scene_base_find(scene, obedit);
|
||||
base = scene->basact;
|
||||
basedit = BKE_scene_layer_base_find(sl, obedit);
|
||||
base = sl->basact;
|
||||
base->lay = ob->lay = obedit->lay;
|
||||
BLI_assert(scene->basact->object == ob);
|
||||
BLI_assert(sl->basact->object == ob);
|
||||
|
||||
/* icky, BKE_object_add sets new base as active.
|
||||
* so set it back to the original edit object */
|
||||
scene->basact = basedit;
|
||||
sl->basact = basedit;
|
||||
|
||||
return ob;
|
||||
}
|
||||
|
||||
@@ -873,6 +873,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
Object *ob = ED_object_active_context(C);
|
||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||
int mode_orig = ob->mode;
|
||||
@@ -885,7 +886,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
|
||||
/* if cloth/softbody was removed, particle mode could be cleared */
|
||||
if (mode_orig & OB_MODE_PARTICLE_EDIT)
|
||||
if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0)
|
||||
if (scene->basact && scene->basact->object == ob)
|
||||
if (sl->basact && sl->basact->object == ob)
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
@@ -133,6 +133,7 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
int mode_orig;
|
||||
|
||||
if (!scene || !ob)
|
||||
@@ -146,7 +147,7 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
*/
|
||||
if (mode_orig & OB_MODE_PARTICLE_EDIT) {
|
||||
if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
|
||||
if (scene->basact && scene->basact->object == ob) {
|
||||
if (sl->basact && sl->basact->object == ob) {
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8384,7 +8384,7 @@ void draw_object_wire_color(Scene *scene, SceneLayer *sl, Base *base, unsigned c
|
||||
/* uses darker active color for non-active + selected */
|
||||
theme_id = TH_GROUP_ACTIVE;
|
||||
|
||||
if (scene->basact != base) {
|
||||
if (sl->basact != base) {
|
||||
theme_shade = -16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,8 +776,8 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = scene->basact->object;
|
||||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
Object *ob = sl->basact->object;
|
||||
ED_vgroup_vert_active_mirror(ob, event - B_VGRP_PNL_EDIT_SINGLE);
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
|
||||
@@ -805,7 +805,8 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
|
||||
{
|
||||
uiBlock *block = uiLayoutAbsoluteBlock(pa->layout);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = scene->basact->object;
|
||||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
Object *ob = sl->basact->object;
|
||||
|
||||
MDeformVert *dv;
|
||||
|
||||
@@ -1119,16 +1120,17 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
|
||||
|
||||
static int view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
return (scene->basact != NULL);
|
||||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
return (sl->basact != NULL);
|
||||
}
|
||||
|
||||
static void view3d_panel_transform(const bContext *C, Panel *pa)
|
||||
{
|
||||
uiBlock *block;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Object *ob = scene->basact->object;
|
||||
Object *ob = sl->basact->object;
|
||||
uiLayout *col;
|
||||
|
||||
block = uiLayoutGetBlock(pa->layout);
|
||||
|
||||
@@ -6388,8 +6388,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
|
||||
else if (t->options & CTX_PAINT_CURVE) {
|
||||
/* pass */
|
||||
}
|
||||
else if ((t->scene->basact) &&
|
||||
(ob = t->scene->basact->object) &&
|
||||
else if ((t->sl->basact) &&
|
||||
(ob = t->sl->basact->object) &&
|
||||
(ob->mode & OB_MODE_PARTICLE_EDIT) &&
|
||||
PE_get_current(t->scene, t->sl, ob))
|
||||
{
|
||||
|
||||
@@ -711,7 +711,7 @@ static void recalcData_spaceclip(TransInfo *t)
|
||||
/* helper for recalcData() - for object transforms, typically in the 3D view */
|
||||
static void recalcData_objects(TransInfo *t)
|
||||
{
|
||||
BaseLegacy *base = t->scene->basact;
|
||||
Base *base = t->sl->basact;
|
||||
|
||||
if (t->obedit) {
|
||||
if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) {
|
||||
|
||||
@@ -88,7 +88,8 @@ void ED_editors_init(bContext *C)
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *sce = CTX_data_scene(C);
|
||||
Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
|
||||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
Object *ob, *obact = (sl && sl->basact) ? sl->basact->object : NULL;
|
||||
ID *data;
|
||||
|
||||
/* This is called during initialization, so we don't want to store any reports */
|
||||
|
||||
Reference in New Issue
Block a user