Compare commits
5 Commits
tmp-eevee-
...
temp-scene
Author | SHA1 | Date | |
---|---|---|---|
3fa048a95b | |||
4b96452e62 | |||
9cdda6e9ca | |||
f846f7164e | |||
e77b4a30c0 |
@@ -33,6 +33,7 @@ struct Main;
|
||||
struct Scene;
|
||||
struct TransformOrientation;
|
||||
struct ViewLayer;
|
||||
struct wmWindow;
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Create, delete, init */
|
||||
@@ -133,6 +134,9 @@ void BKE_workspace_update_object_mode(
|
||||
struct EvaluationContext *eval_ctx,
|
||||
struct WorkSpace *workspace);
|
||||
|
||||
struct Object *BKE_workspace_edit_object(
|
||||
struct WorkSpace *workspace, struct Scene *scene);
|
||||
|
||||
#undef GETTER_ATTRS
|
||||
#undef SETTER_ATTRS
|
||||
|
||||
|
@@ -421,10 +421,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
|
||||
/* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
|
||||
library_foreach_ID_as_subdata_link((ID **)&scene->nodetree, callback, user_data, flag, &data);
|
||||
}
|
||||
/* DO NOT handle scene->basact here, it's doubling with the loop over whole scene->base later,
|
||||
* since basact is just a pointer to one of those items. */
|
||||
CALLBACK_INVOKE(scene->obedit, IDWALK_CB_NOP);
|
||||
|
||||
if (scene->ed) {
|
||||
Sequence *seq;
|
||||
SEQP_BEGIN(scene->ed, seq)
|
||||
|
@@ -74,6 +74,7 @@ typedef struct DupliContext {
|
||||
bool do_update;
|
||||
bool animated;
|
||||
Group *group; /* XXX child objects are selected from this group if set, could be nicer */
|
||||
Object *obedit; /* Only to check if the object is in edit-mode. */
|
||||
|
||||
Scene *scene;
|
||||
ViewLayer *view_layer;
|
||||
@@ -107,6 +108,7 @@ static void init_context(DupliContext *r_ctx, const EvaluationContext *eval_ctx,
|
||||
r_ctx->animated = false;
|
||||
r_ctx->group = NULL;
|
||||
|
||||
r_ctx->obedit = OBEDIT_FROM_EVAL_CTX(eval_ctx);
|
||||
r_ctx->object = ob;
|
||||
if (space_mat)
|
||||
copy_m4_m4(r_ctx->space_mat, space_mat);
|
||||
@@ -241,14 +243,13 @@ static bool is_child(const Object *ob, const Object *parent)
|
||||
static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChildDuplisFunc make_child_duplis_cb)
|
||||
{
|
||||
Object *parent = ctx->object;
|
||||
Object *obedit = ctx->scene->obedit;
|
||||
|
||||
if (ctx->group) {
|
||||
int groupid = 0;
|
||||
FOREACH_GROUP_BASE(ctx->group, base)
|
||||
{
|
||||
Object *ob = base->object;
|
||||
if ((base->flag & BASE_VISIBLED) && ob != obedit && is_child(ob, parent)) {
|
||||
if ((base->flag & BASE_VISIBLED) && ob != ctx->obedit && is_child(ob, parent)) {
|
||||
DupliContext pctx;
|
||||
copy_dupli_context(&pctx, ctx, ctx->object, NULL, groupid, false);
|
||||
|
||||
@@ -267,7 +268,7 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild
|
||||
ViewLayer *view_layer = ctx->view_layer;
|
||||
for (Base *base = view_layer->object_bases.first; base; base = base->next, baseid++) {
|
||||
Object *ob = base->object;
|
||||
if (ob != obedit && is_child(ob, parent)) {
|
||||
if ((ob != ctx->obedit) && is_child(ob, parent)) {
|
||||
DupliContext pctx;
|
||||
copy_dupli_context(&pctx, ctx, ctx->object, NULL, baseid, false);
|
||||
|
||||
|
@@ -173,7 +173,7 @@ void BKE_object_handle_data_update(
|
||||
switch (ob->type) {
|
||||
case OB_MESH:
|
||||
{
|
||||
BMEditMesh *em = (ob == scene->obedit) ? BKE_editmesh_from_object(ob) : NULL;
|
||||
BMEditMesh *em = (eval_ctx->object_mode & OB_MODE_EDIT) ? BKE_editmesh_from_object(ob) : NULL;
|
||||
uint64_t data_mask = scene->customdata_mask | CD_MASK_BAREMESH;
|
||||
#ifdef WITH_FREESTYLE
|
||||
/* make sure Freestyle edge/face marks appear in DM for render (see T40315) */
|
||||
@@ -223,7 +223,7 @@ void BKE_object_handle_data_update(
|
||||
}
|
||||
|
||||
/* particles */
|
||||
if (ob != scene->obedit && ob->particlesystem.first) {
|
||||
if ((ob != OBEDIT_FROM_EVAL_CTX(eval_ctx)) && ob->particlesystem.first) {
|
||||
ParticleSystem *tpsys, *psys;
|
||||
DerivedMesh *dm;
|
||||
ob->transflag &= ~OB_DUPLIPARTS;
|
||||
|
@@ -166,7 +166,6 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
|
||||
|
||||
sce_dst->ed = NULL;
|
||||
sce_dst->depsgraph_hash = NULL;
|
||||
sce_dst->obedit = NULL;
|
||||
sce_dst->fps_info = NULL;
|
||||
|
||||
/* layers and collections */
|
||||
@@ -982,9 +981,6 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
|
||||
/* check for cyclic sets, for reading old files but also for definite security (py?) */
|
||||
BKE_scene_validate_setscene(bmain, scene);
|
||||
|
||||
/* can happen when switching modes in other scenes */
|
||||
scene->obedit = NULL;
|
||||
|
||||
/* deselect objects (for dataselect) */
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next)
|
||||
ob->flag &= ~(SELECT | OB_FROMGROUP);
|
||||
@@ -1380,7 +1376,7 @@ static bool check_rendered_viewport_visible(Main *bmain)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void prepare_mesh_for_viewport_render(Main *bmain, Scene *scene)
|
||||
static void prepare_mesh_for_viewport_render(Main *bmain, const EvaluationContext *eval_ctx)
|
||||
{
|
||||
/* This is needed to prepare mesh to be used by the render
|
||||
* engine from the viewport rendering. We do loading here
|
||||
@@ -1391,7 +1387,7 @@ static void prepare_mesh_for_viewport_render(Main *bmain, Scene *scene)
|
||||
* call loading of the edit data for the mesh objects.
|
||||
*/
|
||||
|
||||
Object *obedit = scene->obedit;
|
||||
Object *obedit = OBEDIT_FROM_EVAL_CTX(eval_ctx);
|
||||
if (obedit) {
|
||||
Mesh *mesh = obedit->data;
|
||||
if ((obedit->type == OB_MESH) &&
|
||||
@@ -1429,7 +1425,7 @@ void BKE_scene_graph_update_tagged(EvaluationContext *eval_ctx,
|
||||
/* Uncomment this to check if graph was properly tagged for update. */
|
||||
// DEG_debug_graph_relations_validate(depsgraph, bmain, scene);
|
||||
/* Flush editing data if needed. */
|
||||
prepare_mesh_for_viewport_render(bmain, scene);
|
||||
prepare_mesh_for_viewport_render(bmain, eval_ctx);
|
||||
/* Flush recalc flags to dependencies. */
|
||||
DEG_graph_flush_update(bmain, depsgraph);
|
||||
/* Update all objects: drivers, matrices, displists, etc. flags set
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
@@ -517,4 +518,20 @@ void BKE_workspace_update_object_mode(
|
||||
* for now without this 'bmain->eval_ctx' is never set. */
|
||||
|
||||
eval_ctx->object_mode = workspace->object_mode;
|
||||
}
|
||||
}
|
||||
|
||||
Object *BKE_workspace_edit_object(WorkSpace *workspace, Scene *scene)
|
||||
{
|
||||
if (workspace->object_mode & OB_MODE_EDIT) {
|
||||
ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
|
||||
if (view_layer) {
|
||||
Object *obedit = OBACT(view_layer);
|
||||
if (obedit) {
|
||||
BLI_assert(BKE_object_is_in_editmode(obedit));
|
||||
return obedit;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -6216,7 +6216,6 @@ static void direct_link_scene(FileData *fd, Scene *sce, Main *bmain)
|
||||
SceneRenderLayer *srl;
|
||||
|
||||
sce->depsgraph_hash = NULL;
|
||||
sce->obedit = NULL;
|
||||
sce->fps_info = NULL;
|
||||
sce->customdata_mask_modal = 0;
|
||||
sce->lay_updated = 0;
|
||||
|
@@ -461,18 +461,6 @@ void update_special_pointers(const Depsgraph *depsgraph,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_SCE:
|
||||
{
|
||||
const Scene *scene_orig = (const Scene *)id_orig;
|
||||
Scene *scene_cow = (Scene *)id_cow;
|
||||
if (scene_orig->obedit != NULL) {
|
||||
scene_cow->obedit = (Object *)depsgraph->get_cow_id(&scene_orig->obedit->id);
|
||||
}
|
||||
else {
|
||||
scene_cow->obedit = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -622,13 +610,6 @@ void update_copy_on_write_scene(const Depsgraph *depsgraph,
|
||||
update_copy_on_write_view_layers(depsgraph, scene_cow, scene_orig);
|
||||
update_copy_on_write_scene_collection(scene_cow->collection,
|
||||
scene_orig->collection);
|
||||
// Update edit object pointer.
|
||||
if (scene_orig->obedit != NULL) {
|
||||
scene_cow->obedit = (Object *)depsgraph->get_cow_id(&scene_orig->obedit->id);
|
||||
}
|
||||
else {
|
||||
scene_cow->obedit = NULL;
|
||||
}
|
||||
/* Synchronize active render engine. */
|
||||
BLI_strncpy(scene_cow->view_render.engine_id,
|
||||
scene_orig->view_render.engine_id,
|
||||
|
@@ -2683,8 +2683,10 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
|
||||
}
|
||||
case ANIMTYPE_OBJECT:
|
||||
{
|
||||
#if 0
|
||||
bDopeSheet *ads = (bDopeSheet *)ac->data;
|
||||
Scene *sce = (Scene *)ads->source;
|
||||
#endif
|
||||
ViewLayer *view_layer = ac->view_layer;
|
||||
Base *base = (Base *)ale->data;
|
||||
Object *ob = base->object;
|
||||
@@ -2723,7 +2725,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
|
||||
adt->flag |= ADT_UI_ACTIVE;
|
||||
|
||||
/* ensure we exit editmode on whatever object was active before to avoid getting stuck there - T48747 */
|
||||
if (ob != sce->obedit)
|
||||
if (ob != CTX_data_edit_object(C))
|
||||
ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
|
||||
|
||||
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
|
||||
|
@@ -5027,7 +5027,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
snap_context,
|
||||
SCE_SELECT_FACE,
|
||||
&(const struct SnapObjectParams){
|
||||
.snap_select = (vc.scene->obedit != NULL) ? SNAP_NOT_ACTIVE : SNAP_ALL,
|
||||
.snap_select = (vc.obedit != NULL) ? SNAP_NOT_ACTIVE : SNAP_ALL,
|
||||
.use_object_edit_cage = false,
|
||||
},
|
||||
mval, NULL, true,
|
||||
|
@@ -788,7 +788,7 @@ static int curve_draw_exec(bContext *C, wmOperator *op)
|
||||
struct CurveDrawData *cdd = op->customdata;
|
||||
|
||||
const CurvePaintSettings *cps = &cdd->vc.scene->toolsettings->curve_paint_settings;
|
||||
Object *obedit = cdd->vc.scene->obedit;
|
||||
Object *obedit = cdd->vc.obedit;
|
||||
Curve *cu = obedit->data;
|
||||
ListBase *nurblist = object_editcurve_get(obedit);
|
||||
|
||||
|
@@ -55,6 +55,7 @@
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_workspace_types.h"
|
||||
|
||||
#include "BKE_collection.h"
|
||||
#include "BKE_context.h"
|
||||
@@ -1293,6 +1294,7 @@ static int gp_convert_poll(bContext *C)
|
||||
bGPDframe *gpf = NULL;
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const WorkSpace *workspace = CTX_wm_workspace(C);
|
||||
|
||||
/* only if the current view is 3D View, if there's valid data (i.e. at least one stroke!),
|
||||
* and if we are not in edit mode!
|
||||
@@ -1301,7 +1303,7 @@ static int gp_convert_poll(bContext *C)
|
||||
(gpl = BKE_gpencil_layer_getactive(gpd)) &&
|
||||
(gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0)) &&
|
||||
(gpf->strokes.first) &&
|
||||
(scene->obedit == NULL));
|
||||
((workspace->object_mode & OB_MODE_EDIT) == 0));
|
||||
}
|
||||
|
||||
static int gp_convert_layer_exec(bContext *C, wmOperator *op)
|
||||
|
@@ -147,7 +147,9 @@ struct ScrArea *ED_screen_state_toggle(struct bContext *C, struct wmWindow *win,
|
||||
void ED_screens_header_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg);
|
||||
bool ED_screen_stereo3d_required(const struct bScreen *screen, const struct Scene *scene);
|
||||
Scene *ED_screen_scene_find(const struct bScreen *screen, const struct wmWindowManager *wm);
|
||||
|
||||
Scene *ED_screen_scene_find_with_window(const struct bScreen *screen, const struct wmWindowManager *wm, struct wmWindow **r_window);
|
||||
struct wmWindow *ED_screen_window_find(const struct bScreen *screen, const struct wmWindowManager *wm);
|
||||
void ED_screen_preview_render(const struct bScreen *screen, int size_x, int size_y, unsigned int *r_rect) ATTR_NONNULL();
|
||||
|
||||
/* workspaces */
|
||||
|
@@ -121,10 +121,9 @@ static void verttag_set_cb(BMVert *v, bool val, void *user_data_v)
|
||||
}
|
||||
|
||||
static void mouse_mesh_shortest_path_vert(
|
||||
Scene *scene, const struct PathSelectParams *op_params,
|
||||
Scene *UNUSED(scene), Object *obedit, const struct PathSelectParams *op_params,
|
||||
BMVert *v_act, BMVert *v_dst)
|
||||
{
|
||||
Object *obedit = scene->obedit;
|
||||
BMEditMesh *em = BKE_editmesh_from_object(obedit);
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
@@ -280,11 +279,11 @@ static void edgetag_set_cb(BMEdge *e, bool val, void *user_data_v)
|
||||
}
|
||||
}
|
||||
|
||||
static void edgetag_ensure_cd_flag(Scene *scene, Mesh *me)
|
||||
static void edgetag_ensure_cd_flag(Mesh *me, const char edge_mode)
|
||||
{
|
||||
BMesh *bm = me->edit_btmesh->bm;
|
||||
|
||||
switch (scene->toolsettings->edge_mode) {
|
||||
switch (edge_mode) {
|
||||
case EDGE_MODE_TAG_CREASE:
|
||||
BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_CREASE);
|
||||
break;
|
||||
@@ -307,10 +306,9 @@ static void edgetag_ensure_cd_flag(Scene *scene, Mesh *me)
|
||||
|
||||
/* since you want to create paths with multiple selects, it doesn't have extend option */
|
||||
static void mouse_mesh_shortest_path_edge(
|
||||
Scene *scene, const struct PathSelectParams *op_params,
|
||||
Scene *scene, Object *obedit, const struct PathSelectParams *op_params,
|
||||
BMEdge *e_act, BMEdge *e_dst)
|
||||
{
|
||||
Object *obedit = scene->obedit;
|
||||
BMEditMesh *em = BKE_editmesh_from_object(obedit);
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
@@ -319,7 +317,7 @@ static void mouse_mesh_shortest_path_edge(
|
||||
Mesh *me = obedit->data;
|
||||
bool is_path_ordered = false;
|
||||
|
||||
edgetag_ensure_cd_flag(scene, obedit->data);
|
||||
edgetag_ensure_cd_flag(obedit->data, op_params->edge_mode);
|
||||
|
||||
if (e_act && (e_act != e_dst)) {
|
||||
if (op_params->use_fill) {
|
||||
@@ -377,7 +375,7 @@ static void mouse_mesh_shortest_path_edge(
|
||||
}
|
||||
else {
|
||||
const bool is_act = !edgetag_test_cb(e_dst, &user_data);
|
||||
edgetag_ensure_cd_flag(scene, obedit->data);
|
||||
edgetag_ensure_cd_flag(obedit->data, op_params->edge_mode);
|
||||
edgetag_set_cb(e_dst, is_act, &user_data); /* switch the edge option */
|
||||
}
|
||||
|
||||
@@ -452,10 +450,9 @@ static void facetag_set_cb(BMFace *f, bool val, void *user_data_v)
|
||||
}
|
||||
|
||||
static void mouse_mesh_shortest_path_face(
|
||||
Scene *scene, const struct PathSelectParams *op_params,
|
||||
Scene *UNUSED(scene), Object *obedit, const struct PathSelectParams *op_params,
|
||||
BMFace *f_act, BMFace *f_dst)
|
||||
{
|
||||
Object *obedit = scene->obedit;
|
||||
BMEditMesh *em = BKE_editmesh_from_object(obedit);
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
@@ -547,7 +544,7 @@ static void mouse_mesh_shortest_path_face(
|
||||
/* Main Operator for vert/edge/face tag */
|
||||
|
||||
static bool edbm_shortest_path_pick_ex(
|
||||
Scene *scene, const struct PathSelectParams *op_params,
|
||||
Scene *scene, Object *obedit, const struct PathSelectParams *op_params,
|
||||
BMElem *ele_src, BMElem *ele_dst)
|
||||
{
|
||||
|
||||
@@ -555,15 +552,15 @@ static bool edbm_shortest_path_pick_ex(
|
||||
/* pass */
|
||||
}
|
||||
else if (ele_src->head.htype == BM_VERT) {
|
||||
mouse_mesh_shortest_path_vert(scene, op_params, (BMVert *)ele_src, (BMVert *)ele_dst);
|
||||
mouse_mesh_shortest_path_vert(scene, obedit, op_params, (BMVert *)ele_src, (BMVert *)ele_dst);
|
||||
return true;
|
||||
}
|
||||
else if (ele_src->head.htype == BM_EDGE) {
|
||||
mouse_mesh_shortest_path_edge(scene, op_params, (BMEdge *)ele_src, (BMEdge *)ele_dst);
|
||||
mouse_mesh_shortest_path_edge(scene, obedit, op_params, (BMEdge *)ele_src, (BMEdge *)ele_dst);
|
||||
return true;
|
||||
}
|
||||
else if (ele_src->head.htype == BM_FACE) {
|
||||
mouse_mesh_shortest_path_face(scene, op_params, (BMFace *)ele_src, (BMFace *)ele_dst);
|
||||
mouse_mesh_shortest_path_face(scene, obedit, op_params, (BMFace *)ele_src, (BMFace *)ele_dst);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -644,7 +641,7 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
|
||||
op_params.track_active = track_active;
|
||||
op_params.edge_mode = vc.scene->toolsettings->edge_mode;
|
||||
|
||||
if (!edbm_shortest_path_pick_ex(vc.scene, &op_params, ele_src, ele_dst)) {
|
||||
if (!edbm_shortest_path_pick_ex(vc.scene, vc.obedit, &op_params, ele_src, ele_dst)) {
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
@@ -681,7 +678,7 @@ static int edbm_shortest_path_pick_exec(bContext *C, wmOperator *op)
|
||||
op_params.track_active = true;
|
||||
op_params.edge_mode = scene->toolsettings->edge_mode;
|
||||
|
||||
if (!edbm_shortest_path_pick_ex(scene, &op_params, ele_src, ele_dst)) {
|
||||
if (!edbm_shortest_path_pick_ex(scene, obedit, &op_params, ele_src, ele_dst)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@@ -720,8 +717,8 @@ void MESH_OT_shortest_path_pick(wmOperatorType *ot)
|
||||
static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_edit_object(C);
|
||||
BMEditMesh *em = BKE_editmesh_from_object(ob);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
BMEditMesh *em = BKE_editmesh_from_object(obedit);
|
||||
BMesh *bm = em->bm;
|
||||
BMIter iter;
|
||||
BMEditSelection *ese_src, *ese_dst;
|
||||
@@ -773,7 +770,7 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op)
|
||||
struct PathSelectParams op_params;
|
||||
path_select_params_from_op(op, &op_params);
|
||||
|
||||
edbm_shortest_path_pick_ex(scene, &op_params, ele_src, ele_dst);
|
||||
edbm_shortest_path_pick_ex(scene, obedit, &op_params, ele_src, ele_dst);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_workspace_types.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_blenlib.h"
|
||||
@@ -275,6 +276,7 @@ static void join_mesh_single(
|
||||
|
||||
int join_mesh_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
const WorkSpace *workspace = CTX_wm_workspace(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
@@ -294,7 +296,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
||||
bDeformGroup *dg, *odg;
|
||||
CustomData vdata, edata, fdata, ldata, pdata;
|
||||
|
||||
if (scene->obedit) {
|
||||
if (workspace->object_mode & OB_MODE_EDIT) {
|
||||
BKE_report(op->reports, RPT_WARNING, "Cannot join while in edit mode");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@@ -1673,7 +1673,7 @@ static int convert_poll(bContext *C)
|
||||
Base *base_act = CTX_data_active_base(C);
|
||||
Object *obact = base_act ? base_act->object : NULL;
|
||||
|
||||
return (!ID_IS_LINKED(scene) && obact && scene->obedit != obact &&
|
||||
return (!ID_IS_LINKED(scene) && obact && (BKE_object_is_in_editmode(obact) == false) &&
|
||||
(base_act->flag & BASE_SELECTED) && !ID_IS_LINKED(obact));
|
||||
}
|
||||
|
||||
@@ -2529,10 +2529,10 @@ static int join_poll(bContext *C)
|
||||
|
||||
static int join_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const WorkSpace *workspace = CTX_wm_workspace(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
if (scene->obedit) {
|
||||
if (workspace->object_mode & OB_MODE_EDIT) {
|
||||
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -2583,10 +2583,10 @@ static int join_shapes_poll(bContext *C)
|
||||
|
||||
static int join_shapes_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const WorkSpace *workspace = CTX_wm_workspace(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
if (scene->obedit) {
|
||||
if (workspace->object_mode & OB_MODE_EDIT) {
|
||||
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@@ -84,6 +84,7 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -283,9 +284,6 @@ void ED_object_editmode_exit(bContext *C, int flag)
|
||||
ListBase pidlist;
|
||||
PTCacheID *pid;
|
||||
|
||||
/* for example; displist make is different in editmode */
|
||||
scene->obedit = NULL; // XXX for context
|
||||
|
||||
/* flag object caches as outdated */
|
||||
BKE_ptcache_ids_from_object(&pidlist, obedit, scene, 0);
|
||||
for (pid = pidlist.first; pid; pid = pid->next) {
|
||||
@@ -358,8 +356,6 @@ void ED_object_editmode_enter(bContext *C, int flag)
|
||||
if (ob->type == OB_MESH) {
|
||||
BMEditMesh *em;
|
||||
ok = 1;
|
||||
scene->obedit = ob; /* context sees this */
|
||||
|
||||
const bool use_key_index = mesh_needs_keyindex(ob->data);
|
||||
|
||||
EDBM_mesh_make(scene->toolsettings, ob, use_key_index);
|
||||
@@ -389,7 +385,6 @@ void ED_object_editmode_enter(bContext *C, int flag)
|
||||
return;
|
||||
}
|
||||
ok = 1;
|
||||
scene->obedit = ob;
|
||||
ED_armature_to_edit(arm);
|
||||
/* to ensure all goes in restposition and without striding */
|
||||
DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* XXX: should this be OB_RECALC_DATA? */
|
||||
@@ -397,21 +392,18 @@ void ED_object_editmode_enter(bContext *C, int flag)
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_ARMATURE, scene);
|
||||
}
|
||||
else if (ob->type == OB_FONT) {
|
||||
scene->obedit = ob; /* XXX for context */
|
||||
ok = 1;
|
||||
ED_curve_editfont_make(ob);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_TEXT, scene);
|
||||
}
|
||||
else if (ob->type == OB_MBALL) {
|
||||
scene->obedit = ob; /* XXX for context */
|
||||
ok = 1;
|
||||
ED_mball_editmball_make(ob);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_MBALL, scene);
|
||||
}
|
||||
else if (ob->type == OB_LATTICE) {
|
||||
scene->obedit = ob; /* XXX for context */
|
||||
ok = 1;
|
||||
ED_lattice_editlatt_make(ob);
|
||||
|
||||
@@ -419,7 +411,6 @@ void ED_object_editmode_enter(bContext *C, int flag)
|
||||
}
|
||||
else if (ob->type == OB_SURF || ob->type == OB_CURVE) {
|
||||
ok = 1;
|
||||
scene->obedit = ob; /* XXX for context */
|
||||
ED_curve_editnurb_make(ob);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_CURVE, scene);
|
||||
@@ -431,7 +422,6 @@ void ED_object_editmode_enter(bContext *C, int flag)
|
||||
DEG_id_tag_update(&scene->id, 0);
|
||||
}
|
||||
else {
|
||||
scene->obedit = NULL; /* XXX for context */
|
||||
workspace->object_mode &= ~OB_MODE_EDIT;
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
|
||||
}
|
||||
@@ -703,7 +693,7 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
|
||||
|
||||
if (!(ob = OBACT(view_layer))) return;
|
||||
|
||||
if (scene->obedit) { // XXX get from context
|
||||
if (BKE_object_is_in_editmode(ob)) {
|
||||
/* obedit_copymenu(); */
|
||||
return;
|
||||
}
|
||||
@@ -942,7 +932,7 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
|
||||
DEG_relations_tag_update(bmain);
|
||||
}
|
||||
|
||||
static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer)
|
||||
static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer, Object *obedit)
|
||||
{
|
||||
Object *ob;
|
||||
short event;
|
||||
@@ -950,7 +940,7 @@ static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLaye
|
||||
|
||||
if (!(ob = OBACT(view_layer))) return;
|
||||
|
||||
if (scene->obedit) { /* XXX get from context */
|
||||
if (obedit) {
|
||||
/* if (ob->type == OB_MESH) */
|
||||
/* XXX mesh_copy_menu(); */
|
||||
return;
|
||||
@@ -1367,7 +1357,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot)
|
||||
|
||||
/* ********************** */
|
||||
|
||||
static void UNUSED_FUNCTION(image_aspect) (Scene *scene, ViewLayer *view_layer)
|
||||
static void UNUSED_FUNCTION(image_aspect) (Scene *scene, ViewLayer *view_layer, Object *obedit)
|
||||
{
|
||||
/* all selected objects with an image map: scale in image aspect */
|
||||
Base *base;
|
||||
@@ -1377,7 +1367,7 @@ static void UNUSED_FUNCTION(image_aspect) (Scene *scene, ViewLayer *view_layer)
|
||||
float x, y, space;
|
||||
int a, b, done;
|
||||
|
||||
if (scene->obedit) return; // XXX get from context
|
||||
if (obedit) return;
|
||||
if (ID_IS_LINKED(scene)) return;
|
||||
|
||||
for (base = FIRSTBASE(view_layer); base; base = base->next) {
|
||||
|
@@ -693,7 +693,7 @@ int ED_object_modifier_apply(ReportList *reports, const bContext *C, Scene *scen
|
||||
const WorkSpace *workspace = CTX_wm_workspace(C);
|
||||
int prev_mode;
|
||||
|
||||
if (scene->obedit) {
|
||||
if (BKE_object_is_in_editmode(ob)) {
|
||||
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in edit mode");
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1444,8 +1444,10 @@ static bool render_view3d_flag_changed(RenderEngine *engine, const bContext *C)
|
||||
job_update_flag |= PR_UPDATE_DATABASE;
|
||||
|
||||
/* load editmesh */
|
||||
if (scene->obedit)
|
||||
ED_object_editmode_load(scene->obedit);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
if (obedit) {
|
||||
ED_object_editmode_load(obedit);
|
||||
}
|
||||
}
|
||||
|
||||
engine->update_flag = 0;
|
||||
|
@@ -92,8 +92,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
||||
Scene *scene = WM_window_get_active_scene(win);
|
||||
WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
|
||||
ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
|
||||
Object *obedit = scene->obedit;
|
||||
Object *obact = (view_layer && view_layer->basact) ? view_layer->basact->object : NULL;
|
||||
Object *obedit = BKE_workspace_edit_object(workspace, scene);
|
||||
|
||||
if (CTX_data_dir(member)) {
|
||||
CTX_data_dir_set(result, screen_context_dir);
|
||||
|
@@ -1871,3 +1871,14 @@ Scene *ED_screen_scene_find(const bScreen *screen, const wmWindowManager *wm)
|
||||
{
|
||||
return ED_screen_scene_find_with_window(screen, wm, NULL);
|
||||
}
|
||||
|
||||
|
||||
wmWindow *ED_screen_window_find(const bScreen *screen, const wmWindowManager *wm)
|
||||
{
|
||||
for (wmWindow *win = wm->windows.first; win; win = win->next) {
|
||||
if (WM_window_get_active_screen(win) == screen) {
|
||||
return win;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object_deform.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_object.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
@@ -58,7 +59,6 @@ bool ED_wpaint_ensure_data(
|
||||
bContext *C, struct ReportList *reports,
|
||||
enum eWPaintFlag flag, struct WPaintVGroupIndex *vgroup_index)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
|
||||
@@ -67,7 +67,7 @@ bool ED_wpaint_ensure_data(
|
||||
vgroup_index->mirror = -1;
|
||||
}
|
||||
|
||||
if (scene->obedit) {
|
||||
if (BKE_object_is_in_editmode(ob)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -308,4 +308,4 @@ float ED_wpaint_blend_tool(
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
/** \} */
|
||||
|
@@ -54,6 +54,7 @@
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_object.h"
|
||||
|
||||
#include "ED_info.h"
|
||||
#include "ED_armature.h"
|
||||
@@ -374,15 +375,15 @@ static bool stats_is_object_dynamic_topology_sculpt(Object *ob, const eObjectMod
|
||||
}
|
||||
|
||||
/* Statistics displayed in info header. Called regularly on scene changes. */
|
||||
static void stats_update(Scene *scene, ViewLayer *view_layer, const eObjectMode object_mode)
|
||||
static void stats_update(ViewLayer *view_layer, Object *obedit, const eObjectMode object_mode)
|
||||
{
|
||||
SceneStats stats = {0};
|
||||
Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL;
|
||||
Base *base;
|
||||
|
||||
if (scene->obedit) {
|
||||
|
||||
if (obedit) {
|
||||
/* Edit Mode */
|
||||
stats_object_edit(scene->obedit, &stats);
|
||||
stats_object_edit(ob, &stats);
|
||||
}
|
||||
else if (ob && (object_mode & OB_MODE_POSE)) {
|
||||
/* Pose Mode */
|
||||
@@ -407,7 +408,7 @@ static void stats_update(Scene *scene, ViewLayer *view_layer, const eObjectMode
|
||||
*(view_layer->stats) = stats;
|
||||
}
|
||||
|
||||
static void stats_string(Scene *scene, ViewLayer *view_layer, const eObjectMode object_mode)
|
||||
static void stats_string(ViewLayer *view_layer, Object *obedit, const eObjectMode object_mode)
|
||||
{
|
||||
#define MAX_INFO_MEM_LEN 64
|
||||
SceneStats *stats = view_layer->stats;
|
||||
@@ -473,17 +474,17 @@ static void stats_string(Scene *scene, ViewLayer *view_layer, const eObjectMode
|
||||
|
||||
ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", versionstr);
|
||||
|
||||
if (scene->obedit) {
|
||||
if (BKE_keyblock_from_object(scene->obedit))
|
||||
if (obedit) {
|
||||
if (BKE_keyblock_from_object(obedit))
|
||||
ofs += BLI_strncpy_rlen(s + ofs, IFACE_("(Key) "), MAX_INFO_LEN - ofs);
|
||||
|
||||
if (scene->obedit->type == OB_MESH) {
|
||||
if (obedit->type == OB_MESH) {
|
||||
ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs,
|
||||
IFACE_("Verts:%s/%s | Edges:%s/%s | Faces:%s/%s | Tris:%s"),
|
||||
stats_fmt.totvertsel, stats_fmt.totvert, stats_fmt.totedgesel, stats_fmt.totedge,
|
||||
stats_fmt.totfacesel, stats_fmt.totface, stats_fmt.tottri);
|
||||
}
|
||||
else if (scene->obedit->type == OB_ARMATURE) {
|
||||
else if (obedit->type == OB_ARMATURE) {
|
||||
ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, IFACE_("Verts:%s/%s | Bones:%s/%s"), stats_fmt.totvertsel,
|
||||
stats_fmt.totvert, stats_fmt.totbonesel, stats_fmt.totbone);
|
||||
}
|
||||
@@ -527,12 +528,16 @@ void ED_info_stats_clear(ViewLayer *view_layer)
|
||||
}
|
||||
}
|
||||
|
||||
const char *ED_info_stats_string(Scene *scene, WorkSpace *workspace, ViewLayer *view_layer)
|
||||
const char *ED_info_stats_string(Scene *UNUSED(scene), WorkSpace *workspace, ViewLayer *view_layer)
|
||||
{
|
||||
Object *obact = (view_layer->basact) ? view_layer->basact->object : NULL;
|
||||
Object *obedit = (obact && (workspace->object_mode & OB_MODE_EDIT) &&
|
||||
BKE_object_is_in_editmode(obact)) ? obact : NULL;
|
||||
|
||||
if (!view_layer->stats) {
|
||||
stats_update(scene, view_layer, workspace->object_mode);
|
||||
stats_update(view_layer, obedit, workspace->object_mode);
|
||||
}
|
||||
stats_string(scene, view_layer, workspace->object_mode);
|
||||
stats_string(view_layer, obedit, workspace->object_mode);
|
||||
|
||||
return view_layer->stats->infostr;
|
||||
}
|
||||
|
@@ -915,10 +915,10 @@ static void view3d_main_region_listener(
|
||||
case ND_SELECT:
|
||||
{
|
||||
WM_manipulatormap_tag_refresh(mmap);
|
||||
if (scene->obedit) {
|
||||
Object *ob = scene->obedit;
|
||||
Object *obedit = OBEDIT_FROM_WINDOW(wmn->window);
|
||||
if (obedit) {
|
||||
/* TODO(sergey): Notifiers shouldn't really be doing DEG tags. */
|
||||
DEG_id_tag_update((ID *)ob->data, DEG_TAG_SELECT_UPDATE);
|
||||
DEG_id_tag_update((ID *)obedit->data, DEG_TAG_SELECT_UPDATE);
|
||||
}
|
||||
ATTR_FALLTHROUGH;
|
||||
}
|
||||
|
@@ -1614,7 +1614,7 @@ static void view3d_draw_objects(
|
||||
/* draw selected and editmode */
|
||||
for (base = view_layer->object_bases.first; base; base = base->next) {
|
||||
if ((base->flag & BASE_VISIBLED) != 0) {
|
||||
if ((base->object == scene->obedit) || (base->flag & BASE_SELECTED)) {
|
||||
if (base->object == obedit || (base->flag & BASE_SELECTED)) {
|
||||
draw_object(eval_ctx, scene, view_layer, ar, v3d, base, 0);
|
||||
}
|
||||
}
|
||||
|
@@ -1069,7 +1069,7 @@ static void manipulator_prepare_mat(
|
||||
bGPdata *gpd = CTX_data_gpencil_data(C);
|
||||
Object *ob = OBACT(view_layer);
|
||||
|
||||
if (((v3d->around == V3D_AROUND_ACTIVE) && (scene->obedit == NULL)) &&
|
||||
if (((v3d->around == V3D_AROUND_ACTIVE) && ((workspace->object_mode & OB_MODE_EDIT) == 0)) &&
|
||||
((gpd == NULL) || !(gpd->flag & GP_DATA_STROKE_EDITMODE)) &&
|
||||
(!(workspace->object_mode & OB_MODE_POSE)))
|
||||
{
|
||||
|
@@ -822,7 +822,7 @@ static bool raycastObjects(
|
||||
Object **r_ob, float r_obmat[4][4],
|
||||
ListBase *r_hit_list)
|
||||
{
|
||||
Object *obedit = use_object_edit_cage ? sctx->scene->obedit : NULL;
|
||||
Object *obedit = use_object_edit_cage ? OBEDIT_FROM_EVAL_CTX(&sctx->eval_ctx) : NULL;
|
||||
|
||||
struct RaycastObjUserData data = {
|
||||
.ray_start = ray_start,
|
||||
@@ -2060,7 +2060,7 @@ static bool snapObjectsRay(
|
||||
float r_loc[3], float r_no[3],
|
||||
Object **r_ob, float r_obmat[4][4])
|
||||
{
|
||||
Object *obedit = use_object_edit_cage ? sctx->scene->obedit : NULL;
|
||||
Object *obedit = use_object_edit_cage ? OBEDIT_FROM_EVAL_CTX(&sctx->eval_ctx) : NULL;
|
||||
|
||||
struct SnapObjUserData data = {
|
||||
.snapdata = snapdata,
|
||||
|
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
@@ -109,7 +110,6 @@ void ED_editors_init(bContext *C)
|
||||
void ED_editors_exit(bContext *C)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *sce;
|
||||
|
||||
if (!bmain)
|
||||
return;
|
||||
@@ -117,23 +117,20 @@ void ED_editors_exit(bContext *C)
|
||||
/* frees all editmode undos */
|
||||
undo_editmode_clear();
|
||||
ED_undo_paint_free();
|
||||
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
if (sce->obedit) {
|
||||
Object *ob = sce->obedit;
|
||||
|
||||
if (ob) {
|
||||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
if (me->edit_btmesh) {
|
||||
EDBM_mesh_free(me->edit_btmesh);
|
||||
MEM_freeN(me->edit_btmesh);
|
||||
me->edit_btmesh = NULL;
|
||||
}
|
||||
}
|
||||
else if (ob->type == OB_ARMATURE) {
|
||||
ED_armature_edit_free(ob->data);
|
||||
}
|
||||
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = ob->data;
|
||||
if (me->edit_btmesh) {
|
||||
EDBM_mesh_free(me->edit_btmesh);
|
||||
MEM_freeN(me->edit_btmesh);
|
||||
me->edit_btmesh = NULL;
|
||||
}
|
||||
}
|
||||
else if (ob->type == OB_ARMATURE) {
|
||||
bArmature *arm = ob->data;
|
||||
if (arm->edbo) {
|
||||
ED_armature_edit_free(ob->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1623,7 +1623,8 @@ typedef struct Scene {
|
||||
|
||||
ListBase base DNA_DEPRECATED;
|
||||
struct Base *basact DNA_DEPRECATED; /* active base */
|
||||
struct Object *obedit; /* name replaces old G.obedit */
|
||||
|
||||
struct Editing *ed; /* sequence editor data is allocated here */
|
||||
|
||||
float cursor[3]; /* 3d cursor location */
|
||||
char _pad[4];
|
||||
@@ -1639,10 +1640,7 @@ typedef struct Scene {
|
||||
|
||||
struct bNodeTree *nodetree;
|
||||
|
||||
struct Editing *ed; /* sequence editor data is allocated here */
|
||||
|
||||
struct ToolSettings *toolsettings; /* default allocated now */
|
||||
void *pad2;
|
||||
struct DisplaySafeAreas safe_areas;
|
||||
|
||||
/* migrate or replace? depends on some internal things... */
|
||||
@@ -1944,9 +1942,14 @@ extern const char *RE_engine_id_CYCLES;
|
||||
#define BASACT(_view_layer) ((_view_layer)->basact)
|
||||
#define OBACT(_view_layer) (BASACT(_view_layer) ? BASACT(_view_layer)->object: NULL)
|
||||
|
||||
#define OBEDIT_FROM_WORKSPACE(workspace, _view_layer) \
|
||||
(((workspace)->object_mode & OD_MODE_EDIT) ? OBACT(_view_layer) : NULL)
|
||||
#define OBEDIT_FROM_EVAL_CTX(eval_ctx) \
|
||||
(((eval_ctx)->object_mode & OB_MODE_EDIT) ? OBACT((eval_ctx)->view_layer) : NULL)
|
||||
|
||||
#define OBEDIT_FROM_WINDOW(window) \
|
||||
BKE_workspace_edit_object(WM_window_get_active_workspace(window), WM_window_get_active_scene(window))
|
||||
|
||||
#define V3D_CAMERA_LOCAL(v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : NULL)
|
||||
#define V3D_CAMERA_SCENE(scene, v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : (scene)->camera)
|
||||
|
||||
|
@@ -847,7 +847,10 @@ static void rna_LayerObjects_active_object_update(struct bContext *C, PointerRNA
|
||||
}
|
||||
|
||||
ViewLayer *view_layer = (ViewLayer *)ptr->data;
|
||||
if (scene->obedit) {
|
||||
|
||||
/* OBMODE/TODO edit_object from _previous_ state needs to be freed! */
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
if (obedit) {
|
||||
ED_object_editmode_exit(C, EM_FREEDATA);
|
||||
}
|
||||
ED_object_base_activate(C, view_layer->basact);
|
||||
|
@@ -92,13 +92,15 @@ const EnumPropertyItem rna_enum_ramp_blend_items[] = {
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
|
||||
#include "ED_node.h"
|
||||
#include "ED_image.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
static void rna_Material_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
||||
{
|
||||
@@ -201,6 +203,11 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
|
||||
if (ma->texpaintslot) {
|
||||
Image *image = ma->texpaintslot[ma->paint_active_slot].ima;
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
wmWindow *win = ED_screen_window_find(sc, bmain->wm.first);
|
||||
if (win == NULL) {
|
||||
continue;
|
||||
}
|
||||
Object *obedit = OBEDIT_FROM_WINDOW(win);
|
||||
ScrArea *sa;
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl;
|
||||
@@ -209,7 +216,7 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
|
||||
SpaceImage *sima = (SpaceImage *)sl;
|
||||
|
||||
if (!sima->pin)
|
||||
ED_space_image_set(sima, scene, scene->obedit, image);
|
||||
ED_space_image_set(sima, scene, obedit, image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -295,11 +295,11 @@ void rna_Object_internal_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene),
|
||||
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
|
||||
}
|
||||
|
||||
static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
static void rna_Object_active_shape_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
Object *ob = ptr->id.data;
|
||||
|
||||
if (scene->obedit == ob) {
|
||||
if (CTX_data_edit_object(C) == ob) {
|
||||
/* exit/enter editmode to get new shape */
|
||||
switch (ob->type) {
|
||||
case OB_MESH:
|
||||
@@ -3018,6 +3018,7 @@ static void rna_def_object(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "shapenr");
|
||||
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
|
||||
RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set",
|
||||
"rna_Object_active_shape_key_index_range");
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_workspace_types.h"
|
||||
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_material.h"
|
||||
@@ -107,6 +108,7 @@ const EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_pbvh.h"
|
||||
#include "BKE_object.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
@@ -391,10 +393,12 @@ static void rna_ImaPaint_stencil_update(bContext *C, PointerRNA *UNUSED(ptr))
|
||||
|
||||
static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
const WorkSpace *workspace = CTX_wm_workspace(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
Object *ob = OBACT(view_layer);
|
||||
Object *obedit = ((workspace->object_mode & OB_MODE_EDIT) && BKE_object_is_in_editmode(ob)) ? ob : NULL;
|
||||
bScreen *sc;
|
||||
Image *ima = scene->toolsettings->imapaint.canvas;
|
||||
|
||||
@@ -407,7 +411,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
|
||||
SpaceImage *sima = (SpaceImage *)slink;
|
||||
|
||||
if (!sima->pin)
|
||||
ED_space_image_set(sima, scene, scene->obedit, ima);
|
||||
ED_space_image_set(sima, scene, obedit, ima);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -857,9 +857,10 @@ static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr)
|
||||
{
|
||||
SpaceImage *sima = (SpaceImage *)(ptr->data);
|
||||
bScreen *sc = (bScreen *)ptr->id.data;
|
||||
Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
|
||||
wmWindow *win = ED_screen_window_find(sc, G.main->wm.first);
|
||||
Object *obedit = OBEDIT_FROM_WINDOW(win);
|
||||
|
||||
return ED_space_image_show_uvedit(sima, scene->obedit);
|
||||
return ED_space_image_show_uvedit(sima, obedit);
|
||||
}
|
||||
|
||||
static int rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr)
|
||||
@@ -877,9 +878,10 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
|
||||
{
|
||||
SpaceImage *sima = (SpaceImage *)(ptr->data);
|
||||
bScreen *sc = (bScreen *)ptr->id.data;
|
||||
Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
|
||||
|
||||
ED_space_image_set(sima, scene, scene->obedit, (Image *)value.data);
|
||||
wmWindow *win;
|
||||
Scene *scene = ED_screen_scene_find_with_window(sc, G.main->wm.first, &win);
|
||||
Object *obedit = OBEDIT_FROM_WINDOW(win);
|
||||
ED_space_image_set(sima, scene, obedit, (Image *)value.data);
|
||||
}
|
||||
|
||||
static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value)
|
||||
|
@@ -785,9 +785,10 @@ static void rna_Window_view_layer_update(struct bContext *C, PointerRNA *ptr)
|
||||
Scene *scene = WM_window_get_active_scene(win);
|
||||
WorkSpace *workspace = WM_window_get_active_workspace(win);
|
||||
ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
|
||||
eObjectMode object_mode = workspace->object_mode;
|
||||
if (scene->obedit) {
|
||||
if (obedit) {
|
||||
ED_object_editmode_exit(C, EM_FREEDATA);
|
||||
}
|
||||
workspace->object_mode = object_mode;
|
||||
|
@@ -49,6 +49,8 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "MOD_util.h"
|
||||
|
||||
#ifdef __SSE2__
|
||||
@@ -300,7 +302,7 @@ static void meshdeformModifier_do(
|
||||
*
|
||||
* We'll support this case once granular dependency graph is landed.
|
||||
*/
|
||||
if (mmd->object == md->scene->obedit) {
|
||||
if (mmd->object == OBEDIT_FROM_EVAL_CTX(eval_ctx)) {
|
||||
BMEditMesh *em = BKE_editmesh_from_object(mmd->object);
|
||||
tmpdm = editbmesh_get_derived_cage_and_final(eval_ctx, md->scene, mmd->object, em, 0, &cagedm);
|
||||
if (tmpdm)
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#include "BKE_library_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_util.h"
|
||||
@@ -1097,7 +1099,9 @@ static void deformVert(
|
||||
}
|
||||
}
|
||||
|
||||
static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], unsigned int numverts, Object *ob)
|
||||
static void surfacedeformModifier_do(
|
||||
ModifierData *md, const EvaluationContext *eval_ctx,
|
||||
float (*vertexCos)[3], unsigned int numverts, Object *ob)
|
||||
{
|
||||
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
|
||||
DerivedMesh *tdm;
|
||||
@@ -1110,7 +1114,7 @@ static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], un
|
||||
}
|
||||
|
||||
/* Handle target mesh both in and out of edit mode */
|
||||
if (smd->target == md->scene->obedit) {
|
||||
if (smd->target == OBEDIT_FROM_EVAL_CTX(eval_ctx)) {
|
||||
BMEditMesh *em = BKE_editmesh_from_object(smd->target);
|
||||
tdm = em->derivedFinal;
|
||||
}
|
||||
@@ -1180,20 +1184,22 @@ static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], un
|
||||
}
|
||||
}
|
||||
|
||||
static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
|
||||
Object *ob, DerivedMesh *UNUSED(derivedData),
|
||||
float (*vertexCos)[3], int numVerts,
|
||||
ModifierApplyFlag UNUSED(flag))
|
||||
static void deformVerts(
|
||||
ModifierData *md, const struct EvaluationContext *eval_ctx,
|
||||
Object *ob, DerivedMesh *UNUSED(derivedData),
|
||||
float (*vertexCos)[3], int numVerts,
|
||||
ModifierApplyFlag UNUSED(flag))
|
||||
{
|
||||
surfacedeformModifier_do(md, vertexCos, numVerts, ob);
|
||||
surfacedeformModifier_do(md, eval_ctx, vertexCos, numVerts, ob);
|
||||
}
|
||||
|
||||
static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
|
||||
Object *ob, struct BMEditMesh *UNUSED(editData),
|
||||
DerivedMesh *UNUSED(derivedData),
|
||||
float (*vertexCos)[3], int numVerts)
|
||||
static void deformVertsEM(
|
||||
ModifierData *md, const struct EvaluationContext *eval_ctx,
|
||||
Object *ob, struct BMEditMesh *UNUSED(editData),
|
||||
DerivedMesh *UNUSED(derivedData),
|
||||
float (*vertexCos)[3], int numVerts)
|
||||
{
|
||||
surfacedeformModifier_do(md, vertexCos, numVerts, ob);
|
||||
surfacedeformModifier_do(md, eval_ctx, vertexCos, numVerts, ob);
|
||||
}
|
||||
|
||||
static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
||||
|
@@ -1688,6 +1688,7 @@ struct parentChildLink {
|
||||
SG_Node* m_gamechildnode;
|
||||
};
|
||||
|
||||
#if 0
|
||||
static bPoseChannel *get_active_posechannel2(Object *ob)
|
||||
{
|
||||
bArmature *arm= (bArmature*)ob->data;
|
||||
@@ -1701,6 +1702,7 @@ static bPoseChannel *get_active_posechannel2(Object *ob)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ListBase *get_active_constraints2(Object *ob)
|
||||
{
|
||||
|
Reference in New Issue
Block a user