diff options
author | UbitUmarov | 2016-11-25 17:34:19 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-25 17:34:19 +0000 |
commit | b82a41d2606dfaf42455e0030b5640752167162b (patch) | |
tree | 16be21f656d7289f64604c2e0bd48a7998478de6 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Implementation of LSL_Integer llScaleByFactor(double scaling_factor) (diff) | |
download | opensim-SC-b82a41d2606dfaf42455e0030b5640752167162b.zip opensim-SC-b82a41d2606dfaf42455e0030b5640752167162b.tar.gz opensim-SC-b82a41d2606dfaf42455e0030b5640752167162b.tar.bz2 opensim-SC-b82a41d2606dfaf42455e0030b5640752167162b.tar.xz |
change llScaleByFactor (sorry Mandarinka).
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b5abdb5..c43aef5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1808,45 +1808,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1808 | m_host.AddScriptLPS(1); | 1808 | m_host.AddScriptLPS(1); |
1809 | SceneObjectGroup group = m_host.ParentGroup; | 1809 | SceneObjectGroup group = m_host.ParentGroup; |
1810 | 1810 | ||
1811 | if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) | 1811 | if(scaling_factor < 1e-6) |
1812 | return ScriptBaseClass.FALSE; | 1812 | return ScriptBaseClass.FALSE; |
1813 | 1813 | if(scaling_factor > 1e6) | |
1814 | if (group.RootPart.KeyframeMotion != null) | ||
1815 | return ScriptBaseClass.FALSE; | 1814 | return ScriptBaseClass.FALSE; |
1816 | 1815 | ||
1817 | List<SceneObjectPart> prims = GetLinkParts(ScriptBaseClass.LINK_SET); | 1816 | if (group == null || group.IsDeleted || group.inTransit) |
1818 | if (prims.Count > 0) | 1817 | return ScriptBaseClass.FALSE; |
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 | 1818 | ||
1834 | if (!prim.IsRoot) | 1819 | if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) |
1835 | { | 1820 | return ScriptBaseClass.FALSE; |
1836 | position = GetSetPosTarget(prim, scaling_factor * position, position, true); | ||
1837 | prim.OffsetPosition = position; | ||
1838 | prim.ScheduleTerseUpdate(); | ||
1839 | } | ||
1840 | 1821 | ||
1841 | SetScale(prim, new_size); | 1822 | if (group.RootPart.KeyframeMotion != null) |
1842 | } | 1823 | return ScriptBaseClass.FALSE; |
1843 | 1824 | ||
1825 | if(group.GroupResize(scaling_factor)) | ||
1844 | return ScriptBaseClass.TRUE; | 1826 | return ScriptBaseClass.TRUE; |
1845 | } | ||
1846 | else | 1827 | else |
1847 | { | ||
1848 | return ScriptBaseClass.FALSE; | 1828 | return ScriptBaseClass.FALSE; |
1849 | } | ||
1850 | } | 1829 | } |
1851 | 1830 | ||
1852 | public void llSetScale(LSL_Vector scale) | 1831 | public void llSetScale(LSL_Vector scale) |