Reenable node name case setting + code cleanups
The method _generate_serial_child_name is indeed called relatively often in editor mode, but that commented out code chunk hardly adds to its slowness (and with the default setting, not at all). Also did various related code cleanups and simplifications.
This commit is contained in:
parent
f392b340ff
commit
f19fd7a4c1
4 changed files with 10 additions and 32 deletions
|
@ -711,7 +711,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
|
|||
input_map->load_from_globals(); //keys for game
|
||||
|
||||
if (video_driver=="") // specified in engine.cfg
|
||||
video_driver=_GLOBAL_DEF("display/driver/name",Variant((const char*)OS::get_singleton()->get_video_driver_name(0)));
|
||||
video_driver=GLOBAL_DEF("display/driver/name",Variant((const char*)OS::get_singleton()->get_video_driver_name(0)));
|
||||
|
||||
if (!force_res && use_custom_res && globals->has("display/window/width"))
|
||||
video_mode.width=globals->get("display/window/width");
|
||||
|
|
|
@ -1384,10 +1384,8 @@ String Node::_generate_serial_child_name(Node *p_child) {
|
|||
if (name=="") {
|
||||
|
||||
name = p_child->get_class();
|
||||
/* this is probably too slow to use here, should check alternatives
|
||||
*
|
||||
// Adjust casing according to project setting. The current type name is expected to be in PascalCase.
|
||||
switch (Globals::get_singleton()->get("node/name_casing").operator int()) {
|
||||
switch (GlobalConfig::get_singleton()->get("editor/node_name_casing").operator int()) {
|
||||
case NAME_CASING_PASCAL_CASE:
|
||||
break;
|
||||
case NAME_CASING_CAMEL_CASE:
|
||||
|
@ -1397,7 +1395,6 @@ String Node::_generate_serial_child_name(Node *p_child) {
|
|||
name = name.camelcase_to_underscore(true);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// Extract trailing number
|
||||
|
@ -2902,10 +2899,10 @@ void Node::request_ready() {
|
|||
|
||||
void Node::_bind_methods() {
|
||||
|
||||
_GLOBAL_DEF("editor/node_name_num_separator",0);
|
||||
GLOBAL_DEF("editor/node_name_num_separator",0);
|
||||
GlobalConfig::get_singleton()->set_custom_property_info("editor/node_name_num_separator",PropertyInfo(Variant::INT,"editor/node_name_num_separator",PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"));
|
||||
_GLOBAL_DEF("node/name_casing",NAME_CASING_PASCAL_CASE);
|
||||
GlobalConfig::get_singleton()->set_custom_property_info("node/name_casing",PropertyInfo(Variant::INT,"node/name_casing",PROPERTY_HINT_ENUM,"PascalCase,camelCase,snake_case"));
|
||||
GLOBAL_DEF("node/name_casing",NAME_CASING_PASCAL_CASE);
|
||||
GlobalConfig::get_singleton()->set_custom_property_info("editor/node_name_casing",PropertyInfo(Variant::INT,"editor/node_name_casing",PROPERTY_HINT_ENUM,"PascalCase,camelCase,snake_case"));
|
||||
|
||||
ClassDB::bind_method(_MD("_add_child_below_node","node:Node","child_node:Node","legible_unique_name"),&Node::add_child_below_node,DEFVAL(false));
|
||||
|
||||
|
|
|
@ -618,23 +618,6 @@ static int _get_key_modifier(const String& p_property) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
SpatialEditorViewport::NavigationScheme SpatialEditorViewport::_get_navigation_schema(const String& p_property) {
|
||||
switch(EditorSettings::get_singleton()->get(p_property).operator int()) {
|
||||
case 0: return NAVIGATION_GODOT;
|
||||
case 1: return NAVIGATION_MAYA;
|
||||
case 2: return NAVIGATION_MODO;
|
||||
}
|
||||
return NAVIGATION_GODOT;
|
||||
}
|
||||
|
||||
SpatialEditorViewport::NavigationZoomStyle SpatialEditorViewport::_get_navigation_zoom_style(const String& p_property) {
|
||||
switch(EditorSettings::get_singleton()->get(p_property).operator int()) {
|
||||
case 0: return NAVIGATION_ZOOM_VERTICAL;
|
||||
case 1: return NAVIGATION_ZOOM_HORIZONTAL;
|
||||
}
|
||||
return NAVIGATION_ZOOM_VERTICAL;
|
||||
}
|
||||
|
||||
bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hilite_only) {
|
||||
|
||||
if (!spatial_editor->is_gizmo_visible())
|
||||
|
@ -854,7 +837,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
|
|||
} break;
|
||||
case BUTTON_RIGHT: {
|
||||
|
||||
NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme");
|
||||
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
|
||||
|
||||
if (b.pressed && _edit.gizmo.is_valid()) {
|
||||
//restore
|
||||
|
@ -1014,7 +997,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
|
|||
|
||||
if (b.pressed) {
|
||||
|
||||
NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme");
|
||||
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
|
||||
if ( (nav_scheme==NAVIGATION_MAYA || nav_scheme==NAVIGATION_MODO) && b.mod.alt) {
|
||||
break;
|
||||
}
|
||||
|
@ -1251,7 +1234,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
|
|||
|
||||
}
|
||||
|
||||
NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme");
|
||||
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
|
||||
NavigationMode nav_mode = NAVIGATION_NONE;
|
||||
|
||||
if (_edit.gizmo.is_valid()) {
|
||||
|
@ -1558,7 +1541,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
|
|||
nav_mode = NAVIGATION_PAN;
|
||||
}
|
||||
|
||||
} else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) {
|
||||
} else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) {
|
||||
// Handle trackpad (no external mouse) use case
|
||||
int mod = 0;
|
||||
if (m.mod.shift)
|
||||
|
@ -1606,7 +1589,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
|
|||
if (nav_scheme==NAVIGATION_MAYA && m.mod.shift)
|
||||
zoom_speed *= zoom_speed_modifier;
|
||||
|
||||
NavigationZoomStyle zoom_style = _get_navigation_zoom_style("3d_editor/zoom_style");
|
||||
NavigationZoomStyle zoom_style = (NavigationZoomStyle)EditorSettings::get_singleton()->get("3d_editor/zoom_style").operator int();
|
||||
if (zoom_style == NAVIGATION_ZOOM_HORIZONTAL) {
|
||||
if ( m.relative_x > 0)
|
||||
cursor.distance*=1-m.relative_x*zoom_speed;
|
||||
|
|
|
@ -156,13 +156,11 @@ private:
|
|||
NAVIGATION_MAYA,
|
||||
NAVIGATION_MODO,
|
||||
};
|
||||
NavigationScheme _get_navigation_schema(const String& p_property);
|
||||
|
||||
enum NavigationZoomStyle {
|
||||
NAVIGATION_ZOOM_VERTICAL,
|
||||
NAVIGATION_ZOOM_HORIZONTAL
|
||||
};
|
||||
NavigationZoomStyle _get_navigation_zoom_style(const String& p_property);
|
||||
|
||||
enum NavigationMode {
|
||||
NAVIGATION_NONE,
|
||||
|
|
Loading…
Reference in a new issue