Making Groups from Selected

Hi all.

/////////////////////

I'm searching for script that making group from selected "Dummy"(with all childrens),
and renaming group with the "Dummy" name.

Ideal, that if i selecting a lot of "Dummys" and when i run the script, It makes groups from all "Dummies" i selected (keeping above rules of-cause).

I'll be very appreciate if some one can help my with this kind of script.

/////////////////////

I'm working on big amount of small game assets, in is over 100 small buildings i have now, and a lot to make.
I Exporting using "Batch Export/Import" Script from Jos Balcaen, so i need all my assets being in separated groups each other, with right naming convention.
My hierarchy for each asset is like:

"Main Dummy object" > Meshes & Nulls

To make script working right, i need manually put all "Main Dummy object" in Group, then rename the group,with the same name dummy has, and i must do it manually for all assets from my scene.

AttachmentSize
2016-06-08_11h13_41.png10.68 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

i can't understand exactly what you want to do. But try this code:

(
	childsArr = #()
	function RecursiveAppend arr obj =
	(
		for c in obj.children do
		(
			append arr c
			RecursiveAppend arr c
		)
	)
	--	"get the dummy object"
	dummyObj = selection[1]
	--	"get all childrens of that dummy"
	RecursiveAppend childsArr dummyObj 
	--	"append the dummy to the childsArr"
	append childsArr dummyObj
	--	"gtoup all"
	group childsArr name:dummyObj.name
)

Select one Dummy. Run the code. It will select all childre objects of this dummy and will create a group(dummy+all childrens) with the name - the name of the dummy.

paukoff's picture

Thank you!

Yes, this is exactly what i'm searching for.

barigazy's picture

...

a small addition ;)

fn dummyGroups arr prefix:"" sufix:"" = if arr.count > 0 do
(
	for i in arr do group (execute ("$"+i.name+"/.../*")) name:(prefix+i.name+sufix)
)
dummyGroups selection

bga

paukoff's picture

YES!!!!

Thank you, so much!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.