diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-17 13:27:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-17 13:27:23 +0400 |
commit | 14f9f167b2686a92883b754d111adbb5efec2515 (patch) | |
tree | 27132ff7ff9d8c65ecbcc26fab38bd3885870dea /source/blender/makesrna | |
parent | bb1b2529a0b0dce1b9c34e616436599ab5fd8021 (diff) |
display options to help with 3d printing.
editmesh debug info,
- overhang (with axis angle options)
- wall thickness (with min/max distance)
- self-intersections.
access below 'Mesh Display' panel.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 99 |
2 files changed, 104 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 8a0f73eedda..56d93cc1d3b 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -2954,6 +2954,11 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Draw Freestyle Face Marks", "Display Freestyle face marks, used with the Freestyle renderer"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); + prop = RNA_def_property(srna, "show_statvis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_STATVIS); + RNA_def_property_ui_text(prop, "Stat Vis", "Display statistical information about the mesh"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); + prop = RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN); RNA_def_property_ui_text(prop, "Edge Length", diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 12dbb514290..e931b35f83f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1426,6 +1426,28 @@ static char *rna_UnifiedPaintSettings_path(PointerRNA *ptr) return BLI_strdup("tool_settings.unified_paint_settings"); } +/* generic function to recalc geometry */ +static void rna_EditMesh_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +{ + Mesh *me = NULL; + + if (scene->basact) { + me = BKE_mesh_from_object(scene->basact->object); + if (me && me->edit_btmesh == NULL) + me = NULL; + } + + if (me) { + DAG_id_tag_update(&me->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_GEOM | ND_DATA, me); + } +} + +static char *rna_MeshStatVis_path(PointerRNA *ptr) +{ + return BLI_strdup("tool_settings.statvis"); +} + /* note: without this, when Multi-Paint is activated/deactivated, the colors * will not change right away when multiple bones are selected, this function * is not for general use and only for the few cases where changing scene @@ -1900,6 +1922,12 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "UnifiedPaintSettings"); RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL); + + /* Mesh Statistics */ + prop = RNA_def_property(srna, "statvis", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "MeshStatVis"); + RNA_def_property_ui_text(prop, "Mesh Statistics Visualization", NULL); } static void rna_def_unified_paint_settings(BlenderRNA *brna) @@ -1972,6 +2000,76 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) "when unlocked brush size is given in pixels"); } +static void rna_def_statvis(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem stat_type[] = { + {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""}, + {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""}, + {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna = RNA_def_struct(brna, "MeshStatVis", NULL); + RNA_def_struct_path_func(srna, "rna_MeshStatVis_path"); + RNA_def_struct_ui_text(srna, "Mesh Visualize Statistics", ""); + + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, stat_type); + RNA_def_property_ui_text(prop, "Type", "XXX"); + RNA_def_property_update(prop, 0, "rna_EditMesh_update"); + + + /* overhang */ + prop = RNA_def_property(srna, "overhang_min", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "overhang_min"); + RNA_def_property_float_default(prop, 0.5f); + RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); + RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3); + RNA_def_property_ui_text(prop, "Overhang Min", "Minimum angle to display"); + RNA_def_property_update(prop, 0, "rna_EditMesh_update"); + + prop = RNA_def_property(srna, "overhang_max", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "overhang_max"); + RNA_def_property_float_default(prop, 0.5f); + RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); + RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3); + RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display"); + RNA_def_property_update(prop, 0, "rna_EditMesh_update"); + + prop = RNA_def_property(srna, "overhang_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "overhang_axis"); + RNA_def_property_enum_items(prop, object_axis_items); + RNA_def_property_ui_text(prop, "Axis", ""); + RNA_def_property_update(prop, 0, "rna_EditMesh_update"); + + + /* thickness */ + prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "thickness_min"); + RNA_def_property_float_default(prop, 0.5f); + RNA_def_property_range(prop, 0.0f, 100.0); + RNA_def_property_ui_range(prop, 0.0f, 10.0, 0.001, 3); + RNA_def_property_ui_text(prop, "Thickness Min", "Minimum for measuring thickness"); + RNA_def_property_update(prop, 0, "rna_EditMesh_update"); + + prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "thickness_max"); + RNA_def_property_float_default(prop, 0.5f); + RNA_def_property_range(prop, 0.0f, 100.0); + RNA_def_property_ui_range(prop, 0.0f, 10.0, 0.001, 3); + RNA_def_property_ui_text(prop, "Thickness Max", "Maximum for measuring thickness"); + RNA_def_property_update(prop, 0, "rna_EditMesh_update"); + + /* intersect */ + prop = RNA_def_property(srna, "thickness_samples", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "thickness_samples"); + RNA_def_property_range(prop, 1, 32); + RNA_def_property_ui_text(prop, "Samples", "Number of samples to test per face"); + RNA_def_property_update(prop, 0, "rna_EditMesh_update"); +} + static void rna_def_unit_settings(BlenderRNA *brna) { StructRNA *srna; @@ -5211,6 +5309,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_define_animate_sdna(false); rna_def_tool_settings(brna); rna_def_unified_paint_settings(brna); + rna_def_statvis(brna); rna_def_unit_settings(brna); rna_def_scene_image_format_data(brna); rna_def_scene_game_data(brna); |