-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathpoint_light.py
54 lines (36 loc) · 1.29 KB
/
point_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
import FreeCAD
import FreeCADGui
from pivy import coin
import light
from arch_texture_utils.resource_utils import iconPath
class PointLight(light.Light):
def __init__(self, obj):
super().__init__(obj)
def setProperties(self, obj):
super().setProperties(obj)
pl = obj.PropertiesList
if not 'Location' in pl:
obj.addProperty("App::PropertyVector", "Location", "Light",
"The position of the light in the scene.").Location = FreeCAD.Vector(0, -1, 0)
self.type = 'PointLight'
class ViewProviderPointLight(light.ViewProviderLight):
def __init__(self, vobj):
super().__init__(vobj)
def attach(self, vobj):
super().attach(vobj)
self.updateLocation()
def createLightInstance(self):
return coin.SoPointLight()
def createGeometry(self):
sphere = coin.SoSphere()
sphere.radius.setValue(50.0)
return sphere
def getIcon(self):
return iconPath("PointLight.svg")
def createPointLight():
obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "PointLight")
light = PointLight(obj)
ViewProviderPointLight(obj.ViewObject)
return obj
if __name__ == "__main__":
createPointLight()