Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_render.c
| Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | static void engine_render(RenderEngine *engine, struct Scene *scene) | ||||
| RNA_parameter_set_lookup(&list, "scene", &scene); | RNA_parameter_set_lookup(&list, "scene", &scene); | ||||
| engine->type->ext.call(NULL, &ptr, func, &list); | engine->type->ext.call(NULL, &ptr, func, &list); | ||||
| RNA_parameter_list_free(&list); | RNA_parameter_list_free(&list); | ||||
| } | } | ||||
| static void engine_bake(RenderEngine *engine, struct Scene *scene, | static void engine_bake(RenderEngine *engine, struct Scene *scene, | ||||
| struct Object *object, const int pass_type, const int pass_filter, | struct Object *object, const int pass_type, const int pass_filter, | ||||
| const int object_id, const struct BakePixel *pixel_array, | const int width, const int height) | ||||
| const int num_pixels, const int depth, void *result) | |||||
| { | { | ||||
| extern FunctionRNA rna_RenderEngine_bake_func; | extern FunctionRNA rna_RenderEngine_bake_func; | ||||
| PointerRNA ptr; | PointerRNA ptr; | ||||
| ParameterList list; | ParameterList list; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); | RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); | ||||
| func = &rna_RenderEngine_bake_func; | func = &rna_RenderEngine_bake_func; | ||||
| RNA_parameter_list_create(&list, &ptr, func); | RNA_parameter_list_create(&list, &ptr, func); | ||||
| RNA_parameter_set_lookup(&list, "scene", &scene); | RNA_parameter_set_lookup(&list, "scene", &scene); | ||||
| RNA_parameter_set_lookup(&list, "object", &object); | RNA_parameter_set_lookup(&list, "object", &object); | ||||
| RNA_parameter_set_lookup(&list, "pass_type", &pass_type); | RNA_parameter_set_lookup(&list, "pass_type", &pass_type); | ||||
| RNA_parameter_set_lookup(&list, "pass_filter", &pass_filter); | RNA_parameter_set_lookup(&list, "pass_filter", &pass_filter); | ||||
| RNA_parameter_set_lookup(&list, "object_id", &object_id); | RNA_parameter_set_lookup(&list, "width", &width); | ||||
| RNA_parameter_set_lookup(&list, "pixel_array", &pixel_array); | RNA_parameter_set_lookup(&list, "height", &height); | ||||
| RNA_parameter_set_lookup(&list, "num_pixels", &num_pixels); | |||||
| RNA_parameter_set_lookup(&list, "depth", &depth); | |||||
| RNA_parameter_set_lookup(&list, "result", &result); | |||||
| engine->type->ext.call(NULL, &ptr, func, &list); | engine->type->ext.call(NULL, &ptr, func, &list); | ||||
| RNA_parameter_list_free(&list); | RNA_parameter_list_free(&list); | ||||
| } | } | ||||
| static void engine_view_update(RenderEngine *engine, const struct bContext *context) | static void engine_view_update(RenderEngine *engine, const struct bContext *context) | ||||
| { | { | ||||
| extern FunctionRNA rna_RenderEngine_view_update_func; | extern FunctionRNA rna_RenderEngine_view_update_func; | ||||
| ▲ Show 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values) | void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values) | ||||
| { | { | ||||
| RenderPass *rpass = (RenderPass *)ptr->data; | RenderPass *rpass = (RenderPass *)ptr->data; | ||||
| memcpy(rpass->rect, values, sizeof(float) * rpass->rectx * rpass->recty * rpass->channels); | memcpy(rpass->rect, values, sizeof(float) * rpass->rectx * rpass->recty * rpass->channels); | ||||
| } | } | ||||
| static PointerRNA rna_BakePixel_next_get(PointerRNA *ptr) | |||||
| { | |||||
| BakePixel *bp = ptr->data; | |||||
| return rna_pointer_inherit_refine(ptr, &RNA_BakePixel, bp + 1); | |||||
| } | |||||
| static RenderPass *rna_RenderPass_find_by_type(RenderLayer *rl, int passtype, const char *view) | static RenderPass *rna_RenderPass_find_by_type(RenderLayer *rl, int passtype, const char *view) | ||||
| { | { | ||||
| return RE_pass_find_by_type(rl, passtype, view); | return RE_pass_find_by_type(rl, passtype, view); | ||||
| } | } | ||||
| static RenderPass *rna_RenderPass_find_by_name(RenderLayer *rl, const char *name, const char *view) | static RenderPass *rna_RenderPass_find_by_name(RenderLayer *rl, const char *name, const char *view) | ||||
| { | { | ||||
| return RE_pass_find_by_name(rl, name, view); | return RE_pass_find_by_name(rl, name, view); | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | static void rna_def_render_engine(BlenderRNA *brna) | ||||
| parm = RNA_def_pointer(func, "scene", "Scene", "", ""); | parm = RNA_def_pointer(func, "scene", "Scene", "", ""); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "object", "Object", "", ""); | parm = RNA_def_pointer(func, "object", "Object", "", ""); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_enum(func, "pass_type", rna_enum_bake_pass_type_items, 0, "Pass", "Pass to bake"); | parm = RNA_def_enum(func, "pass_type", rna_enum_bake_pass_type_items, 0, "Pass", "Pass to bake"); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_int(func, "pass_filter", 0, 0, INT_MAX, "Pass Filter", "Filter to combined, diffuse, glossy, transmission and subsurface passes", 0, INT_MAX); | parm = RNA_def_int(func, "pass_filter", 0, 0, INT_MAX, "Pass Filter", "Filter to combined, diffuse, glossy, transmission and subsurface passes", 0, INT_MAX); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_int(func, "object_id", 0, 0, INT_MAX, "Object Id", "Id of the current object being baked in relation to the others", 0, INT_MAX); | parm = RNA_def_int(func, "width", 0, 0, INT_MAX, "Width", "Image width", 0, INT_MAX); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | |||||
| parm = RNA_def_pointer(func, "pixel_array", "BakePixel", "", ""); | |||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_int(func, "num_pixels", 0, 0, INT_MAX, "Number of Pixels", "Size of the baking batch", 0, INT_MAX); | parm = RNA_def_int(func, "height", 0, 0, INT_MAX, "Height", "Image height", 0, INT_MAX); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | |||||
| parm = RNA_def_int(func, "depth", 0, 0, INT_MAX, "Pixels depth", "Number of channels", 1, INT_MAX); | |||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | |||||
| /* TODO, see how array size of 0 works, this shouldnt be used */ | |||||
| parm = RNA_def_pointer(func, "result", "AnyType", "", ""); | |||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* viewport render callbacks */ | /* viewport render callbacks */ | ||||
| func = RNA_def_function(srna, "view_update", NULL); | func = RNA_def_function(srna, "view_update", NULL); | ||||
| RNA_def_function_ui_description(func, "Update on data changes for viewport render"); | RNA_def_function_ui_description(func, "Update on data changes for viewport render"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| RNA_def_pointer(func, "context", "Context", "", ""); | RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| ▲ Show 20 Lines • Show All 429 Lines • ▼ Show 20 Lines | static void rna_def_render_pass(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "view_id", PROP_INT, PROP_NONE); | prop = RNA_def_property(srna, "view_id", PROP_INT, PROP_NONE); | ||||
| RNA_def_property_int_sdna(prop, NULL, "view_id"); | RNA_def_property_int_sdna(prop, NULL, "view_id"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_define_verify_sdna(1); | RNA_define_verify_sdna(1); | ||||
| } | } | ||||
| static void rna_def_render_bake_pixel(BlenderRNA *brna) | |||||
| { | |||||
| StructRNA *srna; | |||||
| PropertyRNA *prop; | |||||
| srna = RNA_def_struct(brna, "BakePixel", NULL); | |||||
| RNA_def_struct_ui_text(srna, "Bake Pixel", ""); | |||||
| RNA_define_verify_sdna(0); | |||||
| prop = RNA_def_property(srna, "primitive_id", PROP_INT, PROP_NONE); | |||||
| RNA_def_property_int_sdna(prop, NULL, "primitive_id"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| prop = RNA_def_property(srna, "object_id", PROP_INT, PROP_NONE); | |||||
| RNA_def_property_int_sdna(prop, NULL, "object_id"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE); | |||||
| RNA_def_property_array(prop, 2); | |||||
| RNA_def_property_float_sdna(prop, NULL, "uv"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| prop = RNA_def_property(srna, "du_dx", PROP_FLOAT, PROP_NONE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "du_dx"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| prop = RNA_def_property(srna, "du_dy", PROP_FLOAT, PROP_NONE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "du_dy"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| prop = RNA_def_property(srna, "dv_dx", PROP_FLOAT, PROP_NONE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "dv_dx"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| prop = RNA_def_property(srna, "dv_dy", PROP_FLOAT, PROP_NONE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "dv_dy"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| prop = RNA_def_property(srna, "next", PROP_POINTER, PROP_NONE); | |||||
| RNA_def_property_struct_type(prop, "BakePixel"); | |||||
| RNA_def_property_pointer_funcs(prop, "rna_BakePixel_next_get", NULL, NULL, NULL); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_define_verify_sdna(1); | |||||
| } | |||||
| void RNA_def_render(BlenderRNA *brna) | void RNA_def_render(BlenderRNA *brna) | ||||
| { | { | ||||
| rna_def_render_engine(brna); | rna_def_render_engine(brna); | ||||
| rna_def_render_result(brna); | rna_def_render_result(brna); | ||||
| rna_def_render_view(brna); | rna_def_render_view(brna); | ||||
| rna_def_render_layer(brna); | rna_def_render_layer(brna); | ||||
| rna_def_render_pass(brna); | rna_def_render_pass(brna); | ||||
| rna_def_render_bake_pixel(brna); | |||||
| } | } | ||||
| #endif /* RNA_RUNTIME */ | #endif /* RNA_RUNTIME */ | ||||