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.

1021 lines
39 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using System;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UnityEditor;
  7. namespace AmplifyShaderEditor
  8. {
  9. [Serializable]
  10. public sealed class TemplateMultiPass : TemplateDataParent
  11. {
  12. [SerializeField]
  13. private List<TemplateShaderPropertyData> m_availableShaderProperties = new List<TemplateShaderPropertyData>();
  14. [SerializeField]
  15. private List<TemplateSubShader> m_subShaders = new List<TemplateSubShader>();
  16. [SerializeField]
  17. private TemplateTagData m_propertyTag;
  18. [SerializeField]
  19. private TemplateIdManager m_templateIdManager;
  20. [SerializeField]
  21. private string m_shaderNameId = string.Empty;
  22. [SerializeField]
  23. private string m_shaderBody;
  24. [SerializeField]
  25. private TemplatePropertyContainer m_templateProperties = new TemplatePropertyContainer();
  26. [SerializeField]
  27. private TemplateShaderInfo m_shaderData;
  28. [SerializeField]
  29. private bool m_isSinglePass = false;
  30. [SerializeField]
  31. private int m_masterNodesRequired = 0;
  32. [SerializeField]
  33. TemplateInfoContainer m_customInspectorContainer = new TemplateInfoContainer();
  34. [SerializeField]
  35. TemplateInfoContainer m_dependenciesContainer = new TemplateInfoContainer();
  36. [SerializeField]
  37. TemplateInfoContainer m_fallbackContainer = new TemplateInfoContainer();
  38. public TemplateMultiPass()
  39. {
  40. m_templateType = TemplateDataType.MultiPass;
  41. }
  42. public TemplateMultiPass( string name, string guid , bool isCommunity)
  43. {
  44. m_templateType = TemplateDataType.MultiPass;
  45. Init( name, guid , isCommunity);
  46. }
  47. public override void Init( string name, string guid, bool isCommunity )
  48. {
  49. base.Init( name, guid, isCommunity );
  50. TemplatesManager.CurrTemplateGUIDLoaded = guid;
  51. LoadTemplateBody( guid );
  52. Name = string.IsNullOrEmpty( name ) ? m_defaultShaderName : name;
  53. }
  54. void LoadTemplateBody( string guid )
  55. {
  56. m_guid = guid;
  57. string datapath = AssetDatabase.GUIDToAssetPath( guid );
  58. string shaderBody = string.Empty;
  59. shaderBody = IOUtils.LoadTextFileFromDisk( datapath );
  60. shaderBody = shaderBody.Replace( "\r\n", "\n" );
  61. m_shaderData = TemplateShaderInfoUtil.CreateShaderData( shaderBody );
  62. if( m_shaderData == null )
  63. {
  64. m_isValid = false;
  65. return;
  66. }
  67. m_templateIdManager = new TemplateIdManager( shaderBody );
  68. try
  69. {
  70. int nameBegin = shaderBody.IndexOf( TemplatesManager.TemplateShaderNameBeginTag );
  71. if( nameBegin < 0 )
  72. {
  73. // Not a template
  74. return;
  75. }
  76. int nameEnd = shaderBody.IndexOf( TemplatesManager.TemplateFullEndTag, nameBegin );
  77. if( nameEnd < 0 )
  78. return;
  79. m_shaderBody = shaderBody;
  80. int defaultBegin = nameBegin + TemplatesManager.TemplateShaderNameBeginTag.Length;
  81. int defaultLength = nameEnd - defaultBegin;
  82. m_defaultShaderName = shaderBody.Substring( defaultBegin, defaultLength );
  83. int[] nameIdx = m_defaultShaderName.AllIndexesOf( "\"" );
  84. nameIdx[ 0 ] += 1; // Ignore the " character from the string
  85. m_defaultShaderName = m_defaultShaderName.Substring( nameIdx[ 0 ], nameIdx[ 1 ] - nameIdx[ 0 ] );
  86. m_shaderNameId = shaderBody.Substring( nameBegin, nameEnd + TemplatesManager.TemplateFullEndTag.Length - nameBegin );
  87. m_templateProperties.AddId( shaderBody, m_shaderNameId, false );
  88. m_templateIdManager.RegisterId( nameBegin, m_shaderNameId, m_shaderNameId );
  89. shaderBody = shaderBody.Substring( nameEnd + TemplatesManager.TemplateFullEndTag.Length );
  90. }
  91. catch( Exception e )
  92. {
  93. Debug.LogException( e );
  94. m_isValid = false;
  95. }
  96. TemplateHelperFunctions.FetchDependencies( m_dependenciesContainer, ref m_shaderBody );
  97. if( m_dependenciesContainer.IsValid )
  98. {
  99. int index = m_dependenciesContainer.Id.IndexOf( TemplatesManager.TemplateDependenciesListTag );
  100. m_templateProperties.AddId( new TemplateProperty( m_dependenciesContainer.Id, m_dependenciesContainer.Id.Substring( 0, index ), true ) );
  101. m_templateIdManager.RegisterId( m_dependenciesContainer.Index, m_dependenciesContainer.Id, m_dependenciesContainer.Id );
  102. }
  103. TemplateHelperFunctions.FetchCustomInspector( m_customInspectorContainer, ref m_shaderBody );
  104. if( m_customInspectorContainer.IsValid )
  105. {
  106. int index = m_customInspectorContainer.Id.IndexOf( "CustomEditor" );
  107. m_templateProperties.AddId( new TemplateProperty( m_customInspectorContainer.Id, m_customInspectorContainer.Id.Substring( 0, index ), true ) );
  108. m_templateIdManager.RegisterId( m_customInspectorContainer.Index, m_customInspectorContainer.Id, m_customInspectorContainer.Id );
  109. }
  110. TemplateHelperFunctions.FetchFallback( m_fallbackContainer, ref m_shaderBody );
  111. if( m_fallbackContainer.IsValid )
  112. {
  113. int index = m_fallbackContainer.Id.IndexOf( "Fallback" );
  114. m_templateProperties.AddId( new TemplateProperty( m_fallbackContainer.Id, m_fallbackContainer.Id.Substring( 0, index ), true ) );
  115. m_templateIdManager.RegisterId( m_fallbackContainer.Index, m_fallbackContainer.Id, m_fallbackContainer.Id );
  116. }
  117. // Shader body may have been changed to inject inexisting tags like fallback
  118. m_templateIdManager.ShaderBody = m_shaderBody;
  119. m_propertyTag = new TemplateTagData( m_shaderData.PropertyStartIdx, TemplatesManager.TemplatePropertyTag, true );
  120. m_templateIdManager.RegisterId( m_shaderData.PropertyStartIdx, TemplatesManager.TemplatePropertyTag, TemplatesManager.TemplatePropertyTag );
  121. m_templateProperties.AddId( shaderBody, TemplatesManager.TemplatePropertyTag, true );
  122. Dictionary<string, TemplateShaderPropertyData> duplicatesHelper = new Dictionary<string, TemplateShaderPropertyData>();
  123. TemplateHelperFunctions.CreateShaderPropertiesList( m_shaderData.Properties, ref m_availableShaderProperties, ref duplicatesHelper );
  124. int subShaderCount = m_shaderData.SubShaders.Count;
  125. int mainSubShaderIdx = -1;
  126. int mainPassIdx = -1;
  127. int firstVisibleSubShaderId = -1;
  128. int firstVisiblePassId = -1;
  129. bool foundMainPass = false;
  130. bool foundFirstVisible = false;
  131. for( int i = 0; i < subShaderCount; i++ )
  132. {
  133. TemplateSubShader subShader = new TemplateSubShader( i, m_templateIdManager, "SubShader" + i, m_shaderData.SubShaders[ i ], ref duplicatesHelper );
  134. if( subShader.FoundMainPass )
  135. {
  136. if( !foundMainPass )
  137. {
  138. foundMainPass = true;
  139. mainSubShaderIdx = i;
  140. mainPassIdx = subShader.MainPass;
  141. }
  142. }
  143. else if( subShader.MainPass > -1 )
  144. {
  145. if( !foundFirstVisible )
  146. {
  147. foundFirstVisible = true;
  148. firstVisibleSubShaderId = i;
  149. firstVisiblePassId = subShader.MainPass;
  150. }
  151. }
  152. m_subShaders.Add( subShader );
  153. m_masterNodesRequired += subShader.Passes.Count;
  154. }
  155. if( !foundMainPass && foundFirstVisible )
  156. {
  157. mainSubShaderIdx = firstVisibleSubShaderId;
  158. mainPassIdx = firstVisiblePassId;
  159. }
  160. for( int subShaderIdx = 0; subShaderIdx < subShaderCount; subShaderIdx++ )
  161. {
  162. int passCount = m_subShaders[ subShaderIdx ].Passes.Count;
  163. for( int passIdx = 0; passIdx < passCount; passIdx++ )
  164. {
  165. m_subShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass = ( mainSubShaderIdx == subShaderIdx && mainPassIdx == passIdx );
  166. }
  167. }
  168. duplicatesHelper.Clear();
  169. duplicatesHelper = null;
  170. m_isSinglePass = ( m_subShaders.Count == 1 && m_subShaders[ 0 ].PassAmount == 1 );
  171. }
  172. public void ResetState()
  173. {
  174. m_templateIdManager.ResetRegistersState();
  175. int subshaderCount = m_subShaders.Count;
  176. for( int subShaderIdx = 0; subShaderIdx < subshaderCount; subShaderIdx++ )
  177. {
  178. m_subShaders[ subShaderIdx ].TemplateProperties.ResetTemplateUsageData();
  179. int passCount = m_subShaders[ subShaderIdx ].Passes.Count;
  180. for( int passIdx = 0; passIdx < passCount; passIdx++ )
  181. {
  182. m_subShaders[ subShaderIdx ].Passes[ passIdx ].TemplateProperties.ResetTemplateUsageData();
  183. }
  184. }
  185. }
  186. public override void Destroy()
  187. {
  188. m_templateProperties.Destroy();
  189. m_templateProperties = null;
  190. m_availableShaderProperties.Clear();
  191. m_availableShaderProperties = null;
  192. int subShaderCount = m_subShaders.Count;
  193. for( int i = 0; i < subShaderCount; i++ )
  194. {
  195. m_subShaders[ i ].Destroy();
  196. }
  197. m_subShaders.Clear();
  198. m_subShaders = null;
  199. m_templateIdManager.Destroy();
  200. m_templateIdManager = null;
  201. }
  202. public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, string[] list )
  203. {
  204. string id = GetSubShaderDataId( type, subShaderId, false );
  205. string body = string.Empty;
  206. FillTemplateBody( subShaderId, -1, id, ref body, list );
  207. SetSubShaderData( type, subShaderId, body );
  208. }
  209. public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, List<PropertyDataCollector> list )
  210. {
  211. string id = GetSubShaderDataId( type, subShaderId, false );
  212. string body = string.Empty;
  213. FillTemplateBody( subShaderId, -1, id, ref body, list );
  214. SetSubShaderData( type, subShaderId, body );
  215. }
  216. public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, string text )
  217. {
  218. if( subShaderId >= m_subShaders.Count )
  219. return;
  220. string prefix = m_subShaders[ subShaderId ].Modules.UniquePrefix;
  221. switch( type )
  222. {
  223. case TemplateModuleDataType.AllModules:
  224. {
  225. m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateAllModulesTag, text );
  226. }
  227. break;
  228. case TemplateModuleDataType.ModuleShaderModel:
  229. {
  230. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ShaderModel.Id, text );
  231. }
  232. break;
  233. case TemplateModuleDataType.ModuleBlendMode:
  234. {
  235. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendModeId, text );
  236. }
  237. break;
  238. case TemplateModuleDataType.ModuleBlendOp:
  239. {
  240. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendOpId, text );
  241. }break;
  242. case TemplateModuleDataType.ModuleAlphaToMask:
  243. {
  244. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.AlphaToMaskId, text );
  245. }
  246. break;
  247. case TemplateModuleDataType.ModuleCullMode:
  248. {
  249. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.CullModeData.CullModeId, text );
  250. }
  251. break;
  252. case TemplateModuleDataType.ModuleColorMask:
  253. {
  254. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData.ColorMaskId, text );
  255. }
  256. break;
  257. case TemplateModuleDataType.ModuleStencil:
  258. {
  259. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.StencilData.StencilBufferId, text );
  260. }
  261. break;
  262. case TemplateModuleDataType.ModuleZwrite:
  263. {
  264. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZWriteModeId, text );
  265. }
  266. break;
  267. case TemplateModuleDataType.ModuleZTest:
  268. {
  269. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZTestModeId, text );
  270. }
  271. break;
  272. case TemplateModuleDataType.ModuleZOffset:
  273. {
  274. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.OffsetId, text );
  275. }
  276. break;
  277. case TemplateModuleDataType.ModuleTag:
  278. {
  279. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.TagData.TagsId, text );
  280. }
  281. break;
  282. case TemplateModuleDataType.ModuleGlobals:
  283. {
  284. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.GlobalsTag.Id, text );
  285. }
  286. break;
  287. case TemplateModuleDataType.ModuleFunctions:
  288. {
  289. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.FunctionsTag.Id, text );
  290. }
  291. break;
  292. case TemplateModuleDataType.ModulePragma:
  293. {
  294. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PragmaTag.Id, text );
  295. }
  296. break;
  297. case TemplateModuleDataType.ModulePass:
  298. {
  299. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PassTag.Id, text );
  300. }
  301. break;
  302. case TemplateModuleDataType.ModuleInputVert:
  303. {
  304. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.InputsVertTag.Id, text );
  305. }
  306. break;
  307. case TemplateModuleDataType.ModuleInputFrag:
  308. {
  309. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.InputsFragTag.Id, text );
  310. }
  311. break;
  312. }
  313. }
  314. public void SetPropertyData( string[] properties )
  315. {
  316. string body = string.Empty;
  317. FillTemplateBody( -1, -1, TemplatesManager.TemplatePropertyTag, ref body, properties );
  318. SetPropertyData( body );
  319. }
  320. public void SetPropertyData( string text )
  321. {
  322. m_templateIdManager.SetReplacementText( m_propertyTag.Id, text );
  323. }
  324. public string GetSubShaderDataId( TemplateModuleDataType type, int subShaderId, bool addPrefix )
  325. {
  326. if ( subShaderId >= m_subShaders.Count )
  327. return string.Empty;
  328. string prefix = string.Empty;
  329. switch ( type )
  330. {
  331. case TemplateModuleDataType.AllModules:
  332. {
  333. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  334. return prefix + TemplatesManager.TemplateAllModulesTag;
  335. }
  336. case TemplateModuleDataType.ModuleBlendMode:
  337. {
  338. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  339. return prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendModeId;
  340. }
  341. case TemplateModuleDataType.ModuleBlendOp:
  342. {
  343. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  344. return prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendOpId;
  345. }
  346. case TemplateModuleDataType.ModuleAlphaToMask:
  347. {
  348. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  349. return prefix + m_subShaders[ subShaderId ].Modules.BlendData.AlphaToMaskId;
  350. }
  351. case TemplateModuleDataType.ModuleCullMode:
  352. {
  353. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  354. return prefix + m_subShaders[ subShaderId ].Modules.CullModeData.CullModeId;
  355. }
  356. case TemplateModuleDataType.ModuleColorMask:
  357. {
  358. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  359. return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData.ColorMaskId;
  360. }
  361. case TemplateModuleDataType.ModuleStencil:
  362. {
  363. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  364. return prefix + m_subShaders[ subShaderId ].Modules.StencilData.StencilBufferId;
  365. }
  366. case TemplateModuleDataType.ModuleZwrite:
  367. {
  368. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  369. return prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZWriteModeId;
  370. }
  371. case TemplateModuleDataType.ModuleZTest:
  372. {
  373. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  374. return prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZTestModeId;
  375. }
  376. case TemplateModuleDataType.ModuleZOffset:
  377. {
  378. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  379. return prefix + m_subShaders[ subShaderId ].Modules.DepthData.OffsetId;
  380. }
  381. case TemplateModuleDataType.ModuleTag:
  382. {
  383. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  384. return prefix + m_subShaders[ subShaderId ].Modules.TagData.TagsId;
  385. }
  386. case TemplateModuleDataType.ModuleGlobals:
  387. {
  388. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  389. return prefix + m_subShaders[ subShaderId ].Modules.GlobalsTag.Id;
  390. }
  391. case TemplateModuleDataType.ModuleFunctions:
  392. {
  393. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  394. return prefix + m_subShaders[ subShaderId ].Modules.FunctionsTag.Id;
  395. }
  396. case TemplateModuleDataType.ModulePragma:
  397. {
  398. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  399. return prefix + m_subShaders[ subShaderId ].Modules.PragmaTag.Id;
  400. }
  401. case TemplateModuleDataType.ModulePass:
  402. {
  403. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  404. return prefix + m_subShaders[ subShaderId ].Modules.PassTag.Id;
  405. }
  406. case TemplateModuleDataType.ModuleInputVert:
  407. {
  408. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  409. return prefix + m_subShaders[ subShaderId ].Modules.InputsVertTag.Id;
  410. }
  411. case TemplateModuleDataType.ModuleInputFrag:
  412. {
  413. prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty;
  414. return prefix + m_subShaders[ subShaderId ].Modules.InputsFragTag.Id;
  415. }
  416. }
  417. return string.Empty;
  418. }
  419. public string GetPassDataId( TemplateModuleDataType type, int subShaderId, int passId, bool addPrefix )
  420. {
  421. if( subShaderId >= m_subShaders.Count || passId >= m_subShaders[ subShaderId ].Passes.Count )
  422. return string.Empty;
  423. string prefix = string.Empty;
  424. switch( type )
  425. {
  426. case TemplateModuleDataType.AllModules:
  427. {
  428. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  429. return prefix + TemplatesManager.TemplateAllModulesTag;
  430. }
  431. case TemplateModuleDataType.ModuleBlendMode:
  432. {
  433. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  434. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendModeId;
  435. }
  436. case TemplateModuleDataType.ModuleBlendOp:
  437. {
  438. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  439. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendOpId;
  440. }
  441. case TemplateModuleDataType.ModuleAlphaToMask:
  442. {
  443. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  444. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.AlphaToMaskId;
  445. }
  446. case TemplateModuleDataType.ModuleCullMode:
  447. {
  448. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  449. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData.CullModeId;
  450. }
  451. case TemplateModuleDataType.ModuleColorMask:
  452. {
  453. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  454. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData.ColorMaskId;
  455. }
  456. case TemplateModuleDataType.ModuleStencil:
  457. {
  458. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  459. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.StencilData.StencilBufferId;
  460. }
  461. case TemplateModuleDataType.ModuleZwrite:
  462. {
  463. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  464. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZWriteModeId;
  465. }
  466. case TemplateModuleDataType.ModuleZTest:
  467. {
  468. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  469. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZTestModeId;
  470. }
  471. case TemplateModuleDataType.ModuleZOffset:
  472. {
  473. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  474. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.OffsetId;
  475. }
  476. case TemplateModuleDataType.ModuleTag:
  477. {
  478. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  479. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.TagData.TagsId;
  480. }
  481. case TemplateModuleDataType.ModuleGlobals:
  482. {
  483. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  484. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.GlobalsTag.Id;
  485. }
  486. case TemplateModuleDataType.ModuleFunctions:
  487. {
  488. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  489. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.FunctionsTag.Id;
  490. }
  491. case TemplateModuleDataType.ModulePragma:
  492. {
  493. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  494. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaTag.Id;
  495. }
  496. case TemplateModuleDataType.ModulePass:
  497. {
  498. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  499. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PassTag.Id;
  500. }
  501. case TemplateModuleDataType.ModuleInputVert:
  502. {
  503. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  504. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsVertTag.Id;
  505. }
  506. case TemplateModuleDataType.ModuleInputFrag:
  507. {
  508. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty;
  509. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsFragTag.Id;
  510. }
  511. case TemplateModuleDataType.PassVertexFunction:
  512. {
  513. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  514. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexFunctionData.Id;
  515. }
  516. case TemplateModuleDataType.PassFragmentFunction:
  517. {
  518. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  519. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData.Id;
  520. }
  521. case TemplateModuleDataType.PassVertexData:
  522. {
  523. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty;
  524. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexDataContainer.VertexDataId;
  525. }
  526. case TemplateModuleDataType.PassInterpolatorData:
  527. {
  528. prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix: string.Empty;
  529. return prefix + m_subShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer.InterpDataId;
  530. }
  531. }
  532. return string.Empty;
  533. }
  534. public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, string[] list )
  535. {
  536. //if( list == null || list.Length == 0 )
  537. // return;
  538. string id = GetPassDataId( type, subShaderId, passId ,false);
  539. string body = string.Empty;
  540. FillTemplateBody( subShaderId, passId, id, ref body, list );
  541. SetPassData( type, subShaderId, passId, body );
  542. }
  543. public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, List<PropertyDataCollector> list )
  544. {
  545. //if( list == null || list.Count == 0 )
  546. // return;
  547. string id = GetPassDataId( type, subShaderId, passId, false);
  548. string body = string.Empty;
  549. FillTemplateBody( subShaderId, passId, id, ref body, list );
  550. SetPassData( type, subShaderId, passId, body );
  551. }
  552. public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, string text )
  553. {
  554. if( subShaderId >= m_subShaders.Count || passId >= m_subShaders[ subShaderId ].Passes.Count )
  555. return;
  556. string prefix = string.Empty;
  557. switch( type )
  558. {
  559. //case TemplateModuleDataType.EndPass:
  560. //{
  561. // prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  562. // m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateEndPassTag, text );
  563. //}
  564. //break;
  565. case TemplateModuleDataType.AllModules:
  566. {
  567. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  568. m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateAllModulesTag, text );
  569. }
  570. break;
  571. case TemplateModuleDataType.ModuleShaderModel:
  572. {
  573. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  574. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ShaderModel.Id, text );
  575. }
  576. break;
  577. case TemplateModuleDataType.ModuleBlendMode:
  578. {
  579. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  580. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendModeId, text );
  581. }
  582. break;
  583. case TemplateModuleDataType.ModuleBlendOp:
  584. {
  585. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  586. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendOpId, text );
  587. }
  588. break;
  589. case TemplateModuleDataType.ModuleAlphaToMask:
  590. {
  591. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  592. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.AlphaToMaskId, text );
  593. }
  594. break;
  595. case TemplateModuleDataType.ModuleCullMode:
  596. {
  597. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  598. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData.CullModeId, text );
  599. }
  600. break;
  601. case TemplateModuleDataType.ModuleColorMask:
  602. {
  603. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  604. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData.ColorMaskId, text );
  605. }
  606. break;
  607. case TemplateModuleDataType.ModuleStencil:
  608. {
  609. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  610. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.StencilData.StencilBufferId, text );
  611. }
  612. break;
  613. case TemplateModuleDataType.ModuleZwrite:
  614. {
  615. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  616. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZWriteModeId, text );
  617. }
  618. break;
  619. case TemplateModuleDataType.ModuleZTest:
  620. {
  621. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  622. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZTestModeId, text );
  623. }
  624. break;
  625. case TemplateModuleDataType.ModuleZOffset:
  626. {
  627. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  628. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.OffsetId, text );
  629. }
  630. break;
  631. case TemplateModuleDataType.ModuleTag:
  632. {
  633. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  634. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.TagData.TagsId, text );
  635. }
  636. break;
  637. case TemplateModuleDataType.ModuleGlobals:
  638. {
  639. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  640. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.GlobalsTag.Id, text );
  641. }
  642. break;
  643. case TemplateModuleDataType.ModuleFunctions:
  644. {
  645. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  646. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.FunctionsTag.Id, text );
  647. }
  648. break;
  649. case TemplateModuleDataType.ModulePragma:
  650. {
  651. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  652. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaTag.Id, text );
  653. }
  654. break;
  655. case TemplateModuleDataType.ModulePass:
  656. {
  657. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  658. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PassTag.Id, text );
  659. }
  660. break;
  661. case TemplateModuleDataType.ModuleInputVert:
  662. {
  663. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  664. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsVertTag.Id, text );
  665. }
  666. break;
  667. case TemplateModuleDataType.ModuleInputFrag:
  668. {
  669. prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix;
  670. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsFragTag.Id, text );
  671. }
  672. break;
  673. case TemplateModuleDataType.PassVertexFunction:
  674. {
  675. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  676. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexFunctionData.Id, text );
  677. }
  678. break;
  679. case TemplateModuleDataType.PassFragmentFunction:
  680. {
  681. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  682. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData.Id, text );
  683. }
  684. break;
  685. case TemplateModuleDataType.PassVertexData:
  686. {
  687. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  688. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexDataContainer.VertexDataId, text );
  689. }
  690. break;
  691. case TemplateModuleDataType.PassInterpolatorData:
  692. {
  693. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  694. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer.InterpDataId, text );
  695. }
  696. break;
  697. case TemplateModuleDataType.PassNameData:
  698. {
  699. prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  700. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].PassNameContainer.Id, text );
  701. }
  702. break;
  703. }
  704. }
  705. public void SetPassInputData( int subShaderId, int passId, int inputId, string text )
  706. {
  707. if( subShaderId >= m_subShaders.Count ||
  708. passId >= m_subShaders[ subShaderId ].Passes.Count ||
  709. inputId >= m_subShaders[ subShaderId ].Passes[ passId ].InputDataList.Count )
  710. return;
  711. string prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  712. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InputDataFromId( inputId ).TagId, text );
  713. }
  714. public void SetPassInputDataByArrayIdx( int subShaderId, int passId, int inputId, string text )
  715. {
  716. if( subShaderId >= m_subShaders.Count ||
  717. passId >= m_subShaders[ subShaderId ].Passes.Count ||
  718. inputId >= m_subShaders[ subShaderId ].Passes[ passId ].InputDataList.Count )
  719. return;
  720. string prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix;
  721. m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InputDataList[ inputId ].TagId, text );
  722. }
  723. public TemplateData CreateTemplateData( string name, string guid, int subShaderId, int passId )
  724. {
  725. if( subShaderId >= m_subShaders.Count ||
  726. passId >= m_subShaders[ subShaderId ].Passes.Count )
  727. return null;
  728. if( string.IsNullOrEmpty( name ) )
  729. name = m_defaultShaderName;
  730. TemplateData templateData = ScriptableObject.CreateInstance<TemplateData>();
  731. templateData.Name = name;
  732. templateData.GUID = guid;
  733. templateData.TemplateBody = m_shaderBody;
  734. templateData.DefaultShaderName = m_defaultShaderName;
  735. templateData.ShaderNameId = m_shaderNameId;
  736. templateData.OrderId = m_orderId;
  737. templateData.InputDataList = SubShaders[ subShaderId ].Passes[ passId ].InputDataList;
  738. templateData.VertexDataContainer = SubShaders[ subShaderId ].Passes[ passId ].VertexDataContainer;
  739. templateData.InterpolatorDataContainer = SubShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer;
  740. templateData.AvailableShaderProperties = m_availableShaderProperties;
  741. templateData.VertexFunctionData = SubShaders[ subShaderId ].Passes[ passId ].VertexFunctionData;
  742. templateData.FragmentFunctionData = SubShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData;
  743. templateData.BlendData = SubShaders[ subShaderId ].Passes[ passId ].Modules.BlendData;
  744. templateData.CullModeData = SubShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData;
  745. templateData.ColorMaskData = SubShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData;
  746. templateData.StencilData = SubShaders[ subShaderId ].Passes[ passId ].Modules.StencilData;
  747. templateData.DepthData = SubShaders[ subShaderId ].Passes[ passId ].Modules.DepthData;
  748. templateData.TagData = SubShaders[ subShaderId ].Passes[ passId ].Modules.TagData;
  749. //templateData.PropertyList = m_pr;
  750. //private Dictionary<string, TemplateProperty> m_propertyDict = new Dictionary<string, TemplateProperty>();
  751. return templateData;
  752. }
  753. public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, List<PropertyDataCollector> values )
  754. {
  755. if( values.Count == 0 )
  756. {
  757. return true;
  758. }
  759. string[] array = new string[ values.Count ];
  760. for( int i = 0; i < values.Count; i++ )
  761. {
  762. array[ i ] = values[ i ].PropertyName;
  763. }
  764. return FillTemplateBody( subShaderId, passId, id, ref body, array );
  765. }
  766. public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, params string[] values )
  767. {
  768. if( values.Length == 0 )
  769. {
  770. if( id[ id.Length - 1] == '\n' )
  771. body = "\n";
  772. return true;
  773. }
  774. TemplatePropertyContainer propertyContainer = null;
  775. if( subShaderId >= 0 )
  776. {
  777. if( passId >= 0 )
  778. {
  779. propertyContainer = SubShaders[ subShaderId ].Passes[ passId ].TemplateProperties;
  780. }
  781. else
  782. {
  783. propertyContainer = SubShaders[ subShaderId ].TemplateProperties;
  784. }
  785. }
  786. else
  787. {
  788. propertyContainer = m_templateProperties;
  789. }
  790. propertyContainer.BuildInfo();
  791. if( propertyContainer.PropertyDict.ContainsKey( id ) )
  792. {
  793. string finalValue = propertyContainer.PropertyDict[ id ].UseIndentationAtStart? propertyContainer.PropertyDict[ id ].Indentation:string.Empty;
  794. for( int i = 0; i < values.Length; i++ )
  795. {
  796. if( propertyContainer.PropertyDict[ id ].AutoLineFeed )
  797. {
  798. string[] valuesArr = values[ i ].Split( '\n' );
  799. for( int j = 0; j < valuesArr.Length; j++ )
  800. {
  801. //first value will be automatically indented by the string replace
  802. finalValue += ( ( i == 0 && j == 0 ) ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + valuesArr[ j ];
  803. finalValue += TemplatesManager.TemplateNewLine;
  804. }
  805. }
  806. else
  807. {
  808. //first value will be automatically indented by the string replace
  809. finalValue += ( i == 0 ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + values[ i ];
  810. }
  811. }
  812. body = finalValue;
  813. propertyContainer.PropertyDict[ id ].Used = true;
  814. return true;
  815. }
  816. if( values.Length > 1 || !string.IsNullOrEmpty( values[ 0 ] ) )
  817. {
  818. UIUtils.ShowMessage( string.Format( "Attempting to write data into inexistant tag {0}. Please review the template {1} body and consider adding the missing tag.", id, m_defaultShaderName ), MessageSeverity.Error );
  819. return false;
  820. }
  821. return true;
  822. }
  823. public bool FillVertexInstructions( int subShaderId, int passId, params string[] values )
  824. {
  825. TemplateFunctionData vertexFunctionData = SubShaders[ subShaderId ].Passes[ passId ].VertexFunctionData;
  826. if( vertexFunctionData != null && !string.IsNullOrEmpty( vertexFunctionData.Id ) )
  827. {
  828. string body = string.Empty;
  829. bool isValid = FillTemplateBody( subShaderId, passId, vertexFunctionData.Id, ref body, values );
  830. SetPassData( TemplateModuleDataType.PassVertexFunction, subShaderId, passId, body );
  831. return isValid;
  832. }
  833. if( values.Length > 0 )
  834. {
  835. UIUtils.ShowMessage( "Attemping to add vertex instructions on a template with no assigned vertex code area", MessageSeverity.Error );
  836. return false;
  837. }
  838. return true;
  839. }
  840. public bool FillFragmentInstructions( int subShaderId, int passId, params string[] values )
  841. {
  842. TemplateFunctionData fragmentFunctionData = SubShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData;
  843. if( fragmentFunctionData != null && !string.IsNullOrEmpty( fragmentFunctionData.Id ) )
  844. {
  845. string body = string.Empty;
  846. bool isValid = FillTemplateBody( subShaderId, passId, fragmentFunctionData.Id, ref body, values );
  847. SetPassData( TemplateModuleDataType.PassFragmentFunction, subShaderId, passId, body );
  848. return isValid;
  849. }
  850. if( values.Length > 0 )
  851. {
  852. UIUtils.ShowMessage( "Attemping to add fragment instructions on a template with no assigned vertex code area", MessageSeverity.Error );
  853. return false;
  854. }
  855. return true;
  856. }
  857. public void SetShaderName( string name )
  858. {
  859. m_templateIdManager.SetReplacementText( m_shaderNameId, name );
  860. }
  861. public void SetCustomInspector( string customInspector )
  862. {
  863. if( m_customInspectorContainer.Index > -1 )
  864. {
  865. m_templateIdManager.SetReplacementText( m_customInspectorContainer.Id, m_templateProperties.PropertyDict[ m_customInspectorContainer.Id ].Indentation + customInspector );
  866. }
  867. }
  868. public void SetFallback( string fallback )
  869. {
  870. if( m_fallbackContainer.Index > -1 )
  871. {
  872. m_templateIdManager.SetReplacementText( m_fallbackContainer.Id, m_templateProperties.PropertyDict[ m_fallbackContainer.Id ].Indentation + fallback );
  873. }
  874. }
  875. public void SetDependencies( string dependencies )
  876. {
  877. if( m_dependenciesContainer.Index > -1 )
  878. {
  879. m_templateIdManager.SetReplacementText( m_dependenciesContainer.Id, dependencies );
  880. }
  881. }
  882. private void OnEnable()
  883. {
  884. hideFlags = HideFlags.HideAndDontSave;
  885. }
  886. public override bool Reload()
  887. {
  888. m_propertyTag = null;
  889. m_shaderNameId = string.Empty;
  890. m_shaderBody = string.Empty;
  891. m_isSinglePass = false;
  892. m_masterNodesRequired = 0;
  893. m_customInspectorContainer.Reset();
  894. m_fallbackContainer.Reset();
  895. m_dependenciesContainer.Reset();
  896. m_availableShaderProperties.Clear();
  897. int count = m_subShaders.Count;
  898. for( int i = 0; i < count; i++ )
  899. {
  900. m_subShaders[ i ].Destroy();
  901. }
  902. m_subShaders.Clear();
  903. m_templateIdManager.Reset();
  904. if( m_shaderData != null )
  905. m_shaderData.Destroy();
  906. m_templateProperties.Reset();
  907. string oldName = m_defaultShaderName;
  908. LoadTemplateBody( m_guid );
  909. if( m_communityTemplate )
  910. Name = m_defaultShaderName;
  911. return !oldName.Equals( m_defaultShaderName );
  912. }
  913. public TemplateSRPType SRPtype { get { return m_subShaders[ 0 ].Modules.SRPType; } }
  914. //public bool SRPIsPBRHD { get { return m_subShaders[0].Modules.SRPIsPBRHD ; } }
  915. public List<TemplateSubShader> SubShaders { get { return m_subShaders; } }
  916. public List<TemplateShaderPropertyData> AvailableShaderProperties { get { return m_availableShaderProperties; } }
  917. public TemplateTagData PropertyTag { get { return m_propertyTag; } }
  918. public TemplateIdManager IdManager { get { return m_templateIdManager; } }
  919. public TemplatePropertyContainer TemplateProperties { get { return m_templateProperties; } }
  920. public TemplateInfoContainer CustomInspectorContainer { get { return m_customInspectorContainer; } }
  921. public TemplateInfoContainer FallbackContainer { get { return m_fallbackContainer; } }
  922. public bool IsSinglePass { get { return m_isSinglePass; } }
  923. public int MasterNodesRequired { get { return m_masterNodesRequired; } }
  924. }
  925. }