1 # SPDX-FileCopyrightText: 2019-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 Scene, Cameras, and Meshlights Count
8 Increase the stats by displaying the number of scenes, cameras, and light
14 from amaranth
import utils
17 def stats_scene(self
, context
):
18 get_addon
= "amaranth" in context
.preferences
.addons
.keys()
22 if context
.preferences
.addons
["amaranth"].preferences
.use_scene_stats
:
23 scenes_count
= str(len(bpy
.data
.scenes
))
24 cameras_count
= str(len(bpy
.data
.cameras
))
27 meshlights_visible
= 0
29 for ob
in context
.scene
.objects
:
30 if utils
.cycles_is_emission(context
, ob
):
32 if ob
in context
.visible_objects
:
33 meshlights_visible
+= 1
35 if ob
in context
.selected_objects
:
36 if ob
.type == 'CAMERA':
39 meshlights_string
= '| Meshlights:{}/{}'.format(
40 meshlights_visible
, meshlights
)
42 row
= self
.layout
.row(align
=True)
43 row
.label(text
="Scenes:{} | Cameras:{}/{} {}".format(
44 scenes_count
, cameras_selected
, cameras_count
,
45 meshlights_string
if utils
.cycles_active(context
) else ''))
49 bpy
.types
.STATUSBAR_HT_header
.append(stats_scene
)
53 bpy
.types
.STATUSBAR_HT_header
.remove(stats_scene
)