[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19786] branches/blender2.5/blender/source /blender/makesrna: RNA - F-Curve Modifier Wrapping

Joshua Leung aligorith at gmail.com
Sun Apr 19 12:44:08 CEST 2009


Revision: 19786
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19786
Author:   aligorith
Date:     2009-04-19 12:44:07 +0200 (Sun, 19 Apr 2009)

Log Message:
-----------
RNA - F-Curve Modifier Wrapping

* Separated F-Curve specific wrapping out to its own file
* Wrapped some F-Curve Modifiers (others to follow shortly)

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_action.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_fcurve.c

Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2009-04-19 07:07:53 UTC (rev 19785)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2009-04-19 10:44:07 UTC (rev 19786)
@@ -103,6 +103,7 @@
 extern StructRNA RNA_ExplodeModifier;
 extern StructRNA RNA_ExpressionController;
 extern StructRNA RNA_FCurve;
+extern StructRNA RNA_FModifier;
 extern StructRNA RNA_FieldSettings;
 extern StructRNA RNA_FloatProperty;
 extern StructRNA RNA_FluidFluidSettings;

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c	2009-04-19 07:07:53 UTC (rev 19785)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c	2009-04-19 10:44:07 UTC (rev 19786)
@@ -1733,6 +1733,7 @@
 	{"rna_context.c", RNA_def_context},
 	{"rna_controller.c", RNA_def_controller},
 	{"rna_curve.c", RNA_def_curve},
+	{"rna_fcurve.c", RNA_def_fcurve},
 	{"rna_fluidsim.c", RNA_def_fluidsim},
 	{"rna_group.c", RNA_def_group},
 	{"rna_image.c", RNA_def_image},

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_action.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_action.c	2009-04-19 07:07:53 UTC (rev 19785)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_action.c	2009-04-19 10:44:07 UTC (rev 19786)
@@ -29,7 +29,6 @@
 
 #include "rna_internal.h"
 
-#include "DNA_anim_types.h"
 #include "DNA_action_types.h"
 #include "DNA_scene_types.h"
 
@@ -37,197 +36,8 @@
 
 #ifdef RNA_RUNTIME
 
-static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value)
-{
-	DriverTarget *dtar= (DriverTarget *)ptr->data;
-
-	if (dtar->rna_path)
-		strcpy(value, dtar->rna_path);
-	else
-		strcpy(value, "");
-}
-
-static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr)
-{
-	DriverTarget *dtar= (DriverTarget *)ptr->data;
-	
-	if (dtar->rna_path)
-		return strlen(dtar->rna_path);
-	else
-		return 0;
-}
-
-static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value)
-{
-	DriverTarget *dtar= (DriverTarget *)ptr->data;
-	
-	// XXX in this case we need to be very careful, as this will require some new dependencies to be added!
-	if (dtar->rna_path)
-		MEM_freeN(dtar->rna_path);
-	
-	if (strlen(value))
-		dtar->rna_path= BLI_strdup(value);
-	else 
-		dtar->rna_path= NULL;
-}
-
-
-static void rna_FCurve_RnaPath_get(PointerRNA *ptr, char *value)
-{
-	FCurve *fcu= (FCurve *)ptr->data;
-
-	if (fcu->rna_path)
-		strcpy(value, fcu->rna_path);
-	else
-		strcpy(value, "");
-}
-
-static int rna_FCurve_RnaPath_length(PointerRNA *ptr)
-{
-	FCurve *fcu= (FCurve *)ptr->data;
-	
-	if (fcu->rna_path)
-		return strlen(fcu->rna_path);
-	else
-		return 0;
-}
-
-static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value)
-{
-	FCurve *fcu= (FCurve *)ptr->data;
-
-	if (fcu->rna_path)
-		MEM_freeN(fcu->rna_path);
-	
-	if (strlen(value))
-		fcu->rna_path= BLI_strdup(value);
-	else 
-		fcu->rna_path= NULL;
-}
-
 #else
 
-// XXX maybe this should be in a separate file?
-void rna_def_drivertarget(BlenderRNA *brna)
-{
-	StructRNA *srna;
-	PropertyRNA *prop;
-	
-	srna= RNA_def_struct(brna, "DriverTarget", NULL);
-	RNA_def_struct_ui_text(srna, "Driver Target", "Variable from some source/target for driver relationship");
-	
-	/* Variable Name */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Name", "Name to use in scripted expressions/functions.");
-	
-	/* Target Properties */
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
-	RNA_def_property_pointer_sdna(prop, NULL, "id");
-	RNA_def_property_ui_text(prop, "Object", "Object the specific property used can be found from");
-	
-	prop= RNA_def_property(srna, "rna_path", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_DriverTarget_RnaPath_get", "rna_DriverTarget_RnaPath_length", "rna_DriverTarget_RnaPath_set");
-	RNA_def_property_ui_text(prop, "RNA Path", "RNA Path (from Object) to property used");
-	
-	prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
-	RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property used (if applicable)");
-}
-
-// XXX maybe this should be in a separate file?
-void rna_def_channeldriver(BlenderRNA *brna)
-{
-	StructRNA *srna;
-	PropertyRNA *prop;
-	
-	static EnumPropertyItem prop_type_items[] = {
-		{DRIVER_TYPE_AVERAGE, "AVERAGE", "Averaged Value", ""},
-		{DRIVER_TYPE_PYTHON, "SCRIPTED", "Scripted Expression", ""},
-		{DRIVER_TYPE_ROTDIFF, "ROTDIFF", "Rotational Difference", ""},
-		{0, NULL, NULL, NULL}};
-
-	srna= RNA_def_struct(brna, "Driver", NULL);
-	RNA_def_struct_sdna(srna, "ChannelDriver");
-	RNA_def_struct_ui_text(srna, "Driver", "Driver for the value of a setting based on an external value.");
-
-	/* Enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_items(prop, prop_type_items);
-	RNA_def_property_ui_text(prop, "Type", "Driver types.");
-
-	/* String values */
-	prop= RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression.");
-
-	/* Collections */
-	prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
-	RNA_def_property_struct_type(prop, "DriverTarget");
-	RNA_def_property_ui_text(prop, "Target Variables", "Properties acting as targets for this driver.");
-}
-
-// XXX maybe this should be in a separate file?
-void rna_def_fcurve(BlenderRNA *brna)
-{
-	StructRNA *srna;
-	PropertyRNA *prop;
-	
-	static EnumPropertyItem prop_mode_extend_items[] = {
-		{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", "Constant", ""},
-		{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", "Linear", ""},
-		{0, NULL, NULL, NULL}};
-	static EnumPropertyItem prop_mode_color_items[] = {
-		{FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", "Automatic Rainbow", ""},
-		{FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", "Automatic XYZ to RGB", ""},
-		{FCURVE_COLOR_CUSTOM, "CUSTOM", "User Defined", ""},
-		{0, NULL, NULL, NULL}};
-
-	srna= RNA_def_struct(brna, "FCurve", NULL);
-	RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time.");
-
-	/* Enums */
-	prop= RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_sdna(prop, NULL, "extend");
-	RNA_def_property_enum_items(prop, prop_mode_extend_items);
-	RNA_def_property_ui_text(prop, "Extrapolation", "");
-
-	/* Pointers */
-	prop= RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Driver", "Channel Driver (only set for Driver F-Curves)");
-	
-	/* Path + Array Index */
-	prop= RNA_def_property(srna, "rna_path", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length", "rna_FCurve_RnaPath_set");
-	RNA_def_property_ui_text(prop, "RNA Path", "RNA Path to property affected by F-Curve.");
-	
-	prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
-	RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property affected by F-Curve if applicable.");
-	
-	/* Color */
-	prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_items(prop, prop_mode_color_items);
-	RNA_def_property_ui_text(prop, "Color Mode", "Method used to determine color of F-Curve in Graph Editor.");
-	
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
-	RNA_def_property_array(prop, 3);
-	RNA_def_property_ui_text(prop, "Color", "Color of the F-Curve in the Graph Editor.");
-	
-	/* Collections */
-	prop= RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_sdna(prop, NULL, "fpt", "totvert");
-	RNA_def_property_struct_type(prop, "CurvePoint"); // XXX FPoints not BPoints here! FPoints are much smaller!
-	RNA_def_property_ui_text(prop, "Sampled Points", "Sampled animation data");
-
-	prop= RNA_def_property(srna, "keyframe_points", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_sdna(prop, NULL, "bezt", "totvert");
-	RNA_def_property_struct_type(prop, "BezierCurvePoint");
-	RNA_def_property_ui_text(prop, "Keyframes", "User-editable keyframes");
-	
-	// XXX to add modifiers...
-}
-
-/* --- */
-
 void rna_def_action_group(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -297,11 +107,6 @@
 {
 	rna_def_action(brna);
 	rna_def_action_group(brna);
-	
-	// should these be in their own file, or is that overkill?
-	rna_def_fcurve(brna);
-	rna_def_drivertarget(brna);
-	rna_def_channeldriver(brna);
 }
 
 

Added: branches/blender2.5/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_fcurve.c	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_fcurve.c	2009-04-19 10:44:07 UTC (rev 19786)
@@ -0,0 +1,567 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * Contributor(s): Blender Foundation (2009), Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_scene_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#ifdef RNA_RUNTIME
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list