Skip to content

Commit

Permalink
Merge pull request #710 from Jowan-Spooner/fix-other-themes
Browse files Browse the repository at this point in the history
Fix other themes
  • Loading branch information
RodZill4 authored Oct 23, 2024
2 parents 855b270 + be8db2b commit a966230
Show file tree
Hide file tree
Showing 17 changed files with 1,877 additions and 6,484 deletions.
14 changes: 11 additions & 3 deletions material_maker/main_window.gd
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const IDLE_FPS_LIMIT_MAX = 100

const RECENT_FILES_COUNT = 15

const THEMES = [ "Dark", "Default", "Green", "Birch", "Mangosteen", "Light", "Modern"]
const THEMES = ["Default Dark", "Default Light", "Classic"]

const MENU : Array[Dictionary] = [
{ menu="File/New material", command="new_material", shortcut="Control+N" },
Expand Down Expand Up @@ -143,7 +143,7 @@ func _ready() -> void:
get_window().size = mm_globals.config.get_value("window", "size")

# Restore the theme
var theme_name : String = "default"
var theme_name: String = "default dark"
if mm_globals.config.has_section_key("window", "theme"):
theme_name = mm_globals.config.get_value("window", "theme")
change_theme(theme_name)
Expand Down Expand Up @@ -470,7 +470,15 @@ func create_menu_set_theme(menu : MMMenuManager.MenuBase) -> void:
menu.connect_id_pressed(self._on_SetTheme_id_pressed)

func change_theme(theme_name) -> void:
theme = load("res://material_maker/theme/"+theme_name+".tres")
if not ResourceLoader.exists("res://material_maker/theme/"+theme_name+".tres"):
theme_name = "default dark"
var _theme = load("res://material_maker/theme/"+theme_name+".tres")
if _theme == theme:
return
if _theme is EnhancedTheme:
_theme.update()
await get_tree().process_frame
theme = _theme
$NodeFactory.on_theme_changed()

func _on_SetTheme_id_pressed(id) -> void:
Expand Down
4 changes: 2 additions & 2 deletions material_maker/main_window.tscn
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[gd_scene load_steps=20 format=3 uid="uid://cgfeik04a5qqs"]

[ext_resource type="Script" path="res://material_maker/main_window.gd" id="1"]
[ext_resource type="Theme" uid="uid://b628lwfk6ig2c" path="res://material_maker/theme/default dark.tres" id="1_2qcba"]
[ext_resource type="Script" path="res://material_maker/main_window_layout.gd" id="2"]
[ext_resource type="PackedScene" uid="uid://eiq3i53x72m2" path="res://addons/flexible_layout/flexible_layout.tscn" id="6_ygla4"]
[ext_resource type="PackedScene" uid="uid://clw8sb0p8webl" path="res://material_maker/windows/add_node_popup/add_node_popup.tscn" id="7"]
[ext_resource type="PackedScene" uid="uid://bnqq3vhwmudkw" path="res://material_maker/projects_panel.tscn" id="7_ih0ps"]
[ext_resource type="Texture2D" uid="uid://c0j4px4n72di5" path="res://material_maker/icons/icons.tres" id="8"]
[ext_resource type="Script" path="res://material_maker/console.gd" id="8_1tb00"]
[ext_resource type="Script" path="res://material_maker/node_factory.gd" id="9"]
[ext_resource type="Theme" uid="uid://3f6cl7v1oyqo" path="res://material_maker/theme/default.tres" id="10"]
[ext_resource type="PackedScene" uid="uid://cp2mbbfmrv6sf" path="res://material_maker/widgets/render_counter/render_counter.tscn" id="11"]
[ext_resource type="PackedScene" uid="uid://dnttargjmhjh8" path="res://material_maker/tools/share/share_button.tscn" id="12"]
[ext_resource type="PackedScene" uid="uid://dmyq6xxfx88m0" path="res://material_maker/tools/environment_manager/environment_manager.tscn" id="13"]
Expand Down Expand Up @@ -104,7 +104,7 @@ grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource("10")
theme = ExtResource("1_2qcba")
theme_type_variation = &"MM_MainBackground"
script = ExtResource("1")
Expand Down
Loading

0 comments on commit a966230

Please sign in to comment.