2011-07-11 10:59:53 +00:00
|
|
|
/*
|
|
|
|
|
* 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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2011-07-11 10:59:53 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2004 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-06 15:42:22 +11:00
|
|
|
/** \file \ingroup spoutliner
|
2011-07-11 10:59:53 +00:00
|
|
|
*/
|
|
|
|
|
|
2014-10-10 15:04:33 +02:00
|
|
|
#include "DNA_anim_types.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "DNA_armature_types.h"
|
2018-08-29 15:32:50 +02:00
|
|
|
#include "DNA_collection_types.h"
|
2015-02-07 12:50:22 +13:00
|
|
|
#include "DNA_gpencil_types.h"
|
2018-07-31 10:22:19 +02:00
|
|
|
#include "DNA_gpencil_modifier_types.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "DNA_lamp_types.h"
|
2018-05-11 16:02:09 +02:00
|
|
|
#include "DNA_lightprobe_types.h"
|
2012-04-26 05:17:54 +00:00
|
|
|
#include "DNA_object_types.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_sequence_types.h"
|
|
|
|
|
|
2012-10-27 11:18:54 +00:00
|
|
|
#include "BLI_math.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "BLI_blenlib.h"
|
2017-01-16 17:33:34 +01:00
|
|
|
#include "BLI_string_utils.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2013-08-03 11:35:09 +00:00
|
|
|
#include "BLI_mempool.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-03-11 09:06:49 +00:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "BKE_context.h"
|
|
|
|
|
#include "BKE_deform.h"
|
2014-10-10 15:04:33 +02:00
|
|
|
#include "BKE_fcurve.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_gpencil.h"
|
2018-06-21 19:40:14 +02:00
|
|
|
#include "BKE_idcode.h"
|
2017-02-09 17:19:07 +01:00
|
|
|
#include "BKE_layer.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "BKE_library.h"
|
|
|
|
|
#include "BKE_main.h"
|
|
|
|
|
#include "BKE_modifier.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_object.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "BKE_report.h"
|
|
|
|
|
#include "BKE_scene.h"
|
2011-08-11 06:06:17 +00:00
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
2017-09-20 14:15:35 +02:00
|
|
|
#include "DEG_depsgraph_build.h"
|
2017-06-08 10:14:53 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "ED_armature.h"
|
2014-10-10 15:04:33 +02:00
|
|
|
#include "ED_keyframing.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "ED_object.h"
|
|
|
|
|
#include "ED_screen.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2016-10-20 01:43:46 +00:00
|
|
|
#include "GPU_immediate.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
2016-10-20 01:43:46 +00:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "UI_interface_icons.h"
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
|
|
|
|
#include "outliner_intern.h"
|
|
|
|
|
|
2012-06-06 19:36:26 +00:00
|
|
|
/* disable - this is far too slow - campbell */
|
|
|
|
|
// #define USE_GROUP_SELECT
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* ****************************************************** */
|
|
|
|
|
/* Tree Size Functions */
|
|
|
|
|
|
|
|
|
|
static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeElement *te = lb->first;
|
2012-03-24 07:52:14 +00:00
|
|
|
while (te) {
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
2018-06-20 07:12:23 +02:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2011-07-11 10:59:53 +00:00
|
|
|
outliner_height(soops, &te->subtree, h);
|
2018-06-20 07:12:23 +02:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
(*h) += UI_UNIT_Y;
|
2012-05-07 17:56:30 +00:00
|
|
|
te = te->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0 // XXX this is currently disabled until te->xend is set correctly
|
|
|
|
|
static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeElement *te = lb->first;
|
2012-03-24 07:52:14 +00:00
|
|
|
while (te) {
|
2012-10-26 04:14:10 +00:00
|
|
|
// TreeStoreElem *tselem = TREESTORE(te);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
// XXX fixme... te->xend is not set yet
|
2012-04-29 15:47:02 +00:00
|
|
|
if (!TSELEM_OPEN(tselem, soops)) {
|
2011-07-11 10:59:53 +00:00
|
|
|
if (te->xend > *w)
|
|
|
|
|
*w = te->xend;
|
|
|
|
|
}
|
|
|
|
|
outliner_width(soops, &te->subtree, w);
|
2012-05-07 17:56:30 +00:00
|
|
|
te = te->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx)
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeElement *te = lb->first;
|
2012-03-24 07:52:14 +00:00
|
|
|
while (te) {
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
2012-03-03 16:31:46 +00:00
|
|
|
// XXX fixme... (currently, we're using a fixed length of 100)!
|
|
|
|
|
#if 0
|
2012-03-24 06:38:07 +00:00
|
|
|
if (te->xend) {
|
|
|
|
|
if (te->xend > *w)
|
2011-07-11 10:59:53 +00:00
|
|
|
*w = te->xend;
|
2012-03-03 16:31:46 +00:00
|
|
|
}
|
|
|
|
|
#endif
|
2012-05-07 17:56:30 +00:00
|
|
|
if (startx + 100 > *w)
|
|
|
|
|
*w = startx + 100;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2012-05-07 17:56:30 +00:00
|
|
|
outliner_rna_width(soops, &te->subtree, w, startx + UI_UNIT_X);
|
2018-06-20 07:12:23 +02:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
te = te->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 10:16:09 +02:00
|
|
|
/**
|
|
|
|
|
* The active object is only needed for reference.
|
|
|
|
|
*/
|
|
|
|
|
static bool is_object_data_in_editmode(const ID *id, const Object *obact)
|
|
|
|
|
{
|
|
|
|
|
const short id_type = GS(id->name);
|
|
|
|
|
return (
|
|
|
|
|
(obact && (obact->mode & OB_MODE_EDIT)) &&
|
|
|
|
|
(id && OB_DATA_SUPPORT_EDITMODE(id_type)) &&
|
|
|
|
|
(GS(((ID *)obact->data)->name) == id_type) &&
|
|
|
|
|
BKE_object_data_is_in_editmode(id)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* ****************************************************** */
|
|
|
|
|
|
2013-03-12 13:03:58 +00:00
|
|
|
static void restrictbutton_recursive_ebone(bContext *C, EditBone *ebone_parent, int flag, bool set_flag)
|
|
|
|
|
{
|
|
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
|
|
|
|
bArmature *arm = obedit->data;
|
|
|
|
|
EditBone *ebone;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-12 13:03:58 +00:00
|
|
|
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
|
|
|
|
|
if (ED_armature_ebone_is_child_recursive(ebone_parent, ebone)) {
|
|
|
|
|
if (set_flag) {
|
|
|
|
|
ebone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
|
|
|
|
|
ebone->flag |= flag;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-03-13 18:10:05 +00:00
|
|
|
ebone->flag &= ~flag;
|
2013-03-12 13:03:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-16 15:19:18 +02:00
|
|
|
static void restrictbutton_recursive_bone(Bone *bone_parent, int flag, bool set_flag)
|
2013-03-12 13:03:58 +00:00
|
|
|
{
|
|
|
|
|
Bone *bone;
|
|
|
|
|
for (bone = bone_parent->childbase.first; bone; bone = bone->next) {
|
|
|
|
|
if (set_flag) {
|
|
|
|
|
bone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
|
|
|
|
|
bone->flag |= flag;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-03-13 18:10:05 +00:00
|
|
|
bone->flag &= ~flag;
|
2013-03-12 13:03:58 +00:00
|
|
|
}
|
2016-10-16 15:19:18 +02:00
|
|
|
restrictbutton_recursive_bone(bone, flag, set_flag);
|
2013-03-12 13:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2))
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, poin);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2016-10-16 15:19:18 +02:00
|
|
|
static void restrictbutton_bone_visibility_cb(bContext *C, void *UNUSED(poin), void *poin2)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Bone *bone = (Bone *)poin2;
|
2013-07-31 09:18:40 +00:00
|
|
|
if (bone->flag & BONE_HIDDEN_P)
|
2011-07-11 10:59:53 +00:00
|
|
|
bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
|
2013-03-12 13:03:58 +00:00
|
|
|
|
|
|
|
|
if (CTX_wm_window(C)->eventstate->ctrl) {
|
2016-10-16 15:19:18 +02:00
|
|
|
restrictbutton_recursive_bone(bone, BONE_HIDDEN_P, (bone->flag & BONE_HIDDEN_P) != 0);
|
2013-03-12 13:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-16 15:19:18 +02:00
|
|
|
static void restrictbutton_bone_select_cb(bContext *C, void *UNUSED(poin), void *poin2)
|
2013-03-12 13:03:58 +00:00
|
|
|
{
|
|
|
|
|
Bone *bone = (Bone *)poin2;
|
2013-07-31 09:18:40 +00:00
|
|
|
if (bone->flag & BONE_UNSELECTABLE)
|
2013-03-12 13:03:58 +00:00
|
|
|
bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
|
|
|
|
|
|
|
|
|
|
if (CTX_wm_window(C)->eventstate->ctrl) {
|
2016-10-16 15:19:18 +02:00
|
|
|
restrictbutton_recursive_bone(bone, BONE_UNSELECTABLE, (bone->flag & BONE_UNSELECTABLE) != 0);
|
2013-03-12 13:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-12 14:06:18 +00:00
|
|
|
static void restrictbutton_ebone_select_cb(bContext *C, void *UNUSED(poin), void *poin2)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
EditBone *ebone = (EditBone *)poin2;
|
2013-03-12 13:03:58 +00:00
|
|
|
|
|
|
|
|
if (ebone->flag & BONE_UNSELECTABLE) {
|
2011-07-11 10:59:53 +00:00
|
|
|
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
|
2013-03-12 13:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CTX_wm_window(C)->eventstate->ctrl) {
|
|
|
|
|
restrictbutton_recursive_ebone(C, ebone, BONE_UNSELECTABLE, (ebone->flag & BONE_UNSELECTABLE) != 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-12 14:06:18 +00:00
|
|
|
static void restrictbutton_ebone_visibility_cb(bContext *C, void *UNUSED(poin), void *poin2)
|
2013-03-12 13:03:58 +00:00
|
|
|
{
|
|
|
|
|
EditBone *ebone = (EditBone *)poin2;
|
|
|
|
|
if (ebone->flag & BONE_HIDDEN_A) {
|
2013-03-12 21:46:33 +00:00
|
|
|
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
|
2013-03-12 13:03:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CTX_wm_window(C)->eventstate->ctrl) {
|
|
|
|
|
restrictbutton_recursive_ebone(C, ebone, BONE_HIDDEN_A, (ebone->flag & BONE_HIDDEN_A) != 0);
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-09 12:34:17 +13:00
|
|
|
static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), void *UNUSED(poin2))
|
|
|
|
|
{
|
2015-02-17 02:08:12 +01:00
|
|
|
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
|
2015-02-09 12:34:17 +13:00
|
|
|
}
|
|
|
|
|
|
2015-02-15 23:12:54 +05:00
|
|
|
static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2))
|
2015-02-16 00:10:33 +13:00
|
|
|
{
|
|
|
|
|
ID *id = (ID *)poin;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-16 00:10:33 +13:00
|
|
|
BLI_assert(id != NULL);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-16 00:10:33 +13:00
|
|
|
if (id->flag & LIB_FAKEUSER) {
|
|
|
|
|
id_us_plus(id);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
id_us_min(id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-28 14:05:08 +01:00
|
|
|
static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
|
|
|
|
|
{
|
2018-11-30 02:24:06 -02:00
|
|
|
Main *bmain = CTX_data_main(C);
|
2018-11-28 14:05:08 +01:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
ViewLayer *view_layer = poin;
|
|
|
|
|
Base *base = poin2;
|
2018-11-30 02:24:06 -02:00
|
|
|
Object *ob = base->object;
|
|
|
|
|
bool freeze = (CTX_wm_window(C)->eventstate->alt != 0);
|
|
|
|
|
bool changed_restrict_view = false;
|
2018-11-28 14:05:08 +01:00
|
|
|
|
2018-11-30 02:24:06 -02:00
|
|
|
if (freeze) {
|
|
|
|
|
ob->restrictflag |= OB_RESTRICT_VIEW;
|
|
|
|
|
changed_restrict_view = true;
|
|
|
|
|
}
|
|
|
|
|
else if (ob->restrictflag & OB_RESTRICT_VIEW) {
|
|
|
|
|
ob->restrictflag &= ~OB_RESTRICT_VIEW;
|
|
|
|
|
base->flag &= ~BASE_HIDDEN;
|
|
|
|
|
changed_restrict_view = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
base->flag ^= BASE_HIDDEN;
|
2018-11-28 14:05:08 +01:00
|
|
|
}
|
|
|
|
|
|
2018-11-30 02:24:06 -02:00
|
|
|
if (changed_restrict_view) {
|
2019-02-08 13:51:13 -02:00
|
|
|
BKE_main_collection_sync_remap(bmain);
|
2018-11-30 02:24:06 -02:00
|
|
|
DEG_id_tag_update(&ob->id, LIB_TAG_COPIED_ON_WRITE);
|
|
|
|
|
DEG_relations_tag_update(bmain);
|
|
|
|
|
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
|
|
|
|
|
}
|
|
|
|
|
if (!freeze) {
|
|
|
|
|
BKE_layer_collection_sync(scene, view_layer);
|
|
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
|
|
|
|
}
|
2018-11-28 14:05:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *poin2)
|
|
|
|
|
{
|
2018-11-30 02:24:06 -02:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2018-11-28 14:05:08 +01:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
ViewLayer *view_layer = poin;
|
|
|
|
|
LayerCollection *lc = poin2;
|
2018-11-30 02:24:06 -02:00
|
|
|
Collection *collection = lc->collection;
|
|
|
|
|
bool do_disable = (win->eventstate->alt != 0);
|
|
|
|
|
bool do_isolate = (win->eventstate->ctrl != 0) && !do_disable;
|
|
|
|
|
bool extend = (win->eventstate->shift != 0);
|
|
|
|
|
bool depsgraph_changed = false;
|
|
|
|
|
|
|
|
|
|
if (do_disable) {
|
|
|
|
|
collection->flag |= COLLECTION_RESTRICT_VIEW;
|
|
|
|
|
depsgraph_changed = true;
|
|
|
|
|
}
|
|
|
|
|
else if (do_isolate) {
|
|
|
|
|
depsgraph_changed |= BKE_layer_collection_isolate(scene, view_layer, lc, extend);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bool make_visible = ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0) ||
|
|
|
|
|
((collection->flag & COLLECTION_RESTRICT_VIEW) != 0);
|
|
|
|
|
depsgraph_changed |= BKE_layer_collection_set_visible(view_layer, lc, make_visible, extend);
|
|
|
|
|
}
|
2018-11-28 14:05:08 +01:00
|
|
|
|
2018-11-30 02:24:06 -02:00
|
|
|
BKE_layer_collection_sync(scene, view_layer);
|
2018-12-06 17:52:37 +01:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
|
2018-11-30 02:24:06 -02:00
|
|
|
|
|
|
|
|
if (depsgraph_changed) {
|
|
|
|
|
DEG_relations_tag_update(CTX_data_main(C));
|
|
|
|
|
}
|
|
|
|
|
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
|
2018-11-28 14:05:08 +01:00
|
|
|
}
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
|
|
|
|
{
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
Main *bmain = CTX_data_main(C);
|
2012-05-07 17:56:30 +00:00
|
|
|
SpaceOops *soops = CTX_wm_space_outliner(C);
|
|
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2013-08-03 11:35:09 +00:00
|
|
|
BLI_mempool *ts = soops->treestore;
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeStoreElem *tselem = tsep;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ts && tselem) {
|
2015-02-10 02:03:55 +11:00
|
|
|
TreeElement *te = outliner_find_tree_element(&soops->tree, tselem);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
if (tselem->type == 0) {
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
BLI_libblock_ensure_unique_name(bmain, tselem->id->name);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (GS(tselem->id->name)) {
|
2011-07-11 10:59:53 +00:00
|
|
|
case ID_MA:
|
|
|
|
|
WM_event_add_notifier(C, NC_MATERIAL, NULL); break;
|
|
|
|
|
case ID_TE:
|
|
|
|
|
WM_event_add_notifier(C, NC_TEXTURE, NULL); break;
|
|
|
|
|
case ID_IM:
|
|
|
|
|
WM_event_add_notifier(C, NC_IMAGE, NULL); break;
|
|
|
|
|
case ID_SCE:
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE, NULL); break;
|
2018-11-09 10:59:12 -02:00
|
|
|
case ID_OB:
|
|
|
|
|
{
|
|
|
|
|
Object *ob = (Object *)tselem->id;
|
|
|
|
|
if (ob->type == OB_MBALL) {
|
2018-12-06 17:52:37 +01:00
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
2018-11-09 10:59:12 -02:00
|
|
|
}
|
2019-01-04 14:21:35 +01:00
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
|
2018-11-09 10:59:12 -02:00
|
|
|
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
default:
|
2012-05-07 17:56:30 +00:00
|
|
|
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
/* Check the library target exists */
|
|
|
|
|
if (te->idcode == ID_LI) {
|
2012-05-07 17:56:30 +00:00
|
|
|
Library *lib = (Library *)tselem->id;
|
2011-10-23 17:52:20 +00:00
|
|
|
char expanded[FILE_MAX];
|
|
|
|
|
|
2018-05-31 16:04:04 +02:00
|
|
|
BKE_library_filepath_set(bmain, lib, lib->name);
|
2011-10-23 17:52:20 +00:00
|
|
|
|
2011-10-26 22:46:06 +00:00
|
|
|
BLI_strncpy(expanded, lib->name, sizeof(expanded));
|
2018-06-05 15:10:33 +02:00
|
|
|
BLI_path_abs(expanded, BKE_main_blendfile_path(bmain));
|
2011-07-11 10:59:53 +00:00
|
|
|
if (!BLI_exists(expanded)) {
|
2012-05-31 18:40:06 +00:00
|
|
|
BKE_reportf(CTX_wm_reports(C), RPT_ERROR,
|
|
|
|
|
"Library path '%s' does not exist, correct this before saving", expanded);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
else if (lib->id.tag & LIB_TAG_MISSING) {
|
|
|
|
|
BKE_reportf(CTX_wm_reports(C), RPT_INFO,
|
|
|
|
|
"Library path '%s' is now valid, please reload the library", expanded);
|
|
|
|
|
lib->id.tag &= ~LIB_TAG_MISSING;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (tselem->type) {
|
2012-05-07 17:56:30 +00:00
|
|
|
case TSE_DEFGROUP:
|
|
|
|
|
defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object
|
|
|
|
|
break;
|
|
|
|
|
case TSE_NLA_ACTION:
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
BLI_libblock_ensure_unique_name(bmain, tselem->id->name);
|
2012-05-07 17:56:30 +00:00
|
|
|
break;
|
|
|
|
|
case TSE_EBONE:
|
|
|
|
|
{
|
|
|
|
|
bArmature *arm = (bArmature *)tselem->id;
|
|
|
|
|
if (arm->edbo) {
|
|
|
|
|
EditBone *ebone = te->directdata;
|
|
|
|
|
char newname[sizeof(ebone->name)];
|
|
|
|
|
|
|
|
|
|
/* restore bone name */
|
|
|
|
|
BLI_strncpy(newname, ebone->name, sizeof(ebone->name));
|
|
|
|
|
BLI_strncpy(ebone->name, oldname, sizeof(ebone->name));
|
2018-06-07 12:47:00 +02:00
|
|
|
ED_armature_bone_rename(bmain, obedit->data, oldname, newname);
|
2018-05-23 14:19:19 +02:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
2012-05-07 17:56:30 +00:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
case TSE_BONE:
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2018-05-23 14:11:03 +02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2018-05-23 14:19:19 +02:00
|
|
|
bArmature *arm = (bArmature *)tselem->id;
|
2012-05-07 17:56:30 +00:00
|
|
|
Bone *bone = te->directdata;
|
2011-07-11 10:59:53 +00:00
|
|
|
char newname[sizeof(bone->name)];
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-01-16 20:22:45 +11:00
|
|
|
/* always make current object active */
|
2017-11-23 13:51:49 -02:00
|
|
|
tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, true);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* restore bone name */
|
|
|
|
|
BLI_strncpy(newname, bone->name, sizeof(bone->name));
|
|
|
|
|
BLI_strncpy(bone->name, oldname, sizeof(bone->name));
|
2018-06-07 13:04:16 +02:00
|
|
|
ED_armature_bone_rename(bmain, arm, oldname, newname);
|
2018-05-23 14:19:19 +02:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
case TSE_POSE_CHANNEL:
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2018-05-23 14:11:03 +02:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
2018-05-23 14:19:19 +02:00
|
|
|
Object *ob = (Object *)tselem->id;
|
2012-05-07 17:56:30 +00:00
|
|
|
bPoseChannel *pchan = te->directdata;
|
2011-07-11 10:59:53 +00:00
|
|
|
char newname[sizeof(pchan->name)];
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-01-16 20:22:45 +11:00
|
|
|
/* always make current pose-bone active */
|
2017-11-23 13:51:49 -02:00
|
|
|
tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, true);
|
2014-03-24 13:08:29 +01:00
|
|
|
|
|
|
|
|
BLI_assert(ob->type == OB_ARMATURE);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* restore bone name */
|
|
|
|
|
BLI_strncpy(newname, pchan->name, sizeof(pchan->name));
|
|
|
|
|
BLI_strncpy(pchan->name, oldname, sizeof(pchan->name));
|
2018-06-07 12:47:00 +02:00
|
|
|
ED_armature_bone_rename(bmain, ob->data, oldname, newname);
|
2018-05-23 14:19:19 +02:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
case TSE_POSEGRP:
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Object *ob = (Object *)tselem->id; // id = object
|
|
|
|
|
bActionGroup *grp = te->directdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
BLI_uniquename(&ob->pose->agroups, grp, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "Group"), '.',
|
2013-03-25 08:29:06 +00:00
|
|
|
offsetof(bActionGroup, name), sizeof(grp->name));
|
2012-05-07 17:56:30 +00:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2015-02-07 12:50:22 +13:00
|
|
|
case TSE_GP_LAYER:
|
|
|
|
|
{
|
2018-07-31 10:22:19 +02:00
|
|
|
bGPdata *gpd = (bGPdata *)tselem->id; /* id = GP Datablock */
|
2015-02-07 12:50:22 +13:00
|
|
|
bGPDlayer *gpl = te->directdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* always make layer active */
|
|
|
|
|
BKE_gpencil_layer_setactive(gpd, gpl);
|
|
|
|
|
|
2015-02-07 12:50:22 +13:00
|
|
|
// XXX: name needs translation stuff
|
|
|
|
|
BLI_uniquename(&gpd->layers, gpl, "GP Layer", '.',
|
|
|
|
|
offsetof(bGPDlayer, info), sizeof(gpl->info));
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2015-02-07 12:50:22 +13:00
|
|
|
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, gpd);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-05-23 13:39:35 +02:00
|
|
|
case TSE_R_LAYER:
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = (Scene *)tselem->id;
|
|
|
|
|
ViewLayer *view_layer = te->directdata;
|
|
|
|
|
|
|
|
|
|
/* Restore old name. */
|
|
|
|
|
char newname[sizeof(view_layer->name)];
|
|
|
|
|
BLI_strncpy(newname, view_layer->name, sizeof(view_layer->name));
|
|
|
|
|
BLI_strncpy(view_layer->name, oldname, sizeof(view_layer->name));
|
|
|
|
|
|
|
|
|
|
/* Rename, preserving animation and compositing data. */
|
2018-05-24 17:28:35 +02:00
|
|
|
BKE_view_layer_rename(bmain, scene, view_layer, newname);
|
2018-05-23 13:39:35 +02:00
|
|
|
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-03-01 16:32:13 +01:00
|
|
|
case TSE_LAYER_COLLECTION:
|
|
|
|
|
{
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
BLI_libblock_ensure_unique_name(bmain, tselem->id->name);
|
2018-05-23 13:39:35 +02:00
|
|
|
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL);
|
2017-03-01 16:32:13 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tselem->flag &= ~TSE_TEXTBUT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
static void outliner_draw_restrictbuts(
|
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
2018-05-14 23:36:56 +02:00
|
|
|
uiBlock *block, Scene *scene, ViewLayer *view_layer, ARegion *ar, SpaceOops *soops, ListBase *lb)
|
2018-06-04 09:31:30 +02:00
|
|
|
{
|
2018-10-28 17:51:40 +01:00
|
|
|
/* Get RNA properties (once for speed). */
|
|
|
|
|
static struct RestrictProperties {
|
|
|
|
|
bool initialized;
|
|
|
|
|
|
|
|
|
|
PropertyRNA *object_hide_viewport, *object_hide_select, *object_hide_render;
|
|
|
|
|
PropertyRNA *collection_hide_viewport, *collection_hide_select, *collection_hide_render;
|
|
|
|
|
PropertyRNA *modifier_show_viewport, *modifier_show_render;
|
|
|
|
|
} props = {false};
|
|
|
|
|
|
|
|
|
|
if (!props.initialized) {
|
|
|
|
|
props.object_hide_viewport = RNA_struct_type_find_property(&RNA_Object, "hide_viewport");
|
|
|
|
|
props.object_hide_select = RNA_struct_type_find_property(&RNA_Object, "hide_select");
|
|
|
|
|
props.object_hide_render = RNA_struct_type_find_property(&RNA_Object, "hide_render");
|
|
|
|
|
props.collection_hide_select = RNA_struct_type_find_property(&RNA_Collection, "hide_select");
|
|
|
|
|
props.collection_hide_viewport = RNA_struct_type_find_property(&RNA_Collection, "hide_viewport");
|
|
|
|
|
props.collection_hide_render = RNA_struct_type_find_property(&RNA_Collection, "hide_render");
|
|
|
|
|
props.modifier_show_viewport = RNA_struct_type_find_property(&RNA_Modifier, "show_viewport");
|
|
|
|
|
props.modifier_show_render = RNA_struct_type_find_property(&RNA_Modifier, "show_render");
|
|
|
|
|
|
|
|
|
|
props.initialized = true;
|
|
|
|
|
}
|
2018-06-18 19:18:02 +02:00
|
|
|
|
2018-10-28 17:51:40 +01:00
|
|
|
/* Create buttons. */
|
|
|
|
|
uiBut *bt;
|
2014-01-17 08:37:45 +11:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
for (TreeElement *te = lb->first; te; te = te->next) {
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
2012-05-07 17:56:30 +00:00
|
|
|
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
2018-04-23 20:39:05 +02:00
|
|
|
if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) {
|
|
|
|
|
/* View layer render toggle. */
|
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
2018-05-14 23:36:56 +02:00
|
|
|
ViewLayer *layer = te->directdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButBitS(
|
2018-11-02 13:05:05 +01:00
|
|
|
block, UI_BTYPE_ICON_TOGGLE_N, VIEW_LAYER_RENDER, 0, ICON_RESTRICT_RENDER_OFF,
|
2018-06-20 07:12:23 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X,
|
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
2018-05-14 23:36:56 +02:00
|
|
|
UI_UNIT_Y, &layer->flag, 0, 0, 0, 0, TIP_("Use view layer for rendering"));
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-10-28 17:51:40 +01:00
|
|
|
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
2018-05-14 23:36:56 +02:00
|
|
|
else if (tselem->type == 0 && te->idcode == ID_OB) {
|
2018-11-30 02:24:06 -02:00
|
|
|
PointerRNA ptr;
|
Objects: support for hiding all objects in a collection.
In the outliner there are now icons for it, Ctrl+Click isolates a
single collections.
In the 3D view, Ctrl+H key opens a menu that is more or less the
equivalent of the old layer buttons in the header. Regular Click isolates
the collection, Shift+Click toggle the collection visibility. Pressing
number keys and letters works in this menu, which can help for quickly
selecting a specific collection.
Shortcuts for quick switching by just pressing 1/2/3/.. keys are available
again. The order can be confusing with nested collections, but that seems
unavoidable. The first numbers control the top level collections, and then
sub collections if numbers are left.
Remaining design issues:
* The 3D view menu needs to be improved: support for sub collections,
staying open on shift+click, access from the 3D view header somewhere,
shortcut key display.
* Currently collection hiding just controls per-object hiding, we plan
to separate this state still so alt+H doesn't affect collection hiding.
2018-06-18 19:49:53 +02:00
|
|
|
Object *ob = (Object *)tselem->id;
|
2018-11-30 02:24:06 -02:00
|
|
|
RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr);
|
2018-11-28 14:05:08 +01:00
|
|
|
Base *base = BKE_view_layer_base_find(view_layer, ob);
|
|
|
|
|
|
|
|
|
|
if (base) {
|
2018-11-30 02:24:06 -02:00
|
|
|
int icon = ICON_RESTRICT_VIEW_ON;
|
|
|
|
|
if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0) {
|
|
|
|
|
icon = (base->flag & BASE_HIDDEN) != 0 ?
|
|
|
|
|
ICON_HIDE_ON :
|
|
|
|
|
ICON_HIDE_OFF;
|
|
|
|
|
}
|
|
|
|
|
bt = uiDefIconBut(
|
|
|
|
|
block, UI_BTYPE_ICON_TOGGLE, 0, icon,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
|
|
|
|
NULL, 0, 0, 0, 0,
|
|
|
|
|
TIP_("Hide object in viewport (Alt to disable for all viewports)"));
|
2018-11-28 14:05:08 +01:00
|
|
|
UI_but_func_set(bt, hidebutton_base_flag_cb, view_layer, base);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
|
|
|
|
}
|
2018-11-30 02:24:06 -02:00
|
|
|
else {
|
|
|
|
|
bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
|
|
|
|
&ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
|
|
|
|
}
|
2018-06-18 19:18:02 +02:00
|
|
|
|
2018-10-28 17:51:40 +01:00
|
|
|
bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
|
2018-06-18 19:18:02 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
2018-10-28 17:51:40 +01:00
|
|
|
&ptr, props.object_hide_select, -1, 0, 0, -1, -1, NULL);
|
2018-06-18 19:18:02 +02:00
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
|
|
|
|
|
2018-10-28 17:51:40 +01:00
|
|
|
bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
|
2018-06-18 19:18:02 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
2018-10-28 17:51:40 +01:00
|
|
|
&ptr, props.object_hide_render, -1, 0, 0, -1, -1, NULL);
|
2018-06-18 19:18:02 +02:00
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (tselem->type == TSE_MODIFIER) {
|
|
|
|
|
ModifierData *md = (ModifierData *)te->directdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-28 17:51:40 +01:00
|
|
|
PointerRNA ptr;
|
|
|
|
|
RNA_pointer_create(tselem->id, &RNA_Modifier, md, &ptr);
|
|
|
|
|
|
|
|
|
|
bt = uiDefIconButR_prop(
|
|
|
|
|
block, UI_BTYPE_ICON_TOGGLE, 0, 0,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
|
|
|
|
&ptr, props.modifier_show_viewport, -1, 0, 0, -1, -1, NULL);
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-28 17:51:40 +01:00
|
|
|
bt = uiDefIconButR_prop(
|
|
|
|
|
block, UI_BTYPE_ICON_TOGGLE, 0, 0,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
|
|
|
|
&ptr, props.modifier_show_render, -1, 0, 0, -1, -1, NULL);
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (tselem->type == TSE_POSE_CHANNEL) {
|
|
|
|
|
bPoseChannel *pchan = (bPoseChannel *)te->directdata;
|
2011-07-11 10:59:53 +00:00
|
|
|
Bone *bone = pchan->bone;
|
2018-06-20 07:12:23 +02:00
|
|
|
Object *ob = (Object *)tselem->id;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButBitI(
|
2018-11-02 13:05:05 +01:00
|
|
|
block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_P, 0, ICON_HIDE_OFF,
|
2018-06-20 07:12:23 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
|
|
|
|
|
UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0,
|
|
|
|
|
TIP_("Restrict/Allow visibility in the 3D View"));
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_func_set(bt, restrictbutton_bone_visibility_cb, ob->data, bone);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-10-28 17:51:40 +01:00
|
|
|
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButBitI(
|
2018-11-02 13:05:05 +01:00
|
|
|
block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
|
2018-06-20 07:12:23 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
|
|
|
|
|
UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0,
|
|
|
|
|
TIP_("Restrict/Allow selection in the 3D View"));
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_func_set(bt, restrictbutton_bone_select_cb, ob->data, bone);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-10-28 17:51:40 +01:00
|
|
|
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (tselem->type == TSE_EBONE) {
|
|
|
|
|
EditBone *ebone = (EditBone *)te->directdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButBitI(
|
2018-11-02 13:05:05 +01:00
|
|
|
block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF,
|
2018-06-20 07:12:23 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
|
|
|
|
|
UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0,
|
|
|
|
|
TIP_("Restrict/Allow visibility in the 3D View"));
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_func_set(bt, restrictbutton_ebone_visibility_cb, NULL, ebone);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-10-28 17:51:40 +01:00
|
|
|
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButBitI(
|
2018-11-02 13:05:05 +01:00
|
|
|
block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
|
2018-06-20 07:12:23 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
|
|
|
|
|
UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0,
|
|
|
|
|
TIP_("Restrict/Allow selection in the 3D View"));
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_func_set(bt, restrictbutton_ebone_select_cb, NULL, ebone);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-10-28 17:51:40 +01:00
|
|
|
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
|
2015-02-09 12:34:17 +13:00
|
|
|
}
|
|
|
|
|
else if (tselem->type == TSE_GP_LAYER) {
|
|
|
|
|
bGPDlayer *gpl = (bGPDlayer *)te->directdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButBitS(
|
2018-11-02 13:05:05 +01:00
|
|
|
block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_HIDE_OFF,
|
2018-06-20 07:12:23 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
|
|
|
|
|
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
|
|
|
|
|
TIP_("Restrict/Allow visibility in the 3D View"));
|
2015-02-09 12:34:17 +13:00
|
|
|
UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-10-28 17:51:40 +01:00
|
|
|
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButBitS(
|
|
|
|
|
block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_LOCKED, 0, ICON_UNLOCKED,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
|
|
|
|
|
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
|
|
|
|
|
TIP_("Restrict/Allow editing of strokes and keyframes in this layer"));
|
2015-02-09 12:34:17 +13:00
|
|
|
UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-09 12:34:17 +13:00
|
|
|
/* TODO: visibility in renders */
|
2017-02-09 17:19:07 +01:00
|
|
|
}
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
else if (outliner_is_collection_tree_element(te)) {
|
|
|
|
|
LayerCollection *lc = (tselem->type == TSE_LAYER_COLLECTION) ? te->directdata : NULL;
|
|
|
|
|
Collection *collection = outliner_collection_from_tree_element(te);
|
2017-09-20 14:15:35 +02:00
|
|
|
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
if ((!lc || !(lc->flag & LAYER_COLLECTION_EXCLUDE)) &&
|
|
|
|
|
!(collection->flag & COLLECTION_IS_MASTER))
|
2017-12-14 11:46:49 -02:00
|
|
|
{
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
PointerRNA collection_ptr;
|
|
|
|
|
RNA_id_pointer_create(&collection->id, &collection_ptr);
|
|
|
|
|
|
2018-11-30 02:24:06 -02:00
|
|
|
if (lc != NULL) {
|
|
|
|
|
int icon = ICON_RESTRICT_VIEW_ON;
|
|
|
|
|
if ((collection->flag & COLLECTION_RESTRICT_VIEW) == 0) {
|
|
|
|
|
icon = (lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0 ?
|
|
|
|
|
ICON_HIDE_ON :
|
|
|
|
|
ICON_HIDE_OFF;
|
|
|
|
|
}
|
|
|
|
|
bt = uiDefIconBut(
|
|
|
|
|
block, UI_BTYPE_TOGGLE, 0, icon,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
|
|
|
|
NULL, 0, 0, 0, 0,
|
|
|
|
|
TIP_("Hide collection in viewport\n"
|
|
|
|
|
"* Alt to disable for all viewports\n"
|
|
|
|
|
"* Ctrl to isolate visibility\n"
|
|
|
|
|
"* Shift to hide inside objects and collections"));
|
|
|
|
|
UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bt = uiDefIconButR_prop(
|
|
|
|
|
block, UI_BTYPE_ICON_TOGGLE, 0, 0,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
|
|
|
|
|
UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL);
|
|
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
|
|
|
|
}
|
2017-12-14 11:46:49 -02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButR_prop(
|
2018-10-28 17:51:40 +01:00
|
|
|
block, UI_BTYPE_ICON_TOGGLE, 0, 0,
|
2018-06-20 07:12:23 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X,
|
2018-10-28 17:51:40 +01:00
|
|
|
UI_UNIT_Y, &collection_ptr, props.collection_hide_render, -1, 0, 0, 0, 0, NULL);
|
2017-12-14 11:46:49 -02:00
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
|
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButR_prop(
|
2018-10-28 17:51:40 +01:00
|
|
|
block, UI_BTYPE_ICON_TOGGLE, 0, 0,
|
2018-06-20 07:12:23 +02:00
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
|
2018-10-28 17:51:40 +01:00
|
|
|
UI_UNIT_Y, &collection_ptr, props.collection_hide_select, -1, 0, 0, 0, 0, NULL);
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
2018-05-14 23:36:56 +02:00
|
|
|
outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &te->subtree);
|
2018-06-20 07:12:23 +02:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-16 00:10:33 +13:00
|
|
|
static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops, ListBase *lb)
|
|
|
|
|
{
|
|
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
for (TreeElement *te = lb->first; te; te = te->next) {
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
2015-02-16 00:10:33 +13:00
|
|
|
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
|
|
|
|
if (tselem->type == 0) {
|
2018-06-20 07:12:23 +02:00
|
|
|
uiBut *bt;
|
2015-02-16 00:10:33 +13:00
|
|
|
ID *id = tselem->id;
|
|
|
|
|
const char *tip = NULL;
|
|
|
|
|
int icon = ICON_NONE;
|
|
|
|
|
char buf[16] = "";
|
|
|
|
|
int but_flag = UI_BUT_DRAG_LOCK;
|
|
|
|
|
|
2017-11-06 17:17:10 +01:00
|
|
|
if (ID_IS_LINKED(id))
|
2015-02-16 00:10:33 +13:00
|
|
|
but_flag |= UI_BUT_DISABLED;
|
|
|
|
|
|
|
|
|
|
if (id->flag & LIB_FAKEUSER) {
|
|
|
|
|
icon = ICON_FILE_TICK;
|
2016-09-19 16:46:20 +02:00
|
|
|
tip = TIP_("Data-block will be retained using a fake user");
|
2015-02-16 00:10:33 +13:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
icon = ICON_X;
|
2016-09-19 16:46:20 +02:00
|
|
|
tip = TIP_("Data-block has no users and will be deleted");
|
2015-02-16 00:10:33 +13:00
|
|
|
}
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefIconButBitS(
|
|
|
|
|
block, UI_BTYPE_TOGGLE, LIB_FAKEUSER, 1, icon,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
|
|
|
|
&id->flag, 0, 0, 0, 0, tip);
|
2015-02-16 00:10:33 +13:00
|
|
|
UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL);
|
|
|
|
|
UI_but_flag_enable(bt, but_flag);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
|
|
|
|
|
2015-02-16 00:10:33 +13:00
|
|
|
BLI_str_format_int_grouped(buf, id->us);
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefBut(
|
|
|
|
|
block, UI_BTYPE_BUT, 1, buf,
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys,
|
|
|
|
|
UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0,
|
|
|
|
|
TIP_("Number of users of this data-block"));
|
2015-02-16 00:10:33 +13:00
|
|
|
UI_but_flag_enable(bt, but_flag);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
|
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefButBitS(
|
|
|
|
|
block, UI_BTYPE_TOGGLE, LIB_FAKEUSER, 1, (id->flag & LIB_FAKEUSER) ? "F" : " ",
|
|
|
|
|
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y,
|
|
|
|
|
&id->flag, 0, 0, 0, 0,
|
|
|
|
|
TIP_("Data-block has a 'fake' user which will keep it in the file "
|
|
|
|
|
"even if nothing else uses it"));
|
2015-02-16 00:10:33 +13:00
|
|
|
UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL);
|
|
|
|
|
UI_but_flag_enable(bt, but_flag);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
|
|
|
|
outliner_draw_userbuts(block, ar, soops, &te->subtree);
|
|
|
|
|
}
|
2015-02-16 00:10:33 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-08 16:15:49 +13:00
|
|
|
static void outliner_draw_rnacols(ARegion *ar, int sizex)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
View2D *v2d = &ar->v2d;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-12-26 13:05:39 +00:00
|
|
|
float miny = v2d->cur.ymin;
|
2012-05-07 17:56:30 +00:00
|
|
|
if (miny < v2d->tot.ymin) miny = v2d->tot.ymin;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(1.0f);
|
2017-03-07 01:40:40 -03:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-03-07 01:40:40 -03:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 4);
|
2017-03-07 01:40:40 -03:00
|
|
|
|
|
|
|
|
immVertex2f(pos, sizex, v2d->cur.ymax);
|
|
|
|
|
immVertex2f(pos, sizex, miny);
|
|
|
|
|
|
|
|
|
|
immVertex2f(pos, sizex + OL_RNA_COL_SIZEX, v2d->cur.ymax);
|
|
|
|
|
immVertex2f(pos, sizex + OL_RNA_COL_SIZEX, miny);
|
|
|
|
|
|
|
|
|
|
immEnd();
|
|
|
|
|
|
|
|
|
|
immUnbindProgram();
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2016-10-16 15:19:18 +02:00
|
|
|
static void outliner_draw_rnabuts(uiBlock *block, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb)
|
2013-03-11 09:06:49 +00:00
|
|
|
{
|
2011-07-11 10:59:53 +00:00
|
|
|
PointerRNA *ptr;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
for (TreeElement *te = lb->first; te; te = te->next) {
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
2012-05-07 17:56:30 +00:00
|
|
|
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tselem->type == TSE_RNA_PROPERTY) {
|
2012-05-07 17:56:30 +00:00
|
|
|
ptr = &te->rnaptr;
|
|
|
|
|
prop = te->directdata;
|
2014-04-27 22:33:05 +02:00
|
|
|
|
|
|
|
|
if (!TSELEM_OPEN(tselem, soops)) {
|
|
|
|
|
if (RNA_property_type(prop) == PROP_POINTER) {
|
2018-06-20 07:12:23 +02:00
|
|
|
uiBut *but = uiDefAutoButR(
|
|
|
|
|
block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys,
|
|
|
|
|
OL_RNA_COL_SIZEX, UI_UNIT_Y - 1);
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_flag_enable(but, UI_BUT_DISABLED);
|
2014-04-27 22:33:05 +02:00
|
|
|
}
|
|
|
|
|
else if (RNA_property_type(prop) == PROP_ENUM) {
|
2018-06-20 07:12:23 +02:00
|
|
|
uiDefAutoButR(
|
|
|
|
|
block, ptr, prop, -1, NULL, ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
|
|
|
|
|
UI_UNIT_Y - 1);
|
2014-04-27 22:33:05 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2018-06-20 07:12:23 +02:00
|
|
|
uiDefAutoButR(
|
|
|
|
|
block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
|
|
|
|
|
UI_UNIT_Y - 1);
|
2014-04-27 22:33:05 +02:00
|
|
|
}
|
2013-03-11 09:06:49 +00:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (tselem->type == TSE_RNA_ARRAY_ELEM) {
|
2012-05-07 17:56:30 +00:00
|
|
|
ptr = &te->rnaptr;
|
|
|
|
|
prop = te->directdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
uiDefAutoButR(
|
|
|
|
|
block, ptr, prop, te->index, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
|
|
|
|
|
UI_UNIT_Y - 1);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
|
|
|
|
outliner_draw_rnabuts(block, ar, soops, sizex, &te->subtree);
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-12 22:55:42 +00:00
|
|
|
static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, TreeElement *te)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
|
|
|
|
uiBut *bt;
|
|
|
|
|
TreeStoreElem *tselem;
|
|
|
|
|
int spx, dx, len;
|
|
|
|
|
|
2013-09-12 22:55:42 +00:00
|
|
|
tselem = TREESTORE(te);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2013-09-12 22:55:42 +00:00
|
|
|
BLI_assert(tselem->flag & TSE_TEXTBUT);
|
|
|
|
|
/* If we add support to rename Sequence.
|
|
|
|
|
* need change this.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (tselem->type == TSE_EBONE) len = sizeof(((EditBone *) 0)->name);
|
|
|
|
|
else if (tselem->type == TSE_MODIFIER) len = sizeof(((ModifierData *) 0)->name);
|
|
|
|
|
else if (tselem->id && GS(tselem->id->name) == ID_LI) len = sizeof(((Library *) 0)->name);
|
|
|
|
|
else len = MAX_ID_NAME - 2;
|
|
|
|
|
|
|
|
|
|
spx = te->xs + 1.8f * UI_UNIT_X;
|
|
|
|
|
dx = ar->v2d.cur.xmax - (spx + 3.2f * UI_UNIT_X);
|
|
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
bt = uiDefBut(
|
|
|
|
|
block, UI_BTYPE_TEXT, OL_NAMEBUTTON, "", spx, te->ys, dx, UI_UNIT_Y - 1, (void *)te->name,
|
|
|
|
|
1.0, (float)len, 0, 0, "");
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_func_rename_set(bt, namebutton_cb, tselem);
|
2013-09-12 22:55:42 +00:00
|
|
|
|
|
|
|
|
/* returns false if button got removed */
|
2014-11-09 21:20:40 +01:00
|
|
|
if (false == UI_but_active_only(C, ar, block, bt)) {
|
2013-09-12 22:55:42 +00:00
|
|
|
tselem->flag &= ~TSE_TEXTBUT;
|
|
|
|
|
|
2018-09-27 15:35:22 +02:00
|
|
|
/* bad! (notifier within draw) without this, we don't get a refresh */
|
2013-09-12 22:55:42 +00:00
|
|
|
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ****************************************************** */
|
|
|
|
|
/* Normal Drawing... */
|
|
|
|
|
|
2018-08-07 10:55:03 +02:00
|
|
|
TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2018-08-07 10:55:03 +02:00
|
|
|
TreeElementIcon data = {0};
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tselem->type) {
|
2012-05-07 17:56:30 +00:00
|
|
|
switch (tselem->type) {
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_ANIM_DATA:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_ANIM_DATA; /* XXX */
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_NLA:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_NLA;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_NLA_TRACK:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_NLA; /* XXX */
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_NLA_ACTION:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_ACTION;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_DRIVER_BASE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_DRIVER;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_DEFGROUP_BASE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_GROUP_VERTEX;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_BONE:
|
|
|
|
|
case TSE_EBONE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_BONE_DATA;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_CONSTRAINT_BASE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_CONSTRAINT;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_MODIFIER_BASE:
|
2018-12-31 13:50:56 +01:00
|
|
|
data.icon = ICON_MODIFIER_DATA;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_LINKED_OB:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OBJECT_DATA;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2016-12-28 17:30:58 +01:00
|
|
|
case TSE_LINKED_PSYS:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_PARTICLES;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_MODIFIER:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Object *ob = (Object *)tselem->id;
|
2018-07-31 10:22:19 +02:00
|
|
|
if (ob->type != OB_GPENCIL) {
|
|
|
|
|
ModifierData *md = BLI_findlink(&ob->modifiers, tselem->nr);
|
|
|
|
|
switch ((ModifierType)md->type) {
|
|
|
|
|
case eModifierType_Subsurf:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SUBSURF;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Armature:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_ARMATURE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Lattice:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_LATTICE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Curve:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_CURVE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Build:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_BUILD;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Mirror:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MIRROR;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Decimate:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_DECIM;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Wave:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_WAVE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Hook:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_HOOK;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Softbody:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SOFT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Boolean:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_BOOLEAN;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_ParticleSystem:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_PARTICLES;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_ParticleInstance:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_PARTICLES;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_EdgeSplit:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_EDGESPLIT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Array:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_ARRAY;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_UVProject:
|
|
|
|
|
case eModifierType_UVWarp: /* TODO, get own icon */
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_UVPROJECT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Displace:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_DISPLACE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Shrinkwrap:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SHRINKWRAP;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Cast:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_CAST;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_MeshDeform:
|
|
|
|
|
case eModifierType_SurfaceDeform:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MESHDEFORM;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Bevel:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_BEVEL;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Smooth:
|
|
|
|
|
case eModifierType_LaplacianSmooth:
|
|
|
|
|
case eModifierType_CorrectiveSmooth:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SMOOTH;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_SimpleDeform:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SIMPLEDEFORM;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Mask:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MASK;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Cloth:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_CLOTH;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Explode:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_EXPLODE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Collision:
|
|
|
|
|
case eModifierType_Surface:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_PHYSICS;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Fluidsim:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_FLUIDSIM;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Multires:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MULTIRES;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Smoke:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SMOKE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Solidify:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SOLIDIFY;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Screw:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SCREW;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Remesh:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_REMESH;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_WeightVGEdit:
|
|
|
|
|
case eModifierType_WeightVGMix:
|
|
|
|
|
case eModifierType_WeightVGProximity:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_VERTEX_WEIGHT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_DynamicPaint:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_DYNAMICPAINT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Ocean:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_OCEAN;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Warp:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_WARP;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Skin:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SKIN;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Triangulate:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_TRIANGULATE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_MeshCache:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MESHDEFORM; /* XXX, needs own icon */
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_MeshSequenceCache:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MESHDEFORM; /* XXX, needs own icon */
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_Wireframe:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_WIREFRAME;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_LaplacianDeform:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MESHDEFORM; /* XXX, needs own icon */
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_DataTransfer:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_DATA_TRANSFER;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eModifierType_NormalEdit:
|
2018-08-01 14:16:41 +02:00
|
|
|
case eModifierType_WeightedNormal:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_NORMALEDIT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
/* Default */
|
|
|
|
|
case eModifierType_None:
|
|
|
|
|
case eModifierType_ShapeKey:
|
|
|
|
|
|
|
|
|
|
case NUM_MODIFIER_TYPES:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_DOT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* grease pencil modifiers */
|
|
|
|
|
GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, tselem->nr);
|
|
|
|
|
switch ((GpencilModifierType)md->type) {
|
|
|
|
|
case eGpencilModifierType_Noise:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_RNDCURVE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Subdiv:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SUBSURF;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Thick:
|
2018-10-28 17:51:40 +01:00
|
|
|
data.icon = ICON_MOD_THICKNESS;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Tint:
|
2018-10-28 17:51:40 +01:00
|
|
|
data.icon = ICON_MOD_TINT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
2018-10-28 18:08:24 +01:00
|
|
|
case eGpencilModifierType_Array:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_ARRAY;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Build:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_BUILD;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Opacity:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MASK;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Color:
|
2018-10-31 17:30:47 +01:00
|
|
|
data.icon = ICON_MOD_HUE_SATURATION;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Lattice:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_LATTICE;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Mirror:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_MIRROR;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Simplify:
|
2018-10-28 17:51:40 +01:00
|
|
|
data.icon = ICON_MOD_SIMPLIFY;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Smooth:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MOD_SMOOTH;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Hook:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_HOOK;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
case eGpencilModifierType_Offset:
|
2018-10-28 17:51:40 +01:00
|
|
|
data.icon = ICON_MOD_OFFSET;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
2018-08-30 12:22:55 +02:00
|
|
|
case eGpencilModifierType_Armature:
|
|
|
|
|
data.icon = ICON_MOD_ARMATURE;
|
|
|
|
|
break;
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
|
/* Default */
|
|
|
|
|
default:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_DOT;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case TSE_POSE_BASE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_ARMATURE_DATA;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_POSE_CHANNEL:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_BONE_DATA;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_PROXY:
|
2018-10-28 17:51:40 +01:00
|
|
|
data.icon = ICON_GHOST_ENABLED;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_R_LAYER_BASE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_RENDERLAYERS;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2018-04-23 20:39:05 +02:00
|
|
|
case TSE_SCENE_OBJECTS_BASE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_GROUP_INSTANCE;
|
2018-04-23 20:39:05 +02:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_R_LAYER:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_RENDER_RESULT;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_LINKED_LAMP:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHT_DATA;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_LINKED_MAT:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MATERIAL_DATA;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_POSEGRP_BASE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_GROUP_BONE;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
case TSE_SEQUENCE:
|
2012-06-07 15:49:02 +00:00
|
|
|
if (te->idcode == SEQ_TYPE_MOVIE)
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_SEQUENCE;
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (te->idcode == SEQ_TYPE_META)
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_DOT;
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (te->idcode == SEQ_TYPE_SCENE)
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_SCENE;
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (te->idcode == SEQ_TYPE_SOUND_RAM)
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_SOUND;
|
2012-06-07 15:49:02 +00:00
|
|
|
else if (te->idcode == SEQ_TYPE_IMAGE)
|
2018-10-01 10:45:50 +02:00
|
|
|
data.icon = ICON_IMAGE;
|
2011-07-11 10:59:53 +00:00
|
|
|
else
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_PARTICLES;
|
2011-07-11 10:59:53 +00:00
|
|
|
break;
|
|
|
|
|
case TSE_SEQ_STRIP:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIBRARY_DATA_DIRECT;
|
2011-07-11 10:59:53 +00:00
|
|
|
break;
|
|
|
|
|
case TSE_SEQUENCE_DUP:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OBJECT_DATA;
|
2011-07-11 10:59:53 +00:00
|
|
|
break;
|
|
|
|
|
case TSE_RNA_STRUCT:
|
2012-03-24 06:38:07 +00:00
|
|
|
if (RNA_struct_is_ID(te->rnaptr.type)) {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.drag_id = (ID *)te->rnaptr.data;
|
|
|
|
|
data.icon = RNA_struct_ui_icon(te->rnaptr.type);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
else {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = RNA_struct_ui_icon(te->rnaptr.type);
|
2017-02-22 16:02:43 +01:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
break;
|
2018-01-18 17:30:35 -02:00
|
|
|
case TSE_LAYER_COLLECTION:
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
case TSE_SCENE_COLLECTION_BASE:
|
|
|
|
|
case TSE_VIEW_COLLECTION_BASE:
|
2018-08-07 10:55:03 +02:00
|
|
|
{
|
|
|
|
|
Collection *collection = outliner_collection_from_tree_element(te);
|
|
|
|
|
if (collection && !(collection->flag & COLLECTION_IS_MASTER)) {
|
|
|
|
|
data.drag_id = tselem->id;
|
|
|
|
|
data.drag_parent = (data.drag_id && te->parent) ? TREESTORE(te->parent)->id : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.icon = ICON_GROUP;
|
2018-01-18 17:30:35 -02:00
|
|
|
break;
|
2018-08-07 10:55:03 +02:00
|
|
|
}
|
2016-08-03 23:31:48 +02:00
|
|
|
/* Removed the icons from outliner. Need a better structure with Layers, Palettes and Colors */
|
2015-02-07 12:50:22 +13:00
|
|
|
case TSE_GP_LAYER:
|
2018-07-31 10:22:19 +02:00
|
|
|
{
|
|
|
|
|
/* indicate whether layer is active */
|
|
|
|
|
bGPDlayer *gpl = te->directdata;
|
|
|
|
|
if (gpl->flag & GP_LAYER_ACTIVE) {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_GREASEPENCIL;
|
2018-07-31 10:22:19 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_DOT;
|
2018-07-31 10:22:19 +02:00
|
|
|
}
|
2015-02-09 12:39:03 +13:00
|
|
|
break;
|
2018-07-31 10:22:19 +02:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
default:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_DOT;
|
2017-02-22 16:02:43 +01:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2016-07-12 14:39:39 +10:00
|
|
|
else if (tselem->id) {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.drag_id = tselem->id;
|
|
|
|
|
data.drag_parent = (data.drag_id && te->parent) ? TREESTORE(te->parent)->id : NULL;
|
|
|
|
|
|
2016-07-12 14:39:39 +10:00
|
|
|
if (GS(tselem->id->name) == ID_OB) {
|
|
|
|
|
Object *ob = (Object *)tselem->id;
|
|
|
|
|
switch (ob->type) {
|
|
|
|
|
case OB_LAMP:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_LIGHT; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_MESH:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_MESH; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_CAMERA:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_CAMERA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_CURVE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_CURVE; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_MBALL:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_META; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_LATTICE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_LATTICE; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_ARMATURE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_ARMATURE; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_FONT:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_FONT; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_SURF:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_SURFACE; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_SPEAKER:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_SPEAKER; break;
|
2018-05-11 16:02:09 +02:00
|
|
|
case OB_LIGHTPROBE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_LIGHTPROBE; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case OB_EMPTY:
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
if (ob->dup_group) {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_GROUP_INSTANCE;
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
}
|
2018-10-01 10:45:50 +02:00
|
|
|
else if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
|
|
|
|
|
data.icon = ICON_OUTLINER_OB_IMAGE;
|
|
|
|
|
}
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
else {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_EMPTY;
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
}
|
|
|
|
|
break;
|
2018-07-31 10:22:19 +02:00
|
|
|
case OB_GPENCIL:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_OB_GREASEPENCIL; break;
|
2018-07-31 10:22:19 +02:00
|
|
|
break;
|
2016-07-12 14:39:39 +10:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2016-07-12 14:39:39 +10:00
|
|
|
else {
|
2017-08-28 11:19:58 +02:00
|
|
|
/* TODO(sergey): Casting to short here just to handle ID_NLA which is
|
|
|
|
|
* NOT inside of IDType enum.
|
|
|
|
|
*/
|
|
|
|
|
switch ((short)GS(tselem->id->name)) {
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_SCE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_SCENE_DATA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_ME:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_MESH; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_CU:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_CURVE; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_MB:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_META; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_LT:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_LATTICE; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_LA:
|
|
|
|
|
{
|
|
|
|
|
Lamp *la = (Lamp *)tselem->id;
|
|
|
|
|
switch (la->type) {
|
|
|
|
|
case LA_LOCAL:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHT_POINT; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case LA_SUN:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHT_SUN; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case LA_SPOT:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHT_SPOT; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case LA_AREA:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHT_AREA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
default:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_LIGHT; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
}
|
|
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_MA:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_MATERIAL_DATA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_TE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_TEXTURE_DATA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_IM:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_IMAGE_DATA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_SPK:
|
|
|
|
|
case ID_SO:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_SPEAKER; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_AR:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_ARMATURE; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_CA:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_CAMERA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_KE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_SHAPEKEY_DATA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_WO:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_WORLD_DATA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_AC:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_ACTION; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_NLA:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_NLA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_TXT:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_SCRIPT; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_GR:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_GROUP; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_LI:
|
|
|
|
|
if (tselem->id->tag & LIB_TAG_MISSING) {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIBRARY_DATA_BROKEN;
|
2016-07-12 14:39:39 +10:00
|
|
|
}
|
|
|
|
|
else if (((Library *)tselem->id)->parent) {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIBRARY_DATA_INDIRECT;
|
2016-07-12 14:39:39 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIBRARY_DATA_DIRECT;
|
2016-07-12 14:39:39 +10:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ID_LS:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LINE_DATA; break;
|
2016-07-12 14:39:39 +10:00
|
|
|
case ID_GD:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_OUTLINER_DATA_GREASEPENCIL; break;
|
2018-05-11 16:02:09 +02:00
|
|
|
case ID_LP:
|
|
|
|
|
{
|
2018-10-11 09:08:30 +11:00
|
|
|
LightProbe *lp = (LightProbe *)tselem->id;
|
2018-05-11 16:02:09 +02:00
|
|
|
switch (lp->type) {
|
|
|
|
|
case LIGHTPROBE_TYPE_CUBE:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHTPROBE_CUBEMAP; break;
|
2018-05-11 16:02:09 +02:00
|
|
|
case LIGHTPROBE_TYPE_PLANAR:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHTPROBE_PLANAR; break;
|
2018-05-11 16:02:09 +02:00
|
|
|
case LIGHTPROBE_TYPE_GRID:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHTPROBE_GRID; break;
|
2018-05-11 16:02:09 +02:00
|
|
|
default:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_LIGHTPROBE_CUBEMAP; break;
|
2018-05-11 16:02:09 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-05-17 12:20:40 +02:00
|
|
|
case ID_BR:
|
2018-08-07 10:55:03 +02:00
|
|
|
data.icon = ICON_BRUSH_DATA; break;
|
2018-05-17 12:20:40 +02:00
|
|
|
case ID_SCR:
|
|
|
|
|
case ID_WS:
|
2018-10-01 10:45:50 +02:00
|
|
|
data.icon = ICON_WORKSPACE; break;
|
2018-12-29 18:26:04 +01:00
|
|
|
case ID_MSK:
|
|
|
|
|
data.icon = ICON_MOD_MASK; break;
|
|
|
|
|
case ID_MC:
|
|
|
|
|
data.icon = ICON_SEQUENCE; break;
|
2017-08-28 11:19:58 +02:00
|
|
|
default:
|
|
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2018-08-07 10:55:03 +02:00
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void tselem_draw_icon(
|
|
|
|
|
uiBlock *block, int xmax, float x, float y, TreeStoreElem *tselem, TreeElement *te,
|
|
|
|
|
float alpha, const bool is_clickable)
|
|
|
|
|
{
|
|
|
|
|
TreeElementIcon data = tree_element_get_icon(tselem, te);
|
|
|
|
|
|
|
|
|
|
if (data.icon == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_clickable || x >= xmax) {
|
|
|
|
|
/* placement of icons, copied from interface_widgets.c */
|
|
|
|
|
float aspect = (0.8f * UI_UNIT_Y) / ICON_DEFAULT_HEIGHT;
|
|
|
|
|
x += 2.0f * aspect;
|
|
|
|
|
y += 2.0f * aspect;
|
|
|
|
|
|
|
|
|
|
/* restrict column clip... it has been coded by simply overdrawing,
|
2018-09-27 15:49:59 +02:00
|
|
|
* doesn't work for buttons */
|
2018-08-07 10:55:03 +02:00
|
|
|
UI_icon_draw_alpha(x, y, data.icon, alpha);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-08-10 17:04:05 +02:00
|
|
|
uiDefIconBut(
|
2018-08-07 10:55:03 +02:00
|
|
|
block, UI_BTYPE_LABEL, 0, data.icon, x, y, UI_UNIT_X, UI_UNIT_Y, NULL,
|
|
|
|
|
0.0, 0.0, 1.0, alpha,
|
|
|
|
|
(data.drag_id && ID_IS_LINKED(data.drag_id)) ? data.drag_id->lib->name : "");
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2018-06-21 19:40:14 +02:00
|
|
|
/**
|
|
|
|
|
* For icon-only children of a collapsed tree,
|
|
|
|
|
* Draw small number over the icon to show how many items of this type are displayed.
|
|
|
|
|
*/
|
|
|
|
|
static void outliner_draw_iconrow_number(
|
|
|
|
|
const uiFontStyle *fstyle,
|
|
|
|
|
int offsx, int ys,
|
|
|
|
|
const int num_elements)
|
|
|
|
|
{
|
2018-07-26 02:42:20 +02:00
|
|
|
float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
2018-06-21 19:40:14 +02:00
|
|
|
float ufac = 0.25f * UI_UNIT_X;
|
|
|
|
|
float offset_x = (float) offsx + UI_UNIT_X * 0.35f;
|
|
|
|
|
|
|
|
|
|
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
|
|
|
|
UI_draw_roundbox_aa(true,
|
|
|
|
|
offset_x + ufac,
|
|
|
|
|
(float)ys - UI_UNIT_Y * 0.2f + ufac,
|
|
|
|
|
offset_x + UI_UNIT_X - ufac,
|
|
|
|
|
(float)ys - UI_UNIT_Y * 0.2f + UI_UNIT_Y - ufac,
|
|
|
|
|
(float)UI_UNIT_Y / 2.0f - ufac,
|
|
|
|
|
color);
|
|
|
|
|
|
|
|
|
|
/* Now the numbers. */
|
|
|
|
|
unsigned char text_col[4];
|
|
|
|
|
|
|
|
|
|
UI_GetThemeColor4ubv(TH_TEXT_HI, text_col);
|
|
|
|
|
text_col[3] = 255;
|
|
|
|
|
|
|
|
|
|
uiFontStyle fstyle_small = *fstyle;
|
|
|
|
|
fstyle_small.points *= 0.8f;
|
|
|
|
|
|
|
|
|
|
/* We treat +99 as 4 digits to make sure the (eyeballed) alignment looks nice. */
|
|
|
|
|
int num_digits = 4;
|
|
|
|
|
char number_text[4] = "+99\0";
|
|
|
|
|
if (num_elements < 100) {
|
|
|
|
|
BLI_snprintf(number_text, sizeof(number_text), "%d", num_elements);
|
|
|
|
|
num_digits = num_elements < 10 ? 1 : 2;
|
|
|
|
|
}
|
|
|
|
|
UI_fontstyle_draw_simple(&fstyle_small,
|
|
|
|
|
(offset_x + ufac + UI_UNIT_X * (2 - num_digits) * 0.12f),
|
|
|
|
|
(float)ys - UI_UNIT_Y * 0.095f + ufac,
|
|
|
|
|
number_text, text_col);
|
|
|
|
|
UI_fontstyle_set(fstyle);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true); /* Roundbox and text drawing disables. */
|
2018-06-21 19:40:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void outliner_draw_iconrow_doit(
|
|
|
|
|
uiBlock *block, TreeElement *te,
|
|
|
|
|
const uiFontStyle *fstyle,
|
|
|
|
|
int xmax, int *offsx, int ys, float alpha_fac,
|
|
|
|
|
const eOLDrawState active,
|
|
|
|
|
const int num_elements)
|
|
|
|
|
{
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
|
|
|
|
|
|
|
|
|
if (active != OL_DRAWSEL_NONE) {
|
|
|
|
|
float ufac = UI_UNIT_X / 20.0f;
|
2018-10-02 19:04:38 +02:00
|
|
|
float color[4] = {1.0f, 1.0f, 1.0f, 0.2f};
|
2018-06-21 19:40:14 +02:00
|
|
|
|
|
|
|
|
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
|
|
|
|
color[3] *= alpha_fac;
|
|
|
|
|
|
|
|
|
|
UI_draw_roundbox_aa(true,
|
|
|
|
|
(float) *offsx + 1.0f * ufac,
|
|
|
|
|
(float)ys + 1.0f * ufac,
|
|
|
|
|
(float)*offsx + UI_UNIT_X - 1.0f * ufac,
|
|
|
|
|
(float)ys + UI_UNIT_Y - ufac,
|
|
|
|
|
(float)UI_UNIT_Y / 2.0f - ufac,
|
|
|
|
|
color);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true); /* Roundbox disables. */
|
2018-06-21 19:40:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* No inlined icon should be clickable. */
|
2018-07-26 02:42:20 +02:00
|
|
|
tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.8f * alpha_fac, false);
|
2018-06-21 19:40:14 +02:00
|
|
|
te->xs = *offsx;
|
|
|
|
|
te->ys = ys;
|
|
|
|
|
te->xend = (short)*offsx + UI_UNIT_X;
|
|
|
|
|
|
|
|
|
|
if (num_elements > 1) {
|
2018-07-26 02:42:20 +02:00
|
|
|
outliner_draw_iconrow_number(fstyle, *offsx, ys, num_elements);
|
2018-06-21 19:40:14 +02:00
|
|
|
}
|
|
|
|
|
(*offsx) += UI_UNIT_X;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the index to use based on the TreeElement ID and object type
|
|
|
|
|
*
|
2018-09-27 15:49:59 +02:00
|
|
|
* We use a continuum of indices until we get to the object datablocks
|
2018-06-21 19:40:14 +02:00
|
|
|
* and we then make room for the object types.
|
|
|
|
|
*/
|
|
|
|
|
static int tree_element_id_type_to_index(TreeElement *te)
|
|
|
|
|
{
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
|
|
|
|
|
|
|
|
|
const int id_index = tselem->type == 0 ? BKE_idcode_to_index(te->idcode) : INDEX_ID_GR;
|
|
|
|
|
if (id_index < INDEX_ID_OB) {
|
|
|
|
|
return id_index;
|
|
|
|
|
}
|
|
|
|
|
else if (id_index == INDEX_ID_OB) {
|
|
|
|
|
const Object *ob = (Object *)tselem->id;
|
|
|
|
|
return INDEX_ID_OB + ob->type;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return id_index + OB_TYPE_MAX;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-26 17:35:14 +02:00
|
|
|
typedef struct MergedIconRow {
|
|
|
|
|
eOLDrawState active[INDEX_ID_MAX + OB_TYPE_MAX];
|
|
|
|
|
int num_elements[INDEX_ID_MAX + OB_TYPE_MAX];
|
|
|
|
|
TreeElement *tree_element[INDEX_ID_MAX + OB_TYPE_MAX];
|
|
|
|
|
} MergedIconRow;
|
|
|
|
|
|
2018-02-13 18:44:53 +11:00
|
|
|
static void outliner_draw_iconrow(
|
2018-06-21 19:40:14 +02:00
|
|
|
bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
|
2018-07-26 17:35:14 +02:00
|
|
|
ListBase *lb, int level, int xmax, int *offsx, int ys, float alpha_fac, MergedIconRow *merged)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2014-01-16 20:22:45 +11:00
|
|
|
eOLDrawState active;
|
2018-05-30 10:16:09 +02:00
|
|
|
const Object *obact = OBACT(view_layer);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
for (TreeElement *te = lb->first; te; te = te->next) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* exit drawing early */
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((*offsx) - UI_UNIT_X > xmax)
|
2011-07-11 10:59:53 +00:00
|
|
|
break;
|
|
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
2018-05-30 10:16:09 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* object hierarchy always, further constrained on level */
|
2012-05-07 17:56:30 +00:00
|
|
|
if (level < 1 || (tselem->type == 0 && te->idcode == ID_OB)) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* active blocks get white circle */
|
2012-05-07 17:56:30 +00:00
|
|
|
if (tselem->type == 0) {
|
2013-03-09 03:46:30 +00:00
|
|
|
if (te->idcode == ID_OB) {
|
2017-11-23 13:51:49 -02:00
|
|
|
active = (OBACT(view_layer) == (Object *)tselem->id) ? OL_DRAWSEL_NORMAL : OL_DRAWSEL_NONE;
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
2018-05-30 10:16:09 +02:00
|
|
|
else if (is_object_data_in_editmode(tselem->id, obact)) {
|
2014-01-16 20:22:45 +11:00
|
|
|
active = OL_DRAWSEL_NORMAL;
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2017-11-23 13:51:49 -02:00
|
|
|
active = tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NONE, false);
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2013-03-09 03:46:30 +00:00
|
|
|
else {
|
2017-11-23 13:51:49 -02:00
|
|
|
active = tree_element_type_active(C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
|
|
|
|
|
2018-12-13 11:51:50 +01:00
|
|
|
if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER)) {
|
2018-06-21 19:40:14 +02:00
|
|
|
outliner_draw_iconrow_doit(block, te, fstyle, xmax, offsx, ys, alpha_fac, active, 1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
const int index = tree_element_id_type_to_index(te);
|
2018-07-26 17:35:14 +02:00
|
|
|
merged->num_elements[index]++;
|
|
|
|
|
if ((merged->tree_element[index] == NULL) ||
|
|
|
|
|
(active > merged->active[index]))
|
2018-06-21 19:40:14 +02:00
|
|
|
{
|
2018-07-26 17:35:14 +02:00
|
|
|
merged->tree_element[index] = te;
|
2018-06-21 19:40:14 +02:00
|
|
|
}
|
2018-07-26 17:35:14 +02:00
|
|
|
merged->active[index] = MAX2(active, merged->active[index]);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* this tree element always has same amount of branches, so don't draw */
|
2018-05-17 12:20:40 +02:00
|
|
|
if (tselem->type != TSE_R_LAYER) {
|
2018-02-13 18:44:53 +11:00
|
|
|
outliner_draw_iconrow(
|
2018-06-21 19:40:14 +02:00
|
|
|
C, block, fstyle, scene, view_layer, soops,
|
2018-07-26 17:35:14 +02:00
|
|
|
&te->subtree, level + 1, xmax, offsx, ys, alpha_fac, merged);
|
2018-05-17 12:20:40 +02:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-07-26 17:35:14 +02:00
|
|
|
if (level == 0) {
|
|
|
|
|
for (int i = 0; i < INDEX_ID_MAX; i++) {
|
|
|
|
|
const int num_subtypes = (i == INDEX_ID_OB) ? OB_TYPE_MAX : 1;
|
|
|
|
|
/* See tree_element_id_type_to_index for the index logic. */
|
|
|
|
|
int index_base = i;
|
|
|
|
|
if (i > INDEX_ID_OB) {
|
|
|
|
|
index_base += OB_TYPE_MAX;
|
|
|
|
|
}
|
|
|
|
|
for (int j = 0; j < num_subtypes; j++) {
|
|
|
|
|
const int index = index_base + j;
|
|
|
|
|
if (merged->num_elements[index] != 0) {
|
|
|
|
|
outliner_draw_iconrow_doit(block,
|
|
|
|
|
merged->tree_element[index],
|
|
|
|
|
fstyle,
|
|
|
|
|
xmax, offsx, ys, alpha_fac,
|
|
|
|
|
merged->active[index],
|
|
|
|
|
merged->num_elements[index]);
|
|
|
|
|
}
|
2018-06-21 19:40:14 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* closed tree element */
|
2016-10-16 15:19:18 +02:00
|
|
|
static void outliner_set_coord_tree_element(TreeElement *te, int startx, int starty)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
|
|
|
|
TreeElement *ten;
|
2016-10-16 02:53:11 +02:00
|
|
|
|
|
|
|
|
/* closed items may be displayed in row of parent, don't change their coordinate! */
|
|
|
|
|
if ((te->flag & TE_ICONROW) == 0) {
|
|
|
|
|
/* store coord and continue, we need coordinates for elements outside view too */
|
|
|
|
|
te->xs = startx;
|
|
|
|
|
te->ys = starty;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (ten = te->subtree.first; ten; ten = ten->next) {
|
2016-10-16 15:19:18 +02:00
|
|
|
outliner_set_coord_tree_element(ten, startx + UI_UNIT_X, starty);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-01-20 14:25:39 +11:00
|
|
|
static void outliner_draw_tree_element(
|
2018-05-30 10:16:09 +02:00
|
|
|
bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer,
|
2017-02-22 16:02:43 +01:00
|
|
|
ARegion *ar, SpaceOops *soops, TreeElement *te, bool draw_grayed_out,
|
2018-08-10 17:04:05 +02:00
|
|
|
int startx, int *starty, TreeElement **te_edit)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
|
|
|
|
TreeStoreElem *tselem;
|
2012-05-07 17:56:30 +00:00
|
|
|
float ufac = UI_UNIT_X / 20.0f;
|
2014-01-16 20:22:45 +11:00
|
|
|
int offsx = 0;
|
|
|
|
|
eOLDrawState active = OL_DRAWSEL_NONE;
|
2016-11-14 20:04:59 -05:00
|
|
|
float color[4];
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem = TREESTORE(te);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) {
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
const float alpha_fac = ((te->flag & TE_DISABLED) || draw_grayed_out) ? 0.5f : 1.0f;
|
2017-02-22 16:02:43 +01:00
|
|
|
const float alpha = 0.5f * alpha_fac;
|
2012-05-07 17:56:30 +00:00
|
|
|
int xmax = ar->v2d.cur.xmax;
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2013-09-12 22:55:42 +00:00
|
|
|
if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) {
|
|
|
|
|
*te_edit = te;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* icons can be ui buts, we don't want it to overlap with restrict */
|
2012-05-07 17:56:30 +00:00
|
|
|
if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0)
|
|
|
|
|
xmax -= OL_TOGW + UI_UNIT_X;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
|
|
|
|
/* colors for active/selected data */
|
2012-05-07 17:56:30 +00:00
|
|
|
if (tselem->type == 0) {
|
2018-05-30 10:16:09 +02:00
|
|
|
const Object *obact = OBACT(view_layer);
|
2012-05-07 17:56:30 +00:00
|
|
|
if (te->idcode == ID_SCE) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tselem->id == (ID *)scene) {
|
2016-11-14 20:04:59 -05:00
|
|
|
rgba_float_args_set(color, 1.0f, 1.0f, 1.0f, alpha);
|
2014-01-16 20:22:45 +11:00
|
|
|
active = OL_DRAWSEL_ACTIVE;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (te->idcode == ID_OB) {
|
|
|
|
|
Object *ob = (Object *)tselem->id;
|
2017-12-13 16:23:56 -02:00
|
|
|
Base *base = (Base *)te->directdata;
|
|
|
|
|
const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0);
|
|
|
|
|
|
2018-05-30 10:16:09 +02:00
|
|
|
if (ob == obact || is_selected) {
|
2018-12-27 12:54:31 +11:00
|
|
|
uchar col[4] = {0, 0, 0, 0};
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* outliner active ob: always white text, circle color now similar to view3d */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-01-16 20:22:45 +11:00
|
|
|
active = OL_DRAWSEL_ACTIVE;
|
2018-05-30 10:16:09 +02:00
|
|
|
if (ob == obact) {
|
2017-12-13 16:23:56 -02:00
|
|
|
if (is_selected) {
|
2011-07-11 10:59:53 +00:00
|
|
|
UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
|
2012-12-17 17:37:48 +00:00
|
|
|
col[3] = alpha;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-01-16 20:22:45 +11:00
|
|
|
active = OL_DRAWSEL_NORMAL;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2017-12-13 16:23:56 -02:00
|
|
|
else if (is_selected) {
|
2011-07-11 10:59:53 +00:00
|
|
|
UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
|
2012-12-17 17:37:48 +00:00
|
|
|
col[3] = alpha;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2016-11-14 20:04:59 -05:00
|
|
|
rgba_float_args_set(color, (float)col[0] / 255, (float)col[1] / 255, (float)col[2] / 255, alpha);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-05-30 10:16:09 +02:00
|
|
|
else if (is_object_data_in_editmode(tselem->id, obact)) {
|
2016-11-14 20:04:59 -05:00
|
|
|
rgba_float_args_set(color, 1.0f, 1.0f, 1.0f, alpha);
|
2014-01-16 20:22:45 +11:00
|
|
|
active = OL_DRAWSEL_ACTIVE;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2017-11-23 13:51:49 -02:00
|
|
|
if (tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NONE, false)) {
|
2016-11-14 20:04:59 -05:00
|
|
|
rgba_float_args_set(color, 0.85f, 0.85f, 1.0f, alpha);
|
2014-01-16 20:22:45 +11:00
|
|
|
active = OL_DRAWSEL_ACTIVE;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2017-11-23 13:51:49 -02:00
|
|
|
active = tree_element_type_active(C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
|
2016-11-14 20:04:59 -05:00
|
|
|
rgba_float_args_set(color, 0.85f, 0.85f, 1.0f, alpha);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* active circle */
|
2014-01-16 20:22:45 +11:00
|
|
|
if (active != OL_DRAWSEL_NONE) {
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
2017-04-06 19:15:26 -04:00
|
|
|
UI_draw_roundbox_aa(
|
|
|
|
|
true,
|
2017-03-17 16:47:19 +03:00
|
|
|
(float)startx + UI_UNIT_X + 1.0f * ufac,
|
2014-11-09 21:20:40 +01:00
|
|
|
(float)*starty + 1.0f * ufac,
|
2017-03-17 16:47:19 +03:00
|
|
|
(float)startx + 2.0f * UI_UNIT_X - 1.0f * ufac,
|
2014-11-09 21:20:40 +01:00
|
|
|
(float)*starty + UI_UNIT_Y - 1.0f * ufac,
|
2016-11-14 20:04:59 -05:00
|
|
|
UI_UNIT_Y / 2.0f - 1.0f * ufac, color);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true); /* roundbox disables it */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
te->flag |= TE_ACTIVE; // for lookup in display hierarchies
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
if (tselem->type == TSE_VIEW_COLLECTION_BASE) {
|
|
|
|
|
/* Scene collection in view layer can't expand/collapse. */
|
2018-01-02 14:00:03 -02:00
|
|
|
}
|
|
|
|
|
else if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
|
2018-04-16 17:26:55 +02:00
|
|
|
/* open/close icon, only when sublevels, except for scene */
|
2018-01-22 12:04:28 -02:00
|
|
|
int icon_x = startx;
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
// icons a bit higher
|
2018-06-20 07:12:23 +02:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
|
|
|
|
UI_icon_draw_alpha(
|
|
|
|
|
(float)icon_x + 2 * ufac, (float)*starty + 1 * ufac, ICON_DISCLOSURE_TRI_DOWN,
|
|
|
|
|
alpha_fac);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
UI_icon_draw_alpha(
|
|
|
|
|
(float)icon_x + 2 * ufac, (float)*starty + 1 * ufac, ICON_DISCLOSURE_TRI_RIGHT,
|
|
|
|
|
alpha_fac);
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
offsx += UI_UNIT_X;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* datatype icon */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-05-17 12:20:40 +02:00
|
|
|
if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE))) {
|
2018-06-21 19:40:14 +02:00
|
|
|
tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac, true);
|
2018-10-11 12:28:05 +02:00
|
|
|
offsx += UI_UNIT_X + 4 * ufac;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
else
|
2012-05-07 17:56:30 +00:00
|
|
|
offsx += 2 * ufac;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_LINKED(tselem->id)) {
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
if (tselem->id->tag & LIB_TAG_MISSING) {
|
2018-06-20 07:12:23 +02:00
|
|
|
UI_icon_draw_alpha(
|
|
|
|
|
(float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_BROKEN,
|
|
|
|
|
alpha_fac);
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
}
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
else if (tselem->id->tag & LIB_TAG_INDIRECT) {
|
2018-06-20 07:12:23 +02:00
|
|
|
UI_icon_draw_alpha(
|
|
|
|
|
(float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_INDIRECT,
|
|
|
|
|
alpha_fac);
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2018-06-20 07:12:23 +02:00
|
|
|
UI_icon_draw_alpha(
|
|
|
|
|
(float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_DIRECT,
|
|
|
|
|
alpha_fac);
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
}
|
2018-10-11 12:28:05 +02:00
|
|
|
offsx += UI_UNIT_X + 4 * ufac;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
else if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_STATIC_OVERRIDE(tselem->id)) {
|
2018-06-20 07:12:23 +02:00
|
|
|
UI_icon_draw_alpha(
|
|
|
|
|
(float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_OVERRIDE,
|
|
|
|
|
alpha_fac);
|
2018-10-11 12:28:05 +02:00
|
|
|
offsx += UI_UNIT_X + 4 * ufac;
|
2017-12-18 12:02:23 +01:00
|
|
|
}
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* name */
|
2016-06-15 21:46:32 +10:00
|
|
|
if ((tselem->flag & TSE_TEXTBUT) == 0) {
|
2017-02-10 00:00:21 +01:00
|
|
|
unsigned char text_col[4];
|
|
|
|
|
|
2016-06-15 21:46:32 +10:00
|
|
|
if (active == OL_DRAWSEL_NORMAL) {
|
2017-02-10 00:00:21 +01:00
|
|
|
UI_GetThemeColor4ubv(TH_TEXT_HI, text_col);
|
2016-06-15 21:46:32 +10:00
|
|
|
}
|
|
|
|
|
else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
|
2017-02-10 00:00:21 +01:00
|
|
|
UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.75f, text_col);
|
|
|
|
|
text_col[3] = 255;
|
2016-06-15 21:46:32 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2017-02-10 00:00:21 +01:00
|
|
|
UI_GetThemeColor4ubv(TH_TEXT, text_col);
|
2016-06-15 21:46:32 +10:00
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
text_col[3] *= alpha_fac;
|
2016-06-15 21:46:32 +10:00
|
|
|
|
2017-02-10 00:00:21 +01:00
|
|
|
UI_fontstyle_draw_simple(fstyle, startx + offsx, *starty + 5 * ufac, te->name, text_col);
|
2016-06-15 21:46:32 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-01-20 14:25:39 +11:00
|
|
|
offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* closed item, we draw the icons, not when it's a scene, or master-server list though */
|
2012-04-29 15:47:02 +00:00
|
|
|
if (!TSELEM_OPEN(tselem, soops)) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (te->subtree.first) {
|
2012-10-07 09:48:59 +00:00
|
|
|
if (tselem->type == 0 && te->idcode == ID_SCE) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
/* this tree element always has same amount of branches, so don't draw */
|
2012-10-07 09:48:59 +00:00
|
|
|
else if (tselem->type != TSE_R_LAYER) {
|
2012-05-07 17:56:30 +00:00
|
|
|
int tempx = startx + offsx;
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2012-10-07 09:48:59 +00:00
|
|
|
/* divider */
|
2017-02-08 18:35:56 -05:00
|
|
|
{
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
2017-02-08 18:35:56 -05:00
|
|
|
unsigned char col[4];
|
2017-02-22 16:02:43 +01:00
|
|
|
|
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2017-02-08 18:35:56 -05:00
|
|
|
UI_GetThemeColorShade4ubv(TH_BACK, -40, col);
|
2017-02-22 16:02:43 +01:00
|
|
|
col[3] *= alpha_fac;
|
|
|
|
|
|
2017-02-08 18:35:56 -05:00
|
|
|
immUniformColor4ubv(col);
|
|
|
|
|
immRecti(pos, tempx - 10.0f * ufac,
|
2017-02-22 16:02:43 +01:00
|
|
|
*starty + 4.0f * ufac,
|
|
|
|
|
tempx - 8.0f * ufac,
|
|
|
|
|
*starty + UI_UNIT_Y - 4.0f * ufac);
|
2017-02-08 18:35:56 -05:00
|
|
|
immUnbindProgram();
|
|
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2018-07-26 17:35:14 +02:00
|
|
|
MergedIconRow merged = {{0}};
|
2018-02-13 18:44:53 +11:00
|
|
|
outliner_draw_iconrow(
|
2018-06-21 19:40:14 +02:00
|
|
|
C, block, fstyle, scene, view_layer, soops, &te->subtree, 0, xmax, &tempx,
|
2018-07-26 17:35:14 +02:00
|
|
|
*starty, alpha_fac, &merged);
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
/* store coord and continue, we need coordinates for elements outside view too */
|
2013-07-30 08:45:45 +00:00
|
|
|
te->xs = startx;
|
|
|
|
|
te->ys = *starty;
|
2012-05-07 17:56:30 +00:00
|
|
|
te->xend = startx + offsx;
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2012-05-07 17:56:30 +00:00
|
|
|
*starty -= UI_UNIT_Y;
|
2015-01-20 14:25:39 +11:00
|
|
|
|
2017-02-22 16:02:43 +01:00
|
|
|
for (TreeElement *ten = te->subtree.first; ten; ten = ten->next) {
|
|
|
|
|
/* check if element needs to be drawn grayed out, but also gray out
|
|
|
|
|
* childs of a grayed out parent (pass on draw_grayed_out to childs) */
|
2018-08-10 17:04:05 +02:00
|
|
|
bool draw_childs_grayed_out = draw_grayed_out || (ten->flag & TE_DRAGGING);
|
2018-02-13 18:44:53 +11:00
|
|
|
outliner_draw_tree_element(
|
2018-05-30 10:16:09 +02:00
|
|
|
C, block, fstyle, scene, view_layer,
|
2018-02-13 18:44:53 +11:00
|
|
|
ar, soops, ten, draw_childs_grayed_out,
|
2018-08-10 17:04:05 +02:00
|
|
|
startx + UI_UNIT_X, starty, te_edit);
|
2015-01-20 14:25:39 +11:00
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
else {
|
2017-02-22 16:02:43 +01:00
|
|
|
for (TreeElement *ten = te->subtree.first; ten; ten = ten->next) {
|
2016-10-16 15:19:18 +02:00
|
|
|
outliner_set_coord_tree_element(ten, startx, *starty);
|
2015-01-20 14:25:39 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
*starty -= UI_UNIT_Y;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
static void outliner_draw_hierarchy_lines_recursive(
|
|
|
|
|
unsigned pos, SpaceOops *soops, ListBase *lb, int startx,
|
|
|
|
|
const unsigned char col[4], bool draw_grayed_out,
|
|
|
|
|
int *starty)
|
2017-02-22 16:02:43 +01:00
|
|
|
{
|
2018-01-11 17:17:17 -02:00
|
|
|
TreeElement *te, *te_vertical_line_last = NULL;
|
2011-07-11 10:59:53 +00:00
|
|
|
int y1, y2;
|
2017-02-08 15:02:43 -05:00
|
|
|
|
2017-02-22 16:02:43 +01:00
|
|
|
if (BLI_listbase_is_empty(lb)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-16 13:44:34 -04:00
|
|
|
const unsigned char grayed_alpha = col[3] / 2;
|
|
|
|
|
|
2018-01-11 17:17:17 -02:00
|
|
|
/* For vertical lines between objects. */
|
2018-05-01 16:22:29 +02:00
|
|
|
y1 = y2 = *starty;
|
2012-05-07 17:56:30 +00:00
|
|
|
for (te = lb->first; te; te = te->next) {
|
2018-08-10 17:04:05 +02:00
|
|
|
bool draw_childs_grayed_out = draw_grayed_out || (te->flag & TE_DRAGGING);
|
2018-06-20 07:12:23 +02:00
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2017-04-16 13:44:34 -04:00
|
|
|
if (draw_childs_grayed_out) {
|
|
|
|
|
immUniformColor3ubvAlpha(col, grayed_alpha);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
immUniformColor4ubv(col);
|
|
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2018-01-11 17:17:17 -02:00
|
|
|
/* Horizontal Line? */
|
|
|
|
|
if (tselem->type == 0 && (te->idcode == ID_OB || te->idcode == ID_SCE)) {
|
2017-02-08 15:02:43 -05:00
|
|
|
immRecti(pos, startx, *starty, startx + UI_UNIT_X, *starty - 1);
|
2018-01-11 17:17:17 -02:00
|
|
|
|
|
|
|
|
/* Vertical Line? */
|
|
|
|
|
if (te->idcode == ID_OB) {
|
|
|
|
|
te_vertical_line_last = te;
|
|
|
|
|
y2 = *starty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
*starty -= UI_UNIT_Y;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
if (TSELEM_OPEN(tselem, soops))
|
2018-06-20 07:12:23 +02:00
|
|
|
outliner_draw_hierarchy_lines_recursive(
|
|
|
|
|
pos, soops, &te->subtree, startx + UI_UNIT_X,
|
|
|
|
|
col, draw_childs_grayed_out, starty);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2017-04-16 13:44:34 -04:00
|
|
|
if (draw_grayed_out) {
|
|
|
|
|
immUniformColor3ubvAlpha(col, grayed_alpha);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
immUniformColor4ubv(col);
|
|
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2018-01-11 17:17:17 -02:00
|
|
|
/* Vertical line. */
|
|
|
|
|
te = te_vertical_line_last;
|
|
|
|
|
if ((te != NULL) && (te->parent || lb->first != lb->last)) {
|
|
|
|
|
immRecti(pos, startx, y1 + UI_UNIT_Y, startx + 1, y2);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-08 15:02:43 -05:00
|
|
|
static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int startx, int *starty)
|
|
|
|
|
{
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
2017-02-22 16:02:43 +01:00
|
|
|
unsigned char col[4];
|
|
|
|
|
|
2017-02-08 15:02:43 -05:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.4f, col);
|
2017-02-22 16:02:43 +01:00
|
|
|
col[3] = 255;
|
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
2017-02-22 16:02:43 +01:00
|
|
|
outliner_draw_hierarchy_lines_recursive(pos, soops, lb, startx, col, false, starty);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2017-02-08 15:02:43 -05:00
|
|
|
immUnbindProgram();
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-16 15:19:18 +02:00
|
|
|
static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *lb, int *starty)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2018-06-20 07:12:23 +02:00
|
|
|
for (TreeElement *te = lb->first; te; te = te->next) {
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* selection status */
|
2018-06-20 07:12:23 +02:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2017-01-15 19:26:35 -05:00
|
|
|
if (tselem->type == TSE_RNA_STRUCT) {
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
2017-01-15 19:26:35 -05:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
immThemeColorShadeAlpha(TH_BACK, -15, -200);
|
|
|
|
|
immRecti(pos, 0, *starty + 1, (int)ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
}
|
2018-06-20 07:12:23 +02:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
*starty -= UI_UNIT_Y;
|
2012-04-29 15:47:02 +00:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2011-07-11 10:59:53 +00:00
|
|
|
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
|
2017-01-15 19:26:35 -05:00
|
|
|
if (tselem->type == TSE_RNA_STRUCT) {
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-01-15 19:26:35 -05:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
immThemeColorShadeAlpha(TH_BACK, -15, -200);
|
2017-02-23 02:52:36 -03:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 2);
|
2017-02-23 02:52:36 -03:00
|
|
|
immVertex2f(pos, 0, (float)*starty + UI_UNIT_Y);
|
|
|
|
|
immVertex2f(pos, ar->v2d.cur.xmax, (float)*starty + UI_UNIT_Y);
|
|
|
|
|
immEnd();
|
|
|
|
|
|
2017-01-15 19:26:35 -05:00
|
|
|
immUnbindProgram();
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-15 00:40:33 +02:00
|
|
|
static void outliner_draw_highlights_recursive(
|
2017-02-07 12:50:04 -05:00
|
|
|
unsigned pos, const ARegion *ar, const SpaceOops *soops, const ListBase *lb,
|
2016-10-15 00:40:33 +02:00
|
|
|
const float col_selection[4], const float col_highlight[4], const float col_searchmatch[4],
|
|
|
|
|
int start_x, int *io_start_y)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2018-06-20 07:12:23 +02:00
|
|
|
const bool is_searching = (
|
|
|
|
|
SEARCHING_OUTLINER(soops) ||
|
|
|
|
|
(soops->outlinevis == SO_DATA_API &&
|
|
|
|
|
soops->search_string[0] != 0));
|
2016-10-15 00:40:33 +02:00
|
|
|
|
|
|
|
|
for (TreeElement *te = lb->first; te; te = te->next) {
|
|
|
|
|
const TreeStoreElem *tselem = TREESTORE(te);
|
|
|
|
|
const int start_y = *io_start_y;
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* selection status */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tselem->flag & TSE_SELECTED) {
|
2017-02-07 12:50:04 -05:00
|
|
|
immUniformColor4fv(col_selection);
|
|
|
|
|
immRecti(pos, 0, start_y + 1, (int)ar->v2d.cur.xmax, start_y + UI_UNIT_Y - 1);
|
2016-10-15 00:40:33 +02:00
|
|
|
}
|
|
|
|
|
|
2018-08-10 17:04:05 +02:00
|
|
|
/* highlights */
|
|
|
|
|
if (tselem->flag & (TSE_DRAG_ANY | TSE_HIGHLIGHTED | TSE_SEARCHMATCH)) {
|
|
|
|
|
const int end_x = (int)ar->v2d.cur.xmax;
|
2016-10-15 00:40:33 +02:00
|
|
|
|
2018-08-10 17:04:05 +02:00
|
|
|
if (tselem->flag & TSE_DRAG_ANY) {
|
|
|
|
|
/* drag and drop highlight */
|
|
|
|
|
float col[4];
|
|
|
|
|
UI_GetThemeColorShade4fv(TH_BACK, -40, col);
|
|
|
|
|
|
|
|
|
|
if (tselem->flag & TSE_DRAG_BEFORE) {
|
|
|
|
|
immUniformColor4fv(col);
|
|
|
|
|
immRecti(pos, start_x, start_y + UI_UNIT_Y - 1, end_x, start_y + UI_UNIT_Y + 1);
|
|
|
|
|
}
|
|
|
|
|
else if (tselem->flag & TSE_DRAG_AFTER) {
|
|
|
|
|
immUniformColor4fv(col);
|
|
|
|
|
immRecti(pos, start_x, start_y - 1, end_x, start_y + 1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
immUniformColor3fvAlpha(col, col[3] * 0.5f);
|
|
|
|
|
immRecti(pos, start_x, start_y + 1, end_x, start_y + UI_UNIT_Y - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (is_searching && (tselem->flag & TSE_SEARCHMATCH)) {
|
|
|
|
|
/* search match highlights
|
|
|
|
|
* we don't expand items when searching in the datablocks but we
|
|
|
|
|
* still want to highlight any filter matches. */
|
|
|
|
|
immUniformColor4fv(col_searchmatch);
|
|
|
|
|
immRecti(pos, start_x, start_y + 1, end_x, start_y + UI_UNIT_Y - 1);
|
|
|
|
|
}
|
|
|
|
|
else if (tselem->flag & TSE_HIGHLIGHTED) {
|
|
|
|
|
/* mouse hover highlight */
|
|
|
|
|
immUniformColor4fv(col_highlight);
|
|
|
|
|
immRecti(pos, 0, start_y + 1, end_x, start_y + UI_UNIT_Y - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-15 00:40:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*io_start_y -= UI_UNIT_Y;
|
|
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
|
|
|
|
outliner_draw_highlights_recursive(
|
2017-02-22 16:02:43 +01:00
|
|
|
pos, ar, soops, &te->subtree, col_selection, col_highlight, col_searchmatch,
|
|
|
|
|
start_x + UI_UNIT_X, io_start_y);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-15 00:40:33 +02:00
|
|
|
static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx, int *starty)
|
|
|
|
|
{
|
|
|
|
|
const float col_highlight[4] = {1.0f, 1.0f, 1.0f, 0.13f};
|
|
|
|
|
float col_selection[4], col_searchmatch[4];
|
|
|
|
|
|
|
|
|
|
UI_GetThemeColor3fv(TH_SELECT_HIGHLIGHT, col_selection);
|
|
|
|
|
col_selection[3] = 1.0f; /* no alpha */
|
|
|
|
|
UI_GetThemeColor4fv(TH_MATCH, col_searchmatch);
|
|
|
|
|
col_searchmatch[3] = 0.5f;
|
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
2017-02-07 12:50:04 -05:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2018-06-20 07:12:23 +02:00
|
|
|
outliner_draw_highlights_recursive(
|
|
|
|
|
pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch,
|
|
|
|
|
startx, starty);
|
2017-02-07 12:50:04 -05:00
|
|
|
immUnbindProgram();
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2016-10-15 00:40:33 +02:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2016-10-15 01:38:44 +02:00
|
|
|
static void outliner_draw_tree(
|
2018-05-30 10:16:09 +02:00
|
|
|
bContext *C, uiBlock *block, Scene *scene, ViewLayer *view_layer,
|
2018-02-13 18:44:53 +11:00
|
|
|
ARegion *ar, SpaceOops *soops, const bool has_restrict_icons,
|
2016-10-15 01:38:44 +02:00
|
|
|
TreeElement **te_edit)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2015-01-20 14:25:39 +11:00
|
|
|
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
|
2011-07-11 10:59:53 +00:00
|
|
|
int starty, startx;
|
2016-10-15 00:40:33 +02:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); // only once
|
2016-10-15 00:40:33 +02:00
|
|
|
|
2018-05-17 12:20:10 +02:00
|
|
|
if (soops->outlinevis == SO_DATA_API) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* struct marks */
|
2012-05-07 17:56:30 +00:00
|
|
|
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
|
2011-07-11 10:59:53 +00:00
|
|
|
outliner_draw_struct_marks(ar, soops, &soops->tree, &starty);
|
|
|
|
|
}
|
2016-10-15 00:40:33 +02:00
|
|
|
|
|
|
|
|
/* draw highlights before hierarchy */
|
2012-05-07 17:56:30 +00:00
|
|
|
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
|
2016-10-15 00:40:33 +02:00
|
|
|
startx = 0;
|
|
|
|
|
outliner_draw_highlights(ar, soops, startx, &starty);
|
2016-10-15 01:38:44 +02:00
|
|
|
|
|
|
|
|
/* set scissor so tree elements or lines can't overlap restriction icons */
|
2018-06-27 19:07:23 -06:00
|
|
|
float scissor[4] = {0};
|
2016-10-15 01:38:44 +02:00
|
|
|
if (has_restrict_icons) {
|
2018-01-03 18:32:46 -02:00
|
|
|
int mask_x = BLI_rcti_size_x(&ar->v2d.mask) - (int)OL_TOGW + 1;
|
2016-10-15 01:38:44 +02:00
|
|
|
CLAMP_MIN(mask_x, 0);
|
|
|
|
|
|
2018-07-02 18:27:05 +02:00
|
|
|
GPU_scissor_get_f(scissor);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_scissor(0, 0, mask_x, ar->winy);
|
2016-10-15 01:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
2012-07-03 19:09:07 +00:00
|
|
|
// gray hierarchy lines
|
2018-06-04 09:39:04 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET;
|
2018-01-22 12:04:28 -02:00
|
|
|
startx = UI_UNIT_X / 2 - 1.0f;
|
2016-10-15 00:40:33 +02:00
|
|
|
outliner_draw_hierarchy_lines(soops, &soops->tree, startx, &starty);
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
// items themselves
|
2012-05-07 17:56:30 +00:00
|
|
|
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
|
|
|
|
|
startx = 0;
|
2016-10-15 00:40:33 +02:00
|
|
|
for (TreeElement *te = soops->tree.first; te; te = te->next) {
|
2018-02-13 18:44:53 +11:00
|
|
|
outliner_draw_tree_element(
|
2018-05-30 10:16:09 +02:00
|
|
|
C, block, fstyle, scene, view_layer,
|
2018-08-10 17:04:05 +02:00
|
|
|
ar, soops, te, (te->flag & TE_DRAGGING) != 0,
|
|
|
|
|
startx, &starty, te_edit);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2016-10-15 01:38:44 +02:00
|
|
|
|
|
|
|
|
if (has_restrict_icons) {
|
|
|
|
|
/* reset scissor */
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_scissor(UNPACK4(scissor));
|
2016-10-15 01:38:44 +02:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void outliner_back(ARegion *ar)
|
|
|
|
|
{
|
|
|
|
|
int ystart;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
ystart = (int)ar->v2d.tot.ymax;
|
|
|
|
|
ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET;
|
2016-10-20 01:43:46 +00:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2016-10-20 01:43:46 +00:00
|
|
|
|
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
immUniformThemeColorShade(TH_BACK, 6);
|
|
|
|
|
|
|
|
|
|
const float x1 = 0.0f, x2 = ar->v2d.cur.xmax;
|
|
|
|
|
float y1 = ystart, y2;
|
|
|
|
|
int tot = (int)floor(ystart - ar->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y);
|
|
|
|
|
|
|
|
|
|
if (tot > 0) {
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_TRIS, 6 * tot);
|
2016-10-20 01:43:46 +00:00
|
|
|
while (tot--) {
|
|
|
|
|
y1 -= 2 * UI_UNIT_Y;
|
|
|
|
|
y2 = y1 + UI_UNIT_Y;
|
|
|
|
|
immVertex2f(pos, x1, y1);
|
|
|
|
|
immVertex2f(pos, x2, y1);
|
|
|
|
|
immVertex2f(pos, x2, y2);
|
2017-04-10 15:16:59 +02:00
|
|
|
|
|
|
|
|
immVertex2f(pos, x1, y1);
|
|
|
|
|
immVertex2f(pos, x2, y2);
|
2016-10-20 01:43:46 +00:00
|
|
|
immVertex2f(pos, x1, y2);
|
|
|
|
|
}
|
|
|
|
|
immEnd();
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2016-10-20 01:43:46 +00:00
|
|
|
immUnbindProgram();
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-03 18:32:46 -02:00
|
|
|
static void outliner_draw_restrictcols(ARegion *ar)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(1.0f);
|
2017-03-03 13:12:29 -05:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
2017-03-03 13:12:29 -05:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
|
2018-11-30 02:24:06 -02:00
|
|
|
immBegin(GPU_PRIM_LINES, 6);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2018-01-03 18:32:46 -02:00
|
|
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax);
|
|
|
|
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymin);
|
|
|
|
|
|
|
|
|
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)ar->v2d.cur.ymax);
|
|
|
|
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)ar->v2d.cur.ymin);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2017-03-03 13:12:29 -05:00
|
|
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)ar->v2d.cur.ymax);
|
|
|
|
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)ar->v2d.cur.ymin);
|
|
|
|
|
|
|
|
|
|
immEnd();
|
|
|
|
|
immUnbindProgram();
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ****************************************************** */
|
|
|
|
|
/* Main Entrypoint - Draw contents of Outliner editor */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
void draw_outliner(const bContext *C)
|
|
|
|
|
{
|
2018-06-04 09:31:30 +02:00
|
|
|
Main *mainvar = CTX_data_main(C);
|
2012-05-07 17:56:30 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2017-11-23 13:51:49 -02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
2012-05-07 17:56:30 +00:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
|
|
|
|
View2D *v2d = &ar->v2d;
|
|
|
|
|
SpaceOops *soops = CTX_wm_space_outliner(C);
|
2011-07-11 10:59:53 +00:00
|
|
|
uiBlock *block;
|
2012-05-07 17:56:30 +00:00
|
|
|
int sizey = 0, sizex = 0, sizex_rna = 0;
|
2013-09-12 22:55:42 +00:00
|
|
|
TreeElement *te_edit = NULL;
|
2016-10-15 01:38:44 +02:00
|
|
|
bool has_restrict_icons;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_build_tree(mainvar, scene, view_layer, soops, ar); // always
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* get extents of data */
|
|
|
|
|
outliner_height(soops, &soops->tree, &sizey);
|
|
|
|
|
|
2019-01-14 15:01:51 +01:00
|
|
|
/* extend size to allow for horizontal scrollbar */
|
|
|
|
|
sizey += V2D_SCROLL_HEIGHT;
|
|
|
|
|
|
2018-05-17 12:20:10 +02:00
|
|
|
if (soops->outlinevis == SO_DATA_API) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* RNA has two columns:
|
2018-11-14 12:53:15 +11:00
|
|
|
* - column 1 is (max_width + OL_RNA_COL_SPACEX) or
|
|
|
|
|
* (OL_RNA_COL_X), whichever is wider...
|
|
|
|
|
* - column 2 is fixed at OL_RNA_COL_SIZEX
|
2011-07-11 10:59:53 +00:00
|
|
|
*
|
2013-02-13 05:10:38 +00:00
|
|
|
* (*) XXX max width for now is a fixed factor of (UI_UNIT_X * (max_indention + 100))
|
2011-07-11 10:59:53 +00:00
|
|
|
*/
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* get actual width of column 1 */
|
|
|
|
|
outliner_rna_width(soops, &soops->tree, &sizex_rna, 0);
|
2012-10-27 11:18:54 +00:00
|
|
|
sizex_rna = max_ii(OL_RNA_COLX, sizex_rna + OL_RNA_COL_SPACEX);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* get width of data (for setting 'tot' rect, this is column 1 + column 2 + a bit extra) */
|
2013-10-15 13:55:06 +00:00
|
|
|
sizex = sizex_rna + OL_RNA_COL_SIZEX + 50;
|
2016-10-15 01:38:44 +02:00
|
|
|
has_restrict_icons = false;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* width must take into account restriction columns (if visible)
|
|
|
|
|
* so that entries will still be visible */
|
2011-07-11 10:59:53 +00:00
|
|
|
//outliner_width(soops, &soops->tree, &sizex);
|
2013-03-11 09:06:49 +00:00
|
|
|
// XXX should use outliner_width instead when te->xend will be set correctly...
|
|
|
|
|
outliner_rna_width(soops, &soops->tree, &sizex, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* constant offset for restriction columns */
|
|
|
|
|
// XXX this isn't that great yet...
|
2017-12-14 11:46:49 -02:00
|
|
|
if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0) {
|
2018-01-03 18:32:46 -02:00
|
|
|
sizex += OL_TOGW * 3;
|
2017-12-14 11:46:49 -02:00
|
|
|
}
|
2016-10-15 01:38:44 +02:00
|
|
|
|
|
|
|
|
has_restrict_icons = !(soops->flag & SO_HIDE_RESTRICTCOLS);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* adds vertical offset */
|
|
|
|
|
sizey += OL_Y_OFFSET;
|
|
|
|
|
|
|
|
|
|
/* update size of tot-rect (extents of data/viewable area) */
|
|
|
|
|
UI_view2d_totRect_set(v2d, sizex, sizey);
|
|
|
|
|
|
|
|
|
|
/* force display to pixel coords */
|
2012-05-07 17:56:30 +00:00
|
|
|
v2d->flag |= (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
|
2011-07-11 10:59:53 +00:00
|
|
|
/* set matrix for 2d-view controls */
|
|
|
|
|
UI_view2d_view_ortho(v2d);
|
|
|
|
|
|
2013-11-05 21:59:30 +00:00
|
|
|
/* draw outliner stuff (background, hierarchy lines and names) */
|
2011-07-11 10:59:53 +00:00
|
|
|
outliner_back(ar);
|
2014-11-09 21:20:40 +01:00
|
|
|
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
2018-02-13 18:44:53 +11:00
|
|
|
outliner_draw_tree(
|
2018-05-30 10:16:09 +02:00
|
|
|
(bContext *)C, block, scene, view_layer,
|
2018-02-13 18:44:53 +11:00
|
|
|
ar, soops, has_restrict_icons, &te_edit);
|
2018-01-19 15:44:26 -02:00
|
|
|
|
2018-06-20 07:12:23 +02:00
|
|
|
/* Default to no emboss for outliner UI. */
|
|
|
|
|
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
|
|
|
|
|
2018-05-17 12:20:10 +02:00
|
|
|
if (soops->outlinevis == SO_DATA_API) {
|
2018-02-08 16:15:49 +13:00
|
|
|
/* draw rna buttons */
|
|
|
|
|
outliner_draw_rnacols(ar, sizex_rna);
|
2018-06-20 07:12:23 +02:00
|
|
|
|
|
|
|
|
UI_block_emboss_set(block, UI_EMBOSS);
|
2018-02-08 16:15:49 +13:00
|
|
|
outliner_draw_rnabuts(block, ar, soops, sizex_rna, &soops->tree);
|
2018-06-20 07:12:23 +02:00
|
|
|
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
2018-02-08 16:15:49 +13:00
|
|
|
}
|
|
|
|
|
else if ((soops->outlinevis == SO_ID_ORPHANS) && has_restrict_icons) {
|
2015-02-16 00:10:33 +13:00
|
|
|
/* draw user toggle columns */
|
2018-01-03 18:32:46 -02:00
|
|
|
outliner_draw_restrictcols(ar);
|
2015-02-16 00:10:33 +13:00
|
|
|
outliner_draw_userbuts(block, ar, soops, &soops->tree);
|
|
|
|
|
}
|
2016-10-15 01:38:44 +02:00
|
|
|
else if (has_restrict_icons) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* draw restriction columns */
|
2018-01-03 18:32:46 -02:00
|
|
|
outliner_draw_restrictcols(ar);
|
2018-06-20 11:11:58 +02:00
|
|
|
|
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
2018-05-14 23:36:56 +02:00
|
|
|
outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &soops->tree);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2018-06-21 18:15:17 +02:00
|
|
|
UI_block_emboss_set(block, UI_EMBOSS);
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* draw edit buttons if nessecery */
|
2013-09-12 22:55:42 +00:00
|
|
|
if (te_edit) {
|
|
|
|
|
outliner_buttons(C, block, ar, te_edit);
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_end(C, block);
|
|
|
|
|
UI_block_draw(C, block);
|
2018-06-04 09:31:30 +02:00
|
|
|
}
|