Skip to content

Commit 4133e11

Browse files
committed
Fix #4: Add shadow toggle
1 parent 7119b7d commit 4133e11

5 files changed

Lines changed: 23 additions & 1 deletion

File tree

RCT Graphics Helper Addon/rct_graphics_helper/general_panel.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111
import math
1212
import os
1313

14+
def ToggleShadows(self, context):
15+
shadow_caster = bpy.data.lamps['ShadowCasterLamp']
16+
if shadow_caster is None:
17+
return False
18+
print(shadow_caster.shadow_method)
19+
if self.cast_shadows:
20+
shadow_caster.shadow_method = "RAY_SHADOW"
21+
shadow_caster.use_diffuse = True
22+
else:
23+
shadow_caster.shadow_method = "NOSHADOW"
24+
shadow_caster.use_diffuse = False
25+
return
26+
1427
class GeneralProperties(bpy.types.PropertyGroup):
1528
script_file = os.path.realpath(__file__)
1629
directory = os.path.dirname(script_file)
@@ -30,10 +43,16 @@ class GeneralProperties(bpy.types.PropertyGroup):
3043

3144
number_of_animation_frames = bpy.props.IntProperty(
3245
name = "Animation Frames",
33-
description = "Number of animation frames. For example in use for swinging, rotating or animated ride vehicles, animated rides, and animated scenery.",
46+
description = "Number of animation frames. For example in use for swinging, rotating or animated ride vehicles, animated rides, and animated scenery",
3447
default = 1,
3548
min = 1)
3649

50+
cast_shadows = bpy.props.BoolProperty(
51+
name = "Cast Shadows",
52+
description = "Control wether or not the render contains shadows. Should be disabled for vehicles",
53+
default = False,
54+
update = ToggleShadows)
55+
3756
out_start_index = bpy.props.IntProperty(
3857
name = "Output Starting Index",
3958
description = "Number to start counting from for the output file names",
@@ -69,6 +88,9 @@ def draw(self, context):
6988
row = layout.row()
7089
row.prop(properties, "number_of_animation_frames")
7190

91+
row = layout.row()
92+
row.prop(properties, "cast_shadows")
93+
7294
row = layout.row()
7395
row.prop(properties, "out_start_index")
7496

1.31 KB
Binary file not shown.

Sample Models/HOTDS/test.blend

4.38 KB
Binary file not shown.

Sample Models/Tram/Tram.blend

160 Bytes
Binary file not shown.

lighting_rig.blend

-72 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)