You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Add preview Sun and Environment
* Adds both a preview sun and preview environment to the 3D editor. * They are valid as long as a DirectionalLight3D and WorldEnvironment are not in the scene. * If any is added to the scene, the respective preview is disabled. * Changed WorldEnvironment to better handle multiple node versions. * Added a function in SceneTree to get the first node in a group. * Fixed button minimum size to also consider font height if no text is there, this broke with the TextSever PR.
This commit is contained in:
@@ -956,6 +956,21 @@ bool SceneTree::has_group(const StringName &p_identifier) const {
|
||||
return group_map.has(p_identifier);
|
||||
}
|
||||
|
||||
Node *SceneTree::get_first_node_in_group(const StringName &p_group) {
|
||||
Map<StringName, Group>::Element *E = group_map.find(p_group);
|
||||
if (!E) {
|
||||
return nullptr; //no group
|
||||
}
|
||||
|
||||
_update_group_order(E->get()); //update order just in case
|
||||
|
||||
if (E->get().nodes.size() == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return E->get().nodes[0];
|
||||
}
|
||||
|
||||
void SceneTree::get_nodes_in_group(const StringName &p_group, List<Node *> *p_list) {
|
||||
Map<StringName, Group>::Element *E = group_map.find(p_group);
|
||||
if (!E) {
|
||||
@@ -1216,6 +1231,7 @@ void SceneTree::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_group", "group", "property", "value"), &SceneTree::set_group);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_nodes_in_group", "group"), &SceneTree::_get_nodes_in_group);
|
||||
ClassDB::bind_method(D_METHOD("get_first_node_in_group", "group"), &SceneTree::get_first_node_in_group);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_current_scene", "child_node"), &SceneTree::set_current_scene);
|
||||
ClassDB::bind_method(D_METHOD("get_current_scene"), &SceneTree::get_current_scene);
|
||||
|
||||
Reference in New Issue
Block a user