-
Notifications
You must be signed in to change notification settings - Fork 2
/
generic.py
66 lines (48 loc) · 1.32 KB
/
generic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# generic_plot.py
"""
The generic plotting routine from which all others inherit.
"""
class GenericPlot():
"""
Generic plotting class with minimal functionality.
"""
def __init__(self):
"""
Fill members with default values.
"""
import bpy
# Define the members that can be seen by the user.
self.time = None
# Set the handler function for frame changes (time).
bpy.app.handlers.frame_change_pre.append(self.time_handler)
def plot(self):
"""
Plot nothing.
"""
pass
def time_handler(self, scene, depsgraph):
"""
Function to be called whenever any Blender animation functions are used.
Updates the plot according to the function specified.
"""
if not self.time is None:
self.plot()
else:
pass
def update_globals(self):
"""
Update the global variables.
"""
pass
def object_reference_valid(self, obj):
"""
Verify that the reference to the object obj is valid.
This is useful after the user manually deletes objects
and we try to refer to it.
"""
try:
dir(obj)
valid = True
except:
valid = False
return valid