[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13484] trunk/blender/source/blender: Small outliner enhancement: With items selected in the outliner, pressing the V, S or R key will toggle, respectively, the Visibility, Selectability or Render
Chris Burt
desoto at exenex.com
Wed Jan 30 20:20:34 CET 2008
"Small outliner enhancement..."
Oh no.. this is no small enhancement. This is something I've been
begging for. Can't this be extended to allow for CTRL + V, CTRL + S,
and CTRL + R to control Visibility Selectability and Renderability
with things selected in the scene?
Thank you! Saves me hours already!
--Chris
On Jan 30, 2008 12:58 PM, Roland Hess <me at harkyman.com> wrote:
> Revision: 13484
> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13484
> Author: harkyman
> Date: 2008-01-30 18:58:13 +0100 (Wed, 30 Jan 2008)
>
> Log Message:
> -----------
> 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.
>
> Modified Paths:
> --------------
> trunk/blender/source/blender/include/BIF_outliner.h
> trunk/blender/source/blender/src/outliner.c
> trunk/blender/source/blender/src/space.c
>
> Modified: trunk/blender/source/blender/include/BIF_outliner.h
> ===================================================================
> --- trunk/blender/source/blender/include/BIF_outliner.h 2008-01-30 16:25:50 UTC (rev 13483)
> +++ trunk/blender/source/blender/include/BIF_outliner.h 2008-01-30 17:58:13 UTC (rev 13484)
> @@ -97,6 +97,9 @@
> extern void outliner_one_level(struct ScrArea *sa, int add);
> extern void outliner_select(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_operation_menu(struct ScrArea *sa);
> extern void outliner_page_up_down(struct ScrArea *sa, int up);
>
> Modified: trunk/blender/source/blender/src/outliner.c
> ===================================================================
> --- trunk/blender/source/blender/src/outliner.c 2008-01-30 16:25:50 UTC (rev 13483)
> +++ trunk/blender/source/blender/src/outliner.c 2008-01-30 17:58:13 UTC (rev 13484)
> @@ -138,6 +138,8 @@
>
> /* ******************** PROTOTYPES ***************** */
> 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 ***************** */
> @@ -1152,6 +1154,75 @@
> }
> }
>
> +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)
> {
> SpaceOops *soops= sa->spacedata.first;
> @@ -2712,7 +2783,7 @@
> //else pupmenu("Scene Operations%t|Delete");
> }
> 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) {
> char *str="";
>
> @@ -2736,7 +2807,18 @@
> outliner_do_object_operation(soops, &soops->tree, id_local_cb);
> 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();
>
> BIF_undo_push(str);
>
> Modified: trunk/blender/source/blender/src/space.c
> ===================================================================
> --- trunk/blender/source/blender/src/space.c 2008-01-30 16:25:50 UTC (rev 13483)
> +++ trunk/blender/source/blender/src/space.c 2008-01-30 17:58:13 UTC (rev 13484)
> @@ -5490,6 +5490,15 @@
> outliner_find_panel(sa, again, search_flags);
> }
> 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 DELKEY:
> outliner_del(sa);
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
More information about the Bf-committers
mailing list