diff options
Diffstat (limited to 'source/blender/nodes')
214 files changed, 1775 insertions, 2489 deletions
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 7330bb71e74..40d83e83aa4 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -16,11 +16,6 @@ # # The Original Code is Copyright (C) 2006, Blender Foundation # All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# # ***** END GPL LICENSE BLOCK ***** set(INC @@ -32,6 +27,7 @@ set(INC ../blenkernel ../blenlib ../blentranslation + ../depsgraph ../gpu ../imbuf ../makesdna @@ -154,29 +150,26 @@ set(SRC shader/nodes/node_shader_common.c shader/nodes/node_shader_curves.c shader/nodes/node_shader_displacement.c + shader/nodes/node_shader_eevee_specular.c shader/nodes/node_shader_emission.c shader/nodes/node_shader_fresnel.c shader/nodes/node_shader_gamma.c - shader/nodes/node_shader_geom.c shader/nodes/node_shader_geometry.c shader/nodes/node_shader_hair_info.c shader/nodes/node_shader_holdout.c shader/nodes/node_shader_hueSatVal.c shader/nodes/node_shader_ies_light.c shader/nodes/node_shader_invert.c - shader/nodes/node_shader_lamp.c shader/nodes/node_shader_layer_weight.c shader/nodes/node_shader_light_falloff.c shader/nodes/node_shader_light_path.c shader/nodes/node_shader_mapping.c - shader/nodes/node_shader_material.c shader/nodes/node_shader_math.c shader/nodes/node_shader_mixRgb.c shader/nodes/node_shader_mix_shader.c shader/nodes/node_shader_normal.c shader/nodes/node_shader_normal_map.c shader/nodes/node_shader_object_info.c - shader/nodes/node_shader_output.c shader/nodes/node_shader_output_lamp.c shader/nodes/node_shader_output_linestyle.c shader/nodes/node_shader_output_material.c @@ -187,6 +180,7 @@ set(SRC shader/nodes/node_shader_sepcombHSV.c shader/nodes/node_shader_sepcombRGB.c shader/nodes/node_shader_sepcombXYZ.c + shader/nodes/node_shader_shaderToRgb.c shader/nodes/node_shader_squeeze.c shader/nodes/node_shader_subsurface_scattering.c shader/nodes/node_shader_tangent.c @@ -203,7 +197,6 @@ set(SRC shader/nodes/node_shader_tex_sky.c shader/nodes/node_shader_tex_voronoi.c shader/nodes/node_shader_tex_wave.c - shader/nodes/node_shader_texture.c shader/nodes/node_shader_uvAlongStroke.c shader/nodes/node_shader_uvmap.c shader/nodes/node_shader_valToRgb.c diff --git a/source/blender/nodes/NOD_common.h b/source/blender/nodes/NOD_common.h index 39116744491..45e04fac537 100644 --- a/source/blender/nodes/NOD_common.h +++ b/source/blender/nodes/NOD_common.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file NOD_common.h - * \ingroup nodes +/** \file \ingroup nodes */ #ifndef __NOD_COMMON_H__ diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index bb3cd8df3f7..20db93dc858 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file NOD_composite.h - * \ingroup nodes +/** \file \ingroup nodes */ #ifndef __NOD_COMPOSITE_H__ @@ -133,7 +132,7 @@ void register_node_type_cmp_planetrackdeform(void); void register_node_type_cmp_cornerpin(void); void node_cmp_rlayers_outputs(struct bNodeTree *ntree, struct bNode *node); -void node_cmp_rlayers_register_pass(struct bNodeTree *ntree, struct bNode *node, struct Scene *scene, struct SceneRenderLayer *srl, const char *name, int type); +void node_cmp_rlayers_register_pass(struct bNodeTree *ntree, struct bNode *node, struct Scene *scene, struct ViewLayer *view_layer, const char *name, int type); const char *node_cmp_rlayers_sock_to_pass(int sock_index); #endif diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h index 4235df751b3..25a53c2f3fc 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file NOD_shader.h - * \ingroup nodes +/** \file \ingroup nodes */ #ifndef __NOD_SHADER_H__ @@ -36,20 +35,16 @@ void register_node_tree_type_sh(void); void register_node_type_sh_group(void); -void register_node_type_sh_output(void); -void register_node_type_sh_material(void); void register_node_type_sh_camera(void); -void register_node_type_sh_lamp(void); void register_node_type_sh_value(void); void register_node_type_sh_rgb(void); void register_node_type_sh_mix_rgb(void); void register_node_type_sh_valtorgb(void); void register_node_type_sh_rgbtobw(void); -void register_node_type_sh_texture(void); +void register_node_type_sh_shadertorgb(void); void register_node_type_sh_normal(void); void register_node_type_sh_gamma(void); void register_node_type_sh_brightcontrast(void); -void register_node_type_sh_geom(void); void register_node_type_sh_mapping(void); void register_node_type_sh_curve_vec(void); void register_node_type_sh_curve_rgb(void); @@ -57,7 +52,6 @@ void register_node_type_sh_math(void); void register_node_type_sh_vect_math(void); void register_node_type_sh_squeeze(void); void register_node_type_sh_dynamic(void); -void register_node_type_sh_material_ext(void); void register_node_type_sh_invert(void); void register_node_type_sh_seprgb(void); void register_node_type_sh_combrgb(void); @@ -114,9 +108,12 @@ void register_node_type_sh_mix_shader(void); void register_node_type_sh_add_shader(void); void register_node_type_sh_uvmap(void); void register_node_type_sh_uvalongstroke(void); +void register_node_type_sh_eevee_metallic(void); +void register_node_type_sh_eevee_specular(void); void register_node_type_sh_output_lamp(void); void register_node_type_sh_output_material(void); +void register_node_type_sh_output_eevee_material(void); void register_node_type_sh_output_world(void); void register_node_type_sh_output_linestyle(void); diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h index 4caf5f129c4..cdcbb824fd6 100644 --- a/source/blender/nodes/NOD_socket.h +++ b/source/blender/nodes/NOD_socket.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file NOD_socket.h - * \ingroup nodes +/** \file \ingroup nodes */ @@ -41,7 +40,7 @@ struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree, struc void node_verify_socket_templates(struct bNodeTree *ntree, struct bNode *node); void node_socket_init_default_value(struct bNodeSocket *sock); -void node_socket_copy_default_value(struct bNodeSocket *to, struct bNodeSocket *from); +void node_socket_copy_default_value(struct bNodeSocket *to, const struct bNodeSocket *from); void register_standard_node_socket_types(void); #endif diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 91a6005b32e..c3fa52ea94b 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** \file NOD_static_types.h - * \ingroup nodes +/** \file \ingroup nodes */ /* intentionally no include guard */ @@ -28,228 +27,224 @@ /* WARNING! If you edit those strings, please do the same in relevant nodes files (under blender/nodes/...)! */ /* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */ -DefNode( Node, NODE_FRAME, def_frame, "FRAME", Frame, "Frame", "" ) -DefNode( Node, NODE_GROUP, def_group, "GROUP", Group, "Group", "" ) -DefNode( Node, NODE_GROUP_INPUT, def_group_input, "GROUP_INPUT", GroupInput, "Group Input", "" ) -DefNode( Node, NODE_GROUP_OUTPUT, def_group_output, "GROUP_OUTPUT", GroupOutput, "Group Output", "" ) -DefNode( Node, NODE_REROUTE, 0, "REROUTE", Reroute, "Reroute", "" ) +DefNode( Node, NODE_FRAME, def_frame, "FRAME", Frame, "Frame", "" ); +DefNode( Node, NODE_GROUP, def_group, "GROUP", Group, "Group", "" ); +DefNode( Node, NODE_GROUP_INPUT, def_group_input, "GROUP_INPUT", GroupInput, "Group Input", "" ); +DefNode( Node, NODE_GROUP_OUTPUT, def_group_output, "GROUP_OUTPUT", GroupOutput, "Group Output", "" ); +DefNode( Node, NODE_REROUTE, 0, "REROUTE", Reroute, "Reroute", "" ); -DefNode( ShaderNode, SH_NODE_OUTPUT, def_sh_output, "OUTPUT", Output, "Output", "" ) -DefNode( ShaderNode, SH_NODE_MATERIAL, def_sh_material, "MATERIAL", Material, "Material", "" ) -DefNode( ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" ) -DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "Value", "" ) -DefNode( ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" ) -DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" ) -DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ) -DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ) -DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" ) -DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" ) -DefNode( ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" ) -DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" ) -DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" ) -DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curves", "" ) -DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curves", "" ) -DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" ) -DefNode( ShaderNode, SH_NODE_LAMP, def_sh_lamp, "LAMP", LampData, "Lamp Data", "" ) -DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" ) -DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" ) -DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze Value", "" ) -DefNode( ShaderNode, SH_NODE_MATERIAL_EXT, def_sh_material, "MATERIAL_EXT", ExtendedMaterial, "Extended Material", "" ) -DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" ) -DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" ) -DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" ) -DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" ) +DefNode( ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" ); +DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "Value", "" ); +DefNode( ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" ); +DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" ); +DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ); +DefNode( ShaderNode, SH_NODE_SHADERTORGB, 0, "SHADERTORGB", ShaderToRGB, "Shader to RGB", "" ); +DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" ); +DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" ); +DefNode( ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" ); +DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" ); +DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curves", "" ); +DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curves", "" ); +DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" ); +DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" ); +DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" ); +DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze Value", "" ); +DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" ); +DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" ); +DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" ); +DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" ); -DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, "OUTPUT_MATERIAL", OutputMaterial, "Material Output", "" ) -DefNode( ShaderNode, SH_NODE_OUTPUT_LAMP, def_sh_output, "OUTPUT_LAMP", OutputLamp, "Lamp Output", "" ) -DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, "OUTPUT_WORLD", OutputWorld, "World Output", "" ) -DefNode( ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,"OUTPUT_LINESTYLE", OutputLineStyle, "Line Style Output", "" ) -DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" ) -DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "Layer Weight", "" ) -DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" ) -DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" ) -DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" ) -DefNode( ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,"AMBIENT_OCCLUSION", AmbientOcclusion, "Ambient Occlusion", "" ) -DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" ) -DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, "BSDF_PRINCIPLED", BsdfPrincipled, "Principled BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, "BSDF_REFRACTION", BsdfRefraction, "Refraction BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_TOON, def_toon, "BSDF_TOON", BsdfToon, "Toon BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_HAIR, def_hair, "BSDF_HAIR", BsdfHair, "Hair BSDF", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_HAIR_PRINCIPLED, def_hair_principled, "BSDF_HAIR_PRINCIPLED", BsdfHairPrincipled, "Principled Hair BSDF", "") -DefNode( ShaderNode, SH_NODE_SUBSURFACE_SCATTERING, def_sh_subsurface, "SUBSURFACE_SCATTERING",SubsurfaceScattering,"Subsurface Scattering","") -DefNode( ShaderNode, SH_NODE_VOLUME_ABSORPTION, 0, "VOLUME_ABSORPTION", VolumeAbsorption, "Volume Absorption", "" ) -DefNode( ShaderNode, SH_NODE_VOLUME_SCATTER, 0, "VOLUME_SCATTER", VolumeScatter, "Volume Scatter", "" ) -DefNode( ShaderNode, SH_NODE_VOLUME_PRINCIPLED, 0, "PRINCIPLED_VOLUME", VolumePrincipled, "Principled Volume", "" ) -DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" ) -DefNode( ShaderNode, SH_NODE_NEW_GEOMETRY, 0, "NEW_GEOMETRY", NewGeometry, "Geometry", "" ) -DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", LightPath, "Light Path", "" ) -DefNode( ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LIGHT_FALLOFF", LightFalloff, "Light Falloff", "" ) -DefNode( ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" ) -DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" ) -DefNode( ShaderNode, SH_NODE_HAIR_INFO, 0, "HAIR_INFO", HairInfo, "Hair Info", "" ) -DefNode( ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, "WIREFRAME", Wireframe, "Wireframe", "" ) -DefNode( ShaderNode, SH_NODE_WAVELENGTH, 0, "WAVELENGTH", Wavelength, "Wavelength", "" ) -DefNode( ShaderNode, SH_NODE_BLACKBODY, 0, "BLACKBODY", Blackbody, "Blackbody", "" ) -DefNode( ShaderNode, SH_NODE_BUMP, def_sh_bump, "BUMP", Bump, "Bump", "" ) -DefNode( ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" ) -DefNode( ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" ) -DefNode( ShaderNode, SH_NODE_SCRIPT, def_sh_script, "SCRIPT", Script, "Script", "" ) -DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture","" ) -DefNode( ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, "TEX_GRADIENT", TexGradient, "Gradient Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, "TEX_NOISE", TexNoise, "Noise Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, "TEX_WAVE", TexWave, "Wave Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, "TEX_CHECKER", TexChecker, "Checker Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, "TEX_BRICK", TexBrick, "Brick Texture", "" ) -DefNode( ShaderNode, SH_NODE_TEX_POINTDENSITY, def_sh_tex_pointdensity,"TEX_POINTDENSITY", TexPointDensity, "Point Density", "" ) -DefNode( ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, "TEX_COORD", TexCoord, "Texture Coordinate","" ) -DefNode( ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, "VECT_TRANSFORM", VectorTransform, "Vector Transform", "" ) -DefNode( ShaderNode, SH_NODE_SEPHSV, 0, "SEPHSV", SeparateHSV, "Separate HSV", "" ) -DefNode( ShaderNode, SH_NODE_COMBHSV, 0, "COMBHSV", CombineHSV, "Combine HSV", "" ) -DefNode( ShaderNode, SH_NODE_UVMAP, def_sh_uvmap, "UVMAP", UVMap, "UV Map", "" ) -DefNode( ShaderNode, SH_NODE_UVALONGSTROKE, def_sh_uvalongstroke, "UVALONGSTROKE", UVAlongStroke, "UV Along Stroke", "" ) -DefNode( ShaderNode, SH_NODE_SEPXYZ, 0, "SEPXYZ", SeparateXYZ, "Separate XYZ", "" ) -DefNode( ShaderNode, SH_NODE_COMBXYZ, 0, "COMBXYZ", CombineXYZ, "Combine XYZ", "" ) -DefNode( ShaderNode, SH_NODE_BEVEL, def_sh_bevel, "BEVEL", Bevel, "Bevel", "" ) -DefNode( ShaderNode, SH_NODE_DISPLACEMENT, def_sh_displacement, "DISPLACEMENT", Displacement, "Displacement", "" ) -DefNode( ShaderNode, SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,"VECTOR_DISPLACEMENT",VectorDisplacement,"Vector Displacement","" ) -DefNode( ShaderNode, SH_NODE_TEX_IES, def_sh_tex_ies, "TEX_IES", TexIES, "IES Texture", "" ) +DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, "OUTPUT_MATERIAL", OutputMaterial, "Material Output", "" ); +DefNode( ShaderNode, SH_NODE_EEVEE_SPECULAR, 0, "EEVEE_SPECULAR", EeveeSpecular, "Specular", "" ); +DefNode( ShaderNode, SH_NODE_OUTPUT_LIGHT, def_sh_output, "OUTPUT_LIGHT", OutputLight, "Light Output", "" ); +DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, "OUTPUT_WORLD", OutputWorld, "World Output", "" ); +DefNode( ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,"OUTPUT_LINESTYLE", OutputLineStyle, "Line Style Output", "" ); +DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" ); +DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "Layer Weight", "" ); +DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" ); +DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" ); +DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" ); +DefNode( ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,"AMBIENT_OCCLUSION", AmbientOcclusion, "Ambient Occlusion", "" ); +DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" ); +DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, "BSDF_PRINCIPLED", BsdfPrincipled, "Principled BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, "BSDF_REFRACTION", BsdfRefraction, "Refraction BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_TOON, def_toon, "BSDF_TOON", BsdfToon, "Toon BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_HAIR, def_hair, "BSDF_HAIR", BsdfHair, "Hair BSDF", "" ); +DefNode( ShaderNode, SH_NODE_BSDF_HAIR_PRINCIPLED, def_hair_principled, "BSDF_HAIR_PRINCIPLED", BsdfHairPrincipled, "Principled Hair BSDF", ""); +DefNode( ShaderNode, SH_NODE_SUBSURFACE_SCATTERING, def_sh_subsurface, "SUBSURFACE_SCATTERING",SubsurfaceScattering,"Subsurface Scattering",""); +DefNode( ShaderNode, SH_NODE_VOLUME_ABSORPTION, 0, "VOLUME_ABSORPTION", VolumeAbsorption, "Volume Absorption", "" ); +DefNode( ShaderNode, SH_NODE_VOLUME_SCATTER, 0, "VOLUME_SCATTER", VolumeScatter, "Volume Scatter", "" ); +DefNode( ShaderNode, SH_NODE_VOLUME_PRINCIPLED, 0, "PRINCIPLED_VOLUME", VolumePrincipled, "Principled Volume", "" ); +DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" ); +DefNode( ShaderNode, SH_NODE_NEW_GEOMETRY, 0, "NEW_GEOMETRY", NewGeometry, "Geometry", "" ); +DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", LightPath, "Light Path", "" ); +DefNode( ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LIGHT_FALLOFF", LightFalloff, "Light Falloff", "" ); +DefNode( ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" ); +DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" ); +DefNode( ShaderNode, SH_NODE_HAIR_INFO, 0, "HAIR_INFO", HairInfo, "Hair Info", "" ); +DefNode( ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, "WIREFRAME", Wireframe, "Wireframe", "" ); +DefNode( ShaderNode, SH_NODE_WAVELENGTH, 0, "WAVELENGTH", Wavelength, "Wavelength", "" ); +DefNode( ShaderNode, SH_NODE_BLACKBODY, 0, "BLACKBODY", Blackbody, "Blackbody", "" ); +DefNode( ShaderNode, SH_NODE_BUMP, def_sh_bump, "BUMP", Bump, "Bump", "" ); +DefNode( ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" ); +DefNode( ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" ); +DefNode( ShaderNode, SH_NODE_SCRIPT, def_sh_script, "SCRIPT", Script, "Script", "" ); +DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture","" ); +DefNode( ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, "TEX_GRADIENT", TexGradient, "Gradient Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, "TEX_NOISE", TexNoise, "Noise Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, "TEX_WAVE", TexWave, "Wave Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, "TEX_CHECKER", TexChecker, "Checker Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, "TEX_BRICK", TexBrick, "Brick Texture", "" ); +DefNode( ShaderNode, SH_NODE_TEX_POINTDENSITY, def_sh_tex_pointdensity,"TEX_POINTDENSITY", TexPointDensity, "Point Density", "" ); +DefNode( ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, "TEX_COORD", TexCoord, "Texture Coordinate","" ); +DefNode( ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, "VECT_TRANSFORM", VectorTransform, "Vector Transform", "" ); +DefNode( ShaderNode, SH_NODE_SEPHSV, 0, "SEPHSV", SeparateHSV, "Separate HSV", "" ); +DefNode( ShaderNode, SH_NODE_COMBHSV, 0, "COMBHSV", CombineHSV, "Combine HSV", "" ); +DefNode( ShaderNode, SH_NODE_UVMAP, def_sh_uvmap, "UVMAP", UVMap, "UV Map", "" ); +DefNode( ShaderNode, SH_NODE_UVALONGSTROKE, def_sh_uvalongstroke, "UVALONGSTROKE", UVAlongStroke, "UV Along Stroke", "" ); +DefNode( ShaderNode, SH_NODE_SEPXYZ, 0, "SEPXYZ", SeparateXYZ, "Separate XYZ", "" ); +DefNode( ShaderNode, SH_NODE_COMBXYZ, 0, "COMBXYZ", CombineXYZ, "Combine XYZ", "" ); +DefNode( ShaderNode, SH_NODE_BEVEL, def_sh_bevel, "BEVEL", Bevel, "Bevel", "" ); +DefNode( ShaderNode, SH_NODE_DISPLACEMENT, def_sh_displacement, "DISPLACEMENT", Displacement, "Displacement", "" ); +DefNode( ShaderNode, SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,"VECTOR_DISPLACEMENT",VectorDisplacement,"Vector Displacement","" ); +DefNode( ShaderNode, SH_NODE_TEX_IES, def_sh_tex_ies, "TEX_IES", TexIES, "IES Texture", "" ); -DefNode( CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, "VIEWER", Viewer, "Viewer", "" ) -DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" ) -DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" ) -DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix", "" ) -DefNode( CompositorNode, CMP_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" ) -DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ) -DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" ) -DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curves", "" ) -DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" ) -DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" ) -DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" ) -DefNode( CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" ) -DefNode( CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, "MAP_VALUE", MapValue, "Map Value", "" ) -DefNode( CompositorNode, CMP_NODE_MAP_RANGE, def_cmp_map_range, "MAP_RANGE", MapRange, "Map Range", "" ) -DefNode( CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" ) -DefNode( CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, "VECBLUR", VecBlur, "Vector Blur", "" ) -DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" ) -DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" ) -DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" ) -DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SAT", HueSat, "Hue Saturation Value","" ) -DefNode( CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" ) -DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" ) -DefNode( CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" ) +DefNode( CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, "VIEWER", Viewer, "Viewer", "" ); +DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" ); +DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" ); +DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix", "" ); +DefNode( CompositorNode, CMP_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" ); +DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ); +DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" ); +DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curves", "" ); +DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" ); +DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" ); +DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" ); +DefNode( CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" ); +DefNode( CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, "MAP_VALUE", MapValue, "Map Value", "" ); +DefNode( CompositorNode, CMP_NODE_MAP_RANGE, def_cmp_map_range, "MAP_RANGE", MapRange, "Map Range", "" ); +DefNode( CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" ); +DefNode( CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, "VECBLUR", VecBlur, "Vector Blur", "" ); +DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" ); +DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" ); +DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" ); +DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SAT", HueSat, "Hue Saturation Value","" ); +DefNode( CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" ); +DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" ); +DefNode( CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" ); /* NB: OutputFile node has special rna setup function called in rna_nodetree.c */ -DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, 0, "OUTPUT_FILE", OutputFile, "File Output", "" ) -DefNode( CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ) -DefNode( CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, "TRANSLATE", Translate, "Translate", "" ) -DefNode( CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMBINE", Zcombine, "Z Combine", "" ) -DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" ) -DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" ) -DefNode( CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, "INPAINT", Inpaint, "Inpaint", "" ) -DefNode( CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, "DESPECKLE", Despeckle, "Despeckle", "" ) -DefNode( CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" ) -DefNode( CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" ) -DefNode( CompositorNode, CMP_NODE_SEPYCCA, def_cmp_ycc, "SEPYCCA", SepYCCA, "Separate YCbCrA", "" ) -DefNode( CompositorNode, CMP_NODE_COMBYCCA, def_cmp_ycc, "COMBYCCA", CombYCCA, "Combine YCbCrA", "" ) -DefNode( CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" ) -DefNode( CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" ) -DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, "DIFF_MATTE", DiffMatte, "Difference Key", "" ) -DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, "COLOR_SPILL", ColorSpill, "Color Spill", "" ) -DefNode( CompositorNode, CMP_NODE_CHROMA_MATTE, def_cmp_chroma_matte, "CHROMA_MATTE", ChromaMatte, "Chroma Key", "" ) -DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, "CHANNEL_MATTE", ChannelMatte, "Channel Key", "" ) -DefNode( CompositorNode, CMP_NODE_FLIP, def_cmp_flip, "FLIP", Flip, "Flip", "" ) -DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, "SPLITVIEWER", SplitViewer, "Split Viewer", "" ) -DefNode( CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, "MAP_UV", MapUV, "Map UV", "" ) -DefNode( CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, "ID_MASK", IDMask, "ID Mask", "" ) -DefNode( CompositorNode, CMP_NODE_DOUBLEEDGEMASK, def_cmp_double_edge_mask,"DOUBLEEDGEMASK", DoubleEdgeMask, "Double Edge Mask", "" ) -DefNode( CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, "DEFOCUS", Defocus, "Defocus", "" ) -DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" ) -DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" ) -DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" ) -DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" ) -DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" ) -DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" ) -DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" ) -DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" ) -DefNode( CompositorNode, CMP_NODE_CROP, def_cmp_crop, "CROP", Crop, "Crop", "" ) -DefNode( CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, "DBLUR", DBlur, "Directional Blur", "" ) -DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" ) -DefNode( CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, "PREMULKEY", PremulKey, "Alpha Convert", "" ) -DefNode( CompositorNode, CMP_NODE_GLARE, def_cmp_glare, "GLARE", Glare, "Glare", "" ) -DefNode( CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, "TONEMAP", Tonemap, "Tonemap", "" ) -DefNode( CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, "LENSDIST", Lensdist, "Lens Distortion", "" ) -DefNode( CompositorNode, CMP_NODE_VIEW_LEVELS, def_cmp_levels, "LEVELS", Levels, "Levels", "" ) -DefNode( CompositorNode, CMP_NODE_COLOR_MATTE, def_cmp_color_matte, "COLOR_MATTE", ColorMatte, "Color Key", "" ) -DefNode( CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, "DISTANCE_MATTE", DistanceMatte, "Distance Key", "" ) -DefNode( CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, "COLORBALANCE", ColorBalance, "Color Balance", "" ) -DefNode( CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, "HUECORRECT", HueCorrect, "Hue Correct", "" ) -DefNode( CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, "MOVIECLIP", MovieClip, "Movie Clip", "" ) -DefNode( CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, "TRANSFORM", Transform, "Transform", "" ) -DefNode( CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, "STABILIZE2D", Stabilize, "Stabilize 2D", "" ) -DefNode( CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion,"MOVIEDISTORTION",MovieDistortion, "Movie Distortion", "" ) -DefNode( CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, "BOXMASK", BoxMask, "Box Mask", "" ) -DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, "ELLIPSEMASK", EllipseMask, "Ellipse Mask", "" ) -DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, "BOKEHIMAGE", BokehImage, "Bokeh Image", "" ) -DefNode( CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, "BOKEHBLUR", BokehBlur, "Bokeh Blur", "" ) -DefNode( CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, "SWITCH", Switch, "Switch", "" ) -DefNode( CompositorNode, CMP_NODE_SWITCH_VIEW, def_cmp_switch_view, "VIEWSWITCH", SwitchView, "View Switch", "" ) -DefNode( CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLORCORRECTION",ColorCorrection, "Color Correction", "" ) -DefNode( CompositorNode, CMP_NODE_MASK, def_cmp_mask, "MASK", Mask, "Mask", "" ) -DefNode( CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, "KEYINGSCREEN", KeyingScreen, "Keying Screen", "" ) -DefNode( CompositorNode, CMP_NODE_KEYING, def_cmp_keying, "KEYING", Keying, "Keying", "" ) -DefNode( CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, "TRACKPOS", TrackPos, "Track Position", "" ) -DefNode( CompositorNode, CMP_NODE_PIXELATE, 0, "PIXELATE", Pixelate, "Pixelate", "" ) -DefNode( CompositorNode, CMP_NODE_PLANETRACKDEFORM,def_cmp_planetrackdeform,"PLANETRACKDEFORM",PlaneTrackDeform,"Plane Track Deform","" ) -DefNode( CompositorNode, CMP_NODE_CORNERPIN, 0, "CORNERPIN", CornerPin, "Corner Pin", "" ) -DefNode( CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, "SUNBEAMS", SunBeams, "Sun Beams", "" ) -DefNode( CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, "CRYPTOMATTE", Cryptomatte, "Cryptomatte", "" ) +DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, 0, "OUTPUT_FILE", OutputFile, "File Output", "" ); +DefNode( CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ); +DefNode( CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, "TRANSLATE", Translate, "Translate", "" ); +DefNode( CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMBINE", Zcombine, "Z Combine", "" ); +DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" ); +DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" ); +DefNode( CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, "INPAINT", Inpaint, "Inpaint", "" ); +DefNode( CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, "DESPECKLE", Despeckle, "Despeckle", "" ); +DefNode( CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" ); +DefNode( CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" ); +DefNode( CompositorNode, CMP_NODE_SEPYCCA, def_cmp_ycc, "SEPYCCA", SepYCCA, "Separate YCbCrA", "" ); +DefNode( CompositorNode, CMP_NODE_COMBYCCA, def_cmp_ycc, "COMBYCCA", CombYCCA, "Combine YCbCrA", "" ); +DefNode( CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" ); +DefNode( CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" ); +DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, "DIFF_MATTE", DiffMatte, "Difference Key", "" ); +DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, "COLOR_SPILL", ColorSpill, "Color Spill", "" ); +DefNode( CompositorNode, CMP_NODE_CHROMA_MATTE, def_cmp_chroma_matte, "CHROMA_MATTE", ChromaMatte, "Chroma Key", "" ); +DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, "CHANNEL_MATTE", ChannelMatte, "Channel Key", "" ); +DefNode( CompositorNode, CMP_NODE_FLIP, def_cmp_flip, "FLIP", Flip, "Flip", "" ); +DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, "SPLITVIEWER", SplitViewer, "Split Viewer", "" ); +DefNode( CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, "MAP_UV", MapUV, "Map UV", "" ); +DefNode( CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, "ID_MASK", IDMask, "ID Mask", "" ); +DefNode( CompositorNode, CMP_NODE_DOUBLEEDGEMASK, def_cmp_double_edge_mask,"DOUBLEEDGEMASK", DoubleEdgeMask, "Double Edge Mask", "" ); +DefNode( CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, "DEFOCUS", Defocus, "Defocus", "" ); +DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" ); +DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" ); +DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" ); +DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" ); +DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" ); +DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" ); +DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" ); +DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" ); +DefNode( CompositorNode, CMP_NODE_CROP, def_cmp_crop, "CROP", Crop, "Crop", "" ); +DefNode( CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, "DBLUR", DBlur, "Directional Blur", "" ); +DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" ); +DefNode( CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, "PREMULKEY", PremulKey, "Alpha Convert", "" ); +DefNode( CompositorNode, CMP_NODE_GLARE, def_cmp_glare, "GLARE", Glare, "Glare", "" ); +DefNode( CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, "TONEMAP", Tonemap, "Tonemap", "" ); +DefNode( CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, "LENSDIST", Lensdist, "Lens Distortion", "" ); +DefNode( CompositorNode, CMP_NODE_VIEW_LEVELS, def_cmp_levels, "LEVELS", Levels, "Levels", "" ); +DefNode( CompositorNode, CMP_NODE_COLOR_MATTE, def_cmp_color_matte, "COLOR_MATTE", ColorMatte, "Color Key", "" ); +DefNode( CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, "DISTANCE_MATTE", DistanceMatte, "Distance Key", "" ); +DefNode( CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, "COLORBALANCE", ColorBalance, "Color Balance", "" ); +DefNode( CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, "HUECORRECT", HueCorrect, "Hue Correct", "" ); +DefNode( CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, "MOVIECLIP", MovieClip, "Movie Clip", "" ); +DefNode( CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, "TRANSFORM", Transform, "Transform", "" ); +DefNode( CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, "STABILIZE2D", Stabilize, "Stabilize 2D", "" ); +DefNode( CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion,"MOVIEDISTORTION",MovieDistortion, "Movie Distortion", "" ); +DefNode( CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, "BOXMASK", BoxMask, "Box Mask", "" ); +DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, "ELLIPSEMASK", EllipseMask, "Ellipse Mask", "" ); +DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, "BOKEHIMAGE", BokehImage, "Bokeh Image", "" ); +DefNode( CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, "BOKEHBLUR", BokehBlur, "Bokeh Blur", "" ); +DefNode( CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, "SWITCH", Switch, "Switch", "" ); +DefNode( CompositorNode, CMP_NODE_SWITCH_VIEW, def_cmp_switch_view, "VIEWSWITCH", SwitchView, "View Switch", "" ); +DefNode( CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLORCORRECTION",ColorCorrection, "Color Correction", "" ); +DefNode( CompositorNode, CMP_NODE_MASK, def_cmp_mask, "MASK", Mask, "Mask", "" ); +DefNode( CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, "KEYINGSCREEN", KeyingScreen, "Keying Screen", "" ); +DefNode( CompositorNode, CMP_NODE_KEYING, def_cmp_keying, "KEYING", Keying, "Keying", "" ); +DefNode( CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, "TRACKPOS", TrackPos, "Track Position", "" ); +DefNode( CompositorNode, CMP_NODE_PIXELATE, 0, "PIXELATE", Pixelate, "Pixelate", "" ); +DefNode( CompositorNode, CMP_NODE_PLANETRACKDEFORM,def_cmp_planetrackdeform,"PLANETRACKDEFORM",PlaneTrackDeform,"Plane Track Deform","" ); +DefNode( CompositorNode, CMP_NODE_CORNERPIN, 0, "CORNERPIN", CornerPin, "Corner Pin", "" ); +DefNode( CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, "SUNBEAMS", SunBeams, "Sun Beams", "" ); +DefNode( CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, "CRYPTOMATTE", Cryptomatte, "Cryptomatte", "" ); -DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" ) -DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" ) -DefNode( TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ) -DefNode( TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" ) -DefNode( TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" ) -DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" ) -DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ) -DefNode( TextureNode, TEX_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" ) -DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" ) -DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" ) -DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" ) -DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" ) -DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" ) -DefNode( TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" ) -DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" ) -DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" ) -DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" ) -DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" ) -DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Combine RGBA", "" ) -DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Separate RGBA", "" ) -DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Value to Normal", "" ) -DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" ) -DefNode( TextureNode, TEX_NODE_AT, 0, "AT", At, "At", "" ) +DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" ); +DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" ); +DefNode( TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ); +DefNode( TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" ); +DefNode( TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" ); +DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" ); +DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ); +DefNode( TextureNode, TEX_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" ); +DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" ); +DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" ); +DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" ); +DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" ); +DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" ); +DefNode( TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" ); +DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" ); +DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" ); +DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" ); +DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" ); +DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Combine RGBA", "" ); +DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Separate RGBA", "" ); +DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Value to Normal", "" ); +DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" ); +DefNode( TextureNode, TEX_NODE_AT, 0, "AT", At, "At", "" ); /* procedural textures */ -DefNode( TextureNode, TEX_NODE_PROC+TEX_VORONOI, 0, "TEX_VORONOI", TexVoronoi, "Voronoi", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_BLEND, 0, "TEX_BLEND", TexBlend, "Blend", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_MAGIC, 0, "TEX_MAGIC", TexMagic, "Magic", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_MARBLE, 0, "TEX_MARBLE", TexMarble, "Marble", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_CLOUDS, 0, "TEX_CLOUDS", TexClouds, "Clouds", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_WOOD, 0, "TEX_WOOD", TexWood, "Wood", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_MUSGRAVE, 0, "TEX_MUSGRAVE", TexMusgrave, "Musgrave", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_NOISE, 0, "TEX_NOISE", TexNoise, "Noise", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_STUCCI, 0, "TEX_STUCCI", TexStucci, "Stucci", "" ) -DefNode( TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, "TEX_DISTNOISE", TexDistNoise, "Distorted Noise", "" ) +DefNode( TextureNode, TEX_NODE_PROC+TEX_VORONOI, 0, "TEX_VORONOI", TexVoronoi, "Voronoi", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_BLEND, 0, "TEX_BLEND", TexBlend, "Blend", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_MAGIC, 0, "TEX_MAGIC", TexMagic, "Magic", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_MARBLE, 0, "TEX_MARBLE", TexMarble, "Marble", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_CLOUDS, 0, "TEX_CLOUDS", TexClouds, "Clouds", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_WOOD, 0, "TEX_WOOD", TexWood, "Wood", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_MUSGRAVE, 0, "TEX_MUSGRAVE", TexMusgrave, "Musgrave", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_NOISE, 0, "TEX_NOISE", TexNoise, "Noise", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_STUCCI, 0, "TEX_STUCCI", TexStucci, "Stucci", "" ); +DefNode( TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, "TEX_DISTNOISE", TexDistNoise, "Distorted Noise", "" ); /* undefine macros */ diff --git a/source/blender/nodes/NOD_texture.h b/source/blender/nodes/NOD_texture.h index 6b4c4b3066a..b1aff02ef7b 100644 --- a/source/blender/nodes/NOD_texture.h +++ b/source/blender/nodes/NOD_texture.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file NOD_texture.h - * \ingroup nodes +/** \file \ingroup nodes */ #ifndef __NOD_TEXTURE_H__ diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 3f762ebca99..bf01504bce7 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/node_composite_tree.c - * \ingroup nodes +/** \file \ingroup nodes */ @@ -195,9 +194,9 @@ void register_node_tree_type_cmp(void) tt->type = NTREE_COMPOSIT; strcpy(tt->idname, "CompositorNodeTree"); - strcpy(tt->ui_name, "Compositing"); + strcpy(tt->ui_name, N_("Compositing")); tt->ui_icon = 0; /* defined in drawnode.c */ - strcpy(tt->ui_description, "Compositing nodes"); + strcpy(tt->ui_description, N_("Compositing nodes")); tt->free_cache = free_cache; tt->free_node_cache = free_node_cache; @@ -253,7 +252,7 @@ void ntreeCompositUpdateRLayers(bNodeTree *ntree) } -void ntreeCompositRegisterPass(bNodeTree *ntree, Scene *scene, SceneRenderLayer *srl, const char *name, int type) +void ntreeCompositRegisterPass(bNodeTree *ntree, Scene *scene, ViewLayer *view_layer, const char *name, int type) { bNode *node; @@ -261,7 +260,7 @@ void ntreeCompositRegisterPass(bNodeTree *ntree, Scene *scene, SceneRenderLayer for (node = ntree->nodes.first; node; node = node->next) { if (node->type == CMP_NODE_R_LAYERS) - node_cmp_rlayers_register_pass(ntree, node, scene, srl, name, type); + node_cmp_rlayers_register_pass(ntree, node, scene, view_layer, name, type); } } diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 79b9278e2f5..cef11424016 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/node_composite_util.c - * \ingroup nodes +/** \file \ingroup nodes */ #include "node_composite_util.h" diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h index 8ad5b4bb7de..a6c2738e30a 100644 --- a/source/blender/nodes/composite/node_composite_util.h +++ b/source/blender/nodes/composite/node_composite_util.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/node_composite_util.h - * \ingroup nodes +/** \file \ingroup nodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c index 092d269ac4e..caf63adf48b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_alphaOver.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -28,11 +27,11 @@ static bNodeSocketTemplate cmp_node_alphaover_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_alphaover_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c index d6069d631c3..7099dcef831 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_bilateralblur.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 7ab490d9467..442c8f6919d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -18,8 +18,7 @@ * Juho Vepsäläinen */ -/** \file blender/nodes/composite/nodes/node_composite_blur.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c index 98b6d57cf42..39b772542a8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c @@ -18,8 +18,7 @@ * Juho Vepsäläinen */ -/** \file blender/nodes/composite/nodes/node_composite_bokehblur.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c index 803d2c1eba1..ecc13bc62c6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c @@ -18,8 +18,7 @@ */ -/** \file blender/nodes/composite/nodes/node_composite_bokehimage.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -29,7 +28,7 @@ static bNodeSocketTemplate cmp_node_bokehimage_out[] = { { SOCK_RGBA, 0, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c index 195b4d639b9..d283db15bc0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_boxmask.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c index 01bbb48950d..56d25a717be 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.c +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_brightness.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -31,11 +30,11 @@ static bNodeSocketTemplate cmp_node_brightcontrast_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_brightcontrast_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index dffde4f94ae..a825b7ad9fa 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_channelMatte.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,13 +27,13 @@ /* ******************* Channel Matte Node ********************************* */ static bNodeSocketTemplate cmp_node_channel_matte_in[] = { {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate cmp_node_channel_matte_out[] = { {SOCK_RGBA, 0, N_("Image")}, {SOCK_FLOAT, 0, N_("Matte")}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index 0d480034e4c..28a8b06f50d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_chromaMatte.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,13 +27,13 @@ static bNodeSocketTemplate cmp_node_chroma_in[] = { {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate cmp_node_chroma_out[] = { {SOCK_RGBA, 0, N_("Image")}, {SOCK_FLOAT, 0, N_("Matte")}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index e5e81ebcb4f..0632d62ff76 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_colorMatte.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,13 +27,13 @@ static bNodeSocketTemplate cmp_node_color_in[] = { {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate cmp_node_color_out[] = { {SOCK_RGBA, 0, N_("Image")}, {SOCK_FLOAT, 0, N_("Matte")}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c index 009076aa8d9..aaf43c047d5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_colorSpill.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -27,12 +26,12 @@ static bNodeSocketTemplate cmp_node_color_spill_in[] = { {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate cmp_node_color_spill_out[] = { {SOCK_RGBA, 0, N_("Image")}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index 66d355e6014..23204921e0f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_colorbalance.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -27,12 +26,12 @@ static bNodeSocketTemplate cmp_node_colorbalance_in[] = { {SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate cmp_node_colorbalance_out[] = { {SOCK_RGBA, 0, N_("Image")}, - {-1, 0, ""} + {-1, 0, ""}, }; /* Sync functions update formula parameters for other modes, such that the result is comparable. diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c index 103d2ac39f0..5a1c1857381 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_colorcorrection.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -28,12 +27,12 @@ static bNodeSocketTemplate cmp_node_colorcorrection_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, ""} + { -1, 0, ""}, }; static bNodeSocketTemplate cmp_node_colorcorrection_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, ""} + { -1, 0, ""}, }; static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c index def02a9a67f..9e378846ef1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.c +++ b/source/blender/nodes/composite/nodes/node_composite_common.c @@ -18,8 +18,7 @@ * Juho Vepsäläinen */ -/** \file blender/nodes/composite/nodes/node_composite_common.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "DNA_node_types.h" diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c index 91e93c53324..cd57f2e1f3e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.c +++ b/source/blender/nodes/composite/nodes/node_composite_composite.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_composite.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -28,7 +27,7 @@ static bNodeSocketTemplate cmp_node_composite_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_composite(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_cornerpin.c b/source/blender/nodes/composite/nodes/node_composite_cornerpin.c index 6822f060687..37fd199a409 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cornerpin.c +++ b/source/blender/nodes/composite/nodes/node_composite_cornerpin.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_cornerpin.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -36,7 +35,7 @@ static bNodeSocketTemplate inputs[] = { static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Image")}, { SOCK_FLOAT, 0, N_("Plane")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_cornerpin(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c index 261f979db0f..2eb5ab26623 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.c +++ b/source/blender/nodes/composite/nodes/node_composite_crop.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_crop.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,11 +27,11 @@ static bNodeSocketTemplate cmp_node_crop_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_crop_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c index 7b76d4d6395..0f216d7a92f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_cryptomatte.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -29,7 +28,7 @@ /* this is taken from the cryptomatte specification 1.0 */ -static inline float hash_to_float(uint32_t hash) +BLI_INLINE float hash_to_float(uint32_t hash) { uint32_t mantissa = hash & ((1 << 23) - 1); uint32_t exponent = (hash >> 23) & ((1 << 8) - 1); diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c index 9a7b8f10daf..57ab8c28bc4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ b/source/blender/nodes/composite/nodes/node_composite_curves.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_curves.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -30,7 +29,7 @@ /* custom1 = sfra, custom2 = efra */ static bNodeSocketTemplate cmp_node_time_out[] = { { SOCK_FLOAT, 0, N_("Fac")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node) @@ -58,12 +57,12 @@ void register_node_type_cmp_curve_time(void) /* **************** CURVE VEC ******************** */ static bNodeSocketTemplate cmp_node_curve_vec_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_curve_vec_out[] = { { SOCK_VECTOR, 0, N_("Vector")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) @@ -91,12 +90,12 @@ static bNodeSocketTemplate cmp_node_curve_rgb_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Black Level"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("White Level"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_curve_rgb_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 8e1777d8ad6..4bf15a7a339 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_defocus.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -29,11 +28,11 @@ static bNodeSocketTemplate cmp_node_defocus_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_defocus_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.c b/source/blender/nodes/composite/nodes/node_composite_despeckle.c index 4ffe843c95f..81d04eb92e5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.c +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_despeckle.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -27,11 +26,11 @@ static bNodeSocketTemplate cmp_node_despeckle_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_despeckle_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_despeckle(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index e35d02a6c18..6c057f3099a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_diffMatte.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,13 +27,13 @@ static bNodeSocketTemplate cmp_node_diff_matte_in[] = { {SOCK_RGBA, 1, N_("Image 1"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_RGBA, 1, N_("Image 2"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate cmp_node_diff_matte_out[] = { {SOCK_RGBA, 0, N_("Image")}, {SOCK_FLOAT, 0, N_("Matte")}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c index b943b0bbc12..b01fb096e6b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.c +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_dilate.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index b68107a4a6b..01531c2220b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_directionalblur.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index f11fafcd12d..922abd14ef7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_displace.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -32,11 +31,11 @@ static bNodeSocketTemplate cmp_node_displace_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION}, { SOCK_FLOAT, 1, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_displace_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_displace(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c index 5a612a31c44..11aacb965cb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_distanceMatte.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,13 +27,13 @@ static bNodeSocketTemplate cmp_node_distance_matte_in[] = { {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate cmp_node_distance_matte_out[] = { {SOCK_RGBA, 0, N_("Image")}, {SOCK_FLOAT, 0, N_("Matte")}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c index f6b1d98f03c..556eb6901b0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" /* **************** Double Edge Mask ******************** */ @@ -27,11 +26,11 @@ static bNodeSocketTemplate cmp_node_doubleedgemask_in[] = { { SOCK_FLOAT, 1, "Inner Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, // inner mask socket definition { SOCK_FLOAT, 1, "Outer Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, // outer mask socket definition - { -1, 0, "" } // input socket array terminator + { -1, 0, "" }, // input socket array terminator }; static bNodeSocketTemplate cmp_node_doubleedgemask_out[] = { { SOCK_FLOAT, 0, "Mask"}, // output socket definition - { -1, 0, "" } // output socket array terminator + { -1, 0, "" }, // output socket array terminator }; void register_node_type_cmp_doubleedgemask(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c index ff0de261cf9..89164c56014 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_ellipsemask.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c index 53c18313b6c..64020db77cc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.c +++ b/source/blender/nodes/composite/nodes/node_composite_filter.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_filter.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,11 +27,11 @@ static bNodeSocketTemplate cmp_node_filter_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_filter_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_filter(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c index 2800f20f5e5..59dfe6b772b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.c +++ b/source/blender/nodes/composite/nodes/node_composite_flip.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_flip.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -27,12 +26,12 @@ /* **************** Flip ******************** */ static bNodeSocketTemplate cmp_node_flip_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_flip_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_flip(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c index 7a6579c1149..a6066435827 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_gamma.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -29,11 +28,11 @@ static bNodeSocketTemplate cmp_node_gamma_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_gamma_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_gamma(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index 78c56c4ef4a..8082a0b329b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_glare.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -26,11 +25,11 @@ static bNodeSocketTemplate cmp_node_glare_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_glare_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index 33981bfba97..237b800c781 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_hueSatVal.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -32,11 +31,11 @@ static bNodeSocketTemplate cmp_node_hue_sat_in[] = { { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_hue_sat_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_hue_sat(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index 2a8e5445c73..5b7d46ca1a6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_huecorrect.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -27,12 +26,12 @@ static bNodeSocketTemplate cmp_node_huecorrect_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_huecorrect_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c index 5def33d8033..4ea4f34f3c8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_idMask.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -29,11 +28,11 @@ static bNodeSocketTemplate cmp_node_idmask_in[] = { { SOCK_FLOAT, 1, N_("ID value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_idmask_out[] = { { SOCK_FLOAT, 0, N_("Alpha")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_idmask(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index e22f685461b..078e9037c28 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_image.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -33,6 +32,7 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_scene.h" /* **************** IMAGE (and RenderResult, multilayer image) ******************** */ @@ -43,14 +43,14 @@ static bNodeSocketTemplate cmp_node_rlayers_out[] = { { SOCK_VECTOR, 0, N_(RE_PASSNAME_NORMAL), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 0, N_(RE_PASSNAME_UV), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 0, N_(RE_PASSNAME_VECTOR), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 0, N_(RE_PASSNAME_RGBA), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 0, N_(RE_PASSNAME_DIFFUSE), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 0, N_(RE_PASSNAME_SPEC), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, N_(RE_PASSNAME_SHADOW), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, N_(RE_PASSNAME_AO), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 0, N_(RE_PASSNAME_REFLECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 0, N_(RE_PASSNAME_REFRACT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 0, N_(RE_PASSNAME_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, N_(RE_PASSNAME_DEPRECATED), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_(RE_PASSNAME_INDEXOB), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_(RE_PASSNAME_INDEXMA), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_(RE_PASSNAME_MIST), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -68,7 +68,7 @@ static bNodeSocketTemplate cmp_node_rlayers_out[] = { { SOCK_RGBA, 0, N_(RE_PASSNAME_SUBSURFACE_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, N_(RE_PASSNAME_SUBSURFACE_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, N_(RE_PASSNAME_SUBSURFACE_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void cmp_node_image_add_pass_output(bNodeTree *ntree, bNode *node, @@ -182,16 +182,16 @@ typedef struct RLayerUpdateData { int prev_index; } RLayerUpdateData; -void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode *node, Scene *scene, SceneRenderLayer *srl, const char *name, int type) +void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode *node, Scene *scene, ViewLayer *view_layer, const char *name, int type) { RLayerUpdateData *data = node->storage; - if (scene == NULL || srl == NULL || data == NULL || node->id != (ID *)scene) { + if (scene == NULL || view_layer == NULL || data == NULL || node->id != (ID *)scene) { return; } - SceneRenderLayer *node_srl = BLI_findlink(&scene->r.layers, node->custom1); - if (node_srl != srl) { + ViewLayer *node_view_layer = BLI_findlink(&scene->view_layers, node->custom1); + if (node_view_layer != view_layer) { return; } @@ -205,7 +205,7 @@ void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode *node, Scene *scene, } } -static void cmp_node_rlayer_create_outputs_cb(RenderEngine *UNUSED(engine), Scene *scene, SceneRenderLayer *srl, +static void cmp_node_rlayer_create_outputs_cb(RenderEngine *UNUSED(engine), Scene *scene, ViewLayer *view_layer, const char *name, int UNUSED(channels), const char *UNUSED(chanid), int type) { /* Register the pass in all scenes that have a render layer node for this layer. @@ -213,9 +213,11 @@ static void cmp_node_rlayer_create_outputs_cb(RenderEngine *UNUSED(engine), Scen * and check whether their nodetree has a node that needs to be updated. */ /* NOTE: using G_MAIN seems valid here, * unless we want to register that for every other temp Main we could generate??? */ + ntreeCompositRegisterPass(scene->nodetree, scene, view_layer, name, type); + for (Scene *sce = G_MAIN->scene.first; sce; sce = sce->id.next) { - if (sce->nodetree) { - ntreeCompositRegisterPass(sce->nodetree, scene, srl, name, type); + if (sce->nodetree && sce != scene) { + ntreeCompositRegisterPass(sce->nodetree, scene, view_layer, name, type); } } } @@ -227,15 +229,15 @@ static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, bNode *node, LinkNo if (scene) { RenderEngineType *engine_type = RE_engines_find(scene->r.engine); if (engine_type && engine_type->update_render_passes) { - SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, node->custom1); - if (srl) { + ViewLayer *view_layer = BLI_findlink(&scene->view_layers, node->custom1); + if (view_layer) { RLayerUpdateData *data = MEM_mallocN(sizeof(RLayerUpdateData), "render layer update data"); data->available_sockets = available_sockets; data->prev_index = -1; node->storage = data; RenderEngine *engine = RE_engine_create(engine_type); - RE_engine_update_render_passes(engine, scene, srl, cmp_node_rlayer_create_outputs_cb); + RE_engine_update_render_passes(engine, scene, view_layer, cmp_node_rlayer_create_outputs_cb); RE_engine_free(engine); MEM_freeN(data); @@ -312,8 +314,8 @@ static void node_composit_init_image(bNodeTree *ntree, bNode *node) node->storage = iuser; iuser->frames = 1; iuser->sfra = 1; - iuser->fie_ima = 2; iuser->ok = 1; + iuser->flag |= IMA_ANIM_ALWAYS; /* setup initial outputs */ cmp_node_image_verify_outputs(ntree, node, false); @@ -366,14 +368,14 @@ const char *node_cmp_rlayers_sock_to_pass(int sock_index) { const char *sock_to_passname[] = { RE_PASSNAME_COMBINED, RE_PASSNAME_COMBINED, - RE_PASSNAME_Z, RE_PASSNAME_NORMAL, RE_PASSNAME_UV, RE_PASSNAME_VECTOR, RE_PASSNAME_RGBA, - RE_PASSNAME_DIFFUSE, RE_PASSNAME_SPEC, RE_PASSNAME_SHADOW, RE_PASSNAME_AO, - RE_PASSNAME_REFLECT, RE_PASSNAME_REFRACT, RE_PASSNAME_INDIRECT, + RE_PASSNAME_Z, RE_PASSNAME_NORMAL, RE_PASSNAME_UV, RE_PASSNAME_VECTOR, RE_PASSNAME_DEPRECATED, + RE_PASSNAME_DEPRECATED, RE_PASSNAME_DEPRECATED, RE_PASSNAME_SHADOW, RE_PASSNAME_AO, + RE_PASSNAME_DEPRECATED, RE_PASSNAME_DEPRECATED, RE_PASSNAME_DEPRECATED, RE_PASSNAME_INDEXOB, RE_PASSNAME_INDEXMA, RE_PASSNAME_MIST, RE_PASSNAME_EMIT, RE_PASSNAME_ENVIRONMENT, RE_PASSNAME_DIFFUSE_DIRECT, RE_PASSNAME_DIFFUSE_INDIRECT, RE_PASSNAME_DIFFUSE_COLOR, RE_PASSNAME_GLOSSY_DIRECT, RE_PASSNAME_GLOSSY_INDIRECT, RE_PASSNAME_GLOSSY_COLOR, RE_PASSNAME_TRANSM_DIRECT, RE_PASSNAME_TRANSM_INDIRECT, RE_PASSNAME_TRANSM_COLOR, - RE_PASSNAME_SUBSURFACE_DIRECT, RE_PASSNAME_SUBSURFACE_INDIRECT, RE_PASSNAME_SUBSURFACE_COLOR + RE_PASSNAME_SUBSURFACE_DIRECT, RE_PASSNAME_SUBSURFACE_INDIRECT, RE_PASSNAME_SUBSURFACE_COLOR, }; if (sock_index > 30) { return NULL; @@ -420,8 +422,11 @@ static void node_composit_free_rlayers(bNode *node) bNodeSocket *sock; /* free extra socket info */ - for (sock = node->outputs.first; sock; sock = sock->next) - MEM_freeN(sock->storage); + for (sock = node->outputs.first; sock; sock = sock->next) { + if (sock->storage) { + MEM_freeN(sock->storage); + } + } } static void node_composit_copy_rlayers(bNodeTree *UNUSED(dest_ntree), bNode *UNUSED(dest_node), bNode *src_node) @@ -429,8 +434,11 @@ static void node_composit_copy_rlayers(bNodeTree *UNUSED(dest_ntree), bNode *UNU bNodeSocket *sock; /* copy extra socket info */ - for (sock = src_node->outputs.first; sock; sock = sock->next) - sock->new_sock->storage = MEM_dupallocN(sock->storage); + for (sock = src_node->outputs.first; sock; sock = sock->next) { + if (sock->storage) { + sock->new_sock->storage = MEM_dupallocN(sock->storage); + } + } } static void cmp_node_rlayers_update(bNodeTree *ntree, bNode *node) @@ -451,6 +459,7 @@ void register_node_type_cmp_rlayers(void) node_type_storage(&ntype, NULL, node_composit_free_rlayers, node_composit_copy_rlayers); node_type_update(&ntype, cmp_node_rlayers_update, NULL); node_type_init(&ntype, node_cmp_rlayers_outputs); + node_type_size_preset(&ntype, NODE_SIZE_LARGE); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.c b/source/blender/nodes/composite/nodes/node_composite_inpaint.c index a103da18f70..cfb025e5d30 100644 --- a/source/blender/nodes/composite/nodes/node_composite_inpaint.c +++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_inpaint.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index 7dadd31cfff..ead29ec27d6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_invert.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.c b/source/blender/nodes/composite/nodes/node_composite_keying.c index dd254353b9f..10331cb1b1b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.c +++ b/source/blender/nodes/composite/nodes/node_composite_keying.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_keying.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "BLT_translation.h" @@ -26,7 +25,6 @@ #include "DNA_movieclip_types.h" #include "BLI_math_base.h" -#include "BLI_math_color.h" #include "node_composite_util.h" @@ -37,14 +35,14 @@ static bNodeSocketTemplate cmp_node_keying_in[] = { { SOCK_RGBA, 1, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "Garbage Matte", 0.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "Core Matte", 0.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_keying_out[] = { { SOCK_RGBA, 0, "Image"}, { SOCK_FLOAT, 0, "Matte"}, { SOCK_FLOAT, 0, "Edges"}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c index e398d992a04..94cf862e904 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c +++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_keyingscreen.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "DNA_movieclip_types.h" @@ -32,7 +31,7 @@ static bNodeSocketTemplate cmp_node_keyingscreen_out[] = { { SOCK_RGBA, 0, "Screen"}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c index 91dae03783c..0ab3db9dd52 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_lensdist.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,11 +27,11 @@ static bNodeSocketTemplate cmp_node_lensdist_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Distort"), 0.f, 0.f, 0.f, 0.f, -0.999f, 1.f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Dispersion"), 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_lensdist_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index 05b4adc1f49..ffc178abce9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_levels.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,13 +27,13 @@ /* **************** LEVELS ******************** */ static bNodeSocketTemplate cmp_node_view_levels_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_view_levels_out[] = { {SOCK_FLOAT, 0, N_("Mean")}, {SOCK_FLOAT, 0, N_("Std Dev")}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c index 3b97f29ecaf..e99af34c929 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_lummaMatte.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,13 +27,13 @@ /* ******************* Luma Matte Node ********************************* */ static bNodeSocketTemplate cmp_node_luma_matte_in[] = { {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate cmp_node_luma_matte_out[] = { {SOCK_RGBA, 0, N_("Image")}, {SOCK_FLOAT, 0, N_("Matte")}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.c b/source/blender/nodes/composite/nodes/node_composite_mapRange.c index 524556e0b39..b7f3e754717 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapRange.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_mapRange.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -31,11 +30,11 @@ static bNodeSocketTemplate cmp_node_map_range_in[] = { { SOCK_FLOAT, 1, N_("From Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("To Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("To Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_map_range_out[] = { { SOCK_FLOAT, 0, N_("Value")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_map_range(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c index 942c810547b..1000d39678d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_mapUV.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -29,11 +28,11 @@ static bNodeSocketTemplate cmp_node_mapuv_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_VECTOR, 1, N_("UV"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_mapuv_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_mapuv(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c index 62d69ac1e33..59730293c33 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_mapValue.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -27,11 +26,11 @@ /* **************** MAP VALUE ******************** */ static bNodeSocketTemplate cmp_node_map_value_in[] = { { SOCK_FLOAT, 1, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_map_value_out[] = { { SOCK_FLOAT, 0, N_("Value")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c index 8262a93899a..16b9936ac1d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mask.c +++ b/source/blender/nodes/composite/nodes/node_composite_mask.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_mask.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "DNA_mask_types.h" diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c index 6b8229b43da..53588f58234 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.c +++ b/source/blender/nodes/composite/nodes/node_composite_math.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_math.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c index be5764d1549..4c957f89f59 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_mixrgb.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -28,11 +27,11 @@ static bNodeSocketTemplate cmp_node_mix_rgb_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_mix_rgb_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; /* custom1 = mix type */ diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c index de9ef24ada9..4717a0f28ea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_movieclip.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -32,7 +31,7 @@ static bNodeSocketTemplate cmp_node_movieclip_out[] = { { SOCK_FLOAT, 1, N_("Offset Y")}, { SOCK_FLOAT, 1, N_("Scale")}, { SOCK_FLOAT, 1, N_("Angle")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void init(const bContext *C, PointerRNA *ptr) diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c index 36f67dc39cb..1dbca0ffee3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_moviedistortion.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -29,12 +28,12 @@ static bNodeSocketTemplate cmp_node_moviedistortion_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_moviedistortion_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c index 1a98f3c47e5..35e7b862320 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normal.c +++ b/source/blender/nodes/composite/nodes/node_composite_normal.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_normal.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -27,13 +26,13 @@ /* **************** NORMAL ******************** */ static bNodeSocketTemplate cmp_node_normal_in[] = { { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_normal_out[] = { { SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, { SOCK_FLOAT, 0, N_("Dot")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_normal(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c index 480f4505cf9..7b647a387b5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.c +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_normalize.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index cdd53cf1d7c..97cda393d6a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_outputFile.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.c b/source/blender/nodes/composite/nodes/node_composite_pixelate.c index ad6968f0471..c43bd6da3f0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_pixelate.c +++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_pixelate.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c index d7fd312313c..753002e90ad 100644 --- a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c +++ b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_planetrackdeform.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -32,7 +31,7 @@ static bNodeSocketTemplate cmp_node_planetrackdeform_in[] = { static bNodeSocketTemplate cmp_node_planetrackdeform_out[] = { { SOCK_RGBA, 0, N_("Image")}, { SOCK_FLOAT, 0, N_("Plane")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void init(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c index 00b153b7731..74c12861c5c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_premulkey.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,11 +27,11 @@ static bNodeSocketTemplate cmp_node_premulkey_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_premulkey_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_premulkey(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c index 2b465116506..f2adbf81933 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_rgb.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -27,7 +26,7 @@ /* **************** RGB ******************** */ static bNodeSocketTemplate cmp_node_rgb_out[] = { { SOCK_RGBA, 0, N_("RGBA"), 0.5f, 0.5f, 0.5f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_rgb(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index 9cad4f4f24b..f593219aa3f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_rotate.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -29,11 +28,11 @@ static bNodeSocketTemplate cmp_node_rotate_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Degr"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_rotate_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c index 2e874b4c381..6788b83a3bd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.c +++ b/source/blender/nodes/composite/nodes/node_composite_scale.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_scale.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c index 184d5c24b73..1a227d9c56c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_sepcombHSVA.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,14 +27,14 @@ /* **************** SEPARATE HSVA ******************** */ static bNodeSocketTemplate cmp_node_sephsva_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_sephsva_out[] = { { SOCK_FLOAT, 0, N_("H")}, { SOCK_FLOAT, 0, N_("S")}, { SOCK_FLOAT, 0, N_("V")}, { SOCK_FLOAT, 0, N_("A")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_sephsva(void) @@ -55,11 +54,11 @@ static bNodeSocketTemplate cmp_node_combhsva_in[] = { { SOCK_FLOAT, 1, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_combhsva_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_combhsva(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c index f2a4d131349..7896218bc69 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_sepcombRGBA.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -27,14 +26,14 @@ /* **************** SEPARATE RGBA ******************** */ static bNodeSocketTemplate cmp_node_seprgba_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_seprgba_out[] = { { SOCK_FLOAT, 0, N_("R")}, { SOCK_FLOAT, 0, N_("G")}, { SOCK_FLOAT, 0, N_("B")}, { SOCK_FLOAT, 0, N_("A")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_seprgba(void) @@ -55,11 +54,11 @@ static bNodeSocketTemplate cmp_node_combrgba_in[] = { { SOCK_FLOAT, 1, N_("G"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("B"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_combrgba_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_combrgba(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c index 2d7fb3a422d..1b1c0c10efd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_sepcombYCCA.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -62,11 +61,11 @@ static bNodeSocketTemplate cmp_node_combycca_in[] = { { SOCK_FLOAT, 1, N_("Cb"), 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Cr"), 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_combycca_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_mode_combycca(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c index 10469d73bca..fa575eebf7c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_sepcombYUVA.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -56,11 +55,11 @@ static bNodeSocketTemplate cmp_node_combyuva_in[] = { { SOCK_FLOAT, 1, N_("U"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_combyuva_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_combyuva(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c index ce5144af8fa..39a69c8c594 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_setalpha.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,11 +27,11 @@ static bNodeSocketTemplate cmp_node_setalpha_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_setalpha_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_setalpha(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c index f2e4ca5da61..845069f719e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_splitViewer.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -31,7 +30,7 @@ static bNodeSocketTemplate cmp_node_splitviewer_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node) @@ -39,7 +38,6 @@ static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user"); node->storage = iuser; iuser->sfra = 1; - iuser->fie_ima = 2; iuser->ok = 1; node->custom1 = 50; /* default 50% split */ diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c index 6244b9e51cf..bd8af8be426 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_stabilize2d.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -29,12 +28,12 @@ static bNodeSocketTemplate cmp_node_stabilize2d_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_stabilize2d_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void init(const bContext *C, PointerRNA *ptr) diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.c b/source/blender/nodes/composite/nodes/node_composite_sunbeams.c index c7090afaacc..7a5ebde0c8a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.c +++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.c @@ -17,19 +17,18 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_sunbeams.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void init(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c index 1496c43f275..94a6c036826 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switch.c +++ b/source/blender/nodes/composite/nodes/node_composite_switch.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_switch.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "../node_composite_util.h" @@ -27,12 +26,12 @@ static bNodeSocketTemplate cmp_node_switch_in[] = { { SOCK_RGBA, 1, N_("Off"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("On"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_switch_out[] = { { SOCK_RGBA, 0, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; /* custom1 = mix type */ diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.c b/source/blender/nodes/composite/nodes/node_composite_switchview.c index d706af27ae3..d8e3e4f1d96 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switchview.c +++ b/source/blender/nodes/composite/nodes/node_composite_switchview.c @@ -18,8 +18,7 @@ * Dalai Felinto */ -/** \file blender/nodes/composite/nodes/node_composite_switchview.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "BKE_context.h" @@ -28,7 +27,7 @@ /* **************** SWITCH VIEW ******************** */ static bNodeSocketTemplate cmp_node_switch_view_out[] = { { SOCK_RGBA, 0, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocket *ntreeCompositSwitchViewAddSocket(bNodeTree *ntree, bNode *node, const char *name) diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c index c9e63da4d7f..cee5254682e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_texture.c +++ b/source/blender/nodes/composite/nodes/node_composite_texture.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_texture.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,12 +27,12 @@ static bNodeSocketTemplate cmp_node_texture_in[] = { { SOCK_VECTOR, 1, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_TRANSLATION}, { SOCK_VECTOR, 1, N_("Scale"), 1.0f, 1.0f, 1.0f, 1.0f, -10.0f, 10.0f, PROP_XYZ}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_texture_out[] = { { SOCK_FLOAT, 0, N_("Value")}, { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_texture(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c index 5d529ae67b6..59316d111da 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_tonemap.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -26,11 +25,11 @@ static bNodeSocketTemplate cmp_node_tonemap_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_tonemap_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.c b/source/blender/nodes/composite/nodes/node_composite_trackpos.c index b794e8e05c6..8c0cef23a68 100644 --- a/source/blender/nodes/composite/nodes/node_composite_trackpos.c +++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_trackpos.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,7 +27,7 @@ static bNodeSocketTemplate cmp_node_trackpos_out[] = { { SOCK_FLOAT, 0, N_("X")}, { SOCK_FLOAT, 0, N_("Y")}, { SOCK_VECTOR, 0, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY}, - { -1, 0, "" } + { -1, 0, "" }, }; static void init(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c index b56f9b656e0..713091d76bc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_transform.c +++ b/source/blender/nodes/composite/nodes/node_composite_transform.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_transform.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ #include "node_composite_util.h" @@ -31,12 +30,12 @@ static bNodeSocketTemplate cmp_node_transform_in[] = { { SOCK_FLOAT, 1, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, { SOCK_FLOAT, 1, N_("Angle"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, { SOCK_FLOAT, 1, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_transform_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_transform(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c index 214806b3d36..e8a43c8f852 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.c +++ b/source/blender/nodes/composite/nodes/node_composite_translate.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_translate.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -31,11 +30,11 @@ static bNodeSocketTemplate cmp_node_translate_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("X"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_translate_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_translate(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c index 08efe1829db..80effb0d7ee 100644 --- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_valToRgb.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -28,12 +27,12 @@ /* **************** VALTORGB ******************** */ static bNodeSocketTemplate cmp_node_valtorgb_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_valtorgb_out[] = { { SOCK_RGBA, 0, N_("Image")}, { SOCK_FLOAT, 0, N_("Alpha")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node) @@ -59,11 +58,11 @@ void register_node_type_cmp_valtorgb(void) /* **************** RGBTOBW ******************** */ static bNodeSocketTemplate cmp_node_rgbtobw_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_rgbtobw_out[] = { { SOCK_FLOAT, 0, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_rgbtobw(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c index b70fc5df2a5..6e5eea5d322 100644 --- a/source/blender/nodes/composite/nodes/node_composite_value.c +++ b/source/blender/nodes/composite/nodes/node_composite_value.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_value.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -27,7 +26,7 @@ /* **************** VALUE ******************** */ static bNodeSocketTemplate cmp_node_value_out[] = { { SOCK_FLOAT, 0, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_value(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c index 9a530d0c6da..2527e1ca5a5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_vecBlur.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c index 714c60416f8..d4101e74f10 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_viewer.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -41,7 +40,6 @@ static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node) ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user"); node->storage = iuser; iuser->sfra = 1; - iuser->fie_ima = 2; iuser->ok = 1; node->custom3 = 0.5f; node->custom4 = 0.5f; diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c index 27181b1c610..570485581f1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/composite/nodes/node_composite_zcombine.c - * \ingroup cmpnodes +/** \file \ingroup cmpnodes */ @@ -32,12 +31,12 @@ static bNodeSocketTemplate cmp_node_zcombine_in[] = { { SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate cmp_node_zcombine_out[] = { { SOCK_RGBA, 0, N_("Image")}, { SOCK_FLOAT, 0, N_("Z")}, - { -1, 0, "" } + { -1, 0, "" }, }; void register_node_type_cmp_zcombine(void) diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index ea963d7021b..dfdadc10b7b 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/intern/node_common.c - * \ingroup nodes +/** \file \ingroup nodes */ #include <string.h> @@ -202,7 +201,6 @@ void register_node_type_frame(void) node_type_init(ntype, node_frame_init); node_type_storage(ntype, "NodeFrame", node_free_standard_storage, node_copy_standard_storage); node_type_size(ntype, 150, 100, 0); - node_type_compatibility(ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); ntype->needs_free = 1; nodeRegisterType(ntype); @@ -476,7 +474,6 @@ void register_node_type_group_input(void) node_type_size(ntype, 140, 80, 400); node_type_init(ntype, node_group_input_init); node_type_update(ntype, node_group_input_update, node_group_input_verify); - node_type_compatibility(ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); ntype->needs_free = 1; nodeRegisterType(ntype); @@ -575,7 +572,6 @@ void register_node_type_group_output(void) node_type_size(ntype, 140, 80, 400); node_type_init(ntype, node_group_output_init); node_type_update(ntype, node_group_output_update, node_group_output_verify); - node_type_compatibility(ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); ntype->needs_free = 1; nodeRegisterType(ntype); diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h index 7e9da2a0944..2c054926d84 100644 --- a/source/blender/nodes/intern/node_common.h +++ b/source/blender/nodes/intern/node_common.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/intern/node_common.h - * \ingroup nodes +/** \file \ingroup nodes */ diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index 178f0289af0..2349824ebf5 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/intern/node_exec.c - * \ingroup nodes +/** \file \ingroup nodes */ @@ -298,8 +297,6 @@ bool ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *call * If the mute func is not set, assume the node should never be muted, * and hence execute it! */ -// if (node->typeinfo->compatibility == NODE_NEW_SHADING) -// return false; if (node->typeinfo->execfunc && !(node->flag & NODE_MUTED)) node->typeinfo->execfunc(callerdata, thread, node, &nodeexec->data, nsin, nsout); } diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h index ecdfcc97575..807adc21506 100644 --- a/source/blender/nodes/intern/node_exec.h +++ b/source/blender/nodes/intern/node_exec.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/intern/node_exec.h - * \ingroup nodes +/** \file \ingroup nodes */ diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index 8ec67835cc6..24cc9c7098e 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/intern/node_socket.c - * \ingroup nodes +/** \file \ingroup nodes */ #include <limits.h> @@ -258,7 +257,7 @@ void node_socket_init_default_value(bNodeSocket *sock) } } -void node_socket_copy_default_value(bNodeSocket *to, bNodeSocket *from) +void node_socket_copy_default_value(bNodeSocket *to, const bNodeSocket *from) { /* sanity check */ if (to->type != from->type) diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c index f49aa2d3938..be24ef461a7 100644 --- a/source/blender/nodes/intern/node_util.c +++ b/source/blender/nodes/intern/node_util.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/intern/node_util.c - * \ingroup nodes +/** \file \ingroup nodes */ #include <ctype.h> diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h index d3a83850e56..612e3ddc9f3 100644 --- a/source/blender/nodes/intern/node_util.h +++ b/source/blender/nodes/intern/node_util.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/intern/node_util.h - * \ingroup nodes +/** \file \ingroup nodes */ diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index aa95bb79b1f..37036f85361 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/node_shader_tree.c - * \ingroup nodes +/** \file \ingroup nodes */ @@ -31,6 +30,7 @@ #include "DNA_space_types.h" #include "DNA_world_types.h" #include "DNA_linestyle_types.h" +#include "DNA_workspace_types.h" #include "BLI_listbase.h" #include "BLI_threads.h" @@ -56,14 +56,21 @@ #include "node_util.h" #include "node_shader_util.h" + +typedef struct nTreeTags { + float ssr_id, sss_id; +} nTreeTags; + +static void ntree_shader_tag_nodes(bNodeTree *ntree, bNode *output_node, nTreeTags *tags); + static bool shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype)) { Scene *scene = CTX_data_scene(C); + const char *engine_id = scene->r.engine; + /* allow empty engine string too, this is from older versions that didn't have registerable engines yet */ - return (scene->r.engine[0] == '\0' || - STREQ(scene->r.engine, RE_engine_id_BLENDER_RENDER) || - STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME) || - STREQ(scene->r.engine, RE_engine_id_CYCLES) || + return (engine_id[0] == '\0' || + STREQ(engine_id, RE_engine_id_CYCLES) || !BKE_scene_use_shading_nodes_custom(scene)); } @@ -71,11 +78,10 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre { SpaceNode *snode = CTX_wm_space_node(C); Scene *scene = CTX_data_scene(C); - Object *ob = OBACT; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); - if ((snode->shaderfrom == SNODE_SHADER_OBJECT) || - (BKE_scene_use_new_shading_nodes(scene) == false)) - { + if (snode->shaderfrom == SNODE_SHADER_OBJECT) { if (ob) { *r_from = &ob->id; if (ob->type == OB_LAMP) { @@ -93,7 +99,7 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre } #ifdef WITH_FREESTYLE else if (snode->shaderfrom == SNODE_SHADER_LINESTYLE) { - FreestyleLineStyle *linestyle = BKE_linestyle_active_from_scene(scene); + FreestyleLineStyle *linestyle = BKE_linestyle_active_from_view_layer(view_layer); if (linestyle) { *r_from = NULL; *r_id = &linestyle->id; @@ -110,16 +116,12 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre } } -static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback func) +static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func) { func(calldata, NODE_CLASS_INPUT, N_("Input")); func(calldata, NODE_CLASS_OUTPUT, N_("Output")); - - if (BKE_scene_use_new_shading_nodes(scene)) { - func(calldata, NODE_CLASS_SHADER, N_("Shader")); - func(calldata, NODE_CLASS_TEXTURE, N_("Texture")); - } - + func(calldata, NODE_CLASS_SHADER, N_("Shader")); + func(calldata, NODE_CLASS_TEXTURE, N_("Texture")); func(calldata, NODE_CLASS_OP_COLOR, N_("Color")); func(calldata, NODE_CLASS_OP_VECTOR, N_("Vector")); func(calldata, NODE_CLASS_CONVERTOR, N_("Convertor")); @@ -174,9 +176,9 @@ void register_node_tree_type_sh(void) tt->type = NTREE_SHADER; strcpy(tt->idname, "ShaderNodeTree"); - strcpy(tt->ui_name, "Shader"); + strcpy(tt->ui_name, N_("Shader Editor")); tt->ui_icon = 0; /* defined in drawnode.c */ - strcpy(tt->ui_description, "Shader nodes"); + strcpy(tt->ui_description, N_("Shader nodes")); tt->foreach_nodeclass = foreach_nodeclass; tt->localize = localize; @@ -206,16 +208,75 @@ static void ntree_shader_link_builtin_normal(bNodeTree *ntree, * can change in the future and make it a generic function, but for now it stays * private here. */ -static bNode *ntree_shader_output_node(bNodeTree *ntree) +bNode *ntreeShaderOutputNode(bNodeTree *ntree, int target) { /* Make sure we only have single node tagged as output. */ ntreeSetOutput(ntree); - for (bNode *node = ntree->nodes.first; node != NULL; node = node->next) { - if (node->flag & NODE_DO_OUTPUT) { - return node; + + /* Find output node that matches type and target. If there are + * multiple, we prefer exact target match and active nodes. */ + bNode *output_node = NULL; + + for (bNode *node = ntree->nodes.first; node; node = node->next) { + if (!ELEM(node->type, SH_NODE_OUTPUT_MATERIAL, + SH_NODE_OUTPUT_WORLD, + SH_NODE_OUTPUT_LIGHT)) + { + continue; + } + + if (node->custom1 == SHD_OUTPUT_ALL) { + if (output_node == NULL) { + output_node = node; + } + else if (output_node->custom1 == SHD_OUTPUT_ALL) { + if ((node->flag & NODE_DO_OUTPUT) && + !(output_node->flag & NODE_DO_OUTPUT)) + { + output_node = node; + } + } + } + else if (node->custom1 == target) { + if (output_node == NULL) { + output_node = node; + } + else if (output_node->custom1 == SHD_OUTPUT_ALL) { + output_node = node; + } + else if ((node->flag & NODE_DO_OUTPUT) && + !(output_node->flag & NODE_DO_OUTPUT)) + { + output_node = node; + } } } - return NULL; + + return output_node; +} + +/* Find the active output node of a group nodetree. + * + * Does not return the shading output node but the group output node. + */ +static bNode *ntree_group_output_node(bNodeTree *ntree) +{ + /* Make sure we only have single node tagged as output. */ + ntreeSetOutput(ntree); + + /* Find output node that matches type and target. If there are + * multiple, we prefer exact target match and active nodes. */ + bNode *output_node = NULL; + + for (bNode *node = ntree->nodes.first; node; node = node->next) { + if ((node->type == NODE_GROUP_OUTPUT) && + (node->flag & NODE_DO_OUTPUT)) + { + output_node = node; + } + } + + return output_node; } /* Find socket with a specified identifier. */ @@ -244,6 +305,93 @@ static bNodeSocket *ntree_shader_node_find_output(bNode *node, return ntree_shader_node_find_socket(&node->outputs, identifier); } +static void ntree_shader_unlink_hidden_value_sockets(bNode *group_node, bNodeSocket *isock) +{ + bNodeTree *group_ntree = (bNodeTree *)group_node->id; + bNode *node; + bool removed_link = false; + + for (node = group_ntree->nodes.first; node; node = node->next) { + for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) { + if ((sock->flag & SOCK_HIDE_VALUE) == 0) + continue; + /* If socket is linked to a group input node and sockets id match. */ + if (sock && sock->link && sock->link->fromnode->type == NODE_GROUP_INPUT) { + if (STREQ(isock->identifier, sock->link->fromsock->identifier)) { + nodeRemLink(group_ntree, sock->link); + removed_link = true; + } + } + } + } + + if (removed_link) { + ntreeUpdateTree(G.main, group_ntree); + } +} + +/* Node groups once expanded looses their input sockets values. + * To fix this, link value/rgba nodes into the sockets and copy the group sockets values. */ +static void ntree_shader_groups_expand_inputs(bNodeTree *localtree) +{ + bNode *value_node, *group_node; + bNodeSocket *value_socket; + bNodeSocketValueRGBA *src_rgba, *dst_rgba; + bNodeSocketValueFloat *src_float, *dst_float; + bool link_added = false; + + for (group_node = localtree->nodes.first; group_node; group_node = group_node->next) { + + if (group_node->type != NODE_GROUP || group_node->id == NULL) + continue; + + /* Do it recursively. */ + ntree_shader_groups_expand_inputs((bNodeTree *)group_node->id); + + bNodeSocket *group_socket = group_node->inputs.first; + for (; group_socket; group_socket = group_socket->next) { + if (group_socket->link != NULL) + continue; + + /* Detect the case where an input is plugged into a hidden value socket. + * In this case we should just remove the link to trigger the socket default override. */ + ntree_shader_unlink_hidden_value_sockets(group_node, group_socket); + + switch (group_socket->type) { + case SOCK_VECTOR: + case SOCK_RGBA: + value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_RGB); + value_socket = ntree_shader_node_find_output(value_node, "Color"); + BLI_assert(value_socket != NULL); + src_rgba = group_socket->default_value; + dst_rgba = value_socket->default_value; + copy_v4_v4(dst_rgba->value, src_rgba->value); + break; + case SOCK_FLOAT: + value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_VALUE); + value_socket = ntree_shader_node_find_output(value_node, "Value"); + BLI_assert(value_socket != NULL); + src_float = group_socket->default_value; + dst_float = value_socket->default_value; + dst_float->value = src_float->value; + break; + default: + continue; + } + + nodeAddLink(localtree, + value_node, value_socket, + group_node, group_socket); + + link_added = true; + } + } + + if (link_added) { + ntreeUpdateTree(G.main, localtree); + } +} + /* Check whether shader has a displacement. * * Will also return a node and it's socket which is connected to a displacement @@ -251,11 +399,11 @@ static bNodeSocket *ntree_shader_node_find_output(bNode *node, * also returned. */ static bool ntree_shader_has_displacement(bNodeTree *ntree, + bNode *output_node, bNode **r_node, bNodeSocket **r_socket, bNodeLink **r_link) { - bNode *output_node = ntree_shader_output_node(ntree); if (output_node == NULL) { /* We can't have displacement without output node, apparently. */ return false; @@ -419,17 +567,13 @@ static void ntree_shader_link_builtin_normal(bNodeTree *ntree, /* Re-link displacement output to unconnected normal sockets via bump node. * This way material with have proper displacement in the viewport. */ -static void ntree_shader_relink_displacement(bNodeTree *ntree, - short compatibility) +static void ntree_shader_relink_displacement(bNodeTree *ntree, bNode *output_node) { - if (compatibility != NODE_NEW_SHADING) { - /* We can only deal with new shading system here. */ - return; - } bNode *displacement_node; bNodeSocket *displacement_socket; bNodeLink *displacement_link; if (!ntree_shader_has_displacement(ntree, + output_node, &displacement_node, &displacement_socket, &displacement_link)) @@ -483,35 +627,111 @@ static void ntree_shader_relink_displacement(bNodeTree *ntree, ntreeUpdateTree(G.main, ntree); } -void ntreeGPUMaterialNodes(bNodeTree *ntree, GPUMaterial *mat, short compatibility) +static bool ntree_tag_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *userdata, const bool UNUSED(reversed)) +{ + /* Don't evaluate nodes more than once. */ + if (fromnode->tmp_flag) { + return true; + } + fromnode->tmp_flag = 1; + + switch (fromnode->type) { + case NODE_GROUP: + /* Recursive */ + if (fromnode->id != NULL) { + bNodeTree *ntree = (bNodeTree *)fromnode->id; + bNode *group_output = ntree_group_output_node(ntree); + ntree_shader_tag_nodes(ntree, group_output, (nTreeTags *)userdata); + } + break; + case SH_NODE_BSDF_ANISOTROPIC: + case SH_NODE_EEVEE_SPECULAR: + case SH_NODE_BSDF_GLOSSY: + case SH_NODE_BSDF_GLASS: + fromnode->ssr_id = ((nTreeTags *)userdata)->ssr_id; + ((nTreeTags *)userdata)->ssr_id += 1; + break; + case SH_NODE_SUBSURFACE_SCATTERING: + fromnode->sss_id = ((nTreeTags *)userdata)->sss_id; + ((nTreeTags *)userdata)->sss_id += 1; + break; + case SH_NODE_BSDF_PRINCIPLED: + fromnode->ssr_id = ((nTreeTags *)userdata)->ssr_id; + fromnode->sss_id = ((nTreeTags *)userdata)->sss_id; + ((nTreeTags *)userdata)->sss_id += 1; + ((nTreeTags *)userdata)->ssr_id += 1; + break; + default: + /* We could return false here but since we + * allow the use of Closure as RGBA, we can have + * Bsdf nodes linked to other Bsdf nodes. */ + break; + } + + return true; +} + +/* EEVEE: Scan the ntree to set the Screen Space Reflection + * layer id of every specular node AND the Subsurface Scattering id of every SSS node. + */ +void ntree_shader_tag_nodes(bNodeTree *ntree, bNode *output_node, nTreeTags *tags) +{ + if (output_node == NULL) { + return; + } + /* Make sure sockets links pointers are correct. */ + ntreeUpdateTree(G.main, ntree); + + /* Reset visit flag. */ + for (bNode *node = ntree->nodes.first; node; node = node->next) { + node->tmp_flag = 0; + } + + nodeChainIter(ntree, output_node, ntree_tag_bsdf_cb, tags, true); +} + +/* This one needs to work on a local tree. */ +void ntreeGPUMaterialNodes(bNodeTree *localtree, GPUMaterial *mat, bool *has_surface_output, bool *has_volume_output) { - /* localize tree to create links for reroute and mute */ - bNodeTree *localtree = ntreeLocalize(ntree); + bNode *output = ntreeShaderOutputNode(localtree, SHD_OUTPUT_EEVEE); bNodeTreeExec *exec; + ntree_shader_groups_expand_inputs(localtree); + /* Perform all needed modifications on the tree in order to support * displacement/bump mapping. */ - ntree_shader_relink_displacement(localtree, compatibility); + ntree_shader_relink_displacement(localtree, output); + + /* TODO(fclem): consider moving this to the gpu shader tree evaluation. */ + nTreeTags tags = { + .ssr_id = 1.0, + .sss_id = 1.0, + }; + ntree_shader_tag_nodes(localtree, output, &tags); exec = ntreeShaderBeginExecTree(localtree); - ntreeExecGPUNodes(exec, mat, 1, compatibility); + ntreeExecGPUNodes(exec, mat, 1); ntreeShaderEndExecTree(exec); - ntreeFreeTree(localtree); - MEM_freeN(localtree); -} + /* EEVEE: Find which material domain was used (volume, surface ...). */ + *has_surface_output = false; + *has_volume_output = false; -/* **************** call to switch lamploop for material node ************ */ + if (output != NULL) { + bNodeSocket *surface_sock = ntree_shader_node_find_input(output, "Surface"); + bNodeSocket *volume_sock = ntree_shader_node_find_input(output, "Volume"); -void (*node_shader_lamp_loop)(struct ShadeInput *, struct ShadeResult *); + if (surface_sock != NULL) { + *has_surface_output = (nodeCountSocketLinks(localtree, surface_sock) > 0); + } -void set_node_shader_lamp_loop(void (*lamp_loop_func)(ShadeInput *, ShadeResult *)) -{ - node_shader_lamp_loop = lamp_loop_func; + if (volume_sock != NULL) { + *has_volume_output = (nodeCountSocketLinks(localtree, volume_sock) > 0); + } + } } - bNodeTreeExec *ntreeShaderBeginExecTree_internal(bNodeExecContext *context, bNodeTree *ntree, bNodeInstanceKey parent_key) { bNodeTreeExec *exec; @@ -586,26 +806,14 @@ void ntreeShaderEndExecTree(bNodeTreeExec *exec) } } -/* only for Blender internal */ -bool ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr) +/* TODO: left over from Blender Internal, could reuse for new texture nodes. */ +bool ntreeShaderExecTree(bNodeTree *ntree, int thread) { ShaderCallData scd; - /** - * \note: preserve material from ShadeInput for material id, nodetree execs change it - * fix for bug "[#28012] Mat ID messy with shader nodes" - */ - Material *mat = shi->mat; bNodeThreadStack *nts = NULL; bNodeTreeExec *exec = ntree->execdata; int compat; - /* convert caller data to struct */ - scd.shi = shi; - scd.shr = shr; - - /* each material node has own local shaderesult, with optional copying */ - memset(shr, 0, sizeof(ShadeResult)); - /* ensure execdata is only initialized once */ if (!exec) { BLI_thread_lock(LOCK_NODES); @@ -616,18 +824,10 @@ bool ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr) exec = ntree->execdata; } - nts = ntreeGetThreadStack(exec, shi->thread); - compat = ntreeExecThreadNodes(exec, nts, &scd, shi->thread); + nts = ntreeGetThreadStack(exec, thread); + compat = ntreeExecThreadNodes(exec, nts, &scd, thread); ntreeReleaseThreadStack(nts); - // \note: set material back to preserved material - shi->mat = mat; - - /* better not allow negative for now */ - if (shr->combined[0] < 0.0f) shr->combined[0] = 0.0f; - if (shr->combined[1] < 0.0f) shr->combined[1] = 0.0f; - if (shr->combined[2] < 0.0f) shr->combined[2] = 0.0f; - /* if compat is zero, it has been using non-compatible nodes */ return compat; } diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index fbafa49a795..8f18afb1274 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/node_shader_util.c - * \ingroup nodes +/** \file \ingroup nodes */ @@ -83,53 +82,6 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns) } -/* go over all used Geometry and Texture nodes, and return a texco flag */ -/* no group inside needed, this function is called for groups too */ -void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mode) -{ - bNode *node; - bNodeSocket *sock; - int a; - - for (node = ntree->nodes.first; node; node = node->next) { - if (node->type == SH_NODE_TEXTURE) { - if ((r_mode & R_OSA) && node->id) { - Tex *tex = (Tex *)node->id; - if (ELEM(tex->type, TEX_IMAGE, TEX_ENVMAP)) { - *texco |= TEXCO_OSA | NEED_UV; - } - } - /* usability exception... without input we still give the node orcos */ - sock = node->inputs.first; - if (sock == NULL || sock->link == NULL) - *texco |= TEXCO_ORCO | NEED_UV; - } - else if (node->type == SH_NODE_GEOMETRY) { - /* note; sockets always exist for the given type! */ - for (a = 0, sock = node->outputs.first; sock; sock = sock->next, a++) { - if (sock->flag & SOCK_IN_USE) { - switch (a) { - case GEOM_OUT_GLOB: - *texco |= TEXCO_GLOB | NEED_UV; break; - case GEOM_OUT_VIEW: - *texco |= TEXCO_VIEW | NEED_UV; break; - case GEOM_OUT_ORCO: - *texco |= TEXCO_ORCO | NEED_UV; break; - case GEOM_OUT_UV: - *texco |= TEXCO_UV | NEED_UV; break; - case GEOM_OUT_NORMAL: - *texco |= TEXCO_NORM | NEED_UV; break; - case GEOM_OUT_VCOL: - *texco |= NEED_UV; *mode |= MA_VERTEXCOL; break; - case GEOM_OUT_VCOL_ALPHA: - *texco |= NEED_UV; *mode |= MA_VERTEXCOL; break; - } - } - } - } - } -} - void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns) { memset(gs, 0, sizeof(*gs)); @@ -139,7 +91,6 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns) zero_v4(gs->vec); gs->link = NULL; gs->type = GPU_NONE; - gs->name = ""; gs->hasinput = false; gs->hasoutput = false; gs->sockettype = type; @@ -155,11 +106,10 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns) else if (type == SOCK_RGBA) gs->type = GPU_VEC4; else if (type == SOCK_SHADER) - gs->type = GPU_VEC4; + gs->type = GPU_CLOSURE; else gs->type = GPU_NONE; - gs->name = ""; gs->hasinput = ns->hasinput && ns->data; /* XXX Commented out the ns->data check here, as it seems it's not always set, * even though there *is* a valid connection/output... But that might need @@ -185,7 +135,7 @@ static void gpu_stack_from_data_list(GPUNodeStack *gs, ListBase *sockets, bNodeS for (sock = sockets->first, i = 0; sock; sock = sock->next, i++) node_gpu_stack_from_data(&gs[i], sock->type, ns[i]); - gs[i].type = GPU_NONE; + gs[i].end = true; } static void data_from_gpu_stack_list(ListBase *sockets, bNodeStack **ns, GPUNodeStack *gs) @@ -248,7 +198,7 @@ bNode *nodeGetActiveTexture(bNodeTree *ntree) return inactivenode; } -void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs, short compatibility) +void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs) { bNodeExec *nodeexec; bNode *node; @@ -267,9 +217,8 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs, sh do_it = false; /* for groups, only execute outputs for edited group */ if (node->typeinfo->nclass == NODE_CLASS_OUTPUT) { - if (node->typeinfo->compatibility & compatibility) - if (do_outputs && (node->flag & NODE_DO_OUTPUT)) - do_it = true; + if (do_outputs && (node->flag & NODE_DO_OUTPUT)) + do_it = true; } else { do_it = true; @@ -295,13 +244,18 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in float domax = (texmap->flag & TEXMAP_CLIP_MAX) != 0; if (domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) { - GPUNodeLink *tmat = GPU_uniform((float *)texmap->mat); - GPUNodeLink *tmin = GPU_uniform(texmap->min); - GPUNodeLink *tmax = GPU_uniform(texmap->max); - GPUNodeLink *tdomin = GPU_uniform(&domin); - GPUNodeLink *tdomax = GPU_uniform(&domax); - - GPU_link(mat, "mapping", in[0].link, tmat, tmin, tmax, tdomin, tdomax, &in[0].link); + static float max[3] = { FLT_MAX, FLT_MAX, FLT_MAX}; + static float min[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX}; + GPUNodeLink *tmin, *tmax, *tmat0, *tmat1, *tmat2, *tmat3; + + tmin = GPU_uniform((domin) ? texmap->min : min); + tmax = GPU_uniform((domax) ? texmap->max : max); + tmat0 = GPU_uniform((float *)texmap->mat[0]); + tmat1 = GPU_uniform((float *)texmap->mat[1]); + tmat2 = GPU_uniform((float *)texmap->mat[2]); + tmat3 = GPU_uniform((float *)texmap->mat[3]); + + GPU_link(mat, "mapping", in[0].link, tmat0, tmat1, tmat2, tmat3, tmin, tmax, &in[0].link); if (texmap->type == TEXMAP_TYPE_NORMAL) GPU_link(mat, "texco_norm", in[0].link, &in[0].link); diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index 63c09fd189e..6537d252896 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/node_shader_util.h - * \ingroup nodes +/** \file \ingroup nodes */ @@ -56,8 +55,6 @@ #include "BKE_node.h" #include "BKE_texture.h" -#include "BKE_library.h" - #include "NOD_shader.h" #include "node_util.h" @@ -70,6 +67,7 @@ #include "RE_shader_ext.h" #include "GPU_material.h" +#include "GPU_uniformbuffer.h" bool sh_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); @@ -79,17 +77,16 @@ void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, shor /* ********* exec data struct, remains internal *********** */ typedef struct ShaderCallData { - ShadeInput *shi; /* from render pipe */ - ShadeResult *shr; /* from render pipe */ + /* Empty for now, may be reused if we convert shader to texture nodes. */ + int dummy; } ShaderCallData; - void nodestack_get_vec(float *in, short type_in, bNodeStack *ns); void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, struct bNodeStack *ns); void node_data_from_gpu_stack(struct bNodeStack *ns, struct GPUNodeStack *gs); void node_shader_gpu_tex_mapping(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out); -void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs, short compatibility); +void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs); #endif diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.c b/source/blender/nodes/shader/nodes/node_shader_add_shader.c index b142f949389..3eb5e3831f4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_add_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.c @@ -24,17 +24,17 @@ static bNodeSocketTemplate sh_node_add_shader_in[] = { { SOCK_SHADER, 1, N_("Shader")}, { SOCK_SHADER, 1, N_("Shader")}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_add_shader_out[] = { { SOCK_SHADER, 0, N_("Shader")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_add_shader(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_add_shader(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_add_shader", in, out); + return GPU_stack_link(mat, node, "node_add_shader", in, out); } /* node type definition */ @@ -43,7 +43,6 @@ void register_node_type_sh_add_shader(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_add_shader_in, sh_node_add_shader_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c index da3e78264d9..e38a97ae9b2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c +++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c @@ -23,20 +23,25 @@ static bNodeSocketTemplate sh_node_ambient_occlusion_in[] = { { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 0, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { SOCK_FLOAT, 1, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_ambient_occlusion_out[] = { - { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 0, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("AO"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_ambient_occlusion", in, out, GPU_builtin(GPU_VIEW_NORMAL)); + if (!in[2].link) + GPU_link(mat, "world_normals_get", &in[2].link); + + GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE); + + return GPU_stack_link(mat, node, "node_ambient_occlusion", in, out); } static void node_shader_init_ambient_occlusion(bNodeTree *UNUSED(ntree), bNode *node) @@ -51,7 +56,6 @@ void register_node_type_sh_ambient_occlusion(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_ambient_occlusion_in, sh_node_ambient_occlusion_out); node_type_init(&ntype, node_shader_init_ambient_occlusion); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c index d9c192b8284..6f79b4588bb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.c +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c @@ -25,7 +25,7 @@ static bNodeSocketTemplate sh_node_attribute_out[] = { { SOCK_RGBA, 0, N_("Color")}, { SOCK_VECTOR, 0, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node) @@ -37,9 +37,29 @@ static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node) static int node_shader_gpu_attribute(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { NodeShaderAttribute *attr = node->storage; - GPUNodeLink *cd_attr = GPU_attribute(CD_AUTO_FROM_NAME, attr->name); - return GPU_stack_link(mat, "node_attribute", in, out, cd_attr); + /* FIXME : if an attribute layer (like vertex color) has one of theses name, it will not work as expected. */ + if (strcmp(attr->name, "density") == 0) { + return GPU_stack_link(mat, node, "node_attribute_volume_density", in, out, + GPU_builtin(GPU_VOLUME_DENSITY)); + } + else if (strcmp(attr->name, "color") == 0) { + return GPU_stack_link(mat, node, "node_attribute_volume_color", in, out, + GPU_builtin(GPU_VOLUME_DENSITY)); + } + else if (strcmp(attr->name, "flame") == 0) { + return GPU_stack_link(mat, node, "node_attribute_volume_flame", in, out, + GPU_builtin(GPU_VOLUME_FLAME)); + } + else if (strcmp(attr->name, "temperature") == 0) { + return GPU_stack_link(mat, node, "node_attribute_volume_temperature", in, out, + GPU_builtin(GPU_VOLUME_FLAME), + GPU_builtin(GPU_VOLUME_TEMPERATURE)); + } + else { + GPUNodeLink *cd_attr = GPU_attribute(CD_AUTO_FROM_NAME, attr->name); + return GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr); + } } /* node type definition */ @@ -48,7 +68,6 @@ void register_node_type_sh_attribute(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_attribute_out); node_type_init(&ntype, node_shader_init_attribute); node_type_storage(&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_background.c b/source/blender/nodes/shader/nodes/node_shader_background.c index 12ad6b6142a..8301a5476db 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.c +++ b/source/blender/nodes/shader/nodes/node_shader_background.c @@ -24,17 +24,17 @@ static bNodeSocketTemplate sh_node_background_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_background_out[] = { { SOCK_SHADER, 0, N_("Background")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_background(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_background(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_background", in, out, GPU_builtin(GPU_VIEW_NORMAL)); + return GPU_stack_link(mat, node, "node_background", in, out); } /* node type definition */ @@ -43,7 +43,6 @@ void register_node_type_sh_background(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_background_in, sh_node_background_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.c b/source/blender/nodes/shader/nodes/node_shader_bevel.c index 7101c01faf1..7b89c7d6f98 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bevel.c +++ b/source/blender/nodes/shader/nodes/node_shader_bevel.c @@ -22,14 +22,14 @@ /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bevel_in[] = { - { SOCK_FLOAT, 0, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { SOCK_FLOAT, 1, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bevel_out[] = { { SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_bevel(bNodeTree *UNUSED(ntree), bNode *node) @@ -37,13 +37,13 @@ static void node_shader_init_bevel(bNodeTree *UNUSED(ntree), bNode *node) node->custom1 = 4; /* samples */ } -static int gpu_shader_bevel(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_bevel(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[1].link) { GPU_link(mat, "direction_transform_m4v3", GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &in[1].link); } - return GPU_stack_link(mat, "node_bevel", in, out); + return GPU_stack_link(mat, node, "node_bevel", in, out); } /* node type definition */ @@ -52,7 +52,6 @@ void register_node_type_sh_bevel(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bevel_in, sh_node_bevel_out); node_type_init(&ntype, node_shader_init_bevel); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.c b/source/blender/nodes/shader/nodes/node_shader_blackbody.c index ac698348760..7e7dcffc8ee 100644 --- a/source/blender/nodes/shader/nodes/node_shader_blackbody.c +++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.c @@ -22,25 +22,38 @@ /* **************** Blackbody ******************** */ static bNodeSocketTemplate sh_node_blackbody_in[] = { { SOCK_FLOAT, 1, N_("Temperature"), 1500.0f, 0.0f, 0.0f, 0.0f, 800.0f, 12000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_blackbody_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; +static int node_shader_gpu_blackbody(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +{ + const int size = CM_TABLE + 1; + float *data = MEM_mallocN(sizeof(float) * size * 4, "blackbody texture"); + + blackbody_temperature_to_rgb_table(data, size, 965.0f, 12000.0f); + + float layer; + GPUNodeLink *ramp_texture = GPU_color_band(mat, size, data, &layer); + + return GPU_stack_link(mat, node, "node_blackbody", in, out, ramp_texture, GPU_constant(&layer)); +} + /* node type definition */ void register_node_type_sh_blackbody(void) { static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BLACKBODY, "Blackbody", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_socket_templates(&ntype, sh_node_blackbody_in, sh_node_blackbody_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); + node_type_gpu(&ntype, node_shader_gpu_blackbody); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.c b/source/blender/nodes/shader/nodes/node_shader_brightness.c index b8f8fab85d8..5fee57fe0bf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_brightness.c +++ b/source/blender/nodes/shader/nodes/node_shader_brightness.c @@ -26,17 +26,17 @@ static bNodeSocketTemplate sh_node_brightcontrast_in[] = { { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_brightcontrast_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int gpu_shader_brightcontrast(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_brightcontrast(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "brightness_contrast", in, out); + return GPU_stack_link(mat, node, "brightness_contrast", in, out); } void register_node_type_sh_brightcontrast(void) @@ -44,7 +44,6 @@ void register_node_type_sh_brightcontrast(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_brightcontrast_in, sh_node_brightcontrast_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c index 633689e91a3..e0303b07e10 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c @@ -28,12 +28,12 @@ static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[] = { { SOCK_FLOAT, 1, N_("Rotation"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, { SOCK_VECTOR, 1, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_anisotropic(bNodeTree *UNUSED(ntree), bNode *node) @@ -41,14 +41,14 @@ static void node_shader_init_anisotropic(bNodeTree *UNUSED(ntree), bNode *node) node->custom1 = SHD_GLOSSY_GGX; } -static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[4].link) - in[4].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[4].link, GPU_builtin(GPU_VIEW_MATRIX), &in[4].link); + GPU_link(mat, "world_normals_get", &in[4].link); - return GPU_stack_link(mat, "node_bsdf_anisotropic", in, out); + GPU_material_flag_set(mat, GPU_MATFLAG_GLOSSY); + + return GPU_stack_link(mat, node, "node_bsdf_anisotropic", in, out); } /* node type definition */ @@ -57,7 +57,6 @@ void register_node_type_sh_bsdf_anisotropic(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Anisotropic BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_anisotropic_in, sh_node_bsdf_anisotropic_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_anisotropic); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c index 32ef88c9041..15640eba6e9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c @@ -25,22 +25,22 @@ static bNodeSocketTemplate sh_node_bsdf_diffuse_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_diffuse_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[2].link) - in[2].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[2].link, GPU_builtin(GPU_VIEW_MATRIX), &in[2].link); + GPU_link(mat, "world_normals_get", &in[2].link); - return GPU_stack_link(mat, "node_bsdf_diffuse", in, out); + GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE); + + return GPU_stack_link(mat, node, "node_bsdf_diffuse", in, out); } /* node type definition */ @@ -49,7 +49,6 @@ void register_node_type_sh_bsdf_diffuse(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_diffuse_in, sh_node_bsdf_diffuse_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c index cccc8aa507b..20f000dc62b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c @@ -26,12 +26,12 @@ static bNodeSocketTemplate sh_node_bsdf_glass_in[] = { { SOCK_FLOAT, 1, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_glass_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_glass(bNodeTree *UNUSED(ntree), bNode *node) @@ -39,14 +39,14 @@ static void node_shader_init_glass(bNodeTree *UNUSED(ntree), bNode *node) node->custom1 = SHD_GLOSSY_BECKMANN; } -static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[3].link) - in[3].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link); + GPU_link(mat, "world_normals_get", &in[3].link); - return GPU_stack_link(mat, "node_bsdf_glass", in, out); + GPU_material_flag_set(mat, GPU_MATFLAG_GLOSSY | GPU_MATFLAG_REFRACT); + + return GPU_stack_link(mat, node, "node_bsdf_glass", in, out, GPU_constant(&node->ssr_id)); } /* node type definition */ @@ -55,7 +55,6 @@ void register_node_type_sh_bsdf_glass(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_glass_in, sh_node_bsdf_glass_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_glass); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c index 2f18455ee8d..5c5824814a6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c @@ -25,12 +25,12 @@ static bNodeSocketTemplate sh_node_bsdf_glossy_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_glossy_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_glossy(bNodeTree *UNUSED(ntree), bNode *node) @@ -38,14 +38,17 @@ static void node_shader_init_glossy(bNodeTree *UNUSED(ntree), bNode *node) node->custom1 = SHD_GLOSSY_GGX; } -static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[2].link) - in[2].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[2].link, GPU_builtin(GPU_VIEW_MATRIX), &in[2].link); + GPU_link(mat, "world_normals_get", &in[2].link); - return GPU_stack_link(mat, "node_bsdf_glossy", in, out); + if (node->custom1 == SHD_GLOSSY_SHARP) + GPU_link(mat, "set_value_zero", &in[1].link); + + GPU_material_flag_set(mat, GPU_MATFLAG_GLOSSY); + + return GPU_stack_link(mat, node, "node_bsdf_glossy", in, out, GPU_constant(&node->ssr_id)); } /* node type definition */ @@ -54,7 +57,6 @@ void register_node_type_sh_bsdf_glossy(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_glossy_in, sh_node_bsdf_glossy_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_glossy); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c index 5f14a275b16..6756ca61fb2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c @@ -32,12 +32,12 @@ static bNodeSocketTemplate sh_node_bsdf_hair_in[] = { static bNodeSocketTemplate sh_node_bsdf_hair_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_bsdf_hair(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_hair(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_bsdf_hair", in, out); + return GPU_stack_link(mat, node, "node_bsdf_hair", in, out); } /* node type definition */ @@ -46,7 +46,6 @@ void register_node_type_sh_bsdf_hair(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_hair_in, sh_node_bsdf_hair_out); node_type_size(&ntype, 150, 60, 200); node_type_init(&ntype, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c index 8f18a968c93..0b953c34010 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c @@ -41,7 +41,7 @@ static bNodeSocketTemplate sh_node_bsdf_hair_principled_in[] = { static bNodeSocketTemplate sh_node_bsdf_hair_principled_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; /* Initialize the custom Parametrization property to Color. */ @@ -114,7 +114,6 @@ void register_node_type_sh_bsdf_hair_principled(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_hair_principled_in, sh_node_bsdf_hair_principled_out); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, node_shader_init_hair_principled); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c index 28d0b95368a..abc95161cd0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c @@ -42,12 +42,12 @@ static bNodeSocketTemplate sh_node_bsdf_principled_in[] = { { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, { SOCK_VECTOR, 1, N_("Clearcoat Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, { SOCK_VECTOR, 1, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_principled_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node) @@ -56,21 +56,91 @@ static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node) node->custom2 = SHD_SUBSURFACE_BURLEY; } -static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +#define socket_not_zero(sock) (in[sock].link || (clamp_f(in[sock].vec[0], 0.0f, 1.0f) > 1e-5f)) +#define socket_not_one(sock) (in[sock].link || (clamp_f(in[sock].vec[0], 0.0f, 1.0f) < 1.0f - 1e-5f)) + +static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - // normal - if (!in[17].link) - in[17].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[17].link, GPU_builtin(GPU_VIEW_MATRIX), &in[17].link); - - // clearcoat normal - if (!in[18].link) - in[18].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[18].link, GPU_builtin(GPU_VIEW_MATRIX), &in[18].link); - - return GPU_stack_link(mat, "node_bsdf_principled", in, out, GPU_builtin(GPU_VIEW_POSITION)); + GPUNodeLink *sss_scale; + + /* Normals */ + if (!in[17].link) { + GPU_link(mat, "world_normals_get", &in[17].link); + } + + /* Clearcoat Normals */ + if (!in[18].link) { + GPU_link(mat, "world_normals_get", &in[18].link); + } + + /* Tangents */ + if (!in[19].link) { + GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); + GPU_link(mat, "tangent_orco_z", orco, &in[19].link); + GPU_link(mat, "node_tangent", + GPU_builtin(GPU_VIEW_NORMAL), in[19].link, GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), + &in[19].link); + } + + /* SSS Profile */ + if (node->sss_id == 1) { + static short profile = SHD_SUBSURFACE_BURLEY; + bNodeSocket *socket = BLI_findlink(&node->original->inputs, 2); + bNodeSocketValueRGBA *socket_data = socket->default_value; + /* For some reason it seems that the socket value is in ARGB format. */ + GPU_material_sss_profile_create(mat, &socket_data->value[1], &profile, NULL); + } + + if (in[2].link) { + sss_scale = in[2].link; + } + else { + GPU_link(mat, "set_rgb_one", &sss_scale); + } + + bool use_diffuse = socket_not_one(4) && socket_not_one(15); + bool use_subsurf = socket_not_zero(1) && use_diffuse; + bool use_refract = socket_not_one(4) && socket_not_zero(15); + bool use_clear = socket_not_zero(12); + + /* Due to the manual effort done per config, we only optimize the most common permutations. */ + char *node_name; + uint flag = 0; + if (!use_subsurf && use_diffuse && !use_refract && !use_clear) { + static char name[] = "node_bsdf_principled_dielectric"; + node_name = name; + flag = GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY; + } + else if (!use_subsurf && !use_diffuse && !use_refract && !use_clear) { + static char name[] = "node_bsdf_principled_metallic"; + node_name = name; + flag = GPU_MATFLAG_GLOSSY; + } + else if (!use_subsurf && !use_diffuse && !use_refract && use_clear) { + static char name[] = "node_bsdf_principled_clearcoat"; + node_name = name; + flag = GPU_MATFLAG_GLOSSY; + } + else if (use_subsurf && use_diffuse && !use_refract && !use_clear) { + static char name[] = "node_bsdf_principled_subsurface"; + node_name = name; + flag = GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_SSS | GPU_MATFLAG_GLOSSY; + } + else if (!use_subsurf && !use_diffuse && use_refract && !use_clear && !socket_not_zero(4)) { + static char name[] = "node_bsdf_principled_glass"; + node_name = name; + flag = GPU_MATFLAG_GLOSSY | GPU_MATFLAG_REFRACT; + } + else { + static char name[] = "node_bsdf_principled"; + node_name = name; + flag = GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY | GPU_MATFLAG_SSS | GPU_MATFLAG_REFRACT; + } + + GPU_material_flag_set(mat, flag); + + return GPU_stack_link(mat, node, node_name, in, out, GPU_builtin(GPU_VIEW_POSITION), + GPU_constant(&node->ssr_id), GPU_constant(&node->sss_id), sss_scale); } static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node) @@ -95,7 +165,6 @@ void register_node_type_sh_bsdf_principled(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_principled_in, sh_node_bsdf_principled_out); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, node_shader_init_principled); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c index 907ada1cd91..db4451eea6b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c @@ -26,12 +26,12 @@ static bNodeSocketTemplate sh_node_bsdf_refraction_in[] = { { SOCK_FLOAT, 1, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_refraction_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_refraction(bNodeTree *UNUSED(ntree), bNode *node) @@ -39,14 +39,17 @@ static void node_shader_init_refraction(bNodeTree *UNUSED(ntree), bNode *node) node->custom1 = SHD_GLOSSY_BECKMANN; } -static int node_shader_gpu_bsdf_refraction(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_refraction(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[3].link) - in[3].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link); + GPU_link(mat, "world_normals_get", &in[3].link); - return GPU_stack_link(mat, "node_bsdf_refraction", in, out); + if (node->custom1 == SHD_GLOSSY_SHARP) + GPU_link(mat, "set_value_zero", &in[1].link); + + GPU_material_flag_set(mat, GPU_MATFLAG_REFRACT); + + return GPU_stack_link(mat, node, "node_bsdf_refraction", in, out); } /* node type definition */ @@ -55,7 +58,6 @@ void register_node_type_sh_bsdf_refraction(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_refraction_in, sh_node_bsdf_refraction_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_refraction); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c index 2333c4eedfe..ed706ca2ae1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c @@ -26,22 +26,22 @@ static bNodeSocketTemplate sh_node_bsdf_toon_in[] = { { SOCK_FLOAT, 1, N_("Size"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_toon_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_bsdf_toon(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_toon(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[3].link) in[3].link = GPU_builtin(GPU_VIEW_NORMAL); else GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link); - return GPU_stack_link(mat, "node_bsdf_toon", in, out); + return GPU_stack_link(mat, node, "node_bsdf_toon", in, out); } /* node type definition */ @@ -50,7 +50,6 @@ void register_node_type_sh_bsdf_toon(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_toon_in, sh_node_bsdf_toon_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c index 7d3f5ca3717..4dba71e80b4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c @@ -24,22 +24,22 @@ static bNodeSocketTemplate sh_node_bsdf_translucent_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_translucent_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[1].link) - in[1].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[1].link, GPU_builtin(GPU_VIEW_MATRIX), &in[1].link); + GPU_link(mat, "world_normals_get", &in[1].link); - return GPU_stack_link(mat, "node_bsdf_translucent", in, out); + GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE); + + return GPU_stack_link(mat, node, "node_bsdf_translucent", in, out); } /* node type definition */ @@ -48,7 +48,6 @@ void register_node_type_sh_bsdf_translucent(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_translucent_in, sh_node_bsdf_translucent_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c index 9dd59f1b52b..a8fbe3afbee 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c @@ -23,17 +23,17 @@ static bNodeSocketTemplate sh_node_bsdf_transparent_in[] = { { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_transparent_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_bsdf_transparent", in, out); + return GPU_stack_link(mat, node, "node_bsdf_transparent", in, out); } /* node type definition */ @@ -42,7 +42,6 @@ void register_node_type_sh_bsdf_transparent(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_transparent_in, sh_node_bsdf_transparent_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c index 362aa526056..15aa58123a2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c @@ -25,22 +25,22 @@ static bNodeSocketTemplate sh_node_bsdf_velvet_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Sigma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_bsdf_velvet_out[] = { { SOCK_SHADER, 0, N_("BSDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[2].link) - in[2].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[2].link, GPU_builtin(GPU_VIEW_MATRIX), &in[2].link); + GPU_link(mat, "world_normals_get", &in[2].link); - return GPU_stack_link(mat, "node_bsdf_velvet", in, out); + GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE); + + return GPU_stack_link(mat, node, "node_bsdf_velvet", in, out); } /* node type definition */ @@ -49,7 +49,6 @@ void register_node_type_sh_bsdf_velvet(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_velvet_in, sh_node_bsdf_velvet_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.c b/source/blender/nodes/shader/nodes/node_shader_bump.c index 17f3cfa714b..19faf3fb529 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.c +++ b/source/blender/nodes/shader/nodes/node_shader_bump.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_bump.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ #include "node_shader_util.h" @@ -39,19 +38,13 @@ static bNodeSocketTemplate sh_node_bump_out[] = { static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - if (!in[3].link) - in[3].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link); - float invert = node->custom1; - GPU_stack_link(mat, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_uniform(&invert)); - /* Other nodes are applying view matrix if the input Normal has a link. - * We don't want normal to have view matrix applied twice, so we cancel it here. - * - * TODO(sergey): This is an extra multiplication which cancels each other, - * better avoid this but that requires bigger refactor. - */ - return GPU_link(mat, "direction_transform_m4v3", out[0].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[0].link); + if (!in[3].link) { + GPU_link(mat, "world_normals_get", &in[3].link); + } + + float invert = (node->custom1) ? -1.0 : 1.0; + + return GPU_stack_link(mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_constant(&invert)); } /* node type definition */ @@ -60,7 +53,6 @@ void register_node_type_sh_bump(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bump_in, sh_node_bump_out); node_type_storage(&ntype, "", NULL, NULL); node_type_gpu(&ntype, gpu_shader_bump); diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c index 9ca1e8680f0..0a26e71b34c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.c +++ b/source/blender/nodes/shader/nodes/node_shader_camera.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_camera.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -29,32 +28,16 @@ static bNodeSocketTemplate sh_node_camera_out[] = { { SOCK_VECTOR, 0, N_("View Vector")}, { SOCK_FLOAT, 0, N_("View Z Depth")}, { SOCK_FLOAT, 0, N_("View Distance")}, - { -1, 0, "" } + { -1, 0, "" }, }; - -static void node_shader_exec_camera(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **out) -{ - if (data) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; /* Data we need for shading. */ - - copy_v3_v3(out[0]->vec, shi->co); /* get view vector */ - out[1]->vec[0] = fabsf(shi->co[2]); /* get view z-depth */ - out[2]->vec[0] = normalize_v3(out[0]->vec); /* get view distance */ - } -} - -static int gpu_shader_camera(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_camera(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { GPUNodeLink *viewvec; viewvec = GPU_builtin(GPU_VIEW_POSITION); - - /* Blender has negative Z, Cycles positive Z convention */ - if (GPU_material_use_new_shading_nodes(mat)) - GPU_link(mat, "invert_z", viewvec, &viewvec); - - return GPU_stack_link(mat, "camera", in, out, viewvec); + GPU_link(mat, "invert_z", viewvec, &viewvec); + return GPU_stack_link(mat, node, "camera", in, out, viewvec); } void register_node_type_sh_camera(void) @@ -62,10 +45,8 @@ void register_node_type_sh_camera(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_camera_out); node_type_storage(&ntype, "", NULL, NULL); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_camera); node_type_gpu(&ntype, gpu_shader_camera); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c index 03ba14a18a4..c5ec024f1fd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_common.c +++ b/source/blender/nodes/shader/nodes/node_shader_common.c @@ -18,8 +18,7 @@ * Juho Vepsäläinen */ -/** \file blender/nodes/shader/nodes/node_shader_common.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -207,11 +206,7 @@ static int gpu_group_execute(GPUMaterial *mat, bNode *node, bNodeExecData *execd return 0; group_gpu_copy_inputs(node, in, exec->stack); -#if 0 /* XXX NODE_GROUP_EDIT is deprecated, depends on node space */ - ntreeExecGPUNodes(exec, mat, (node->flag & NODE_GROUP_EDIT)); -#else - ntreeExecGPUNodes(exec, mat, 0, NODE_NEW_SHADING | NODE_OLD_SHADING); -#endif + ntreeExecGPUNodes(exec, mat, 0); group_gpu_move_outputs(node, out, exec->stack); return 1; @@ -234,7 +229,6 @@ void register_node_type_sh_group(void) BLI_assert(ntype.ext.srna != NULL); RNA_struct_blender_type_set(ntype.ext.srna, &ntype); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 140, 60, 400); node_type_label(&ntype, node_group_label); diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c index dbb08dd349e..c4c790d82c5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.c +++ b/source/blender/nodes/shader/nodes/node_shader_curves.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_curves.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -27,14 +26,14 @@ /* **************** CURVE VEC ******************** */ static bNodeSocketTemplate sh_node_curve_vec_in[] = { - { SOCK_FLOAT, 0, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_curve_vec_out[] = { { SOCK_VECTOR, 0, N_("Vector")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_curve_vec(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -54,11 +53,13 @@ static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - float *array; + float *array, layer; int size; curvemapping_table_RGBA(node->storage, &array, &size); - return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array)); + GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer); + + return GPU_stack_link(mat, node, "curves_vec", in, out, tex, GPU_constant(&layer)); } void register_node_type_sh_curve_vec(void) @@ -66,7 +67,6 @@ void register_node_type_sh_curve_vec(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_curve_vec_in, sh_node_curve_vec_out); node_type_init(&ntype, node_shader_init_curve_vec); node_type_size_preset(&ntype, NODE_SIZE_LARGE); @@ -82,12 +82,12 @@ void register_node_type_sh_curve_vec(void) static bNodeSocketTemplate sh_node_curve_rgb_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_curve_rgb_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_curve_rgb(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -112,12 +112,14 @@ static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node) static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - float *array; + float *array, layer; int size; curvemapping_initialize(node->storage); curvemapping_table_RGBA(node->storage, &array, &size); - return GPU_stack_link(mat, "curves_rgb", in, out, GPU_texture(size, array)); + GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer); + + return GPU_stack_link(mat, node, "curves_rgb", in, out, tex, GPU_constant(&layer)); } void register_node_type_sh_curve_rgb(void) @@ -125,7 +127,6 @@ void register_node_type_sh_curve_rgb(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_curve_rgb_in, sh_node_curve_rgb_out); node_type_init(&ntype, node_shader_init_curve_rgb); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/shader/nodes/node_shader_displacement.c b/source/blender/nodes/shader/nodes/node_shader_displacement.c index 1cd502360de..3ab8e3215a8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_displacement.c +++ b/source/blender/nodes/shader/nodes/node_shader_displacement.c @@ -22,16 +22,16 @@ /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_displacement_in[] = { - { SOCK_FLOAT, 0, N_("Height"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - { SOCK_FLOAT, 0, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - { SOCK_FLOAT, 0, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { SOCK_FLOAT, 1, N_("Height"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { SOCK_FLOAT, 1, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { SOCK_FLOAT, 1, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_displacement_out[] = { { SOCK_VECTOR, 0, N_("Displacement"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_displacement(bNodeTree *UNUSED(ntree), bNode *node) @@ -53,10 +53,10 @@ static int gpu_shader_displacement(GPUMaterial *mat, bNode *node, bNodeExecData } if (node->custom1 == SHD_SPACE_OBJECT) { - return GPU_stack_link(mat, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX)); + return GPU_stack_link(mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX)); } else { - return GPU_stack_link(mat, "node_displacement_world", in, out, GPU_builtin(GPU_OBJECT_MATRIX)); + return GPU_stack_link(mat, node, "node_displacement_world", in, out, GPU_builtin(GPU_OBJECT_MATRIX)); } } @@ -66,7 +66,6 @@ void register_node_type_sh_displacement(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, "Displacement", NODE_CLASS_OP_VECTOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_displacement_in, sh_node_displacement_out); node_type_storage(&ntype, "", NULL, NULL); node_type_init(&ntype, node_shader_init_displacement); diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c new file mode 100644 index 00000000000..eb5e3bc7b3c --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c @@ -0,0 +1,80 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_eevee_specular_in[] = { + { SOCK_RGBA, 1, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, N_("Specular"), 0.03f, 0.03f, 0.03f, 1.0f}, + { SOCK_FLOAT, 1, N_("Roughness"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_RGBA, 1, N_("Emissive Color"), 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 1, N_("Transparency"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { SOCK_FLOAT, 1, N_("Clear Coat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Clear Coat Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_VECTOR, 1, N_("Clear Coat Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { SOCK_FLOAT, 1, N_("Ambient Occlusion"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { -1, 0, "" }, +}; + +static bNodeSocketTemplate sh_node_eevee_specular_out[] = { + { SOCK_SHADER, 0, N_("BSDF")}, + { -1, 0, "" }, +}; + +static int node_shader_gpu_eevee_specular(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +{ + static float one = 1.0f; + + /* Normals */ + if (!in[5].link) { + GPU_link(mat, "world_normals_get", &in[5].link); + } + + /* Clearcoat Normals */ + if (!in[8].link) { + GPU_link(mat, "world_normals_get", &in[8].link); + } + + /* Occlusion */ + if (!in[9].link) { + GPU_link(mat, "set_value", GPU_constant(&one), &in[9].link); + } + + GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY); + + return GPU_stack_link(mat, node, "node_eevee_specular", in, out, GPU_constant(&node->ssr_id)); +} + + +/* node type definition */ +void register_node_type_sh_eevee_specular(void) +{ + static bNodeType ntype; + + sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, "Specular", NODE_CLASS_SHADER, 0); + node_type_socket_templates(&ntype, sh_node_eevee_specular_in, sh_node_eevee_specular_out); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_gpu(&ntype, node_shader_gpu_eevee_specular); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.c b/source/blender/nodes/shader/nodes/node_shader_emission.c index 88f3034c51d..5440ef5e0d0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_emission.c +++ b/source/blender/nodes/shader/nodes/node_shader_emission.c @@ -24,17 +24,17 @@ static bNodeSocketTemplate sh_node_emission_in[] = { { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_emission_out[] = { { SOCK_SHADER, 0, N_("Emission")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_emission(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_emission(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_emission", in, out, GPU_builtin(GPU_VIEW_NORMAL)); + return GPU_stack_link(mat, node, "node_emission", in, out, GPU_builtin(GPU_VIEW_NORMAL)); } /* node type definition */ @@ -43,7 +43,6 @@ void register_node_type_sh_emission(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_emission_in, sh_node_emission_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c index bae23ca052e..681e361202e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.c +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c @@ -23,53 +23,28 @@ static bNodeSocketTemplate sh_node_fresnel_in[] = { { SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_fresnel_out[] = { { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[1].link) { in[1].link = GPU_builtin(GPU_VIEW_NORMAL); } - else if (GPU_material_use_world_space_shading(mat)) { + else { GPU_link(mat, "direction_transform_m4v3", in[1].link, GPU_builtin(GPU_VIEW_MATRIX), &in[1].link); } - return GPU_stack_link(mat, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_POSITION)); + return GPU_stack_link(mat, node, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_POSITION)); } -static void node_shader_exec_fresnel(void *data, int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) +static void node_shader_exec_fresnel(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out)) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; - - /* Compute IOR. */ - float eta; - nodestack_get_vec(&eta, SOCK_FLOAT, in[0]); - eta = max_ff(eta, 0.00001); - eta = shi->flippednor ? 1 / eta : eta; - - /* Get normal from socket, but only if linked. */ - bNodeSocket *sock_normal = node->inputs.first; - sock_normal = sock_normal->next; - - float n[3]; - if (sock_normal->link) { - nodestack_get_vec(n, SOCK_VECTOR, in[1]); - } - else { - copy_v3_v3(n, shi->vn); - } - - if (shi->use_world_space_shading) { - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEW_MATRIX), n); - } - - out[0]->vec[0] = RE_fresnel_dielectric(shi->view, n, eta); } /* node type definition */ @@ -78,7 +53,6 @@ void register_node_type_sh_fresnel(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING | NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_fresnel_in, sh_node_fresnel_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.c b/source/blender/nodes/shader/nodes/node_shader_gamma.c index 20df14eda49..06b2ed272c8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_gamma.c +++ b/source/blender/nodes/shader/nodes/node_shader_gamma.c @@ -24,12 +24,12 @@ static bNodeSocketTemplate sh_node_gamma_in[] = { { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_gamma_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_gamma(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -44,9 +44,9 @@ static void node_shader_exec_gamma(void *UNUSED(data), int UNUSED(thread), bNode out[0]->vec[2] = col[2] > 0.0f ? powf(col[2], gamma) : col[2]; } -static int node_shader_gpu_gamma(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_gamma(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_gamma", in, out); + return GPU_stack_link(mat, node, "node_gamma", in, out); } void register_node_type_sh_gamma(void) @@ -54,7 +54,6 @@ void register_node_type_sh_gamma(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_gamma_in, sh_node_gamma_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c deleted file mode 100644 index 8c4272e192a..00000000000 --- a/source/blender/nodes/shader/nodes/node_shader_geom.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2005 Blender Foundation. - * All rights reserved. - */ - -/** \file blender/nodes/shader/nodes/node_shader_geom.c - * \ingroup shdnodes - */ - - -#include "node_shader_util.h" - -#include "DNA_customdata_types.h" - -/* **************** GEOMETRY ******************** */ - -/* output socket type definition */ -static bNodeSocketTemplate sh_node_geom_out[] = { - { SOCK_VECTOR, 0, N_("Global")}, - { SOCK_VECTOR, 0, N_("Local")}, - { SOCK_VECTOR, 0, N_("View")}, - { SOCK_VECTOR, 0, N_("Orco")}, - { SOCK_VECTOR, 0, N_("UV")}, - { SOCK_VECTOR, 0, N_("Normal")}, - { SOCK_RGBA, 0, N_("Vertex Color")}, - { SOCK_FLOAT, 0, N_("Vertex Alpha")}, - { SOCK_FLOAT, 0, N_("Front/Back")}, - { -1, 0, "" } -}; - -/* node execute callback */ -static void node_shader_exec_geom(void *data, int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **out) -{ - if (data) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; - NodeGeometry *ngeo = (NodeGeometry *)node->storage; - ShadeInputUV *suv = &shi->uv[shi->actuv]; - static float defaultvcol[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - int i; - - if (ngeo->uvname[0]) { - /* find uv map by name */ - for (i = 0; i < shi->totuv; i++) { - if (STREQ(shi->uv[i].name, ngeo->uvname)) { - suv = &shi->uv[i]; - break; - } - } - } - - /* out: global, local, view, orco, uv, normal, vertex color */ - copy_v3_v3(out[GEOM_OUT_GLOB]->vec, shi->gl); - copy_v3_v3(out[GEOM_OUT_LOCAL]->vec, shi->co); - copy_v3_v3(out[GEOM_OUT_VIEW]->vec, shi->view); - copy_v3_v3(out[GEOM_OUT_ORCO]->vec, shi->lo); - copy_v3_v3(out[GEOM_OUT_UV]->vec, suv->uv); - copy_v3_v3(out[GEOM_OUT_NORMAL]->vec, shi->vno); - - if (shi->use_world_space_shading) { - negate_v3(out[GEOM_OUT_NORMAL]->vec); - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEWINV_MATRIX), out[GEOM_OUT_NORMAL]->vec); - } - if (shi->totcol) { - /* find vertex color layer by name */ - ShadeInputCol *scol = &shi->col[0]; - - if (ngeo->colname[0]) { - for (i = 0; i < shi->totcol; i++) { - if (STREQ(shi->col[i].name, ngeo->colname)) { - scol = &shi->col[i]; - break; - } - } - } - - srgb_to_linearrgb_v3_v3(out[GEOM_OUT_VCOL]->vec, scol->col); - out[GEOM_OUT_VCOL]->vec[3] = scol->col[3]; - out[GEOM_OUT_VCOL_ALPHA]->vec[0] = scol->col[3]; - } - else { - memcpy(out[GEOM_OUT_VCOL]->vec, defaultvcol, sizeof(defaultvcol)); - out[GEOM_OUT_VCOL_ALPHA]->vec[0] = 1.0f; - } - - if (shi->osatex) { - out[GEOM_OUT_GLOB]->data = shi->dxgl; - out[GEOM_OUT_GLOB]->datatype = NS_OSA_VECTORS; - out[GEOM_OUT_LOCAL]->data = shi->dxco; - out[GEOM_OUT_LOCAL]->datatype = NS_OSA_VECTORS; - out[GEOM_OUT_VIEW]->data = &shi->dxview; - out[GEOM_OUT_VIEW]->datatype = NS_OSA_VALUES; - out[GEOM_OUT_ORCO]->data = shi->dxlo; - out[GEOM_OUT_ORCO]->datatype = NS_OSA_VECTORS; - out[GEOM_OUT_UV]->data = suv->dxuv; - out[GEOM_OUT_UV]->datatype = NS_OSA_VECTORS; - out[GEOM_OUT_NORMAL]->data = shi->dxno; - out[GEOM_OUT_NORMAL]->datatype = NS_OSA_VECTORS; - } - - /* front/back, normal flipping was stored */ - out[GEOM_OUT_FRONTBACK]->vec[0] = (shi->flippednor) ? 0.0f : 1.0f; - } -} - -static void node_shader_init_geometry(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->storage = MEM_callocN(sizeof(NodeGeometry), "NodeGeometry"); -} - -static int gpu_shader_geom(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) -{ - NodeGeometry *ngeo = (NodeGeometry *)node->storage; - GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); - GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, ngeo->uvname); - GPUNodeLink *mcol = GPU_attribute(CD_MCOL, ngeo->colname); - - bool ret = GPU_stack_link(mat, "geom", in, out, - GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), - GPU_builtin(GPU_INVERSE_VIEW_MATRIX), orco, mtface, mcol); - if (GPU_material_use_world_space_shading(mat)) { - GPU_link(mat, "vec_math_negate", out[5].link, &out[5].link); - ret &= GPU_link(mat, "direction_transform_m4v3", out[5].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[5].link); - } - return ret; -} - -/* node type definition */ -void register_node_type_sh_geom(void) -{ - static bNodeType ntype; - - sh_node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING); - node_type_socket_templates(&ntype, NULL, sh_node_geom_out); - node_type_init(&ntype, node_shader_init_geometry); - node_type_storage(&ntype, "NodeGeometry", node_free_standard_storage, node_copy_standard_storage); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_geom); - node_type_gpu(&ntype, gpu_shader_geom); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.c b/source/blender/nodes/shader/nodes/node_shader_geometry.c index 9f993f02817..241b6b863e4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geometry.c +++ b/source/blender/nodes/shader/nodes/node_shader_geometry.c @@ -30,14 +30,15 @@ static bNodeSocketTemplate sh_node_geometry_out[] = { { SOCK_VECTOR, 0, N_("Parametric"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Backfacing"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Pointiness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_geometry", in, out, + return GPU_stack_link(mat, node, "node_geometry", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), - GPU_builtin(GPU_INVERSE_VIEW_MATRIX)); + GPU_attribute(CD_ORCO, ""), GPU_builtin(GPU_OBJECT_MATRIX), + GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_BARYCENTRIC_TEXCO)); } /* node type definition */ @@ -46,7 +47,6 @@ void register_node_type_sh_geometry(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_geometry_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.c b/source/blender/nodes/shader/nodes/node_shader_hair_info.c index bab89ba46b8..2191f71a221 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hair_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.c @@ -26,19 +26,24 @@ static bNodeSocketTemplate outputs[] = { { SOCK_VECTOR, 0, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, /*{ SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},*/ { SOCK_FLOAT, 0, N_("Random") }, - { -1, 0, "" } + { -1, 0, "" }, }; +static int node_shader_gpu_hair_info(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, node, "node_hair_info", in, out); +} + /* node type definition */ void register_node_type_sh_hair_info(void) { static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, outputs); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); + node_type_gpu(&ntype, node_shader_gpu_hair_info); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.c b/source/blender/nodes/shader/nodes/node_shader_holdout.c index e922258b89c..57394414f4b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_holdout.c +++ b/source/blender/nodes/shader/nodes/node_shader_holdout.c @@ -22,12 +22,12 @@ /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_holdout_in[] = { - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_holdout_out[] = { { SOCK_SHADER, 0, N_("Holdout")}, - { -1, 0, "" } + { -1, 0, "" }, }; @@ -37,7 +37,6 @@ void register_node_type_sh_holdout(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_holdout_in, sh_node_holdout_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c index b52681190b4..af802e988bb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_hueSatVal.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -32,11 +31,11 @@ static bNodeSocketTemplate sh_node_hue_sat_in[] = { { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_hue_sat_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; /* note: it would be possible to use CMP version for both nodes */ @@ -73,9 +72,9 @@ static void node_shader_exec_hue_sat(void *UNUSED(data), int UNUSED(thread), bNo } -static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "hue_sat", in, out); + return GPU_stack_link(mat, node, "hue_sat", in, out); } void register_node_type_sh_hue_sat(void) @@ -83,7 +82,6 @@ void register_node_type_sh_hue_sat(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_hue_sat_in, sh_node_hue_sat_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_exec(&ntype, NULL, NULL, node_shader_exec_hue_sat); diff --git a/source/blender/nodes/shader/nodes/node_shader_ies_light.c b/source/blender/nodes/shader/nodes/node_shader_ies_light.c index 6a71ccd704c..566deee0c42 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ies_light.c +++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.c @@ -24,12 +24,12 @@ static bNodeSocketTemplate sh_node_tex_ies_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, { SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_ies_out[] = { { SOCK_FLOAT, 0, N_("Fac")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_ies(bNodeTree *UNUSED(ntree), bNode *node) @@ -44,7 +44,6 @@ void register_node_type_sh_tex_ies(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_ies_in, sh_node_tex_ies_out); node_type_init(&ntype, node_shader_init_tex_ies); node_type_storage(&ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.c b/source/blender/nodes/shader/nodes/node_shader_invert.c index 6a3767b8006..87c14c9d70f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_invert.c +++ b/source/blender/nodes/shader/nodes/node_shader_invert.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_invert.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -57,9 +56,9 @@ static void node_shader_exec_invert(void *UNUSED(data), int UNUSED(thread), bNod copy_v3_v3(out[0]->vec, icol); } -static int gpu_shader_invert(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_invert(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "invert", in, out); + return GPU_stack_link(mat, node, "invert", in, out); } void register_node_type_sh_invert(void) @@ -67,7 +66,6 @@ void register_node_type_sh_invert(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_invert_in, sh_node_invert_out); node_type_exec(&ntype, NULL, NULL, node_shader_exec_invert); node_type_gpu(&ntype, gpu_shader_invert); diff --git a/source/blender/nodes/shader/nodes/node_shader_lamp.c b/source/blender/nodes/shader/nodes/node_shader_lamp.c deleted file mode 100644 index d051b4df784..00000000000 --- a/source/blender/nodes/shader/nodes/node_shader_lamp.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2013 Blender Foundation. - * All rights reserved. - */ - -/** \file blender/nodes/shader/nodes/node_shader_lamp.c - * \ingroup shdnodes - */ - - -#include "node_shader_util.h" - -/* **************** LAMP INFO ******************** */ -static bNodeSocketTemplate sh_node_lamp_out[] = { - { SOCK_RGBA, 0, N_("Color")}, - { SOCK_VECTOR, 0, N_("Light Vector")}, - { SOCK_FLOAT, 0, N_("Distance")}, - { SOCK_RGBA, 0, N_("Shadow")}, - { SOCK_FLOAT, 0, N_("Visibility Factor")}, - { -1, 0, "" } -}; - - -static void node_shader_exec_lamp(void *data, int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **out) -{ - if (data) { - Object *ob = (Object *)node->id; - - if (ob) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; - - shi->nodes = 1; /* temp hack to prevent trashadow recursion */ - out[4]->vec[0] = RE_lamp_get_data(shi, ob, out[0]->vec, out[1]->vec, out[2]->vec, out[3]->vec); - shi->nodes = 0; - if (shi->use_world_space_shading) - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEWINV_MATRIX), out[1]->vec); - } - } -} - -static int gpu_shader_lamp(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) -{ - if (node->id) { - GPULamp *lamp = GPU_lamp_from_blender(GPU_material_scene(mat), (Object *)node->id, NULL); - GPUNodeLink *col, *lv, *dist, *visifac, *shadow, *energy; - - visifac = GPU_lamp_get_data(mat, lamp, &col, &lv, &dist, &shadow, &energy); - - bool ret = GPU_stack_link(mat, "lamp", in, out, col, energy, lv, dist, shadow, visifac); - if (GPU_material_use_world_space_shading(mat)) - ret &= GPU_link(mat, "direction_transform_m4v3", out[1].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[1].link); - return ret; - } - - return false; -} - -void register_node_type_sh_lamp(void) -{ - static bNodeType ntype; - - sh_node_type_base(&ntype, SH_NODE_LAMP, "Lamp Data", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING); - node_type_socket_templates(&ntype, NULL, sh_node_lamp_out); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_lamp); - node_type_gpu(&ntype, gpu_shader_lamp); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c index 3df06990350..1dd615bceac 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c @@ -24,61 +24,29 @@ static bNodeSocketTemplate sh_node_layer_weight_in[] = { { SOCK_FLOAT, 1, N_("Blend"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_layer_weight_out[] = { { SOCK_FLOAT, 0, N_("Fresnel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Facing"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_layer_weight(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_layer_weight(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - if (!in[1].link) + if (!in[1].link) { in[1].link = GPU_builtin(GPU_VIEW_NORMAL); - else if (GPU_material_use_world_space_shading(mat)) { + } + else { GPU_link(mat, "direction_transform_m4v3", in[1].link, GPU_builtin(GPU_VIEW_MATRIX), &in[1].link); } - return GPU_stack_link(mat, "node_layer_weight", in, out, GPU_builtin(GPU_VIEW_POSITION)); + return GPU_stack_link(mat, node, "node_layer_weight", in, out, GPU_builtin(GPU_VIEW_POSITION)); } -static void node_shader_exec_layer_weight(void *data, int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) +static void node_shader_exec_layer_weight(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out)) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; - - /* Compute IOR. */ - float blend; - nodestack_get_vec(&blend, SOCK_FLOAT, in[0]); - float eta = max_ff(1 - blend, 0.00001); - eta = shi->flippednor ? eta : 1 / eta; - - /* Get normal from socket, but only if linked. */ - bNodeSocket *sock_normal = node->inputs.first; - sock_normal = sock_normal->next; - - float n[3]; - if (sock_normal->link) { - nodestack_get_vec(n, SOCK_VECTOR, in[1]); - } - else { - copy_v3_v3(n, shi->vn); - } - - - if (shi->use_world_space_shading) - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEW_MATRIX), n); - - out[0]->vec[0] = RE_fresnel_dielectric(shi->view, n, eta); - - float facing = fabs(dot_v3v3(shi->view, n)); - if (blend != 0.5) { - CLAMP(blend, 0.0, 0.99999); - blend = (blend < 0.5) ? 2.0 * blend : 0.5 / (1.0 - blend); - facing = pow(facing, blend); - } - out[1]->vec[0] = 1.0 - facing; } /* node type definition */ @@ -87,7 +55,6 @@ void register_node_type_sh_layer_weight(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING | NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_layer_weight_in, sh_node_layer_weight_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.c b/source/blender/nodes/shader/nodes/node_shader_light_falloff.c index 59bc174a516..c3dd65305ab 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.c +++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.c @@ -22,9 +22,9 @@ /* **************** INPUT ********************* */ static bNodeSocketTemplate sh_node_light_falloff_in[] = { - { SOCK_FLOAT, 0, N_("Strength"), 100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - { SOCK_FLOAT, 0, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - { -1, 0, "" } + { SOCK_FLOAT, 1, N_("Strength"), 100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, + { SOCK_FLOAT, 1, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { -1, 0, "" }, }; /* **************** OUTPUT ******************** */ @@ -33,12 +33,12 @@ static bNodeSocketTemplate sh_node_light_falloff_out[] = { { SOCK_FLOAT, 0, N_("Quadratic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Linear"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Constant"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_light_falloff(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_light_falloff(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_light_falloff", in, out); + return GPU_stack_link(mat, node, "node_light_falloff", in, out); } /* node type definition */ @@ -47,7 +47,6 @@ void register_node_type_sh_light_falloff(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_light_falloff_in, sh_node_light_falloff_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.c b/source/blender/nodes/shader/nodes/node_shader_light_path.c index 9828eb1ebdd..3584fb542dd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.c +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.c @@ -35,12 +35,12 @@ static bNodeSocketTemplate sh_node_light_path_out[] = { { SOCK_FLOAT, 0, N_("Glossy Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Transparent Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Transmission Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_light_path", in, out); + return GPU_stack_link(mat, node, "node_light_path", in, out); } /* node type definition */ @@ -49,7 +49,6 @@ void register_node_type_sh_light_path(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_light_path_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c index 5a96f906b51..36631f4091c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.c +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_mapping.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ #include "node_shader_util.h" @@ -26,12 +25,12 @@ /* **************** MAPPING ******************** */ static bNodeSocketTemplate sh_node_mapping_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_mapping_out[] = { { SOCK_VECTOR, 0, N_("Vector")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void *node_shader_initexec_mapping(bNodeExecContext *UNUSED(context), @@ -80,13 +79,18 @@ static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, bNodeExecData *UNUS TexMapping *texmap = node->storage; float domin = (texmap->flag & TEXMAP_CLIP_MIN) != 0; float domax = (texmap->flag & TEXMAP_CLIP_MAX) != 0; - GPUNodeLink *tmat = GPU_uniform((float *)texmap->mat); - GPUNodeLink *tmin = GPU_uniform(texmap->min); - GPUNodeLink *tmax = GPU_uniform(texmap->max); - GPUNodeLink *tdomin = GPU_uniform(&domin); - GPUNodeLink *tdomax = GPU_uniform(&domax); + static float max[3] = { FLT_MAX, FLT_MAX, FLT_MAX}; + static float min[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX}; + GPUNodeLink *tmin, *tmax, *tmat0, *tmat1, *tmat2, *tmat3; - GPU_stack_link(mat, "mapping", in, out, tmat, tmin, tmax, tdomin, tdomax); + tmin = GPU_uniform((domin) ? texmap->min : min); + tmax = GPU_uniform((domax) ? texmap->max : max); + tmat0 = GPU_uniform((float *)texmap->mat[0]); + tmat1 = GPU_uniform((float *)texmap->mat[1]); + tmat2 = GPU_uniform((float *)texmap->mat[2]); + tmat3 = GPU_uniform((float *)texmap->mat[3]); + + GPU_stack_link(mat, node, "mapping", in, out, tmat0, tmat1, tmat2, tmat3, tmin, tmax); if (texmap->type == TEXMAP_TYPE_NORMAL) GPU_link(mat, "texco_norm", out[0].link, &out[0].link); @@ -99,7 +103,6 @@ void register_node_type_sh_mapping(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_mapping_in, sh_node_mapping_out); node_type_size(&ntype, 320, 160, 360); node_type_init(&ntype, node_shader_init_mapping); diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c deleted file mode 100644 index 7280a016821..00000000000 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2005 Blender Foundation. - * All rights reserved. - */ - -/** \file blender/nodes/shader/nodes/node_shader_material.c - * \ingroup shdnodes - */ - -#include "node_shader_util.h" - -/* **************** MATERIAL ******************** */ - -static bNodeSocketTemplate sh_node_material_in[] = { - { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("DiffuseIntensity"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, - { -1, 0, "" } -}; - -static bNodeSocketTemplate sh_node_material_out[] = { - { SOCK_RGBA, 0, N_("Color")}, - { SOCK_FLOAT, 0, N_("Alpha")}, - { SOCK_VECTOR, 0, N_("Normal")}, - { -1, 0, "" } -}; - -/* **************** EXTENDED MATERIAL ******************** */ - -static bNodeSocketTemplate sh_node_material_ext_in[] = { - { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("DiffuseIntensity"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, - { SOCK_RGBA, 1, N_("Mirror"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Ambient"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_FLOAT, 1, N_("Emit"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - { SOCK_FLOAT, 1, N_("SpecTra"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_FLOAT, 1, N_("Reflectivity"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_FLOAT, 1, N_("Alpha"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - { SOCK_FLOAT, 1, N_("Translucency"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } -}; - -static bNodeSocketTemplate sh_node_material_ext_out[] = { - { SOCK_RGBA, 0, N_("Color")}, - { SOCK_FLOAT, 0, N_("Alpha")}, - { SOCK_VECTOR, 0, N_("Normal")}, - { SOCK_RGBA, 0, N_("Diffuse")}, - { SOCK_RGBA, 0, N_("Spec")}, - { SOCK_RGBA, 0, N_("AO")}, - { -1, 0, "" } -}; - -static void node_shader_exec_material(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) -{ - if (data && node->id) { - ShadeResult shrnode; - ShadeInput *shi; - ShaderCallData *shcd = data; - float col[4]; - bNodeSocket *sock; - char hasinput[NUM_MAT_IN] = {'\0'}; - int i, mode; - - /* note: cannot use the in[]->hasinput flags directly, as these are not necessarily - * the constant input stack values (e.g. in case material node is inside a group). - * we just want to know if a node input uses external data or the material setting. - * this is an ugly hack, but so is this node as a whole. - */ - for (sock = node->inputs.first, i = 0; sock; sock = sock->next, ++i) - hasinput[i] = (sock->link != NULL); - - shi = shcd->shi; - shi->mat = (Material *)node->id; - - /* copy all relevant material vars, note, keep this synced with render_types.h */ - memcpy(&shi->r, &shi->mat->r, 23 * sizeof(float)); - shi->har = shi->mat->har; - - /* write values */ - if (hasinput[MAT_IN_COLOR]) - nodestack_get_vec(&shi->r, SOCK_VECTOR, in[MAT_IN_COLOR]); - - if (hasinput[MAT_IN_SPEC]) - nodestack_get_vec(&shi->specr, SOCK_VECTOR, in[MAT_IN_SPEC]); - - if (hasinput[MAT_IN_REFL]) - nodestack_get_vec(&shi->refl, SOCK_FLOAT, in[MAT_IN_REFL]); - - /* retrieve normal */ - if (hasinput[MAT_IN_NORMAL]) { - nodestack_get_vec(shi->vn, SOCK_VECTOR, in[MAT_IN_NORMAL]); - if (shi->use_world_space_shading) { - negate_v3(shi->vn); - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEW_MATRIX), shi->vn); - } - normalize_v3(shi->vn); - } - else - copy_v3_v3(shi->vn, shi->vno); - - /* custom option to flip normal */ - if (node->custom1 & SH_NODE_MAT_NEG) { - negate_v3(shi->vn); - } - - if (node->type == SH_NODE_MATERIAL_EXT) { - if (hasinput[MAT_IN_MIR]) - nodestack_get_vec(&shi->mirr, SOCK_VECTOR, in[MAT_IN_MIR]); - if (hasinput[MAT_IN_AMB]) - nodestack_get_vec(&shi->amb, SOCK_FLOAT, in[MAT_IN_AMB]); - if (hasinput[MAT_IN_EMIT]) - nodestack_get_vec(&shi->emit, SOCK_FLOAT, in[MAT_IN_EMIT]); - if (hasinput[MAT_IN_SPECTRA]) - nodestack_get_vec(&shi->spectra, SOCK_FLOAT, in[MAT_IN_SPECTRA]); - if (hasinput[MAT_IN_RAY_MIRROR]) - nodestack_get_vec(&shi->ray_mirror, SOCK_FLOAT, in[MAT_IN_RAY_MIRROR]); - if (hasinput[MAT_IN_ALPHA]) - nodestack_get_vec(&shi->alpha, SOCK_FLOAT, in[MAT_IN_ALPHA]); - if (hasinput[MAT_IN_TRANSLUCENCY]) - nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]); - } - - /* make alpha output give results even if transparency is only enabled on - * the material linked in this not and not on the parent material */ - mode = shi->mode; - if (shi->mat->mode & MA_TRANSP) - shi->mode |= MA_TRANSP; - - shi->nodes = 1; /* temp hack to prevent trashadow recursion */ - node_shader_lamp_loop(shi, &shrnode); /* clears shrnode */ - shi->nodes = 0; - - shi->mode = mode; - - /* write to outputs */ - if (node->custom1 & SH_NODE_MAT_DIFF) { - copy_v3_v3(col, shrnode.combined); - if (!(node->custom1 & SH_NODE_MAT_SPEC)) { - sub_v3_v3(col, shrnode.spec); - } - } - else if (node->custom1 & SH_NODE_MAT_SPEC) { - copy_v3_v3(col, shrnode.spec); - } - else - col[0] = col[1] = col[2] = 0.0f; - - col[3] = shrnode.alpha; - - if (shi->do_preview) - BKE_node_preview_set_pixel(execdata->preview, col, shi->xs, shi->ys, shi->do_manage); - - copy_v3_v3(out[MAT_OUT_COLOR]->vec, col); - out[MAT_OUT_ALPHA]->vec[0] = shrnode.alpha; - - if (node->custom1 & SH_NODE_MAT_NEG) { - shi->vn[0] = -shi->vn[0]; - shi->vn[1] = -shi->vn[1]; - shi->vn[2] = -shi->vn[2]; - } - - copy_v3_v3(out[MAT_OUT_NORMAL]->vec, shi->vn); - - if (shi->use_world_space_shading) { - negate_v3(out[MAT_OUT_NORMAL]->vec); - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEWINV_MATRIX), out[MAT_OUT_NORMAL]->vec); - } - /* Extended material options */ - if (node->type == SH_NODE_MATERIAL_EXT) { - /* Shadow, Reflect, Refract, Radiosity, Speed seem to cause problems inside - * a node tree :( */ - copy_v3_v3(out[MAT_OUT_DIFFUSE]->vec, shrnode.diffshad); - copy_v3_v3(out[MAT_OUT_SPEC]->vec, shrnode.spec); - copy_v3_v3(out[MAT_OUT_AO]->vec, shrnode.ao); - } - - /* copy passes, now just active node */ - if (node->flag & NODE_ACTIVE_ID) { - float combined[4], alpha; - - copy_v4_v4(combined, shcd->shr->combined); - alpha = shcd->shr->alpha; - - *(shcd->shr) = shrnode; - - copy_v4_v4(shcd->shr->combined, combined); - shcd->shr->alpha = alpha; - } - } -} - - -static void node_shader_init_material(bNodeTree *UNUSED(ntree), bNode *node) -{ - node->custom1 = SH_NODE_MAT_DIFF | SH_NODE_MAT_SPEC; -} - -/* XXX this is also done as a local static function in gpu_codegen.c, - * but we need this to hack around the crappy material node. - */ -static GPUNodeLink *gpu_get_input_link(GPUMaterial *mat, GPUNodeStack *in) -{ - if (in->link) { - return in->link; - } - else { - GPUNodeLink *result = NULL; - - /* note GPU_uniform() is only intended to be used as a parameter to - * GPU_link(), returning it directly results in leaks or double frees */ - if (in->type == GPU_FLOAT) - GPU_link(mat, "set_value", GPU_uniform(in->vec), &result); - else if (in->type == GPU_VEC3) - GPU_link(mat, "set_rgb", GPU_uniform(in->vec), &result); - else if (in->type == GPU_VEC4) - GPU_link(mat, "set_rgba", GPU_uniform(in->vec), &result); - else - BLI_assert(0); - - return result; - } -} - -static int gpu_shader_material(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) -{ - if (node->id) { - GPUShadeInput shi; - GPUShadeResult shr; - bNodeSocket *sock; - char hasinput[NUM_MAT_IN] = {'\0'}; - int i; - - /* note: cannot use the in[]->hasinput flags directly, as these are not necessarily - * the constant input stack values (e.g. in case material node is inside a group). - * we just want to know if a node input uses external data or the material setting. - */ - for (sock = node->inputs.first, i = 0; sock; sock = sock->next, ++i) - hasinput[i] = (sock->link != NULL); - - GPU_shadeinput_set(mat, (Material *)node->id, &shi); - - /* write values */ - if (hasinput[MAT_IN_COLOR]) - shi.rgb = gpu_get_input_link(mat, &in[MAT_IN_COLOR]); - - if (hasinput[MAT_IN_SPEC]) - shi.specrgb = gpu_get_input_link(mat, &in[MAT_IN_SPEC]); - - if (hasinput[MAT_IN_REFL]) - shi.refl = gpu_get_input_link(mat, &in[MAT_IN_REFL]); - - /* retrieve normal */ - if (hasinput[MAT_IN_NORMAL]) { - GPUNodeLink *tmp; - shi.vn = gpu_get_input_link(mat, &in[MAT_IN_NORMAL]); - if (GPU_material_use_world_space_shading(mat)) { - GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn); - GPU_link(mat, "direction_transform_m4v3", shi.vn, GPU_builtin(GPU_VIEW_MATRIX), &shi.vn); - } - GPU_link(mat, "vec_math_normalize", shi.vn, &shi.vn, &tmp); - } - - /* custom option to flip normal */ - if (node->custom1 & SH_NODE_MAT_NEG) - GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn); - - if (node->type == SH_NODE_MATERIAL_EXT) { - if (hasinput[MAT_IN_MIR]) - shi.mir = gpu_get_input_link(mat, &in[MAT_IN_MIR]); - if (hasinput[MAT_IN_AMB]) - shi.amb = gpu_get_input_link(mat, &in[MAT_IN_AMB]); - if (hasinput[MAT_IN_EMIT]) - shi.emit = gpu_get_input_link(mat, &in[MAT_IN_EMIT]); - if (hasinput[MAT_IN_SPECTRA]) - shi.spectra = gpu_get_input_link(mat, &in[MAT_IN_SPECTRA]); - if (hasinput[MAT_IN_ALPHA]) - shi.alpha = gpu_get_input_link(mat, &in[MAT_IN_ALPHA]); - } - - GPU_shaderesult_set(&shi, &shr); /* clears shr */ - - /* write to outputs */ - if (node->custom1 & SH_NODE_MAT_DIFF) { - out[MAT_OUT_COLOR].link = shr.combined; - - if (!(node->custom1 & SH_NODE_MAT_SPEC)) { - GPUNodeLink *link; - GPU_link(mat, "vec_math_sub", shr.combined, shr.spec, &out[MAT_OUT_COLOR].link, &link); - } - } - else if (node->custom1 & SH_NODE_MAT_SPEC) { - out[MAT_OUT_COLOR].link = shr.spec; - } - else - GPU_link(mat, "set_rgb_zero", &out[MAT_OUT_COLOR].link); - - GPU_link(mat, "mtex_alpha_to_col", out[MAT_OUT_COLOR].link, shr.alpha, &out[MAT_OUT_COLOR].link); - - out[MAT_OUT_ALPHA].link = shr.alpha; // - - if (node->custom1 & SH_NODE_MAT_NEG) - GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn); - out[MAT_OUT_NORMAL].link = shi.vn; - if (GPU_material_use_world_space_shading(mat)) { - GPU_link(mat, "vec_math_negate", out[MAT_OUT_NORMAL].link, &out[MAT_OUT_NORMAL].link); - GPU_link(mat, "direction_transform_m4v3", out[MAT_OUT_NORMAL].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[MAT_OUT_NORMAL].link); - } - - if (node->type == SH_NODE_MATERIAL_EXT) { - out[MAT_OUT_DIFFUSE].link = shr.diff; - out[MAT_OUT_SPEC].link = shr.spec; - GPU_link(mat, "set_rgb_one", &out[MAT_OUT_AO].link); - } - - return 1; - } - - return 0; -} - -void register_node_type_sh_material(void) -{ - static bNodeType ntype; - - sh_node_type_base(&ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_PREVIEW); - node_type_compatibility(&ntype, NODE_OLD_SHADING); - node_type_socket_templates(&ntype, sh_node_material_in, sh_node_material_out); - node_type_init(&ntype, node_shader_init_material); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_material); - node_type_gpu(&ntype, gpu_shader_material); - - nodeRegisterType(&ntype); -} - - -void register_node_type_sh_material_ext(void) -{ - static bNodeType ntype; - - sh_node_type_base(&ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_PREVIEW); - node_type_compatibility(&ntype, NODE_OLD_SHADING); - node_type_socket_templates(&ntype, sh_node_material_ext_in, sh_node_material_ext_out); - node_type_init(&ntype, node_shader_init_material); - node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_material); - node_type_gpu(&ntype, gpu_shader_material); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index 2a72151186e..9c7ab47634f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_math.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -272,7 +271,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED( "math_divide", "math_sine", "math_cosine", "math_tangent", "math_asin", "math_acos", "math_atan", "math_pow", "math_log", "math_min", "math_max", "math_round", "math_less_than", "math_greater_than", "math_modulo", "math_abs", - "math_atan2", "math_floor", "math_ceil", "math_fract", "math_sqrt" + "math_atan2", "math_floor", "math_ceil", "math_fract", "math_sqrt", }; switch (node->custom1) { @@ -288,7 +287,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED( case NODE_MATH_GREATER: case NODE_MATH_MOD: case NODE_MATH_ATAN2: - GPU_stack_link(mat, names[node->custom1], in, out); + GPU_stack_link(mat, node, names[node->custom1], in, out); break; case NODE_MATH_SIN: case NODE_MATH_COS: @@ -307,14 +306,14 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED( GPUNodeStack tmp_in[2]; memcpy(&tmp_in[0], &in[0], sizeof(GPUNodeStack)); memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack)); - GPU_stack_link(mat, names[node->custom1], tmp_in, out); + GPU_stack_link(mat, node, names[node->custom1], tmp_in, out); } else { /* use only second item and terminator */ GPUNodeStack tmp_in[2]; memcpy(&tmp_in[0], &in[1], sizeof(GPUNodeStack)); memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack)); - GPU_stack_link(mat, names[node->custom1], tmp_in, out); + GPU_stack_link(mat, node, names[node->custom1], tmp_in, out); } break; default: @@ -324,7 +323,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED( if (node->custom2 & SHD_MATH_CLAMP) { float min[3] = {0.0f, 0.0f, 0.0f}; float max[3] = {1.0f, 1.0f, 1.0f}; - GPU_link(mat, "clamp_val", out[0].link, GPU_uniform(min), GPU_uniform(max), &out[0].link); + GPU_link(mat, "clamp_val", out[0].link, GPU_constant(min), GPU_constant(max), &out[0].link); } return 1; @@ -335,7 +334,6 @@ void register_node_type_sh_math(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_math_in, sh_node_math_out); node_type_label(&ntype, node_math_label); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c index e422e076f53..fc0bc514971 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_mixRgb.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -29,11 +28,11 @@ static bNodeSocketTemplate sh_node_mix_rgb_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f}, { SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_mix_rgb_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_mix_rgb(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -63,11 +62,12 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUS "mix_screen", "mix_div", "mix_diff", "mix_dark", "mix_light", "mix_overlay", "mix_dodge", "mix_burn", "mix_hue", "mix_sat", "mix_val", "mix_color", "mix_soft", "mix_linear"}; - int ret = GPU_stack_link(mat, names[node->custom1], in, out); + + int ret = GPU_stack_link(mat, node, names[node->custom1], in, out); if (ret && node->custom2 & SHD_MIXRGB_CLAMP) { float min[3] = {0.0f, 0.0f, 0.0f}; float max[3] = {1.0f, 1.0f, 1.0f}; - GPU_link(mat, "clamp_vec3", out[0].link, GPU_uniform(min), GPU_uniform(max), &out[0].link); + GPU_link(mat, "clamp_vec3", out[0].link, GPU_constant(min), GPU_constant(max), &out[0].link); } return ret; } @@ -78,7 +78,6 @@ void register_node_type_sh_mix_rgb(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out); node_type_label(&ntype, node_blend_label); node_type_exec(&ntype, NULL, NULL, node_shader_exec_mix_rgb); diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c index eb877af8a67..345680a5b76 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c @@ -25,17 +25,17 @@ static bNodeSocketTemplate sh_node_mix_shader_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_SHADER, 1, N_("Shader")}, { SOCK_SHADER, 1, N_("Shader")}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_mix_shader_out[] = { { SOCK_SHADER, 0, N_("Shader")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_mix_shader(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_mix_shader(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_mix_shader", in, out); + return GPU_stack_link(mat, node, "node_mix_shader", in, out); } /* node type definition */ @@ -44,7 +44,6 @@ void register_node_type_sh_mix_shader(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_mix_shader_in, sh_node_mix_shader_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c index b693ba9ebab..28bf49c14d0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal.c +++ b/source/blender/nodes/shader/nodes/node_shader_normal.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_normal.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -27,13 +26,13 @@ /* **************** NORMAL ******************** */ static bNodeSocketTemplate sh_node_normal_in[] = { { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_normal_out[] = { { SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, { SOCK_FLOAT, 0, N_("Dot")}, - { -1, 0, "" } + { -1, 0, "" }, }; /* generates normal, does dot product */ @@ -50,15 +49,10 @@ static void node_shader_exec_normal(void *UNUSED(data), int UNUSED(thread), bNod out[1]->vec[0] = -dot_v3v3(vec, out[0]->vec); } -static int gpu_shader_normal(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_normal(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { GPUNodeLink *vec = GPU_uniform(out[0].vec); - if (GPU_material_use_new_shading_nodes(mat)) { - return GPU_stack_link(mat, "normal_new_shading", in, out, vec); - } - else { - return GPU_stack_link(mat, "normal", in, out, vec); - } + return GPU_stack_link(mat, node, "normal_new_shading", in, out, vec); } void register_node_type_sh_normal(void) @@ -66,7 +60,6 @@ void register_node_type_sh_normal(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_normal_in, sh_node_normal_out); node_type_exec(&ntype, NULL, NULL, node_shader_exec_normal); node_type_gpu(&ntype, gpu_shader_normal); diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.c b/source/blender/nodes/shader/nodes/node_shader_normal_map.c index 2c33d3024ab..e0021d44e69 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal_map.c +++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c @@ -24,12 +24,12 @@ static bNodeSocketTemplate sh_node_normal_map_in[] = { { SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, { SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_normal_map_out[] = { { SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node) @@ -39,80 +39,9 @@ static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node) } static void node_shader_exec_normal_map( - void *data, int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), - bNodeStack **in, bNodeStack **out) + void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), + bNodeStack **UNUSED(in), bNodeStack **UNUSED(out)) { - if (data) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; - - NodeShaderNormalMap *nm = node->storage; - - float strength, vecIn[3]; - nodestack_get_vec(&strength, SOCK_FLOAT, in[0]); - nodestack_get_vec(vecIn, SOCK_VECTOR, in[1]); - - vecIn[0] = -2 * (vecIn[0] - 0.5f); - vecIn[1] = 2 * (vecIn[1] - 0.5f); - vecIn[2] = 2 * (vecIn[2] - 0.5f); - - CLAMP_MIN(strength, 0.0f); - - float *N = shi->nmapnorm; - int uv_index = 0; - switch (nm->space) { - case SHD_SPACE_TANGENT: - if (nm->uv_map[0]) { - /* find uv map by name */ - for (int i = 0; i < shi->totuv; i++) { - if (STREQ(shi->uv[i].name, nm->uv_map)) { - uv_index = i; - break; - } - } - } - else { - uv_index = shi->actuv; - } - - float *T = shi->tangents[uv_index]; - - float B[3]; - cross_v3_v3v3(B, N, T); - mul_v3_fl(B, T[3]); - - for (int j = 0; j < 3; j++) - out[0]->vec[j] = vecIn[0] * T[j] + vecIn[1] * B[j] + vecIn[2] * N[j]; - interp_v3_v3v3(out[0]->vec, N, out[0]->vec, strength); - if (shi->use_world_space_shading) { - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEWINV_MATRIX), out[0]->vec); - } - break; - - case SHD_SPACE_OBJECT: - case SHD_SPACE_BLENDER_OBJECT: - if (shi->use_world_space_shading) { - mul_mat3_m4_v3((float (*)[4])RE_object_instance_get_matrix(shi->obi, RE_OBJECT_INSTANCE_MATRIX_OB), vecIn); - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEWINV_MATRIX), N); - } - else - mul_mat3_m4_v3((float (*)[4])RE_object_instance_get_matrix(shi->obi, RE_OBJECT_INSTANCE_MATRIX_LOCALTOVIEW), vecIn); - interp_v3_v3v3(out[0]->vec, N, vecIn, strength); - break; - - case SHD_SPACE_WORLD: - case SHD_SPACE_BLENDER_WORLD: - if (shi->use_world_space_shading) - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEWINV_MATRIX), N); - else - mul_mat3_m4_v3((float (*)[4])RE_render_current_get_matrix(RE_VIEW_MATRIX), vecIn); - interp_v3_v3v3(out[0]->vec, N, vecIn, strength); - break; - } - if (shi->use_world_space_shading) { - negate_v3(out[0]->vec); - } - normalize_v3(out[0]->vec); - } } static int gpu_shader_normal_map(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) @@ -126,68 +55,50 @@ static int gpu_shader_normal_map(GPUMaterial *mat, bNode *node, bNodeExecData *U if (in[0].link) strength = in[0].link; + else if (node->original) { + bNodeSocket *socket = BLI_findlink(&node->original->inputs, 0); + bNodeSocketValueFloat *socket_data = socket->default_value; + strength = GPU_uniform(&socket_data->value); + } else - strength = GPU_uniform(in[0].vec); + strength = GPU_constant(in[0].vec); if (in[1].link) realnorm = in[1].link; + else if (node->original) { + bNodeSocket *socket = BLI_findlink(&node->original->inputs, 1); + bNodeSocketValueRGBA *socket_data = socket->default_value; + realnorm = GPU_uniform(socket_data->value); + } else - realnorm = GPU_uniform(in[1].vec); + realnorm = GPU_constant(in[1].vec); negnorm = GPU_builtin(GPU_VIEW_NORMAL); - GPU_link(mat, "math_max", strength, GPU_uniform(d), &strength); - - if (GPU_material_use_world_space_shading(mat)) { - - /* ******* CYCLES or BLENDER INTERNAL with world space shading flag ******* */ - - const char *color_to_normal_fnc_name = "color_to_normal_new_shading"; - if (nm->space == SHD_SPACE_BLENDER_OBJECT || nm->space == SHD_SPACE_BLENDER_WORLD || !GPU_material_use_new_shading_nodes(mat)) - color_to_normal_fnc_name = "color_to_blender_normal_new_shading"; - switch (nm->space) { - case SHD_SPACE_TANGENT: - GPU_link(mat, "color_to_normal_new_shading", realnorm, &realnorm); - GPU_link(mat, "node_normal_map", GPU_attribute(CD_TANGENT, nm->uv_map), negnorm, realnorm, &realnorm); - GPU_link(mat, "vec_math_mix", strength, realnorm, GPU_builtin(GPU_VIEW_NORMAL), &out[0].link); - /* for uniform scale this is sufficient to match Cycles */ - GPU_link(mat, "direction_transform_m4v3", out[0].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[0].link); - GPU_link(mat, "vect_normalize", out[0].link, &out[0].link); - return true; - case SHD_SPACE_OBJECT: - case SHD_SPACE_BLENDER_OBJECT: - GPU_link(mat, "direction_transform_m4v3", negnorm, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &negnorm); - GPU_link(mat, color_to_normal_fnc_name, realnorm, &realnorm); - GPU_link(mat, "direction_transform_m4v3", realnorm, GPU_builtin(GPU_OBJECT_MATRIX), &realnorm); - break; - case SHD_SPACE_WORLD: - case SHD_SPACE_BLENDER_WORLD: - GPU_link(mat, "direction_transform_m4v3", negnorm, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &negnorm); - GPU_link(mat, color_to_normal_fnc_name, realnorm, &realnorm); - break; - } - - } - else { - - /* ************** BLENDER INTERNAL without world space shading flag ******* */ - - GPU_link(mat, "color_to_normal", realnorm, &realnorm); - GPU_link(mat, "mtex_negate_texnormal", realnorm, &realnorm); - GPU_link(mat, "vec_math_negate", negnorm, &negnorm); - - switch (nm->space) { - case SHD_SPACE_TANGENT: - GPU_link(mat, "node_normal_map", GPU_attribute(CD_TANGENT, nm->uv_map), negnorm, realnorm, &realnorm); - break; - case SHD_SPACE_OBJECT: - case SHD_SPACE_BLENDER_OBJECT: - GPU_link(mat, "direction_transform_m4v3", realnorm, GPU_builtin(GPU_LOC_TO_VIEW_MATRIX), &realnorm); - break; - case SHD_SPACE_WORLD: - case SHD_SPACE_BLENDER_WORLD: - GPU_link(mat, "direction_transform_m4v3", realnorm, GPU_builtin(GPU_VIEW_MATRIX), &realnorm); - break; - } + GPU_link(mat, "math_max", strength, GPU_constant(d), &strength); + + const char *color_to_normal_fnc_name = "color_to_normal_new_shading"; + if (nm->space == SHD_SPACE_BLENDER_OBJECT || nm->space == SHD_SPACE_BLENDER_WORLD) + color_to_normal_fnc_name = "color_to_blender_normal_new_shading"; + switch (nm->space) { + case SHD_SPACE_TANGENT: + GPU_link(mat, "color_to_normal_new_shading", realnorm, &realnorm); + GPU_link(mat, "node_normal_map", GPU_attribute(CD_TANGENT, nm->uv_map), negnorm, realnorm, &realnorm); + GPU_link(mat, "vec_math_mix", strength, realnorm, GPU_builtin(GPU_VIEW_NORMAL), &out[0].link); + /* for uniform scale this is sufficient to match Cycles */ + GPU_link(mat, "direction_transform_m4v3", out[0].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[0].link); + GPU_link(mat, "vect_normalize", out[0].link, &out[0].link); + return true; + case SHD_SPACE_OBJECT: + case SHD_SPACE_BLENDER_OBJECT: + GPU_link(mat, "direction_transform_m4v3", negnorm, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &negnorm); + GPU_link(mat, color_to_normal_fnc_name, realnorm, &realnorm); + GPU_link(mat, "direction_transform_m4v3", realnorm, GPU_builtin(GPU_OBJECT_MATRIX), &realnorm); + break; + case SHD_SPACE_WORLD: + case SHD_SPACE_BLENDER_WORLD: + GPU_link(mat, "direction_transform_m4v3", negnorm, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &negnorm); + GPU_link(mat, color_to_normal_fnc_name, realnorm, &realnorm); + break; } GPU_link(mat, "vec_math_mix", strength, realnorm, negnorm, &out[0].link); @@ -202,7 +113,6 @@ void register_node_type_sh_normal_map(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING | NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_normal_map_in, sh_node_normal_map_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_normal_map); diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.c b/source/blender/nodes/shader/nodes/node_shader_object_info.c index e1c333b4334..fe3015e689f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_object_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_object_info.c @@ -26,21 +26,16 @@ static bNodeSocketTemplate sh_node_object_info_out[] = { { SOCK_FLOAT, 0, N_("Object Index"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Material Index"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Random"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_object_info(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_object_info(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "node_object_info", in, out, GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_OBJECT_INFO)); + return GPU_stack_link(mat, node, "node_object_info", in, out, GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_OBJECT_INFO)); } -static void node_shader_exec_object_info(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **out) +static void node_shader_exec_object_info(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out)) { - ShaderCallData *scd = (ShaderCallData *)data; - copy_v4_v4(out[0]->vec, RE_object_instance_get_matrix(scd->shi->obi, RE_OBJECT_INSTANCE_MATRIX_OB)[3]); - out[1]->vec[0] = RE_object_instance_get_object_pass_index(scd->shi->obi); - out[2]->vec[0] = scd->shi->mat->index; - out[3]->vec[0] = RE_object_instance_get_random_id(scd->shi->obi) * (1.0f / (float)0xFFFFFFFF); } /* node type definition */ @@ -49,7 +44,6 @@ void register_node_type_sh_object_info(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_object_info_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c deleted file mode 100644 index 68ad6a38969..00000000000 --- a/source/blender/nodes/shader/nodes/node_shader_output.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2005 Blender Foundation. - * All rights reserved. - */ - -/** \file blender/nodes/shader/nodes/node_shader_output.c - * \ingroup shdnodes - */ - - -#include "node_shader_util.h" - -/* **************** OUTPUT ******************** */ -static bNodeSocketTemplate sh_node_output_in[] = { - { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } -}; - -static void node_shader_exec_output(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **UNUSED(out)) -{ - if (data) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; - float col[4]; - - /* stack order input sockets: col, alpha, normal */ - nodestack_get_vec(col, SOCK_VECTOR, in[0]); - nodestack_get_vec(col + 3, SOCK_FLOAT, in[1]); - - if (shi->do_preview) { - BKE_node_preview_set_pixel(execdata->preview, col, shi->xs, shi->ys, shi->do_manage); - node->lasty = shi->ys; - } - - if (node->flag & NODE_DO_OUTPUT) { - ShadeResult *shr = ((ShaderCallData *)data)->shr; - - copy_v4_v4(shr->combined, col); - shr->alpha = col[3]; - - // copy_v3_v3(shr->nor, in[3]->vec); - } - } -} - -static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) -{ - GPUNodeLink *outlink; - -#if 0 - if (in[1].hasinput) - GPU_material_enable_alpha(mat); -#endif - - GPU_stack_link(mat, "output_node", in, out, &outlink); - GPU_material_output_link(mat, outlink); - - return 1; -} - -void register_node_type_sh_output(void) -{ - static bNodeType ntype; - - sh_node_type_base(&ntype, SH_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW); - node_type_compatibility(&ntype, NODE_OLD_SHADING); - node_type_socket_templates(&ntype, sh_node_output_in, NULL); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_output); - node_type_gpu(&ntype, gpu_shader_output); - - /* Do not allow muting output node. */ - node_type_internal_links(&ntype, NULL); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c index bd097a728b3..efd390c872f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c @@ -23,7 +23,7 @@ static bNodeSocketTemplate sh_node_output_lamp_in[] = { { SOCK_SHADER, 1, N_("Surface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; /* node type definition */ @@ -31,8 +31,7 @@ void register_node_type_sh_output_lamp(void) { static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_LAMP, "Lamp Output", NODE_CLASS_OUTPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, "Light Output", NODE_CLASS_OUTPUT, 0); node_type_socket_templates(&ntype, sh_node_output_lamp_in, NULL); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.c b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.c index ddadf23b93d..e1c03c53679 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.c @@ -26,7 +26,7 @@ static bNodeSocketTemplate sh_node_output_linestyle_in[] = { { SOCK_FLOAT, 1, N_("Color Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR }, { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR }, { SOCK_FLOAT, 1, N_("Alpha Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR }, - { -1, 0, "" } + { -1, 0, "" }, }; /* node type definition */ @@ -35,7 +35,6 @@ void register_node_type_sh_output_linestyle(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, "Line Style Output", NODE_CLASS_OUTPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_output_linestyle_in, NULL); node_type_init(&ntype, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c index ee94a00c769..3f6cb0d8704 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c @@ -19,20 +19,22 @@ #include "../node_shader_util.h" +#include "BKE_scene.h" + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_output_material_in[] = { { SOCK_SHADER, 1, N_("Surface")}, { SOCK_SHADER, 1, N_("Volume")}, { SOCK_VECTOR, 1, N_("Displacement"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_output_material(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_output_material(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { GPUNodeLink *outlink; - GPU_stack_link(mat, "node_output_material", in, out, &outlink); + GPU_stack_link(mat, node, "node_output_material", in, out, &outlink); GPU_material_output_link(mat, outlink); return true; @@ -45,7 +47,6 @@ void register_node_type_sh_output_material(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_output_material_in, NULL); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.c b/source/blender/nodes/shader/nodes/node_shader_output_world.c index b1b178e445e..84f52860b5f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_world.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.c @@ -24,14 +24,14 @@ static bNodeSocketTemplate sh_node_output_world_in[] = { { SOCK_SHADER, 1, N_("Surface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_SHADER, 1, N_("Volume"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_output_world(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_output_world(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { GPUNodeLink *outlink; - GPU_stack_link(mat, "node_output_world", in, out, &outlink); + GPU_stack_link(mat, node, "node_output_world", in, out, &outlink); GPU_material_output_link(mat, outlink); return true; @@ -43,7 +43,6 @@ void register_node_type_sh_output_world(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_output_world_in, NULL); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.c b/source/blender/nodes/shader/nodes/node_shader_particle_info.c index 1a21fa82232..3a20dd1ca02 100644 --- a/source/blender/nodes/shader/nodes/node_shader_particle_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.c @@ -34,17 +34,14 @@ static bNodeSocketTemplate outputs[] = { { SOCK_VECTOR, 0, "Angular Velocity" }, { -1, 0, "" } }; -static void node_shader_exec_particle_info(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **out) +static void node_shader_exec_particle_info(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out)) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; - - RE_instance_get_particle_info(shi->obi, out[0]->vec, out[1]->vec, out[2]->vec, out[3]->vec, out[4]->vec, out[5]->vec, out[6]->vec, out[7]->vec); } -static int gpu_shader_particle_info(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_particle_info(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "particle_info", in, out, + return GPU_stack_link(mat, node, "particle_info", in, out, GPU_builtin(GPU_PARTICLE_SCALAR_PROPS), GPU_builtin(GPU_PARTICLE_LOCATION), GPU_builtin(GPU_PARTICLE_VELOCITY), @@ -57,7 +54,6 @@ void register_node_type_sh_particle_info(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING | NODE_OLD_SHADING); node_type_socket_templates(&ntype, NULL, outputs); node_type_exec(&ntype, NULL, NULL, node_shader_exec_particle_info); node_type_gpu(&ntype, gpu_shader_particle_info); diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.c b/source/blender/nodes/shader/nodes/node_shader_rgb.c index 5a82da58e90..ef1e436641f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_rgb.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_rgb.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -27,13 +26,13 @@ /* **************** RGB ******************** */ static bNodeSocketTemplate sh_node_rgb_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int gpu_shader_rgb(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - GPUNodeLink *vec = GPU_uniform(out[0].vec); - return GPU_stack_link(mat, "set_rgba", in, out, vec); + GPUNodeLink *link = GPU_uniformbuffer_link_out(mat, node, out, 0); + return GPU_stack_link(mat, node, "set_rgba", in, out, link); } void register_node_type_sh_rgb(void) @@ -41,7 +40,6 @@ void register_node_type_sh_rgb(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_rgb_out); node_type_gpu(&ntype, gpu_shader_rgb); diff --git a/source/blender/nodes/shader/nodes/node_shader_script.c b/source/blender/nodes/shader/nodes/node_shader_script.c index 929e8d31e32..3e91f9efb74 100644 --- a/source/blender/nodes/shader/nodes/node_shader_script.c +++ b/source/blender/nodes/shader/nodes/node_shader_script.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_script.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ #include "node_shader_util.h" @@ -60,7 +59,6 @@ void register_node_type_sh_script(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_init(&ntype, init); node_type_storage(&ntype, "NodeShaderScript", node_free_script, node_copy_script); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c index b6da1788656..3b87b18ff58 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_sepcombHSV.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -27,13 +26,13 @@ /* **************** SEPARATE HSV ******************** */ static bNodeSocketTemplate sh_node_sephsv_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_sephsv_out[] = { { SOCK_FLOAT, 0, N_("H")}, { SOCK_FLOAT, 0, N_("S")}, { SOCK_FLOAT, 0, N_("V")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_sephsv(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -45,9 +44,9 @@ static void node_shader_exec_sephsv(void *UNUSED(data), int UNUSED(thread), bNod &out[0]->vec[0], &out[1]->vec[0], &out[2]->vec[0]); } -static int gpu_shader_sephsv(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_sephsv(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "separate_hsv", in, out); + return GPU_stack_link(mat, node, "separate_hsv", in, out); } void register_node_type_sh_sephsv(void) @@ -55,7 +54,6 @@ void register_node_type_sh_sephsv(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_sephsv_in, sh_node_sephsv_out); node_type_exec(&ntype, NULL, NULL, node_shader_exec_sephsv); node_type_gpu(&ntype, gpu_shader_sephsv); @@ -69,11 +67,11 @@ static bNodeSocketTemplate sh_node_combhsv_in[] = { { SOCK_FLOAT, 1, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, { SOCK_FLOAT, 1, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, { SOCK_FLOAT, 1, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_combhsv_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_combhsv(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -86,9 +84,9 @@ static void node_shader_exec_combhsv(void *UNUSED(data), int UNUSED(thread), bNo hsv_to_rgb(h, s, v, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2]); } -static int gpu_shader_combhsv(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_combhsv(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "combine_hsv", in, out); + return GPU_stack_link(mat, node, "combine_hsv", in, out); } void register_node_type_sh_combhsv(void) @@ -96,7 +94,6 @@ void register_node_type_sh_combhsv(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_combhsv_in, sh_node_combhsv_out); node_type_exec(&ntype, NULL, NULL, node_shader_exec_combhsv); node_type_gpu(&ntype, gpu_shader_combhsv); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c index 741b002fe8a..762affbac90 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_sepcombRGB.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -27,13 +26,13 @@ /* **************** SEPARATE RGBA ******************** */ static bNodeSocketTemplate sh_node_seprgb_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_seprgb_out[] = { { SOCK_FLOAT, 0, N_("R")}, { SOCK_FLOAT, 0, N_("G")}, { SOCK_FLOAT, 0, N_("B")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_seprgb(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -46,9 +45,9 @@ static void node_shader_exec_seprgb(void *UNUSED(data), int UNUSED(thread), bNod out[2]->vec[0] = col[2]; } -static int gpu_shader_seprgb(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_seprgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "separate_rgb", in, out); + return GPU_stack_link(mat, node, "separate_rgb", in, out); } void register_node_type_sh_seprgb(void) @@ -56,7 +55,6 @@ void register_node_type_sh_seprgb(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_seprgb_in, sh_node_seprgb_out); node_type_exec(&ntype, NULL, NULL, node_shader_exec_seprgb); node_type_gpu(&ntype, gpu_shader_seprgb); @@ -71,11 +69,11 @@ static bNodeSocketTemplate sh_node_combrgb_in[] = { { SOCK_FLOAT, 1, N_("R"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, { SOCK_FLOAT, 1, N_("G"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, { SOCK_FLOAT, 1, N_("B"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_combrgb_out[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_combrgb(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -90,9 +88,9 @@ static void node_shader_exec_combrgb(void *UNUSED(data), int UNUSED(thread), bNo out[0]->vec[2] = b; } -static int gpu_shader_combrgb(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_combrgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "combine_rgb", in, out); + return GPU_stack_link(mat, node, "combine_rgb", in, out); } void register_node_type_sh_combrgb(void) @@ -100,7 +98,6 @@ void register_node_type_sh_combrgb(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_combrgb_in, sh_node_combrgb_out); node_type_exec(&ntype, NULL, NULL, node_shader_exec_combrgb); node_type_gpu(&ntype, gpu_shader_combrgb); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c b/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c index de0f4d91385..4ef8974ae5a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_sepcombXYZ.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -27,18 +26,18 @@ /* **************** SEPARATE XYZ ******************** */ static bNodeSocketTemplate sh_node_sepxyz_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_sepxyz_out[] = { { SOCK_FLOAT, 0, N_("X")}, { SOCK_FLOAT, 0, N_("Y")}, { SOCK_FLOAT, 0, N_("Z")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int gpu_shader_sepxyz(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_sepxyz(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "separate_xyz", in, out); + return GPU_stack_link(mat, node, "separate_xyz", in, out); } void register_node_type_sh_sepxyz(void) @@ -46,7 +45,6 @@ void register_node_type_sh_sepxyz(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_sepxyz_in, sh_node_sepxyz_out); node_type_gpu(&ntype, gpu_shader_sepxyz); @@ -60,16 +58,16 @@ static bNodeSocketTemplate sh_node_combxyz_in[] = { { SOCK_FLOAT, 1, N_("X"), 0.0f, 0.0f, 0.0f, 1.0f, -10000.0f, 10000.0f}, { SOCK_FLOAT, 1, N_("Y"), 0.0f, 0.0f, 0.0f, 1.0f, -10000.0f, 10000.0f}, { SOCK_FLOAT, 1, N_("Z"), 0.0f, 0.0f, 0.0f, 1.0f, -10000.0f, 10000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_combxyz_out[] = { { SOCK_VECTOR, 0, N_("Vector")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int gpu_shader_combxyz(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_combxyz(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "combine_xyz", in, out); + return GPU_stack_link(mat, node, "combine_xyz", in, out); } void register_node_type_sh_combxyz(void) @@ -77,7 +75,6 @@ void register_node_type_sh_combxyz(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_combxyz_in, sh_node_combxyz_out); node_type_gpu(&ntype, gpu_shader_combxyz); diff --git a/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.c b/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.c new file mode 100644 index 00000000000..fbb1f97e121 --- /dev/null +++ b/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.c @@ -0,0 +1,52 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2005 Blender Foundation. + * All rights reserved. + */ + +#include "../node_shader_util.h" + +/* **************** OUTPUT ******************** */ + +static bNodeSocketTemplate sh_node_shadertorgb_in[] = { + { SOCK_SHADER, 1, N_("Shader")}, + { -1, 0, "" }, +}; + +static bNodeSocketTemplate sh_node_shadertorgb_out[] = { + { SOCK_RGBA, 0, N_("Color")}, + { SOCK_FLOAT, 0, N_("Alpha")}, + { -1, 0, "" }, +}; + +static int node_shader_gpu_shadertorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +{ + return GPU_stack_link(mat, node, "node_shader_to_rgba", in, out); +} + +/* node type definition */ +void register_node_type_sh_shadertorgb(void) +{ + static bNodeType ntype; + + sh_node_type_base(&ntype, SH_NODE_SHADERTORGB, "Shader to RGB", NODE_CLASS_CONVERTOR, 0); + node_type_socket_templates(&ntype, sh_node_shadertorgb_in, sh_node_shadertorgb_out); + node_type_init(&ntype, NULL); + node_type_storage(&ntype, "", NULL, NULL); + node_type_gpu(&ntype, node_shader_gpu_shadertorgb); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.c b/source/blender/nodes/shader/nodes/node_shader_squeeze.c index 38881ed5416..db49e1d98c4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.c +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_squeeze.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -48,9 +47,9 @@ static void node_shader_exec_squeeze(void *UNUSED(data), int UNUSED(thread), bNo out[0]->vec[0] = 1.0f / (1.0f + powf(M_E, -((vec[0] - vec[2]) * vec[1]))); } -static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_squeeze(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "squeeze", in, out); + return GPU_stack_link(mat, node, "squeeze", in, out); } void register_node_type_sh_squeeze(void) @@ -58,7 +57,6 @@ void register_node_type_sh_squeeze(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, sh_node_squeeze_in, sh_node_squeeze_out); node_type_storage(&ntype, "", NULL, NULL); node_type_exec(&ntype, NULL, NULL, node_shader_exec_squeeze); diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c index 0315f6c6648..b414dd85eea 100644 --- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c +++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c @@ -28,12 +28,12 @@ static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = { { SOCK_FLOAT, 1, N_("Sharpness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Texture Blur"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_subsurface_scattering_out[] = { { SOCK_SHADER, 0, N_("BSSRDF")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_subsurface_scattering(bNodeTree *UNUSED(ntree), bNode *node) @@ -41,14 +41,25 @@ static void node_shader_init_subsurface_scattering(bNodeTree *UNUSED(ntree), bNo node->custom1 = SHD_SUBSURFACE_BURLEY; } -static int node_shader_gpu_subsurface_scattering(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_subsurface_scattering(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { if (!in[5].link) - in[5].link = GPU_builtin(GPU_VIEW_NORMAL); - else - GPU_link(mat, "direction_transform_m4v3", in[5].link, GPU_builtin(GPU_VIEW_MATRIX), &in[5].link); + GPU_link(mat, "world_normals_get", &in[5].link); - return GPU_stack_link(mat, "node_subsurface_scattering", in, out); + GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_SSS); + + if (node->sss_id == 1) { + bNodeSocket *socket = BLI_findlink(&node->original->inputs, 2); + bNodeSocketValueRGBA *socket_data = socket->default_value; + bNodeSocket *socket_sharp = BLI_findlink(&node->original->inputs, 3); + bNodeSocketValueFloat *socket_data_sharp = socket_sharp->default_value; + /* For some reason it seems that the socket value is in ARGB format. */ + GPU_material_sss_profile_create(mat, &socket_data->value[1], + &node->original->custom1, + &socket_data_sharp->value); + } + + return GPU_stack_link(mat, node, "node_subsurface_scattering", in, out, GPU_constant(&node->sss_id)); } static void node_shader_update_subsurface_scattering(bNodeTree *UNUSED(ntree), bNode *node) @@ -73,7 +84,6 @@ void register_node_type_sh_subsurface_scattering(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_subsurface_scattering_in, sh_node_subsurface_scattering_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_subsurface_scattering); diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.c b/source/blender/nodes/shader/nodes/node_shader_tangent.c index 199c3ff7e44..673cb9d4936 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tangent.c +++ b/source/blender/nodes/shader/nodes/node_shader_tangent.c @@ -23,7 +23,7 @@ static bNodeSocketTemplate sh_node_tangent_out[] = { { SOCK_VECTOR, 0, N_("Tangent"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node) @@ -33,16 +33,38 @@ static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node) node->storage = attr; } +static int node_shader_gpu_tangent(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +{ + NodeShaderTangent *attr = node->storage; + + if (attr->direction_type == SHD_TANGENT_UVMAP) { + return GPU_stack_link(mat, node, "node_tangentmap", in, out, GPU_attribute(CD_TANGENT, ""), GPU_builtin(GPU_INVERSE_VIEW_MATRIX)); + } + else { + GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); + + if (attr->axis == SHD_TANGENT_AXIS_X) + GPU_link(mat, "tangent_orco_x", orco, &orco); + else if (attr->axis == SHD_TANGENT_AXIS_Y) + GPU_link(mat, "tangent_orco_y", orco, &orco); + else + GPU_link(mat, "tangent_orco_z", orco, &orco); + + return GPU_stack_link(mat, node, "node_tangent", in, out, GPU_builtin(GPU_VIEW_NORMAL), orco, + GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX)); + } +} + /* node type definition */ void register_node_type_sh_tangent(void) { static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_tangent_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_tangent); + node_type_gpu(&ntype, node_shader_gpu_tangent); node_type_storage(&ntype, "NodeShaderTangent", node_free_standard_storage, node_copy_standard_storage); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c index c603ce9afb8..ffd81631a11 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c @@ -32,13 +32,13 @@ static bNodeSocketTemplate sh_node_tex_brick_in[] = { { SOCK_FLOAT, 1, N_("Bias"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 1, N_("Brick Width"), 0.5f, 0.0f, 0.0f, 0.0f, 0.01f, 100.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 1, N_("Row Height"), 0.25f, 0.0f, 0.0f, 0.0f, 0.01f, 100.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_brick_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node) @@ -65,17 +65,17 @@ static int node_shader_gpu_tex_brick(GPUMaterial *mat, bNode *node, bNodeExecDat { if (!in[0].link) { in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_from_orco", in[0].link, &in[0].link); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexBrick *tex = (NodeTexBrick *)node->storage; float offset_freq = tex->offset_freq; float squash_freq = tex->squash_freq; - return GPU_stack_link(mat, "node_tex_brick", + return GPU_stack_link(mat, node, "node_tex_brick", in, out, - GPU_uniform(&tex->offset), GPU_uniform(&offset_freq), - GPU_uniform(&tex->squash), GPU_uniform(&squash_freq)); + GPU_constant(&tex->offset), GPU_constant(&offset_freq), + GPU_constant(&tex->squash), GPU_constant(&squash_freq)); } /* node type definition */ @@ -84,7 +84,6 @@ void register_node_type_sh_tex_brick(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_brick_in, sh_node_tex_brick_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_tex_brick); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c index 14bbe90db54..80cf1cecae3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c @@ -26,13 +26,13 @@ static bNodeSocketTemplate sh_node_tex_checker_in[] = { { SOCK_RGBA, 1, N_("Color1"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Color2"), 0.2f, 0.2f, 0.2f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Scale"), 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_checker_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode *node) @@ -48,12 +48,12 @@ static int node_shader_gpu_tex_checker(GPUMaterial *mat, bNode *node, bNodeExecD { if (!in[0].link) { in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_from_orco", in[0].link, &in[0].link); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); - return GPU_stack_link(mat, "node_tex_checker", in, out); + return GPU_stack_link(mat, node, "node_tex_checker", in, out); } /* node type definition */ @@ -62,7 +62,6 @@ void register_node_type_sh_tex_checker(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_CHECKER, "Checker Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_checker_in, sh_node_tex_checker_out); node_type_init(&ntype, node_shader_init_tex_checker); node_type_storage(&ntype, "NodeTexChecker", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c index 6098b0bb598..fb901ea0774 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c @@ -31,27 +31,20 @@ static bNodeSocketTemplate sh_node_tex_coord_out[] = { { SOCK_VECTOR, 0, N_("Camera"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 0, N_("Window"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 0, N_("Reflection"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, ""); - GPUMatType type = GPU_Material_get_type(mat); - if (type == GPU_MATERIAL_TYPE_MESH) { - return GPU_stack_link(mat, "node_tex_coord", in, out, - GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), - GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), - GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), orco, mtface); - } - else { - return GPU_stack_link(mat, "node_tex_coord_background", in, out, - GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), - GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), - GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), orco, mtface); - } + GPU_link(mat, "generated_from_orco", orco, &orco); + + return GPU_stack_link(mat, node, "node_tex_coord", in, out, + GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL), + GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), + GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), orco, mtface); } /* node type definition */ @@ -60,7 +53,6 @@ void register_node_type_sh_tex_coord(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_tex_coord_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c index 761a153c3a7..5b5f6d0d7db 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -23,12 +23,12 @@ static bNodeSocketTemplate sh_node_tex_environment_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_environment_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *node) @@ -40,7 +40,6 @@ static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *no tex->projection = SHD_PROJ_EQUIRECTANGULAR; tex->iuser.frames = 1; tex->iuser.sfra = 1; - tex->iuser.fie_ima = 2; tex->iuser.ok = 1; node->storage = tex; @@ -50,27 +49,44 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, bNodeE { Image *ima = (Image *)node->id; ImageUser *iuser = NULL; - NodeTexImage *tex = node->storage; + NodeTexEnvironment *tex = node->storage; int isdata = tex->color_space == SHD_COLORSPACE_NONE; + GPUNodeLink *outalpha; if (!ima) - return GPU_stack_link(mat, "node_tex_environment_empty", in, out); + return GPU_stack_link(mat, node, "node_tex_environment_empty", in, out); if (!in[0].link) { - GPUMatType type = GPU_Material_get_type(mat); - - if (type == GPU_MATERIAL_TYPE_MESH) - in[0].link = GPU_builtin(GPU_VIEW_POSITION); - else - GPU_link(mat, "background_transform_to_world", GPU_builtin(GPU_VIEW_POSITION), &in[0].link); + GPU_link(mat, "node_tex_environment_texco", GPU_builtin(GPU_VIEW_POSITION), &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); - if (tex->projection == SHD_PROJ_EQUIRECTANGULAR) - GPU_stack_link(mat, "node_tex_environment_equirectangular", in, out, GPU_image(ima, iuser, isdata)); - else - GPU_stack_link(mat, "node_tex_environment_mirror_ball", in, out, GPU_image(ima, iuser, isdata)); + /* Compute texture coordinate. */ + if (tex->projection == SHD_PROJ_EQUIRECTANGULAR) { + /* To fix pole issue we clamp the v coordinate. The clamp value depends on the filter size. */ + float clamp_size = (ELEM(tex->interpolation, SHD_INTERP_CUBIC, SHD_INTERP_SMART)) ? 1.5 : 0.5; + GPU_link(mat, "node_tex_environment_equirectangular", in[0].link, GPU_constant(&clamp_size), + GPU_image(ima, iuser, isdata), &in[0].link); + } + else { + GPU_link(mat, "node_tex_environment_mirror_ball", in[0].link, &in[0].link); + } + + /* Sample texture with correct interpolation. */ + switch (tex->interpolation) { + case SHD_INTERP_LINEAR: + /* Force the highest mipmap and don't do anisotropic filtering. + * This is to fix the artifact caused by derivatives discontinuity. */ + GPU_link(mat, "node_tex_image_linear_no_mip", in[0].link, GPU_image(ima, iuser, isdata), &out[0].link, &outalpha); + break; + case SHD_INTERP_CLOSEST: + GPU_link(mat, "node_tex_image_nearest", in[0].link, GPU_image(ima, iuser, isdata), &out[0].link, &outalpha); + break; + default: + GPU_link(mat, "node_tex_image_cubic", in[0].link, GPU_image(ima, iuser, isdata), &out[0].link, &outalpha); + break; + } ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL); if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 && @@ -89,12 +105,12 @@ void register_node_type_sh_tex_environment(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_environment_in, sh_node_tex_environment_out); node_type_init(&ntype, node_shader_init_tex_environment); node_type_storage(&ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage); node_type_gpu(&ntype, node_shader_gpu_tex_environment); node_type_label(&ntype, node_image_label); + node_type_size_preset(&ntype, NODE_SIZE_LARGE); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c index 478189cb2cf..5dd0b5bf37c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c @@ -23,13 +23,13 @@ static bNodeSocketTemplate sh_node_tex_gradient_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_gradient_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node) @@ -46,14 +46,14 @@ static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, bNodeExec { if (!in[0].link) { in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_from_orco", in[0].link, &in[0].link); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexGradient *tex = (NodeTexGradient *)node->storage; float gradient_type = tex->gradient_type; - return GPU_stack_link(mat, "node_tex_gradient", in, out, GPU_uniform(&gradient_type)); + return GPU_stack_link(mat, node, "node_tex_gradient", in, out, GPU_constant(&gradient_type)); } /* node type definition */ @@ -62,7 +62,6 @@ void register_node_type_sh_tex_gradient(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_gradient_in, sh_node_tex_gradient_out); node_type_init(&ntype, node_shader_init_tex_gradient); node_type_storage(&ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c index bb0ccec29a8..7b15555630e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -23,13 +23,13 @@ static bNodeSocketTemplate sh_node_tex_image_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_image_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 0, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node) @@ -40,7 +40,6 @@ static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node) tex->color_space = SHD_COLORSPACE_COLOR; tex->iuser.frames = 1; tex->iuser.sfra = 1; - tex->iuser.fie_ima = 2; tex->iuser.ok = 1; node->storage = tex; @@ -48,17 +47,59 @@ static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node) static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { + static const char *names[] = { + "node_tex_image_linear", + "node_tex_image_nearest", + "node_tex_image_cubic", + "node_tex_image_smart", + }; + static const char *names_box[] = { + "tex_box_sample_linear", + "tex_box_sample_nearest", + "tex_box_sample_cubic", + "tex_box_sample_smart", + }; + static const char *names_clip[] = { + "tex_clip_linear", + "tex_clip_nearest", + "tex_clip_cubic", + "tex_clip_smart", + }; + Image *ima = (Image *)node->id; ImageUser *iuser = NULL; NodeTexImage *tex = node->storage; + const char *gpu_node_name = (tex->projection == SHD_PROJ_BOX) + ? names_box[tex->interpolation] + : names[tex->interpolation]; + bool do_color_correction = false; + bool do_texco_extend = (tex->extension != SHD_IMAGE_EXTENSION_REPEAT); + const bool do_texco_clip = (tex->extension == SHD_IMAGE_EXTENSION_CLIP); + + if (do_texco_extend && (tex->projection != SHD_PROJ_BOX) && + ELEM(tex->interpolation, SHD_INTERP_CUBIC, SHD_INTERP_SMART)) + { + gpu_node_name = "node_tex_image_cubic_extend"; + /* We do it inside the sampling function */ + do_texco_extend = false; + } - GPUNodeLink *norm; + GPUNodeLink *norm, *col1, *col2, *col3, *input_coords; int isdata = tex->color_space == SHD_COLORSPACE_NONE; float blend = tex->projection_blend; if (!ima) - return GPU_stack_link(mat, "node_tex_image_empty", in, out); + return GPU_stack_link(mat, node, "node_tex_image_empty", in, out); + + ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL); + if ((tex->color_space == SHD_COLORSPACE_COLOR) && + ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 && + GPU_material_do_color_management(mat)) + { + do_color_correction = true; + } + BKE_image_release_ibuf(ima, ibuf, NULL); if (!in[0].link) in[0].link = GPU_attribute(CD_MTFACE, ""); @@ -67,7 +108,13 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, bNodeExecDat switch (tex->projection) { case SHD_PROJ_FLAT: - GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser, isdata)); + if (do_texco_clip) { + GPU_link(mat, "set_rgb", in[0].link, &input_coords); + } + if (do_texco_extend) { + GPU_link(mat, "point_texco_clamp", in[0].link, GPU_image(ima, iuser, isdata), &in[0].link); + } + GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(ima, iuser, isdata)); break; case SHD_PROJ_BOX: GPU_link(mat, "direction_transform_m4v3", GPU_builtin(GPU_VIEW_NORMAL), @@ -76,8 +123,20 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, bNodeExecDat GPU_link(mat, "direction_transform_m4v3", norm, GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), &norm); + GPU_link(mat, gpu_node_name, in[0].link, + norm, + GPU_image(ima, iuser, isdata), + &col1, + &col2, + &col3); + if (do_color_correction) { + GPU_link(mat, "srgb_to_linearrgb", col1, &col1); + GPU_link(mat, "srgb_to_linearrgb", col2, &col2); + GPU_link(mat, "srgb_to_linearrgb", col3, &col3); + } GPU_link(mat, "node_tex_image_box", in[0].link, norm, + col1, col2, col3, GPU_image(ima, iuser, isdata), GPU_uniform(&blend), &out[0].link, @@ -86,23 +145,36 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, bNodeExecDat case SHD_PROJ_SPHERE: GPU_link(mat, "point_texco_remap_square", in[0].link, &in[0].link); GPU_link(mat, "point_map_to_sphere", in[0].link, &in[0].link); - GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser, isdata)); + if (do_texco_clip) { + GPU_link(mat, "set_rgb", in[0].link, &input_coords); + } + if (do_texco_extend) { + GPU_link(mat, "point_texco_clamp", in[0].link, GPU_image(ima, iuser, isdata), &in[0].link); + } + GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(ima, iuser, isdata)); break; case SHD_PROJ_TUBE: GPU_link(mat, "point_texco_remap_square", in[0].link, &in[0].link); GPU_link(mat, "point_map_to_tube", in[0].link, &in[0].link); - GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser, isdata)); + if (do_texco_clip) { + GPU_link(mat, "set_rgb", in[0].link, &input_coords); + } + if (do_texco_extend) { + GPU_link(mat, "point_texco_clamp", in[0].link, GPU_image(ima, iuser, isdata), &in[0].link); + } + GPU_stack_link(mat, node, gpu_node_name, in, out, GPU_image(ima, iuser, isdata)); break; } - ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL); - if ((tex->color_space == SHD_COLORSPACE_COLOR) && - ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 && - GPU_material_do_color_management(mat)) - { + if (do_texco_clip && (tex->projection != SHD_PROJ_BOX)) { + GPU_link(mat, names_clip[tex->interpolation], + input_coords, GPU_image(ima, iuser, isdata), out[0].link, + &out[0].link, &out[1].link); + } + + if (do_color_correction && (tex->projection != SHD_PROJ_BOX)) { GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link); } - BKE_image_release_ibuf(ima, ibuf, NULL); return true; } @@ -113,12 +185,12 @@ void register_node_type_sh_tex_image(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_image_in, sh_node_tex_image_out); node_type_init(&ntype, node_shader_init_tex_image); node_type_storage(&ntype, "NodeTexImage", node_free_standard_storage, node_copy_standard_storage); node_type_gpu(&ntype, node_shader_gpu_tex_image); node_type_label(&ntype, node_image_label); + node_type_size_preset(&ntype, NODE_SIZE_LARGE); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c index 8adf749488f..ba99e53735b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c @@ -25,13 +25,13 @@ static bNodeSocketTemplate sh_node_tex_magic_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, { SOCK_FLOAT, 1, N_("Scale"), 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, { SOCK_FLOAT, 1, N_("Distortion"), 1.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_magic_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node) @@ -51,12 +51,12 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, bNodeExecDat if (!in[0].link) { in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_from_orco", in[0].link, &in[0].link); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); - return GPU_stack_link(mat, "node_tex_magic", in, out, GPU_uniform(&depth)); + return GPU_stack_link(mat, node, "node_tex_magic", in, out, GPU_constant(&depth)); } /* node type definition */ @@ -65,7 +65,6 @@ void register_node_type_sh_tex_magic(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_magic_in, sh_node_tex_magic_out); node_type_init(&ntype, node_shader_init_tex_magic); node_type_storage(&ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c index 72437067d7b..0cfbd225a61 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c @@ -29,13 +29,13 @@ static bNodeSocketTemplate sh_node_tex_musgrave_in[] = { { SOCK_FLOAT, 1, N_("Lacunarity"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_FLOAT, 1, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, { SOCK_FLOAT, 1, N_("Gain"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_musgrave_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node) @@ -52,7 +52,7 @@ static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, bNodeExec { if (!in[0].link) { in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_from_orco", in[0].link, &in[0].link); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); @@ -60,7 +60,7 @@ static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, bNodeExec NodeTexMusgrave *tex = (NodeTexMusgrave *)node->storage; float type = tex->musgrave_type; - return GPU_stack_link(mat, "node_tex_musgrave", in, out, GPU_uniform(&type)); + return GPU_stack_link(mat, node, "node_tex_musgrave", in, out, GPU_constant(&type)); } /* node type definition */ @@ -69,7 +69,6 @@ void register_node_type_sh_tex_musgrave(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_musgrave_in, sh_node_tex_musgrave_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_tex_musgrave); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c index 5b44a7f1097..65ab7e459c6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c @@ -26,13 +26,13 @@ static bNodeSocketTemplate sh_node_tex_noise_in[] = { { SOCK_FLOAT, 1, N_("Scale"), 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, { SOCK_FLOAT, 1, N_("Detail"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f}, { SOCK_FLOAT, 1, N_("Distortion"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_noise_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node) @@ -48,12 +48,12 @@ static int node_shader_gpu_tex_noise(GPUMaterial *mat, bNode *node, bNodeExecDat { if (!in[0].link) { in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_from_orco", in[0].link, &in[0].link); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); - return GPU_stack_link(mat, "node_tex_noise", in, out); + return GPU_stack_link(mat, node, "node_tex_noise", in, out); } /* node type definition */ @@ -62,7 +62,6 @@ void register_node_type_sh_tex_noise(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_noise_in, sh_node_tex_noise_out); node_type_init(&ntype, node_shader_init_tex_noise); node_type_storage(&ntype, "NodeTexNoise", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c index 2ab18c8f8b4..56e98520e8b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c @@ -26,13 +26,13 @@ static bNodeSocketTemplate sh_node_tex_pointdensity_in[] = { {SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, 0, ""} + {-1, 0, ""}, }; static bNodeSocketTemplate sh_node_tex_pointdensity_out[] = { {SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, 0, N_("Density"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {-1, 0, ""} + {-1, 0, ""}, }; static void node_shader_init_tex_pointdensity(bNodeTree *UNUSED(ntree), @@ -77,7 +77,6 @@ void register_node_type_sh_tex_pointdensity(void) "Point Density", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_pointdensity_in, sh_node_tex_pointdensity_out); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index edf11cc10e4..1fa58396733 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -23,12 +23,12 @@ static bNodeSocketTemplate sh_node_tex_sky_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_sky_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node) @@ -53,7 +53,7 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat, bNode *node, bNodeExecData node_shader_gpu_tex_mapping(mat, node, in, out); - return GPU_stack_link(mat, "node_tex_sky", in, out); + return GPU_stack_link(mat, node, "node_tex_sky", in, out); } /* node type definition */ @@ -62,7 +62,6 @@ void register_node_type_sh_tex_sky(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_sky_in, sh_node_tex_sky_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_tex_sky); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c index 430f098f56f..bd3dc0d2c79 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c @@ -25,13 +25,13 @@ static bNodeSocketTemplate sh_node_tex_voronoi_in[] = { { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, { SOCK_FLOAT, 1, N_("Scale"), 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, { SOCK_FLOAT, 1, N_("Exponent"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 32.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_voronoi_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node) @@ -50,15 +50,17 @@ static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, bNode *node, bNodeExecD { if (!in[0].link) { in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_from_orco", in[0].link, &in[0].link); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage; float coloring = tex->coloring; + float metric = tex->distance; + float feature = tex->feature; - return GPU_stack_link(mat, "node_tex_voronoi", in, out, GPU_uniform(&coloring)); + return GPU_stack_link(mat, node, "node_tex_voronoi", in, out, GPU_constant(&coloring), GPU_constant(&metric), GPU_constant(&feature)); } static void node_shader_update_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node) @@ -84,7 +86,6 @@ void register_node_type_sh_tex_voronoi(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_voronoi_in, sh_node_tex_voronoi_out); node_type_init(&ntype, node_shader_init_tex_voronoi); node_type_storage(&ntype, "NodeTexVoronoi", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c index 6d293376086..660fc0fdcae 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c @@ -27,13 +27,13 @@ static bNodeSocketTemplate sh_node_tex_wave_in[] = { { SOCK_FLOAT, 1, N_("Distortion"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, { SOCK_FLOAT, 1, N_("Detail"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f}, { SOCK_FLOAT, 1, N_("Detail Scale"), 1.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_tex_wave_out[] = { { SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node) @@ -50,7 +50,7 @@ static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, bNodeExecData { if (!in[0].link) { in[0].link = GPU_attribute(CD_ORCO, ""); - GPU_link(mat, "generated_from_orco", in[0].link, &in[0].link); + GPU_link(mat, "generated_texco", GPU_builtin(GPU_VIEW_POSITION), in[0].link, &in[0].link); } node_shader_gpu_tex_mapping(mat, node, in, out); @@ -59,7 +59,7 @@ static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, bNodeExecData float wave_type = tex->wave_type; float wave_profile = tex->wave_profile; - return GPU_stack_link(mat, "node_tex_wave", in, out, GPU_uniform(&wave_type), GPU_uniform(&wave_profile)); + return GPU_stack_link(mat, node, "node_tex_wave", in, out, GPU_constant(&wave_type), GPU_constant(&wave_profile)); } /* node type definition */ @@ -68,7 +68,6 @@ void register_node_type_sh_tex_wave(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_wave_in, sh_node_tex_wave_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_tex_wave); diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c deleted file mode 100644 index b9fc89c5d1d..00000000000 --- a/source/blender/nodes/shader/nodes/node_shader_texture.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2005 Blender Foundation. - * All rights reserved. - */ - -/** \file blender/nodes/shader/nodes/node_shader_texture.c - * \ingroup shdnodes - */ - -#include "DNA_texture_types.h" - -#include "node_shader_util.h" - -#include "GPU_material.h" - -/* **************** TEXTURE ******************** */ -static bNodeSocketTemplate sh_node_texture_in[] = { - { SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, /* no limit */ - { -1, 0, "" } -}; -static bNodeSocketTemplate sh_node_texture_out[] = { - { SOCK_FLOAT, 0, N_("Value"), 0, 0, 0, 0, 0, 0, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - { SOCK_RGBA, 0, N_("Color"), 0, 0, 0, 0, 0, 0, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - { SOCK_VECTOR, 0, N_("Normal"), 0, 0, 0, 0, 0, 0, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - { -1, 0, "" } -}; - -static void node_shader_exec_texture(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) -{ - if (data && node->id) { - ShadeInput *shi = ((ShaderCallData *)data)->shi; - TexResult texres; - bNodeSocket *sock_vector = node->inputs.first; - float vec[3], nor[3] = {0.0f, 0.0f, 0.0f}; - int retval; - short which_output = node->custom1; - - short thread = shi->thread; - - /* out: value, color, normal */ - - /* we should find out if a normal as output is needed, for now we do all */ - texres.nor = nor; - texres.tr = texres.tg = texres.tb = 0.0f; - - /* don't use in[0]->hasinput, see material node for explanation */ - if (sock_vector->link) { - nodestack_get_vec(vec, SOCK_VECTOR, in[0]); - - if (in[0]->datatype == NS_OSA_VECTORS) { - float *fp = in[0]->data; - retval = multitex_nodes((Tex *)node->id, vec, fp, fp + 3, shi->osatex, &texres, thread, which_output, NULL, NULL, NULL); - } - else if (in[0]->datatype == NS_OSA_VALUES) { - const float *fp = in[0]->data; - float dxt[3], dyt[3]; - - dxt[0] = fp[0]; dxt[1] = dxt[2] = 0.0f; - dyt[0] = fp[1]; dyt[1] = dyt[2] = 0.0f; - retval = multitex_nodes((Tex *)node->id, vec, dxt, dyt, shi->osatex, &texres, thread, which_output, NULL, NULL, NULL); - } - else - retval = multitex_nodes((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output, NULL, NULL, NULL); - } - else { - copy_v3_v3(vec, shi->lo); - retval = multitex_nodes((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output, NULL, NULL, NULL); - } - - /* stupid exception */ - if ( ((Tex *)node->id)->type == TEX_STUCCI) { - texres.tin = 0.5f + 0.7f * texres.nor[0]; - CLAMP(texres.tin, 0.0f, 1.0f); - } - - /* intensity and color need some handling */ - if (texres.talpha) - out[0]->vec[0] = texres.ta; - else - out[0]->vec[0] = texres.tin; - - if ((retval & TEX_RGB) == 0) { - copy_v3_fl(out[1]->vec, out[0]->vec[0]); - out[1]->vec[3] = 1.0f; - } - else { - copy_v3_v3(out[1]->vec, &texres.tr); - out[1]->vec[3] = 1.0f; - } - - copy_v3_v3(out[2]->vec, nor); - - if (shi->do_preview) { - BKE_node_preview_set_pixel(execdata->preview, out[1]->vec, shi->xs, shi->ys, shi->do_manage); - } - - } -} - -static int gpu_shader_texture(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) -{ - Tex *tex = (Tex *)node->id; - - if (tex && tex->ima && (tex->type == TEX_IMAGE || tex->type == TEX_ENVMAP)) { - if (tex->type == TEX_IMAGE) { - GPUNodeLink *texlink = GPU_image(tex->ima, &tex->iuser, false); - GPU_stack_link(mat, "texture_image", in, out, texlink); - } - else { /* TEX_ENVMAP */ - if (!in[0].link) - in[0].link = GPU_uniform(in[0].vec); - if (!GPU_material_use_world_space_shading(mat)) - GPU_link(mat, "direction_transform_m4v3", in[0].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &in[0].link); - GPU_link(mat, "mtex_cube_map_refl_from_refldir", - GPU_cube_map(tex->ima, &tex->iuser, false), in[0].link, &out[0].link, &out[1].link); - GPU_link(mat, "color_to_normal", out[1].link, &out[2].link); - } - - ImBuf *ibuf = BKE_image_acquire_ibuf(tex->ima, &tex->iuser, NULL); - if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 && - GPU_material_do_color_management(mat)) - { - GPU_link(mat, "srgb_to_linearrgb", out[1].link, &out[1].link); - } - BKE_image_release_ibuf(tex->ima, ibuf, NULL); - - return true; - } - - return false; -} - -void register_node_type_sh_texture(void) -{ - static bNodeType ntype; - - sh_node_type_base(&ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW); - node_type_compatibility(&ntype, NODE_OLD_SHADING); - node_type_socket_templates(&ntype, sh_node_texture_in, sh_node_texture_out); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_texture); - node_type_gpu(&ntype, gpu_shader_texture); - - nodeRegisterType(&ntype); -} diff --git a/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c b/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c index 394e78b2209..1f70b845fed 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c +++ b/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c @@ -23,7 +23,7 @@ static bNodeSocketTemplate sh_node_uvalongstroke_out[] = { { SOCK_VECTOR, 0, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; /* node type definition */ @@ -32,7 +32,6 @@ void register_node_type_sh_uvalongstroke(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_uvalongstroke_out); node_type_init(&ntype, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.c b/source/blender/nodes/shader/nodes/node_shader_uvmap.c index e6e515290a1..d2c2341414c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uvmap.c +++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.c @@ -25,7 +25,7 @@ static bNodeSocketTemplate sh_node_uvmap_out[] = { { SOCK_VECTOR, 0, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node) @@ -39,7 +39,7 @@ static int node_shader_gpu_uvmap(GPUMaterial *mat, bNode *node, bNodeExecData *U NodeShaderUVMap *attr = node->storage; GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, attr->uv_map); - return GPU_stack_link(mat, "node_uvmap", in, out, mtface); + return GPU_stack_link(mat, node, "node_uvmap", in, out, mtface); } /* node type definition */ @@ -48,7 +48,6 @@ void register_node_type_sh_uvmap(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_uvmap_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, node_shader_init_uvmap); diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index 4d26427486f..23b01618c45 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_valToRgb.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -28,12 +27,12 @@ /* **************** VALTORGB ******************** */ static bNodeSocketTemplate sh_node_valtorgb_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_valtorgb_out[] = { { SOCK_RGBA, 0, N_("Color")}, { SOCK_FLOAT, 0, N_("Alpha")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_valtorgb(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) @@ -57,11 +56,39 @@ static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node) static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - float *array; + struct ColorBand *coba = node->storage; + float *array, layer; int size; - BKE_colorband_evaluate_table_rgba(node->storage, &array, &size); - return GPU_stack_link(mat, "valtorgb", in, out, GPU_texture(size, array)); + /* Common / easy case optimisation. */ + if ((coba->tot <= 2) && (coba->color_mode == COLBAND_BLEND_RGB)) { + float mul_bias[2]; + switch (coba->ipotype) { + case COLBAND_INTERP_LINEAR: + mul_bias[0] = 1.0f / (coba->data[1].pos - coba->data[0].pos); + mul_bias[1] = -mul_bias[0] * coba->data[0].pos; + return GPU_stack_link(mat, node, "valtorgb_opti_linear", in, out, GPU_uniform(mul_bias), + GPU_uniform(&coba->data[0].r), + GPU_uniform(&coba->data[1].r)); + case COLBAND_INTERP_CONSTANT: + mul_bias[1] = max_ff(coba->data[0].pos, coba->data[1].pos); + return GPU_stack_link(mat, node, "valtorgb_opti_constant", in, out, GPU_uniform(&mul_bias[1]), + GPU_uniform(&coba->data[0].r), + GPU_uniform(&coba->data[1].r)); + default: + break; + } + } + + BKE_colorband_evaluate_table_rgba(coba, &array, &size); + GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer); + + if (coba->ipotype == COLBAND_INTERP_CONSTANT) { + return GPU_stack_link(mat, node, "valtorgb_nearest", in, out, tex, GPU_constant(&layer)); + } + else { + return GPU_stack_link(mat, node, "valtorgb", in, out, tex, GPU_constant(&layer)); + } } void register_node_type_sh_valtorgb(void) @@ -69,7 +96,6 @@ void register_node_type_sh_valtorgb(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_valtorgb_in, sh_node_valtorgb_out); node_type_init(&ntype, node_shader_init_valtorgb); node_type_size_preset(&ntype, NODE_SIZE_LARGE); @@ -102,9 +128,9 @@ static void node_shader_exec_rgbtobw(void *UNUSED(data), int UNUSED(thread), bNo out[0]->vec[0] = IMB_colormanagement_get_luminance(col); } -static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return GPU_stack_link(mat, "rgbtobw", in, out); + return GPU_stack_link(mat, node, "rgbtobw", in, out); } void register_node_type_sh_rgbtobw(void) @@ -112,7 +138,6 @@ void register_node_type_sh_rgbtobw(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out); node_type_exec(&ntype, NULL, NULL, node_shader_exec_rgbtobw); node_type_gpu(&ntype, gpu_shader_rgbtobw); diff --git a/source/blender/nodes/shader/nodes/node_shader_value.c b/source/blender/nodes/shader/nodes/node_shader_value.c index bd3f79daf78..8601021528e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.c +++ b/source/blender/nodes/shader/nodes/node_shader_value.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_value.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ @@ -27,13 +26,13 @@ /* **************** VALUE ******************** */ static bNodeSocketTemplate sh_node_value_out[] = { { SOCK_FLOAT, 0, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int gpu_shader_value(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_value(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - GPUNodeLink *vec = GPU_uniform(out[0].vec); - return GPU_stack_link(mat, "set_value", in, out, vec); + GPUNodeLink *link = GPU_uniformbuffer_link_out(mat, node, out, 0); + return GPU_stack_link(mat, node, "set_value", in, out, link); } void register_node_type_sh_value(void) @@ -41,7 +40,6 @@ void register_node_type_sh_value(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_value_out); node_type_gpu(&ntype, gpu_shader_value); diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c index 41eee6ed9d5..b051735d9f0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c +++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_vectMath.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ #include "node_shader_util.h" @@ -103,7 +102,7 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, bNodeExecData *UN case 2: case 3: case 4: - GPU_stack_link(mat, names[node->custom1], in, out); + GPU_stack_link(mat, node, names[node->custom1], in, out); break; case 5: if (in[0].hasinput || !in[1].hasinput) { @@ -111,14 +110,14 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, bNodeExecData *UN GPUNodeStack tmp_in[2]; memcpy(&tmp_in[0], &in[0], sizeof(GPUNodeStack)); memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack)); - GPU_stack_link(mat, names[node->custom1], tmp_in, out); + GPU_stack_link(mat, node, names[node->custom1], tmp_in, out); } else { /* use only second item and terminator */ GPUNodeStack tmp_in[2]; memcpy(&tmp_in[0], &in[1], sizeof(GPUNodeStack)); memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack)); - GPU_stack_link(mat, names[node->custom1], tmp_in, out); + GPU_stack_link(mat, node, names[node->custom1], tmp_in, out); } break; default: @@ -133,7 +132,6 @@ void register_node_type_sh_vect_math(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_vect_math_in, sh_node_vect_math_out); node_type_label(&ntype, node_vect_math_label); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_vectTransform.c b/source/blender/nodes/shader/nodes/node_shader_vectTransform.c index 46b6f011408..d2e14af8e5b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectTransform.c +++ b/source/blender/nodes/shader/nodes/node_shader_vectTransform.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/shader/nodes/node_shader_vectTransform.c - * \ingroup shdnodes +/** \file \ingroup shdnodes */ #include "../node_shader_util.h" @@ -44,68 +43,8 @@ static void node_shader_init_vect_transform(bNodeTree *UNUSED(ntree), bNode *nod node->storage = vect; } -static const float (* get_matrix_from_to(ShaderCallData *scd, short from, short to))[4] +static void node_shader_exec_vect_transform(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out)) { - switch (from) { - case SHD_VECT_TRANSFORM_SPACE_OBJECT: - switch (to) { - case SHD_VECT_TRANSFORM_SPACE_OBJECT: - return NULL; - case SHD_VECT_TRANSFORM_SPACE_WORLD: - return RE_object_instance_get_matrix(scd->shi->obi, RE_OBJECT_INSTANCE_MATRIX_OB); - case SHD_VECT_TRANSFORM_SPACE_CAMERA: - return RE_object_instance_get_matrix(scd->shi->obi, RE_OBJECT_INSTANCE_MATRIX_LOCALTOVIEW); - } - break; - case SHD_VECT_TRANSFORM_SPACE_WORLD: - switch (to) { - case SHD_VECT_TRANSFORM_SPACE_WORLD: - return NULL; - case SHD_VECT_TRANSFORM_SPACE_CAMERA: - return RE_render_current_get_matrix(RE_VIEW_MATRIX); - case SHD_VECT_TRANSFORM_SPACE_OBJECT: - return RE_object_instance_get_matrix(scd->shi->obi, RE_OBJECT_INSTANCE_MATRIX_OBINV); - } - break; - case SHD_VECT_TRANSFORM_SPACE_CAMERA: - switch (to) { - case SHD_VECT_TRANSFORM_SPACE_CAMERA: - return NULL; - case SHD_VECT_TRANSFORM_SPACE_WORLD: - return RE_render_current_get_matrix(RE_VIEWINV_MATRIX); - case SHD_VECT_TRANSFORM_SPACE_OBJECT: - return RE_object_instance_get_matrix(scd->shi->obi, RE_OBJECT_INSTANCE_MATRIX_LOCALTOVIEWINV); - } - break; - } - return NULL; -} - -static void node_shader_exec_vect_transform(void *data, int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) -{ - float vec[4]; - const float (*mat)[4]; - - if (data) { - NodeShaderVectTransform *nodeprop = (NodeShaderVectTransform *)node->storage; - - nodestack_get_vec(vec, SOCK_VECTOR, in[0]); - - if (nodeprop->type == SHD_VECT_TRANSFORM_TYPE_POINT) - vec[3] = 1.0f; - else - vec[3] = 0.0f; - - mat = get_matrix_from_to((ShaderCallData *)data, nodeprop->convert_from, nodeprop->convert_to); - if (mat) { - mul_m4_v4((float(*)[4])mat, vec); - } - - if (nodeprop->type == SHD_VECT_TRANSFORM_TYPE_NORMAL) - normalize_v3(vec); - - copy_v4_v4(out[0]->vec, vec); - } } static GPUNodeLink *get_gpulink_matrix_from_to(short from, short to) @@ -153,32 +92,25 @@ static int gpu_shader_vect_transform(GPUMaterial *mat, bNode *node, bNodeExecDat const char *ptransform = "point_transform_m4v3"; const char *func_name = 0; - bool new_shading = GPU_material_use_new_shading_nodes(mat); - NodeShaderVectTransform *nodeprop = (NodeShaderVectTransform *)node->storage; if (in[0].hasinput) inputlink = in[0].link; else - inputlink = GPU_uniform(in[0].vec); + inputlink = GPU_constant(in[0].vec); fromto = get_gpulink_matrix_from_to(nodeprop->convert_from, nodeprop->convert_to); func_name = (nodeprop->type == SHD_VECT_TRANSFORM_TYPE_POINT) ? ptransform : vtransform; if (fromto) { - if (new_shading) { - /* For cycles we have inverted Z */ - /* TODO: pass here the correct matrices */ - if (nodeprop->convert_from == SHD_VECT_TRANSFORM_SPACE_CAMERA && nodeprop->convert_to != SHD_VECT_TRANSFORM_SPACE_CAMERA) { - GPU_link(mat, "invert_z", inputlink, &inputlink); - } - GPU_link(mat, func_name, inputlink, fromto, &out[0].link); - if (nodeprop->convert_to == SHD_VECT_TRANSFORM_SPACE_CAMERA && nodeprop->convert_from != SHD_VECT_TRANSFORM_SPACE_CAMERA) { - GPU_link(mat, "invert_z", out[0].link, &out[0].link); - } + /* For cycles we have inverted Z */ + /* TODO: pass here the correct matrices */ + if (nodeprop->convert_from == SHD_VECT_TRANSFORM_SPACE_CAMERA && nodeprop->convert_to != SHD_VECT_TRANSFORM_SPACE_CAMERA) { + GPU_link(mat, "invert_z", inputlink, &inputlink); } - else { - GPU_link(mat, func_name, inputlink, fromto, &out[0].link); + GPU_link(mat, func_name, inputlink, fromto, &out[0].link); + if (nodeprop->convert_to == SHD_VECT_TRANSFORM_SPACE_CAMERA && nodeprop->convert_from != SHD_VECT_TRANSFORM_SPACE_CAMERA) { + GPU_link(mat, "invert_z", out[0].link, &out[0].link); } } else @@ -195,7 +127,6 @@ void register_node_type_sh_vect_transform(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR, 0); - node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); node_type_init(&ntype, node_shader_init_vect_transform); node_type_socket_templates(&ntype, sh_node_vect_transform_in, sh_node_vect_transform_out); node_type_storage(&ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c index 58bbcced380..83e6b078be7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c +++ b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c @@ -22,15 +22,15 @@ /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_vector_displacement_in[] = { - { SOCK_RGBA, 0, N_("Vector"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE}, - { SOCK_FLOAT, 0, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - { SOCK_FLOAT, 0, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - { -1, 0, "" } + { SOCK_RGBA, 1, N_("Vector"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE}, + { SOCK_FLOAT, 1, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { SOCK_FLOAT, 1, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_vector_displacement_out[] = { { SOCK_VECTOR, 0, N_("Displacement"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_vector_displacement(bNodeTree *UNUSED(ntree), bNode *node) @@ -42,6 +42,7 @@ static int gpu_shader_vector_displacement(GPUMaterial *mat, bNode *node, bNodeEx { if (node->custom1 == SHD_SPACE_TANGENT) { return GPU_stack_link(mat, + node, "node_vector_displacement_tangent", in, out, @@ -51,10 +52,10 @@ static int gpu_shader_vector_displacement(GPUMaterial *mat, bNode *node, bNodeEx GPU_builtin(GPU_VIEW_MATRIX)); } else if (node->custom1 == SHD_SPACE_OBJECT) { - return GPU_stack_link(mat, "node_vector_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX)); + return GPU_stack_link(mat, node, "node_vector_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX)); } else { - return GPU_stack_link(mat, "node_vector_displacement_world", in, out); + return GPU_stack_link(mat, node, "node_vector_displacement_world", in, out); } } @@ -64,7 +65,6 @@ void register_node_type_sh_vector_displacement(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VECTOR_DISPLACEMENT, "Vector Displacement", NODE_CLASS_OP_VECTOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_vector_displacement_in, sh_node_vector_displacement_out); node_type_storage(&ntype, "", NULL, NULL); node_type_init(&ntype, node_shader_init_vector_displacement); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c index 626b8b2843d..19dd9bdb5db 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c @@ -24,17 +24,17 @@ static bNodeSocketTemplate sh_node_volume_absorption_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_volume_absorption_out[] = { { SOCK_SHADER, 0, N_("Volume")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_volume_absorption(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out)) +static int node_shader_gpu_volume_absorption(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return false; + return GPU_stack_link(mat, node, "node_volume_absorption", in, out); } /* node type definition */ @@ -43,7 +43,6 @@ void register_node_type_sh_volume_absorption(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, "Volume Absorption", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_volume_absorption_in, sh_node_volume_absorption_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c index 7a3e35e597b..f0ebd9f52be 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c @@ -34,12 +34,12 @@ static bNodeSocketTemplate sh_node_volume_principled_in[] = { { SOCK_RGBA, 1, N_("Blackbody Tint"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Temperature"), 1000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6500.0f}, { SOCK_STRING, 1, N_("Temperature Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_volume_principled_out[] = { { SOCK_SHADER, 0, N_("Volume")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode *node) @@ -54,9 +54,89 @@ static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode * } } -static int node_shader_gpu_volume_principled(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out)) +static void node_shader_gpu_volume_attribute(GPUMaterial *mat, const char *name, GPUNodeLink **outcol, GPUNodeLink **outvec, GPUNodeLink **outf) { - return false; + if (strcmp(name, "density") == 0) { + GPU_link(mat, "node_attribute_volume_density", + GPU_builtin(GPU_VOLUME_DENSITY), + outcol, outvec, outf); + } + else if (strcmp(name, "color") == 0) { + GPU_link(mat, "node_attribute_volume_color", + GPU_builtin(GPU_VOLUME_DENSITY), + outcol, outvec, outf); + } + else if (strcmp(name, "flame") == 0) { + GPU_link(mat, "node_attribute_volume_flame", + GPU_builtin(GPU_VOLUME_FLAME), + outcol, outvec, outf); + } + else if (strcmp(name, "temperature") == 0) { + GPU_link(mat, "node_attribute_volume_temperature", + GPU_builtin(GPU_VOLUME_FLAME), + GPU_builtin(GPU_VOLUME_TEMPERATURE), + outcol, outvec, outf); + } + else { + *outcol = *outvec = *outf = NULL; + } +} + +static int node_shader_gpu_volume_principled(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +{ + /* Test if blackbody intensity is enabled. */ + bool use_blackbody = (in[8].link || in[8].vec[0] != 0.0f); + + /* Get volume attributes. */ + GPUNodeLink *density = NULL, *color = NULL, *temperature = NULL; + + for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) { + if (sock->typeinfo->type != SOCK_STRING) { + continue; + } + + bNodeSocketValueString *value = sock->default_value; + GPUNodeLink *outcol, *outvec, *outf; + + if (STREQ(sock->name, "Density Attribute")) { + node_shader_gpu_volume_attribute(mat, value->value, &outcol, &outvec, &density); + } + else if (STREQ(sock->name, "Color Attribute")) { + node_shader_gpu_volume_attribute(mat, value->value, &color, &outvec, &outf); + } + else if (use_blackbody && STREQ(sock->name, "Temperature Attribute")) { + node_shader_gpu_volume_attribute(mat, value->value, &outcol, &outvec, &temperature); + } + } + + /* Default values if attributes not found. */ + if (!density) { + static float one = 1.0f; + density = GPU_constant(&one); + } + if (!color) { + static float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + color = GPU_constant(white); + } + if (!temperature) { + static float one = 1.0f; + temperature = GPU_constant(&one); + } + + /* Create blackbody spectrum. */ + const int size = CM_TABLE + 1; + float *data, layer; + if (use_blackbody) { + data = MEM_mallocN(sizeof(float) * size * 4, "blackbody texture"); + blackbody_temperature_to_rgb_table(data, size, 965.0f, 12000.0f); + } + else { + data = MEM_callocN(sizeof(float) * size * 4, "blackbody black"); + } + GPUNodeLink *spectrummap = GPU_color_band(mat, size, data, &layer); + + return GPU_stack_link(mat, node, "node_volume_principled", in, out, density, color, temperature, spectrummap, + GPU_constant(&layer)); } /* node type definition */ @@ -65,7 +145,6 @@ void register_node_type_sh_volume_principled(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, "Principled Volume", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_volume_principled_in, sh_node_volume_principled_out); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, node_shader_init_volume_principled); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c index 71260b831f8..d99bc47e25f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c @@ -25,17 +25,17 @@ static bNodeSocketTemplate sh_node_volume_scatter_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_FLOAT, 1, N_("Anisotropy"),0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_FACTOR}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_volume_scatter_out[] = { { SOCK_SHADER, 0, N_("Volume")}, - { -1, 0, "" } + { -1, 0, "" }, }; -static int node_shader_gpu_volume_scatter(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out)) +static int node_shader_gpu_volume_scatter(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return false; + return GPU_stack_link(mat, node, "node_volume_scatter", in, out); } /* node type definition */ @@ -44,7 +44,6 @@ void register_node_type_sh_volume_scatter(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VOLUME_SCATTER, "Volume Scatter", NODE_CLASS_SHADER, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_volume_scatter_in, sh_node_volume_scatter_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_wavelength.c b/source/blender/nodes/shader/nodes/node_shader_wavelength.c index 8bc853af689..427d9f17a63 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wavelength.c +++ b/source/blender/nodes/shader/nodes/node_shader_wavelength.c @@ -22,12 +22,12 @@ /* **************** Wavelength ******************** */ static bNodeSocketTemplate sh_node_wavelength_in[] = { { SOCK_FLOAT, 1, N_("Wavelength"), 500.0f, 0.0f, 0.0f, 0.0f, 380.0f, 780.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_wavelength_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; /* node type definition */ @@ -36,7 +36,6 @@ void register_node_type_sh_wavelength(void) static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_WAVELENGTH, "Wavelength", NODE_CLASS_CONVERTOR, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_socket_templates(&ntype, sh_node_wavelength_in, sh_node_wavelength_out); node_type_init(&ntype, NULL); diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.c b/source/blender/nodes/shader/nodes/node_shader_wireframe.c index 98544fc5fc0..2a902211ee4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wireframe.c +++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.c @@ -22,24 +22,35 @@ /* **************** Wireframe ******************** */ static bNodeSocketTemplate sh_node_wireframe_in[] = { { SOCK_FLOAT, 1, N_("Size"), 0.01f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate sh_node_wireframe_out[] = { { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { -1, 0, "" } + { -1, 0, "" }, }; +static int node_shader_gpu_wireframe(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +{ + /* node->custom1 is use_pixel_size */ + if (node->custom1) { + return GPU_stack_link(mat, node, "node_wireframe_screenspace", in, out, GPU_builtin(GPU_BARYCENTRIC_TEXCO)); + } + else { + return GPU_stack_link(mat, node, "node_wireframe", in, out, GPU_builtin(GPU_BARYCENTRIC_TEXCO), GPU_builtin(GPU_BARYCENTRIC_DIST)); + } +} + /* node type definition */ void register_node_type_sh_wireframe(void) { static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT, 0); - node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_wireframe_in, sh_node_wireframe_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); + node_type_gpu(&ntype, node_shader_gpu_wireframe); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 4e054fb53ae..655c80f347c 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/node_texture_tree.c - * \ingroup nodes +/** \file \ingroup nodes */ @@ -45,44 +44,22 @@ #include "NOD_texture.h" #include "node_texture_util.h" +#include "DEG_depsgraph.h" + #include "RNA_access.h" #include "RE_shader_ext.h" - -static void texture_get_from_context(const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from) +static void texture_get_from_context( + const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from) { SpaceNode *snode = CTX_wm_space_node(C); Scene *scene = CTX_data_scene(C); - Object *ob = OBACT; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); Tex *tx = NULL; - if (snode->texfrom == SNODE_TEX_OBJECT) { - if (ob) { - tx = give_current_object_texture(ob); - if (tx) { - if (ob->type == OB_LAMP) - *r_from = (ID *)ob->data; - else - *r_from = (ID *)give_current_material(ob, ob->actcol); - - /* from is not set fully for material nodes, should be ID + Node then */ - *r_id = &tx->id; - *r_ntree = tx->nodetree; - } - } - } - else if (snode->texfrom == SNODE_TEX_WORLD) { - if (scene->world) { - *r_from = (ID *)scene->world; - tx = give_current_world_texture(scene->world); - if (tx) { - *r_id = &tx->id; - *r_ntree = tx->nodetree; - } - } - } - else if (snode->texfrom == SNODE_TEX_BRUSH) { + if (snode->texfrom == SNODE_TEX_BRUSH) { struct Brush *brush = NULL; if (ob && (ob->mode & OB_MODE_SCULPT)) @@ -100,7 +77,7 @@ static void texture_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tr } } else if (snode->texfrom == SNODE_TEX_LINESTYLE) { - FreestyleLineStyle *linestyle = BKE_linestyle_active_from_scene(scene); + FreestyleLineStyle *linestyle = BKE_linestyle_active_from_view_layer(view_layer); if (linestyle) { *r_from = (ID *)linestyle; tx = give_current_linestyle_texture(linestyle); @@ -178,9 +155,9 @@ void register_node_tree_type_tex(void) tt->type = NTREE_TEXTURE; strcpy(tt->idname, "TextureNodeTree"); - strcpy(tt->ui_name, "Texture"); + strcpy(tt->ui_name, N_("Texture Node Editor")); tt->ui_icon = 0; /* defined in drawnode.c */ - strcpy(tt->ui_description, "Texture nodes"); + strcpy(tt->ui_description, N_("Texture nodes")); tt->foreach_nodeclass = foreach_nodeclass; tt->update = update; @@ -313,7 +290,6 @@ int ntreeTexExecTree( short which_output, int cfra, int preview, - ShadeInput *shi, MTex *mtex) { TexCallData data; @@ -328,12 +304,11 @@ int ntreeTexExecTree( data.osatex = osatex; data.target = texres; data.do_preview = preview; - data.do_manage = (shi) ? shi->do_manage : true; + data.do_manage = true; data.thread = thread; data.which_output = which_output; data.cfra = cfra; data.mtex = mtex; - data.shi = shi; /* ensure execdata is only initialized once */ if (!exec) { diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c index 433d01df14f..1fae951a8d8 100644 --- a/source/blender/nodes/texture/node_texture_util.c +++ b/source/blender/nodes/texture/node_texture_util.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/node_texture_util.c - * \ingroup nodes +/** \file \ingroup nodes */ @@ -116,7 +115,6 @@ void params_from_cdata(TexParams *out, TexCallData *in) out->previewco = in->co; out->osatex = in->osatex; out->cfra = in->cfra; - out->shi = in->shi; out->mtex = in->mtex; } diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h index d55a98d5a96..d3476778d7e 100644 --- a/source/blender/nodes/texture/node_texture_util.h +++ b/source/blender/nodes/texture/node_texture_util.h @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/node_texture_util.h - * \ingroup nodes +/** \file \ingroup nodes */ @@ -53,7 +52,6 @@ #include "BKE_material.h" #include "BKE_node.h" #include "BKE_texture.h" -#include "BKE_library.h" #include "node_util.h" #include "NOD_texture.h" @@ -79,7 +77,6 @@ typedef struct TexCallData { short which_output; int cfra; - ShadeInput *shi; MTex *mtex; } TexCallData; @@ -92,7 +89,6 @@ typedef struct TexParams { /* optional. we don't really want these here, but image * textures need to do mapping & color correction */ - ShadeInput *shi; MTex *mtex; } TexParams; diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c index 726e2060fc9..b653cefd847 100644 --- a/source/blender/nodes/texture/nodes/node_texture_at.c +++ b/source/blender/nodes/texture/nodes/node_texture_at.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_at.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c index f505440a269..6ef6d9ca144 100644 --- a/source/blender/nodes/texture/nodes/node_texture_bricks.c +++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_bricks.c - * \ingroup texnodes +/** \file \ingroup texnodes */ @@ -39,7 +38,7 @@ static bNodeSocketTemplate inputs[] = { }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, ""} + { -1, 0, ""}, }; static void init(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c index b843c80a548..7b303f07185 100644 --- a/source/blender/nodes/texture/nodes/node_texture_checker.c +++ b/source/blender/nodes/texture/nodes/node_texture_checker.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_checker.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c index 4d5c0ee94f1..1d458a2ca95 100644 --- a/source/blender/nodes/texture/nodes/node_texture_common.c +++ b/source/blender/nodes/texture/nodes/node_texture_common.c @@ -18,8 +18,7 @@ * Juho Vepsäläinen */ -/** \file blender/nodes/texture/nodes/node_texture_common.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c index 01c88aa86ae..d40d5dc75f6 100644 --- a/source/blender/nodes/texture/nodes/node_texture_compose.c +++ b/source/blender/nodes/texture/nodes/node_texture_compose.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_compose.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c index 1ce39a0042f..a18218ed050 100644 --- a/source/blender/nodes/texture/nodes/node_texture_coord.c +++ b/source/blender/nodes/texture/nodes/node_texture_coord.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_coord.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c index 9db9dc6d9f8..4ee67a0e55b 100644 --- a/source/blender/nodes/texture/nodes/node_texture_curves.c +++ b/source/blender/nodes/texture/nodes/node_texture_curves.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_curves.c - * \ingroup texnodes +/** \file \ingroup texnodes */ @@ -76,12 +75,12 @@ void register_node_type_tex_curve_time(void) /* **************** CURVE RGB ******************** */ static bNodeSocketTemplate rgb_inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate rgb_outputs[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, ""} + { -1, 0, ""}, }; static void rgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c index 99cbe14a16e..afa141ed159 100644 --- a/source/blender/nodes/texture/nodes/node_texture_decompose.c +++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_decompose.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c index 96fe5f907ca..5930da5e727 100644 --- a/source/blender/nodes/texture/nodes/node_texture_distance.c +++ b/source/blender/nodes/texture/nodes/node_texture_distance.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_distance.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c index c69aa204d4a..39610a00483 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_hueSatVal.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c index 5e5e4a59e01..41d85387f98 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.c +++ b/source/blender/nodes/texture/nodes/node_texture_image.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_image.c - * \ingroup texnodes +/** \file \ingroup texnodes */ @@ -85,8 +84,8 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node) ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user"); node->storage = iuser; iuser->sfra = 1; - iuser->fie_ima = 2; iuser->ok = 1; + iuser->flag |= IMA_ANIM_ALWAYS; } void register_node_type_tex_image(void) diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c index f5bd15bcff6..5254fa3f631 100644 --- a/source/blender/nodes/texture/nodes/node_texture_invert.c +++ b/source/blender/nodes/texture/nodes/node_texture_invert.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_invert.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 4f2446d9f8d..62fb4e008bb 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_math.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c index 47ee28cd2f9..460d643107e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_mixRgb.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index 6bc4d33f595..475bcbc8f47 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_output.c - * \ingroup texnodes +/** \file \ingroup texnodes */ @@ -29,7 +28,7 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION}, - { -1, 0, ""} + { -1, 0, ""}, }; /* applies to render pipeline */ diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c index b487a4cad4b..d70e03b49ac 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.c +++ b/source/blender/nodes/texture/nodes/node_texture_proc.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_proc.c - * \ingroup texnodes +/** \file \ingroup texnodes */ @@ -61,7 +60,7 @@ static void do_proc(float *result, TexParams *p, const float col1[4], const floa texres.nor = NULL; textype = multitex_nodes(tex, p->co, p->dxt, p->dyt, p->osatex, - &texres, thread, 0, p->shi, p->mtex, NULL); + &texres, thread, 0, p->mtex, NULL); if (is_normal) return; diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c index fa8fd7edb7f..4e338c00d2a 100644 --- a/source/blender/nodes/texture/nodes/node_texture_rotate.c +++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_rotate.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c index dbdfa59171d..67db042ebf2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_scale.c +++ b/source/blender/nodes/texture/nodes/node_texture_scale.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_scale.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index 01ccc2fb337..559675da754 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_texture.c - * \ingroup texnodes +/** \file \ingroup texnodes */ @@ -70,7 +69,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor texres.nor = nor; textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex, - &texres, thread, 0, p->shi, p->mtex, NULL); + &texres, thread, 0, p->mtex, NULL); if (textype & TEX_RGB) { copy_v4_v4(out, &texres.tr); diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c index 43bd937ad56..a78f597503d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_translate.c +++ b/source/blender/nodes/texture/nodes/node_texture_translate.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_translate.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c index cfb711397ab..47feb213960 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_valToNor.c - * \ingroup texnodes +/** \file \ingroup texnodes */ diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c index e418b1a00aa..3fb3725bad8 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_valToRgb.c - * \ingroup texnodes +/** \file \ingroup texnodes */ @@ -29,11 +28,11 @@ /* **************** VALTORGB ******************** */ static bNodeSocketTemplate valtorgb_in[] = { { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate valtorgb_out[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void valtorgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) @@ -72,11 +71,11 @@ void register_node_type_tex_valtorgb(void) /* **************** RGBTOBW ******************** */ static bNodeSocketTemplate rgbtobw_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate rgbtobw_out[] = { { SOCK_FLOAT, 0, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index 14f6d1ba04d..34276d7d971 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -17,8 +17,7 @@ * All rights reserved. */ -/** \file blender/nodes/texture/nodes/node_texture_viewer.c - * \ingroup texnodes +/** \file \ingroup texnodes */ |