[Bf-blender-cvs] [5edb6d437aa] greasepencil-object: GP Build Modifier: Rename direction -> transition, and rearrange UI panel
Joshua Leung
noreply at git.blender.org
Thu Nov 23 15:33:09 CET 2017
Commit: 5edb6d437aaf891be3bde64272bbf76b459e052c
Author: Joshua Leung
Date: Fri Nov 24 02:41:55 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB5edb6d437aaf891be3bde64272bbf76b459e052c
GP Build Modifier: Rename direction -> transition, and rearrange UI panel
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/intern/MOD_gpencilbuild.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 0a87770ef23..d109e6819e1 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1788,19 +1788,17 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
split = layout.split()
col = split.column()
- col.label("Transition:")
- col.prop(md, "direction")
+ col.prop(md, "mode")
+ if md.mode == 'CONCURRENT':
+ col.prop(md, "concurrent_time_alignment")
col.separator()
+
+ col.prop(md, "transition")
sub = col.column(align=True)
sub.prop(md, "start_delay")
sub.prop(md, "length")
- col = split.column()
- col.prop(md, "mode")
- if md.mode == 'CONCURRENT':
- col.prop(md, "concurrent_time_alignment")
-
- col = layout.column()
+ col = split.column(align=True)
col.prop(md, "use_restrict_frame_range")
sub = col.column(align=True)
sub.active = md.use_restrict_frame_range
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 0ed34224af2..21c7cdd37fc 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1783,7 +1783,7 @@ typedef struct GpencilBuildModifierData {
short flag; /* (eGpencilBuild_Flag) Options for controlling modifier behaviour */
short mode; /* (eGpencilBuild_Mode) How are strokes ordered */
- short direction; /* (eGpencilBuild_Direction) In what order do stroke points appear/disappear */
+ short transition; /* (eGpencilBuild_Transition) In what order do stroke points appear/disappear */
short time_alignment; /* (eGpencilBuild_TimeAlignment) For the "Concurrent" mode, when should "shorter" strips start/end */
} GpencilBuildModifierData;
@@ -1795,14 +1795,14 @@ typedef enum eGpencilBuild_Mode {
GP_BUILD_MODE_CONCURRENT = 1,
} eGpencilBuild_Mode;
-typedef enum eGpencilBuild_Direction {
+typedef enum eGpencilBuild_Transition {
/* Show in forward order */
- GP_BUILD_DIRECTION_GROW = 0,
+ GP_BUILD_TRANSITION_GROW = 0,
/* Hide in reverse order */
- GP_BUILD_DIRECTION_SHRINK = 1,
+ GP_BUILD_TRANSITION_SHRINK = 1,
/* Hide in forward order */
- GP_BUILD_DIRECTION_FADE = 2,
-} eGpencilBuild_Direction;
+ GP_BUILD_TRANSITION_FADE = 2,
+} eGpencilBuild_Transition;
typedef enum eGpencilBuild_TimeAlignment {
/* All strokes start at same time */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 61e64aa569a..30bbc8cc95d 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5415,14 +5415,14 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
- static EnumPropertyItem prop_gpencil_build_direction_items[] = {
- {GP_BUILD_DIRECTION_GROW, "GROW", 0, "Grow",
+ static EnumPropertyItem prop_gpencil_build_transition_items[] = {
+ {GP_BUILD_TRANSITION_GROW, "GROW", 0, "Grow",
"Show points in the order they occur in each stroke "
"(e.g. for animating lines being drawn)"},
- {GP_BUILD_DIRECTION_SHRINK, "SHRINK", 0, "Shrink",
+ {GP_BUILD_TRANSITION_SHRINK, "SHRINK", 0, "Shrink",
"Hide points from the end of each stroke to the start "
"(e.g. for animating lines being erased)"},
- {GP_BUILD_DIRECTION_FADE, "FADE", 0, "Fade",
+ {GP_BUILD_TRANSITION_FADE, "FADE", 0, "Fade",
"Hide points in the order they occur in each stroke "
"(e.g. for animating ink fading or vanishing after getting drawn)"},
{0, NULL, 0, NULL, NULL}
@@ -5474,9 +5474,9 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
/* Direction */
- prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_gpencil_build_direction_items);
- RNA_def_property_ui_text(prop, "Direction", "How are strokes animated (i.e. are they appearing or disappearing)");
+ prop = RNA_def_property(srna, "transition", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_gpencil_build_transition_items);
+ RNA_def_property_ui_text(prop, "Transition", "How are strokes animated (i.e. are they appearing or disappearing)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
diff --git a/source/blender/modifiers/intern/MOD_gpencilbuild.c b/source/blender/modifiers/intern/MOD_gpencilbuild.c
index 48fbdb78f66..6715dc333e3 100644
--- a/source/blender/modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/modifiers/intern/MOD_gpencilbuild.c
@@ -118,15 +118,15 @@ static void gpf_clear_all_strokes(bGPDframe *gpf, int modifier_index)
* Note: This won't be called if all points are present/removed
* TODO: Allow blending of growing/shrinking tip (e.g. for more gradual transitions)
*/
-static void reduce_stroke_points(bGPDstroke *gps, const int num_points, const eGpencilBuild_Direction direction)
+static void reduce_stroke_points(bGPDstroke *gps, const int num_points, const eGpencilBuild_Transition transition)
{
bGPDspoint *new_points = MEM_callocN(sizeof(bGPDspoint) * num_points, "GP Build Modifier - Reduced Points");
/* Which end should points be removed from */
// TODO: free stroke weights
- switch (direction) {
- case GP_BUILD_DIRECTION_GROW: /* Show in forward order = Remove ungrown-points from end of stroke */
- case GP_BUILD_DIRECTION_SHRINK: /* Hide in reverse order = Remove dead-points from end of stroke */
+ switch (transition) {
+ case GP_BUILD_TRANSITION_GROW: /* Show in forward order = Remove ungrown-points from end of stroke */
+ case GP_BUILD_TRANSITION_SHRINK: /* Hide in reverse order = Remove dead-points from end of stroke */
{
/* copy over point data */
memcpy(new_points, gps->points, sizeof(bGPDspoint) * num_points);
@@ -141,7 +141,7 @@ static void reduce_stroke_points(bGPDstroke *gps, const int num_points, const eG
}
/* Hide in forward order = Remove points from start of stroke */
- case GP_BUILD_DIRECTION_FADE:
+ case GP_BUILD_TRANSITION_FADE:
{
/* num_points is the number of points left after reducing.
* We need to know how many to remove
@@ -161,7 +161,7 @@ static void reduce_stroke_points(bGPDstroke *gps, const int num_points, const eG
}
default:
- printf("ERROR: Unknown direction %d in %s()\n", direction, __func__);
+ printf("ERROR: Unknown transition %d in %s()\n", transition, __func__);
break;
}
@@ -230,11 +230,11 @@ static void build_sequential(GpencilBuildModifierData *mmd, bGPDlayer *gpl, bGPD
size_t first_visible = 0;
size_t last_visible = 0;
- switch (mmd->direction) {
+ switch (mmd->transition) {
/* Show in forward order
* - As fac increases, the number of visible points increases
*/
- case GP_BUILD_DIRECTION_GROW:
+ case GP_BUILD_TRANSITION_GROW:
first_visible = 0; /* always visible */
last_visible = (size_t)roundf(totpoints * fac);
break;
@@ -242,7 +242,7 @@ static void build_sequential(GpencilBuildModifierData *mmd, bGPDlayer *gpl, bGPD
/* Hide in reverse order
* - As fac increases, the number of points visible at the end decreases
*/
- case GP_BUILD_DIRECTION_SHRINK:
+ case GP_BUILD_TRANSITION_SHRINK:
first_visible = 0; /* always visible (until last point removed) */
last_visible = (size_t)(totpoints * (1.0f - fac));
break;
@@ -250,7 +250,7 @@ static void build_sequential(GpencilBuildModifierData *mmd, bGPDlayer *gpl, bGPD
/* Hide in forward order
* - As fac increases, the early points start getting hidden
*/
- case GP_BUILD_DIRECTION_FADE:
+ case GP_BUILD_TRANSITION_FADE:
first_visible = (size_t)(totpoints * fac);
last_visible = totpoints; /* i.e. visible until the end, unless first overlaps this */
break;
@@ -268,19 +268,19 @@ static void build_sequential(GpencilBuildModifierData *mmd, bGPDlayer *gpl, bGPD
}
else {
/* Some proportion of stroke is visible */
- /* XXX: Will the direction settings still be valid now? */
+ /* XXX: Will the transition settings still be valid now? */
if ((first_visible <= cell->start_idx) && (last_visible >= cell->end_idx)) {
/* Do nothing - whole stroke is visible */
}
else if (first_visible > cell->start_idx) {
/* Starts partway through this stroke */
int num_points = cell->end_idx - first_visible; // XXX: Check for off-by-1
- reduce_stroke_points(cell->gps, num_points, mmd->direction);
+ reduce_stroke_points(cell->gps, num_points, mmd->transition);
}
else {
/* Ends partway through this stroke */
int num_points = last_visible - cell->start_idx; // XXX: Check for off-by-1
- reduce_stroke_points(cell->gps, num_points, mmd->direction);
+ reduce_stroke_points(cell->gps, num_points, mmd->transition);
}
}
}
@@ -299,7 +299,7 @@ static void build_concurrent(GpencilBuildModifierData *mmd, bGPDlayer *gpl, bGPD
bGPDstroke *gps, *gps_next;
int max_points = 0;
- const bool reverse = (mmd->direction != GP_BUILD_DIRECTION_GROW);
+ const bool reverse = (mmd->transition != GP_BUILD_TRANSITION_GROW);
/* 1) Determine the longest stroke, to figure out when short strokes should start */
/* FIXME: A *really* long stroke here could dwarf everything else, causing bad timings */
@@ -388,7 +388,7 @@ static void build_concurrent(GpencilBuildModifierData *mmd, bGPDlayer *gpl, bGPD
}
else if (num_points < gps->totpoints) {
/* Remove some points */
- reduce_stroke_points(gps, num_points, mmd->direction);
+ reduce_stroke_points(gps, num_points, mmd->transition);
}
}
}
@@ -401,7 +401,7 @@ static void generateStrokes(ModifierData *md, const EvaluationContext *eval_ctx,
int modifier_index)
{
GpencilBuildModifierData *mmd = (GpencilBuildModifierData *)md;
- const bool reverse = (mmd->direction != GP_BUILD_DIRECTION_GROW);
+ const bool reverse = (mmd->transition != GP_BUILD_TRANSITION_GROW);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list