Skip to content

Instantly share code, notes, and snippets.

@p2or
Last active May 21, 2023 21:43
Show Gist options
  • Save p2or/bfff03972510568b808672fa138212a9 to your computer and use it in GitHub Desktop.
Save p2or/bfff03972510568b808672fa138212a9 to your computer and use it in GitHub Desktop.
Display the type of the active node, for https://blender.stackexchange.com/questions/251143/what-shader-node-is-it #Blender #BSE
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# ##### END GPL LICENSE BLOCK #####
# for https://blender.stackexchange.com/questions/251143/what-shader-node-is-it
import bpy
bl_info = {
"name": "Node Type",
"description": "Display the type of the active node",
"author": "p2or",
"version": (0, 1),
"blender": (2, 82, 0),
"location": "Node Editor > Properties Panel > Node",
"category": "Node"
}
def node_type_poll(context):
return len(context.selected_nodes) and \
context.space_data.type == 'NODE_EDITOR'
def display_node_type(self, context):
act_node = context.active_node
if act_node and node_type_poll(context):
layout = self.layout
row = layout.row()
if act_node.type == 'GROUP':
row.prop(act_node.node_tree, "name", text="Type (Group)")
#row.enabled = False
else:
row.prop(act_node.bl_rna, "name", text="Type")
#layout.row().prop(act_node, "bl_idname")
def register():
bpy.types.NODE_PT_active_node_generic.append(display_node_type)
def unregister():
bpy.types.NODE_PT_active_node_generic.remove(display_node_type)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment