You can now set the viewport shadow from the sun angle, useful for shadow studies

This commit is contained in:
Dion Moult
2020-09-01 22:26:57 +10:00
parent 55a54098dd
commit 2e6150b5ef
3 changed files with 17 additions and 0 deletions
@@ -193,6 +193,7 @@ if bpy is not None:
operator.SelectScheduleFile,
operator.BuildSchedule,
operator.AddScheduleToSheet,
operator.SetViewportShadowFromSun,
prop.StrProperty,
prop.Variable,
prop.Role,
@@ -3831,3 +3831,17 @@ class AddScheduleToSheet(bpy.types.Operator):
props.schedules[props.active_schedule_index].name,
props.sheets[props.active_sheet_index].name)
return {'FINISHED'}
class SetViewportShadowFromSun(bpy.types.Operator):
bl_idname = 'bim.set_viewport_shadow_from_sun'
bl_label = 'Set Viewport Shadow from Sun'
def execute(self, context):
# The vector used for the light direction is a bit funny
mat = Matrix(((-1.0, 0.0, 0.0, 0.0),
(0.0, 0, 1.0, 0.0),
(-0.0, -1.0, 0, 0.0),
(0.0, 0.0, 0.0, 1.0)))
context.scene.display.light_direction = mat.inverted() @ (context.active_object.matrix_world.to_quaternion() @ Vector((0,0,-1)))
return {'FINISHED'}
@@ -1988,6 +1988,8 @@ class BIM_PT_misc_utilities(Panel):
row.prop(props, 'override_colour', text='')
row = layout.row(align=True)
row.operator("bim.set_override_colour")
row = layout.row(align=True)
row.operator("bim.set_viewport_shadow_from_sun")
def ifc_units(self, context):