Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2016 13:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/1bf264e815c5b4222995fcb4ac0f35a7 to your computer and use it in GitHub Desktop.
// Normal and specular map applier script for Kemono - Body (v.1.13.25+)
// If you want to use this with any other version of the M3 head or the venus head or the kemono body or whatever, you will need to figure out the link names and face numbers and replace them in the script.
string specmap = "<UUID goes here>"; // your specular map UUID
vector repeats = <20, 20, 0>; // horizontal and vertical repeats
vector offsets = <0, 0, 0>; // horizontal and vertical offsets
float rot = 0.0; // texture angle
integer gloss = 51; // glossiness
integer env = 0; // environment reflection
vector color = <1.000, 1.000, 1.000>; // specular color
key normal = "<UUID goes here>"; // your normal map UUID
vector Nrepeats = <1, 1, 0>; // horizontal and vertical repeats for normals
vector Noffsets = <0, 0, 0>; // horizontal and vertical offsets for normals
float Nrot = 0.0; // texture angle for normals
// change this if kemono body link names / face numbers change
applySpecMaps() {
// "link_name", [face_1, face_2, ...]
applyLinkSpec("arms", [0, 1, 2, 3, 4, 5, 6, 7]);
applyLinkSpec("neck", [0, 1, 2, 3, 4, 5, 6, 7]);
applyLinkSpec("hips", [0, 1, 2, 3, 4, 5, 6, 7]);
applyLinkSpec("body", [0, 1, 2, 3, 4, 5, 6, 7]);
applyLinkSpec("Lhand", [0, 1, 2, 3, 4]);
applyLinkSpec("Rhand", [0, 1, 2, 3, 4]);
applyLinkSpec("LFleg", [0, 1, 2, 3, 4, 5, 6]);
applyLinkSpec("LHleg", [0, 1, 2, 3, 4, 5, 6]);
applyLinkSpec("RFleg", [0, 1, 2, 3, 4, 5, 6]);
applyLinkSpec("RHleg", [0, 1, 2, 3, 4, 5, 6]);
applyLinkSpec("PG", [0, 1, 2, 3]);
}
// 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;
}
applyLinkSpec(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,
PRIM_NORMAL, face_num, normal, Nrepeats, Noffsets, Nrot
]);
}
}
default {
state_entry() {
applySpecMaps();
}
}
// Specular map applier script for [M3+] - Venus Anime Head (v.1.12.17)
// If you want to use this with any other version of the M3 head or the venus head or the kemono body or whatever, you will need to figure out the link names and face numbers and replace them in the script.
string specmap = "<UUID goes here>"; // 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 = 51; // glossiness
integer env = 0; // environment reflection
vector color = <1.000, 1.000, 1.000>; // specular color
key normal = "<UUID goes here>"; // your normal map UUID (if applicable)
vector Nrepeats = <1, 1, 0>; // horizontal and vertical repeats for normals
vector Noffsets = <0, 0, 0>; // horizontal and vertical offsets for normals
float Nrot = 0.0; // texture angle for normals
// change this if venus head link names / face numbers change
applySpecMaps() {
// "link_name", [face_1, face_2, ...]
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]);
}
// 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;
}
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,
PRIM_NORMAL, face_num, normal, Nrepeats, Noffsets, Nrot
]);
}
}
default {
state_entry() {
applySpecMaps();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment