revert Outliner: Port grease pencil effect elements to new tree-element code design

This is causing compile errors which I can’t fix right now. Reverting until resolved.
This commit is contained in:
Julian Eisel
2023-07-27 19:10:56 +02:00
parent 790cbeda2c
commit 3d6f02493e
7 changed files with 20 additions and 121 deletions

View File

@@ -53,7 +53,6 @@ set(SRC
tree/tree_element_defgroup.cc
tree/tree_element_driver.cc
tree/tree_element_edit_bone.cc
tree/tree_element_gpencil_effect.cc
tree/tree_element_gpencil_layer.cc
tree/tree_element_id.cc
tree/tree_element_id_armature.cc
@@ -92,7 +91,6 @@ set(SRC
tree/tree_element_id_armature.hh
tree/tree_element_id_collection.hh
tree/tree_element_id_curve.hh
tree/tree_element_gpencil_effect.hh
tree/tree_element_id_gpencil_legacy.hh
tree/tree_element_id_library.hh
tree/tree_element_id_linestyle.hh

View File

@@ -25,7 +25,6 @@ struct ListBase;
struct Main;
struct Object;
struct Scene;
struct ShaderFxData;
struct TreeStoreElem;
struct ViewLayer;
struct bContext;
@@ -304,11 +303,6 @@ struct DeformGroupElementCreateData {
bDeformGroup *defgroup;
};
struct GPencilEffectElementCreateData {
Object *object;
ShaderFxData *fx;
};
struct ParticleSystemElementCreateData {
Object *object;
ParticleSystem *psys;

View File

@@ -245,9 +245,6 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
else if (type == TSE_EBONE) {
id = static_cast<EditBoneElementCreateData *>(idv)->armature_id;
}
else if (type == TSE_GPENCIL_EFFECT) {
id = &static_cast<GPencilEffectElementCreateData *>(idv)->object->id;
}
else if (type == TSE_DEFGROUP) {
id = &static_cast<DeformGroupElementCreateData *>(idv)->object->id;
}
@@ -312,9 +309,6 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
else if (ELEM(type, TSE_BONE, TSE_EBONE)) {
/* pass */
}
else if (ELEM(type, TSE_GPENCIL_EFFECT_BASE, TSE_GPENCIL_EFFECT)) {
/* pass */
}
else if (ELEM(type, TSE_DEFGROUP, TSE_DEFGROUP_BASE)) {
/* pass */
}
@@ -371,8 +365,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
TSE_SEQ_STRIP,
TSE_SEQUENCE_DUP,
TSE_GENERIC_LABEL) ||
ELEM(
type, TSE_DEFGROUP, TSE_DEFGROUP_BASE, TSE_GPENCIL_EFFECT, TSE_GPENCIL_EFFECT_BASE))
ELEM(type, TSE_DEFGROUP, TSE_DEFGROUP_BASE))
{
BLI_assert_msg(false, "Element type should already use new AbstractTreeElement design");
}

View File

@@ -23,7 +23,6 @@
#include "tree_element_defgroup.hh"
#include "tree_element_driver.hh"
#include "tree_element_edit_bone.hh"
#include "tree_element_gpencil_effect.hh"
#include "tree_element_gpencil_layer.hh"
#include "tree_element_id.hh"
#include "tree_element_label.hh"
@@ -117,14 +116,6 @@ std::unique_ptr<AbstractTreeElement> AbstractTreeElement::createFromType(const i
return std::make_unique<TreeElementEditBone>(
legacy_te, *ebone_data->armature_id, *ebone_data->ebone);
}
case TSE_GPENCIL_EFFECT: {
GPencilEffectElementCreateData *gp_effect_data =
static_cast<GPencilEffectElementCreateData *>(idv);
return std::make_unique<TreeElementGPencilEffect>(
legacy_te, *gp_effect_data->object, *gp_effect_data->fx);
}
case TSE_GPENCIL_EFFECT_BASE:
return std::make_unique<TreeElementGPencilEffectBase>(legacy_te, static_cast<Object *>(idv));
case TSE_DEFGROUP_BASE:
return std::make_unique<TreeElementDeformGroupBase>(legacy_te, *static_cast<Object *>(idv));
case TSE_DEFGROUP: {

View File

@@ -1,59 +0,0 @@
/* SPDX-FileCopyrightText: 2023 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup spoutliner
*/
#include "DNA_object_types.h"
#include "DNA_outliner_types.h"
#include "DNA_shader_fx_types.h"
#include "BLI_listbase.h"
#include "BLT_translation.h"
#include "../outliner_intern.hh"
#include "tree_element_gpencil_effect.hh"
namespace blender::ed::outliner {
TreeElementGPencilEffectBase::TreeElementGPencilEffectBase(TreeElement &legacy_te, Object &object)
: AbstractTreeElement(legacy_te), object_(object)
{
legacy_te.name = IFACE_("Effects");
}
void TreeElementGPencilEffectBase::expand(SpaceOutliner &space_outliner) const
{
int index;
LISTBASE_FOREACH_INDEX (ShaderFxData *, fx, &object_.shader_fx, index) {
outliner_add_element(
&space_outliner, &legacy_te_.subtree, &object_, &legacy_te_, TSE_GPENCIL_EFFECT, index);
}
}
TreeElementGPencilEffect::TreeElementGPencilEffect(TreeElement &legacy_te,
Object & /* object */,
ShaderFxData &fx)
: AbstractTreeElement(legacy_te), /* object_(object), */ fx_(fx)
{
legacy_te.name = fx_.name;
legacy_te.directdata = &fx_;
}
void TreeElementGPencilEffect::expand(SpaceOutliner &space_outliner) const
{
if (fx_.type == eShaderFxType_Swirl) {
outliner_add_element(&space_outliner,
&legacy_te_.subtree,
((SwirlShaderFxData *)(&fx_))->object,
&legacy_te_,
TSE_LINKED_OB,
0);
}
}
} // namespace blender::ed::outliner

View File

@@ -1,36 +0,0 @@
/* SPDX-FileCopyrightText: 2023 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup spoutliner
*/
#pragma once
#include "tree_element.hh"
struct Object;
struct ShaderFxData;
namespace blender::ed::outliner {
class TreeElementGPencilEffectBase final : public AbstractTreeElement {
Object &object_;
public:
TreeElementGPencilEffectBase(TreeElement &legacy_te, Object &object);
void expand(SpaceOutliner &) const override;
};
class TreeElementGPencilEffect final : public AbstractTreeElement {
/* Not needed right now, avoid unused member variable warning. */
// Object &object_;
ShaderFxData &fx_;
public:
TreeElementGPencilEffect(TreeElement &legacy_te, Object &object, ShaderFxData &fx);
void expand(SpaceOutliner &) const override;
};
} // namespace blender::ed::outliner

View File

@@ -259,8 +259,26 @@ void TreeElementIDObject::expand_gpencil_effects(SpaceOutliner &space_outliner)
if (BLI_listbase_is_empty(&object_.shader_fx)) {
return;
}
outliner_add_element(
TreeElement *ten_fx = outliner_add_element(
&space_outliner, &legacy_te_.subtree, &object_, &legacy_te_, TSE_GPENCIL_EFFECT_BASE, 0);
ten_fx->name = IFACE_("Effects");
int index;
LISTBASE_FOREACH_INDEX (ShaderFxData *, fx, &object_.shader_fx, index) {
TreeElement *ten = outliner_add_element(
&space_outliner, &ten_fx->subtree, &object_, ten_fx, TSE_GPENCIL_EFFECT, index);
ten->name = fx->name;
ten->directdata = fx;
if (fx->type == eShaderFxType_Swirl) {
outliner_add_element(&space_outliner,
&ten->subtree,
((SwirlShaderFxData *)fx)->object,
ten,
TSE_LINKED_OB,
0);
}
}
}
void TreeElementIDObject::expand_vertex_groups(SpaceOutliner &space_outliner) const