Cleanup: Add asserts for Outliner tree element creation

Such asserts are used for other tree element types already, and should
be used in these cases as well. Helps avoiding potential errors.
This commit is contained in:
Julian Eisel
2023-08-01 15:07:55 +02:00
parent eca984e79d
commit ebfa6b9f04
4 changed files with 9 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ namespace blender::ed::outliner {
TreeElementDeformGroupBase::TreeElementDeformGroupBase(TreeElement &legacy_te, Object &object)
: AbstractTreeElement(legacy_te), object_(object)
{
BLI_assert(legacy_te.store_elem->type == TSE_DEFGROUP_BASE);
legacy_te.name = IFACE_("Vertex Groups");
}
@@ -44,6 +45,7 @@ TreeElementDeformGroup::TreeElementDeformGroup(TreeElement &legacy_te,
bDeformGroup &defgroup)
: AbstractTreeElement(legacy_te), /* object_(object), */ defgroup_(defgroup)
{
BLI_assert(legacy_te.store_elem->type == TSE_DEFGROUP);
legacy_te.name = defgroup_.name;
legacy_te.directdata = &defgroup_;
}

View File

@@ -8,6 +8,8 @@
#include "BKE_armature.h"
#include "DNA_outliner_types.h"
#include "../outliner_intern.hh"
#include "tree_element_edit_bone.hh"
@@ -19,6 +21,7 @@ TreeElementEditBone::TreeElementEditBone(TreeElement &legacy_te,
EditBone &ebone)
: AbstractTreeElement(legacy_te) /*, armature_id_(armature_id)*/, ebone_(ebone)
{
BLI_assert(legacy_te.store_elem->type == TSE_EBONE);
legacy_te.directdata = &ebone_;
legacy_te.name = ebone_.name;
}

View File

@@ -23,6 +23,7 @@ namespace blender::ed::outliner {
TreeElementGPencilEffectBase::TreeElementGPencilEffectBase(TreeElement &legacy_te, Object &object)
: AbstractTreeElement(legacy_te), object_(object)
{
BLI_assert(legacy_te.store_elem->type == TSE_GPENCIL_EFFECT_BASE);
legacy_te.name = IFACE_("Effects");
}
@@ -40,6 +41,7 @@ TreeElementGPencilEffect::TreeElementGPencilEffect(TreeElement &legacy_te,
ShaderFxData &fx)
: AbstractTreeElement(legacy_te), /* object_(object), */ fx_(fx)
{
BLI_assert(legacy_te.store_elem->type == TSE_GPENCIL_EFFECT);
legacy_te.name = fx_.name;
legacy_te.directdata = &fx_;
}

View File

@@ -6,6 +6,7 @@
* \ingroup spoutliner
*/
#include "DNA_outliner_types.h"
#include "DNA_particle_types.h"
#include "../outliner_intern.hh"
@@ -19,6 +20,7 @@ TreeElementParticleSystem::TreeElementParticleSystem(TreeElement &legacy_te,
ParticleSystem &psys)
: AbstractTreeElement(legacy_te), /* object_(object), */ psys_(psys)
{
BLI_assert(legacy_te.store_elem->type == TSE_LINKED_PSYS);
legacy_te.directdata = &psys_;
legacy_te.name = psys_.part->id.name + 2;
}