Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pymel.core import *
- #grass plane
- Plane = ls("pPlane1")[0]
- PlaneScale = Plane.getScale()
- #scale of grass object
- PlaneWidth = PlaneScale[0]
- PlaneHeight = PlaneScale[2]
- # get pixles from texture
- CellWidth = getAttr(Plane.getShape().listConnections()[1].subdivisionsWidth)
- CellHeight = getAttr(Plane.getShape().listConnections()[1].subdivisionsHeight)
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MakeTexture : MonoBehaviour {
- public Color StartColor;
- public Color EndColor;
- public int TextueWidth = 16;
- public int TextureHeight = 16;
- //public Color[] StartColorList;
- private Texture2D texture;
- private Color[] mapPixels;
- private int mapPixelLength;
- private float Timer = 0;
- public int Offseter = 0;
- void LoopThroughPixles()
- {
- for (var ix = 0; ix < mapPixelLength; ix++)
- {
- for (var iy = 0; iy < mapPixelLength; iy++)
- {
- texture.SetPixel(ix, iy, EndColor);
- }
- }
- texture.Apply(false);
- }
- void Start () {
- texture = new Texture2D(TextueWidth, TextureHeight);
- texture.filterMode = 0;
- GetComponent<Renderer>().material.mainTexture = texture;
- mapPixels = texture.GetPixels();
- mapPixelLength = mapPixels.Length;
- for (var ix = 0; ix < mapPixelLength; ix++)
- {
- for (var iy = 0; iy < mapPixelLength; iy++)
- {
- texture.SetPixel(ix, iy, StartColor);
- }
- }
- texture.Apply(false);
- }
- void Update()
- {
- LoopThroughPixles();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment