Guest User

Untitled

a guest
Aug 10th, 2021
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. //Batch paste edits to multiple shaders in Maker
  2. //Change the two lines below to the start and end slots, copy/paste everything in to the C# REPL Console
  3. //Need to Copy Edits of the material you want to be copied first
  4. //Press Pause Break to open Console
  5. //Change main_item_emission to the shader you want changed
  6. //If you want to copy your edits to EVERY shader, change everyShader's false to true
  7. //The script will fail to run the first time with errors showing up that types are defined multiple times but that's fine just run the script again and it will work.
  8.  
  9. int accessorySlotStart = 1;
  10. int accessorySlotEnd = 20;
  11. string shader = "Shader Forge/main_item_emission";
  12. bool everyShader = false;
  13.  
  14. KK_Plugins.MaterialEditor.MaterialEditorCharaController meController = GameObject.FindObjectOfType<KK_Plugins.MaterialEditor.MaterialEditorCharaController>();
  15. for (int i = accessorySlotStart - 1; i < accessorySlotEnd; i++)
  16. {
  17. var acc = KKAPI.Maker.AccessoriesApi.GetAccessoryObject(meController.ChaControl, i);
  18. if (acc != null)
  19. {
  20. foreach (Renderer rend in acc.GetComponentsInChildren<Renderer>())
  21. {
  22. foreach (Material mat in MaterialEditorAPI.MaterialAPI.GetMaterials(acc, rend))
  23. {
  24. Console.WriteLine(mat.shader.ToString());
  25. if (!everyShader)
  26. {
  27. if (mat.shader.ToString().Equals(shader+" (UnityEngine.Shader)"))
  28. meController.MaterialPasteEdits(i, KK_Plugins.MaterialEditor.MaterialEditorCharaController.ObjectType.Accessory, mat, acc);
  29. }
  30. else
  31. meController.MaterialPasteEdits(i, KK_Plugins.MaterialEditor.MaterialEditorCharaController.ObjectType.Accessory, mat, acc);
  32. }
  33. }
  34. }
  35. }
  36.  
Add Comment
Please, Sign In to add comment