Python API: remove object.dupli_list_create and dupli_list_clear.

Cycles is no longer using this. There are still addons using it but for
correct results with the new depsgraph this API should not be used.

Differential Revision: https://developer.blender.org/D3143
This commit is contained in:
2018-04-06 10:32:18 +02:00
parent f0a4c631bb
commit 5d7952d9c7
4 changed files with 0 additions and 110 deletions

View File

@@ -205,88 +205,6 @@ static Mesh *rna_Object_to_mesh(
return rna_Main_meshes_new_from_object(bmain, reports, sce, view_layer, ob, apply_modifiers, settings, calc_tessface, calc_undeformed);
}
/* mostly a copy from convertblender.c */
static void dupli_render_particle_set(EvaluationContext *eval_ctx, Scene *scene, Object *ob, int level, int enable)
{
/* ugly function, but we need to set particle systems to their render
* settings before calling object_duplilist, to get render level duplis */
Group *group;
GroupObject *go;
ParticleSystem *psys;
DerivedMesh *dm;
float mat[4][4];
unit_m4(mat);
if (level >= MAX_DUPLI_RECUR)
return;
if (ob->transflag & OB_DUPLIPARTS) {
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
if (ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
if (enable)
psys_render_set(ob, psys, mat, mat, 1, 1, 0.f);
else
psys_render_restore(ob, psys);
}
}
if (enable) {
/* this is to make sure we get render level duplis in groups:
* the derivedmesh must be created before init_render_mesh,
* since object_duplilist does dupliparticles before that */
dm = mesh_create_derived_render(eval_ctx, scene, ob, CD_MASK_BAREMESH | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL);
dm->release(dm);
for (psys = ob->particlesystem.first; psys; psys = psys->next)
psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
}
}
if (ob->dup_group == NULL) return;
group = ob->dup_group;
for (go = group->gobject.first; go; go = go->next)
dupli_render_particle_set(eval_ctx, scene, go->ob, level + 1, enable);
}
/* When no longer needed, duplilist should be freed with Object.free_duplilist */
static void rna_Object_create_duplilist(Object *ob, bContext *C, ReportList *reports, Scene *sce, int settings)
{
bool for_render = (settings == DAG_EVAL_RENDER);
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
eval_ctx.mode = settings;
if (!(ob->transflag & OB_DUPLI)) {
BKE_report(reports, RPT_ERROR, "Object does not have duplis");
return;
}
/* free duplilist if a user forgets to */
if (ob->duplilist) {
BKE_report(reports, RPT_WARNING, "Object.dupli_list has not been freed");
free_object_duplilist(ob->duplilist);
ob->duplilist = NULL;
}
if (for_render)
dupli_render_particle_set(&eval_ctx, sce, ob, 0, 1);
ob->duplilist = object_duplilist(&eval_ctx, sce, ob);
if (for_render)
dupli_render_particle_set(&eval_ctx, sce, ob, 0, 0);
/* ob->duplilist should now be freed with Object.free_duplilist */
}
static void rna_Object_free_duplilist(Object *ob)
{
if (ob->duplilist) {
free_object_duplilist(ob->duplilist);
ob->duplilist = NULL;
}
}
static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports,
const char *name, int from_mix)
{
@@ -542,13 +460,6 @@ void RNA_api_object(StructRNA *srna)
{0, NULL, 0, NULL, NULL}
};
static const EnumPropertyItem dupli_eval_mode_items[] = {
{DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Generate duplis using viewport settings"},
{DAG_EVAL_PREVIEW, "PREVIEW", 0, "Preview", "Generate duplis using preview settings"},
{DAG_EVAL_RENDER, "RENDER", 0, "Render", "Generate duplis using render settings"},
{0, NULL, 0, NULL, NULL}
};
#ifndef NDEBUG
static const EnumPropertyItem mesh_dm_info_items[] = {
{0, "SOURCE", 0, "Source", "Source mesh"},
@@ -650,19 +561,6 @@ void RNA_api_object(StructRNA *srna)
"Mesh created from object, remove it if it is only used for export");
RNA_def_function_return(func, parm);
/* duplis */
func = RNA_def_function(srna, "dupli_list_create", "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 to restore the "
"objects real matrix and layers");
parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
RNA_def_enum(func, "settings", dupli_eval_mode_items, 0, "", "Generate texture coordinates for rendering");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist");
RNA_def_function_ui_description(func, "Free the list of dupli objects");
/* Armature */
func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature");
RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier");