Correctly freed PhysicalBoneEditor
This commit is contained in:
parent
d226ba7c2b
commit
a3bdcb901f
|
@ -69,17 +69,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicalBoneEditor::~PhysicalBoneEditor() {
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhysicalBoneEditor::set_selected(PhysicalBone *p_pb) {
|
void PhysicalBoneEditor::set_selected(PhysicalBone *p_pb) {
|
||||||
|
|
||||||
|
@ -100,19 +90,17 @@ void PhysicalBoneEditor::show() {
|
||||||
|
|
||||||
PhysicalBonePlugin::PhysicalBonePlugin(EditorNode *p_editor) :
|
PhysicalBonePlugin::PhysicalBonePlugin(EditorNode *p_editor) :
|
||||||
editor(p_editor),
|
editor(p_editor),
|
||||||
selected(NULL) {
|
selected(NULL),
|
||||||
|
physical_bone_editor(editor) {}
|
||||||
physical_bone_editor = memnew(PhysicalBoneEditor(editor));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhysicalBonePlugin::make_visible(bool p_visible) {
|
void PhysicalBonePlugin::make_visible(bool p_visible) {
|
||||||
if (p_visible) {
|
if (p_visible) {
|
||||||
|
|
||||||
physical_bone_editor->show();
|
physical_bone_editor.show();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
physical_bone_editor->hide();
|
physical_bone_editor.hide();
|
||||||
physical_bone_editor->set_selected(NULL);
|
physical_bone_editor.set_selected(NULL);
|
||||||
selected = NULL;
|
selected = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,5 +109,5 @@ void PhysicalBonePlugin::edit(Object *p_node) {
|
||||||
selected = static_cast<PhysicalBone *>(p_node); // Trust it
|
selected = static_cast<PhysicalBone *>(p_node); // Trust it
|
||||||
ERR_FAIL_COND(!selected);
|
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;
|
EditorNode *editor;
|
||||||
PhysicalBone *selected;
|
PhysicalBone *selected;
|
||||||
PhysicalBoneEditor *physical_bone_editor;
|
PhysicalBoneEditor physical_bone_editor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual String get_name() const { return "PhysicalBone"; }
|
virtual String get_name() const { return "PhysicalBone"; }
|
||||||
|
|
Loading…
Reference in New Issue