How can I check if a group having a particular name is present in the scene or not??
Forum topic · General Scripting
Check for a group
By Goonda · 2012-09-05
Description
Comments (4)
miauu · 2012-09-06
Ok, but you asked about single group not groups.
The optimized code:
local objGroup = for o in helpers where ( (o.name == "Group01") and (isGroupHead o) ) collect o
if objGroup.count != 0 then...
Goonda · 2012-09-07
ok....Thanks!! :)
Goonda · 2012-09-06
Thanks miauu!!! But this is working fine only if there is one group of that name. If there are multiple groups of the same name...it is not working. Instead I have tried this:
objgroup = #()
for o in helpers do
(
if o.name == "Group01" then
(
append objgroup o
)
)
(
if objgroup.count != 0 then.....
( groupName =
miauu · 2012-09-05
(
groupName = "Group01"
-- use this
grp = getNodeByName groupName
-- or
-- grp = execute ("$"+groupName)
if isValidNode grp and isGroupHead grp then
print "Exst in the scene"
else
print "Do not exist in the scene"
)