aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llprimitive/llprimitive.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llprimitive/llprimitive.cpp130
1 files changed, 128 insertions, 2 deletions
diff --git a/linden/indra/llprimitive/llprimitive.cpp b/linden/indra/llprimitive/llprimitive.cpp
index 99610dd..91d3c4e 100644
--- a/linden/indra/llprimitive/llprimitive.cpp
+++ b/linden/indra/llprimitive/llprimitive.cpp
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -41,6 +41,7 @@
41#include "llvolumemgr.h" 41#include "llvolumemgr.h"
42#include "llstring.h" 42#include "llstring.h"
43#include "lldatapacker.h" 43#include "lldatapacker.h"
44#include "llsdutil.h"
44 45
45/** 46/**
46 * exported constants 47 * exported constants
@@ -1795,6 +1796,47 @@ void LLLightParams::copy(const LLNetworkData& data)
1795 mFalloff = param->mFalloff; 1796 mFalloff = param->mFalloff;
1796} 1797}
1797 1798
1799LLSD LLLightParams::asLLSD() const
1800{
1801 LLSD sd;
1802
1803 sd["color"] = ll_sd_from_color4(getColor());
1804 sd["radius"] = getRadius();
1805 sd["falloff"] = getFalloff();
1806 sd["cutoff"] = getCutoff();
1807
1808 return sd;
1809}
1810
1811bool LLLightParams::fromLLSD(LLSD& sd)
1812{
1813 const char *w;
1814 w = "color";
1815 if (sd.has(w))
1816 {
1817 setColor( ll_color4_from_sd(sd["color"]) );
1818 } else goto fail;
1819 w = "radius";
1820 if (sd.has(w))
1821 {
1822 setRadius( (F32)sd[w].asReal() );
1823 } else goto fail;
1824 w = "falloff";
1825 if (sd.has(w))
1826 {
1827 setFalloff( (F32)sd[w].asReal() );
1828 } else goto fail;
1829 w = "cutoff";
1830 if (sd.has(w))
1831 {
1832 setCutoff( (F32)sd[w].asReal() );
1833 } else goto fail;
1834
1835 return true;
1836 fail:
1837 return false;
1838}
1839
1798//============================================================================ 1840//============================================================================
1799 1841
1800LLFlexibleObjectData::LLFlexibleObjectData() 1842LLFlexibleObjectData::LLFlexibleObjectData()
@@ -1876,6 +1918,59 @@ void LLFlexibleObjectData::copy(const LLNetworkData& data)
1876 //mRenderingCollisionSphere = flex_data->mRenderingCollisionSphere; 1918 //mRenderingCollisionSphere = flex_data->mRenderingCollisionSphere;
1877} 1919}
1878 1920
1921LLSD LLFlexibleObjectData::asLLSD() const
1922{
1923 LLSD sd;
1924
1925 sd["air_friction"] = getAirFriction();
1926 sd["gravity"] = getGravity();
1927 sd["simulate_lod"] = getSimulateLOD();
1928 sd["tension"] = getTension();
1929 sd["user_force"] = getUserForce().getValue();
1930 sd["wind_sensitivity"] = getWindSensitivity();
1931
1932 return sd;
1933}
1934
1935bool LLFlexibleObjectData::fromLLSD(LLSD& sd)
1936{
1937 const char *w;
1938 w = "air_friction";
1939 if (sd.has(w))
1940 {
1941 setAirFriction( (F32)sd[w].asReal() );
1942 } else goto fail;
1943 w = "gravity";
1944 if (sd.has(w))
1945 {
1946 setGravity( (F32)sd[w].asReal() );
1947 } else goto fail;
1948 w = "simulate_lod";
1949 if (sd.has(w))
1950 {
1951 setSimulateLOD( sd[w].asInteger() );
1952 } else goto fail;
1953 w = "tension";
1954 if (sd.has(w))
1955 {
1956 setTension( (F32)sd[w].asReal() );
1957 } else goto fail;
1958 w = "user_force";
1959 if (sd.has(w))
1960 {
1961 LLVector3 user_force = ll_vector3_from_sd(sd[w], 0);
1962 setUserForce( user_force );
1963 } else goto fail;
1964 w = "wind_sensitivity";
1965 if (sd.has(w))
1966 {
1967 setWindSensitivity( (F32)sd[w].asReal() );
1968 } else goto fail;
1969
1970 return true;
1971 fail:
1972 return false;
1973}
1879 1974
1880//============================================================================ 1975//============================================================================
1881 1976
@@ -1927,3 +2022,34 @@ void LLSculptParams::copy(const LLNetworkData& data)
1927 mSculptType = param->mSculptType; 2022 mSculptType = param->mSculptType;
1928} 2023}
1929 2024
2025
2026
2027LLSD LLSculptParams::asLLSD() const
2028{
2029 LLSD sd;
2030
2031 sd["texture"] = mSculptTexture;
2032 sd["type"] = mSculptType;
2033
2034 return sd;
2035}
2036
2037bool LLSculptParams::fromLLSD(LLSD& sd)
2038{
2039 const char *w;
2040 w = "texture";
2041 if (sd.has(w))
2042 {
2043 setSculptTexture( sd[w] );
2044 } else goto fail;
2045 w = "type";
2046 if (sd.has(w))
2047 {
2048 setSculptType( (U8)sd[w].asInteger() );
2049 } else goto fail;
2050
2051 return true;
2052 fail:
2053 return false;
2054}
2055