Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texture Replacing? #19

Closed
innercircus opened this issue Jun 12, 2013 · 3 comments
Closed

Texture Replacing? #19

innercircus opened this issue Jun 12, 2013 · 3 comments

Comments

@innercircus
Copy link

I've been scouring the internet looking for how to go about this but for the life of me I can not get this to work. The scenario is I'd like to run my fancy script that replaces colors within a texture by creating a new texture. I would like LWF to use my new textures. I'm assuming I would use LWF.Format.TextureReplacement() however, I am completely at a loss on how or if this works?

@splhack
Copy link
Contributor

splhack commented Jun 13, 2013

Would you try it? The latest lwf is required.

var cache = LWF.UnityRenderer.ResourceCache.SharedInstance().textureCache;
if (cache != null) {
    var key = "lwf_filename/texture_filename_for_replacement";
    if (cache.ContainsKey(key)) {
        var cache_item = cache[key];
        var tex_context = cache_item.Entity();
        tex_context.material.mainTexture = texture2d_instance_for_replacement;
    }
}

@HiroyukiHaga
Copy link
Contributor

Here is a texture replacement example for you.
This example replaces any textures in swf files with a cat texture which is in Resoruce/textures/ folder.

Source

Build

13 06 13 13 03

13 06 13 13 06

@innercircus
Copy link
Author

This worked awesome! Thanks so much! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants