* add beginning of Material RNA and Nodetree+Node RNA
authorNathan Letwory <nathan@letworyinteractive.com>
Thu, 27 Nov 2008 00:23:22 +0000 (00:23 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Thu, 27 Nov 2008 00:23:22 +0000 (00:23 +0000)
source/blender/makesdna/DNA_material_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_material.c [new file with mode: 0644]
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_nodetree.c [new file with mode: 0644]
source/blender/makesrna/intern/rna_scene.c

index aa8470505810d694e47165e35c8a69582e26a14f..706ee748585643189d6120ba4b2276f23516f5af 100644 (file)
@@ -41,7 +41,6 @@
 
 struct MTex;
 struct Ipo;
-struct Material;
 struct ColorBand;
 struct Group;
 struct bNodeTree;
index f3afaf1bb784ab26db9450e59b83082d2ecb0f6c..ac27e51bc9220a57441c0d01228484a5d071e6ce 100644 (file)
@@ -862,6 +862,8 @@ RNAProcessItem PROCESS_ITEMS[]= {
        {"rna_ID.c", RNA_def_ID},
        {"rna_main.c", RNA_def_main},
        {"rna_mesh.c", RNA_def_mesh},
+       {"rna_nodetree.c", RNA_def_nodetree},
+       {"rna_material.c", RNA_def_material},
        {"rna_object.c", RNA_def_object},
        {"rna_rna.c", RNA_def_rna},
        {"rna_scene.c", RNA_def_scene},
index e3ce6b9f3136f9bf4c5aea4e401ac48a6e02b379..bc92ae64b4c78e30bb5a30a5405397081256a21f 100644 (file)
@@ -85,6 +85,8 @@ void RNA_def_lamp(struct BlenderRNA *brna);
 void RNA_def_main(struct BlenderRNA *brna);
 void RNA_def_mesh(struct BlenderRNA *brna);
 void RNA_def_object(struct BlenderRNA *brna);
+void RNA_def_nodetree(struct BlenderRNA *brna);
+void RNA_def_material(struct BlenderRNA *brna);
 void RNA_def_rna(struct BlenderRNA *brna);
 void RNA_def_scene(struct BlenderRNA *brna);
 void RNA_def_wm(struct BlenderRNA *brna);
index 8e500ff2bd03a4a3c6d62576540f9cf5e505e6b5..82ee9c24bcc41c363cb8d9fc960fc886eb323fdf 100644 (file)
@@ -79,12 +79,16 @@ static void rna_Main_mball_begin(CollectionPropertyIterator *iter, PointerRNA *p
        rna_iterator_listbase_begin(iter, &bmain->mball, NULL);
 }
 
+#endif
+
 static void rna_Main_mat_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
        Main *bmain= (Main*)ptr->data;
        rna_iterator_listbase_begin(iter, &bmain->mat, NULL);
 }
 
+#if 0
+
 static void rna_Main_tex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
        Main *bmain= (Main*)ptr->data;
@@ -177,12 +181,16 @@ static void rna_Main_action_begin(CollectionPropertyIterator *iter, PointerRNA *
        rna_iterator_listbase_begin(iter, &bmain->action, NULL);
 }
 
+#endif
+
 static void rna_Main_nodetree_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
        Main *bmain= (Main*)ptr->data;
        rna_iterator_listbase_begin(iter, &bmain->nodetree, NULL);
 }
 
+#if 0
+
 static void rna_Main_brush_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
        Main *bmain= (Main*)ptr->data;
@@ -211,14 +219,15 @@ void RNA_def_main(BlenderRNA *brna)
        const char *lists[][5]= {
                {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks."},
                {"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks."},
+               {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks."},
+               {"nodetrees", "bNodeTree", "rna_Main_nodetree_begin", "Node Trees", "Nodetree datablocks."},
                {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks."}, 
                {"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks."},
                {"windowmanagers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks."},
                {NULL, NULL, NULL, NULL, NULL},
                {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks."},
                {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks."}, 
-               {"metaballs", "MBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks."}, 
-               {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks."},
+               {"metaballs", "MBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks."},
                {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks."},
                {"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks."},
                {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks."},
@@ -234,7 +243,6 @@ void RNA_def_main(BlenderRNA *brna)
                {"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks."},
                {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks."},
                {"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks."},
-               {"nodegroups", "NodeGroup", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks."},
                {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks."},
                {"particles", "Particle", "rna_Main_particle_begin", "Particles", "Particle datablocks."},
                {NULL, NULL, NULL, NULL, NULL}};
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
new file mode 100644 (file)
index 0000000..485b331
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * $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), Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_material_types.h"
+
+#ifdef RNA_RUNTIME
+
+#else
+
+void RNA_def_material(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       static EnumPropertyItem prop_type_items[] = {
+               {MA_RGB, "RGB", "RGB", ""},
+               {MA_CMYK, "CMYK", "CMYK", ""},
+               {MA_YUV, "YUV", "YUV", ""},
+               {MA_HSV, "HSV", "HSV", ""},
+               {0, NULL, NULL, NULL}};
+       
+       srna= RNA_def_struct(brna, "Material", "ID", "Material");
+               
+       prop= RNA_def_property(srna, "colormodel", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, prop_type_items);
+       RNA_def_property_ui_text(prop, "Color Model", "Color model.");
+       
+       prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+       RNA_def_property_float_sdna(prop, "Material", "r");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Color", "Diffuse color.");
+       RNA_def_property_ui_range(prop, 0.0f , 1.0f, 10.0f, 3.0f);
+       
+       prop= RNA_def_property(srna, "specular", PROP_FLOAT, PROP_COLOR);
+       RNA_def_property_float_sdna(prop, NULL, "specr");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Specular", "Specular color.");
+       RNA_def_property_ui_range(prop, 0.0f , 1.0f, 10.0f, 3.0f);
+
+       prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "bNodeTree");
+       RNA_def_property_ui_text(prop, "Nodetree", "Nodetree");
+
+}
+
+#endif
+
+
index 522641318bc22ce58c222896cb255fc8ee147cbe..851d1fc2ae8afdf17f087c5bccd16eb93377a6d0 100644 (file)
@@ -939,8 +939,8 @@ static void rna_def_mesh(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
-       RNA_def_property_struct_type(prop, "ID");
-       RNA_def_property_ui_text(prop, "Materials", "");
+       RNA_def_property_struct_type(prop, "Material");
+       RNA_def_property_ui_text(prop, "Materials", "Materials");
 
        /*prop= RNA_def_property(srna, "key", PROP_POINTER, PROP_NONE);
        RNA_def_property_ui_text(prop, "Key", "");*/
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
new file mode 100644 (file)
index 0000000..bef4ec4
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * $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), Nathan Letwory
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_node_types.h"
+
+#ifdef RNA_RUNTIME
+
+#else
+
+void RNA_def_nodetree(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       srna= RNA_def_struct(brna, "bNodeTree", "ID", "Node Tree");
+
+       prop= RNA_def_property(srna, "Nodes", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
+       RNA_def_property_struct_type(prop, "bNode");
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_ui_text(prop, "Nodes", "Nodes in the Node Tree.");
+       
+       srna= RNA_def_struct(brna, "bNode", NULL, "Node");
+       
+       prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR);
+       RNA_def_property_float_sdna(prop, NULL, "locx");
+       RNA_def_property_array(prop, 2);
+       RNA_def_property_range(prop, -1000.0f, 1000.0f);
+       RNA_def_property_ui_text(prop, "Location", "Node Location");
+
+}
+
+#endif
+
index 22ae54c63003319c20726667e7db877d74b9b19a..15f5622436b4b5a1552ce468427b6a16c414ed48 100644 (file)
@@ -140,6 +140,10 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "toolsettings->unwrapper", 0);
        RNA_def_property_enum_items(prop, unwrapper_items);
        RNA_def_property_ui_text(prop, "Unwrapper", "Unwrap algorithm used by the Unwrap tool.");
+       
+       prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "bNodeTree");
+       RNA_def_property_ui_text(prop, "Nodetree", "Nodetree");
 }
 
 #endif