[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17618] branches/blender2.5/blender/source /blender:

Brecht Van Lommel brecht at blender.org
Sat Nov 29 15:35:52 CET 2008


Revision: 17618
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17618
Author:   blendix
Date:     2008-11-29 15:35:50 +0100 (Sat, 29 Nov 2008)

Log Message:
-----------

RNA
* Added more lamp properties. (patch by Michael Fox)
* Fix a number of warnings in the RNA code.
* Converted DOS line endings to UNIX.
* Added some information on defining ID structs, and fixed use
  of "ID" inheritance for some non-ID structs.
* Added text on naming conventions to the RNA documentation, and
  applied it to the current code.

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNA#Naming_Conventions

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesdna/DNA_documentation.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
    branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_lamp.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_mesh.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_nodetree.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_sensor.c

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

Modified: branches/blender2.5/blender/source/blender/makesdna/DNA_documentation.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesdna/DNA_documentation.h	2008-11-29 13:57:19 UTC (rev 17617)
+++ branches/blender2.5/blender/source/blender/makesdna/DNA_documentation.h	2008-11-29 14:35:50 UTC (rev 17618)
@@ -65,7 +65,7 @@
 
 /* PLEASE READ INSTRUCTIONS ABOUT ADDING VARIABLES IN 'DNA' STRUCTS IN
 
-  ../blenloader/intern/genfile.c
+  intern/dna_genfile.c
   (ton)
 
  */

Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2008-11-29 13:57:19 UTC (rev 17617)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2008-11-29 14:35:50 UTC (rev 17618)
@@ -39,6 +39,7 @@
 extern StructRNA RNA_IDProperty;
 extern StructRNA RNA_IDPropertyGroup;
 extern StructRNA RNA_Main;
+extern StructRNA RNA_CurveMapping;
 extern StructRNA RNA_Mesh;
 extern StructRNA RNA_MVert;
 extern StructRNA RNA_MVertGroup;

Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_define.h	2008-11-29 13:57:19 UTC (rev 17617)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_define.h	2008-11-29 14:35:50 UTC (rev 17618)
@@ -48,13 +48,17 @@
 
 /* Property */
 
+typedef enum EnumPropertyFlag {
+	PROP_DEF_ENUM_BITFLAGS = 1
+} EnumPropertyFlag;
+
 PropertyRNA *RNA_def_property(StructRNA *srna, const char *identifier, int type, int subtype);
 
 void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int bit);
 void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname);
 void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname);
 void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname);
-void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname, int bitflags);
+void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname, EnumPropertyFlag flag);
 void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname);
 void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname);
 

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c	2008-11-29 13:57:19 UTC (rev 17617)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c	2008-11-29 14:35:50 UTC (rev 17618)
@@ -240,13 +240,23 @@
 	else fprintf(f, "%.10ff", num);
 }
 
+static void rna_int_print(FILE *f, int num)
+{
+	if(num == INT_MIN) fprintf(f, "INT_MIN");
+	else if(num == INT_MAX) fprintf(f, "INT_MAX");
+	else fprintf(f, "%d", num);
+}
+
 static void rna_clamp_value(FILE *f, PropertyRNA *prop)
 {
 	if(prop->type == PROP_INT) {
 		IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
 
-		if(iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX)
-			fprintf(f, "	CLAMP(value, %d, %d);\n", iprop->hardmin, iprop->hardmax);
+		if(iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX) {
+			fprintf(f, "	CLAMP(value, ");
+			rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
+			rna_int_print(f, iprop->hardmax); fprintf(f, ");\n");
+		}
 	}
 	else if(prop->type == PROP_FLOAT) {
 		FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
@@ -323,7 +333,7 @@
 				}
 				else if(prop->type == PROP_ENUM && dp->enumbitflags) {
 					fprintf(f, "	data->%s &= ~%d;\n", dp->dnaname, rna_enum_bitmask(prop));
-					fprintf(f, "	data->%s |= value;\n", dp->dnaname, rna_enum_bitmask(prop));
+					fprintf(f, "	data->%s |= value;\n", dp->dnaname);
 				}
 				else {
 					rna_clamp_value(f, prop);
@@ -767,7 +777,13 @@
 			}
 			case PROP_INT: {
 				IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-				fprintf(f, "\t%s, %s, %s, %s, %s, %d, %d, %d, %d, %d,\n\t%d, ", rna_function_string(iprop->get), rna_function_string(iprop->set), rna_function_string(iprop->getarray), rna_function_string(iprop->setarray), rna_function_string(iprop->range), iprop->softmin, iprop->softmax, iprop->hardmin, iprop->hardmax, iprop->step, iprop->defaultvalue);
+				fprintf(f, "\t%s, %s, %s, %s, %s,\n\t", rna_function_string(iprop->get), rna_function_string(iprop->set), rna_function_string(iprop->getarray), rna_function_string(iprop->setarray), rna_function_string(iprop->range), iprop->softmin, iprop->softmax, iprop->hardmin, iprop->hardmax, iprop->step, iprop->defaultvalue);
+				rna_int_print(f, iprop->softmin); fprintf(f, ", ");
+				rna_int_print(f, iprop->softmax); fprintf(f, ", ");
+				rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
+				rna_int_print(f, iprop->hardmax); fprintf(f, ", ");
+				rna_int_print(f, iprop->step); fprintf(f, ", ");
+				rna_int_print(f, iprop->defaultvalue); fprintf(f, ", ");
 				if(prop->arraylength) fprintf(f, "rna_%s_%s_default\n", srna->identifier, prop->identifier);
 				else fprintf(f, "NULL\n");
 				break;
@@ -861,6 +877,7 @@
 RNAProcessItem PROCESS_ITEMS[]= {
 	{"rna_ID.c", RNA_def_ID},
 	{"rna_main.c", RNA_def_main},
+	{"rna_color.c", RNA_def_color},
 	{"rna_mesh.c", RNA_def_mesh},
 	{"rna_nodetree.c", RNA_def_nodetree},
 	{"rna_material.c", RNA_def_material},

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c	2008-11-29 13:57:19 UTC (rev 17617)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c	2008-11-29 14:35:50 UTC (rev 17618)
@@ -66,7 +66,6 @@
 		case ID_SCE: return &RNA_Scene;
 		case ID_SCR: return &RNA_Screen;
 		case ID_WM: return &RNA_WindowManager;
-		case ID_SE: return &RNA_Sensor;
 		default: return &RNA_ID;
 	}
 }

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c	2008-11-29 13:57:19 UTC (rev 17617)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c	2008-11-29 14:35:50 UTC (rev 17618)
@@ -868,7 +868,7 @@
 			memset(&iter->ptr, 0, sizeof(iter->ptr));
 	}
 	else
-		memset(&iter, 0, sizeof(*iter));
+		memset(iter, 0, sizeof(*iter));
 }
 
 void RNA_property_collection_next(CollectionPropertyIterator *iter)

Added: branches/blender2.5/blender/source/blender/makesrna/intern/rna_color.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_color.c	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_color.c	2008-11-29 14:35:50 UTC (rev 17618)
@@ -0,0 +1,50 @@
+/**
+ * $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 (2008).
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#include "DNA_color_types.h"
+
+#ifdef RNA_RUNTIME
+
+#else
+
+void RNA_def_color(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna= RNA_def_struct(brna, "CurveMapPoint", NULL, "CurveMapPoint");
+
+	srna= RNA_def_struct(brna, "CurveMap", NULL, "CurveMap");
+
+	srna= RNA_def_struct(brna, "CurveMapping", NULL, "CurveMapping");
+}
+
+#endif
+

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c	2008-11-29 13:57:19 UTC (rev 17617)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c	2008-11-29 14:35:50 UTC (rev 17618)
@@ -562,7 +562,7 @@
 
 void RNA_def_property_array(PropertyRNA *prop, int arraylength)
 {
-	StructRNA *srna;
+	StructRNA *srna= DefRNA.laststruct;
 
 	switch(prop->type) {
 		case PROP_BOOLEAN:
@@ -585,7 +585,7 @@
 
 void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
 {
-	StructRNA *srna;
+	StructRNA *srna= DefRNA.laststruct;
 
 	switch(prop->type) {
 		case PROP_INT: {
@@ -612,7 +612,7 @@
 
 void RNA_def_property_range(PropertyRNA *prop, double min, double max)
 {
-	StructRNA *srna;
+	StructRNA *srna= DefRNA.laststruct;
 
 	switch(prop->type) {
 		case PROP_INT: {
@@ -640,7 +640,7 @@
 
 void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
 {
-	StructRNA *srna;
+	StructRNA *srna= DefRNA.laststruct;
 
 	if(!DefRNA.preprocess) {
 		fprintf(stderr, "RNA_def_property_struct_type: only during preprocessing.\n");
@@ -667,7 +667,7 @@
 
 void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
 {
-	StructRNA *srna;
+	StructRNA *srna= DefRNA.laststruct;
 	int i;
 
 	switch(prop->type) {
@@ -689,7 +689,7 @@
 
 void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
 {
-	StructRNA *srna;
+	StructRNA *srna= DefRNA.laststruct;
 
 	switch(prop->type) {
 		case PROP_STRING: {
@@ -706,7 +706,7 @@
 
 void RNA_def_property_boolean_default(PropertyRNA *prop, int value)
 {
-	StructRNA *srna;
+	StructRNA *srna= DefRNA.laststruct;
 
 	switch(prop->type) {
 		case PROP_BOOLEAN: {
@@ -723,7 +723,7 @@
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list