UI Code Quality: Port Outliner Grease Pencil layers to new design
Continuation of work in2e221de4ce
and249e4df110
. Now the tree-element types have to be ported one by one. This is probably the most straight forward type to port.
This commit is contained in:
parent
a592f7e6cb
commit
e0442a955b
Notes:
blender-bot
2023-02-14 06:46:23 +01:00
Referenced by commit 3a907e7425
, Outliner: Barebones to port IDs to new Outliner tree-element code design
|
@ -57,6 +57,7 @@ set(SRC
|
|||
tree/tree_element.cc
|
||||
tree/tree_element_anim_data.cc
|
||||
tree/tree_element_driver_base.cc
|
||||
tree/tree_element_gpencil_layer.cc
|
||||
tree/tree_element_nla.cc
|
||||
|
||||
outliner_intern.h
|
||||
|
@ -66,6 +67,7 @@ set(SRC
|
|||
tree/tree_element.hh
|
||||
tree/tree_element_anim_data.hh
|
||||
tree/tree_element_driver_base.hh
|
||||
tree/tree_element_gpencil_layer.hh
|
||||
tree/tree_element_nla.hh
|
||||
)
|
||||
|
||||
|
|
|
@ -1016,16 +1016,16 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
|||
outliner_add_id_contents(space_outliner, te, tselem, id);
|
||||
}
|
||||
}
|
||||
else if (ELEM(type, TSE_ANIM_DATA, TSE_DRIVER_BASE, TSE_NLA, TSE_NLA_ACTION, TSE_NLA_TRACK)) {
|
||||
else if (ELEM(type,
|
||||
TSE_ANIM_DATA,
|
||||
TSE_DRIVER_BASE,
|
||||
TSE_NLA,
|
||||
TSE_NLA_ACTION,
|
||||
TSE_NLA_TRACK,
|
||||
TSE_GP_LAYER)) {
|
||||
/* Should already use new AbstractTreeElement design. */
|
||||
BLI_assert(0);
|
||||
}
|
||||
else if (type == TSE_GP_LAYER) {
|
||||
bGPDlayer *gpl = (bGPDlayer *)idv;
|
||||
|
||||
te->name = gpl->info;
|
||||
te->directdata = gpl;
|
||||
}
|
||||
else if (type == TSE_SEQUENCE) {
|
||||
Sequence *seq = (Sequence *)idv;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "tree_element_anim_data.hh"
|
||||
#include "tree_element_driver_base.hh"
|
||||
#include "tree_element_gpencil_layer.hh"
|
||||
#include "tree_element_nla.hh"
|
||||
|
||||
#include "tree_element.h"
|
||||
|
@ -46,6 +47,8 @@ static AbstractTreeElement *tree_element_create(int type, TreeElement &legacy_te
|
|||
return new TreeElementNLATrack(legacy_te, *static_cast<NlaTrack *>(idv));
|
||||
case TSE_NLA_ACTION:
|
||||
return new TreeElementNLAAction(legacy_te);
|
||||
case TSE_GP_LAYER:
|
||||
return new TreeElementGPencilLayer(legacy_te, *static_cast<bGPDlayer *>(idv));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_gpencil_types.h"
|
||||
|
||||
#include "../outliner_intern.h"
|
||||
|
||||
#include "tree_element_gpencil_layer.hh"
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
TreeElementGPencilLayer::TreeElementGPencilLayer(TreeElement &legacy_te, bGPDlayer &gplayer)
|
||||
: AbstractTreeElement(legacy_te)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_GP_LAYER);
|
||||
/* this element's info */
|
||||
legacy_te.name = gplayer.info;
|
||||
legacy_te.directdata = &gplayer;
|
||||
}
|
||||
|
||||
} // namespace blender::ed::outliner
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tree_element.hh"
|
||||
|
||||
struct bGPDlayer;
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
class TreeElementGPencilLayer : public AbstractTreeElement {
|
||||
public:
|
||||
TreeElementGPencilLayer(TreeElement &legacy_te, bGPDlayer &gplayer);
|
||||
};
|
||||
|
||||
} // namespace blender::ed::outliner
|
Loading…
Reference in New Issue