1 # SPDX-License-Identifier: GPL-2.0-or-later
6 # FUNCTION: Checks if cycles is available
8 return hasattr(bpy
.types
.Scene
, "cycles")
11 # FUNCTION: Checks if cycles is the active renderer
12 def cycles_active(context
):
13 return context
.scene
.render
.engine
== "CYCLES"
16 # FUNCTION: Check if material has Emission (for select and stats)
17 def cycles_is_emission(context
, ob
):
20 if not ob
.material_slots
:
23 for ma
in ob
.material_slots
:
26 if ma
.material
.node_tree
and ma
.material
.node_tree
.nodes
:
27 for no
in ma
.material
.node_tree
.nodes
:
28 if not no
.type in ("EMISSION", "GROUP"):
33 if no
.type == "GROUP" and no
.node_tree
and no
.node_tree
.nodes
:
34 for gno
in no
.node_tree
.nodes
:
35 if gno
.type != "EMISSION":
37 for gou
in gno
.outputs
:
38 if ou
.links
and gou
.links
:
40 elif no
.type == "EMISSION":
46 # FUNCTION: Check if object has keyframes for a specific frame
47 def is_keyframe(ob
, frame
):
48 if ob
is not None and ob
.animation_data
is not None and ob
.animation_data
.action
is not None:
49 for fcu
in ob
.animation_data
.action
.fcurves
:
50 if frame
in (p
.co
.x
for p
in fcu
.keyframe_points
):