-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader_ops.py
38 lines (28 loc) · 916 Bytes
/
header_ops.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
import bpy
from bpy.types import Operator
class LOCK_OT_Camera_View(Operator):
bl_idname = "space_data.lock_camera"
bl_label = "Lock"
bl_description = "Lock Camera to View"
bl_options = {"REGISTER"}
@classmethod
def poll(cls, context):
if context.space_data.lock_camera is True:
return False
return True
def execute(self, context):
context.space_data.lock_camera = True
return {'FINISHED'}
class UNLOCK_OT_Camera_View(Operator):
bl_idname = "space_data.unlock_camera"
bl_label = "Unlock"
bl_description = "Unlock Camera to View"
bl_options = {"REGISTER"}
@classmethod
def poll(cls, context):
if context.space_data.lock_camera is True:
return True
return False
def execute(self, context):
context.space_data.lock_camera = False
return {'FINISHED'}