ScriptSpot home

Script

open/close all/selected groups

By le1setreter · 2013-04-02

Community compatibilityNo compatibility reports yet

No reports yet for the available releases.

Community reviewsNo reviews yet.
Version
v 0.2
3ds Max compatibility
Unknown
How compatibility works

Choose the 3ds Max version you use. For example, selecting 2020 puts direct matches for 2020 first, followed by listings that say a supported version or newer.

Scripts that only mention an older version can still appear as “2020 unconfirmed.” Listings that rule out 2020 are excluded. Use “Show scripts with unconfirmed compatibility” to also see listings without a clear match.

Community reports show what worked for members on a specific release. They’re separate from the listing’s compatibility claims and don’t change the filter.

Original version requirement
works in max design 2011 + 2013 64 bit.
Date updated
2013-04-04
Legacy votes
1

Downloads

Tags: open, close, all groups, selected groups, visible groups

Description

open-close-group

This macro-script is meant to use as a shortcut. It can open or close all or all selected groups in the scene.
I use "STRG + SHIFT + G" to open all groups and "STRG + G" to close all groups but you can change it to whatever you prefer.

 

Additional Info

Usage:
1) Run the .mcr file
2) Go to "Customize" -> "Customize User Interface" -> "Keyboard" -> "Category" -> "Custom"
3) define your desired shortcuts

You can also make some button if you like.

The credits belong to "Swordslayer" as i used his code for this macro: http://www.scriptspot.com/forums/3ds-max/general-scripting/open-all-groups-and-sub-groups

When i saw the thread i realised  that this macro could be very helpful. At least for my daily work. So i always have all groups closed and just open all groups for editing an object. As soon i am done i close all groups again. A good timesaver.

 

Update version 0.2:

- added two actions "open visible groups" + "close visible groups"
- added messagebox with info with category name of actions

 

More by le1setreter

View all contributions
Comments (15)

Comment policy

fajar

why not making open group a

why not assign "open group" a keyboard shortcut let say :

---> costumize -->keyboard --> category [Groups] Group Open --> Assign keyboard to Group Open ex : Ctrl+Shift+R

let select closed group [ multiple selection is OK ] and then press Ctrl+Shift+R...closed group should be opened.....you know what you do next....I guess

Reply to fajar
le1setreter

hi fajar,

thank you for your feedback but honestly i do not really understand your question. do you mind try to explain it again?

TIA

Raymond Homme Ingebretsen

I guess this works (I Dont have max here right now, so i have not tested)

for o in group_arr where not o.isHidden do

Integrated in Open All Groups:


macroScript OPEN_ALL_GROUPS Category:"Custom" toolTip:"open all groups" (
	fn openGroupsAll objs toggle= (
		group_arr = for o in objs where isValidNode o AND isGroupHead o collect o
	 
		with redraw off (
			for o in group_arr where not o.isHidden do (
				setGroupOpen o toggle
				-- ungroup o
			) -- end for
		)-- end redraw
	) -- end fn

	openGroupsAll objects true
)
Reply to Jay
le1setreter

"Right now, it opens the groups of objects that are on hidden layer."

i think it is a question of personal workflow if
a) all groups
b) selected groups
c) all but not hidden groups
should be implemented.

For me i only use open and close ALL groups. As soon i am done editing my desired object i just close all groups.

But i will extend the version with the requested feature open/close all and selected but not hidden groups.

Will post updated version as soon as possible.

Thx sir!

It's definitely a question of workflow, but I think that if it's made so that whats hidden isn't affected is just more clean and powerful and thus can adapt to any workflow.

More logical also no? But yeah why code something you don't use, I understand. :)

But it's just that small little detail thats missing making this script complete I think. :)

Anyway! Thx for considering updating it man, appreciate and thx for your work!

Reply to Jay
le1setreter

many thanks for your feedback :)
i just uploaded the new version (v 0.2)

Reply to le1setreter
Raymond Homme Ingebretsen

Hi le1setreter,

You snippets are great :)

Here is my approach to do Open and close groups (based on your first code):


-----------------------------------------------------------------
-- Open/Close All Groups (Not hidden Groups)
-----------------------------------------------------------------
try (destroyDialog ::rol_OpenCloseGroups) catch()
 
rollout rol_OpenCloseGroups "Open/Close Groups"
(
    checkbutton ckb_OpenClose "OPEN GROUP" height:35 width:140 highlightColor:[0,80,255] tooltip:"OPEN / CLOSE GROUPS"
     
     
    fn openGroupsAll objs toggle=
    (
        group_arr = for o in objs where isValidNode o AND isGroupHead o collect o
  
        with redraw off
        (
            for o in group_arr where not o.isHidden do
            (
                setGroupOpen o toggle
            ) 
        )
    )
 
    on ckb_OpenClose changed state do
    (
        if not state then 
        (
            openGroupsAll objects false
            ckb_OpenClose.text = "OPEN GROUP"
        )
        else
        (
            openGroupsAll objects true
            ckb_OpenClose.text = "CLOSE GROUP"
        )
    )
)
         
createDialog rol_OpenCloseGroups width:150 height:45
Reply to Raymond Homme Ingebretsen
Branko Živković

;) or even shorter tassel


try (destroyDialog ::rol_OpenCloseGroups) catch()
rollout rol_OpenCloseGroups "Open/Close Groups"
(
fn groupFIlter grp = isGroupHead grp and not grp.isHidden
mapped fn openGroups arr toggle: = if groupFIlter arr do setGroupOpen arr toggle
checkbutton ckb_OpenClose "OPEN GROUP" height:35 width:140 highlightColor:[0,80,255] tooltip:"OPEN / CLOSE GROUPS"
on ckb_OpenClose changed state do
(
openGroups (helpers as array) toggle:state
ckb_OpenClose.text = (if state then "CLOSE" else "OPEN") + " GROUP"
)
)
createdialog rol_OpenCloseGroups

thx

Hi le1setreter,

thx for having considered the comments and do the update so fast!

Good work!

Jay

question modifs

Hi,

first of all great job this script is really handy for us here.

One thing though, would it be possible to make it so that it don't open the groups that are hidden?

Right now, it opens the groups of objects that are on hidden layer.

Let me know!

Thx!

Branko Živković

+1

Cool idea. Recently I've been thinking about *Group Manager* tool similar to Layer Manager. Maybe someone can write this soon.
Anyway, keep up the good work.
Cheers!