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-07-16 14:36:44 +0300
committerYimingWu <xp8110@outlook.com>2019-07-16 14:36:44 +0300
commitcb17dba738afbb7f9fdec67180444e8df6557658 (patch)
tree620a4da674d68598783aefff3818f686e58a5ef7 /source/blender/editors
parent9a0c100e6c95bdcd87e6c2858891ea822696b5e4 (diff)
parent575fff2209f6cb7b9d9ed393c8a5b18d6428814a (diff)
Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c58
-rw-r--r--source/blender/editors/gpencil/gpencil_interpolate.c5
-rw-r--r--source/blender/editors/interface/interface_handlers.c14
-rw-r--r--source/blender/editors/interface/interface_region_popover.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c4
-rw-r--r--source/blender/editors/physics/particle_edit.c7
-rw-r--r--source/blender/editors/space_image/image_draw.c5
-rw-r--r--source/blender/editors/space_node/node_edit.c1
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c51
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c1
-rw-r--r--source/blender/editors/transform/transform_conversions.c7
11 files changed, 109 insertions, 48 deletions
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 2ebd64a15f9..47ebf2e01a5 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1521,8 +1521,10 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
/* first lock all colors */
for (short i = 0; i < *totcol; i++) {
Material *tmp_ma = give_current_material(ob, i + 1);
- tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
- DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
+ if (tmp_ma) {
+ tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
+ DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
/* loop all selected strokes and unlock any color */
@@ -2433,10 +2435,12 @@ static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
- gp_style = ma->gp_style;
- gp_style->flag |= GP_STYLE_COLOR_LOCKED;
- gp_style->flag |= GP_STYLE_COLOR_HIDE;
- DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ if (ma) {
+ gp_style = ma->gp_style;
+ gp_style->flag |= GP_STYLE_COLOR_LOCKED;
+ gp_style->flag |= GP_STYLE_COLOR_HIDE;
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
/* loop all selected strokes and unlock any color used in active layer */
@@ -2515,7 +2519,7 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
/* Skip if this is the active one */
- if (ma == active_ma) {
+ if ((ma == NULL) || (ma == active_ma)) {
continue;
}
@@ -2534,6 +2538,9 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
/* Set flags on all "other" colors */
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
+ if (ma == NULL) {
+ continue;
+ }
gp_style = ma->gp_style;
if (gp_style == active_color) {
continue;
@@ -2548,6 +2555,9 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
/* Clear flags - Restore everything else */
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
+ if (ma == NULL) {
+ continue;
+ }
gp_style = ma->gp_style;
gp_style->flag &= ~flags;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
@@ -2610,10 +2620,12 @@ static int gpencil_color_hide_exec(bContext *C, wmOperator *op)
MaterialGPencilStyle *color = NULL;
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
- color = ma->gp_style;
- if (active_color != color) {
- color->flag |= GP_STYLE_COLOR_HIDE;
- DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ if (ma) {
+ color = ma->gp_style;
+ if (active_color != color) {
+ color->flag |= GP_STYLE_COLOR_HIDE;
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
}
}
@@ -2671,9 +2683,11 @@ static int gpencil_color_reveal_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
- gp_style = ma->gp_style;
- gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
- DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ if (ma) {
+ gp_style = ma->gp_style;
+ gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
/* updates */
@@ -2722,9 +2736,11 @@ static int gpencil_color_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
- gp_style = ma->gp_style;
- gp_style->flag |= GP_STYLE_COLOR_LOCKED;
- DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ if (ma) {
+ gp_style = ma->gp_style;
+ gp_style->flag |= GP_STYLE_COLOR_LOCKED;
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
/* updates */
@@ -2773,9 +2789,11 @@ static int gpencil_color_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
- gp_style = ma->gp_style;
- gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
- DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ if (ma) {
+ gp_style = ma->gp_style;
+ gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
/* updates */
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 8a9f7c1224a..4d5548dcdf3 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -996,8 +996,9 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op)
float factor;
/* get interpolation factor */
- factor = (float)(cframe - prevFrame->framenum) /
- (nextFrame->framenum - prevFrame->framenum + 1);
+ float framerange = nextFrame->framenum - prevFrame->framenum;
+ CLAMP_MIN(framerange, 1.0f);
+ factor = (float)(cframe - prevFrame->framenum) / framerange;
if (ipo_settings->type == GP_IPO_CURVEMAP) {
/* custom curvemap */
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 0666f0e491e..a7fc0cfec25 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -758,9 +758,17 @@ static void ui_apply_but_undo(uiBut *but)
/* Optionally override undo when undo system doesn't support storing properties. */
if (but->rnapoin.id.data) {
- ID *id = but->rnapoin.id.data;
- if (!ED_undo_is_legacy_compatible_for_property(but->block->evil_C, id)) {
- str = "";
+ /* Exception for renaming ID data, we always need undo pushes in this case,
+ * because undo systems track data by their ID, see: T67002. */
+ extern PropertyRNA rna_ID_name;
+ if (but->rnaprop == &rna_ID_name) {
+ /* pass */
+ }
+ else {
+ ID *id = but->rnapoin.id.data;
+ if (!ED_undo_is_legacy_compatible_for_property(but->block->evil_C, id)) {
+ str = "";
+ }
}
}
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index 22c62ecd6f7..53c96fb72a7 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -355,7 +355,7 @@ uiPopover *UI_popover_begin(bContext *C, int ui_size_x)
}
pup->ui_size_x = ui_size_x;
- /* Opertor context default same as menus, change if needed. */
+ /* Operator context default same as menus, change if needed. */
ui_popover_create_block(C, pup, WM_OP_EXEC_REGION_WIN);
/* create in advance so we can let buttons point to retval already */
@@ -404,7 +404,7 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap)
/* TODO(campbell): we may want to make this configurable.
* The begin/end stype of calling popups doesn't allow to 'can_refresh' to be set.
- * For now close this style of popvers when accessed. */
+ * For now close this style of popovers when accessed. */
UI_block_flag_disable(pup->block, UI_BLOCK_KEEP_OPEN);
/* panels are created flipped (from event handling pov) */
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 6f0319223e0..a46dbffbcdd 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -7419,7 +7419,7 @@ void MESH_OT_symmetry_snap(struct wmOperatorType *ot)
//#ifdef WITH_FREESTYLE
/* -------------------------------------------------------------------- */
-/** \name Mark Edge (FreeStyle) Operator
+/** \name Mark Edge (Freestyle) Operator
* \{ */
static int edbm_mark_freestyle_edge_exec(bContext *C, wmOperator *op)
@@ -7499,7 +7499,7 @@ void MESH_OT_mark_freestyle_edge(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Mark Face (FreeStyle) Operator
+/** \name Mark Face (Freestyle) Operator
* \{ */
static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 4a55cb6c5c6..4e6022cf18c 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -337,10 +337,13 @@ static PTCacheEdit *pe_get_current(Depsgraph *depsgraph, Scene *scene, Object *o
}
}
- if (edit) {
+ /* Don't consider inactive or render dependency graphs, since they might be evaluated for a
+ * different number of childrem. or have different pointer to evaluated particle system or
+ * modifier which will also cause troubles. */
+ if (edit && DEG_is_active(depsgraph)) {
edit->pid = *pid;
if (edit->flags & PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL) {
- if (edit->psys != NULL) {
+ if (edit->psys != NULL && edit->psys_eval != NULL) {
psys_copy_particles(edit->psys, edit->psys_eval);
pe_update_hair_particle_edit_pointers(edit);
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 86db6d50fcc..97a3c7f2480 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -797,6 +797,11 @@ void draw_image_main(const bContext *C, ARegion *ar)
ima = ED_space_image(sima);
ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ /* Tag image as in active use for garbage collector. */
+ if (ima) {
+ BKE_image_tag_time(ima);
+ }
+
show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0;
show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0;
show_paint = (ima && (sima->mode == SI_MODE_PAINT) && (show_viewer == false) &&
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 08768df9d1d..d31256a1425 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -210,6 +210,7 @@ static void compo_initjob(void *cjv)
/* NOTE: Don't update animation to preserve unkeyed changes, this means can not use
* evaluate_on_framechange. */
+ DEG_graph_flush_update(bmain, cj->compositor_depsgraph);
DEG_evaluate_on_refresh(cj->compositor_depsgraph);
bNodeTree *ntree_eval = (bNodeTree *)DEG_get_evaluated_id(cj->compositor_depsgraph,
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index a618f8ef4c2..89eb3b9d953 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -109,8 +109,9 @@ static void set_operation_types(SpaceOutliner *soops,
}
}
else {
- int idcode = GS(tselem->id->name);
- switch (idcode) {
+ const int idcode = (int)GS(tselem->id->name);
+ bool is_standard_id = false;
+ switch ((ID_Type)idcode) {
case ID_SCE:
*scenelevel = 1;
break;
@@ -134,21 +135,47 @@ static void set_operation_types(SpaceOutliner *soops,
case ID_KE:
case ID_WO:
case ID_AC:
- case ID_NLA:
case ID_TXT:
case ID_GR:
case ID_LS:
case ID_LI:
- if (*idlevel == 0) {
- *idlevel = idcode;
- }
- else if (*idlevel != idcode) {
- *idlevel = -1;
- }
- if (ELEM(*datalevel, TSE_VIEW_COLLECTION_BASE, TSE_SCENE_COLLECTION_BASE)) {
- *datalevel = 0;
- }
+ case ID_VF:
+ case ID_NT:
+ case ID_BR:
+ case ID_PA:
+ case ID_GD:
+ case ID_MC:
+ case ID_MSK:
+ case ID_PAL:
+ case ID_PC:
+ case ID_CF:
+ case ID_WS:
+ case ID_LP:
+ is_standard_id = true;
break;
+ case ID_WM:
+ case ID_SCR:
+ /* Those are ignored here. */
+ /* Note: while Screens should be manageable here, deleting a screen used by a workspace
+ * will cause crashes when trying to use that workspace, so for now let's play minimal,
+ * safe change. */
+ break;
+ }
+ if (idcode == ID_NLA) {
+ /* Fake one, not an actual ID type... */
+ is_standard_id = true;
+ }
+
+ if (is_standard_id) {
+ if (*idlevel == 0) {
+ *idlevel = idcode;
+ }
+ else if (*idlevel != idcode) {
+ *idlevel = -1;
+ }
+ if (ELEM(*datalevel, TSE_VIEW_COLLECTION_BASE, TSE_SCENE_COLLECTION_BASE)) {
+ *datalevel = 0;
+ }
}
}
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index fd7cc3d2ba2..0df5652c539 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -2319,6 +2319,7 @@ static bool ed_object_select_pick(bContext *C,
retval = true;
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
/* in weightpaint, we use selected bone to select vertexgroup,
* so no switch to new active object */
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index be7ea752fec..f7158244cc7 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1289,7 +1289,6 @@ static void createTransPose(TransInfo *t)
bPose *pose = ob->pose;
bArmature *arm;
- short ik_on = 0;
/* check validity of state */
arm = BKE_armature_from_object(tc->poseobj);
@@ -1315,8 +1314,7 @@ static void createTransPose(TransInfo *t)
/* do we need to add temporal IK chains? */
if ((pose->flag & POSE_AUTO_IK) && t->mode == TFM_TRANSLATION) {
- ik_on = pose_grab_with_ik(bmain, ob);
- if (ik_on) {
+ if (pose_grab_with_ik(bmain, ob)) {
t->flag |= T_AUTOIK;
has_translate_rotate[0] = true;
}
@@ -1359,7 +1357,6 @@ static void createTransPose(TransInfo *t)
Object *ob = tc->poseobj;
TransData *td;
TransDataExtension *tdx;
- short ik_on = 0;
int i;
PoseInitData_Mirror *pid = tc->custom.type.data;
@@ -1407,7 +1404,7 @@ static void createTransPose(TransInfo *t)
}
/* initialize initial auto=ik chainlen's? */
- if (ik_on) {
+ if (t->flag & T_AUTOIK) {
transform_autoik_update(t, 0);
}
}