Correctly freed PhysicalBoneEditor
This commit is contained in:
parent
d226ba7c2b
commit
a3bdcb901f
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"; }
|
||||
|
|
Loading…
Reference in New Issue