summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorGilles Roudière <gilles.roudiere@gmail.com>2021-03-08 20:56:33 +0100
committerGilles Roudière <gilles.roudiere@gmail.com>2021-03-10 11:23:06 +0100
commitba1344408f66592eb1bec0b91b5bcdea8385ccdc (patch)
tree027ac69c671f58121a13a41b21c64d3deb3a81c6 /editor
parenta9dc53d152c25af8f291031917dbbee3029f6276 (diff)
downloadredot-engine-ba1344408f66592eb1bec0b91b5bcdea8385ccdc.tar.gz
Implement Navigation layers
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_properties.cpp19
-rw-r--r--editor/editor_properties.h2
-rw-r--r--editor/property_editor.cpp20
3 files changed, 38 insertions, 3 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 6bfc16ccd7..dbe4aa55fa 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -716,12 +716,18 @@ void EditorPropertyLayers::setup(LayerType p_layer_type) {
case LAYER_PHYSICS_2D:
basename = "layer_names/2d_physics";
break;
+ case LAYER_NAVIGATION_2D:
+ basename = "layer_names/2d_navigation";
+ break;
case LAYER_RENDER_3D:
basename = "layer_names/3d_render";
break;
case LAYER_PHYSICS_3D:
basename = "layer_names/3d_physics";
break;
+ case LAYER_NAVIGATION_3D:
+ basename = "layer_names/3d_navigation";
+ break;
}
Vector<String> names;
@@ -3300,7 +3306,12 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
editor->setup(options);
add_property_editor(p_path, editor);
- } else if (p_hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_2D_RENDER || p_hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_3D_RENDER) {
+ } else if (p_hint == PROPERTY_HINT_LAYERS_2D_PHYSICS ||
+ p_hint == PROPERTY_HINT_LAYERS_2D_RENDER ||
+ p_hint == PROPERTY_HINT_LAYERS_2D_NAVIGATION ||
+ p_hint == PROPERTY_HINT_LAYERS_3D_PHYSICS ||
+ p_hint == PROPERTY_HINT_LAYERS_3D_RENDER ||
+ p_hint == PROPERTY_HINT_LAYERS_3D_NAVIGATION) {
EditorPropertyLayers::LayerType lt = EditorPropertyLayers::LAYER_RENDER_2D;
switch (p_hint) {
case PROPERTY_HINT_LAYERS_2D_RENDER:
@@ -3309,12 +3320,18 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
case PROPERTY_HINT_LAYERS_2D_PHYSICS:
lt = EditorPropertyLayers::LAYER_PHYSICS_2D;
break;
+ case PROPERTY_HINT_LAYERS_2D_NAVIGATION:
+ lt = EditorPropertyLayers::LAYER_NAVIGATION_2D;
+ break;
case PROPERTY_HINT_LAYERS_3D_RENDER:
lt = EditorPropertyLayers::LAYER_RENDER_3D;
break;
case PROPERTY_HINT_LAYERS_3D_PHYSICS:
lt = EditorPropertyLayers::LAYER_PHYSICS_3D;
break;
+ case PROPERTY_HINT_LAYERS_3D_NAVIGATION:
+ lt = EditorPropertyLayers::LAYER_NAVIGATION_3D;
+ break;
default: {
} //compiler could be smarter here and realize this can't happen
}
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index 6f097fb5df..07a1e72319 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -239,8 +239,10 @@ public:
enum LayerType {
LAYER_PHYSICS_2D,
LAYER_RENDER_2D,
+ LAYER_NAVIGATION_2D,
LAYER_PHYSICS_3D,
LAYER_RENDER_3D,
+ LAYER_NAVIGATION_3D,
};
private:
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 07312e42b4..8ce7153355 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -417,7 +417,12 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
updating = false;
return false;
- } else if (hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || hint == PROPERTY_HINT_LAYERS_2D_RENDER || hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || hint == PROPERTY_HINT_LAYERS_3D_RENDER) {
+ } else if (hint == PROPERTY_HINT_LAYERS_2D_PHYSICS ||
+ hint == PROPERTY_HINT_LAYERS_2D_RENDER ||
+ hint == PROPERTY_HINT_LAYERS_2D_NAVIGATION ||
+ hint == PROPERTY_HINT_LAYERS_3D_PHYSICS ||
+ hint == PROPERTY_HINT_LAYERS_3D_RENDER ||
+ hint == PROPERTY_HINT_LAYERS_3D_NAVIGATION) {
String basename;
switch (hint) {
case PROPERTY_HINT_LAYERS_2D_RENDER:
@@ -426,12 +431,18 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
case PROPERTY_HINT_LAYERS_2D_PHYSICS:
basename = "layer_names/2d_physics";
break;
+ case PROPERTY_HINT_LAYERS_2D_NAVIGATION:
+ basename = "layer_names/2d_navigation";
+ break;
case PROPERTY_HINT_LAYERS_3D_RENDER:
basename = "layer_names/3d_render";
break;
case PROPERTY_HINT_LAYERS_3D_PHYSICS:
basename = "layer_names/3d_physics";
break;
+ case PROPERTY_HINT_LAYERS_3D_NAVIGATION:
+ basename = "layer_names/3d_navigation";
+ break;
}
checks20gc->show();
@@ -1153,7 +1164,12 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
emit_signal("variant_changed");
} break;
case Variant::INT: {
- if (hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || hint == PROPERTY_HINT_LAYERS_2D_RENDER || hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || hint == PROPERTY_HINT_LAYERS_3D_RENDER) {
+ if (hint == PROPERTY_HINT_LAYERS_2D_PHYSICS ||
+ hint == PROPERTY_HINT_LAYERS_2D_RENDER ||
+ hint == PROPERTY_HINT_LAYERS_2D_NAVIGATION ||
+ hint == PROPERTY_HINT_LAYERS_3D_PHYSICS ||
+ hint == PROPERTY_HINT_LAYERS_3D_RENDER ||
+ hint == PROPERTY_HINT_LAYERS_3D_NAVIGATION) {
uint32_t f = v;
if (checks20[p_which]->is_pressed()) {
f |= (1 << p_which);