<commit_before>﻿using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;


public class LpcSpriteProcessor : AssetPostprocessor {

	enum LpcAnimationState
	{
		Hurt,
		Shoot,
		Slash,
		Walkcycle,
		Thrust,
		Spellcast
	}

	private const int LPC_SHEET_WIDTH  = 832;
	private const int LPC_SHEET_HEIGHT = 1344;
	private const int LPC_SPRITE_SIZE  = 64;

	private int m_PixelsPerUnit; // Sets the Pixels Per Unit in the Importer
	private int m_ScFrames;      // Spellcast animation frames
	private int m_ThFrames;      // Thrust animation frames
	private int m_WcFrames;      // Walkcycle animation frames
	private int m_SlFrames;      // Slash animation frames
	private int m_ShFrames;      // Shoot animation frames
	private int m_HuFrames;      // Hurt animation frames

	private bool m_ImportEmptySprites;
	private int m_ColCount;
	private int m_RowCount;

	void RetrieveSettings(){
		// Retrieve Basic Settings
		m_ImportEmptySprites = LpcSpriteSettings.GetImportEmptySprites();
		m_PixelsPerUnit = LpcSpriteSettings.GetPixelsPerUnit ();

		// Retrieve Animation Settings
		m_ScFrames = LpcSpriteSettings.GetScFrameCount();
		m_ThFrames = LpcSpriteSettings.GetThFrameCount();
		m_WcFrames = LpcSpriteSettings.GetWcFrameCount();
		m_SlFrames = LpcSpriteSettings.GetSlFrameCount();
		m_ShFrames = LpcSpriteSettings.GetShFrameCount();
		m_HuFrames = LpcSpriteSettings.GetHuFrameCount();

		// Retrieve Other Settings
		m_ColCount = LpcSpriteSettings.GetColCount();
		m_RowCount = LpcSpriteSettings.GetRowCount();
	}

	void OnPreprocessTexture()
	{
		RetrieveSettings ();
		TextureImporter textureImporter = (TextureImporter)assetImporter;
		textureImporter.textureType = TextureImporterType.Sprite;
		textureImporter.spriteImportMode = SpriteImportMode.Multiple;
		textureImporter.mipmapEnabled = false;
		textureImporter.filterMode = FilterMode.Point;
		textureImporter.spritePixelsPerUnit = m_PixelsPerUnit;
	}

	public void OnPostprocessTexture (Texture2D texture)
	{
		// Do nothing if it not a LPC Based Sprite<commit_msg>Fixed PreProcess modifying non LPC assets<commit_after>﻿using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;


public class LpcSpriteProcessor : AssetPostprocessor {

	enum LpcAnimationState
	{
		Hurt,
		Shoot,
		Slash,
		Walkcycle,
		Thrust,
		Spellcast
	}

	private const int LPC_SHEET_WIDTH  = 832;
	private const int LPC_SHEET_HEIGHT = 1344;
	private const int LPC_SPRITE_SIZE  = 64;

	private int m_PixelsPerUnit; // Sets the Pixels Per Unit in the Importer
	private int m_ScFrames;      // Spellcast animation frames
	private int m_ThFrames;      // Thrust animation frames
	private int m_WcFrames;      // Walkcycle animation frames
	private int m_SlFrames;      // Slash animation frames
	private int m_ShFrames;      // Shoot animation frames
	private int m_HuFrames;      // Hurt animation frames

	private bool m_ImportEmptySprites;
	private int m_ColCount;
	private int m_RowCount;

	void RetrieveSettings(){
		// Retrieve Basic Settings
		m_ImportEmptySprites = LpcSpriteSettings.GetImportEmptySprites();
		m_PixelsPerUnit = LpcSpriteSettings.GetPixelsPerUnit ();

		// Retrieve Animation Settings
		m_ScFrames = LpcSpriteSettings.GetScFrameCount();
		m_ThFrames = LpcSpriteSettings.GetThFrameCount();
		m_WcFrames = LpcSpriteSettings.GetWcFrameCount();
		m_SlFrames = LpcSpriteSettings.GetSlFrameCount();
		m_ShFrames = LpcSpriteSettings.GetShFrameCount();
		m_HuFrames = LpcSpriteSettings.GetHuFrameCount();

		// Retrieve Other Settings
		m_ColCount = LpcSpriteSettings.GetColCount();
		m_RowCount = LpcSpriteSettings.GetRowCount();
	}

	void OnPreprocessTexture()
	{
		Texture2D texture = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture2D)) as Texture2D);
		if (!IsLpcSpriteSheet(texture))
			return;
		
		RetrieveSettings ();
		TextureImporter textureImporter = (TextureImporter)assetImporter;
		textureImporter.textureType = TextureImporterType.Sprite;
		textureImporter.spriteImportMode = SpriteImportMode.Multiple;
		textureImporter.mipmapEnabled = false;
		textureImporter.filterMode = FilterMode.Point;
		textureImporter.spritePixelsPerUnit = m_PixelsPerUnit;
	}

	public void OnPostprocessTexture (Texture2D texture)
	{
		// Do nothing if it not a LPC Based Sprite
{'fraction_non_alphanumeric': 0.07031793919702947, 'fraction_numerical': 0.005337665351589696, 'mean_word_length': 4.863945578231292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '663133', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1362, 'n_words': 317}