[Bf-blender-cvs] [c6f425c] master: Fix T37189: Inconsistent icons for Force field

Sergey Sharybin noreply at git.blender.org
Wed Dec 4 20:25:32 CET 2013


Commit: c6f425c8758d0c674f5e59075dbb3fef418af29a
Author: Sergey Sharybin
Date:   Thu Dec 5 01:24:05 2013 +0600
http://developer.blender.org/rBc6f425c8758d0c674f5e59075dbb3fef418af29a

Fix T37189: Inconsistent icons for Force field

There's still an issue with Curve Guide force field
which you can not so easily change type from/to.

This i would consider TODO for later.

===================================================================

M	source/blender/makesrna/intern/rna_object_force.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 2a93925..b8cf7a1 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -523,6 +523,18 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA
 	}
 }
 
+static void rna_FieldSettings_type_set(PointerRNA *ptr, int value)
+{
+	Object *ob = (Object *)ptr->id.data;
+	ob->pd->forcefield = value;
+	if (ELEM(value, PFIELD_WIND, PFIELD_VORTEX)) {
+		ob->empty_drawtype = OB_SINGLE_ARROW;
+	}
+	else {
+		ob->empty_drawtype = OB_PLAINAXES;
+	}
+}
+
 static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	if (particle_id_check(ptr)) {
@@ -1159,6 +1171,7 @@ static void rna_def_field(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "forcefield");
 	RNA_def_property_enum_items(prop, field_type_items);
+	RNA_def_property_enum_funcs(prop, NULL, "rna_FieldSettings_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Type", "Type of field");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");




More information about the Bf-blender-cvs mailing list