Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_scene_api.c
| Show First 20 Lines • Show All 145 Lines • ▼ Show 20 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 *sl, float origin[3], float direction[3], float ray_dist, | Scene *scene, SceneLayer *scene_layer, const char *engine_id, | ||||
| 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; | |||||
| if (engine_id == NULL || engine_id[0] == '\0') { | |||||
| engine = RE_engines_find(scene->view_render.engine_id); | |||||
| } | |||||
| else { | |||||
| 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, sl, 0); | G.main, scene, scene_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 179 Lines • ▼ Show 20 Lines | void RNA_api_scene(StructRNA *srna) | ||||
| 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, "scene_layer", "SceneLayer", "", "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"); | |||||
| /* 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, | ||||
| "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX); | "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX); | ||||
| /* return location and normal */ | /* return location and normal */ | ||||
| ▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines | |||||