diff options
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r-- | source/blender/editors/util/CMakeLists.txt | 3 | ||||
-rw-r--r-- | source/blender/editors/util/ed_transverts.c | 5 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 48 | ||||
-rw-r--r-- | source/blender/editors/util/editmode_undo.c | 5 | ||||
-rw-r--r-- | source/blender/editors/util/undo.c | 13 |
5 files changed, 49 insertions, 25 deletions
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index c0b30f93939..71a3322cb50 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -24,6 +24,7 @@ set(INC ../../blenlib ../../blentranslation ../../bmesh + ../../depsgraph ../../imbuf ../../gpu ../../makesdna @@ -64,6 +65,7 @@ set(SRC ../include/ED_lattice.h ../include/ED_logic.h ../include/ED_markers.h + ../include/ED_manipulator_library.h ../include/ED_mask.h ../include/ED_mball.h ../include/ED_mesh.h @@ -75,6 +77,7 @@ set(SRC ../include/ED_particle.h ../include/ED_physics.h ../include/ED_render.h + ../include/ED_scene.h ../include/ED_screen.h ../include/ED_screen_types.h ../include/ED_sculpt.h diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c index b0970cdfd48..872810c5cf2 100644 --- a/source/blender/editors/util/ed_transverts.c +++ b/source/blender/editors/util/ed_transverts.c @@ -39,12 +39,13 @@ #include "BLI_math.h" #include "BKE_curve.h" -#include "BKE_depsgraph.h" #include "BKE_lattice.h" #include "BKE_editmesh.h" #include "BKE_DerivedMesh.h" #include "BKE_context.h" +#include "DEG_depsgraph.h" + #include "ED_armature.h" #include "ED_transverts.h" /* own include */ @@ -56,7 +57,7 @@ void ED_transverts_update_obedit(TransVertStore *tvs, Object *obedit) const int mode = tvs->mode; BLI_assert(ED_transverts_check_obedit(obedit) == true); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); if (obedit->type == OB_MESH) { BMEditMesh *em = BKE_editmesh_from_object(obedit); diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 1f1a778cac7..f028293d219 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -70,6 +70,8 @@ #include "ED_space_api.h" #include "ED_util.h" +#include "GPU_immediate.h" + #include "UI_interface.h" #include "UI_resources.h" @@ -86,7 +88,8 @@ void ED_editors_init(bContext *C) wmWindowManager *wm = CTX_wm_manager(C); Main *bmain = CTX_data_main(C); Scene *sce = CTX_data_scene(C); - Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL; + SceneLayer *sl = CTX_data_scene_layer(C); + Object *ob, *obact = (sl && sl->basact) ? sl->basact->object : NULL; ID *data; /* This is called during initialization, so we don't want to store any reports */ @@ -101,12 +104,15 @@ void ED_editors_init(bContext *C) for (ob = bmain->object.first; ob; ob = ob->id.next) { int mode = ob->mode; - if (!ELEM(mode, OB_MODE_OBJECT, OB_MODE_POSE)) { - ob->mode = OB_MODE_OBJECT; + if (mode == OB_MODE_OBJECT) { + /* pass */ + } + else { data = ob->data; - - if (ob == obact && !ID_IS_LINKED_DATABLOCK(ob) && !(data && ID_IS_LINKED_DATABLOCK(data))) + ob->mode = OB_MODE_OBJECT; + if ((ob == obact) && !ID_IS_LINKED_DATABLOCK(ob) && !(data && ID_IS_LINKED_DATABLOCK(data))) { ED_object_toggle_modes(C, mode); + } } } @@ -312,16 +318,28 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info { wmWindow *win = CTX_wm_window(C); const float *mval_src = (float *)arg_info; - const int mval_dst[2] = {win->eventstate->x - ar->winrct.xmin, - win->eventstate->y - ar->winrct.ymin}; - - UI_ThemeColor(TH_VIEW_OVERLAY); - setlinestyle(3); - glBegin(GL_LINES); - glVertex2iv(mval_dst); - glVertex2fv(mval_src); - glEnd(); - setlinestyle(0); + const float mval_dst[2] = {win->eventstate->x - ar->winrct.xmin, + win->eventstate->y - ar->winrct.ymin}; + + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); + + float viewport_size[4]; + glGetFloatv(GL_VIEWPORT, viewport_size); + immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); + + immUniform1i("num_colors", 0); /* "simple" mode */ + immUniformThemeColor(TH_VIEW_OVERLAY); + immUniform1f("dash_width", 6.0f); + immUniform1f("dash_factor", 0.5f); + + immBegin(GWN_PRIM_LINES, 2); + immVertex2fv(shdr_pos, mval_src); + immVertex2fv(shdr_pos, mval_dst); + immEnd(); + + immUnbindProgram(); } /** diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 441fd446cd6..d9f777771a8 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -42,9 +42,10 @@ #include "BKE_blender_undo.h" #include "BKE_context.h" -#include "BKE_depsgraph.h" #include "BKE_global.h" +#include "DEG_depsgraph.h" + #include "ED_util.h" #include "ED_mesh.h" @@ -269,7 +270,7 @@ void undo_editmode_step(bContext *C, int step) EDBM_selectmode_to_scene(C); } - DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + DEG_id_tag_update(&obedit->id, OB_RECALC_DATA); /* XXX notifiers */ } diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 419c15bf83f..ff328a28ee9 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -101,7 +101,7 @@ void ED_undo_push(bContext *C, const char *str) else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) { if (U.undosteps == 0) return; - PE_undo_push(CTX_data_scene(C), str); + PE_undo_push(CTX_data_scene(C), CTX_data_scene_layer(C), str); } else if (obact && obact->mode & OB_MODE_SCULPT) { /* do nothing for now */ @@ -120,6 +120,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) wmWindow *win = CTX_wm_window(C); Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); Object *obedit = CTX_data_edit_object(C); Object *obact = CTX_data_active_object(C); ScrArea *sa = CTX_wm_area(C); @@ -180,9 +181,9 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) } else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) { if (step == 1) - PE_undo(scene); + PE_undo(scene, sl); else - PE_redo(scene); + PE_redo(scene, sl); } else if (U.uiflag & USER_GLOBALUNDO) { // note python defines not valid here anymore. @@ -297,7 +298,7 @@ bool ED_undo_is_valid(const bContext *C, const char *undoname) return 1; } else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) { - return PE_undo_is_valid(CTX_data_scene(C)); + return PE_undo_is_valid(CTX_data_scene(C), CTX_data_scene_layer(C)); } if (U.uiflag & USER_GLOBALUNDO) { @@ -542,7 +543,7 @@ static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem) const char *name = NULL; if (undosys == UNDOSYSTEM_PARTICLE) { - name = PE_undo_get_name(CTX_data_scene(C), i, &active); + name = PE_undo_get_name(CTX_data_scene(C), CTX_data_scene_layer(C), i, &active); } else if (undosys == UNDOSYSTEM_EDITMODE) { name = undo_editmode_get_name(C, i, &active); @@ -625,7 +626,7 @@ static int undo_history_exec(bContext *C, wmOperator *op) int item = RNA_int_get(op->ptr, "item"); if (undosys == UNDOSYSTEM_PARTICLE) { - PE_undo_number(CTX_data_scene(C), item); + PE_undo_number(CTX_data_scene(C), CTX_data_scene_layer(C), item); } else if (undosys == UNDOSYSTEM_EDITMODE) { undo_editmode_number(C, item + 1); |