summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorAndrea Catania <info@andreacatania.com>2018-09-22 11:27:30 +0200
committerAndrea Catania <info@andreacatania.com>2018-09-22 11:27:30 +0200
commita3bdcb901f57fc2392fb8a003f8dd017ab5ee9f9 (patch)
tree86adc0bc0b3179128fb3dafd2a1a51dd0ffed049 /editor/plugins
parentd226ba7c2be9c8519aa5434809f93c03f338db0f (diff)
Correctly freed PhysicalBoneEditor
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/physical_bone_plugin.cpp26
-rw-r--r--editor/plugins/physical_bone_plugin.h2
2 files changed, 8 insertions, 20 deletions
diff --git a/editor/plugins/physical_bone_plugin.cpp b/editor/plugins/physical_bone_plugin.cpp
index 1b4f66d6e4..6341d7f2ef 100644
--- a/editor/plugins/physical_bone_plugin.cpp
+++ b/editor/plugins/physical_bone_plugin.cpp
@@ -69,17 +69,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
hide();
}
-PhysicalBoneEditor::~PhysicalBoneEditor() {
- for (int i = spatial_editor_hb->get_child_count() - 1; 0 <= i; --i) {
- Node *n = spatial_editor_hb->get_child(i);
- spatial_editor_hb->remove_child(n);
- memdelete(n);
- }
- if (spatial_editor_hb->get_parent()) {
- spatial_editor_hb->get_parent()->remove_child(spatial_editor_hb);
- }
- memdelete(spatial_editor_hb);
-}
+PhysicalBoneEditor::~PhysicalBoneEditor() {}
void PhysicalBoneEditor::set_selected(PhysicalBone *p_pb) {
@@ -100,19 +90,17 @@ void PhysicalBoneEditor::show() {
PhysicalBonePlugin::PhysicalBonePlugin(EditorNode *p_editor) :
editor(p_editor),
- selected(NULL) {
-
- physical_bone_editor = memnew(PhysicalBoneEditor(editor));
-}
+ selected(NULL),
+ physical_bone_editor(editor) {}
void PhysicalBonePlugin::make_visible(bool p_visible) {
if (p_visible) {
- physical_bone_editor->show();
+ physical_bone_editor.show();
} else {
- physical_bone_editor->hide();
- physical_bone_editor->set_selected(NULL);
+ physical_bone_editor.hide();
+ physical_bone_editor.set_selected(NULL);
selected = NULL;
}
}
@@ -121,5 +109,5 @@ void PhysicalBonePlugin::edit(Object *p_node) {
selected = static_cast<PhysicalBone *>(p_node); // Trust it
ERR_FAIL_COND(!selected);
- physical_bone_editor->set_selected(selected);
+ physical_bone_editor.set_selected(selected);
}
diff --git a/editor/plugins/physical_bone_plugin.h b/editor/plugins/physical_bone_plugin.h
index e03d342709..e1f8c9ec47 100644
--- a/editor/plugins/physical_bone_plugin.h
+++ b/editor/plugins/physical_bone_plugin.h
@@ -64,7 +64,7 @@ class PhysicalBonePlugin : public EditorPlugin {
EditorNode *editor;
PhysicalBone *selected;
- PhysicalBoneEditor *physical_bone_editor;
+ PhysicalBoneEditor physical_bone_editor;
public:
virtual String get_name() const { return "PhysicalBone"; }