Skip to content

Commit ce41f62

Browse files
committed
Fix missing invert multi tile order
1 parent ab7f88f commit ce41f62

File tree

15 files changed

+178
-24
lines changed

15 files changed

+178
-24
lines changed

rct-graphics-helper/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from .properties.tiles_properties import register_tiles_properties, unregister_tiles_properties
1515
from .properties.walls_properties import register_walls_properties, unregister_walls_properties
1616
from .properties.general_properties import register_general_properties, unregister_general_properties
17+
from .properties.track_properties import register_track_properties, unregister_track_properties
1718
from .rct_graphics_helper_panel import GraphicsHelperPanel
1819
from . import developer_utils
1920
import importlib
@@ -23,7 +24,7 @@
2324
"name": "RCT Graphics Helper",
2425
"description": "Render tool to replicate RCT graphics",
2526
"author": "Olivier Wervers",
26-
"version": (0, 4, 1),
27+
"version": (0, 4, 6),
2728
"blender": (2, 79, 0),
2829
"location": "Render",
2930
"support": "COMMUNITY",
@@ -50,6 +51,7 @@ def register():
5051
register_tiles_properties()
5152
register_vehicles_properties()
5253
register_walls_properties()
54+
register_track_properties()
5355

5456
print("Registered {} with {} modules".format(
5557
bl_info["name"], len(modules)))
@@ -65,5 +67,6 @@ def unregister():
6567
unregister_tiles_properties()
6668
unregister_vehicles_properties()
6769
unregister_walls_properties()
70+
unregister_track_properties()
6871

6972
print("Unregistered {}".format(bl_info["name"]))

rct-graphics-helper/builders/scene_builder.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def __init__(self):
2323
def build(self, context):
2424
scene = context.scene
2525

26+
self.remove_scene_object(context, "Lamp")
27+
2628
# Root rig object
2729
rig_obj = self.create_scene_object(context, "Rig", None)
2830
rig_obj.location = (0, 0, 0)
@@ -112,7 +114,7 @@ def create_main_light(self, context):
112114
lamp_data.use_diffuse = True
113115
lamp_data.shadow_method = "RAY_SHADOW"
114116
lamp_data.shadow_ray_sample_method = "ADAPTIVE_QMC"
115-
lamp_data.shadow_ray_samples = 2
117+
lamp_data.shadow_ray_samples = 4
116118
lamp_data.shadow_soft_size = 0.5
117119
lamp_data.shadow_adaptive_threshold = 0.001
118120

@@ -129,9 +131,13 @@ def create_filler_light(self, context):
129131
lamp_data = self.create_lamp_data(context, "FillerLight", "SUN")
130132

131133
lamp_data.energy = 0.5
132-
lamp_data.use_specular = False
134+
lamp_data.use_specular = True
133135
lamp_data.use_diffuse = True
134-
lamp_data.shadow_method = "NOSHADOW"
136+
lamp_data.shadow_method = "RAY_SHADOW"
137+
lamp_data.shadow_ray_sample_method = "ADAPTIVE_QMC"
138+
lamp_data.shadow_ray_samples = 4
139+
lamp_data.shadow_soft_size = 0.5
140+
lamp_data.shadow_adaptive_threshold = 0.001
135141

136142
lamp_object = self.create_scene_object(
137143
context, 'FillerLight', lamp_data)
@@ -162,6 +168,12 @@ def create_scene_object(self, context, name, data=None):
162168
context.scene.objects[name], do_unlink=True)
163169
return bpy.data.objects.new(name, data)
164170

171+
def remove_scene_object(self, context, name):
172+
if name in context.scene.objects:
173+
bpy.data.objects.remove(
174+
context.scene.objects[name], do_unlink=True)
175+
176+
165177
def create_lamp_data(self, context, name, type):
166178
name = self.prefix + name + self.suffix
167179
if name in bpy.data.lamps:

rct-graphics-helper/builders/task_builder.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def __init__(self):
2828
self.width = 1
2929
self.length = 1
3030

31+
self.invert_tile_positions = False
32+
3133
self.use_anti_aliasing = True
3234
self.anti_alias_with_background = False
3335
self.maintain_aliased_silhouette = True
@@ -65,7 +67,7 @@ def add_viewing_angles(self, number_of_viewing_angles, animation_frame_index=0,
6567
frame_index = start_output_index + i * animation_frames + j
6668
frame = Frame(frame_index, self.task, angle + self.view_angle,
6769
self.bank_angle, self.vertical_angle, self.mid_angle)
68-
frame.set_multi_tile_size(self.width, self.length)
70+
frame.set_multi_tile_size(self.width, self.length, self.invert_tile_positions)
6971

7072
frame.set_offset(self.offset_x, self.offset_y)
7173

@@ -92,8 +94,12 @@ def add_viewing_angles(self, number_of_viewing_angles, animation_frame_index=0,
9294
if frame.oversized:
9395
output_indices = []
9496
for k in range(frame.width * frame.length):
97+
tile_index = k
98+
if frame.invert_tile_positions:
99+
tile_index = (frame.width * frame.length - k - 1)
95100
output_indices.append(
96-
start_output_index + k * animation_frames * number_of_viewing_angles + j * number_of_viewing_angles + i)
101+
start_output_index + tile_index * animation_frames * number_of_viewing_angles + j * number_of_viewing_angles + i)
102+
97103
frame.set_output_indices(output_indices)
98104

99105
self.angles.append(frame)
@@ -129,9 +135,10 @@ def set_anti_aliasing_with_background(self, use_anti_aliasing, anti_alias_with_b
129135
not anti_alias_with_background) or maintain_aliased_silhouette) and use_anti_aliasing
130136

131137
# Sets the size of the render in tiles
132-
def set_size(self, width, length):
138+
def set_size(self, width, length, invert_tile_positions):
133139
self.width = width
134140
self.length = length
141+
self.invert_tile_positions = invert_tile_positions
135142

136143
# Sets the rotation applied to future render angles
137144
def set_rotation(self, view_angle, bank_angle=0, vertical_angle=0, mid_angle=0):

rct-graphics-helper/frame.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def __init__(self, frame_index, task, view_angle, bank_angle=0, vertical_angle=0
2828
self.width = 1
2929
self.length = 1
3030
self.oversized = False
31+
self.invert_tile_positions = False
3132

3233
self.recolorables = 0
3334

@@ -99,11 +100,13 @@ def set_offset(self, offset_x, offset_y):
99100
self.offset_x = offset_x
100101
self.offset_y = offset_y
101102

102-
def set_multi_tile_size(self, width, length):
103+
def set_multi_tile_size(self, width, length, invert_tile_positions):
103104
self.width = width
104105
self.length = length
105106

106107
self.oversized = self.width > 1 or self.length > 1
108+
if self.oversized:
109+
self.invert_tile_positions = invert_tile_positions
107110

108111
def set_layer(self, layer_name):
109112
self.layer = layer_name

rct-graphics-helper/operators/render_tiles_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def create_task(self, context):
3535
general_props.number_of_recolorables)
3636

3737
self.task_builder.set_size(
38-
props.object_width, props.object_length)
38+
props.object_width, props.object_length, props.invert_tile_positions)
3939

4040
for animationIndex in range(general_props.number_of_animation_frames):
4141
self.task_builder.add_viewing_angles(
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'''
2+
Copyright (c) 2022 RCT Graphics Helper developers
3+
4+
For a complete list of all authors, please refer to the addon's meta info.
5+
Interested in contributing? Visit https://github.com/oli414/Blender-RCT-Graphics
6+
7+
RCT Graphics Helper is licensed under the GNU General Public License version 3.
8+
'''
9+
10+
import bpy
11+
import math
12+
import os
13+
14+
from .render_operator import RCTRender
15+
16+
17+
class RenderTrack(RCTRender, bpy.types.Operator):
18+
bl_idname = "render.rct_track"
19+
bl_label = "Render RCT Track"
20+
21+
def create_task(self, context):
22+
scene = context.scene
23+
props = scene.rct_graphics_helper_track_properties
24+
general_props = scene.rct_graphics_helper_general_properties
25+
26+
# Create the list of frames with our parameters
27+
self.task_builder.clear()
28+
return self.task_builder.create_task(context)

rct-graphics-helper/operators/vehicle_render_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def create_task(self, context):
2727
self.task_builder.set_anti_aliasing_with_background(
2828
context.scene.render.use_antialiasing, general_props.anti_alias_with_background, general_props.maintain_aliased_silhouette)
2929
self.task_builder.set_output_index(general_props.out_start_index)
30-
self.task_builder.set_size(1, 1)
30+
self.task_builder.set_size(1, 1, False)
3131

3232
# Add vehicle frames
3333
self.task_builder.set_recolorables(

rct-graphics-helper/processors/sub_processes/frame_processors/tile_indices_render_processor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def process(self, frame, callback):
4444
meta_render_output = frame.get_meta_render_output_file_name(
4545
output_suffix)
4646

47+
if frame.oversized:
48+
self.renderer.set_multi_tile_size(frame.width, frame.length)
49+
else:
50+
self.renderer.set_multi_tile_size(1, 1)
4751
self.renderer.set_layer(frame.layer)
4852
self.renderer.set_aa(self.with_anti_aliasing)
4953
self.renderer.set_meta_output_path(

rct-graphics-helper/properties/general_properties.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class GeneralProperties(bpy.types.PropertyGroup):
3939

4040
cast_shadows = bpy.props.BoolProperty(
4141
name="Shadows",
42-
description="Control wether or not the render contains shadows.",
42+
description="Control whether the lights should cast shadows.",
4343
default=True)
4444

4545
anti_alias_with_background = bpy.props.BoolProperty(
@@ -48,8 +48,8 @@ class GeneralProperties(bpy.types.PropertyGroup):
4848
default=False)
4949

5050
maintain_aliased_silhouette = bpy.props.BoolProperty(
51-
name="Maintain Aliased Silhouette",
52-
description="Maintains the aliased image's silhouette.",
51+
name="Maintain Aliased Silhouette (For modular pieces)",
52+
description="The image is anti-aliased against the background, but is masked using the aliased silhoutte.",
5353
default=False)
5454

5555
out_start_index = bpy.props.IntProperty(
@@ -101,7 +101,9 @@ class GeneralProperties(bpy.types.PropertyGroup):
101101
("VEHICLE", "Vehicle",
102102
"Renders a vehicle from the necesssary angles given a set of track ability flags.", 2),
103103
("WALLS", "Walls",
104-
"Renders a wall piece.", 3)
104+
"Renders a wall piece.", 3),
105+
("TRACK", "Track",
106+
"Renders track pieces.", 4)
105107
)
106108
)
107109

@@ -112,13 +114,13 @@ class GeneralProperties(bpy.types.PropertyGroup):
112114

113115
build_gx = bpy.props.BoolProperty(
114116
name="Generate GX (optimized sprite file)",
115-
description="Whether or not to create a .dat sprite file.",
116-
default=True)
117+
description="Whether or not to create a .dat sprite file. Having GXC installed is required.",
118+
default=False)
117119

118120
build_assetpack = bpy.props.BoolProperty(
119121
name="Generate the asset pack file",
120122
description="Whether or not to the ORCT2 asset pack file",
121-
default=True)
123+
default=False)
122124

123125
copy_assetpack_to_orct2 = bpy.props.BoolProperty(
124126
name="Copy to OpenRCT2",
@@ -127,12 +129,12 @@ class GeneralProperties(bpy.types.PropertyGroup):
127129

128130
build_parkobj = bpy.props.BoolProperty(
129131
name="Generate .parkobj file",
130-
description="Automatically build the .parkobj file.",
132+
description="Automatically build the .parkobj file. An object.json file with the object description is required in the output folder.",
131133
default=False)
132134

133135
copy_parkobj_to_orct2 = bpy.props.BoolProperty(
134136
name="Copy to OpenRCT2",
135-
description="Copy the generated .parkobj file to the ORCT2 objects folder.",
137+
description="Copy the generated .parkobj file to the ORCT2 objects folder. Linking your OpenRCT2 Documents folder is required in the add-on preferences.",
136138
default=False)
137139

138140

rct-graphics-helper/properties/tiles_properties.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,25 @@
1919
class TilesProperties(bpy.types.PropertyGroup):
2020
viewing_angles = bpy.props.IntProperty(
2121
name="Viewing Angles",
22-
description="Number of viewing angles to render for",
22+
description="Number of viewing angles to render for.",
2323
default=4,
2424
min=1)
2525

2626
object_width = bpy.props.IntProperty(
2727
name="Object Width",
28-
description="Width of the object in tiles. Only used for large scenery",
28+
description="Width of the object in tiles. Only used for large scenery.",
2929
default=1,
3030
min=1)
3131
object_length = bpy.props.IntProperty(
3232
name="Object Length",
33-
description="Length of the object in tiles. Only used for large scenery",
33+
description="Length of the object in tiles. Only used for large scenery.",
3434
default=1,
3535
min=1)
36+
37+
invert_tile_positions = bpy.props.BoolProperty(
38+
name="Invert Tile Positions",
39+
description="Some large scenery pieces extend into the negative axis, whilst others extends into the positive axis. Use this setting to switch between the two.",
40+
default=False)
3641

3742

3843
def register_tiles_properties():

0 commit comments

Comments
 (0)