[Bf-extensions-cvs] [c27fd9ec] master: Node Wrangler: use utility function to populate switch menu
Scott Ramsay
noreply at git.blender.org
Mon Jul 25 21:11:51 CEST 2022
Commit: c27fd9ecb8aeda9c583695f7d226e4ff581d4da6
Author: Scott Ramsay
Date: Mon Jul 25 20:59:54 2022 +0200
Branches: master
https://developer.blender.org/rBAc27fd9ecb8aeda9c583695f7d226e4ff581d4da6
Node Wrangler: use utility function to populate switch menu
Currently, the nodes in the Switch menu (Shift+S) are generated from Node
Wrangler's own long static list of categories and nodes, which often goes
out of sync when Blender changes.
This changes to using the node_categories_iter utility which uses the correct
list of available nodes from nodeitems_builtins.py.
The submenu classes are now procedurally generated and registered in the same
fashion as the add menu, but just with a different operator in their draw
function.
Removing the static lists required a couple changes outside of the Switch menu.
Mostly having to compare types using the verbose node.rna_type.identifier.
Includes improvements on the original patch by Benni Merz.
===================================================================
M node_wrangler.py
===================================================================
diff --git a/node_wrangler.py b/node_wrangler.py
index 4525217d..290ac082 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -3,7 +3,7 @@
bl_info = {
"name": "Node Wrangler",
"author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer",
- "version": (3, 40),
+ "version": (3, 41),
"blender": (2, 93, 0),
"location": "Node Editor Toolbar or Shift-W",
"description": "Various tools to enhance and speed up node-based workflow",
@@ -72,406 +72,6 @@ rl_outputs = (
RL_entry('use_pass_z', 'Z', 'Depth', True, True),
)
-# shader nodes
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-shaders_input_nodes_props = (
- ('ShaderNodeAmbientOcclusion', 'AMBIENT_OCCLUSION', 'Ambient Occlusion'),
- ('ShaderNodeAttribute', 'ATTRIBUTE', 'Attribute'),
- ('ShaderNodeBevel', 'BEVEL', 'Bevel'),
- ('ShaderNodeCameraData', 'CAMERA', 'Camera Data'),
- ('ShaderNodeFresnel', 'FRESNEL', 'Fresnel'),
- ('ShaderNodeNewGeometry', 'NEW_GEOMETRY', 'Geometry'),
- ('ShaderNodeHairInfo', 'HAIR_INFO', 'Hair Info'),
- ('ShaderNodeLayerWeight', 'LAYER_WEIGHT', 'Layer Weight'),
- ('ShaderNodeLightPath', 'LIGHT_PATH', 'Light Path'),
- ('ShaderNodeObjectInfo', 'OBJECT_INFO', 'Object Info'),
- ('ShaderNodeParticleInfo', 'PARTICLE_INFO', 'Particle Info'),
- ('ShaderNodeRGB', 'RGB', 'RGB'),
- ('ShaderNodeTangent', 'TANGENT', 'Tangent'),
- ('ShaderNodeTexCoord', 'TEX_COORD', 'Texture Coordinate'),
- ('ShaderNodeUVMap', 'UVMAP', 'UV Map'),
- ('ShaderNodeValue', 'VALUE', 'Value'),
- ('ShaderNodeVertexColor', 'VERTEX_COLOR', 'Vertex Color'),
- ('ShaderNodeVolumeInfo', 'VOLUME_INFO', 'Volume Info'),
- ('ShaderNodeWireframe', 'WIREFRAME', 'Wireframe'),
-
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-shaders_output_nodes_props = (
- ('ShaderNodeOutputAOV', 'OUTPUT_AOV', 'AOV Output'),
- ('ShaderNodeOutputLight', 'OUTPUT_LIGHT', 'Light Output'),
- ('ShaderNodeOutputMaterial', 'OUTPUT_MATERIAL', 'Material Output'),
- ('ShaderNodeOutputWorld', 'OUTPUT_WORLD', 'World Output'),
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-shaders_shader_nodes_props = (
- ('ShaderNodeAddShader', 'ADD_SHADER', 'Add Shader'),
- ('ShaderNodeBsdfAnisotropic', 'BSDF_ANISOTROPIC', 'Anisotropic BSDF'),
- ('ShaderNodeBsdfDiffuse', 'BSDF_DIFFUSE', 'Diffuse BSDF'),
- ('ShaderNodeEmission', 'EMISSION', 'Emission'),
- ('ShaderNodeBsdfGlass', 'BSDF_GLASS', 'Glass BSDF'),
- ('ShaderNodeBsdfGlossy', 'BSDF_GLOSSY', 'Glossy BSDF'),
- ('ShaderNodeBsdfHair', 'BSDF_HAIR', 'Hair BSDF'),
- ('ShaderNodeHoldout', 'HOLDOUT', 'Holdout'),
- ('ShaderNodeMixShader', 'MIX_SHADER', 'Mix Shader'),
- ('ShaderNodeBsdfPrincipled', 'BSDF_PRINCIPLED', 'Principled BSDF'),
- ('ShaderNodeBsdfHairPrincipled', 'BSDF_HAIR_PRINCIPLED', 'Principled Hair BSDF'),
- ('ShaderNodeVolumePrincipled', 'PRINCIPLED_VOLUME', 'Principled Volume'),
- ('ShaderNodeBsdfRefraction', 'BSDF_REFRACTION', 'Refraction BSDF'),
- ('ShaderNodeSubsurfaceScattering', 'SUBSURFACE_SCATTERING', 'Subsurface Scattering'),
- ('ShaderNodeBsdfToon', 'BSDF_TOON', 'Toon BSDF'),
- ('ShaderNodeBsdfTranslucent', 'BSDF_TRANSLUCENT', 'Translucent BSDF'),
- ('ShaderNodeBsdfTransparent', 'BSDF_TRANSPARENT', 'Transparent BSDF'),
- ('ShaderNodeBsdfVelvet', 'BSDF_VELVET', 'Velvet BSDF'),
- ('ShaderNodeBackground', 'BACKGROUND', 'Background'),
- ('ShaderNodeVolumeAbsorption', 'VOLUME_ABSORPTION', 'Volume Absorption'),
- ('ShaderNodeVolumeScatter', 'VOLUME_SCATTER', 'Volume Scatter'),
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping things in alphabetical order so we don't need to sort later.
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-shaders_texture_nodes_props = (
- ('ShaderNodeTexBrick', 'TEX_BRICK', 'Brick Texture'),
- ('ShaderNodeTexChecker', 'TEX_CHECKER', 'Checker Texture'),
- ('ShaderNodeTexEnvironment', 'TEX_ENVIRONMENT', 'Environment Texture'),
- ('ShaderNodeTexGradient', 'TEX_GRADIENT', 'Gradient Texture'),
- ('ShaderNodeTexIES', 'TEX_IES', 'IES Texture'),
- ('ShaderNodeTexImage', 'TEX_IMAGE', 'Image Texture'),
- ('ShaderNodeTexMagic', 'TEX_MAGIC', 'Magic Texture'),
- ('ShaderNodeTexMusgrave', 'TEX_MUSGRAVE', 'Musgrave Texture'),
- ('ShaderNodeTexNoise', 'TEX_NOISE', 'Noise Texture'),
- ('ShaderNodeTexPointDensity', 'TEX_POINTDENSITY', 'Point Density'),
- ('ShaderNodeTexSky', 'TEX_SKY', 'Sky Texture'),
- ('ShaderNodeTexVoronoi', 'TEX_VORONOI', 'Voronoi Texture'),
- ('ShaderNodeTexWave', 'TEX_WAVE', 'Wave Texture'),
- ('ShaderNodeTexWhiteNoise', 'TEX_WHITE_NOISE', 'White Noise'),
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-shaders_color_nodes_props = (
- ('ShaderNodeBrightContrast', 'BRIGHTCONTRAST', 'Bright Contrast'),
- ('ShaderNodeGamma', 'GAMMA', 'Gamma'),
- ('ShaderNodeHueSaturation', 'HUE_SAT', 'Hue Saturation Value'),
- ('ShaderNodeInvert', 'INVERT', 'Invert'),
- ('ShaderNodeLightFalloff', 'LIGHT_FALLOFF', 'Light Falloff'),
- ('ShaderNodeMixRGB', 'MIX_RGB', 'MixRGB'),
- ('ShaderNodeRGBCurve', 'CURVE_RGB', 'RGB Curves'),
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-shaders_vector_nodes_props = (
- ('ShaderNodeBump', 'BUMP', 'Bump'),
- ('ShaderNodeDisplacement', 'DISPLACEMENT', 'Displacement'),
- ('ShaderNodeMapping', 'MAPPING', 'Mapping'),
- ('ShaderNodeNormal', 'NORMAL', 'Normal'),
- ('ShaderNodeNormalMap', 'NORMAL_MAP', 'Normal Map'),
- ('ShaderNodeVectorCurve', 'CURVE_VEC', 'Vector Curves'),
- ('ShaderNodeVectorDisplacement', 'VECTOR_DISPLACEMENT', 'Vector Displacement'),
- ('ShaderNodeVectorTransform', 'VECT_TRANSFORM', 'Vector Transform'),
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-shaders_converter_nodes_props = (
- ('ShaderNodeBlackbody', 'BLACKBODY', 'Blackbody'),
- ('ShaderNodeClamp', 'CLAMP', 'Clamp'),
- ('ShaderNodeValToRGB', 'VALTORGB', 'ColorRamp'),
- ('ShaderNodeCombineHSV', 'COMBHSV', 'Combine HSV'),
- ('ShaderNodeCombineRGB', 'COMBRGB', 'Combine RGB'),
- ('ShaderNodeCombineXYZ', 'COMBXYZ', 'Combine XYZ'),
- ('ShaderNodeMapRange', 'MAP_RANGE', 'Map Range'),
- ('ShaderNodeMath', 'MATH', 'Math'),
- ('ShaderNodeRGBToBW', 'RGBTOBW', 'RGB to BW'),
- ('ShaderNodeSeparateRGB', 'SEPRGB', 'Separate RGB'),
- ('ShaderNodeSeparateXYZ', 'SEPXYZ', 'Separate XYZ'),
- ('ShaderNodeSeparateHSV', 'SEPHSV', 'Separate HSV'),
- ('ShaderNodeVectorMath', 'VECT_MATH', 'Vector Math'),
- ('ShaderNodeWavelength', 'WAVELENGTH', 'Wavelength'),
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-shaders_layout_nodes_props = (
- ('NodeFrame', 'FRAME', 'Frame'),
- ('NodeReroute', 'REROUTE', 'Reroute'),
-)
-
-# compositing nodes
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-compo_input_nodes_props = (
- ('CompositorNodeBokehImage', 'BOKEHIMAGE', 'Bokeh Image'),
- ('CompositorNodeImage', 'IMAGE', 'Image'),
- ('CompositorNodeMask', 'MASK', 'Mask'),
- ('CompositorNodeMovieClip', 'MOVIECLIP', 'Movie Clip'),
- ('CompositorNodeRLayers', 'R_LAYERS', 'Render Layers'),
- ('CompositorNodeRGB', 'RGB', 'RGB'),
- ('CompositorNodeTexture', 'TEXTURE', 'Texture'),
- ('CompositorNodeTime', 'TIME', 'Time'),
- ('CompositorNodeTrackPos', 'TRACKPOS', 'Track Position'),
- ('CompositorNodeValue', 'VALUE', 'Value'),
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-compo_output_nodes_props = (
- ('CompositorNodeComposite', 'COMPOSITE', 'Composite'),
- ('CompositorNodeOutputFile', 'OUTPUT_FILE', 'File Output'),
- ('CompositorNodeLevels', 'LEVELS', 'Levels'),
- ('CompositorNodeSplitViewer', 'SPLITVIEWER', 'Split Viewer'),
- ('CompositorNodeViewer', 'VIEWER', 'Viewer'),
-)
-# (rna_type.identifier, type, rna_type.name)
-# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
-# Keeping things in alphabetical order so we don't need to sort later.
-compo_color_nodes_props = (
- ('CompositorNodeAlphaOver', 'ALPHAOVER', 'Alpha Over'),
- ('CompositorNodeBrightContrast', 'BRIGHTCONTRAST', 'Bright/Contrast'),
- ('CompositorNodeColorBalance', 'COLORBALANCE', 'Color Balance'),
- ('CompositorNodeColorCorrection', 'COLORCORRECTION', 'Color Correction'),
- ('CompositorNodeGamma', 'GAMMA', 'Gamma'),
- ('CompositorNodeHueCorrect', 'HUECORRECT', 'Hue Correct'),
- ('CompositorNodeHueSat', 'HUE_SAT', 'Hue Saturation Value'),
- ('CompositorNodeInvert', 'INVERT', 'Invert'),
- ('CompositorNodeMixRGB', 'MIX_RGB', 'Mix'),
- ('CompositorNodeCurveRGB', 'CURVE_RGB', 'RGB Curves'),
- ('CompositorNodeTonemap', 'TONEMAP', 'Tonemap'),
- ('CompositorNodeZcombi
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list