-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcreate_light.py
55 lines (42 loc) · 1.69 KB
/
create_light.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
import FreeCAD, FreeCADGui
import texture_config
from arch_texture_utils.resource_utils import iconPath
import point_light
import directional_light
class CreatePointLightCommand:
toolbarName = 'Light_Tools'
commandName = 'Create_PointLight'
def GetResources(self):
return {'MenuText': "Create Pointlight",
'ToolTip' : "Create a new point light in the scene",
'Pixmap': iconPath('CreatePointLight.svg')
}
def Activated(self):
point_light.createPointLight()
def IsActive(self):
"""If there is no active document we can't do anything."""
return not FreeCAD.ActiveDocument is None
class CreateDirectionalLightCommand:
toolbarName = 'Light_Tools'
commandName = 'Create_DirectionalLight'
def GetResources(self):
return {'MenuText': "Create Directionallight",
'ToolTip' : "Create a new Directional light in the scene",
'Pixmap': iconPath('CreateDirectionalLight.svg')
}
def Activated(self):
directional_light.createDirectionalLight()
def IsActive(self):
"""If there is no active document we can't do anything."""
return not FreeCAD.ActiveDocument is None
if __name__ == "__main__":
command = CreatePointLightCommand();
if command.IsActive():
command.Activated()
else:
import arch_texture_utils.qtutils as qtutils
qtutils.showInfo("No open Document", "There is no open document")
else:
import archtexture_toolbars
archtexture_toolbars.toolbarManager.registerCommand(CreatePointLightCommand())
archtexture_toolbars.toolbarManager.registerCommand(CreateDirectionalLightCommand())