Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_scene_api.c
| Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subframe) | ||||
| CLAMP(cfra, MINAFRAME, MAXFRAME); | CLAMP(cfra, MINAFRAME, MAXFRAME); | ||||
| BKE_scene_frame_set(scene, cfra); | BKE_scene_frame_set(scene, cfra); | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| BPy_BEGIN_ALLOW_THREADS; | BPy_BEGIN_ALLOW_THREADS; | ||||
| #endif | #endif | ||||
| for (SceneLayer *scene_layer = scene->render_layers.first; | for (ViewLayer *view_layer = scene->view_layers.first; | ||||
| scene_layer != NULL; | view_layer != NULL; | ||||
| scene_layer = scene_layer->next) | view_layer = view_layer->next) | ||||
| { | { | ||||
| Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, scene_layer, true); | Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); | ||||
| BKE_scene_graph_update_for_newframe(bmain->eval_ctx, | BKE_scene_graph_update_for_newframe(bmain->eval_ctx, | ||||
| depsgraph, | depsgraph, | ||||
| bmain, | bmain, | ||||
| scene, | scene, | ||||
| scene_layer); | view_layer); | ||||
| } | } | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| BPy_END_ALLOW_THREADS; | BPy_END_ALLOW_THREADS; | ||||
| #endif | #endif | ||||
| BKE_scene_camera_switch_update(scene); | BKE_scene_camera_switch_update(scene); | ||||
| Show All 24 Lines | |||||
| } | } | ||||
| static void rna_Scene_update_tagged(Scene *scene, Main *bmain) | static void rna_Scene_update_tagged(Scene *scene, Main *bmain) | ||||
| { | { | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| BPy_BEGIN_ALLOW_THREADS; | BPy_BEGIN_ALLOW_THREADS; | ||||
| #endif | #endif | ||||
| for (SceneLayer *scene_layer = scene->render_layers.first; | for (ViewLayer *view_layer = scene->view_layers.first; | ||||
| scene_layer != NULL; | view_layer != NULL; | ||||
| scene_layer = scene_layer->next) | view_layer = view_layer->next) | ||||
| { | { | ||||
| Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, scene_layer, true); | Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); | ||||
| BKE_scene_graph_update_tagged(bmain->eval_ctx, | BKE_scene_graph_update_tagged(bmain->eval_ctx, | ||||
| depsgraph, | depsgraph, | ||||
| bmain, | bmain, | ||||
| scene, | scene, | ||||
| scene_layer); | view_layer); | ||||
| } | } | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| BPy_END_ALLOW_THREADS; | BPy_END_ALLOW_THREADS; | ||||
| #endif | #endif | ||||
| } | } | ||||
| static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int preview, const char *view, char *name) | static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int preview, const char *view, char *name) | ||||
| Show All 10 Lines | static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int preview, const char *view, char *name) | ||||
| else { | else { | ||||
| BKE_image_path_from_imformat( | BKE_image_path_from_imformat( | ||||
| name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, | name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, | ||||
| &rd->im_format, (rd->scemode & R_EXTENSION) != 0, true, suffix); | &rd->im_format, (rd->scemode & R_EXTENSION) != 0, true, suffix); | ||||
| } | } | ||||
| } | } | ||||
| static void rna_Scene_ray_cast( | static void rna_Scene_ray_cast( | ||||
| Scene *scene, SceneLayer *scene_layer, const char *engine_id, | Scene *scene, ViewLayer *view_layer, const char *engine_id, | ||||
| float origin[3], float direction[3], float ray_dist, | float origin[3], float direction[3], float ray_dist, | ||||
| int *r_success, float r_location[3], float r_normal[3], int *r_index, | int *r_success, float r_location[3], float r_normal[3], int *r_index, | ||||
| Object **r_ob, float r_obmat[16]) | Object **r_ob, float r_obmat[16]) | ||||
| { | { | ||||
| RenderEngineType *engine; | RenderEngineType *engine; | ||||
| if (engine_id == NULL || engine_id[0] == '\0') { | if (engine_id == NULL || engine_id[0] == '\0') { | ||||
| engine = RE_engines_find(scene->view_render.engine_id); | engine = RE_engines_find(scene->view_render.engine_id); | ||||
| } | } | ||||
| else { | else { | ||||
| engine = RE_engines_find(engine_id); | engine = RE_engines_find(engine_id); | ||||
| } | } | ||||
| normalize_v3(direction); | normalize_v3(direction); | ||||
| SnapObjectContext *sctx = ED_transform_snap_object_context_create( | SnapObjectContext *sctx = ED_transform_snap_object_context_create( | ||||
| G.main, scene, scene_layer, engine, 0); | G.main, scene, view_layer, engine, 0); | ||||
| bool ret = ED_transform_snap_object_project_ray_ex( | bool ret = ED_transform_snap_object_project_ray_ex( | ||||
| sctx, | sctx, | ||||
| &(const struct SnapObjectParams){ | &(const struct SnapObjectParams){ | ||||
| .snap_select = SNAP_ALL, | .snap_select = SNAP_ALL, | ||||
| }, | }, | ||||
| origin, direction, &ray_dist, | origin, direction, &ray_dist, | ||||
| r_location, r_normal, r_index, | r_location, r_normal, r_index, | ||||
| ▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | static void rna_Scene_collada_export( | ||||
| int keep_bind_info) | int keep_bind_info) | ||||
| { | { | ||||
| EvaluationContext eval_ctx; | EvaluationContext eval_ctx; | ||||
| CTX_data_eval_ctx(C, &eval_ctx); | CTX_data_eval_ctx(C, &eval_ctx); | ||||
| collada_export(&eval_ctx, | collada_export(&eval_ctx, | ||||
| scene, | scene, | ||||
| CTX_data_scene_layer(C), | CTX_data_view_layer(C), | ||||
| filepath, | filepath, | ||||
| apply_modifiers, | apply_modifiers, | ||||
| export_mesh_type, | export_mesh_type, | ||||
| selected, | selected, | ||||
| include_children, | include_children, | ||||
| include_armatures, | include_armatures, | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | void RNA_api_scene(StructRNA *srna) | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_float_vector(func, "result", 2, NULL, 0.0f, FLT_MAX, "", "aspect", 0.0f, FLT_MAX); | parm = RNA_def_float_vector(func, "result", 2, NULL, 0.0f, FLT_MAX, "", "aspect", 0.0f, FLT_MAX); | ||||
| RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); | RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); | ||||
| RNA_def_function_output(func, parm); | RNA_def_function_output(func, parm); | ||||
| /* Ray Cast */ | /* Ray Cast */ | ||||
| func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast"); | func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast"); | ||||
| RNA_def_function_ui_description(func, "Cast a ray onto in object space"); | RNA_def_function_ui_description(func, "Cast a ray onto in object space"); | ||||
| parm = RNA_def_pointer(func, "scene_layer", "SceneLayer", "", "Scene Layer"); | parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Scene Layer"); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_string(func, "engine", NULL, MAX_NAME, "Engine", "Render engine, use scene one by default"); | parm = RNA_def_string(func, "engine", NULL, MAX_NAME, "Engine", "Render engine, use scene one by default"); | ||||
| /* ray start and end */ | /* ray start and end */ | ||||
| parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); | parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); | parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX, | RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX, | ||||
| ▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines | |||||