Advertisement
Edie_Shoreland

Roz's Texture information Finder

Mar 27th, 2019
699
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Roz's llSetLinkPrimitiveParams Texture Info Sender.
  2. //Set up to work with Texture Info HUD and Receiver
  3.  
  4. //FIXED: Deleted comma in overflow string  4-15-19
  5.  
  6. //WARNING: YOU MUST HAVE FULL PERMISSIONS ON TEXTURES
  7. //AND THE OBJECTS YOU'RE TEXTURING FOR THIS TO WORK.
  8. //PRIM_TEXTURE DOES NOT RETURN A UUID FOR OBJECTS THAT
  9. //ARE NOT FULL PERM.
  10.  
  11. //Change textures on multilinked objects and get the
  12. //llSetLinkPrimitiveParamsFast and llSetPrimitiveParams
  13. //PRIM_TEXTURE and PRIM_COLOR information back in local
  14. //chat to cut and paste into texture change scripts.
  15. //Texture your model the way you want it, pop in the
  16. //script, and get the LSL settings for recreating your
  17. //texture information in a script friendly format.
  18.  
  19. //THIS IS THE CREATOR'S SCRIPT, DON'T PUT THIS SCRIPT
  20. //IN AN ACTUAL PRODUCT TO BE SOLD.  Rez a copy of the
  21. //clothing item you will use to test your textures on.  
  22. //Put this script in the test version to record your
  23. //texture and color edits.  The information you see in
  24. //chat will be what you want to paste into your customer
  25. //script.
  26.  
  27. //Change the object description in your test model to
  28. //what you want your texture preset to be called. Using
  29. //user-defined functions to store texture information
  30. //avoids the hassle with notecard and dataserver events.
  31.  
  32. integer primFaces;
  33. integer primz;
  34. integer primLoop;
  35. integer faceLoop;
  36. integer facez;
  37. integer spamzy;
  38.  
  39. primLink()
  40. {
  41.     primz = llGetObjectPrimCount(llGetKey());
  42.     list textureInfo;
  43.     list colorInfo;
  44.     string infochat;
  45.     string colorchat;
  46.     string overflow;
  47.     string fName = llGetObjectDesc( );
  48.     integer colorCheck;
  49.     integer textureOverflow;
  50.     integer multiPrim = FALSE;
  51.     integer OFi; //overflow index
  52.     if (primz > 1) multiPrim = TRUE;
  53.     //llSay (0, fName + "( ) {");
  54.  
  55.     for (primLoop=multiPrim; primLoop<=(primz * multiPrim); primLoop++)
  56.     //Gets information for every link
  57.     {
  58.         primFaces = llGetLinkNumberOfSides(primLoop);
  59.         if (primFaces > 6) textureOverflow = TRUE;
  60.         else textureOverflow = FALSE;
  61.         colorchat = overflow = infochat = "llSetLinkPrimitiveParamsFast (" + (string)primLoop + ", [";
  62.         if (!multiPrim) colorchat = overflow = infochat = "llSetPrimitiveParams([";
  63.         colorchat = "llSetLinkPrimitiveParamsFast (" + (string)primLoop + ", [";
  64.         colorCheck = FALSE;
  65.  
  66.         for (faceLoop=0; faceLoop<primFaces; faceLoop++)
  67.         //Gets information for every face
  68.         {
  69.             textureInfo = llGetLinkPrimitiveParams(primLoop,[PRIM_TEXTURE,faceLoop]);
  70.             textureInfo = llListReplaceList(textureInfo, ["\"" + llList2String(textureInfo,0) + "\""],0,0);
  71.             colorInfo = llGetLinkPrimitiveParams(primLoop,[PRIM_COLOR,faceLoop]);
  72.             if (faceLoop > 0)
  73.             {
  74.                 colorchat = colorchat + ", ";
  75.                 infochat = infochat + ", ";//Adds commas except at the end
  76.             }
  77.             infochat = infochat + "PRIM_TEXTURE, " + (string)faceLoop + ", " + llList2CSV(textureInfo);
  78.             colorchat = colorchat + "PRIM_COLOR, " + (string)faceLoop + ", " + llList2CSV(colorInfo);
  79.             if (llList2Vector(colorInfo,0) != <1.00,1.00,1.00>) colorCheck=TRUE;
  80.         }
  81.         if (textureOverflow) //Split the information in chat
  82.         {
  83.             //Don't let chat character limits render the code
  84.             //useless, it should still be able to be cut and
  85.             //pasted into a script with as little editing as
  86.             //possible.
  87.             OFi = llSubStringIndex(infochat, ", PRIM_TEXTURE, 4");
  88.             overflow = overflow + llGetSubString(infochat, OFi + 2, -1);
  89.             infochat = llDeleteSubString(infochat, OFi, -1);
  90.         }                
  91.         infochat = infochat + "] );";
  92.         colorchat = colorchat + "] );";
  93.        
  94.         //The next part sends the information into local chat
  95.         //from your editing copy to be used in a script for
  96.         //to put into your finished product.
  97.  
  98.         //if you need an extra set of eyes....
  99.         llSay(0, infochat); //llSay instead of llOwnerSay, should you need an extra set of eyes.
  100.         if (textureOverflow) llSay(0, overflow + "] );");
  101.         if (colorCheck) llSay(0, colorchat);
  102.  
  103.         //or, if you don't need help...
  104.         //llOwnerSay(infochat);
  105.         //if (textureOverflow) llOwnerSay(0, overflow + "] );");
  106.         //if (colorCheck) llOwnerSay(0, colorchat);
  107.  
  108.     }
  109.     //llSay(0, "} //End "+ fName);
  110. }
  111.  
  112. default
  113. {
  114.     state_entry()
  115.     {
  116.         primLink();
  117.     }
  118.    
  119.     changed(integer change)
  120.     {
  121.         //If multiple changes to link order are made, there's no
  122.         //need to continuously spam the owner with updates.
  123.         if (spamzy == FALSE)
  124.         {
  125.             if (change & (CHANGED_COLOR|CHANGED_TEXTURE))
  126.             {
  127.                 llOwnerSay ("Touch me, once you're finished editing, to update the object's texture information.");
  128.                 //llSay (0, "Touch me, once you're finished editing, to update the object's texture information.");
  129.                 spamzy = TRUE;
  130.             }
  131.         }    
  132.     }
  133.  
  134.     touch_start(integer total_number)
  135.     {
  136.         //Let's update the information for all links
  137.         llResetScript();
  138.     }
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement