public void AddTexture() { P3D_PaintableTexture item = new P3D_PaintableTexture(); this.Textures ??= new List <P3D_PaintableTexture>(); this.Textures.Add(item); }
private bool NameOob(P3D_Paintable paintable, P3D_PaintableTexture texture) { var renderer = paintable.GetComponent <Renderer>(); if (renderer != null) { if (texture.MaterialIndex >= 0) { var materials = renderer.sharedMaterials; if (texture.MaterialIndex < materials.Length) { var material = materials[texture.MaterialIndex]; var names = P3D_Helper.GetTexEnvNames(material); if (names.Contains(texture.TextureName) == true) { return(false); } } } } return(true); }
public void AddTexture() { var texture = new P3D_PaintableTexture(); if (Textures == null) { Textures = new List <P3D_PaintableTexture>(); } Textures.Add(texture); }
public void Paint(P3D_Brush brush, P3D_Result result, int groupMask = -1) { if ((result != null) && (this.Textures != null)) { for (int i = this.Textures.Count - 1; i >= 0; i--) { P3D_PaintableTexture texture = this.Textures[i]; if ((texture != null) && P3D_Helper.IndexInMask((int)texture.Group, groupMask)) { texture.Paint(brush, result.GetUV(texture.Coord)); } } } }
public void Paint(P3D_Brush brush, Vector2 uv, int groupMask = -1) { if (this.Textures != null) { for (int i = this.Textures.Count - 1; i >= 0; i--) { P3D_PaintableTexture texture = this.Textures[i]; if ((texture != null) && P3D_Helper.IndexInMask((int)texture.Group, groupMask)) { texture.Paint(brush, uv); } } } }
private bool MaterialOob(P3D_Paintable paintable, P3D_PaintableTexture texture) { var renderer = paintable.GetComponent <Renderer>(); if (renderer != null) { if (texture.MaterialIndex >= 0 && texture.MaterialIndex < renderer.sharedMaterials.Length) { return(false); } } return(true); }
protected virtual void Awake() { if (this.Textures != null) { for (int i = this.Textures.Count - 1; i >= 0; i--) { P3D_PaintableTexture texture = this.Textures[i]; if (texture != null) { texture.Awake(base.gameObject); } } } this.UpdateTree(); }
protected virtual void Update() { this.applyCooldown -= Time.deltaTime; if ((this.applyCooldown <= 0f) && (this.Textures != null)) { this.applyCooldown = this.ApplyInterval; for (int i = this.Textures.Count - 1; i >= 0; i--) { P3D_PaintableTexture texture = this.Textures[i]; if ((texture != null) && (texture.Painter != null)) { texture.Painter.Apply(); } } } this.updateCooldown -= Time.deltaTime; }