-Project/Editor settings now use new inspector

-Project/Editor settings now show tooltips properly
-Settings thar require restart now will show a restart warning
-Video driver is now visible all the time, can be changed easily
-Added function to request current video driver
This commit is contained in:
Juan Linietsky 2018-07-19 18:58:15 -03:00
parent 76bfe14e00
commit c69de2ba46
47 changed files with 1055 additions and 81 deletions

View file

@ -342,7 +342,7 @@ MessageQueue::MessageQueue() {
buffer_end = 0;
buffer_max_used = 0;
buffer_size = GLOBAL_DEF("memory/limits/message_queue/max_size_kb", DEFAULT_QUEUE_SIZE_KB);
buffer_size = GLOBAL_DEF_RST("memory/limits/message_queue/max_size_kb", DEFAULT_QUEUE_SIZE_KB);
buffer_size *= 1024;
buffer = memnew_arr(uint8_t, buffer_size);
}

View file

@ -659,6 +659,18 @@ const char *OS::get_audio_driver_name(int p_driver) const {
return AudioDriverManager::get_driver(p_driver)->get_name();
}
void OS::set_restart_on_exit(bool p_restart, const List<String> &p_restart_arguments) {
restart_on_exit = p_restart;
restart_commandline = p_restart_arguments;
}
bool OS::is_restart_on_exit_set() const {
return restart_on_exit;
}
List<String> OS::get_restart_on_exit_argumens() const {
return restart_commandline;
}
OS::OS() {
void *volatile stack_bottom;

View file

@ -74,6 +74,9 @@ class OS {
CompositeLogger *_logger;
bool restart_on_exit;
List<String> restart_commandline;
protected:
void _set_logger(CompositeLogger *p_logger);
@ -182,7 +185,7 @@ public:
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
virtual int get_current_video_driver() const = 0;
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
@ -496,6 +499,11 @@ public:
bool is_layered_allowed() const { return _allow_layered; }
bool is_hidpi_allowed() const { return _allow_hidpi; }
void set_restart_on_exit(bool p_restart, const List<String> &p_restart_arguments);
bool is_restart_on_exit_set() const;
List<String> get_restart_on_exit_argumens() const;
OS();
virtual ~OS();
};

View file

@ -105,6 +105,11 @@ void ProjectSettings::set_initial_value(const String &p_name, const Variant &p_v
ERR_FAIL_COND(!props.has(p_name));
props[p_name].initial = p_value;
}
void ProjectSettings::set_restart_if_changed(const String &p_name, bool p_restart) {
ERR_FAIL_COND(!props.has(p_name));
props[p_name].restart_if_changed = p_restart;
}
String ProjectSettings::globalize_path(const String &p_path) const {
@ -225,6 +230,9 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
else
vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE;
if (v->restart_if_changed) {
vc.flags |= PROPERTY_USAGE_RESTART_IF_CHANGED;
}
vclist.insert(vc);
}
@ -817,7 +825,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
return OK;
}
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) {
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed) {
Variant ret;
if (!ProjectSettings::get_singleton()->has_setting(p_var)) {
@ -827,6 +835,7 @@ Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) {
ProjectSettings::get_singleton()->set_initial_value(p_var, p_default);
ProjectSettings::get_singleton()->set_builtin_order(p_var);
ProjectSettings::get_singleton()->set_restart_if_changed(p_var, p_restart_if_changed);
return ret;
}
@ -1080,7 +1089,6 @@ ProjectSettings::ProjectSettings() {
custom_prop_info["rendering/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/threads/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe,Single-Safe,Multi-Threaded");
custom_prop_info["physics/2d/thread_model"] = PropertyInfo(Variant::INT, "physics/2d/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe,Single-Safe,Multi-Threaded");
custom_prop_info["rendering/quality/intended_usage/framebuffer_allocation"] = PropertyInfo(Variant::INT, "rendering/quality/intended_usage/framebuffer_allocation", PROPERTY_HINT_ENUM, "2D,2D Without Sampling,3D,3D Without Effects");
GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_mode", 2);
GLOBAL_DEF("debug/settings/profiler/max_functions", 16384);

View file

@ -59,11 +59,13 @@ protected:
Variant initial;
bool hide_from_editor;
bool overridden;
bool restart_if_changed;
VariantContainer() :
order(0),
persist(false),
hide_from_editor(false),
overridden(false) {
restart_if_changed = false;
}
VariantContainer(const Variant &p_variant, int p_order, bool p_persist = false) :
order(p_order),
@ -71,6 +73,7 @@ protected:
variant(p_variant),
hide_from_editor(false),
overridden(false) {
restart_if_changed = false;
}
};
@ -120,6 +123,7 @@ public:
String globalize_path(const String &p_path) const;
void set_initial_value(const String &p_name, const Variant &p_value);
void set_restart_if_changed(const String &p_name, bool p_restart);
bool property_can_revert(const String &p_name);
Variant property_get_revert(const String &p_name);
@ -158,8 +162,9 @@ public:
};
//not a macro any longer
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default);
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed = false);
#define GLOBAL_DEF(m_var, m_value) _GLOBAL_DEF(m_var, m_value)
#define GLOBAL_DEF_RST(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true)
#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get(m_var)
#endif

View file

@ -191,7 +191,7 @@ void register_core_types() {
void register_core_settings() {
//since in register core types, globals may not e present
GLOBAL_DEF("network/limits/packet_peer_stream/max_buffer_po2", (16));
GLOBAL_DEF_RST("network/limits/packet_peer_stream/max_buffer_po2", (16));
}
void register_core_singletons() {

View file

@ -102,7 +102,7 @@ Error AudioDriverCoreAudio::init() {
break;
}
mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
zeromem(&strdesc, sizeof(strdesc));
strdesc.mFormatID = kAudioFormatLinearPCM;
@ -117,7 +117,7 @@ Error AudioDriverCoreAudio::init() {
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &strdesc, sizeof(strdesc));
ERR_FAIL_COND_V(result != noErr, FAILED);
int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
// Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels)
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);

View file

@ -1895,7 +1895,7 @@ void RasterizerCanvasGLES3::initialize() {
}
{
uint32_t poly_size = GLOBAL_DEF("rendering/limits/buffers/canvas_polygon_buffer_size_kb", 128);
uint32_t poly_size = GLOBAL_DEF_RST("rendering/limits/buffers/canvas_polygon_buffer_size_kb", 128);
poly_size *= 1024; //kb
poly_size = MAX(poly_size, (2 + 2 + 4) * 4 * sizeof(float));
glGenBuffers(1, &data.polygon_buffer);
@ -1942,7 +1942,7 @@ void RasterizerCanvasGLES3::initialize() {
glGenVertexArrays(1, &data.polygon_buffer_pointer_array);
uint32_t index_size = GLOBAL_DEF("rendering/limits/buffers/canvas_polygon_index_buffer_size_kb", 128);
uint32_t index_size = GLOBAL_DEF_RST("rendering/limits/buffers/canvas_polygon_index_buffer_size_kb", 128);
index_size *= 1024; //kb
glGenBuffers(1, &data.polygon_index_buffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);

View file

@ -4866,7 +4866,7 @@ void RasterizerSceneGLES3::initialize() {
glBufferData(GL_UNIFORM_BUFFER, sizeof(State::EnvironmentRadianceUBO), &state.env_radiance_ubo, GL_DYNAMIC_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
render_list.max_elements = GLOBAL_DEF("rendering/limits/rendering/max_renderable_elements", (int)RenderList::DEFAULT_MAX_ELEMENTS);
render_list.max_elements = GLOBAL_DEF_RST("rendering/limits/rendering/max_renderable_elements", (int)RenderList::DEFAULT_MAX_ELEMENTS);
if (render_list.max_elements > 1000000)
render_list.max_elements = 1000000;
if (render_list.max_elements < 1024)

View file

@ -7463,7 +7463,7 @@ void RasterizerStorageGLES3::initialize() {
{
//transform feedback buffers
uint32_t xf_feedback_size = GLOBAL_DEF("rendering/limits/buffers/blend_shape_max_buffer_size_kb", 4096);
uint32_t xf_feedback_size = GLOBAL_DEF_RST("rendering/limits/buffers/blend_shape_max_buffer_size_kb", 4096);
for (int i = 0; i < 2; i++) {
glGenBuffers(1, &resources.transform_feedback_buffers[i]);

View file

@ -155,7 +155,7 @@ Error AudioDriverPulseAudio::init_device() {
break;
}
int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
pa_buffer_size = buffer_frames * pa_map.channels;
@ -204,7 +204,7 @@ Error AudioDriverPulseAudio::init() {
thread_exited = false;
exit_thread = false;
mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
pa_ml = pa_mainloop_new();
ERR_FAIL_COND_V(pa_ml == NULL, ERR_CANT_OPEN);

View file

@ -88,7 +88,7 @@ Error AudioDriverRtAudio::init() {
// FIXME: Adapt to the OutputFormat -> SpeakerMode change
/*
String channels = GLOBAL_DEF("audio/output","stereo");
String channels = GLOBAL_DEF_RST("audio/output","stereo");
if (channels=="5.1")
output_format=OUTPUT_5_1;
@ -108,7 +108,7 @@ Error AudioDriverRtAudio::init() {
options.numberOfBuffers = 4;
parameters.firstChannel = 0;
mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
unsigned int buffer_frames = closest_power_of_2(latency * mix_rate / 1000);

View file

@ -318,7 +318,7 @@ Error AudioDriverWASAPI::finish_device() {
Error AudioDriverWASAPI::init() {
mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
Error err = init_device();
if (err != OK) {

View file

@ -50,7 +50,7 @@ Error AudioDriverXAudio2::init() {
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", 25);
int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
buffer_size = closest_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);

View file

@ -1507,12 +1507,19 @@ void EditorInspector::update_tree() {
checked = p.usage & PROPERTY_USAGE_CHECKED;
}
if (p.usage & PROPERTY_USAGE_RESTART_IF_CHANGED) {
restart_request_props.insert(p.name);
}
String doc_hint;
if (use_doc_hints) {
StringName classname = object->get_class_name();
StringName propname = p.name;
if (object_class != String()) {
classname = object_class;
}
StringName propname = property_prefix + p.name;
String descr;
bool found = false;
@ -1580,9 +1587,9 @@ void EditorInspector::update_tree() {
ep->connect("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED);
ep->connect("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED);
if (doc_hint != String()) {
ep->set_tooltip(TTR("Property: ") + p.name + "\n\n" + doc_hint);
ep->set_tooltip(TTR("Property: ") + property_prefix + p.name + "\n\n" + doc_hint);
} else {
ep->set_tooltip(TTR("Property: ") + p.name);
ep->set_tooltip(TTR("Property: ") + property_prefix + p.name);
}
ep->set_draw_red(draw_red);
ep->set_use_folding(use_folding);
@ -1659,6 +1666,7 @@ void EditorInspector::_clear() {
editor_property_map.clear();
sections.clear();
pending.clear();
restart_request_props.clear();
}
void EditorInspector::refresh() {
@ -1902,6 +1910,10 @@ void EditorInspector::_property_changed(const String &p_path, const Variant &p_v
if (changing)
this->changing--;
if (restart_request_props.has(p_path)) {
emit_signal("restart_requested");
}
}
void EditorInspector::_property_changed_update_all(const String &p_path, const Variant &p_value) {
@ -1921,6 +1933,9 @@ void EditorInspector::_multiple_properties_changed(Vector<String> p_paths, Array
undo_redo->create_action(TTR("Set Multiple:") + " " + names, UndoRedo::MERGE_ENDS);
for (int i = 0; i < p_paths.size(); i++) {
_edit_set(p_paths[i], p_values[i], false, "");
if (restart_request_props.has(p_paths[i])) {
emit_signal("restart_requested");
}
}
changing++;
undo_redo->commit_action();
@ -1993,6 +2008,8 @@ void EditorInspector::_property_selected(const String &p_path, int p_focusable)
E->get()->deselect();
}
}
emit_signal("property_selected", p_path);
}
void EditorInspector::_object_id_selected(const String &p_path, ObjectID p_id) {
@ -2090,6 +2107,21 @@ void EditorInspector::_vscroll_changed(double p_offset) {
scroll_cache[object->get_instance_id()] = p_offset;
}
}
void EditorInspector::set_property_prefix(const String &p_prefix) {
property_prefix = p_prefix;
}
String EditorInspector::get_property_prefix() const {
return property_prefix;
}
void EditorInspector::set_object_class(const String &p_class) {
object_class = p_class;
}
String EditorInspector::get_object_class() const {
return object_class;
}
void EditorInspector::_bind_methods() {
@ -2110,9 +2142,12 @@ void EditorInspector::_bind_methods() {
ClassDB::bind_method("refresh", &EditorInspector::refresh);
ADD_SIGNAL(MethodInfo("property_selected", PropertyInfo(Variant::STRING, "property")));
ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property")));
ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::OBJECT, "res"), PropertyInfo(Variant::STRING, "prop")));
ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("property_edited", PropertyInfo(Variant::STRING, "property")));
ADD_SIGNAL(MethodInfo("restart_requested"));
}
EditorInspector::EditorInspector() {

View file

@ -267,9 +267,13 @@ class EditorInspector : public ScrollContainer {
Map<StringName, Map<StringName, String> > descr_cache;
Map<StringName, String> class_descr_cache;
Set<StringName> restart_request_props;
Map<ObjectID, int> scroll_cache;
String property_prefix; //used for sectioned inspector
String object_class;
void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field);
void _property_changed(const String &p_path, const Variant &p_value, bool changing = false);
@ -343,6 +347,12 @@ public:
void set_scroll_offset(int p_offset);
int get_scroll_offset() const;
void set_property_prefix(const String &p_prefix);
String get_property_prefix() const;
void set_object_class(const String &p_class);
String get_object_class() const;
void set_use_sub_inspector_bg(bool p_enable);
EditorInspector();

View file

@ -1068,6 +1068,32 @@ void EditorNode::_save_scene(String p_file, int idx) {
}
}
void EditorNode::save_all_scenes_and_restart() {
_menu_option_confirm(RUN_STOP, true);
exiting = true;
_save_all_scenes();
String to_reopen;
if (get_tree()->get_edited_scene_root()) {
to_reopen = get_tree()->get_edited_scene_root()->get_filename();
}
get_tree()->quit();
String exec = OS::get_singleton()->get_executable_path();
List<String> args;
args.push_back("--path");
args.push_back(ProjectSettings::get_singleton()->get_resource_path());
args.push_back("-e");
if (to_reopen != String()) {
args.push_back(to_reopen);
}
OS::get_singleton()->set_restart_on_exit(true, args);
}
void EditorNode::_save_all_scenes() {
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
@ -2204,6 +2230,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
about->popup_centered_minsize(Size2(780, 500) * EDSCALE);
} break;
case SET_VIDEO_DRIVER_SAVE_AND_RESTART: {
ProjectSettings::get_singleton()->set("rendering/quality/driver/driver_name", video_driver_request);
ProjectSettings::get_singleton()->save();
save_all_scenes_and_restart();
} break;
default: {
if (p_option >= IMPORT_PLUGIN_BASE) {
}
@ -4390,6 +4423,21 @@ void EditorNode::_bottom_panel_raise_toggled(bool p_pressed) {
}
}
void EditorNode::_video_driver_selected(int p_which) {
String driver = video_driver->get_item_metadata(p_which);
String current = OS::get_singleton()->get_video_driver_name(OS::get_singleton()->get_current_video_driver());
if (driver == current) {
return;
}
video_driver_request = driver;
video_restart_dialog->popup_centered_minsize();
video_driver->select(video_driver_current);
}
void EditorNode::_bind_methods() {
ClassDB::bind_method("_menu_option", &EditorNode::_menu_option);
@ -4460,6 +4508,8 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_resources_reimported"), &EditorNode::_resources_reimported);
ClassDB::bind_method(D_METHOD("_bottom_panel_raise_toggled"), &EditorNode::_bottom_panel_raise_toggled);
ClassDB::bind_method(D_METHOD("_video_driver_selected"), &EditorNode::_video_driver_selected);
ADD_SIGNAL(MethodInfo("play_pressed"));
ADD_SIGNAL(MethodInfo("pause_pressed"));
ADD_SIGNAL(MethodInfo("stop_pressed"));
@ -4656,19 +4706,19 @@ EditorNode::EditorNode() {
ClassDB::set_class_enabled("RootMotionView", true);
//defs here, use EDITOR_GET in logic
EDITOR_DEF("interface/scene_tabs/always_show_close_button", false);
EDITOR_DEF("interface/scene_tabs/resize_if_many_tabs", true);
EDITOR_DEF("interface/scene_tabs/minimum_width", 50);
EDITOR_DEF_RST("interface/scene_tabs/always_show_close_button", false);
EDITOR_DEF_RST("interface/scene_tabs/resize_if_many_tabs", true);
EDITOR_DEF_RST("interface/scene_tabs/minimum_width", 50);
EDITOR_DEF("run/output/always_clear_output_on_play", true);
EDITOR_DEF("run/output/always_open_output_on_play", true);
EDITOR_DEF("run/output/always_close_output_on_stop", true);
EDITOR_DEF("run/auto_save/save_before_running", true);
EDITOR_DEF("interface/editor/save_each_scene_on_quit", true);
EDITOR_DEF_RST("interface/editor/save_each_scene_on_quit", true);
EDITOR_DEF("interface/editor/quit_confirmation", true);
EDITOR_DEF("interface/scene_tabs/restore_scenes_on_load", false);
EDITOR_DEF("interface/scene_tabs/show_thumbnail_on_hover", true);
EDITOR_DEF("interface/inspector/capitalize_properties", true);
EDITOR_DEF("interface/inspector/disable_folding", false);
EDITOR_DEF_RST("interface/scene_tabs/restore_scenes_on_load", false);
EDITOR_DEF_RST("interface/scene_tabs/show_thumbnail_on_hover", true);
EDITOR_DEF_RST("interface/inspector/capitalize_properties", true);
EDITOR_DEF_RST("interface/inspector/disable_folding", false);
EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true);
EDITOR_DEF("interface/inspector/resources_types_to_open_in_new_inspector", "SpatialMaterial");
EDITOR_DEF("run/auto_save/save_before_running", true);
@ -5191,6 +5241,37 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
#endif
video_driver = memnew(OptionButton);
video_driver->set_flat(true);
video_driver->set_focus_mode(Control::FOCUS_NONE);
video_driver->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
String video_drivers = ProjectSettings::get_singleton()->get_custom_property_info()["rendering/quality/driver/driver_name"].hint_string;
String current_video_driver = OS::get_singleton()->get_video_driver_name(OS::get_singleton()->get_current_video_driver());
menu_hb->add_child(video_driver);
video_driver_current = 0;
for (int i = 0; i < video_drivers.get_slice_count(","); i++) {
String driver = video_drivers.get_slice(",", i);
if (gui_base->has_icon(driver, "EditorIcons")) {
video_driver->add_icon_item(gui_base->get_icon(driver, "EditorIcons"), "");
} else {
video_driver->add_item(driver);
}
video_driver->set_item_metadata(i, driver);
if (current_video_driver == driver) {
video_driver->select(i);
video_driver_current = i;
}
}
video_driver->connect("item_selected", this, "_video_driver_selected");
video_restart_dialog = memnew(ConfirmationDialog);
video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor."));
video_restart_dialog->get_ok()->set_text(TTR("Save & Restart"));
video_restart_dialog->connect("confirmed", this, "_menu_option", varray(SET_VIDEO_DRIVER_SAVE_AND_RESTART));
add_child(video_restart_dialog);
progress_hb = memnew(BackgroundProgress);
HBoxContainer *right_menu_hb = memnew(HBoxContainer);

View file

@ -182,6 +182,8 @@ private:
HELP_COMMUNITY,
HELP_ABOUT,
SET_VIDEO_DRIVER_SAVE_AND_RESTART,
IMPORT_PLUGIN_BASE = 100,
TOOL_MENU_BASE = 1000
@ -194,6 +196,13 @@ private:
Control *gui_base;
VBoxContainer *main_vbox;
PanelContainer *play_button_panel;
OptionButton *video_driver;
ConfirmationDialog *video_restart_dialog;
int video_driver_current;
String video_driver_request;
void _video_driver_selected(int);
//split
@ -745,6 +754,8 @@ public:
void add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu);
void remove_tool_menu_item(const String &p_name);
void save_all_scenes_and_restart();
void dim_editor(bool p_dimming);
void edit_current() { _edit_current(); };

View file

@ -0,0 +1,306 @@
#include "editor_sectioned_inspector.h"
#include "editor_scale.h"
class SectionedInspectorFilter : public Object {
GDCLASS(SectionedInspectorFilter, Object);
Object *edited;
String section;
bool allow_sub;
bool _set(const StringName &p_name, const Variant &p_value) {
if (!edited)
return false;
String name = p_name;
if (section != "") {
name = section + "/" + name;
}
bool valid;
edited->set(name, p_value, &valid);
return valid;
}
bool _get(const StringName &p_name, Variant &r_ret) const {
if (!edited)
return false;
String name = p_name;
if (section != "") {
name = section + "/" + name;
}
bool valid = false;
r_ret = edited->get(name, &valid);
return valid;
}
void _get_property_list(List<PropertyInfo> *p_list) const {
if (!edited)
return;
List<PropertyInfo> pinfo;
edited->get_property_list(&pinfo);
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
PropertyInfo pi = E->get();
int sp = pi.name.find("/");
if (pi.name == "resource_path" || pi.name == "resource_name" || pi.name == "resource_local_to_scene" || pi.name.begins_with("script/")) //skip resource stuff
continue;
if (sp == -1) {
pi.name = "global/" + pi.name;
}
if (pi.name.begins_with(section + "/")) {
pi.name = pi.name.replace_first(section + "/", "");
if (!allow_sub && pi.name.find("/") != -1)
continue;
p_list->push_back(pi);
}
}
}
bool property_can_revert(const String &p_name) {
return edited->call("property_can_revert", section + "/" + p_name);
}
Variant property_get_revert(const String &p_name) {
return edited->call("property_get_revert", section + "/" + p_name);
}
protected:
static void _bind_methods() {
ClassDB::bind_method("property_can_revert", &SectionedInspectorFilter::property_can_revert);
ClassDB::bind_method("property_get_revert", &SectionedInspectorFilter::property_get_revert);
}
public:
void set_section(const String &p_section, bool p_allow_sub) {
section = p_section;
allow_sub = p_allow_sub;
_change_notify();
}
void set_edited(Object *p_edited) {
edited = p_edited;
_change_notify();
}
SectionedInspectorFilter() {
edited = NULL;
}
};
void SectionedInspector::_bind_methods() {
ClassDB::bind_method("_section_selected", &SectionedInspector::_section_selected);
ClassDB::bind_method("_search_changed", &SectionedInspector::_search_changed);
ClassDB::bind_method("update_category_list", &SectionedInspector::update_category_list);
}
void SectionedInspector::_section_selected() {
if (!sections->get_selected())
return;
filter->set_section(sections->get_selected()->get_metadata(0), sections->get_selected()->get_children() == NULL);
inspector->set_property_prefix(String(sections->get_selected()->get_metadata(0)) + "/");
}
void SectionedInspector::set_current_section(const String &p_section) {
if (section_map.has(p_section)) {
section_map[p_section]->select(0);
}
}
String SectionedInspector::get_current_section() const {
if (sections->get_selected())
return sections->get_selected()->get_metadata(0);
else
return "";
}
String SectionedInspector::get_full_item_path(const String &p_item) {
String base = get_current_section();
if (base != "")
return base + "/" + p_item;
else
return p_item;
}
void SectionedInspector::edit(Object *p_object) {
if (!p_object) {
obj = -1;
sections->clear();
filter->set_edited(NULL);
inspector->edit(NULL);
return;
}
ObjectID id = p_object->get_instance_id();
inspector->set_object_class(p_object->get_class());
if (obj != id) {
obj = id;
update_category_list();
filter->set_edited(p_object);
inspector->edit(filter);
if (sections->get_root()->get_children()) {
sections->get_root()->get_children()->select(0);
}
} else {
update_category_list();
}
}
void SectionedInspector::update_category_list() {
String selected_category = get_current_section();
sections->clear();
Object *o = ObjectDB::get_instance(obj);
if (!o)
return;
List<PropertyInfo> pinfo;
o->get_property_list(&pinfo);
section_map.clear();
TreeItem *root = sections->create_item();
section_map[""] = root;
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
PropertyInfo pi = E->get();
if (pi.usage & PROPERTY_USAGE_CATEGORY)
continue;
else if (!(pi.usage & PROPERTY_USAGE_EDITOR))
continue;
if (pi.name.find(":") != -1 || pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path" || pi.name == "resource_local_to_scene")
continue;
if (search_box && search_box->get_text() != String() && pi.name.findn(search_box->get_text()) == -1)
continue;
int sp = pi.name.find("/");
if (sp == -1)
pi.name = "Global/" + pi.name;
Vector<String> sectionarr = pi.name.split("/");
String metasection;
int sc = MIN(2, sectionarr.size() - 1);
for (int i = 0; i < sc; i++) {
TreeItem *parent = section_map[metasection];
parent->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
if (i > 0) {
metasection += "/" + sectionarr[i];
} else {
metasection = sectionarr[i];
}
if (!section_map.has(metasection)) {
TreeItem *ms = sections->create_item(parent);
section_map[metasection] = ms;
ms->set_text(0, sectionarr[i].capitalize());
ms->set_metadata(0, metasection);
ms->set_selectable(0, false);
}
if (i == sc - 1) {
//if it has children, make selectable
section_map[metasection]->set_selectable(0, true);
}
}
}
if (section_map.has(selected_category)) {
section_map[selected_category]->select(0);
}
inspector->update_tree();
}
void SectionedInspector::register_search_box(LineEdit *p_box) {
search_box = p_box;
inspector->register_text_enter(p_box);
search_box->connect("text_changed", this, "_search_changed");
}
void SectionedInspector::_search_changed(const String &p_what) {
update_category_list();
}
EditorInspector *SectionedInspector::get_inspector() {
return inspector;
}
SectionedInspector::SectionedInspector() {
obj = -1;
search_box = NULL;
add_constant_override("autohide", 1); // Fixes the dragger always showing up
VBoxContainer *left_vb = memnew(VBoxContainer);
left_vb->set_custom_minimum_size(Size2(170, 0) * EDSCALE);
add_child(left_vb);
sections = memnew(Tree);
sections->set_v_size_flags(SIZE_EXPAND_FILL);
sections->set_hide_root(true);
left_vb->add_child(sections, true);
VBoxContainer *right_vb = memnew(VBoxContainer);
right_vb->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
right_vb->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(right_vb);
filter = memnew(SectionedInspectorFilter);
inspector = memnew(EditorInspector);
inspector->set_v_size_flags(SIZE_EXPAND_FILL);
right_vb->add_child(inspector, true);
inspector->set_use_doc_hints(true);
sections->connect("cell_selected", this, "_section_selected");
}
SectionedInspector::~SectionedInspector() {
memdelete(filter);
}

View file

@ -0,0 +1,42 @@
#ifndef EDITOR_SECTIONED_INSPECTOR_H
#define EDITOR_SECTIONED_INSPECTOR_H
#include "editor/editor_inspector.h"
#include "scene/gui/split_container.h"
#include "scene/gui/tree.h"
class SectionedInspectorFilter;
class SectionedInspector : public HSplitContainer {
GDCLASS(SectionedInspector, HSplitContainer);
ObjectID obj;
Tree *sections;
SectionedInspectorFilter *filter;
Map<String, TreeItem *> section_map;
EditorInspector *inspector;
LineEdit *search_box;
static void _bind_methods();
void _section_selected();
void _search_changed(const String &p_what);
public:
void register_search_box(LineEdit *p_box);
EditorInspector *get_inspector();
void edit(Object *p_object);
String get_full_item_path(const String &p_item);
void set_current_section(const String &p_section);
String get_current_section() const;
void update_category_list();
SectionedInspector();
~SectionedInspector();
};
#endif // EDITOR_SECTIONED_INSPECTOR_H

View file

@ -165,6 +165,7 @@ struct _EVCSort {
Variant::Type type;
int order;
bool save;
bool restart_if_changed;
bool operator<(const _EVCSort &p_vcs) const { return order < p_vcs.order; }
};
@ -188,6 +189,7 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
vc.order = v->order;
vc.type = v->variant.get_type();
vc.save = v->save;
vc.restart_if_changed = v->restart_if_changed;
vclist.insert(vc);
}
@ -210,6 +212,10 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
if (hints.has(E->get().name))
pi = hints[E->get().name];
if (E->get().restart_if_changed) {
pi.usage |= PROPERTY_USAGE_RESTART_IF_CHANGED;
}
p_list->push_back(pi);
}
@ -280,6 +286,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
}
_initial_set("interface/editor/editor_language", best);
set_restart_if_changed("interface/editor/editor_language", true);
hints["interface/editor/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
}
@ -1017,6 +1024,14 @@ void EditorSettings::raise_order(const String &p_setting) {
props[p_setting].order = ++last_order;
}
void EditorSettings::set_restart_if_changed(const StringName &p_setting, bool p_restart) {
_THREAD_SAFE_METHOD_
if (!props.has(p_setting))
return;
props[p_setting].restart_if_changed = p_restart;
}
void EditorSettings::set_initial_value(const StringName &p_setting, const Variant &p_value, bool p_update_current) {
_THREAD_SAFE_METHOD_
@ -1030,16 +1045,19 @@ void EditorSettings::set_initial_value(const StringName &p_setting, const Varian
}
}
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default) {
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_restart_if_changed) {
Variant ret = p_default;
if (EditorSettings::get_singleton()->has_setting(p_setting))
if (EditorSettings::get_singleton()->has_setting(p_setting)) {
ret = EditorSettings::get_singleton()->get(p_setting);
else
} else {
EditorSettings::get_singleton()->set_manually(p_setting, p_default);
EditorSettings::get_singleton()->set_restart_if_changed(p_setting, p_restart_if_changed);
}
if (!EditorSettings::get_singleton()->has_default_value(p_setting))
if (!EditorSettings::get_singleton()->has_default_value(p_setting)) {
EditorSettings::get_singleton()->set_initial_value(p_setting, p_default);
}
return ret;
}

View file

@ -70,6 +70,7 @@ private:
bool has_default_value;
bool hide_from_editor;
bool save;
bool restart_if_changed;
VariantContainer() {
variant = Variant();
initial = Variant();
@ -77,6 +78,7 @@ private:
hide_from_editor = false;
has_default_value = false;
save = false;
restart_if_changed = false;
}
VariantContainer(const Variant &p_variant, int p_order) {
variant = p_variant;
@ -85,6 +87,7 @@ private:
hide_from_editor = false;
has_default_value = false;
save = false;
restart_if_changed = false;
}
};
@ -145,6 +148,7 @@ public:
void erase(const String &p_setting);
void raise_order(const String &p_setting);
void set_initial_value(const StringName &p_setting, const Variant &p_value, bool p_update_current = false);
void set_restart_if_changed(const StringName &p_setting, bool p_restart);
void set_manually(const StringName &p_setting, const Variant &p_value, bool p_emit_signal = false) {
if (p_emit_signal)
_set(p_setting, p_value);
@ -200,7 +204,8 @@ public:
//not a macro any longer
#define EDITOR_DEF(m_var, m_val) _EDITOR_DEF(m_var, Variant(m_val))
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default);
#define EDITOR_DEF_RST(m_var, m_val) _EDITOR_DEF(m_var, Variant(m_val), true)
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_restart_if_changed = false);
#define EDITOR_GET(m_var) _EDITOR_GET(m_var)
Variant _EDITOR_GET(const String &p_setting);

View file

@ -268,7 +268,8 @@ void EditorSpinSlider::_notification(int p_what) {
update();
}
if (p_what == NOTIFICATION_FOCUS_ENTER) {
/* Sorry, I dont like this, it makes navigating the different fields with arrows more difficult
/* Sorry, I dont like this, it makes navigating the different fields with arrows more difficult.
* Just press enter to edit.
* if (!Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && !value_input_just_closed) {
_focus_entered();
}*/

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.8 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.9 KiB

View file

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg2"
width="48"
height="16"
viewBox="0 0 47.999999 16"
sodipodi:docname="icon_vulkan.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1853"
inkscape:window-height="1016"
id="namedview4"
showgrid="false"
inkscape:zoom="10.24"
inkscape:cx="9.4970674"
inkscape:cy="11.192118"
inkscape:window-x="67"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="g8" />
<path
style="fill:#000000;stroke-width:1.06666672"
d=""
id="path819"
inkscape:connector-curvature="0" />
<path
style="fill:#000000;stroke-width:1.06666672"
d=""
id="path817"
inkscape:connector-curvature="0" />
<g
transform="matrix(0.04333868,0,0,0.04333868,-4.0493236,-3.7704963)"
id="g8">
<path
inkscape:connector-curvature="0"
d="m 724.1,432.41989 h -40.6 c 0,0 0,-99 0,-129.7 13,7.2 30.1,20.5 40.6,33.3 z"
id="path10"
style="fill:#e6555a;fill-opacity:1" />
<g
id="g12"
style="fill:#e6555a;fill-opacity:1"
transform="translate(0,47.319882)">
<path
inkscape:connector-curvature="0"
d="m 381.8,385.1 h -50.6 l -66,-204 h 46 l 45.4,143.5 h 0.6 l 46,-143.5 h 46.3 z"
id="path14"
style="fill:#e6555a;fill-opacity:1" />
<path
inkscape:connector-curvature="0"
d="M 585.5,385.1 H 546.9 V 364.5 H 546 c -5.1,8.6 -11.8,14.8 -20,18.6 -8.2,3.8 -16.6,5.7 -25.1,5.7 -10.9,0 -19.8,-1.4 -26.7,-4.3 -7,-2.9 -12.4,-6.9 -16.4,-12.1 -4,-5.2 -6.8,-11.6 -8.4,-19.1 -1.6,-7.5 -2.4,-15.9 -2.4,-25 v -90.9 h 40.6 v 83.4 c 0,12.2 1.9,21.3 5.7,27.3 3.8,6 10.6,9 20.3,9 11,0 19.1,-3.3 24,-9.9 5,-6.6 7.4,-17.4 7.4,-32.4 v -77.4 h 40.6 v 147.7 z"
id="path16"
style="fill:#e6555a;fill-opacity:1" />
</g>
<polygon
points="730.8,296.2 730.7,290.5 781.9,237.3 829.9,237.3 774.2,291.6 836.2,385.1 787,385.1 "
id="polygon18"
style="fill:#e6555a;fill-opacity:1"
transform="translate(0,47.319882)" />
<path
inkscape:connector-curvature="0"
d="m 843.6,330.11989 c 0.6,-9.5 3,-17.4 7.2,-23.7 4.2,-6.3 9.5,-11.3 16,-15.1 6.5,-3.8 13.8,-6.5 21.9,-8.1 8.1,-1.6 16.2,-2.4 24.4,-2.4 7.4,0 15,0.5 22.6,1.6 7.6,1.1 14.6,3.1 20.9,6.1 6.3,3.1 11.4,7.3 15.4,12.7 4,5.4 6,12.6 6,21.6 v 76.9 c 0,6.7 0.4,13.1 1.1,19.1 0.8,6.1 2.1,10.7 4,13.7 h -41.2 c -0.8,-2.3 -1.4,-4.6 -1.9,-7 -0.5,-2.4 -0.8,-4.8 -1,-7.3 -6.5,6.7 -14.1,11.3 -22.9,14 -8.8,2.7 -17.7,4 -26.9,4 -7,0 -13.6,-0.9 -19.7,-2.6 -6.1,-1.7 -11.4,-4.4 -16,-8 -4.6,-3.6 -8.2,-8.2 -10.7,-13.7 -2.6,-5.5 -3.9,-12.1 -3.9,-19.7 0,-8.4 1.5,-15.3 4.4,-20.7 3,-5.4 6.8,-9.8 11.4,-13 4.7,-3.2 10,-5.7 16,-7.3 6,-1.6 12,-2.9 18.1,-3.9 6.1,-0.9 12.1,-1.7 18,-2.3 5.9,-0.6 11.1,-1.4 15.7,-2.6 4.6,-1.1 8.2,-2.8 10.9,-5 2.7,-2.2 3.9,-5.4 3.7,-9.6 0,-4.4 -0.7,-7.9 -2.2,-10.4 -1.4,-2.6 -3.3,-4.6 -5.7,-6 -2.4,-1.4 -5.1,-2.4 -8.3,-2.9 -3.1,-0.5 -6.5,-0.7 -10.1,-0.7 -8,0 -14.3,1.7 -18.9,5.1 -4.6,3.4 -7.2,9.1 -8,17.1 h -40.3 z m 93.8,30 c -1.7,1.5 -3.9,2.7 -6.4,3.6 -2.6,0.9 -5.3,1.6 -8.3,2.2 -2.9,0.6 -6,1 -9.3,1.4 -3.2,0.4 -6.5,0.9 -9.7,1.4 -3,0.6 -6,1.3 -9,2.3 -3,1 -5.5,2.2 -7.7,3.9 -2.2,1.6 -4,3.7 -5.3,6.1 -1.3,2.5 -2,5.6 -2,9.4 0,3.6 0.7,6.7 2,9.1 1.3,2.5 3.1,4.4 5.4,5.9 2.3,1.4 5,2.4 8,3 3.1,0.6 6.2,0.9 9.4,0.9 8,0 14.2,-1.3 18.6,-4 4.4,-2.7 7.6,-5.9 9.7,-9.6 2.1,-3.7 3.4,-7.5 3.9,-11.3 0.5,-3.8 0.7,-6.9 0.7,-9.1 z"
id="path20"
style="fill:#e6555a;fill-opacity:1" />
<path
inkscape:connector-curvature="0"
d="m 1004.2,284.61989 h 38.6 v 20.6 h 0.9 c 5.1,-8.6 11.8,-14.8 20,-18.7 8.2,-3.9 16.6,-5.9 25.1,-5.9 10.9,0 19.8,1.5 26.7,4.4 7,3 12.4,7.1 16.4,12.3 4,5.2 6.8,11.6 8.4,19.1 1.6,7.5 2.4,15.9 2.4,25 v 90.9 h -40.6 v -83.4 c 0,-12.2 -1.9,-21.3 -5.7,-27.3 -3.8,-6 -10.6,-9 -20.3,-9 -11,0 -19,3.3 -24,9.9 -5,6.6 -7.4,17.4 -7.4,32.4 v 77.4 h -40.6 v -147.7 z"
id="path22"
style="fill:#e6555a;fill-opacity:1" />
<g
id="g24"
style="fill:#e6555a;fill-opacity:1"
transform="translate(0,47.319882)">
<path
inkscape:connector-curvature="0"
d="M 612.4,211.8 V 385 H 653 V 234.2 c -13.1,-8 -26.6,-15.5 -40.6,-22.4 z"
id="path26"
style="fill:#e6555a;fill-opacity:1" />
</g>
<path
inkscape:connector-curvature="0"
d="m 198.4,266.51989 c 23.5,-68.9 164.2,-94.2 314.1,-56.4 90,22.6 163.5,66.5 211.5,109.9 -21.7,-57.6 -127.3,-139.6 -272.8,-167.7 -164.5,-31.8 -326.7,-3.9 -346.8,69.1 -14.5,52.7 49.2,114.5 147.7,156.7 -44.3,-35.8 -65.8,-76 -53.7,-111.6 z"
id="path28"
style="fill:#e6555a;fill-opacity:1" />
<g
id="g30"
style="fill:#e6555a;fill-opacity:1"
transform="translate(0,47.319882)">
<path
inkscape:connector-curvature="0"
d="M 724.2,247.6 V 181 h -40.6 v 20.2 c 17.3,15.5 31,31.2 40.6,46.4 z"
id="path32"
style="fill:#e6555a;fill-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

@ -106,6 +106,12 @@ void ProjectSettingsEditor::_notification(int p_what) {
translation_res_file_open->add_filter("*." + E->get());
translation_res_option_file_open->add_filter("*." + E->get());
}
restart_close_button->set_icon(get_icon("Close", "EditorIcons"));
restart_container->add_style_override("panel", get_stylebox("bg", "Tree"));
restart_icon->set_texture(get_icon("StatusWarning", "EditorIcons"));
restart_label->add_color_override("font_color", get_color("error_color", "Editor"));
} break;
case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
@ -800,15 +806,13 @@ void ProjectSettingsEditor::popup_project_settings() {
plugin_settings->update_plugins();
}
void ProjectSettingsEditor::_item_selected() {
void ProjectSettingsEditor::_item_selected(const String &p_path) {
TreeItem *ti = globals_editor->get_property_editor()->get_property_tree()->get_selected();
if (!ti)
return;
if (!ti->get_parent())
String selected_path = p_path;
if (selected_path == String())
return;
category->set_text(globals_editor->get_current_section());
property->set_text(ti->get_text(0));
property->set_text(selected_path);
popup_copy_to_feature->set_disabled(false);
}
@ -865,7 +869,7 @@ void ProjectSettingsEditor::_item_add() {
void ProjectSettingsEditor::_item_del() {
String path = globals_editor->get_property_editor()->get_selected_path();
String path = globals_editor->get_inspector()->get_selected_path();
if (path == String()) {
EditorNode::get_singleton()->show_warning(TTR("Select a setting item first!"));
return;
@ -1043,7 +1047,7 @@ void ProjectSettingsEditor::_copy_to_platform_about_to_show() {
void ProjectSettingsEditor::_copy_to_platform(int p_which) {
String path = globals_editor->get_property_editor()->get_selected_path();
String path = globals_editor->get_inspector()->get_selected_path();
if (path == String()) {
EditorNode::get_singleton()->show_warning(TTR("Select a setting item first!"));
return;
@ -1572,7 +1576,7 @@ void ProjectSettingsEditor::_update_translations() {
void ProjectSettingsEditor::_toggle_search_bar(bool p_pressed) {
globals_editor->get_property_editor()->set_use_filter(p_pressed);
globals_editor->get_inspector()->set_use_filter(p_pressed);
if (p_pressed) {
@ -1593,7 +1597,7 @@ void ProjectSettingsEditor::_clear_search_box() {
return;
search_box->clear();
globals_editor->get_property_editor()->update_tree();
globals_editor->get_inspector()->update_tree();
}
void ProjectSettingsEditor::set_plugins_page() {
@ -1606,6 +1610,18 @@ TabContainer *ProjectSettingsEditor::get_tabs() {
return tab_container;
}
void ProjectSettingsEditor::_editor_restart() {
EditorNode::get_singleton()->save_all_scenes_and_restart();
}
void ProjectSettingsEditor::_editor_restart_request() {
restart_container->show();
}
void ProjectSettingsEditor::_editor_restart_close() {
restart_container->hide();
}
void ProjectSettingsEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_item_selected"), &ProjectSettingsEditor::_item_selected);
@ -1651,6 +1667,10 @@ void ProjectSettingsEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_copy_to_platform_about_to_show"), &ProjectSettingsEditor::_copy_to_platform_about_to_show);
ClassDB::bind_method(D_METHOD("_editor_restart_request"), &ProjectSettingsEditor::_editor_restart_request);
ClassDB::bind_method(D_METHOD("_editor_restart"), &ProjectSettingsEditor::_editor_restart);
ClassDB::bind_method(D_METHOD("_editor_restart_close"), &ProjectSettingsEditor::_editor_restart_close);
ClassDB::bind_method(D_METHOD("get_tabs"), &ProjectSettingsEditor::get_tabs);
}
@ -1737,16 +1757,17 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
search_bar->add_child(clear_button);
clear_button->connect("pressed", this, "_clear_search_box");
globals_editor = memnew(SectionedPropertyEditor);
globals_editor = memnew(SectionedInspector);
props_base->add_child(globals_editor);
globals_editor->get_property_editor()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
globals_editor->get_property_editor()->set_property_selectable(true);
globals_editor->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
globals_editor->get_inspector()->set_property_selectable(true);
//globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
globals_editor->register_search_box(search_box);
globals_editor->get_property_editor()->get_property_tree()->connect("cell_selected", this, "_item_selected");
globals_editor->get_property_editor()->connect("property_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED);
globals_editor->get_property_editor()->connect("property_edited", this, "_settings_prop_edited");
globals_editor->get_inspector()->connect("property_selected", this, "_item_selected");
//globals_editor->get_inspector()->connect("property_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED);
globals_editor->get_inspector()->connect("property_edited", this, "_settings_prop_edited");
globals_editor->get_inspector()->connect("restart_requested", this, "_editor_restart_request");
Button *del = memnew(Button);
hbc->add_child(del);
@ -1766,6 +1787,26 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
get_ok()->set_text(TTR("Close"));
set_hide_on_ok(true);
restart_container = memnew(PanelContainer);
props_base->add_child(restart_container);
HBoxContainer *restart_hb = memnew(HBoxContainer);
restart_container->add_child(restart_hb);
restart_icon = memnew(TextureRect);
restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
restart_hb->add_child(restart_icon);
restart_label = memnew(Label);
restart_label->set_text(TTR("Editor must be restarted for changes to take effect"));
restart_hb->add_child(restart_label);
restart_hb->add_spacer();
Button *restart_button = memnew(Button);
restart_button->connect("pressed", this, "_editor_restart");
restart_hb->add_child(restart_button);
restart_button->set_text(TTR("Save & Restart"));
restart_close_button = memnew(ToolButton);
restart_close_button->connect("pressed", this, "_editor_restart_close");
restart_hb->add_child(restart_close_button);
restart_container->hide();
message = memnew(AcceptDialog);
add_child(message);

View file

@ -35,7 +35,7 @@
#include "editor/editor_autoload_settings.h"
#include "editor/editor_data.h"
#include "editor/editor_plugin_settings.h"
#include "editor/property_editor.h"
#include "editor/editor_sectioned_inspector.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tab_container.h"
@ -64,7 +64,7 @@ class ProjectSettingsEditor : public AcceptDialog {
EditorData *data;
UndoRedo *undo_redo;
SectionedPropertyEditor *globals_editor;
SectionedInspector *globals_editor;
HBoxContainer *search_bar;
Button *search_button;
@ -112,7 +112,7 @@ class ProjectSettingsEditor : public AcceptDialog {
EditorPluginSettings *plugin_settings;
void _item_selected();
void _item_selected(const String &);
void _item_adds(String);
void _item_add();
void _item_del();
@ -166,6 +166,15 @@ class ProjectSettingsEditor : public AcceptDialog {
static ProjectSettingsEditor *singleton;
Label *restart_label;
TextureRect *restart_icon;
PanelContainer *restart_container;
ToolButton *restart_close_button;
void _editor_restart_request();
void _editor_restart();
void _editor_restart_close();
protected:
void _notification(int p_what);
static void _bind_methods();

View file

@ -54,12 +54,12 @@ void EditorSettingsDialog::_settings_changed() {
void EditorSettingsDialog::_settings_property_edited(const String &p_name) {
String full_name = property_editor->get_full_item_path(p_name);
String full_name = inspector->get_full_item_path(p_name);
// Small usability workaround to update the text color settings when the
// color theme is changed
if (full_name == "text_editor/theme/color_theme") {
property_editor->get_property_editor()->update_tree();
inspector->get_inspector()->update_tree();
} else if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast") {
EditorSettings::get_singleton()->set_manually("interface/theme/preset", "Custom"); // set preset to Custom
} else if (full_name.begins_with("text_editor/highlighting")) {
@ -88,8 +88,8 @@ void EditorSettingsDialog::popup_edit_settings() {
EditorSettings::get_singleton()->list_text_editor_themes(); // make sure we have an up to date list of themes
property_editor->edit(EditorSettings::get_singleton());
property_editor->get_property_editor()->update_tree();
inspector->edit(EditorSettings::get_singleton());
inspector->get_inspector()->update_tree();
search_box->select_all();
search_box->grab_focus();
@ -120,7 +120,7 @@ void EditorSettingsDialog::_clear_search_box() {
return;
search_box->clear();
property_editor->get_property_editor()->update_tree();
inspector->get_inspector()->update_tree();
}
void EditorSettingsDialog::_clear_shortcut_search_box() {
@ -158,7 +158,7 @@ void EditorSettingsDialog::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_update_icons();
// Update theme colors.
property_editor->update_category_list();
inspector->update_category_list();
_update_shortcuts();
} break;
}
@ -202,6 +202,11 @@ void EditorSettingsDialog::_update_icons() {
shortcut_search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
clear_button->set_icon(get_icon("Close", "EditorIcons"));
shortcut_clear_button->set_icon(get_icon("Close", "EditorIcons"));
restart_close_button->set_icon(get_icon("Close", "EditorIcons"));
restart_container->add_style_override("panel", get_stylebox("bg", "Tree"));
restart_icon->set_texture(get_icon("StatusWarning", "EditorIcons"));
restart_label->add_color_override("font_color", get_color("error_color", "Editor"));
}
void EditorSettingsDialog::_update_shortcuts() {
@ -388,6 +393,18 @@ void EditorSettingsDialog::_focus_current_search_box() {
}
}
void EditorSettingsDialog::_editor_restart() {
EditorNode::get_singleton()->save_all_scenes_and_restart();
}
void EditorSettingsDialog::_editor_restart_request() {
restart_container->show();
}
void EditorSettingsDialog::_editor_restart_close() {
restart_container->hide();
}
void EditorSettingsDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_unhandled_input"), &EditorSettingsDialog::_unhandled_input);
@ -402,6 +419,10 @@ void EditorSettingsDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_press_a_key_confirm"), &EditorSettingsDialog::_press_a_key_confirm);
ClassDB::bind_method(D_METHOD("_wait_for_key"), &EditorSettingsDialog::_wait_for_key);
ClassDB::bind_method(D_METHOD("_tabs_tab_changed"), &EditorSettingsDialog::_tabs_tab_changed);
ClassDB::bind_method(D_METHOD("_editor_restart_request"), &EditorSettingsDialog::_editor_restart_request);
ClassDB::bind_method(D_METHOD("_editor_restart"), &EditorSettingsDialog::_editor_restart);
ClassDB::bind_method(D_METHOD("_editor_restart_close"), &EditorSettingsDialog::_editor_restart_close);
}
EditorSettingsDialog::EditorSettingsDialog() {
@ -434,14 +455,35 @@ EditorSettingsDialog::EditorSettingsDialog() {
hbc->add_child(clear_button);
clear_button->connect("pressed", this, "_clear_search_box");
property_editor = memnew(SectionedPropertyEditor);
//property_editor->hide_top_label();
property_editor->get_property_editor()->set_use_filter(true);
property_editor->register_search_box(search_box);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
property_editor->get_property_editor()->set_undo_redo(undo_redo);
tab_general->add_child(property_editor);
property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");
inspector = memnew(SectionedInspector);
//inspector->hide_top_label();
inspector->get_inspector()->set_use_filter(true);
inspector->register_search_box(search_box);
inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
inspector->get_inspector()->set_undo_redo(undo_redo);
tab_general->add_child(inspector);
inspector->get_inspector()->connect("property_edited", this, "_settings_property_edited");
inspector->get_inspector()->connect("restart_requested", this, "_editor_restart_request");
restart_container = memnew(PanelContainer);
tab_general->add_child(restart_container);
HBoxContainer *restart_hb = memnew(HBoxContainer);
restart_container->add_child(restart_hb);
restart_icon = memnew(TextureRect);
restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
restart_hb->add_child(restart_icon);
restart_label = memnew(Label);
restart_label->set_text(TTR("Editor must be restarted for changes to take effect"));
restart_hb->add_child(restart_label);
restart_hb->add_spacer();
Button *restart_button = memnew(Button);
restart_button->connect("pressed", this, "_editor_restart");
restart_hb->add_child(restart_button);
restart_button->set_text(TTR("Save & Restart"));
restart_close_button = memnew(ToolButton);
restart_close_button->connect("pressed", this, "_editor_restart_close");
restart_hb->add_child(restart_close_button);
restart_container->hide();
// Shortcuts Tab

View file

@ -31,9 +31,14 @@
#ifndef SETTINGS_CONFIG_DIALOG_H
#define SETTINGS_CONFIG_DIALOG_H
#include "property_editor.h"
#include "editor/editor_sectioned_inspector.h"
#include "editor_inspector.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/rich_text_label.h"
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
class EditorSettingsDialog : public AcceptDialog {
@ -49,7 +54,7 @@ class EditorSettingsDialog : public AcceptDialog {
LineEdit *shortcut_search_box;
ToolButton *clear_button;
ToolButton *shortcut_clear_button;
SectionedPropertyEditor *property_editor;
SectionedInspector *inspector;
Timer *timer;
@ -89,6 +94,15 @@ class EditorSettingsDialog : public AcceptDialog {
static void _undo_redo_callback(void *p_self, const String &p_name);
Label *restart_label;
TextureRect *restart_icon;
PanelContainer *restart_container;
ToolButton *restart_close_button;
void _editor_restart_request();
void _editor_restart();
void _editor_restart_close();
protected:
static void _bind_methods();

View file

@ -825,7 +825,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->set_cmdline(execpath, main_args);
GLOBAL_DEF("rendering/quality/driver/driver_name", "GLES3");
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/driver/driver_name", PropertyInfo(Variant::STRING, "rendering/quality/driver/driver_name", PROPERTY_HINT_ENUM, "GLES3,GLES2"));
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/driver/driver_name", PropertyInfo(Variant::STRING, "rendering/quality/driver/driver_name", PROPERTY_HINT_ENUM, "GLES2,GLES3"));
if (video_driver == "") {
video_driver = GLOBAL_GET("rendering/quality/driver/driver_name");
}
@ -914,7 +914,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
if (audio_driver == "") { // specified in project.godot
audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
audio_driver = GLOBAL_DEF_RST("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
}
for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
@ -1957,6 +1957,15 @@ void Main::cleanup() {
if (engine)
memdelete(engine);
if (OS::get_singleton()->is_restart_on_exit_set()) {
//attempt to restart with arguments
String exec = OS::get_singleton()->get_executable_path();
List<String> args = OS::get_singleton()->get_restart_on_exit_argumens();
OS::ProcessID pid = 0;
OS::get_singleton()->execute(exec, args, false, &pid);
OS::get_singleton()->set_restart_on_exit(false, List<String>()); //clear list (uses memory)
}
unregister_core_driver_types();
unregister_core_types();

View file

@ -78,9 +78,9 @@ Error AudioDriverAndroid::init() {
// __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
JNIEnv *env = ThreadAndroid::get_env();
int mix_rate = GLOBAL_DEF("audio/mix_rate", 44100);
int mix_rate = GLOBAL_DEF_RST("audio/mix_rate", 44100);
int latency = GLOBAL_DEF("audio/output_latency", 25);
int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
if (OS::get_singleton()->is_stdout_verbose()) {
print_line("audio buffer size: " + itos(buffer_size));

View file

@ -123,6 +123,9 @@ void OS_Android::set_opengl_extensions(const char *p_gl_extensions) {
ERR_FAIL_COND(!p_gl_extensions);
gl_extensions = p_gl_extensions;
}
int OS_Android::get_current_video_driver() const {
return video_driver_index;
}
Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
@ -136,9 +139,11 @@ Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
if (use_gl2) {
RasterizerGLES2::register_config();
RasterizerGLES2::make_current();
video_driver_index = VIDEO_DRIVER_GLES2;
} else {
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
video_driver_index = VIDEO_DRIVER_GLES3;
}
visual_server = memnew(VisualServerRaster);

View file

@ -137,6 +137,7 @@ private:
AlertFunc alert_func;
//power_android *power_manager;
int video_driver_index;
public:
// functions used by main to initialize/deintialize the OS
@ -146,6 +147,8 @@ public:
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
virtual int get_current_video_driver() const;
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);

View file

@ -43,7 +43,7 @@ Error AudioDriverMediaKit::init() {
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", 25);
int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
buffer_size = next_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);

View file

@ -93,8 +93,14 @@ void OSIPhone::initialize_core() {
set_data_dir(data_dir);
};
int OSIPhone::get_current_video_driver() const {
return video_driver_index;
}
Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
video_driver = p_video_driver; //this may be misleading
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();

View file

@ -77,6 +77,8 @@ private:
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
virtual int get_current_video_driver() const;
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
@ -112,6 +114,8 @@ private:
int virtual_keyboard_height;
int video_driver_index;
public:
bool iterate();

View file

@ -643,6 +643,9 @@ const char *OS_JavaScript::get_audio_driver_name(int p_driver) const {
}
// Lifecycle
int OS_JavaScript::get_current_video_driver() const {
return video_driver_index;
}
void OS_JavaScript::initialize_core() {
@ -669,6 +672,8 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
RasterizerGLES2::make_current();
break;
}
video_driver_index = p_video_driver;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes);
ERR_EXPLAIN("WebGL " + itos(attributes.majorVersion) + ".0 not available");
ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE);

View file

@ -81,7 +81,11 @@ class OS_JavaScript : public OS_Unix {
static void file_access_close_callback(const String &p_file, int p_flags);
int video_driver_index;
protected:
virtual int get_current_video_driver() const;
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);

View file

@ -137,6 +137,9 @@ public:
void _update_window();
int video_driver_index;
virtual int get_current_video_driver() const;
protected:
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);

View file

@ -1176,6 +1176,10 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay
displays_arrangement_dirty = true;
}
int OS_OSX::get_current_video_driver() const {
return video_driver_index;
}
Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
/*** OSX INITIALIZATION ***/
@ -1272,6 +1276,8 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
}
video_driver_index = p_video_driver;
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
/*

View file

@ -1012,6 +1012,10 @@ typedef enum _SHC_PROCESS_DPI_AWARENESS {
SHC_PROCESS_PER_MONITOR_DPI_AWARE = 2
} SHC_PROCESS_DPI_AWARENESS;
int OS_Windows::get_current_video_driver() const {
return video_driver_index;
}
Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
@ -1181,6 +1185,8 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
RasterizerGLES3::make_current();
}
video_driver_index = p_video_driver; // FIXME TODO - FIX IF DRIVER DETECTION HAPPENS AND GLES2 MUST BE USED
gl_context->set_use_vsync(video_mode.use_vsync);
#endif

View file

@ -134,6 +134,7 @@ class OS_Windows : public OS {
PowerWindows *power_manager;
int video_driver_index;
#ifdef WASAPI_ENABLED
AudioDriverWASAPI driver_wasapi;
#endif
@ -153,6 +154,8 @@ class OS_Windows : public OS {
// functions used by main to initialize/deintialize the OS
protected:
virtual int get_current_video_driver() const;
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);

View file

@ -84,6 +84,10 @@ void OS_X11::initialize_core() {
OS_Unix::initialize_core();
}
int OS_X11::get_current_video_driver() const {
return video_driver_index;
}
Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
long im_event_mask = 0;
@ -285,6 +289,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
} break;
}
video_driver_index = p_video_driver; // FIXME TODO - FIX IF DRIVER DETECTION HAPPENS AND GLES2 MUST BE USED
context_gl->set_use_vsync(current_videomode.use_vsync);
#endif
@ -1825,8 +1831,8 @@ void OS_X11::process_xevents() {
GrabModeAsync, GrabModeAsync, x11_window, None, CurrentTime);
}
#ifdef TOUCH_ENABLED
// Grab touch devices to avoid OS gesture interference
/*for (int i = 0; i < touch.devices.size(); ++i) {
// Grab touch devices to avoid OS gesture interference
/*for (int i = 0; i < touch.devices.size(); ++i) {
XIGrabDevice(x11_display, touch.devices[i], x11_window, CurrentTime, None, XIGrabModeAsync, XIGrabModeAsync, False, &touch.event_mask);
}*/
#endif

View file

@ -180,6 +180,7 @@ class OS_X11 : public OS_Unix {
CrashHandler crash_handler;
int video_driver_index;
int audio_driver_index;
unsigned int capture_idle;
bool maximized;
@ -206,6 +207,8 @@ protected:
bool is_window_maximize_allowed();
public:
virtual int get_current_video_driver() const;
virtual String get_name();
virtual void set_cursor_shape(CursorShape p_shape);

View file

@ -44,7 +44,7 @@ Error AudioDriverDummy::init() {
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_frames * channels);

View file

@ -903,8 +903,8 @@ void AudioServer::init_channels_and_buffers() {
void AudioServer::init() {
channel_disable_threshold_db = GLOBAL_DEF("audio/channel_disable_threshold_db", -60.0);
channel_disable_frames = float(GLOBAL_DEF("audio/channel_disable_time", 2.0)) * get_mix_rate();
channel_disable_threshold_db = GLOBAL_DEF_RST("audio/channel_disable_threshold_db", -60.0);
channel_disable_frames = float(GLOBAL_DEF_RST("audio/channel_disable_time", 2.0)) * get_mix_rate();
buffer_size = 1024; //hardcoded for now
init_channels_and_buffers();
@ -920,7 +920,7 @@ void AudioServer::init() {
set_edited(false); //avoid editors from thinking this was edited
#endif
GLOBAL_DEF("audio/video_delay_compensation_ms", 0);
GLOBAL_DEF_RST("audio/video_delay_compensation_ms", 0);
}
void AudioServer::update() {