Skip to content

Texture Replacer: A Free SL Script

Texture Replacer for Linked Prims

(Change Texture Script – A Great Aid for Creators)

This script may be used to replace one or more textures on linked prims.  It’s ideal for replacing textures in hair, dresses made of a series of prims, jewelry, and other multi-prim builds and objects.

It does a face-to-face search and replace.  So if you needed to replace Texture 1  with Texture 2 on the Face #3 on all of the prims of an object, it would do that.  If Texture 1 is only found on Face #3 of Prim # 4, it will just replace that texture on that face on that prim.  In addition to replacing the texture, it will also copy the three other texture characteristics (repeats, offset &  rotation) from the old texture to the new.

A Big Help If You Are a Creator

You’ll find this script very handy if you create things in Second Life.  Second Life isn’t always reliable when you select a series of prims and manually change the texture en masse.  It may look as if all of the prims have picked up the new texture, but upon re-rezzing, you may find some of the prims were missed.  Additionally, for some types of clothing, jewelry, hair and other builds, it may be very difficult to select all of the prims that need to be re-texturized.

The script uses texture names to do its work.  That means you don’t have to visually hunt down and locate all of the prims that need to be changed – especially those difficult, hard-to-reach prims found under other prims.  Re-texturizing has never been easier.

How it Works

The script must have some way to identify each of set of textures: the original set and the new set. You do that by adding the prefix “A_” or “B_” to your texture names.

For example let’s say “A_HairTexture1” and “B_HairTexture” are the names of the textures in a hair style that you have created.

Let’s also say that the names of the textures that you want to replace them with are “A_HairTextureNew” and “B_HairTextureNew.”

If you name the textures in this manner, then this script will replaced “A_HairTexture” with “A_HairTextureNew” and replace “B_HairTexture” with “B_HairTextureNew.”

The rest of the name doesn’t matter.  You just must have the   “A_” and “B_” at the beginning.

The textures you are replacing  – including the old textures plus the new textures which will replace the old ones – need to be placed in the contents of the root prim of the linked prims.  That’s the only place you need to place them.  They do NOT need to be placed in every linked prim.

What if the Original Textures Aren’t Named in this Manner?

No problem.

Let’s say that the original textures are NOT named with the “A_” and “B_” prefixes.  It still works.

If for instance, the original object was made up “HairTexture1” and “HairTexture2,” all that is necessary is to place the two textures in the object’s content.  Then rename them.

It’s easiest to rename them right in the object’s content.   So, once they are in the contents, right click on one and select “Rename” from the menu.  Using our example from above, “HairTexture1” would renamed “A_HairTexture1.” “HairTexture2” would be renamed “B_HairTexture2.”

The Script Can Handle Several Textures at Once

So far I’ve given examples of two replacements, but the script handles more than two.  You can have three (A_, B_, C_) or four (A_, B_, C_, D_) or more.  In the script package described below, I have included a demonstration object in which five (5) different textures on different faces are changed.

Just one thing to keep in mind.  You must have full permissions of the textures for the script to work properly.

Don’t Like the New Texture?  Need to Return to the Original Texture?

That’s really easy.

Let’s say that you are replacing the textures in a dress.  If, after you run the  script, you don’t like the look of the dress.  Wait until the script stops, and run the script again and the original textures will be restored.

It’s not necessary to change any of the textures in the object’s content.  When it runs  a second time, the script will replace the new textures with the original.

Recompile the Script When Adding or Changing Textures

Whenever you add textures to the contents of the parent prim, be sure to re-compile the script.  Otherwise, the script will act upon the previous contents and you’ll get weird results.  Use the “Mono” option when you re-compile.

Free Script Package

The re-texturizer script is available in a complete package.

The package includes a full permissions script and three different demonstration objects that you can try out.  The included demonstration objects include a flexi-prim skirt, hair mounted on a mannequin, and a multi-prim build that includes five (5) different textures on different faces.

The free package is available at my store.  I only ask for one small favor.  While you are at my store, I would be grateful if you added the store to your “Picks.”  (If you’ve never added a store to your picks, here how to do it in two illustrations:  Adding a Pick )

Look for the following display:

TextureReplacerPoster

.

More Information on the Demonstration Objects

Let’s look at each of the demonstration objects that come in the script package.  To run the scripts you’ll need to go to a sandbox or someplace where you can rez prims.

 

  • Flexi-prim Dress.  In the package, look for: Demonstration: Re-texture One (1) Texture on Multi-prim Skirt.
    .

    Drag it out of your inventory and rez it on the ground.  What appears is a typical flexi-prim dress with eight dress panels.  The original red plaid texture has been applied to all sides of the panels.   The script has been placed in the contents.
    .
    Clicking on the dress activates the script.  Each of the red plaid textures of the dress are replaced with the new green plaid texture.  If you want to return to the original red plaid, click on the dress again.

 

  • Hair.  The re-texturizing script is a godsend when it comes to hair.  I’ve spent hours re-texturizing individual hair strands.  And have you ever tried to select hair strands which lie beneath outer strands?  Oh, what a huge headache!  But no more with this script.  It’s a piece of cake.
    .
    Look for “Demonstration: Re-texture HAIR – Two (2) Textures & Faces.”  Rez it.
    .
    Yes, I know.  The demonstration hair style is a little on the unbalanced side.  I removed the back part of the hair to keep the prim count low in case you might be trying this some place where prims are limited.  Nonetheless, you’ll see that it demonstrates hair re-texturing quite well.
    .
    In this hair style, there are two different types of textures used: one is used for the hair covering, the part of the hair which covers the head.  The other texture is used for the flexible strands. The hair covering texture extends through all faces, but the hair strand texture has only been applied to the faces #2 and #4.
    .
    The other faces on the strand (faces 1,3,5 and 6) are invisible.  Why is that?  If a texture is applied to those faces, the hair would show unappealing lines along the edges of flexible strands.  So when the replacement is done, we want to make sure the invisible faces remain that way.
    .
    Give it a try.  Click on the hair.  Lo and behold, you’ll see that only faces #2 and #4 are replaced.  The hair covering is also replaced with its own texture.  Don’t like the brown texture?  Click on the hair again and you’ll return to the original white.

 

  • Multi-prim Build.  Look for “Demonstation: Re-texture Five (5) Textures & Multi-faces.  Rez it.
    .
    This build consists of a series of blocks linked together with five (5) different textures.  The textures are on different faces.  The faces with no texture have been colored.
    .
    Click on the build and watch all five of the textures change.  You’ll notice that the colored faces remain unchanged – as they should.  The faces with the textures change to the new set.  (Yes.  I’m having a little fun with this one.  You’ll notice that the “American Gothic” painting changes to “The Scream.”)  Try clicking on it again and the original textures re-appear.

 

Just a reminder.  When you try this on your own projects, be sure to re-compile the script (in “Mono”) whenever you add or change textures.  Enjoy!

 

_______

Key Words:  Change Texture Script, Second Life Scripts, Changing Textures, Second Life Change Texture, Replacing Texture, Re-texturizing, Texture Script, LSL Replace Texture, LSL Replace Texture

 

Advertisements
%d bloggers like this: