Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.7 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using System;
  4. using UnityEngine;
  5. using UnityEditor;
  6. namespace AmplifyShaderEditor
  7. {
  8. [Serializable]
  9. public class TemplateModuleParent
  10. {
  11. private const string UnreadableDataMessagePrefix = "Unreadable data on Module ";
  12. protected string m_unreadableMessage;
  13. [SerializeField]
  14. protected bool m_validData = false;
  15. [SerializeField]
  16. protected bool m_isDirty = false;
  17. [SerializeField]
  18. protected string m_moduleName = string.Empty;
  19. //[SerializeField]
  20. //protected bool m_foldoutValue = false;
  21. [SerializeField]
  22. protected bool m_independentModule = true;
  23. public TemplateModuleParent( string moduleName ) { m_moduleName = moduleName; m_unreadableMessage = UnreadableDataMessagePrefix + moduleName; }
  24. public virtual void Draw( UndoParentNode owner , bool style = true) { }
  25. public virtual void ReadFromString( ref uint index, ref string[] nodeParams ) { }
  26. public virtual void WriteToString( ref string nodeInfo ) { }
  27. public virtual string GenerateShaderData( bool isSubShader ) { return string.Empty; }
  28. public virtual void Destroy() { }
  29. public bool ValidData { get { return m_validData; } }
  30. public bool ValidAndIndependent { get { return m_validData && m_independentModule; } }
  31. public virtual void ShowUnreadableDataMessage( ParentNode owner )
  32. {
  33. ShowUnreadableDataMessage();
  34. }
  35. public virtual void ShowUnreadableDataMessage()
  36. {
  37. EditorGUILayout.HelpBox( m_unreadableMessage, MessageType.Info );
  38. }
  39. public bool IsDirty
  40. {
  41. get { return m_isDirty; }
  42. set { m_isDirty = value; }
  43. }
  44. public bool IndependentModule
  45. {
  46. get { return m_independentModule; }
  47. set { m_independentModule = value; }
  48. }
  49. }
  50. }