2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2008 Blender Foundation.
19 * All rights reserved.
22 * Contributor(s): Blender Foundation
24 * ***** END GPL LICENSE BLOCK *****
27 /** \file blender/editors/space_outliner/outliner_intern.h
32 #ifndef ED_OUTLINER_INTERN_H
33 #define ED_OUTLINER_INTERN_H
35 #include "RNA_types.h"
37 /* internal exports only */
39 struct wmWindowManager;
40 struct wmOperatorType;
48 typedef struct TreeElement {
49 struct TreeElement *next, *prev, *parent;
51 float xs, ys; // do selection
52 int store_index; // offset in tree store
53 short flag; // flag for non-saved stuff
54 short index; // index for data arrays
55 short idcode; // from TreeStore id
56 short xend; // width of item display, for select
58 void *directdata; // Armature Bones, Base, Sequence, Strip...
59 PointerRNA rnaptr; // RNA Pointer
62 /* TreeElement->flag */
65 #define TE_LAZY_CLOSED 4
66 #define TE_FREE_NAME 8
68 /* TreeStoreElem types */
70 #define TSE_NLA_ACTION 2
71 #define TSE_DEFGROUP_BASE 3
72 #define TSE_DEFGROUP 4
75 #define TSE_CONSTRAINT_BASE 7
76 #define TSE_CONSTRAINT 8
77 #define TSE_MODIFIER_BASE 9
78 #define TSE_MODIFIER 10
79 #define TSE_LINKED_OB 11
80 #define TSE_SCRIPT_BASE 12
81 #define TSE_POSE_BASE 13
82 #define TSE_POSE_CHANNEL 14
83 #define TSE_ANIM_DATA 15
84 #define TSE_DRIVER_BASE 16
88 #define TSE_R_LAYER_BASE 19
89 #define TSE_R_LAYER 20
91 #define TSE_LINKED_MAT 22
92 /* NOTE, is used for light group */
93 #define TSE_LINKED_LAMP 23
94 #define TSE_POSEGRP_BASE 24
95 #define TSE_POSEGRP 25
96 #define TSE_SEQUENCE 26
97 #define TSE_SEQ_STRIP 27
98 #define TSE_SEQUENCE_DUP 28
99 #define TSE_LINKED_PSYS 29
100 #define TSE_RNA_STRUCT 30
101 #define TSE_RNA_PROPERTY 31
102 #define TSE_RNA_ARRAY_ELEM 32
103 #define TSE_NLA_TRACK 33
104 #define TSE_KEYMAP 34
105 #define TSE_KEYMAP_ITEM 35
108 #define OL_NAMEBUTTON 1
110 /* get TreeStoreElem associated with a TreeElement
111 * < a: (TreeElement) tree element to find stored element for
113 #define TREESTORE(a) ((a)?soops->treestore->data+(a)->store_index:NULL)
116 #define OL_Y_OFFSET 2
118 #define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X*3)
119 #define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X*2)
120 #define OL_TOG_RESTRICT_RENDERX UI_UNIT_X
122 #define OL_TOGW OL_TOG_RESTRICT_VIEWX
124 #define OL_RNA_COLX (UI_UNIT_X*15)
125 #define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5f)
126 #define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5f)
129 /* Outliner Searching --
131 Are we looking for something in the outliner?
132 If so finding matches in child items makes it more useful
134 - We want to flag parents to act as being open to filter child matches
135 - and also flag matches so we can highlight them
136 - Flags are stored in TreeStoreElem->flag
137 - Flag options defined in DNA_outliner_types.h
138 - SO_SEARCH_RECURSIVE defined in DNA_space_types.h
140 - NOT in datablocks view - searching all datablocks takes way too long
142 - not searching into RNA items helps but isn't the complete solution
145 #define SEARCHING_OUTLINER(sov) (sov->search_flags & SO_SEARCH_RECURSIVE)
147 /* is the currrent element open? if so we also show children */
148 #define TSELEM_OPEN(telm,sv) ( (telm->flag & TSE_CLOSED)==0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH)) )
150 /* outliner_tree.c ----------------------------------------------- */
152 void outliner_free_tree(ListBase *lb);
153 void outliner_cleanup_tree(struct SpaceOops *soops);
155 TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse);
156 TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id);
157 struct ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode);
159 void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct SpaceOops *soops);
161 /* outliner_draw.c ---------------------------------------------- */
163 void draw_outliner(const struct bContext *C);
164 void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag);
166 /* outliner_select.c -------------------------------------------- */
167 int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set);
168 int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, TreeElement *te, int set);
170 /* outliner_edit.c ---------------------------------------------- */
172 void outliner_do_object_operation(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb,
173 void (*operation_cb)(struct bContext *C, struct Scene *scene, struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *));
175 int common_restrict_check(struct bContext *C, struct Object *ob);
177 int outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, short curlevel);
178 void outliner_set_flag(struct SpaceOops *soops, ListBase *lb, short flag, short set);
180 void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
181 void object_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
182 void object_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
185 void group_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
186 void group_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
187 void group_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
189 void item_rename_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
191 /* ...................................................... */
193 void OUTLINER_OT_item_activate(struct wmOperatorType *ot);
194 void OUTLINER_OT_item_openclose(struct wmOperatorType *ot);
195 void OUTLINER_OT_item_rename(struct wmOperatorType *ot);
197 void OUTLINER_OT_show_one_level(struct wmOperatorType *ot);
198 void OUTLINER_OT_show_active(struct wmOperatorType *ot);
199 void OUTLINER_OT_show_hierarchy(struct wmOperatorType *ot);
201 void OUTLINER_OT_selected_toggle(struct wmOperatorType *ot);
202 void OUTLINER_OT_expanded_toggle(struct wmOperatorType *ot);
204 void OUTLINER_OT_scroll_page(struct wmOperatorType *ot);
206 void OUTLINER_OT_renderability_toggle(struct wmOperatorType *ot);
207 void OUTLINER_OT_selectability_toggle(struct wmOperatorType *ot);
208 void OUTLINER_OT_visibility_toggle(struct wmOperatorType *ot);
210 void OUTLINER_OT_keyingset_add_selected(struct wmOperatorType *ot);
211 void OUTLINER_OT_keyingset_remove_selected(struct wmOperatorType *ot);
213 void OUTLINER_OT_drivers_add_selected(struct wmOperatorType *ot);
214 void OUTLINER_OT_drivers_delete_selected(struct wmOperatorType *ot);
216 /* outliner_tools.c ---------------------------------------------- */
218 void OUTLINER_OT_operation(struct wmOperatorType *ot);
219 void OUTLINER_OT_object_operation(struct wmOperatorType *ot);
220 void OUTLINER_OT_group_operation(struct wmOperatorType *ot);
221 void OUTLINER_OT_id_operation(struct wmOperatorType *ot);
222 void OUTLINER_OT_data_operation(struct wmOperatorType *ot);
223 void OUTLINER_OT_animdata_operation(struct wmOperatorType *ot);
224 void OUTLINER_OT_action_set(struct wmOperatorType *ot);
226 /* ---------------------------------------------------------------- */
229 void outliner_operatortypes(void);
230 void outliner_keymap(struct wmKeyConfig *keyconf);
232 #endif /* ED_OUTLINER_INTERN_H */