[Bf-blender-cvs] [225edf4] blender2.8: immediate mode: outliner background
Commit: 225edf4e667c12651d2c056b0fbf3a7b17080ff7 Author: Dalai Felinto Date: Thu Oct 20 01:43:46 2016 + Branches: blender2.8 https://developer.blender.org/rB225edf4e667c12651d2c056b0fbf3a7b17080ff7 immediate mode: outliner background I tried using immRecti instead, but it didn't work. The current approach should be more efficient anyways (since GL_TRIANGLE_FAN wouldn't work here). === M source/blender/editors/space_outliner/outliner_draw.c === diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index edda90a..ecdab26 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -68,6 +68,8 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_immediate.h" + #include "UI_interface.h" #include "UI_interface_icons.h" #include "UI_resources.h" @@ -1806,14 +1808,32 @@ static void outliner_back(ARegion *ar) { int ystart; - UI_ThemeColorShade(TH_BACK, 6); ystart = (int)ar->v2d.tot.ymax; ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET; - - while (ystart + 2 * UI_UNIT_Y > ar->v2d.cur.ymin) { - glRecti(0, ystart, (int)ar->v2d.cur.xmax, ystart + UI_UNIT_Y); - ystart -= 2 * UI_UNIT_Y; + + VertexFormat *format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformThemeColorShade(TH_BACK, 6); + + const float x1 = 0.0f, x2 = ar->v2d.cur.xmax; + float y1 = ystart, y2; + int tot = (int)floor(ystart - ar->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y); + + if (tot > 0) { + immBegin(GL_QUADS, 4 * tot); + while (tot--) { + y1 -= 2 * UI_UNIT_Y; + y2 = y1 + UI_UNIT_Y; + immVertex2f(pos, x1, y1); + immVertex2f(pos, x2, y1); + immVertex2f(pos, x2, y2); + immVertex2f(pos, x1, y2); + } + immEnd(); } + immUnbindProgram(); } static void outliner_draw_restrictcols(ARegion *ar) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8d8f2e2] transform-manipulators: Support drawing arrow manipulators while translating
Commit: 8d8f2e2e336838b70e3040de9249642a3e99e7b8 Author: Julian Eisel Date: Thu Oct 20 02:04:58 2016 +0200 Branches: transform-manipulators https://developer.blender.org/rB8d8f2e2e336838b70e3040de9249642a3e99e7b8 Support drawing arrow manipulators while translating === M source/blender/editors/space_view3d/view3d_transform_manipulators.c M source/blender/windowmanager/manipulators/WM_manipulator_api.h M source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c M source/blender/windowmanager/manipulators/intern/wm_manipulator.c M source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c === diff --git a/source/blender/editors/space_view3d/view3d_transform_manipulators.c b/source/blender/editors/space_view3d/view3d_transform_manipulators.c index 8898d49..ece5819 100644 --- a/source/blender/editors/space_view3d/view3d_transform_manipulators.c +++ b/source/blender/editors/space_view3d/view3d_transform_manipulators.c @@ -164,6 +164,23 @@ static void transform_manipulators_info_free(void *customdata) /* init callback and helpers */ /** + * Custom handler for manipulator widgets + */ +static int transform_axis_manipulator_handler( +bContext *C, const wmEvent *UNUSED(event), wmManipulator *widget, const int UNUSED(flag)) +{ + View3D *v3d = CTX_wm_view3d(C); + float origin[3]; + + /* update origin */ + if (calculateTransformCenter(C, v3d->around, origin, NULL)) { + WM_manipulator_set_origin(widget, origin); + } + + return OPERATOR_PASS_THROUGH; +} + +/** * Create and initialize a manipulator for \a axis. */ static void transform_axis_manipulator_init(TranformAxisManipulator *axis, wmManipulatorGroup *mgroup) @@ -178,6 +195,7 @@ static void transform_axis_manipulator_init(TranformAxisManipulator *axis, wmMan } PointerRNA *ptr = WM_manipulator_set_operator(axis->manipulator, axis->op_name); + WM_manipulator_set_custom_handler(axis->manipulator, transform_axis_manipulator_handler); if (RNA_struct_find_property(ptr, "constraint_axis")) { RNA_boolean_set_array(ptr, "constraint_axis", axis->constraint); diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h index 099ad7f..c2d194c 100644 --- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h +++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h @@ -58,6 +58,9 @@ void WM_manipulator_delete( void WM_manipulator_set_property(struct wmManipulator *, int slot, struct PointerRNA *ptr, const char *propname); struct PointerRNA *WM_manipulator_set_operator(struct wmManipulator *, const char *opname); +void WM_manipulator_set_custom_handler( +struct wmManipulator *manipulator, +int (*handler)(struct bContext *, const struct wmEvent *, struct wmManipulator *, const int)); void WM_manipulator_set_func_select( struct wmManipulator *manipulator, void (*select)(struct bContext *, struct wmManipulator *, const int action)); /* wmManipulatorSelectFunc */ diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c index 6cdf982..5d5e401 100644 --- a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c +++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c @@ -32,6 +32,7 @@ #include "DNA_defs.h" #include "DNA_listBase.h" #include "DNA_userdef_types.h" +#include "DNA_windowmanager_types.h" #include "GPU_select.h" @@ -39,6 +40,8 @@ #include "RNA_types.h" +#include "WM_types.h" + #include "manipulator_library_intern.h" #include "WM_manipulator_types.h" #include "wm_manipulator_wmapi.h" @@ -98,14 +101,13 @@ static void arrow_draw_geom(const ArrowManipulator *arrow, const bool UNUSED(sel glPopMatrix(); } -static void arrow_get_matrix(const ArrowManipulator *arrow, float r_mat[4][4]) +static void arrow_get_matrix(const ArrowManipulator *arrow, float r_rot[3][3], float r_mat[4][4]) { const float up[3] = {0.0f, 0.0f, 1.0f}; - float rot[3][3]; - rotation_between_vecs_to_mat3(rot, up, arrow->direction); + rotation_between_vecs_to_mat3(r_rot, up, arrow->direction); - copy_m4_m3(r_mat, rot); + copy_m4_m3(r_mat, r_rot); copy_v3_v3(r_mat[3], arrow->manipulator.origin); mul_mat3_m4_fl(r_mat, arrow->manipulator.scale); } @@ -113,10 +115,11 @@ static void arrow_get_matrix(const ArrowManipulator *arrow, float r_mat[4][4]) static void arrow_draw_intern(const ArrowManipulator *arrow, const bool select, const bool highlight) {
[Bf-blender-cvs] [33d99bd] blender2.8: immediate mode: ed_util.c
Commit: 33d99bdfe6c4f883671c4ab757a85bea781f820e Author: Dalai Felinto Date: Wed Oct 19 23:59:22 2016 + Branches: blender2.8 https://developer.blender.org/rB33d99bdfe6c4f883671c4ab757a85bea781f820e immediate mode: ed_util.c note: I switched one of the glVertex2iv into glVertex2fv to use the same attrib_id === M source/blender/editors/util/ed_util.c === diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 1f1a778..482523e 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" @@ -312,15 +314,23 @@ 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}; + const float 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(); + + VertexFormat *format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformThemeColor(TH_VIEW_OVERLAY); + + immBegin(GL_LINES, 2); + immVertex2fv(pos, mval_dst); + immVertex2fv(pos, mval_src); + immEnd(); + immUnbindProgram(); + setlinestyle(0); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b574bd6] transform-manipulators: Finish basic transform manipulators for translate
Commit: b574bd6cf74dd2d4515d7da0c6a620eb9e87f837 Author: Julian Eisel Date: Thu Oct 20 01:18:30 2016 +0200 Branches: transform-manipulators https://developer.blender.org/rBb574bd6cf74dd2d4515d7da0c6a620eb9e87f837 Finish basic transform manipulators for translate === M source/blender/editors/space_view3d/space_view3d.c M source/blender/editors/space_view3d/view3d_transform_manipulators.c M source/blender/editors/transform/transform_orientations.c M source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c === diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index f5e28df..06d73c9 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1040,6 +1040,7 @@ static void view3d_main_region_listener(bScreen *sc, ScrArea *sa, ARegion *ar, w case NC_GPENCIL: if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) { ED_region_tag_redraw(ar); + WM_manipulatormap_tag_refresh(mmap); } break; } diff --git a/source/blender/editors/space_view3d/view3d_transform_manipulators.c b/source/blender/editors/space_view3d/view3d_transform_manipulators.c index 1b214e4..8898d49 100644 --- a/source/blender/editors/space_view3d/view3d_transform_manipulators.c +++ b/source/blender/editors/space_view3d/view3d_transform_manipulators.c @@ -22,15 +22,20 @@ * \ingroup spview3d */ -#include "BKE_context.h" #include "BLI_math.h" +#include "BKE_action.h" +#include "BKE_context.h" + +#include "DNA_armature_types.h" +#include "DNA_gpencil_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" +#include "ED_armature.h" #include "ED_transform.h" #include "MEM_guardedalloc.h" @@ -46,7 +51,7 @@ /* axes as index */ -enum { +enum TransformAxisType { MAN_AXIS_TRANS_X = 0, MAN_AXIS_TRANS_Y, MAN_AXIS_TRANS_Z, @@ -75,24 +80,22 @@ enum { MAN_AXIS_LAST, }; -/* axis types */ -enum { +enum TransformType { MAN_AXES_ALL = 0, MAN_AXES_TRANSLATE, MAN_AXES_ROTATE, MAN_AXES_SCALE, }; -enum { - MAN_CONSTRAINT_X = (1 << 0), - MAN_CONSTRAINT_Y = (1 << 1), - MAN_CONSTRAINT_Z = (1 << 2), -}; +/* threshold for testing view aligned manipulator axis */ +#define TW_AXIS_DOT_MIN 0.02f +#define TW_AXIS_DOT_MAX 0.1f typedef struct TranformAxisManipulator { /* -- initialized using static array -- */ - int index, type; + enum TransformAxisType index; + enum TransformType type; const char *name; /* op info */ @@ -102,6 +105,7 @@ typedef struct TranformAxisManipulator { /* appearance */ int theme_colorid; int manipulator_type; + int protectflag; /* the protectflags this axis checks (e.g. OB_LOCK_LOCZ) */ /* -- initialized later -- */ @@ -110,6 +114,15 @@ typedef struct TranformAxisManipulator { } TranformAxisManipulator; /** + * Struct for carrying data of transform manipulators as wmManipulatorGroup.customdata. + */ +typedef struct TransformManipulatorsInfo { + TranformAxisManipulator *axes; /* Array of axes */ + + float mat[4][4]; /* Cached loc/rot matrix */ +} TransformManipulatorsInfo; + +/** * This TranformAxisManipulator array contains all the info we need to initialize, store and identify all * transform manipulators. When creating a new group instance we simply create an allocated version of this. * @@ -119,23 +132,35 @@ static TranformAxisManipulator tman_axes[] = { { MAN_AXIS_TRANS_X, MAN_AXES_TRANSLATE, "translate_x", "TRANSFORM_OT_translate", {1, 0, 0}, - TH_AXIS_X, MANIPULATOR_ARROW_STYLE_NORMAL, + TH_AXIS_X, MANIPULATOR_ARROW_STYLE_NORMAL, OB_LOCK_LOCX, }, { MAN_AXIS_TRANS_Y, MAN_AXES_TRANSLATE, "translate_y", "TRANSFORM_OT_translate", {0, 1, 0}, - TH_AXIS_Y, MANIPULATOR_ARROW_STYLE_NORMAL, + TH_AXIS_Y, MANIPULATOR_ARROW_STYLE_NORMAL, OB_LOCK_LOCY, }, { MAN_AXIS_TRANS_Z, MAN_AXES_TRANSLATE, "translate_z", "TRANSFORM_OT_translate", {0, 0, 1}, - TH_AXIS_Z, MANIPULATOR_ARROW_STYLE_NORMAL, + TH_AXIS_Z, MANIPULATOR_ARROW_STYLE_NORMAL, OB_LOCK_LOCZ, }, {0, 0, NULL} }; /* */ +/* General helpers */ + +static void transform_manipulators_info_free(void *customdata) +{ +
[Bf-blender-cvs] [2cd6a89] master: Python API: add full_path parameter for bpy.ops.ui.copy_data_path_button.
Commit: 2cd6a89d07e031901291ab95b9a5d6cdeb372bbe Author: christian brinkmann Date: Thu Oct 20 00:27:14 2016 +0200 Branches: master https://developer.blender.org/rB2cd6a89d07e031901291ab95b9a5d6cdeb372bbe Python API: add full_path parameter for bpy.ops.ui.copy_data_path_button. Also use the operator as part of the UI keymap now, to deduplicate code and let users configure a custom shortcut. Reviewed By: brecht Differential Revision: https://developer.blender.org/D2303 === M source/blender/editors/interface/interface_handlers.c M source/blender/editors/interface/interface_ops.c === diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 369eba6..863f5e3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2218,32 +2218,6 @@ static void ui_but_drop(bContext *C, const wmEvent *event, uiBut *but, uiHandleB /* *** copy and paste */ -static void ui_but_copy_data_path(uiBut *but, const bool full_path) -{ - char *id_path; - - if (but->rnapoin.id.data == NULL) { - return; - } - - if (full_path) { - if (but->rnaprop) { - id_path = RNA_path_full_property_py_ex(>rnapoin, but->rnaprop, but->rnaindex, true); - } - else { - id_path = RNA_path_full_struct_py(>rnapoin); - } - } - else { - id_path = RNA_path_from_ID_to_property(>rnapoin, but->rnaprop); - } - - if (id_path) { - WM_clipboard_text_set(id_path, false); - MEM_freeN(id_path); - } -} - /* c = copy, v = paste */ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, char mode) { @@ -6985,7 +6959,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) { /* handle copy-paste */ if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && - IS_EVENT_MOD(event, ctrl, oskey)) + IS_EVENT_MOD(event, ctrl, oskey) && !event->shift && !event->alt) { /* Specific handling for listrows, we try to find their overlapping tex button. */ if (but->type == UI_BTYPE_LISTROW) { @@ -6995,13 +6969,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * data = but->active; } } - - /* special case, copy-data-path */ - if ((event->type == CKEY) && event->shift) { - ui_but_copy_data_path(but, event->alt != 0); - return WM_UI_HANDLER_BREAK; - } - ui_but_copy_paste(C, but, data, (event->type == CKEY) ? 'c' : 'v'); return WM_UI_HANDLER_BREAK; } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 7e51647..40ebc94 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -113,19 +113,33 @@ static int copy_data_path_button_poll(bContext *C) return 0; } -static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) +static int copy_data_path_button_exec(bContext *C, wmOperator *op) { PointerRNA ptr; PropertyRNA *prop; char *path; int index; + const bool full_path = RNA_boolean_get(op->ptr, "full_path"); + /* try to create driver using property retrieved from UI */ UI_context_active_but_prop_get(C, , , ); - if (ptr.id.data && ptr.data && prop) { - path = RNA_path_from_ID_to_property(, prop); - + if (ptr.id.data != NULL) { + + if (full_path) { + + if (prop) { + path = RNA_path_full_property_py_ex(, prop, index, true); + } + else { + path = RNA_path_full_struct_py(); + } + } + else { + path = RNA_path_from_ID_to_property(, prop); + } + if (path) { WM_clipboard_text_set(path, false); MEM_freeN(path); @@ -138,6 +152,8 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) static void
[Bf-blender-cvs] [789ea73] master: Fix T49793 : Fix enabling SSE2 globally for msvc.
Commit: 789ea7397fd80dc5ab63d86719880f355bb440ae Author: lazydodo Date: Wed Oct 19 10:06:45 2016 -0600 Branches: master https://developer.blender.org/rB789ea7397fd80dc5ab63d86719880f355bb440ae Fix T49793 : Fix enabling SSE2 globally for msvc. When feeding msvc both /arch:sse2 and /arch:sse it's not smart enough to pick the best option, just goes with the last option === M CMakeLists.txt === diff --git a/CMakeLists.txt b/CMakeLists.txt index 64fd2c5..c7addc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -986,7 +986,7 @@ if(SUPPORT_SSE_BUILD) add_definitions(-D__SSE__ -D__MMX__) endif() if(SUPPORT_SSE2_BUILD) - set(PLATFORM_CFLAGS " ${COMPILER_SSE2_FLAG} ${PLATFORM_CFLAGS}") + set(PLATFORM_CFLAGS " ${PLATFORM_CFLAGS} ${COMPILER_SSE2_FLAG}") add_definitions(-D__SSE2__) if(NOT SUPPORT_SSE_BUILD) # dont double up add_definitions(-D__MMX__) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [07c886e] blender-v2.78-release: Blender 2.78a release: Use proper "a' on the splash
Commit: 07c886e97632b0e8de875746264fdfc756a77dc7 Author: Sergey Sharybin Date: Wed Oct 19 16:56:44 2016 +0200 Branches: blender-v2.78-release https://developer.blender.org/rB07c886e97632b0e8de875746264fdfc756a77dc7 Blender 2.78a release: Use proper "a' on the splash === M source/blender/blenkernel/BKE_blender_version.h === diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index eae83c8..aba5f9e 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -35,7 +35,7 @@ /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHAR +#define BLENDER_VERSION_CHARa /* alpha/beta/rc/release, docs use this */ #define BLENDER_VERSION_CYCLE release ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2e77ad7] blender-v2.78-release: Blender 2.78a release: Update addons submodule hash
Commit: 2e77ad7f99dc4fee8b645247e80794e4bdcc9e74 Author: Sergey Sharybin Date: Wed Oct 19 15:16:04 2016 +0200 Branches: blender-v2.78-release https://developer.blender.org/rB2e77ad7f99dc4fee8b645247e80794e4bdcc9e74 Blender 2.78a release: Update addons submodule hash === M release/scripts/addons === diff --git a/release/scripts/addons b/release/scripts/addons index c0f720c..0509ef6 16 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit c0f720c85ee12cd32cd837d6d0006f80b1da36c6 +Subproject commit 0509ef6d8eff45042db7fb965f95b2f816ceffb4 ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3da4560] blender-v2.78-release: Fix T49775: Appending data with internal dependency cycles prevents correct clearing of linked data-blocks.
Commit: 3da4560143910df39bccbdfe1e8d6582ecbbbc5b Author: Bastien Montagne Date: Wed Oct 19 14:29:43 2016 +0200 Branches: blender-v2.78-release https://developer.blender.org/rB3da4560143910df39bccbdfe1e8d6582ecbbbc5b Fix T49775: Appending data with internal dependency cycles prevents correct clearing of linked data-blocks. This is not a simple fix, but imho still needs to be backported to 2.78a... === M source/blender/blenkernel/BKE_library_query.h M source/blender/blenkernel/intern/library.c M source/blender/blenkernel/intern/library_query.c === diff --git a/source/blender/blenkernel/BKE_library_query.h b/source/blender/blenkernel/BKE_library_query.h index c5f575c..c6b6375 100644 --- a/source/blender/blenkernel/BKE_library_query.h +++ b/source/blender/blenkernel/BKE_library_query.h @@ -88,4 +88,6 @@ bool BKE_library_ID_is_locally_used(struct Main *bmain, void *idv); bool BKE_library_ID_is_indirectly_used(struct Main *bmain, void *idv); void BKE_library_ID_test_usages(struct Main *bmain, void *idv, bool *is_used_local, bool *is_used_linked); +void BKE_library_tag_unused_linked_data(struct Main *bmain, const bool do_init_tag); + #endif /* __BKE_LIBRARY_QUERY_H__ */ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 988f23d..0e76320 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -73,6 +73,8 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_linklist.h" +#include "BLI_memarena.h" #include "BLI_threads.h" #include "BLT_translation.h" @@ -1592,15 +1594,6 @@ void id_clear_lib_data_ex(Main *bmain, ID *id, const bool id_in_mainlist) if ((key = BKE_key_from_id(id))) { id_clear_lib_data_ex(bmain, >id, id_in_mainlist); /* sigh, why are keys in Main? */ } - - if (GS(id->name) == ID_OB) { - Object *object = (Object *)id; - if (object->proxy_from != NULL) { - object->proxy_from->proxy = NULL; - object->proxy_from->proxy_group = NULL; - } - object->proxy = object->proxy_from = object->proxy_group = NULL; - } } void id_clear_lib_data(Main *bmain, ID *id) @@ -1653,6 +1646,10 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged ID *id, *id_next; int a; + LinkNode *copied_ids = NULL; + LinkNode *linked_loop_candidates = NULL; + MemArena *linklist_mem = BLI_memarena_new(256 * sizeof(copied_ids), __func__); + for (a = set_listbasepointers(bmain, lbarray); a--; ) { id = lbarray[a]->first; @@ -1662,6 +1659,7 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged for (; id; id = id_next) { id->newid = NULL; + id->tag &= ~LIB_TAG_DOIT; id_next = id->next; /* id is possibly being inserted again */ /* The check on the second line (LIB_TAG_PRE_EXISTING) is done so its @@ -1676,6 +1674,10 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged if (id->lib) { /* In this specific case, we do want to make ID local even if it has no local usage yet... */ id_make_local(bmain, id, false, true); + + if (id->newid) { + BLI_linklist_prepend_arena(_ids, id, linklist_mem); + } } else { id->tag &= ~(LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW); @@ -1695,12 +1697,13 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged /* We have to remap local usages of old (linked) ID to new (local) id in a second loop, as lbarray ordering is not * enough to ensure us we did catch all dependencies (e.g. if making local a parent object before its child...). * See T48907. */ - for (a = set_listbasepointers(bmain, lbarray); a--; ) { - for (id = lbarray[a]->first; id; id = id->next) { - if (id->newid) { - BKE_libblock_remap(bmain, id, id->newid, ID_REMAP_SKIP_INDIRECT_USAGE); - } - } + for (LinkNode *it = copied_ids; it; it = it->next) { + id = it->link; + + BLI_assert(id->newid != NULL); + BLI_assert(id->lib != NULL); + +
[Bf-blender-cvs] [417847c] master: Fix T49775: Appending data with internal dependency cycles prevents correct clearing of linked data-blocks.
Commit: 417847c161ee9fa461c4f354c6b779b566c23796 Author: Bastien Montagne Date: Wed Oct 19 14:29:43 2016 +0200 Branches: master https://developer.blender.org/rB417847c161ee9fa461c4f354c6b779b566c23796 Fix T49775: Appending data with internal dependency cycles prevents correct clearing of linked data-blocks. This is not a simple fix, but imho still needs to be backported to 2.78a... === M source/blender/blenkernel/BKE_library_query.h M source/blender/blenkernel/intern/library.c M source/blender/blenkernel/intern/library_query.c === diff --git a/source/blender/blenkernel/BKE_library_query.h b/source/blender/blenkernel/BKE_library_query.h index c5f575c..c6b6375 100644 --- a/source/blender/blenkernel/BKE_library_query.h +++ b/source/blender/blenkernel/BKE_library_query.h @@ -88,4 +88,6 @@ bool BKE_library_ID_is_locally_used(struct Main *bmain, void *idv); bool BKE_library_ID_is_indirectly_used(struct Main *bmain, void *idv); void BKE_library_ID_test_usages(struct Main *bmain, void *idv, bool *is_used_local, bool *is_used_linked); +void BKE_library_tag_unused_linked_data(struct Main *bmain, const bool do_init_tag); + #endif /* __BKE_LIBRARY_QUERY_H__ */ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8b09e51..1461215 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -73,6 +73,8 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_linklist.h" +#include "BLI_memarena.h" #include "BLI_threads.h" #include "BLT_translation.h" @@ -1644,6 +1646,10 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged ID *id, *id_next; int a; + LinkNode *copied_ids = NULL; + LinkNode *linked_loop_candidates = NULL; + MemArena *linklist_mem = BLI_memarena_new(256 * sizeof(copied_ids), __func__); + for (a = set_listbasepointers(bmain, lbarray); a--; ) { id = lbarray[a]->first; @@ -1653,6 +1659,7 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged for (; id; id = id_next) { id->newid = NULL; + id->tag &= ~LIB_TAG_DOIT; id_next = id->next; /* id is possibly being inserted again */ /* The check on the second line (LIB_TAG_PRE_EXISTING) is done so its @@ -1675,6 +1682,10 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged else { id_make_local(bmain, id, false, true); } + + if (id->newid) { + BLI_linklist_prepend_arena(_ids, id, linklist_mem); + } } else { id->tag &= ~(LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW); @@ -1694,12 +1705,13 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged /* We have to remap local usages of old (linked) ID to new (local) id in a second loop, as lbarray ordering is not * enough to ensure us we did catch all dependencies (e.g. if making local a parent object before its child...). * See T48907. */ - for (a = set_listbasepointers(bmain, lbarray); a--; ) { - for (id = lbarray[a]->first; id; id = id->next) { - if (id->newid) { - BKE_libblock_remap(bmain, id, id->newid, ID_REMAP_SKIP_INDIRECT_USAGE); - } - } + for (LinkNode *it = copied_ids; it; it = it->next) { + id = it->link; + + BLI_assert(id->newid != NULL); + BLI_assert(id->lib != NULL); + + BKE_libblock_remap(bmain, id, id->newid, ID_REMAP_SKIP_INDIRECT_USAGE); } /* Third step: remove datablocks that have been copied to be localized and are no more used in the end... @@ -1707,61 +1719,108 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged bool do_loop = true; while (do_loop) { do_loop = false; - for (a = set_listbasepointers(bmain, lbarray); a--; ) { - for (id = lbarray[a]->first; id; id = id_next) { - id_next = id->next; - if (id->newid) { - bool is_local = false, is_lib = false; - -
[Bf-blender-cvs] [9941bc3] blender2.8: OpenGL: draw empties with new imm mode
Commit: 9941bc3041c6712d6e2ccca3ac5559c55d82bfc1 Author: Mike Erwin Date: Wed Oct 19 04:01:15 2016 -0400 Branches: blender2.8 https://developer.blender.org/rB9941bc3041c6712d6e2ccca3ac5559c55d82bfc1 OpenGL: draw empties with new imm mode Part of T49043 === M source/blender/editors/space_view3d/drawarmature.c M source/blender/editors/space_view3d/drawobject.c M source/blender/editors/space_view3d/view3d_draw.c M source/blender/editors/space_view3d/view3d_intern.h === diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 1d9a515..b37a674 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2161,11 +2161,9 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - glColor3ubv(col); - float viewmat_pchan[4][4]; mul_m4_m4m4(viewmat_pchan, rv3d->viewmatob, bmat); - drawaxes(viewmat_pchan, pchan->bone->length * 0.25f, OB_ARROWS); + drawaxes(viewmat_pchan, pchan->bone->length * 0.25f, OB_ARROWS, col); glPopMatrix(); } @@ -2370,11 +2368,9 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - glColor3ubv(col); - float viewmat_ebone[4][4]; mul_m4_m4m4(viewmat_ebone, rv3d->viewmatob, bmat); - drawaxes(viewmat_ebone, eBone->length * 0.25f, OB_ARROWS); + drawaxes(viewmat_ebone, eBone->length * 0.25f, OB_ARROWS, col); glPopMatrix(); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5dfbfc4..1400ae1 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -210,10 +210,11 @@ typedef struct drawBMSelect_userData { static void draw_bounding_volume(Object *ob, char type); -static void drawcube_size(float size); -static void drawcircle_size(float size); -static void draw_empty_sphere(float size); -static void draw_empty_cone(float size); +static void drawcube_size(float size, unsigned pos); +static void drawcircle_size(float size, unsigned pos); +static void draw_empty_sphere(float size, unsigned pos); +static void draw_empty_cone(float size, unsigned pos); + static void draw_box(const float vec[8][3], bool solid); static void ob_wire_color_blend_theme_id(const unsigned char ob_wire_col[4], const int theme_id, float fac) @@ -414,7 +415,7 @@ static const float cosval[CIRCLE_RESOL] = { * \param viewmat_local_unit is typically the 'rv3d->viewmatob' * copied into a 3x3 matrix and normalized. */ -static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3], float size, int axis) +static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3], float size, int axis, unsigned pos) { int line_type; float buffer[4][3]; @@ -501,18 +502,25 @@ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3] return; } + immBegin(line_type, n); for (int i = 0; i < n; i++) { mul_transposed_m3_v3((float (*)[3])viewmat_local_unit, buffer[i]); add_v3_v3(buffer[i], c); + immVertex3fv(pos, buffer[i]); } + immEnd(); + /* TODO: recode this function for clarity once we're not in a hurry to modernize GL usage */ + +#if 0 glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_FLOAT, 0, buffer); glDrawArrays(line_type, 0, n);