Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_scene_api.c
| Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | BKE_image_path_from_imformat(name, | ||||
| &rd->im_format, | &rd->im_format, | ||||
| (rd->scemode & R_EXTENSION) != 0, | (rd->scemode & R_EXTENSION) != 0, | ||||
| true, | true, | ||||
| suffix); | suffix); | ||||
| } | } | ||||
| } | } | ||||
| static void rna_Scene_ray_cast(Scene *scene, | static void rna_Scene_ray_cast(Scene *scene, | ||||
| Main *bmain, | Depsgraph *depsgraph, | ||||
| ViewLayer *view_layer, | |||||
| float origin[3], | float origin[3], | ||||
| float direction[3], | float direction[3], | ||||
| float ray_dist, | float ray_dist, | ||||
| bool *r_success, | bool *r_success, | ||||
| float r_location[3], | float r_location[3], | ||||
| float r_normal[3], | float r_normal[3], | ||||
| int *r_index, | int *r_index, | ||||
| Object **r_ob, | Object **r_ob, | ||||
| float r_obmat[16]) | float r_obmat[16]) | ||||
| { | { | ||||
| normalize_v3(direction); | normalize_v3(direction); | ||||
| Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); | |||||
| SnapObjectContext *sctx = ED_transform_snap_object_context_create(scene, 0); | SnapObjectContext *sctx = ED_transform_snap_object_context_create(scene, 0); | ||||
| bool ret = ED_transform_snap_object_project_ray_ex(sctx, | bool ret = ED_transform_snap_object_project_ray_ex(sctx, | ||||
| depsgraph, | depsgraph, | ||||
| &(const struct SnapObjectParams){ | &(const struct SnapObjectParams){ | ||||
| .snap_select = SNAP_ALL, | .snap_select = SNAP_ALL, | ||||
| }, | }, | ||||
| origin, | origin, | ||||
| ▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | void RNA_api_scene(StructRNA *srna) | ||||
| parm = RNA_def_pointer(func, "object", "Object", "", "Object"); | parm = RNA_def_pointer(func, "object", "Object", "", "Object"); | ||||
| 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_flag(func, FUNC_USE_MAIN); | |||||
| 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, "view_layer", "ViewLayer", "", "Scene Layer"); | |||||
| parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "The current dependency graph"); | |||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* 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, | RNA_def_float(func, | ||||
| "distance", | "distance", | ||||
| ▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines | |||||