feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -81,6 +81,8 @@ void EditorNode3DGizmo::redraw() {
|
|||
gizmo_plugin->redraw(this);
|
||||
}
|
||||
|
||||
_update_bvh();
|
||||
|
||||
if (Node3DEditor::get_singleton()->is_current_selected_gizmo(this)) {
|
||||
Node3DEditor::get_singleton()->update_transform_gizmo();
|
||||
}
|
||||
|
|
@ -225,7 +227,7 @@ void EditorNode3DGizmo::Instance::create_instance(Node3D *p_base, bool p_hidden)
|
|||
|
||||
void EditorNode3DGizmo::add_mesh(const Ref<Mesh> &p_mesh, const Ref<Material> &p_material, const Transform3D &p_xform, const Ref<SkinReference> &p_skin_reference) {
|
||||
ERR_FAIL_NULL(spatial_node);
|
||||
ERR_FAIL_COND_MSG(!p_mesh.is_valid(), "EditorNode3DGizmo.add_mesh() requires a valid Mesh resource.");
|
||||
ERR_FAIL_COND_MSG(p_mesh.is_null(), "EditorNode3DGizmo.add_mesh() requires a valid Mesh resource.");
|
||||
|
||||
Instance ins;
|
||||
|
||||
|
|
@ -244,6 +246,32 @@ void EditorNode3DGizmo::add_mesh(const Ref<Mesh> &p_mesh, const Ref<Material> &p
|
|||
instances.push_back(ins);
|
||||
}
|
||||
|
||||
void EditorNode3DGizmo::_update_bvh() {
|
||||
ERR_FAIL_NULL(spatial_node);
|
||||
|
||||
Transform3D transform = spatial_node->get_global_transform();
|
||||
|
||||
float effective_icon_size = selectable_icon_size > 0.0f ? selectable_icon_size : 0.0f;
|
||||
Vector3 icon_size_vector3 = Vector3(effective_icon_size, effective_icon_size, effective_icon_size);
|
||||
AABB aabb(spatial_node->get_position() - icon_size_vector3 * 100.0f, icon_size_vector3 * 200.0f);
|
||||
|
||||
for (const Vector3 &segment_end : collision_segments) {
|
||||
aabb.expand_to(transform.xform(segment_end));
|
||||
}
|
||||
|
||||
if (collision_mesh.is_valid()) {
|
||||
for (const Face3 &face : collision_mesh->get_faces()) {
|
||||
aabb.expand_to(transform.xform(face.vertex[0]));
|
||||
aabb.expand_to(transform.xform(face.vertex[1]));
|
||||
aabb.expand_to(transform.xform(face.vertex[2]));
|
||||
}
|
||||
}
|
||||
|
||||
Node3DEditor::get_singleton()->update_gizmo_bvh_node(
|
||||
bvh_node_id,
|
||||
aabb);
|
||||
}
|
||||
|
||||
void EditorNode3DGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard, const Color &p_modulate) {
|
||||
add_vertices(p_lines, p_material, Mesh::PRIMITIVE_LINES, p_billboard, p_modulate);
|
||||
}
|
||||
|
|
@ -264,14 +292,11 @@ void EditorNode3DGizmo::add_vertices(const Vector<Vector3> &p_vertices, const Re
|
|||
|
||||
Vector<Color> color;
|
||||
color.resize(p_vertices.size());
|
||||
const Color vertex_color = (is_selected() ? Color(1, 1, 1, 0.8) : Color(1, 1, 1, 0.2)) * p_modulate;
|
||||
{
|
||||
Color *w = color.ptrw();
|
||||
for (int i = 0; i < p_vertices.size(); i++) {
|
||||
if (is_selected()) {
|
||||
w[i] = Color(1, 1, 1, 0.8) * p_modulate;
|
||||
} else {
|
||||
w[i] = Color(1, 1, 1, 0.2) * p_modulate;
|
||||
}
|
||||
w[i] = vertex_color;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -403,12 +428,13 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
|
|||
colors.resize(p_handles.size());
|
||||
Color *w = colors.ptrw();
|
||||
for (int i = 0; i < p_handles.size(); i++) {
|
||||
int id = p_ids.is_empty() ? i : p_ids[i];
|
||||
|
||||
Color col(1, 1, 1, 1);
|
||||
if (is_handle_highlighted(i, p_secondary)) {
|
||||
if (is_handle_highlighted(id, p_secondary)) {
|
||||
col = Color(0, 0, 1, 0.9);
|
||||
}
|
||||
|
||||
int id = p_ids.is_empty() ? i : p_ids[i];
|
||||
if (!is_current_hover_gizmo || current_hover_handle != id || p_secondary != current_hover_handle_secondary) {
|
||||
col.a = 0.8;
|
||||
}
|
||||
|
|
@ -765,6 +791,10 @@ void EditorNode3DGizmo::create() {
|
|||
instances.write[i].create_instance(spatial_node, hidden);
|
||||
}
|
||||
|
||||
bvh_node_id = Node3DEditor::get_singleton()->insert_gizmo_bvh_node(
|
||||
spatial_node,
|
||||
AABB(spatial_node->get_position(), Vector3(0, 0, 0)));
|
||||
|
||||
transform();
|
||||
}
|
||||
|
||||
|
|
@ -774,6 +804,8 @@ void EditorNode3DGizmo::transform() {
|
|||
for (int i = 0; i < instances.size(); i++) {
|
||||
RS::get_singleton()->instance_set_transform(instances[i].instance, spatial_node->get_global_transform() * instances[i].xform);
|
||||
}
|
||||
|
||||
_update_bvh();
|
||||
}
|
||||
|
||||
void EditorNode3DGizmo::free() {
|
||||
|
|
@ -790,6 +822,9 @@ void EditorNode3DGizmo::free() {
|
|||
|
||||
clear();
|
||||
|
||||
Node3DEditor::get_singleton()->remove_gizmo_bvh_node(bvh_node_id);
|
||||
bvh_node_id = DynamicBVH::ID();
|
||||
|
||||
valid = false;
|
||||
}
|
||||
|
||||
|
|
@ -945,7 +980,7 @@ void EditorNode3DGizmoPlugin::create_handle_material(const String &p_name, bool
|
|||
|
||||
handle_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
handle_material->set_flag(StandardMaterial3D::FLAG_USE_POINT_SIZE, true);
|
||||
Ref<Texture2D> handle_t = p_icon != nullptr ? p_icon : EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Editor3DHandle"), EditorStringName(EditorIcons));
|
||||
Ref<Texture2D> handle_t = p_icon.is_valid() ? p_icon : EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Editor3DHandle"), EditorStringName(EditorIcons));
|
||||
handle_material->set_point_size(handle_t->get_width());
|
||||
handle_material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, handle_t);
|
||||
handle_material->set_albedo(Color(1, 1, 1));
|
||||
|
|
@ -1023,7 +1058,7 @@ Ref<EditorNode3DGizmo> EditorNode3DGizmoPlugin::get_gizmo(Node3D *p_spatial) {
|
|||
ref->set_node_3d(p_spatial);
|
||||
ref->set_hidden(current_state == HIDDEN);
|
||||
|
||||
current_gizmos.push_back(ref.ptr());
|
||||
current_gizmos.insert(ref.ptr());
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue