Skip to content

Instantly share code, notes, and snippets.

@todashuta
Created June 26, 2022 09:06
Show Gist options
  • Select an option

  • Save todashuta/73a2ce64a0bd4e184259d9c77fe4d7fc to your computer and use it in GitHub Desktop.

Select an option

Save todashuta/73a2ce64a0bd4e184259d9c77fe4d7fc to your computer and use it in GitHub Desktop.
Show Number of Selected Objects
# ##### 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 #####
bl_info = {
"name": "Show Number of Selected Objects",
"author": "todashuta",
"version": (1, 0, 0),
"blender": (2, 93, 0),
"location": "3D View > Object Mode > Tool Header",
"description": "",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Object"
}
import bpy
def drawfunc(self, context):
active_object = context.active_object
if active_object and active_object.mode == "OBJECT":
self.layout.label(text=f"#selected_objects: {len(context.selected_objects)}")
def register():
bpy.types.VIEW3D_HT_tool_header.prepend(drawfunc)
def unregister():
bpy.types.VIEW3D_HT_tool_header.remove(drawfunc)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment