Ejemplo n.º 1
0
void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb, 
                                  void (*operation_cb)(bContext *C, Scene *scene, TreeElement *,
                                                       TreeStoreElem *, TreeStoreElem *))
{
	TreeElement *te;
	TreeStoreElem *tselem;
	
	for (te = lb->first; te; te = te->next) {
		tselem = TREESTORE(te);
		if (tselem->flag & TSE_SELECTED) {
			if (tselem->type == 0 && te->idcode == ID_OB) {
				// when objects selected in other scenes... dunno if that should be allowed
				Scene *scene_owner = (Scene *)outliner_search_back(soops, te, ID_SCE);
				if (scene_owner && scene_act != scene_owner) {
					ED_screen_set_scene(C, CTX_wm_screen(C), scene_owner);
				}
				/* important to use 'scene_owner' not scene_act else deleting objects can crash.
				 * only use 'scene_act' when 'scene_owner' is NULL, which can happen when the
				 * outliner isn't showing scenes: Visible Layer draw mode for eg. */
				operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem);
			}
		}
		if (TSELEM_OPEN(tselem, soops)) {
			outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb);
		}
	}
}
Ejemplo n.º 2
0
static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb, 
										 void (*operation_cb)(int, TreeElement *, TreeStoreElem *))
{
	TreeElement *te;
	TreeStoreElem *tselem;
	
	for (te=lb->first; te; te= te->next) {
		tselem= TREESTORE(te);
		if (tselem->flag & TSE_SELECTED) {
			if (tselem->type==type) {
				operation_cb(event, te, tselem);
			}
		}
		if (TSELEM_OPEN(tselem,soops)) {
			outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb);
		}
	}
}
Ejemplo n.º 3
0
static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *lb, ID *newid,
                                         void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *, ID *))
{
	TreeElement *te;
	TreeStoreElem *tselem;
	
	for (te = lb->first; te; te = te->next) {
		tselem = TREESTORE(te);
		if (tselem->flag & TSE_SELECTED) {
			if (tselem->type == type) {
				TreeStoreElem *tsep = te->parent ? TREESTORE(te->parent) : NULL;
				operation_cb(te, tselem, tsep, newid);
			}
		}
		if (TSELEM_OPEN(tselem, soops)) {
			outliner_do_id_set_operation(soops, type, &te->subtree, newid, operation_cb);
		}
	}
}
Ejemplo n.º 4
0
static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, 
										 void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
{
	TreeElement *te;
	TreeStoreElem *tselem;
	
	for (te=lb->first; te; te= te->next) {
		tselem= TREESTORE(te);
		if (tselem->flag & TSE_SELECTED) {
			if (tselem->type==0) {
				TreeStoreElem *tsep= TREESTORE(te->parent);
				operation_cb(C, scene, te, tsep, tselem);
			}
		}
		if (TSELEM_OPEN(tselem,soops)) {
			outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb);
		}
	}
}