MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / populateEntityListStore

Method populateEntityListStore

plugins/dm.stimresponse/EffectEditor.cpp:246–285  ·  view source on GitHub ↗

Traverse the scenegraph to populate the tree model

Source from the content-addressed store, hash-verified

244
245// Traverse the scenegraph to populate the tree model
246void EffectEditor::populateEntityListStore()
247{
248 _entityChoices.Clear();
249
250 std::string selfEntity = game::current::getValue<std::string>(GKEY_ENTITY_SELF);
251
252 // Append the name to the list store
253 _entityChoices.Add(selfEntity);
254
255 // Create a scenegraph walker to traverse the graph
256 class EntityFinder :
257 public scene::NodeVisitor
258 {
259 // List to add names to
260 wxArrayString& _list;
261 public:
262 // Constructor
263 EntityFinder(wxArrayString& list) :
264 _list(list)
265 {}
266
267 // Visit function
268 bool pre(const scene::INodePtr& node)
269 {
270 Entity* entity = Node_getEntity(node);
271
272 if (entity != NULL)
273 {
274 // Get the entity name and append it to the list store
275 _list.Add(entity->getKeyValue("name"));
276
277 return false; // don't traverse children if entity found
278 }
279
280 return true; // traverse children otherwise
281 }
282 } finder(_entityChoices);
283
284 GlobalSceneGraph().root()->traverse(finder);
285}
286
287void EffectEditor::revert()
288{

Callers

nothing calls this directly

Calls 4

AddMethod · 0.80
ClearMethod · 0.45
traverseMethod · 0.45
rootMethod · 0.45

Tested by

no test coverage detected