[Bf-blender-cvs] [3804636ee57] master: Fix: Better fix for KeyingSet "Export to File" and unescaped characters

2019-03-01 Thread Joshua Leung
Commit: 3804636ee57b58c0ca02dd5360f6df62603ae929
Author: Joshua Leung
Date:   Sat Mar 2 02:15:54 2019 +1300
Branches: master
https://developer.blender.org/rB3804636ee57b58c0ca02dd5360f6df62603ae929

Fix: Better fix for KeyingSet "Export to File" and unescaped characters

Use Python's native raw formatting instead, which should take care of any issues
we may face.

===

M   release/scripts/startup/bl_operators/anim.py

===

diff --git a/release/scripts/startup/bl_operators/anim.py 
b/release/scripts/startup/bl_operators/anim.py
index 61247f1ae1e..4f2642bbe7c 100644
--- a/release/scripts/startup/bl_operators/anim.py
+++ b/release/scripts/startup/bl_operators/anim.py
@@ -79,7 +79,7 @@ class ANIM_OT_keying_set_export(Operator):
 f.write("# Keying Set Level declarations\n")
 f.write("ks = scene.keying_sets.new(idname=\"%s\", name=\"%s\")\n"
 "" % (ks.bl_idname, ks.bl_label))
-f.write("ks.bl_description = \"\"\"%s\"\"\"\n" % ks.bl_description)
+f.write("ks.bl_description = %r\n" % ks.bl_description)
 
 if not ks.is_path_absolute:
 f.write("ks.is_path_absolute = False\n")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dbeef6751db] master: Cleanup: Adding braces around all cases here to make it easier for the next step

2019-03-01 Thread Joshua Leung
Commit: dbeef6751db3cf300a588b1530441ff685d3f103
Author: Joshua Leung
Date:   Sat Mar 2 02:11:14 2019 +1300
Branches: master
https://developer.blender.org/rBdbeef6751db3cf300a588b1530441ff685d3f103

Cleanup: Adding braces around all cases here to make it easier for the next step

===

M   source/blender/editors/space_action/action_select.c

===

diff --git a/source/blender/editors/space_action/action_select.c 
b/source/blender/editors/space_action/action_select.c
index d97a27a403a..c7b62af9d0b 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -306,11 +306,15 @@ static void box_select_action(bAnimContext *ac, const 
rcti rect, short mode, sho
break;
}
case ANIMTYPE_MASKLAYER:
+   {

ED_masklayer_frames_select_box(ale->data, rectf.xmin, rectf.xmax, selectmode);
break;
+   }
default:
+   {
ANIM_animchannel_keyframes_loop(, 
ac->ads, ale, ok_cb, select_cb, NULL);
break;
+   }
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2bad126999b] master: Fix T62057: Particle settings keyframes not showing in Graph Editor channels

2019-03-01 Thread Joshua Leung
Commit: 2bad126999b2094e685fb8599bb4d39b76a38a2e
Author: Joshua Leung
Date:   Sat Mar 2 02:10:43 2019 +1300
Branches: master
https://developer.blender.org/rB2bad126999b2094e685fb8599bb4d39b76a38a2e

Fix T62057: Particle settings keyframes not showing in Graph Editor channels

In short, the settings to expand/collapse the Particles Animation Dopesheet 
expander
were no longer getting exposed, so the F-Curves attached to the particle 
settings
were not showing up in the channels list as that section was collapsed and 
couldn't
be opened from the UI.

Early on during the development of 2.8, we originally wanted to completely 
remove
the Particle System. Eventually that decision got walked back, and so particles
were reinstated. Well... most of the relevant code was! One of the areas that 
was
the most messed up during this process was the animation editor support for 
these
channels. It seems that there was almost a two-step removal process here -
the first pass tried to keep the channel definitions while removing all 
references
to particle stuff, while the second pass tried to remove the definitions 
completely
and/or re-added them in the wrong places, etc. To say the removal/reverting 
history is
here is "colourful" is an understatement...

===

M   source/blender/editors/animation/anim_channels_defines.c

===

diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index 29ae22cd306..d1cef1cfa17 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -2028,7 +2028,7 @@ static int acf_dspart_setting_flag(bAnimContext 
*UNUSED(ac), eAnimChannel_Settin
 
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
-   return 0;
+   return PART_DS_EXPAND;
 
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
@@ -2046,18 +2046,22 @@ static int acf_dspart_setting_flag(bAnimContext 
*UNUSED(ac), eAnimChannel_Settin
 }
 
 /* get pointer to the setting */
-static void *acf_dspart_setting_ptr(bAnimListElem *UNUSED(ale), 
eAnimChannel_Settings setting, short *type)
+static void *acf_dspart_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings 
setting, short *type)
 {
+   ParticleSettings *part = (ParticleSettings *)ale->data;
+
/* clear extra return data first */
*type = 0;
 
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
-   return NULL;
+   return GET_ACF_FLAG_PTR(part->flag, type);
 
case ACHANNEL_SETTING_SELECT: /* selected */
case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor 
only) */
+   if (part->adt)
+   return GET_ACF_FLAG_PTR(part->adt->flag, type);
return NULL;
 
default: /* unsupported */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [49618b0e18f] master: Fix: Ensure that KeyingSet.bl_description field is properly escaped when using the Export to File operator

2019-02-04 Thread Joshua Leung
Commit: 49618b0e18f7554dd70ac898d93abc7baf380081
Author: Joshua Leung
Date:   Tue Feb 5 16:21:35 2019 +1300
Branches: master
https://developer.blender.org/rB49618b0e18f7554dd70ac898d93abc7baf380081

Fix: Ensure that KeyingSet.bl_description field is properly escaped when using 
the Export to File operator

Previously, if double-quotes appeared in the KeyingSet.bl_description field,
these would cause a syntax error in the resulting .py script export of the
KeyingSet. Since single quotes are even more likely to appear
(e.g. as apostrophes), we now use triple quotes here.

Unreported bug, noticed earlier when investigating T61010.

===

M   release/scripts/startup/bl_operators/anim.py

===

diff --git a/release/scripts/startup/bl_operators/anim.py 
b/release/scripts/startup/bl_operators/anim.py
index fa8ca3575a6..61247f1ae1e 100644
--- a/release/scripts/startup/bl_operators/anim.py
+++ b/release/scripts/startup/bl_operators/anim.py
@@ -79,7 +79,7 @@ class ANIM_OT_keying_set_export(Operator):
 f.write("# Keying Set Level declarations\n")
 f.write("ks = scene.keying_sets.new(idname=\"%s\", name=\"%s\")\n"
 "" % (ks.bl_idname, ks.bl_label))
-f.write("ks.bl_description = \"%s\"\n" % ks.bl_description)
+f.write("ks.bl_description = \"\"\"%s\"\"\"\n" % ks.bl_description)
 
 if not ks.is_path_absolute:
 f.write("ks.is_path_absolute = False\n")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2a237377ce3] master: Fix typos

2019-02-03 Thread Joshua Leung
Commit: 2a237377ce390509bfd18cf70f645d17d8bc92aa
Author: Joshua Leung
Date:   Thu Jan 31 17:31:51 2019 +1300
Branches: master
https://developer.blender.org/rB2a237377ce390509bfd18cf70f645d17d8bc92aa

Fix typos

===

M   source/blender/editors/animation/anim_filter.c

===

diff --git a/source/blender/editors/animation/anim_filter.c 
b/source/blender/editors/animation/anim_filter.c
index 03d16dd078d..48e6d6c74a0 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1903,7 +1903,7 @@ static size_t animdata_filter_mask(Main *bmain, ListBase 
*anim_data, void *UNUSE
if (tmp_items) {
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
-   /* add gpd as channel too (if for drawing, and 
it has layers) */
+   /* add mask datablock as channel too (if for 
drawing, and it has layers) */
ANIMCHANNEL_NEW_CHANNEL(mask, 
ANIMTYPE_MASKDATABLOCK, NULL, NULL);
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [65340ad73f4] master: Fix T60753: Graph Editor showing cache curves regardless of filters

2019-02-03 Thread Joshua Leung
Commit: 65340ad73f4c70936a5132bc5d8f911408cfb826
Author: Joshua Leung
Date:   Thu Jan 31 15:42:59 2019 +1300
Branches: master
https://developer.blender.org/rB65340ad73f4c70936a5132bc5d8f911408cfb826

Fix T60753: Graph Editor showing cache curves regardless of filters

This commit adds a datablock filtering option for cache files channels,
so that a shot with lots of these in addition to standard animation
(e.g. the Spring production files) don't become bogged down by these.

Furthermore, these channels also respect the "Only Selected" toggle too now.

===

M   release/scripts/startup/bl_ui/space_dopesheet.py
M   source/blender/editors/animation/anim_filter.c
M   source/blender/makesdna/DNA_action_types.h
M   source/blender/makesrna/intern/rna_action.c

===

diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py 
b/release/scripts/startup/bl_ui/space_dopesheet.py
index 506a4f3a242..0a2e9ca3a82 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -148,6 +148,8 @@ class DopesheetFilterPopoverBase:
 flow.prop(dopesheet, "show_textures", text="Textures")
 if bpy.data.shape_keys:
 flow.prop(dopesheet, "show_shapekeys", text="Shape Keys")
+if bpy.data.cache_files:
+flow.prop(dopesheet, "show_cache_files", text="Cache Files")
 
 layout.separator()
 
diff --git a/source/blender/editors/animation/anim_filter.c 
b/source/blender/editors/animation/anim_filter.c
index 0c44a4a2c2c..03d16dd078d 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2980,9 +2980,11 @@ static size_t animdata_filter_dopesheet(bAnimContext 
*ac, ListBase *anim_data, b
}
 
/* Cache files level animations (frame duration and such). */
-   CacheFile *cache_file = ac->bmain->cachefiles.first;
-   for (; cache_file; cache_file = cache_file->id.next) {
-   items += animdata_filter_ds_cachefile(ac, anim_data, ads, 
cache_file, filter_mode);
+   if (!(ads->filterflag2 & ADS_FILTER_NOCACHEFILES) && !(ads->filterflag 
& ADS_FILTER_ONLYSEL)) {
+   CacheFile *cache_file = ac->bmain->cachefiles.first;
+   for (; cache_file; cache_file = cache_file->id.next) {
+   items += animdata_filter_ds_cachefile(ac, anim_data, 
ads, cache_file, filter_mode);
+   }
}
 
/* movie clip's animation */
diff --git a/source/blender/makesdna/DNA_action_types.h 
b/source/blender/makesdna/DNA_action_types.h
index 2e5b4c57375..2036284a279 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -727,12 +727,12 @@ typedef struct bDopeSheet {
 
/** Flags to use for filtering data. */
int filterflag;
+   int filterflag2;
/** Standard flags. */
int flag;
 
/** Index+1 of channel to rename - only gets set by renaming operator. 
*/
int renameIndex;
-   int pad;
 } bDopeSheet;
 
 
@@ -795,6 +795,11 @@ typedef enum eDopeSheet_FilterFlag {
ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | 
ADS_FILTER_NOLAM | ADS_FILTER_NOCUR | ADS_FILTER_NOPART | ADS_FILTER_NOARM | 
ADS_FILTER_NOSPK | ADS_FILTER_NOMODIFIERS),
 } eDopeSheet_FilterFlag;
 
+/* DopeSheet filter-flags - Overflow (filterflag2) */
+typedef enum eDopeSheet_FilterFlag2 {
+   ADS_FILTER_NOCACHEFILES  = (1 << 1),
+} eDopeSheet_FilterFlag2;
+
 /* DopeSheet general flags */
 typedef enum eDopeSheet_Flag {
/** when summary is shown, it is collapsed, so all other channels get 
hidden */
@@ -807,8 +812,6 @@ typedef enum eDopeSheet_Flag {
ADS_FLAG_FUZZY_NAMES= (1 << 2),
/** do not sort datablocks (mostly objects) by name (NOTE: potentially 
expensive operation) */
ADS_FLAG_NO_DB_SORT = (1 << 3),
-
-   /* NOTE: datablock filter flags continued (1 << 10) onwards... */
 } eDopeSheet_Flag;
 
 
diff --git a/source/blender/makesrna/intern/rna_action.c 
b/source/blender/makesrna/intern/rna_action.c
index 225045ed286..47a5401e25a 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -483,6 +483,12 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_SPEAKER, 0);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, 
NULL);
 
+   prop = RNA_def_property(srna, "show_cache_files", PROP_BOOLEAN, 
PROP_NONE);
+   RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag2", 
ADS_FILTER_NOCACHEFILES);
+   RNA_def_propert

[Bf-blender-cvs] [9d4ed6d03b6] master: Fix T59984: Drivers don't update values in UI or show proper errors

2019-01-08 Thread Joshua Leung
Commit: 9d4ed6d03b6910b5239c2f17b3559987330f9652
Author: Joshua Leung
Date:   Fri Jan 4 14:57:09 2019 +1300
Branches: master
https://developer.blender.org/rB9d4ed6d03b6910b5239c2f17b3559987330f9652

Fix T59984: Drivers don't update values in UI or show proper errors

We now perform COW -> original data flushing for all the debug values + error
status flags on Drivers/DriverVariables/DriverTargets, as these are only set
when errors are encountered when evaluating drivers.

===

M   source/blender/blenkernel/intern/anim_sys.c

===

diff --git a/source/blender/blenkernel/intern/anim_sys.c 
b/source/blender/blenkernel/intern/anim_sys.c
index 2019554996c..c5a21342dc0 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -3484,11 +3484,34 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph,
 
PathResolvedRNA anim_rna;
if (animsys_store_rna_setting(_ptr, fcu->rna_path, 
fcu->array_index, _rna)) {
+   /* Evaluate driver, and write results to 
COW-domain destination */
const float ctime = DEG_get_ctime(depsgraph);
const float curval = 
evaluate_fcurve_driver(_rna, fcu, driver_orig, ctime);
ok = animsys_write_rna_setting(_rna, 
curval);
+
+   /* Flush results & status codes to original 
data for UI (T59984) */
if (ok && DEG_is_active(depsgraph)) {
animsys_write_orig_anim_rna(_ptr, 
fcu->rna_path, fcu->array_index, curval);
+
+   /* curval is displayed in the UI, and 
flag contains error-status codes */
+   driver_orig->curval = 
fcu->driver->curval;
+   driver_orig->flag = fcu->driver->flag;
+
+   DriverVar *dvar_orig = 
driver_orig->variables.first;
+   DriverVar *dvar = 
fcu->driver->variables.first;
+   for (;
+dvar_orig && dvar;
+dvar_orig = dvar_orig->next, dvar 
= dvar->next)
+   {
+   DriverTarget *dtar_orig = 
_orig->targets[0];
+   DriverTarget *dtar = 
>targets[0];
+   for (int i = 0; i < 
MAX_DRIVER_TARGETS; i++, dtar_orig++, dtar++) {
+   dtar_orig->flag = 
dtar->flag;
+   }
+
+   dvar_orig->curval = 
dvar->curval;
+   dvar_orig->flag = dvar->flag;
+   }
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [395120ed72e] master: Typo fixes

2019-01-08 Thread Joshua Leung
Commit: 395120ed72e9cca0a21a876a46fec19e1531f59f
Author: Joshua Leung
Date:   Fri Jan 4 15:02:41 2019 +1300
Branches: master
https://developer.blender.org/rB395120ed72e9cca0a21a876a46fec19e1531f59f

Typo fixes

===

M   source/blender/blenkernel/BKE_animsys.h
M   source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c

===

diff --git a/source/blender/blenkernel/BKE_animsys.h 
b/source/blender/blenkernel/BKE_animsys.h
index f85782d9caa..7cdb62712e8 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -154,7 +154,7 @@ char *BKE_animdata_driver_path_hack(struct bContext *C, 
struct PointerRNA *ptr,
 char *base_path);
 
 /* * */
-/* GPUBatch AnimData API */
+/* Batch AnimData API */
 
 /* Define for callback looper used in BKE_animdata_main_cb */
 typedef void (*ID_AnimData_Edit_Callback)(struct ID *id, struct AnimData *adt, 
void *user_data);
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index dbf1a67603f..e9e82d0ed8e 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -57,7 +57,7 @@ static void initData(GpencilModifierData *md)
BuildGpencilModifierData *gpmd = (BuildGpencilModifierData *)md;
 
/* We deliberately set this range to the half the default
-* frame-range to have an immediate effect ot suggest use-cases
+* frame-range to have an immediate effect to suggest use-cases
 */
gpmd->start_frame = 1;
gpmd->end_frame = 125;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [37ffd95594f] blender2.8: Fix: Drivers popover not showing

2018-10-19 Thread Joshua Leung
Commit: 37ffd95594fe801cd51f60816e575fb3786cd095
Author: Joshua Leung
Date:   Sat Oct 13 11:32:28 2018 +1300
Branches: blender2.8
https://developer.blender.org/rB37ffd95594fe801cd51f60816e575fb3786cd095

Fix: Drivers popover not showing

This was broken since cca87ccc753a85b447872a259c9d3e3f07ec1c13

The problem was that as this popover was defined in the C-code
for the Graph Editor, the relevant panel never got added to the
WM_paneltype registry, since only Python defined panels get
WM_paneltype_add() called when they are defined.

Since the majority of panels defined for regions are only used there,
a more localised fix was applied here by only adding the driver popover
to the global list manually.

===

M   source/blender/editors/space_graph/graph_buttons.c

===

diff --git a/source/blender/editors/space_graph/graph_buttons.c 
b/source/blender/editors/space_graph/graph_buttons.c
index ddb248f754d..25d1465c579 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -1197,7 +1197,7 @@ void graph_buttons_register(ARegionType *art)
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = graph_panel_drivers_popover;
pt->poll = graph_panel_drivers_popover_poll;
-   BLI_addtail(>paneltypes, pt);
+   WM_paneltype_add(pt); /* This panel isn't used in this region. Add 
explicitly to global list (so popovers work). */
 
pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers");
strcpy(pt->idname, "GRAPH_PT_modifiers");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b634bf9fb64] blender2.8: Fix typo

2018-10-19 Thread Joshua Leung
Commit: b634bf9fb64930e0073c17bc115b6c3436b9a8e2
Author: Joshua Leung
Date:   Sat Oct 20 15:28:43 2018 +1300
Branches: blender2.8
https://developer.blender.org/rBb634bf9fb64930e0073c17bc115b6c3436b9a8e2

Fix typo

===

M   source/blender/editors/space_graph/graph_buttons.c

===

diff --git a/source/blender/editors/space_graph/graph_buttons.c 
b/source/blender/editors/space_graph/graph_buttons.c
index 25d1465c579..2b114cd326b 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -891,7 +891,7 @@ static void graph_draw_driver_settings_panel(uiLayout 
*layout, ID *id, FCurve *f
but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, 
ICON_ADD, IFACE_("Add Input Variable"),
   0, 0, 10 * UI_UNIT_X, UI_UNIT_Y,
   NULL, 0.0, 0.0, 0, 0,
-  TIP_("Driver variables ensure that all 
dependencies will be accounted for, eusuring that drivers will update 
correctly"));
+  TIP_("Driver variables ensure that all 
dependencies will be accounted for, ensuring that drivers will update 
correctly"));
UI_but_func_set(but, driver_add_var_cb, driver, NULL);
 
/* copy/paste (as sub-row) */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8ee06f50c05] blender2.8: Motion Path Calcs: Minor optimisation tweaks

2018-08-22 Thread Joshua Leung
Commit: 8ee06f50c059e23802bde0b9eacf28f3871df79f
Author: Joshua Leung
Date:   Thu Aug 23 16:29:06 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB8ee06f50c059e23802bde0b9eacf28f3871df79f

Motion Path Calcs: Minor optimisation tweaks

* Don't print on every frame evaluated. This was only needed
  earlier to track the progress (and why things were taking so
  long - answer, it was the Scene COW issue). Saves 50-100 ms

* Remove the extra calculation of the scene after evaluating
  motion paths. This shouldn't be needed now with COW.
  Saves about 20-30 ms

===

M   source/blender/blenkernel/intern/anim.c

===

diff --git a/source/blender/blenkernel/intern/anim.c 
b/source/blender/blenkernel/intern/anim.c
index ece3a018a9e..68f691e4b1c 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -466,10 +466,8 @@ static void motionpaths_calc_bake_targets(ListBase 
*targets, int cframe)
}
 
/* calculate path over requested range */
-   printf("Calculating Paths over Frame Range:\n");
+   printf("Calculating MotionPaths between frames %d - %d (%d frames)\n", 
sfra, efra, efra - sfra + 1);
for (CFRA = sfra; CFRA <= efra; CFRA++) {
-   printf("  Frame %d\n", CFRA);
-   
/* update relevant data for new frame */
motionpaths_calc_update_scene(bmain, depsgraph);
 
@@ -478,8 +476,12 @@ static void motionpaths_calc_bake_targets(ListBase 
*targets, int cframe)
}
 
/* reset original environment */
+   /* NOTE: We shouldn't need to reevaluate the main scene,
+* as the depsgraph passed in calculates the results on a
+* a copy-on-write copy of the data. That said, we have to
+* restore the current frame settings
+*/
CFRA = cfra;
-   motionpaths_calc_update_scene(bmain, depsgraph);  // XXX: Soon to be 
obsolete
 
/* clear recalc flags from targets */
for (mpt = targets->first; mpt; mpt = mpt->next) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3fa4e526577] blender2.8: Motion Path Calcs: Use filtered depsgraph by default

2018-08-22 Thread Joshua Leung
Commit: 3fa4e52657758b37698a6187764239560ff3d573
Author: Joshua Leung
Date:   Thu Aug 23 16:51:54 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB3fa4e52657758b37698a6187764239560ff3d573

Motion Path Calcs: Use filtered depsgraph by default

Use debug_value = -1 to disable the use of the filtered depsgraph.
It's still useful to have this for benchmarking + until we're
confident the filtering works safely.

===

M   source/blender/editors/armature/pose_edit.c

===

diff --git a/source/blender/editors/armature/pose_edit.c 
b/source/blender/editors/armature/pose_edit.c
index ca4ea0c5ff9..2ebc04a39ee 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -201,7 +201,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, 
Object *ob)
bool free_depsgraph = false;
 
/* Override depsgraph with a filtered, simpler copy */
-   if (G.debug_value == 555) {
+   if (G.debug_value != -1) {
 TIMEIT_START(filter_pose_depsgraph);
DEG_FilterQuery query = {0};

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [18c7dfa8dc0] blender2.8: Cleanup: Remove the conditional ID node removal stuff, copied from clear_id_nodes()

2018-08-22 Thread Joshua Leung
Commit: 18c7dfa8dc082f78b55d5dd59bee6c532682bf3f
Author: Joshua Leung
Date:   Thu Aug 23 15:54:58 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB18c7dfa8dc082f78b55d5dd59bee6c532682bf3f

Cleanup: Remove the conditional ID node removal stuff, copied from 
clear_id_nodes()

This was just randomly leaving all the Particle datablocks in the
filtered graph (and causing and extra/excess pass over the ID's
to get run). Unless we actually need those specially kept for
some reason later, it's better to leave those out for now.

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 4038f0cb135..8cfbacd6e4d 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -116,61 +116,6 @@ void deg_unlink_opnode(Depsgraph *graph, OperationDepsNode 
*op_node)
}
 }
 
-/* Remove and free given ID Node */
-// XXX: Use id_cow or id_orig?
-bool deg_filter_free_idnode(Depsgraph *graph, IDDepsNode *id_node,
-const std::function & 
filter)
-{
-   if (id_node->done == 0) {
-   /* This node has not been marked for deletion */
-   return false;
-   }
-   else {
-   const ID_Type id_type = GS(id_node->id_orig->name);
-   if (filter(id_type)) {
-   //printf("  id_type (T) = %d ");
-   id_node->destroy();
-   return true;
-   }
-   else {
-   //printf("  id_type (F) = %d ");
-   return false;
-   }
-   }
-}
-
-/* Remove and free ID Nodes of a particular type from the graph
- *
- * See Depsgraph::clear_id_nodes() and Depsgraph::clear_id_nodes_conditional()
- * for more details about why we need these type filters
- */
-void deg_filter_clear_ids_conditional(
-Depsgraph *graph,
-const std::function & filter)
-{
-   /* Based on Depsgraph::clear_id_nodes_conditional()... */
-   for (Depsgraph::IDDepsNodes::const_iterator it = 
graph->id_nodes.begin();
-it != graph->id_nodes.end();
-)
-   {
-   IDDepsNode *id_node = *it;
-   ID *id = id_node->id_orig;
-   
-   if (deg_filter_free_idnode(graph, id_node, filter)) {
-   /* Node data got destroyed. Remove from collections, 
and free */
-   //printf("  culling %s\n", id->name);
-   BLI_ghash_remove(graph->id_hash, id, NULL, NULL);
-   it = graph->id_nodes.erase(it);
-   OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
-   }
-   else {
-   /* Node wasn't freed. Increment iterator */
-   //printf("  skipping %s\n", id->name);
-   ++it;
-   }
-   }
-}
-
 /* Remove every ID Node (and its associated subnodes, COW data) */
 void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
 {
@@ -207,13 +152,34 @@ void deg_filter_remove_unwanted_ids(Depsgraph *graph, 
GSet *retained_ids)
}

/* Free ID nodes that are no longer wanted
-* NOTE: See clear_id_nodes() for more details about what's happening 
here
-*   (e.g. regarding the lambdas used for freeing order hacks)
+*
+* This is loosely based on Depsgraph::clear_id_nodes().
+* However, we don't worry about the conditional freeing for physics
+* stuff, since it's rarely needed currently.
 */
-   printf("Culling ID's scene:\n");
-   deg_filter_clear_ids_conditional(graph,  [](ID_Type id_type) { return 
id_type == ID_SCE; });
-   printf("Culling ID's other:\n");
-   deg_filter_clear_ids_conditional(graph,  [](ID_Type id_type) { return 
id_type != ID_PA; });
+   for (Depsgraph::IDDepsNodes::const_iterator it_id = 
graph->id_nodes.begin();
+it_id != graph->id_nodes.end();
+)
+   {
+   IDDepsNode *id_node = *it_id;
+   ID *id = id_node->id_orig;
+   
+   if (id_node->done) {
+   /* Destroy node data, then remove from collections, and 
free */
+   //printf("  culling %s\n", id->name);
+   id_node->destroy();
+   
+   BLI_ghash_remove(graph->id_hash, id, NULL, NULL);
+   it_id = graph->id_nodes.erase(it_i

[Bf-blender-cvs] [36148f20ec7] blender2.8: Fix: Silence compiler warnings about size_t's in printf

2018-08-22 Thread Joshua Leung
Commit: 36148f20ec7d5465c2ec24b874fa31e6b038fccc
Author: Joshua Leung
Date:   Thu Aug 23 16:58:13 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB36148f20ec7d5465c2ec24b874fa31e6b038fccc

Fix: Silence compiler warnings about size_t's in printf

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index cfa51ac0673..da6b239cc0a 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -232,8 +232,6 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
BLI_gset_free(retained_ids, NULL);
retained_ids = NULL;
 
-   /* Debug - Are the desired targets still in there? */
-
/* Print Stats */
// XXX: Hide behind debug flags
size_t s_outer, s_operations, s_relations;
@@ -247,8 +245,10 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
DEG_stats_simple(graph_src, _outer, _operations, _relations);
DEG_stats_simple(graph_new, _outer, _operations, _relations);

-   printf("%s: src = (ID's: %u (%u), Out: %u, Op: %u, Rel: %u)\n", 
__func__, s_ids, s_idh, s_outer, s_operations, s_relations); // XXX
-   printf("%s: new = (ID's: %u (%u), Out: %u, Op: %u, Rel: %u)\n", 
__func__, n_ids, n_idh, n_outer, n_operations, n_relations); // XXX
+   printf("%s: src = (ID's: %zu (%u), Out: %zu, Op: %zu, Rel: %zu)\n",
+  __func__, s_ids, s_idh, s_outer, s_operations, s_relations);
+   printf("%s: new = (ID's: %zu (%u), Out: %zu, Op: %zu, Rel: %zu)\n",
+  __func__, n_ids, n_idh, n_outer, n_operations, n_relations);
 
/* Return this new graph instance */
return graph_new;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4cbb75935b7] blender2.8: Code Cleanup

2018-08-22 Thread Joshua Leung
Commit: 4cbb75935b70cced058434903fc716cedf165371
Author: Joshua Leung
Date:   Thu Aug 23 16:48:50 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB4cbb75935b70cced058434903fc716cedf165371

Code Cleanup

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc
M   source/blender/editors/armature/pose_edit.c

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 8cfbacd6e4d..83ee350f300 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -94,7 +94,7 @@ void deg_add_retained_id_cb(ID *id, void *user_data)
 void deg_unlink_opnode(Depsgraph *graph, OperationDepsNode *op_node)
 {
std::vector all_links;
-   
+
/* Collect all inlinks to this operation */
foreach (DepsRelation *rel, op_node->inlinks) {
all_links.push_back(rel);
@@ -103,13 +103,13 @@ void deg_unlink_opnode(Depsgraph *graph, 
OperationDepsNode *op_node)
foreach (DepsRelation *rel, op_node->outlinks) {
all_links.push_back(rel);
}
-   
+
/* Delete all collected relations */
foreach (DepsRelation *rel, all_links) {
rel->unlink();
OBJECT_GUARDED_DELETE(rel, DepsRelation);
}
-   
+
/* Remove from entry tags */
if (BLI_gset_haskey(graph->entry_tags, op_node)) {
BLI_gset_remove(graph->entry_tags, op_node, NULL);
@@ -135,7 +135,7 @@ void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet 
*retained_ids)
GHASH_FOREACH_END();
}
}
-   
+
/* 2) Remove unwanted operations from graph->operations */
for (Depsgraph::OperationNodes::const_iterator it_opnode = 
graph->operations.begin();
 it_opnode != graph->operations.end();
@@ -150,7 +150,7 @@ void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet 
*retained_ids)
++it_opnode;
}
}
-   
+
/* Free ID nodes that are no longer wanted
 *
 * This is loosely based on Depsgraph::clear_id_nodes().
@@ -166,17 +166,15 @@ void deg_filter_remove_unwanted_ids(Depsgraph *graph, 
GSet *retained_ids)

if (id_node->done) {
/* Destroy node data, then remove from collections, and 
free */
-   //printf("  culling %s\n", id->name);
id_node->destroy();
-   
+
BLI_ghash_remove(graph->id_hash, id, NULL, NULL);
it_id = graph->id_nodes.erase(it_id);
-   
+
OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
}
else {
/* This node has not been marked for deletion. 
Increment iterator */
-   //printf("  skipping %s\n", id->name);
++it_id;
}
}
@@ -194,7 +192,7 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
if (deg_graph_src == NULL) {
return NULL;
}
-   
+
/* Construct a full new depsgraph based on the one we got */
/* TODO: Improve the builders to not add any ID nodes we don't need 
later (e.g. ProxyBuilder?) */
Depsgraph *graph_new = DEG_graph_new(deg_graph_src->scene,
@@ -204,11 +202,11 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
bmain,
deg_graph_src->scene,
deg_graph_src->view_layer);
-   
+
/* Build a set of all the id's we want to keep */
GSet *retained_ids = BLI_gset_ptr_new(__func__);
DEG::RetainedIdUserData retained_id_data = {query, retained_ids};
-   
+
LISTBASE_FOREACH(DEG_FilterTarget *, target, >targets) {
/* Target Itself */
BLI_gset_add(retained_ids, (void *)target->id);
@@ -219,47 +217,36 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
DEG::deg_add_retained_id_cb,
_id_data);
}
-   
+
/* Remove everything we don't want to keep around anymore */
DEG::Depsgraph *deg_graph_new = reinterpret_cast(graph_new);
if (BLI_gset_len(retained_ids) > 0) {
DEG::deg_filter_remove_unwanted_ids(deg_graph_new, 
retained_ids);
}
// TODO: query->LOD filters
-   
+
/* Free 

[Bf-blender-cvs] [0e09bfa0594] blender2.8: Depsgraph: Added note that the filtering function should NOT be called on a filtered graph

2018-08-22 Thread Joshua Leung
Commit: 0e09bfa0594ef64e5a1966280277330d65e874dd
Author: Joshua Leung
Date:   Thu Aug 23 16:55:07 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB0e09bfa0594ef64e5a1966280277330d65e874dd

Depsgraph: Added note that the filtering function should NOT be called on a 
filtered graph

===

M   source/blender/depsgraph/DEG_depsgraph_query.h
M   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h 
b/source/blender/depsgraph/DEG_depsgraph_query.h
index b7ecd0544e4..a666100c6da 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -233,7 +233,10 @@ typedef struct DEG_FilterQuery {
eDEG_FilterQuery_Granularity detail_level;
 } DEG_FilterQuery;
 
-/* Obtain a new graph instance that only contains the subset of desired nodes 
*/
+/* Obtain a new graph instance that only contains the subset of desired nodes
+ * WARNING: Do NOT pass an already filtered depsgraph through this function 
again,
+ *  as we are currently unable to accurately recreate it.
+ */
 Depsgraph *DEG_graph_filter(const Depsgraph *depsgraph, struct Main *bmain, 
DEG_FilterQuery *query);
 
 
diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 83ee350f300..cfa51ac0673 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -185,7 +185,10 @@ void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet 
*retained_ids)
 /* *** */
 /* Graph Filtering API */
 
-/* Obtain a new graph instance that only contains the nodes needed */
+/* Obtain a new graph instance that only contains the subset of desired nodes
+ * WARNING: Do NOT pass an already filtered depsgraph through this function 
again,
+ *  as we are currently unable to accurately recreate it.
+ */
 Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, Main *bmain, 
DEG_FilterQuery *query)
 {
const DEG::Depsgraph *deg_graph_src = reinterpret_cast(graph_src);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dcefce5eae9] blender2.8: Fix memory leak - the temporary depsgraph instance was not getting freed after use

2018-08-22 Thread Joshua Leung
Commit: dcefce5eae9bdcc2b0fdcbc371fcf17e0ef0ada0
Author: Joshua Leung
Date:   Thu Aug 23 16:02:09 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBdcefce5eae9bdcc2b0fdcbc371fcf17e0ef0ada0

Fix memory leak - the temporary depsgraph instance was not getting freed after 
use

===

M   source/blender/editors/armature/pose_edit.c

===

diff --git a/source/blender/editors/armature/pose_edit.c 
b/source/blender/editors/armature/pose_edit.c
index 3586a219fd8..2445a3dc062 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -198,6 +198,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, 
Object *ob)
struct Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase targets = {NULL, NULL};
+   bool free_depsgraph = false;
 
/* Override depsgraph with a filtered, simpler copy */
if (G.debug_value == 555) {
@@ -210,6 +211,7 @@ TIMEIT_START(filter_pose_depsgraph);
BLI_addtail(, dft_ob);

depsgraph = DEG_graph_filter(depsgraph, bmain, );
+   free_depsgraph = true;

MEM_freeN(dft_ob);
 TIMEIT_END(filter_pose_depsgraph);
@@ -233,6 +235,11 @@ TIMEIT_END(pose_path_calc);
 
/* tag armature object for copy on write - so paths will draw/redraw */
DEG_id_tag_update(>id, DEG_TAG_COPY_ON_WRITE);
+   
+   /* Free temporary depsgraph instance */
+   if (free_depsgraph) {
+   DEG_graph_free(depsgraph);
+   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0e44cf5d786] blender2.8: Cleanup: Disable some of the extra debug prints that were slowing things down

2018-08-22 Thread Joshua Leung
Commit: 0e44cf5d786a72efd9f721b6e2ffc2adf4379bb3
Author: Joshua Leung
Date:   Thu Aug 23 14:41:36 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB0e44cf5d786a72efd9f721b6e2ffc2adf4379bb3

Cleanup: Disable some of the extra debug prints that were slowing things down

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 5614804078d..4038f0cb135 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -128,12 +128,12 @@ bool deg_filter_free_idnode(Depsgraph *graph, IDDepsNode 
*id_node,
else {
const ID_Type id_type = GS(id_node->id_orig->name);
if (filter(id_type)) {
-   printf("  id_type (T) = %d ");
+   //printf("  id_type (T) = %d ");
id_node->destroy();
return true;
}
else {
-   printf("  id_type (F) = %d ");
+   //printf("  id_type (F) = %d ");
return false;
}
}
@@ -158,14 +158,14 @@ void deg_filter_clear_ids_conditional(

if (deg_filter_free_idnode(graph, id_node, filter)) {
/* Node data got destroyed. Remove from collections, 
and free */
-   printf("  culling %s\n", id->name);
+   //printf("  culling %s\n", id->name);
BLI_ghash_remove(graph->id_hash, id, NULL, NULL);
it = graph->id_nodes.erase(it);
OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
}
else {
/* Node wasn't freed. Increment iterator */
-   printf("  skipping %s\n", id->name);
+   //printf("  skipping %s\n", id->name);
++it;
}
}
@@ -266,6 +266,7 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
retained_ids = NULL;

/* Debug - Are the desired targets still in there? */
+#if 0
printf("Filtered Graph Sanity Check - Do targets exist?:\n");
LISTBASE_FOREACH(DEG_FilterTarget *, target, >targets) {
printf("   %s -> %d\n", target->id->name, 
BLI_ghash_haskey(deg_graph_new->id_hash, target->id));
@@ -275,6 +276,7 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
foreach (DEG::IDDepsNode *id_node, deg_graph_new->id_nodes) {
printf("  %d: %s\n", id_node_idx++, id_node->id_orig->name);
}
+#endif

/* Print Stats */
// XXX: Hide behind debug flags

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bd801e7a687] blender2.8: Faster Motion Path calculations using Depsgraph Filtering

2018-08-22 Thread Joshua Leung
Commit: bd801e7a687922e91c56ba2884cf93a4500c4e24
Author: Joshua Leung
Date:   Thu Aug 23 15:41:08 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBbd801e7a687922e91c56ba2884cf93a4500c4e24

Faster Motion Path calculations using Depsgraph Filtering

This commit makes the motion path calculations use the
new Depsgraph Filtering API to obtain a more streamlined
copy of the full scene dependency graph, allowing for
faster calculations (as less data needs to be evaluated
for each frame being baked).

For example, in 01_020_A.anim.blend from the Spring production
files, the time needed to calculate paths on several bones
on Autumn went from  39.84 seconds (!) down to 9.90 seconds!

Currently, this works by just replacing the depsgraph instance
passed to the motion path calculation function. This filtered
instance contains just the ID's needed to evaluate the graph
to evaluate a specified target (i.e. the Object owning the pose).

Notes:
* By default, the filtering is not performed unless debug mode 555
  is activated. Having a debug switch here allows comparing
  performance and disabling it should thing it start crashing.

* It is necessary to pass in the original Scene instance (not the
  COW one owned by the filtered depsgraph), otherwise changing the
  current frame had no effect, due to the COW flushing from original
  Scene to the new Scene overwriting the CFRA changes we make.

* The code here still needs cleaning up to debugging instrumentation, etc.
  and also to optimise further (e.g. caching the filtered depsgraph
  for faster updates when animating on existing paths, or fine-tuning
  the exact set of nodes needed).  I'm just committing this first,
  since this was the quickly hacked-together test code I've been using
  to check that this is all working.

* Further improvements could also be made to the time needed to
  build the full graph instance (about 3.3 sec), by allowing partial
  builds (e.g. by making a filtering proxy/wrapper around existing builders)

===

M   source/blender/blenkernel/intern/anim.c
M   source/blender/editors/armature/pose_edit.c

===

diff --git a/source/blender/blenkernel/intern/anim.c 
b/source/blender/blenkernel/intern/anim.c
index 6168ce97f86..ece3a018a9e 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -466,7 +466,10 @@ static void motionpaths_calc_bake_targets(ListBase 
*targets, int cframe)
}
 
/* calculate path over requested range */
+   printf("Calculating Paths over Frame Range:\n");
for (CFRA = sfra; CFRA <= efra; CFRA++) {
+   printf("  Frame %d\n", CFRA);
+   
/* update relevant data for new frame */
motionpaths_calc_update_scene(bmain, depsgraph);
 
@@ -475,9 +478,8 @@ static void motionpaths_calc_bake_targets(ListBase 
*targets, int cframe)
}
 
/* reset original environment */
-   // XXX: Soon to be obsolete
CFRA = cfra;
-   motionpaths_calc_update_scene(bmain, depsgraph);
+   motionpaths_calc_update_scene(bmain, depsgraph);  // XXX: Soon to be 
obsolete
 
/* clear recalc flags from targets */
for (mpt = targets->first; mpt; mpt = mpt->next) {
diff --git a/source/blender/editors/armature/pose_edit.c 
b/source/blender/editors/armature/pose_edit.c
index 571f766ee4c..3586a219fd8 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -46,12 +46,15 @@
 #include "BKE_armature.h"
 #include "BKE_context.h"
 #include "BKE_deform.h"
+#include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_object.h"
 #include "BKE_report.h"
 #include "BKE_layer.h"
+#include "BKE_scene.h"
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -196,12 +199,36 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, 
Object *ob)
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase targets = {NULL, NULL};
 
+   /* Override depsgraph with a filtered, simpler copy */
+   if (G.debug_value == 555) {
+TIMEIT_START(filter_pose_depsgraph);
+   
+   DEG_FilterQuery query = {0};
+   
+   DEG_FilterTarget *dft_ob = 
MEM_callocN(sizeof(DEG_FilterTarget), "DEG_FilterTarget");
+   dft_ob->id = >id;
+   BLI_addtail(, dft_ob);
+   
+   depsgraph = DEG_graph_filter(depsgraph, bmain, );
+   
+   MEM_freeN(dft_ob);
+TIMEIT_END(filter_pose_depsgraph);
+   
+TIMEIT_START(filter_pose_update);
+   BKE_scene_g

[Bf-blender-cvs] [2f2ab13b5f4] blender2.8: Depsgraph Filtering: Fix ID node filtering problems

2018-08-22 Thread Joshua Leung
Commit: 2f2ab13b5f46b26dcffb889ac4294a52c6c79085
Author: Joshua Leung
Date:   Thu Aug 23 13:54:07 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB2f2ab13b5f46b26dcffb889ac4294a52c6c79085

Depsgraph Filtering: Fix ID node filtering problems

* COW data hasn't been expanded yet when we try to filter the graph
  (you need to have tagged + evaluated it for this data to exist),
  so all the offending nodes would just get left in

* Added more debug prints to verify whether the id_nodes vector is
  getting cleared correctly

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 11d8de098b9..5614804078d 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -125,19 +125,8 @@ bool deg_filter_free_idnode(Depsgraph *graph, IDDepsNode 
*id_node,
/* This node has not been marked for deletion */
return false;
}
-   else if (id_node->id_cow == NULL) {
-   /* This means builder "stole" ownership of the copy-on-written
-* datablock for her own dirty needs.
-*/
-   printf("  no id_cow ");
-   return false;
-   }
-   else if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
-   printf("  id_cow collapsed ");
-   return false;
-   }
else {
-   const ID_Type id_type = GS(id_node->id_cow->name);
+   const ID_Type id_type = GS(id_node->id_orig->name);
if (filter(id_type)) {
printf("  id_type (T) = %d ");
id_node->destroy();
@@ -277,10 +266,15 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
retained_ids = NULL;

/* Debug - Are the desired targets still in there? */
-   printf("Filtered graph sanity check:\n");
+   printf("Filtered Graph Sanity Check - Do targets exist?:\n");
LISTBASE_FOREACH(DEG_FilterTarget *, target, >targets) {
printf("   %s -> %d\n", target->id->name, 
BLI_ghash_haskey(deg_graph_new->id_hash, target->id));
}
+   printf("Filtered Graph Sanity Check - Remaining ID Nodes:\n");
+   size_t id_node_idx = 0;
+   foreach (DEG::IDDepsNode *id_node, deg_graph_new->id_nodes) {
+   printf("  %d: %s\n", id_node_idx++, id_node->id_orig->name);
+   }

/* Print Stats */
// XXX: Hide behind debug flags
@@ -289,7 +283,7 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
unsigned int s_idh = BLI_ghash_len(deg_graph_src->id_hash);

size_t n_outer, n_operations, n_relations;
-   size_t n_ids = deg_graph_src->id_nodes.size();
+   size_t n_ids = deg_graph_new->id_nodes.size();
unsigned int n_idh = BLI_ghash_len(deg_graph_new->id_hash);

DEG_stats_simple(graph_src, _outer, _operations, _relations);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9e477090896] blender2.8: Typo fixes

2018-08-22 Thread Joshua Leung
Commit: 9e4770908968903537eff32df8d7a2f6b6641a8e
Author: Joshua Leung
Date:   Thu Aug 23 00:04:38 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB9e4770908968903537eff32df8d7a2f6b6641a8e

Typo fixes

===

M   source/blender/depsgraph/intern/nodes/deg_node.cc

===

diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc 
b/source/blender/depsgraph/intern/nodes/deg_node.cc
index e09ba8c4f05..3e2c48e9096 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node.cc
@@ -121,7 +121,7 @@ eDepsNode_Class DepsNode::get_class() const {
 
/***
  * Generic nodes definition.
  */
-\
+
 DEG_DEPSNODE_DEFINE(TimeSourceDepsNode, DEG_NODE_TYPE_TIMESOURCE, "Time 
Source");
 static DepsNodeFactoryImpl DNTI_TIMESOURCE;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [be77eeae46e] blender2.8: Depsgraph: First draft of graph filtering API implementation

2018-08-22 Thread Joshua Leung
Commit: be77eeae46e17c1b6ffb0e4d4834a1bd28aedf64
Author: Joshua Leung
Date:   Thu Aug 23 01:24:48 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBbe77eeae46e17c1b6ffb0e4d4834a1bd28aedf64

Depsgraph: First draft of graph filtering API implementation

When this works correctly, we should be able to feed in an existing
depsgraph instance, and get out a "filtered" copy of it that contains
only the subset of nodes needed to evaluate what we're interested in.

The current implementation only filters on ID blocks/nodes,
and starts by building a full new depsgraph instance first.
I'd originally intended to do it per operation instead, copying
over individual nodes as appropriate to have the smallest and least
memory intensive graph possible. However, I ended up running into
into problems with function binding + COW arguments, hence the
current slow solution.

===

M   source/blender/depsgraph/CMakeLists.txt
M   source/blender/depsgraph/DEG_depsgraph.h
M   source/blender/depsgraph/DEG_depsgraph_query.h
M   source/blender/depsgraph/intern/depsgraph_query.cc
A   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/CMakeLists.txt 
b/source/blender/depsgraph/CMakeLists.txt
index c39ce65a337..884f1d272a5 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -70,6 +70,7 @@ set(SRC
intern/depsgraph_eval.cc
intern/depsgraph_physics.cc
intern/depsgraph_query.cc
+   intern/depsgraph_query_filter.cc
intern/depsgraph_query_foreach.cc
intern/depsgraph_query_iter.cc
intern/depsgraph_tag.cc
diff --git a/source/blender/depsgraph/DEG_depsgraph.h 
b/source/blender/depsgraph/DEG_depsgraph.h
index 7e26987f936..d3900bc6350 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -71,6 +71,7 @@ struct ViewLayer;
 typedef enum eEvaluationMode {
DAG_EVAL_VIEWPORT   = 0,/* evaluate for OpenGL viewport */
DAG_EVAL_RENDER = 1,/* evaluate for render purposes */
+   DAG_EVAL_BACKGROUND = 2,/* evaluate in background for 
baking/caching */
 } eEvaluationMode;
 
 /* DagNode->eval_flags */
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h 
b/source/blender/depsgraph/DEG_depsgraph_query.h
index 41650769fcf..b7ecd0544e4 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -34,6 +34,7 @@
 #define __DEG_DEPSGRAPH_QUERY_H__
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
 
 struct ID;
 
@@ -207,6 +208,34 @@ void DEG_foreach_dependent_ID(const Depsgraph *depsgraph,
 void DEG_foreach_ID(const Depsgraph *depsgraph,
 DEGForeachIDCallback callback, void *user_data);
 
+/* * DEG graph filtering ** */
+
+/* ComponentKey for nodes we want to be able to evaluate in the filtered graph 
*/
+typedef struct DEG_FilterTarget {
+   struct DEG_FilterTarget *next, *prev;
+
+   struct ID *id;
+   /* TODO: component identifiers - Component Type, Subdata/Component Name 
*/
+} DEG_FilterTarget;
+
+typedef enum eDEG_FilterQuery_Granularity {
+   DEG_FILTER_NODES_ALL   = 0,
+   DEG_FILTER_NODES_NO_OPS= 1,
+   DEG_FILTER_NODES_ID_ONLY   = 2,
+} eDEG_FilterQuery_Granularity;
+
+
+typedef struct DEG_FilterQuery {
+   /* List of DEG_FilterTarget's */
+   struct ListBase targets;
+
+   /* Level of detail in the resulting graph */
+   eDEG_FilterQuery_Granularity detail_level;
+} DEG_FilterQuery;
+
+/* Obtain a new graph instance that only contains the subset of desired nodes 
*/
+Depsgraph *DEG_graph_filter(const Depsgraph *depsgraph, struct Main *bmain, 
DEG_FilterQuery *query);
+
 
 #ifdef __cplusplus
 } /* extern "C" */
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc 
b/source/blender/depsgraph/intern/depsgraph_query.cc
index a6c930196ef..631669babb2 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -27,7 +27,7 @@
 /** \file blender/depsgraph/intern/depsgraph_query.cc
  *  \ingroup depsgraph
  *
- * Implementation of Querying and Filtering API's
+ * Implementation of Querying API
  */
 
 #include "MEM_guardedalloc.h"
diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
new file mode 100644
index 000..89becda3ee3
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -0,0 +1,272 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the ter

[Bf-blender-cvs] [e01a9c5eeea] blender2.8: Motion Path Calculations: Don't pass scene into motionpaths_calc_bake_targets()

2018-08-22 Thread Joshua Leung
Commit: e01a9c5eeeaa61a63103c4eb63af2b752306871c
Author: Joshua Leung
Date:   Thu Aug 23 14:06:11 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBe01a9c5eeeaa61a63103c4eb63af2b752306871c

Motion Path Calculations: Don't pass scene into motionpaths_calc_bake_targets()

It's not needed, and actually precludes us from considering parallel
evaluation in future.

===

M   source/blender/blenkernel/intern/anim.c

===

diff --git a/source/blender/blenkernel/intern/anim.c 
b/source/blender/blenkernel/intern/anim.c
index 7df889d22b2..6168ce97f86 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -340,7 +340,7 @@ static void motionpaths_calc_update_scene(Main *bmain,
 /*  */
 
 /* perform baking for the targets on the current frame */
-static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
+static void motionpaths_calc_bake_targets(ListBase *targets, int cframe)
 {
MPathTarget *mpt;
 
@@ -352,12 +352,12 @@ static void motionpaths_calc_bake_targets(Scene *scene, 
ListBase *targets)
/* current frame must be within the range the cache works for
 *  - is inclusive of the first frame, but not the last 
otherwise we get buffer overruns
 */
-   if ((CFRA < mpath->start_frame) || (CFRA >= mpath->end_frame)) {
+   if ((cframe < mpath->start_frame) || (cframe >= 
mpath->end_frame)) {
continue;
}
 
/* get the relevant cache vert to write to */
-   mpv = mpath->points + (CFRA - mpath->start_frame);
+   mpv = mpath->points + (cframe - mpath->start_frame);
 
Object *ob_eval = mpt->ob_eval;
 
@@ -386,7 +386,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, 
ListBase *targets)
copy_v3_v3(mpv->co, ob_eval->obmat[3]);
}
 
-   float mframe = (float)(CFRA);
+   float mframe = (float)(cframe);
 
/* Tag if it's a keyframe */
if (BLI_dlrbTree_search_exact(>keys, compare_ak_cfraPtr, 
)) {
@@ -471,7 +471,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, 
ListBase *targets)
motionpaths_calc_update_scene(bmain, depsgraph);
 
/* perform baking for targets */
-   motionpaths_calc_bake_targets(scene, targets);
+   motionpaths_calc_bake_targets(targets, CFRA);
}
 
/* reset original environment */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e5e42b77820] blender2.8: Depsgraph Filtering: WIP more debugging prints

2018-08-22 Thread Joshua Leung
Commit: e5e42b77820999a4fe6de3fde92ac3b741bbe243
Author: Joshua Leung
Date:   Thu Aug 23 11:36:20 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBe5e42b77820999a4fe6de3fde92ac3b741bbe243

Depsgraph Filtering: WIP more debugging prints

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 9bfe8815703..11d8de098b9 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -91,7 +91,7 @@ void deg_add_retained_id_cb(ID *id, void *user_data)
 
 /* Remove relations pointing to the given OperationDepsNode */
 /* TODO: Make this part of OperationDepsNode? */
-void deg_unlink_opnode(OperationDepsNode *op_node)
+void deg_unlink_opnode(Depsgraph *graph, OperationDepsNode *op_node)
 {
std::vector all_links;

@@ -129,18 +129,22 @@ bool deg_filter_free_idnode(Depsgraph *graph, IDDepsNode 
*id_node,
/* This means builder "stole" ownership of the copy-on-written
 * datablock for her own dirty needs.
 */
+   printf("  no id_cow ");
return false;
}
else if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
+   printf("  id_cow collapsed ");
return false;
}
else {
const ID_Type id_type = GS(id_node->id_cow->name);
if (filter(id_type)) {
+   printf("  id_type (T) = %d ");
id_node->destroy();
return true;
}
else {
+   printf("  id_type (F) = %d ");
return false;
}
}
@@ -165,12 +169,14 @@ void deg_filter_clear_ids_conditional(

if (deg_filter_free_idnode(graph, id_node, filter)) {
/* Node data got destroyed. Remove from collections, 
and free */
+   printf("  culling %s\n", id->name);
BLI_ghash_remove(graph->id_hash, id, NULL, NULL);
-   OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
it = graph->id_nodes.erase(it);
+   OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
}
else {
/* Node wasn't freed. Increment iterator */
+   printf("  skipping %s\n", id->name);
++it;
}
}
@@ -189,7 +195,7 @@ void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet 
*retained_ids)
GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, 
id_node->components)
{
foreach (OperationDepsNode *op_node, 
comp_node->operations) {
-   deg_unlink_opnode(op_node);
+   deg_unlink_opnode(graph, op_node);
}
}
GHASH_FOREACH_END();
@@ -215,7 +221,9 @@ void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet 
*retained_ids)
 * NOTE: See clear_id_nodes() for more details about what's happening 
here
 *   (e.g. regarding the lambdas used for freeing order hacks)
 */
+   printf("Culling ID's scene:\n");
deg_filter_clear_ids_conditional(graph,  [](ID_Type id_type) { return 
id_type == ID_SCE; });
+   printf("Culling ID's other:\n");
deg_filter_clear_ids_conditional(graph,  [](ID_Type id_type) { return 
id_type != ID_PA; });
 }
 
@@ -268,16 +276,27 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
BLI_gset_free(retained_ids, NULL);
retained_ids = NULL;

+   /* Debug - Are the desired targets still in there? */
+   printf("Filtered graph sanity check:\n");
+   LISTBASE_FOREACH(DEG_FilterTarget *, target, >targets) {
+   printf("   %s -> %d\n", target->id->name, 
BLI_ghash_haskey(deg_graph_new->id_hash, target->id));
+   }
+   
/* Print Stats */
// XXX: Hide behind debug flags
size_t s_outer, s_operations, s_relations;
+   size_t s_ids = deg_graph_src->id_nodes.size();
+   unsigned int s_idh = BLI_ghash_len(deg_graph_src->id_hash);
+   
size_t n_outer, n_operations, n_relations;
+   size_t n_ids = deg_graph_src->id_nodes.size();
+   unsigned int n_idh = BLI_ghash_len(deg_

[Bf-blender-cvs] [9a0ef0933d3] blender2.8: Depsgraph: Print simple stats after filtering graph, to quickly verify if anything happened

2018-08-22 Thread Joshua Leung
Commit: 9a0ef0933d39f37e2267102f097ef7e4497d7789
Author: Joshua Leung
Date:   Thu Aug 23 02:51:01 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB9a0ef0933d39f37e2267102f097ef7e4497d7789

Depsgraph: Print simple stats after filtering graph, to quickly verify if 
anything happened

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 89becda3ee3..20de3e6f41a 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -51,6 +51,7 @@ extern "C" {
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
+#include "DEG_depsgraph_debug.h"
 
 #include "util/deg_util_foreach.h"
 
@@ -265,6 +266,17 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, 
Main *bmain, DEG_FilterQ
BLI_gset_free(retained_ids, NULL);
retained_ids = NULL;

+   /* Print Stats */
+   // XXX: Hide behind debug flags
+   size_t s_outer, s_operations, s_relations;
+   size_t n_outer, n_operations, n_relations;
+   
+   DEG_stats_simple(graph_src, _outer, _operations, _relations);
+   DEG_stats_simple(graph_new, _outer, _operations, _relations);
+   
+   printf("%s: src = (Out: %u, Op: %u, Rel: %u)\n", __func__, s_outer, 
s_operations, s_relations); // XXX
+   printf("%s: new = (Out: %u, Op: %u, Rel: %u)\n", __func__, n_outer, 
n_operations, n_relations); // XXX
+   
/* Return this new graph instance */
return graph_new;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6bbf6712bb0] blender2.8: Depsgraph Filtering: Remove opnodes from entry tags too

2018-08-22 Thread Joshua Leung
Commit: 6bbf6712bb095add22cacd391cc4f10cfb5bfc34
Author: Joshua Leung
Date:   Thu Aug 23 11:35:30 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB6bbf6712bb095add22cacd391cc4f10cfb5bfc34

Depsgraph Filtering: Remove opnodes from entry tags too

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index d6965206844..9bfe8815703 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -104,11 +104,16 @@ void deg_unlink_opnode(OperationDepsNode *op_node)
all_links.push_back(rel);
}

-   /* Delete all collected entries */
+   /* Delete all collected relations */
foreach (DepsRelation *rel, all_links) {
rel->unlink();
OBJECT_GUARDED_DELETE(rel, DepsRelation);
}
+   
+   /* Remove from entry tags */
+   if (BLI_gset_haskey(graph->entry_tags, op_node)) {
+   BLI_gset_remove(graph->entry_tags, op_node, NULL);
+   }
 }
 
 /* Remove and free given ID Node */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6ec933886c3] blender2.8: Depsgraph: Fix filtering-related crashes

2018-08-22 Thread Joshua Leung
Commit: 6ec933886c363c99da3df4063c6f35b94d42cbfe
Author: Joshua Leung
Date:   Thu Aug 23 03:15:19 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB6ec933886c363c99da3df4063c6f35b94d42cbfe

Depsgraph: Fix filtering-related crashes

* Simplified operation-relation deletion. Now we collect the relations
  to delete into a vector, then iterate through that, thus solving issues
  with iterator invalidation (+ aborts arising from that)

* DEG_foreach_ancestor_ID() was assuming that all dependencies were
  OperationDepsNodes, when in fact, some could be TimeSource nodes

===

M   source/blender/depsgraph/intern/depsgraph_query_filter.cc
M   source/blender/depsgraph/intern/depsgraph_query_foreach.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 20de3e6f41a..d6965206844 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -93,22 +93,19 @@ void deg_add_retained_id_cb(ID *id, void *user_data)
 /* TODO: Make this part of OperationDepsNode? */
 void deg_unlink_opnode(OperationDepsNode *op_node)
 {
-   /* Delete inlinks to this operation */
-   for (DepsNode::Relations::const_iterator it_rel = 
op_node->inlinks.begin();
-it_rel != op_node->inlinks.end();
-)
-   {
-   DepsRelation *rel = *it_rel;
-   rel->unlink();
-   OBJECT_GUARDED_DELETE(rel, DepsRelation);
+   std::vector all_links;
+   
+   /* Collect all inlinks to this operation */
+   foreach (DepsRelation *rel, op_node->inlinks) {
+   all_links.push_back(rel);
+   }
+   /* Collect all outlinks from this operation */
+   foreach (DepsRelation *rel, op_node->outlinks) {
+   all_links.push_back(rel);
}

-   /* Delete outlinks from this operation */
-   for (DepsNode::Relations::const_iterator it_rel = 
op_node->outlinks.begin();
-it_rel != op_node->outlinks.end();
-)
-   {
-   DepsRelation *rel = *it_rel;
+   /* Delete all collected entries */
+   foreach (DepsRelation *rel, all_links) {
rel->unlink();
OBJECT_GUARDED_DELETE(rel, DepsRelation);
}
diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc 
b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
index 83d81d82b26..c8aaf353874 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
@@ -178,21 +178,27 @@ static void deg_foreach_ancestor_ID(const Depsgraph 
*graph,
}
/* Schedule incoming operation nodes. */
if (op_node->inlinks.size() == 1) {
-   OperationDepsNode *from_node = 
(OperationDepsNode *)op_node->inlinks[0]->from;
-   if (from_node->scheduled == false) {
-   from_node->scheduled = true;
-   op_node = from_node;
-   }
-   else {
-   break;
+   DepsNode *from = op_node->inlinks[0]->from;
+   if (from->get_class() == 
DEG_NODE_CLASS_OPERATION) {
+   OperationDepsNode *from_node = 
(OperationDepsNode *)from;
+   if (from_node->scheduled == false) {
+   from_node->scheduled = true;
+   op_node = from_node;
+   }
+   else {
+   break;
+   }
}
}
else {
foreach (DepsRelation *rel, op_node->inlinks) {
-   OperationDepsNode *from_node = 
(OperationDepsNode *)rel->from;
-   if (from_node->scheduled == false) {
-   queue.push_front(from_node);
-   from_node->scheduled = true;
+   DepsNode *from = rel->from;
+   if (from->get_class() == 
DEG_NODE_CLASS_OPERATION) {
+   OperationDepsNode *from_node = 
(OperationDepsNode *)from;
+ 

[Bf-blender-cvs] [4f06c7c8389] blender2.8: Fix T56457: Crash when selecting Grease Pencil objects

2018-08-20 Thread Joshua Leung
Commit: 4f06c7c8389d144394efdda8829f3d01283694d6
Author: Joshua Leung
Date:   Tue Aug 21 17:05:27 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB4f06c7c8389d144394efdda8829f3d01283694d6

Fix T56457: Crash when selecting Grease Pencil objects

Thanks to Charlie Jolly (@charlie) for the backtrace

===

M   source/blender/editors/gpencil/gpencil_ops.c

===

diff --git a/source/blender/editors/gpencil/gpencil_ops.c 
b/source/blender/editors/gpencil/gpencil_ops.c
index 67e3d484596..d39dd085add 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -129,7 +129,8 @@ static bool gp_stroke_paintmode_draw_poll(bContext *C)
bGPdata *gpd = CTX_data_gpencil_data(C);
ToolSettings *ts = CTX_data_tool_settings(C);
Brush *brush = BKE_brush_getactive_gpencil(ts);
-   return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) &&
+   return ((gpd) && (gpd->flag & GP_DATA_STROKE_PAINTMODE) &&
+   (brush && brush->gpencil_settings) &&
(brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_DRAW));
 }
 
@@ -140,7 +141,8 @@ static bool gp_stroke_paintmode_erase_poll(bContext *C)
bGPdata *gpd = CTX_data_gpencil_data(C);
ToolSettings *ts = CTX_data_tool_settings(C);
Brush *brush = BKE_brush_getactive_gpencil(ts);
-   return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) &&
+   return ((gpd) && (gpd->flag & GP_DATA_STROKE_PAINTMODE) &&
+   (brush && brush->gpencil_settings) &&
(brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE));
 }
 
@@ -151,7 +153,8 @@ static bool gp_stroke_paintmode_fill_poll(bContext *C)
bGPdata *gpd = CTX_data_gpencil_data(C);
ToolSettings *ts = CTX_data_tool_settings(C);
Brush *brush = BKE_brush_getactive_gpencil(ts);
-   return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) &&
+   return ((gpd) && (gpd->flag & GP_DATA_STROKE_PAINTMODE) &&
+   (brush && brush->gpencil_settings) &&
(brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_FILL));
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a7dcad2f8ff] blender2.8: Cleanup: Fix typos

2018-08-20 Thread Joshua Leung
Commit: a7dcad2f8ff01490436ff2fd0e2aa671a1e2fa90
Author: Joshua Leung
Date:   Tue Aug 21 14:54:18 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBa7dcad2f8ff01490436ff2fd0e2aa671a1e2fa90

Cleanup: Fix typos

===

M   source/blender/depsgraph/intern/depsgraph_query_iter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index a9492b48a1b..3331389a1db 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -83,7 +83,7 @@ void deg_invalidate_iterator_work_data(DEGObjectIterData 
*data)
 #endif
 }
 
-void verify_id_proeprties_freed(DEGObjectIterData *data)
+void verify_id_properties_freed(DEGObjectIterData *data)
 {
if (data->dupli_object_current == NULL) {
// We didn't enter duplication yet, so we can't have any 
dangling
@@ -127,7 +127,7 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
continue;
}
 
-   verify_id_proeprties_freed(data);
+   verify_id_properties_freed(data);
 
data->dupli_object_current = dob;
 
@@ -260,7 +260,7 @@ void DEG_iterator_objects_next(BLI_Iterator *iter)
return;
}
else {
-   verify_id_proeprties_freed(data);
+   verify_id_properties_freed(data);
free_object_duplilist(data->dupli_list);
data->dupli_parent = NULL;
data->dupli_list = NULL;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2a5f319465b] blender2.8: Depsgraph: Add query methods to identify all the ID's that a given datablock depends on

2018-08-20 Thread Joshua Leung
Commit: 2a5f319465b2d94ddff1d3d1402d3c46e4e2c0e8
Author: Joshua Leung
Date:   Tue Aug 21 16:20:54 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB2a5f319465b2d94ddff1d3d1402d3c46e4e2c0e8

Depsgraph: Add query methods to identify all the ID's that a given datablock 
depends on

This commit adds a new method, DEG_foreach_ancestor_ID()
to accompany the existing DEG_foreach_descendent_ID().

It can be used to help print/collect all the ID's that
a given ID block depends on (i.e. all the datablocks that
need to be evaluated before the datablock of interest can
be evaluated)

===

M   source/blender/depsgraph/DEG_depsgraph_query.h
M   source/blender/depsgraph/intern/depsgraph_query_foreach.cc

===

diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h 
b/source/blender/depsgraph/DEG_depsgraph_query.h
index 1c4e11d1197..41650769fcf 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -197,6 +197,9 @@ typedef void (*DEGForeachIDCallback)(ID *id, void 
*user_data);
 /* NOTE: Modifies runtime flags in depsgraph nodes, so can not be used in
  * parallel. Keep an eye on that!
  */
+void DEG_foreach_ancestor_ID(const Depsgraph *depsgraph,
+ const ID *id,
+ DEGForeachIDCallback callback, void *user_data);
 void DEG_foreach_dependent_ID(const Depsgraph *depsgraph,
   const ID *id,
   DEGForeachIDCallback callback, void *user_data);
diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc 
b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
index 5fb6a01d894..83d81d82b26 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
@@ -136,6 +136,71 @@ static void deg_foreach_dependent_ID(const Depsgraph 
*graph,
}
 }
 
+static void deg_foreach_ancestor_ID(const Depsgraph *graph,
+ const ID *id,
+ DEGForeachIDCallback callback,
+ void *user_data)
+{
+   /* Start with getting ID node from the graph. */
+   IDDepsNode *target_id_node = graph->find_id_node(id);
+   if (target_id_node == NULL) {
+   /* TODO(sergey): Shall we inform or assert here about attempt 
to start
+* iterating over non-existing ID?
+*/
+   return;
+   }
+   /* Make sure all runtime flags are ready and clear. */
+   deg_foreach_clear_flags(graph);
+   /* Start with scheduling all operations from ID node. */
+   TraversalQueue queue;
+   GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, 
target_id_node->components)
+   {
+   foreach (OperationDepsNode *op_node, comp_node->operations) {
+   queue.push_back(op_node);
+   op_node->scheduled = true;
+   }
+   }
+   GHASH_FOREACH_END();
+   target_id_node->done = true;
+   /* Process the queue. */
+   while (!queue.empty()) {
+   /* get next operation node to process. */
+   OperationDepsNode *op_node = queue.front();
+   queue.pop_front();
+   for (;;) {
+   /* Check whether we need to inform callee about 
corresponding ID node. */
+   ComponentDepsNode *comp_node = op_node->owner;
+   IDDepsNode *id_node = comp_node->owner;
+   if (!id_node->done) {
+   /* TODO(sergey): Is it orig or CoW? */
+   callback(id_node->id_orig, user_data);
+   id_node->done = true;
+   }
+   /* Schedule incoming operation nodes. */
+   if (op_node->inlinks.size() == 1) {
+   OperationDepsNode *from_node = 
(OperationDepsNode *)op_node->inlinks[0]->from;
+   if (from_node->scheduled == false) {
+   from_node->scheduled = true;
+   op_node = from_node;
+   }
+   else {
+   break;
+   }
+   }
+   else {
+   foreach (DepsRelation *rel, op_node->inlinks) {
+   OperationDepsNode *from_node = 
(OperationDepsNode *)rel->from;
+   if (from_node->scheduled == false) {
+   

[Bf-blender-cvs] [351d13194d5] blender2.8: Cleanup: Fix variable shadowing

2018-08-20 Thread Joshua Leung
Commit: 351d13194d5e5c27278885fc6a7c5faaddd37e08
Author: Joshua Leung
Date:   Tue Aug 21 15:22:59 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB351d13194d5e5c27278885fc6a7c5faaddd37e08

Cleanup: Fix variable shadowing

===

M   source/blender/depsgraph/intern/depsgraph_query_foreach.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc 
b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
index b5ed3e38f09..5fb6a01d894 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
@@ -77,8 +77,8 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
  void *user_data)
 {
/* Start with getting ID node from the graph. */
-   IDDepsNode *id_node = graph->find_id_node(id);
-   if (id_node == NULL) {
+   IDDepsNode *target_id_node = graph->find_id_node(id);
+   if (target_id_node == NULL) {
/* TODO(sergey): Shall we inform or assert here about attempt 
to start
 * iterating over non-existing ID?
 */
@@ -88,7 +88,7 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
deg_foreach_clear_flags(graph);
/* Start with scheduling all operations from ID node. */
TraversalQueue queue;
-   GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+   GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, 
target_id_node->components)
{
foreach (OperationDepsNode *op_node, comp_node->operations) {
queue.push_back(op_node);
@@ -96,7 +96,7 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
}
}
GHASH_FOREACH_END();
-   id_node->done = true;
+   target_id_node->done = true;
/* Process the queue. */
while (!queue.empty()) {
/* get next operation node to process. */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [939a5cb6eec] blender2.8: Image Editor: Add active tool button for Annotations (WIP - Event handling not working) This reuses the tool defines for the 3D view. However, for some reaso

2018-08-20 Thread Joshua Leung
Commit: 939a5cb6eecc45d925a147b8b6f6a1225679bc45
Author: Joshua Leung
Date:   Tue Aug 21 01:17:15 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB939a5cb6eecc45d925a147b8b6f6a1225679bc45

Image Editor: Add active tool button for Annotations  (WIP - Event handling not 
working)
This reuses the tool defines for the 3D view. However, for some reason,
the events don't seem to be getting fired off here, like the tool system
is getting ignored here completely.

FIXME: Resolve the event handling issues

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index cc2f34e314d..54499bb4ac3 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1418,13 +1418,22 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, 
Panel):
 ),
 )
 
+_tools_annotate = (
+(
+_defs_annotate.scribble,
+_defs_annotate.line,
+_defs_annotate.poly,
+_defs_annotate.eraser,
+),
+)
+
 _tools = {
 None: [
 # for all modes
 ],
 'VIEW': [
 *_tools_select,
-
+*_tools_annotate,
 ],
 'MASK': [
 None,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3ef1aeb15ec] blender2.8: Fix: Theme colors for datablock channels were missing for the NLA in the new default theme

2018-08-20 Thread Joshua Leung
Commit: 3ef1aeb15ec8f8a07118eed2aa477f6c4e6e5efe
Author: Joshua Leung
Date:   Mon Aug 20 18:26:46 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB3ef1aeb15ec8f8a07118eed2aa477f6c4e6e5efe

Fix: Theme colors for datablock channels were missing for the NLA in the new 
default theme

===

M   release/datafiles/userdef/userdef_default_theme.c

===

diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index 69ad58ea1c5..ed2a7b54a4c 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -553,6 +553,8 @@ const bTheme U_theme_default = {
.strip = RGBA(0x0c0a0a80),
.strip_select = RGBA(0xff8c00ff),
.cframe = RGBA(0x5680c2ff),
+   .ds_channel = RGBA(0x5a85b2ff),
+   .ds_subchannel = RGBA(0x7d98b3ff),
.keyborder = RGBA(0x00ff),
.keyborder_select = RGBA(0x00ff),
.vertex_size = 3,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [503866c6815] blender2.8: Fix T56199: Crash on Annotation in (VSE) Image Preview

2018-08-01 Thread Joshua Leung
Commit: 503866c68154ef09e6199068391515f81eebaa2d
Author: Joshua Leung
Date:   Thu Aug 2 16:34:27 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB503866c68154ef09e6199068391515f81eebaa2d

Fix T56199: Crash on Annotation in (VSE) Image Preview

In some cases (e.g. using old userpref settings/keymaps)
it was possible to trigger a crash when the wrong GP/Annotation
operators were triggered in the wrong contexts (e.g. using
the old GPENCIL_OT_paint in annotation-only contexts like
all the 2D editors).

This commit resolves several issues that were caused by sloppy
code-churn + features that had been hacked on.

===

M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index 6325052fccd..b551f3d630b 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1206,9 +1206,19 @@ static tGPsdata *gp_session_initpaint(bContext *C)
/* create new context data */
p = MEM_callocN(sizeof(tGPsdata), "Annotation Drawing Data");
 
-   gp_session_initdata(C, p);
+   /* Try to initialise context data
+* WARNING: This may not always succeed (e.g. using GP in an 
annotation-only context)
+*/
+   if (gp_session_initdata(C, p) == 0) {
+   /* Invalid state - Exit
+* NOTE: It should be safe to just free the data, since failing 
context checks should
+* only happen when no data has been allocated.
+*/
+   MEM_freeN(p);
+   return NULL;
+   }
 
-   /* radius for eraser circle is defined in userprefs now */
+   /* Radius for eraser circle is defined in userprefs */
/* NOTE: we do this here, so that if we exit immediately,
 *   erase size won't get lost
 */
@@ -1548,9 +1558,6 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
 {
tGPsdata *p = op->customdata;
 
-   /* clear undo stack */
-   gpencil_undo_finish();
-
/* restore cursor to indicate end of drawing */
WM_cursor_modal_restore(CTX_wm_window(C));
 
@@ -1568,10 +1575,14 @@ static void gpencil_draw_exit(bContext *C, wmOperator 
*op)
 */
U.gp_eraser = p->radius;
 
+   /* clear undo stack */
+   gpencil_undo_finish();
+
/* cleanup */
gp_paint_cleanup(p);
gp_session_cleanup(p);
gp_session_free(p);
+   p = NULL;
}
 
op->customdata = NULL;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 0c411db57b4..6a0bf0c4a47 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1746,18 +1746,20 @@ static tGPsdata *gp_session_initpaint(bContext *C, 
wmOperator *op)
 {
tGPsdata *p = NULL;
 
-   /* create new context data */
+   /* Create new context data */
p = MEM_callocN(sizeof(tGPsdata), "GPencil Drawing Data");
 
-   gp_session_initdata(C, op, p);
-
-#if 0
-   /* radius for eraser circle is defined in userprefs now */
-   /* NOTE: we do this here, so that if we exit immediately,
-*   erase size won't get lost
+   /* Try to initialise context data
+* WARNING: This may not always succeed (e.g. using GP in an 
annotation-only context)
 */
-   p->radius = U.gp_eraser;
-#endif
+   if (gp_session_initdata(C, op, p) == 0) {
+   /* Invalid state - Exit
+* NOTE: It should be safe to just free the data, since failing 
context checks should
+* only happen when no data has been allocated.
+*/
+   MEM_freeN(p);
+   return NULL;
+   }
 
/* Random generator, only init once. */
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
@@ -2092,26 +2094,7 @@ static bool gpencil_is_tablet_eraser_active(const 
wmEvent *event)
 static void gpencil_draw_exit(bContext *C, wmOperator *op)
 {
tGPsdata *p = op->customdata;
-   bGPdata *gpd = CTX_data_gpencil_data(C);
-
-   /* clear undo stack */
-   gpencil_undo_finish();
-
-   /* restore cursor to indicate end of drawing */
-   if (p->sa->spacetype != SPACE_VIEW3D) {
-   WM_cursor_modal_restore(CTX_wm_window(C));
-   }
-   else {
-   /* or restore paint if 3D view */
-   if ((p) && (p->paintmode == GP_PAINTMODE_ERASER)) {
-   WM_cursor_modal_set(p->win, CURSOR_STD);
- 

[Bf-blender-cvs] [0fdd058991a] blender2.8: Dev Tooling: Instrument motion path calculation operator (for bones) to collect timing data

2018-08-01 Thread Joshua Leung
Commit: 0fdd058991afe68d4cabd60b8d936b6ae8266524
Author: Joshua Leung
Date:   Thu Aug 2 14:46:15 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB0fdd058991afe68d4cabd60b8d936b6ae8266524

Dev Tooling: Instrument motion path calculation operator (for bones) to collect 
timing data

This will be useful for checking on the progress of our optimisation
efforts, and to generate some nice stats for later.

===

M   source/blender/editors/armature/pose_edit.c

===

diff --git a/source/blender/editors/armature/pose_edit.c 
b/source/blender/editors/armature/pose_edit.c
index 1dfb9ec984a..a2cd3c57101 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -70,6 +70,15 @@
 
 #include "armature_intern.h"
 
+
+#define DEBUG_TIME
+
+#include "PIL_time.h"
+#ifdef DEBUG_TIME
+#  include "PIL_time_utildefines.h"
+#endif
+
+
 /* matches logic with ED_operator_posemode_context() */
 Object *ED_pose_object_from_context(bContext *C)
 {
@@ -256,10 +265,18 @@ static int pose_calculate_paths_exec(bContext *C, 
wmOperator *op)
}
CTX_DATA_END;
 
+#ifdef DEBUG_TIME
+   TIMEIT_START(recalc_pose_paths);
+#endif
+
/* calculate the bones that now have motionpaths... */
/* TODO: only make for the selected bones? */
ED_pose_recalculate_paths(C, scene, ob);
 
+#ifdef DEBUG_TIME
+   TIMEIT_END(recalc_pose_paths);
+#endif
+
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8a0760eba2f] blender2.8: Armature Panel Tweaks - Motion Paths/Ghosting

2018-08-01 Thread Joshua Leung
Commit: 8a0760eba2fe8ce31b0d054c498e9a264795c2b4
Author: Joshua Leung
Date:   Thu Aug 2 14:44:17 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB8a0760eba2fe8ce31b0d054c498e9a264795c2b4

Armature Panel Tweaks - Motion Paths/Ghosting

Since most animators find Motion Paths more useful than Armature Ghosting:
* Move Motion Paths before Ghosting settings (less scrolling)
* Collapse Ghosting panel by default
* Open Motion Paths panel by default instead

===

M   release/scripts/startup/bl_ui/properties_animviz.py
M   release/scripts/startup/bl_ui/properties_data_armature.py
M   release/scripts/startup/bl_ui/properties_object.py

===

diff --git a/release/scripts/startup/bl_ui/properties_animviz.py 
b/release/scripts/startup/bl_ui/properties_animviz.py
index 901e15c181a..4033d5c2448 100644
--- a/release/scripts/startup/bl_ui/properties_animviz.py
+++ b/release/scripts/startup/bl_ui/properties_animviz.py
@@ -29,7 +29,7 @@ class MotionPathButtonsPanel:
 bl_space_type = 'PROPERTIES'
 bl_region_type = 'WINDOW'
 bl_label = "Motion Paths"
-bl_options = {'DEFAULT_CLOSED'}
+# bl_options = {'DEFAULT_CLOSED'}
 
 def draw_settings(self, context, avs, mpath, bones=False):
 layout = self.layout
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py 
b/release/scripts/startup/bl_ui/properties_data_armature.py
index 63d80638ae2..8ea20ada390 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -211,6 +211,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
 # TODO: this panel will soon be deprecated too
 class DATA_PT_ghost(ArmatureButtonsPanel, Panel):
 bl_label = "Ghost"
+bl_options = {'DEFAULT_CLOSED'}
 
 def draw(self, context):
 layout = self.layout
@@ -340,9 +341,9 @@ classes = (
 DATA_MT_bone_group_specials,
 DATA_PT_bone_groups,
 DATA_PT_pose_library,
+DATA_PT_motion_paths,
 DATA_PT_ghost,
 DATA_PT_iksolver_itasc,
-DATA_PT_motion_paths,
 DATA_PT_custom_props_arm,
 )
 
diff --git a/release/scripts/startup/bl_ui/properties_object.py 
b/release/scripts/startup/bl_ui/properties_object.py
index 64bc8d52068..79b2f7b8df8 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -329,6 +329,7 @@ from .properties_animviz import (
 class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):
 #bl_label = "Object Motion Paths"
 bl_context = "object"
+bl_options = {'DEFAULT_CLOSED'}
 
 @classmethod
 def poll(cls, context):

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4684375bd45] blender2.8: Fix: Motion Paths were still visible after clearing them

2018-07-31 Thread Joshua Leung
Commit: 4684375bd45f7c6bebcfd5006a8bc86e777f971e
Author: Joshua Leung
Date:   Wed Aug 1 01:27:47 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB4684375bd45f7c6bebcfd5006a8bc86e777f971e

Fix: Motion Paths were still visible after clearing them

After clearing motion paths from objects, those objects needed to be
tagged for copy on write so that the copied data (i.e. viewport)
recieve the changes (i.e. removed paths)

Reported by Hjalti

===

M   source/blender/editors/armature/pose_edit.c
M   source/blender/editors/object/object_edit.c

===

diff --git a/source/blender/editors/armature/pose_edit.c 
b/source/blender/editors/armature/pose_edit.c
index 3ae578279ca..1dfb9ec984a 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -365,6 +365,9 @@ static void ED_pose_clear_paths(Object *ob, bool 
only_selected)
/* if nothing was skipped, there should be no paths left! */
if (skipped == false)
ob->pose->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS;
+
+   /* tag armature object for copy on write - so removed paths don't still 
show */
+   DEG_id_tag_update(>id, DEG_TAG_COPY_ON_WRITE);
 }
 
 /* operator callback - wrapper for the backend function  */
diff --git a/source/blender/editors/object/object_edit.c 
b/source/blender/editors/object/object_edit.c
index 48048319cb7..a6dad906579 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1378,6 +1378,9 @@ static void object_clear_mpath(Object *ob)
animviz_free_motionpath(ob->mpath);
ob->mpath = NULL;
ob->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS;
+
+   /* tag object for copy on write - so removed paths don't still 
show */
+   DEG_id_tag_update(>id, DEG_TAG_COPY_ON_WRITE);
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f08f6c1adec] blender2.8: Clean Keyframes operator tweaks

2018-07-30 Thread Joshua Leung
Commit: f08f6c1adecd5f65c77a33213be3a1bd80968473
Author: Joshua Leung
Date:   Tue Jul 31 03:48:37 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBf08f6c1adecd5f65c77a33213be3a1bd80968473

Clean Keyframes operator tweaks

By popular demand, the CLean Keyframes operator will now
leave handles and other interpolation settings untouched.

Previously, it would recreate the keyframes from scratch,
keeping only the frame + value, under the assumption that
the handle information was "bad" (i.e. the source of bumps
and roughness, due to bad hand tweaking). However, since
most animators use this on hand-keyed animation instead of
motion-capture data, this assumption didn't hold, and was
actually overly destructive - wiping out lots of hand-adjusted
curve data.

===

M   source/blender/editors/animation/keyframes_general.c

===

diff --git a/source/blender/editors/animation/keyframes_general.c 
b/source/blender/editors/animation/keyframes_general.c
index a6ed6643257..b98feac2384 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -183,7 +183,8 @@ void duplicate_fcurve_keys(FCurve *fcu)
 /* Various Tools */
 
 /* Basic F-Curve 'cleanup' function that removes 'double points' and 
unnecessary keyframes on linear-segments only
- * optionally clears up curve if one keyframe with default value remains */
+ * optionally clears up curve if one keyframe with default value remains
+ */
 void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, 
bool cleardefault)
 {
FCurve *fcu = (FCurve *)ale->key_data;
@@ -206,7 +207,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem 
*ale, float thresh, boo
 
/* now insert first keyframe, as it should be ok */
bezt = old_bezts;
-   insert_vert_fcurve(fcu, bezt->vec[1][0], bezt->vec[1][1], 
BEZKEYTYPE(bezt), 0);
+   insert_bezt_fcurve(fcu, bezt, 0);
if (!(bezt->f2 & SELECT)) {
lastb = fcu->bezt;
lastb->f1 = lastb->f2 = lastb->f3 = 0;
@@ -235,7 +236,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem 
*ale, float thresh, boo
cur[0] = bezt->vec[1][0]; cur[1] = bezt->vec[1][1];
 
if (!(bezt->f2 & SELECT)) {
-   insert_vert_fcurve(fcu, cur[0], cur[1], 
BEZKEYTYPE(bezt), 0);
+   insert_bezt_fcurve(fcu, bezt, 0);
lastb = (fcu->bezt + (fcu->totvert - 1));
lastb->f1 = lastb->f2 = lastb->f3 = 0;
continue;
@@ -254,7 +255,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem 
*ale, float thresh, boo
if (cur[1] > next[1]) {
if (IS_EQT(cur[1], prev[1], thresh) == 
0) {
/* add new keyframe */
-   insert_vert_fcurve(fcu, cur[0], 
cur[1], BEZKEYTYPE(bezt), 0);
+   insert_bezt_fcurve(fcu, bezt, 
0);
}
}
}
@@ -262,7 +263,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem 
*ale, float thresh, boo
/* only add if values are a considerable 
distance apart */
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
/* add new keyframe */
-   insert_vert_fcurve(fcu, cur[0], cur[1], 
BEZKEYTYPE(bezt), 0);
+   insert_bezt_fcurve(fcu, bezt, 0);
}
}
}
@@ -271,19 +272,19 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem 
*ale, float thresh, boo
if (beztn) {
/* does current have same value as previous and 
next? */
if (IS_EQT(cur[1], prev[1], thresh) == 0) {
-   /* add new keyframe*/
-   insert_vert_fcurve(fcu, cur[0], cur[1], 
BEZKEYTYPE(bezt), 0);
+   /* add new keyframe */
+   insert_bezt_fcurve(fcu, bezt, 0);
}
else if (IS_EQT(cur[1], next[1], thresh) == 0) {
/* add new keyframe */
-   insert_vert_fcurve(fcu, cur[0], cur[1], 
BEZKEYTYPE(bezt), 0);
+   insert_bezt_fcurve(fcu, bezt, 0);
   

[Bf-blender-cvs] [d28248595b5] blender2.8: Silencing a bunch of compiler warnings

2018-07-30 Thread Joshua Leung
Commit: d28248595b5936ed5f268418ff9905200660ec69
Author: Joshua Leung
Date:   Tue Jul 31 02:57:53 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBd28248595b5936ed5f268418ff9905200660ec69

Silencing a bunch of compiler warnings

Most of these were mismatched const qualifiers

===

M   source/blender/blenkernel/intern/collection.c
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/editors/transform/transform_conversions.c
M   source/blender/makesrna/intern/rna_define.c
M   source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
M   source/blender/windowmanager/gizmo/WM_gizmo_api.h

===

diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 0c93f304218..04e09d06405 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -57,7 +57,7 @@
 
 / Prototypes /
 
-static bool collection_child_add(Collection *parent, Collection *collection, 
int flag, const bool add_us);
+static bool collection_child_add(Collection *parent, Collection *collection, 
const int flag, const bool add_us);
 static bool collection_child_remove(Collection *parent, Collection 
*collection);
 static bool collection_object_add(Main *bmain, Collection *collection, Object 
*ob, int flag, const bool add_us);
 static bool collection_object_remove(Main *bmain, Collection *collection, 
Object *ob, const bool free_us);
diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 516b121031e..6b0c59fb557 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -119,7 +119,7 @@ void ED_view3d_cursor3d_position_rotation(
 float cursor_co[3], float cursor_quat[4]);
 void ED_view3d_cursor3d_update(
 struct bContext *C, const int mval[2],
-bool use_depth, enum eV3DCursorOrient orientation);
+const bool use_depth, enum eV3DCursorOrient orientation);
 
 struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct 
RegionView3D *rv3d);
 
diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index 2cc1236e5c6..e94d3a13225 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -4625,7 +4625,7 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
 
 /* cursor position in vec, result in vec, mval in region coords */
 /* note: cannot use event->mval here (called by object_add() */
-void ED_view3d_cursor3d_position(bContext *C, const int mval[2], bool 
use_depth, float cursor_co[3])
+void ED_view3d_cursor3d_position(bContext *C, const int mval[2], const bool 
use_depth, float cursor_co[3])
 {
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
diff --git a/source/blender/editors/transform/transform_conversions.c 
b/source/blender/editors/transform/transform_conversions.c
index a5706f4a003..675441189b0 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -747,7 +747,7 @@ static void bone_children_clear_transflag(int mode, short 
around, ListBase *lb)
 
 /* sets transform flags in the bones
  * returns total number of bones with BONE_TRANSFORM */
-int count_set_pose_transflags(Object *ob, const int mode, short around, bool 
has_translate_rotate[2])
+int count_set_pose_transflags(Object *ob, const int mode, const short around, 
bool has_translate_rotate[2])
 {
bArmature *arm = ob->data;
bPoseChannel *pchan;
diff --git a/source/blender/makesrna/intern/rna_define.c 
b/source/blender/makesrna/intern/rna_define.c
index c84ce56c58b..4964e94652c 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -2282,7 +2282,7 @@ void RNA_def_property_update_runtime(PropertyRNA *prop, 
const void *func)
 void RNA_def_property_poll_runtime(PropertyRNA *prop, const void *func)
 {
if (prop->type == PROP_POINTER) {
-   ((PointerPropertyRNA *)prop)->poll = func;
+   ((PointerPropertyRNA *)prop)->poll = (void *)func;
}
else {
fprintf(stderr, "%s: %s is not a Pointer Property.\n", 
__func__, prop->identifier);
diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c 
b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
index bf9ab4a5064..af988c0df39 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
@@ -37,7 

[Bf-blender-cvs] [480abbe839e] soc-2018-npr: Fix: Ensure that LANPR panel is only enabled when that engine is enabled

2018-07-30 Thread Joshua Leung
Commit: 480abbe839e8b6305d92ded82f3acd2f69045ea0
Author: Joshua Leung
Date:   Tue Jul 31 02:05:13 2018 +1200
Branches: soc-2018-npr
https://developer.blender.org/rB480abbe839e8b6305d92ded82f3acd2f69045ea0

Fix: Ensure that LANPR panel is only enabled when that engine is enabled

- Fixed incorrect COMPAT_ENGINES define

- Removed poll() callback that was preventing the COMPAT_ENGINES
  set from working

- Have panel opened by default (since it doesn't need to stay collapsed
  when other engines are active anymore)

===

M   release/scripts/startup/bl_ui/properties_scene.py

===

diff --git a/release/scripts/startup/bl_ui/properties_scene.py 
b/release/scripts/startup/bl_ui/properties_scene.py
index 2d8a8d2242c..76ec27d9b4a 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -584,6 +584,7 @@ class SCENE_PT_viewport_display(SceneButtonsPanel, Panel):
 col.prop(scene.display, "light_direction")
 col.prop(scene.display, "shadow_shift")
 
+
 class LANPR_linesets(UIList):
 def draw_item(self, context, layout, data, item, icon, active_data, 
active_propname, index):
 lineset = item
@@ -597,14 +598,10 @@ class LANPR_linesets(UIList):
 layout.alignment = 'CENTER'
 layout.label("", icon_value=icon)
 
+
 class SCENE_PT_lanpr(SceneButtonsPanel, Panel):
-COMPAT_ENGINES = {'BLENDER_CLAY'}
+COMPAT_ENGINES = {'BLENDER_LANPR'}
 bl_label = "LANPR"
-bl_options = {'DEFAULT_CLOSED'}
-
-@classmethod
-def poll(cls, context):
-return True
 
 def draw(self, context):
 layout = self.layout

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [91a4d28a1c2] soc-2018-npr: Example commit for fixing panel visibility when LANPR is enabled

2018-07-30 Thread Joshua Leung
Commit: 91a4d28a1c23890f06ae0134bc9326cb072c946a
Author: Joshua Leung
Date:   Tue Jul 31 01:58:49 2018 +1200
Branches: soc-2018-npr
https://developer.blender.org/rB91a4d28a1c23890f06ae0134bc9326cb072c946a

Example commit for fixing panel visibility when LANPR is enabled

Following the examples here (for the Scene/KeyingSet settings),
all general non-engine-specific panels should include "BLENDER_LANPR"
in the COMPAT_ENGINES set.

===

M   release/scripts/startup/bl_ui/properties_scene.py

===

diff --git a/release/scripts/startup/bl_ui/properties_scene.py 
b/release/scripts/startup/bl_ui/properties_scene.py
index b609e2322b6..2d8a8d2242c 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -66,7 +66,7 @@ class SceneButtonsPanel:
 
 class SCENE_PT_scene(SceneButtonsPanel, Panel):
 bl_label = "Scene"
-COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL', 
'BLENDER_LANPR'}
 
 def draw(self, context):
 layout = self.layout
@@ -81,7 +81,7 @@ class SCENE_PT_scene(SceneButtonsPanel, Panel):
 
 class SCENE_PT_unit(SceneButtonsPanel, Panel):
 bl_label = "Units"
-COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL', 
'BLENDER_LANPR'}
 
 def draw_header_preset(self, context):
 SCENE_PT_units_length_presets.draw_panel_header(self.layout)
@@ -163,7 +163,7 @@ class SceneKeyingSetsPanel:
 class SCENE_PT_keying_sets(SceneButtonsPanel, SceneKeyingSetsPanel, Panel):
 bl_label = "Keying Sets"
 bl_options = {'DEFAULT_CLOSED'}
-COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL', 
'BLENDER_LANPR'}
 
 def draw(self, context):
 layout = self.layout

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [277a7a527f9] soc-2018-npr: Automatically refresh viewport when changing LANPR settings

2018-07-30 Thread Joshua Leung
Commit: 277a7a527f9de5cacb2894a3f0d8ce84ab35f30e
Author: Joshua Leung
Date:   Tue Jul 31 01:51:31 2018 +1200
Branches: soc-2018-npr
https://developer.blender.org/rB277a7a527f9de5cacb2894a3f0d8ce84ab35f30e

Automatically refresh viewport when changing LANPR settings

Use the messagebus struct-subscription methods here (as used for EEVEE settings)
so that changing rendering methods or other settings immediately refreshes
the viewport instead of requiring the user to click on the viewport to force
a redraw.

===

M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/makesrna/RNA_access.h

===

diff --git a/source/blender/editors/space_view3d/space_view3d.c 
b/source/blender/editors/space_view3d/space_view3d.c
index 2577077002e..5822f3d8838 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1106,6 +1106,7 @@ static void view3d_main_region_message_subscribe(
}
 
WM_msg_subscribe_rna_anon_type(mbus, SceneEEVEE, 
_sub_value_region_tag_redraw);
+   WM_msg_subscribe_rna_anon_type(mbus, SceneLANPR, 
_sub_value_region_tag_redraw);
WM_msg_subscribe_rna_anon_type(mbus, SceneDisplay, 
_sub_value_region_tag_redraw);
WM_msg_subscribe_rna_anon_type(mbus, ObjectDisplay, 
_sub_value_region_tag_redraw);
 
diff --git a/source/blender/makesrna/RNA_access.h 
b/source/blender/makesrna/RNA_access.h
index 5d2e66ec59f..f992b6f5c3f 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -505,6 +505,7 @@ extern StructRNA RNA_RigidBodyJointConstraint;
 extern StructRNA RNA_SPHFluidSettings;
 extern StructRNA RNA_Scene;
 extern StructRNA RNA_SceneEEVEE;
+extern StructRNA RNA_SceneLANPR;
 extern StructRNA RNA_SceneObjects;
 extern StructRNA RNA_SceneRenderLayer;
 extern StructRNA RNA_SceneSequence;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4c088075f0a] soc-2018-npr: Fix compiler warnings (use 0 in enums for no icon, not NULL) + whitespace (mixed tabs/spaces)

2018-07-30 Thread Joshua Leung
Commit: 4c088075f0a3799dcccbf469e0ad8cc8ea0d3128
Author: Joshua Leung
Date:   Tue Jul 31 01:44:54 2018 +1200
Branches: soc-2018-npr
https://developer.blender.org/rB4c088075f0a3799dcccbf469e0ad8cc8ea0d3128

Fix compiler warnings (use 0 in enums for no icon, not NULL) + whitespace 
(mixed tabs/spaces)

===

M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 220f17dae79..34b6159d602 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -6212,41 +6212,41 @@ static void rna_def_scene_lanpr(BlenderRNA *brna)
PropertyRNA *prop;
 
static const EnumPropertyItem DEBUG_rna_enum_lanpr_reload[] = {
-   {0, "IDLE", NULL, "Idle", "Idle"},
-{1, "RELOAD", NULL, "RELOAD", "Force reload the scene"},
-   {0, NULL, 0, NULL, NULL}
-};
+   {0, "IDLE", 0, "Idle", "Idle"},
+   {1, "RELOAD", 0, "RELOAD", "Force reload the scene"},
+   {0, NULL, 0, NULL, NULL}
+   };
 
static const EnumPropertyItem rna_enum_lanpr_master_mode[] = {
-   {LANPR_MASTER_MODE_SOFTWARE, "SOFTWARE", NULL, "Software", 
"Software edge calculation" },
-   {LANPR_MASTER_MODE_DPIX, "DPIX", NULL, "DPIX", "DPIX GPU edge 
calculation"},
-{LANPR_MASTER_MODE_SNAKE, "SNAKE", NULL, "Snake", "Image filter and 
GPU tracing method"},
-   {0, NULL, 0, NULL, NULL}
-};
+   {LANPR_MASTER_MODE_SOFTWARE, "SOFTWARE", 0, "Software", 
"Software edge calculation" },
+   {LANPR_MASTER_MODE_DPIX, "DPIX", 0, "DPIX", "DPIX GPU edge 
calculation"},
+   {LANPR_MASTER_MODE_SNAKE, "SNAKE", 0, "Snake", "Image filter 
and GPU tracing method"},
+   {0, NULL, 0, NULL, NULL}
+   };
 
static const EnumPropertyItem rna_enum_lanpr_enable_post_processing[] = 
{
-   {LANPR_POST_PROCESSING_DISABLED, "DISABLED", NULL, "Disabled", 
"LANPR does not compute anything"},
-{LANPR_POST_PROCESSING_ENABLED, "ENABLED", NULL, "Enabled", "LANPR 
will compute feature lines in image post processing"},
-   {0, NULL, 0, NULL, NULL}
-};
+   {LANPR_POST_PROCESSING_DISABLED, "DISABLED", 0, "Disabled", 
"LANPR does not compute anything"},
+   {LANPR_POST_PROCESSING_ENABLED, "ENABLED", 0, "Enabled", "LANPR 
will compute feature lines in image post processing"},
+   {0, NULL, 0, NULL, NULL}
+   };
 
static const EnumPropertyItem rna_enum_lanpr_display_thinning_result[] 
= {
-   {LANPR_POST_PROCESSING_DISABLED, "DISABLED", NULL, "Edge 
Detection", "Display edge detector result"},
-{LANPR_POST_PROCESSING_ENABLED, "ENABLED", NULL, "Thinning", "Apply 
thinning filters for vector usage"},
-   {0, NULL, 0, NULL, NULL}
-};
+   {LANPR_POST_PROCESSING_DISABLED, "DISABLED", 0, "Edge 
Detection", "Display edge detector result"},
+   {LANPR_POST_PROCESSING_ENABLED, "ENABLED", 0, "Thinning", 
"Apply thinning filters for vector usage"},
+   {0, NULL, 0, NULL, NULL}
+   };
 
static const EnumPropertyItem rna_enum_lanpr_use_same_taper[] = {
-   {LANPR_USE_DIFFERENT_TAPER, "DISABLED", NULL, "Different", "Use 
different taper value"},
-{LANPR_USE_SAME_TAPER, "ENABLED", NULL, "Same", "Use same taper value 
for both sides of the line"},
-   {0, NULL, 0, NULL, NULL}
-};
+   {LANPR_USE_DIFFERENT_TAPER, "DISABLED", 0, "Different", "Use 
different taper value"},
+   {LANPR_USE_SAME_TAPER, "ENABLED", 0, "Same", "Use same taper 
value for both sides of the line"},
+   {0, NULL, 0, NULL, NULL}
+   };
 
static const EnumPropertyItem rna_enum_lanpr_enable_tip_extend[] = {
-   {LANPR_DISABLE_TIP_EXTEND, "DISABLED", NULL, "Disable", "Do not 
extend curve tips"},
-{LANPR_ENABLE_TIP_EXTEND, "ENABLED", NULL, "Enable", "Extend curve 
tips to a user specified length"},
-   {0, NULL, 0, NULL, NULL}
-};
+   {LANPR_DISABLE_TIP_EXTEND, "DISABLED", 0, "Disable", "Do not 
extend curve tips"},
+   {LANPR_ENABLE_TIP_EXTEND, "ENABLED", 0, "Enable", "Extend curve 
tips to a user specified length"},
+   {0, NULL, 0, NULL, NULL}
+   };
 
srna = RNA_def_struct(brna, "SceneLANPR", NULL);
RNA_def_struct_sdna(srna, "SceneLANPR");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ff471c95fce] soc-2018-npr: Compile Fix: Branch now compiles when WITH_OPENSUBDIV is disabled

2018-07-30 Thread Joshua Leung
Commit: ff471c95fce4abfa6047227b063617dc6ae3261b
Author: Joshua Leung
Date:   Tue Jul 31 00:54:51 2018 +1200
Branches: soc-2018-npr
https://developer.blender.org/rBff471c95fce4abfa6047227b063617dc6ae3261b

Compile Fix: Branch now compiles when WITH_OPENSUBDIV is disabled

===

M   source/blender/modifiers/intern/MOD_mybmesh.c

===

diff --git a/source/blender/modifiers/intern/MOD_mybmesh.c 
b/source/blender/modifiers/intern/MOD_mybmesh.c
index ba52be6b4b9..427d2b80f6a 100644
--- a/source/blender/modifiers/intern/MOD_mybmesh.c
+++ b/source/blender/modifiers/intern/MOD_mybmesh.c
@@ -65,6 +65,7 @@
 
 //TODO this modifier depends on OpenSubDiv. So if it's not compiled in, remove 
this modifier
 
+#ifdef WITH_OPENSUBDIV
 #include "opensubdiv_capi.h"
 #include "opensubdiv_converter_capi.h"
 #include "opensubdiv_evaluator_capi.h"
@@ -4324,6 +4325,8 @@ static Mesh *mybmesh_do(Mesh *mesh, MyBMeshModifierData 
*mmd, float cam_loc[3])
return result;
 }
 
+#endif /* WITH_OPENSUBDIV */
+
 /* MyBMesh */
 static void initData(ModifierData *md)
 {
@@ -4362,9 +4365,11 @@ static Mesh *applyModifier(ModifierData *md, const 
ModifierEvalContext *ctx,
*/
}
 
+#ifdef WITH_OPENSUBDIV
if (!(result = mybmesh_do(mesh, mmd, cam_loc))) {
return mesh;
}
+#endif
 
return result;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [12ed26444e5] greasepencil-object: Fix: Forgot to rename a few properties in earlier RNA/DNA commit

2018-07-27 Thread Joshua Leung
Commit: 12ed26444e50345b8aaa6d5b175ba435ece99dc7
Author: Joshua Leung
Date:   Fri Jul 27 17:15:07 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB12ed26444e50345b8aaa6d5b175ba435ece99dc7

Fix: Forgot to rename a few properties in earlier RNA/DNA commit

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index d331da3569e..8e17c24688f 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -40,7 +40,7 @@ def gpencil_stroke_placement_settings(context, layout):
 if context.space_data.type != 'VIEW_3D':
 col.label(text="Stroke Placement:")
 row = col.row(align=True)
-#row.prop_enum(ts, propname, 'VIEW')  # XXX: Now removed!
+row.prop_enum(ts, propname, 'VIEW')
 row.prop_enum(ts, propname, 'CURSOR', text="Cursor")
 
 
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 07d3b6a2ec4..741badd46d6 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2450,21 +2450,21 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
/* Annotations - 2D Views Stroke Placement */
-   prop = RNA_def_property(srna, "gpencil_stroke_placement_view2d", 
PROP_ENUM, PROP_NONE);
+   prop = RNA_def_property(srna, "annotation_stroke_placement_view2d", 
PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v2d_align");
RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
RNA_def_property_ui_text(prop, "Stroke Placement (2D View)", "");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
/* Annotations - Sequencer Preview Stroke Placement */
-   prop = RNA_def_property(srna, 
"gpencil_stroke_placement_sequencer_preview", PROP_ENUM, PROP_NONE);
+   prop = RNA_def_property(srna, 
"annotation_stroke_placement_sequencer_preview", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_seq_align");
RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
RNA_def_property_ui_text(prop, "Stroke Placement (Sequencer Preview)", 
"");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
/* Annotations - Image Editor Stroke Placement */
-   prop = RNA_def_property(srna, "gpencil_stroke_placement_image_editor", 
PROP_ENUM, PROP_NONE);
+   prop = RNA_def_property(srna, 
"annotation_stroke_placement_image_editor", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_ima_align");
RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
RNA_def_property_ui_text(prop, "Stroke Placement (Image Editor)", "");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [81b971b154d] greasepencil-object: Fix: Refresh issues in Topbar with Grease Pencil and Annotations

2018-07-26 Thread Joshua Leung
Commit: 81b971b154dc0b1fc00c13e72a08771aaffbd998
Author: Joshua Leung
Date:   Fri Jul 27 16:44:38 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB81b971b154dc0b1fc00c13e72a08771aaffbd998

Fix: Refresh issues in Topbar with Grease Pencil and Annotations

===

M   source/blender/editors/space_topbar/space_topbar.c

===

diff --git a/source/blender/editors/space_topbar/space_topbar.c 
b/source/blender/editors/space_topbar/space_topbar.c
index e45159124e8..6113922c02e 100644
--- a/source/blender/editors/space_topbar/space_topbar.c
+++ b/source/blender/editors/space_topbar/space_topbar.c
@@ -168,6 +168,10 @@ static void topbar_main_region_listener(wmWindow 
*UNUSED(win), ScrArea *UNUSED(s
if (wmn->data == ND_SPACE_VIEW3D)
ED_region_tag_redraw(ar);
break;
+   case NC_GPENCIL:
+   if (wmn->data == ND_DATA)
+   ED_region_tag_redraw(ar);
+   break;
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [aa8b7f4368b] greasepencil-object: RNA/DNA changes to further decouple Grease Pencil and Annotation settings where clashes occurred

2018-07-26 Thread Joshua Leung
Commit: aa8b7f4368b02ac35dc7305bf2a970972eef685a
Author: Joshua Leung
Date:   Fri Jul 27 16:13:56 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBaa8b7f4368b02ac35dc7305bf2a970972eef685a

RNA/DNA changes to further decouple Grease Pencil and Annotation settings where 
clashes occurred

* Decouple stroke placement settings for 3D view
* Ensure that proper thickness controls are used in the topbar

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/drawgpencil.c
M   source/blender/editors/gpencil/gpencil_convert.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/makesdna/DNA_gpencil_types.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_gpencil.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 1bc8426b61a..1c9e4ab9a6a 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -25,13 +25,13 @@ from bpy.app.translations import pgettext_iface as iface_
 
 def gpencil_stroke_placement_settings(context, layout):
 if context.space_data.type == 'VIEW_3D':
-propname = "gpencil_stroke_placement_view3d"
+propname = "annotation_stroke_placement_view3d"
 elif context.space_data.type == 'SEQUENCE_EDITOR':
-propname = "gpencil_stroke_placement_sequencer_preview"
+propname = "annotation_stroke_placement_sequencer_preview"
 elif context.space_data.type == 'IMAGE_EDITOR':
-propname = "gpencil_stroke_placement_image_editor"
+propname = "annotation_stroke_placement_image_editor"
 else:
-propname = "gpencil_stroke_placement_view2d"
+propname = "annotation_stroke_placement_view2d"
 
 ts = context.tool_settings
 
@@ -131,7 +131,7 @@ class GreasePencilDrawingToolsPanel:
 #col.separator()
 #col.separator()
 
-#gpencil_stroke_placement_settings(context, col)
+gpencil_stroke_placement_settings(context, col)
 
 gpd = context.gpencil_data
 
@@ -789,8 +789,8 @@ class GreasePencilDataPanel:
 sub.operator("gpencil.layer_move", icon='TRIA_DOWN', 
text="").type = 'DOWN'
 
 if gpl:
-row = layout.row(align=True)
-row.prop(gpl, "opacity", text="Opacity", slider=True)
+layout.prop(gpl, "opacity", text="Opacity", slider=True)
+layout.prop(gpl, "thickness", text="Thickness")
 
 layout.separator()
 
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index d7ab5e3bd33..ecf641b394e 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -200,10 +200,10 @@ class _defs_annotate:
 
 if gpd and gpl:
 layout.prop(gpd.layers, "active_note", text="")
-layout.prop(gpl, "line_change", text="Thickness")  # XXX: Replace 
with proper thickness control
+layout.prop(gpl, "thickness", text="Thickness")
 else:
 layout.prop(user_prefs.edit, "grease_pencil_default_color", 
text="Color")
-layout.label("Thickness: [...]")
+layout.prop(ts, "annotation_thickness", text="Thickness")
 
 # For 3D view, show the stroke placement settings
 # XXX: How to tell what editor the active tool comes from?
@@ -212,7 +212,7 @@ class _defs_annotate:
 layout.separator()
 
 row = layout.row(align=True)
-row.prop(ts, "gpencil_stroke_placement_view3d", text="Orientation")
+row.prop(ts, "annotation_stroke_placement_view3d", 
text="Orientation")
 if ts.gpencil_stroke_placement_view3d == 'CURSOR':
 row.prop(ts.gpencil_sculpt, "lockaxis"

[Bf-blender-cvs] [a2dcac0a029] greasepencil-object: Cleanup: Remove unused code

2018-07-26 Thread Joshua Leung
Commit: a2dcac0a0295d029578c44a05b17ca77ade648fe
Author: Joshua Leung
Date:   Fri Jul 27 16:20:48 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBa2dcac0a0295d029578c44a05b17ca77ade648fe

Cleanup: Remove unused code

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 1c9e4ab9a6a..d331da3569e 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -431,7 +431,7 @@ class GPENCIL_MT_pie_settings_palette(Menu):
 pie = layout.menu_pie()
 gpd = context.gpencil_data
 gpl = context.active_gpencil_layer
-palcolor = context.active_gpencil_palettecolor
+palcolor = None #context.active_gpencil_palettecolor
 brush = context.active_gpencil_brush
 
 is_editmode = bool(gpd and gpd.use_stroke_edit_mode and 
context.editable_gpencil_strokes)
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 2da6e786b18..8231af374ea 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1024,13 +1024,6 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
RNA_def_property_editable_func(prop, 
"rna_GPencilLayer_active_frame_editable");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
-   /* Draw Style */
-   // TODO: replace these with a "draw type" combo (i.e. strokes only, 
filled strokes, strokes + fills, volumetric)?
-   prop = RNA_def_property(srna, "use_volumetric_strokes", PROP_BOOLEAN, 
PROP_NONE);
-   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_VOLUMETRIC);
-   RNA_def_property_ui_text(prop, "Volumetric Strokes",
-"Draw strokes as a series of circular blobs, 
resulting in a volumetric effect");
-   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
 
/* Layer Opacity */
prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f4f5c1152c7] greasepencil-object: Fix: Don't show GP Object's layer data in the Annotation topbar settings

2018-07-26 Thread Joshua Leung
Commit: f4f5c1152c7132065245dcf88e4e2bc50fc30712
Author: Joshua Leung
Date:   Fri Jul 27 14:03:29 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBf4f5c1152c7132065245dcf88e4e2bc50fc30712

Fix: Don't show GP Object's layer data in the Annotation topbar settings

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index c6015a855cd..d7ab5e3bd33 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -24,6 +24,7 @@
 # For now keep this in a single file since it's an area that may change,
 # so avoid making changes all over the place.
 
+import bpy
 from bpy.types import Panel
 
 from .space_toolsystem_common import (
@@ -190,8 +191,12 @@ class _defs_annotate:
 
 # XXX: These context checks are needed for layer-dependent settings,
 # but this breaks for using topbar for 2D editor active tools, etc.
-gpd = context.gpencil_data
-gpl = context.active_gpencil_layer
+if type(context.gpencil_data_owner) is bpy.types.Object:
+gpd = context.scene.grease_pencil
+else:
+gpd = context.gpencil_data
+
+gpl = gpd.layers.active if gpd else None
 
 if gpd and gpl:
 layout.prop(gpd.layers, "active_note", text="")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9afed02356e] greasepencil-object: Annotation Eraser: Only erase the point within the cursor, not the whole segment

2018-07-24 Thread Joshua Leung
Commit: 9afed02356e7626d121fb46470516a71eb4ecd4d
Author: Joshua Leung
Date:   Wed Jul 25 16:46:43 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB9afed02356e7626d121fb46470516a71eb4ecd4d

Annotation Eraser: Only erase the point within the cursor, not the whole segment

===

M   source/blender/editors/gpencil/annotate_paint.c

===

diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index ec645f0188c..4acc6dd985e 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -933,9 +933,13 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
if ((gp_stroke_eraser_is_occluded(p, 
pt1, pc1[0], pc1[1]) == false) ||
(gp_stroke_eraser_is_occluded(p, 
pt2, pc2[0], pc2[1]) == false))
{
-   /* Point is affected */
-   pt1->flag |= GP_SPOINT_TAG;
-   pt2->flag |= GP_SPOINT_TAG;
+   /* Edge is affected - Check 
individual points now */
+   if (len_v2v2_int(mval, pc1) <= 
radius) {
+   pt1->flag |= 
GP_SPOINT_TAG;
+   }
+   if (len_v2v2_int(mval, pc2) <= 
radius) {
+   pt2->flag |= 
GP_SPOINT_TAG;
+   }
do_cull = true;
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [171e231a8a8] greasepencil-object: Fix: Crash in non-3d editors when using Annotations

2018-07-24 Thread Joshua Leung
Commit: 171e231a8a8790408a78ec98014f00b52e738d9a
Author: Joshua Leung
Date:   Wed Jul 25 16:39:56 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB171e231a8a8790408a78ec98014f00b52e738d9a

Fix: Crash in non-3d editors when using Annotations

The wrong shader was being used after removing the per-point
varying colors.

===

M   source/blender/editors/gpencil/annotate_draw.c

===

diff --git a/source/blender/editors/gpencil/annotate_draw.c 
b/source/blender/editors/gpencil/annotate_draw.c
index d761b4f5f8c..dad5af7379c 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -347,9 +347,8 @@ static void gp_draw_stroke_2d(const bGPDspoint *points, int 
totpoints, short thi
 
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 
2, GPU_FETCH_FLOAT);
-   uint color = GPU_vertformat_attr_add(format, "color", 
GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
 
-   immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+   immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3fvAlpha(ink, ink[3]);
immBegin(GPU_PRIM_TRI_STRIP, totpoints * 2 + 4);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a54c30da76d] greasepencil-object: Hacky fix for Mode Switch Pie Menu overflowing to a submenu on GP Objects

2018-07-23 Thread Joshua Leung
Commit: a54c30da76dca5d73c241ac7815820ff7970ba07
Author: Joshua Leung
Date:   Tue Jul 24 17:47:28 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBa54c30da76dca5d73c241ac7815820ff7970ba07

Hacky fix for Mode Switch Pie Menu overflowing to a submenu on GP Objects

With the introduction of the GP editing modes to the object/workspace
modes enum, this introduced a number of issues for the Ctrl-Tab mode
switching pie menu, e.g.
 * To access any of the GP Editing modes, you had to first navigate to
   the "More" sub-pie, before being able to see these values. In practice,
   this was tricky to use, and not ideal.
 * Particle Editing mode was also moved into a sub-pie by itself

This was due to the following reasons:
 1) Pie Menus for Enums use the "static" enum define to determine
where items should go.  This was done to ensure spatial consistency
of items (e.g. Edit is always in the "east" position).
 2) Each pie menu layout is only allowed to contain 8 items.
(i.e. so that movements can be less precise, corresponding to the
main compass directions only)
 3) The nature of the modes menu means that there is never any situation
where all menu items need to be visible at the same time. Usually,
there are only between 2-5 items in that menu at a time, and at least
6 of the items are only valid for a single object type each.

Several other solutions were tried, but this hack is the simplest fix.

===

M   source/blender/editors/interface/interface_layout.c

===

diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index 82ed4c5acba..89e1a8caec8 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1244,7 +1244,15 @@ void uiItemsFullEnumO(
bool free;
 
if (ui_layout_is_radial(layout)) {
+   /* XXX: While "_all()" guarantees spatial stability, 
it's bad when an enum has > 8 items total,
+* but only a small subset will ever be shown at once 
(e.g. Mode Switch menu, after the 
+* introduction of GP editing modes)
+*/
+#if 0
RNA_property_enum_items_gettexted_all(block->evil_C, 
, prop, _array, , );
+#else
+   RNA_property_enum_items_gettexted(block->evil_C, , 
prop, _array, , );
+#endif
}
else {
RNA_property_enum_items_gettexted(block->evil_C, , 
prop, _array, , );

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [091db5fb961] greasepencil-object: Assorted Cleanup/Fixes

2018-07-23 Thread Joshua Leung
Commit: 091db5fb9619887673c3d3b0b717776b6035d163
Author: Joshua Leung
Date:   Tue Jul 24 02:32:45 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB091db5fb9619887673c3d3b0b717776b6035d163

Assorted Cleanup/Fixes

===

M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/makesrna/intern/rna_gpencil.c
M   source/blender/nodes/composite/nodes/node_composite_cryptomatte.c

===

diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index 53b842233cf..ec645f0188c 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -458,9 +458,6 @@ static short gp_stroke_addpoint(
return GP_STROKEADD_NORMAL;
}
else if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
-#if 0
-   bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
-#endif
/* get pointer to destination point */
pt = (tGPspoint *)(gpd->runtime.sbuffer);
 
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index c2f984d2bbe..cf077999c12 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -468,8 +468,8 @@ static void rna_GPencil_stroke_point_add(bGPDstroke 
*stroke, int count, float pr
  sizeof(bGPDspoint) * 
(stroke->totpoints + count),
  "gp_stroke_points");
stroke->dvert = MEM_recallocN_id(stroke->dvert,
-   
  sizeof(MDeformVert) * (stroke->totpoints + count),
-   
  "gp_stroke_weight");
+ sizeof(MDeformVert) * 
(stroke->totpoints + count),
+ "gp_stroke_weight");
 
/* init the pressure and strength values so that old scripts 
won't need to
 * be modified to give these initial values...
diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c 
b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
index bf9ab4a5064..af988c0df39 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
@@ -37,7 +37,7 @@
 
 /* this is taken from the cryptomatte specification 1.0 */
 
-static inline float hash_to_float(uint32_t hash)
+BLI_INLINE float hash_to_float(uint32_t hash)
 {
uint32_t mantissa = hash & ((1 << 23) - 1);
uint32_t exponent = (hash >> 23) & ((1 << 8) - 1);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [846f5d8f744] greasepencil-object: Annotations: Dynamically updating layer-color preview icons + "Active Note" enum

2018-07-23 Thread Joshua Leung
Commit: 846f5d8f744601914ba0481dc23ec75c5dc7509d
Author: Joshua Leung
Date:   Tue Jul 24 02:28:35 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB846f5d8f744601914ba0481dc23ec75c5dc7509d

Annotations: Dynamically updating layer-color preview icons + "Active Note" enum

This adds a new enum with dynamically-generated icons to show previews
for the icons associated with each GP layer used for annotations. This
enum is used as part of the UI for annotations (specifically, in the
topbar settings for the active  tool), making it easier for users to
see what color strokes drawn using the active note/layer will look like.

I ended up needing to create a new icon type in BKE_icons.h so that
we can store references to the layer/color used.

Known issues:
* The icon seems a bit too big, and would look a bit nicer with
  rounded corners. But there are too many issues with the UI roundbox
  functions (e.g. _aa() makes colors too dark, and non-aa versions look
  too rough).

* Changing layer colors doesn't redraw the icons. A manual refresh
  (by mousing over the widget) is needed.

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M   source/blender/blenkernel/BKE_icons.h
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/blenkernel/intern/icons.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/interface/interface_icons.c
M   source/blender/makesdna/DNA_gpencil_types.h
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 0d2d6445203..9668c398658 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -184,7 +184,7 @@ class _defs_annotate:
 gpl = context.active_gpencil_layer
 
 if gpd and gpl:
-layout.prop_search(gpd.layers, "active", gpd, "layers", text="")
+layout.prop(gpd.layers, "active_note", text="")
 layout.prop(gpl, "line_change", text="Thickness")  # XXX: Replace 
with proper thickness control
 else:
 layout.prop(user_prefs.edit, "grease_pencil_default_color", 
text="Color")
diff --git a/source/blender/blenkernel/BKE_icons.h 
b/source/blender/blenkernel/BKE_icons.h
index 22897d2ea80..7a5262e0a14 100644
--- a/source/blender/blenkernel/BKE_icons.h
+++ b/source/blender/blenkernel/BKE_icons.h
@@ -43,7 +43,10 @@ enum {
ICON_DATA_PREVIEW,
/** 2D triangles: obj is #Icon_Geom */
ICON_DATA_GEOM,
+   /** Studiolight */
ICON_DATA_STUDIOLIGHT,
+   /** GPencil Layer color preview (annotations): obj is #bGPDlayer */
+   ICON_DATA_GPLAYER,
 };
 
 struct Icon {
@@ -79,6 +82,7 @@ struct ImBuf;
 struct PreviewImage;
 struct ID;
 struct StudioLight;
+struct bGPDlayer;
 
 enum eIconSizes;
 
@@ -87,6 +91,9 @@ void BKE_icons_init(int first_dyn_id);
 /* return icon id for library object or create new icon if not found */
 int BKE_icon_id_ensure(struct ID *id);
 
+/* return icon id for Grease Pencil layer (color preview) or create new icon 
if not found */
+int BKE_icon_gplayer_color_ensure(struct bGPDlayer *gpl);
+
 int BKE_icon_preview_ensure(struct ID *id, struct PreviewImage *preview);
 
 /* retrieve icon for id */
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 424b5955486..de3f891f9f9 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -60,6 +60,7 @@
 #include "BKE_global.h"
 #include "BKE_gpencil.h"
 #include "BKE_colortools.h"
+#include "BKE_icons.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_object.h"
@@ -1031,6 +1032,9 @@ void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer 
*gpl)
/* free layer */
BKE_gpencil_free_frames(gpl);
 
+   /* free icon providing preview of icon color */
+   BKE_icon_delete(gpl->runtime.icon_id);
+
/* free derived data */
BKE_gpencil_clear_derived(gpl);
if (gpl->runtime.derived_data) {
diff --git a/source/blender/blenkernel/intern/icons.c 
b/source/blender/blenkernel/intern/icons.c
index 1c2575dfa52..3a4bf53e22d 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -37,6 +37,8 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_brush_types.h"
+#include "DNA_gpencil_types.h"
 #include "DNA_group_types.h"
 #include "D

[Bf-blender-cvs] [c8cf0e10e08] greasepencil-object: Annotations: Show "Stroke Placement" options in the topbar again

2018-07-23 Thread Joshua Leung
Commit: c8cf0e10e08203bb43d0c551c4ecb42a76886326
Author: Joshua Leung
Date:   Tue Jul 24 17:24:25 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBc8cf0e10e08203bb43d0c551c4ecb42a76886326

Annotations: Show "Stroke Placement" options in the topbar again

We may have to introduce a dedicated setting here for use with the
annotation tools, since the GP Object version is quite different now.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 4b1b3cdbd62..f972c467182 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -119,7 +119,7 @@ class GreasePencilDrawingToolsPanel:
 col.separator()
 col.separator()
 
-if context.space_data.type in {'VIEW_3D', 'CLIP_EDITOR'}:
+if context.space_data.type in {'CLIP_EDITOR'}:
 col.separator()
 col.label("Data Source:")
 row = col.row(align=True)
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 6f3019d6fff..08cf388870d 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -176,7 +176,7 @@ class _defs_annotate:
 @classmethod
 def draw_settings_common(cls, context, layout, tool):
 user_prefs = context.user_preferences
-#tool_settings = context.tool_settings
+ts = context.tool_settings
 
 # XXX: These context checks are needed for layer-dependent settings,
 # but this breaks for using topbar for 2D editor active tools, etc.
@@ -190,6 +190,19 @@ class _defs_annotate:
 layout.prop(user_prefs.edit, "grease_pencil_default_color", 
text="Color")
 layout.label("Thickness: [...]")
 
+# For 3D view, show the stroke placement settings
+# XXX: How to tell what editor the active tool comes from?
+is_3d_view = True
+if is_3d_view:
+layout.separator()
+
+row = layout.row(align=True)
+row.prop(ts, "gpencil_stroke_placement_view3d", text="Orientation")
+if ts.gpencil_stroke_placement_view3d == 'CURSOR':
+row.prop(ts.gpencil_sculpt, "lockaxis")
+elif ts.gpencil_stroke_placement_view3d in {'SURFACE', 'STROKE'}:
+row.prop(ts, "use_gpencil_stroke_endpoints")
+
 @ToolDef.from_fn
 def scribble():
 def draw_settings(context, layout, tool):

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dc215a58518] greasepencil-object: Annotation Tools: Use different cursors to indicate that the tools are running

2018-07-23 Thread Joshua Leung
Commit: dc215a585185cbc420a22f81c59186255dfb00de
Author: Joshua Leung
Date:   Tue Jul 24 03:16:46 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBdc215a585185cbc420a22f81c59186255dfb00de

Annotation Tools: Use different cursors to indicate that the tools are running

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 9668c398658..6f3019d6fff 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -198,6 +198,7 @@ class _defs_annotate:
 return dict(
 text="Annotate",
 icon="ops.gpencil.draw",
+cursor='PAINT_BRUSH',
 keymap=(
 ("gpencil.annotate",
  dict(mode='DRAW', wait_for_input=False),
@@ -214,6 +215,7 @@ class _defs_annotate:
 return dict(
 text="Draw Line",
 icon="ops.gpencil.draw.line",
+cursor='CROSSHAIR',
 keymap=(
 ("gpencil.annotate",
  dict(mode='DRAW_STRAIGHT', wait_for_input=False),
@@ -230,6 +232,7 @@ class _defs_annotate:
 return dict(
 text="Draw Polygon",
 icon="ops.gpencil.draw.poly",
+cursor='CROSSHAIR',
 keymap=(
 ("gpencil.annotate",
  dict(mode='DRAW_POLY', wait_for_input=False),
@@ -248,7 +251,7 @@ class _defs_annotate:
 return dict(
 text="Eraser",
 icon="ops.gpencil.draw.eraser",
-#cursor='...',  # XXX: Always show brush circle when enabled
+cursor='CROSSHAIR', # XXX: Always show brush circle when enabled
 keymap=(
 ("gpencil.annotate",
  dict(mode='ERASER', wait_for_input=False),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d62a48411db] greasepencil-object: Cleanup: Remove need to set colors on each and every annotation point when drawing

2018-07-23 Thread Joshua Leung
Commit: d62a48411db16b74c0c2e6f87a544d0bdfdbbb9b
Author: Joshua Leung
Date:   Fri Jul 20 15:03:15 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBd62a48411db16b74c0c2e6f87a544d0bdfdbbb9b

Cleanup: Remove need to set colors on each and every annotation point when 
drawing

===

M   source/blender/editors/gpencil/annotate_draw.c

===

diff --git a/source/blender/editors/gpencil/annotate_draw.c 
b/source/blender/editors/gpencil/annotate_draw.c
index 9e5556bffe9..159d840b9f3 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -90,36 +90,7 @@ typedef enum eDrawStrokeFlags {
 } eDrawStrokeFlags;
 
 
-/* conversion utility (float --> normalized unsigned byte) */
-#define F2UB(x) (uchar)(255.0f * x)
-
 /* - Tool Buffer Drawing -- */
-/* helper functions to set color of buffer point */
-// XXX: Remove these
-static void UNUSED_FUNCTION(gp_set_tpoint_varying_color)(
-const tGPspoint *UNUSED(pt), const float ink[4], uint attrib_id)
-{
-   float alpha = ink[3];
-   CLAMP(alpha, GPENCIL_STRENGTH_MIN, 1.0f);
-   immAttrib4ub(attrib_id, F2UB(ink[0]), F2UB(ink[1]), F2UB(ink[2]), 
F2UB(alpha));
-}
-
-static void UNUSED_FUNCTION(gp_set_point_uniform_color)(
-const bGPDspoint *UNUSED(pt), const float ink[4])
-{
-   float alpha = ink[3];
-   CLAMP(alpha, GPENCIL_STRENGTH_MIN, 1.0f);
-   immUniformColor3fvAlpha(ink, alpha);
-}
-
-static void gp_set_point_varying_color(const bGPDspoint *UNUSED(pt), const 
float ink[4], uint attrib_id)
-{
-   float alpha = ink[3];
-   CLAMP(alpha, GPENCIL_STRENGTH_MIN, 1.0f);
-   immAttrib4ub(attrib_id, F2UB(ink[0]), F2UB(ink[1]), F2UB(ink[2]), 
F2UB(alpha));
-}
-
-
 
 /* draw stroke defined in buffer (simple ogl lines/points for now, as dotted 
lines) */
 static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, 
short thickness,
@@ -142,16 +113,15 @@ static void gp_draw_stroke_buffer(const tGPspoint 
*points, int totpoints, short
 
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, 
GPU_FETCH_INT_TO_FLOAT);
-   uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, 
GPU_FETCH_INT_TO_FLOAT_UNIT); // XXX: Just set once
 
const tGPspoint *pt = points;
 
if (totpoints == 1) {
/* if drawing a single point, draw it larger */
GPU_point_size((float)(thickness + 2) * points->pressure);
-   
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
+   
immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);
+   immUniformColor3fvAlpha(ink, ink[3]);
immBegin(GPU_PRIM_POINTS, 1);
-   immAttrib4ub(color, F2UB(ink[0]), F2UB(ink[1]), F2UB(ink[2]), 
F2UB(ink[3]));
immVertex2iv(pos, >x);
}
else {
@@ -159,10 +129,12 @@ static void gp_draw_stroke_buffer(const tGPspoint 
*points, int totpoints, short
 
/* draw stroke curve */
GPU_line_width(max_ff(oldpressure * thickness, 1.0));
-   immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
-   immBeginAtMost(GPU_PRIM_LINE_STRIP, totpoints);
+
+   immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+   immUniformColor3fvAlpha(ink, ink[3]);
 
/* TODO: implement this with a geometry shader to draw one 
continuous tapered stroke */
+   immBeginAtMost(GPU_PRIM_LINE_STRIP, totpoints);
 
for (int i = 0; i < totpoints; i++, pt++) {
/* if there was a significant pressure change, stop the 
curve, change the thickness of the stroke,
@@ -171,7 +143,6 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
if (fabsf(pt->pressure - oldpressure) > 0.2f) {
/* need to have 2 points to avoid immEnd assert 
error */
if (draw_points < 2) {
-   immAttrib4ub(color, F2UB(ink[0]), 
F2UB(ink[1]), F2UB(ink[2]), F2UB(ink[3]));
immVertex2iv(pos, &(pt - 1)->x);
}
 
@@ -183,7 +154,6 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
 
/* need to roll-back one point to ensure that 
there are no gaps in the stroke */
if (i != 0) {
-   immAttrib4ub(color, F2UB(ink[0]), 
F2UB(ink[1]), F2UB(ink[2]), F2UB(ink[3]));
immVertex2iv(pos, &(pt - 1)->

[Bf-blender-cvs] [1b477901118] greasepencil-object: Cleanup: Whitespace

2018-07-23 Thread Joshua Leung
Commit: 1b47790111844fcd3204f55ad05a6829bf241a89
Author: Joshua Leung
Date:   Fri Jul 20 15:13:34 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB1b47790111844fcd3204f55ad05a6829bf241a89

Cleanup: Whitespace

===

M   source/blender/gpu/intern/gpu_shader.c
M   source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl

===

diff --git a/source/blender/gpu/intern/gpu_shader.c 
b/source/blender/gpu/intern/gpu_shader.c
index 0ecce7fe6f3..23efb83a034 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -873,8 +873,8 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader 
shader)
  
datatoc_gpu_shader_2D_nodelink_frag_glsl },
 
[GPU_SHADER_GPENCIL_STROKE] = { 
datatoc_gpu_shader_gpencil_stroke_vert_glsl,
-   
datatoc_gpu_shader_gpencil_stroke_frag_glsl,
-   
datatoc_gpu_shader_gpencil_stroke_geom_glsl },
+   
datatoc_gpu_shader_gpencil_stroke_frag_glsl,
+   
datatoc_gpu_shader_gpencil_stroke_geom_glsl },
 
[GPU_SHADER_GPENCIL_FILL] = { 
datatoc_gpu_shader_gpencil_fill_vert_glsl,
  
datatoc_gpu_shader_gpencil_fill_frag_glsl },
diff --git a/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl 
b/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl
index 6e0c94f58af..3de1bd838b3 100644
--- a/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl
@@ -74,7 +74,7 @@ void main(void)
vec2 miter_a = normalize(n0 + n1);  // miter at start of current 
segment
vec2 miter_b = normalize(n1 + n2);  // miter at end of current segment
 
-/* determine the length of the miter by projecting it onto normal and then 
inverse it */
+   /* determine the length of the miter by projecting it onto normal and 
then inverse it */
float an1 = dot(miter_a, n1);
float bn1 = dot(miter_b, n2);
if (an1 == 0) an1 = 1;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d94a9f5fbb3] greasepencil-object: RNA: Material filtering for GP Brush Settings

2018-07-16 Thread Joshua Leung
Commit: d94a9f5fbb353d62784bdc50b1d53c8fc3845b7f
Author: Joshua Leung
Date:   Mon Jul 16 18:28:13 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBd94a9f5fbb353d62784bdc50b1d53c8fc3845b7f

RNA: Material filtering for GP Brush Settings

===

M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/source/blender/makesrna/intern/rna_brush.c 
b/source/blender/makesrna/intern/rna_brush.c
index 8401843d19a..944393872a5 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -683,7 +683,7 @@ static const EnumPropertyItem 
*rna_Brush_stroke_itemf(bContext *C, PointerRNA *U
}
 }
 
-/* Grease pencil Drawing Brushes Settings*/
+/* Grease Pencil Drawing Brushes Settings */
 static void rna_brush_gpencil_default_eraser(Main *bmain, Scene *scene, 
PointerRNA *UNUSED(ptr))
 {
ToolSettings *ts = scene->toolsettings;
@@ -724,7 +724,14 @@ static void rna_brush_gpencil_eraser_mode(Main 
*UNUSED(bmain), Scene *scene, Poi
break;
}
}
+}
+
+static bool rna_BrushGpencilSettings_material_poll(PointerRNA *UNUSED(ptr), 
PointerRNA value)
+{
+   Material *ma = (Material *)value.data;
 
+   /* GP materials only */
+   return (ma->gp_style != NULL);
 }
 
 #else
@@ -1194,8 +1201,9 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
/* Material */
prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Material");
+   RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, 
"rna_BrushGpencilSettings_material_poll");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
-   RNA_def_property_ui_text(prop, "Material", "Material used when enable 
this brush");
+   RNA_def_property_ui_text(prop, "Material", "Material used for strokes 
drawn using this brush");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4faa243dd6e] greasepencil-object: Cleanup: Make RNA callback names more consistent with the general naming scheme used

2018-07-16 Thread Joshua Leung
Commit: 4faa243dd6e09eda04a646f97ed4c91e9140f58b
Author: Joshua Leung
Date:   Mon Jul 16 18:33:31 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB4faa243dd6e09eda04a646f97ed4c91e9140f58b

Cleanup: Make RNA callback names more consistent with the general naming scheme 
used

===

M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/source/blender/makesrna/intern/rna_brush.c 
b/source/blender/makesrna/intern/rna_brush.c
index 944393872a5..0359de007cb 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -684,7 +684,7 @@ static const EnumPropertyItem 
*rna_Brush_stroke_itemf(bContext *C, PointerRNA *U
 }
 
 /* Grease Pencil Drawing Brushes Settings */
-static void rna_brush_gpencil_default_eraser(Main *bmain, Scene *scene, 
PointerRNA *UNUSED(ptr))
+static void rna_BrushGpencilSettings_default_eraser_update(Main *bmain, Scene 
*scene, PointerRNA *UNUSED(ptr))
 {
ToolSettings *ts = scene->toolsettings;
Paint *paint = >gp_paint->paint;
@@ -701,7 +701,7 @@ static void rna_brush_gpencil_default_eraser(Main *bmain, 
Scene *scene, PointerR
}
 }
 
-static void rna_brush_gpencil_eraser_mode(Main *UNUSED(bmain), Scene *scene, 
PointerRNA *UNUSED(ptr))
+static void rna_BrushGpencilSettings_eraser_mode_update(Main *UNUSED(bmain), 
Scene *scene, PointerRNA *UNUSED(ptr))
 {
ToolSettings *ts = scene->toolsettings;
Paint *paint = >gp_paint->paint;
@@ -1190,7 +1190,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_enum_items(prop, 
rna_enum_gpencil_brush_eraser_modes_items);
RNA_def_property_ui_text(prop, "Mode", "Eraser Mode");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
-   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_brush_gpencil_eraser_mode");
+   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_BrushGpencilSettings_eraser_mode_update");
 
prop = RNA_def_property(srna, "gpencil_fill_draw_mode", PROP_ENUM, 
PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "fill_draw_mode");
@@ -1225,7 +1225,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
RNA_def_property_ui_text(prop, "Default Eraser", "Use this brush when 
enable eraser with fast switch key");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
-   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_brush_gpencil_default_eraser");
+   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_BrushGpencilSettings_default_eraser_update");
 
prop = RNA_def_property(srna, "enable_settings", PROP_BOOLEAN, 
PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_BRUSH_GROUP_SETTINGS);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [39886fbb923] greasepencil-object: RNA: Filter "normal" materials vs "GP Object" ones

2018-07-15 Thread Joshua Leung
Commit: 39886fbb92344b6eca844189abad12de0f9dc411
Author: Joshua Leung
Date:   Mon Jul 16 17:57:57 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB39886fbb92344b6eca844189abad12de0f9dc411

RNA: Filter "normal" materials vs "GP Object" ones

===

M   source/blender/makesrna/intern/rna_object.c

===

diff --git a/source/blender/makesrna/intern/rna_object.c 
b/source/blender/makesrna/intern/rna_object.c
index 4e956e5b4fa..f87b171e039 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -966,6 +966,21 @@ static void rna_MaterialSlot_material_set(PointerRNA *ptr, 
PointerRNA value)
assign_material(G_MAIN, ob, value.data, index + 1, 
BKE_MAT_ASSIGN_EXISTING);
 }
 
+static bool rna_MaterialSlot_material_poll(PointerRNA *ptr, PointerRNA value)
+{
+   Object *ob = (Object *)ptr->id.data;
+   Material *ma = (Material *)value.data;
+
+   if (ob->type == OB_GPENCIL) {
+   /* GP Materials only */
+   return (ma->gp_style != NULL);
+   }
+   else {
+   /* Everything except GP materials */
+   return (ma->gp_style == NULL);
+   }
+}
+
 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
 {
Object *ob = (Object *)ptr->id.data;
@@ -1684,7 +1699,7 @@ static void rna_def_material_slot(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_editable_func(prop, 
"rna_MaterialSlot_material_editable");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-   RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", 
"rna_MaterialSlot_material_set", NULL, NULL);
+   RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", 
"rna_MaterialSlot_material_set", NULL, "rna_MaterialSlot_material_poll");
RNA_def_property_ui_text(prop, "Material", "Material data-block used by 
this material slot");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, 
"rna_MaterialSlot_update");
 
@@ -2182,7 +2197,8 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "active_material", PROP_POINTER, 
PROP_NONE);
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get",
-  "rna_Object_active_material_set", NULL, 
NULL);
+  "rna_Object_active_material_set", NULL,
+  "rna_MaterialSlot_material_poll");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_editable_func(prop, 
"rna_Object_active_material_editable");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3a82de14d1b] greasepencil-object: RNA: Add pointer poll callbacks so that Annotation datablocks don't get used for GP Objects and vice versa

2018-07-15 Thread Joshua Leung
Commit: 3a82de14d1b7a7df43e072f6a70a4eb20169dec1
Author: Joshua Leung
Date:   Mon Jul 16 17:05:31 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB3a82de14d1b7a7df43e072f6a70a4eb20169dec1

RNA: Add pointer poll callbacks so that Annotation datablocks don't get used 
for GP Objects and vice versa

===

M   source/blender/makesrna/intern/rna_gpencil.c
M   source/blender/makesrna/intern/rna_internal.h
M   source/blender/makesrna/intern/rna_movieclip.c
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/makesrna/intern/rna_object.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/makesrna/intern/rna_space.c
M   source/blender/makesrna/intern/rna_tracking.c

===

diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index f4df82ae2c8..7b23ec1b622 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -129,6 +129,22 @@ static void 
UNUSED_FUNCTION(rna_GPencil_onion_skinning_update)(Main *bmain, Scen
rna_GPencil_update(bmain, scene, ptr);
 }
 
+
+/* Poll Callback to filter GP Datablocks to only show those for Annotations */
+bool rna_GPencil_datablocks_annotations_poll(PointerRNA *UNUSED(ptr), const 
PointerRNA value)
+{
+   bGPdata *gpd = value.data;
+   return (gpd->flag & GP_DATA_ANNOTATIONS) != 0;
+}
+
+/* Poll Callback to filter GP Datablocks to only show those for GP Objects */
+bool rna_GPencil_datablocks_obdata_poll(PointerRNA *UNUSED(ptr), const 
PointerRNA value)
+{
+   bGPdata *gpd = value.data;
+   return (gpd->flag & GP_DATA_ANNOTATIONS) == 0;
+}
+
+
 static char *rna_GPencilLayer_path(PointerRNA *ptr)
 {
bGPDlayer *gpl = (bGPDlayer *)ptr->data;
diff --git a/source/blender/makesrna/intern/rna_internal.h 
b/source/blender/makesrna/intern/rna_internal.h
index 626c336a84c..a88623e5b5b 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -294,6 +294,10 @@ bool rna_Mesh_object_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);
 
+/* Grease Pencil datablock polling functions - for filtering GP Object vs 
Annotation datablocks */
+bool rna_GPencil_datablocks_annotations_poll(struct PointerRNA *ptr, const 
struct PointerRNA value);
+bool rna_GPencil_datablocks_obdata_poll(struct PointerRNA *ptr, const struct 
PointerRNA value);
+
 char *rna_TextureSlot_path(struct PointerRNA *ptr);
 char *rna_Node_ImageUser_path(struct PointerRNA *ptr);
 
diff --git a/source/blender/makesrna/intern/rna_movieclip.c 
b/source/blender/makesrna/intern/rna_movieclip.c
index aded4229a3c..81c3c9b43b9 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -338,6 +338,7 @@ static void rna_def_movieclip(BlenderRNA *brna)
prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "gpd");
RNA_def_property_struct_type(prop, "GreasePencil");
+   RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, 
"rna_GPencil_datablocks_annotations_poll");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for 
this movie clip");
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index c0eda3dc053..799d50f01ce 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -8267,6 +8267,7 @@ static void rna_def_nodetree(BlenderRNA *brna)
prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "gpd");
RNA_def_property_struct_type(prop, "GreasePencil");
+   RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, 
"rna_GPencil_datablocks_annotations_poll");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil 
data-block");
RNA_def_property_update(prop, NC_NODE, NULL);
diff --git a/source/blender/makesrna/intern/rna_object.c 
b/source/blender/makesrna/intern/rna_object.c
index 9f2e5db9635..4e956e5b4fa 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -186,6 +186,7 @@ const EnumProp

[Bf-blender-cvs] [f468302660d] greasepencil-object: Fix: All GP Paint brushes were getting added to the same group in the toolbar

2018-07-10 Thread Joshua Leung
Commit: f468302660d220b01e838f0d7b70323bd0ff1d33
Author: Joshua Leung
Date:   Wed Jul 11 17:13:23 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBf468302660d220b01e838f0d7b70323bd0ff1d33

Fix: All GP Paint brushes were getting added to the same group in the toolbar

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 75e5a5737a7..11287e1068e 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -91,10 +91,7 @@ def generate_from_brushes_gpencil(
 tool_defs = tuple(brush_categories.pop(groups[0], ()))
 else:
 tool_defs = tuple(item for g in groups for item in 
brush_categories.pop(g, ()))
-if len(tool_defs) > 1:
-return (tool_defs,)
-else:
-return tool_defs
+return tool_defs
 
 # Each item below is a single toolbar entry:
 # Grouped for multiple or none if no brushes are found.

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7a40a8c0efe] greasepencil-object: Cleanup/Fixes

2018-07-10 Thread Joshua Leung
Commit: 7a40a8c0efed52e8cfe8c898f73b8ef168c1b866
Author: Joshua Leung
Date:   Tue Jul 10 19:52:23 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB7a40a8c0efed52e8cfe8c898f73b8ef168c1b866

Cleanup/Fixes

* Remove hack that's no longer needed

* Don't change the GP Eraser Size userpref property from GP Object
  drawing operator, as it doesn't use that anymore. Instead, the
  eraser brush's size gets adjusted instead.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index d12b3f5a732..7d4ae1fbfd6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1728,11 +1728,6 @@ static bool gp_session_initdata(bContext *C, wmOperator 
*op, tGPsdata *p)
 */
gp_init_colors(p);
}
-   else {
-   #if 1 /* XXX: Temporary hack only - Materials won't be used 
here in future... */
-   gp_init_colors(p);
-   #endif
-   }
 
/* lock axis */
p->lock_axis = ts->gp_sculpt.lock_axis;
@@ -2123,7 +2118,9 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
 * NOTE: Do this even when not in eraser mode, as eraser may
 *   have been toggled at some point.
 */
-   U.gp_eraser = p->radius;
+   if (p->eraser) {
+   p->eraser->size = p->radius;
+   }
 
/* cleanup */
gp_paint_cleanup(p);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0e967bfb765] greasepencil-object: Toolbar: Move Ruler into same group with Annotations (but as separate buttons)

2018-07-10 Thread Joshua Leung
Commit: 0e967bfb76519f35681fed150f38251405bf4aea
Author: Joshua Leung
Date:   Tue Jul 10 19:13:10 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB0e967bfb76519f35681fed150f38251405bf4aea

Toolbar: Move Ruler into same group with Annotations (but as separate buttons)

This way, the items group up nicer when you have the 2 column
icon groupings.

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index b760fbe0187..ab733a12952 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1037,8 +1037,6 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, 
Panel):
 _defs_transform.scale,
 _defs_transform.scale_cage,
 ),
-None,
-_defs_view3d_generic.ruler,
 )
 
 _tools_select = (
@@ -1056,6 +1054,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, 
Panel):
 _defs_annotate.poly,
 _defs_annotate.eraser,
 ),
+_defs_view3d_generic.ruler,
 )
 
 _tools = {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a77c3d5cb31] greasepencil-object: Fix: Pinning GP Object data in Properties Editor wasn't showing the GP Data tab

2018-07-10 Thread Joshua Leung
Commit: a77c3d5cb31feaaea0c796d372134df8400f30ff
Author: Joshua Leung
Date:   Tue Jul 10 17:59:45 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBa77c3d5cb31feaaea0c796d372134df8400f30ff

Fix: Pinning GP Object data in Properties Editor wasn't showing the GP Data tab

===

M   source/blender/editors/space_buttons/buttons_context.c

===

diff --git a/source/blender/editors/space_buttons/buttons_context.c 
b/source/blender/editors/space_buttons/buttons_context.c
index 8d8af62f4c5..67632f6a53a 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -237,6 +237,7 @@ static int buttons_context_path_data(ButsContextPath *path, 
int type)
else if (RNA_struct_is_a(ptr->type, _Light) && (type == -1 || type 
== OB_LAMP)) return 1;
else if (RNA_struct_is_a(ptr->type, _Speaker) && (type == -1 || 
type == OB_SPEAKER)) return 1;
else if (RNA_struct_is_a(ptr->type, _LightProbe) && (type == -1 || 
type == OB_LIGHTPROBE)) return 1;
+   else if (RNA_struct_is_a(ptr->type, _GreasePencil) && (type == -1 
|| type == OB_GPENCIL)) return 1;
/* try to get an object in the path, no pinning supported here */
else if (buttons_context_path_object(path)) {
ob = path->ptr[path->len - 1].data;
@@ -571,13 +572,14 @@ static int buttons_context_path(const bContext *C, 
ButsContextPath *path, int ma
found = buttons_context_path_particle(path);
break;
case BCONTEXT_MATERIAL:
-   /* the colors of grease pencil are not real materials, 
but to keep UI consistency, we
-  simulate and generate a path */
+   /* NOTE: Grease Pencil materials use different 
panels... */
if (ob && ob->type == OB_GPENCIL) {
+   /* XXX: Why path_data? */
found = buttons_context_path_data(path, -1);
-   break;
}
-   found = buttons_context_path_material(path);
+   else {
+   found = buttons_context_path_material(path);
+   }
break;
case BCONTEXT_TEXTURE:
found = buttons_context_path_texture(C, path, 
sbuts->texuser);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fe98aed876d] greasepencil-object: Cleanup: Remove GPENCIL_OT_color_choose

2018-07-09 Thread Joshua Leung
Commit: fe98aed876d47af59eb690e9913636e3ad454d7a
Author: Joshua Leung
Date:   Tue Jul 10 17:25:40 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBfe98aed876d47af59eb690e9913636e3ad454d7a

Cleanup: Remove GPENCIL_OT_color_choose

This isn't used anywhere, and should really even need to be
used for any purpose.

===

M   source/blender/editors/gpencil/gpencil_data.c
M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_ops.c

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 0459e48792e..a20eabe055d 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -2403,38 +2403,3 @@ void GPENCIL_OT_color_select(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
-
-/* * Choose color by index  */
-static int gpencil_color_choose_exec(bContext *C, wmOperator *op)
-{
-   const int index = RNA_int_get(op->ptr, "index");
-
-   Object *ob = CTX_data_active_object(C);
-   if (ob == NULL)
-   return OPERATOR_CANCELLED;
-
-   ob->actcol = index + 1;
-
-   /* notifiers */
-   WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
-
-   return OPERATOR_FINISHED;
-}
-
-void GPENCIL_OT_color_choose(wmOperatorType *ot)
-{
-   /* identifiers */
-   ot->name = "Choose Color";
-   ot->idname = "GPENCIL_OT_color_choose";
-   ot->description = "Active a gpencil_ color";
-
-   /* callbacks */
-   ot->exec = gpencil_color_choose_exec;
-   ot->poll = gpencil_active_color_poll;
-
-   /* flags */
-   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
-   /* properties */
-   RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Index of 
Color", 0, INT_MAX);
-}
diff --git a/source/blender/editors/gpencil/gpencil_intern.h 
b/source/blender/editors/gpencil/gpencil_intern.h
index b58ca3fb339..924c3a6631f 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -416,7 +416,6 @@ void GPENCIL_OT_color_reveal(struct wmOperatorType *ot);
 void GPENCIL_OT_color_lock_all(struct wmOperatorType *ot);
 void GPENCIL_OT_color_unlock_all(struct wmOperatorType *ot);
 void GPENCIL_OT_color_select(struct wmOperatorType *ot);
-void GPENCIL_OT_color_choose(struct wmOperatorType *ot);
 
 /* convert old 2.7 files to 2.8 */
 void GPENCIL_OT_convert_old_files(struct wmOperatorType *ot);
diff --git a/source/blender/editors/gpencil/gpencil_ops.c 
b/source/blender/editors/gpencil/gpencil_ops.c
index fd96b10e779..b61a9d3f0b8 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -765,7 +765,6 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_color_lock_all);
WM_operatortype_append(GPENCIL_OT_color_unlock_all);
WM_operatortype_append(GPENCIL_OT_color_select);
-   WM_operatortype_append(GPENCIL_OT_color_choose);
 
/* Editing (Time) --- */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2c609f6175d] greasepencil-object: Fix: Don't allow Annotation tool to paint on GP Objects and vice versa

2018-07-09 Thread Joshua Leung
Commit: 2c609f6175db6df3b95aa6b1d958f3bd43d193bd
Author: Joshua Leung
Date:   Tue Jul 10 15:44:30 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB2c609f6175db6df3b95aa6b1d958f3bd43d193bd

Fix: Don't allow Annotation tool to paint on GP Objects and vice versa

===

M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index 393f33c2fcb..6958e0fe476 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1152,17 +1152,17 @@ static bool gp_session_initdata(bContext *C, tGPsdata 
*p)
{
p->status = GP_STATUS_ERROR;
if (G.debug & G_DEBUG)
-   printf("Error: Active view not appropriate for 
Grease Pencil drawing\n");
+   printf("Error: Annotations are not supported in 
this editor\n");
return 0;
}
}
 
/* get gp-data */
gpd_ptr = ED_gpencil_data_get_pointers(C, >ownerPtr);
-   if (gpd_ptr == NULL) {
+   if ((gpd_ptr == NULL) || 
!ED_gpencil_data_owner_is_annotation(>ownerPtr)) {
p->status = GP_STATUS_ERROR;
if (G.debug & G_DEBUG)
-   printf("Error: Current context doesn't allow for any 
Grease Pencil data\n");
+   printf("Error: Current context doesn't allow for any 
Annotation data\n");
return 0;
}
else {
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index b9f048856d2..d12b3f5a732 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1695,7 +1695,7 @@ static bool gp_session_initdata(bContext *C, wmOperator 
*op, tGPsdata *p)
 
/* get gp-data */
gpd_ptr = ED_gpencil_data_get_pointers(C, >ownerPtr);
-   if (gpd_ptr == NULL) {
+   if ((gpd_ptr == NULL) || 
ED_gpencil_data_owner_is_annotation(>ownerPtr)) {
p->status = GP_STATUS_ERROR;
if (G.debug & G_DEBUG)
printf("Error: Current context doesn't allow for any 
Grease Pencil data\n");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [76c80cf124c] greasepencil-object: Annotations: Don't display Annotations properties panel when GP data in context is for GP Object

2018-07-09 Thread Joshua Leung
Commit: 76c80cf124cf30067b7860eb4cd6a87e54eb8af6
Author: Joshua Leung
Date:   Tue Jul 10 17:21:59 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB76c80cf124cf30067b7860eb4cd6a87e54eb8af6

Annotations: Don't display Annotations properties panel when GP data in context 
is for GP Object

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 805823d6f6a..b93b1e4c855 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -18,7 +18,7 @@
 
 # 
 
-
+import bpy
 from bpy.types import Menu, UIList
 from bpy.app.translations import pgettext_iface as iface_
 
@@ -734,10 +734,13 @@ class GreasePencilDataPanel:
 @classmethod
 def poll(cls, context):
 # Show this panel as long as someone that might own this exists
+# AND the owner isn't an object (e.g. GP Object)
 if context.gpencil_data_owner is None:
 return False
-
-return True
+elif type(context.gpencil_data_owner) is bpy.types.Object:
+return False
+else:
+return True
 
 @staticmethod
 def draw_header(self, context):
@@ -750,7 +753,6 @@ class GreasePencilDataPanel:
 layout.use_property_decorate = False
 
 # owner of Grease Pencil data
-# XXX: Review this for the 3D view when there's a GP object active
 gpd_owner = context.gpencil_data_owner
 gpd = context.gpencil_data

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e7dc57438a3] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object

2018-07-09 Thread Joshua Leung
Commit: e7dc57438a3e30af4b07d256f4fb875a8c384ecf
Author: Joshua Leung
Date:   Tue Jul 10 14:49:22 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBe7dc57438a3e30af4b07d256f4fb875a8c384ecf

Merge branch 'blender2.8' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d884d41d172] greasepencil-object: Annotations: Change "New Layer" label to "New Note"

2018-07-09 Thread Joshua Leung
Commit: d884d41d172c97dc41134dfd11eb5e48d29595c0
Author: Joshua Leung
Date:   Mon Jul 9 23:15:51 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBd884d41d172c97dc41134dfd11eb5e48d29595c0

Annotations: Change "New Layer" label to "New Note"

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index d4ec27ae1df..805823d6f6a 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -762,7 +762,7 @@ class GreasePencilDataPanel:
 
 # Grease Pencil data...
 if (gpd is None) or (not gpd.layers):
-layout.operator("gpencil.layer_add", text="New Layer")
+layout.operator("gpencil.layer_add", text="New Note")
 else:
 self.draw_layers(context, layout, gpd)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c56e3bcb6f3] greasepencil-object: Fix: "New Note" didn't tag newly-created GP datablock for annotations when creating a new datablock

2018-07-09 Thread Joshua Leung
Commit: c56e3bcb6f366bcef679807dc94afc6a0d8b7389
Author: Joshua Leung
Date:   Mon Jul 9 23:47:29 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBc56e3bcb6f366bcef679807dc94afc6a0d8b7389

Fix: "New Note" didn't tag newly-created GP datablock for annotations when 
creating a new datablock

===

M   source/blender/editors/gpencil/gpencil_data.c

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 11f2f5e3458..029e2eeaabd 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -216,6 +216,9 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
if (is_annotation) {
/* Annotations */
*gpd_ptr = BKE_gpencil_data_addnew(bmain, 
DATA_("Notes"));
+
+   /* mark as annotation */
+   (*gpd_ptr)->flag |= GP_DATA_ANNOTATIONS;
}
else {
/* GP Object */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [117d304a90a] greasepencil-object: Tweaks to GPENCIL_OT_new operator

2018-07-09 Thread Joshua Leung
Commit: 117d304a90aca119faaa7b5db9f8d4bfc8391093
Author: Joshua Leung
Date:   Tue Jul 10 00:20:19 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB117d304a90aca119faaa7b5db9f8d4bfc8391093

Tweaks to GPENCIL_OT_new operator

* Correctly tag Annotation datablocks as such when adding them
* Add new layer by default. It saves users from having to manually
  add one after adding the datablock anyway.

===

M   source/blender/editors/gpencil/gpencil_data.c

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 029e2eeaabd..0459e48792e 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -103,7 +103,9 @@
 /* add new datablock - wrapper around API */
 static int gp_data_add_exec(bContext *C, wmOperator *op)
 {
-   bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
+   PointerRNA gpd_owner = {{NULL}};
+   bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, _owner);
+   bool is_annotation = ED_gpencil_data_owner_is_annotation(_owner);
 
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil 
data to go");
@@ -113,13 +115,35 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
/* decrement user count and add new datablock */
/* TODO: if a datablock exists, we should make a copy of it 
instead of starting fresh (as in other areas) */
Main *bmain = CTX_data_main(C);
-   bGPdata *gpd = (*gpd_ptr);
+   bGPdata *gpd;
+
+   /* decrement user count of old GP datablock */
+   if (*gpd_ptr) {
+   gpd = (*gpd_ptr);
+   id_us_min(>id);
+   }
+
+   /* add new datablock, with a single layer ready to use (so 
users don't have to perform an extra step) */
+   if (is_annotation) {
+   bGPdata *gpd = BKE_gpencil_data_addnew(bmain, 
DATA_("Notes"));
+   *gpd_ptr = gpd;
+
+   /* tag for annotations */
+   gpd->flag |= GP_DATA_ANNOTATIONS;
 
-   id_us_min((ID *)gpd);
-   *gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
+   /* add new layer (i.e. a "note") */
+   BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("Note"), true);
+   }
+   else {
+   /* GP Object Case - This shouldn't happen! */
+   *gpd_ptr = BKE_gpencil_data_addnew(bmain, 
DATA_("GPencil"));
 
-   /* add default sets of colors and brushes */
-   ED_gpencil_add_defaults(C);
+   /* add default sets of colors and brushes */
+   ED_gpencil_add_defaults(C);
+
+   /* add new layer */
+   BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), 
true);
+   }
}
 
/* notifiers */
@@ -200,16 +224,13 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
 {
PointerRNA gpd_owner = {{NULL}};
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, _owner);
-   bool is_annotation = false;
+   bool is_annotation = ED_gpencil_data_owner_is_annotation(_owner);
 
/* if there's no existing Grease-Pencil data there, add some */
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil 
data to go");
return OPERATOR_CANCELLED;
}
-   else {
-   is_annotation = ED_gpencil_data_owner_is_annotation(_owner);
-   }
 
if (*gpd_ptr == NULL) {
Main *bmain = CTX_data_main(C);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [60d2ff134ec] greasepencil-object: Cleanup: Use GPU_* calls instead of gl* in annotate_draw.c

2018-07-09 Thread Joshua Leung
Commit: 60d2ff134ecfb374e4760e0c923b84284f5d1165
Author: Joshua Leung
Date:   Mon Jul 9 23:28:02 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB60d2ff134ecfb374e4760e0c923b84284f5d1165

Cleanup: Use GPU_* calls instead of gl* in annotate_draw.c

===

M   source/blender/editors/gpencil/annotate_draw.c

===

diff --git a/source/blender/editors/gpencil/annotate_draw.c 
b/source/blender/editors/gpencil/annotate_draw.c
index 4248ceccd61..c128ae364f7 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -64,6 +64,7 @@
 
 #include "GPU_immediate.h"
 #include "GPU_draw.h"
+#include "GPU_state.h"
 
 #include "ED_gpencil.h"
 #include "ED_screen.h"
@@ -145,7 +146,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
 
if (totpoints == 1) {
/* if drawing a single point, draw it larger */
-   glPointSize((float)(thickness + 2) * points->pressure);
+   GPU_point_size((float)(thickness + 2) * points->pressure);

immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
immBegin(GWN_PRIM_POINTS, 1);
immAttrib4ub(color, F2UB(ink[0]), F2UB(ink[1]), F2UB(ink[2]), 
F2UB(ink[3]));
@@ -155,7 +156,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
float oldpressure = points[0].pressure;
 
/* draw stroke curve */
-   glLineWidth(max_ff(oldpressure * thickness, 1.0));
+   GPU_line_width(max_ff(oldpressure * thickness, 1.0));
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints);
 
@@ -175,7 +176,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
immEnd();
draw_points = 0;
 
-   glLineWidth(max_ff(pt->pressure * thickness, 
1.0f));
+   GPU_line_width(max_ff(pt->pressure * thickness, 
1.0f));
immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - 
i + 1);
 
/* need to roll-back one point to ensure that 
there are no gaps in the stroke */
@@ -293,7 +294,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int 
totpoints, short thi
/* TODO: implement this with a geometry shader to draw one continuous 
tapered stroke */
 
/* draw stroke curve */
-   glLineWidth(max_ff(curpressure * thickness, 1.0f));
+   GPU_line_width(max_ff(curpressure * thickness, 1.0f));
immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints + cyclic_add);
const bGPDspoint *pt = points;
for (int i = 0; i < totpoints; i++, pt++) {
@@ -313,7 +314,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int 
totpoints, short thi
draw_points = 0;
 
curpressure = pt->pressure;
-   glLineWidth(max_ff(curpressure * thickness, 1.0f));
+   GPU_line_width(max_ff(curpressure * thickness, 1.0f));
immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1 + 
cyclic_add);
 
/* need to roll-back one point to ensure that there are 
no gaps in the stroke */
@@ -580,7 +581,7 @@ static void gp_draw_strokes(
if (no_xray) {
glGetIntegerv(GL_DEPTH_WRITEMASK, _orig);
glDepthMask(0);
-   glEnable(GL_DEPTH_TEST);
+   GPU_depth_test(true);
 
/* first arg is normally rv3d->dist, but this 
isn't
 * available here and seems to work quite well 
without */
@@ -598,7 +599,7 @@ static void gp_draw_strokes(
 
if (no_xray) {
glDepthMask(mask_orig);
-   glDisable(GL_DEPTH_TEST);
+   GPU_depth_test(false);
 
bglPolygonOffset(0.0, 0.0);
}
@@ -636,7 +637,7 @@ static void gp_draw_strokes_edit(
if (no_xray) {
glGetIntegerv(GL_DEPTH_WRITEMASK, _orig);
glDepthMask(0);
-   glEnable(GL_DEPTH_TEST);
+   GPU_depth_test(true);
 
/* first arg is normally rv3d->dist, but this isn't
 * available here and seems to work quite well without 
*/
@@ -741,7 +742,7 @@ static void gp_draw_strokes_e

[Bf-blender-cvs] [995a573d30c] greasepencil-object: User Prefs: Make it clearer which properties affect Annotations only vs GP + Annotations

2018-07-09 Thread Joshua Leung
Commit: 995a573d30cbeff1b50854ced86c0bab1ca44ce1
Author: Joshua Leung
Date:   Mon Jul 9 19:45:21 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB995a573d30cbeff1b50854ced86c0bab1ca44ce1

User Prefs: Make it clearer which properties affect Annotations only vs GP + 
Annotations

===

M   release/scripts/startup/bl_ui/space_userpref.py

===

diff --git a/release/scripts/startup/bl_ui/space_userpref.py 
b/release/scripts/startup/bl_ui/space_userpref.py
index ca240d5a666..6debcb0fa92 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -382,14 +382,16 @@ class USERPREF_PT_edit(Panel):
 row.separator()
 
 col = row.column()
-col.label(text="Grease Pencil:")
+col.label(text="Annotations:")
+sub = col.row()
+sub.prop(edit, "grease_pencil_default_color", text="Default Color")
 col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
 col.separator()
+col.label(text="Grease Pencil/Annotations:")
+col.separator()
 col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan 
Distance")
 col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean 
Distance")
 col.separator()
-col.prop(edit, "grease_pencil_default_color", text="Default Color")
-col.separator()
 col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify 
Stroke")
 col.separator()
 col.separator()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9cfd0c17205] greasepencil-object: Annotations: Change default color for new annotation layers

2018-07-09 Thread Joshua Leung
Commit: 9cfd0c1720594a5ecf815acdb20a0b18cdb847a3
Author: Joshua Leung
Date:   Mon Jul 9 19:42:37 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB9cfd0c1720594a5ecf815acdb20a0b18cdb847a3

Annotations: Change default color for new annotation layers

Although we've had a default color for new Grease Pencil layers for
years, hardly anyone ever changed the default color from the old
default of black. This commit changes this default to match the
color used in the annotation pencil icons, giving it a stronger
connection to the tool, and giving users a better default color
that will make the new strokes actually visible with the default
theme.

===

M   source/blender/editors/interface/resources.c

===

diff --git a/source/blender/editors/interface/resources.c 
b/source/blender/editors/interface/resources.c
index 3a67b8ff0ba..56c243b3407 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1544,15 +1544,6 @@ void init_userdef_do_versions(Main *bmain)
 #undef USER_VERSION_ATLEAST
 #define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST((&(U)), ver, 
subver)
 
-
-   if (!USER_VERSION_ATLEAST(269, 9)) {
-   /* grease pencil - new layer color */
-   if (U.gpencil_new_layer_col[3] < 0.1f) {
-   /* defaults to black, but must at least be visible! */
-   U.gpencil_new_layer_col[3] = 0.9f;
-   }
-   }
-
if (!USER_VERSION_ATLEAST(271, 5)) {
U.pie_menu_radius = 100;
U.pie_menu_threshold = 12;
@@ -1590,6 +1581,17 @@ void init_userdef_do_versions(Main *bmain)
for (bTheme *btheme = U.themes.first; btheme; btheme = 
btheme->next) {
memcpy(btheme, _theme_default, sizeof(*btheme));
}
+   
+   /* Annotations - new layer color
+* Replace anything that used to be set if it looks like was 
left
+* on the old default (i.e. black), which most users used
+*/
+   if ((U.gpencil_new_layer_col[3] < 0.1f) || 
(U.gpencil_new_layer_col[0] < 0.1f)) {
+   /* - New color matches the annotation pencil icon
+* - Non-full alpha looks better!
+*/
+   ARRAY_SET_ITEMS(U.gpencil_new_layer_col, 0.38f, 0.61f, 
0.78f, 0.9f);
+   }
}
 
/**

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4a09bb1e8a0] greasepencil-object: Annotations: WIP access to tool settings in topbar

2018-07-09 Thread Joshua Leung
Commit: 4a09bb1e8a022e5d433c650fa9316a82cd17dc7f
Author: Joshua Leung
Date:   Mon Jul 9 19:26:22 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB4a09bb1e8a022e5d433c650fa9316a82cd17dc7f

Annotations: WIP access to tool settings in topbar

Lots of stuff to fix still - Not final UI at all
(in terms of widgets + properties exposed)

What works now:
* Exposed access to the setting controlling the default color to use
  when adding new layers
* Exposed access to change which color (layer) and thickness new strokes
  get drawn with (as per the current implementation). Now all annotation
  tools have tool settings exposed.

Big Todo's:
* Find a way to display color previews of GP Layers as icons
  (e.g. how to register all the necessary icon_id's, etc.)
* Replace the prop_search() with an enum prop
* Separate annotation RNA type defines? Context issues? etc.

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index b9d030e0de4..b760fbe0187 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -128,12 +128,25 @@ class _defs_view3d_generic:
 class _defs_annotate:
 @classmethod
 def draw_settings_common(cls, context, layout, tool):
-pass
+user_prefs = context.user_preferences
+#tool_settings = context.tool_settings
+
+# XXX: These context checks are needed for layer-dependent settings,
+# but this breaks for using topbar for 2D editor active tools, etc.
+gpd = context.gpencil_data
+gpl = context.active_gpencil_layer
+
+if gpd and gpl:
+layout.prop_search(gpd.layers, "active", gpd, "layers", text="")
+layout.prop(gpl, "line_change", text="Thickness")  # XXX: Replace 
with proper thickness control
+else:
+layout.prop(user_prefs.edit, "grease_pencil_default_color", 
text="Color")
+layout.label("Thickness: [...]")
 
 @ToolDef.from_fn
 def scribble():
 def draw_settings(context, layout, tool):
-pass
+_defs_annotate.draw_settings_common(context, layout, tool)
 
 return dict(
 text="Annotate",
@@ -149,8 +162,7 @@ class _defs_annotate:
 @ToolDef.from_fn
 def line():
 def draw_settings(context, layout, tool):
-# XXX: Reuse
-pass
+_defs_annotate.draw_settings_common(context, layout, tool)
 
 return dict(
 text="Draw Line",
@@ -166,8 +178,7 @@ class _defs_annotate:
 @ToolDef.from_fn
 def poly():
 def draw_settings(context, layout, tool):
-# XXX: Reuse
-pass
+_defs_annotate.draw_settings_common(context, layout, tool)
 
 return dict(
 text="Draw Polygon",
diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index 29473dd595f..d94c28eaa2f 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -100,7 +100,6 @@ bGPdata **ED_gpencil_data_get_pointers_direct(ID 
*screen_id, ScrArea *sa, Scene
/* XXX: Should we reduce reliance on 
context.gpencil_data for these cases? */
case SPACE_BUTS: /* properties */
case SPACE_INFO: /* header info (needed after 
workspaces merge) */
-   case SPACE_TOPBAR: /* Topbar (needed after topbar 
merge) */
{
if (ob && (ob->type == OB_GPENCIL)) {
/* GP Object */
@@ -114,6 +113,7 @@ bGPdata **ED_gpencil_data_get_pointers_direct(ID 
*screen_id, ScrArea *sa, Scene
break;
}
 
+   case SPACE_TOPBAR: /* Topbar (needed after topbar 
merge) */
case SPACE_VIEW3D: /* 3D-View */
{
if (ob && (ob->type == OB_GPENCIL)) {
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index e2dac94d9ad..f4df82ae2c8 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -288,6 +288,15 @@ static void rna_GPencil_active_layer_set(PointerRNA *ptr, 
PointerRNA value)
 {
bGPdata *gpd = ptr->id.data;
 
+ 

[Bf-blender-cvs] [2d2c03b8e4a] greasepencil-object: Annotation Eraser Tweaks

2018-07-08 Thread Joshua Leung
Commit: 2d2c03b8e4abead515a74c32d6dea55a3491e05f
Author: Joshua Leung
Date:   Mon Jul 9 15:34:22 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB2d2c03b8e4abead515a74c32d6dea55a3491e05f

Annotation Eraser Tweaks

* Remove the "soft" modes from the annotation eraser. Now, erasing
  strokes will immediately remove the stroke points. This works better
  for annotation use cases, as when erasing strokes, you usually just
  want to get rid of the notes quickly.

* Show eraser brush size setting in the topbar/tool settings when the
  eraser tool is active.  (Note: This setting still uses the userpref
  setting, which we should move to the scene toolsettings instead
  so that it doesn't get reset with each session)

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M   source/blender/editors/gpencil/annotate_paint.c

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 90c676feff3..b9d030e0de4 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -160,6 +160,7 @@ class _defs_annotate:
  dict(mode='DRAW_STRAIGHT', wait_for_input=False),
  dict(type='EVT_TWEAK_A', value='ANY')),
 ),
+draw_settings=draw_settings,
 )
 
 @ToolDef.from_fn
@@ -176,13 +177,15 @@ class _defs_annotate:
  dict(mode='DRAW_POLY', wait_for_input=False),
  dict(type='ACTIONMOUSE', value='PRESS')),
 ),
+draw_settings=draw_settings,
 )
 
 @ToolDef.from_fn
 def eraser():
 def draw_settings(context, layout, tool):
-# XXX: Reuse
-pass
+# TODO: Move this setting to toolsettings
+user_prefs = context.user_preferences
+layout.prop(user_prefs.edit, "grease_pencil_eraser_radius", 
text="Radius")
 
 return dict(
 text="Eraser",
@@ -193,6 +196,7 @@ class _defs_annotate:
  dict(mode='ERASER', wait_for_input=False),
  dict(type='ACTIONMOUSE', value='PRESS')),
 ),
+draw_settings=draw_settings,
 )
 
 
diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index dbd55e95f64..ae08ba2efb9 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -860,23 +860,6 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p, 
const bGPDspoint *pt, cons
return false;
 }
 
-/* apply a falloff effect to brush strength, based on distance */
-static float gp_stroke_eraser_calc_influence(tGPsdata *p, const int mval[2], 
const int radius, const int co[2])
-{
-   /* Linear Falloff... */
-   float distance = (float)len_v2v2_int(mval, co);
-   float fac;
-
-   CLAMP(distance, 0.0f, (float)radius);
-   fac = 1.0f - (distance / (float)radius);
-
-   /* Control this further using pen pressure */
-   fac *= p->pressure;
-
-   /* Return influence factor computed here */
-   return fac;
-}
-
 /* eraser tool - evaluation per stroke */
 /* TODO: this could really do with some optimization (KD-Tree/BVH?) */
 static void gp_stroke_eraser_dostroke(tGPsdata *p,
@@ -909,19 +892,9 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
}
}
else {
-   /* Pressure threshold at which stroke should be culled: 
Calculated as pressure value
-* below which we would have invisible strokes
-*/
-   const float cull_thresh = (gps->thickness) ?  1.0f / 
((float)gps->thickness)  : 1.0f;
-
-   /* Amount to decrease the pressure of each point with each 
stroke */
-   // TODO: Fetch from toolsettings, or compute based on thickness 
instead?
-   const float strength = 0.1f;
-
/* Perform culling? */
bool do_cull = false;
 
-
/* Clear Tags
 *
 * Note: It's better this way, as we are sure that
@@ -961,23 +934,11 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
if ((gp_stroke_eraser_is_occluded(p, 
pt1, pc1[0], pc1[1]) == false) ||
(gp_stroke_eraser_is_occluded(p, 
pt2, pc2[0], pc2[1]) == false))
{
-   /* Point is affected: */
-   /* 1) Adjust thickness
-*  - Influence of eraser falls

[Bf-blender-cvs] [3a53b24043e] greasepencil-object: Cleanup: Assorted little tweaks/moving code around

2018-07-08 Thread Joshua Leung
Commit: 3a53b24043eefd4aec50d5d656e880a06cd016f7
Author: Joshua Leung
Date:   Mon Jul 9 15:54:20 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB3a53b24043eefd4aec50d5d656e880a06cd016f7

Cleanup: Assorted little tweaks/moving code around

===

M   source/blender/editors/gpencil/annotate_paint.c

===

diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index ae08ba2efb9..10af555d2e1 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -806,17 +806,6 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
 
 /* --- 'Eraser' for 'Paint' Tool -- */
 
-/* which which point is infront (result should only be used for comparison) */
-static float view3d_point_depth(const RegionView3D *rv3d, const float co[3])
-{
-   if (rv3d->is_persp) {
-   return ED_view3d_calc_zfac(rv3d, co, NULL);
-   }
-   else {
-   return -dot_v3v3(rv3d->viewinv[2], co);
-   }
-}
-
 /* helper to free a stroke
  * NOTE: gps->dvert and gps->triangles should be NULL, but check anyway for 
good measure
  */
@@ -838,7 +827,19 @@ static void gp_free_stroke(bGPdata *gpd, bGPDframe *gpf, 
bGPDstroke *gps)
BLI_freelinkN(>strokes, gps);
 }
 
-/* only erase stroke points that are visible */
+
+/* which which point is infront (result should only be used for comparison) */
+static float view3d_point_depth(const RegionView3D *rv3d, const float co[3])
+{
+   if (rv3d->is_persp) {
+   return ED_view3d_calc_zfac(rv3d, co, NULL);
+   }
+   else {
+   return -dot_v3v3(rv3d->viewinv[2], co);
+   }
+}
+
+/* only erase stroke points that are visible (3d view) */
 static bool gp_stroke_eraser_is_occluded(tGPsdata *p, const bGPDspoint *pt, 
const int x, const int y)
 {
if ((p->sa->spacetype == SPACE_VIEW3D) &&
@@ -935,7 +936,6 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
(gp_stroke_eraser_is_occluded(p, 
pt2, pc2[0], pc2[1]) == false))
{
/* Point is affected */
-   /* XXX: Should we only cull the 
ones inside the brush? */
pt1->flag |= GP_SPOINT_TAG;
pt2->flag |= GP_SPOINT_TAG;
do_cull = true;
@@ -1182,10 +1182,14 @@ static bool gp_session_initdata(bContext *C, tGPsdata 
*p)
else {
/* if no existing GPencil block exists, add one */
if (*gpd_ptr == NULL) {
-   *gpd_ptr = BKE_gpencil_data_addnew(bmain, "Notes");
-   (*gpd_ptr)->flag |= GP_DATA_ANNOTATIONS;
+   bGPdata *gpd = BKE_gpencil_data_addnew(bmain, "Notes");
+   *gpd_ptr = gpd;
+
+   /* mark datablock as being used for annotations */
+   gpd->flag |= GP_DATA_ANNOTATIONS;
+
/* annotations always in front of all objects */
-   (*gpd_ptr)->xray_mode = GP_XRAY_FRONT;
+   gpd->xray_mode = GP_XRAY_FRONT;
}
p->gpd = *gpd_ptr;
}
@@ -1212,7 +1216,7 @@ static tGPsdata *gp_session_initpaint(bContext *C)
tGPsdata *p = NULL;
 
/* create new context data */
-   p = MEM_callocN(sizeof(tGPsdata), "GPencil Drawing Data");
+   p = MEM_callocN(sizeof(tGPsdata), "Annotation Drawing Data");
 
gp_session_initdata(C, p);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6e05dc608c0] greasepencil-object: Annotation Eraser: Only operate on the active layer

2018-07-08 Thread Joshua Leung
Commit: 6e05dc608c004dfa2fbf96b98cf627f01b8f12b5
Author: Joshua Leung
Date:   Mon Jul 9 16:05:29 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB6e05dc608c004dfa2fbf96b98cf627f01b8f12b5

Annotation Eraser: Only operate on the active layer

Since we aren't exposing per-layer locks here (as we want to avoid
having lots of work enabling/disabling locks), the eraser now only
erases strokes on the active layer

===

M   source/blender/editors/gpencil/annotate_paint.c

===

diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index 10af555d2e1..393f33c2fcb 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -864,7 +864,7 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p, const 
bGPDspoint *pt, cons
 /* eraser tool - evaluation per stroke */
 /* TODO: this could really do with some optimization (KD-Tree/BVH?) */
 static void gp_stroke_eraser_dostroke(tGPsdata *p,
-  bGPDlayer *UNUSED(gpl), bGPDframe *gpf, 
bGPDstroke *gps,
+  bGPDframe *gpf, bGPDstroke *gps,
   const int mval[2], const int mvalo[2],
   const int radius, const rcti *rect)
 {
@@ -954,7 +954,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
 /* erase strokes which fall under the eraser strokes */
 static void gp_stroke_doeraser(tGPsdata *p)
 {
-   bGPDlayer *gpl;
+   bGPDframe *gpf = p->gpf;
bGPDstroke *gps, *gpn;
rcti rect;
 
@@ -972,30 +972,16 @@ static void gp_stroke_doeraser(tGPsdata *p)
}
}
 
-   /* loop over all layers too, since while it's easy to restrict editing 
to
-* only a subset of layers, it is harder to perform the same erase 
operation
-* on multiple layers...
+   /* loop over strokes of active layer only (session init already took 
care of ensuring validity),
+* checking segments for intersections to remove
 */
-   for (gpl = p->gpd->layers.first; gpl; gpl = gpl->next) {
-   bGPDframe *gpf = gpl->actframe;
-
-   /* only affect layer if it's editable (and visible) */
-   if (gpencil_layer_is_editable(gpl) == false) {
-   continue;
-   }
-   else if (gpf == NULL) {
-   continue;
-   }
-
-   /* loop over strokes, checking segments for intersections */
-   for (gps = gpf->strokes.first; gps; gps = gpn) {
-   gpn = gps->next;
-   /* Not all strokes in the datablock may be valid in the 
current editor/context
-* (e.g. 2D space strokes in the 3D view, if the same 
datablock is shared)
-*/
-   if (ED_gpencil_stroke_can_use_direct(p->sa, gps)) {
-   gp_stroke_eraser_dostroke(p, gpl, gpf, gps, 
p->mval, p->mvalo, p->radius, );
-   }
+   for (gps = gpf->strokes.first; gps; gps = gpn) {
+   gpn = gps->next;
+   /* Not all strokes in the datablock may be valid in the current 
editor/context
+* (e.g. 2D space strokes in the 3D view, if the same datablock 
is shared)
+*/
+   if (ED_gpencil_stroke_can_use_direct(p->sa, gps)) {
+   gp_stroke_eraser_dostroke(p, gpf, gps, p->mval, 
p->mvalo, p->radius, );
}
}
 }
@@ -1282,36 +1268,21 @@ static void gp_paint_initstroke(tGPsdata *p, 
eGPencil_PaintModes paintmode, Deps
/* get active frame (add a new one if not matching frame) */
if (paintmode == GP_PAINTMODE_ERASER) {
/* Eraser mode:
-* 1) Add new frames to all frames that we might touch,
+* 1) Only allow erasing on the active layer (unlike for 3d-art 
Grease Pencil),
+*since we won't be exposing layer locking in the UI
 * 2) Ensure that p->gpf refers to the frame used for the 
active layer
 *(to avoid problems with other tools which expect it to 
exist)
 */
bool has_layer_to_erase = false;
 
-   for (bGPDlayer *gpl = p->gpd->layers.first; gpl; gpl = 
gpl->next) {
-   /* Skip if layer not editable */
-   if (gpencil_layer_is_editable(gpl) == false)
-   continue;
-
-   /* Add a new frame if needed (and based off the active 
frame,
-* as we need some existing strokes to erase)
-

[Bf-blender-cvs] [7e6beb70ad6] greasepencil-object: Cleanup: Deduplicate stroke freeing code

2018-07-08 Thread Joshua Leung
Commit: 7e6beb70ad66bfcf540f49ed95cb549cc4d66721
Author: Joshua Leung
Date:   Mon Jul 9 14:55:34 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB7e6beb70ad66bfcf540f49ed95cb549cc4d66721

Cleanup: Deduplicate stroke freeing code

===

M   source/blender/editors/gpencil/annotate_paint.c

===

diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index 17d1143aba7..dbd55e95f64 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -817,6 +817,27 @@ static float view3d_point_depth(const RegionView3D *rv3d, 
const float co[3])
}
 }
 
+/* helper to free a stroke
+ * NOTE: gps->dvert and gps->triangles should be NULL, but check anyway for 
good measure
+ */
+static void gp_free_stroke(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps)
+{
+   if (gps->points) {
+   MEM_freeN(gps->points);
+   }
+
+   if (gps->dvert) {
+   BKE_gpencil_free_stroke_weights(gps);
+   MEM_freeN(gps->dvert);
+   }
+
+   if (gps->triangles) {
+   MEM_freeN(gps->triangles);
+   }
+
+   BLI_freelinkN(>strokes, gps);
+}
+
 /* only erase stroke points that are visible */
 static bool gp_stroke_eraser_is_occluded(tGPsdata *p, const bGPDspoint *pt, 
const int x, const int y)
 {
@@ -870,11 +891,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
 
if (gps->totpoints == 0) {
/* just free stroke */
-   if (gps->points)
-   MEM_freeN(gps->points);
-   if (gps->triangles)
-   MEM_freeN(gps->triangles);
-   BLI_freelinkN(>strokes, gps);
+   gp_free_stroke(p->gpd, gpf, gps);
}
else if (gps->totpoints == 1) {
/* only process if it hasn't been masked out... */
@@ -886,11 +903,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
/* only check if point is inside */
if (len_v2v2_int(mval, pc1) <= radius) {
/* free stroke */
-   // XXX: pressure sensitive eraser 
should apply here too?
-   MEM_freeN(gps->points);
-   if (gps->triangles)
-   MEM_freeN(gps->triangles);
-   BLI_freelinkN(>strokes, gps);
+   gp_free_stroke(p->gpd, gpf, gps);
}
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [85d61dfbd69] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object

2018-07-08 Thread Joshua Leung
Commit: 85d61dfbd698c50674a54199368f2a2e9495716d
Author: Joshua Leung
Date:   Mon Jul 9 14:32:40 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB85d61dfbd698c50674a54199368f2a2e9495716d

Merge branch 'blender2.8' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [49af17beb8d] blender2.8: Fix T55796: Motion Paths are not being drawn as overlay

2018-07-06 Thread Joshua Leung
Commit: 49af17beb8d2aca856ff8e23bac99841d1b45f5b
Author: Joshua Leung
Date:   Sat Jul 7 02:52:11 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB49af17beb8d2aca856ff8e23bac99841d1b45f5b

Fix T55796: Motion Paths are not being drawn as overlay

Remove depth testing flags from motion path pass drawing,
so that they always appear to draw in "x-ray" style on top
of everything, making it easier for animators to see what
they're doing.

===

M   source/blender/draw/intern/draw_anim_viz.c

===

diff --git a/source/blender/draw/intern/draw_anim_viz.c 
b/source/blender/draw/intern/draw_anim_viz.c
index 42c36ab3662..d19bd54ff5f 100644
--- a/source/blender/draw/intern/draw_anim_viz.c
+++ b/source/blender/draw/intern/draw_anim_viz.c
@@ -149,12 +149,12 @@ static void MPATH_cache_init(void *vedata)
MPATH_PassList *psl = ((MPATH_Data *)vedata)->psl;
 
{
-   DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH 
| DRW_STATE_DEPTH_LESS;
+   DRWState state = DRW_STATE_WRITE_COLOR;
psl->lines = DRW_pass_create("Motionpath Line Pass", state);
}
 
{
-   DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH 
| DRW_STATE_DEPTH_LESS | DRW_STATE_POINT;
+   DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_POINT;
psl->points = DRW_pass_create("Motionpath Point Pass", state);
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [288bcb2593f] blender2.8: Further tweaks to drawing of non-selected graph editor keyframes

2018-07-05 Thread Joshua Leung
Commit: 288bcb2593f52c47225da9ea8efe13d288d35892
Author: Joshua Leung
Date:   Fri Jul 6 15:38:25 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB288bcb2593f52c47225da9ea8efe13d288d35892

Further tweaks to drawing of non-selected graph editor keyframes

The previous commit only solves the problem when using the default
theme using factory settings. For previously saved themes, there could
still be problems, as the alpha values were still 0.

This commit improves the logic here so that while keyframe points on
unselected F-Curves will still get faded out (to not stick out too much
from the curves they live on), but the effect will not be as pronounced
(i.e. the points will stay visible all the time).

===

M   source/blender/editors/space_graph/graph_draw.c

===

diff --git a/source/blender/editors/space_graph/graph_draw.c 
b/source/blender/editors/space_graph/graph_draw.c
index b08ff8dcfa1..4e9f8cd3733 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -148,21 +148,27 @@ static void 
draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
 /* helper func - set color to draw F-Curve data with */
 static void set_fcurve_vertex_color(FCurve *fcu, bool sel)
 {
-   /* Fade the 'intensity' of the vertices based on the selection of the 
curves too */
-   int alphaOffset = (int)((fcurve_display_alpha(fcu) - 1.0f) * 255);
-
float color[4];
+   float diff;
 
/* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) 
*/
if ((fcu->flag & FCURVE_PROTECTED) == 0) {
/* Curve's points ARE BEING edited */
-   UI_GetThemeColorShadeAlpha4fv(sel ? TH_VERTEX_SELECT : 
TH_VERTEX, 0, alphaOffset, color);
+   UI_GetThemeColor3fv(sel ? TH_VERTEX_SELECT : TH_VERTEX, color);
}
else {
/* Curve's points CANNOT BE edited */
-   UI_GetThemeColorShadeAlpha4fv(sel ? TH_TEXT_HI : TH_TEXT, 0, 
alphaOffset, color);
+   UI_GetThemeColor3fv(sel ? TH_TEXT_HI : TH_TEXT, color);
}
 
+   /* Fade the 'intensity' of the vertices based on the selection of the 
curves too
+* - Only fade by 50% the amount the curves were faded by, so that the 
points
+*   still stand out for easier selection
+*/
+   diff = 1.0f - fcurve_display_alpha(fcu);
+   color[3] = 1.0f - (diff * 0.5f);
+   CLAMP(color[3], 0.2f, 1.0f);
+
immUniformColor4fv(color);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a71c2deac5d] blender2.8: Fix T55777: Non-selected keys in Graph Editor are invisible

2018-07-05 Thread Joshua Leung
Commit: a71c2deac5d1a80d802fb646474da2256d73d79f
Author: Joshua Leung
Date:   Fri Jul 6 15:15:45 2018 +1200
Branches: blender2.8
https://developer.blender.org/rBa71c2deac5d1a80d802fb646474da2256d73d79f

Fix T55777: Non-selected keys in Graph Editor are invisible

Restore theem setting default for Graph Editor's vertex,
with default alpha set to 1.0. The alpha value here needs
to be non-zero, as the alpha values currently get used
when drawing verts.

===

M   release/datafiles/userdef/userdef_default_theme.c

===

diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index 04a34cfd1ae..f7a4bd157e0 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -424,6 +424,7 @@ const bTheme U_theme_default = {
.grid = RGBA(0x1a1a1aff),
.group = RGBA(0x44992eff),
.group_active = RGBA(0x5ccd3eff),
+   .vertex = RGBA(0x00ff),
.vertex_select = RGBA(0xff8500ff),
.cframe = RGBA(0x308837ff),
.lastsel_point = RGBA(0x),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [88a6aab8bbc] blender2.8: Fix T55775: Crash when select keyframe on object channels in Timeline editor

2018-07-05 Thread Joshua Leung
Commit: 88a6aab8bbce423e042419fe26891bf8c5fbf84e
Author: Joshua Leung
Date:   Fri Jul 6 15:01:28 2018 +1200
Branches: blender2.8
https://developer.blender.org/rB88a6aab8bbce423e042419fe26891bf8c5fbf84e

Fix T55775: Crash when select keyframe on object channels in Timeline editor

===

M   source/blender/editors/space_action/action_select.c

===

diff --git a/source/blender/editors/space_action/action_select.c 
b/source/blender/editors/space_action/action_select.c
index b6431596323..c46d0fdb035 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -1369,7 +1369,7 @@ static void mouse_action_keys(bAnimContext *ac, const int 
mval[2], short select_
rctf rectf;
 
/* get dopesheet info */
-   if (ac->datatype == ANIMCONT_DOPESHEET)
+   if (ELEM(ac->datatype, ANIMCONT_DOPESHEET, ANIMCONT_TIMELINE))
ads = ac->data;
 
/* use View2D to determine the index of the channel (i.e a row in the 
list) where keyframe was */
@@ -1490,7 +1490,7 @@ static void mouse_action_keys(bAnimContext *ac, const int 
mval[2], short select_
deselect_action_keys(ac, 0, SELECT_SUBTRACT);
 
/* highlight channel clicked on */
-   if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET)) {
+   if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET, 
ANIMCONT_TIMELINE)) {
/* deselect all other channels first */
ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 
0, ACHANNEL_SETFLAG_CLEAR);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2c19f296ce8] greasepencil-object: Fix: Icons for annotation tools now show in toolbar

2018-07-05 Thread Joshua Leung
Commit: 2c19f296ce8b1cd97a852bf0b9e69c877a868594
Author: Joshua Leung
Date:   Fri Jul 6 03:54:07 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB2c19f296ce8b1cd97a852bf0b9e69c877a868594

Fix: Icons for annotation tools now show in toolbar

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 820a0419a86..90c676feff3 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -136,7 +136,7 @@ class _defs_annotate:
 pass
 
 return dict(
-text="Annotate (Scribble)",
+text="Annotate",
 icon="ops.gpencil.draw",
 keymap=(
 ("gpencil.annotate",
@@ -154,7 +154,7 @@ class _defs_annotate:
 
 return dict(
 text="Draw Line",
-icon="ops.gpencil.drawline",
+icon="ops.gpencil.draw.line",
 keymap=(
 ("gpencil.annotate",
  dict(mode='DRAW_STRAIGHT', wait_for_input=False),
@@ -170,7 +170,7 @@ class _defs_annotate:
 
 return dict(
 text="Draw Polygon",
-icon="ops.gpencil.drawpoly",
+icon="ops.gpencil.draw.poly",
 keymap=(
 ("gpencil.annotate",
  dict(mode='DRAW_POLY', wait_for_input=False),
@@ -186,7 +186,7 @@ class _defs_annotate:
 
 return dict(
 text="Eraser",
-icon="ops.gpencil.draweraser",
+icon="ops.gpencil.draw.eraser",
 #cursor='...',  # XXX: Always show brush circle when enabled
 keymap=(
 ("gpencil.annotate",

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4eefe33f774] greasepencil-object: Icons for Grease Pencil/Annotation tools

2018-07-05 Thread Joshua Leung
Commit: 4eefe33f774928eea4e1e778e8361a10c248c2bb
Author: Joshua Leung
Date:   Fri Jul 6 03:37:00 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB4eefe33f774928eea4e1e778e8361a10c248c2bb

Icons for Grease Pencil/Annotation tools

These were in the icon_geom.blend file in SVN (lib/resources),
but needed to be manually added to the Export group for this to
work.

They are needed for use for use with the annotation tools.

NOTE: There are currently problems running the icon generation
scripts in the gp-object branch due to some file loading pointer
remapping problems there causing segfaults when running the script.
Thus, I generated these icons using the 2.8 branch, then cherry-picked
that commit over to this branch.

===

A   release/datafiles/icons/ops.gpencil.draw.dat
A   release/datafiles/icons/ops.gpencil.draw.eraser.dat
A   release/datafiles/icons/ops.gpencil.draw.line.dat
A   release/datafiles/icons/ops.gpencil.draw.poly.dat
M   source/blender/editors/datafiles/CMakeLists.txt

===

diff --git a/release/datafiles/icons/ops.gpencil.draw.dat 
b/release/datafiles/icons/ops.gpencil.draw.dat
new file mode 100644
index 000..3adc50ab17d
Binary files /dev/null and b/release/datafiles/icons/ops.gpencil.draw.dat differ
diff --git a/release/datafiles/icons/ops.gpencil.draw.eraser.dat 
b/release/datafiles/icons/ops.gpencil.draw.eraser.dat
new file mode 100644
index 000..323d8c23245
Binary files /dev/null and 
b/release/datafiles/icons/ops.gpencil.draw.eraser.dat differ
diff --git a/release/datafiles/icons/ops.gpencil.draw.line.dat 
b/release/datafiles/icons/ops.gpencil.draw.line.dat
new file mode 100644
index 000..238db63807a
Binary files /dev/null and b/release/datafiles/icons/ops.gpencil.draw.line.dat 
differ
diff --git a/release/datafiles/icons/ops.gpencil.draw.poly.dat 
b/release/datafiles/icons/ops.gpencil.draw.poly.dat
new file mode 100644
index 000..8351e48fec1
Binary files /dev/null and b/release/datafiles/icons/ops.gpencil.draw.poly.dat 
differ
diff --git a/source/blender/editors/datafiles/CMakeLists.txt 
b/source/blender/editors/datafiles/CMakeLists.txt
index d02b6d8d413..1946ab24aa4 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -579,6 +579,10 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
ops.generic.select_border
ops.generic.select_circle
ops.generic.select_lasso
+   ops.gpencil.draw
+   ops.gpencil.draw.eraser
+   ops.gpencil.draw.line
+   ops.gpencil.draw.poly
ops.mesh.bevel
ops.mesh.bisect
ops.mesh.dupli_extrude_cursor

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4b64b7e21cf] greasepencil-object: Cleanup: Remove the obsolete "ts->gp_brushes" field

2018-07-05 Thread Joshua Leung
Commit: 4b64b7e21cf51a0de59b44fae7efd11e62d41bec
Author: Joshua Leung
Date:   Wed Jul 4 16:50:41 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB4b64b7e21cf51a0de59b44fae7efd11e62d41bec

Cleanup: Remove the obsolete "ts->gp_brushes" field

This isn't used or accessed from anywhere anymore, so time to remove it

===

M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index c211d8443be..569e04fd0bb 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1283,10 +1283,7 @@ typedef struct ToolSettings {
/* Grease Pencil Interpolation Tool(s) */
struct GP_Interpolate_Settings gp_interpolate;
 
-   /* Grease Pencil Drawing Brushes */
-   ListBase gp_brushes; /* Deprecated*/
-
-   /* Image Paint (8 byttse aligned please!) */
+   /* Image Paint (8 bytes aligned please!) */
struct ImagePaintSettings imapaint;
 
/* Particle Editing */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b643f323545] greasepencil-object: Fixes for incorrect version patching code introduced in b6776304e76a

2018-07-05 Thread Joshua Leung
Commit: b643f3235454beacaf0415b6a0a0af542c572ab1
Author: Joshua Leung
Date:   Fri Jul 6 00:37:33 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBb643f3235454beacaf0415b6a0a0af542c572ab1

Fixes for incorrect version patching code introduced in b6776304e76a

* newlibadr() shouldn't be called from direct_link_* functions
  Besides, the pointers in question get corrected in
  lib_link_material() already

* Added expand_doit() calls for the sima and ima pointers.
  Following what's done for tex->ima, these also get expand_doit() calls,
  since they increase the usercount of images when used.

===

M   source/blender/blenloader/intern/readfile.c

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index c3ef3a1f5fa..d9aa6b0ccbc 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4159,16 +4159,6 @@ static void direct_link_material(FileData *fd, Material 
*ma)
BLI_listbase_clear(>gpumaterial);
 
ma->gp_style = newdataadr(fd, ma->gp_style);
-   /* relink grease pencil settings */
-   if (ma->gp_style != NULL) {
-   MaterialGPencilStyle *gp_style = ma->gp_style;
-   if (gp_style->sima != NULL) {
-   gp_style->sima = newlibadr_us(fd, ma->id.lib, 
gp_style->sima);
-   }
-   if (gp_style->ima != NULL) {
-   gp_style->ima = newlibadr_us(fd, ma->id.lib, 
gp_style->ima);
-   }
-   }
 }
 
 /*  READ PARTICLE SETTINGS * */
@@ -9477,6 +9467,11 @@ static void expand_material(FileData *fd, Main *mainvar, 
Material *ma)
if (ma->nodetree)
expand_nodetree(fd, mainvar, ma->nodetree);
 
+   if (ma->gp_style) {
+   MaterialGPencilStyle *gp_style = ma->gp_style;
+   expand_doit(fd, mainvar, gp_style->sima);
+   expand_doit(fd, mainvar, gp_style->ima);
+   }
 }
 
 static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9d96302f473] greasepencil-object: Fix typo

2018-07-03 Thread Joshua Leung
Commit: 9d96302f47325d5360e6ebafdad1242ea21369e1
Author: Joshua Leung
Date:   Wed Jul 4 03:57:28 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB9d96302f47325d5360e6ebafdad1242ea21369e1

Fix typo

===

M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index f04bf33e3c6..e98456bbc31 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -107,7 +107,7 @@ class VIEW3D_HT_header(Header):
 sub.popover(
 space_type='VIEW_3D',
 region_type='HEADER',
-panel_type="VIEw3D_PT_gpencil_multi_frame",
+panel_type="VIEW3D_PT_gpencil_multi_frame",
 text="Multiframe"
 )
 
@@ -4266,7 +4266,7 @@ class VIEW3D_PT_context_properties(Panel):
 
 
 # Grease Pencil Object - Multiframe falloff tools
-class VIEw3D_PT_gpencil_multi_frame(Panel):
+class VIEW3D_PT_gpencil_multi_frame(Panel):
 bl_space_type = 'VIEW_3D'
 bl_region_type = 'HEADER'
 bl_label = "Multi Frame"
@@ -4421,7 +4421,7 @@ classes = (
 VIEW3D_PT_view3d_properties,
 VIEW3D_PT_view3d_cursor,
 VIEW3D_PT_grease_pencil,
-VIEw3D_PT_gpencil_multi_frame,
+VIEW3D_PT_gpencil_multi_frame,
 VIEW3D_PT_quad_view,
 VIEW3D_PT_view3d_stereo,
 VIEW3D_PT_shading,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [891a944dfd6] greasepencil-object: Fix: Crash when erasing annotation strokes

2018-07-03 Thread Joshua Leung
Commit: 891a944dfd6ec02b42853ed1560930698abbc6c6
Author: Joshua Leung
Date:   Wed Jul 4 03:43:02 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB891a944dfd6ec02b42853ed1560930698abbc6c6

Fix: Crash when erasing annotation strokes

The code was assuming that dvert data always exists on strokes
(it shouldn't, if we're doing everything correctly!), which
caused crashes when erasing annotation strokes (which definitely
don't have this data).

TODO:
Check that the rest of the code doesn't make similar assumptions!

===

M   source/blender/editors/gpencil/gpencil_edit.c

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 6ebfdd087fe..ba4b93d8ad3 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1748,19 +1748,25 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, 
bGPDstroke *gps, bGPDstroke
 
/* Compute new buffer size (+ 1 needed as the endpoint 
index is "inclusive") */
new_stroke->totpoints = island->end_idx - 
island->start_idx + 1;
-   new_stroke->points= MEM_callocN(sizeof(bGPDspoint) 
* new_stroke->totpoints, "gp delete stroke fragment");
-   new_stroke->dvert = MEM_callocN(sizeof(MDeformVert) 
* new_stroke->totpoints, "gp delete stroke fragment weight");
 
-   /* Copy over the relevant points */
+   /* Copy over the relevant point data */
+   new_stroke->points= MEM_callocN(sizeof(bGPDspoint) 
* new_stroke->totpoints, "gp delete stroke fragment");
memcpy(new_stroke->points, gps->points + 
island->start_idx, sizeof(bGPDspoint) * new_stroke->totpoints);
-   memcpy(new_stroke->dvert, gps->dvert + 
island->start_idx, sizeof(MDeformVert) * new_stroke->totpoints);
-   /* Copy weights */
-   int e = island->start_idx;
-   for (int i = 0; i < new_stroke->totpoints; i++) {
-   MDeformVert *dvert_dst = >dvert[e];
-   MDeformVert *dvert_src = _stroke->dvert[i];
-   dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
-   e++;
+   
+   /* Copy over vertex weight data (if available) */
+   if (new_stroke->dvert != NULL) {
+   /* Copy over the relevant vertex-weight points 
*/
+   new_stroke->dvert = 
MEM_callocN(sizeof(MDeformVert) * new_stroke->totpoints, "gp delete stroke 
fragment weight");
+   memcpy(new_stroke->dvert, gps->dvert + 
island->start_idx, sizeof(MDeformVert) * new_stroke->totpoints);
+   
+   /* Copy weights */
+   int e = island->start_idx;
+   for (int i = 0; i < new_stroke->totpoints; i++) 
{
+   MDeformVert *dvert_dst = >dvert[e];
+   MDeformVert *dvert_src = 
_stroke->dvert[i];
+   dvert_dst->dw = 
MEM_dupallocN(dvert_src->dw);
+   e++;
+   }
}
 
/* Each island corresponds to a new stroke. We must 
adjust the

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [179dfd0729b] greasepencil-object: Cleanup: Remove 2D Editor support from gpencil_paint.c

2018-07-03 Thread Joshua Leung
Commit: 179dfd0729b53a55d81533af98eb276632a9d637
Author: Joshua Leung
Date:   Wed Jul 4 02:57:03 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB179dfd0729b53a55d81533af98eb276632a9d637

Cleanup: Remove 2D Editor support from gpencil_paint.c

The "GPENCIL_OT_draw" operator pretty much didn't support non-3D
views already (at least not without crashing). Now that we've got
a separate/dedicated operator for Annotation support (GPENCIL_OT_annotate),
we can remove the old 2D Editor support here.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 758d3268861..b9f048856d2 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -405,24 +405,6 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int 
mval[2], float out[3]
}
}
}
-
-   /* 2d - on 'canvas' (assume that p->v2d is set) */
-   else if ((gpd->runtime.sbuffer_sflag & GP_STROKE_2DSPACE) && (p->v2d)) {
-   UI_view2d_region_to_view(p->v2d, mval[0], mval[1], [0], 
[1]);
-   mul_v3_m4v3(out, p->imat, out);
-   }
-
-   /* 2d - relative to screen (viewport area) */
-   else {
-   if (p->subrect == NULL) { /* normal 3D view */
-   out[0] = (float)(mval[0]) / (float)(p->ar->winx) * 100;
-   out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100;
-   }
-   else { /* camera view, use subrect */
-   out[0] = ((mval[0] - p->subrect->xmin) / 
BLI_rctf_size_x(p->subrect)) * 100;
-   out[1] = ((mval[1] - p->subrect->ymin) / 
BLI_rctf_size_y(p->subrect)) * 100;
-   }
-   }
 }
 
 /* apply jitter to stroke */
@@ -1700,90 +1682,7 @@ static bool gp_session_initdata(bContext *C, wmOperator 
*op, tGPsdata *p)
 
break;
}
-   case SPACE_NODE:
-   {
-   /* SpaceNode *snode = curarea->spacedata.first; */
-
-   /* set current area */
-   p->sa = curarea;
-   p->ar = ar;
-   p->v2d = >v2d;
-   p->align_flag = >gpencil_v2d_align;
-   break;
-   }
-   case SPACE_SEQ:
-   {
-   SpaceSeq *sseq = curarea->spacedata.first;
-
-   /* set current area */
-   p->sa = curarea;
-   p->ar = ar;
-   p->v2d = >v2d;
-   p->align_flag = >gpencil_seq_align;
-
-   /* check that gpencil data is allowed to be drawn */
-   if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
-   p->status = GP_STATUS_ERROR;
-   if (G.debug & G_DEBUG)
-   printf("Error: In active view 
(sequencer), active mode doesn't support Grease Pencil\n");
-   return 0;
-   }
-   break;
-   }
-   case SPACE_IMAGE:
-   {
-   /* SpaceImage *sima = curarea->spacedata.first; */
-
-   /* set the current area */
-   p->sa = curarea;
-   p->ar = ar;
-   p->v2d = >v2d;
-   p->align_flag = >gpencil_ima_align;
-   break;
-   }
-   case SPACE_CLIP:
-   {
-   SpaceClip *sc = curarea->spacedata.first;
-   MovieClip *clip = ED_space_clip_get_clip(sc);
-
-   if (clip == NULL) {
-   p->status = GP_STATUS_ERROR;
-   return false;
-   }
-
-   /* set the current area */
-   p->sa = curarea;
-   p->ar = ar;
-   p->v2d = >v2d;
-   p->align_flag = >gpencil_v2d_align;
-
-   invert_m4_m4(p->imat, sc->unistabmat);
-
-   /* custom color for new layer */
-   p->custom_color[0] = 1.0f;
-   p->custom_color[1] = 0.0f;
-   p->custom_color[2] = 0.5f;
-   p->custom_color[3] = 0.9f;
-
-

[Bf-blender-cvs] [cc7bbda849a] greasepencil-object: Annotations: WIP first steps towards toolbar support

2018-07-03 Thread Joshua Leung
Commit: cc7bbda849a1cedde69a2b6184c4a6efc2385055
Author: Joshua Leung
Date:   Wed Jul 4 03:33:56 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBcc7bbda849a1cedde69a2b6184c4a6efc2385055

Annotations: WIP first steps towards toolbar support

This adds a toolbar entry for activating the annotations tools
as active tools. Many things are WIP still (e.g. tool settings
are yet to come, as the necessary props aren't defined in DNA/RNA yet).

Todo's:
* Icons are missing.  The necessary icons *do* exist right now
  in the icon_geom.blend file, but I can't get them to export/generate
  .dat files that we can use in the UI here.  That said, the placeholder
  names (from that file) are now used.

* Key mappings need work/testing. They seem to work well enough as-is
  already though

* Tool settings (in topbar) are not implemented yet. Coming soon
  (aka tomorrow, after I get some sleep)

* Non-3D view toolbar support

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 110611cf7ab..cc30d1d372c 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -125,6 +125,77 @@ class _defs_view3d_generic:
 )
 
 
+class _defs_annotate:
+@classmethod
+def draw_settings_common(cls, context, layout, tool):
+pass
+
+@ToolDef.from_fn
+def scribble():
+def draw_settings(context, layout, tool):
+pass
+
+return dict(
+text="Annotate (Scribble)",
+icon="ops.gpencil.draw",
+keymap=(
+("gpencil.annotate",
+ dict(mode='DRAW', wait_for_input=False),
+ dict(type='EVT_TWEAK_A', value='ANY')),
+),
+draw_settings=draw_settings,
+)
+
+@ToolDef.from_fn
+def line():
+def draw_settings(context, layout, tool):
+# XXX: Reuse
+pass
+
+return dict(
+text="Draw Line",
+icon="ops.gpencil.drawline",
+keymap=(
+("gpencil.annotate",
+ dict(mode='DRAW_STRAIGHT', wait_for_input=False),
+ dict(type='EVT_TWEAK_A', value='ANY')),
+),
+)
+
+@ToolDef.from_fn
+def poly():
+def draw_settings(context, layout, tool):
+# XXX: Reuse
+pass
+
+return dict(
+text="Draw Polygon",
+icon="ops.gpencil.drawpoly",
+keymap=(
+("gpencil.annotate",
+ dict(mode='DRAW_POLY', wait_for_input=False),
+ dict(type='ACTIONMOUSE', value='PRESS')),
+),
+)
+
+@ToolDef.from_fn
+def eraser():
+def draw_settings(context, layout, tool):
+# XXX: Reuse
+pass
+
+return dict(
+text="Eraser",
+icon="ops.gpencil.draweraser",
+#cursor='...',  # XXX: Always show brush circle when enabled
+keymap=(
+("gpencil.annotate",
+ dict(mode='ERASER', wait_for_input=False),
+ dict(type='ACTIONMOUSE', value='PRESS')),
+),
+)
+
+
 class _defs_transform:
 
 @ToolDef.from_fn
@@ -960,6 +1031,15 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, 
Panel):
 ),
 )
 
+_tools_annotate = (
+(
+_defs_annotate.scribble,
+_defs_annotate.line,
+_defs_annotate.poly,
+_defs_annotate.eraser,
+),
+)
+
 _tools = {
 None: [
 _defs_view3d_generic.cursor,
@@ -969,21 +1049,27 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, 
Panel):
 *_tools_select,
 None,
 *_tools_transform,
+None,
+*_tools_annotate,
 ],
 'POSE': [
 *_tools_select,
 *_tools_transform,
 None,
+*_tools_annotate,
+None,
 (
 _defs_pose.breakdown,
 _defs_pose.push,
 _defs_pose.relax,
-)
+),
 ],
 'EDIT_ARMATURE': [
 *_tools_select,
 None,
 *_tools_transform,
+None,
+*_tools_annotate,
 _defs_edit_armature.roll,
 (
 _defs_edit_armature.bone_size,
@@ -993,13 +1079,15 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, 
Panel):
 (
 _defs_edit_armature.extr

[Bf-blender-cvs] [6cb0327f17a] greasepencil-object: Cleanup: Remove deprecated toolsettings->gpencil_src field

2018-07-03 Thread Joshua Leung
Commit: 6cb0327f17aaccf74d6ea042d485dd53fa12ff61
Author: Joshua Leung
Date:   Wed Jul 4 02:41:21 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB6cb0327f17aaccf74d6ea042d485dd53fa12ff61

Cleanup: Remove deprecated toolsettings->gpencil_src field

This was used to determine whether Grease Pencil data was stored
on the Scene level or per Object. It isn't actually used anywhere
in 2.8 now, with the GP Objects / Annotations. Removing now
to make space for storing the toolsettings for the annotation tools.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_primitive.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/include/ED_gpencil.h
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 9eee6139892..4e4efa449ce 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -231,7 +231,7 @@ Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, 
float matrix[4][4],
 
for (int i = 0; i < totpoints; i++, tpt++) {
ED_gpencil_tpoint_to_point(ar, origin, tpt, );
-   ED_gp_project_point_to_plane(ob, rv3d, origin, 
ts->gp_sculpt.lock_axis - 1, ts->gpencil_src, );
+   ED_gp_project_point_to_plane(ob, rv3d, origin, 
ts->gp_sculpt.lock_axis - 1, );
 
/* first point for adjacency (not drawn) */
if (i == 0) {
@@ -304,7 +304,7 @@ Gwn_Batch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, 
float matrix[4][4], s
 
for (int i = 0; i < totpoints; i++, tpt++) {
ED_gpencil_tpoint_to_point(ar, origin, tpt, );
-   ED_gp_project_point_to_plane(ob, rv3d, origin, 
ts->gp_sculpt.lock_axis - 1, ts->gpencil_src, );
+   ED_gp_project_point_to_plane(ob, rv3d, origin, 
ts->gp_sculpt.lock_axis - 1, );
 
/* set point */
gpencil_set_stroke_point(vbo, matrix, , idx,
diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 03a3904fff3..6ebfdd087fe 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -2760,7 +2760,7 @@ static int gp_strokes_reproject_exec(bContext *C, 
wmOperator *op)

ED_gp_get_drawing_reference(v3d, scene, ob, gpl,
ts->gpencil_v3d_align, 
origin);

ED_gp_project_point_to_plane(ob, rv3d, origin,
-   lock_axis - 1, 
ts->gpencil_src, );
+   lock_axis - 1, );
 
copy_v3_v3(>x, );
 
diff --git a/source/blender/editors/gpencil/gpencil_fill.c 
b/source/blender/editors/gpencil/gpencil_fill.c
index d52ca6368f5..6d23efd994a 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -891,7 +891,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
ED_gp_get_drawing_reference(tgpf->v3d, tgpf->scene, tgpf->ob, 
tgpf->gpl,
ts->gpencil_v3d_align, origin);
ED_gp_project_stroke_to_plane(tgpf->ob, tgpf->rv3d, gps, origin,
-   tgpf->lock_axis - 1, ts->gpencil_src);
+   tgpf->lock_axis - 1);
}
 
/* if parented change position relative to parent object */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 483b96d0c6c..875628ba732 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -360,7 +360,7 @@ static void gp_reproject_toplane(tGPsdata *p, bGPDstroke 
*gps)
 
/* get drawing origin */
gp_get_3d_reference(p, origin);
-   ED_gp_project_stroke_to_plane(obact, rv3d, gps, origin, p->lock_axis - 
1, p->scene->toolsettings->gpencil_src);
+   ED_gp_project_stroke_to_plane(obact, rv3d, gps, origin, p->lock_axis - 
1);
 }
 
 /* convert screen-coordinates to buffer-coordinates */
@@ -715,11 +715,11 @@ static short gp_stroke_addpoint(
gp_get_3d_reference(p, origin);
/* reprojec

[Bf-blender-cvs] [c3f5c1dd20e] greasepencil-object: Cleanup: Remove "Scene->gp_object"

2018-07-03 Thread Joshua Leung
Commit: c3f5c1dd20eb93f9585fdcd73a63245802113a6a
Author: Joshua Leung
Date:   Wed Jul 4 02:48:24 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBc3f5c1dd20eb93f9585fdcd73a63245802113a6a

Cleanup: Remove "Scene->gp_object"

This was from an earlier design for supporting Annotations,
where in the 3D view, we would have only had GP Objects.
Now that we've moved away from that idea, and are back to
having a separate "Annotations" system, this concept can
be removed from the code again.

===

M   release/scripts/startup/bl_ui/properties_scene.py
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/object/object_add.c
M   source/blender/editors/object/object_relations.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_scene.py 
b/release/scripts/startup/bl_ui/properties_scene.py
index d7f7bba7f20..ada0e00471b 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -76,7 +76,6 @@ class SCENE_PT_scene(SceneButtonsPanel, Panel):
 layout.prop(scene, "camera")
 layout.prop(scene, "background_set")
 layout.prop(scene, "active_clip")
-layout.prop(scene, "gpencil_object")
 
 
 class SCENE_PT_unit(SceneButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 64a8c76470e..f68cce0ff35 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -425,10 +425,9 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
/* NOTE: part of SCE_COPY_LINK_DATA and SCE_COPY_FULL operations
 * are done outside of blenkernel with ED_object_single_users! 
*/
 
-   /*  camera and gp_object  */
+   /*  camera   */
if (ELEM(type, SCE_COPY_LINK_DATA, SCE_COPY_FULL)) {
ID_NEW_REMAP(sce_copy->camera);
-   ID_NEW_REMAP(sce_copy->gp_object);
}
 
return sce_copy;
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 6dfb8e28d87..ac6afedea39 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5892,7 +5892,6 @@ static void lib_link_scene(FileData *fd, Main *main)
sce->world = newlibadr_us(fd, sce->id.lib, sce->world);
sce->set = newlibadr(fd, sce->id.lib, sce->set);
sce->gpd = newlibadr_us(fd, sce->id.lib, sce->gpd);
-   sce->gp_object = newlibadr(fd, sce->id.lib, 
sce->gp_object);
 
link_paint(fd, sce, >toolsettings->sculpt->paint);
link_paint(fd, sce, >toolsettings->vpaint->paint);
@@ -9804,8 +9803,6 @@ static void expand_scene(FileData *fd, Main *mainvar, 
Scene *sce)
if (sce->gpd)
expand_doit(fd, mainvar, sce->gpd);
 
-   expand_doit(fd, mainvar, sce->gp_object);
-
if (sce->ed) {
Sequence *seq;
 
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 875628ba732..758d3268861 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1689,37 +1689,11 @@ static bool gp_session_initdata(bContext *C, wmOperator 
*op, tGPsdata *p)
return 0;
}
 
-   /* if active object doesn't exist or it's not a Grease 
Pencil object,
-* use the scene's gp_object (), or create one if it 
doesn't exist
-*/
+   /* if active object doesn't exist or isn't a GP Object, 
create one */
float *cur = ED_view3d_cursor3d_get(p->scene, 
v3d)->location;
if ((!obact) || (obact->type != OB_GPENCIL)) {
-   if (p->scene->gp_object) {
-   /* use existing default */
-   /* XXX: This will still lose whatever 
mode we were in before,
-*  making GP less convenient for 
annotations than it used to be
-*/
-   obact = p->scene->gp_object;
-
-   

[Bf-blender-cvs] [339708d3eb5] greasepencil-object: GP UI: Make the "Grease Pencil Paper" panel/options part of the Overlays popover

2018-07-02 Thread Joshua Leung
Commit: 339708d3eb59c6d3e1912985e723e1f6905d1b3b
Author: Joshua Leung
Date:   Tue Jul 3 17:14:49 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB339708d3eb59c6d3e1912985e723e1f6905d1b3b

GP UI: Make the "Grease Pencil Paper" panel/options part of the Overlays popover

This is a special feature only used during Draw Mode, and functionally
acts like an overlay. Some cleanups/tweaks to this are needed still,
but it's good to get it out of the way.

===

M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index d99ab3ecadd..f04bf33e3c6 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -124,8 +124,6 @@ class VIEW3D_HT_header(Header):
 
 view = context.space_data
 row = layout.row()
-row.prop(view, "use_gpencil_paper", text="", icon='GHOST')
-
 row.prop(gpd, "use_onion_skinning", text="Onion Skins", 
icon='PARTICLE_PATH')
 row.prop(gpd, "show_edit_lines", text="", icon="PARTICLE_POINT")
 
@@ -4120,6 +4118,39 @@ class VIEW3D_PT_overlay_paint(Panel):
 col.prop(overlay, "show_paint_wire")
 
 
+class VIEW3D_PT_overlay_gpencil_paper(Panel):
+bl_space_type = 'VIEW_3D'
+bl_region_type = 'HEADER'
+bl_parent_id = 'VIEW3D_PT_overlay'
+bl_label = ""
+
+@classmethod
+def poll(cls, context):
+return context.mode in {'GPENCIL_PAINT', 'GPENCIL_SCULPT'}
+
+def draw_header(self, context):
+view = context.space_data
+self.layout.prop(view, "use_gpencil_paper", text="Drawing Paper")
+
+def draw(self, context):
+layout = self.layout
+view = context.space_data
+layout.active = view.use_gpencil_paper
+
+row = layout.row()
+row.prop(view, "gp_paper_color", text="Color")
+row = layout.row()
+row.prop(view, "gp_paper_opacity", text="Opacity")
+
+row = layout.row(align=False)
+row.prop(view, "use_gpencil_grid", text="Display Grid")
+
+row = layout.row(align=False)
+col = row.column(align=True)
+col.enabled = view.use_gpencil_grid
+col.prop(view, "gpencil_grid_size", text="")
+
+
 class VIEW3D_PT_quad_view(Panel):
 bl_space_type = 'VIEW_3D'
 bl_region_type = 'UI'
@@ -4155,41 +4186,6 @@ class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, 
Panel):
 # NOTE: this is just a wrapper around the generic GP Panel
 
 
-# TODO: Move to Overlays popover (when in GP Object Draw Mode)
-class VIEW3D_PT_gp_paper(Panel):
-bl_space_type = 'VIEW_3D'
-bl_region_type = 'UI'
-bl_label = "Grease Pencil Paper"
-bl_options = {'DEFAULT_CLOSED'}
-
-@classmethod
-def poll(cls, context):
-view = context.space_data
-return (view and context.active_object and context.gpencil_data)
-
-def draw_header(self, context):
-view = context.space_data
-self.layout.prop(view, "use_gpencil_paper", text="")
-
-def draw(self, context):
-layout = self.layout
-view = context.space_data
-layout.active = view.use_gpencil_paper
-
-row = layout.row()
-row.prop(view, "gp_paper_color", text="Color")
-row = layout.row()
-row.prop(view, "gp_paper_opacity", text="Opacity")
-
-row = layout.row(align=False)
-row.prop(view, "use_gpencil_grid", text="Display Grid")
-
-row = layout.row(align=False)
-col = row.column(align=True)
-col.enabled = view.use_gpencil_grid
-col.prop(view, "gpencil_grid_size", text="")
-
-
 class VIEW3D_PT_view3d_stereo(Panel):
 bl_space_type = 'VIEW_3D'
 bl_region_type = 'UI'
@@ -4425,7 +4421,6 @@ classes = (
 VIEW3D_PT_view3d_properties,
 VIEW3D_PT_view3d_cursor,
 VIEW3D_PT_grease_pencil,
-VIEW3D_PT_gp_paper,
 VIEw3D_PT_gpencil_multi_frame,
 VIEW3D_PT_quad_view,
 VIEW3D_PT_view3d_stereo,
@@ -4440,6 +4435,7 @@ classes = (
 VIEW3D_PT_overlay_pose,
 VIEW3D_PT_overlay_paint,
 VIEW3D_PT_overlay_sculpt,
+VIEW3D_PT_overlay_gpencil_paper,
 VIEW3D_PT_context_properties,
 )

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [df1cf4af94a] greasepencil-object: Cleanup: Variable Naming

2018-07-02 Thread Joshua Leung
Commit: df1cf4af94a7070963de99f5d6ff4aea5c517000
Author: Joshua Leung
Date:   Tue Jul 3 16:22:12 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBdf1cf4af94a7070963de99f5d6ff4aea5c517000

Cleanup: Variable Naming

===

M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index b731d5cf4c3..d99ab3ecadd 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -79,7 +79,8 @@ class VIEW3D_HT_header(Header):
 
 # Grease Pencil
 # GPXX this is a hack while we merge to keep all running
-if context.active_object and context.gpencil_data and 
context.active_object.type == 'GPENCIL':
+# XXX: Should these buttons show up in Object Mode at all?
+if obj and obj.type == 'GPENCIL' and context.gpencil_data:
 gpd = context.gpencil_data
 
 if gpd.is_stroke_paint_mode:
@@ -106,7 +107,7 @@ class VIEW3D_HT_header(Header):
 sub.popover(
 space_type='VIEW_3D',
 region_type='HEADER',
-panel_type="VIEW3D_PT_GreasePencilMultiFrame",
+panel_type="VIEw3D_PT_gpencil_multi_frame",
 text="Multiframe"
 )
 
@@ -4268,9 +4269,8 @@ class VIEW3D_PT_context_properties(Panel):
 rna_prop_ui.draw(self.layout, context, member, object, False)
 
 
-# Grease Pencil multiframe falloff tools
-# FIXME: Name breaks conventions
-class VIEW3D_PT_GreasePencilMultiFrame(Panel):
+# Grease Pencil Object - Multiframe falloff tools
+class VIEw3D_PT_gpencil_multi_frame(Panel):
 bl_space_type = 'VIEW_3D'
 bl_region_type = 'HEADER'
 bl_label = "Multi Frame"
@@ -4426,7 +4426,7 @@ classes = (
 VIEW3D_PT_view3d_cursor,
 VIEW3D_PT_grease_pencil,
 VIEW3D_PT_gp_paper,
-VIEW3D_PT_GreasePencilMultiFrame,
+VIEw3D_PT_gpencil_multi_frame,
 VIEW3D_PT_quad_view,
 VIEW3D_PT_view3d_stereo,
 VIEW3D_PT_shading,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ebbc047dfe2] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object

2018-07-02 Thread Joshua Leung
Commit: ebbc047dfe2ae183e6f575cb4de7222ffb032a68
Author: Joshua Leung
Date:   Tue Jul 3 13:20:38 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBebbc047dfe2ae183e6f575cb4de7222ffb032a68

Merge branch 'blender2.8' into greasepencil-object

# Conflicts:
#   release/scripts/startup/bl_ui/space_view3d.py

===



===

diff --cc release/scripts/startup/bl_ui/space_view3d.py
index feb16ce9566,e5e903f5338..b731d5cf4c3
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@@ -144,12 -117,20 +161,20 @@@ class VIEW3D_HT_header(Header)
  # Mode & Transform Settings
  scene = context.scene
  
- # Orientation & Pivot
+ # Orientation
 -if object_mode in {'OBJECT', 'EDIT', 'POSE'}:
 +if object_mode in {'OBJECT', 'EDIT', 'POSE', 'GPENCIL_EDIT', 
'GPENCIL_SCULPT'}:
- layout.prop(scene, "transform_orientation", text="")
+ orientation = scene.transform_orientation
+ current_orientation = scene.current_orientation
+ 
+ if not current_orientation:
+ trans_orientation = \
+ 
bpy.types.Scene.bl_rna.properties["transform_orientation"].enum_items[orientation]
+ trans_icon = getattr(trans_orientation, "icon", "BLANK1")
+ trans_name = getattr(trans_orientation, "name", "Orientation")
+ else:
+ trans_icon = "VISIBLE_IPO_OFF"
+ trans_name = getattr(current_orientation, "name", 
"Orientation")
  
- pivot_point = tool_settings.transform_pivot_point
- act_pivot_point = 
bpy.types.ToolSettings.bl_rna.properties["transform_pivot_point"].enum_items[pivot_point]
  row = layout.row(align=True)
  row.popover(
  space_type='TOPBAR',
@@@ -234,22 -179,49 +223,51 @@@
  text=""
  )
  
- layout.separator_spacer()
+ # Proportional editing
+ if obj:
 -if context.gpencil_data and 
context.gpencil_data.use_stroke_edit_mode:
 -row = layout.row(align=True)
 -row.prop(tool_settings, "proportional_edit", icon_only=True)
++gpd = context.gpencil_data
++if gpd is not None:
++if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode:
++row = layout.row(align=True)
++row.prop(tool_settings, "proportional_edit", 
icon_only=True)
  
- # Viewport Settings
- row = layout.row(align=True)
- row.prop(shading, "type", text="", expand=True)
 -sub = row.row(align=True)
 -sub.active = tool_settings.proportional_edit != 'DISABLED'
 -sub.prop(tool_settings, "proportional_edit_falloff", 
icon_only=True)
++sub = row.row(align=True)
++sub.active = tool_settings.proportional_edit != 'DISABLED'
++sub.prop(tool_settings, "proportional_edit_falloff", 
icon_only=True)
  
- sub = row.row(align=True)
- sub.enabled = shading.type != 'RENDERED'
- sub.popover(space_type='VIEW_3D', region_type='HEADER', 
panel_type="VIEW3D_PT_shading")
+ elif object_mode in {'EDIT', 'PARTICLE_EDIT'}:
+ row = layout.row(align=True)
+ row.prop(tool_settings, "proportional_edit", icon_only=True)
+ sub = row.row(align=True)
+ sub.active = tool_settings.proportional_edit != 'DISABLED'
+ sub.prop(tool_settings, "proportional_edit_falloff", 
icon_only=True)
  
- row = layout.row(align=True)
- row.prop(overlay, "show_overlays", icon='WIRE', text="")
+ elif object_mode == 'OBJECT':
+ row = layout.row(align=True)
+ row.prop(tool_settings, "use_proportional_edit_objects", 
icon_only=True)
+ sub = row.row(align=True)
+ sub.active = tool_settings.use_proportional_edit_objects
+ sub.prop(tool_settings, "proportional_edit_falloff", 
icon_only=True)
+ else:
+ if context.gpencil_data and 
context.gpencil_data.use_stroke_edit_mode:
+ row = layout.row(align=True)
+ row.prop(tool_settings, "proportional_edit", icon_only=True)
+ sub = row.row(align=True)
+ sub.active = tool_settings.proportional_edit != 'DISABLED'
+ sub.prop(tool_settings, "proportional_edit_falloff

[Bf-blender-cvs] [87a308ed334] greasepencil-object: GP Object: Don't show Add/Unlink datablock buttons for GP datablock ID selector

2018-07-02 Thread Joshua Leung
Commit: 87a308ed334e113556745eb770cb2301a48f361e
Author: Joshua Leung
Date:   Mon Jul 2 16:41:33 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB87a308ed334e113556745eb770cb2301a48f361e

GP Object: Don't show Add/Unlink datablock buttons for GP datablock ID selector

These buttons are not shown for any other object type,
so these shouldn't be shown for Grease Pencil objects.

===

M   release/scripts/startup/bl_ui/properties_data_gpencil.py

===

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index ecef591a46f..9522807eada 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -64,7 +64,7 @@ class DATA_PT_gpencil(DataButtonsPanel, Panel):
 gpd_owner = context.gpencil_data_owner
 gpd = context.gpencil_data
 
-layout.template_ID(gpd_owner, "data", new="gpencil.data_add", 
unlink="gpencil.data_unlink")
+layout.template_ID(gpd_owner, "data")
 
 
 class GPENCIL_UL_layer(UIList):

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


  1   2   3   4   5   6   7   8   9   10   >