Blender V2.61 - r43446

outliner_intern.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version. 
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2008 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * 
00022  * Contributor(s): Blender Foundation
00023  *
00024  * ***** END GPL LICENSE BLOCK *****
00025  */
00026 
00032 #ifndef ED_OUTLINER_INTERN_H
00033 #define ED_OUTLINER_INTERN_H
00034 
00035 #include "RNA_types.h"
00036 
00037 /* internal exports only */
00038 
00039 struct wmWindowManager;
00040 struct wmOperatorType;
00041 struct TreeStoreElem;
00042 struct bContext;
00043 struct Scene;
00044 struct ARegion;
00045 struct ID;
00046 struct Object;
00047 
00048 typedef struct TreeElement {
00049     struct TreeElement *next, *prev, *parent;
00050     ListBase subtree;
00051     float xs, ys;       // do selection
00052     int store_index;    // offset in tree store
00053     short flag;         // flag for non-saved stuff
00054     short index;        // index for data arrays
00055     short idcode;       // from TreeStore id
00056     short xend;         // width of item display, for select
00057     const char *name;
00058     void *directdata;   // Armature Bones, Base, Sequence, Strip...
00059     PointerRNA rnaptr;  // RNA Pointer
00060 }  TreeElement;
00061 
00062 /* TreeElement->flag */
00063 #define TE_ACTIVE       1
00064 #define TE_ICONROW      2
00065 #define TE_LAZY_CLOSED  4
00066 #define TE_FREE_NAME    8
00067 
00068 /* TreeStoreElem types */
00069 #define TSE_NLA             1   
00070 #define TSE_NLA_ACTION      2
00071 #define TSE_DEFGROUP_BASE   3
00072 #define TSE_DEFGROUP        4
00073 #define TSE_BONE            5
00074 #define TSE_EBONE           6
00075 #define TSE_CONSTRAINT_BASE 7
00076 #define TSE_CONSTRAINT      8
00077 #define TSE_MODIFIER_BASE   9
00078 #define TSE_MODIFIER        10
00079 #define TSE_LINKED_OB       11
00080 #define TSE_SCRIPT_BASE     12
00081 #define TSE_POSE_BASE       13
00082 #define TSE_POSE_CHANNEL    14
00083 #define TSE_ANIM_DATA       15
00084 #define TSE_DRIVER_BASE     16
00085 #define TSE_DRIVER          17
00086 
00087 #define TSE_PROXY           18
00088 #define TSE_R_LAYER_BASE    19
00089 #define TSE_R_LAYER         20
00090 #define TSE_R_PASS          21
00091 #define TSE_LINKED_MAT      22
00092 /* NOTE, is used for light group */
00093 #define TSE_LINKED_LAMP     23
00094 #define TSE_POSEGRP_BASE    24
00095 #define TSE_POSEGRP         25
00096 #define TSE_SEQUENCE        26
00097 #define TSE_SEQ_STRIP       27
00098 #define TSE_SEQUENCE_DUP    28
00099 #define TSE_LINKED_PSYS     29
00100 #define TSE_RNA_STRUCT      30
00101 #define TSE_RNA_PROPERTY    31
00102 #define TSE_RNA_ARRAY_ELEM  32
00103 #define TSE_NLA_TRACK       33
00104 #define TSE_KEYMAP          34
00105 #define TSE_KEYMAP_ITEM     35
00106 
00107 /* button events */
00108 #define OL_NAMEBUTTON       1
00109 
00110 /* get TreeStoreElem associated with a TreeElement 
00111  * < a: (TreeElement) tree element to find stored element for
00112  */
00113 #define TREESTORE(a) ((a)?soops->treestore->data+(a)->store_index:NULL)
00114 
00115 /* size constants */
00116 #define OL_Y_OFFSET 2
00117 
00118 #define OL_TOG_RESTRICT_VIEWX   (UI_UNIT_X*3)
00119 #define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X*2)
00120 #define OL_TOG_RESTRICT_RENDERX UI_UNIT_X
00121 
00122 #define OL_TOGW OL_TOG_RESTRICT_VIEWX
00123 
00124 #define OL_RNA_COLX         (UI_UNIT_X*15)
00125 #define OL_RNA_COL_SIZEX    (UI_UNIT_X*7.5f)
00126 #define OL_RNA_COL_SPACEX   (UI_UNIT_X*2.5f)
00127 
00128 
00129 /* Outliner Searching --
00130 
00131    Are we looking for something in the outliner?
00132    If so finding matches in child items makes it more useful
00133 
00134      - We want to flag parents to act as being open to filter child matches 
00135      - and also flag matches so we can highlight them
00136      - Flags are stored in TreeStoreElem->flag
00137      - Flag options defined in DNA_outliner_types.h
00138      - SO_SEARCH_RECURSIVE defined in DNA_space_types.h
00139      
00140      - NOT in datablocks view - searching all datablocks takes way too long 
00141         to be useful
00142      - not searching into RNA items helps but isn't the complete solution
00143     */
00144 
00145 #define SEARCHING_OUTLINER(sov)   (sov->search_flags & SO_SEARCH_RECURSIVE)
00146 
00147 /* is the currrent element open? if so we also show children */
00148 #define TSELEM_OPEN(telm,sv)    ( (telm->flag & TSE_CLOSED)==0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH)) )
00149 
00150 /* outliner_tree.c ----------------------------------------------- */
00151 
00152 void outliner_free_tree(ListBase *lb);
00153 void outliner_cleanup_tree(struct SpaceOops *soops);
00154 
00155 TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse);
00156 TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id);
00157 struct ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode);
00158 
00159 void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct SpaceOops *soops);
00160 
00161 /* outliner_draw.c ---------------------------------------------- */
00162 
00163 void draw_outliner(const struct bContext *C);
00164 void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag);
00165 
00166 /* outliner_select.c -------------------------------------------- */
00167 int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set);
00168 int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, TreeElement *te, int set);
00169 
00170 /* outliner_edit.c ---------------------------------------------- */
00171 
00172 void outliner_do_object_operation(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb, 
00173                                   void (*operation_cb)(struct bContext *C, struct Scene *scene, struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *));
00174 
00175 int common_restrict_check(struct bContext *C, struct Object *ob);
00176 
00177 int outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, short curlevel);
00178 void outliner_set_flag(struct SpaceOops *soops, ListBase *lb, short flag, short set);
00179 
00180 void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
00181 void object_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
00182 void object_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
00183 
00184 
00185 void group_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
00186 void group_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
00187 void group_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
00188 
00189 void item_rename_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
00190 
00191 /* ...................................................... */
00192 
00193 void OUTLINER_OT_item_activate(struct wmOperatorType *ot);
00194 void OUTLINER_OT_item_openclose(struct wmOperatorType *ot);
00195 void OUTLINER_OT_item_rename(struct wmOperatorType *ot);
00196 
00197 void OUTLINER_OT_show_one_level(struct wmOperatorType *ot);
00198 void OUTLINER_OT_show_active(struct wmOperatorType *ot);
00199 void OUTLINER_OT_show_hierarchy(struct wmOperatorType *ot);
00200 
00201 void OUTLINER_OT_selected_toggle(struct wmOperatorType *ot);
00202 void OUTLINER_OT_expanded_toggle(struct wmOperatorType *ot);
00203 
00204 void OUTLINER_OT_scroll_page(struct wmOperatorType *ot);
00205 
00206 void OUTLINER_OT_renderability_toggle(struct wmOperatorType *ot);
00207 void OUTLINER_OT_selectability_toggle(struct wmOperatorType *ot);
00208 void OUTLINER_OT_visibility_toggle(struct wmOperatorType *ot);
00209 
00210 void OUTLINER_OT_keyingset_add_selected(struct wmOperatorType *ot);
00211 void OUTLINER_OT_keyingset_remove_selected(struct wmOperatorType *ot);
00212 
00213 void OUTLINER_OT_drivers_add_selected(struct wmOperatorType *ot);
00214 void OUTLINER_OT_drivers_delete_selected(struct wmOperatorType *ot);
00215 
00216 /* outliner_tools.c ---------------------------------------------- */
00217 
00218 void OUTLINER_OT_operation(struct wmOperatorType *ot);
00219 void OUTLINER_OT_object_operation(struct wmOperatorType *ot);
00220 void OUTLINER_OT_group_operation(struct wmOperatorType *ot);
00221 void OUTLINER_OT_id_operation(struct wmOperatorType *ot);
00222 void OUTLINER_OT_data_operation(struct wmOperatorType *ot);
00223 void OUTLINER_OT_animdata_operation(struct wmOperatorType *ot);
00224 void OUTLINER_OT_action_set(struct wmOperatorType *ot);
00225 
00226 /* ---------------------------------------------------------------- */
00227 
00228 /* outliner_ops.c */
00229 void outliner_operatortypes(void);
00230 void outliner_keymap(struct wmKeyConfig *keyconf);
00231 
00232 #endif /* ED_OUTLINER_INTERN_H */