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:
authorSybren A. Stüvel <sybren@blender.org>2019-07-16 16:06:25 +0300
committerSybren A. Stüvel <sybren@blender.org>2019-07-16 16:06:25 +0300
commite6e69a28ab28631b2b1b99f55fb618459e7671ad (patch)
tree42684562cb6bbf9ddf10ca3708f31147a500c653 /source/blender/editors/screen
parentdd3e3474abcb9c07ba0bd26f6b8940fc906d97a5 (diff)
Fixed crash when adding/removing custom normals from pinned mesh
When a mesh is pinned in the properties panel, Blender crashes when you click the "Add Custom Split Normals Data". The code calls `ob = ED_object_context(C)` which returns NULL when the mesh is pinned in the properties panel, causing a segfault when trying to get the mesh via `ob->data`. A new function `ED_mesh_context(C)` avoids this by first checking whether a mesh was pinned in the context. If not, it checks the pinned object's data. If that's not there, or it's not a mesh, it returns the active object's mesh. Finally it returns NULL if there is no active object, or if the active object is not a mesh object. Reviewed By: brecht, mont29 Differential Revision: https://developer.blender.org/D5223
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/screen_ops.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 5fc7979a631..c9a45728bc2 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -74,6 +74,7 @@
#include "ED_clip.h"
#include "ED_image.h"
#include "ED_keyframes_draw.h"
+#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_screen_types.h"
@@ -371,6 +372,12 @@ bool ED_operator_object_active_editable_font(bContext *C)
return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_FONT));
}
+bool ED_operator_editable_mesh(bContext *C)
+{
+ Mesh *mesh = ED_mesh_context(C);
+ return (mesh != NULL) && !ID_IS_LINKED(mesh);
+}
+
bool ED_operator_editmesh(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);