Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Some requested features.
Browse files Browse the repository at this point in the history
Ahorn now won't show things from mods in the Everest blacklist.txt (can be disabled in the config).
Disabled the dropdown for decal textures by default (can be enabled in the config).
Added option to disable the dropdown for parallax textures to improve performance.
  • Loading branch information
Cruor authored and Vexatos committed Jul 27, 2021
1 parent b26759e commit ed699c0
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
6 changes: 6 additions & 0 deletions lang/en_gb.lang
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,9 @@ settings.config.names.load_image_meta_yaml=Load Image Meta YAML
settings.config.names.split_atlas_into_smaller_surfaces=Split up Celeste atlases
settings.config.names.hide_styleground_parallax_preview=Hide styleground parallax preview
settings.config.names.tools_brushes_smoother_brushes=Smoother brushing
settings.config.names.use_everest_blacklist=Use Everest blacklist
settings.config.names.show_decal_texture_dropdown=Show decal texture dropdown
settings.config.names.show_parallax_texture_dropdown=Show parallax texture dropdown

settings.config.tooltips.language=The language file being used.
settings.config.tooltips.camera_maximum_zoom=The greatest allowed camera zoom level.
Expand Down Expand Up @@ -700,6 +703,9 @@ settings.config.tooltips.load_image_meta_yaml=Loads the .meta.yaml image metadat
settings.config.tooltips.split_atlas_into_smaller_surfaces=Splits the atlases from Celeste into smaller images for better performance. (Requires restart)
settings.config.tooltips.hide_styleground_parallax_preview=Whether the parallax preview should be hidden. Useful for larger previews.\nCan be toggled by double clicking the preview in styleground window.
settings.config.tooltips.tools_brushes_smoother_brushes=Whether the brush tool should attempt to smoothen movement by approximating lost movement information with lines.
settings.config.tooltips.use_everest_blacklist=Whether Ahorn should respect the Everest blacklist.txt and not load the mods in it.
settings.config.tooltips.show_decal_texture_dropdown=Whether the property menu for decals should have a dropdown for textures. Huge amounts of textures can make the window slow to open.
settings.config.tooltips.show_parallax_texture_dropdown=Whether the stylegrounds window should have a dropdown for parallax textures. Huge amounts of textures can make the window slow to open.


settings.debug.names.DEBUG_MENU_DROPDOWN=Debug menu dropdown
Expand Down
4 changes: 3 additions & 1 deletion src/decals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ function propertyOptions(decal::Maple.Decal, ignores::Array{String, 1}=String[])
ignores = vcat("__name", ignores)
data = Dict(decal)

showEditingChoices = get(config, "show_decal_texture_dropdown", false)

for (attr, value) in data
if attr in ignores
continue
Expand All @@ -134,7 +136,7 @@ function propertyOptions(decal::Maple.Decal, ignores::Array{String, 1}=String[])
name = expandTooltipText(get(names, Symbol(attr), ""))
displayName = isempty(name) ? humanizeVariableName(attr) : name
tooltip = expandTooltipText(get(tooltips, Symbol(attr), ""))
textures = attr == "texture" ? decalTextures() : nothing
textures = showEditingChoices && attr == "texture" ? decalTextures() : nothing
preferredType = get(preferredDecalTypes, attr, typeof(value))

push!(res, Form.suggestOption(displayName, value, dataName=attr, tooltip=tooltip, choices=textures, editable=true, preferredType=preferredType))
Expand Down
43 changes: 41 additions & 2 deletions src/mods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,52 @@ function getAhornModZips()
return targetFolders
end

function getCelesteModDirs()
function getEverestBlacklist()
entries = Set()

celesteDir = get(config, "celeste_dir", "")
blacklistPath = joinpath(celesteDir, "Mods", "blacklist.txt")

if isfile(blacklistPath)
for line in readlines(blacklistPath)
# Lines starting by # are comments
if !startswith(line, "#")
push!(entries, strip(line))
end
end
end

return entries
end

# Good enough for now, can be expanded later
function getModLoadingFilter()
useEverestBlacklist = get(config, "use_everest_blacklist", true)

if useEverestBlacklist
return getEverestBlacklist()
end

return Set()
end

function getCelesteModDirs(ignoreFilters::Bool=false)
if !get(config, "load_plugins_celeste", true)
return String[]
end

celesteDir = get(config, "celeste_dir", "")
modsPath = joinpath(celesteDir, "Mods")
modFilters = getModLoadingFilter()

targetFolders = String[]

if isdir(modsPath)
for fn in readdir(modsPath)
if !ignoreFilters && fn in modFilters
continue
end

if isdir(joinpath(modsPath, fn))
push!(targetFolders, joinpath(modsPath, fn))
end
Expand Down Expand Up @@ -92,18 +126,23 @@ function getModRoot(fn::String)
end
end

function getCelesteModZips()
function getCelesteModZips(ignoreFilters::Bool=false)
if !get(config, "load_plugins_celeste_zip", true)
return String[]
end

celesteDir = get(config, "celeste_dir", "")
modsPath = joinpath(celesteDir, "Mods")
modFilters = getModLoadingFilter()

targetZips = String[]

if isdir(modsPath)
for fn in readdir(modsPath)
if !ignoreFilters && fn in modFilters
continue
end

if isfile(joinpath(modsPath, fn)) && hasExt(fn, ".zip")
push!(targetZips, joinpath(modsPath, fn))
end
Expand Down
16 changes: 12 additions & 4 deletions src/windows/styleground_window.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,21 @@ function moveBackdrop!(target::Array{Maple.Backdrop, 1}, indices::Array{Int, 1},
end

function getParallaxOptions(fields::Dict{String, Any}, langdata::Ahorn.LangData)
options = Ahorn.Form.Option[]
showTextureChoices = get(Ahorn.config, "show_parallax_texture_dropdown", true)

# Make sure we get a new list of valid textures
options = Ahorn.Form.Option[]
dropdownOptions = Dict{String, Any}(
"texture" => sort(spritesToBackgroundTextures(Ahorn.getAtlas("Gameplay"))),
"blendmode" => String[
"additive", "alphablend"
]
)

if showTextureChoices
# Make sure we get a new list of valid textures
texturesSorted = sort(spritesToBackgroundTextures(Ahorn.getAtlas("Gameplay")))
dropdownOptions["texture"] = texturesSorted
end

names = get(langdata, :names)
tooltips = get(langdata, :tooltips)

Expand Down Expand Up @@ -552,7 +557,10 @@ function getParallaxGrid(map::Maple.Map)

Ahorn.connectChanged(parallaxRowHandler, parallaxList)

signal_connect(widget -> draw(preview), textureOption.combobox, "changed")
if get(Ahorn.config, "show_parallax_texture_dropdown", true)
signal_connect(widget -> draw(preview), textureOption.combobox, "changed")
end

signal_connect(widget -> draw(preview), colorOption.entry, "changed")

add_events(preview,
Expand Down

0 comments on commit ed699c0

Please sign in to comment.