Create a gist now

Instantly share code, notes, and snippets.

anonymous /venus_applier.lsl
Created Dec 3, 2016

What would you like to do?
Specular map for venus anime head, doesn't break when link numbers update
//Specular map applier script for [M3+] - Venus Anime Head (v.1.12.17)
string specmap = "4c311c0a-c418-d649-cab8-3fae3e387e46"; // your specular map UUID
vector repeats = <10,10,0>; // horizontal and vertical repeats
vector offsets = <0,0,0>; // horizontal and vertical offsets
float rot = 0.0; // texture angle
integer gloss = 25; // glossyness
integer env = 7; // environment reflection
vector color = <1.000, 1.000, 1.000>; // specular color
// Shouldn't have to edit below here.
integer LINK_NONE = -99;
integer getNumberOfPrims() {
return (llGetObjectPrimCount(llGetKey()) + llGetNumberOfPrims() * !!llGetAttached());
}
integer getLinkNum(string link_name) {
if (link_name == "MAIN_PRIM") {
return LINK_ROOT;
}
integer prim_count = getNumberOfPrims();
integer link = 1;
do {
if(llGetLinkName(link) == link_name)
return link;
}
while(link++ < prim_count);
return LINK_NONE;
}
applySpecMaps() {
setLinkSpec("MAIN_PRIM", [0, 1]);
setLinkSpec("blink0", [0, 3]);
setLinkSpec("blink1", [0, 3]);
setLinkSpec("blink2", [0, 3]);
setLinkSpec("blink3", [0, 4]);
setLinkSpec("brow0", [0, 3]);
setLinkSpec("brow1", [0, 3]);
setLinkSpec("brow2", [0, 3]);
setLinkSpec("e01", [0, 2]);
setLinkSpec("e02", [0, 2]);
setLinkSpec("e03", [0, 3]);
setLinkSpec("e04", [0, 3]);
setLinkSpec("e05", [0, 2]);
setLinkSpec("e06", [0, 2]);
setLinkSpec("e07", [0, 3]);
setLinkSpec("e08", [0, 2]);
setLinkSpec("e09", [0, 2]);
setLinkSpec("e10", [0, 3]);
setLinkSpec("e11", [0, 2]);
setLinkSpec("e12", [0, 2]);
setLinkSpec("e13", [0, 2]);
setLinkSpec("ears", [0, 1, 2, 3]);
}
setLinkSpec(string link_name, list faces) {
integer link_num = getLinkNum(link_name);
if (link_num == LINK_NONE) {
llOwnerSay("Couldn't find " + link_name + " link???");
return;
}
integer i;
for(i=0; i<llGetListLength(faces); ++i) {
integer face_num = llList2Integer(faces, i);
llSetLinkPrimitiveParamsFast(link_num, [
PRIM_SPECULAR, face_num, specmap, repeats, offsets, rot, color, gloss, env,
PRIM_ALPHA_MODE, face_num, 0, 0
]);
}
}
default {
state_entry() {
applySpecMaps();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment