diff --git a/table/set-toggle.gd b/table/set-toggle.gd index 5419f0ef..6f3d2a9a 100644 --- a/table/set-toggle.gd +++ b/table/set-toggle.gd @@ -15,10 +15,8 @@ func _init() -> void: var style_dark: = style_light.duplicate(true) style_dark.bg_color = Color(0.12, 0.12, 0.12) styles[0] = style_dark - - -func _exit_tree() -> void: - ProjectSettings.disconnect('settings_changed', on_setting_changed) + ProjectSettings.connect('settings_changed', on_setting_changed) + call_deferred('on_setting_changed') func on_setting_changed(): diff --git a/table/table.gd b/table/table.gd index ce2019c4..972acd64 100644 --- a/table/table.gd +++ b/table/table.gd @@ -392,8 +392,6 @@ func add_row(row_types: Array) -> void: _assert(node.get('name') is StringName, 'экземпляр не имеет поля \"name\"') var node_key: String = NODE_KEY_FORMAT % [i_row, i_col] node.name = node_key - if node.has_method('apply_colors'): - node.apply_colors() add_child(node) if allow_set_size: node.custom_minimum_size.x = columns_min_size[i_col] diff --git a/table/ячейка-2.gd b/table/ячейка-2.gd index b2cdbbf2..42adbafc 100644 --- a/table/ячейка-2.gd +++ b/table/ячейка-2.gd @@ -5,7 +5,6 @@ static var init_done: = false func _init() -> void: - ProjectSettings.connect('settings_changed', apply_colors) if not init_done: init_done = true var style_0_light = get_theme_stylebox('normal') @@ -23,6 +22,8 @@ func _init() -> void: style_1_light.bg_color = Color.GRAY styles[0][0] = style_0_dark styles[0][1] = style_1_dark + ProjectSettings.connect('settings_changed', apply_colors) + apply_colors() func apply_colors(): diff --git a/table/ячейка-цвет.gd b/table/ячейка-цвет.gd index 19b38ea8..5635b9c1 100644 --- a/table/ячейка-цвет.gd +++ b/table/ячейка-цвет.gd @@ -5,7 +5,6 @@ static var init_done: = false func _init() -> void: - ProjectSettings.connect('settings_changed', apply_colors) if not init_done: init_done = true var style_light: = get_theme_stylebox('normal') @@ -14,6 +13,8 @@ func _init() -> void: var style_dark: = style_light.duplicate(true) style_dark.bg_color = Color(0.12, 0.12, 0.12) styles[0] = style_dark + ProjectSettings.connect('settings_changed', apply_colors) + apply_colors() func apply_colors():