summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_inspector.cpp6
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/editor_properties.cpp6
-rw-r--r--editor/editor_translation_parser.cpp6
-rw-r--r--editor/filesystem_dock.cpp6
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--editor/import/resource_importer_obj.cpp2
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp57
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h2
9 files changed, 57 insertions, 32 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 236e0f1abb..738b2f9f82 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -2570,9 +2570,9 @@ void EditorInspector::_update_script_class_properties(const Object &p_object, Li
}
// Script Variables -> to insert: NodeC..B..A -> bottom (insert_here)
- List<PropertyInfo>::Element *script_variables = NULL;
- List<PropertyInfo>::Element *bottom = NULL;
- List<PropertyInfo>::Element *insert_here = NULL;
+ List<PropertyInfo>::Element *script_variables = nullptr;
+ List<PropertyInfo>::Element *bottom = nullptr;
+ List<PropertyInfo>::Element *insert_here = nullptr;
for (List<PropertyInfo>::Element *E = r_list.front(); E; E = E->next()) {
PropertyInfo &pi = E->get();
if (pi.name != "Script Variables") {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index cc9080c923..6a50976908 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1379,7 +1379,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
// which would result in an invalid texture.
if (c3d == 0 && c2d == 0) {
img.instance();
- img->create(1, 1, 0, Image::FORMAT_RGB8);
+ img->create(1, 1, false, Image::FORMAT_RGB8);
} else if (c3d < c2d) {
Ref<ViewportTexture> viewport_texture = scene_root->get_texture();
if (viewport_texture->get_width() > 0 && viewport_texture->get_height() > 0) {
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 7b3ab4738a..fa44239e32 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -649,14 +649,16 @@ public:
Color color = get_theme_color("highlight_color", "Editor");
for (int i = 0; i < 2; i++) {
Point2 ofs(4, vofs);
- if (i == 1)
+ if (i == 1) {
ofs.y += bsize + 1;
+ }
ofs += rect.position;
for (int j = 0; j < 10; j++) {
Point2 o = ofs + Point2(j * (bsize + 1), 0);
- if (j >= 5)
+ if (j >= 5) {
o.x += 1;
+ }
const int idx = i * 10 + j;
const bool on = value & (1 << idx);
diff --git a/editor/editor_translation_parser.cpp b/editor/editor_translation_parser.cpp
index 51bd9b3383..fd36372dde 100644
--- a/editor/editor_translation_parser.cpp
+++ b/editor/editor_translation_parser.cpp
@@ -38,8 +38,9 @@
EditorTranslationParser *EditorTranslationParser::singleton = nullptr;
Error EditorTranslationParserPlugin::parse_file(const String &p_path, Vector<String> *r_ids, Vector<Vector<String>> *r_ids_ctx_plural) {
- if (!get_script_instance())
+ if (!get_script_instance()) {
return ERR_UNAVAILABLE;
+ }
if (get_script_instance()->has_method("parse_file")) {
Array ids;
@@ -70,8 +71,9 @@ Error EditorTranslationParserPlugin::parse_file(const String &p_path, Vector<Str
}
void EditorTranslationParserPlugin::get_recognized_extensions(List<String> *r_extensions) const {
- if (!get_script_instance())
+ if (!get_script_instance()) {
return;
+ }
if (get_script_instance()->has_method("get_recognized_extensions")) {
Array extensions = get_script_instance()->call("get_recognized_extensions");
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index d6ae901ca9..899070f036 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -2621,8 +2621,9 @@ void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &f
}
void FileSystemDock::_update_import_dock() {
- if (!import_dock_needs_update)
+ if (!import_dock_needs_update) {
return;
+ }
// List selected.
Vector<String> selected;
@@ -2633,8 +2634,9 @@ void FileSystemDock::_update_import_dock() {
} else {
// Use the file list.
for (int i = 0; i < files->get_item_count(); i++) {
- if (!files->is_selected(i))
+ if (!files->is_selected(i)) {
continue;
+ }
selected.push_back(files->get_item_metadata(i));
}
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 080393e570..d3183e5a8d 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1688,7 +1688,7 @@ Node *EditorSceneImporterCollada::import_scene(const String &p_path, uint32_t p_
state.use_mesh_builtin_materials = true;
state.bake_fps = p_bake_fps;
- Error err = state.load(p_path, flags, p_flags & EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS, 0);
+ Error err = state.load(p_path, flags, p_flags & EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS, false);
if (r_err) {
*r_err = err;
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 5c522e3176..dd62c72d8a 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -427,7 +427,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) {
List<Ref<Mesh>> meshes;
- Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, 0, Vector3(1, 1, 1), Vector3(0, 0, 0), r_missing_deps);
+ Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, false, Vector3(1, 1, 1), Vector3(0, 0, 0), r_missing_deps);
if (err != OK) {
if (r_err) {
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 121ccfa417..ad60984ad1 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -167,16 +167,18 @@ void BoneTransformEditor::_notification(int p_what) {
}
void BoneTransformEditor::_value_changed(const double p_value) {
- if (updating)
+ if (updating) {
return;
+ }
Transform tform = compute_transform_from_vector3s();
_change_transform(tform);
}
void BoneTransformEditor::_value_changed_vector3(const String p_property_name, const Vector3 p_vector, const StringName p_edited_property_name, const bool p_boolean) {
- if (updating)
+ if (updating) {
return;
+ }
Transform tform = compute_transform_from_vector3s();
_change_transform(tform);
}
@@ -194,8 +196,9 @@ Transform BoneTransformEditor::compute_transform_from_vector3s() const {
}
void BoneTransformEditor::_value_changed_transform(const String p_property_name, const Transform p_transform, const StringName p_edited_property_name, const bool p_boolean) {
- if (updating)
+ if (updating) {
return;
+ }
_change_transform(p_transform);
}
@@ -222,11 +225,13 @@ void BoneTransformEditor::update_enabled_checkbox() {
}
void BoneTransformEditor::_update_properties() {
- if (updating)
+ if (updating) {
return;
+ }
- if (skeleton == nullptr)
+ if (skeleton == nullptr) {
return;
+ }
updating = true;
@@ -235,11 +240,13 @@ void BoneTransformEditor::_update_properties() {
}
void BoneTransformEditor::_update_custom_pose_properties() {
- if (updating)
+ if (updating) {
return;
+ }
- if (skeleton == nullptr)
+ if (skeleton == nullptr) {
return;
+ }
updating = true;
@@ -287,14 +294,16 @@ void BoneTransformEditor::set_toggle_enabled(const bool p_enabled) {
}
void BoneTransformEditor::_key_button_pressed() {
- if (skeleton == nullptr)
+ if (skeleton == nullptr) {
return;
+ }
const BoneId bone_id = property.get_slicec('/', 1).to_int();
const String name = skeleton->get_bone_name(bone_id);
- if (name.is_empty())
+ if (name.is_empty()) {
return;
+ }
// Need to normalize the basis before you key it
Transform tform = compute_transform_from_vector3s();
@@ -405,8 +414,9 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi
Variant Skeleton3DEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
TreeItem *selected = joint_tree->get_selected();
- if (!selected)
+ if (!selected) {
return Variant();
+ }
Ref<Texture> icon = selected->get_icon(0);
@@ -431,27 +441,32 @@ Variant Skeleton3DEditor::get_drag_data_fw(const Point2 &p_point, Control *p_fro
bool Skeleton3DEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
TreeItem *target = joint_tree->get_item_at_position(p_point);
- if (!target)
+ if (!target) {
return false;
+ }
const String path = target->get_metadata(0);
- if (!path.begins_with("bones/"))
+ if (!path.begins_with("bones/")) {
return false;
+ }
TreeItem *selected = Object::cast_to<TreeItem>(Dictionary(p_data)["node"]);
- if (target == selected)
+ if (target == selected) {
return false;
+ }
const String path2 = target->get_metadata(0);
- if (!path2.begins_with("bones/"))
+ if (!path2.begins_with("bones/")) {
return false;
+ }
return true;
}
void Skeleton3DEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
- if (!can_drop_data_fw(p_point, p_data, p_from))
+ if (!can_drop_data_fw(p_point, p_data, p_from)) {
return;
+ }
TreeItem *target = joint_tree->get_item_at_position(p_point);
TreeItem *selected = Object::cast_to<TreeItem>(Dictionary(p_data)["node"]);
@@ -510,19 +525,23 @@ void Skeleton3DEditor::_joint_tree_rmb_select(const Vector2 &p_pos) {
}
void Skeleton3DEditor::_update_properties() {
- if (rest_editor)
+ if (rest_editor) {
rest_editor->_update_properties();
- if (pose_editor)
+ }
+ if (pose_editor) {
pose_editor->_update_properties();
- if (custom_pose_editor)
+ }
+ if (custom_pose_editor) {
custom_pose_editor->_update_custom_pose_properties();
+ }
}
void Skeleton3DEditor::update_joint_tree() {
joint_tree->clear();
- if (skeleton == nullptr)
+ if (skeleton == nullptr) {
return;
+ }
TreeItem *root = joint_tree->create_item();
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 83b4914b66..517dc6056f 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -67,7 +67,7 @@ private:
VisualShader::Type type = VisualShader::Type::TYPE_MAX;
VisualShaderNode *visual_node = nullptr;
GraphNode *graph_node = nullptr;
- bool preview_visible = 0;
+ bool preview_visible = false;
int preview_pos = 0;
Map<int, InputPort> input_ports;
Map<int, Port> output_ports;