MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / AddGroup

Method AddGroup

Source/Editor/Surface/ContextMenu/VisjectCM.cs:389–435  ·  view source on GitHub ↗

Adds the group archetype to add to the menu. The group. True if merge group items into any existing group of the same name.

(GroupArchetype groupArchetype, bool withGroupMerge = true)

Source from the content-addressed store, hash-verified

387 /// <param name="groupArchetype">The group.</param>
388 /// <param name="withGroupMerge">True if merge group items into any existing group of the same name.</param>
389 public void AddGroup(GroupArchetype groupArchetype, bool withGroupMerge = true)
390 {
391 // Check if can create group for them to be spawned via GUI
392 if (groupArchetype.Archetypes.Any(x => (x.Flags & NodeFlags.NoSpawnViaGUI) == 0))
393 {
394 Profiler.BeginEvent("VisjectCM.AddGroup");
395
396 var group = CreateGroup(groupArchetype, withGroupMerge);
397 group.Close(false);
398
399 foreach (var nodeArchetype in groupArchetype.Archetypes)
400 {
401 var item = new VisjectCMItem(group, groupArchetype, nodeArchetype)
402 {
403 Parent = group
404 };
405 }
406 group.SortChildren();
407 group.Parent = _groupsPanel;
408
409 _groups.Add(group);
410
411 if (!IsLayoutLocked)
412 {
413 group.UnlockChildrenRecursive();
414 // TODO: Improve filtering to be based on boxes with the most common things instead of first box
415 if (_contextSensitiveSearchEnabled && _selectedBoxes.Count > 0 && _selectedBoxes[0] != null)
416 UpdateFilters();
417 else
418 SortGroups();
419 if (ShowExpanded)
420 group.Open(false);
421 group.PerformLayout();
422 if (_searchBox.TextLength != 0)
423 {
424 OnSearchFilterChanged();
425 }
426 }
427 else if (_contextSensitiveSearchEnabled && _selectedBoxes.Count > 0)
428 {
429 // TODO: Filtering could be improved here as well
430 group.EvaluateVisibilityWithBox(_selectedBoxes[0]);
431 }
432
433 Profiler.EndEvent();
434 }
435 }
436
437 /// <summary>
438 /// Adds the group archetypes to add to the menu.

Callers 3

OnShowPrimaryMenuMethod · 0.80
GetMethod · 0.80
OnContextChangedMethod · 0.80

Calls 10

AnyMethod · 0.80
SortChildrenMethod · 0.80
BeginEventMethod · 0.45
CloseMethod · 0.45
AddMethod · 0.45
OpenMethod · 0.45
PerformLayoutMethod · 0.45
EndEventMethod · 0.45

Tested by

no test coverage detected