bool LLTextureEntry::fromLLSD(LLSD& sd) { const char *w, *x; w = "imageid"; if (sd.has(w)) { setID( sd[w] ); } else goto fail; w = "colors"; if (sd.has(w)) { setColor( ll_color4_from_sd(sd["colors"]) ); } else goto fail; w = "scales"; x = "scalet"; if (sd.has(w) && sd.has(x)) { setScale( (F32)sd[w].asReal(), (F32)sd[x].asReal() ); } else goto fail; w = "offsets"; x = "offsett"; if (sd.has(w) && sd.has(x)) { setOffset( (F32)sd[w].asReal(), (F32)sd[x].asReal() ); } else goto fail; w = "imagerot"; if (sd.has(w)) { setRotation( (F32)sd[w].asReal() ); } else goto fail; w = "bump"; if (sd.has(w)) { setBumpShiny( sd[w].asInteger() ); } else goto fail; w = "fullbright"; if (sd.has(w)) { setFullbright( sd[w].asInteger() ); } else goto fail; w = "media_flags"; if (sd.has(w)) { setMediaTexGen( sd[w].asInteger() ); } else goto fail; w = "glow"; if (sd.has(w)) { setGlow((F32)sd[w].asReal() ); } return true; fail: return false; }
bool LLTextureEntry::fromLLSD(const LLSD& sd) { const char *w, *x; w = "imageid"; if (sd.has(w)) { setID( sd[w] ); } else goto fail; w = "colors"; if (sd.has(w)) { setColor( ll_color4_from_sd(sd["colors"]) ); } else goto fail; w = "scales"; x = "scalet"; if (sd.has(w) && sd.has(x)) { setScale( (F32)sd[w].asReal(), (F32)sd[x].asReal() ); } else goto fail; w = "offsets"; x = "offsett"; if (sd.has(w) && sd.has(x)) { setOffset( (F32)sd[w].asReal(), (F32)sd[x].asReal() ); } else goto fail; w = "imagerot"; if (sd.has(w)) { setRotation( (F32)sd[w].asReal() ); } else goto fail; w = "bump"; if (sd.has(w)) { setBumpShiny( sd[w].asInteger() ); } else goto fail; w = "fullbright"; if (sd.has(w)) { setFullbright( sd[w].asInteger() ); } else goto fail; w = "media_flags"; if (sd.has(w)) { setMediaTexGen( sd[w].asInteger() ); } else goto fail; // If the "has media" flag doesn't match the fact that // media data exists, updateMediaData will "fix" it // by either clearing or setting the flag w = TEXTURE_MEDIA_DATA_KEY; if (hasMedia() != sd.has(w)) { llwarns << "LLTextureEntry::fromLLSD: media_flags (" << hasMedia() << ") does not match presence of media_data (" << sd.has(w) << "). Fixing." << llendl; } updateMediaData(sd[w]); w = "glow"; if (sd.has(w)) { setGlow((F32)sd[w].asReal() ); } return true; fail: return false; }