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
path: root/source
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-03-03 13:34:23 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-03-03 13:34:23 +0300
commitb42a3d24853195150130df513353c034ac528933 (patch)
treeacfd20a730e5586127f2eeb04991f00e469b2b89 /source
parentf2bc3dd67806e0757a8e952516337b37ee987f19 (diff)
Another stability commit for legacy users - don't crash when toggling
dyntopo just notify user that their system doesn't support it.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c60
-rw-r--r--source/blender/gpu/GPU_extensions.h1
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c5
3 files changed, 46 insertions, 20 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 69428c0f0d7..c0925eeca39 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -83,8 +83,8 @@
#include "RNA_access.h"
#include "RNA_define.h"
-
#include "GPU_buffers.h"
+#include "GPU_extensions.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -4650,6 +4650,10 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(o
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
+ if (!GPU_vertex_buffer_support()) {
+ return OPERATOR_CANCELLED;
+ }
+
if (ss->bm) {
sculpt_undo_push_begin("Dynamic topology disable");
sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END);
@@ -4666,32 +4670,44 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(o
}
-static int dyntopo_warning_popup(bContext *C, wmOperatorType *ot, bool vdata, bool modifiers)
+static int dyntopo_warning_popup(bContext *C, wmOperatorType *ot, bool vdata, bool modifiers, bool novertexbuf)
{
- uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Warning!"), ICON_ERROR);
- uiLayout *layout = UI_popup_menu_layout(pup);
+ if (novertexbuf) {
+ uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Error!"), ICON_ERROR);
+ uiLayout *layout = UI_popup_menu_layout(pup);
- if (vdata) {
- const char *msg_error = TIP_("Vertex Data Detected!");
- const char *msg = TIP_("Dyntopo will not preserve vertex colors, UVs, or other customdata");
- uiItemL(layout, msg_error, ICON_INFO);
- uiItemL(layout, msg, ICON_NONE);
- uiItemS(layout);
- }
+ uiItemL(layout, "Dyntopo is not supported on this system", ICON_INFO);
+ uiItemL(layout, "No vertex buffer support detected", ICON_NONE);
- if (modifiers) {
- const char *msg_error = TIP_("Generative Modifiers Detected!");
- const char *msg = TIP_("Keeping the modifiers will increase polycount when returning to object mode");
+ uiItemFullO_ptr(layout, ot, IFACE_("OK"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0);
- uiItemL(layout, msg_error, ICON_INFO);
- uiItemL(layout, msg, ICON_NONE);
- uiItemS(layout);
+ UI_popup_menu_end(C, pup);
}
+ else {
+ uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Warning!"), ICON_ERROR);
+ uiLayout *layout = UI_popup_menu_layout(pup);
+
+ if (vdata) {
+ const char *msg_error = TIP_("Vertex Data Detected!");
+ const char *msg = TIP_("Dyntopo will not preserve vertex colors, UVs, or other customdata");
+ uiItemL(layout, msg_error, ICON_INFO);
+ uiItemL(layout, msg, ICON_NONE);
+ uiItemS(layout);
+ }
+
+ if (modifiers) {
+ const char *msg_error = TIP_("Generative Modifiers Detected!");
+ const char *msg = TIP_("Keeping the modifiers will increase polycount when returning to object mode");
- uiItemFullO_ptr(layout, ot, IFACE_("OK"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0);
+ uiItemL(layout, msg_error, ICON_INFO);
+ uiItemL(layout, msg, ICON_NONE);
+ uiItemS(layout);
+ }
- UI_popup_menu_end(C, pup);
+ uiItemFullO_ptr(layout, ot, IFACE_("OK"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0);
+ UI_popup_menu_end(C, pup);
+ }
return OPERATOR_INTERFACE;
}
@@ -4702,6 +4718,10 @@ static int sculpt_dynamic_topology_toggle_invoke(bContext *C, wmOperator *op, co
Mesh *me = ob->data;
SculptSession *ss = ob->sculpt;
+ if (!GPU_vertex_buffer_support()) {
+ dyntopo_warning_popup(C, op->type, false, false, true);
+ }
+
if (!ss->bm) {
Scene *scene = CTX_data_scene(C);
ModifierData *md;
@@ -4736,7 +4756,7 @@ static int sculpt_dynamic_topology_toggle_invoke(bContext *C, wmOperator *op, co
if (vdata || modifiers) {
/* The mesh has customdata that will be lost, let the user confirm this is OK */
- return dyntopo_warning_popup(C, op->type, vdata, modifiers);
+ return dyntopo_warning_popup(C, op->type, vdata, modifiers, false);
}
}
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 186db85d31a..228bea14e00 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -58,6 +58,7 @@ void GPU_extensions_disable(void);
int GPU_glsl_support(void);
int GPU_non_power_of_two_support(void);
+int GPU_vertex_buffer_support(void);
int GPU_display_list_support(void);
int GPU_color_depth(void);
void GPU_code_generate_glsl_lib(void);
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index c7e89e50b7e..f9bdaad832a 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -263,6 +263,11 @@ int GPU_non_power_of_two_support(void)
return GLEW_ARB_texture_non_power_of_two;
}
+int GPU_vertex_buffer_support(void)
+{
+ return GLEW_ARB_vertex_buffer_object || GLEW_VERSION_1_5;
+}
+
int GPU_display_list_support(void)
{
return !GG.dlistsdisabled;