Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-09-03 11:25:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-03 11:25:37 +0400
commitd0c54d3d0e77f0ed6b73ed5c3ac100ebd5e58660 (patch)
treee20fc4af058ed1a1dd48f0c8100c32988769b1a4 /source/blender/makesrna/intern/rna_ID.c
parent870469ec0e49f47b61fe9bda27c4b11fdd955d6b (diff)
use set as a suffix (matches operators)
- set_frame() --> frame_set() - set_context_pointer() --> context_pointer_set() material adding works for curves and metaballs, new function to remove materials. materials.link() didnt well fit how this is used elsewhere - order matters - it can be linked more than once. - remove(material), isnt that useful since you need to manage indicies. ... use list style functions instead. materials.append(mat) / materials.pop(index)
Diffstat (limited to 'source/blender/makesrna/intern/rna_ID.c')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index a8b7fb1540b..b9ef92cdca1 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -71,6 +71,7 @@ EnumPropertyItem id_type_items[] = {
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_animsys.h"
+#include "BKE_material.h"
/* name functions that ignore the first two ID characters */
void rna_ID_name_get(PointerRNA *ptr, char *value)
@@ -331,6 +332,31 @@ static void rna_def_ID_properties(BlenderRNA *brna)
RNA_def_struct_name_property(srna, prop);
}
+
+static void rna_def_ID_materials(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* for mesh/mball/curve materials */
+ srna= RNA_def_struct(brna, "IDMaterials", NULL);
+ RNA_def_struct_sdna(srna, "ID");
+ RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
+
+ func= RNA_def_function(srna, "append", "material_append_id");
+ RNA_def_function_ui_description(func, "Add a new material to Mesh.");
+ parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "pop", "material_pop_id");
+ RNA_def_function_ui_description(func, "Add a new material to Mesh.");
+ parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Frame number to set.", 0, INT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
+ RNA_def_function_return(func, parm);
+}
+
static void rna_def_ID(BlenderRNA *brna)
{
StructRNA *srna;
@@ -422,6 +448,7 @@ void RNA_def_ID(BlenderRNA *brna)
rna_def_ID(brna);
rna_def_ID_properties(brna);
+ rna_def_ID_materials(brna);
rna_def_library(brna);
}