forked from bartvdbraak/blender
Small outliner enhancement: With items selected in the outliner, pressing the V, S or R key will toggle, respectively, the Visibility, Selectability or Renderability locks. Note that this functions independently of what is selected in the SCENE -- this is based on the RMB selection in the outliner. The options are also available from the RMB popup menu.
There are enough items in that popup now that this space should probably have its own header with a menu.
This commit is contained in:
parent
746522a0ad
commit
a12602e51f
@ -97,6 +97,9 @@ extern void outliner_show_hierarchy(struct ScrArea *sa);
|
|||||||
extern void outliner_one_level(struct ScrArea *sa, int add);
|
extern void outliner_one_level(struct ScrArea *sa, int add);
|
||||||
extern void outliner_select(struct ScrArea *sa);
|
extern void outliner_select(struct ScrArea *sa);
|
||||||
extern void outliner_toggle_selected(struct ScrArea *sa);
|
extern void outliner_toggle_selected(struct ScrArea *sa);
|
||||||
|
extern void outliner_toggle_visibility(struct ScrArea *sa);
|
||||||
|
extern void outliner_toggle_selectability(struct ScrArea *sa);
|
||||||
|
extern void outliner_toggle_renderability(struct ScrArea *sa);
|
||||||
extern void outliner_del(struct ScrArea *sa);
|
extern void outliner_del(struct ScrArea *sa);
|
||||||
extern void outliner_operation_menu(struct ScrArea *sa);
|
extern void outliner_operation_menu(struct ScrArea *sa);
|
||||||
extern void outliner_page_up_down(struct ScrArea *sa, int up);
|
extern void outliner_page_up_down(struct ScrArea *sa, int up);
|
||||||
|
@ -138,6 +138,8 @@ extern ListBase server_list;
|
|||||||
|
|
||||||
/* ******************** PROTOTYPES ***************** */
|
/* ******************** PROTOTYPES ***************** */
|
||||||
static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int startx, int *starty);
|
static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int startx, int *starty);
|
||||||
|
static void outliner_do_object_operation(SpaceOops *soops, ListBase *lb,
|
||||||
|
void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *));
|
||||||
|
|
||||||
|
|
||||||
/* ******************** PERSISTANT DATA ***************** */
|
/* ******************** PERSISTANT DATA ***************** */
|
||||||
@ -1152,6 +1154,75 @@ static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void object_toggle_visibility_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
|
||||||
|
{
|
||||||
|
Base *base= (Base *)te->directdata;
|
||||||
|
|
||||||
|
if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
|
||||||
|
if(base) {
|
||||||
|
base->object->restrictflag^=OB_RESTRICT_VIEW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void outliner_toggle_visibility(struct ScrArea *sa)
|
||||||
|
{
|
||||||
|
SpaceOops *soops= sa->spacedata.first;
|
||||||
|
|
||||||
|
outliner_do_object_operation(soops, &soops->tree, object_toggle_visibility_cb);
|
||||||
|
|
||||||
|
BIF_undo_push("Outliner toggle selectability");
|
||||||
|
|
||||||
|
allqueue(REDRAWVIEW3D, 1);
|
||||||
|
allqueue(REDRAWOOPS, 0);
|
||||||
|
allqueue(REDRAWINFO, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void object_toggle_selectability_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
|
||||||
|
{
|
||||||
|
Base *base= (Base *)te->directdata;
|
||||||
|
|
||||||
|
if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
|
||||||
|
if(base) {
|
||||||
|
base->object->restrictflag^=OB_RESTRICT_SELECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void outliner_toggle_selectability(struct ScrArea *sa)
|
||||||
|
{
|
||||||
|
SpaceOops *soops= sa->spacedata.first;
|
||||||
|
|
||||||
|
outliner_do_object_operation(soops, &soops->tree, object_toggle_selectability_cb);
|
||||||
|
|
||||||
|
BIF_undo_push("Outliner toggle selectability");
|
||||||
|
|
||||||
|
allqueue(REDRAWVIEW3D, 1);
|
||||||
|
allqueue(REDRAWOOPS, 0);
|
||||||
|
allqueue(REDRAWINFO, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void object_toggle_renderability_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
|
||||||
|
{
|
||||||
|
Base *base= (Base *)te->directdata;
|
||||||
|
|
||||||
|
if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
|
||||||
|
if(base) {
|
||||||
|
base->object->restrictflag^=OB_RESTRICT_RENDER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void outliner_toggle_renderability(struct ScrArea *sa)
|
||||||
|
{
|
||||||
|
SpaceOops *soops= sa->spacedata.first;
|
||||||
|
|
||||||
|
outliner_do_object_operation(soops, &soops->tree, object_toggle_renderability_cb);
|
||||||
|
|
||||||
|
BIF_undo_push("Outliner toggle renderability");
|
||||||
|
|
||||||
|
allqueue(REDRAWVIEW3D, 1);
|
||||||
|
allqueue(REDRAWOOPS, 0);
|
||||||
|
allqueue(REDRAWINFO, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void outliner_toggle_visible(struct ScrArea *sa)
|
void outliner_toggle_visible(struct ScrArea *sa)
|
||||||
{
|
{
|
||||||
SpaceOops *soops= sa->spacedata.first;
|
SpaceOops *soops= sa->spacedata.first;
|
||||||
@ -2712,7 +2783,7 @@ void outliner_operation_menu(ScrArea *sa)
|
|||||||
//else pupmenu("Scene Operations%t|Delete");
|
//else pupmenu("Scene Operations%t|Delete");
|
||||||
}
|
}
|
||||||
else if(objectlevel) {
|
else if(objectlevel) {
|
||||||
short event= pupmenu("Select%x1|Deselect%x2|Delete%x4"); /* make local: does not work... it doesn't set lib_extern flags... so data gets lost */
|
short event= pupmenu("Select%x1|Deselect%x2|Delete%x4|Toggle Visible%x6|Toggle Selectable%x7|Toggle Renderable%x8"); /* make local: does not work... it doesn't set lib_extern flags... so data gets lost */
|
||||||
if(event>0) {
|
if(event>0) {
|
||||||
char *str="";
|
char *str="";
|
||||||
|
|
||||||
@ -2736,7 +2807,18 @@ void outliner_operation_menu(ScrArea *sa)
|
|||||||
outliner_do_object_operation(soops, &soops->tree, id_local_cb);
|
outliner_do_object_operation(soops, &soops->tree, id_local_cb);
|
||||||
str= "Localized Objects";
|
str= "Localized Objects";
|
||||||
}
|
}
|
||||||
|
else if(event==6) {
|
||||||
|
outliner_do_object_operation(soops, &soops->tree, object_toggle_visibility_cb);
|
||||||
|
str= "Toggle Visibility";
|
||||||
|
}
|
||||||
|
else if(event==7) {
|
||||||
|
outliner_do_object_operation(soops, &soops->tree, object_toggle_selectability_cb);
|
||||||
|
str= "Toggle Selectability";
|
||||||
|
}
|
||||||
|
else if(event==8) {
|
||||||
|
outliner_do_object_operation(soops, &soops->tree, object_toggle_renderability_cb);
|
||||||
|
str= "Toggle Renderability";
|
||||||
|
}
|
||||||
countall();
|
countall();
|
||||||
|
|
||||||
BIF_undo_push(str);
|
BIF_undo_push(str);
|
||||||
|
@ -5490,6 +5490,15 @@ static void winqreadoopsspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
outliner_find_panel(sa, again, search_flags);
|
outliner_find_panel(sa, again, search_flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case RKEY:
|
||||||
|
outliner_toggle_renderability(sa);
|
||||||
|
break;
|
||||||
|
case SKEY:
|
||||||
|
outliner_toggle_selectability(sa);
|
||||||
|
break;
|
||||||
|
case VKEY:
|
||||||
|
outliner_toggle_visibility(sa);
|
||||||
|
break;
|
||||||
case XKEY:
|
case XKEY:
|
||||||
case DELKEY:
|
case DELKEY:
|
||||||
outliner_del(sa);
|
outliner_del(sa);
|
||||||
|
Loading…
Reference in New Issue
Block a user