Edie_Shoreland icon

Roz's Texture information Finder

Edie_Shoreland | PRO | 03/27/19 03:43:00 PM UTC | 0 ⭐ | 9558 👁️ | Never ⏰ | []
Linden Scripting |

0 B

|

None

|

0 👍

/

0 👎

//Roz's llSetLinkPrimitiveParams Texture Info Sender.
//Set up to work with Texture Info HUD and Receiver
 
//FIXED: Deleted comma in overflow string  4-15-19
 
//WARNING: YOU MUST HAVE FULL PERMISSIONS ON TEXTURES
//AND THE OBJECTS YOU'RE TEXTURING FOR THIS TO WORK.
//PRIM_TEXTURE DOES NOT RETURN A UUID FOR OBJECTS THAT
//ARE NOT FULL PERM.
 
//Change textures on multilinked objects and get the 
//llSetLinkPrimitiveParamsFast and llSetPrimitiveParams
//PRIM_TEXTURE and PRIM_COLOR information back in local
//chat to cut and paste into texture change scripts.
//Texture your model the way you want it, pop in the
//script, and get the LSL settings for recreating your
//texture information in a script friendly format.
 
//THIS IS THE CREATOR'S SCRIPT, DON'T PUT THIS SCRIPT
//IN AN ACTUAL PRODUCT TO BE SOLD.  Rez a copy of the 
//clothing item you will use to test your textures on.  
//Put this script in the test version to record your 
//texture and color edits.  The information you see in
//chat will be what you want to paste into your customer
//script.
 
//Change the object description in your test model to 
//what you want your texture preset to be called. Using
//user-defined functions to store texture information
//avoids the hassle with notecard and dataserver events.
 
integer primFaces;
integer primz;
integer primLoop;
integer faceLoop;
integer facez;
integer spamzy;
 
primLink()
{
    primz = llGetObjectPrimCount(llGetKey());
    list textureInfo;
    list colorInfo;
    string infochat;
    string colorchat;
    string overflow;
    string fName = llGetObjectDesc( );
    integer colorCheck;
    integer textureOverflow;
    integer multiPrim = FALSE;
    integer OFi; //overflow index
    if (primz > 1) multiPrim = TRUE;
    //llSay (0, fName + "( ) {");
 
    for (primLoop=multiPrim; primLoop<=(primz * multiPrim); primLoop++) 
    //Gets information for every link
    {
        primFaces = llGetLinkNumberOfSides(primLoop);
        if (primFaces > 6) textureOverflow = TRUE;
        else textureOverflow = FALSE;
        colorchat = overflow = infochat = "llSetLinkPrimitiveParamsFast (" + (string)primLoop + ", [";
        if (!multiPrim) colorchat = overflow = infochat = "llSetPrimitiveParams([";
        colorchat = "llSetLinkPrimitiveParamsFast (" + (string)primLoop + ", [";
        colorCheck = FALSE;
 
        for (faceLoop=0; faceLoop<primFaces; faceLoop++)
        //Gets information for every face
        {
            textureInfo = llGetLinkPrimitiveParams(primLoop,[PRIM_TEXTURE,faceLoop]);
            textureInfo = llListReplaceList(textureInfo, ["\"" + llList2String(textureInfo,0) + "\""],0,0);
            colorInfo = llGetLinkPrimitiveParams(primLoop,[PRIM_COLOR,faceLoop]);
            if (faceLoop > 0)
            {
                colorchat = colorchat + ", ";
                infochat = infochat + ", ";//Adds commas except at the end
            }
            infochat = infochat + "PRIM_TEXTURE, " + (string)faceLoop + ", " + llList2CSV(textureInfo);
            colorchat = colorchat + "PRIM_COLOR, " + (string)faceLoop + ", " + llList2CSV(colorInfo);
            if (llList2Vector(colorInfo,0) != <1.00,1.00,1.00>) colorCheck=TRUE;
        }
        if (textureOverflow) //Split the information in chat
        {
            //Don't let chat character limits render the code
            //useless, it should still be able to be cut and
            //pasted into a script with as little editing as 
            //possible.
            OFi = llSubStringIndex(infochat, ", PRIM_TEXTURE, 4");
            overflow = overflow + llGetSubString(infochat, OFi + 2, -1);
            infochat = llDeleteSubString(infochat, OFi, -1);
        }                
        infochat = infochat + "] );";
        colorchat = colorchat + "] );";
        
        //The next part sends the information into local chat
        //from your editing copy to be used in a script for 
        //to put into your finished product.
 
        //if you need an extra set of eyes....
        llSay(0, infochat); //llSay instead of llOwnerSay, should you need an extra set of eyes.
        if (textureOverflow) llSay(0, overflow + "] );");
        if (colorCheck) llSay(0, colorchat);
 
        //or, if you don't need help...
        //llOwnerSay(infochat);
        //if (textureOverflow) llOwnerSay(0, overflow + "] );");
        //if (colorCheck) llOwnerSay(0, colorchat);
 
    }
    //llSay(0, "} //End "+ fName);
}
 
default
{
    state_entry()
    { 
        primLink();
    }
    
    changed(integer change)
    {
        //If multiple changes to link order are made, there's no
        //need to continuously spam the owner with updates.
        if (spamzy == FALSE)
        {
            if (change & (CHANGED_COLOR|CHANGED_TEXTURE))
            {
                llOwnerSay ("Touch me, once you're finished editing, to update the object's texture information.");
                //llSay (0, "Touch me, once you're finished editing, to update the object's texture information.");
                spamzy = TRUE;
            }
        }    
    }
 
    touch_start(integer total_number)
    {
        //Let's update the information for all links
        llResetScript();
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎