/// <summary> /// Deep copy of the OverlayColorData. /// </summary> public OverlayColorData Duplicate() { var res = new OverlayColorData(); res.name = name; res.channelMask = new Color[channelMask.Length]; for (int i = 0; i < channelMask.Length; i++) { res.channelMask[i] = channelMask[i]; } res.channelAdditiveMask = new Color[channelAdditiveMask.Length]; for (int i = 0; i < channelAdditiveMask.Length; i++) { res.channelAdditiveMask[i] = channelAdditiveMask[i]; } if (PropertyBlock != null) { res.PropertyBlock = new UMAMaterialPropertyBlock(); res.PropertyBlock.shaderProperties = new List <UMAProperty>(PropertyBlock.shaderProperties.Count); for (int i = 0; i < PropertyBlock.shaderProperties.Count; i++) { UMAProperty up = PropertyBlock.shaderProperties[i]; if (up != null) { res.PropertyBlock.shaderProperties.Add(up.Clone()); } } } return(res); }
public void AssignFrom(OverlayColorData src) { if (src.name != null) { name = String.Copy(src.name); } EnsureChannels(src.channelMask.Length); for (int i = 0; i < src.channelMask.Length; i++) { channelMask[i] = src.channelMask[i]; } for (int i = 0; i < src.channelAdditiveMask.Length; i++) { channelAdditiveMask[i] = src.channelAdditiveMask[i]; } PropertyBlock = new UMAMaterialPropertyBlock(); if (src.PropertyBlock != null) { PropertyBlock.shaderProperties = new List <UMAProperty>(src.PropertyBlock.shaderProperties.Count); for (int i = 0; i < src.PropertyBlock.shaderProperties.Count; i++) { UMAProperty up = src.PropertyBlock.shaderProperties[i]; PropertyBlock.shaderProperties.Add(up.Clone()); } } }