[Bf-blender-cvs] [55a6fc0be3f] soc-2019-npr: Merge remote-tracking branch 'origin/master' into soc-2019-npr
YimingWu
noreply at git.blender.org
Wed Sep 4 05:31:33 CEST 2019
Commit: 55a6fc0be3ffa823052aba45bec12c6902e7bd53
Author: YimingWu
Date: Wed Sep 4 11:30:16 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB55a6fc0be3ffa823052aba45bec12c6902e7bd53
Merge remote-tracking branch 'origin/master' into soc-2019-npr
===================================================================
===================================================================
diff --cc release/scripts/startup/bl_ui/properties_data_modifier.py
index ae813c06511,dcdb1e22bde..d52ed7dec4e
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@@ -1994,10 -2014,17 +2050,21 @@@ class DATA_PT_gpencil_modifiers(Modifie
row = layout.row()
row.prop(md, "opacity_mode", text="Mode")
+ row = layout.row()
+ row.prop(md, "create_materials")
+ if md.opacity_mode == 'COLOR':
+ row.prop(md, "modify_color", text="Change")
+ if md.opacity_mode == 'MATERIAL':
+ row = layout.row()
+ row.prop(md, "create_materials")
+ row.prop(md, "modify_color", text="Change")
+ else:
+ col = layout.column()
+ col.separator()
+ col.label(text="Vertex Group:")
+ row = col.row(align=True)
+ row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ row.prop(md, "invert_vertex", text="", icon='ARROW_LEFTRIGHT')
col = layout.column()
col.separator()
diff --cc source/blender/blenkernel/BKE_gpencil.h
index c544c065a70,011590100de..b4f636199f8
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@@ -48,84 -41,24 +41,100 @@@ struct bGPDstroke
struct bGPdata;
struct MDeformVert;
- struct MDeformWeight;
+
+ #define GPENCIL_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE))
+ #define GPENCIL_SIMPLIFY_ONPLAY(playing) \
+ (((playing == true) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY)) || \
+ ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY) == 0))
+ #define GPENCIL_SIMPLIFY_FILL(scene, playing) \
+ ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL)))
+ #define GPENCIL_SIMPLIFY_MODIF(scene, playing) \
+ ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER)))
+ #define GPENCIL_SIMPLIFY_FX(scene, playing) \
+ ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FX)))
+ #define GPENCIL_SIMPLIFY_BLEND(scene, playing) \
+ ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_BLEND)))
+struct GPUBatch;
+struct GPUVertBuf;
+struct GPUVertFormat;
+struct GpencilBatchGroup;
+
+#define GP_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE))
+#define GP_SIMPLIFY_ONPLAY(playing) \
+ (((playing == true) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY)) || \
+ ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY) == 0))
+#define GP_SIMPLIFY_FILL(scene, playing) \
+ ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL)))
+#define GP_SIMPLIFY_MODIF(scene, playing) \
+ ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER)))
+#define GP_SIMPLIFY_FX(scene, playing) \
+ ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FX)))
+#define GP_SIMPLIFY_BLEND(scene, playing) \
+ ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_BLEND)))
+
+/* GPUBatch Cache Element */
+typedef struct GpencilBatchCacheElem {
+ struct GPUBatch *batch;
+ struct GPUVertBuf *vbo;
+ int vbo_len;
+ /* attr ids */
+ struct GPUVertFormat *format;
+ uint pos_id;
+ uint color_id;
+ uint thickness_id;
+ uint uvdata_id;
+ uint prev_pos_id;
+
+ /* size for VBO alloc */
+ int tot_vertex;
+} GpencilBatchCacheElem;
+
+/* Defines each batch group to define later the shgroup */
+typedef struct GpencilBatchGroup {
+ struct bGPDlayer *gpl; /* reference to original layer */
+ struct bGPDframe *gpf; /* reference to original frame */
+ struct bGPDstroke *gps; /* reference to original stroke */
+ short type; /* type of element */
+ bool onion; /* the group is part of onion skin */
+ int vertex_idx; /* index of vertex data */
+} GpencilBatchGroup;
+
+typedef enum GpencilBatchGroup_Type {
+ eGpencilBatchGroupType_Stroke = 1,
+ eGpencilBatchGroupType_Point = 2,
+ eGpencilBatchGroupType_Fill = 3,
+ eGpencilBatchGroupType_Edit = 4,
+ eGpencilBatchGroupType_Edlin = 5,
+} GpencilBatchGroup_Type;
+
+/* Runtime data for GPU and derived frames after applying modifiers */
+typedef struct GpencilBatchCache {
+ struct GpencilBatchCacheElem b_stroke;
+ struct GpencilBatchCacheElem b_point;
+ struct GpencilBatchCacheElem b_fill;
+ struct GpencilBatchCacheElem b_edit;
+ struct GpencilBatchCacheElem b_edlin;
+
+ /* settings to determine if cache is invalid */
+ bool is_dirty;
+ bool is_editmode;
+ int cache_frame;
+
+ /* data with the shading groups */
+ int grp_used; /* total groups in arrays */
+ int grp_size; /* max size of the array */
+ struct GpencilBatchGroup *grp_cache; /* array of elements */
+} GpencilBatchCache;
+
/* ------------ Grease-Pencil API ------------------ */
void BKE_gpencil_free_point_weights(struct MDeformVert *dvert);
diff --cc source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
index 53abfdf177c,e9e92f7a1e2..cc38df141d1
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
@@@ -118,16 -146,18 +146,26 @@@ static void deformStroke(GpencilModifie
continue;
}
+ if ((mmd->flag & GP_THICK_CUSTOM_CURVE) && (mmd->curve_thickness)) {
+ /* normalize value to evaluate curve */
+ float value = (float)i / (gps->totpoints - 1);
+ curvef = BKE_curvemapping_evaluateF(mmd->curve_thickness, 0, value);
+ }
+
+ float new_pressure = weight * curvef;
+
if (mmd->flag & GP_THICK_NORMALIZE) {
- pt->pressure = 1.0f * new_pressure;
+ if (gps_has_unaffected_points) {
+ /* Clamp value for very weird situations when stroke thickness can be zero. */
+ CLAMP_MIN(gps->thickness, 1);
+ /* Calculate pressure value to match the width of strokes with reset thickness and 1.0
+ * pressure. */
+ pt->pressure = (float)mmd->thickness / (float)gps->thickness;
+ }
+ else {
+ /* Reset point pressure values so only stroke thickness counts. */
+ pt->pressure = 1.0f;
+ }
}
else {
if ((mmd->flag & GP_THICK_CUSTOM_CURVE) && (mmd->curve_thickness)) {
More information about the Bf-blender-cvs
mailing list