Skip to content

Commit

Permalink
Adjust preset bake quality settings, support new custom level flag
Browse files Browse the repository at this point in the history
Also fixed minor bug with 'batch object properties' utility referencing nonexistent fields
  • Loading branch information
denetii committed Apr 13, 2019
1 parent f4db7ed commit 4ca9903
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 31 deletions.
20 changes: 11 additions & 9 deletions bake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,20 +1438,20 @@ def bake_thug_lightmaps(meshes, context):
scene.render.bake_margin = 2 # Used to be bake_margin
if ob.thug_lightmap_quality != 'Custom':
if ob.thug_lightmap_quality == 'Draft':
scene.cycles.samples = 16
scene.cycles.samples = 32
scene.cycles.max_bounces = 2
if ob.thug_lightmap_quality == 'Preview':
scene.cycles.samples = 32
scene.cycles.max_bounces = 4
scene.cycles.samples = 64
scene.cycles.max_bounces = 2
if ob.thug_lightmap_quality == 'Good':
scene.cycles.samples = 108
scene.cycles.max_bounces = 5
scene.cycles.samples = 128
scene.cycles.max_bounces = 3
if ob.thug_lightmap_quality == 'High':
scene.cycles.samples = 225
scene.cycles.max_bounces = 6
scene.cycles.samples = 256
scene.cycles.max_bounces = 3
if ob.thug_lightmap_quality == 'Ultra':
scene.cycles.samples = 450
scene.cycles.max_bounces = 8
scene.cycles.samples = 512
scene.cycles.max_bounces = 3
print("Using {} bake quality. Samples: {}, bounces: {}".format(ob.thug_lightmap_quality, scene.cycles.samples, scene.cycles.max_bounces))
if scene.thug_bake_type == 'SHADOW':
bpy.ops.object.bake(type='SHADOW')
Expand Down Expand Up @@ -2827,6 +2827,8 @@ def draw(self, context):
box.row().prop(ob, "thug_lightmap_resolution")
box.row().prop(ob, "thug_lightmap_quality")
box.row().prop(ob, "thug_lightmap_type", expand=True)
else:
box.row().prop(ob, "thug_lightmap_quality")

tmp_row = box.row().split()
tmp_row.column().operator(BakeLightmaps.bl_idname, text=BakeLightmaps.bl_label, icon='LIGHTPAINT')
Expand Down
2 changes: 2 additions & 0 deletions level_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def export_level_manifest_json(filename, directory, operator, level_info):
outp.write("\t\"FLAG_DISABLE_GOALEDITOR\": {},\n".format(("true" if level_info.level_flag_nogoaleditor else "false")))
outp.write("\t\"FLAG_DISABLE_GOALATTACK\": {},\n".format(("true" if level_info.level_flag_nogoalattack else "false")))
outp.write("\t\"FLAG_NO_PRX\": {},\n".format(("true" if level_info.level_flag_noprx else "false")))
outp.write("\t\"FLAG_IS_BIG_LEVEL\": {},\n".format(("true" if level_info.level_flag_biglevel else "false")))

outp.write("}\n")

Expand Down Expand Up @@ -180,6 +181,7 @@ def draw(self, context):
self.layout.row().label(text="Level Flags", icon='INFO')
box = self.layout.box().column(True)
box.row().prop(scene.thug_level_props, "level_flag_offline")
box.row().prop(scene.thug_level_props, "level_flag_biglevel")
box.row().prop(scene.thug_level_props, "level_flag_noprx")
box.row().prop(scene.thug_level_props, "level_flag_indoor")
box.row().prop(scene.thug_level_props, "level_flag_nosun")
Expand Down
25 changes: 13 additions & 12 deletions scene_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,10 +1053,10 @@ class THUGTODProps(bpy.types.PropertyGroup):
#- Properties for the entire level
#----------------------------------------------------------------------------------
class THUGLevelProps(bpy.types.PropertyGroup):
level_name = StringProperty(name="Level Name", description="Name of your level, used for in-game menus.")
scene_name = StringProperty(name="Scene Name", description="Short name referenced by scripts.")
creator_name = StringProperty(name="Creator Name", description="Name of the person(s) who created this level.")
level_skybox = StringProperty(name="Skybox Name", description="Name of the skybox to be used with this level.")
level_name = StringProperty(name="Level Name", description="Name of your level, used for in-game menus")
scene_name = StringProperty(name="Scene Name", description="Short name referenced by scripts")
creator_name = StringProperty(name="Creator Name", description="Name of the person(s) who created this level")
level_skybox = StringProperty(name="Skybox Name", description="Name of the skybox to be used with this level")

export_props = PointerProperty(type=THUGLevelExportProps)

Expand All @@ -1081,32 +1081,33 @@ class THUGLevelProps(bpy.types.PropertyGroup):
default=(0.5, 0.5, 0.5, 0.25),
size=4,
min=0.0, max=1.0,
description="Light color, with alpha used as the mod value.")
description="Light color, with alpha used as the mod value")
level_light0_rgba = FloatVectorProperty(name="Light #1: Color/Mod",
subtype='COLOR',
default=(0.5, 0.5, 0.5, 0.25),
size=4,
min=0.0, max=1.0,
description="Light color, with alpha used as the mod value.")
description="Light color, with alpha used as the mod value")
level_light0_headpitch = FloatVectorProperty(name="Heading/Pitch", size=2, soft_min=0, soft_max=360, default=(0, 0))
level_light1_rgba = FloatVectorProperty(name="Light #2: Color/Mod",
subtype='COLOR',
default=(0.5, 0.5, 0.5, 0.25),
size=4,
min=0.0, max=1.0,
description="Light color, with alpha used as the mod value.")
description="Light color, with alpha used as the mod value")
level_light1_headpitch = FloatVectorProperty(name="Heading/Pitch", size=2, soft_min=0, soft_max=360, default=(0, 0))

level_flag_offline = BoolProperty(name="Offline Only", description="This level is not enabled for online play.", default=False)
level_flag_indoor = BoolProperty(name="Indoor", description="(THUG PRO only) This level is indoor.", default=False)
level_flag_nosun = BoolProperty(name="No Sun", description="(THUG PRO only) Don't display the dynamic sun in this level.", default=False)
level_flag_defaultsky = BoolProperty(name="Default Sky", description="(THUG PRO only) Use the default skybox.", default=False)
level_flag_wallridehack = BoolProperty(name="Wallride Hack", description="(THUG PRO only) Automatically makes all walls wallridable.", default=False)
level_flag_offline = BoolProperty(name="Offline Only", description="This level is not enabled for online play", default=False)
level_flag_indoor = BoolProperty(name="Indoor", description="(THUG PRO only) This level is indoor", default=False)
level_flag_nosun = BoolProperty(name="No Sun", description="(THUG PRO only) Don't display the dynamic sun in this level", default=False)
level_flag_defaultsky = BoolProperty(name="Default Sky", description="(THUG PRO only) Use the default skybox", default=False)
level_flag_wallridehack = BoolProperty(name="Wallride Hack", description="(THUG PRO only) Automatically makes all walls wallridable", default=False)
level_flag_nobackfacehack = BoolProperty(name="No Backface Hack", description="(THUG PRO only)", default=False)
level_flag_modelsinprx = BoolProperty(name="Models in scripts .prx", description="(THUG PRO only)", default=False)
level_flag_nogoaleditor = BoolProperty(name="Disable goal editor", description="(THUG PRO only)", default=False)
level_flag_nogoalattack = BoolProperty(name="Disable goal attack", description="(THUG PRO only)", default=False)
level_flag_noprx = BoolProperty(name="Don't use prx files", description="(THUG PRO only) This level uses uncompressed files, not packed in .prx files", default=False)
level_flag_biglevel = BoolProperty(name="Big Level", description="(THUG PRO only) Use extended online position broadcast limits", default=False)

# METHODS
#############################################
Expand Down
10 changes: 0 additions & 10 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,6 @@ def draw(self, context):
col.row().prop(self, "thug_lightgroup")
col.row().prop(self, "thug_is_trickobject")
col.row().prop(self, "thug_cluster_name")
col.row().prop(self, "triggerscript_type")
col.row().prop_search(
self,
"target_node",
context.window_manager,
"thug_all_restarts")
col.row().prop_search(
self, "custom_name",
bpy.data,
"texts")

#----------------------------------------------------------------------------------
class THUGUtilBatchImport(bpy.types.Operator):
Expand Down

0 comments on commit 4ca9903

Please sign in to comment.