Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_main_api.c
| Show First 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | static Mesh *rna_Main_meshes_new(Main *bmain, const char *name) | ||||
| Mesh *me = BKE_mesh_add(bmain, safe_name); | Mesh *me = BKE_mesh_add(bmain, safe_name); | ||||
| id_us_min(&me->id); | id_us_min(&me->id); | ||||
| return me; | return me; | ||||
| } | } | ||||
| /* copied from Mesh_getFromObject and adapted to RNA interface */ | /* copied from Mesh_getFromObject and adapted to RNA interface */ | ||||
| /* settings: 1 - preview, 2 - render */ | /* settings: 1 - preview, 2 - render */ | ||||
| Mesh *rna_Main_meshes_new_from_object( | Mesh *rna_Main_meshes_new_from_object( | ||||
| Main *bmain, ReportList *reports, Scene *sce, SceneLayer *scene_layer, | Main *bmain, ReportList *reports, Scene *sce, ViewLayer *view_layer, | ||||
| Object *ob, int apply_modifiers, int settings, int calc_tessface, int calc_undeformed) | Object *ob, int apply_modifiers, int settings, int calc_tessface, int calc_undeformed) | ||||
| { | { | ||||
| EvaluationContext eval_ctx; | EvaluationContext eval_ctx; | ||||
| /* XXX: This should never happen, but render pipeline is not ready to give | /* XXX: This should never happen, but render pipeline is not ready to give | ||||
| * proper scene_layer, and will always pass NULL here. For until we port | * proper view_layer, and will always pass NULL here. For until we port | ||||
| * pipeline form SceneRenderLayer to SceneLayer we have this stub to prevent | * pipeline form SceneRenderLayer to ViewLayer we have this stub to prevent | ||||
| * some obvious crashes. | * some obvious crashes. | ||||
| * - sergey - | * - sergey - | ||||
| */ | */ | ||||
| if (scene_layer == NULL) { | if (view_layer == NULL) { | ||||
| scene_layer = sce->render_layers.first; | view_layer = sce->view_layers.first; | ||||
| } | } | ||||
| DEG_evaluation_context_init(&eval_ctx, settings); | DEG_evaluation_context_init(&eval_ctx, settings); | ||||
| eval_ctx.ctime = (float)sce->r.cfra + sce->r.subframe; | eval_ctx.ctime = (float)sce->r.cfra + sce->r.subframe; | ||||
| eval_ctx.scene_layer = scene_layer; | eval_ctx.view_layer = view_layer; | ||||
| eval_ctx.depsgraph = BKE_scene_get_depsgraph(sce, scene_layer, false); | eval_ctx.depsgraph = BKE_scene_get_depsgraph(sce, view_layer, false); | ||||
| switch (ob->type) { | switch (ob->type) { | ||||
| case OB_FONT: | case OB_FONT: | ||||
| case OB_CURVE: | case OB_CURVE: | ||||
| case OB_SURF: | case OB_SURF: | ||||
| case OB_MBALL: | case OB_MBALL: | ||||
| case OB_MESH: | case OB_MESH: | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 582 Lines • ▼ Show 20 Lines | void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh data-block"); | parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh data-block"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "new_from_object", "rna_Main_meshes_new_from_object"); | func = RNA_def_function(srna, "new_from_object", "rna_Main_meshes_new_from_object"); | ||||
| RNA_def_function_ui_description(func, "Add a new mesh created from object with modifiers applied"); | RNA_def_function_ui_description(func, "Add a new mesh created from object with modifiers applied"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers"); | parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers"); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "scene_layer", "SceneLayer", "", "Scene layer within which to evaluate modifiers"); | parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Scene layer within which to evaluate modifiers"); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from"); | parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from"); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers"); | parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers"); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); | parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces"); | RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces"); | ||||
| ▲ Show 20 Lines • Show All 1,105 Lines • Show Last 20 Lines | |||||