diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2008-11-27 03:23:22 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2008-11-27 03:23:22 +0300 |
commit | 651a94886e09f8f6abac478a14fc295b5ffa4d0e (patch) | |
tree | f0ba2865dec0acad238288738267b2f136c232de /source/blender/makesrna | |
parent | 2fdc41ccf49f0b2f574ba1916cd0ee1a145d53f3 (diff) |
* add beginning of Material RNA and Nodetree+Node RNA
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 76 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 62 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 4 |
7 files changed, 159 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index f3afaf1bb78..ac27e51bc92 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -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}, diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index e3ce6b9f313..bc92ae64b4c 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -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); diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 8e500ff2bd0..82ee9c24bcc 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -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 index 00000000000..485b331195c --- /dev/null +++ b/source/blender/makesrna/intern/rna_material.c @@ -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 + + diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 522641318bc..851d1fc2ae8 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -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 index 00000000000..bef4ec42009 --- /dev/null +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -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 + diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 22ae54c6300..15f5622436b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -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 |