Cleanup: Move Cryptomatte node defines into enums
This commit is contained in:
parent
931c188ce5
commit
123da3412b
|
@ -1096,10 +1096,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i
|
|||
#define CMP_CHAN_RGB 1
|
||||
#define CMP_CHAN_A 2
|
||||
|
||||
/* Cryptomatte source. */
|
||||
#define CMP_CRYPTOMATTE_SRC_RENDER 0
|
||||
#define CMP_CRYPTOMATTE_SRC_IMAGE 1
|
||||
|
||||
/* Default SMAA configuration values. */
|
||||
#define CMP_DEFAULT_SMAA_THRESHOLD 1.0f
|
||||
#define CMP_DEFAULT_SMAA_CONTRAST_LIMIT 0.2f
|
||||
|
|
|
@ -83,9 +83,9 @@
|
|||
static void version_composite_nodetree_null_id(bNodeTree *ntree, Scene *scene)
|
||||
{
|
||||
for (bNode *node : ntree->all_nodes()) {
|
||||
if (node->id == nullptr &&
|
||||
((node->type == CMP_NODE_R_LAYERS) ||
|
||||
(node->type == CMP_NODE_CRYPTOMATTE && node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER)))
|
||||
if (node->id == nullptr && ((node->type == CMP_NODE_R_LAYERS) ||
|
||||
(node->type == CMP_NODE_CRYPTOMATTE &&
|
||||
node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER)))
|
||||
{
|
||||
node->id = &scene->id;
|
||||
}
|
||||
|
|
|
@ -204,10 +204,10 @@ Vector<NodeOperation *> CryptomatteNode::create_input_operations(const Composito
|
|||
{
|
||||
Vector<NodeOperation *> input_operations;
|
||||
switch (node.custom1) {
|
||||
case CMP_CRYPTOMATTE_SRC_RENDER:
|
||||
case CMP_NODE_CRYPTOMATTE_SOURCE_RENDER:
|
||||
input_operations_from_render_source(context, node, input_operations);
|
||||
break;
|
||||
case CMP_CRYPTOMATTE_SRC_IMAGE:
|
||||
case CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE:
|
||||
input_operations_from_image_source(context, node, input_operations);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -316,8 +316,8 @@ static bool eyedropper_cryptomatte_sample_fl(bContext *C,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* CMP_CRYPTOMATTE_SRC_RENDER and CMP_CRYPTOMATTE_SRC_IMAGE require a referenced image/scene to
|
||||
* work properly. */
|
||||
/* CMP_NODE_CRYPTOMATTE_SOURCE_RENDER and CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE require a referenced
|
||||
* image/scene to work properly. */
|
||||
if (!node->id) {
|
||||
return false;
|
||||
}
|
||||
|
@ -330,10 +330,10 @@ static bool eyedropper_cryptomatte_sample_fl(bContext *C,
|
|||
ntreeCompositCryptomatteLayerPrefix(scene, node, prefix, sizeof(prefix) - 1);
|
||||
prefix[MAX_NAME] = '\0';
|
||||
|
||||
if (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) {
|
||||
if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER) {
|
||||
return eyedropper_cryptomatte_sample_render_fl(node, prefix, fpos, r_col);
|
||||
}
|
||||
if (node->custom1 == CMP_CRYPTOMATTE_SRC_IMAGE) {
|
||||
if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
|
||||
return eyedropper_cryptomatte_sample_image_fl(node, crypto, prefix, fpos, r_col);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -762,7 +762,7 @@ static void node_composit_buts_cryptomatte(uiLayout *layout, bContext *C, Pointe
|
|||
uiItemR(row, ptr, "source", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
if (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) {
|
||||
if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER) {
|
||||
uiTemplateID(col,
|
||||
C,
|
||||
ptr,
|
||||
|
|
|
@ -1507,8 +1507,8 @@ static int node_read_viewlayers_exec(bContext *C, wmOperator * /*op*/)
|
|||
}
|
||||
|
||||
for (bNode *node : edit_tree.all_nodes()) {
|
||||
if ((node->type == CMP_NODE_R_LAYERS) ||
|
||||
(node->type == CMP_NODE_CRYPTOMATTE && node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER))
|
||||
if ((node->type == CMP_NODE_R_LAYERS) || (node->type == CMP_NODE_CRYPTOMATTE &&
|
||||
node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER))
|
||||
{
|
||||
ID *id = node->id;
|
||||
if (id == nullptr) {
|
||||
|
|
|
@ -2518,6 +2518,12 @@ typedef enum CMPNodeCombSepColorMode {
|
|||
CMP_NODE_COMBSEP_COLOR_YUV = 4,
|
||||
} CMPNodeCombSepColorMode;
|
||||
|
||||
/* Cryptomatte node source. */
|
||||
typedef enum CMPNodeCryptomatteSource {
|
||||
CMP_NODE_CRYPTOMATTE_SOURCE_RENDER = 0,
|
||||
CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE = 1,
|
||||
} CMPNodeCryptomatteSource;
|
||||
|
||||
/* Point Density shader node */
|
||||
|
||||
enum {
|
||||
|
|
|
@ -2771,7 +2771,7 @@ static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *p
|
|||
Image *ima = reinterpret_cast<Image *>(node->id);
|
||||
ImageUser *iuser = static_cast<ImageUser *>(node->storage);
|
||||
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2842,7 +2842,7 @@ static const EnumPropertyItem *rna_Node_image_layer_itemf(bContext * /*C*/,
|
|||
const EnumPropertyItem *item = nullptr;
|
||||
RenderLayer *rl;
|
||||
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
|
||||
return rna_enum_dummy_NULL_items;
|
||||
}
|
||||
|
||||
|
@ -2864,7 +2864,7 @@ static bool rna_Node_image_has_layers_get(PointerRNA *ptr)
|
|||
bNode *node = static_cast<bNode *>(ptr->data);
|
||||
Image *ima = reinterpret_cast<Image *>(node->id);
|
||||
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2880,7 +2880,7 @@ static bool rna_Node_image_has_views_get(PointerRNA *ptr)
|
|||
bNode *node = static_cast<bNode *>(ptr->data);
|
||||
Image *ima = reinterpret_cast<Image *>(node->id);
|
||||
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2930,7 +2930,7 @@ static const EnumPropertyItem *rna_Node_image_view_itemf(bContext * /*C*/,
|
|||
const EnumPropertyItem *item = nullptr;
|
||||
RenderView *rv;
|
||||
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_CRYPTOMATTE_SRC_IMAGE) {
|
||||
if (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 != CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
|
||||
return rna_enum_dummy_NULL_items;
|
||||
}
|
||||
|
||||
|
@ -3156,7 +3156,7 @@ static PointerRNA rna_NodeCryptomatte_scene_get(PointerRNA *ptr)
|
|||
{
|
||||
bNode *node = static_cast<bNode *>(ptr->data);
|
||||
|
||||
Scene *scene = (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) ?
|
||||
Scene *scene = (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER) ?
|
||||
reinterpret_cast<Scene *>(node->id) :
|
||||
nullptr;
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene);
|
||||
|
@ -3166,7 +3166,7 @@ static void rna_NodeCryptomatte_scene_set(PointerRNA *ptr, PointerRNA value, Rep
|
|||
{
|
||||
bNode *node = static_cast<bNode *>(ptr->data);
|
||||
|
||||
if (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) {
|
||||
if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER) {
|
||||
rna_Node_scene_set(ptr, value, reports);
|
||||
}
|
||||
}
|
||||
|
@ -3175,7 +3175,7 @@ static PointerRNA rna_NodeCryptomatte_image_get(PointerRNA *ptr)
|
|||
{
|
||||
bNode *node = static_cast<bNode *>(ptr->data);
|
||||
|
||||
Image *image = (node->custom1 == CMP_CRYPTOMATTE_SRC_IMAGE) ?
|
||||
Image *image = (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) ?
|
||||
reinterpret_cast<Image *>(node->id) :
|
||||
nullptr;
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Image, image);
|
||||
|
@ -3187,7 +3187,7 @@ static void rna_NodeCryptomatte_image_set(PointerRNA *ptr,
|
|||
{
|
||||
bNode *node = static_cast<bNode *>(ptr->data);
|
||||
|
||||
if (node->custom1 == CMP_CRYPTOMATTE_SRC_IMAGE) {
|
||||
if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
|
||||
if (node->id)
|
||||
id_us_min(node->id);
|
||||
if (value.data)
|
||||
|
@ -8443,8 +8443,16 @@ static void def_cmp_cryptomatte(StructRNA *srna)
|
|||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem cryptomatte_source_items[] = {
|
||||
{CMP_CRYPTOMATTE_SRC_RENDER, "RENDER", 0, "Render", "Use Cryptomatte passes from a render"},
|
||||
{CMP_CRYPTOMATTE_SRC_IMAGE, "IMAGE", 0, "Image", "Use Cryptomatte passes from an image"},
|
||||
{CMP_NODE_CRYPTOMATTE_SOURCE_RENDER,
|
||||
"RENDER",
|
||||
0,
|
||||
"Render",
|
||||
"Use Cryptomatte passes from a render"},
|
||||
{CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE,
|
||||
"IMAGE",
|
||||
0,
|
||||
"Image",
|
||||
"Use Cryptomatte passes from an image"},
|
||||
{0, nullptr, 0, nullptr, nullptr}};
|
||||
|
||||
prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
|
||||
|
|
|
@ -98,11 +98,11 @@ static blender::bke::cryptomatte::CryptomatteSessionPtr cryptomatte_init_from_no
|
|||
}
|
||||
|
||||
switch (node.custom1) {
|
||||
case CMP_CRYPTOMATTE_SRC_RENDER: {
|
||||
case CMP_NODE_CRYPTOMATTE_SOURCE_RENDER: {
|
||||
return cryptomatte_init_from_node_render(node, use_meta_data);
|
||||
}
|
||||
|
||||
case CMP_CRYPTOMATTE_SRC_IMAGE: {
|
||||
case CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE: {
|
||||
return cryptomatte_init_from_node_image(scene, node);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue