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:
authorCampbell Barton <ideasman42@gmail.com>2021-02-11 04:34:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-02-11 04:34:41 +0300
commit52cfc620c8cc3125282d8dd66df312ffb576569c (patch)
tree2a8a44c61a76de8289dfbe603127b00576ad0407
parent2d252b6d26f90f81f2a2dc7a3031c407dc8a643c (diff)
Fix T83013: Annotation with hidden object in sculpt mode crashes
This just avoids the crash, the annotation tool still doesn't work. Larger changes will be needed to resolve this, see T85532.
-rw-r--r--source/blender/editors/include/ED_sculpt.h6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_transform.c9
-rw-r--r--source/blender/editors/transform/transform_convert.c2
-rw-r--r--source/blender/editors/transform/transform_convert.h2
-rw-r--r--source/blender/editors/transform/transform_convert_gpencil.c2
-rw-r--r--source/blender/editors/transform/transform_convert_particle.c4
-rw-r--r--source/blender/editors/transform/transform_convert_sculpt.c10
7 files changed, 17 insertions, 18 deletions
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index 1175d08399e..348ea503372 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -43,9 +43,9 @@ bool ED_sculpt_mask_box_select(struct bContext *C,
bool select);
/* transform */
-void ED_sculpt_update_modal_transform(struct bContext *C);
-void ED_sculpt_init_transform(struct bContext *C);
-void ED_sculpt_end_transform(struct bContext *C);
+void ED_sculpt_update_modal_transform(struct bContext *C, struct Object *ob);
+void ED_sculpt_init_transform(struct bContext *C, struct Object *ob);
+void ED_sculpt_end_transform(struct bContext *C, struct Object *ob);
/* sculpt_undo.c */
void ED_sculpt_undosys_type(struct UndoType *ut);
diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.c b/source/blender/editors/sculpt_paint/sculpt_transform.c
index da8204fd57c..4554ea178ab 100644
--- a/source/blender/editors/sculpt_paint/sculpt_transform.c
+++ b/source/blender/editors/sculpt_paint/sculpt_transform.c
@@ -60,10 +60,9 @@
#include <math.h>
#include <stdlib.h>
-void ED_sculpt_init_transform(struct bContext *C)
+void ED_sculpt_init_transform(struct bContext *C, Object *ob)
{
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
@@ -220,10 +219,9 @@ static void sculpt_transform_all_vertices(Sculpt *sd, Object *ob)
0, ss->filter_cache->totnode, &data, sculpt_transform_task_cb, &settings);
}
-void ED_sculpt_update_modal_transform(struct bContext *C)
+void ED_sculpt_update_modal_transform(struct bContext *C, Object *ob)
{
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
@@ -243,9 +241,8 @@ void ED_sculpt_update_modal_transform(struct bContext *C)
SCULPT_flush_update_step(C, SCULPT_UPDATE_COORDS);
}
-void ED_sculpt_end_transform(struct bContext *C)
+void ED_sculpt_end_transform(struct bContext *C, Object *ob)
{
- Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
if (ss->filter_cache) {
SCULPT_filter_cache_free(ss);
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c
index fb365da6b43..3ea0b0a0a70 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -1246,7 +1246,7 @@ void createTransData(bContext *C, TransInfo *t)
init_prop_edit = false;
break;
case TC_PARTICLE_VERTS:
- createTransParticleVerts(C, t);
+ createTransParticleVerts(t);
break;
case TC_SCULPT:
createTransSculpt(C, t);
diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h
index be4322b42e2..466bfd6b226 100644
--- a/source/blender/editors/transform/transform_convert.h
+++ b/source/blender/editors/transform/transform_convert.h
@@ -224,7 +224,7 @@ void createTransPaintCurveVerts(bContext *C, TransInfo *t);
void flushTransPaintCurve(TransInfo *t);
/* transform_convert_particle.c */
-void createTransParticleVerts(bContext *C, TransInfo *t);
+void createTransParticleVerts(TransInfo *t);
void recalcData_particles(TransInfo *t);
/* transform_convert_sculpt.c */
diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c
index 0a742ec4470..deb18b50a22 100644
--- a/source/blender/editors/transform/transform_convert_gpencil.c
+++ b/source/blender/editors/transform/transform_convert_gpencil.c
@@ -688,7 +688,7 @@ void createTransGPencil(bContext *C, TransInfo *t)
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
const Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
- Object *obact = CTX_data_active_object(C);
+ Object *obact = OBACT(t->view_layer);
bGPdata *gpd = obact->data;
BLI_assert(gpd != NULL);
diff --git a/source/blender/editors/transform/transform_convert_particle.c b/source/blender/editors/transform/transform_convert_particle.c
index fbe9c07ebe9..6366eff2f4c 100644
--- a/source/blender/editors/transform/transform_convert_particle.c
+++ b/source/blender/editors/transform/transform_convert_particle.c
@@ -45,13 +45,13 @@
*
* \{ */
-void createTransParticleVerts(bContext *C, TransInfo *t)
+void createTransParticleVerts(TransInfo *t)
{
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = NULL;
TransDataExtension *tx;
- Object *ob = CTX_data_active_object(C);
+ Object *ob = OBACT(t->view_layer);
ParticleEditSettings *pset = PE_settings(t->scene);
PTCacheEdit *edit = PE_get_current(t->depsgraph, t->scene, ob);
ParticleSystem *psys = NULL;
diff --git a/source/blender/editors/transform/transform_convert_sculpt.c b/source/blender/editors/transform/transform_convert_sculpt.c
index 0ac6bd9264f..70fec49d77d 100644
--- a/source/blender/editors/transform/transform_convert_sculpt.c
+++ b/source/blender/editors/transform/transform_convert_sculpt.c
@@ -49,7 +49,7 @@ void createTransSculpt(bContext *C, TransInfo *t)
return;
}
- Object *ob = CTX_data_active_object(t->context);
+ Object *ob = OBACT(t->view_layer);
SculptSession *ss = ob->sculpt;
{
@@ -101,7 +101,7 @@ void createTransSculpt(bContext *C, TransInfo *t)
copy_m3_m4(td->axismtx, ob->obmat);
BLI_assert(!(t->options & CTX_PAINT_CURVE));
- ED_sculpt_init_transform(C);
+ ED_sculpt_init_transform(C, ob);
}
/** \} */
@@ -113,7 +113,8 @@ void createTransSculpt(bContext *C, TransInfo *t)
void recalcData_sculpt(TransInfo *t)
{
- ED_sculpt_update_modal_transform(t->context);
+ Object *ob = OBACT(t->view_layer);
+ ED_sculpt_update_modal_transform(t->context, ob);
}
void special_aftertrans_update__sculpt(bContext *C, TransInfo *t)
@@ -124,8 +125,9 @@ void special_aftertrans_update__sculpt(bContext *C, TransInfo *t)
return;
}
+ Object *ob = OBACT(t->view_layer);
BLI_assert(!(t->options & CTX_PAINT_CURVE));
- ED_sculpt_end_transform(C);
+ ED_sculpt_end_transform(C, ob);
}
/** \} */