public void UpdateNodeTargets() { for (int ch = 0; ch < painter.canvasChannelCount && ch < channelTargets.Count; ch++) { ChannelNodeTargets channelTarget = channelTargets[ch]; for (int i = 0; i < channelTarget.targets.Count; i++) { UpdateNodeTarget(channelTarget.targets[i]); } } }
public void AssignCanvas(params RenderTexture[] textures) { #if UNITY_EDITOR if (!Application.isPlaying) #if UNITY_5_3 || UNITY_5_3_OR_NEWER { UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(gameObject.scene); } #else { UnityEditor.EditorApplication.MarkSceneDirty(); } #endif #endif if (textures == null || textures.Length == 0 || textures.Any((RT) => RT == null)) { if (TCNode != null) { AssignToNode(Texture2D.blackTexture, TCNode); } for (int ch = 0; ch < channelTargets.Count; ch++) { ChannelNodeTargets channelTarget = channelTargets[ch]; for (int i = 0; i < channelTarget.targets.Count; i++) { AssignToNode(Texture2D.blackTexture, channelTarget.targets[i]); } } } else { if (TCNode != null) { AssignToNode(textures[0], TCNode); } for (int ch = 0; ch < painter.canvasChannelCount && ch < channelTargets.Count; ch++) { ChannelNodeTargets channelTarget = channelTargets[ch]; int texIndex = Mathf.Clamp(Mathf.FloorToInt((float)ch / 4), 0, textures.Length - 1); Painting.Channels texChannels = painter.canvasFormat == Painting.Format.Multi ? (Painting.Channels)(ch % 4 + 2) : Painting.Channels.RGBA; for (int i = 0; i < channelTarget.targets.Count; i++) { AssignToNode(textures[texIndex], texChannels, channelTarget.targets[i]); } } } painter.canvasRotation = transform.localRotation.eulerAngles.y / 180; if (!painter.isDrawing || Settings.autoGenerate) { if (TC_Generate.instance != null) { TC.AutoGenerate(FinalizeGenerateRect()); } } }