-
Notifications
You must be signed in to change notification settings - Fork 4
/
overte_panels.py
100 lines (81 loc) · 2.88 KB
/
overte_panels.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import bpy
from .entities import MaterialEntity, ZoneEntity
from .entity_factory import EntityFactory
class OverteObjectPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Overte Object"
bl_idname = "OBJECT_PT_overte_object"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
@classmethod
def poll(cls, context):
obj = context.active_object
return EntityFactory.createEntity(obj)
def draw(self, context):
layout = self.layout
obj = context.active_object
entity = EntityFactory.createEntity(obj)
if entity:
entity.draw_panel(layout)
class OverteCollectionPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Overte Zone"
bl_idname = "OBJECT_PT_overte_collection"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "collection"
@classmethod
def poll(cls, context):
col = context.collection
return EntityFactory.matchName(col, "Zone")
def draw(self, context):
layout = self.layout
col = context.collection
if EntityFactory.matchName(col, "Zone"):
entity = ZoneEntity(col)
entity.draw_panel(layout)
else:
row = layout.row()
row.label(text="Collection name is not a \"Zone\"")
class OverteMaterialPanel(bpy.types.Panel):
"""Creates a Panel in the Material properties window"""
bl_label = "Overte Material"
bl_idname = "OBJECT_PT_overte_material"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "material"
@classmethod
def poll(cls, context):
obj = context.active_object
return obj and obj.active_material
def draw(self, context):
layout = self.layout
obj = context.active_object
if context.active_object and context.active_object.active_material:
mat = context.active_object.active_material
entity = MaterialEntity(mat)
entity.draw_panel(layout)
else:
row = layout.row()
row.label(text="No material")
class OverteWorldPanel(bpy.types.Panel):
"""Creates a Panel in the World properties window"""
bl_label = "Overte Settings"
bl_idname = "OBJECT_PT_overte_world"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
def draw(self, context):
obj = context.scene.world
layout = self.layout
row = layout.row()
row.prop(obj.overte, "domain_url")
row = layout.row()
row.prop(obj.overte, "models_path")
row = layout.row()
row.prop(obj.overte, "textures_path")
row = layout.row()
row.prop(obj.overte, "world_scale")
row = layout.row()
row.operator("world.overte_refresh_library")