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:
authorArystanbek Dyussenov <arystan.d@gmail.com>2009-08-13 15:14:06 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2009-08-13 15:14:06 +0400
commit44ddff5c516058a73f0297a94845b2e835307d2f (patch)
tree5e0303f5b6a3eb6becbaac86462cca563c3ad52a /source/blender
parent6a056e4717c6f194aaac5dabe5c6bc6c8e32006e (diff)
- 3ds importer working (without the "scale to size" option)
- changing object.matrix now updates object.loc/rot/scale - added bpy.data.add_lamp()
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c27
-rw-r--r--source/blender/makesrna/intern/rna_material_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c6
-rw-r--r--source/blender/makesrna/intern/rna_object.c7
4 files changed, 38 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 17f3800e10e..9d42c473f50 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -44,6 +44,9 @@
#include "BKE_object.h"
#include "BKE_material.h"
#include "BKE_image.h"
+#include "BKE_texture.h"
+
+#include "DNA_lamp_types.h"
static Mesh *rna_Main_add_mesh(Main *main, char *name)
{
@@ -62,6 +65,23 @@ static void rna_Main_remove_mesh(Main *main, ReportList *reports, Mesh *me)
/* XXX python now has invalid pointer? */
}
+static Lamp *rna_Main_add_lamp(Main *main, char *name)
+{
+ Lamp *la= add_lamp(name);
+ la->id.us--;
+ return la;
+}
+
+/*
+static void rna_Main_remove_lamp(Main *main, ReportList *reports, Lamp *la)
+{
+ if(la->id.us == 0)
+ free_libblock(&main->lamp, la);
+ else
+ BKE_report(reports, RPT_ERROR, "Lamp must have zero users to be removed.");
+}
+*/
+
static Object* rna_Main_add_object(Main *main, int type, char *name)
{
Object *ob= add_only_object(type, name);
@@ -158,6 +178,13 @@ void RNA_api_main(StructRNA *srna)
parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove.");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ func= RNA_def_function(srna, "add_lamp", "rna_Main_add_lamp");
+ RNA_def_function_ui_description(func, "Add a new lamp.");
+ parm= RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "mesh", "Lamp", "", "New lamp.");
+ RNA_def_function_return(func, parm);
+
func= RNA_def_function(srna, "add_material", "rna_Main_add_material");
RNA_def_function_ui_description(func, "Add a new material.");
parm= RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock."); /* optional */
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index e2b47460fdb..aa28b6b923c 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -101,7 +101,7 @@ void RNA_api_material(StructRNA *srna)
static EnumPropertyItem prop_texture_mapto_items[] = {
{MAP_COL, "COLOR", 0, "Color", "Causes the texture to affect basic color of the material"},
{MAP_NORM, "NORMAL", 0, "Normal", "Causes the texture to affect the rendered normal"},
- {MAP_COLSPEC, "SPEC_COLOR", 0, "Specularity Color", "Causes the texture to affect the specularity color"},
+ {MAP_COLSPEC, "SPECULAR_COLOR", 0, "Specularity Color", "Causes the texture to affect the specularity color"},
{MAP_COLMIR, "MIRROR", 0, "Mirror", "Causes the texture to affect the mirror color"},
{MAP_REF, "REFLECTION", 0, "Reflection", "Causes the texture to affect the value of the materials reflectivity"},
{MAP_SPEC, "SPECULARITY", 0, "Specularity", "Causes the texture to affect the value of specularity"},
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index b50cc678f4f..9d4dad1fb5b 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -248,7 +248,7 @@ static void rna_Mesh_add_geometry(Mesh *mesh, int verts, int edges, int faces)
rna_Mesh_add_faces(mesh, faces);
}
-static void rna_Mesh_add_uv_layer(Mesh *me)
+static void rna_Mesh_add_uv_texture(Mesh *me)
{
me->mtface= CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface);
}
@@ -306,8 +306,8 @@ void RNA_api_mesh(StructRNA *srna)
parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh, remove it if it is only used for export.");
RNA_def_function_return(func, parm);
- func= RNA_def_function(srna, "add_uv_layer", "rna_Mesh_add_uv_layer");
- RNA_def_function_ui_description(func, "Add new UV layer to Mesh.");
+ func= RNA_def_function(srna, "add_uv_texture", "rna_Mesh_add_uv_texture");
+ RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
func= RNA_def_function(srna, "calc_normals", "rna_Mesh_calc_normals");
RNA_def_function_ui_description(func, "Calculate vertex normals.");
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 6fe254dcb68..32307709387 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -74,6 +74,12 @@ void rna_Object_update(bContext *C, PointerRNA *ptr)
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
}
+void rna_Object_matrix_update(bContext *C, PointerRNA *ptr)
+{
+ ED_object_apply_obmat(ptr->id.data);
+ rna_Object_update(C, ptr);
+}
+
void rna_Object_update_data(bContext *C, PointerRNA *ptr)
{
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA);
@@ -1101,6 +1107,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "obmat");
RNA_def_property_array(prop, 16);
RNA_def_property_ui_text(prop, "Matrix", "Transformation matrix.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_matrix_update");
/* collections */
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);