forked from bartvdbraak/blender
svn merge -r39257:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender/
This commit is contained in:
commit
7cfd8e15bb
Binary file not shown.
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 200 KiB |
@ -43,17 +43,17 @@ extern "C" {
|
||||
/* these lines are grep'd, watch out for our not-so-awesome regex
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 258
|
||||
#define BLENDER_SUBVERSION 1
|
||||
#define BLENDER_VERSION 259
|
||||
#define BLENDER_SUBVERSION 0
|
||||
|
||||
#define BLENDER_MINVERSION 250
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
||||
/* used by packaging tools */
|
||||
/* can be left blank, otherwise a,b,c... etc with no quotes */
|
||||
#define BLENDER_VERSION_CHAR a
|
||||
#define BLENDER_VERSION_CHAR
|
||||
/* alpha/beta/rc/release, docs use this */
|
||||
#define BLENDER_VERSION_CYCLE beta
|
||||
#define BLENDER_VERSION_CYCLE release
|
||||
|
||||
struct ListBase;
|
||||
struct MemFile;
|
||||
|
@ -136,7 +136,7 @@ static struct bUnitDef buImperialLenDef[] = {
|
||||
{"yard", "yards", "yd", NULL, "Yards", UN_SC_YD, 0.0, B_UNIT_DEF_NONE},
|
||||
{"foot", "feet", "'", "ft", "Feet", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
|
||||
{"inch", "inches", "\"", "in", "Inches", UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
|
||||
{"thou", "thous", "mil", NULL, "Thous", UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
|
||||
{"thou", "thou", "thou", "mil", "Thou", UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, /* plural for thou has no 's' */
|
||||
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
|
||||
};
|
||||
static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 4, 0, sizeof(buImperialLenDef)/sizeof(bUnitDef)};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,6 +39,7 @@
|
||||
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_colortools.h"
|
||||
@ -2110,7 +2111,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
|
||||
}
|
||||
else if(itemptr->type == &RNA_ShapeKey) {
|
||||
Object *ob= (Object*)activeptr->data;
|
||||
Key *key= (Key*)itemptr->data;
|
||||
Key *key= (Key*)itemptr->id.data;
|
||||
|
||||
split= uiLayoutSplit(sub, 0.75f, 0);
|
||||
|
||||
@ -2328,9 +2329,10 @@ static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
|
||||
|
||||
static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_first();
|
||||
GHashIterator *iter= WM_operatortype_iter();
|
||||
|
||||
for(; ot; ot= ot->next) {
|
||||
for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
|
||||
|
||||
if(BLI_strcasestr(ot->name, str)) {
|
||||
if(WM_operator_poll((bContext*)C, ot)) {
|
||||
@ -2351,6 +2353,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_ghashIterator_free(iter);
|
||||
}
|
||||
|
||||
void uiTemplateOperatorSearch(uiLayout *layout)
|
||||
|
@ -37,8 +37,12 @@ set(INC_SYS
|
||||
)
|
||||
|
||||
set(SRC
|
||||
outliner.c
|
||||
outliner_draw.c
|
||||
outliner_edit.c
|
||||
outliner_ops.c
|
||||
outliner_select.c
|
||||
outliner_tools.c
|
||||
outliner_tree.c
|
||||
space_outliner.c
|
||||
|
||||
outliner_intern.h
|
||||
|
File diff suppressed because it is too large
Load Diff
1671
source/blender/editors/space_outliner/outliner_draw.c
Normal file
1671
source/blender/editors/space_outliner/outliner_draw.c
Normal file
File diff suppressed because it is too large
Load Diff
1398
source/blender/editors/space_outliner/outliner_edit.c
Normal file
1398
source/blender/editors/space_outliner/outliner_edit.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -44,6 +44,8 @@ struct TreeStoreElem;
|
||||
struct bContext;
|
||||
struct Scene;
|
||||
struct ARegion;
|
||||
struct ID;
|
||||
struct Object;
|
||||
|
||||
typedef struct TreeElement {
|
||||
struct TreeElement *next, *prev, *parent;
|
||||
@ -107,27 +109,65 @@ typedef struct TreeElement {
|
||||
/* button events */
|
||||
#define OL_NAMEBUTTON 1
|
||||
|
||||
/* get TreeStoreElem associated with a TreeElement
|
||||
* < a: (TreeElement) tree element to find stored element for
|
||||
*/
|
||||
#define TREESTORE(a) ((a)?soops->treestore->data+(a)->store_index:NULL)
|
||||
|
||||
/* outliner_ops.c */
|
||||
void outliner_operatortypes(void);
|
||||
void outliner_keymap(struct wmKeyConfig *keyconf);
|
||||
/* size constants */
|
||||
#define OL_Y_OFFSET 2
|
||||
|
||||
/* outliner_header.c */
|
||||
void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);
|
||||
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X*3)
|
||||
#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X*2)
|
||||
#define OL_TOG_RESTRICT_RENDERX UI_UNIT_X
|
||||
|
||||
#define OL_TOGW OL_TOG_RESTRICT_VIEWX
|
||||
|
||||
#define OL_RNA_COLX (UI_UNIT_X*15)
|
||||
#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5)
|
||||
#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5)
|
||||
|
||||
|
||||
/* outliner_tree.c ----------------------------------------------- */
|
||||
|
||||
void outliner_free_tree(ListBase *lb);
|
||||
|
||||
TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse);
|
||||
TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id);
|
||||
struct ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode);
|
||||
|
||||
void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct SpaceOops *soops);
|
||||
|
||||
/* outliner_draw.c ---------------------------------------------- */
|
||||
|
||||
/* outliner.c */
|
||||
void outliner_free_tree(struct ListBase *lb);
|
||||
void outliner_select(struct SpaceOops *soops, struct ListBase *lb, int *index, short *selecting);
|
||||
void draw_outliner(const struct bContext *C);
|
||||
|
||||
/* outliner_select.c -------------------------------------------- */
|
||||
|
||||
void outliner_select(struct SpaceOops *soops, ListBase *lb, int *index, short *selecting);
|
||||
|
||||
int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set);
|
||||
int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, TreeElement *te, int set);
|
||||
|
||||
/* outliner_edit.c ---------------------------------------------- */
|
||||
|
||||
void outliner_do_object_operation(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb,
|
||||
void (*operation_cb)(struct bContext *C, struct Scene *scene, struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *));
|
||||
|
||||
int common_restrict_check(struct bContext *C, struct Object *ob);
|
||||
|
||||
int outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, short curlevel);
|
||||
void outliner_set_flag(struct SpaceOops *soops, ListBase *lb, short flag, short set);
|
||||
|
||||
void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
|
||||
void object_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
|
||||
void object_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
|
||||
|
||||
/* ...................................................... */
|
||||
|
||||
void OUTLINER_OT_item_activate(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_item_openclose(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_item_rename(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_object_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_group_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_id_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_data_operation(struct wmOperatorType *ot);
|
||||
|
||||
void OUTLINER_OT_show_one_level(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_show_active(struct wmOperatorType *ot);
|
||||
@ -148,5 +188,23 @@ void OUTLINER_OT_keyingset_remove_selected(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_drivers_add_selected(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_drivers_delete_selected(struct wmOperatorType *ot);
|
||||
|
||||
#endif /* ED_OUTLINER_INTERN_H */
|
||||
/* outliner_tools.c ---------------------------------------------- */
|
||||
|
||||
void OUTLINER_OT_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_object_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_group_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_id_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_data_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_animdata_operation(struct wmOperatorType *ot);
|
||||
void OUTLINER_OT_action_set(struct wmOperatorType *ot);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* outliner_ops.c */
|
||||
void outliner_operatortypes(void);
|
||||
void outliner_keymap(struct wmKeyConfig *keyconf);
|
||||
|
||||
/* outliner_header.c */
|
||||
void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);
|
||||
|
||||
#endif /* ED_OUTLINER_INTERN_H */
|
||||
|
@ -57,6 +57,13 @@ void outliner_operatortypes(void)
|
||||
WM_operatortype_append(OUTLINER_OT_group_operation);
|
||||
WM_operatortype_append(OUTLINER_OT_id_operation);
|
||||
WM_operatortype_append(OUTLINER_OT_data_operation);
|
||||
WM_operatortype_append(OUTLINER_OT_animdata_operation);
|
||||
|
||||
#if 0 // GSOC_PEPPER
|
||||
|
||||
WM_operatortype_append(OUTLINER_OT_action_set);
|
||||
|
||||
#endif // GSOC_PEPPER
|
||||
|
||||
WM_operatortype_append(OUTLINER_OT_show_one_level);
|
||||
WM_operatortype_append(OUTLINER_OT_show_active);
|
||||
|
867
source/blender/editors/space_outliner/outliner_select.c
Normal file
867
source/blender/editors/space_outliner/outliner_select.c
Normal file
@ -0,0 +1,867 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2004 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): Joshua Leung
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/editors/space_outliner/outliner_select.c
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math_base.h"
|
||||
|
||||
#if defined WIN32 && !defined _LIBC
|
||||
# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
|
||||
#else
|
||||
# ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
# endif
|
||||
# include <fnmatch.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_fcurve.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_group.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_sequencer.h"
|
||||
|
||||
#include "ED_armature.h"
|
||||
#include "ED_object.h"
|
||||
#include "ED_screen.h"
|
||||
#include "ED_util.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_glutil.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_interface_icons.h"
|
||||
#include "UI_resources.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "outliner_intern.h"
|
||||
|
||||
/* ****************************************************** */
|
||||
/* Outliner Selection (grey-blue highlight for rows) */
|
||||
|
||||
void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) {
|
||||
tselem= TREESTORE(te);
|
||||
|
||||
/* if we've encountered the right item, set its 'Outliner' selection status */
|
||||
if (*index == 0) {
|
||||
/* this should be the last one, so no need to do anything with index */
|
||||
if ((te->flag & TE_ICONROW)==0) {
|
||||
/* -1 value means toggle testing for now... */
|
||||
if (*selecting == -1) {
|
||||
if (tselem->flag & TSE_SELECTED)
|
||||
*selecting= 0;
|
||||
else
|
||||
*selecting= 1;
|
||||
}
|
||||
|
||||
/* set selection */
|
||||
if (*selecting)
|
||||
tselem->flag |= TSE_SELECTED;
|
||||
else
|
||||
tselem->flag &= ~TSE_SELECTED;
|
||||
}
|
||||
}
|
||||
else if ((tselem->flag & TSE_CLOSED)==0) {
|
||||
/* Only try selecting sub-elements if we haven't hit the right element yet
|
||||
*
|
||||
* Hack warning:
|
||||
* Index must be reduced before supplying it to the sub-tree to try to do
|
||||
* selection, however, we need to increment it again for the next loop to
|
||||
* function correctly
|
||||
*/
|
||||
(*index)--;
|
||||
outliner_select(soops, &te->subtree, index, selecting);
|
||||
(*index)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ****************************************************** */
|
||||
/* Outliner Element Selection/Activation on Click */
|
||||
|
||||
static int tree_element_active_renderlayer(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
Scene *sce;
|
||||
|
||||
/* paranoia check */
|
||||
if(te->idcode!=ID_SCE)
|
||||
return 0;
|
||||
sce= (Scene *)tselem->id;
|
||||
|
||||
if(set) {
|
||||
sce->r.actlay= tselem->nr;
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, sce);
|
||||
}
|
||||
else {
|
||||
return sce->r.actlay==tselem->nr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
Scene *sce;
|
||||
Base *base;
|
||||
Object *ob= NULL;
|
||||
|
||||
/* if id is not object, we search back */
|
||||
if(te->idcode==ID_OB) ob= (Object *)tselem->id;
|
||||
else {
|
||||
ob= (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
if(ob==OBACT) return 0;
|
||||
}
|
||||
if(ob==NULL) return 0;
|
||||
|
||||
sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
|
||||
if(sce && scene != sce) {
|
||||
ED_screen_set_scene(C, sce);
|
||||
}
|
||||
|
||||
/* find associated base in current scene */
|
||||
base= object_in_scene(ob, scene);
|
||||
|
||||
if(base) {
|
||||
if(set==2) {
|
||||
/* swap select */
|
||||
if(base->flag & SELECT)
|
||||
ED_base_object_select(base, BA_DESELECT);
|
||||
else
|
||||
ED_base_object_select(base, BA_SELECT);
|
||||
}
|
||||
else {
|
||||
/* deleselect all */
|
||||
scene_deselect_all(scene);
|
||||
ED_base_object_select(base, BA_SELECT);
|
||||
}
|
||||
if(C) {
|
||||
ED_base_object_activate(C, base); /* adds notifier */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
}
|
||||
}
|
||||
|
||||
if(ob!=scene->obedit)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
TreeElement *tes;
|
||||
Object *ob;
|
||||
|
||||
/* we search for the object parent */
|
||||
ob= (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
// note: ob->matbits can be NULL when a local object points to a library mesh.
|
||||
if(ob==NULL || ob!=OBACT || ob->matbits==NULL) return 0; // just paranoia
|
||||
|
||||
/* searching in ob mat array? */
|
||||
tes= te->parent;
|
||||
if(tes->idcode==ID_OB) {
|
||||
if(set) {
|
||||
ob->actcol= te->index+1;
|
||||
ob->matbits[te->index]= 1; // make ob material active too
|
||||
ob->colbits |= (1<<te->index);
|
||||
}
|
||||
else {
|
||||
if(ob->actcol == te->index+1)
|
||||
if(ob->matbits[te->index]) return 1;
|
||||
}
|
||||
}
|
||||
/* or we search for obdata material */
|
||||
else {
|
||||
if(set) {
|
||||
ob->actcol= te->index+1;
|
||||
ob->matbits[te->index]= 0; // make obdata material active too
|
||||
ob->colbits &= ~(1<<te->index);
|
||||
}
|
||||
else {
|
||||
if(ob->actcol == te->index+1)
|
||||
if(ob->matbits[te->index]==0) return 1;
|
||||
}
|
||||
}
|
||||
if(set) {
|
||||
WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
TreeElement *tep;
|
||||
TreeStoreElem /* *tselem,*/ *tselemp;
|
||||
Object *ob=OBACT;
|
||||
SpaceButs *sbuts=NULL;
|
||||
|
||||
if(ob==NULL) return 0; // no active object
|
||||
|
||||
/*tselem= TREESTORE(te);*/ /*UNUSED*/
|
||||
|
||||
/* find buttons area (note, this is undefined really still, needs recode in blender) */
|
||||
/* XXX removed finding sbuts */
|
||||
|
||||
/* where is texture linked to? */
|
||||
tep= te->parent;
|
||||
tselemp= TREESTORE(tep);
|
||||
|
||||
if(tep->idcode==ID_WO) {
|
||||
World *wrld= (World *)tselemp->id;
|
||||
|
||||
if(set) {
|
||||
if(sbuts) {
|
||||
// XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
|
||||
// XXX sbuts->texfrom= 1;
|
||||
}
|
||||
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
|
||||
wrld->texact= te->index;
|
||||
}
|
||||
else if(tselemp->id == (ID *)(scene->world)) {
|
||||
if(wrld->texact==te->index) return 1;
|
||||
}
|
||||
}
|
||||
else if(tep->idcode==ID_LA) {
|
||||
Lamp *la= (Lamp *)tselemp->id;
|
||||
if(set) {
|
||||
if(sbuts) {
|
||||
// XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
|
||||
// XXX sbuts->texfrom= 2;
|
||||
}
|
||||
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
|
||||
la->texact= te->index;
|
||||
}
|
||||
else {
|
||||
if(tselemp->id == ob->data) {
|
||||
if(la->texact==te->index) return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(tep->idcode==ID_MA) {
|
||||
Material *ma= (Material *)tselemp->id;
|
||||
if(set) {
|
||||
if(sbuts) {
|
||||
//sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
|
||||
// XXX sbuts->texfrom= 0;
|
||||
}
|
||||
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
|
||||
ma->texact= (char)te->index;
|
||||
|
||||
/* also set active material */
|
||||
ob->actcol= tep->index+1;
|
||||
}
|
||||
else if(tep->flag & TE_ACTIVE) { // this is active material
|
||||
if(ma->texact==te->index) return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(set)
|
||||
WM_event_add_notifier(C, NC_TEXTURE, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
Object *ob;
|
||||
|
||||
/* we search for the object parent */
|
||||
ob= (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
if(ob==NULL || ob!=OBACT) return 0; // just paranoia
|
||||
|
||||
if(set) {
|
||||
// XXX extern_set_butspace(F5KEY, 0);
|
||||
}
|
||||
else return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
Object *ob= (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
|
||||
if(set)
|
||||
return 0;
|
||||
|
||||
return scene->camera == ob;
|
||||
}
|
||||
|
||||
static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
TreeElement *tep;
|
||||
TreeStoreElem *tselem=NULL;
|
||||
Scene *sce=NULL;
|
||||
|
||||
tep= te->parent;
|
||||
if(tep) {
|
||||
tselem= TREESTORE(tep);
|
||||
sce= (Scene *)tselem->id;
|
||||
}
|
||||
|
||||
if(set) { // make new scene active
|
||||
if(sce && scene != sce) {
|
||||
ED_screen_set_scene(C, sce);
|
||||
}
|
||||
}
|
||||
|
||||
if(tep==NULL || tselem->id == (ID *)scene) {
|
||||
if(set) {
|
||||
// XXX extern_set_butspace(F8KEY, 0);
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
Object *ob;
|
||||
|
||||
/* id in tselem is object */
|
||||
ob= (Object *)tselem->id;
|
||||
if(set) {
|
||||
ob->actdef= te->index+1;
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
|
||||
}
|
||||
else {
|
||||
if(ob==OBACT)
|
||||
if(ob->actdef== te->index+1) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_posegroup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
Object *ob= (Object *)tselem->id;
|
||||
|
||||
if(set) {
|
||||
if (ob->pose) {
|
||||
ob->pose->active_group= te->index+1;
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(ob==OBACT && ob->pose) {
|
||||
if (ob->pose->active_group== te->index+1) return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
Object *ob= (Object *)tselem->id;
|
||||
bArmature *arm= ob->data;
|
||||
bPoseChannel *pchan= te->directdata;
|
||||
|
||||
if(set) {
|
||||
if(!(pchan->bone->flag & BONE_HIDDEN_P)) {
|
||||
|
||||
if(set==2) ED_pose_deselectall(ob, 2); // 2 = clear active tag
|
||||
else ED_pose_deselectall(ob, 0); // 0 = deselect
|
||||
|
||||
if(set==2 && (pchan->bone->flag & BONE_SELECTED)) {
|
||||
pchan->bone->flag &= ~BONE_SELECTED;
|
||||
} else {
|
||||
pchan->bone->flag |= BONE_SELECTED;
|
||||
arm->act_bone= pchan->bone;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, ob);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(ob==OBACT && ob->pose) {
|
||||
if (pchan->bone->flag & BONE_SELECTED) return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
bArmature *arm= (bArmature *)tselem->id;
|
||||
Bone *bone= te->directdata;
|
||||
|
||||
if(set) {
|
||||
if(!(bone->flag & BONE_HIDDEN_P)) {
|
||||
if(set==2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag
|
||||
else ED_pose_deselectall(OBACT, 0);
|
||||
|
||||
if(set==2 && (bone->flag & BONE_SELECTED)) {
|
||||
bone->flag &= ~BONE_SELECTED;
|
||||
} else {
|
||||
bone->flag |= BONE_SELECTED;
|
||||
arm->act_bone= bone;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, OBACT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Object *ob= OBACT;
|
||||
|
||||
if(ob && ob->data==arm) {
|
||||
if (bone->flag & BONE_SELECTED) return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* ebones only draw in editmode armature */
|
||||
static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel)
|
||||
{
|
||||
if(sel) {
|
||||
ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
|
||||
arm->act_edbone= ebone;
|
||||
// flush to parent?
|
||||
if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
|
||||
}
|
||||
else {
|
||||
ebone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL);
|
||||
// flush to parent?
|
||||
if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
|
||||
}
|
||||
static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
|
||||
{
|
||||
bArmature *arm= scene->obedit->data;
|
||||
EditBone *ebone= te->directdata;
|
||||
|
||||
if(set==1) {
|
||||
if(!(ebone->flag & BONE_HIDDEN_A)) {
|
||||
ED_armature_deselect_all(scene->obedit, 0); // deselect
|
||||
tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (set==2) {
|
||||
if(!(ebone->flag & BONE_HIDDEN_A)) {
|
||||
if(!(ebone->flag & BONE_SELECTED)) {
|
||||
tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
/* entirely selected, so de-select */
|
||||
tree_element_active_ebone__sel(C, scene, arm, ebone, FALSE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ebone->flag & BONE_SELECTED) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
|
||||
{
|
||||
if(set) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
|
||||
|
||||
// XXX extern_set_butspace(F9KEY, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
|
||||
{
|
||||
if(set) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
|
||||
|
||||
// XXX extern_set_butspace(F7KEY, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
|
||||
{
|
||||
if(set) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
|
||||
// XXX extern_set_butspace(F7KEY, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_text(bContext *UNUSED(C), Scene *UNUSED(scene), SpaceOops *UNUSED(soops), TreeElement *UNUSED(te), int UNUSED(set))
|
||||
{
|
||||
// XXX removed
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
|
||||
{
|
||||
Object *ob= (Object *)tselem->id;
|
||||
Base *base= object_in_scene(ob, scene);
|
||||
|
||||
if(set) {
|
||||
if(scene->obedit)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
|
||||
|
||||
if(ob->mode & OB_MODE_POSE)
|
||||
ED_armature_exit_posemode(C, base);
|
||||
else
|
||||
ED_armature_enter_posemode(C, base);
|
||||
}
|
||||
else {
|
||||
if(ob->mode & OB_MODE_POSE) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
|
||||
{
|
||||
Sequence *seq= (Sequence*) te->directdata;
|
||||
|
||||
if(set) {
|
||||
// XXX select_single_seq(seq, 1);
|
||||
}
|
||||
else {
|
||||
if(seq->flag & SELECT)
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
|
||||
{
|
||||
Sequence *seq, *p;
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
|
||||
seq= (Sequence*)te->directdata;
|
||||
if(set==0) {
|
||||
if(seq->flag & SELECT)
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
// XXX select_single_seq(seq, 1);
|
||||
p= ed->seqbasep->first;
|
||||
while(p) {
|
||||
if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
|
||||
p= p->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
|
||||
// XXX select_single_seq(p, 0);
|
||||
p= p->next;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
|
||||
{
|
||||
wmKeyMapItem *kmi= te->directdata;
|
||||
|
||||
if(set==0) {
|
||||
if(kmi->flag & KMI_INACTIVE) return 0;
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
kmi->flag ^= KMI_INACTIVE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------- */
|
||||
|
||||
/* generic call for ID data check or make/check active in UI */
|
||||
int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
|
||||
switch(te->idcode) {
|
||||
case ID_OB:
|
||||
return tree_element_set_active_object(C, scene, soops, te, set);
|
||||
case ID_MA:
|
||||
return tree_element_active_material(C, scene, soops, te, set);
|
||||
case ID_WO:
|
||||
return tree_element_active_world(C, scene, soops, te, set);
|
||||
case ID_LA:
|
||||
return tree_element_active_lamp(C, scene, soops, te, set);
|
||||
case ID_TE:
|
||||
return tree_element_active_texture(C, scene, soops, te, set);
|
||||
case ID_TXT:
|
||||
return tree_element_active_text(C, scene, soops, te, set);
|
||||
case ID_CA:
|
||||
return tree_element_active_camera(C, scene, soops, te, set);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* generic call for non-id data to make/check active in UI */
|
||||
/* Context can be NULL when set==0 */
|
||||
int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
switch(tselem->type) {
|
||||
case TSE_DEFGROUP:
|
||||
return tree_element_active_defgroup(C, scene, te, tselem, set);
|
||||
case TSE_BONE:
|
||||
return tree_element_active_bone(C, scene, te, tselem, set);
|
||||
case TSE_EBONE:
|
||||
return tree_element_active_ebone(C, scene, te, tselem, set);
|
||||
case TSE_MODIFIER:
|
||||
return tree_element_active_modifier(C, te, tselem, set);
|
||||
case TSE_LINKED_OB:
|
||||
if(set) tree_element_set_active_object(C, scene, soops, te, set);
|
||||
else if(tselem->id==(ID *)OBACT) return 1;
|
||||
break;
|
||||
case TSE_LINKED_PSYS:
|
||||
return tree_element_active_psys(C, scene, te, tselem, set);
|
||||
case TSE_POSE_BASE:
|
||||
return tree_element_active_pose(C, scene, te, tselem, set);
|
||||
case TSE_POSE_CHANNEL:
|
||||
return tree_element_active_posechannel(C, scene, te, tselem, set);
|
||||
case TSE_CONSTRAINT:
|
||||
return tree_element_active_constraint(C, te, tselem, set);
|
||||
case TSE_R_LAYER:
|
||||
return tree_element_active_renderlayer(C, te, tselem, set);
|
||||
case TSE_POSEGRP:
|
||||
return tree_element_active_posegroup(C, scene, te, tselem, set);
|
||||
case TSE_SEQUENCE:
|
||||
return tree_element_active_sequence(te, tselem, set);
|
||||
case TSE_SEQUENCE_DUP:
|
||||
return tree_element_active_sequence_dup(scene, te, tselem, set);
|
||||
case TSE_KEYMAP_ITEM:
|
||||
return tree_element_active_keymap_item(C, te, tselem, set);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
|
||||
static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2])
|
||||
{
|
||||
|
||||
if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
int openclose= 0;
|
||||
|
||||
/* open close icon */
|
||||
if((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close
|
||||
if( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X)
|
||||
openclose= 1;
|
||||
}
|
||||
|
||||
if(openclose) {
|
||||
/* all below close/open? */
|
||||
if(extend) {
|
||||
tselem->flag &= ~TSE_CLOSED;
|
||||
outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1));
|
||||
}
|
||||
else {
|
||||
if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
|
||||
else tselem->flag |= TSE_CLOSED;
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/* name and first icon */
|
||||
else if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
|
||||
|
||||
/* always makes active object */
|
||||
if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
|
||||
tree_element_set_active_object(C, scene, soops, te, 1 + (extend!=0 && tselem->type==0));
|
||||
|
||||
if(tselem->type==0) { // the lib blocks
|
||||
/* editmode? */
|
||||
if(te->idcode==ID_SCE) {
|
||||
if(scene!=(Scene *)tselem->id) {
|
||||
ED_screen_set_scene(C, (Scene *)tselem->id);
|
||||
}
|
||||
}
|
||||
else if(te->idcode==ID_GR) {
|
||||
Group *gr= (Group *)tselem->id;
|
||||
GroupObject *gob;
|
||||
|
||||
if(extend) {
|
||||
int sel= BA_SELECT;
|
||||
for(gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
if(gob->ob->flag & SELECT) {
|
||||
sel= BA_DESELECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
ED_base_object_select(object_in_scene(gob->ob, scene), sel);
|
||||
}
|
||||
}
|
||||
else {
|
||||
scene_deselect_all(scene);
|
||||
|
||||
for(gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
if((gob->ob->flag & SELECT) == 0)
|
||||
ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
}
|
||||
else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
|
||||
WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
|
||||
} else { // rest of types
|
||||
tree_element_active(C, scene, soops, te, 1);
|
||||
}
|
||||
|
||||
}
|
||||
else tree_element_type_active(C, scene, soops, te, tselem, 1+(extend!=0));
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for(te= te->subtree.first; te; te= te->next) {
|
||||
if(do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* event can enterkey, then it opens/closes */
|
||||
static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
TreeElement *te;
|
||||
float fmval[2];
|
||||
int extend= RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
|
||||
|
||||
if(!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) && !(soops->flag & SO_HIDE_RESTRICTCOLS) && fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
for(te= soops->tree.first; te; te= te->next) {
|
||||
if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
|
||||
}
|
||||
|
||||
if(te) {
|
||||
ED_undo_push(C, "Outliner click event");
|
||||
}
|
||||
else {
|
||||
short selecting= -1;
|
||||
int row;
|
||||
|
||||
/* get row number - 100 here is just a dummy value since we don't need the column */
|
||||
UI_view2d_listview_view_to_cell(&ar->v2d, 1000, UI_UNIT_Y, 0.0f, OL_Y_OFFSET,
|
||||
fmval[0], fmval[1], NULL, &row);
|
||||
|
||||
/* select relevant row */
|
||||
outliner_select(soops, &soops->tree, &row, &selecting);
|
||||
|
||||
soops->storeflag |= SO_TREESTORE_REDRAW;
|
||||
|
||||
ED_undo_push(C, "Outliner selection event");
|
||||
}
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OUTLINER_OT_item_activate(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Activate Item";
|
||||
ot->idname= "OUTLINER_OT_item_activate";
|
||||
ot->description= "Handle mouse clicks to activate/select items";
|
||||
|
||||
ot->invoke= outliner_item_activate;
|
||||
|
||||
ot->poll= ED_operator_outliner_active;
|
||||
|
||||
RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection for activation.");
|
||||
}
|
||||
|
||||
/* ****************************************************** */
|
1217
source/blender/editors/space_outliner/outliner_tools.c
Normal file
1217
source/blender/editors/space_outliner/outliner_tools.c
Normal file
File diff suppressed because it is too large
Load Diff
1585
source/blender/editors/space_outliner/outliner_tree.c
Normal file
1585
source/blender/editors/space_outliner/outliner_tree.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -179,6 +179,13 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NC_ANIMATION:
|
||||
switch(wmn->data) {
|
||||
case ND_NLA_ACTCHANGE:
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5777,7 +5777,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
|
||||
/* if( ((int)ob->ctime) != F_(scene->r.cfra)) where_is_object(scene, ob); */
|
||||
|
||||
/* draw motion paths (in view space) */
|
||||
if (ob->mpath) {
|
||||
if (ob->mpath && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
|
||||
bAnimVizSettings *avs= &ob->avs;
|
||||
|
||||
/* setup drawing environment for paths */
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "BLI_editVert.h"
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_idprop.h"
|
||||
@ -140,9 +141,10 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
|
||||
|
||||
static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_first();
|
||||
GHashIterator *iter= WM_operatortype_iter();
|
||||
|
||||
for(; ot; ot= ot->next) {
|
||||
for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
|
||||
|
||||
if(BLI_strcasestr(ot->name, str)) {
|
||||
if(WM_operator_poll((bContext*)C, ot)) {
|
||||
@ -152,6 +154,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_ghashIterator_free(iter);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,6 +52,9 @@
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_context.h"
|
||||
|
||||
@ -359,14 +362,17 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
|
||||
|
||||
static PyObject *pyop_dir(PyObject *UNUSED(self))
|
||||
{
|
||||
GHashIterator *iter= WM_operatortype_iter();
|
||||
PyObject *list= PyList_New(0), *name;
|
||||
wmOperatorType *ot;
|
||||
|
||||
for(ot= WM_operatortype_first(); ot; ot= ot->next) {
|
||||
for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
|
||||
|
||||
name= PyUnicode_FromString(ot->idname);
|
||||
PyList_Append(list, name);
|
||||
Py_DECREF(name);
|
||||
}
|
||||
BLI_ghashIterator_free(iter);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ void WM_operator_free (struct wmOperator *op);
|
||||
void WM_operator_stack_clear(struct wmWindowManager *wm);
|
||||
|
||||
struct wmOperatorType *WM_operatortype_find(const char *idnamem, int quiet);
|
||||
struct wmOperatorType *WM_operatortype_first(void);
|
||||
struct GHashIterator *WM_operatortype_iter(void);
|
||||
void WM_operatortype_append (void (*opfunc)(struct wmOperatorType*));
|
||||
void WM_operatortype_append_ptr (void (*opfunc)(struct wmOperatorType*, void *), void *userdata);
|
||||
void WM_operatortype_append_macro_ptr (void (*opfunc)(struct wmOperatorType*, void *), void *userdata);
|
||||
@ -230,6 +230,7 @@ void WM_operator_bl_idname(char *to, const char *from);
|
||||
void WM_operator_py_idname(char *to, const char *from);
|
||||
|
||||
/* *************** menu types ******************** */
|
||||
void WM_menutype_init(void);
|
||||
struct MenuType *WM_menutype_find(const char *idname, int quiet);
|
||||
int WM_menutype_add(struct MenuType* mt);
|
||||
int WM_menutype_contains(struct MenuType* mt);
|
||||
|
@ -423,8 +423,6 @@ typedef struct wmTimer {
|
||||
|
||||
|
||||
typedef struct wmOperatorType {
|
||||
struct wmOperatorType *next, *prev;
|
||||
|
||||
const char *name; /* text for ui, undo */
|
||||
const char *idname; /* unique identifier */
|
||||
const char *description; /* tooltips and python docs */
|
||||
|
@ -40,7 +40,11 @@
|
||||
|
||||
#include "GHOST_C-api.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "BKE_blender.h"
|
||||
#include "BKE_context.h"
|
||||
@ -59,8 +63,6 @@
|
||||
#include "wm_draw.h"
|
||||
#include "wm.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
@ -151,14 +153,14 @@ void WM_operator_stack_clear(wmWindowManager *wm)
|
||||
|
||||
/* ****************************************** */
|
||||
|
||||
static ListBase menutypes = {NULL, NULL}; /* global menutype list */
|
||||
static GHash *menutypes_hash= NULL;
|
||||
|
||||
MenuType *WM_menutype_find(const char *idname, int quiet)
|
||||
{
|
||||
MenuType* mt;
|
||||
|
||||
if (idname[0]) {
|
||||
mt= BLI_findstring(&menutypes, idname, offsetof(MenuType, idname));
|
||||
mt= BLI_ghash_lookup(menutypes_hash, idname);
|
||||
if(mt)
|
||||
return mt;
|
||||
}
|
||||
@ -171,35 +173,55 @@ MenuType *WM_menutype_find(const char *idname, int quiet)
|
||||
|
||||
int WM_menutype_add(MenuType* mt)
|
||||
{
|
||||
BLI_addtail(&menutypes, mt);
|
||||
BLI_ghash_insert(menutypes_hash, (void *)mt->idname, mt);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* inefficient but only used for tooltip code */
|
||||
int WM_menutype_contains(MenuType* mt)
|
||||
{
|
||||
return (mt != NULL && BLI_findindex(&menutypes, mt) != -1);
|
||||
int found= FALSE;
|
||||
|
||||
if(mt) {
|
||||
GHashIterator *iter= BLI_ghashIterator_new(menutypes_hash);
|
||||
|
||||
for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||
if(mt == BLI_ghashIterator_getValue(iter)) {
|
||||
found= TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
BLI_ghashIterator_free(iter);
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
void WM_menutype_freelink(MenuType* mt)
|
||||
{
|
||||
BLI_freelinkN(&menutypes, mt);
|
||||
BLI_ghash_remove(menutypes_hash, mt->idname, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
}
|
||||
|
||||
/* called on initialize WM_init() */
|
||||
void WM_menutype_init(void)
|
||||
{
|
||||
menutypes_hash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "menutypes_hash gh");
|
||||
}
|
||||
|
||||
void WM_menutype_free(void)
|
||||
{
|
||||
MenuType* mt= menutypes.first, *mt_next;
|
||||
GHashIterator *iter= BLI_ghashIterator_new(menutypes_hash);
|
||||
|
||||
while(mt) {
|
||||
mt_next= mt->next;
|
||||
|
||||
if(mt->ext.free)
|
||||
for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||
MenuType *mt= BLI_ghashIterator_getValue(iter);
|
||||
if(mt->ext.free) {
|
||||
mt->ext.free(mt->ext.data);
|
||||
|
||||
WM_menutype_freelink(mt);
|
||||
|
||||
mt= mt_next;
|
||||
}
|
||||
}
|
||||
BLI_ghashIterator_free(iter);
|
||||
|
||||
BLI_ghash_free(menutypes_hash, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
menutypes_hash= NULL;
|
||||
}
|
||||
|
||||
/* ****************************************** */
|
||||
|
@ -127,6 +127,7 @@ void WM_init(bContext *C, int argc, const char **argv)
|
||||
}
|
||||
GHOST_CreateSystemPaths();
|
||||
wm_operatortype_init();
|
||||
WM_menutype_init();
|
||||
|
||||
set_free_windowmanager_cb(wm_close_and_free); /* library.c */
|
||||
set_blender_test_break_cb(wm_window_testbreak); /* blender.c */
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
|
||||
@ -100,7 +101,7 @@
|
||||
#include "wm_subwindow.h"
|
||||
#include "wm_window.h"
|
||||
|
||||
static ListBase global_ops= {NULL, NULL};
|
||||
static GHash *global_ops_hash= NULL;
|
||||
|
||||
/* ************ operator API, exported ********** */
|
||||
|
||||
@ -113,7 +114,7 @@ wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
|
||||
WM_operator_bl_idname(idname_bl, idname);
|
||||
|
||||
if (idname_bl[0]) {
|
||||
ot= (wmOperatorType *)BLI_findstring_ptr(&global_ops, idname_bl, offsetof(wmOperatorType, idname));
|
||||
ot= BLI_ghash_lookup(global_ops_hash, idname_bl);
|
||||
if(ot) {
|
||||
return ot;
|
||||
}
|
||||
@ -125,9 +126,10 @@ wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wmOperatorType *WM_operatortype_first(void)
|
||||
/* caller must free */
|
||||
GHashIterator *WM_operatortype_iter(void)
|
||||
{
|
||||
return global_ops.first;
|
||||
return BLI_ghashIterator_new(global_ops_hash);
|
||||
}
|
||||
|
||||
/* all ops in 1 list (for time being... needs evaluation later) */
|
||||
@ -147,7 +149,8 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
|
||||
|
||||
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:"(undocumented operator)"); // XXX All ops should have a description but for now allow them not to.
|
||||
RNA_def_struct_identifier(ot->srna, ot->idname);
|
||||
BLI_addtail(&global_ops, ot);
|
||||
|
||||
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
|
||||
}
|
||||
|
||||
void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *userdata)
|
||||
@ -159,7 +162,8 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *us
|
||||
opfunc(ot, userdata);
|
||||
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:"(undocumented operator)");
|
||||
RNA_def_struct_identifier(ot->srna, ot->idname);
|
||||
BLI_addtail(&global_ops, ot);
|
||||
|
||||
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
|
||||
}
|
||||
|
||||
/* ********************* macro operator ******************** */
|
||||
@ -351,7 +355,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
|
||||
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); // XXX All ops should have a description but for now allow them not to.
|
||||
RNA_def_struct_identifier(ot->srna, ot->idname);
|
||||
|
||||
BLI_addtail(&global_ops, ot);
|
||||
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
|
||||
|
||||
return ot;
|
||||
}
|
||||
@ -378,7 +382,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), vo
|
||||
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
|
||||
RNA_def_struct_identifier(ot->srna, ot->idname);
|
||||
|
||||
BLI_addtail(&global_ops, ot);
|
||||
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
|
||||
}
|
||||
|
||||
wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
|
||||
@ -426,14 +430,14 @@ int WM_operatortype_remove(const char *idname)
|
||||
if (ot==NULL)
|
||||
return 0;
|
||||
|
||||
BLI_remlink(&global_ops, ot);
|
||||
RNA_struct_free(&BLENDER_RNA, ot->srna);
|
||||
|
||||
if(ot->macro.first)
|
||||
wm_operatortype_free_macro(ot);
|
||||
|
||||
MEM_freeN(ot);
|
||||
BLI_ghash_remove(global_ops_hash, (void *)ot->idname, NULL, NULL);
|
||||
|
||||
MEM_freeN(ot);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1311,9 +1315,10 @@ static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2)
|
||||
|
||||
static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_first();
|
||||
GHashIterator *iter= WM_operatortype_iter();
|
||||
|
||||
for(; ot; ot= ot->next) {
|
||||
for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
|
||||
|
||||
if((ot->flag & OPTYPE_INTERNAL) && (G.f & G_DEBUG) == 0)
|
||||
continue;
|
||||
@ -1337,6 +1342,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_ghashIterator_free(iter);
|
||||
}
|
||||
|
||||
static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op))
|
||||
@ -3457,26 +3463,31 @@ static void WM_OT_ndof_sensitivity_change(wmOperatorType *ot)
|
||||
RNA_def_boolean(ot->srna, "fast", 0, "Fast NDOF sensitivity change", "If true then sensitivity changes 50%, otherwise 10%");
|
||||
}
|
||||
|
||||
|
||||
static void operatortype_ghash_free_cb(wmOperatorType *ot)
|
||||
{
|
||||
if(ot->macro.first)
|
||||
wm_operatortype_free_macro(ot);
|
||||
|
||||
if(ot->ext.srna) /* python operator, allocs own string */
|
||||
MEM_freeN((void *)ot->idname);
|
||||
|
||||
MEM_freeN(ot);
|
||||
}
|
||||
|
||||
/* ******************************************************* */
|
||||
/* called on initialize WM_exit() */
|
||||
void wm_operatortype_free(void)
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
|
||||
for(ot= global_ops.first; ot; ot= ot->next) {
|
||||
if(ot->macro.first)
|
||||
wm_operatortype_free_macro(ot);
|
||||
|
||||
if(ot->ext.srna) /* python operator, allocs own string */
|
||||
MEM_freeN((void *)ot->idname);
|
||||
}
|
||||
|
||||
BLI_freelistN(&global_ops);
|
||||
BLI_ghash_free(global_ops_hash, NULL, (GHashValFreeFP)operatortype_ghash_free_cb);
|
||||
global_ops_hash= NULL;
|
||||
}
|
||||
|
||||
/* called on initialize WM_init() */
|
||||
void wm_operatortype_init(void)
|
||||
{
|
||||
global_ops_hash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wm_operatortype_init gh");
|
||||
|
||||
WM_operatortype_append(WM_OT_window_duplicate);
|
||||
WM_operatortype_append(WM_OT_read_homefile);
|
||||
WM_operatortype_append(WM_OT_read_factory_settings);
|
||||
|
@ -384,7 +384,7 @@ void RE_engine_report(struct RenderEngine *engine, int type, const char *msg) {}
|
||||
|
||||
/* python */
|
||||
struct wmOperatorType *WM_operatortype_find(const char *idname, int quiet){return (struct wmOperatorType *) NULL;}
|
||||
struct wmOperatorType *WM_operatortype_first(){return (struct wmOperatorType *) NULL;}
|
||||
struct GHashIterator *WM_operatortype_iter(){return (struct GHashIterator *) NULL;}
|
||||
struct wmOperatorType *WM_operatortype_exists(const char *idname){return (struct wmOperatorType *) NULL;}
|
||||
struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *ot, const char *idname){return (struct wmOperatorTypeMacro *) NULL;}
|
||||
int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int context, struct PointerRNA *properties, struct ReportList *reports){return 0;}
|
||||
|
Loading…
Reference in New Issue
Block a user