Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_image.cc
| Show All 20 Lines | |||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "node_composite_util.hh" | #include "node_composite_util.hh" | ||||
| #include "BLI_linklist.h" | #include "BLI_linklist.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "DNA_scene_types.h" | |||||
| #include "RE_engine.h" | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "DNA_scene_types.h" | |||||
| #include "RE_engine.h" | |||||
| #include "RNA_access.h" | |||||
| #include "UI_interface.h" | |||||
| #include "UI_resources.h" | |||||
| /* **************** IMAGE (and RenderResult, multilayer image) ******************** */ | /* **************** IMAGE (and RenderResult, multilayer image) ******************** */ | ||||
| static bNodeSocketTemplate cmp_node_rlayers_out[] = { | static bNodeSocketTemplate cmp_node_rlayers_out[] = { | ||||
| {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_(RE_PASSNAME_Z), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_FLOAT, N_(RE_PASSNAME_Z), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_VECTOR, N_(RE_PASSNAME_NORMAL), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_VECTOR, N_(RE_PASSNAME_NORMAL), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_VECTOR, N_(RE_PASSNAME_UV), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_VECTOR, N_(RE_PASSNAME_UV), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| ▲ Show 20 Lines • Show All 503 Lines • ▼ Show 20 Lines | |||||
| static void cmp_node_rlayers_update(bNodeTree *ntree, bNode *node) | static void cmp_node_rlayers_update(bNodeTree *ntree, bNode *node) | ||||
| { | { | ||||
| cmp_node_image_verify_outputs(ntree, node, true); | cmp_node_image_verify_outputs(ntree, node, true); | ||||
| cmp_node_update_default(ntree, node); | cmp_node_update_default(ntree, node); | ||||
| } | } | ||||
| static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) | |||||
| { | |||||
| bNode *node = (bNode *)ptr->data; | |||||
| uiLayout *col, *row; | |||||
| uiTemplateID(layout, | |||||
| C, | |||||
| ptr, | |||||
| "scene", | |||||
| nullptr, | |||||
| nullptr, | |||||
| nullptr, | |||||
| UI_TEMPLATE_ID_FILTER_ALL, | |||||
| false, | |||||
| nullptr); | |||||
| if (!node->id) { | |||||
| return; | |||||
| } | |||||
| col = uiLayoutColumn(layout, false); | |||||
| row = uiLayoutRow(col, true); | |||||
| uiItemR(row, ptr, "layer", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); | |||||
| PropertyRNA *prop = RNA_struct_find_property(ptr, "layer"); | |||||
| const char *layer_name; | |||||
| if (!(RNA_property_enum_identifier( | |||||
| C, ptr, prop, RNA_property_enum_get(ptr, prop), &layer_name))) { | |||||
| return; | |||||
| } | |||||
| PointerRNA scn_ptr; | |||||
| char scene_name[MAX_ID_NAME - 2]; | |||||
| scn_ptr = RNA_pointer_get(ptr, "scene"); | |||||
| RNA_string_get(&scn_ptr, "name", scene_name); | |||||
| PointerRNA op_ptr; | |||||
| uiItemFullO( | |||||
| row, "RENDER_OT_render", "", ICON_RENDER_STILL, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); | |||||
| RNA_string_set(&op_ptr, "layer", layer_name); | |||||
| RNA_string_set(&op_ptr, "scene", scene_name); | |||||
| } | |||||
| void register_node_type_cmp_rlayers() | void register_node_type_cmp_rlayers() | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW); | cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW); | ||||
| node_type_socket_templates(&ntype, nullptr, cmp_node_rlayers_out); | node_type_socket_templates(&ntype, nullptr, cmp_node_rlayers_out); | ||||
| ntype.draw_buttons = node_composit_buts_viewlayers; | |||||
| ntype.initfunc_api = node_composit_init_rlayers; | ntype.initfunc_api = node_composit_init_rlayers; | ||||
| ntype.poll = node_composit_poll_rlayers; | ntype.poll = node_composit_poll_rlayers; | ||||
| node_type_storage(&ntype, nullptr, node_composit_free_rlayers, node_composit_copy_rlayers); | node_type_storage(&ntype, nullptr, node_composit_free_rlayers, node_composit_copy_rlayers); | ||||
| node_type_update(&ntype, cmp_node_rlayers_update); | node_type_update(&ntype, cmp_node_rlayers_update); | ||||
| node_type_init(&ntype, node_cmp_rlayers_outputs); | node_type_init(&ntype, node_cmp_rlayers_outputs); | ||||
| node_type_size_preset(&ntype, NODE_SIZE_LARGE); | node_type_size_preset(&ntype, NODE_SIZE_LARGE); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||