Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/ui/properties_physics_softbody.py1
-rw-r--r--source/blender/blenkernel/intern/softbody.c14
-rw-r--r--source/blender/editors/space_view3d/drawobject.c2
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c29
4 files changed, 43 insertions, 3 deletions
diff --git a/release/scripts/ui/properties_physics_softbody.py b/release/scripts/ui/properties_physics_softbody.py
index 60b9c08ee58..706d87cb9a8 100644
--- a/release/scripts/ui/properties_physics_softbody.py
+++ b/release/scripts/ui/properties_physics_softbody.py
@@ -264,6 +264,7 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
layout.label(text="Diagnostics:")
layout.prop(softbody, "diagnose")
+ layout.prop(softbody, "estimate_matrix")
class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel):
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index f53700976fd..735c57ea0ce 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3608,7 +3608,7 @@ static void softbody_to_object(Object *ob, float (*vertexCos)[3], int numVerts,
if(sb){
BodyPoint *bp= sb->bpoint;
int a;
- if(sb->solverflags & SBSO_MONITOR ||sb->solverflags & SBSO_ESTIMATEIPO){SB_estimate_transform(ob,sb->lcom,sb->lrot,sb->lscale);}
+ if(sb->solverflags & SBSO_ESTIMATEIPO){SB_estimate_transform(ob,sb->lcom,sb->lrot,sb->lscale);}
/* inverse matrix is not uptodate... */
invert_m4_m4(ob->imat, ob->obmat);
@@ -3836,9 +3836,19 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
free_scratch(sb); /* clear if any */
sb_new_scratch(sb); /* make a new */
sb->scratch->needstobuildcollider=1;
+ zero_v3(sb->lcom);
+ unit_m3(sb->lrot);
+ unit_m3(sb->lscale);
+
+
/* copy some info to scratch */
- if (1) reference_to_scratch(ob); /* wa only need that if we want to reconstruct IPO */
+ /* we only need that if we want to reconstruct IPO */
+ if(1) {
+ reference_to_scratch(ob);
+ SB_estimate_transform(ob,NULL,NULL,NULL);
+ SB_estimate_transform(ob,NULL,NULL,NULL);
+ }
switch(ob->type) {
case OB_MESH:
if (ob->softflag & OB_SB_FACECOLL) mesh_faces_to_scratch(ob);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 8f20b53c296..c689b4d338f 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5909,7 +5909,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
SoftBody *sb = 0;
float tipw = 0.5f, tiph = 0.5f,drawsize = 4.0f;
if ((sb= ob->soft)){
- if(sb->solverflags & SBSO_MONITOR ||sb->solverflags & SBSO_ESTIMATEIPO){
+ if(sb->solverflags & SBSO_ESTIMATEIPO){
wmLoadMatrix(rv3d->viewmat);
copy_m3_m3(msc,sb->lscale);
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 67c7a9aa078..f4ff066f2b4 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -1381,6 +1381,8 @@ static void rna_def_softbody(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
+ int matrix_dimsize[]= {3, 3};
+
static EnumPropertyItem collision_type_items[] = {
{SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"},
@@ -1586,6 +1588,33 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR);
RNA_def_property_ui_text(prop, "Print Performance to Console", "Turn on SB diagnose console prints");
+ prop= RNA_def_property(srna, "estimate_matrix", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_ESTIMATEIPO);
+ RNA_def_property_ui_text(prop, "Estimate matrix", "esimate matrix .. split to COM , ROT ,SCALE ");
+
+
+ /***********************************************************************************/
+ /* these are not exactly settings, but reading calculated results*/
+ /* but i did not want to start a new property struct */
+ /* so rather rename this from SoftBodySettings to SoftBody */
+ /* translation */
+ prop= RNA_def_property(srna, "lcom", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "lcom");
+ RNA_def_property_ui_text(prop, "Center of mass", "Location of Center of mass.");
+
+ /* matrix */
+ prop= RNA_def_property(srna, "lrot", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "lrot");
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
+ RNA_def_property_ui_text(prop, "Rot Matrix", "Estimated rotation matrix.");
+
+ prop= RNA_def_property(srna, "lscale", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "lscale");
+ RNA_def_property_multi_array(prop, 2, matrix_dimsize);
+ RNA_def_property_ui_text(prop, "Scale Matrix", "Estimated scale matrix.");
+ /***********************************************************************************/
+
+
/* Flags */
prop= RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE);