diff options
author | Melanie Thielker | 2008-07-31 12:31:31 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-07-31 12:31:31 +0000 |
commit | c441a03ea3120c52af3fdffb284194f2609127cf (patch) | |
tree | 539b48d22ab51f45dc09f930dbeb1b7f6ba703a8 /OpenSim/Region | |
parent | Thank you, HomerHorwitz, for a patch that add PERMISSION_CONTROL_CAMERA (diff) | |
download | opensim-SC_OLD-c441a03ea3120c52af3fdffb284194f2609127cf.zip opensim-SC_OLD-c441a03ea3120c52af3fdffb284194f2609127cf.tar.gz opensim-SC_OLD-c441a03ea3120c52af3fdffb284194f2609127cf.tar.bz2 opensim-SC_OLD-c441a03ea3120c52af3fdffb284194f2609127cf.tar.xz |
Thank you, HomerHorwitz, for a patch that implements llSetCameraParams/llClearCameraParams.
Fixes Mantis #1867
Diffstat (limited to 'OpenSim/Region')
7 files changed, 227 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 995fe5e..04518bd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -6281,5 +6281,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6281 | } | 6281 | } |
6282 | 6282 | ||
6283 | #endregion | 6283 | #endregion |
6284 | |||
6285 | |||
6286 | #region Camera | ||
6287 | |||
6288 | public void SendSetFollowCamProperties (LLUUID objectID, SortedDictionary<int, float> parameters) | ||
6289 | { | ||
6290 | SetFollowCamPropertiesPacket packet = (SetFollowCamPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.SetFollowCamProperties); | ||
6291 | packet.ObjectData.ObjectID = objectID; | ||
6292 | SetFollowCamPropertiesPacket.CameraPropertyBlock[] camPropBlock = new SetFollowCamPropertiesPacket.CameraPropertyBlock[parameters.Count]; | ||
6293 | uint idx = 0; | ||
6294 | foreach(KeyValuePair<int, float> pair in parameters) | ||
6295 | { | ||
6296 | SetFollowCamPropertiesPacket.CameraPropertyBlock block = new SetFollowCamPropertiesPacket.CameraPropertyBlock(); | ||
6297 | block.Type = pair.Key; | ||
6298 | block.Value = pair.Value; | ||
6299 | |||
6300 | camPropBlock[idx++] = block; | ||
6301 | } | ||
6302 | packet.CameraProperty = camPropBlock; | ||
6303 | OutPacket(packet, ThrottleOutPacketType.Task); | ||
6304 | } | ||
6305 | |||
6306 | public void SendClearFollowCamProperties (LLUUID objectID) | ||
6307 | { | ||
6308 | ClearFollowCamPropertiesPacket packet = (ClearFollowCamPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ClearFollowCamProperties); | ||
6309 | packet.ObjectData.ObjectID = objectID; | ||
6310 | OutPacket(packet, ThrottleOutPacketType.Task); | ||
6311 | } | ||
6312 | |||
6313 | #endregion | ||
6284 | } | 6314 | } |
6285 | } | 6315 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index d84283b..357e454 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -824,5 +824,13 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
824 | byte mediaLoop) | 824 | byte mediaLoop) |
825 | { | 825 | { |
826 | } | 826 | } |
827 | |||
828 | public void SendSetFollowCamProperties (LLUUID objectID, SortedDictionary<int, float> parameters) | ||
829 | { | ||
830 | } | ||
831 | |||
832 | public void SendClearFollowCamProperties (LLUUID objectID) | ||
833 | { | ||
834 | } | ||
827 | } | 835 | } |
828 | } | 836 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index ce4cd62..b1e1854 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -824,5 +824,13 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
824 | { | 824 | { |
825 | 825 | ||
826 | } | 826 | } |
827 | |||
828 | public void SendSetFollowCamProperties (LLUUID objectID, SortedDictionary<int, float> parameters) | ||
829 | { | ||
830 | } | ||
831 | |||
832 | public void SendClearFollowCamProperties (LLUUID objectID) | ||
833 | { | ||
834 | } | ||
827 | } | 835 | } |
828 | } | 836 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index 551c6f6..cd2aa45 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs | |||
@@ -2425,5 +2425,30 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2425 | // Can not be public const? | 2425 | // Can not be public const? |
2426 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); | 2426 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); |
2427 | public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0, 0.0, 1.0); | 2427 | public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0, 0.0, 1.0); |
2428 | |||
2429 | // constants for llSetCameraParams | ||
2430 | public const int CAMERA_PITCH = 0; | ||
2431 | public const int CAMERA_FOCUS_OFFSET = 1; | ||
2432 | public const int CAMERA_FOCUS_OFFSET_X = 2; | ||
2433 | public const int CAMERA_FOCUS_OFFSET_Y = 3; | ||
2434 | public const int CAMERA_FOCUS_OFFSET_Z = 4; | ||
2435 | public const int CAMERA_POSITION_LAG = 5; | ||
2436 | public const int CAMERA_FOCUS_LAG = 6; | ||
2437 | public const int CAMERA_DISTANCE = 7; | ||
2438 | public const int CAMERA_BEHINDNESS_ANGLE = 8; | ||
2439 | public const int CAMERA_BEHINDNESS_LAG = 9; | ||
2440 | public const int CAMERA_POSITION_THRESHOLD = 10; | ||
2441 | public const int CAMERA_FOCUS_THRESHOLD = 11; | ||
2442 | public const int CAMERA_ACTIVE = 12; | ||
2443 | public const int CAMERA_POSITION = 13; | ||
2444 | public const int CAMERA_POSITION_X = 14; | ||
2445 | public const int CAMERA_POSITION_Y = 15; | ||
2446 | public const int CAMERA_POSITION_Z = 16; | ||
2447 | public const int CAMERA_FOCUS = 17; | ||
2448 | public const int CAMERA_FOCUS_X = 18; | ||
2449 | public const int CAMERA_FOCUS_Y = 19; | ||
2450 | public const int CAMERA_FOCUS_Z = 20; | ||
2451 | public const int CAMERA_POSITION_LOCKED = 21; | ||
2452 | public const int CAMERA_FOCUS_LOCKED = 22; | ||
2428 | } | 2453 | } |
2429 | } | 2454 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index c386e38..bdca67c 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -6917,13 +6917,77 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
6917 | public void llSetCameraParams(LSL_Types.list rules) | 6917 | public void llSetCameraParams(LSL_Types.list rules) |
6918 | { | 6918 | { |
6919 | m_host.AddScriptLPS(1); | 6919 | m_host.AddScriptLPS(1); |
6920 | NotImplemented("llSetCameraParams"); | 6920 | |
6921 | // our key in the object we are in | ||
6922 | LLUUID invItemID=InventorySelf(); | ||
6923 | if (invItemID == LLUUID.Zero) return; | ||
6924 | |||
6925 | // the object we are in | ||
6926 | LLUUID objectID = m_host.ParentUUID; | ||
6927 | if(objectID == LLUUID.Zero) return; | ||
6928 | |||
6929 | // we need the permission first, to know which avatar we want to set the camera for | ||
6930 | LLUUID agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
6931 | if (agentID == LLUUID.Zero) return; | ||
6932 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | ||
6933 | |||
6934 | ScenePresence presence = World.GetScenePresence(agentID); | ||
6935 | |||
6936 | // we are not interested in child-agents | ||
6937 | if(presence.IsChildAgent) return; | ||
6938 | |||
6939 | SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); | ||
6940 | object[] data = rules.Data; | ||
6941 | for(int i = 0; i < data.Length; ++i) { | ||
6942 | int type = Convert.ToInt32(data[i++]); | ||
6943 | if(i >= data.Length) break; // odd number of entries => ignore the last | ||
6944 | |||
6945 | // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) | ||
6946 | switch(type) { | ||
6947 | case BuiltIn_Commands_BaseClass.CAMERA_FOCUS: | ||
6948 | case BuiltIn_Commands_BaseClass.CAMERA_FOCUS_OFFSET: | ||
6949 | case BuiltIn_Commands_BaseClass.CAMERA_POSITION: | ||
6950 | LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i]; | ||
6951 | parameters.Add(type + 1, (float)v.x); | ||
6952 | parameters.Add(type + 2, (float)v.y); | ||
6953 | parameters.Add(type + 3, (float)v.z); | ||
6954 | break; | ||
6955 | default: | ||
6956 | // TODO: clean that up as soon as the implicit casts are in | ||
6957 | if(data[i] is LSL_Types.LSLFloat) | ||
6958 | parameters.Add(type, (float)((LSL_Types.LSLFloat)data[i]).value); | ||
6959 | else if(data[i] is LSL_Types.LSLInteger) | ||
6960 | parameters.Add(type, (float)((LSL_Types.LSLInteger)data[i]).value); | ||
6961 | else parameters.Add(type, Convert.ToSingle(data[i])); | ||
6962 | break; | ||
6963 | } | ||
6964 | } | ||
6965 | if(parameters.Count > 0) presence.ControllingClient.SendSetFollowCamProperties(objectID, parameters); | ||
6921 | } | 6966 | } |
6922 | 6967 | ||
6923 | public void llClearCameraParams() | 6968 | public void llClearCameraParams() |
6924 | { | 6969 | { |
6925 | m_host.AddScriptLPS(1); | 6970 | m_host.AddScriptLPS(1); |
6926 | NotImplemented("llClearCameraParams"); | 6971 | |
6972 | // our key in the object we are in | ||
6973 | LLUUID invItemID=InventorySelf(); | ||
6974 | if (invItemID == LLUUID.Zero) return; | ||
6975 | |||
6976 | // the object we are in | ||
6977 | LLUUID objectID = m_host.ParentUUID; | ||
6978 | if(objectID == LLUUID.Zero) return; | ||
6979 | |||
6980 | // we need the permission first, to know which avatar we want to clear the camera for | ||
6981 | LLUUID agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
6982 | if (agentID == LLUUID.Zero) return; | ||
6983 | if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | ||
6984 | |||
6985 | ScenePresence presence = World.GetScenePresence(agentID); | ||
6986 | |||
6987 | // we are not interested in child-agents | ||
6988 | if(presence.IsChildAgent) return; | ||
6989 | |||
6990 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | ||
6927 | } | 6991 | } |
6928 | 6992 | ||
6929 | public double llListStatistics(int operation, LSL_Types.list src) | 6993 | public double llListStatistics(int operation, LSL_Types.list src) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 99af529..dadad02 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6695,13 +6695,77 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6695 | public void llSetCameraParams(LSL_Types.list rules) | 6695 | public void llSetCameraParams(LSL_Types.list rules) |
6696 | { | 6696 | { |
6697 | m_host.AddScriptLPS(1); | 6697 | m_host.AddScriptLPS(1); |
6698 | NotImplemented("llSetCameraParams"); | 6698 | |
6699 | // our key in the object we are in | ||
6700 | LLUUID invItemID=InventorySelf(); | ||
6701 | if (invItemID == LLUUID.Zero) return; | ||
6702 | |||
6703 | // the object we are in | ||
6704 | LLUUID objectID = m_host.ParentUUID; | ||
6705 | if(objectID == LLUUID.Zero) return; | ||
6706 | |||
6707 | // we need the permission first, to know which avatar we want to set the camera for | ||
6708 | LLUUID agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
6709 | if (agentID == LLUUID.Zero) return; | ||
6710 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | ||
6711 | |||
6712 | ScenePresence presence = World.GetScenePresence(agentID); | ||
6713 | |||
6714 | // we are not interested in child-agents | ||
6715 | if(presence.IsChildAgent) return; | ||
6716 | |||
6717 | SortedDictionary<int, float> parameters = new SortedDictionary<int, float>(); | ||
6718 | object[] data = rules.Data; | ||
6719 | for(int i = 0; i < data.Length; ++i) { | ||
6720 | int type = Convert.ToInt32(data[i++]); | ||
6721 | if(i >= data.Length) break; // odd number of entries => ignore the last | ||
6722 | |||
6723 | // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) | ||
6724 | switch(type) { | ||
6725 | case ScriptBaseClass.CAMERA_FOCUS: | ||
6726 | case ScriptBaseClass.CAMERA_FOCUS_OFFSET: | ||
6727 | case ScriptBaseClass.CAMERA_POSITION: | ||
6728 | LSL_Types.Vector3 v = (LSL_Types.Vector3)data[i]; | ||
6729 | parameters.Add(type + 1, (float)v.x); | ||
6730 | parameters.Add(type + 2, (float)v.y); | ||
6731 | parameters.Add(type + 3, (float)v.z); | ||
6732 | break; | ||
6733 | default: | ||
6734 | // TODO: clean that up as soon as the implicit casts are in | ||
6735 | if(data[i] is LSL_Types.LSLFloat) | ||
6736 | parameters.Add(type, (float)((LSL_Types.LSLFloat)data[i]).value); | ||
6737 | else if(data[i] is LSL_Types.LSLInteger) | ||
6738 | parameters.Add(type, (float)((LSL_Types.LSLInteger)data[i]).value); | ||
6739 | else parameters.Add(type, Convert.ToSingle(data[i])); | ||
6740 | break; | ||
6741 | } | ||
6742 | } | ||
6743 | if(parameters.Count > 0) presence.ControllingClient.SendSetFollowCamProperties(objectID, parameters); | ||
6699 | } | 6744 | } |
6700 | 6745 | ||
6701 | public void llClearCameraParams() | 6746 | public void llClearCameraParams() |
6702 | { | 6747 | { |
6703 | m_host.AddScriptLPS(1); | 6748 | m_host.AddScriptLPS(1); |
6704 | NotImplemented("llClearCameraParams"); | 6749 | |
6750 | // our key in the object we are in | ||
6751 | LLUUID invItemID=InventorySelf(); | ||
6752 | if (invItemID == LLUUID.Zero) return; | ||
6753 | |||
6754 | // the object we are in | ||
6755 | LLUUID objectID = m_host.ParentUUID; | ||
6756 | if(objectID == LLUUID.Zero) return; | ||
6757 | |||
6758 | // we need the permission first, to know which avatar we want to clear the camera for | ||
6759 | LLUUID agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
6760 | if (agentID == LLUUID.Zero) return; | ||
6761 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | ||
6762 | |||
6763 | ScenePresence presence = World.GetScenePresence(agentID); | ||
6764 | |||
6765 | // we are not interested in child-agents | ||
6766 | if(presence.IsChildAgent) return; | ||
6767 | |||
6768 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | ||
6705 | } | 6769 | } |
6706 | 6770 | ||
6707 | public double llListStatistics(int operation, LSL_Types.list src) | 6771 | public double llListStatistics(int operation, LSL_Types.list src) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 810a655..3dc1c05 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -421,5 +421,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
421 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); | 421 | public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); |
422 | public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0, 0.0, 1.0); | 422 | public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0, 0.0, 1.0); |
423 | 423 | ||
424 | // constants for llSetCameraParams | ||
425 | public const int CAMERA_PITCH = 0; | ||
426 | public const int CAMERA_FOCUS_OFFSET = 1; | ||
427 | public const int CAMERA_FOCUS_OFFSET_X = 2; | ||
428 | public const int CAMERA_FOCUS_OFFSET_Y = 3; | ||
429 | public const int CAMERA_FOCUS_OFFSET_Z = 4; | ||
430 | public const int CAMERA_POSITION_LAG = 5; | ||
431 | public const int CAMERA_FOCUS_LAG = 6; | ||
432 | public const int CAMERA_DISTANCE = 7; | ||
433 | public const int CAMERA_BEHINDNESS_ANGLE = 8; | ||
434 | public const int CAMERA_BEHINDNESS_LAG = 9; | ||
435 | public const int CAMERA_POSITION_THRESHOLD = 10; | ||
436 | public const int CAMERA_FOCUS_THRESHOLD = 11; | ||
437 | public const int CAMERA_ACTIVE = 12; | ||
438 | public const int CAMERA_POSITION = 13; | ||
439 | public const int CAMERA_POSITION_X = 14; | ||
440 | public const int CAMERA_POSITION_Y = 15; | ||
441 | public const int CAMERA_POSITION_Z = 16; | ||
442 | public const int CAMERA_FOCUS = 17; | ||
443 | public const int CAMERA_FOCUS_X = 18; | ||
444 | public const int CAMERA_FOCUS_Y = 19; | ||
445 | public const int CAMERA_FOCUS_Z = 20; | ||
446 | public const int CAMERA_POSITION_LOCKED = 21; | ||
447 | public const int CAMERA_FOCUS_LOCKED = 22; | ||
424 | } | 448 | } |
425 | } | 449 | } |