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:
authorYimingWu <xp8110@outlook.com>2019-06-17 09:58:39 +0300
committerYimingWu <xp8110@outlook.com>2019-06-17 09:58:39 +0300
commit915a928067a89923fab144ca4a7ca2e75337a5e8 (patch)
treec0c1dae1f4f39c1e2a5d451f2c8e9fc5cd726319 /source/blender/editors
parentfe71389950aa611aac12cc88bdc965363dbcdc7d (diff)
parent5364e62b0535cdadbd1db27dc1633cfd253a49ef (diff)
Merge branch 'master' into soc-2019-npr
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/animation/anim_motion_paths.c20
-rw-r--r--source/blender/editors/armature/pose_transform.c2
-rw-r--r--source/blender/editors/gpencil/annotate_draw.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c24
-rw-r--r--source/blender/editors/include/ED_mesh.h16
-rw-r--r--source/blender/editors/include/ED_view3d.h19
-rw-r--r--source/blender/editors/include/UI_icons.h2
-rw-r--r--source/blender/editors/interface/interface.c4
-rw-r--r--source/blender/editors/interface/interface_context_menu.c2
-rw-r--r--source/blender/editors/interface/interface_layout.c4
-rw-r--r--source/blender/editors/interface/interface_ops.c38
-rw-r--r--source/blender/editors/interface/interface_templates.c45
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt1
-rw-r--r--source/blender/editors/mesh/editmesh_select.c207
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c11
-rw-r--r--source/blender/editors/mesh/mesh_mirror.c2
-rw-r--r--source/blender/editors/object/object_constraint.c6
-rw-r--r--source/blender/editors/object/object_edit.c1
-rw-r--r--source/blender/editors/object/object_gpencil_modifier.c8
-rw-r--r--source/blender/editors/object/object_intern.h2
-rw-r--r--source/blender/editors/object/object_modifier.c6
-rw-r--r--source/blender/editors/object/object_ops.c2
-rw-r--r--source/blender/editors/object/object_relations.c52
-rw-r--r--source/blender/editors/object/object_shader_fx.c6
-rw-r--r--source/blender/editors/object/object_vgroup.c30
-rw-r--r--source/blender/editors/physics/particle_edit.c108
-rw-r--r--source/blender/editors/physics/particle_object.c23
-rw-r--r--source/blender/editors/render/render_opengl.c1
-rw-r--r--source/blender/editors/screen/screen_context.c48
-rw-r--r--source/blender/editors/screen/workspace_edit.c3
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h2
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c2
-rw-r--r--source/blender/editors/space_file/file_draw.c9
-rw-r--r--source/blender/editors/space_file/filesel.c6
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c84
-rw-r--r--source/blender/editors/space_graph/graph_edit.c52
-rw-r--r--source/blender/editors/space_graph/graph_intern.h1
-rw-r--r--source/blender/editors/space_graph/graph_utils.c10
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c34
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c36
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c5
-rw-r--r--source/blender/editors/space_view3d/drawobject.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h3
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c233
-rw-r--r--source/blender/editors/transform/transform.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c22
50 files changed, 670 insertions, 549 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 718e85c0e27..8d30076103b 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -113,7 +113,7 @@ static void animedit_get_yscale_factor(bAnimContext *ac)
*/
ac->yscale_fac = btheme->space_action.keyframe_scale_fac;
- /* clamp to avoid problems with uninitialised values... */
+ /* clamp to avoid problems with uninitialized values... */
if (ac->yscale_fac < 0.1f) {
ac->yscale_fac = 1.0f;
}
diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c
index e3c4e2a8cfb..d3c6109afcd 100644
--- a/source/blender/editors/animation/anim_motion_paths.c
+++ b/source/blender/editors/animation/anim_motion_paths.c
@@ -250,8 +250,20 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
/* get copies of objects/bones to get the calculated results from
* (for copy-on-write evaluation), so that we actually get some results
*/
- // TODO: Create a copy of background depsgraph that only contain these entities,
- // and only evaluates them.
+
+ /* TODO: Create a copy of background depsgraph that only contain these entities,
+ * and only evaluates them.
+ *
+ * For until that is done we force dependency graph to not be active, so we don't loose unkeyed
+ * changes during updating the motion path.
+ * This still doesn't include unkeyed changes to the path itself, but allows to have updates in
+ * an environment when auto-keying and pose paste is used. */
+
+ const bool is_active_depsgraph = DEG_is_active(depsgraph);
+ if (is_active_depsgraph) {
+ DEG_make_inactive(depsgraph);
+ }
+
for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) {
mpt->ob_eval = DEG_get_evaluated_object(depsgraph, mpt->ob);
@@ -317,6 +329,10 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
motionpaths_calc_update_scene(bmain, depsgraph);
}
+ if (is_active_depsgraph) {
+ DEG_make_active(depsgraph);
+ }
+
/* clear recalc flags from targets */
for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) {
bAnimVizSettings *avs;
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index 365414b4884..325e6eaee2a 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -694,7 +694,9 @@ static int pose_copy_exec(bContext *C, wmOperator *op)
*/
Main *temp_bmain = BKE_main_new();
Object ob_copy = *ob;
+ ob_copy.adt = NULL;
bArmature arm_copy = *((bArmature *)ob->data);
+ arm_copy.adt = NULL;
ob_copy.data = &arm_copy;
BLI_addtail(&temp_bmain->objects, &ob_copy);
BLI_addtail(&temp_bmain->armatures, &arm_copy);
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index a853e2bcc9a..e8f97290173 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -667,7 +667,7 @@ static void annotation_draw_strokes_edit(bGPdata *gpd,
continue;
}
- /* Optimisation: only draw points for selected strokes
+ /* Optimization: only draw points for selected strokes
* We assume that selected points can only occur in
* strokes that are selected too.
*/
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index df27198922c..d914cdea442 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -446,7 +446,7 @@ static void get_pixel(const ImBuf *ibuf, const int idx, float r_col[4])
}
else {
/* XXX: This case probably doesn't happen, as we only write to the float buffer,
- * but we get compiler warnings about uninitialised vars otherwise
+ * but we get compiler warnings about uninitialized vars otherwise
*/
BLI_assert(!"gpencil_fill.c - get_pixel() non-float case is used!");
zero_v4(r_col);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 041704d8473..c5e91bd2cab 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2392,6 +2392,10 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
WM_cursor_modal_restore(CTX_wm_window(C));
}
else {
+ /* or restore paint if 3D view */
+ if ((p) && (p->paintmode == GP_PAINTMODE_ERASER)) {
+ WM_cursor_modal_set(p->win, CURSOR_STD);
+ }
/* drawing batch cache is dirty now */
bGPdata *gpd = CTX_data_gpencil_data(C);
@@ -2405,6 +2409,8 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
gpencil_undo_finish();
/* cleanup */
+ WM_cursor_modal_set(p->win, CURSOR_STD);
+
gp_paint_cleanup(p);
gp_session_cleanup(p);
ED_gpencil_toggle_brush_cursor(C, true, NULL);
@@ -2469,6 +2475,18 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event)
/* ------------------------------- */
+/* ensure that the correct cursor icon is set */
+static void gpencil_draw_cursor_set(tGPsdata *p)
+{
+ Brush *brush = p->brush;
+ if ((p->paintmode == GP_PAINTMODE_ERASER) || (brush->gpencil_tool == GPAINT_TOOL_ERASE)) {
+ WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */
+ }
+ else {
+ WM_cursor_modal_set(p->win, CURSOR_NONE);
+ }
+}
+
/* update UI indicators of status, including cursor and header prints */
static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p)
{
@@ -3183,6 +3201,11 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
else {
ED_gpencil_toggle_brush_cursor(C, true, NULL);
}
+ /* set cursor
+ * NOTE: This may change later (i.e. intentionally via brush toggle,
+ * or unintentionally if the user scrolls outside the area)...
+ */
+ gpencil_draw_cursor_set(p);
/* only start drawing immediately if we're allowed to do so... */
if (RNA_boolean_get(op->ptr, "wait_for_input") == false) {
@@ -3749,6 +3772,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
else {
/* update status indicators - cursor, header, etc. */
gpencil_draw_status_indicators(C, p);
+ gpencil_draw_cursor_set(p); /* cursor may have changed outside our control - T44084 */
}
/* process last operations before exiting */
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 0a8304f3f8a..5d8038d0b28 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -142,22 +142,6 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
void ED_mesh_undosys_type(struct UndoType *ut);
/* editmesh_select.c */
-struct EDBMSelectID_Context;
-struct EDBMSelectID_Context *EDBM_select_id_context_create(struct ViewContext *vc,
- struct Base **bases,
- const uint bases_len,
- short select_mode);
-void EDBM_select_id_context_destroy(struct EDBMSelectID_Context *sel_id_ctx);
-struct BMElem *EDBM_select_id_bm_elem_get(struct EDBMSelectID_Context *sel_id_ctx,
- const uint sel_id,
- uint *r_base_index);
-
-uint EDBM_select_id_context_offset_for_object_elem(const struct EDBMSelectID_Context *sel_id_ctx,
- int base_index,
- char htype);
-
-uint EDBM_select_id_context_elem_len(const struct EDBMSelectID_Context *sel_id_ctx);
-
void EDBM_select_mirrored(
struct BMEditMesh *em, const int axis, const bool extend, int *r_totmirr, int *r_totfail);
void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update, const char hflag);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 5ce9133a531..21a18a0b387 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -512,6 +512,23 @@ int view3d_opengl_select(struct ViewContext *vc,
eV3DSelectObjectFilter select_filter);
/* view3d_select.c */
+struct EDSelectID_Context;
+struct EDSelectID_Context *ED_view3d_select_id_context_create(struct ViewContext *vc,
+ struct Base **bases,
+ const uint bases_len,
+ short select_mode);
+
+void ED_view3d_select_id_context_destroy(struct EDSelectID_Context *sel_id_ctx);
+uint ED_view3d_select_id_context_offset_for_object_elem(
+ const struct EDSelectID_Context *sel_id_ctx, int base_index, char elem_type);
+
+uint ED_view3d_select_id_context_elem_len(const struct EDSelectID_Context *sel_id_ctx);
+bool ED_view3d_select_id_elem_get(struct EDSelectID_Context *sel_id_ctx,
+ const uint sel_id,
+ uint *r_elem,
+ uint *r_base_index,
+ char *r_elem_type);
+
float ED_view3d_select_dist_px(void);
void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc);
void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact);
@@ -701,7 +718,7 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr
#define XRAY_ALPHA(v3d) \
(((v3d)->shading.type == OB_WIRE) ? (v3d)->shading.xray_alpha_wire : (v3d)->shading.xray_alpha)
#define XRAY_FLAG(v3d) \
- (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY)
+ (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_WIREFRAME : V3D_SHADING_XRAY)
#define XRAY_FLAG_ENABLED(v3d) (((v3d)->shading.flag & XRAY_FLAG(v3d)) != 0)
#define XRAY_ENABLED(v3d) (XRAY_FLAG_ENABLED(v3d) && (XRAY_ALPHA(v3d) < 1.0f))
#define XRAY_ACTIVE(v3d) (XRAY_ENABLED(v3d) && ((v3d)->shading.type < OB_MATERIAL))
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index f9e9e342ee5..340b0f70987 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -338,7 +338,7 @@ DEF_ICON_OBJECT_DATA(OUTLINER_DATA_FONT)
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_SURFACE)
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_SPEAKER)
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_LIGHTPROBE)
-DEF_ICON_BLANK(345)
+DEF_ICON_OBJECT_DATA(OUTLINER_DATA_GP_LAYER)
DEF_ICON_OBJECT_DATA(OUTLINER_DATA_GREASEPENCIL)
DEF_ICON(GP_SELECT_POINTS)
DEF_ICON(GP_SELECT_STROKES)
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 2154ac4a7f6..32e70f173f4 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1378,7 +1378,7 @@ static bool ui_but_event_property_operator_string(const bContext *C,
*
* but it's actually quite logical. It's designed to be 'upwards compatible'
* for muscle memory so that the menu item locations are fixed and don't move
- * as new items are added to the menu later on. It also optimises efficiency -
+ * as new items are added to the menu later on. It also optimizes efficiency -
* a radial menu is best kept symmetrical, with as large an angle between
* items as possible, so that the gestural mouse movements can be fast and inexact.
*
@@ -1462,7 +1462,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
void ui_but_override_flag(uiBut *but)
{
- const int override_status = RNA_property_static_override_status(
+ const int override_status = RNA_property_override_library_status(
&but->rnapoin, but->rnaprop, but->rnaindex);
if (override_status & RNA_OVERRIDE_STATUS_OVERRIDDEN) {
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index 71026e79f60..36e197a0591 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -524,7 +524,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
const bool is_array = RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0;
const bool is_array_component = (is_array && but->rnaindex != -1);
- const int override_status = RNA_property_static_override_status(ptr, prop, -1);
+ const int override_status = RNA_property_override_library_status(ptr, prop, -1);
const bool is_overridable = (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE) != 0;
/* Set the (button_pointer, button_prop)
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index d4d7af3a374..af992a89caa 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -278,9 +278,9 @@ static int ui_layout_vary_direction(uiLayout *layout)
static bool ui_layout_variable_size(uiLayout *layout)
{
- /* Note that this code is probably a bit flacky, we'd probably want to know whether it's
+ /* Note that this code is probably a bit flakey, we'd probably want to know whether it's
* variable in X and/or Y, etc. But for now it mimics previous one,
- * with addition of variable flag set for children of gridflow layouts. */
+ * with addition of variable flag set for children of grid-flow layouts. */
return ui_layout_vary_direction(layout) == UI_ITEM_VARY_X || layout->variable_size;
}
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 768cc32aeb5..aa7e7f97478 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -430,7 +430,7 @@ static bool override_type_set_button_poll(bContext *C)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- const int override_status = RNA_property_static_override_status(&ptr, prop, index);
+ const int override_status = RNA_property_override_library_status(&ptr, prop, index);
return (ptr.data && prop && (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE));
}
@@ -448,20 +448,20 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
switch (op_type) {
case UIOverride_Type_NOOP:
- operation = IDOVERRIDESTATIC_OP_NOOP;
+ operation = IDOVERRIDE_LIBRARY_OP_NOOP;
break;
case UIOverride_Type_Replace:
- operation = IDOVERRIDESTATIC_OP_REPLACE;
+ operation = IDOVERRIDE_LIBRARY_OP_REPLACE;
break;
case UIOverride_Type_Difference:
/* override code will automatically switch to subtract if needed. */
- operation = IDOVERRIDESTATIC_OP_ADD;
+ operation = IDOVERRIDE_LIBRARY_OP_ADD;
break;
case UIOverride_Type_Factor:
- operation = IDOVERRIDESTATIC_OP_MULTIPLY;
+ operation = IDOVERRIDE_LIBRARY_OP_MULTIPLY;
break;
default:
- operation = IDOVERRIDESTATIC_OP_REPLACE;
+ operation = IDOVERRIDE_LIBRARY_OP_REPLACE;
BLI_assert(0);
break;
}
@@ -475,7 +475,7 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
index = -1;
}
- IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_get(
+ IDOverrideLibraryPropertyOperation *opop = RNA_property_override_property_operation_get(
&ptr, prop, operation, index, true, NULL, &created);
if (!created) {
opop->operation = operation;
@@ -491,7 +491,7 @@ static int override_type_set_button_invoke(bContext *C,
#if 0 /* Disabled for now */
return WM_menu_invoke_ex(C, op, WM_OP_INVOKE_DEFAULT);
#else
- RNA_enum_set(op->ptr, "type", IDOVERRIDESTATIC_OP_REPLACE);
+ RNA_enum_set(op->ptr, "type", IDOVERRIDE_LIBRARY_OP_REPLACE);
return override_type_set_button_exec(C, op);
#endif
}
@@ -530,7 +530,7 @@ static bool override_remove_button_poll(bContext *C)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- const int override_status = RNA_property_static_override_status(&ptr, prop, index);
+ const int override_status = RNA_property_override_library_status(&ptr, prop, index);
return (ptr.data && ptr.id.data && prop && (override_status & RNA_OVERRIDE_STATUS_OVERRIDDEN));
}
@@ -547,16 +547,16 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
ID *id = ptr.id.data;
- IDOverrideStaticProperty *oprop = RNA_property_override_property_find(&ptr, prop);
+ IDOverrideLibraryProperty *oprop = RNA_property_override_property_find(&ptr, prop);
BLI_assert(oprop != NULL);
- BLI_assert(id != NULL && id->override_static != NULL);
+ BLI_assert(id != NULL && id->override_library != NULL);
- const bool is_template = (id->override_static->reference == NULL);
+ const bool is_template = (id->override_library->reference == NULL);
/* We need source (i.e. linked data) to restore values of deleted overrides...
* If this is an override template, we obviously do not need to restore anything. */
if (!is_template) {
- RNA_id_pointer_create(id->override_static->reference, &id_refptr);
+ RNA_id_pointer_create(id->override_library->reference, &id_refptr);
if (!RNA_path_resolve(&id_refptr, oprop->rna_path, &src, NULL)) {
BLI_assert(0 && "Failed to create matching source (linked data) RNA pointer");
}
@@ -566,7 +566,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
bool is_strict_find;
/* Remove override operation for given item,
* add singular operations for the other items as needed. */
- IDOverrideStaticPropertyOperation *opop = BKE_override_static_property_operation_find(
+ IDOverrideLibraryPropertyOperation *opop = BKE_override_library_property_operation_find(
oprop, NULL, NULL, index, index, false, &is_strict_find);
BLI_assert(opop != NULL);
if (!is_strict_find) {
@@ -575,22 +575,22 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
* before removing generic one. */
for (int idx = RNA_property_array_length(&ptr, prop); idx--;) {
if (idx != index) {
- BKE_override_static_property_operation_get(
+ BKE_override_library_property_operation_get(
oprop, opop->operation, NULL, NULL, idx, idx, true, NULL, NULL);
}
}
}
- BKE_override_static_property_operation_delete(oprop, opop);
+ BKE_override_library_property_operation_delete(oprop, opop);
if (!is_template) {
RNA_property_copy(bmain, &ptr, &src, prop, index);
}
if (BLI_listbase_is_empty(&oprop->operations)) {
- BKE_override_static_property_delete(id->override_static, oprop);
+ BKE_override_library_property_delete(id->override_library, oprop);
}
}
else {
/* Just remove whole generic override operation of this property. */
- BKE_override_static_property_delete(id->override_static, oprop);
+ BKE_override_library_property_delete(id->override_library, oprop);
if (!is_template) {
RNA_property_copy(bmain, &ptr, &src, prop, -1);
}
@@ -1504,7 +1504,7 @@ static void UI_OT_reloadtranslation(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Prese Button Operator
+/** \name Press Button Operator
* \{ */
static ARegion *region_event_inside_for_screen(bContext *C, const int xy[2])
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 4efa024ac77..5d3ef5c625e 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -515,8 +515,8 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
case UI_ID_LOCAL:
if (id) {
Main *bmain = CTX_data_main(C);
- if (BKE_override_static_is_enabled() && CTX_wm_window(C)->eventstate->shift) {
- ID *override_id = BKE_override_static_create_from_id(bmain, id);
+ if (BKE_override_library_is_enabled() && CTX_wm_window(C)->eventstate->shift) {
+ ID *override_id = BKE_override_library_create_from_id(bmain, id);
if (override_id != NULL) {
BKE_main_id_clear_newpoins(bmain);
@@ -537,8 +537,8 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
}
break;
case UI_ID_OVERRIDE:
- if (id && id->override_static) {
- BKE_override_static_free(&id->override_static);
+ if (id && id->override_library) {
+ BKE_override_library_free(&id->override_library);
/* reassign to get get proper updates/notifiers */
idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop);
RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, NULL);
@@ -856,9 +856,9 @@ static void template_ID(bContext *C,
0,
0,
0,
- BKE_override_static_is_enabled() ?
+ BKE_override_library_is_enabled() ?
TIP_("Direct linked library data-block, click to make local, "
- "Shift + Click to create a static override") :
+ "Shift + Click to create a library override") :
TIP_("Direct linked library data-block, click to make local"));
if (disabled) {
UI_but_flag_enable(but, UI_BUT_DISABLED);
@@ -869,22 +869,21 @@ static void template_ID(bContext *C,
}
}
}
- else if (ID_IS_STATIC_OVERRIDE(id)) {
- but = uiDefIconBut(
- block,
- UI_BTYPE_BUT,
- 0,
- ICON_LIBRARY_DATA_OVERRIDE,
- 0,
- 0,
- UI_UNIT_X,
- UI_UNIT_Y,
- NULL,
- 0,
- 0,
- 0,
- 0,
- TIP_("Static override of linked library data-block, click to make fully local"));
+ else if (ID_IS_OVERRIDE_LIBRARY(id)) {
+ but = uiDefIconBut(block,
+ UI_BTYPE_BUT,
+ 0,
+ ICON_LIBRARY_DATA_OVERRIDE,
+ 0,
+ 0,
+ UI_UNIT_X,
+ UI_UNIT_Y,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0,
+ TIP_("Library override of linked data-block, click to make fully local"));
UI_but_funcN_set(
but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_OVERRIDE));
}
@@ -6451,7 +6450,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
flow = uiLayoutColumnFlow(layout, 2, false);
- RNA_STRUCT_BEGIN (ptr, prop) {
+ RNA_STRUCT_BEGIN_SKIP_RNA_TYPE (ptr, prop) {
const bool is_set = RNA_property_is_set(ptr, prop);
uiBut *but;
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index 9a779db4812..57bf67e825e 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -23,7 +23,6 @@ set(INC
../../blentranslation
../../bmesh
../../depsgraph
- ../../draw
../../gpu
../../imbuf
../../makesdna
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 75d685fb9c6..7b770f055b4 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -68,8 +68,6 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-#include "DRW_engine.h"
-
#include "mesh_intern.h" /* own include */
/* use bmesh operator flags for a few operators */
@@ -199,177 +197,34 @@ void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag)
/** \name Back-Buffer OpenGL Selection
* \{ */
-struct EDBMBaseOffset {
- /* For convenience only. */
- union {
- uint offset;
- uint face_start;
- };
- union {
- uint face;
- uint edge_start;
- };
- union {
- uint edge;
- uint vert_start;
- };
- uint vert;
-};
-
-struct EDBMSelectID_Context {
- struct EDBMBaseOffset *base_array_index_offsets;
- /** Borrow from caller (not freed). */
- struct Base **bases;
- uint bases_len;
- /** Total number of items `base_array_index_offsets[bases_len - 1].vert`. */
- uint base_array_index_len;
-};
-
-static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt)
+static BMElem *EDBM_select_id_bm_elem_get(struct EDSelectID_Context *sel_id_ctx,
+ Base **bases,
+ const uint sel_id,
+ uint *r_base_index)
{
- if (select_mode & SCE_SELECT_FACE) {
- if ((dt < OB_SOLID) || XRAY_FLAG_ENABLED(v3d)) {
- return true;
- }
- if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) {
- return true;
- }
- if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGES) == 0) {
- /* Since we can't deduce face selection when edges aren't visible - show dots. */
- return true;
- }
- }
- return false;
-}
-
-static void edbm_select_pick_draw_bases(struct EDBMSelectID_Context *sel_id_ctx,
- ViewContext *vc,
- short select_mode)
-{
- Scene *scene_eval = (Scene *)DEG_get_evaluated_id(vc->depsgraph, &vc->scene->id);
- DRW_framebuffer_select_id_setup(vc->ar, true);
-
- uint offset = 1;
- for (uint base_index = 0; base_index < sel_id_ctx->bases_len; base_index++) {
- Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph,
- sel_id_ctx->bases[base_index]->object);
-
- struct EDBMBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
- bool draw_facedot = check_ob_drawface_dot(select_mode, vc->v3d, ob_eval->dt);
-
- DRW_draw_select_id_object(scene_eval,
- vc->rv3d,
- ob_eval,
- select_mode,
- draw_facedot,
- offset,
- &base_ofs->vert,
- &base_ofs->edge,
- &base_ofs->face);
-
- base_ofs->offset = offset;
- offset = base_ofs->vert;
- }
-
- sel_id_ctx->base_array_index_len = offset;
-
- DRW_framebuffer_select_id_release(vc->ar);
-}
-
-BMElem *EDBM_select_id_bm_elem_get(struct EDBMSelectID_Context *sel_id_ctx,
- const uint sel_id,
- uint *r_base_index)
-{
- char elem_type = 0;
uint elem_id;
- uint base_index = 0;
- for (; base_index < sel_id_ctx->bases_len; base_index++) {
- struct EDBMBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
- if (base_ofs->face > sel_id) {
- elem_id = sel_id - base_ofs->face_start;
- elem_type = BM_FACE;
- break;
- }
- if (base_ofs->edge > sel_id) {
- elem_id = sel_id - base_ofs->edge_start;
- elem_type = BM_EDGE;
- break;
- }
- if (base_ofs->vert > sel_id) {
- elem_id = sel_id - base_ofs->vert_start;
- elem_type = BM_VERT;
- break;
- }
- }
-
- if (base_index >= sel_id_ctx->bases_len) {
- BLI_assert(0);
- return NULL;
- }
-
- if (r_base_index) {
- *r_base_index = base_index;
- }
-
- Object *obedit = sel_id_ctx->bases[base_index]->object;
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ char elem_type = 0;
+ bool success = ED_view3d_select_id_elem_get(
+ sel_id_ctx, sel_id, &elem_id, r_base_index, &elem_type);
- switch (elem_type) {
- case BM_FACE:
- return (BMElem *)BM_face_at_index_find_or_table(em->bm, elem_id);
- case BM_EDGE:
- return (BMElem *)BM_edge_at_index_find_or_table(em->bm, elem_id);
- case BM_VERT:
- return (BMElem *)BM_vert_at_index_find_or_table(em->bm, elem_id);
- default:
- BLI_assert(0);
- return NULL;
- }
-}
+ if (success) {
+ Object *obedit = bases[*r_base_index]->object;
+ BMEditMesh *em = BKE_editmesh_from_object(obedit);
-uint EDBM_select_id_context_offset_for_object_elem(const struct EDBMSelectID_Context *sel_id_ctx,
- int base_index,
- char htype)
-{
- struct EDBMBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
- if (htype == BM_VERT) {
- return base_ofs->vert_start - 1;
- }
- if (htype == BM_EDGE) {
- return base_ofs->edge_start - 1;
- }
- if (htype == BM_FACE) {
- return base_ofs->face_start - 1;
+ switch (elem_type) {
+ case SCE_SELECT_FACE:
+ return (BMElem *)BM_face_at_index_find_or_table(em->bm, elem_id);
+ case SCE_SELECT_EDGE:
+ return (BMElem *)BM_edge_at_index_find_or_table(em->bm, elem_id);
+ case SCE_SELECT_VERTEX:
+ return (BMElem *)BM_vert_at_index_find_or_table(em->bm, elem_id);
+ default:
+ BLI_assert(0);
+ return NULL;
+ }
}
- BLI_assert(0);
- return 0;
-}
-uint EDBM_select_id_context_elem_len(const struct EDBMSelectID_Context *sel_id_ctx)
-{
- return sel_id_ctx->base_array_index_len;
-}
-
-struct EDBMSelectID_Context *EDBM_select_id_context_create(ViewContext *vc,
- Base **bases,
- const uint bases_len,
- short select_mode)
-{
- struct EDBMSelectID_Context *sel_id_ctx = MEM_mallocN(sizeof(*sel_id_ctx), __func__);
- sel_id_ctx->base_array_index_offsets = MEM_mallocN(sizeof(struct EDBMBaseOffset) * bases_len,
- __func__);
- sel_id_ctx->bases = bases;
- sel_id_ctx->bases_len = bases_len;
-
- edbm_select_pick_draw_bases(sel_id_ctx, vc, select_mode);
-
- return sel_id_ctx;
-}
-
-void EDBM_select_id_context_destroy(struct EDBMSelectID_Context *sel_id_ctx)
-{
- MEM_freeN(sel_id_ctx->base_array_index_offsets);
- MEM_freeN(sel_id_ctx);
+ return NULL;
}
/** \} */
@@ -480,19 +335,19 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
{
FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_VERTEX);
- struct EDBMSelectID_Context *sel_id_ctx = EDBM_select_id_context_create(
+ struct EDSelectID_Context *sel_id_ctx = ED_view3d_select_id_context_create(
vc, bases, bases_len, select_mode);
index = ED_select_buffer_find_nearest_to_point(vc->mval, 1, UINT_MAX, &dist_px);
if (index) {
- eve = (BMVert *)EDBM_select_id_bm_elem_get(sel_id_ctx, index, &base_index);
+ eve = (BMVert *)EDBM_select_id_bm_elem_get(sel_id_ctx, bases, index, &base_index);
}
else {
eve = NULL;
}
- EDBM_select_id_context_destroy(sel_id_ctx);
+ ED_view3d_select_id_context_destroy(sel_id_ctx);
FAKE_SELECT_MODE_END(vc, fake_select_mode);
}
@@ -709,19 +564,19 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
{
FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_EDGE);
- struct EDBMSelectID_Context *sel_id_ctx = EDBM_select_id_context_create(
+ struct EDSelectID_Context *sel_id_ctx = ED_view3d_select_id_context_create(
vc, bases, bases_len, select_mode);
index = ED_select_buffer_find_nearest_to_point(vc->mval, 1, UINT_MAX, &dist_px);
if (index) {
- eed = (BMEdge *)EDBM_select_id_bm_elem_get(sel_id_ctx, index, &base_index);
+ eed = (BMEdge *)EDBM_select_id_bm_elem_get(sel_id_ctx, bases, index, &base_index);
}
else {
eed = NULL;
}
- EDBM_select_id_context_destroy(sel_id_ctx);
+ ED_view3d_select_id_context_destroy(sel_id_ctx);
FAKE_SELECT_MODE_END(vc, fake_select_mode);
}
@@ -922,19 +777,19 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
{
FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_FACE);
- struct EDBMSelectID_Context *sel_id_ctx = EDBM_select_id_context_create(
+ struct EDSelectID_Context *sel_id_ctx = ED_view3d_select_id_context_create(
vc, bases, bases_len, select_mode);
index = ED_select_buffer_sample_point(vc->mval);
if (index) {
- efa = (BMFace *)EDBM_select_id_bm_elem_get(sel_id_ctx, index, &base_index);
+ efa = (BMFace *)EDBM_select_id_bm_elem_get(sel_id_ctx, bases, index, &base_index);
}
else {
efa = NULL;
}
- EDBM_select_id_context_destroy(sel_id_ctx);
+ ED_view3d_select_id_context_destroy(sel_id_ctx);
FAKE_SELECT_MODE_END(vc, fake_select_mode);
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 97bdb3a7a5d..60de26e6ddc 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -7690,7 +7690,7 @@ static int point_normals_init(bContext *C, wmOperator *op, const wmEvent *UNUSED
BKE_editmesh_ensure_autosmooth(em);
BKE_editmesh_lnorspace_update(em);
- BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm);
+ BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false);
op->customdata = lnors_ed_arr;
@@ -8247,7 +8247,10 @@ static int normals_split_merge(bContext *C, const bool do_merge)
BKE_editmesh_ensure_autosmooth(em);
BKE_editmesh_lnorspace_update(em);
- BMLoopNorEditDataArray *lnors_ed_arr = do_merge ? BM_loop_normal_editdata_array_init(bm) : NULL;
+ /* Note that we need temp lnor editing data for all loops of all affected vertices, since by
+ * setting some faces/edges as smooth we are going to change clnors spaces... See also T65809. */
+ BMLoopNorEditDataArray *lnors_ed_arr = do_merge ? BM_loop_normal_editdata_array_init(bm, true) :
+ NULL;
mesh_set_smooth_faces(em, do_merge);
@@ -8574,7 +8577,7 @@ static int edbm_normals_tools_exec(bContext *C, wmOperator *op)
BKE_editmesh_ensure_autosmooth(em);
BKE_editmesh_lnorspace_update(em);
- BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm);
+ BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false);
BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata;
float *normal_vector = scene->toolsettings->normal_vector;
@@ -8868,7 +8871,7 @@ static int edbm_smoothen_normals_exec(bContext *C, wmOperator *op)
BKE_editmesh_ensure_autosmooth(em);
BKE_editmesh_lnorspace_update(em);
- BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm);
+ BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false);
float(*smooth_normal)[3] = MEM_callocN(sizeof(*smooth_normal) * lnors_ed_arr->totloop, __func__);
diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c
index eec0c4a57fa..d76801a2500 100644
--- a/source/blender/editors/mesh/mesh_mirror.c
+++ b/source/blender/editors/mesh/mesh_mirror.c
@@ -322,7 +322,7 @@ void ED_mesh_mirrtopo_init(Mesh *me,
BMVert **vtable = em->bm->vtable;
for (a = 1; a <= totvert; a++) {
// printf("I %d %ld %d\n",
- // (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_indexs);
+ // (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_index);
if ((a == totvert) || (topo_pairs[a - 1].hash != topo_pairs[a].hash)) {
const int match_count = a - last;
if (match_count == 2) {
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index e424d2cc5bf..53bc037c736 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -651,9 +651,9 @@ static bool edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
return 0;
}
- if (ID_IS_STATIC_OVERRIDE(ob)) {
- CTX_wm_operator_poll_msg_set(C, "Cannot edit constraints coming from static override");
- return (((bConstraint *)ptr.data)->flag & CONSTRAINT_STATICOVERRIDE_LOCAL) != 0;
+ if (ID_IS_OVERRIDE_LIBRARY(ob)) {
+ CTX_wm_operator_poll_msg_set(C, "Cannot edit constraints coming from library override");
+ return (((bConstraint *)ptr.data)->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) != 0;
}
return 1;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 8ccd35051c6..4f1154c02e3 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1604,6 +1604,7 @@ static void move_to_collection_menu_create(bContext *UNUSED(C), uiLayout *layout
MoveToCollectionData *menu = menu_v;
const char *name = BKE_collection_ui_name_get(menu->collection);
+ UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP);
uiItemIntO(layout, name, ICON_NONE, menu->ot->idname, "collection_index", menu->index);
uiItemS(layout);
diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c
index 383974270f4..5c4fa5aeee6 100644
--- a/source/blender/editors/object/object_gpencil_modifier.c
+++ b/source/blender/editors/object/object_gpencil_modifier.c
@@ -402,10 +402,10 @@ static int gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type,
return 0;
}
- if (ID_IS_STATIC_OVERRIDE(ob)) {
- CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from static override");
- return (((GpencilModifierData *)ptr.data)->flag & eGpencilModifierFlag_StaticOverride_Local) !=
- 0;
+ if (ID_IS_OVERRIDE_LIBRARY(ob)) {
+ CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override");
+ return (((GpencilModifierData *)ptr.data)->flag &
+ eGpencilModifierFlag_OverrideLibrary_Local) != 0;
}
return 1;
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index d17b6515dbb..b9350052093 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -59,7 +59,7 @@ void OBJECT_OT_vertex_parent_set(struct wmOperatorType *ot);
void OBJECT_OT_track_set(struct wmOperatorType *ot);
void OBJECT_OT_track_clear(struct wmOperatorType *ot);
void OBJECT_OT_make_local(struct wmOperatorType *ot);
-void OBJECT_OT_make_override_static(struct wmOperatorType *ot);
+void OBJECT_OT_make_override_library(struct wmOperatorType *ot);
void OBJECT_OT_make_single_user(struct wmOperatorType *ot);
void OBJECT_OT_make_links_scene(struct wmOperatorType *ot);
void OBJECT_OT_make_links_data(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 42f819b9f42..08012842c37 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -927,9 +927,9 @@ bool edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_fla
return 0;
}
- if (ID_IS_STATIC_OVERRIDE(ob)) {
- CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from static override");
- return (((ModifierData *)ptr.data)->flag & eModifierFlag_StaticOverride_Local) != 0;
+ if (ID_IS_OVERRIDE_LIBRARY(ob)) {
+ CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override");
+ return (((ModifierData *)ptr.data)->flag & eModifierFlag_OverrideLibrary_Local) != 0;
}
return 1;
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index afc0297cb01..b653c7fa70c 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -78,7 +78,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_track_set);
WM_operatortype_append(OBJECT_OT_track_clear);
WM_operatortype_append(OBJECT_OT_make_local);
- WM_operatortype_append(OBJECT_OT_make_override_static);
+ WM_operatortype_append(OBJECT_OT_make_override_library);
WM_operatortype_append(OBJECT_OT_make_single_user);
WM_operatortype_append(OBJECT_OT_make_links_scene);
WM_operatortype_append(OBJECT_OT_make_links_data);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 1446ea23bb8..42b27d1d255 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -405,7 +405,7 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
* will depend on order of bases.
*
* TODO(sergey): We really need to get rid of this bi-directional links
- * in proxies with something like static overrides.
+ * in proxies with something like library overrides.
*/
newob->proxy->proxy_from = newob;
@@ -2320,7 +2320,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
}
-static void make_override_static_tag_object(Object *obact, Object *ob)
+static void make_override_library_tag_object(Object *obact, Object *ob)
{
if (ob == obact) {
return;
@@ -2354,17 +2354,17 @@ static void make_override_static_tag_object(Object *obact, Object *ob)
}
}
-static void make_override_static_tag_collections(Collection *collection)
+static void make_override_library_tag_collections(Collection *collection)
{
collection->id.tag |= LIB_TAG_DOIT;
for (CollectionChild *coll_child = collection->children.first; coll_child != NULL;
coll_child = coll_child->next) {
- make_override_static_tag_collections(coll_child->collection);
+ make_override_library_tag_collections(coll_child->collection);
}
}
/* Set the object to override. */
-static int make_override_static_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int make_override_library_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Scene *scene = CTX_data_scene(C);
Object *obact = ED_object_active_context(C);
@@ -2400,12 +2400,12 @@ static int make_override_static_invoke(bContext *C, wmOperator *op, const wmEven
/* Error.. cannot continue. */
BKE_report(op->reports,
RPT_ERROR,
- "Can only make static override for a referenced object or collection");
+ "Can only make library override for a referenced object or collection");
return OPERATOR_CANCELLED;
}
}
-static int make_override_static_exec(bContext *C, wmOperator *op)
+static int make_override_library_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *obact = CTX_data_active_object(C);
@@ -2421,10 +2421,10 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
Base *base = BLI_findlink(&dup_collection_objects, RNA_enum_get(op->ptr, "object"));
obact = base->object;
- /* First, we make a static override of the linked collection itself, and all its children. */
- make_override_static_tag_collections(collection);
+ /* First, we make a library override of the linked collection itself, and all its children. */
+ make_override_library_tag_collections(collection);
- /* Then, we make static override of the whole set of objects in the Collection. */
+ /* Then, we make library override of the whole set of objects in the Collection. */
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) {
ob->id.tag |= LIB_TAG_DOIT;
}
@@ -2443,7 +2443,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
- success = BKE_override_static_create_from_tag(bmain);
+ success = BKE_override_library_create_from_tag(bmain);
/* Instantiate our newly overridden objects in scene, if not yet done. */
Scene *scene = CTX_data_scene(C);
@@ -2452,7 +2452,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
BKE_collection_child_add(bmain, scene->master_collection, new_collection);
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (new_collection, new_ob) {
- if (new_ob != NULL && new_ob->id.override_static != NULL) {
+ if (new_ob != NULL && new_ob->id.override_library != NULL) {
if ((base = BKE_view_layer_base_find(view_layer, new_ob)) == NULL) {
BKE_collection_object_add_from(bmain, scene, obcollection, new_ob);
base = BKE_view_layer_base_find(view_layer, new_ob);
@@ -2468,10 +2468,10 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
}
else {
/* Disable auto-override tags for non-active objects, will help with performaces... */
- new_ob->id.override_static->flag &= ~STATICOVERRIDE_AUTO;
+ new_ob->id.override_library->flag &= ~OVERRIDE_LIBRARY_AUTO;
}
/* We still want to store all objects' current override status (i.e. change of parent). */
- BKE_override_static_operations_create(bmain, &new_ob->id, true);
+ BKE_override_library_operations_create(bmain, &new_ob->id, true);
}
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
@@ -2496,10 +2496,10 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
obact->id.tag |= LIB_TAG_DOIT;
for (Object *ob = bmain->objects.first; ob != NULL; ob = ob->id.next) {
- make_override_static_tag_object(obact, ob);
+ make_override_library_tag_object(obact, ob);
}
- success = BKE_override_static_create_from_tag(bmain);
+ success = BKE_override_library_create_from_tag(bmain);
/* Also, we'd likely want to lock by default things like
* transformations of implicitly overridden objects? */
@@ -2510,7 +2510,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
}
/* TODO: probably more cases where we want to do automated smart things in the future! */
else {
- success = (BKE_override_static_create_from_id(bmain, &obact->id) != NULL);
+ success = (BKE_override_library_create_from_id(bmain, &obact->id) != NULL);
}
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -2518,28 +2518,28 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
return success ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
-static bool make_override_static_poll(bContext *C)
+static bool make_override_library_poll(bContext *C)
{
Object *obact = CTX_data_active_object(C);
/* Object must be directly linked to be overridable. */
- return (BKE_override_static_is_enabled() && ED_operator_objectmode(C) && obact != NULL &&
+ return (BKE_override_library_is_enabled() && ED_operator_objectmode(C) && obact != NULL &&
((ID_IS_LINKED(obact) && obact->id.tag & LIB_TAG_EXTERN) ||
(!ID_IS_LINKED(obact) && obact->instance_collection != NULL &&
ID_IS_LINKED(obact->instance_collection))));
}
-void OBJECT_OT_make_override_static(wmOperatorType *ot)
+void OBJECT_OT_make_override_library(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Make Static Override";
- ot->description = "Make local override of this library linked data-block";
- ot->idname = "OBJECT_OT_make_override_static";
+ ot->name = "Make Library Override";
+ ot->description = "Make a local override of this library linked data-block";
+ ot->idname = "OBJECT_OT_make_override_library";
/* api callbacks */
- ot->invoke = make_override_static_invoke;
- ot->exec = make_override_static_exec;
- ot->poll = make_override_static_poll;
+ ot->invoke = make_override_library_invoke;
+ ot->exec = make_override_library_exec;
+ ot->poll = make_override_library_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c
index f4f944459f7..6212269c099 100644
--- a/source/blender/editors/object/object_shader_fx.c
+++ b/source/blender/editors/object/object_shader_fx.c
@@ -310,9 +310,9 @@ static bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obt
return 0;
}
- if (ID_IS_STATIC_OVERRIDE(ob)) {
- CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from static override");
- return (((ShaderFxData *)ptr.data)->flag & eShaderFxFlag_StaticOverride_Local) != 0;
+ if (ID_IS_OVERRIDE_LIBRARY(ob)) {
+ CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override");
+ return (((ShaderFxData *)ptr.data)->flag & eShaderFxFlag_OverrideLibrary_Local) != 0;
}
return 1;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 2e958385a60..678f6f50096 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -59,6 +59,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "DNA_armature_types.h"
#include "RNA_access.h"
@@ -1314,7 +1315,7 @@ static void getVerticalAndHorizontalChange(const float norm[3],
* coord is a point on the plane
*/
static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
- Scene *scene,
+ Scene *UNUSED(scene),
Object *ob,
Mesh *me,
int index,
@@ -1325,10 +1326,15 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
float strength,
float cp)
{
+ Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+ Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+ Mesh *mesh_eval = (Mesh *)object_eval->data;
+
Mesh *me_deform;
- MDeformWeight *dw;
+ MDeformWeight *dw, *dw_eval;
MVert m;
MDeformVert *dvert = me->dvert + index;
+ MDeformVert *dvert_eval = mesh_eval->dvert + index;
int totweight = dvert->totweight;
float oldw = 0;
float oldPos[3] = {0};
@@ -1349,7 +1355,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
float originalDistToBe = distToBe;
do {
wasChange = false;
- me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH);
+ me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
m = me_deform->mvert[index];
copy_v3_v3(oldPos, m.co);
distToStart = dot_v3v3(norm, oldPos) + d;
@@ -1360,6 +1366,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
for (i = 0; i < totweight; i++) {
dwIndices[i] = i;
dw = (dvert->dw + i);
+ dw_eval = (dvert_eval->dw + i);
vc = hc = 0;
if (!dw->weight) {
changes[i][0] = 0;
@@ -1371,7 +1378,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
if (me_deform) {
/* DO NOT try to do own cleanup here, this is call for dramatic failures and bugs!
* Better to over-free and recompute a bit. */
- BKE_object_free_derived_caches(ob);
+ BKE_object_free_derived_caches(object_eval);
}
oldw = dw->weight;
if (k) {
@@ -1389,11 +1396,13 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
if (dw->weight > 1) {
dw->weight = 1;
}
- me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH);
+ dw_eval->weight = dw->weight;
+ me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
m = me_deform->mvert[index];
getVerticalAndHorizontalChange(
norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
dw->weight = oldw;
+ dw_eval->weight = oldw;
if (!k) {
vc = changes[i][0];
hc = changes[i][1];
@@ -1488,7 +1497,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
if (me_deform) {
/* DO NOT try to do own cleanup here, this is call for dramatic failures and bugs!
* Better to over-free and recompute a bit. */
- BKE_object_free_derived_caches(ob);
+ BKE_object_free_derived_caches(object_eval);
}
}
} while (wasChange && ((distToStart - distToBe) / fabsf(distToStart - distToBe) ==
@@ -1503,9 +1512,11 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
/* this is used to try to smooth a surface by only adjusting the nonzero weights of a vertex
* but it could be used to raise or lower an existing 'bump.' */
static void vgroup_fix(
- const bContext *C, Scene *scene, Object *ob, float distToBe, float strength, float cp)
+ const bContext *C, Scene *UNUSED(scene), Object *ob, float distToBe, float strength, float cp)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+ Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
int i;
Mesh *me = ob->data;
@@ -1522,7 +1533,8 @@ static void vgroup_fix(
MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints");
int k;
- Mesh *me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH);
+ Mesh *me_deform = mesh_get_eval_deform(
+ depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
k = count;
while (k--) {
p[k] = me_deform->mvert[verts[k]];
@@ -1540,7 +1552,7 @@ static void vgroup_fix(
d = -dot_v3v3(norm, coord);
/* dist = (dot_v3v3(norm, m.co) + d); */ /* UNUSED */
moveCloserToDistanceFromPlane(
- depsgraph, scene, ob, me, i, norm, coord, d, distToBe, strength, cp);
+ depsgraph, scene_eval, object_eval, me, i, norm, coord, d, distToBe, strength, cp);
}
}
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index dc634865a0a..7506ad37908 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -778,6 +778,7 @@ static void foreach_mouse_hit_key_iter(void *__restrict iter_data_v,
}
ParticleSystem *psys = edit->psys;
ParticleSystemModifierData *psmd_eval = iter_data->edit->psmd_eval;
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
ParticleEditSettings *pset = PE_settings(data->scene);
const int selected = iter_data->selected;
float mat[4][4], imat[4][4];
@@ -793,7 +794,7 @@ static void foreach_mouse_hit_key_iter(void *__restrict iter_data_v,
if (key_inside_circle(data, data->rad, KEY_WCO, &mouse_distance)) {
if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(
- data->ob, psmd_eval->mesh_final, psys->part->from, psys->particles + iter, mat);
+ data->ob, mesh_final, psys->part->from, psys->particles + iter, mat);
invert_m4_m4(imat, mat);
}
iter_data->func(data, mat, imat, iter, point->totkey - 1, key, mouse_distance);
@@ -812,7 +813,7 @@ static void foreach_mouse_hit_key_iter(void *__restrict iter_data_v,
if (key_inside_circle(data, data->rad, KEY_WCO, &mouse_distance)) {
if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(
- data->ob, psmd_eval->mesh_final, psys->part->from, psys->particles + iter, mat);
+ data->ob, mesh_final, psys->part->from, psys->particles + iter, mat);
invert_m4_m4(imat, mat);
}
iter_data->func(data, mat, imat, iter, k, key, mouse_distance);
@@ -927,7 +928,9 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
psmd_eval = edit->psmd_eval;
totpart = psys->totpart;
- if (!psmd_eval->mesh_final) {
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+
+ if (!mesh_final) {
return;
}
@@ -937,7 +940,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
LOOP_PARTICLES
{
key = pa->hair;
- psys_mat_hair_to_orco(ob, psmd_eval->mesh_final, psys->part->from, pa, mat);
+ psys_mat_hair_to_orco(ob, mesh_final, psys->part->from, pa, mat);
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
BLI_kdtree_3d_insert(tree, p, co);
@@ -953,7 +956,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
LOOP_PARTICLES
{
key = pa->hair;
- psys_mat_hair_to_orco(ob, psmd_eval->mesh_final, psys->part->from, pa, mat);
+ psys_mat_hair_to_orco(ob, mesh_final, psys->part->from, pa, mat);
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
co[0] = -co[0];
@@ -1084,8 +1087,9 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
edit = psys->edit;
psmd_eval = edit->psmd_eval;
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
- if (!psmd_eval->mesh_final) {
+ if (!mesh_final) {
return;
}
@@ -1102,7 +1106,7 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
LOOP_POINTS
{
if (point->flag & PEP_EDIT_RECALC) {
- PE_mirror_particle(ob, psmd_eval->mesh_final, psys, psys->particles + p, NULL);
+ PE_mirror_particle(ob, mesh_final, psys, psys->particles + p, NULL);
if (edit->mirror_cache[p] != -1) {
edit->points[edit->mirror_cache[p]].flag &= ~PEP_EDIT_RECALC;
@@ -1152,8 +1156,8 @@ static void deflect_emitter_iter(void *__restrict iter_data_v,
float *vec, *nor, dvec[3], dot, dist_1st = 0.0f;
const float dist = iter_data->dist;
const float emitterdist = iter_data->emitterdist;
- psys_mat_hair_to_object(
- object, psmd_eval->mesh_final, psys->part->from, psys->particles + iter, hairmat);
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+ psys_mat_hair_to_object(object, mesh_final, psys->part->from, psys->particles + iter, hairmat);
LOOP_KEYS
{
@@ -1217,7 +1221,8 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
psys = edit->psys;
- if (!edit->psmd_eval->mesh_final) {
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(edit->psmd_eval);
+ if (!mesh_final) {
return;
}
@@ -1382,7 +1387,7 @@ void recalc_lengths(PTCacheEdit *edit)
void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), ParticleSystem *psys)
{
PTCacheEdit *edit = psys->edit;
- Mesh *mesh = edit->psmd_eval->mesh_final;
+ Mesh *mesh = BKE_particle_modifier_mesh_final_get(edit->psmd_eval);
float *vec, *nor;
int i, totface /*, totvert*/;
@@ -1489,15 +1494,16 @@ void update_world_cos(Depsgraph *UNUSED(depsgraph), Object *ob, PTCacheEdit *edi
KEY_K;
float hairmat[4][4];
- if (psys == 0 || psys->edit == 0 || psmd_eval->mesh_final == NULL) {
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+
+ if (psys == 0 || psys->edit == 0 || mesh_final == NULL) {
return;
}
LOOP_POINTS
{
if (!(psys->flag & PSYS_GLOBAL_HAIR)) {
- psys_mat_hair_to_global(
- ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, hairmat);
+ psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + p, hairmat);
}
LOOP_KEYS
@@ -2269,11 +2275,12 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, const
data.is_changed |= PE_deselect_all_visible_ex(edit);
}
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+
LOOP_VISIBLE_POINTS
{
if (edit->psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
- psys_mat_hair_to_global(
- ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat);
+ psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + p, mat);
}
if (pset->selectmode == SCE_SELECT_POINT) {
@@ -2739,10 +2746,11 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
if (mirror) {
/* mirror tags */
psmd_eval = edit->psmd_eval;
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
LOOP_TAGGED_POINTS
{
- PE_mirror_particle(ob, psmd_eval->mesh_final, psys, psys->particles + p, NULL);
+ PE_mirror_particle(ob, mesh_final, psys, psys->particles + p, NULL);
}
}
@@ -2831,12 +2839,13 @@ static void remove_tagged_keys(Depsgraph *depsgraph, Object *ob, ParticleSystem
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
ParticleSystemModifierData *psmd_eval = (ParticleSystemModifierData *)modifier_get_evaluated(
depsgraph, ob, &psmd->modifier);
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
LOOP_POINTS
{
LOOP_TAGGED_KEYS
{
- PE_mirror_particle(ob, psmd_eval->mesh_final, psys, psys->particles + p, NULL);
+ PE_mirror_particle(ob, mesh_final, psys, psys->particles + p, NULL);
break;
}
}
@@ -3063,6 +3072,8 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
psmd_eval = edit->psmd_eval;
totremoved = 0;
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+
do {
removed = 0;
@@ -3071,8 +3082,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
/* insert particles into kd tree */
LOOP_SELECTED_POINTS
{
- psys_mat_hair_to_object(
- ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat);
+ psys_mat_hair_to_object(ob, mesh_final, psys->part->from, psys->particles + p, mat);
copy_v3_v3(co, point->keys->co);
mul_m4_v3(mat, co);
BLI_kdtree_3d_insert(tree, p, co);
@@ -3083,8 +3093,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
/* tag particles to be removed */
LOOP_SELECTED_POINTS
{
- psys_mat_hair_to_object(
- ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat);
+ psys_mat_hair_to_object(ob, mesh_final, psys->part->from, psys->particles + p, mat);
copy_v3_v3(co, point->keys->co);
mul_m4_v3(mat, co);
@@ -3347,20 +3356,22 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
}
psmd_eval = edit->psmd_eval;
- if (!psmd_eval->mesh_final) {
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+ Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(psmd_eval);
+
+ if (!mesh_final) {
return;
}
const bool use_dm_final_indices = (psys->part->use_modifier_stack &&
- !psmd_eval->mesh_final->runtime.deformed_only);
+ !mesh_final->runtime.deformed_only);
/* NOTE: this is not nice to use tessfaces but hard to avoid since pa->num uses tessfaces */
BKE_mesh_tessface_ensure(me);
/* NOTE: In case psys uses Mesh tessface indices, we mirror final Mesh itself, not orig mesh.
* Avoids an (impossible) mesh -> orig -> mesh tessface indices conversion. */
- mirrorfaces = mesh_get_x_mirror_faces(
- ob, NULL, use_dm_final_indices ? psmd_eval->mesh_final : NULL);
+ mirrorfaces = mesh_get_x_mirror_faces(ob, NULL, use_dm_final_indices ? mesh_final : NULL);
if (!edit->mirror_cache) {
PE_update_mirror_cache(ob, psys);
@@ -3376,7 +3387,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
if (point_is_selected(point)) {
if (edit->mirror_cache[p] != -1) {
/* already has a mirror, don't need to duplicate */
- PE_mirror_particle(ob, psmd_eval->mesh_final, psys, pa, NULL);
+ PE_mirror_particle(ob, mesh_final, psys, pa, NULL);
continue;
}
else {
@@ -3391,7 +3402,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
}
if (newtotpart != psys->totpart) {
- MFace *mtessface = use_dm_final_indices ? psmd_eval->mesh_final->mface : me->mface;
+ MFace *mtessface = use_dm_final_indices ? mesh_final->mface : me->mface;
/* allocate new arrays and copy existing */
new_pars = MEM_callocN(newtotpart * sizeof(ParticleData), "ParticleData new");
@@ -3467,7 +3478,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
}
else {
newpa->num_dmcache = psys_particle_dm_face_lookup(
- psmd_eval->mesh_final, psmd_eval->mesh_original, newpa->num, newpa->fuv, NULL);
+ mesh_final, mesh_original, newpa->num, newpa->fuv, NULL);
}
/* update edit key pointers */
@@ -3478,7 +3489,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
}
/* map key positions as mirror over x axis */
- PE_mirror_particle(ob, psmd_eval->mesh_final, psys, pa, newpa);
+ PE_mirror_particle(ob, mesh_final, psys, pa, newpa);
newpa++;
newpoint++;
@@ -4157,19 +4168,18 @@ static void brush_add_count_iter(void *__restrict iter_data_v,
0,
0,
0)) {
- if (psys->part->use_modifier_stack && !psmd_eval->mesh_final->runtime.deformed_only) {
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+ Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(psmd_eval);
+ if (psys->part->use_modifier_stack && !mesh_final->runtime.deformed_only) {
add_pars[iter].num = add_pars[iter].num_dmcache;
add_pars[iter].num_dmcache = DMCACHE_ISCHILD;
}
- else if (iter_data->mesh == psmd_eval->mesh_original) {
+ else if (iter_data->mesh == mesh_original) {
/* Final DM is not same topology as orig mesh,
* we have to map num_dmcache to real final dm. */
add_pars[iter].num = add_pars[iter].num_dmcache;
- add_pars[iter].num_dmcache = psys_particle_dm_face_lookup(psmd_eval->mesh_final,
- psmd_eval->mesh_original,
- add_pars[iter].num,
- add_pars[iter].fuv,
- NULL);
+ add_pars[iter].num_dmcache = psys_particle_dm_face_lookup(
+ mesh_final, mesh_original, add_pars[iter].num, add_pars[iter].fuv, NULL);
}
else {
add_pars[iter].num = add_pars[iter].num_dmcache;
@@ -4227,11 +4237,12 @@ static int brush_add(const bContext *C, PEData *data, short number)
timestep = psys_get_timestep(&sim);
- if (psys->part->use_modifier_stack || psmd_eval->mesh_final->runtime.deformed_only) {
- mesh = psmd_eval->mesh_final;
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+ if (psys->part->use_modifier_stack || mesh_final->runtime.deformed_only) {
+ mesh = mesh_final;
}
else {
- mesh = psmd_eval->mesh_original;
+ mesh = BKE_particle_modifier_mesh_original_get(psmd_eval);
}
BLI_assert(mesh);
@@ -4315,7 +4326,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
tree = BLI_kdtree_3d_new(psys->totpart);
for (i = 0, pa = psys->particles; i < totpart; i++, pa++) {
- psys_particle_on_dm(psmd_eval->mesh_final,
+ psys_particle_on_dm(mesh_final,
psys->part->from,
pa->num,
pa->num_dmcache,
@@ -4372,7 +4383,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
int w, maxw;
float maxd, totw = 0.0, weight[3];
- psys_particle_on_dm(psmd_eval->mesh_final,
+ psys_particle_on_dm(mesh_final,
psys->part->from,
pa->num,
pa->num_dmcache,
@@ -4450,7 +4461,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
}
}
for (k = 0, hkey = pa->hair; k < pset->totaddkey; k++, hkey++) {
- psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, pa, hairmat);
+ psys_mat_hair_to_global(ob, mesh_final, psys->part->from, pa, hairmat);
invert_m4_m4(imat, hairmat);
mul_m4_v3(imat, hkey->co);
}
@@ -4651,7 +4662,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
}
case PE_BRUSH_PUFF: {
if (edit->psys) {
- data.mesh = psmd_eval->mesh_final;
+ data.mesh = BKE_particle_modifier_mesh_final_get(psmd_eval);
data.mval = mval;
data.rad = pe_brush_size_get(scene, brush);
data.select = selected;
@@ -4708,7 +4719,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
}
case PE_BRUSH_WEIGHT: {
if (edit->psys) {
- data.mesh = psmd_eval->mesh_final;
+ data.mesh = BKE_particle_modifier_mesh_final_get(psmd_eval);
data.mval = mval;
data.rad = pe_brush_size_get(scene, brush);
@@ -5082,8 +5093,8 @@ int PE_minmax(Scene *scene, ViewLayer *view_layer, float min[3], float max[3])
LOOP_VISIBLE_POINTS
{
if (psys) {
- psys_mat_hair_to_global(
- ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat);
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+ psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + p, mat);
}
LOOP_SELECTED_KEYS
@@ -5124,7 +5135,8 @@ void PE_create_particle_edit(
}
/* no psmd->dm happens in case particle system modifier is not enabled */
- if (!(psys && psmd && psmd_eval->mesh_final) && !cache) {
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+ if (!(psys && psmd && mesh_final) && !cache) {
return;
}
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index b03ec56c7e4..d85bf72851d 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -620,6 +620,7 @@ static void disconnect_hair(Depsgraph *depsgraph, Scene *scene, Object *ob, Part
edit = psys->edit;
point = edit ? edit->points : NULL;
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
if (point) {
@@ -627,7 +628,7 @@ static void disconnect_hair(Depsgraph *depsgraph, Scene *scene, Object *ob, Part
point++;
}
- psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, pa, hairmat);
+ psys_mat_hair_to_global(ob, mesh_final, psys->part->from, pa, hairmat);
for (k = 0, key = pa->hair; k < pa->totkey; k++, key++) {
mul_m4_v3(hairmat, key->co);
@@ -725,7 +726,8 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
float from_ob_imat[4][4], to_ob_imat[4][4];
float from_imat[4][4], to_imat[4][4];
- if (!target_psmd->mesh_final) {
+ Mesh *target_mesh_final = BKE_particle_modifier_mesh_final_get(target_psmd);
+ if (!target_mesh_final) {
return false;
}
if (!psys->part || psys->part->type != PART_HAIR) {
@@ -742,14 +744,14 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
invert_m4_m4(from_imat, from_mat);
invert_m4_m4(to_imat, to_mat);
- if (target_psmd->mesh_final->runtime.deformed_only) {
+ if (target_mesh_final->runtime.deformed_only) {
/* we don't want to mess up target_psmd->dm when converting to global coordinates below */
- mesh = target_psmd->mesh_final;
+ mesh = target_mesh_final;
}
else {
- mesh = target_psmd->mesh_original;
+ mesh = BKE_particle_modifier_mesh_original_get(target_psmd);
}
- target_mesh = target_psmd->mesh_final;
+ target_mesh = target_mesh_final;
if (mesh == NULL) {
return false;
}
@@ -1155,10 +1157,13 @@ static bool copy_particle_systems_to_object(const bContext *C,
modifier_unique_name(&ob_to->modifiers, (ModifierData *)psmd);
psmd->psys = psys;
- BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&psmd->mesh_final, LIB_ID_COPY_LOCALIZE);
- BKE_mesh_calc_normals(psmd->mesh_final);
- BKE_mesh_tessface_ensure(psmd->mesh_final);
+ /* TODO(sergey): This should probably be accessing evaluated psmd. */
+ ParticleSystemModifierDataRuntime *runtime = BKE_particle_modifier_runtime_ensure(psmd);
+ BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&runtime->mesh_final, LIB_ID_COPY_LOCALIZE);
+
+ BKE_mesh_calc_normals(runtime->mesh_final);
+ BKE_mesh_tessface_ensure(runtime->mesh_final);
if (psys_from->edit) {
copy_particle_edit(depsgraph, scene, ob_to, psys, psys_from);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 110dc7aaaf1..72e6c6fdf03 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -331,6 +331,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT);
+ GPU_matrix_reset();
wmOrtho2(0, scene->r.xsch, 0, scene->r.ysch);
GPU_matrix_translate_2f(scene->r.xsch / 2, scene->r.ysch / 2);
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 6a5df8a3776..2eb7f732534 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -104,7 +104,11 @@ const char *screen_context_dir[] = {
"active_gpencil_layer",
"active_gpencil_frame",
"active_operator",
+ "visible_fcurves",
+ "editable_fcurves",
+ "selected_visible_fcurves",
"selected_editable_fcurves",
+ "active_editable_fcurve",
NULL,
};
@@ -654,23 +658,31 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
- else if (CTX_data_equals(member, "selected_editable_fcurves")) {
+ else if (CTX_data_equals(member, "editable_fcurves") ||
+ CTX_data_equals(member, "visible_fcurves") ||
+ CTX_data_equals(member, "selected_editable_fcurves") ||
+ CTX_data_equals(member, "selected_visible_fcurves")) {
bAnimContext ac;
if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_ACTION, SPACE_GRAPH)) {
- bAnimListElem *ale;
ListBase anim_data = {NULL, NULL};
- int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS |
- ANIMFILTER_SEL) |
+ int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS) |
(ac.spacetype == SPACE_GRAPH ? ANIMFILTER_CURVE_VISIBLE :
ANIMFILTER_LIST_VISIBLE);
+ if (strstr(member, "editable_")) {
+ filter |= ANIMFILTER_FOREDIT;
+ }
+ if (STRPREFIX(member, "selected_")) {
+ filter |= ANIMFILTER_SEL;
+ }
+
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
- for (ale = anim_data.first; ale; ale = ale->next) {
- if (ale->type == ANIMTYPE_FCURVE) {
- CTX_data_list_add(result, ale->id, &RNA_FCurve, ale->data);
+ for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next) {
+ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
+ CTX_data_list_add(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data);
}
}
@@ -680,6 +692,28 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
+ else if (CTX_data_equals(member, "active_editable_fcurve")) {
+ bAnimContext ac;
+
+ if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_GRAPH)) {
+ ListBase anim_data = {NULL, NULL};
+
+ int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT |
+ ANIMFILTER_CURVE_VISIBLE);
+
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next) {
+ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
+ CTX_data_pointer_set(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data);
+ break;
+ }
+ }
+
+ ANIM_animdata_freelist(&anim_data);
+ return 1;
+ }
+ }
else {
return 0; /* not found */
}
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index 9fcd0e5295c..6030b6fded5 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -376,6 +376,9 @@ static int workspace_append_activate_exec(bContext *C, wmOperator *op)
BLI_assert(appended_workspace != NULL);
if (appended_workspace) {
+ /* Set defaults. */
+ BLO_update_defaults_workspace(appended_workspace, NULL);
+
/* Reorder to last position. */
BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 4287feed92c..e66e1c49685 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -33,8 +33,8 @@
#include "BKE_pbvh.h"
-struct Main;
struct KeyBlock;
+struct Main;
struct Object;
struct SculptOrigVertData;
struct SculptUndoNode;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 9b0150d731d..129f249d7d0 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -510,7 +510,7 @@ static void buttons_area_listener(wmWindow *UNUSED(win),
case NC_GPENCIL:
switch (wmn->data) {
case ND_DATA:
- if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
+ if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED)) {
ED_area_tag_redraw(sa);
}
break;
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 6b3baa1e766..9bdea13276b 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -478,7 +478,14 @@ static void file_draw_preview(uiBlock *block,
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
if (icon) {
- UI_icon_draw_ex((float)xco, (float)yco, icon, icon_aspect, 1.0f, 0.0f, NULL, false);
+ UI_icon_draw_ex((float)xco + (7 * UI_DPI_FAC),
+ (float)yco + (7 * UI_DPI_FAC),
+ icon,
+ icon_aspect,
+ 1.0f,
+ 0.0f,
+ NULL,
+ false);
}
/* border */
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index fab3cfbb69d..faaecd975a3 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -786,8 +786,10 @@ void ED_fileselect_exit(wmWindowManager *wm, ScrArea *sa, SpaceFile *sfile)
}
}
-/** Helper used by both main update code, and smoothscroll timer,
- * to try to enable rename editing from #FileSelectParams.renamefile name. */
+/**
+ * Helper used by both main update code, and smooth-scroll timer,
+ * to try to enable rename editing from #FileSelectParams.renamefile name.
+ */
void file_params_renamefile_activate(SpaceFile *sfile, FileSelectParams *params)
{
BLI_assert(params->rename_flag != 0);
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index cdb5e672f4a..c727c5225c9 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -904,7 +904,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout,
DriverVar *dvar;
PointerRNA driver_ptr;
- uiLayout *col, *row;
+ uiLayout *col, *row, *row_outer;
uiBlock *block;
uiBut *but;
@@ -957,7 +957,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout,
else if (!BKE_driver_has_simple_expression(driver)) {
if ((G.f & G_FLAG_SCRIPT_AUTOEXEC) == 0) {
/* TODO: Add button to enable? */
- uiItemL(col, TIP_("WARNING: Python expressions limited for security"), ICON_ERROR);
+ uiItemL(col, TIP_("Python restricted for security"), ICON_ERROR);
}
else {
uiItemL(col, TIP_("Slow Python expression"), ICON_INFO);
@@ -1005,61 +1005,41 @@ static void graph_draw_driver_settings_panel(uiLayout *layout,
uiItemS(layout);
/* add/copy/paste driver variables */
- if (is_popover) {
- /* add driver variable - add blank */
- row = uiLayoutRow(layout, true);
- block = uiLayoutGetBlock(row);
- but = uiDefIconTextBut(
- block,
- UI_BTYPE_BUT,
- B_IPO_DEPCHANGE,
- ICON_ADD,
- IFACE_("Add Input Variable"),
- 0,
- 0,
- 10 * UI_UNIT_X,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- TIP_("Add a Driver Variable to keep track an input used by the driver"));
- UI_but_func_set(but, driver_add_var_cb, driver, NULL);
+ row_outer = uiLayoutRow(layout, false);
+ /* add driver variable - add blank */
+ row = uiLayoutRow(row_outer, true);
+ block = uiLayoutGetBlock(row);
+ but = uiDefIconTextBut(
+ block,
+ UI_BTYPE_BUT,
+ B_IPO_DEPCHANGE,
+ ICON_ADD,
+ IFACE_("Add Input Variable"),
+ 0,
+ 0,
+ 10 * UI_UNIT_X,
+ UI_UNIT_Y,
+ NULL,
+ 0.0,
+ 0.0,
+ 0,
+ 0,
+ TIP_("Add a Driver Variable to keep track of an input used by the driver"));
+ UI_but_func_set(but, driver_add_var_cb, driver, NULL);
+
+ if (is_popover) {
/* add driver variable - add using eyedropper */
/* XXX: will this operator work like this? */
uiItemO(row, "", ICON_EYEDROPPER, "UI_OT_eyedropper_driver");
}
- else {
- /* add driver variable */
- row = uiLayoutRow(layout, false);
- block = uiLayoutGetBlock(row);
- but = uiDefIconTextBut(block,
- UI_BTYPE_BUT,
- B_IPO_DEPCHANGE,
- ICON_ADD,
- IFACE_("Add Input Variable"),
- 0,
- 0,
- 10 * UI_UNIT_X,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- TIP_("Driver variables ensure that all dependencies will be accounted "
- "for, ensuring that drivers will update correctly"));
- UI_but_func_set(but, driver_add_var_cb, driver, NULL);
- /* copy/paste (as sub-row) */
- row = uiLayoutRow(row, true);
- block = uiLayoutGetBlock(row);
+ /* copy/paste (as sub-row) */
+ row = uiLayoutRow(row_outer, true);
+ block = uiLayoutGetBlock(row);
- uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_driver_variables_copy");
- uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_driver_variables_paste");
- }
+ uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_driver_variables_copy");
+ uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_driver_variables_paste");
/* loop over targets, drawing them */
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
@@ -1280,6 +1260,10 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *pa)
if (fcu && fcu->driver) {
ID *id = ptr.id.data;
+ PointerRNA ptr_fcurve;
+ RNA_pointer_create(id, &RNA_FCurve, fcu, &ptr_fcurve);
+ uiLayoutSetContextPointer(layout, "active_editable_fcurve", &ptr_fcurve);
+
/* Driven Property Settings */
uiItemL(layout, IFACE_("Driven Property:"), ICON_NONE);
graph_draw_driven_property_panel(pa->layout, id, fcu);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index b68efdc0ea0..dc5837e3fd1 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2995,29 +2995,15 @@ void GRAPH_OT_fmodifier_paste(wmOperatorType *ot)
static int graph_driver_vars_copy_exec(bContext *C, wmOperator *op)
{
- bAnimContext ac;
- bAnimListElem *ale;
bool ok = false;
- /* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0) {
- return OPERATOR_CANCELLED;
- }
-
- /* clear buffer first */
- ANIM_driver_vars_copybuf_free();
-
- /* get the active F-Curve */
- ale = get_active_fcurve_channel(&ac);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "active_editable_fcurve", &RNA_FCurve);
/* if this exists, call the copy driver vars API function */
- if (ale && ale->data) {
- FCurve *fcu = (FCurve *)ale->data;
+ FCurve *fcu = (FCurve *)ptr.data;
+ if (fcu) {
ok = ANIM_driver_vars_copy(op->reports, fcu);
-
- /* free temp data now */
- MEM_freeN(ale);
}
/* successful or not? */
@@ -3034,11 +3020,11 @@ void GRAPH_OT_driver_variables_copy(wmOperatorType *ot)
/* identifiers */
ot->name = "Copy Driver Variables";
ot->idname = "GRAPH_OT_driver_variables_copy";
- ot->description = "Copy the driver variables of the active F-Curve";
+ ot->description = "Copy the driver variables of the active driver";
/* api callbacks */
ot->exec = graph_driver_vars_copy_exec;
- ot->poll = graphop_active_fcurve_poll;
+ ot->poll = graphop_active_editable_fcurve_ctx_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3048,34 +3034,18 @@ void GRAPH_OT_driver_variables_copy(wmOperatorType *ot)
static int graph_driver_vars_paste_exec(bContext *C, wmOperator *op)
{
- bAnimContext ac;
-
- ListBase anim_data = {NULL, NULL};
- bAnimListElem *ale;
- int filter;
-
const bool replace = RNA_boolean_get(op->ptr, "replace");
bool ok = false;
- /* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0) {
- return OPERATOR_CANCELLED;
- }
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "active_editable_fcurve", &RNA_FCurve);
- /* filter data */
- filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT |
- ANIMFILTER_NODUPLIS);
- ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ /* if this exists, call the paste driver vars API function */
+ FCurve *fcu = (FCurve *)ptr.data;
- /* paste variables */
- for (ale = anim_data.first; ale; ale = ale->next) {
- FCurve *fcu = (FCurve *)ale->data;
- ok |= ANIM_driver_vars_paste(op->reports, fcu, replace);
+ if (fcu) {
+ ok = ANIM_driver_vars_paste(op->reports, fcu, replace);
}
- /* cleanup */
- ANIM_animdata_freelist(&anim_data);
-
/* successful or not? */
if (ok) {
/* rebuild depsgraph, now that there are extra deps here */
@@ -3100,7 +3070,7 @@ void GRAPH_OT_driver_variables_paste(wmOperatorType *ot)
/* api callbacks */
ot->exec = graph_driver_vars_paste_exec;
- ot->poll = graphop_active_fcurve_poll;
+ ot->poll = graphop_active_editable_fcurve_ctx_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index 6ec8e54dce9..168c38b66a4 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -168,6 +168,7 @@ struct bAnimListElem *get_active_fcurve_channel(struct bAnimContext *ac);
bool graphop_visible_keyframes_poll(struct bContext *C);
bool graphop_editable_keyframes_poll(struct bContext *C);
bool graphop_active_fcurve_poll(struct bContext *C);
+bool graphop_active_editable_fcurve_ctx_poll(struct bContext *C);
bool graphop_selected_fcurve_poll(struct bContext *C);
/* ***************************************** */
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index d582ac557fa..b95ab48189c 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -44,6 +44,8 @@
#include "ED_screen.h"
#include "UI_interface.h"
+#include "RNA_access.h"
+
#include "graph_intern.h" // own include
/* ************************************************************** */
@@ -278,6 +280,14 @@ bool graphop_active_fcurve_poll(bContext *C)
return has_fcurve;
}
+/* has active F-Curve in the context that's editable */
+bool graphop_active_editable_fcurve_ctx_poll(bContext *C)
+{
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "active_editable_fcurve", &RNA_FCurve);
+
+ return ptr.data != NULL;
+}
+
/* has selected F-Curve that's editable */
bool graphop_selected_fcurve_poll(bContext *C)
{
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index feff1dc5f4a..fed56f3d452 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -116,6 +116,12 @@ static void outliner_tree_dimensions(SpaceOutliner *soops, int *r_width, int *r_
static bool is_object_data_in_editmode(const ID *id, const Object *obact)
{
const short id_type = GS(id->name);
+
+ if (id_type == ID_GD && obact && obact->data == id) {
+ bGPdata *gpd = (bGPdata *)id;
+ return GPENCIL_EDIT_MODE(gpd);
+ }
+
return ((obact && (obact->mode & OB_MODE_EDIT)) && (id && OB_DATA_SUPPORT_EDITMODE(id_type)) &&
(GS(((ID *)obact->data)->name) == id_type) && BKE_object_data_is_in_editmode(id));
}
@@ -800,7 +806,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
BLI_uniquename(
&gpd->layers, gpl, "GP Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
- WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, gpd);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, gpd);
break;
}
case TSE_R_LAYER: {
@@ -2145,17 +2151,8 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
data.icon = ICON_GROUP;
break;
}
- /* Removed the icons from outliner.
- * Need a better structure with Layers, Palettes and Colors. */
case TSE_GP_LAYER: {
- /* indicate whether layer is active */
- bGPDlayer *gpl = te->directdata;
- if (gpl->flag & GP_LAYER_ACTIVE) {
- data.icon = ICON_GREASEPENCIL;
- }
- else {
- data.icon = ICON_DOT;
- }
+ data.icon = ICON_OUTLINER_DATA_GP_LAYER;
break;
}
default:
@@ -2635,12 +2632,16 @@ static void outliner_draw_iconrow(bContext *C,
active = tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NONE, false);
}
}
+ else if (tselem->type == TSE_GP_LAYER) {
+ bGPDlayer *gpl = te->directdata;
+ active = (gpl->flag & GP_LAYER_ACTIVE) ? OL_DRAWSEL_ACTIVE : OL_DRAWSEL_NONE;
+ }
else {
active = tree_element_type_active(
C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
}
- if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER)) {
+ if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER, TSE_GP_LAYER)) {
outliner_draw_iconrow_doit(block, te, fstyle, xmax, offsx, ys, alpha_fac, active, 1);
}
else {
@@ -2802,6 +2803,13 @@ static void outliner_draw_tree_element(bContext *C,
}
}
}
+ else if (tselem->type == TSE_GP_LAYER) {
+ /* Active grease pencil layer. */
+ if (((bGPDlayer *)te->directdata)->flag & GP_LAYER_ACTIVE) {
+ icon_bgcolor[3] = 0.2f;
+ active = OL_DRAWSEL_ACTIVE;
+ }
+ }
else {
active = tree_element_type_active(
C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
@@ -2895,7 +2903,7 @@ static void outliner_draw_tree_element(bContext *C,
}
offsx += UI_UNIT_X + 4 * ufac;
}
- else if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_STATIC_OVERRIDE(tselem->id)) {
+ else if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_OVERRIDE_LIBRARY(tselem->id)) {
UI_icon_draw_alpha((float)startx + offsx + 2 * ufac,
(float)*starty + 2 * ufac,
ICON_LIBRARY_DATA_OVERRIDE,
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 7e5638e48ea..d8057a0ea28 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -557,17 +557,17 @@ static void id_local_cb(bContext *C,
}
}
-static void id_static_override_cb(bContext *C,
- ReportList *UNUSED(reports),
- Scene *UNUSED(scene),
- TreeElement *UNUSED(te),
- TreeStoreElem *UNUSED(tsep),
- TreeStoreElem *tselem,
- void *UNUSED(user_data))
+static void id_override_library_cb(bContext *C,
+ ReportList *UNUSED(reports),
+ Scene *UNUSED(scene),
+ TreeElement *UNUSED(te),
+ TreeStoreElem *UNUSED(tsep),
+ TreeStoreElem *tselem,
+ void *UNUSED(user_data))
{
if (ID_IS_LINKED(tselem->id) && (tselem->id->tag & LIB_TAG_EXTERN)) {
Main *bmain = CTX_data_main(C);
- ID *override_id = BKE_override_static_create_from_id(bmain, tselem->id);
+ ID *override_id = BKE_override_library_create_from_id(bmain, tselem->id);
if (override_id != NULL) {
BKE_main_id_clear_newpoins(bmain);
}
@@ -1337,7 +1337,7 @@ typedef enum eOutlinerIdOpTypes {
OUTLINER_IDOP_UNLINK,
OUTLINER_IDOP_LOCAL,
- OUTLINER_IDOP_STATIC_OVERRIDE,
+ OUTLINER_IDOP_OVERRIDE_LIBRARY,
OUTLINER_IDOP_SINGLE,
OUTLINER_IDOP_DELETE,
OUTLINER_IDOP_REMAP,
@@ -1356,11 +1356,11 @@ typedef enum eOutlinerIdOpTypes {
static const EnumPropertyItem prop_id_op_types[] = {
{OUTLINER_IDOP_UNLINK, "UNLINK", 0, "Unlink", ""},
{OUTLINER_IDOP_LOCAL, "LOCAL", 0, "Make Local", ""},
- {OUTLINER_IDOP_STATIC_OVERRIDE,
- "STATIC_OVERRIDE",
+ {OUTLINER_IDOP_OVERRIDE_LIBRARY,
+ "OVERRIDE_LIBRARY",
0,
- "Add Static Override",
- "Add a local static override of this data-block"},
+ "Add Library Override",
+ "Add a local override of this linked data-block"},
{OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""},
{OUTLINER_IDOP_DELETE, "DELETE", ICON_X, "Delete", ""},
{OUTLINER_IDOP_REMAP,
@@ -1389,7 +1389,7 @@ static const EnumPropertyItem *outliner_id_operation_itemf(bContext *UNUSED(C),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- if (BKE_override_static_is_enabled()) {
+ if (BKE_override_library_is_enabled()) {
*r_free = false;
return prop_id_op_types;
}
@@ -1398,7 +1398,7 @@ static const EnumPropertyItem *outliner_id_operation_itemf(bContext *UNUSED(C),
int totitem = 0;
for (const EnumPropertyItem *it = prop_id_op_types; it->identifier != NULL; it++) {
- if (it->value == OUTLINER_IDOP_STATIC_OVERRIDE) {
+ if (it->value == OUTLINER_IDOP_OVERRIDE_LIBRARY) {
continue;
}
RNA_enum_item_add(&items, &totitem, it);
@@ -1485,11 +1485,11 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
ED_undo_push(C, "Localized Data");
break;
}
- case OUTLINER_IDOP_STATIC_OVERRIDE: {
- if (BKE_override_static_is_enabled()) {
+ case OUTLINER_IDOP_OVERRIDE_LIBRARY: {
+ if (BKE_override_library_is_enabled()) {
/* make local */
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, id_static_override_cb, NULL);
+ C, op->reports, scene, soops, &soops->tree, id_override_library_cb, NULL);
ED_undo_push(C, "Overridden Data");
}
break;
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 5510b981899..c3e683b5f59 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -3439,10 +3439,6 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- for (iseq = nseqbase.first; iseq; iseq = iseq->next) {
- BKE_sequence_sound_init(scene, iseq);
- }
-
iseq_first = nseqbase.first;
BLI_movelisttolist(ed->seqbasep, &nseqbase);
@@ -3459,6 +3455,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
}
}
+ DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index cc76c151a29..38e8d285c77 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -50,14 +50,6 @@
#include "view3d_intern.h" /* bad level include */
-int view3d_effective_drawtype(const struct View3D *v3d)
-{
- if (v3d->shading.type == OB_RENDER) {
- return v3d->shading.prev_type;
- }
- return v3d->shading.type;
-}
-
/* OpenGL Circle Drawing - Tables for Optimized Drawing Speed */
/* 32 values of sin function (still same result!) */
#define CIRCLE_RESOL 32
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 755852a2e18..dd97a023825 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -771,14 +771,9 @@ void ED_view3d_datamask(const bContext *C,
const View3D *v3d,
CustomData_MeshMasks *r_cddata_masks)
{
- const int drawtype = view3d_effective_drawtype(v3d);
-
- if (ELEM(drawtype, OB_TEXTURE, OB_MATERIAL)) {
+ if (ELEM(v3d->shading.type, OB_TEXTURE, OB_MATERIAL, OB_RENDER)) {
r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
-
- if (drawtype == OB_MATERIAL) {
- r_cddata_masks->vmask |= CD_MASK_ORCO;
- }
+ r_cddata_masks->vmask |= CD_MASK_ORCO;
}
if ((CTX_data_mode_enum(C) == CTX_MODE_EDIT_MESH) &&
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 1ee572211c0..6e12091cf75 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -5204,7 +5204,7 @@ static int toggle_xray_exec(bContext *C, wmOperator *op)
ELEM(v3d->shading.type, OB_WIRE, OB_SOLID));
if (v3d->shading.type == OB_WIRE) {
- v3d->shading.flag ^= V3D_SHADING_XRAY_BONE;
+ v3d->shading.flag ^= V3D_SHADING_XRAY_WIREFRAME;
}
else {
v3d->shading.flag ^= V3D_SHADING_XRAY;
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index e499672acc1..3a6825aacb4 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -126,9 +126,6 @@ void VIEW3D_OT_fly(struct wmOperatorType *ot);
/* view3d_walk.c */
void VIEW3D_OT_walk(struct wmOperatorType *ot);
-/* drawobject.c */
-int view3d_effective_drawtype(const struct View3D *v3d);
-
/* view3d_draw.c */
void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar);
void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 6d741d39aae..c1b5b553c21 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -101,11 +101,190 @@
#include "GPU_glew.h"
#include "GPU_matrix.h"
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
+#include "DRW_engine.h"
+
#include "view3d_intern.h" /* own include */
// #include "PIL_time_utildefines.h"
/* -------------------------------------------------------------------- */
+/** \name Selection Utilities
+ * \{ */
+
+struct EDBaseOffset {
+ /* For convenience only. */
+ union {
+ uint offset;
+ uint face_start;
+ };
+ union {
+ uint face;
+ uint edge_start;
+ };
+ union {
+ uint edge;
+ uint vert_start;
+ };
+ uint vert;
+};
+
+struct EDSelectID_Context {
+ struct EDBaseOffset *base_array_index_offsets;
+ /** Borrow from caller (not freed). */
+ struct Base **bases;
+ uint bases_len;
+ /** Total number of items `base_array_index_offsets[bases_len - 1].vert`. */
+ uint base_array_index_len;
+};
+
+static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt)
+{
+ if (select_mode & SCE_SELECT_FACE) {
+ if ((dt < OB_SOLID) || XRAY_FLAG_ENABLED(v3d)) {
+ return true;
+ }
+ if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) {
+ return true;
+ }
+ if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGES) == 0) {
+ /* Since we can't deduce face selection when edges aren't visible - show dots. */
+ return true;
+ }
+ }
+ return false;
+}
+
+static void ed_select_id_draw_bases(struct EDSelectID_Context *sel_id_ctx,
+ ViewContext *vc,
+ short select_mode)
+{
+ Scene *scene_eval = (Scene *)DEG_get_evaluated_id(vc->depsgraph, &vc->scene->id);
+ DRW_framebuffer_select_id_setup(vc->ar, true);
+
+ uint offset = 1;
+ for (uint base_index = 0; base_index < sel_id_ctx->bases_len; base_index++) {
+ Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph,
+ sel_id_ctx->bases[base_index]->object);
+
+ struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
+ bool draw_facedot = check_ob_drawface_dot(select_mode, vc->v3d, ob_eval->dt);
+
+ DRW_draw_select_id_object(scene_eval,
+ vc->rv3d,
+ ob_eval,
+ select_mode,
+ draw_facedot,
+ offset,
+ &base_ofs->vert,
+ &base_ofs->edge,
+ &base_ofs->face);
+
+ base_ofs->offset = offset;
+ offset = base_ofs->vert;
+ }
+
+ sel_id_ctx->base_array_index_len = offset;
+
+ DRW_framebuffer_select_id_release(vc->ar);
+}
+
+uint ED_view3d_select_id_context_offset_for_object_elem(
+ const struct EDSelectID_Context *sel_id_ctx, int base_index, char elem_type)
+{
+ struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
+ if (elem_type == SCE_SELECT_VERTEX) {
+ return base_ofs->vert_start - 1;
+ }
+ if (elem_type == SCE_SELECT_EDGE) {
+ return base_ofs->edge_start - 1;
+ }
+ if (elem_type == SCE_SELECT_FACE) {
+ return base_ofs->face_start - 1;
+ }
+ BLI_assert(0);
+ return 0;
+}
+
+uint ED_view3d_select_id_context_elem_len(const struct EDSelectID_Context *sel_id_ctx)
+{
+ return sel_id_ctx->base_array_index_len;
+}
+
+struct EDSelectID_Context *ED_view3d_select_id_context_create(ViewContext *vc,
+ Base **bases,
+ const uint bases_len,
+ short select_mode)
+{
+ struct EDSelectID_Context *sel_id_ctx = MEM_mallocN(sizeof(*sel_id_ctx), __func__);
+ sel_id_ctx->base_array_index_offsets = MEM_mallocN(sizeof(struct EDBaseOffset) * bases_len,
+ __func__);
+ sel_id_ctx->bases = bases;
+ sel_id_ctx->bases_len = bases_len;
+
+ ed_select_id_draw_bases(sel_id_ctx, vc, select_mode);
+
+ return sel_id_ctx;
+}
+
+void ED_view3d_select_id_context_destroy(struct EDSelectID_Context *sel_id_ctx)
+{
+ MEM_freeN(sel_id_ctx->base_array_index_offsets);
+ MEM_freeN(sel_id_ctx);
+}
+
+bool ED_view3d_select_id_elem_get(struct EDSelectID_Context *sel_id_ctx,
+ const uint sel_id,
+ uint *r_elem,
+ uint *r_base_index,
+ char *r_elem_type)
+{
+ char elem_type = 0;
+ uint elem_id;
+ uint base_index = 0;
+
+ while (true) {
+ struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
+ if (base_ofs->face > sel_id) {
+ elem_id = sel_id - base_ofs->face_start;
+ elem_type = SCE_SELECT_FACE;
+ break;
+ }
+ if (base_ofs->edge > sel_id) {
+ elem_id = sel_id - base_ofs->edge_start;
+ elem_type = SCE_SELECT_EDGE;
+ break;
+ }
+ if (base_ofs->vert > sel_id) {
+ elem_id = sel_id - base_ofs->vert_start;
+ elem_type = SCE_SELECT_VERTEX;
+ break;
+ }
+
+ base_index++;
+ if (base_index >= sel_id_ctx->bases_len) {
+ return false;
+ }
+ }
+
+ *r_elem = elem_id;
+
+ if (r_base_index) {
+ *r_base_index = base_index;
+ }
+
+ if (r_elem_type) {
+ *r_elem_type = elem_type;
+ }
+
+ return true;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Public Utilities
* \{ */
@@ -194,7 +373,7 @@ static bool object_deselect_all_except(ViewLayer *view_layer, Base *b)
struct EditSelectBuf_Cache {
Base **bases;
uint bases_len;
- struct EDBMSelectID_Context *sel_id_ctx;
+ struct EDSelectID_Context *sel_id_ctx;
BLI_bitmap *select_bitmap;
};
@@ -216,7 +395,7 @@ static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewCont
esel->bases_len = 0;
}
}
- esel->sel_id_ctx = EDBM_select_id_context_create(
+ esel->sel_id_ctx = ED_view3d_select_id_context_create(
vc, esel->bases, esel->bases_len, vc->scene->toolsettings->selectmode);
for (int i = 0; i < esel->bases_len; i++) {
esel->bases[i]->object->runtime.select_id = i;
@@ -226,7 +405,7 @@ static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewCont
static void editselect_buf_cache_free(struct EditSelectBuf_Cache *esel)
{
if (esel->sel_id_ctx) {
- EDBM_select_id_context_destroy(esel->sel_id_ctx);
+ ED_view3d_select_id_context_destroy(esel->sel_id_ctx);
}
MEM_SAFE_FREE(esel->select_bitmap);
MEM_SAFE_FREE(esel->bases);
@@ -264,8 +443,8 @@ static bool edbm_backbuf_check_and_select_verts(struct EditSelectBuf_Cache *esel
bool changed = false;
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- uint index = EDBM_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx, ob->runtime.select_id, BM_VERT);
+ uint index = ED_view3d_select_id_context_offset_for_object_elem(
+ esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_VERTEX);
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
@@ -292,8 +471,8 @@ static bool edbm_backbuf_check_and_select_edges(struct EditSelectBuf_Cache *esel
bool changed = false;
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- uint index = EDBM_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx, ob->runtime.select_id, BM_EDGE);
+ uint index = ED_view3d_select_id_context_offset_for_object_elem(
+ esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_EDGE);
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
@@ -320,8 +499,8 @@ static bool edbm_backbuf_check_and_select_faces(struct EditSelectBuf_Cache *esel
bool changed = false;
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- uint index = EDBM_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx, ob->runtime.select_id, BM_FACE);
+ uint index = ED_view3d_select_id_context_offset_for_object_elem(
+ esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_FACE);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
@@ -826,7 +1005,7 @@ static bool do_lasso_select_mesh(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
}
}
@@ -845,10 +1024,11 @@ static bool do_lasso_select_mesh(ViewContext *vc,
struct LassoSelectUserData_ForMeshEdge data_for_edge = {
.data = &data,
.esel = use_zbuf ? esel : NULL,
- .backbuf_offset = use_zbuf ?
- EDBM_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx, vc->obedit->runtime.select_id, BM_EDGE) :
- 0,
+ .backbuf_offset = use_zbuf ? ED_view3d_select_id_context_offset_for_object_elem(
+ esel->sel_id_ctx,
+ vc->obedit->runtime.select_id,
+ SCE_SELECT_EDGE) :
+ 0,
};
mesh_foreachScreenEdge(
vc, do_lasso_select_mesh__doSelectEdge_pass0, &data_for_edge, V3D_PROJ_TEST_CLIP_NEAR);
@@ -1135,7 +1315,7 @@ static bool do_lasso_select_paintvert(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
}
}
@@ -1194,7 +1374,7 @@ static bool do_lasso_select_paintface(ViewContext *vc,
if (esel == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
}
@@ -2500,7 +2680,7 @@ static bool do_paintvert_box_select(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
}
if (esel->select_bitmap != NULL) {
@@ -2555,7 +2735,7 @@ static bool do_paintface_box_select(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
}
if (esel->select_bitmap != NULL) {
@@ -2753,7 +2933,7 @@ static bool do_mesh_box_select(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
}
}
@@ -2772,10 +2952,11 @@ static bool do_mesh_box_select(ViewContext *vc,
struct BoxSelectUserData_ForMeshEdge cb_data = {
.data = &data,
.esel = use_zbuf ? esel : NULL,
- .backbuf_offset = use_zbuf ?
- EDBM_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx, vc->obedit->runtime.select_id, BM_EDGE) :
- 0,
+ .backbuf_offset = use_zbuf ? ED_view3d_select_id_context_offset_for_object_elem(
+ esel->sel_id_ctx,
+ vc->obedit->runtime.select_id,
+ SCE_SELECT_EDGE) :
+ 0,
};
mesh_foreachScreenEdge(
vc, do_mesh_box_select__doSelectEdge_pass0, &cb_data, V3D_PROJ_TEST_CLIP_NEAR);
@@ -3339,7 +3520,7 @@ static bool mesh_circle_select(ViewContext *vc,
struct EditSelectBuf_Cache *esel = wm_userdata->data;
if (use_zbuf) {
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f));
}
@@ -3416,7 +3597,7 @@ static bool paint_facesel_circle_select(ViewContext *vc,
{
struct EditSelectBuf_Cache *esel = wm_userdata->data;
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f));
if (esel->select_bitmap != NULL) {
changed |= edbm_backbuf_check_and_select_faces_obmode(me, esel, sel_op);
@@ -3471,7 +3652,7 @@ static bool paint_vertsel_circle_select(ViewContext *vc,
if (use_zbuf) {
struct EditSelectBuf_Cache *esel = wm_userdata->data;
- const uint buffer_len = EDBM_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f));
if (esel->select_bitmap != NULL) {
changed |= edbm_backbuf_check_and_select_verts_obmode(me, esel, sel_op);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 9019b21997f..5b3f7d85b43 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -4784,7 +4784,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
static void storeCustomLNorValue(TransDataContainer *tc, BMesh *bm)
{
- BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm);
+ BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false);
// BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata;
tc->custom.mode.data = lnors_ed_arr;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 2dad3aef320..a9acdcd001c 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1835,7 +1835,12 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail)
}
else if (td_near) {
float dist;
- dist = len_v3v3(td_near->center, td->center);
+ float vec[3];
+
+ sub_v3_v3v3(vec, td_near->center, td->center);
+ mul_m3_v3(head->mtx, vec);
+ dist = len_v3(vec);
+
if (dist < (td - 1)->dist) {
td->dist = (td - 1)->dist;
}
@@ -1856,7 +1861,12 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail)
}
else if (td_near) {
float dist;
- dist = len_v3v3(td_near->center, td->center);
+ float vec[3];
+
+ sub_v3_v3v3(vec, td_near->center, td->center);
+ mul_m3_v3(head->mtx, vec);
+ dist = len_v3(vec);
+
if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td + 1)->dist < td->dist) {
td->flag &= ~TD_NOTCONNECTED;
if (dist < (td + 1)->dist) {
@@ -2414,8 +2424,8 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
ParticleSystemModifierData *psmd_eval = edit->psmd_eval;
- psys_mat_hair_to_global(
- ob, psmd_eval->mesh_final, psys->part->from, psys->particles + i, mat);
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+ psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + i, mat);
}
for (k = 0, key = point->keys; k < point->totkey; k++, key++) {
@@ -2506,8 +2516,8 @@ void flushTransParticles(TransInfo *t)
if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
ParticleSystemModifierData *psmd_eval = edit->psmd_eval;
- psys_mat_hair_to_global(
- ob, psmd_eval->mesh_final, psys->part->from, psys->particles + i, mat);
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval);
+ psys_mat_hair_to_global(ob, mesh_final, psys->part->from, psys->particles + i, mat);
invert_m4_m4(imat, mat);
for (k = 0, key = point->keys; k < point->totkey; k++, key++) {