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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 27a88006b40..8efc0bb3e45 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -70,14 +70,13 @@
/* copied from Mesh_getFromObject and adapted to RNA interface */
/* settings: 0 - preview, 1 - render */
-static Mesh *rna_Object_create_mesh(Object *ob, bContext *C, ReportList *reports, int apply_modifiers, int settings)
+static Mesh *rna_Object_create_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings)
{
Mesh *tmpmesh;
Curve *tmpcu = NULL;
Object *tmpobj = NULL;
int render = settings, i;
int cage = !apply_modifiers;
- Scene *sce = CTX_data_scene(C);
/* perform the mesh extraction based on type */
switch (ob->type) {
@@ -115,7 +114,7 @@ static Mesh *rna_Object_create_mesh(Object *ob, bContext *C, ReportList *reports
/* nurbs_to_mesh changes the type to a mesh, check it worked */
if (tmpobj->type != OB_MESH) {
- free_libblock_us( &(CTX_data_main(C)->object), tmpobj );
+ free_libblock_us( &(G.main->object), tmpobj );
BKE_report(reports, RPT_ERROR, "cant convert curve to mesh. Does the curve have any segments?");
return NULL;
}
@@ -233,7 +232,7 @@ static Mesh *rna_Object_create_mesh(Object *ob, bContext *C, ReportList *reports
}
/* When no longer needed, duplilist should be freed with Object.free_duplilist */
-static void rna_Object_create_duplilist(Object *ob, bContext *C, ReportList *reports)
+static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce)
{
if (!(ob->transflag & OB_DUPLI)) {
BKE_report(reports, RPT_ERROR, "Object does not have duplis.");
@@ -248,7 +247,7 @@ static void rna_Object_create_duplilist(Object *ob, bContext *C, ReportList *rep
ob->duplilist= NULL;
}
- ob->duplilist= object_duplilist(CTX_data_scene(C), ob);
+ ob->duplilist= object_duplilist(sce, ob);
/* ob->duplilist should now be freed with Object.free_duplilist */
}
@@ -273,10 +272,8 @@ static void rna_Object_add_vertex_to_group(Object *ob, int vertex_index, bDeform
}
/* copied from old API Object.makeDisplayList (Object.c) */
-static void rna_Object_make_display_list(Object *ob, bContext *C)
+static void rna_Object_make_display_list(Object *ob, Scene *sce)
{
- Scene *sce= CTX_data_scene(C);
-
if (ob->type == OB_FONT) {
Curve *cu = ob->data;
freedisplist(&cu->disp);
@@ -328,9 +325,9 @@ static PointerRNA rna_Object_add_shape_key(Object *ob, bContext *C, ReportList *
}
}
-int rna_Object_is_visible(Object *ob, bContext *C)
+int rna_Object_is_visible(Object *ob, Scene *sce)
{
- return !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->lay & CTX_data_scene(C)->lay;
+ return !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->lay & sce->lay;
}
/*
@@ -431,7 +428,9 @@ void RNA_api_object(StructRNA *srna)
/* mesh */
func= RNA_def_function(srna, "create_mesh", "rna_Object_create_mesh");
RNA_def_function_ui_description(func, "Create a Mesh datablock with modifiers applied.");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
parm= RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply.");
@@ -442,7 +441,9 @@ void RNA_api_object(StructRNA *srna)
/* duplis */
func= RNA_def_function(srna, "create_dupli_list", "rna_Object_create_duplilist");
RNA_def_function_ui_description(func, "Create a list of dupli objects for this object, needs to be freed manually with free_dupli_list.");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
func= RNA_def_function(srna, "free_dupli_list", "rna_Object_free_duplilist");
RNA_def_function_ui_description(func, "Free the list of dupli objects.");
@@ -508,12 +509,14 @@ void RNA_api_object(StructRNA *srna)
/* DAG */
func= RNA_def_function(srna, "make_display_list", "rna_Object_make_display_list");
RNA_def_function_ui_description(func, "Update object's display data."); /* XXX describe better */
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm= RNA_def_pointer(func, "scene", "Scene", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
/* View */
func= RNA_def_function(srna, "is_visible", "rna_Object_is_visible");
- RNA_def_function_ui_description(func, "Determine if object is visible in active scene.");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Determine if object is visible in a given scene.");
+ parm= RNA_def_pointer(func, "scene", "Scene", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
parm= RNA_def_boolean(func, "is_visible", 0, "", "Object visibility.");
RNA_def_function_return(func, parm);
}