View Issue Details

IDProjectCategoryView StatusLast Update
0003690DarkRadiantSelection Systempublic20.04.2016 15:53
Reporteruser81Assigned ToSteveL  
PrioritynormalSeveritynormalReproducibilityalways
Status closedResolutionfixed 
PlatformWin32OSWindowsOS Version7 sp1
Product Version1.8.1 
Summary0003690: Select all models of same type: not working anymore.
Descriptionwhen you do the above selection, other models of the same type arent being selected anymore.
Steps To ReproduceClick on scripts, then "Select all Models of same type"
TagsNo tags attached.
Attached Files
select_all_models_of_type.py (1,467 bytes)   
# Set the command name so that DarkRadiant recognises this file
__commandName__ = 'SelectAllModelsOfType'
__commandDisplayName__ = 'Select all Models of same type'

# The actual algorithm called by DarkRadiant is contained in the execute() function
def execute():
	# Collect all currently selected models
	selectedModelNames = {}

	class Walker(SelectionVisitor) :
		def visit(self, node):
			# Try to "cast" the node to an entity
			entity = node.getEntity()

			if not entity.isNull():
				if not entity.getKeyValue('model') == '':
					selectedModelNames[entity.getKeyValue('model')] = 1

	visitor = Walker()
	GlobalSelectionSystem.foreachSelected(visitor)

	print('Unique models currently selected: ' + str(len(selectedModelNames)))

	# Now traverse the scenegraph, selecting all of the same names
	class SceneWalker(SceneNodeVisitor) :
		def pre(self, node):

			# Try to "cast" the node to an entity
			entity = node.getEntity()

			if not entity.isNull():
				modelName = entity.getKeyValue('model')

				if not modelName == '' and modelName in selectedModelNames:
					# match, select this node
					node.setSelected(1);

				return 0 # don't traverse this entity's children
			return 1 # not an entity, so traverse children

	walker = SceneWalker()
	GlobalSceneGraph.root().traverse(walker)

# __executeCommand__ evaluates to true after DarkRadiant has successfully initialised
if __executeCommand__:
	execute()
select_all_models_of_type.py (1,467 bytes)   

Activities

user81

21.03.2014 10:11

  ~0006451

Double checking this issue was not in 1.8.0 compared to 1.8.1 where it is.
SteveL

SteveL

21.03.2014 20:05

reporter   ~0006452

Reproduced in 1.8.1 pre-release. In 1.8.0 with the same test map the script works. Python script is unchanged.

user81

21.03.2014 22:45

  ~0006453

Confirmed, it works in 1.8.0 not not in 1.8.1
SteveL

SteveL

28.03.2014 10:11

reporter   ~0006477

Last edited: 28.03.2014 20:26

This python script has always had a bug in it, but the functionality didn't break till January when work was done on separating the jobs of Node::traverse() and Node::traverseChildren(). The script always returns 0 in its second visitor class, so doesn't search a level down. That worked for selecting FS models when it started by traversing children of world, but not now that it starts with world itself.

SteveL

SteveL

28.03.2014 20:29

reporter   ~0006480

Modified script posted to the beta forum thread for testing.
SteveL

SteveL

23.04.2014 18:50

reporter   ~0006550

Submitted pull request to DR repo:
https://github.com/orbweaver/DarkRadiant/pull/11

user81

27.07.2014 18:20

  ~0006810

Its happening again in the latest released version of 1.8.1

user81

07.07.2015 09:51

  ~0007626

I believe this has been fixed in 203.

Issue History

Date Modified Username Field Change
10.03.2014 12:41 user81 New Issue
21.03.2014 10:11 user81 Note Added: 0006451
21.03.2014 19:57 SteveL Assigned To => SteveL
21.03.2014 19:57 SteveL Status new => assigned
21.03.2014 20:05 SteveL Note Added: 0006452
21.03.2014 20:05 SteveL Status assigned => confirmed
21.03.2014 22:45 user81 Note Added: 0006453
28.03.2014 10:11 SteveL Note Added: 0006477
28.03.2014 10:12 SteveL Note Edited: 0006477
28.03.2014 20:26 SteveL Note Edited: 0006477
28.03.2014 20:29 SteveL File Added: select_all_models_of_type.py
28.03.2014 20:29 SteveL Note Added: 0006480
23.04.2014 18:50 SteveL Note Added: 0006550
23.04.2014 18:50 SteveL Status confirmed => resolved
23.04.2014 18:50 SteveL Fixed in Version => 1.8.1
23.04.2014 18:50 SteveL Resolution open => fixed
23.04.2014 18:50 SteveL Product Version 1.8.0 => 1.8.1
27.07.2014 18:20 user81 Note Added: 0006810
27.07.2014 18:20 user81 Status resolved => assigned
27.07.2014 18:20 user81 Resolution fixed => reopened
07.07.2015 09:51 user81 Note Added: 0007626
07.07.2015 10:15 greebo Status assigned => resolved
07.07.2015 10:15 greebo Fixed in Version 1.8.1 =>
07.07.2015 10:15 greebo Resolution reopened => fixed
20.04.2016 15:53 greebo Status resolved => closed