Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_object_api.c
| Show All 36 Lines | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "BKE_depsgraph.h" | |||||
| #include "rna_internal.h" /* own include */ | #include "rna_internal.h" /* own include */ | ||||
| static EnumPropertyItem space_items[] = { | static EnumPropertyItem space_items[] = { | ||||
| {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", | {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", | ||||
| "The most gobal space in Blender"}, | "The most gobal space in Blender"}, | ||||
| {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space", | {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space", | ||||
| "The pose space of a bone (its armature's object space)"}, | "The pose space of a bone (its armature's object space)"}, | ||||
| {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent", | {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent", | ||||
| "The local space of a bone's parent bone"}, | "The local space of a bone's parent bone"}, | ||||
| {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", | {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", | ||||
| "The local space of an object/bone"}, | "The local space of an object/bone"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| #ifdef RNA_RUNTIME | #ifdef RNA_RUNTIME | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BKE_anim.h" | #include "BKE_anim.h" | ||||
| #include "BKE_bvhutils.h" | #include "BKE_bvhutils.h" | ||||
| #include "BKE_cdderivedmesh.h" | #include "BKE_cdderivedmesh.h" | ||||
| #include "BKE_constraint.h" | #include "BKE_constraint.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_customdata.h" | #include "BKE_customdata.h" | ||||
| #include "BKE_depsgraph.h" | |||||
| #include "BKE_font.h" | #include "BKE_font.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_mball.h" | #include "BKE_mball.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int enable) | ||||
| group = ob->dup_group; | group = ob->dup_group; | ||||
| for (go = group->gobject.first; go; go = go->next) | for (go = group->gobject.first; go; go = go->next) | ||||
| dupli_render_particle_set(scene, go->ob, level + 1, enable); | dupli_render_particle_set(scene, go->ob, level + 1, enable); | ||||
| } | } | ||||
| /* When no longer needed, duplilist should be freed with Object.free_duplilist */ | /* When no longer needed, duplilist should be freed with Object.free_duplilist */ | ||||
| static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, int settings) | static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, int settings) | ||||
| { | { | ||||
| int for_render = settings == eModifierMode_Render; | bool for_render = (settings == DAG_EVAL_RENDER); | ||||
| EvaluationContext eval_ctx = {0}; | EvaluationContext eval_ctx = {0}; | ||||
| eval_ctx.for_render = for_render; | eval_ctx.mode = settings; | ||||
| if (!(ob->transflag & OB_DUPLI)) { | if (!(ob->transflag & OB_DUPLI)) { | ||||
| BKE_report(reports, RPT_ERROR, "Object does not have duplis"); | BKE_report(reports, RPT_ERROR, "Object does not have duplis"); | ||||
| return; | return; | ||||
| } | } | ||||
| /* free duplilist if a user forgets to */ | /* free duplilist if a user forgets to */ | ||||
| if (ob->duplilist) { | if (ob->duplilist) { | ||||
| ▲ Show 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | void RNA_api_object(StructRNA *srna) | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| static EnumPropertyItem mesh_type_items[] = { | static EnumPropertyItem mesh_type_items[] = { | ||||
| {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, | {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, | ||||
| {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, | {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| static 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 | #ifndef NDEBUG | ||||
| static EnumPropertyItem mesh_dm_info_items[] = { | static EnumPropertyItem mesh_dm_info_items[] = { | ||||
| {0, "SOURCE", 0, "Source", "Source mesh"}, | {0, "SOURCE", 0, "Source", "Source mesh"}, | ||||
| {1, "DEFORM", 0, "Deform", "Objects deform mesh"}, | {1, "DEFORM", 0, "Deform", "Objects deform mesh"}, | ||||
| {2, "FINAL", 0, "Final", "Objects final mesh"}, | {2, "FINAL", 0, "Final", "Objects final mesh"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| #endif | #endif | ||||
| Show All 35 Lines | #endif | ||||
| /* duplis */ | /* duplis */ | ||||
| func = RNA_def_function(srna, "dupli_list_create", "rna_Object_create_duplilist"); | 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 " | 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 " | "be freed manually with free_dupli_list to restore the " | ||||
| "objects real matrix and layers"); | "objects real matrix and layers"); | ||||
| parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis"); | 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_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | ||||
| RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Generate texture coordinates for rendering"); | RNA_def_enum(func, "settings", dupli_eval_mode_items, 0, "", "Generate texture coordinates for rendering"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist"); | func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist"); | ||||
| RNA_def_function_ui_description(func, "Free the list of dupli objects"); | RNA_def_function_ui_description(func, "Free the list of dupli objects"); | ||||
| /* Armature */ | /* Armature */ | ||||
| func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature"); | 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"); | RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier"); | ||||
| ▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines | |||||