[Bf-blender-cvs] [fa73cd1854d] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Mon Jul 2 13:00:58 CEST 2018
Commit: fa73cd1854d47c0be2b74dbebc016cd8f3c3a371
Author: Antonio Vazquez
Date: Mon Jul 2 12:48:37 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBfa73cd1854d47c0be2b74dbebc016cd8f3c3a371
Merge branch 'blender2.8' into greasepencil-object
Conflicts:
source/blender/editors/gpencil/gpencil_data.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_intern.h
source/blender/editors/gpencil/gpencil_utils.c
source/blender/makesrna/intern/rna_internal.h
===================================================================
===================================================================
diff --cc source/blender/editors/gpencil/gpencil_convert.c
index 40d5aa61057,ccdbcba71f9..e553676dfe5
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@@ -1291,12 -1291,9 +1291,12 @@@ static void gp_convert_set_end_frame(st
}
}
- static int gp_convert_poll(bContext *C)
+ static bool gp_convert_poll(bContext *C)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ int cfra_eval = (int)DEG_get_ctime(depsgraph);
+
bGPDlayer *gpl = NULL;
bGPDframe *gpf = NULL;
ScrArea *sa = CTX_wm_area(C);
diff --cc source/blender/editors/gpencil/gpencil_edit.c
index 1aa8ebf6261,ec67b2da161..348e78a3904
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@@ -95,13 -85,9 +95,13 @@@
/* ************************************************ */
/* Stroke Edit Mode Management */
- static int gpencil_editmode_toggle_poll(bContext *C)
-
+ static bool gpencil_editmode_toggle_poll(bContext *C)
{
+ /* if using gpencil object, use this gpd */
+ Object *ob = CTX_data_active_object(C);
+ if ((ob) && (ob->type == OB_GPENCIL)) {
+ return ob->data != NULL;
+ }
return ED_gpencil_data_get_active(C) != NULL;
}
diff --cc source/blender/editors/gpencil/gpencil_intern.h
index c9385b0c2b6,90ff1e0bb25..d48bfd99feb
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@@ -224,10 -94,12 +224,10 @@@ void gp_stroke_convertcoords_tpoint(str
/* Poll Callbacks ------------------------------------ */
/* gpencil_utils.c */
- int gp_add_poll(struct bContext *C);
- int gp_active_layer_poll(struct bContext *C);
- int gp_active_brush_poll(struct bContext *C);
- int gp_brush_crt_presets_poll(bContext *C);
+ bool gp_add_poll(struct bContext *C);
+ bool gp_active_layer_poll(struct bContext *C);
+ bool gp_active_brush_poll(struct bContext *C);
-bool gp_active_palette_poll(struct bContext *C);
-bool gp_active_palettecolor_poll(struct bContext *C);
-bool gp_brush_crt_presets_poll(bContext *C);
++boll gp_brush_crt_presets_poll(bContext *C);
/* Copy/Paste Buffer --------------------------------- */
/* gpencil_edit.c */
diff --cc source/blender/editors/gpencil/gpencil_paint.c
index 997a86d33ec,483966c0c78..b01717840a0
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@@ -237,32 -203,19 +237,32 @@@ static void gp_session_validatebuffer(t
/* Context Wrangling... */
/* check if context is suitable for drawing */
- static int gpencil_draw_poll(bContext *C)
+ static bool gpencil_draw_poll(bContext *C)
{
if (ED_operator_regionactive(C)) {
- /* check if current context can support GPencil data */
- if (ED_gpencil_data_get_pointers(C, NULL) != NULL) {
- /* check if Grease Pencil isn't already running */
- if (ED_gpencil_session_active() == 0)
- return 1;
- else
- CTX_wm_operator_poll_msg_set(C, "Grease Pencil operator is already active");
+ ScrArea *sa = CTX_wm_area(C);
+ if (!ELEM(sa->spacetype, SPACE_VIEW3D)) {
+ /* check if current context can support GPencil data */
+ if (ED_gpencil_data_get_pointers(C, NULL) != NULL) {
+ /* check if Grease Pencil isn't already running */
+ if (ED_gpencil_session_active() == 0)
+ return 1;
+ else
+ CTX_wm_operator_poll_msg_set(C, "Grease Pencil operator is already active");
+ }
+ else {
+ CTX_wm_operator_poll_msg_set(C, "Failed to find Grease Pencil data to draw into");
+ }
+ return 0;
}
+ /* 3D Viewport */
else {
- CTX_wm_operator_poll_msg_set(C, "Failed to find Grease Pencil data to draw into");
+ if (ED_gpencil_session_active() == 0) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
}
else {
diff --cc source/blender/editors/gpencil/gpencil_utils.c
index 8aa15bd451b,8b65855f7c4..af6e45bc114
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@@ -308,16 -278,31 +308,16 @@@ bool gp_active_layer_poll(bContext *C
}
/* poll callback for checking if there is an active brush */
- int gp_active_brush_poll(bContext *C)
+ bool gp_active_brush_poll(bContext *C)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
-
- return (brush != NULL);
-}
-
-/* poll callback for checking if there is an active palette */
-bool gp_active_palette_poll(bContext *C)
-{
- bGPdata *gpd = ED_gpencil_data_get_active(C);
- bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
-
- return (palette != NULL);
-}
-
-/* poll callback for checking if there is an active palette color */
-bool gp_active_palettecolor_poll(bContext *C)
-{
- bGPdata *gpd = ED_gpencil_data_get_active(C);
- bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
- bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
-
- return (palcolor != NULL);
+ Paint *paint = &ts->gp_paint->paint;
+ if (paint) {
+ return (paint->brush != NULL);
+ }
+ else {
+ return false;
+ }
}
/* ******************************************************** */
diff --cc source/blender/makesrna/intern/rna_internal.h
index 8ff7564b6ef,5784b2a489a..ce6ba20d511
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@@ -281,17 -280,16 +281,17 @@@ void rna_Mesh_update_draw(struct Main *
void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr);
/* basic poll functions for object types */
- int rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
- int rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
- int rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
- int rna_GPencil_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
- int rna_Lamp_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
- int rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
- int rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ bool rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ bool rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ bool rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
++bool rna_GPencil_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ bool rna_Lamp_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ bool rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ bool rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
/* basic poll functions for actions (to prevent actions getting set in wrong places) */
- int rna_Action_id_poll(struct PointerRNA *ptr, struct PointerRNA value);
- int rna_Action_actedit_assign_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ bool rna_Action_id_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ bool rna_Action_actedit_assign_poll(struct PointerRNA *ptr, struct PointerRNA value);
char *rna_TextureSlot_path(struct PointerRNA *ptr);
char *rna_Node_ImageUser_path(struct PointerRNA *ptr);
More information about the Bf-blender-cvs
mailing list