parent
820cdb46fd
commit
86fcc39fa9
4 changed files with 26 additions and 40 deletions
|
@ -1394,11 +1394,13 @@ void EditorNode::_property_editor_back() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_menu_collapseall() {
|
void EditorNode::_menu_collapseall() {
|
||||||
property_editor->collapse_all_parent_nodes();
|
|
||||||
|
property_editor->collapse_all_folding();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_menu_expandall() {
|
void EditorNode::_menu_expandall() {
|
||||||
property_editor->expand_all_parent_nodes();
|
|
||||||
|
property_editor->expand_all_folding();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_save_default_environment() {
|
void EditorNode::_save_default_environment() {
|
||||||
|
@ -5444,7 +5446,7 @@ EditorNode::EditorNode() {
|
||||||
property_editor->set_use_doc_hints(true);
|
property_editor->set_use_doc_hints(true);
|
||||||
property_editor->set_hide_script(false);
|
property_editor->set_hide_script(false);
|
||||||
property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
|
property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
|
||||||
property_editor->set_use_folding(bool(EDITOR_DEF("interface/editor/expand_all_properties", false)) == false);
|
property_editor->set_use_folding(!bool(EDITOR_DEF("interface/editor/disable_inspector_folding", false)));
|
||||||
|
|
||||||
property_editor->hide_top_label();
|
property_editor->hide_top_label();
|
||||||
property_editor->register_text_enter(search_box);
|
property_editor->register_text_enter(search_box);
|
||||||
|
|
|
@ -2665,18 +2665,14 @@ TreeItem *PropertyEditor::get_parent_node(String p_path, HashMap<String, TreeIte
|
||||||
item->set_editable(1, false);
|
item->set_editable(1, false);
|
||||||
item->set_selectable(1, subsection_selectable);
|
item->set_selectable(1, subsection_selectable);
|
||||||
|
|
||||||
if (use_folding || folding_behaviour != FB_UNDEFINED) { // Even if you disabled folding (expand all by default), you still can collapse all manually.
|
if (use_folding) { //
|
||||||
if (!obj->editor_is_section_unfolded(p_path)) {
|
if (!obj->editor_is_section_unfolded(p_path)) {
|
||||||
updating_folding = true;
|
updating_folding = true;
|
||||||
if (folding_behaviour == FB_COLLAPSEALL)
|
item->set_collapsed(true);
|
||||||
item->set_collapsed(true);
|
|
||||||
else if (folding_behaviour == FB_EXPANDALL || is_expandall_enabled)
|
|
||||||
item->set_collapsed(false);
|
|
||||||
else
|
|
||||||
item->set_collapsed(true);
|
|
||||||
updating_folding = false;
|
updating_folding = false;
|
||||||
}
|
}
|
||||||
item->set_metadata(0, p_path);
|
item->set_metadata(0, p_path);
|
||||||
|
foldable_property_cache.push_back(p_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->get_parent() == root) {
|
if (item->get_parent() == root) {
|
||||||
|
@ -2725,6 +2721,7 @@ void PropertyEditor::refresh() {
|
||||||
void PropertyEditor::update_tree() {
|
void PropertyEditor::update_tree() {
|
||||||
|
|
||||||
tree->clear();
|
tree->clear();
|
||||||
|
foldable_property_cache.clear();
|
||||||
|
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return;
|
return;
|
||||||
|
@ -3733,7 +3730,7 @@ void PropertyEditor::_item_edited() {
|
||||||
_edit_set(name, item->get_text(1), refresh_all);
|
_edit_set(name, item->get_text(1), refresh_all);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
// math types
|
// math types
|
||||||
|
|
||||||
case Variant::VECTOR3: {
|
case Variant::VECTOR3: {
|
||||||
|
|
||||||
|
@ -4212,29 +4209,29 @@ void PropertyEditor::set_subsection_selectable(bool p_selectable) {
|
||||||
update_tree();
|
update_tree();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyEditor::is_expand_all_properties_enabled() const {
|
|
||||||
|
|
||||||
return (use_folding == false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropertyEditor::set_use_folding(bool p_enable) {
|
void PropertyEditor::set_use_folding(bool p_enable) {
|
||||||
|
|
||||||
use_folding = p_enable;
|
use_folding = p_enable;
|
||||||
tree->set_hide_folding(false);
|
tree->set_hide_folding(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyEditor::collapse_all_parent_nodes() {
|
void PropertyEditor::collapse_all_folding() {
|
||||||
|
if (!obj)
|
||||||
folding_behaviour = FB_COLLAPSEALL;
|
return;
|
||||||
|
for (List<String>::Element *E = foldable_property_cache.front(); E; E = E->next()) {
|
||||||
|
obj->editor_set_section_unfold(E->get(), false);
|
||||||
|
}
|
||||||
update_tree();
|
update_tree();
|
||||||
folding_behaviour = FB_UNDEFINED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyEditor::expand_all_parent_nodes() {
|
void PropertyEditor::expand_all_folding() {
|
||||||
|
|
||||||
folding_behaviour = FB_EXPANDALL;
|
if (!obj)
|
||||||
|
return;
|
||||||
|
for (List<String>::Element *E = foldable_property_cache.front(); E; E = E->next()) {
|
||||||
|
obj->editor_set_section_unfold(E->get(), true);
|
||||||
|
}
|
||||||
update_tree();
|
update_tree();
|
||||||
folding_behaviour = FB_UNDEFINED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyEditor::PropertyEditor() {
|
PropertyEditor::PropertyEditor() {
|
||||||
|
@ -4309,8 +4306,6 @@ PropertyEditor::PropertyEditor() {
|
||||||
subsection_selectable = false;
|
subsection_selectable = false;
|
||||||
property_selectable = false;
|
property_selectable = false;
|
||||||
show_type_icons = false; // maybe one day will return.
|
show_type_icons = false; // maybe one day will return.
|
||||||
folding_behaviour = FB_UNDEFINED;
|
|
||||||
is_expandall_enabled = bool(EDITOR_DEF("interface/editor/expand_all_properties", true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyEditor::~PropertyEditor() {
|
PropertyEditor::~PropertyEditor() {
|
||||||
|
|
|
@ -203,18 +203,9 @@ class PropertyEditor : public Control {
|
||||||
bool hide_script;
|
bool hide_script;
|
||||||
bool use_folding;
|
bool use_folding;
|
||||||
bool property_selectable;
|
bool property_selectable;
|
||||||
bool is_expandall_enabled;
|
|
||||||
|
|
||||||
bool updating_folding;
|
bool updating_folding;
|
||||||
|
|
||||||
enum FOLDING_BEHAVIOUR {
|
List<String> foldable_property_cache;
|
||||||
FB_UNDEFINED,
|
|
||||||
FB_COLLAPSEALL,
|
|
||||||
FB_EXPANDALL,
|
|
||||||
FB_EXPANDALL_FORCE
|
|
||||||
};
|
|
||||||
FOLDING_BEHAVIOUR folding_behaviour;
|
|
||||||
|
|
||||||
HashMap<String, String> pending;
|
HashMap<String, String> pending;
|
||||||
String selected_property;
|
String selected_property;
|
||||||
|
|
||||||
|
@ -314,10 +305,8 @@ public:
|
||||||
|
|
||||||
void set_use_folding(bool p_enable);
|
void set_use_folding(bool p_enable);
|
||||||
|
|
||||||
bool is_expand_all_properties_enabled() const;
|
void collapse_all_folding();
|
||||||
|
void expand_all_folding();
|
||||||
void collapse_all_parent_nodes();
|
|
||||||
void expand_all_parent_nodes();
|
|
||||||
PropertyEditor();
|
PropertyEditor();
|
||||||
~PropertyEditor();
|
~PropertyEditor();
|
||||||
};
|
};
|
||||||
|
|
|
@ -164,7 +164,7 @@ void PrimitiveMesh::_bind_methods() {
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_mesh_arrays"), &PrimitiveMesh::get_mesh_arrays);
|
ClassDB::bind_method(D_METHOD("get_mesh_arrays"), &PrimitiveMesh::get_mesh_arrays);
|
||||||
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_material", "get_material");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrimitiveMesh::set_material(const Ref<Material> &p_material) {
|
void PrimitiveMesh::set_material(const Ref<Material> &p_material) {
|
||||||
|
|
Loading…
Reference in a new issue