Commit: 17656a6e1fedbc344aa1492d83257262bcfca776 Author: YimingWu Date: Mon Aug 12 09:12:09 2019 +0800 Branches: temp-lanpr-staging https://developer.blender.org/rB17656a6e1fedbc344aa1492d83257262bcfca776
LANPR: Use flag for enable field. =================================================================== M source/blender/blenkernel/intern/scene.c M source/blender/blenloader/intern/versioning_280.c M source/blender/editors/lanpr/lanpr_cpu.c M source/blender/editors/space_buttons/buttons_context.c M source/blender/makesdna/DNA_scene_types.h M source/blender/makesrna/intern/rna_scene.c =================================================================== diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 3440c8dfb69..d73843663fd 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1017,13 +1017,7 @@ void BKE_scene_init(Scene *sce) /* SceneLANPR */ sce->lanpr.crease_threshold = 0.7; - - sce->lanpr.line_thickness = 1.5; - sce->lanpr.depth_clamp = 0.001; - sce->lanpr.depth_strength = 800; - sce->lanpr.normal_clamp = 2; - sce->lanpr.normal_strength = 10; - + sce->lanpr.enable_intersections = 1; sce->lanpr.line_color[0] = 1; diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index cc52bb8f2fd..c5880eed175 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1796,12 +1796,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) scene->lanpr.crease_threshold = 0.7; - scene->lanpr.line_thickness = 1.5; - scene->lanpr.depth_clamp = 0.001; - scene->lanpr.depth_strength = 800; - scene->lanpr.normal_clamp = 2; - scene->lanpr.normal_strength = 10; - scene->lanpr.enable_intersections = 1; scene->lanpr.line_color[0] = 0.39; @@ -3516,12 +3510,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) for (Scene *sce = bmain->scenes.first; sce; sce = sce->id.next) { sce->lanpr.crease_threshold = 0.7; - sce->lanpr.line_thickness = 1.5; - sce->lanpr.depth_clamp = 0.001; - sce->lanpr.depth_strength = 800; - sce->lanpr.normal_clamp = 2; - sce->lanpr.normal_strength = 10; - sce->lanpr.enable_intersections = 1; zero_v4(sce->lanpr.line_color); diff --git a/source/blender/editors/lanpr/lanpr_cpu.c b/source/blender/editors/lanpr/lanpr_cpu.c index 4c1c254aea0..8d4ef34d51f 100644 --- a/source/blender/editors/lanpr/lanpr_cpu.c +++ b/source/blender/editors/lanpr/lanpr_cpu.c @@ -3756,7 +3756,7 @@ int ED_lanpr_compute_feature_lines_internal(Depsgraph *depsgraph, int intersecto SceneLANPR *lanpr = &s->lanpr; int is_lanpr_engine = !strcmp(s->r.engine, RE_engine_id_BLENDER_LANPR); - if (!is_lanpr_engine && !lanpr->enabled) { + if (!is_lanpr_engine && (lanpr->flag & LANPR_ENABLED)==0) { return OPERATOR_CANCELLED; } @@ -3844,7 +3844,7 @@ static int lanpr_compute_feature_lines_exec(struct bContext *C, struct wmOperato int result; int is_lanpr_engine = !strcmp(scene->r.engine, RE_engine_id_BLENDER_LANPR); - if (!is_lanpr_engine && !lanpr->enabled) { + if (!is_lanpr_engine && (lanpr->flag & LANPR_ENABLED)==0) { return OPERATOR_CANCELLED; } @@ -3899,7 +3899,7 @@ bool ED_lanpr_dpix_shader_error() } bool ED_lanpr_disable_edge_splits(Scene *s) { - return (s->lanpr.enabled && s->lanpr.disable_edge_splits); + return ((s->lanpr.flag & LANPR_ENABLED) && s->lanpr.disable_edge_splits); } /* GPencil bindings */ @@ -4283,7 +4283,7 @@ void OBJECT_OT_lanpr_update_gp_source(struct wmOperatorType *ot) void ED_lanpr_post_frame_update_external(Scene *s, Depsgraph *dg) { - if (!s->lanpr.enabled || !s->lanpr.auto_update) { + if ((s->lanpr.flag & LANPR_ENABLED)==0 || !s->lanpr.auto_update) { return; } if (strcmp(s->r.engine, RE_engine_id_BLENDER_LANPR)) { diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index bd7c8b8dbbd..2a28dc56607 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -604,7 +604,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma found = buttons_context_path_collection(path, window); break; case BCONTEXT_LANPR: - if (scene && (scene->lanpr.enabled || !strcmp(scene->r.engine, "BLENDER_LANPR"))) { + if (scene && ((scene->lanpr.flag & LANPR_ENABLED) || !strcmp(scene->r.engine, "BLENDER_LANPR"))) { found = buttons_context_path_object(path); } else { diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index a6544a7f950..590a46718dd 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1648,31 +1648,32 @@ typedef enum LANPR_PostProcessingStatus { LANPR_POST_PROCESSING_ENABLED = 1, } LANPR_PostProcessingStatus; +typedef enum LANPR_MainFlags{ + LANPR_ENABLED = 0, + /* For LANPR->GP to update automatically. */ + LANPR_AUTO_UPDATE = (1<<0), + LANPR_SAME_TAPER = (1<<2), + /* Edge split modifier will cause problems in LANPR. */ + LANPR_DISABLE_EDGE_SPLITS = (1<<3), + LANPR_USE_CHAINING = (1<<4), + LANPR_USE_INTERSECTIONS = (1<<5), + /* Overwrite existing strokes in this frame. */ + LANPR_GPENCIL_OVERWRITE = (1<<6), +}LANPR_MainFlags; + typedef struct SceneLANPR { - int enabled; - int auto_update; /* for LANPR->GP to update automatically */ + int flag; + int auto_update; int master_mode; /* LANPR_MasterMode */ - int enable_vector_trace; - int display_thinning_result; - - float depth_clamp; - float depth_strength; - float normal_clamp; - float normal_strength; - - float line_thickness; - int use_same_taper; float taper_left_distance; float taper_left_strength; float taper_right_distance; float taper_right_strength; - int snake_sensitivity; - /* shared */ float contour_fade; /* for dpix contour fading,reserved for future usage */ @@ -1686,8 +1687,7 @@ typedef struct SceneLANPR { float depth_width_curve; float depth_alpha_influence; float depth_alpha_curve; - - /* edge split modifier will cause problems in LANPR. */ + int disable_edge_splits; int gpu_cache_size; /* enum! */ @@ -1703,7 +1703,7 @@ typedef struct SceneLANPR { float chaining_geometry_threshold; float chaining_image_threshold; - /* Overwrite existing strokes in this frame. */ + int gpencil_overwrite; } SceneLANPR; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 3c19c21679b..247f87a0e60 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -7203,6 +7203,7 @@ static void rna_def_scene_lanpr(BlenderRNA *brna) prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_default(prop, 0); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LANPR_ENABLED); RNA_def_property_ui_text(prop, "Enabled", "Is LANPR enabled"); RNA_def_property_update(prop, NC_WINDOW, NULL); @@ -7231,56 +7232,6 @@ static void rna_def_scene_lanpr(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_SCENE, NULL); - prop = RNA_def_property(srna, "enable_vector_trace", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_enum_lanpr_enable_post_processing); - RNA_def_property_enum_default(prop, LANPR_POST_PROCESSING_DISABLED); - RNA_def_property_ui_text( - prop, "Enable Post Processing", "Draw image post processing line or not"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "display_thinning_result", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_enum_lanpr_display_thinning_result); - RNA_def_property_enum_default(prop, LANPR_POST_PROCESSING_DISABLED); - RNA_def_property_ui_text(prop, "Display", "Display mode"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_PERCENTAGE); - RNA_def_property_float_default(prop, 0.001f); - RNA_def_property_ui_text(prop, "Depth Clamp", "Depth clamp value for edge extraction"); - RNA_def_property_ui_range(prop, 0.0, 0.01, 0.0001, 5); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "depth_strength", PROP_FLOAT, PROP_PERCENTAGE); - RNA_def_property_float_default(prop, 800); - RNA_def_property_ui_text(prop, "Depth Strength", "Depth strength value for edge extraction"); - RNA_def_property_ui_range(prop, 0, 1000, 10, 2); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "normal_clamp", PROP_FLOAT, PROP_PERCENTAGE); - RNA_def_property_float_default(prop, 2); - RNA_def_property_ui_text(prop, "Normal Clamp", "Normal clamp value for edge extraction"); - RNA_def_property_ui_range(prop, 0, 5, 0.1, 2); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "normal_strength", PROP_FLOAT, PROP_PERCENTAGE); - RNA_def_property_float_default(prop, 10); - RNA_def_property_ui_text(prop, "Normal Strength", "Normal strength value for edge extraction"); - RNA_def_property_ui_range(prop, 0, 20, 1, 2); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "line_thickness", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 2.0f); - RNA_def_property_ui_text(prop, "Line Thickness", "Thickness of extracted line"); - RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 2); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_update(prop, NC_SCENE, NULL); - prop = RNA_def_property(srna, "depth_width_influence", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_default(prop, 0.3f); RNA_def_property_ui_text(prop, "Width Influence", "Use camera distance to control line width."); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs