Difference between revisions of "Sample Addons"

From Light Forge Wiki
Jump to: navigation, search
(Created page with "=Select Children= <highlightsyntax lang=python> def onExecute(): #get list of selected groups groupList = api.groups.getSelectedGroups() if groupList != None: for group ...")
 
(Select Children)
Line 1: Line 1:
 
=Select Children=
 
=Select Children=
<highlightsyntax lang=python>
+
<syntaxhighlight lang="python">
 
def onExecute():
 
def onExecute():
 
#get list of selected groups
 
#get list of selected groups
Line 24: Line 24:
 
 
 
api.groups.selectGroup(newPath)
 
api.groups.selectGroup(newPath)
</highlightsyntax>
+
</syntaxhighlight>

Revision as of 19:24, 9 May 2013

Select Children

def onExecute():
	#get list of selected groups
	groupList = api.groups.getSelectedGroups()
 
	if groupList != None:
		for group in groupList:
			selectChildren(group)
 
def selectChildren(groupPath):
	childCount = api.groups.getChildCount(groupPath)
 
	if childCount > 0:
		api.groups.deselectGroup(groupPath)
 
	for i in range(0, childCount):
		#build the group path for the next group
		newPath = groupPath
		if len(newPath) == 0:
			newPath = str(i)
		else:
			newPath = newPath + "," + str(i) 
 
		api.groups.selectGroup(newPath)
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox