[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57705] trunk/blender/source/blender/ makesrna/intern/rna_lattice.c: fix for editing lattice interpolation and options in editmode had no effect (exiting editmode would loose changes too).

Campbell Barton ideasman42 at gmail.com
Mon Jun 24 17:30:38 CEST 2013


Revision: 57705
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57705
Author:   campbellbarton
Date:     2013-06-24 15:30:37 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
fix for editing lattice interpolation and options in editmode had no effect (exiting editmode would loose changes too).

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_lattice.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_lattice.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_lattice.c	2013-06-24 15:13:51 UTC (rev 57704)
+++ trunk/blender/source/blender/makesrna/intern/rna_lattice.c	2013-06-24 15:30:37 UTC (rev 57705)
@@ -42,6 +42,7 @@
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 
+#include "BLI_string.h"
 #include "BKE_depsgraph.h"
 #include "BKE_lattice.h"
 #include "BKE_main.h"
@@ -99,6 +100,28 @@
 	WM_main_add_notifier(NC_GEOM | ND_DATA, id);
 }
 
+/* copy settings to editlattice,
+ * we could split this up differently (one update call per property)
+ * but for now thats overkill
+ */
+static void rna_Lattice_update_data_editlatt(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+	ID *id = ptr->id.data;
+	Lattice *lt = (Lattice *)ptr->id.data;
+
+	if (lt->editlatt) {
+		Lattice *lt_em = lt->editlatt->latt;
+		lt_em->typeu = lt->typeu;
+		lt_em->typev = lt->typev;
+		lt_em->typew = lt->typew;
+		lt_em->flag = lt->flag;
+		BLI_strncpy(lt_em->vgroup, lt->vgroup, sizeof(lt_em->vgroup));
+	}
+
+	DAG_id_tag_update(id, 0);
+	WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+}
+
 static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	Lattice *lt = ptr->id.data;
@@ -291,31 +314,31 @@
 	RNA_def_property_enum_sdna(prop, NULL, "typeu");
 	RNA_def_property_enum_items(prop, keyblock_type_items);
 	RNA_def_property_ui_text(prop, "Interpolation Type U", "");
-	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
+	RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
 
 	prop = RNA_def_property(srna, "interpolation_type_v", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "typev");
 	RNA_def_property_enum_items(prop, keyblock_type_items);
 	RNA_def_property_ui_text(prop, "Interpolation Type V", "");
-	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
+	RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
 
 	prop = RNA_def_property(srna, "interpolation_type_w", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "typew");
 	RNA_def_property_enum_items(prop, keyblock_type_items);
 	RNA_def_property_ui_text(prop, "Interpolation Type W", "");
-	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
+	RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
 
 	prop = RNA_def_property(srna, "use_outside", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LT_OUTSIDE);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Lattice_use_outside_set");
 	RNA_def_property_ui_text(prop, "Outside", "Only draw, and take into account, the outer vertices");
-	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
+	RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
 	
 	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "vgroup");
 	RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group to apply the influence of the lattice");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Lattice_vg_name_set");
-	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
+	RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
 
 	prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "key");




More information about the Bf-blender-cvs mailing list