diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-09-20 23:05:46 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:02 +0300 |
commit | 491e7493c7f35a0b2d03a9fc6e934e5868c88b10 (patch) | |
tree | f3d5b295e104df491250db5701d0a41af3f4d66d /source/blender/makesrna/intern/rna_cloth.c | |
parent | 00bb836e17de349b7e4f9478b1911f8de8e0b334 (diff) |
Basic solver result feedback from the mass-spring (cloth/hair) solver.
This returns a general status (success/no-convergence/other) along with
basic statistics (min/max/average) for the error value and the number
of iterations. It allows some general estimation of the simulation
quality and detection of critical settings that could become a problem.
Better visualization and extended feedback can follow later.
Diffstat (limited to 'source/blender/makesrna/intern/rna_cloth.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_cloth.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 154ab7db52d..57dc3ea293d 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -38,6 +38,8 @@ #include "BKE_cloth.h" #include "BKE_modifier.h" +#include "BPH_mass_spring.h" + #include "WM_api.h" #include "WM_types.h" @@ -268,6 +270,64 @@ static char *rna_ClothCollisionSettings_path(PointerRNA *ptr) #else +static void rna_def_cloth_solver_result(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem status_items[] = { + {BPH_SOLVER_SUCCESS, "SUCCESS", 0, "Success", "Computation was successful"}, + {BPH_SOLVER_NUMERICAL_ISSUE, "NUMERICAL_ISSUE", 0, "Numerical Issue", "The provided data did not satisfy the prerequisites"}, + {BPH_SOLVER_NO_CONVERGENCE, "NO_CONVERGENCE", 0, "No Convergence", "Iterative procedure did not converge"}, + {BPH_SOLVER_INVALID_INPUT, "INVALID_INPUT", 0, "Invalid Input", "The inputs are invalid, or the algorithm has been improperly called"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "ClothSolverResult", NULL); + RNA_def_struct_ui_text(srna, "Solver Result", "Result of cloth solver iteration"); + + RNA_define_verify_sdna(0); + + prop = RNA_def_property(srna, "status", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, status_items); + RNA_def_property_enum_sdna(prop, NULL, "status"); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Status", "Status of the solver iteration"); + + prop = RNA_def_property(srna, "max_error", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "max_error"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Maximum Error", "Maximum error during substeps"); + + prop = RNA_def_property(srna, "min_error", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "min_error"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Minimum Error", "Minimum error during substeps"); + + prop = RNA_def_property(srna, "avg_error", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "avg_error"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Average Error", "Average error during substeps"); + + prop = RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "max_iterations"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Maximum Iterations", "Maximum iterations during substeps"); + + prop = RNA_def_property(srna, "min_iterations", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "min_iterations"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Minimum Iterations", "Minimum iterations during substeps"); + + prop = RNA_def_property(srna, "avg_iterations", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "avg_iterations"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Average Iterations", "Average iterations during substeps"); + + RNA_define_verify_sdna(1); +} + static void rna_def_cloth_sim_settings(BlenderRNA *brna) { StructRNA *srna; @@ -660,6 +720,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) void RNA_def_cloth(BlenderRNA *brna) { + rna_def_cloth_solver_result(brna); rna_def_cloth_sim_settings(brna); rna_def_cloth_collision_settings(brna); } |