Commit: b42a3d24853195150130df513353c034ac528933
Author: Antony Riakiotakis
Date:   Tue Mar 3 11:34:23 2015 +0100
Branches: master
https://developer.blender.org/rBb42a3d24853195150130df513353c034ac528933

Another stability commit for legacy users - don't crash when toggling
dyntopo just notify user that their system doesn't support it.

===================================================================

M       source/blender/editors/sculpt_paint/sculpt.c
M       source/blender/gpu/GPU_extensions.h
M       source/blender/gpu/intern/gpu_extensions.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 69428c0..c0925ee 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 186db85..228bea1 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 c7e89e5..f9bdaad 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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to