MB3_MeshCombinerSettings.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DigitalOpus.MB.Core
  5. {
  6. public enum MB_MeshPivotLocation
  7. {
  8. worldOrigin,
  9. boundsCenter,
  10. customLocation,
  11. }
  12. [System.Serializable]
  13. public class MB3_MeshCombinerSettingsData : MB_IMeshBakerSettings
  14. {
  15. [SerializeField] protected MB_RenderType _renderType;
  16. public virtual MB_RenderType renderType
  17. {
  18. get { return _renderType; }
  19. set { _renderType = value; }
  20. }
  21. [SerializeField] protected MB2_OutputOptions _outputOption;
  22. public virtual MB2_OutputOptions outputOption
  23. {
  24. get { return _outputOption; }
  25. set { _outputOption = value; }
  26. }
  27. [SerializeField] protected MB2_LightmapOptions _lightmapOption = MB2_LightmapOptions.ignore_UV2;
  28. public virtual MB2_LightmapOptions lightmapOption
  29. {
  30. get { return _lightmapOption; }
  31. set { _lightmapOption = value; }
  32. }
  33. [SerializeField] protected bool _doNorm = true;
  34. public virtual bool doNorm
  35. {
  36. get { return _doNorm; }
  37. set { _doNorm = value; }
  38. }
  39. [SerializeField] protected bool _doTan = true;
  40. public virtual bool doTan
  41. {
  42. get { return _doTan; }
  43. set { _doTan = value; }
  44. }
  45. [SerializeField] protected bool _doCol;
  46. public virtual bool doCol
  47. {
  48. get { return _doCol; }
  49. set { _doCol = value; }
  50. }
  51. [SerializeField] protected bool _doUV = true;
  52. public virtual bool doUV
  53. {
  54. get { return _doUV; }
  55. set { _doUV = value; }
  56. }
  57. [SerializeField] protected bool _doUV3;
  58. public virtual bool doUV3
  59. {
  60. get { return _doUV3; }
  61. set { _doUV3 = value; }
  62. }
  63. [SerializeField] protected bool _doUV4;
  64. public virtual bool doUV4
  65. {
  66. get { return _doUV4; }
  67. set { _doUV4 = value; }
  68. }
  69. [SerializeField] protected bool _doUV5;
  70. public virtual bool doUV5
  71. {
  72. get { return _doUV5; }
  73. set { _doUV5 = value; }
  74. }
  75. [SerializeField] protected bool _doUV6;
  76. public virtual bool doUV6
  77. {
  78. get { return _doUV6; }
  79. set { _doUV6 = value; }
  80. }
  81. [SerializeField] protected bool _doUV7;
  82. public virtual bool doUV7
  83. {
  84. get { return _doUV7; }
  85. set { _doUV7 = value; }
  86. }
  87. [SerializeField] protected bool _doUV8;
  88. public virtual bool doUV8
  89. {
  90. get { return _doUV8; }
  91. set { _doUV8 = value; }
  92. }
  93. [SerializeField]
  94. protected bool _doBlendShapes;
  95. public virtual bool doBlendShapes
  96. {
  97. get { return _doBlendShapes; }
  98. set { _doBlendShapes = value; }
  99. }
  100. [UnityEngine.Serialization.FormerlySerializedAs("_recenterVertsToBoundsCenter")]
  101. [SerializeField]
  102. protected MB_MeshPivotLocation _pivotLocationType;
  103. public virtual MB_MeshPivotLocation pivotLocationType
  104. {
  105. get { return _pivotLocationType; }
  106. set{ _pivotLocationType = value; }
  107. }
  108. [SerializeField]
  109. protected Vector3 _pivotLocation;
  110. public virtual Vector3 pivotLocation
  111. {
  112. get { return _pivotLocation; }
  113. set { _pivotLocation = value; }
  114. }
  115. //[SerializeField]
  116. //protected bool _recenterVertsToBoundsCenter = false;
  117. /*
  118. public virtual bool recenterVertsToBoundsCenter
  119. {
  120. get
  121. {
  122. if (_pivotLocationType == MB_MeshPivotLocation.boundsCenter) return true;
  123. else return false;
  124. }
  125. }
  126. */
  127. [SerializeField]
  128. protected bool _clearBuffersAfterBake = false;
  129. public bool clearBuffersAfterBake
  130. {
  131. get { return _clearBuffersAfterBake; }
  132. set { _clearBuffersAfterBake = value; }
  133. }
  134. [SerializeField]
  135. public bool _optimizeAfterBake = true;
  136. public bool optimizeAfterBake
  137. {
  138. get { return _optimizeAfterBake; }
  139. set { _optimizeAfterBake = value; }
  140. }
  141. [SerializeField]
  142. protected float _uv2UnwrappingParamsHardAngle = 60f;
  143. public float uv2UnwrappingParamsHardAngle
  144. {
  145. get { return _uv2UnwrappingParamsHardAngle; }
  146. set { _uv2UnwrappingParamsHardAngle = value; }
  147. }
  148. [SerializeField]
  149. protected float _uv2UnwrappingParamsPackMargin = .005f;
  150. public float uv2UnwrappingParamsPackMargin
  151. {
  152. get { return _uv2UnwrappingParamsPackMargin; }
  153. set { _uv2UnwrappingParamsPackMargin = value; }
  154. }
  155. [SerializeField]
  156. protected UnityEngine.Object _assignToMeshCustomizer;
  157. public IAssignToMeshCustomizer assignToMeshCustomizer
  158. {
  159. get
  160. {
  161. if (_assignToMeshCustomizer is IAssignToMeshCustomizer)
  162. {
  163. return (IAssignToMeshCustomizer) _assignToMeshCustomizer;
  164. }
  165. else
  166. {
  167. _assignToMeshCustomizer = null;
  168. return null;
  169. }
  170. }
  171. set
  172. {
  173. _assignToMeshCustomizer = (UnityEngine.Object)value;
  174. }
  175. }
  176. }
  177. [CreateAssetMenu(fileName = "MeshBakerSettings", menuName = "Mesh Baker/Mesh Baker Settings")]
  178. public class MB3_MeshCombinerSettings : ScriptableObject, MB_IMeshBakerSettingsHolder
  179. {
  180. public MB3_MeshCombinerSettingsData data;
  181. public MB_IMeshBakerSettings GetMeshBakerSettings()
  182. {
  183. return data;
  184. }
  185. public void GetMeshBakerSettingsAsSerializedProperty(out string propertyName, out UnityEngine.Object targetObj)
  186. {
  187. targetObj = this;
  188. propertyName = "data";
  189. }
  190. }
  191. }