Skip to content

Commit 7119b7d

Browse files
committed
Fix space in path not working. Add configurable palette
1 parent 7cc7275 commit 7119b7d

7 files changed

Lines changed: 41 additions & 48 deletions

File tree

RCT Graphics Helper Addon/rct_graphics_helper/general_panel.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@
1212
import os
1313

1414
class GeneralProperties(bpy.types.PropertyGroup):
15+
script_file = os.path.realpath(__file__)
16+
directory = os.path.dirname(script_file)
17+
default_palette_path = directory + "\\res\\palette.gif"
18+
palette_path = bpy.props.StringProperty(
19+
name="Palette Path",
20+
description="Palette to dither to",
21+
maxlen= 1024,
22+
subtype='FILE_PATH',
23+
default= default_palette_path)
24+
25+
number_of_rider_sets = bpy.props.IntProperty(
26+
name = "Rider Sets",
27+
description = "Number of unqique sets of riders. Usually just the amount of peeps for this vehicle/ride. Some rides for example only expect peeps in sets of 2 to lower the amount of required graphics. This is often done on vehicles which carry 4 or more riders.",
28+
default = 0,
29+
min = 0)
30+
31+
number_of_animation_frames = bpy.props.IntProperty(
32+
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.",
34+
default = 1,
35+
min = 1)
36+
1537
out_start_index = bpy.props.IntProperty(
1638
name = "Output Starting Index",
1739
description = "Number to start counting from for the output file names",
@@ -38,6 +60,15 @@ def draw(self, context):
3860
scene = context.scene
3961
properties = scene.rct_graphics_helper_general_properties
4062

63+
row = layout.row()
64+
row.prop(properties, "palette_path")
65+
66+
row = layout.row()
67+
row.prop(properties, "number_of_rider_sets")
68+
69+
row = layout.row()
70+
row.prop(properties, "number_of_animation_frames")
71+
4172
row = layout.row()
4273
row.prop(properties, "out_start_index")
4374

RCT Graphics Helper Addon/rct_graphics_helper/render_task.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,11 @@ def rotate_rig(context, angle, verAngle=0, bankedAngle=0, midAngle=0):
4141
return True
4242

4343
def post_render(context, index):
44-
magickPath = "magick"
45-
outputPath = get_output_path(context, index)
44+
magick_path = "magick"
45+
output_path = get_output_path(context, index)
4646

47-
script_file = os.path.realpath(__file__)
48-
directory = os.path.dirname(script_file)
49-
palettePath = directory + "\\res\\palette.gif"
50-
result = str(subprocess.check_output(magickPath + " " + outputPath + " -fuzz 0 -fill none -opaque rgb(57,59,57) -quantize RGB -dither FloydSteinberg -define dither:diffusion-amount=30% -remap \"" + palettePath + "\" -colorspace sRGB -bordercolor none -border 1 -trim -format \"%[fx:page.x - page.width/2] %[fx:page.y - page.height/2]\" -write info: " + outputPath, shell=True))
47+
palette_path = context.scene.rct_graphics_helper_general_properties.palette_path
48+
result = str(subprocess.check_output(magick_path + " \"" + output_path + "\" -fuzz 0 -fill none -opaque rgb(57,59,57) -quantize RGB -dither FloydSteinberg -define dither:diffusion-amount=30% -remap \"" + palette_path + "\" -colorspace sRGB -bordercolor none -border 1 -trim -format \"%[fx:page.x - page.width/2] %[fx:page.y - page.height/2]\" -write info: \"" + output_path + "\"", shell=True))
5149

5250
offset_file = open(get_offset_output_path(context, index), "w")
5351
offset_file.write(result[2:][:-1])
857 Bytes
Loading
871 Bytes
Loading
886 Bytes
Loading

RCT Graphics Helper Addon/rct_graphics_helper/static_panel.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def execute(self, context):
2828

2929
self.renderTask = RenderTask(context.scene.rct_graphics_helper_general_properties.out_start_index, context)
3030

31-
for i in range(self.props.number_of_rider_sets + 1):
32-
self.renderTask.add([[ False, context.scene.rct_graphics_helper_static_properties.viewing_angles, 0, 0, 0 ]], i, False, 0, self.props.number_of_animation_frames)
31+
for i in range(context.scene.rct_graphics_helper_general_properties.number_of_rider_sets + 1):
32+
self.renderTask.add([[ False, context.scene.rct_graphics_helper_static_properties.viewing_angles, 0, 0, 0 ]], i, False, 0, context.scene.rct_graphics_helper_general_properties.number_of_animation_frames)
3333

3434
return super(RenderStatic, self).execute(context)
3535

@@ -43,18 +43,6 @@ class StaticProperties(bpy.types.PropertyGroup):
4343
description = "Number of viewing angles to render for",
4444
default = 4,
4545
min = 1)
46-
47-
number_of_rider_sets = bpy.props.IntProperty(
48-
name = "Rider Sets",
49-
description = "Number of unqique sets of riders. Usually just the amount of riders for this vehicle. Some rides for example only expect rides in sets of 2 to lower the amount of required graphics. This is often done on vehicles which carry 4 or more riders.",
50-
default = 0,
51-
min = 0)
52-
53-
number_of_animation_frames = bpy.props.IntProperty(
54-
name = "Animation Frames",
55-
description = "Number of animation frames. For example in use for animated scenery and/or rides.",
56-
default = 1,
57-
min = 1)
5846

5947

6048
class StaticPanel(bpy.types.Panel):
@@ -71,12 +59,6 @@ def draw(self, context):
7159

7260
row = layout.row()
7361
row.prop(properties, "viewing_angles")
74-
75-
row = layout.row()
76-
row.prop(properties, "number_of_rider_sets")
77-
78-
row = layout.row()
79-
row.prop(properties, "number_of_animation_frames")
8062

8163
row = layout.row()
8264
row.operator("render.rct_static", text = "Render Static Object")

RCT Graphics Helper Addon/rct_graphics_helper/vehicles_panel.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def property_value(self, key):
3737

3838
def append_angles_to_rendertask(self, render_layer, inverted):
3939
start_anim = 0
40-
if self.props.number_of_animation_frames != 1:
40+
if self.scene.rct_graphics_helper_general_properties.number_of_animation_frames != 1:
4141
start_anim = 4
42-
anim_count = self.props.number_of_animation_frames
42+
anim_count = self.scene.rct_graphics_helper_general_properties.number_of_animation_frames
4343
for i in range(len(track_angle_sections_names)):
4444
key = track_angle_sections_names[i]
4545
track_section = track_angle_sections[key]
@@ -70,7 +70,7 @@ def execute(self, context):
7070
self.renderTask = RenderTask(context.scene.rct_graphics_helper_general_properties.out_start_index, context)
7171

7272

73-
for i in range(self.props.number_of_rider_sets + 1):
73+
for i in range(context.scene.rct_graphics_helper_general_properties.number_of_rider_sets + 1):
7474
self.append_angles_to_rendertask(i, False)
7575

7676
if self.props.inverted_set:
@@ -160,25 +160,13 @@ class VehicleProperties(bpy.types.PropertyGroup):
160160

161161
restraint_animation = bpy.props.BoolProperty(
162162
name = "Restraint Animation",
163-
description = "Render restraint animation",
163+
description = "Render with restraint animation. The restrain animation is 3 frames long and starts at frame 1",
164164
default = False)
165165

166166
inverted_set = bpy.props.BoolProperty(
167167
name = "Inverted Set",
168168
description = "Used for rides which can invert for an extended amount of time like the flying and lay-down rollercoasters",
169169
default = False)
170-
171-
number_of_rider_sets = bpy.props.IntProperty(
172-
name = "Rider Sets",
173-
description = "Number of unqique sets of riders. Usually just the amount of riders for this vehicle. Some rides for example only expect rides in sets of 2 to lower the amount of required graphics. This is often done on vehicles which carry 4 or more riders.",
174-
default = 0,
175-
min = 0)
176-
177-
number_of_animation_frames = bpy.props.IntProperty(
178-
name = "Animation Frames",
179-
description = "Number of animation frames. For example in use for swinging, rotating or animated ride vehicles.",
180-
default = 1,
181-
min = 1)
182170

183171
class VehiclesPanel(bpy.types.Panel):
184172
bl_label = "RCT Vehicles"
@@ -210,12 +198,6 @@ def draw(self, context):
210198
row = layout.row()
211199
row.prop(properties, "inverted_set")
212200

213-
row = layout.row()
214-
row.prop(properties, "number_of_rider_sets")
215-
216-
row = layout.row()
217-
row.prop(properties, "number_of_animation_frames")
218-
219201
row = layout.row()
220202
row.operator("render.rct_vehicle", text = "Render Vehicle")
221203

0 commit comments

Comments
 (0)