diff options
author | Mandarinka Tasty | 2016-11-24 23:40:20 +0100 |
---|---|---|
committer | UbitUmarov | 2016-11-25 16:22:10 +0000 |
commit | e45245d267a91a5f79f0e54351d4e24b8c1690c0 (patch) | |
tree | 0d0a5dec394be172c3afbea84ad40a1468740fe7 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | work around viewers not suporting large regions on landmark creation. They s... (diff) | |
download | opensim-SC_OLD-e45245d267a91a5f79f0e54351d4e24b8c1690c0.zip opensim-SC_OLD-e45245d267a91a5f79f0e54351d4e24b8c1690c0.tar.gz opensim-SC_OLD-e45245d267a91a5f79f0e54351d4e24b8c1690c0.tar.bz2 opensim-SC_OLD-e45245d267a91a5f79f0e54351d4e24b8c1690c0.tar.xz |
Implementation of LSL_Integer llScaleByFactor(double scaling_factor)
Signed-off-by: Mandarinka Tasty <mandarinka.tasty@gmail.com>
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3db5dd2..b5abdb5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1803,6 +1803,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1803 | return 0; | 1803 | return 0; |
1804 | } | 1804 | } |
1805 | 1805 | ||
1806 | public LSL_Integer llScaleByFactor(double scaling_factor) | ||
1807 | { | ||
1808 | m_host.AddScriptLPS(1); | ||
1809 | SceneObjectGroup group = m_host.ParentGroup; | ||
1810 | |||
1811 | if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) | ||
1812 | return ScriptBaseClass.FALSE; | ||
1813 | |||
1814 | if (group.RootPart.KeyframeMotion != null) | ||
1815 | return ScriptBaseClass.FALSE; | ||
1816 | |||
1817 | List<SceneObjectPart> prims = GetLinkParts(ScriptBaseClass.LINK_SET); | ||
1818 | if (prims.Count > 0) | ||
1819 | { | ||
1820 | foreach (SceneObjectPart prim in prims) | ||
1821 | { | ||
1822 | LSL_Vector size = new LSL_Vector(prim.Scale.X, prim.Scale.Y, prim.Scale.Z); | ||
1823 | LSL_Vector new_size = new LSL_Vector(scaling_factor * size); | ||
1824 | |||
1825 | new_size.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.x)); | ||
1826 | new_size.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.y)); | ||
1827 | new_size.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.z)); | ||
1828 | |||
1829 | if (new_size.x != scaling_factor * size.x || new_size.y != scaling_factor * size.y || new_size.z != scaling_factor * size.z) | ||
1830 | return ScriptBaseClass.FALSE; | ||
1831 | |||
1832 | LSL_Vector position = new LSL_Vector(GetPartLocalPos(prim)); | ||
1833 | |||
1834 | if (!prim.IsRoot) | ||
1835 | { | ||
1836 | position = GetSetPosTarget(prim, scaling_factor * position, position, true); | ||
1837 | prim.OffsetPosition = position; | ||
1838 | prim.ScheduleTerseUpdate(); | ||
1839 | } | ||
1840 | |||
1841 | SetScale(prim, new_size); | ||
1842 | } | ||
1843 | |||
1844 | return ScriptBaseClass.TRUE; | ||
1845 | } | ||
1846 | else | ||
1847 | { | ||
1848 | return ScriptBaseClass.FALSE; | ||
1849 | } | ||
1850 | } | ||
1851 | |||
1806 | public void llSetScale(LSL_Vector scale) | 1852 | public void llSetScale(LSL_Vector scale) |
1807 | { | 1853 | { |
1808 | m_host.AddScriptLPS(1); | 1854 | m_host.AddScriptLPS(1); |