Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Picard <dam.pic@free.fr>2020-10-29 01:08:51 +0300
committerDamien Picard <dam.pic@free.fr>2020-10-29 01:19:14 +0300
commit899c25c9a5ce128ddd776fc45121b3373ecf1b49 (patch)
tree8cf4f3b6def86ba5520b73dc4fdf04f8238489fc /sun_position
parentd85787dd2bf343903cf95d9c4a9bd87d55c71e31 (diff)
Sun position: T80379 Startup breaks add-on: no World and UI warning
- Take into account the situation when no World datablock is assigned. - Also apply this to HDRI texture mode's environment texture - Add warnings when either no World datablock is assigned or no node tree is assigned to the World.
Diffstat (limited to 'sun_position')
-rw-r--r--sun_position/ui_sun.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/sun_position/ui_sun.py b/sun_position/ui_sun.py
index fa79a3f0..2eb969d2 100644
--- a/sun_position/ui_sun.py
+++ b/sun_position/ui_sun.py
@@ -99,8 +99,20 @@ class SUNPOS_PT_Panel(bpy.types.Panel):
col = flow.column(align=True)
col.label(text="Environment texture:")
- col.prop_search(sp, "hdr_texture",
- context.scene.world.node_tree, "nodes", text="")
+
+ if context.scene.world is not None:
+ if context.scene.world.node_tree is not None:
+ col.prop_search(sp, "hdr_texture",
+ context.scene.world.node_tree, "nodes")
+ col.prop_search(sp, "sky_texture",
+ context.scene.world.node_tree, "nodes")
+ else:
+ col.label(text="Please activate Use Nodes in the World panel.",
+ icon="ERROR")
+ else:
+ col.label(text="Please select World in the World panel.",
+ icon="ERROR")
+
col.separator()
col = flow.column(align=True)
@@ -122,7 +134,7 @@ class SUNPOS_PT_Panel(bpy.types.Panel):
else:
prop_text="Bind Texture to Sun "
col.prop(sp, "bind_to_sun", toggle=True, icon="CONSTRAINT",
- text=prop_text)
+ text=prop_text)
row = col.row(align=True)
row.enabled = not sp.bind_to_sun
@@ -148,9 +160,16 @@ class SUNPOS_PT_Panel(bpy.types.Panel):
col.prop(sp, "time_spread")
col.separator()
- if context.scene.world.node_tree is not None:
- col.prop_search(sp, "sky_texture", context.scene.world.node_tree,
- "nodes")
+ if context.scene.world is not None:
+ if context.scene.world.node_tree is not None:
+ col.prop_search(sp, "sky_texture",
+ context.scene.world.node_tree, "nodes")
+ else:
+ col.label(text="Please activate Use Nodes in the World panel.",
+ icon="ERROR")
+ else:
+ col.label(text="Please select World in the World panel.",
+ icon="ERROR")
class SUNPOS_PT_Location(bpy.types.Panel):
bl_space_type = "PROPERTIES"