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:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/CMakeLists.txt4
-rw-r--r--source/blender/editors/armature/CMakeLists.txt5
-rw-r--r--source/blender/editors/curve/CMakeLists.txt5
-rw-r--r--source/blender/editors/gizmo_library/CMakeLists.txt5
-rw-r--r--source/blender/editors/gpencil/CMakeLists.txt5
-rw-r--r--source/blender/editors/include/ED_fileselect.h1
-rw-r--r--source/blender/editors/interface/CMakeLists.txt5
-rw-r--r--source/blender/editors/interface/interface.c2
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/editors/interface/interface_layout.c71
-rw-r--r--source/blender/editors/mask/CMakeLists.txt5
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt5
-rw-r--r--source/blender/editors/object/CMakeLists.txt5
-rw-r--r--source/blender/editors/physics/CMakeLists.txt5
-rw-r--r--source/blender/editors/render/CMakeLists.txt5
-rw-r--r--source/blender/editors/screen/CMakeLists.txt5
-rw-r--r--source/blender/editors/sculpt_paint/CMakeLists.txt5
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c20
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_dyntopo.c28
-rw-r--r--source/blender/editors/space_action/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_api/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_api/spacetypes.c8
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_clip/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_console/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_file/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_file/file_intern.h7
-rw-r--r--source/blender/editors/space_file/file_ops.c39
-rw-r--r--source/blender/editors/space_file/filesel.c29
-rw-r--r--source/blender/editors/space_graph/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_image/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_image/image_draw.c6
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_outliner/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_script/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_sequencer/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_statusbar/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_text/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_topbar/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/transform/CMakeLists.txt4
-rw-r--r--source/blender/editors/transform/transform_constraints.c51
-rw-r--r--source/blender/editors/transform/transform_convert_mesh.c3
-rw-r--r--source/blender/editors/transform/transform_mode_edge_seq_slide.c27
-rw-r--r--source/blender/editors/transform/transform_mode_translate.c61
-rw-r--r--source/blender/editors/transform/transform_snap.c87
-rw-r--r--source/blender/editors/util/CMakeLists.txt4
-rw-r--r--source/blender/editors/uvedit/CMakeLists.txt4
51 files changed, 237 insertions, 362 deletions
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index ce6778a1ff9..1ca9a844feb 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -30,9 +30,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
anim_channels_defines.c
@@ -69,6 +66,5 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 71c7febe192..98c050950be 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -31,10 +31,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
armature_add.c
armature_edit.c
@@ -67,6 +63,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt
index ff80c47baa8..877c2d99102 100644
--- a/source/blender/editors/curve/CMakeLists.txt
+++ b/source/blender/editors/curve/CMakeLists.txt
@@ -31,10 +31,6 @@ set(INC
../../../../extern/curve_fit_nd
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
curve_ops.c
editcurve.c
@@ -59,6 +55,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_curve "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/gizmo_library/CMakeLists.txt b/source/blender/editors/gizmo_library/CMakeLists.txt
index 1f3edf31b19..eeb1e60166b 100644
--- a/source/blender/editors/gizmo_library/CMakeLists.txt
+++ b/source/blender/editors/gizmo_library/CMakeLists.txt
@@ -32,10 +32,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
gizmo_draw_utils.c
gizmo_geometry.h
@@ -59,6 +55,5 @@ set(SRC
set(LIB
)
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_gizmo_library "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index 735ad8bc039..20408327105 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -31,10 +31,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
annotate_draw.c
annotate_paint.c
@@ -75,6 +71,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index 47b8eb543f4..341f97943a5 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -150,6 +150,7 @@ int ED_file_extension_icon(const char *path);
void ED_file_read_bookmarks(void);
+void ED_file_change_dir_ex(struct bContext *C, struct bScreen *screen, struct ScrArea *area);
void ED_file_change_dir(struct bContext *C);
void ED_file_path_button(struct bScreen *screen,
diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt
index e4fb0631f06..680cf3ea01a 100644
--- a/source/blender/editors/interface/CMakeLists.txt
+++ b/source/blender/editors/interface/CMakeLists.txt
@@ -34,10 +34,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
interface.c
interface_align.c
@@ -113,6 +109,5 @@ if(WIN32)
endif()
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 0bd4934dd0f..10650da4b0e 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -6676,7 +6676,7 @@ static void operator_enum_search_update_fn(const struct bContext *C,
}
}
- MEM_freeN(filtered_items);
+ MEM_freeN((void *)filtered_items);
BLI_string_search_free(search);
if (do_free) {
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index c91b4d826a7..d22ddb5f2b7 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -256,7 +256,7 @@ static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc)
/* Utilities */
-static void viconutil_set_point(GLint pt[2], int x, int y)
+static void viconutil_set_point(int pt[2], int x, int y)
{
pt[0] = x;
pt[1] = y;
@@ -264,7 +264,7 @@ static void viconutil_set_point(GLint pt[2], int x, int y)
static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha)
{
- GLint pts[3][2];
+ int pts[3][2];
const int cx = x + w / 2 - 4;
const int cy = y + w / 2;
const int d = w / 5, d2 = w / 7;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 4cf2953153e..983c3e5ebd3 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -87,8 +87,8 @@
* highlighted together.
*/
typedef struct uiButtonGroup {
- uiButtonGroup *next, *prev;
- ListBase *buttons;
+ void *next, *prev;
+ ListBase buttons; /* #LinkData with #uiBut data field. */
} uiButtonGroup;
typedef struct uiLayoutRoot {
@@ -428,6 +428,43 @@ static void ui_item_move(uiItem *item, int delta_xmin, int delta_xmax)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Button Groups
+ * \{ */
+
+/**
+ * Every function that adds a set of buttons must create another group,
+ * then #ui_def_but adds buttons to the current group (the last).
+ */
+static void layout_root_new_button_group(uiLayoutRoot *root)
+{
+ uiButtonGroup *new_group = MEM_mallocN(sizeof(uiButtonGroup), __func__);
+ BLI_listbase_clear(&new_group->buttons);
+ BLI_addtail(&root->button_groups, new_group);
+}
+
+static void button_group_add_but(uiLayoutRoot *root, uiBut *but)
+{
+ BLI_assert(root != NULL);
+
+ uiButtonGroup *current_button_group = root->button_groups.last;
+ BLI_assert(current_button_group != NULL);
+
+ /* We can't use the button directly because adding it to
+ * this list would mess with its prev and next pointers. */
+ LinkData *button_link = MEM_mallocN(sizeof(LinkData), __func__);
+ button_link->data = but;
+ BLI_addtail(&current_button_group->buttons, button_link);
+}
+
+static void button_group_free(uiButtonGroup *button_group)
+{
+ BLI_freelistN(&button_group->buttons);
+ MEM_freeN(button_group);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Special RNA Items
* \{ */
@@ -2859,6 +2896,7 @@ static uiBut *ui_item_menu(uiLayout *layout,
int w, h;
UI_block_layout_set_current(block, layout);
+ layout_root_new_button_group(layout->root);
if (!name) {
name = "";
@@ -3126,6 +3164,7 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
int w;
UI_block_layout_set_current(block, layout);
+ layout_root_new_button_group(layout->root);
if (!name) {
name = "";
@@ -5293,29 +5332,12 @@ static void ui_layout_free(uiLayout *layout)
static void layout_root_free(uiLayoutRoot *root)
{
- BLI_freelistN(&root->button_groups);
ui_layout_free(root->layout);
- MEM_freeN(root);
-}
-/**
- * Every function that adds a set of buttons must create another group,
- * then #ui_def_but adds buttons to the current group (the last).
- */
-static void layout_root_new_button_group(uiLayoutRoot *root)
-{
- uiButtonGroup *new_group = MEM_mallocN(sizeof(uiButtonGroup), __func__);
- BLI_listbase_clear(&new_group->buttons);
- BLI_addtail(&root->button_groups, new_group);
-}
-
-static void button_group_add_but(uiLayoutRoot *root, const uiBut *but)
-{
- uiButtonGroup *current_button_group = root->button_groups.last;
-
- BLI_assert(current_button_group != NULL);
-
- BLI_addtail(&current_button_group->buttons, but);
+ LISTBASE_FOREACH_MUTABLE (uiButtonGroup *, button_group, &root->button_groups) {
+ button_group_free(button_group);
+ }
+ MEM_freeN(root);
}
static void ui_layout_add_padding_button(uiLayoutRoot *root)
@@ -5353,6 +5375,7 @@ uiLayout *UI_block_layout(uiBlock *block,
root->opcontext = WM_OP_INVOKE_REGION_WIN;
BLI_listbase_clear(&root->button_groups);
+ layout_root_new_button_group(root);
layout = MEM_callocN(sizeof(uiLayout), "uiLayout");
layout->item.type = (type == UI_LAYOUT_VERT_BAR) ? ITEM_LAYOUT_COLUMN : ITEM_LAYOUT_ROOT;
@@ -5513,6 +5536,8 @@ void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y)
layout_root_free(root);
}
+ BLI_listbase_clear(&block->layouts);
+
/* XXX silly trick, interface_templates.c doesn't get linked
* because it's not used by other files in this module? */
{
diff --git a/source/blender/editors/mask/CMakeLists.txt b/source/blender/editors/mask/CMakeLists.txt
index 66c055d9426..dd04732a814 100644
--- a/source/blender/editors/mask/CMakeLists.txt
+++ b/source/blender/editors/mask/CMakeLists.txt
@@ -30,10 +30,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
mask_add.c
mask_draw.c
@@ -51,6 +47,5 @@ set(SRC
set(LIB
)
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_mask "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index 589b51ce942..035af772a55 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -35,10 +35,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
editface.c
editmesh_add.c
@@ -97,6 +93,5 @@ if(WITH_GMP)
add_definitions(-DWITH_GMP)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 953ef8114f9..be6c0658b1f 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -39,10 +39,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
object_add.c
object_bake.c
@@ -81,7 +77,6 @@ set(LIB
bf_windowmanager
)
-add_definitions(${GL_DEFINITIONS})
if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index 0998280c381..2b9d9aaa0e1 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -30,10 +30,6 @@ set(INC
../../../../intern/mantaflow/extern
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
dynamicpaint_ops.c
particle_boids.c
@@ -74,6 +70,5 @@ if(WITH_BULLET)
add_definitions(-DWITH_BULLET)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt
index 7f7748bf52f..642e92592f1 100644
--- a/source/blender/editors/render/CMakeLists.txt
+++ b/source/blender/editors/render/CMakeLists.txt
@@ -34,10 +34,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
render_internal.c
render_opengl.c
@@ -61,7 +57,6 @@ else()
)
endif()
-add_definitions(${GL_DEFINITIONS})
if(WITH_FREESTYLE)
list(APPEND INC
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index dc355148ad3..1de5ad729c5 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -33,10 +33,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
area.c
area_query.c
@@ -64,6 +60,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 51cfb912722..930f9890dd9 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -36,10 +36,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
paint_cursor.c
paint_curve.c
@@ -90,6 +86,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 3d8c718c8a9..55abb269660 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -142,7 +142,7 @@ typedef struct LoadTexData {
ViewContext *vc;
MTex *mtex;
- GLubyte *buffer;
+ uchar *buffer;
bool col;
struct ImagePool *pool;
@@ -160,7 +160,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata,
ViewContext *vc = data->vc;
MTex *mtex = data->mtex;
- GLubyte *buffer = data->buffer;
+ uchar *buffer = data->buffer;
const bool col = data->col;
struct ImagePool *pool = data->pool;
@@ -230,7 +230,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata,
/* Clamp to avoid precision overflow. */
CLAMP(avg, 0.0f, 1.0f);
- buffer[index] = 255 - (GLubyte)(255 * avg);
+ buffer[index] = 255 - (uchar)(255 * avg);
}
}
else {
@@ -254,7 +254,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
MTex *mtex = (primary) ? &br->mtex : &br->mask_mtex;
ePaintOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags();
- GLubyte *buffer = NULL;
+ uchar *buffer = NULL;
int size;
bool refresh;
@@ -309,10 +309,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
target->old_col = col;
}
if (col) {
- buffer = MEM_mallocN(sizeof(GLubyte) * size * size * 4, "load_tex");
+ buffer = MEM_mallocN(sizeof(uchar) * size * size * 4, "load_tex");
}
else {
- buffer = MEM_mallocN(sizeof(GLubyte) * size * size, "load_tex");
+ buffer = MEM_mallocN(sizeof(uchar) * size * size, "load_tex");
}
pool = BKE_image_pool_new();
@@ -381,7 +381,7 @@ static void load_tex_cursor_task_cb(void *__restrict userdata,
LoadTexData *data = userdata;
Brush *br = data->br;
- GLubyte *buffer = data->buffer;
+ uchar *buffer = data->buffer;
const int size = data->size;
@@ -398,7 +398,7 @@ static void load_tex_cursor_task_cb(void *__restrict userdata,
/* Falloff curve. */
float avg = BKE_brush_curve_strength_clamped(br, len, 1.0f);
- buffer[index] = (GLubyte)(255 * avg);
+ buffer[index] = (uchar)(255 * avg);
}
else {
buffer[index] = 0;
@@ -411,7 +411,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
bool init;
ePaintOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags();
- GLubyte *buffer = NULL;
+ uchar *buffer = NULL;
int size;
const bool refresh = !cursor_snap.overlay_texture ||
@@ -452,7 +452,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
cursor_snap.size = size;
}
- buffer = MEM_mallocN(sizeof(GLubyte) * size * size, "load_tex");
+ buffer = MEM_mallocN(sizeof(uchar) * size * size, "load_tex");
BKE_curvemapping_init(br->curve);
diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
index f07d22ed639..9b4b5b8d1e2 100644
--- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
@@ -36,6 +36,7 @@
#include "BKE_brush.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
@@ -58,6 +59,7 @@
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
+#include "ED_undo.h"
#include "ED_view3d.h"
#include "paint_intern.h"
#include "sculpt_intern.h"
@@ -285,11 +287,17 @@ void sculpt_dynamic_topology_disable_with_undo(Main *bmain,
Object *ob)
{
SculptSession *ss = ob->sculpt;
- if (ss->bm) {
- SCULPT_undo_push_begin("Dynamic topology disable");
- SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END);
+ if (ss->bm != NULL) {
+ /* May be false in background mode. */
+ const bool use_undo = G.background ? (ED_undo_stack_get() != NULL) : true;
+ if (use_undo) {
+ SCULPT_undo_push_begin("Dynamic topology disable");
+ SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END);
+ }
SCULPT_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, NULL);
- SCULPT_undo_push_end();
+ if (use_undo) {
+ SCULPT_undo_push_end();
+ }
}
}
@@ -300,10 +308,16 @@ static void sculpt_dynamic_topology_enable_with_undo(Main *bmain,
{
SculptSession *ss = ob->sculpt;
if (ss->bm == NULL) {
- SCULPT_undo_push_begin("Dynamic topology enable");
+ /* May be false in background mode. */
+ const bool use_undo = G.background ? (ED_undo_stack_get() != NULL) : true;
+ if (use_undo) {
+ SCULPT_undo_push_begin("Dynamic topology enable");
+ }
SCULPT_dynamic_topology_enable_ex(bmain, depsgraph, scene, ob);
- SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
- SCULPT_undo_push_end();
+ if (use_undo) {
+ SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
+ SCULPT_undo_push_end();
+ }
}
}
diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt
index 6c43f8b9549..10dcc77fc24 100644
--- a/source/blender/editors/space_action/CMakeLists.txt
+++ b/source/blender/editors/space_action/CMakeLists.txt
@@ -28,10 +28,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
action_buttons.c
action_data.c
@@ -49,6 +45,5 @@ set(LIB
bf_blenlib
)
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index d948d84f1c3..573afb76f0e 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -20,6 +20,7 @@ set(INC
../io
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 29ad314cd65..2a18ffafc6c 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -33,6 +33,8 @@
#include "BKE_context.h"
#include "BKE_screen.h"
+#include "GPU_state.h"
+
#include "UI_interface.h"
#include "UI_view2d.h"
@@ -269,12 +271,18 @@ void ED_region_draw_cb_exit(ARegionType *art, void *handle)
void ED_region_draw_cb_draw(const bContext *C, ARegion *region, int type)
{
RegionDrawCB *rdc;
+ bool has_drawn_something = false;
for (rdc = region->type->drawcalls.first; rdc; rdc = rdc->next) {
if (rdc->type == type) {
rdc->draw(C, region, rdc->customdata);
+ has_drawn_something = true;
}
}
+ if (has_drawn_something) {
+ /* This is needed until we get rid of BGL which can change the states we are tracking. */
+ GPU_force_state();
+ }
}
/* ********************* space template *********************** */
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index 75d91174470..ce0787dbdb9 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -28,10 +28,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
buttons_context.c
buttons_ops.c
@@ -48,7 +44,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt
index 2ea4bc97d18..8c7f59d61dd 100644
--- a/source/blender/editors/space_clip/CMakeLists.txt
+++ b/source/blender/editors/space_clip/CMakeLists.txt
@@ -33,10 +33,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
clip_buttons.c
clip_dopesheet_draw.c
@@ -68,7 +64,6 @@ set(LIB
bf_blenlib
)
-add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index 33934832ccc..e5aedd0d0de 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -28,10 +28,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
console_draw.c
console_ops.c
@@ -49,6 +45,5 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_console "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index 84df11ea39c..dcacf5e2504 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -33,10 +33,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
file_draw.c
file_ops.c
@@ -95,7 +91,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 44131693628..b459c02d9e5 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -39,6 +39,7 @@ struct View2D;
void file_calc_previews(const bContext *C, ARegion *region);
void file_draw_list(const bContext *C, ARegion *region);
+void file_draw_check_ex(bContext *C, struct ScrArea *area);
void file_draw_check(bContext *C);
void file_draw_check_cb(bContext *C, void *arg1, void *arg2);
bool file_draw_check_exists(SpaceFile *sfile);
@@ -80,13 +81,13 @@ void file_filename_enter_handle(bContext *C, void *arg_unused, void *arg_but);
int file_highlight_set(struct SpaceFile *sfile, struct ARegion *region, int mx, int my);
void file_sfile_filepath_set(struct SpaceFile *sfile, const char *filepath);
-void file_sfile_to_operator_ex(bContext *C,
+void file_sfile_to_operator_ex(struct Main *bmain,
struct wmOperator *op,
struct SpaceFile *sfile,
char *filepath);
-void file_sfile_to_operator(bContext *C, struct wmOperator *op, struct SpaceFile *sfile);
+void file_sfile_to_operator(struct Main *bmain, struct wmOperator *op, struct SpaceFile *sfile);
-void file_operator_to_sfile(bContext *C, struct SpaceFile *sfile, struct wmOperator *op);
+void file_operator_to_sfile(struct Main *bmain, struct SpaceFile *sfile, struct wmOperator *op);
/* filesel.c */
void fileselect_file_set(SpaceFile *sfile, const int index);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 8c4b2a1b8a6..b3587fc7f97 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1432,9 +1432,8 @@ void FILE_OT_cancel(struct wmOperatorType *ot)
/** \name Operator Utilities
* \{ */
-void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, char *filepath)
+void file_sfile_to_operator_ex(Main *bmain, wmOperator *op, SpaceFile *sfile, char *filepath)
{
- Main *bmain = CTX_data_main(C);
PropertyRNA *prop;
/* XXX, not real length */
@@ -1507,16 +1506,15 @@ void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, ch
}
}
}
-void file_sfile_to_operator(bContext *C, wmOperator *op, SpaceFile *sfile)
+void file_sfile_to_operator(Main *bmain, wmOperator *op, SpaceFile *sfile)
{
- char filepath[FILE_MAX];
+ char filepath_dummy[FILE_MAX];
- file_sfile_to_operator_ex(C, op, sfile, filepath);
+ file_sfile_to_operator_ex(bmain, op, sfile, filepath_dummy);
}
-void file_operator_to_sfile(bContext *C, SpaceFile *sfile, wmOperator *op)
+void file_operator_to_sfile(Main *bmain, SpaceFile *sfile, wmOperator *op)
{
- Main *bmain = CTX_data_main(C);
PropertyRNA *prop;
/* If neither of the above are set, split the filepath back */
@@ -1569,25 +1567,37 @@ void file_sfile_filepath_set(SpaceFile *sfile, const char *filepath)
}
}
-void file_draw_check(bContext *C)
+void file_draw_check_ex(bContext *C, ScrArea *area)
{
- SpaceFile *sfile = CTX_wm_space_file(C);
+ /* May happen when manipulating non-active spaces. */
+ if (UNLIKELY(area->spacetype != SPACE_FILE)) {
+ return;
+ }
+ SpaceFile *sfile = area->spacedata.first;
wmOperator *op = sfile->op;
if (op) { /* fail on reload */
if (op->type->check) {
- file_sfile_to_operator(C, op, sfile);
+ Main *bmain = CTX_data_main(C);
+ file_sfile_to_operator(bmain, op, sfile);
/* redraw */
if (op->type->check(C, op)) {
- file_operator_to_sfile(C, sfile, op);
+ file_operator_to_sfile(bmain, sfile, op);
/* redraw, else the changed settings wont get updated */
- ED_area_tag_redraw(CTX_wm_area(C));
+ ED_area_tag_redraw(area);
}
}
}
}
+void file_draw_check(bContext *C)
+{
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ ScrArea *area = CTX_wm_area(C);
+ file_draw_check_ex(C, area);
+}
+
/* for use with; UI_block_func_set */
void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
@@ -1675,7 +1685,7 @@ static int file_exec(bContext *C, wmOperator *exec_op)
sfile->op = NULL;
- file_sfile_to_operator_ex(C, op, sfile, filepath);
+ file_sfile_to_operator_ex(bmain, op, sfile, filepath);
if (BLI_exists(sfile->params->dir)) {
fsmenu_insert_entry(ED_fsmenu_get(),
@@ -2091,6 +2101,7 @@ void FILE_OT_smoothscroll(wmOperatorType *ot)
static int filepath_drop_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile) {
@@ -2105,7 +2116,7 @@ static int filepath_drop_exec(bContext *C, wmOperator *op)
file_sfile_filepath_set(sfile, filepath);
if (sfile->op) {
- file_sfile_to_operator(C, sfile->op, sfile);
+ file_sfile_to_operator(bmain, sfile->op, sfile);
file_draw_check(C);
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 306d6cba50e..9fc4e8936f4 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -828,13 +828,23 @@ FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, ARegion *region)
return sfile->layout;
}
-void ED_file_change_dir(bContext *C)
+/**
+ * Support updating the directory even when this isn't the active space
+ * needed so RNA properties update function isn't context sensitive, see T70255.
+ */
+void ED_file_change_dir_ex(bContext *C, bScreen *screen, ScrArea *area)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- SpaceFile *sfile = CTX_wm_space_file(C);
-
+ /* May happen when manipulating non-active spaces. */
+ if (UNLIKELY(area->spacetype != SPACE_FILE)) {
+ return;
+ }
+ SpaceFile *sfile = area->spacedata.first;
if (sfile->params) {
- ED_fileselect_clear(wm, CTX_data_scene(C), sfile);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ Scene *scene = WM_windows_scene_get_from_screen(wm, screen);
+ if (LIKELY(scene != NULL)) {
+ ED_fileselect_clear(wm, scene, sfile);
+ }
/* Clear search string, it is very rare to want to keep that filter while changing dir,
* and usually very annoying to keep it actually! */
@@ -853,10 +863,17 @@ void ED_file_change_dir(bContext *C)
folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
- file_draw_check(C);
+ file_draw_check_ex(C, area);
}
}
+void ED_file_change_dir(bContext *C)
+{
+ bScreen *screen = CTX_wm_screen(C);
+ ScrArea *area = CTX_wm_area(C);
+ ED_file_change_dir_ex(C, screen, area);
+}
+
int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matched_file)
{
int match = 0;
diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index 8170c920990..fd5c5863608 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -29,10 +29,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
graph_buttons.c
graph_draw.c
@@ -67,6 +63,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index 24ec7a89397..96aab8b5d1a 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -35,10 +35,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
image_buttons.c
image_draw.c
@@ -81,6 +77,5 @@ if(WITH_IMAGE_CINEON)
add_definitions(-DWITH_CINEON)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 85d153feb4c..60dd134646d 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -55,6 +55,7 @@
#include "BIF_glutil.h"
+#include "GPU_framebuffer.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
@@ -570,7 +571,8 @@ static void draw_image_buffer(const bContext *C,
float zoomy)
{
/* Image are still drawn in display space. */
- glDisable(GL_FRAMEBUFFER_SRGB);
+ GPUFrameBuffer *fb = GPU_framebuffer_active_get();
+ GPU_framebuffer_bind_no_srgb(fb);
int x, y;
int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(ibuf);
@@ -660,7 +662,7 @@ static void draw_image_buffer(const bContext *C,
}
}
- glEnable(GL_FRAMEBUFFER_SRGB);
+ GPU_framebuffer_bind(fb);
}
static void draw_image_buffer_repeated(const bContext *C,
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index ad410e0aade..b6df07eec4e 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -33,10 +33,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
set(SRC
info_draw.c
info_ops.c
@@ -56,6 +52,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index 60152bffaf4..9a94d28c604 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -29,9 +29,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
nla_buttons.c
@@ -54,6 +51,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index f8c30f9a688..fc831bf8490 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -34,9 +34,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
drawnode.c
@@ -75,6 +72,5 @@ if(WITH_OPENIMAGEDENOISE)
add_definitions(-DWITH_OPENIMAGEDENOISE)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 616915dbc2c..db38839f959 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -30,9 +30,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
outliner_collections.c
@@ -60,6 +57,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt
index 0bd2a01a151..f2dd39ea13d 100644
--- a/source/blender/editors/space_script/CMakeLists.txt
+++ b/source/blender/editors/space_script/CMakeLists.txt
@@ -27,9 +27,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
script_edit.c
@@ -49,6 +46,5 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_script "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index 8105891e157..caf75349454 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -32,9 +32,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
sequencer_add.c
@@ -73,6 +70,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_statusbar/CMakeLists.txt b/source/blender/editors/space_statusbar/CMakeLists.txt
index ad4c060a1f6..a0f3afecaf9 100644
--- a/source/blender/editors/space_statusbar/CMakeLists.txt
+++ b/source/blender/editors/space_statusbar/CMakeLists.txt
@@ -29,9 +29,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
space_statusbar.c
@@ -42,6 +39,5 @@ set(LIB
bf_blenlib
)
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_statusbar "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt
index 740fc9948ef..abd7620ea2b 100644
--- a/source/blender/editors/space_text/CMakeLists.txt
+++ b/source/blender/editors/space_text/CMakeLists.txt
@@ -29,9 +29,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
space_text.c
@@ -56,7 +53,6 @@ set(LIB
bf_blenlib
)
-add_definitions(${GL_DEFINITIONS})
if(WITH_PYTHON)
list(APPEND INC
diff --git a/source/blender/editors/space_topbar/CMakeLists.txt b/source/blender/editors/space_topbar/CMakeLists.txt
index d56e1da334d..15e71e2296d 100644
--- a/source/blender/editors/space_topbar/CMakeLists.txt
+++ b/source/blender/editors/space_topbar/CMakeLists.txt
@@ -29,9 +29,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
space_topbar.c
@@ -40,6 +37,5 @@ set(SRC
set(LIB
)
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_space_topbar "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index f2536cfac62..f4d6f7e322c 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -38,9 +38,6 @@ set(INC
${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
drawobject.c
@@ -85,7 +82,6 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index f3300f21628..0b5daece556 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1065,7 +1065,7 @@ static void draw_rotation_guide(const RegionView3D *rv3d)
float o[3]; /* center of rotation */
float end[3]; /* endpoints for drawing */
- GLubyte color[4] = {0, 108, 255, 255}; /* bright blue so it matches device LEDs */
+ uchar color[4] = {0, 108, 255, 255}; /* bright blue so it matches device LEDs */
negate_v3_v3(o, rv3d->ofs);
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index b284ba0af2d..f905e96dbdd 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -33,9 +33,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
transform.c
@@ -125,6 +122,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 84eac3bbf8f..0eaae7f17cd 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -163,41 +163,6 @@ void constraintNumInput(TransInfo *t, float vec[3])
}
}
-static void postConstraintChecks(TransInfo *t, float vec[3])
-{
- mul_m3_v3(t->spacemtx_inv, vec);
-
- transform_snap_increment(t, vec);
-
- if (t->flag & T_NULL_ONE) {
- if (!(t->con.mode & CON_AXIS0)) {
- vec[0] = 1.0f;
- }
-
- if (!(t->con.mode & CON_AXIS1)) {
- vec[1] = 1.0f;
- }
-
- if (!(t->con.mode & CON_AXIS2)) {
- vec[2] = 1.0f;
- }
- }
-
- if (applyNumInput(&t->num, vec)) {
- constraintNumInput(t, vec);
- removeAspectRatio(t, vec);
- }
-
- /* If `t->values` is operator param, use that directly but not if snapping is forced */
- if (t->flag & T_INPUT_IS_VALUES_FINAL && (t->tsnap.status & SNAP_FORCED) == 0) {
- copy_v3_v3(vec, t->values);
- constraintValuesFinal(t, vec);
- /* inverse transformation at the end */
- }
-
- mul_m3_v3(t->spacemtx, vec);
-}
-
static void viewAxisCorrectCenter(const TransInfo *t, float t_con_center[3])
{
if (t->spacetype == SPACE_VIEW3D) {
@@ -432,15 +397,22 @@ static void applyAxisConstraintVec(
{
copy_v3_v3(out, in);
if (!td && t->con.mode & CON_APPLY) {
+ bool is_snap_to_point = false, is_snap_to_edge = false, is_snap_to_face = false;
mul_m3_v3(t->con.pmtx, out);
- bool is_snap_to_edge = false, is_snap_to_face = false;
+
if (activeSnap(t)) {
- is_snap_to_edge = (t->tsnap.snapElem & SCE_SNAP_MODE_EDGE) != 0;
- is_snap_to_face = (t->tsnap.snapElem & SCE_SNAP_MODE_FACE) != 0;
+ if (validSnap(t)) {
+ is_snap_to_point = (t->tsnap.snapElem & SCE_SNAP_MODE_VERTEX) != 0;
+ is_snap_to_edge = (t->tsnap.snapElem & SCE_SNAP_MODE_EDGE) != 0;
+ is_snap_to_face = (t->tsnap.snapElem & SCE_SNAP_MODE_FACE) != 0;
+ }
+ else if (t->tsnap.snapElem & SCE_SNAP_MODE_GRID) {
+ is_snap_to_point = true;
+ }
}
/* With snap points, a projection is alright, no adjustments needed. */
- if (!validSnap(t) || is_snap_to_edge || is_snap_to_face) {
+ if (!is_snap_to_point || is_snap_to_edge || is_snap_to_face) {
const int dims = getConstraintSpaceDimension(t);
if (dims == 2) {
if (!is_zero_v3(out)) {
@@ -486,7 +458,6 @@ static void applyAxisConstraintVec(
}
}
}
- postConstraintChecks(t, out);
}
}
diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c
index 7ad54a56545..06ab60d992c 100644
--- a/source/blender/editors/transform/transform_convert_mesh.c
+++ b/source/blender/editors/transform/transform_convert_mesh.c
@@ -1296,6 +1296,9 @@ void mesh_customdatacorrect_init(TransInfo *t)
use_merge_group = (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED) != 0;
}
}
+ else {
+ return;
+ }
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
mesh_customdatacorrect_init_container(tc, use_merge_group);
diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.c b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
index 141f9acdeb4..d2474d78387 100644
--- a/source/blender/editors/transform/transform_mode_edge_seq_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
@@ -93,22 +93,29 @@ static void applySeqSlideValue(TransInfo *t, const float val[2])
static void applySeqSlide(TransInfo *t, const int mval[2])
{
char str[UI_MAX_DRAW_STR];
+ float values_final[3];
snapSequenceBounds(t, mval);
-
- if (t->con.mode & CON_APPLY) {
- float tvec[3];
- t->con.applyVec(t, NULL, NULL, t->values, tvec);
- copy_v3_v3(t->values_final, tvec);
+ if (applyNumInput(&t->num, values_final)) {
+ if (t->con.mode & CON_APPLY) {
+ if (t->con.mode & CON_AXIS0) {
+ /* Do nothing. */
+ }
+ else {
+ mul_v2_v2fl(values_final, t->spacemtx[1], values_final[0]);
+ }
+ }
+ }
+ else if (t->con.mode & CON_APPLY) {
+ t->con.applyVec(t, NULL, NULL, t->values, values_final);
}
else {
- // transform_snap_increment(t, t->values);
- applyNumInput(&t->num, t->values);
- copy_v3_v3(t->values_final, t->values);
+ copy_v2_v2(values_final, t->values);
}
- t->values_final[0] = floorf(t->values_final[0] + 0.5f);
- t->values_final[1] = floorf(t->values_final[1] + 0.5f);
+ values_final[0] = floorf(values_final[0] + 0.5f);
+ values_final[1] = floorf(values_final[1] + 0.5f);
+ copy_v2_v2(t->values_final, values_final);
headerSeqSlide(t, t->values_final, str);
applySeqSlideValue(t, t->values_final);
diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c
index 866b9d921c8..758a6d04f11 100644
--- a/source/blender/editors/transform/transform_mode_translate.c
+++ b/source/blender/editors/transform/transform_mode_translate.c
@@ -360,42 +360,49 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
if (t->flag & T_INPUT_IS_VALUES_FINAL) {
mul_v3_m3v3(global_dir, t->spacemtx, t->values);
}
+ else if (applyNumInput(&t->num, global_dir)) {
+ if (t->con.mode & CON_APPLY) {
+ if (t->con.mode & CON_AXIS0) {
+ /* Do nothing. */
+ }
+ else if (t->con.mode & CON_AXIS1) {
+ mul_v3_v3fl(global_dir, t->spacemtx[1], global_dir[0]);
+ }
+ else if (t->con.mode & CON_AXIS2) {
+ mul_v3_v3fl(global_dir, t->spacemtx[2], global_dir[0]);
+ }
+ }
+ }
else {
copy_v3_v3(global_dir, t->values);
- if (applyNumInput(&t->num, global_dir)) {
- removeAspectRatio(t, global_dir);
+
+ t->tsnap.snapElem = 0;
+ applySnapping(t, global_dir);
+ transform_snap_grid(t, global_dir);
+
+ if (t->con.mode & CON_APPLY) {
+ float in[3];
+ copy_v3_v3(in, global_dir);
+ t->con.applyVec(t, NULL, NULL, in, global_dir);
}
- else {
- applySnapping(t, global_dir);
- if (!validSnap(t) && !(t->con.mode & CON_APPLY)) {
- float dist_sq = FLT_MAX;
- if (transform_snap_grid(t, global_dir)) {
- dist_sq = len_squared_v3v3(t->values, global_dir);
- }
+ float incr_dir[3];
+ mul_v3_m3v3(incr_dir, t->spacemtx_inv, global_dir);
+ if (transform_snap_increment(t, incr_dir)) {
+ mul_v3_m3v3(incr_dir, t->spacemtx, incr_dir);
- /* Check the snap distance to the initial value to work with mixed snap. */
- float increment_loc[3];
- copy_v3_v3(increment_loc, t->values);
- if (transform_snap_increment(t, increment_loc)) {
- if ((dist_sq == FLT_MAX) || (len_squared_v3v3(t->values, increment_loc) < dist_sq)) {
- copy_v3_v3(global_dir, increment_loc);
- }
- }
+ /* Test for mixed snap with grid. */
+ float snap_dist_sq = FLT_MAX;
+ if (t->tsnap.snapElem != 0) {
+ snap_dist_sq = len_squared_v3v3(t->values, global_dir);
+ }
+ if ((snap_dist_sq == FLT_MAX) || (len_squared_v3v3(global_dir, incr_dir) < snap_dist_sq)) {
+ copy_v3_v3(global_dir, incr_dir);
}
}
}
- if (t->con.mode & CON_APPLY) {
- float in[3];
- copy_v3_v3(in, global_dir);
- t->con.applyVec(t, NULL, NULL, in, global_dir);
- headerTranslation(t, global_dir, str);
- }
- else {
- headerTranslation(t, global_dir, str);
- }
-
+ headerTranslation(t, global_dir, str);
applyTranslationValue(t, global_dir);
/* evil hack - redo translation if clipping needed */
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 1813acadb9e..a546aabd095 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -464,6 +464,7 @@ void applySnapping(TransInfo *t, float *vec)
void resetSnapping(TransInfo *t)
{
t->tsnap.status = 0;
+ t->tsnap.snapElem = 0;
t->tsnap.align = false;
t->tsnap.project = 0;
t->tsnap.mode = 0;
@@ -1412,12 +1413,12 @@ void snapSequenceBounds(TransInfo *t, const int mval[2])
t->values[0] = frame_near - frame_snap;
}
-static void snap_grid_apply_ex(
+static void snap_grid_apply(
TransInfo *t, const int max_index, const float grid_dist, const float loc[3], float r_out[3])
{
+ BLI_assert(max_index <= 2);
const float *center_global = t->center_global;
const float *asp = t->aspect;
- bool use_local_axis = false;
/* use a fallback for cursor selection,
* this isn't useful as a global center for absolute grid snapping
@@ -1427,74 +1428,27 @@ static void snap_grid_apply_ex(
center_global = cd->global;
}
- if (t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2)) {
- use_local_axis = true;
+ float in[3];
+ if (t->con.mode & CON_APPLY) {
+ BLI_assert(t->tsnap.snapElem == 0);
+ t->con.applyVec(t, NULL, NULL, loc, in);
+ }
+ else {
+ copy_v3_v3(in, loc);
}
for (int i = 0; i <= max_index; i++) {
- /* do not let unconstrained axis jump to absolute grid increments */
- if (!(t->con.mode & CON_APPLY) || t->con.mode & (CON_AXIS0 << i)) {
- const float iter_fac = grid_dist * asp[i];
-
- if (use_local_axis) {
- float local_axis[3];
- float pos_on_axis[3];
-
- copy_v3_v3(local_axis, t->spacemtx[i]);
- copy_v3_v3(pos_on_axis, t->spacemtx[i]);
-
- /* amount of movement on axis from initial pos */
- mul_v3_fl(pos_on_axis, loc[i]);
-
- /* actual global position on axis */
- add_v3_v3(pos_on_axis, center_global);
-
- float min_dist = INFINITY;
- for (int j = 0; j < 3; j++) {
- if (fabs(local_axis[j]) < 0.01f) {
- /* Ignore very small (normalized) axis changes */
- continue;
- }
-
- /* closest point on grid */
- float grid_p = iter_fac * roundf(pos_on_axis[j] / iter_fac);
- float dist_p = fabs((grid_p - pos_on_axis[j]) / local_axis[j]);
-
- /* The amount of distance needed to travel along the
- * local axis to snap to the closest grid point */
- /* in the global j axis direction */
- float move_dist = (grid_p - center_global[j]) / local_axis[j];
-
- if (dist_p < min_dist) {
- min_dist = dist_p;
- r_out[i] = move_dist;
- }
- }
- }
- else {
- r_out[i] = iter_fac * roundf((loc[i] + center_global[i]) / iter_fac) - center_global[i];
- }
- }
+ const float iter_fac = grid_dist * asp[i];
+ r_out[i] = iter_fac * roundf((in[i] + center_global[i]) / iter_fac) - center_global[i];
}
}
-static void snap_grid_apply(TransInfo *t, int max_index, const float grid_dist, float *r_val)
+bool transform_snap_grid(TransInfo *t, float *val)
{
- BLI_assert(t->tsnap.mode & SCE_SNAP_MODE_GRID);
- BLI_assert(max_index <= 2);
-
- /* Early bailing out if no need to snap */
- if (grid_dist == 0.0f) {
- return;
+ if (!activeSnap(t)) {
+ return false;
}
- /* absolute snapping on grid based on global center.
- * for now only 3d view (others can be added if we want) */
- snap_grid_apply_ex(t, max_index, grid_dist, r_val, r_val);
-}
-
-bool transform_snap_grid(TransInfo *t, float *val)
-{
if ((!(t->tsnap.mode & SCE_SNAP_MODE_GRID)) || validSnap(t)) {
/* Don't do grid snapping if there is a valid snap point. */
return false;
@@ -1508,10 +1462,15 @@ bool transform_snap_grid(TransInfo *t, float *val)
return false;
}
- float grid_dist = activeSnap(t) ? (t->modifiers & MOD_PRECISION) ? t->snap[2] : t->snap[1] :
- t->snap[0];
+ float grid_dist = (t->modifiers & MOD_PRECISION) ? t->snap[2] : t->snap[1];
+
+ /* Early bailing out if no need to snap */
+ if (grid_dist == 0.0f) {
+ return false;
+ }
- snap_grid_apply(t, t->idx_max, grid_dist, val);
+ snap_grid_apply(t, t->idx_max, grid_dist, val, val);
+ t->tsnap.snapElem = SCE_SNAP_MODE_GRID;
return true;
}
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 207606c2dcd..e05d1fedf6d 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -33,9 +33,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
ed_transverts.c
@@ -106,7 +103,6 @@ set(SRC
set(LIB
)
-add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt
index a39234561c2..f1751ef8d27 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -31,9 +31,6 @@ set(INC
../../../../intern/guardedalloc
)
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
set(SRC
uvedit_buttons.c
@@ -58,6 +55,5 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")