説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

BlackboardViewModel.cs 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using UnityEngine;
  5. using UnityEngine.UIElements;
  6. using UnityEditor;
  7. using UnityEditor.Experimental.GraphView;
  8. namespace UnityEditor.ShaderGraph.Drawing
  9. {
  10. class BlackboardViewModel : ISGViewModel
  11. {
  12. public GraphData model { get; set; }
  13. public VisualElement parentView { get; set; }
  14. public string title { get; set; }
  15. public string subtitle { get; set; }
  16. public Dictionary<string, IGraphDataAction> propertyNameToAddActionMap { get; set; }
  17. public Dictionary<string, IGraphDataAction> defaultKeywordNameToAddActionMap { get; set; }
  18. public Dictionary<string, IGraphDataAction> builtInKeywordNameToAddActionMap { get; set; }
  19. public Tuple<string, IGraphDataAction> defaultDropdownNameToAdd { get; set; }
  20. public IGraphDataAction addCategoryAction { get; set; }
  21. public Action<IGraphDataAction> requestModelChangeAction { get; set; }
  22. public List<CategoryData> categoryInfoList { get; set; }
  23. // Can't add disbled keywords, so don't need an add action
  24. public List<string> disabledKeywordNameList { get; set; }
  25. public List<string> disabledDropdownNameList { get; set; }
  26. public BlackboardViewModel()
  27. {
  28. propertyNameToAddActionMap = new Dictionary<string, IGraphDataAction>();
  29. defaultKeywordNameToAddActionMap = new Dictionary<string, IGraphDataAction>();
  30. builtInKeywordNameToAddActionMap = new Dictionary<string, IGraphDataAction>();
  31. defaultDropdownNameToAdd = null;
  32. categoryInfoList = new List<CategoryData>();
  33. disabledKeywordNameList = new List<string>();
  34. disabledDropdownNameList = new List<string>();
  35. }
  36. public void ResetViewModelData()
  37. {
  38. subtitle = String.Empty;
  39. propertyNameToAddActionMap.Clear();
  40. defaultKeywordNameToAddActionMap.Clear();
  41. builtInKeywordNameToAddActionMap.Clear();
  42. defaultDropdownNameToAdd = null;
  43. categoryInfoList.Clear();
  44. disabledKeywordNameList.Clear();
  45. disabledDropdownNameList.Clear();
  46. requestModelChangeAction = null;
  47. }
  48. }
  49. }