Merge pull request #108767 from aaronfranke/editor-3d-org

Organize 3D editor code and rename a few 3D things
This commit is contained in:
Thaddeus Crews
2026-06-23 14:49:11 -05:00
21 changed files with 221 additions and 226 deletions
@@ -2351,7 +2351,7 @@ AnimationPlayerEditor::~AnimationPlayerEditor() {
void AnimationPlayerEditorPlugin::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
Node3DEditor::get_singleton()->connect(SNAME("transform_key_request"), callable_mp(this, &AnimationPlayerEditorPlugin::_transform_key_request));
Node3DEditor::get_singleton()->connect(SNAME("transform_3d_key_request"), callable_mp(this, &AnimationPlayerEditorPlugin::_transform_3d_key_request));
InspectorDock::get_inspector_singleton()->connect(SNAME("property_keyed"), callable_mp(this, &AnimationPlayerEditorPlugin::_property_keyed));
anim_editor->get_track_editor()->connect(SNAME("keying_changed"), callable_mp(this, &AnimationPlayerEditorPlugin::_update_keying));
InspectorDock::get_inspector_singleton()->connect(SNAME("edited_object_changed"), callable_mp(anim_editor->get_track_editor(), &AnimationTrackEditor::update_keying));
@@ -2369,7 +2369,7 @@ void AnimationPlayerEditorPlugin::_property_keyed(const String &p_keyed, const V
te->insert_value_key(p_keyed, p_advance);
}
void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key) {
void AnimationPlayerEditorPlugin::_transform_3d_key_request(Object *sp, const String &p_sub, const Transform3D &p_key) {
if (!anim_editor->get_track_editor()->has_keying()) {
return;
}
@@ -2377,9 +2377,9 @@ void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const Strin
if (!s) {
return;
}
anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_POSITION_3D, p_key.origin);
anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_ROTATION_3D, p_key.basis.get_rotation_quaternion());
anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_SCALE_3D, p_key.basis.get_scale());
anim_editor->get_track_editor()->insert_transform_3d_key(s, p_sub, Animation::TYPE_POSITION_3D, p_key.origin);
anim_editor->get_track_editor()->insert_transform_3d_key(s, p_sub, Animation::TYPE_ROTATION_3D, p_key.basis.get_rotation_quaternion());
anim_editor->get_track_editor()->insert_transform_3d_key(s, p_sub, Animation::TYPE_SCALE_3D, p_key.basis.get_scale());
}
void AnimationPlayerEditorPlugin::_update_keying() {
@@ -296,7 +296,7 @@ protected:
void _notification(int p_what);
void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
void _transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key);
void _transform_3d_key_request(Object *sp, const String &p_sub, const Transform3D &p_key);
void _update_keying();
public:
+2 -2
View File
@@ -4536,7 +4536,7 @@ void AnimationTrackEditor::_insert_track(bool p_reset_wanted, bool p_create_bezi
}
}
void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value) {
void AnimationTrackEditor::insert_transform_3d_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value) {
if (read_only) {
popup_read_only_dialog();
return;
@@ -4584,7 +4584,7 @@ void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_
_query_insert(id);
}
bool AnimationTrackEditor::has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type) {
bool AnimationTrackEditor::has_transform_3d_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type) {
ERR_FAIL_NULL_V(root, false);
if (!keying) {
return false;
+2 -2
View File
@@ -973,8 +973,8 @@ public:
void set_anim_pos(float p_pos);
void insert_node_value_key(Node *p_node, const String &p_property, bool p_only_if_exists = false, bool p_advance = false);
void insert_value_key(const String &p_property, bool p_advance);
void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value);
bool has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type);
void insert_transform_3d_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value);
bool has_transform_3d_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type);
void make_insert_queue();
void commit_insert_queue();
+16 -16
View File
@@ -5227,9 +5227,9 @@ void EditorNode::get_preload_scene_modification_table(
new_additive_node_entry.owner = p_node->get_owner();
new_additive_node_entry.index = p_node->get_index();
Node2D *node_2d = Object::cast_to<Node2D>(p_node);
if (node_2d) {
new_additive_node_entry.transform_2d = node_2d->get_transform();
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
if (canvas_item) {
new_additive_node_entry.transform_2d = canvas_item->get_transform();
}
Node3D *node_3d = Object::cast_to<Node3D>(p_node);
if (node_3d) {
@@ -8572,14 +8572,14 @@ EditorNode::EditorNode() {
import_wav.instantiate();
ResourceFormatImporter::get_singleton()->add_importer(import_wav);
Ref<ResourceImporterOBJ> import_obj;
import_obj.instantiate();
ResourceFormatImporter::get_singleton()->add_importer(import_obj);
Ref<ResourceImporterShaderFile> import_shader_file;
import_shader_file.instantiate();
ResourceFormatImporter::get_singleton()->add_importer(import_shader_file);
Ref<ResourceImporterOBJ> import_obj;
import_obj.instantiate();
ResourceFormatImporter::get_singleton()->add_importer(import_obj);
Ref<ResourceImporterScene> import_model_as_scene;
import_model_as_scene.instantiate("PackedScene");
ResourceFormatImporter::get_singleton()->add_importer(import_model_as_scene);
@@ -9456,14 +9456,6 @@ EditorNode::EditorNode() {
resource_preview->add_preview_generator(Ref<EditorGradientPreviewPlugin>(memnew(EditorGradientPreviewPlugin)));
{
Ref<StandardMaterial3DConversionPlugin> spatial_mat_convert;
spatial_mat_convert.instantiate();
resource_conversion_plugins.push_back(spatial_mat_convert);
Ref<ORMMaterial3DConversionPlugin> orm_mat_convert;
orm_mat_convert.instantiate();
resource_conversion_plugins.push_back(orm_mat_convert);
Ref<CanvasItemMaterialConversionPlugin> canvas_item_mat_convert;
canvas_item_mat_convert.instantiate();
resource_conversion_plugins.push_back(canvas_item_mat_convert);
@@ -9476,6 +9468,14 @@ EditorNode::EditorNode() {
particles_mat_convert.instantiate();
resource_conversion_plugins.push_back(particles_mat_convert);
Ref<StandardMaterial3DConversionPlugin> spatial_mat_convert;
spatial_mat_convert.instantiate();
resource_conversion_plugins.push_back(spatial_mat_convert);
Ref<ORMMaterial3DConversionPlugin> orm_mat_convert;
orm_mat_convert.instantiate();
resource_conversion_plugins.push_back(orm_mat_convert);
Ref<ProceduralSkyMaterialConversionPlugin> procedural_sky_mat_convert;
procedural_sky_mat_convert.instantiate();
resource_conversion_plugins.push_back(procedural_sky_mat_convert);
@@ -9615,7 +9615,7 @@ EditorNode::EditorNode() {
ResourceLoader::set_load_callback(_resource_loaded);
// Apply setting presets in case the editor_settings file is missing values.
EditorSettingsDialog::update_navigation_preset();
EditorSettingsDialog::update_3d_navigation_preset();
screenshot_timer = memnew(Timer);
screenshot_timer->set_one_shot(true);
+47 -48
View File
@@ -791,7 +791,53 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R
return p_node;
}
if (_teststr(name, "colonly") || _teststr(name, "convcolonly")) {
if (_teststr(name, "occ") || _teststr(name, "occonly")) {
if (isroot) {
return p_node;
}
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(p_node);
if (mi) {
Ref<ImporterMesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
if (r_occluder_arrays) {
OccluderInstance3D::bake_single_node(mi, 0.0f, r_occluder_arrays->first, r_occluder_arrays->second);
}
if (_teststr(name, "occ")) {
String fixed_name = _fixstr(name, "occ");
if (!fixed_name.is_empty()) {
if (mi->get_parent() && !mi->get_parent()->has_node(fixed_name)) {
mi->set_name(fixed_name);
}
}
} else {
p_node->set_owner(nullptr);
memdelete(p_node);
p_node = nullptr;
}
}
}
} else if (_teststr(name, "navmesh") && Object::cast_to<ImporterMeshInstance3D>(p_node)) {
if (isroot) {
return p_node;
}
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(p_node);
Ref<ImporterMesh> mesh = mi->get_mesh();
ERR_FAIL_COND_V(mesh.is_null(), nullptr);
NavigationRegion3D *nmi = memnew(NavigationRegion3D);
nmi->set_name(_fixstr(name, "navmesh"));
Ref<NavigationMesh> nmesh = mesh->create_navigation_mesh();
nmi->set_navigation_mesh(nmesh);
Object::cast_to<Node3D>(nmi)->set_transform(mi->get_transform());
_copy_meta(p_node, nmi);
p_node->replace_by(nmi);
p_node->set_owner(nullptr);
memdelete(p_node);
p_node = nmi;
} else if (_teststr(name, "colonly") || _teststr(name, "convcolonly")) {
if (isroot) {
return p_node;
}
@@ -942,53 +988,6 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R
_add_shapes(col, shapes);
}
}
} else if (_teststr(name, "navmesh") && Object::cast_to<ImporterMeshInstance3D>(p_node)) {
if (isroot) {
return p_node;
}
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(p_node);
Ref<ImporterMesh> mesh = mi->get_mesh();
ERR_FAIL_COND_V(mesh.is_null(), nullptr);
NavigationRegion3D *nmi = memnew(NavigationRegion3D);
nmi->set_name(_fixstr(name, "navmesh"));
Ref<NavigationMesh> nmesh = mesh->create_navigation_mesh();
nmi->set_navigation_mesh(nmesh);
Object::cast_to<Node3D>(nmi)->set_transform(mi->get_transform());
_copy_meta(p_node, nmi);
p_node->replace_by(nmi);
p_node->set_owner(nullptr);
memdelete(p_node);
p_node = nmi;
} else if (_teststr(name, "occ") || _teststr(name, "occonly")) {
if (isroot) {
return p_node;
}
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(p_node);
if (mi) {
Ref<ImporterMesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
if (r_occluder_arrays) {
OccluderInstance3D::bake_single_node(mi, 0.0f, r_occluder_arrays->first, r_occluder_arrays->second);
}
if (_teststr(name, "occ")) {
String fixed_name = _fixstr(name, "occ");
if (!fixed_name.is_empty()) {
if (mi->get_parent() && !mi->get_parent()->has_node(fixed_name)) {
mi->set_name(fixed_name);
}
}
} else {
p_node->set_owner(nullptr);
memdelete(p_node);
p_node = nullptr;
}
}
}
} else if (_teststr(name, "vehicle")) {
if (isroot) {
return p_node;
+2 -2
View File
@@ -3551,10 +3551,10 @@ void EditorPropertyResource::_update_preferred_shader() {
// Set preferred shader based on edited parent type.
if ((Object::cast_to<GPUParticles2D>(ed_object) || Object::cast_to<GPUParticles3D>(ed_object)) && ed_property == SNAME("process_material")) {
shader_picker->set_preferred_mode(Shader::MODE_PARTICLES);
} else if (Object::cast_to<FogVolume>(ed_object)) {
shader_picker->set_preferred_mode(Shader::MODE_FOG);
} else if (Object::cast_to<CanvasItem>(ed_object)) {
shader_picker->set_preferred_mode(Shader::MODE_CANVAS_ITEM);
} else if (Object::cast_to<FogVolume>(ed_object)) {
shader_picker->set_preferred_mode(Shader::MODE_FOG);
} else if (Object::cast_to<Node3D>(ed_object) || Object::cast_to<Mesh>(ed_object)) {
shader_picker->set_preferred_mode(Shader::MODE_SPATIAL);
} else if (Object::cast_to<Sky>(ed_object)) {
+17 -16
View File
@@ -491,16 +491,6 @@ void EditorPlugin::remove_node_3d_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin
Node3DEditor::get_singleton()->remove_gizmo_plugin(p_gizmo_plugin);
}
void EditorPlugin::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
ERR_FAIL_COND(p_plugin.is_null());
EditorInspector::add_inspector_plugin(p_plugin);
}
void EditorPlugin::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
ERR_FAIL_COND(p_plugin.is_null());
EditorInspector::remove_inspector_plugin(p_plugin);
}
void EditorPlugin::add_scene_format_importer_plugin(const Ref<EditorSceneFormatImporter> &p_importer, bool p_first_priority) {
ERR_FAIL_COND(p_importer.is_null());
ResourceImporterScene::add_scene_importer(p_importer, p_first_priority);
@@ -519,6 +509,16 @@ void EditorPlugin::remove_scene_post_import_plugin(const Ref<EditorScenePostImpo
ResourceImporterScene::remove_post_importer_plugin(p_plugin);
}
void EditorPlugin::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
ERR_FAIL_COND(p_plugin.is_null());
EditorInspector::add_inspector_plugin(p_plugin);
}
void EditorPlugin::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
ERR_FAIL_COND(p_plugin.is_null());
EditorInspector::remove_inspector_plugin(p_plugin);
}
void EditorPlugin::add_context_menu_plugin(EditorContextMenuPlugin::ContextMenuSlot p_slot, const Ref<EditorContextMenuPlugin> &p_plugin) {
EditorContextMenuPluginManager::get_singleton()->add_plugin(p_slot, p_plugin);
}
@@ -662,16 +662,10 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_translation_parser_plugin", "parser"), &EditorPlugin::remove_translation_parser_plugin);
ClassDB::bind_method(D_METHOD("add_import_plugin", "importer", "first_priority"), &EditorPlugin::add_import_plugin, DEFVAL(false));
ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer"), &EditorPlugin::remove_import_plugin);
ClassDB::bind_method(D_METHOD("add_scene_format_importer_plugin", "scene_format_importer", "first_priority"), &EditorPlugin::add_scene_format_importer_plugin, DEFVAL(false));
ClassDB::bind_method(D_METHOD("remove_scene_format_importer_plugin", "scene_format_importer"), &EditorPlugin::remove_scene_format_importer_plugin);
ClassDB::bind_method(D_METHOD("add_scene_post_import_plugin", "scene_import_plugin", "first_priority"), &EditorPlugin::add_scene_post_import_plugin, DEFVAL(false));
ClassDB::bind_method(D_METHOD("remove_scene_post_import_plugin", "scene_import_plugin"), &EditorPlugin::remove_scene_post_import_plugin);
ClassDB::bind_method(D_METHOD("add_export_plugin", "plugin"), &EditorPlugin::add_export_plugin);
ClassDB::bind_method(D_METHOD("remove_export_plugin", "plugin"), &EditorPlugin::remove_export_plugin);
ClassDB::bind_method(D_METHOD("add_export_platform", "platform"), &EditorPlugin::add_export_platform);
ClassDB::bind_method(D_METHOD("remove_export_platform", "platform"), &EditorPlugin::remove_export_platform);
ClassDB::bind_method(D_METHOD("add_node_3d_gizmo_plugin", "plugin"), &EditorPlugin::add_node_3d_gizmo_plugin);
ClassDB::bind_method(D_METHOD("remove_node_3d_gizmo_plugin", "plugin"), &EditorPlugin::remove_node_3d_gizmo_plugin);
ClassDB::bind_method(D_METHOD("add_inspector_plugin", "plugin"), &EditorPlugin::add_inspector_plugin);
ClassDB::bind_method(D_METHOD("remove_inspector_plugin", "plugin"), &EditorPlugin::remove_inspector_plugin);
ClassDB::bind_method(D_METHOD("add_resource_conversion_plugin", "plugin"), &EditorPlugin::add_resource_conversion_plugin);
@@ -681,6 +675,13 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_context_menu_plugin", "slot", "plugin"), &EditorPlugin::add_context_menu_plugin);
ClassDB::bind_method(D_METHOD("remove_context_menu_plugin", "plugin"), &EditorPlugin::remove_context_menu_plugin);
ClassDB::bind_method(D_METHOD("add_node_3d_gizmo_plugin", "plugin"), &EditorPlugin::add_node_3d_gizmo_plugin);
ClassDB::bind_method(D_METHOD("remove_node_3d_gizmo_plugin", "plugin"), &EditorPlugin::remove_node_3d_gizmo_plugin);
ClassDB::bind_method(D_METHOD("add_scene_format_importer_plugin", "scene_format_importer", "first_priority"), &EditorPlugin::add_scene_format_importer_plugin, DEFVAL(false));
ClassDB::bind_method(D_METHOD("remove_scene_format_importer_plugin", "scene_format_importer"), &EditorPlugin::remove_scene_format_importer_plugin);
ClassDB::bind_method(D_METHOD("add_scene_post_import_plugin", "scene_import_plugin", "first_priority"), &EditorPlugin::add_scene_post_import_plugin, DEFVAL(false));
ClassDB::bind_method(D_METHOD("remove_scene_post_import_plugin", "scene_import_plugin"), &EditorPlugin::remove_scene_post_import_plugin);
ClassDB::bind_method(D_METHOD("get_editor_interface"), &EditorPlugin::get_editor_interface);
ClassDB::bind_method(D_METHOD("get_script_create_dialog"), &EditorPlugin::get_script_create_dialog);
ClassDB::bind_method(D_METHOD("add_debugger_plugin", "script"), &EditorPlugin::add_debugger_plugin);
+3 -3
View File
@@ -246,15 +246,15 @@ public:
void add_node_3d_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin);
void remove_node_3d_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin);
void add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
void add_scene_format_importer_plugin(const Ref<EditorSceneFormatImporter> &p_importer, bool p_first_priority = false);
void remove_scene_format_importer_plugin(const Ref<EditorSceneFormatImporter> &p_importer);
void add_scene_post_import_plugin(const Ref<EditorScenePostImportPlugin> &p_importer, bool p_first_priority = false);
void remove_scene_post_import_plugin(const Ref<EditorScenePostImportPlugin> &p_importer);
void add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
void add_autoload_singleton(const String &p_name, const String &p_path);
void remove_autoload_singleton(const String &p_name);
+35 -29
View File
@@ -162,8 +162,6 @@ void register_editor_types() {
GDREGISTER_CLASS(EditorFileDialog);
GDREGISTER_VIRTUAL_CLASS(EditorSettings);
GDREGISTER_ABSTRACT_CLASS(EditorToaster);
GDREGISTER_CLASS(EditorNode3DGizmo);
GDREGISTER_CLASS(EditorNode3DGizmoPlugin);
GDREGISTER_ABSTRACT_CLASS(EditorResourcePreview);
GDREGISTER_CLASS(EditorResourcePreviewGenerator);
GDREGISTER_CLASS(EditorResourceTooltipPlugin);
@@ -184,8 +182,6 @@ void register_editor_types() {
register_exporter_types();
GDREGISTER_CLASS(EditorResourceConversionPlugin);
GDREGISTER_CLASS(EditorSceneFormatImporter);
GDREGISTER_CLASS(EditorScenePostImportPlugin);
GDREGISTER_CLASS(EditorInspector);
GDREGISTER_CLASS(EditorInspectorPlugin);
GDREGISTER_CLASS(EditorProperty);
@@ -200,11 +196,17 @@ void register_editor_types() {
GDREGISTER_ABSTRACT_CLASS(FileSystemDock);
GDREGISTER_VIRTUAL_CLASS(EditorFileSystemImportFormatSupportQuery);
GDREGISTER_CLASS(EditorScenePostImport);
GDREGISTER_VIRTUAL_CLASS(EditorCommandPalette);
GDREGISTER_CLASS(EditorDebuggerPlugin);
GDREGISTER_ABSTRACT_CLASS(EditorDebuggerSession);
// 3D editor foundational classes.
GDREGISTER_CLASS(EditorNode3DGizmo);
GDREGISTER_CLASS(EditorNode3DGizmoPlugin);
GDREGISTER_CLASS(EditorSceneFormatImporter);
GDREGISTER_CLASS(EditorScenePostImportPlugin);
GDREGISTER_CLASS(EditorScenePostImport);
// Required to document import options in the class reference.
GDREGISTER_CLASS(ResourceImporterBitMap);
GDREGISTER_CLASS(ResourceImporterBMFont);
@@ -221,42 +223,27 @@ void register_editor_types() {
GDREGISTER_CLASS(ResourceImporterTextureAtlas);
GDREGISTER_CLASS(ResourceImporterWAV);
// This list is alphabetized, and plugins that depend on Node2D are in their own section below.
// This list is alphabetized, and plugins that depend on Node2D or Node3D are in their own section below.
EditorPlugins::add_by_type<AnimationTreeEditorPlugin>();
EditorPlugins::add_by_type<AudioStreamEditorPlugin>();
EditorPlugins::add_by_type<AudioStreamRandomizerEditorPlugin>();
EditorPlugins::add_by_type<BitMapEditorPlugin>();
EditorPlugins::add_by_type<BoneMapEditorPlugin>();
EditorPlugins::add_by_type<Camera3DEditorPlugin>();
EditorPlugins::add_by_type<ControlEditorPlugin>();
EditorPlugins::add_by_type<CPUParticles3DEditorPlugin>();
EditorPlugins::add_by_type<CurveEditorPlugin>();
if (!Engine::get_singleton()->is_recovery_mode_hint()) {
EditorPlugins::add_by_type<DebugAdapterServer>();
}
EditorPlugins::add_by_type<EditorScriptPlugin>();
EditorPlugins::add_by_type<FontEditorPlugin>();
EditorPlugins::add_by_type<GPUParticles3DEditorPlugin>();
EditorPlugins::add_by_type<GPUParticlesCollisionSDF3DEditorPlugin>();
EditorPlugins::add_by_type<GradientEditorPlugin>();
EditorPlugins::add_by_type<GradientTexture2DEditorPlugin>();
EditorPlugins::add_by_type<InputEventEditorPlugin>();
EditorPlugins::add_by_type<LightmapGIEditorPlugin>();
EditorPlugins::add_by_type<MarginContainerEditorPlugin>();
EditorPlugins::add_by_type<MaterialEditorPlugin>();
EditorPlugins::add_by_type<MeshEditorPlugin>();
EditorPlugins::add_by_type<MeshInstance3DEditorPlugin>();
EditorPlugins::add_by_type<MeshLibraryEditorPlugin>();
EditorPlugins::add_by_type<MultiMeshEditorPlugin>();
EditorPlugins::add_by_type<OccluderInstance3DEditorPlugin>();
EditorPlugins::add_by_type<PackedSceneEditorPlugin>();
EditorPlugins::add_by_type<Path3DEditorPlugin>();
EditorPlugins::add_by_type<PhysicalBone3DEditorPlugin>();
EditorPlugins::add_by_type<Polygon3DEditorPlugin>();
EditorPlugins::add_by_type<ResourcePreloaderEditorPlugin>();
EditorPlugins::add_by_type<ShaderEditorPlugin>();
EditorPlugins::add_by_type<ShaderFileEditorPlugin>();
EditorPlugins::add_by_type<Skeleton3DEditorPlugin>();
EditorPlugins::add_by_type<SpriteFramesEditorPlugin>();
EditorPlugins::add_by_type<StyleBoxEditorPlugin>();
EditorPlugins::add_by_type<SubViewportPreviewEditorPlugin>();
@@ -267,31 +254,50 @@ void register_editor_types() {
EditorPlugins::add_by_type<ThemeEditorPlugin>();
EditorPlugins::add_by_type<ToolButtonEditorPlugin>();
EditorPlugins::add_by_type<VirtualJoystickEditorPlugin>();
EditorPlugins::add_by_type<VoxelGIEditorPlugin>();
#ifndef DISABLE_DEPRECATED
EditorPlugins::add_by_type<SkeletonIK3DEditorPlugin>();
#endif
// 2D
// Node2D-based editor plugins.
EditorPlugins::add_by_type<Camera2DEditorPlugin>();
EditorPlugins::add_by_type<CollisionPolygon2DEditorPlugin>();
EditorPlugins::add_by_type<CollisionShape2DEditorPlugin>();
EditorPlugins::add_by_type<CPUParticles2DEditorPlugin>();
EditorPlugins::add_by_type<GPUParticles2DEditorPlugin>();
EditorPlugins::add_by_type<LightOccluder2DEditorPlugin>();
EditorPlugins::add_by_type<Line2DEditorPlugin>();
EditorPlugins::add_by_type<Path2DEditorPlugin>();
EditorPlugins::add_by_type<Polygon2DEditorPlugin>();
EditorPlugins::add_by_type<Cast2DEditorPlugin>();
EditorPlugins::add_by_type<Skeleton2DEditorPlugin>();
EditorPlugins::add_by_type<Sprite2DEditorPlugin>();
EditorPlugins::add_by_type<TileSetEditorPlugin>();
EditorPlugins::add_by_type<TileMapEditorPlugin>();
EditorPlugins::add_by_type<ScenePaint2DEditorPlugin>();
// 2D physics editor plugins.
EditorPlugins::add_by_type<Cast2DEditorPlugin>();
EditorPlugins::add_by_type<CollisionPolygon2DEditorPlugin>();
EditorPlugins::add_by_type<CollisionShape2DEditorPlugin>();
#ifndef DISABLE_DEPRECATED
EditorPlugins::add_by_type<ParallaxBackgroundEditorPlugin>();
#endif
// 3D editor plugins.
EditorPlugins::add_by_type<BoneMapEditorPlugin>();
EditorPlugins::add_by_type<Camera3DEditorPlugin>();
EditorPlugins::add_by_type<CPUParticles3DEditorPlugin>();
EditorPlugins::add_by_type<GPUParticles3DEditorPlugin>();
EditorPlugins::add_by_type<GPUParticlesCollisionSDF3DEditorPlugin>();
EditorPlugins::add_by_type<LightmapGIEditorPlugin>();
EditorPlugins::add_by_type<MeshEditorPlugin>();
EditorPlugins::add_by_type<MeshInstance3DEditorPlugin>();
EditorPlugins::add_by_type<MeshLibraryEditorPlugin>();
EditorPlugins::add_by_type<OccluderInstance3DEditorPlugin>();
EditorPlugins::add_by_type<MultiMeshEditorPlugin>();
EditorPlugins::add_by_type<Path3DEditorPlugin>();
EditorPlugins::add_by_type<Polygon3DEditorPlugin>();
EditorPlugins::add_by_type<Skeleton3DEditorPlugin>();
EditorPlugins::add_by_type<VoxelGIEditorPlugin>();
// 3D physics editor plugins.
EditorPlugins::add_by_type<PhysicalBone3DEditorPlugin>();
#ifndef DISABLE_DEPRECATED
EditorPlugins::add_by_type<SkeletonIK3DEditorPlugin>();
#endif
// For correct doc generation.
GLOBAL_DEF(PropertyInfo(Variant::STRING, "editor/run/main_run_args", PROPERTY_HINT_NONE, "monospace"), "");
+10 -9
View File
@@ -2842,17 +2842,12 @@ void Node3DEditor::_register_all_gizmos() {
add_gizmo_plugin(Ref<AudioListener3DGizmoPlugin>(memnew(AudioListener3DGizmoPlugin)));
add_gizmo_plugin(Ref<MeshInstance3DGizmoPlugin>(memnew(MeshInstance3DGizmoPlugin)));
add_gizmo_plugin(Ref<OccluderInstance3DGizmoPlugin>(memnew(OccluderInstance3DGizmoPlugin)));
add_gizmo_plugin(Ref<SoftBody3DGizmoPlugin>(memnew(SoftBody3DGizmoPlugin)));
add_gizmo_plugin(Ref<SpriteBase3DGizmoPlugin>(memnew(SpriteBase3DGizmoPlugin)));
add_gizmo_plugin(Ref<Label3DGizmoPlugin>(memnew(Label3DGizmoPlugin)));
add_gizmo_plugin(Ref<GeometryInstance3DGizmoPlugin>(memnew(GeometryInstance3DGizmoPlugin)));
add_gizmo_plugin(Ref<Marker3DGizmoPlugin>(memnew(Marker3DGizmoPlugin)));
add_gizmo_plugin(Ref<RayCast3DGizmoPlugin>(memnew(RayCast3DGizmoPlugin)));
add_gizmo_plugin(Ref<ShapeCast3DGizmoPlugin>(memnew(ShapeCast3DGizmoPlugin)));
add_gizmo_plugin(Ref<SpringArm3DGizmoPlugin>(memnew(SpringArm3DGizmoPlugin)));
add_gizmo_plugin(Ref<SpringBoneCollision3DGizmoPlugin>(memnew(SpringBoneCollision3DGizmoPlugin)));
add_gizmo_plugin(Ref<SpringBoneSimulator3DGizmoPlugin>(memnew(SpringBoneSimulator3DGizmoPlugin)));
add_gizmo_plugin(Ref<VehicleWheel3DGizmoPlugin>(memnew(VehicleWheel3DGizmoPlugin)));
add_gizmo_plugin(Ref<VisibleOnScreenNotifier3DGizmoPlugin>(memnew(VisibleOnScreenNotifier3DGizmoPlugin)));
add_gizmo_plugin(Ref<GPUParticles3DGizmoPlugin>(memnew(GPUParticles3DGizmoPlugin)));
add_gizmo_plugin(Ref<GPUParticlesCollision3DGizmoPlugin>(memnew(GPUParticlesCollision3DGizmoPlugin)));
@@ -2863,14 +2858,20 @@ void Node3DEditor::_register_all_gizmos() {
add_gizmo_plugin(Ref<VoxelGIGizmoPlugin>(memnew(VoxelGIGizmoPlugin)));
add_gizmo_plugin(Ref<LightmapGIGizmoPlugin>(memnew(LightmapGIGizmoPlugin)));
add_gizmo_plugin(Ref<LightmapProbeGizmoPlugin>(memnew(LightmapProbeGizmoPlugin)));
add_gizmo_plugin(Ref<FogVolumeGizmoPlugin>(memnew(FogVolumeGizmoPlugin)));
add_gizmo_plugin(Ref<TwoBoneIK3DGizmoPlugin>(memnew(TwoBoneIK3DGizmoPlugin)));
add_gizmo_plugin(Ref<ChainIK3DGizmoPlugin>(memnew(ChainIK3DGizmoPlugin)));
// Physics gizmo plugins.
add_gizmo_plugin(Ref<CollisionObject3DGizmoPlugin>(memnew(CollisionObject3DGizmoPlugin)));
add_gizmo_plugin(Ref<CollisionShape3DGizmoPlugin>(memnew(CollisionShape3DGizmoPlugin)));
add_gizmo_plugin(Ref<CollisionPolygon3DGizmoPlugin>(memnew(CollisionPolygon3DGizmoPlugin)));
add_gizmo_plugin(Ref<Joint3DGizmoPlugin>(memnew(Joint3DGizmoPlugin)));
add_gizmo_plugin(Ref<SoftBody3DGizmoPlugin>(memnew(SoftBody3DGizmoPlugin)));
add_gizmo_plugin(Ref<ShapeCast3DGizmoPlugin>(memnew(ShapeCast3DGizmoPlugin)));
add_gizmo_plugin(Ref<SpringArm3DGizmoPlugin>(memnew(SpringArm3DGizmoPlugin)));
add_gizmo_plugin(Ref<PhysicalBone3DGizmoPlugin>(memnew(PhysicalBone3DGizmoPlugin)));
add_gizmo_plugin(Ref<FogVolumeGizmoPlugin>(memnew(FogVolumeGizmoPlugin)));
add_gizmo_plugin(Ref<TwoBoneIK3DGizmoPlugin>(memnew(TwoBoneIK3DGizmoPlugin)));
add_gizmo_plugin(Ref<ChainIK3DGizmoPlugin>(memnew(ChainIK3DGizmoPlugin)));
add_gizmo_plugin(Ref<VehicleWheel3DGizmoPlugin>(memnew(VehicleWheel3DGizmoPlugin)));
add_gizmo_plugin(Ref<RayCast3DGizmoPlugin>(memnew(RayCast3DGizmoPlugin)));
}
void Node3DEditor::_bind_methods() {
@@ -2885,7 +2886,7 @@ void Node3DEditor::_bind_methods() {
ClassDB::bind_method("update_all_gizmos", &Node3DEditor::update_all_gizmos);
ClassDB::bind_method("update_transform_gizmo", &Node3DEditor::update_transform_gizmo);
ADD_SIGNAL(MethodInfo("transform_key_request"));
ADD_SIGNAL(MethodInfo("transform_3d_key_request"));
ADD_SIGNAL(MethodInfo("item_lock_status_changed"));
ADD_SIGNAL(MethodInfo("item_group_status_changed"));
}
+15 -16
View File
@@ -2905,7 +2905,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
continue;
}
spatial_editor->emit_signal(SNAME("transform_key_request"), sp, "", sp->get_transform());
spatial_editor->emit_signal(SNAME("transform_3d_key_request"), sp, "", sp->get_transform());
}
set_message(TTR("Animation Key Inserted."));
@@ -5380,18 +5380,18 @@ void Node3DEditorViewport::assign_pending_data_pointers(Node3D *p_preview_node,
accept = p_accept;
}
void _insert_rid_recursive(Node *node, HashSet<RID> &rids) {
CollisionObject3D *co = Object::cast_to<CollisionObject3D>(node);
void _insert_collision_object_rid_recursive(Node *p_node, HashSet<RID> &p_col_obj_rids) {
CollisionObject3D *col_obj = Object::cast_to<CollisionObject3D>(p_node);
if (co) {
rids.insert(co->get_rid());
} else if (node->is_class("CSGShape3D")) { // HACK: We should avoid referencing module logic.
rids.insert(node->call("_get_root_collision_instance"));
if (col_obj) {
p_col_obj_rids.insert(col_obj->get_rid());
} else if (p_node->is_class("CSGShape3D")) { // HACK: We should avoid referencing module logic.
p_col_obj_rids.insert(p_node->call("_get_root_collision_instance"));
}
for (int i = 0; i < node->get_child_count(); i++) {
Node *child = node->get_child(i);
_insert_rid_recursive(child, rids);
for (int i = 0; i < p_node->get_child_count(); i++) {
Node *child = p_node->get_child(i);
_insert_collision_object_rid_recursive(child, p_col_obj_rids);
}
}
@@ -5402,27 +5402,26 @@ Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos, Node3D
Vector3 world_ray = get_ray(p_pos);
Vector3 world_pos = get_ray_pos(p_pos);
PhysicsDirectSpaceState3D *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state();
HashSet<RID> rids;
HashSet<RID> col_obj_rids_to_exclude;
if (preview_node && preview_node->get_child_count() > 0) {
_insert_rid_recursive(preview_node, rids);
_insert_collision_object_rid_recursive(preview_node, col_obj_rids_to_exclude);
} else if (!preview_node->is_inside_tree() && !ruler->is_inside_tree()) {
const List<Node *> &selection = editor_selection->get_top_selected_node_list();
Node3D *first_selected_node = Object::cast_to<Node3D>(selection.front()->get());
if (first_selected_node) {
_insert_rid_recursive(first_selected_node, rids);
_insert_collision_object_rid_recursive(first_selected_node, col_obj_rids_to_exclude);
}
}
PhysicsDirectSpaceState3D::RayParameters ray_params;
ray_params.exclude = rids;
ray_params.exclude = col_obj_rids_to_exclude;
ray_params.from = world_pos;
ray_params.to = world_pos + world_ray * camera->get_far();
PhysicsDirectSpaceState3D *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state();
PhysicsDirectSpaceState3D::RayResult result;
if (ss->intersect_ray(ray_params, result) && (preview_node->get_child_count() > 0 || !preview_node->is_inside_tree())) {
// Calculate an offset for the `p_node` such that the its bounding box is on top of and touching the contact surface's plane.
@@ -293,13 +293,13 @@ void BonePropertiesEditor::_property_keyed(const String &p_path, bool p_advance)
if (split.size() == 3 && split[0] == "bones") {
int bone_idx = split[1].to_int();
if (split[2] == "position") {
te->insert_transform_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_POSITION_3D, (Vector3)skeleton->get(p_path) / skeleton->get_motion_scale());
te->insert_transform_3d_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_POSITION_3D, (Vector3)skeleton->get(p_path) / skeleton->get_motion_scale());
}
if (split[2] == "rotation") {
te->insert_transform_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_ROTATION_3D, skeleton->get(p_path));
te->insert_transform_3d_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_ROTATION_3D, skeleton->get(p_path));
}
if (split[2] == "scale") {
te->insert_transform_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_SCALE_3D, skeleton->get(p_path));
te->insert_transform_3d_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_SCALE_3D, skeleton->get(p_path));
}
}
}
@@ -510,14 +510,14 @@ void Skeleton3DEditor::_insert_keys(const bool p_all_bones) {
continue;
}
if (pos_enabled && (p_all_bones || te->has_track(skeleton, name, Animation::TYPE_POSITION_3D))) {
te->insert_transform_key(skeleton, name, Animation::TYPE_POSITION_3D, skeleton->get_bone_pose_position(i) / skeleton->get_motion_scale());
if (pos_enabled && (p_all_bones || te->has_transform_3d_track(skeleton, name, Animation::TYPE_POSITION_3D))) {
te->insert_transform_3d_key(skeleton, name, Animation::TYPE_POSITION_3D, skeleton->get_bone_pose_position(i) / skeleton->get_motion_scale());
}
if (rot_enabled && (p_all_bones || te->has_track(skeleton, name, Animation::TYPE_ROTATION_3D))) {
te->insert_transform_key(skeleton, name, Animation::TYPE_ROTATION_3D, skeleton->get_bone_pose_rotation(i));
if (rot_enabled && (p_all_bones || te->has_transform_3d_track(skeleton, name, Animation::TYPE_ROTATION_3D))) {
te->insert_transform_3d_key(skeleton, name, Animation::TYPE_ROTATION_3D, skeleton->get_bone_pose_rotation(i));
}
if (scl_enabled && (p_all_bones || te->has_track(skeleton, name, Animation::TYPE_SCALE_3D))) {
te->insert_transform_key(skeleton, name, Animation::TYPE_SCALE_3D, skeleton->get_bone_pose_scale(i));
if (scl_enabled && (p_all_bones || te->has_transform_3d_track(skeleton, name, Animation::TYPE_SCALE_3D))) {
te->insert_transform_3d_key(skeleton, name, Animation::TYPE_SCALE_3D, skeleton->get_bone_pose_scale(i));
}
}
te->commit_insert_queue();
+1
View File
@@ -34,6 +34,7 @@
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "scene/resources/3d/primitive_meshes.h"
#include "scene/resources/environment.h"
#include "scene/resources/material.h"
class Camera3D;
+1 -3
View File
@@ -2042,9 +2042,7 @@ void SpriteFramesEditor::_fetch_sprite_node() {
}
bool show_node_edit = false;
AnimatedSprite2D *as2d = Object::cast_to<AnimatedSprite2D>(selected);
AnimatedSprite3D *as3d = Object::cast_to<AnimatedSprite3D>(selected);
if (as2d || as3d) {
if (selected->has_method("get_sprite_frames")) {
if (frames != selected->call("get_sprite_frames")) {
_remove_sprite_node();
} else {
@@ -383,13 +383,7 @@ void TextureRegionEditor::_commit_drag() {
edited_margin = -1;
} else {
undo_redo->create_action(TTR("Set Region Rect"));
if (node_sprite_2d) {
undo_redo->add_do_method(node_sprite_2d, "set_region_rect", node_sprite_2d->get_region_rect());
undo_redo->add_undo_method(node_sprite_2d, "set_region_rect", rect_prev);
} else if (node_sprite_3d) {
undo_redo->add_do_method(node_sprite_3d, "set_region_rect", node_sprite_3d->get_region_rect());
undo_redo->add_undo_method(node_sprite_3d, "set_region_rect", rect_prev);
} else if (node_ninepatch) {
if (node_ninepatch) {
undo_redo->add_do_method(node_ninepatch, "set_region_rect", node_ninepatch->get_region_rect());
undo_redo->add_undo_method(node_ninepatch, "set_region_rect", rect_prev);
} else if (res_stylebox.is_valid()) {
@@ -398,6 +392,12 @@ void TextureRegionEditor::_commit_drag() {
} else if (res_atlas_texture.is_valid()) {
undo_redo->add_do_method(res_atlas_texture.ptr(), "set_region", res_atlas_texture->get_region());
undo_redo->add_undo_method(res_atlas_texture.ptr(), "set_region", rect_prev);
} else if (node_sprite_2d) {
undo_redo->add_do_method(node_sprite_2d, "set_region_rect", node_sprite_2d->get_region_rect());
undo_redo->add_undo_method(node_sprite_2d, "set_region_rect", rect_prev);
} else if (node_sprite_3d) {
undo_redo->add_do_method(node_sprite_3d, "set_region_rect", node_sprite_3d->get_region_rect());
undo_redo->add_undo_method(node_sprite_3d, "set_region_rect", rect_prev);
}
drag_index = -1;
}
@@ -461,30 +461,13 @@ void TextureRegionEditor::_texture_overlay_input(const Ref<InputEvent> &p_input)
if (E.has_point(point)) {
rect = E;
if (Input::get_singleton()->is_key_pressed(Key::CMD_OR_CTRL) && !(Input::get_singleton()->is_key_pressed(Key(Key::SHIFT | Key::ALT)))) {
Rect2 r;
if (node_sprite_2d) {
r = node_sprite_2d->get_region_rect();
} else if (node_sprite_3d) {
r = node_sprite_3d->get_region_rect();
} else if (node_ninepatch) {
r = node_ninepatch->get_region_rect();
} else if (res_stylebox.is_valid()) {
r = res_stylebox->get_region_rect();
} else if (res_atlas_texture.is_valid()) {
r = res_atlas_texture->get_region();
}
Rect2 r = _get_edited_object_region();
rect.expand_to(r.position);
rect.expand_to(r.get_end());
}
undo_redo->create_action(TTR("Set Region Rect"));
if (node_sprite_2d) {
undo_redo->add_do_method(node_sprite_2d, "set_region_rect", rect);
undo_redo->add_undo_method(node_sprite_2d, "set_region_rect", node_sprite_2d->get_region_rect());
} else if (node_sprite_3d) {
undo_redo->add_do_method(node_sprite_3d, "set_region_rect", rect);
undo_redo->add_undo_method(node_sprite_3d, "set_region_rect", node_sprite_3d->get_region_rect());
} else if (node_ninepatch) {
if (node_ninepatch) {
undo_redo->add_do_method(node_ninepatch, "set_region_rect", rect);
undo_redo->add_undo_method(node_ninepatch, "set_region_rect", node_ninepatch->get_region_rect());
} else if (res_stylebox.is_valid()) {
@@ -493,6 +476,12 @@ void TextureRegionEditor::_texture_overlay_input(const Ref<InputEvent> &p_input)
} else if (res_atlas_texture.is_valid()) {
undo_redo->add_do_method(res_atlas_texture.ptr(), "set_region", rect);
undo_redo->add_undo_method(res_atlas_texture.ptr(), "set_region", res_atlas_texture->get_region());
} else if (node_sprite_2d) {
undo_redo->add_do_method(node_sprite_2d, "set_region_rect", rect);
undo_redo->add_undo_method(node_sprite_2d, "set_region_rect", node_sprite_2d->get_region_rect());
} else if (node_sprite_3d) {
undo_redo->add_do_method(node_sprite_3d, "set_region_rect", rect);
undo_redo->add_undo_method(node_sprite_3d, "set_region_rect", node_sprite_3d->get_region_rect());
}
undo_redo->add_do_method(this, "_update_rect");
@@ -1043,16 +1032,16 @@ Ref<Texture2D> TextureRegionEditor::_get_edited_object_texture() const {
Rect2 TextureRegionEditor::_get_edited_object_region() const {
Rect2 region;
if (node_sprite_2d) {
region = node_sprite_2d->get_region_rect();
} else if (node_sprite_3d) {
region = node_sprite_3d->get_region_rect();
} else if (node_ninepatch) {
if (node_ninepatch) {
region = node_ninepatch->get_region_rect();
} else if (res_stylebox.is_valid()) {
region = res_stylebox->get_region_rect();
} else if (res_atlas_texture.is_valid()) {
region = res_atlas_texture->get_region();
} else if (node_sprite_2d) {
region = node_sprite_2d->get_region_rect();
} else if (node_sprite_3d) {
region = node_sprite_3d->get_region_rect();
}
const Ref<Texture2D> object_texture = _get_edited_object_texture();
@@ -1083,7 +1072,9 @@ void TextureRegionEditor::_edit_region() {
}
CanvasItem::TextureFilter filter = CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
if (node_sprite_2d) {
if (node_ninepatch) {
filter = node_ninepatch->get_texture_filter_in_tree();
} else if (node_sprite_2d) {
filter = node_sprite_2d->get_texture_filter_in_tree();
} else if (node_sprite_3d) {
StandardMaterial3D::TextureFilter filter_3d = node_sprite_3d->get_texture_filter();
@@ -1112,8 +1103,6 @@ void TextureRegionEditor::_edit_region() {
filter = CanvasItem::TEXTURE_FILTER_PARENT_NODE;
break;
}
} else if (node_ninepatch) {
filter = node_ninepatch->get_texture_filter_in_tree();
}
// occurs when get_texture_filter_in_tree reaches the scene root
+2 -2
View File
@@ -90,12 +90,12 @@ void EditorSettingsDialog::_settings_property_edited() {
} else if (full_name == "editors/3d/navigation/orbit_mouse_button" || full_name == "editors/3d/navigation/pan_mouse_button" || full_name == "editors/3d/navigation/zoom_mouse_button" || full_name == "editors/3d/navigation/emulate_3_button_mouse") {
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/navigation_scheme", (int)View3DController::NAV_SCHEME_CUSTOM);
} else if (full_name == "editors/3d/navigation/navigation_scheme") {
update_navigation_preset();
update_3d_navigation_preset();
_update_shortcuts();
}
}
void EditorSettingsDialog::update_navigation_preset() {
void EditorSettingsDialog::update_3d_navigation_preset() {
View3DController::NavigationScheme nav_scheme = (View3DController::NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int();
View3DController::NavigationMouseButton set_orbit_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
View3DController::NavigationMouseButton set_pan_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
+1 -1
View File
@@ -130,7 +130,7 @@ protected:
public:
void popup_edit_settings();
static void update_navigation_preset();
static void update_3d_navigation_preset();
void set_current_section(const String &p_section);
void set_advanced_mode_enabled(bool p_enabled);
+27 -27
View File
@@ -104,19 +104,19 @@ void CSGShape3D::set_use_collision(bool p_enable) {
if (use_collision) {
root_collision_shape.instantiate();
root_collision_instance = PhysicsServer3D::get_singleton()->body_create();
PhysicsServer3D::get_singleton()->body_set_mode(root_collision_instance, PhysicsServer3D::BODY_MODE_STATIC);
PhysicsServer3D::get_singleton()->body_set_state(root_collision_instance, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
PhysicsServer3D::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
PhysicsServer3D::get_singleton()->body_set_space(root_collision_instance, get_world_3d()->get_space());
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id());
root_collision_body = PhysicsServer3D::get_singleton()->body_create();
PhysicsServer3D::get_singleton()->body_set_mode(root_collision_body, PhysicsServer3D::BODY_MODE_STATIC);
PhysicsServer3D::get_singleton()->body_set_state(root_collision_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
PhysicsServer3D::get_singleton()->body_add_shape(root_collision_body, root_collision_shape->get_rid());
PhysicsServer3D::get_singleton()->body_set_space(root_collision_body, get_world_3d()->get_space());
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(root_collision_body, get_instance_id());
set_collision_layer(collision_layer);
set_collision_mask(collision_mask);
set_collision_priority(collision_priority);
_make_dirty(); //force update
} else {
PhysicsServer3D::get_singleton()->free_rid(root_collision_instance);
root_collision_instance = RID();
PhysicsServer3D::get_singleton()->free_rid(root_collision_body);
root_collision_body = RID();
root_collision_shape.unref();
}
notify_property_list_changed();
@@ -129,8 +129,8 @@ bool CSGShape3D::is_using_collision() const {
void CSGShape3D::set_collision_layer(uint32_t p_layer) {
collision_layer = p_layer;
if (root_collision_instance.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_collision_layer(root_collision_instance, p_layer);
if (root_collision_body.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_collision_layer(root_collision_body, p_layer);
}
}
@@ -140,8 +140,8 @@ uint32_t CSGShape3D::get_collision_layer() const {
void CSGShape3D::set_collision_mask(uint32_t p_mask) {
collision_mask = p_mask;
if (root_collision_instance.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_collision_mask(root_collision_instance, p_mask);
if (root_collision_body.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_collision_mask(root_collision_body, p_mask);
}
}
@@ -186,8 +186,8 @@ bool CSGShape3D::get_collision_mask_value(int p_layer_number) const {
}
RID CSGShape3D::_get_root_collision_instance() const {
if (root_collision_instance.is_valid()) {
return root_collision_instance;
if (root_collision_body.is_valid()) {
return root_collision_body;
} else if (parent_shape) {
return parent_shape->_get_root_collision_instance();
}
@@ -197,8 +197,8 @@ RID CSGShape3D::_get_root_collision_instance() const {
void CSGShape3D::set_collision_priority(real_t p_priority) {
collision_priority = p_priority;
if (root_collision_instance.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_collision_priority(root_collision_instance, p_priority);
if (root_collision_body.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_collision_priority(root_collision_body, p_priority);
}
}
@@ -1059,12 +1059,12 @@ void CSGShape3D::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
if (use_collision && is_root_shape()) {
root_collision_shape.instantiate();
root_collision_instance = PhysicsServer3D::get_singleton()->body_create();
PhysicsServer3D::get_singleton()->body_set_mode(root_collision_instance, PhysicsServer3D::BODY_MODE_STATIC);
PhysicsServer3D::get_singleton()->body_set_state(root_collision_instance, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
PhysicsServer3D::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
PhysicsServer3D::get_singleton()->body_set_space(root_collision_instance, get_world_3d()->get_space());
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id());
root_collision_body = PhysicsServer3D::get_singleton()->body_create();
PhysicsServer3D::get_singleton()->body_set_mode(root_collision_body, PhysicsServer3D::BODY_MODE_STATIC);
PhysicsServer3D::get_singleton()->body_set_state(root_collision_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
PhysicsServer3D::get_singleton()->body_add_shape(root_collision_body, root_collision_shape->get_rid());
PhysicsServer3D::get_singleton()->body_set_space(root_collision_body, get_world_3d()->get_space());
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(root_collision_body, get_instance_id());
set_collision_layer(collision_layer);
set_collision_mask(collision_mask);
set_collision_priority(collision_priority);
@@ -1074,17 +1074,17 @@ void CSGShape3D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_TREE: {
if (use_collision && is_root_shape() && root_collision_instance.is_valid()) {
PhysicsServer3D::get_singleton()->free_rid(root_collision_instance);
root_collision_instance = RID();
if (use_collision && is_root_shape() && root_collision_body.is_valid()) {
PhysicsServer3D::get_singleton()->free_rid(root_collision_body);
root_collision_body = RID();
root_collision_shape.unref();
_clear_debug_collision_shape();
}
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
if (use_collision && is_root_shape() && root_collision_instance.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_state(root_collision_instance, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
if (use_collision && is_root_shape() && root_collision_body.is_valid()) {
PhysicsServer3D::get_singleton()->body_set_state(root_collision_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
}
_on_transform_changed();
} break;
+1 -1
View File
@@ -77,7 +77,7 @@ private:
uint32_t collision_mask = 1;
real_t collision_priority = 1.0;
Ref<ConcavePolygonShape3D> root_collision_shape;
RID root_collision_instance;
RID root_collision_body;
RID root_collision_debug_instance;
Transform3D debug_shape_old_transform;
#endif // PHYSICS_3D_DISABLED
@@ -35,6 +35,7 @@
#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "editor/shader/shader_editor.h"
#include "scene/gui/graph_edit.h"
#include "scene/resources/environment.h"
#include "scene/resources/material.h"
#include "scene/resources/syntax_highlighter.h"