Outliner: Port particle system elements to new tree-element code design #110245
|
@ -68,6 +68,7 @@ set(SRC
|
||||||
tree/tree_element_label.cc
|
tree/tree_element_label.cc
|
||||||
tree/tree_element_nla.cc
|
tree/tree_element_nla.cc
|
||||||
tree/tree_element_overrides.cc
|
tree/tree_element_overrides.cc
|
||||||
|
tree/tree_element_particle_system.cc
|
||||||
tree/tree_element_rna.cc
|
tree/tree_element_rna.cc
|
||||||
tree/tree_element_scene_objects.cc
|
tree/tree_element_scene_objects.cc
|
||||||
tree/tree_element_seq.cc
|
tree/tree_element_seq.cc
|
||||||
|
@ -99,6 +100,7 @@ set(SRC
|
||||||
tree/tree_element_label.hh
|
tree/tree_element_label.hh
|
||||||
tree/tree_element_nla.hh
|
tree/tree_element_nla.hh
|
||||||
tree/tree_element_overrides.hh
|
tree/tree_element_overrides.hh
|
||||||
|
tree/tree_element_particle_system.hh
|
||||||
tree/tree_element_rna.hh
|
tree/tree_element_rna.hh
|
||||||
tree/tree_element_scene_objects.hh
|
tree/tree_element_scene_objects.hh
|
||||||
tree/tree_element_seq.hh
|
tree/tree_element_seq.hh
|
||||||
|
|
|
@ -296,6 +296,11 @@ struct EditBoneElementCreateData {
|
||||||
EditBone *ebone;
|
EditBone *ebone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ParticleSystemElementCreateData {
|
||||||
|
Object *object;
|
||||||
|
ParticleSystem *psys;
|
||||||
|
};
|
||||||
|
|
||||||
TreeTraversalAction outliner_collect_selected_collections(TreeElement *te, void *customdata);
|
TreeTraversalAction outliner_collect_selected_collections(TreeElement *te, void *customdata);
|
||||||
TreeTraversalAction outliner_collect_selected_objects(TreeElement *te, void *customdata);
|
TreeTraversalAction outliner_collect_selected_objects(TreeElement *te, void *customdata);
|
||||||
|
|
||||||
|
|
|
@ -245,6 +245,9 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
||||||
else if (type == TSE_EBONE) {
|
else if (type == TSE_EBONE) {
|
||||||
id = static_cast<EditBoneElementCreateData *>(idv)->armature_id;
|
id = static_cast<EditBoneElementCreateData *>(idv)->armature_id;
|
||||||
}
|
}
|
||||||
|
else if (type == TSE_LINKED_PSYS) {
|
||||||
|
id = &static_cast<ParticleSystemElementCreateData *>(idv)->object->id;
|
||||||
Almaz-Shinbay marked this conversation as resolved
Outdated
|
|||||||
|
}
|
||||||
|
|
||||||
/* exceptions */
|
/* exceptions */
|
||||||
if (ELEM(type, TSE_ID_BASE, TSE_GENERIC_LABEL)) {
|
if (ELEM(type, TSE_ID_BASE, TSE_GENERIC_LABEL)) {
|
||||||
|
@ -303,6 +306,9 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
||||||
else if (ELEM(type, TSE_BONE, TSE_EBONE)) {
|
else if (ELEM(type, TSE_BONE, TSE_EBONE)) {
|
||||||
/* pass */
|
/* pass */
|
||||||
}
|
}
|
||||||
|
else if (type == TSE_LINKED_PSYS) {
|
||||||
|
/* pass */
|
||||||
|
}
|
||||||
else if (type == TSE_SOME_ID) {
|
else if (type == TSE_SOME_ID) {
|
||||||
if (!te->abstract_element) {
|
if (!te->abstract_element) {
|
||||||
BLI_assert_msg(0, "Expected this ID type to be ported to new Outliner tree-element design");
|
BLI_assert_msg(0, "Expected this ID type to be ported to new Outliner tree-element design");
|
||||||
|
@ -341,6 +347,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
||||||
TSE_BONE,
|
TSE_BONE,
|
||||||
TSE_DRIVER_BASE,
|
TSE_DRIVER_BASE,
|
||||||
TSE_EBONE,
|
TSE_EBONE,
|
||||||
|
TSE_LINKED_PSYS,
|
||||||
TSE_NLA,
|
TSE_NLA,
|
||||||
TSE_NLA_ACTION,
|
TSE_NLA_ACTION,
|
||||||
TSE_NLA_TRACK,
|
TSE_NLA_TRACK,
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "tree_element_label.hh"
|
#include "tree_element_label.hh"
|
||||||
#include "tree_element_nla.hh"
|
#include "tree_element_nla.hh"
|
||||||
#include "tree_element_overrides.hh"
|
#include "tree_element_overrides.hh"
|
||||||
|
#include "tree_element_particle_system.hh"
|
||||||
#include "tree_element_rna.hh"
|
#include "tree_element_rna.hh"
|
||||||
#include "tree_element_scene_objects.hh"
|
#include "tree_element_scene_objects.hh"
|
||||||
#include "tree_element_seq.hh"
|
#include "tree_element_seq.hh"
|
||||||
|
@ -114,6 +115,12 @@ std::unique_ptr<AbstractTreeElement> AbstractTreeElement::createFromType(const i
|
||||||
return std::make_unique<TreeElementEditBone>(
|
return std::make_unique<TreeElementEditBone>(
|
||||||
legacy_te, *ebone_data->armature_id, *ebone_data->ebone);
|
legacy_te, *ebone_data->armature_id, *ebone_data->ebone);
|
||||||
}
|
}
|
||||||
|
case TSE_LINKED_PSYS: {
|
||||||
|
ParticleSystemElementCreateData *psys_data = static_cast<ParticleSystemElementCreateData *>(
|
||||||
|
idv);
|
||||||
|
return std::make_unique<TreeElementParticleSystem>(
|
||||||
|
legacy_te, *psys_data->object, *psys_data->psys);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,12 +202,11 @@ void TreeElementIDObject::expand_modifiers(SpaceOutliner &space_outliner) const
|
||||||
}
|
}
|
||||||
else if (md->type == eModifierType_ParticleSystem) {
|
else if (md->type == eModifierType_ParticleSystem) {
|
||||||
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
|
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
|
||||||
TreeElement *ten_psys;
|
|
||||||
|
|
||||||
ten_psys = outliner_add_element(
|
ParticleSystemElementCreateData psys_data = {&object_, psys};
|
||||||
&space_outliner, &ten->subtree, &object_, &legacy_te_, TSE_LINKED_PSYS, 0);
|
|
||||||
ten_psys->directdata = psys;
|
outliner_add_element(
|
||||||
ten_psys->name = psys->part->id.name + 2;
|
&space_outliner, &ten->subtree, &psys_data, &legacy_te_, TSE_LINKED_PSYS, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \ingroup spoutliner
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "DNA_particle_types.h"
|
||||||
|
|
||||||
|
#include "../outliner_intern.hh"
|
||||||
|
|
||||||
|
#include "tree_element_particle_system.hh"
|
||||||
|
|
||||||
|
namespace blender::ed::outliner {
|
||||||
|
|
||||||
|
TreeElementParticleSystem::TreeElementParticleSystem(TreeElement &legacy_te,
|
||||||
|
Object & /* object */,
|
||||||
|
ParticleSystem &psys)
|
||||||
|
: AbstractTreeElement(legacy_te), /* object_(object), */ psys_(psys)
|
||||||
|
{
|
||||||
|
legacy_te.directdata = &psys_;
|
||||||
|
legacy_te.name = psys_.part->id.name + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace blender::ed::outliner
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* \ingroup spoutliner
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "tree_element.hh"
|
||||||
|
|
||||||
|
namespace blender::ed::outliner {
|
||||||
|
|
||||||
|
class TreeElementParticleSystem final : public AbstractTreeElement {
|
||||||
|
/* Not needed right now, avoid unused member variable warning. */
|
||||||
|
// Object &object_;
|
||||||
|
ParticleSystem &psys_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TreeElementParticleSystem(TreeElement &legacy_te, Object &object, ParticleSystem &psys);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace blender::ed::outliner
|
Loading…
Reference in New Issue
Instead of the extra cast, you can do:
id = &static_cast<ParticleSystemElementCreateData *>(idv)->object->id;