Cleanup: Nodes: Use common prefix instead of sh_fn
Nodes that are shared between Geometry and Shader nodes use the prefix sh_fn for their base type and poll functions. The compositor will also share those nodes very soon, so we generalize the name to use the prefix "common".
This commit is contained in:
@@ -38,9 +38,9 @@ bool sh_node_poll_default(const blender::bke::bNodeType * /*ntype*/,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool sh_fn_poll_default(const blender::bke::bNodeType * /*ntype*/,
|
||||
const bNodeTree *ntree,
|
||||
const char **r_disabled_hint)
|
||||
static bool common_poll_default(const blender::bke::bNodeType * /*ntype*/,
|
||||
const bNodeTree *ntree,
|
||||
const char **r_disabled_hint)
|
||||
{
|
||||
if (!STR_ELEM(ntree->idname, "ShaderNodeTree", "GeometryNodeTree")) {
|
||||
*r_disabled_hint = RPT_("Not a shader or geometry node tree");
|
||||
@@ -60,12 +60,12 @@ void sh_node_type_base(blender::bke::bNodeType *ntype,
|
||||
ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node;
|
||||
}
|
||||
|
||||
void sh_fn_node_type_base(blender::bke::bNodeType *ntype,
|
||||
std::string idname,
|
||||
const std::optional<int16_t> legacy_type)
|
||||
void common_node_type_base(blender::bke::bNodeType *ntype,
|
||||
std::string idname,
|
||||
const std::optional<int16_t> legacy_type)
|
||||
{
|
||||
sh_node_type_base(ntype, idname, legacy_type);
|
||||
ntype->poll = sh_fn_poll_default;
|
||||
ntype->poll = common_poll_default;
|
||||
ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ bool sh_node_poll_default(const blender::bke::bNodeType *ntype,
|
||||
void sh_node_type_base(blender::bke::bNodeType *ntype,
|
||||
std::string idname,
|
||||
std::optional<int16_t> legacy_type = std::nullopt);
|
||||
void sh_fn_node_type_base(blender::bke::bNodeType *ntype,
|
||||
std::string idname,
|
||||
std::optional<int16_t> legacy_type = std::nullopt);
|
||||
void common_node_type_base(blender::bke::bNodeType *ntype,
|
||||
std::string idname,
|
||||
std::optional<int16_t> legacy_type = std::nullopt);
|
||||
bool line_style_shader_nodes_poll(const bContext *C);
|
||||
bool world_shader_nodes_poll(const bContext *C);
|
||||
bool object_shader_nodes_poll(const bContext *C);
|
||||
|
||||
@@ -70,7 +70,7 @@ void register_node_type_sh_blackbody()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeBlackbody", SH_NODE_BLACKBODY);
|
||||
common_node_type_base(&ntype, "ShaderNodeBlackbody", SH_NODE_BLACKBODY);
|
||||
ntype.ui_name = "Blackbody";
|
||||
ntype.ui_description = "Convert a blackbody temperature to an RGB value";
|
||||
ntype.enum_name_legacy = "BLACKBODY";
|
||||
|
||||
@@ -99,7 +99,7 @@ void register_node_type_sh_clamp()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeClamp", SH_NODE_CLAMP);
|
||||
common_node_type_base(&ntype, "ShaderNodeClamp", SH_NODE_CLAMP);
|
||||
ntype.ui_name = "Clamp";
|
||||
ntype.ui_description = "Clamp a value between a minimum and a maximum";
|
||||
ntype.enum_name_legacy = "CLAMP";
|
||||
|
||||
@@ -162,7 +162,7 @@ void register_node_type_sh_valtorgb()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeValToRGB", SH_NODE_VALTORGB);
|
||||
common_node_type_base(&ntype, "ShaderNodeValToRGB", SH_NODE_VALTORGB);
|
||||
ntype.ui_name = "Color Ramp";
|
||||
ntype.ui_description = "Map values to colors with the use of a gradient";
|
||||
ntype.enum_name_legacy = "VALTORGB";
|
||||
|
||||
@@ -132,7 +132,7 @@ void register_node_type_sh_curve_vec()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeVectorCurve", SH_NODE_CURVE_VEC);
|
||||
common_node_type_base(&ntype, "ShaderNodeVectorCurve", SH_NODE_CURVE_VEC);
|
||||
ntype.ui_name = "Vector Curves";
|
||||
ntype.ui_description = "Map input vector components with curves";
|
||||
ntype.enum_name_legacy = "CURVE_VEC";
|
||||
@@ -296,7 +296,7 @@ void register_node_type_sh_curve_rgb()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeRGBCurve", SH_NODE_CURVE_RGB);
|
||||
common_node_type_base(&ntype, "ShaderNodeRGBCurve", SH_NODE_CURVE_RGB);
|
||||
ntype.ui_name = "RGB Curves";
|
||||
ntype.ui_description = "Apply color corrections for each color channel";
|
||||
ntype.enum_name_legacy = "CURVE_RGB";
|
||||
@@ -428,7 +428,7 @@ void register_node_type_sh_curve_float()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeFloatCurve", SH_NODE_CURVE_FLOAT);
|
||||
common_node_type_base(&ntype, "ShaderNodeFloatCurve", SH_NODE_CURVE_FLOAT);
|
||||
ntype.ui_name = "Float Curve";
|
||||
ntype.ui_description = "Map an input float to a curve and outputs a float value";
|
||||
ntype.enum_name_legacy = "CURVE_FLOAT";
|
||||
|
||||
@@ -524,7 +524,7 @@ void register_node_type_sh_map_range()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeMapRange", SH_NODE_MAP_RANGE);
|
||||
common_node_type_base(&ntype, "ShaderNodeMapRange", SH_NODE_MAP_RANGE);
|
||||
ntype.ui_name = "Map Range";
|
||||
ntype.ui_description = "Remap a value from a range to a target range";
|
||||
ntype.enum_name_legacy = "MAP_RANGE";
|
||||
|
||||
@@ -361,7 +361,7 @@ void register_node_type_sh_math()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeMath", SH_NODE_MATH);
|
||||
common_node_type_base(&ntype, "ShaderNodeMath", SH_NODE_MATH);
|
||||
ntype.ui_name = "Math";
|
||||
ntype.ui_description = "Perform math operations";
|
||||
ntype.enum_name_legacy = "MATH";
|
||||
|
||||
@@ -599,7 +599,7 @@ void register_node_type_sh_mix()
|
||||
namespace file_ns = blender::nodes::node_sh_mix_cc;
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeMix", SH_NODE_MIX);
|
||||
common_node_type_base(&ntype, "ShaderNodeMix", SH_NODE_MIX);
|
||||
ntype.ui_name = "Mix";
|
||||
ntype.ui_description = "Mix values by a factor";
|
||||
ntype.enum_name_legacy = "MIX";
|
||||
|
||||
@@ -158,7 +158,7 @@ void register_node_type_sh_mix_rgb()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeMixRGB", SH_NODE_MIX_RGB_LEGACY);
|
||||
common_node_type_base(&ntype, "ShaderNodeMixRGB", SH_NODE_MIX_RGB_LEGACY);
|
||||
ntype.ui_name = "Mix (Legacy)";
|
||||
ntype.ui_description = "Mix two input colors";
|
||||
ntype.enum_name_legacy = "MIX_RGB";
|
||||
|
||||
@@ -79,7 +79,7 @@ void register_node_type_sh_seprgb()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeSeparateRGB", SH_NODE_SEPRGB_LEGACY);
|
||||
common_node_type_base(&ntype, "ShaderNodeSeparateRGB", SH_NODE_SEPRGB_LEGACY);
|
||||
ntype.ui_name = "Separate RGB (Legacy)";
|
||||
ntype.ui_description = "Deprecated";
|
||||
ntype.enum_name_legacy = "SEPRGB";
|
||||
@@ -127,7 +127,7 @@ void register_node_type_sh_combrgb()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeCombineRGB", SH_NODE_COMBRGB_LEGACY);
|
||||
common_node_type_base(&ntype, "ShaderNodeCombineRGB", SH_NODE_COMBRGB_LEGACY);
|
||||
ntype.ui_name = "Combine RGB (Legacy)";
|
||||
ntype.ui_description = "Deprecated";
|
||||
ntype.enum_name_legacy = "COMBRGB";
|
||||
|
||||
@@ -137,7 +137,7 @@ void register_node_type_sh_sepxyz()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeSeparateXYZ", SH_NODE_SEPXYZ);
|
||||
common_node_type_base(&ntype, "ShaderNodeSeparateXYZ", SH_NODE_SEPXYZ);
|
||||
ntype.ui_name = "Separate XYZ";
|
||||
ntype.ui_description = "Split a vector into its X, Y, and Z components";
|
||||
ntype.enum_name_legacy = "SEPXYZ";
|
||||
@@ -229,7 +229,7 @@ void register_node_type_sh_combxyz()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeCombineXYZ", SH_NODE_COMBXYZ);
|
||||
common_node_type_base(&ntype, "ShaderNodeCombineXYZ", SH_NODE_COMBXYZ);
|
||||
ntype.ui_name = "Combine XYZ";
|
||||
ntype.ui_description = "Create a vector from X, Y, and Z components";
|
||||
ntype.enum_name_legacy = "COMBXYZ";
|
||||
|
||||
@@ -301,7 +301,7 @@ void register_node_type_sh_tex_brick()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexBrick", SH_NODE_TEX_BRICK);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexBrick", SH_NODE_TEX_BRICK);
|
||||
ntype.ui_name = "Brick Texture";
|
||||
ntype.ui_description = "Generate a procedural texture producing bricks";
|
||||
ntype.enum_name_legacy = "TEX_BRICK";
|
||||
|
||||
@@ -139,7 +139,7 @@ void register_node_type_sh_tex_checker()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexChecker", SH_NODE_TEX_CHECKER);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexChecker", SH_NODE_TEX_CHECKER);
|
||||
ntype.ui_name = "Checker Texture";
|
||||
ntype.ui_description = "Generate a checkerboard texture";
|
||||
ntype.enum_name_legacy = "TEX_CHECKER";
|
||||
|
||||
@@ -207,7 +207,7 @@ void register_node_type_sh_tex_gabor()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexGabor", SH_NODE_TEX_GABOR);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexGabor", SH_NODE_TEX_GABOR);
|
||||
ntype.ui_name = "Gabor Texture";
|
||||
ntype.ui_description = "Generate Gabor noise";
|
||||
ntype.enum_name_legacy = "TEX_GABOR";
|
||||
|
||||
@@ -197,7 +197,7 @@ void register_node_type_sh_tex_gradient()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexGradient", SH_NODE_TEX_GRADIENT);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexGradient", SH_NODE_TEX_GRADIENT);
|
||||
ntype.ui_name = "Gradient Texture";
|
||||
ntype.ui_description =
|
||||
"Generate interpolated color and intensity values based on the input vector";
|
||||
|
||||
@@ -183,7 +183,7 @@ void register_node_type_sh_tex_magic()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexMagic", SH_NODE_TEX_MAGIC);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexMagic", SH_NODE_TEX_MAGIC);
|
||||
ntype.ui_name = "Magic Texture";
|
||||
ntype.ui_description = "Generate a psychedelic color texture";
|
||||
ntype.enum_name_legacy = "TEX_MAGIC";
|
||||
|
||||
@@ -461,7 +461,7 @@ void register_node_type_sh_tex_noise()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexNoise", SH_NODE_TEX_NOISE);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexNoise", SH_NODE_TEX_NOISE);
|
||||
ntype.ui_name = "Noise Texture";
|
||||
ntype.ui_description = "Generate fractal Perlin noise";
|
||||
ntype.enum_name_legacy = "TEX_NOISE";
|
||||
|
||||
@@ -818,7 +818,7 @@ void register_node_type_sh_tex_voronoi()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexVoronoi", SH_NODE_TEX_VORONOI);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexVoronoi", SH_NODE_TEX_VORONOI);
|
||||
ntype.ui_name = "Voronoi Texture";
|
||||
ntype.ui_description =
|
||||
"Generate Worley noise based on the distance to random points. Typically used to generate "
|
||||
|
||||
@@ -335,7 +335,7 @@ void register_node_type_sh_tex_wave()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexWave", SH_NODE_TEX_WAVE);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexWave", SH_NODE_TEX_WAVE);
|
||||
ntype.ui_name = "Wave Texture";
|
||||
ntype.ui_description = "Generate procedural bands or rings with noise";
|
||||
ntype.enum_name_legacy = "TEX_WAVE";
|
||||
|
||||
@@ -260,7 +260,7 @@ void register_node_type_sh_tex_white_noise()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeTexWhiteNoise", SH_NODE_TEX_WHITE_NOISE);
|
||||
common_node_type_base(&ntype, "ShaderNodeTexWhiteNoise", SH_NODE_TEX_WHITE_NOISE);
|
||||
ntype.ui_name = "White Noise Texture";
|
||||
ntype.ui_description = "Return a random value or color based on an input seed";
|
||||
ntype.enum_name_legacy = "TEX_WHITE_NOISE";
|
||||
|
||||
@@ -54,7 +54,7 @@ void register_node_type_sh_value()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeValue", SH_NODE_VALUE);
|
||||
common_node_type_base(&ntype, "ShaderNodeValue", SH_NODE_VALUE);
|
||||
ntype.ui_name = "Value";
|
||||
ntype.ui_description = "Input numerical values to other nodes in the tree";
|
||||
ntype.enum_name_legacy = "VALUE";
|
||||
|
||||
@@ -556,7 +556,7 @@ void register_node_type_sh_vect_math()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeVectorMath", SH_NODE_VECTOR_MATH);
|
||||
common_node_type_base(&ntype, "ShaderNodeVectorMath", SH_NODE_VECTOR_MATH);
|
||||
ntype.ui_name = "Vector Math";
|
||||
ntype.ui_description = "Perform vector math operation";
|
||||
ntype.enum_name_legacy = "VECT_MATH";
|
||||
|
||||
@@ -268,7 +268,7 @@ void register_node_type_sh_vector_rotate()
|
||||
|
||||
static blender::bke::bNodeType ntype;
|
||||
|
||||
sh_fn_node_type_base(&ntype, "ShaderNodeVectorRotate", SH_NODE_VECTOR_ROTATE);
|
||||
common_node_type_base(&ntype, "ShaderNodeVectorRotate", SH_NODE_VECTOR_ROTATE);
|
||||
ntype.ui_name = "Vector Rotate";
|
||||
ntype.ui_description = "Rotate a vector around a pivot point (center)";
|
||||
ntype.enum_name_legacy = "VECTOR_ROTATE";
|
||||
|
||||
Reference in New Issue
Block a user