コード例 #1
0
 public Billboard(SceneInterface sceneinterface, BillboardResource resource, Effect effect, Vector3 position, Vector3 scale)
 {
     this._Position = position;
     this._Scale = scale;
     this._SceneObject = new SceneObject(effect, resource.BoundingSphere, Matrix.Identity, resource.IndexBuffer, resource.VertexBuffer, resource.VertexDeclaration, resource.IndexStart, resource.PrimitiveType, resource.PrimitiveCount, resource.VertexBase, resource.VertexRange, resource.VertexStreamOffset, resource.SizeInBytes)
     {
         ObjectType = ObjectType.Dynamic,
         Visibility = ObjectVisibility.RenderedAndCastShadows,
         World = Matrix.CreateScale(this._Scale) * Matrix.CreateTranslation(this._Position)
     };
     sceneinterface.ObjectManager.Submit(this._SceneObject);
 }
コード例 #2
0
        /// <inheritdoc />
        public void Register(ISceneObject obj)
        {
            if (ContainsGuid(obj.Guid))
            {
                throw new AlreadyRegisteredException(obj);
            }

            if (ContainsName(obj.UniqueName))
            {
                throw new NameNotUniqueException(obj);
            }

            registeredEntities.Add(obj.Guid, obj);
        }
コード例 #3
0
        private CharacterSpawnDetailsParameters?CreateCharacterSpawnDetails(ISceneObject sceneObject)
        {
            // It may be null because not every object on a scene is a character.
            var characterGetter = sceneObject.Components.GetComponent <ICharacterParametersGetter>();

            if (characterGetter == null)
            {
                return(null);
            }

            var directionTransform = sceneObject.Components.GetComponent <IDirectionTransform>().AssertNotNull();

            return(new CharacterSpawnDetailsParameters(sceneObject.Id, characterGetter.GetCharacter(), directionTransform.Direction.GetDirectionsFromDirection()));
        }
コード例 #4
0
        /// <summary>
        /// Ensures that this <see cref="ISceneObject"/>'s UniqueName is not duplicated.
        /// </summary>
        /// <param name="sceneObject"><see cref="ISceneObject"/> to whom the `UniqueName` will be validated.</param>
        /// <param name="baseName">Optional base for this <paramref name="sceneObject"/>'s `UniqueName`.</param>
        public static void SetSuitableName(this ISceneObject sceneObject, string baseName = "")
        {
            int    counter = 1;
            string newName = baseName = string.IsNullOrEmpty(baseName) ? sceneObject.GameObject.name : baseName;

            RuntimeConfigurator.Configuration.SceneObjectRegistry.Unregister(sceneObject);
            while (RuntimeConfigurator.Configuration.SceneObjectRegistry.ContainsName(newName))
            {
                newName = string.Format("{0}_{1}", baseName, counter);
                counter++;
            }

            sceneObject.ChangeUniqueName(newName);
        }
コード例 #5
0
        public override void DoCollideWith(ISceneObject other, float tpf)
        {
            if (HasFullCapacity() && !other.HasControlOfType <FollowingControl>())
            {
                return;
            }

            if (!(other is ICatchable))
            {
                return;
            }

            TryToCatchCollidedObject(other as ICatchable);
        }
コード例 #6
0
        protected override void InitControl(ISceneObject me)
        {
            base.InitControl(me);
            if (!(me is SingularityExplodingBullet))
            {
                throw new InvalidOperationException("Cannot attach SingularityControl to non SingularityExploadingBullet object");
            }

            hitObjects   = new List <long>();
            meBullet     = me as SingularityExplodingBullet;
            hitSomething = false;

            events.AddEvent((int)Events.DEATH_AND_BULLET_SPAWN, new Event(SharedDef.BULLET_LIFE_TIME, EventType.ONE_TIME, new Action(() => { DieAndSpawnBullets(); })));
        }
コード例 #7
0
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public virtual bool IncomingCreateObject(UUID regionID, ISceneObject sog)
        {
            Scene scene = GetScene(regionID);

            if (scene == null)
            {
                return(false);
            }

            //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
            SceneObjectGroup newObject;

            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[EntityTransferModule]: Problem casting object: {0}", e.Message);
                return(false);
            }

            if (!AddSceneObject(scene, newObject))
            {
                m_log.WarnFormat("[EntityTransferModule]: Problem adding scene object {0} in {1} ", sog.UUID, scene.RegionInfo.RegionName);
                return(false);
            }

            newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, 1, UUID.Zero);
            newObject.RootPart.ParentGroup.ResumeScripts();

            if (newObject.RootPart.SitTargetAvatar.Count != 0)
            {
                lock (newObject.RootPart.SitTargetAvatar)
                {
                    foreach (UUID avID in newObject.RootPart.SitTargetAvatar)
                    {
                        IScenePresence SP = scene.GetScenePresence(avID);
                        while (SP == null)
                        {
                            Thread.Sleep(20);
                        }
                        SP.AbsolutePosition = newObject.AbsolutePosition;
                        SP.CrossSittingAgent(SP.ControllingClient, newObject.RootPart.UUID);
                    }
                }
            }

            return(true);
        }
コード例 #8
0
        public void PopText(
            ISceneObject targetSceneObject,
            string text,
            Color color
            )
        {
            IPopUI popUI = GetNext();

            popUI.SetColor(color);
            popUI.ActivateAt(
                targetSceneObject,
                text
                );
        }
コード例 #9
0
ファイル: LockingTests.cs プロジェクト: VaLiuM09/Creator
        public IEnumerator GetLockablePropertiesMultipleObjectsAndConditions()
        {
            // Given three scene objects,
            // one of them with one lockable property and one non-lockable property,
            // one of them with only one non-lockable property,
            // and one of them with only one lockable property,
            // used by three different conditions in a transition.
            ISceneObject         o1       = TestingUtils.CreateSceneObject("o1");
            LockablePropertyMock property = o1.GameObject.AddComponent <LockablePropertyMock>();

            o1.GameObject.AddComponent <PropertyMock>();

            ISceneObject o2 = TestingUtils.CreateSceneObject("o2");

            o2.GameObject.AddComponent <PropertyMock>();

            ISceneObject         o3        = TestingUtils.CreateSceneObject("o3");
            LockablePropertyMock property2 = o2.GameObject.AddComponent <LockablePropertyMock>();

            LockableReferencingConditionMock condition1 = new LockableReferencingConditionMock();

            condition1.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            condition1.LockableProperties        = new[] { new LockablePropertyData(property, true) };

            ReferencingConditionMock condition2 = new ReferencingConditionMock();

            condition2.Data.PropertyMock = new ScenePropertyReference <PropertyMock>(o2.UniqueName);

            LockableReferencingConditionMock condition3 = new LockableReferencingConditionMock();

            condition3.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o3.UniqueName);
            condition3.LockableProperties        = new[] { new LockablePropertyData(property2, true) };

            Step step2 = new BasicStepBuilder("step2").Build();
            Step step  = new BasicStepBuilder("step")
                         .AddCondition(condition1)
                         .AddCondition(condition2)
                         .AddCondition(condition3)
                         .Build();
            Transition transition = (Transition)step.Data.Transitions.Data.Transitions[0];

            transition.Data.TargetStep = step2;

            // When counting the lockable properties in the transition.
            // Then there are exactly two lockable properties.
            Assert.IsTrue(transition.GetLockableProperties().Count() == 2);

            yield return(null);
        }
コード例 #10
0
 /// <summary>
 /// ihned odebere objekt ze sceny
 /// </summary>
 private void DirectRemoveFromScene(ISceneObject obj)
 {
     objects.Remove(obj);
     BeginInvoke(new Action(() =>
     {
         if (obj is IHeavyWeightSceneObject)
         {
             GetCanvas().Children.Remove((obj as IHeavyWeightSceneObject).HeavyWeightGeometry);
         }
         else if (obj.GetGeometry() != null)
         {
             area.Remove(obj.GetGeometry(), obj.Category);
         }
     }));
 }
コード例 #11
0
        public void SetParent(ISceneObject sceneObj)
        {
            Transform parentTrans;

            if (sceneObj != null)
            {
                IMonoBehaviourAdaptor parentAdaptor = sceneObj.GetAdaptor();
                parentTrans = parentAdaptor.GetTransform();
            }
            else
            {
                parentTrans = null;
            }
            thisAdaptor.SetParent(parentTrans);
        }
コード例 #12
0
        public void StartPullingObject(ISceneObject o)
        {
            IMovementControl c = o.GetControlOfType <IMovementControl>();

            if (c != null)
            {
                c.Enabled = false;
            }

            FollowingControl follow = new FollowingControl(me);

            follow.Speed = Speed * 2;

            o.AddControl(follow);
        }
コード例 #13
0
        public void RemoveSceneObject(ISceneObject sceneObject)
        {
            if (SceneObjects.Remove(sceneObject))
            {
                data.ToUnlock = data.ToUnlock.Where(property =>
                {
                    if (property.GetProperty() == null)
                    {
                        return(false);
                    }

                    return(property.GetProperty().SceneObject != sceneObject);
                }).ToList();
            }
        }
コード例 #14
0
 public static void RemoveSceneObject(Coocoo3DMain appBody, Scene scene, ISceneObject sceneObject)
 {
     if (scene.sceneObjects.Remove(sceneObject))
     {
         if (sceneObject is MMD3DEntity entity)
         {
             scene.RemoveSceneObject(entity);
         }
         else if (sceneObject is Lighting lighting)
         {
             scene.RemoveSceneObject(lighting);
         }
     }
     appBody.RequireRender();
 }
コード例 #15
0
 /// <summary>
 /// bezpecne odstrani objekt (SceneObject i gui objekt) v dalsim updatu
 /// </summary>
 public void RemoveFromSceneDelayed(ISceneObject obj)
 {
     if (obj is ParticleEmmitor)
     {
         obj.Dead = true;
         obj.OnRemove();
         GetParticleArea().RemoveEmmitor(obj as ParticleEmmitor);
     }
     else
     {
         obj.Dead = true;
         obj.OnRemove();
         objectsToRemove.Add(obj);
     }
 }
コード例 #16
0
        private void RemoveSubscriptionFromPublishers(ISceneObject sceneObject)
        {
            foreach (var region in regions)
            {
                if (region == null)
                {
                    continue;
                }

                if (region.HasSubscription(sceneObject))
                {
                    region.RemoveSubscriptionForAllSubscribers(sceneObject);
                }
            }
        }
コード例 #17
0
        public Intersection(ISceneObject o, float d)
        {
            if (o == null)
            {
                throw new ArgumentNullException(nameof(o));
            }
            // 0 is legal if we hit an object with the camera
            if (d < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(d));
            }

            IntersectedObject = o;
            Distance          = d;
        }
コード例 #18
0
        private void EditorAddSceneBlockObject(ISceneObject obj)
        {
            if (m_Tree == null)
            {
                return;
            }
            if (obj == null)
            {
                return;
            }
            //使用SceneObject包装
            SceneObject sbobj = new SceneObject(obj);

            m_Tree.Add(sbobj);
        }
コード例 #19
0
        public RGBA Illuminate(ISceneObject obj)
        {
            var center    = obj.MidPoint;
            var direction = Origin - center;
            var normal    = obj.Normal;
            var cos       = direction.DotProduct(normal) / (direction.Length * normal.Length);
            var c         = Math.Max(cos, 0.1);

            return(new RGBA
            {
                Blue = (byte)(212 * c),
                Red = (byte)(127 * c),
                Green = (byte)(255 * c)
            });
        }
コード例 #20
0
        public ISceneObject Shoot(Point point, bool noControl = false)
        {
            if (IsReady() || noControl)
            {
                ISceneObject obj = SpawnMine(point);
                if (!noControl)
                {
                    ReloadTime = Owner.Data.MineCooldown;
                }

                Owner.Statistics.MineFired++;
                return(obj);
            }

            return(null);
        }
コード例 #21
0
        private void UndoSceneObjectAutomaticSetup(GameObject selectedSceneObject, Type valueType, bool hadTrainingComponent, Component[] alreadyAttachedProperties)
        {
            ISceneObject sceneObject = selectedSceneObject.GetComponent <TrainingSceneObject>();

            if (typeof(ISceneObjectProperty).IsAssignableFrom(valueType))
            {
                sceneObject.RemoveTrainingProperty(valueType, true, alreadyAttachedProperties);
            }

            if (hadTrainingComponent == false)
            {
                Object.DestroyImmediate((TrainingSceneObject)sceneObject);
            }

            isUndoOperation = true;
        }
コード例 #22
0
        public ISceneObject Shoot(Point point, bool noControl = false)
        {
            if (IsReady() || noControl)
            {
                ISceneObject obj = SpawnBullet(point);
                if (!noControl)
                {
                    ReloadTime = Owner.Data.BulletCooldown;
                }
                //SoundManager.Instance.StartPlayingOnce(SharedDef.MUSIC_SHOOT);
                Owner.Statistics.BulletFired++;
                return(obj);
            }

            return(null);
        }
コード例 #23
0
        /// <summary>
        ///
        /// </summary>
        public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
        {
            // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start");

            string uri = destination.ServerURI + ObjectPath() + sog.UUID + "/";

            try
            {
                OSDMap args = new OSDMap(16);

                args["sog"]          = OSD.FromString(sog.ToXml2());
                args["extra"]        = OSD.FromString(sog.ExtraToXmlString());
                args["modified"]     = OSD.FromBoolean(sog.HasGroupChanged);
                args["new_position"] = newPosition.ToString();

                string state = sog.GetStateSnapshot();
                if (state.Length > 0)
                {
                    args["state"] = OSD.FromString(state);
                }

                // Add the input general arguments
                args["destination_x"]    = OSD.FromString(destination.RegionLocX.ToString());
                args["destination_y"]    = OSD.FromString(destination.RegionLocY.ToString());
                args["destination_name"] = OSD.FromString(destination.RegionName);
                args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());

                OSDMap result = WebUtil.PostToService(uri, args, 40000, false);

                if (result == null)
                {
                    return(false);
                }
                bool success = result["success"].AsBoolean();
                if (!success)
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}", e.ToString());
                return(false);
            }

            return(true);
        }
コード例 #24
0
        protected override void InitControl(ISceneObject me)
        {
            if (!(me is IMovable))
            {
                throw new ArgumentException("DirectionCloneControl must by attached to an IMovable object");
            }

            control = cloned.GetControlOfType <IMovementControl>();
            if (control != null)
            {
                (me as IMovable).Direction = control.RealDirection;
            }
            else
            {
                (me as IMovable).Direction = cloned.Direction;
            }
        }
        public override void DoCollideWith(ISceneObject other, float tpf)
        {
            if (!CanCollideWithObject(other))
            {
                return;
            }

            foreach (long id in IgnoredObjects)
            {
                if (other.Id == id)
                {
                    return;
                }
            }

            base.DoCollideWith(other, tpf);
        }
コード例 #26
0
        protected override void InitControl(ISceneObject me)
        {
            if (!(me is ParticleEmmitor))
            {
                throw new ArgumentException("EmmitorDirectionCloneControl must by attached to an ParticleEmmitor object");
            }

            control = cloned.GetControlOfType <IMovementControl>();
            Vector direction = control != null ? control.RealDirection : cloned.Direction;

            if (DirectionOfsetRotation > 0)
            {
                direction = direction.Rotate(DirectionOfsetRotation);
            }

            (me as ParticleEmmitor).EmmitingDirection = direction;
        }
コード例 #27
0
ファイル: Ray.cs プロジェクト: stas1f1/CGProject
        //Reflection ray methods

        /// <summary>
        /// Get SceneObject reflection ray (assuming ray hits plane)
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public Ray ReflectionRay(ISceneObject o)
        {
            switch (o)
            {
            case Box b:
                return(ReflectionRay(b));

            case Sphere s:
                return(ReflectionRay(s));

            case Plane p:
                return(ReflectionRay(p));

            default:
                throw new ArgumentException("Wrong Type");
            }
        }
コード例 #28
0
ファイル: Ray.cs プロジェクト: stas1f1/CGProject
        //Hit checking methods

        /// <summary>
        /// Finds whether ray hits SceneObject or not
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public bool Hits(ISceneObject o)
        {
            switch (o)
            {
            case Box b:
                return(Hits(b));

            case Sphere s:
                return(Hits(s));

            case Plane p:
                return(Hits(p));

            default:
                throw new ArgumentException("Wrong Type");
            }
        }
コード例 #29
0
        private void TreeViewItem_OnItemSelected(object sender, RoutedEventArgs e)
        {
            TreeViewObjects.Tag = e.OriginalSource;
            TreeViewItem tvi         = TreeViewObjects.Tag as TreeViewItem;
            TreeViewItem parentItem  = GetSelectedTreeViewItemParent(tvi);
            ISceneObject sceneObject = null;

            if (parentItem != null)
            {
                sceneObject = _objectBrowserViewModel.Items.Where(i => i.Name == parentItem.Header.ToString()).FirstOrDefault();
            }

            if (sceneObject != null)
            {
                PropertiesGrid.ItemsSource = new SceneObjectComponentsList(sceneObject.components.Where(c => c.Key == tvi.DataContext.ToString()).Select(c => c.Value).ToList());
            }
        }
コード例 #30
0
        private void SceneObjectAutomaticSetup(GameObject selectedSceneObject, Type valueType)
        {
            ISceneObject sceneObject = selectedSceneObject.GetComponent <TrainingSceneObject>() ?? selectedSceneObject.AddComponent <TrainingSceneObject>();

            if (RuntimeConfigurator.Configuration.SceneObjectRegistry.ContainsGuid(sceneObject.Guid) == false)
            {
                // Sets a UniqueName and then registers it.
                sceneObject.SetSuitableName();
            }

            if (typeof(ISceneObjectProperty).IsAssignableFrom(valueType))
            {
                sceneObject.AddTrainingProperty(valueType);
            }

            isUndoOperation = true;
        }
コード例 #31
0
ファイル: Ray.cs プロジェクト: stas1f1/CGProject
        //Ray intersecton methods

        /// <summary>
        /// Get SceneObject intersection point (assuming ray hits plane)
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public Vector3 Intersection(ISceneObject o)
        {
            switch (o)
            {
            case Box b:
                return(Intersection(b));

            case Sphere s:
                return(Intersection(s));

            case Plane p:
                return(Intersection(p));

            default:
                throw new ArgumentException("Wrong Type");
            }
        }
コード例 #32
0
        /// <summary>
        ///
        /// </summary>
        public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
        {
            // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start");

            string uri = destination.ServerURI + ObjectPath() + sog.UUID + "/";

            try
            {
                OSDMap args = new OSDMap(2);

                args["sog"] = OSD.FromString(sog.ToXml2());
                args["extra"] = OSD.FromString(sog.ExtraToXmlString());
                args["modified"] = OSD.FromBoolean(sog.HasGroupChanged);
                args["new_position"] = newPosition.ToString();

                string state = sog.GetStateSnapshot();
                if (state.Length > 0)
                    args["state"] = OSD.FromString(state);

                // Add the input general arguments
                args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
                args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
                args["destination_name"] = OSD.FromString(destination.RegionName);
                args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());

                WebUtil.PostToService(uri, args, 40000);
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}",e.ToString());
            }

            return true;
        }
コード例 #33
0
		/// <summary>
		/// Receives the scene object change.
		/// </summary>
		/// <param name="iSceneObject">I scene object.</param>

		public void ReceiveSceneObjectChange(ISceneObject<string> iSceneObject) {

//			Debug.Log ("Receive Change : " + iSceneObject.Key);

					foreach (SceneObject sceneObject in _sceneObjects) {

						if(sceneObject.Key == iSceneObject.Key) {

							sceneObject.ReceiveData(iSceneObject);
						}
								
				
					}
			}
コード例 #34
0
ファイル: Scene.cs プロジェクト: shangcheng/Aurora
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public bool IncomingCreateObject(ISceneObject sog, ISceneObject oldsog)
        {
            //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
            SceneObjectGroup newObject;
            SceneObjectGroup oldObject = (SceneObjectGroup)oldsog;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[SCENE]: Problem casting object: {0}", e.Message);
                return false;
            }
            if (!AddSceneObject(newObject))
            {
                m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
                return false;
            }

            newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1, UUID.Zero);
            newObject.RootPart.ParentGroup.ResumeScripts();

            // Do this as late as possible so that listeners have full access to the incoming object
            EventManager.TriggerOnIncomingSceneObject(newObject);

            TriggerChangedTeleport(newObject);

            if (newObject.RootPart.SitTargetAvatar.Count != 0)
            {
                lock (newObject.RootPart.SitTargetAvatar)
                {
                    foreach (UUID avID in newObject.RootPart.SitTargetAvatar)
                    {
                        ScenePresence SP = GetScenePresence(avID);
                        while (SP == null)
                        {
                            Thread.Sleep(20);
                        }
                        SP.AbsolutePosition = newObject.AbsolutePosition;
                        SP.CrossSittingAgent(SP.ControllingClient, newObject.RootPart.UUID);
                    }
                }
            }

            return true;
        }
コード例 #35
0
ファイル: Scene.cs プロジェクト: UbitUmarov/Ubit-opensim
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public bool IncomingCreateObject(ISceneObject sog)
        {
            //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
            //    ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);

            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[SCENE]: Problem casting object, exception {0}{1}", e.Message, e.StackTrace);
                return false;
            }

            if (!AddSceneObject(newObject))
            {
                m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
                return false;
            }

            // For attachments, we need to wait until the agent is root
            // before we restart the scripts, or else some functions won't work.
            if (!newObject.IsAttachment)
            {
                newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
                newObject.ResumeScripts();
            }
            else
            {
                ScenePresence sp;
                if (TryGetScenePresence(newObject.OwnerID, out sp))
                {
                    // If the scene presence is here and already a root
                    // agent, we came from a ;egacy region. Start the scripts
                    // here as they used to start.
                    // TODO: Remove in 0.7.3
                    if (!sp.IsChildAgent)
                    {
                        newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
                        newObject.ResumeScripts();
                    }
                }
            }

            // Do this as late as possible so that listeners have full access to the incoming object
            EventManager.TriggerOnIncomingSceneObject(newObject);

            return true;
        }
コード例 #36
0
ファイル: Ship.cs プロジェクト: PhilMoc/Meteorocks
 public void Collide(ISceneObject obj)
 {
 }
コード例 #37
0
ファイル: Scene.cs プロジェクト: N3X15/VoxelSim
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public bool IncomingCreateObject(ISceneObject sog)
        {
            //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[SCENE]: Problem casting object: " + e.ToString());
                return false;
            }

            if (!AddSceneObject(newObject))
            {
                m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
                return false;
            }
            
            newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2);

            newObject.ResumeScripts();

            // Do this as late as possible so that listeners have full access to the incoming object
            EventManager.TriggerOnIncomingSceneObject(newObject);

            TriggerChangedTeleport(newObject);
            
            return true;
        }
コード例 #38
0
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="regionID"></param>
        /// <param name="sog"></param>
        /// <returns></returns>
        public virtual bool IncomingCreateObject(UUID regionID, ISceneObject sog)
        {
            IScene scene = GetScene(regionID);
            if (scene == null)
                return false;
            
            //MainConsole.Instance.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                MainConsole.Instance.WarnFormat("[EntityTransferModule]: Problem casting object: {0}", e.Message);
                return false;
            }

            IAttachmentsModule attachmentsModule = scene.RequestModuleInterface<IAttachmentsModule>();
            attachmentsModule.AttachObjectFromInworldObject(sog.LocalId, scene.GetScenePresence(sog.OwnerID).ControllingClient, newObject, 0);
            /*newObject.RootPart.IsAttachment = true;
            newObject.RootPart.AttachedAvatar = sog.OwnerID;
            newObject.RootPart.AttachmentPoint = 0;
            if (!AddSceneObject(scene, newObject))
            {
                MainConsole.Instance.WarnFormat("[EntityTransferModule]: Problem adding scene object {0} in {1} ", sog.UUID, scene.RegionInfo.RegionName);
                return false;
            }

            newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, StateSource.PrimCrossing, UUID.Zero, false);*/

            return true;
        }
コード例 #39
0
        public override void UpdateObject(ISceneObject obj)
        {
            Assert.Fatal(obj is ISceneObject2D, "Only ISceneContainerObject objects can be removed from this SceneGraph");
            ISceneObject2D o = (ISceneObject2D)obj;

            _container.CheckSceneObjectBins(o);
        }
コード例 #40
0
ファイル: ObjectHandlers.cs プロジェクト: CassieEllen/opensim
 // subclasses can override this
 protected virtual bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog)
 {
     return m_SimulationService.CreateObject(destination, newPosition, sog, false);
 }
コード例 #41
0
 public HavokNavMeshGlobalSettings(ISceneObject parent, string name)
 {
     m_parent = parent;
       m_name = name;
 }
コード例 #42
0
        public bool CreateObject(GridRegion destination, ISceneObject sog)
        {
            // Try local first
            if (m_localBackend != null && m_localBackend.CreateObject(destination, sog))
            {
                //MainConsole.Instance.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
                return true;
            }

            // else do the remote thing
            bool successful = false;
            if (m_localBackend == null || !m_localBackend.IsLocalRegion(destination.RegionHandle))
            {
                string uri = MakeUri(destination, false) + sog.UUID + "/";
                //MainConsole.Instance.Debug("   >>> DoCreateObjectCall <<< " + uri);

                OSDMap args = new OSDMap(7);
                args["sog"] = OSD.FromString(sog.ToXml2());
                args["extra"] = OSD.FromString(sog.ExtraToXmlString());
                // Add the input general arguments
                args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
                args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
                args["destination_name"] = OSD.FromString(destination.RegionName);
                args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());

                OSDMap result = WebUtils.PostToService(uri, args, true, false);
                if (bool.TryParse(result["_RawResult"], out successful))
                    return successful;
            }
            return successful;
        }
コード例 #43
0
        protected HavokNavMeshGlobalSettings(SerializationInfo info, StreamingContext context)
        {
            // Nav Mesh Generation Settings
              m_parent = (ISceneObject)info.GetValue("Parent", typeof(ISceneObject));
              m_name = info.GetString("Name");
              m_characterHeight = info.GetSingle("CharacterHeight");
              m_maxWalkableSlopeDeg = info.GetSingle("MaxWalkableSlope");
              m_minRegionArea = info.GetSingle("MinRegionArea");
              m_minDistanceToSeedPoints = info.GetSingle("MinDistanceToSeedPoints");
              m_borderPreservationTolerance = info.GetSingle("BorderPreservationTolerance");
              m_minCharacterWidth = info.GetSingle("MinCharacterWidth");

              m_characterWidthUsage = (eCharacterWidthUsage)info.GetValue("CharacterWidthUsage", typeof(eCharacterWidthUsage));

              if (m_characterWidthUsage > eCharacterWidthUsage.BlockEdges)
              {
              m_characterWidthUsage = eCharacterWidthUsage.BlockEdges;
              }

              m_restrictToGeometryFromSameZoneOnly = info.GetBoolean("RestrictToZoneGeometry");
              if (SerializationHelper.HasElement(info, "TerrainLOD"))
            m_terrainLOD = (eTerrainLOD)info.GetValue("TerrainLOD", typeof(eTerrainLOD));

              // Nav Mesh Generation Settings (Advanced)
              m_quantizationGridSize = info.GetSingle("QuantizationGridSize");
              m_degenerateAreaThreshold = info.GetSingle("DegenerateAreaThreshold");
              m_degenerateWidthThreshold = info.GetSingle("DegenerateWidthThreshold");
              m_convexThreshold = info.GetSingle("ConvexThreshold");
              m_maxNumEdgesPerFace = info.GetInt32("MaxNumEdgesPerFace");
              m_weldInputVertices = info.GetBoolean("WeldInputVertices");
              m_weldThreshold = info.GetSingle("WeldThreshold");
              if (SerializationHelper.HasElement(info, "VertexSelectionMethod"))
              m_vertexSelectionMethod = (eVertexSelectionMethod)info.GetValue("VertexSelectionMethod", typeof(eVertexSelectionMethod));
              if (SerializationHelper.HasElement(info, "AreaFraction"))
              m_areaFraction = info.GetSingle("AreaFraction");
              if (SerializationHelper.HasElement(info, "VertexFraction"))
              m_vertexFraction = info.GetSingle("VertexFraction");

              // Nav Mesh Edge Matching Settings
              m_edgeConnectionIterations = info.GetInt32("EdgeConnectionIterations");
              m_edgeMatchingMetric = (eEdgeMatchingMetric)info.GetValue("EdgeMatchingMetric", typeof(eEdgeMatchingMetric));
              m_maxStepHeight = info.GetSingle("MaxStepHeight");
              m_maxSeparation = info.GetSingle("MaxSeparation");
              m_maxOverhang = info.GetSingle("MaxOverhang");
              m_planarAlignmentAngleDeg = info.GetSingle("PlanarAlignmentAngle");
              m_verticalAlignmentAngleDeg = info.GetSingle("VerticalAlignmentAngle");
              m_minEdgeOverlap = info.GetSingle("MinEdgeOverlap");

              // Nav Mesh Simplification Settings
              m_enableSimplification = info.GetBoolean("EnableSimplification");
              m_maxBorderSimplifyArea = info.GetSingle("MaxBorderSimplifyArea");
              m_maxConcaveBorderSimplifyArea = info.GetSingle("MaxConcaveBorderSimplifyArea");
              m_useHeightPartitioning = info.GetBoolean("UseHeightPartitioning");
              m_maxPartitionHeightError = info.GetSingle("MaxPartitionHeightError");

              // Nav Mesh Simplification Settings (Advanced)
              m_minCorridorWidth = info.GetSingle("MinCorridorWidth");
              m_maxCorridorWidth = info.GetSingle("MaxCorridorWidth");
              m_holeReplacementArea = info.GetSingle("HoleReplacementArea");
              m_maxLoopShrinkFraction = info.GetSingle("MaxLoopShrinkFraction");
              m_maxBorderHeightError = info.GetSingle("MaxBorderHeightError");
              m_maxBorderDistanceError = info.GetSingle("MaxBorderDistanceError");
              m_maxPartitionSize = info.GetInt32("MaxPartitionSize");
              m_useConservativeHeightPartitioning = info.GetBoolean("UseConservativeHeightPartitioning");
              m_hertelMehlhornHeightError = info.GetSingle("HertelMehlhornHeightError");
              m_planarityThresholdDeg = info.GetSingle("PlanarityThreshold");
              m_nonconvexityThreshold = info.GetSingle("NonconvexityThreshold");
              m_boundaryEdgeFilterThreshold = info.GetSingle("BoundaryEdgeFilterThreshold");
              m_maxSharedVertexHorizontalError = info.GetSingle("MaxSharedVertexHorizontalError");
              m_maxSharedVertexVerticalError = info.GetSingle("MaxSharedVertexVerticalError");
              m_maxBoundaryVertexHorizontalError = info.GetSingle("MaxBoundaryVertexHorizontalError");
              m_maxBoundaryVertexVerticalError = info.GetSingle("MaxBoundaryVertexVerticalError");
              m_mergeLongestEdgesFirst = info.GetBoolean("MergeLongestEdgesFirst");

              // Nav Mesh Split Generation Settings
              m_numTilesX = info.GetInt32("NumTilesX");
              m_numTilesY = info.GetInt32("NumTilesY");
              m_splitGenerationMethod = (eSplitGenerationMethod)info.GetValue("SplitGenerationMethod", typeof(eSplitGenerationMethod));
              m_shelverType = (eShelverType)info.GetValue("ShelverType", typeof(eShelverType));

              // Nav Mesh Link Settings
              if (SerializationHelper.HasElement(info, "LinkEdgeMatchTolerance"))
            m_linkEdgeMatchTolerance = info.GetSingle("LinkEdgeMatchTolerance");

              if (SerializationHelper.HasElement(info, "LinkMaxStepHeight"))
            m_linkMaxStepHeight = info.GetSingle("LinkMaxStepHeight");

              if (SerializationHelper.HasElement(info, "LinkMaxSeparation"))
            m_linkMaxSeparation = info.GetSingle("LinkMaxSeparation");

              if (SerializationHelper.HasElement(info, "LinkMaxOverhang"))
            m_linkMaxOverhang = info.GetSingle("LinkMaxOverhang");

              if (SerializationHelper.HasElement(info, "LinkPlanarAlignmentAngle"))
            m_linkPlanarAlignmentAngle = info.GetSingle("LinkPlanarAlignmentAngle");

              if (SerializationHelper.HasElement(info, "LinkVerticalAlignmentAngle"))
            m_linkVerticalAlignmentAngle = info.GetSingle("LinkVerticalAlignmentAngle");

              if (SerializationHelper.HasElement(info, "LinkMinEdgeOverlap"))
            m_linkMinEdgeOverlap = info.GetSingle("LinkMinEdgeOverlap");

              if (SerializationHelper.HasElement(info, "ConnectNavToPhysics"))
            m_connectNavToPhysics = info.GetBoolean("ConnectNavToPhysics");
        }
コード例 #44
0
 public EntityPropertyCollection(ISceneObject owner, DynamicPropertyCollectionType collectionType)
     : base(owner, collectionType)
 {
 }
        /**
         * Object-related communications
         */

        public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
        {
            if (destination == null)
                return false;

            if (m_scenes.ContainsKey(destination.RegionID))
            {
//                    m_log.DebugFormat(
//                        "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
//                        s.RegionInfo.RegionName, destination.RegionHandle);

                Scene s = m_scenes[destination.RegionID];

                if (isLocalCall)
                {
                    // We need to make a local copy of the object
                    ISceneObject sogClone = sog.CloneForNewScene();
                    sogClone.SetState(sog.GetStateSnapshot(), s);
                    return s.IncomingCreateObject(newPosition, sogClone);
                }
                else
                {
                    // Use the object as it came through the wire
                    return s.IncomingCreateObject(newPosition, sog);
                }
            }

            return false;
        }
コード例 #46
0
ファイル: RegionClient.cs プロジェクト: AlphaStaxLLC/taiga
        public bool DoCreateObjectCall(GridRegion region, ISceneObject sog, string sogXml2, bool allowScriptCrossing)
        {
            ulong regionHandle = GetRegionHandle(region.RegionHandle);
            string uri 
                = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort 
                    + "/object/" + sog.UUID + "/" + regionHandle.ToString() + "/";
            //m_log.Debug("   >>> DoCreateChildAgentCall <<< " + uri);

            WebRequest ObjectCreateRequest = WebRequest.Create(uri);
            ObjectCreateRequest.Method = "POST";
            ObjectCreateRequest.ContentType = "application/json";
            ObjectCreateRequest.Timeout = 10000;

            OSDMap args = new OSDMap(2);
            args["sog"] = OSD.FromString(sogXml2);
            args["extra"] = OSD.FromString(sog.ExtraToXmlString());
            if (allowScriptCrossing)
            {
                string state = sog.GetStateSnapshot();
                if (state.Length > 0)
                    args["state"] = OSD.FromString(state);
            }

            string strBuffer = "";
            byte[] buffer = new byte[1];
            try
            {
                strBuffer = OSDParser.SerializeJsonString(args);
                Encoding str = Util.UTF8;
                buffer = str.GetBytes(strBuffer);

            }
            catch (Exception e)
            {
                m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message);
                // ignore. buffer will be empty, caller should check.
            }

            Stream os = null;
            try
            { // send the Post
                ObjectCreateRequest.ContentLength = buffer.Length;   //Count bytes to send
                os = ObjectCreateRequest.GetRequestStream();
                os.Write(buffer, 0, strBuffer.Length);         //Send it
                m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
            }
            //catch (WebException ex)
            catch
            {
                // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message);

                return false;
            }
            finally
            {
                if (os != null)
                    os.Close();
            }

            // Let's wait for the response
            //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");

            StreamReader sr = null;
            try
            {
                WebResponse webResponse = ObjectCreateRequest.GetResponse();
                if (webResponse == null)
                {
                    m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post");
                }

                sr = new StreamReader(webResponse.GetResponseStream());
                //reply = sr.ReadToEnd().Trim();
                sr.ReadToEnd().Trim();
                //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply);

            }
            catch (WebException ex)
            {
                m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message);
                // ignore, really
            }
            finally
            {
                if (sr != null)
                    sr.Close();
            }

            return true;

        }
コード例 #47
0
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="regionID"></param>
        /// <param name="sog"></param>
        /// <returns></returns>
        public virtual bool IncomingCreateObject(UUID regionID, ISceneObject sog)
        {
            IScene scene = GetScene(regionID);
            if (scene == null)
                return false;
            
            //MainConsole.Instance.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                MainConsole.Instance.WarnFormat("[EntityTransferModule]: Problem casting object: {0}", e.Message);
                return false;
            }

            if (!AddSceneObject(scene, newObject))
            {
                MainConsole.Instance.WarnFormat("[EntityTransferModule]: Problem adding scene object {0} in {1} ", sog.UUID, scene.RegionInfo.RegionName);
                return false;
            }

            newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, StateSource.PrimCrossing, UUID.Zero, false);

            return true;
        }
コード例 #48
0
ファイル: Scene.cs プロジェクト: emperorstarfinder/Opensim2
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
        {
            //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
            //    ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);

            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[INTERREGION]: Problem casting object, exception {0}{1}", e.Message, e.StackTrace);
                return false;
            }

            if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition))
                return false;

            // Do this as late as possible so that listeners have full access to the incoming object
            EventManager.TriggerOnIncomingSceneObject(newObject);

            return true;
        }
コード例 #49
0
 public override DynamicPropertyCollection CreateInstance(ISceneObject forObject)
 {
     return new EntityPropertyCollection(forObject, this);
 }
コード例 #50
0
        /**
         * Object-related communications
         */

        public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
        {
            if (destination == null)
                return false;

            foreach (Scene s in m_sceneList)
            {
                if (s.RegionInfo.RegionHandle == destination.RegionHandle)
                {
                    //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
                    if (isLocalCall)
                    {
                        // We need to make a local copy of the object
                        ISceneObject sogClone = sog.CloneForNewScene(s);
                        sogClone.SetState(sog.GetStateSnapshot(), s);
                        return s.IncomingCreateObject(sogClone);
                    }
                    else
                    {
                        // Use the object as it came through the wire
                        return s.IncomingCreateObject(sog);
                    }
                }
            }
            return false;
        }
コード例 #51
0
        /**
         * Object-related communications
         */

        public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
        {
            if (destination == null)
                return false;

            // Try local first
            if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall))
            {
                //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
                return true;
            }

            // else do the remote thing
            if (!m_localBackend.IsLocalRegion(destination.RegionID))
                return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);

            return false;
        }
コード例 #52
0
        /**
         * Object-related communications
         */

        public bool CreateObject(GridRegion destination, ISceneObject sog)
        {
            if (destination == null)
                return false;

            foreach (Scene s in m_sceneList)
            {
                if (s.RegionInfo.RegionHandle == destination.RegionHandle)
                {
                    //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
                    IEntityTransferModule AgentTransferModule = s.RequestModuleInterface<IEntityTransferModule>();
                    if (AgentTransferModule != null)
                    {
                        return AgentTransferModule.IncomingCreateObject(s.RegionInfo.RegionID, sog);
                    }
                }
            }
            m_log.Warn("[LOCAL SIMULATION COMMS]: region not found in CreateObject");
            return false;
        }
コード例 #53
0
        public override void AddObject(ISceneObject obj)
        {
            Assert.Fatal(obj is ISceneObject2D, "Only ISceneContainerObject objects can be added to this SceneGraph");
            ISceneObject2D o = (ISceneObject2D)obj;

            _container.CheckSceneObjectBins(o);
        }
コード例 #54
0
        public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
        {
            string uri
                = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/";
            //m_log.Debug("   >>> DoCreateObjectCall <<< " + uri);

            WebRequest ObjectCreateRequest = WebRequest.Create(uri);
            ObjectCreateRequest.Method = "POST";
            ObjectCreateRequest.ContentType = "application/json";
            ObjectCreateRequest.Timeout = 10000;

            OSDMap args = new OSDMap(2);
            args["sog"] = OSD.FromString(sog.ToXml2());
            args["extra"] = OSD.FromString(sog.ExtraToXmlString());
            string state = sog.GetStateSnapshot();
            if (state.Length > 0)
                args["state"] = OSD.FromString(state);
            // Add the input general arguments
            args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
            args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
            args["destination_name"] = OSD.FromString(destination.RegionName);
            args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());

            string strBuffer = "";
            byte[] buffer = new byte[1];
            try
            {
                strBuffer = OSDParser.SerializeJsonString(args);
                Encoding str = Util.UTF8;
                buffer = str.GetBytes(strBuffer);

            }
            catch (Exception e)
            {
                m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Exception thrown on serialization of CreateObject: {0}", e.Message);
                // ignore. buffer will be empty, caller should check.
            }

            Stream os = null;
            try
            { // send the Post
                ObjectCreateRequest.ContentLength = buffer.Length;   //Count bytes to send
                os = ObjectCreateRequest.GetRequestStream();
                os.Write(buffer, 0, strBuffer.Length);         //Send it
                m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateObject request to remote sim {0}", uri);
            }
            catch (WebException ex)
            {
                m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on CreateObject {0}", ex.Message);
                return false;
            }
            finally
            {
                if (os != null)
                    os.Close();
            }

            // Let's wait for the response
            //m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");

            StreamReader sr = null;
            try
            {
                WebResponse webResponse = ObjectCreateRequest.GetResponse();
                if (webResponse == null)
                {
                    m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on CreateObject post");
                    return false;
                }

                sr = new StreamReader(webResponse.GetResponseStream());
                //reply = sr.ReadToEnd().Trim();
                sr.ReadToEnd().Trim();
                //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", reply);

            }
            catch (WebException ex)
            {
                m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of CreateObject {0}", ex.Message);
                return false;
            }
            finally
            {
                if (sr != null)
                    sr.Close();
            }

            return true;
        }
コード例 #55
0
ファイル: OpenSimComms.cs プロジェクト: diva/Grider
 public static bool CreateObject(RegionInfo region, ISceneObject sog)
 {
     string reason = string.Empty;
     bool success = region_comms.DoCreateObjectCall(region, sog, sog.ToXml2(), true);
     Console.WriteLine("[GridSurfer]: posted object to " + region.ExternalHostName + ":" + region.HttpPort + " -- " + success);
     return success;
 }
コード例 #56
0
ファイル: Scene.cs プロジェクト: Ideia-Boa/opensim
        public bool IncomingCreateObject(ISceneObject sog)
        {
            //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[SCENE]: Problem casting object: {0}", e.Message);
                return false;
            }

            if (!AddSceneObject(newObject))
            {
                m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
                return false;
            }
            newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
            return true;
        }
コード例 #57
0
ファイル: Scene.cs プロジェクト: CCIR/opensim
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
        {
            //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
            //    ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);

            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[INTERREGION]: Problem casting object, exception {0}{1}", e.Message, e.StackTrace);
                return false;
            }

            // If the user is banned, we won't let any of their objects
            // enter. Period.
            //
            if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID))
            {
                m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID);
                return false;
            }

            if (newPosition != Vector3.Zero)
                newObject.RootPart.GroupPosition = newPosition;

            if (!AddSceneObject(newObject))
            {
                m_log.DebugFormat(
                    "[INTERREGION]: Problem adding scene object {0} in {1} ", newObject.UUID, RegionInfo.RegionName);
                return false;
            }

            if (!newObject.IsAttachment)
            {
                // FIXME: It would be better to never add the scene object at all rather than add it and then delete
                // it
                if (!Permissions.CanObjectEntry(newObject.UUID, true, newObject.AbsolutePosition))
                {
                    // Deny non attachments based on parcel settings
                    //
                    m_log.Info("[INTERREGION]: Denied prim crossing because of parcel settings");

                    DeleteSceneObject(newObject, false);

                    return false;
                }

                // For attachments, we need to wait until the agent is root
                // before we restart the scripts, or else some functions won't work.
                newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
                newObject.ResumeScripts();
            }

            // Do this as late as possible so that listeners have full access to the incoming object
            EventManager.TriggerOnIncomingSceneObject(newObject);

            return true;
        }
コード例 #58
0
 public HavokNavMeshGlobalSettingsDictionary(ISceneObject parent)
 {
     m_parent = parent;
       m_settingsDictionary = new Dictionary<string, HavokNavMeshGlobalSettings>();
 }
コード例 #59
0
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public virtual bool IncomingCreateObject(UUID regionID, ISceneObject sog)
        {
            Scene scene = GetScene(regionID);
            if (scene == null)
                return false;
            
            //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[EntityTransferModule]: Problem casting object: {0}", e.Message);
                return false;
            }

            if (!AddSceneObject(scene, newObject))
            {
                m_log.WarnFormat("[EntityTransferModule]: Problem adding scene object {0} in {1} ", sog.UUID, scene.RegionInfo.RegionName);
                return false;
            }

            newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, 1, UUID.Zero);
            newObject.RootPart.ParentGroup.ResumeScripts();

            if (newObject.RootPart.SitTargetAvatar.Count != 0)
            {
                lock (newObject.RootPart.SitTargetAvatar)
                {
                    foreach (UUID avID in newObject.RootPart.SitTargetAvatar)
                    {
                        ScenePresence SP = scene.GetScenePresence(avID);
                        while (SP == null)
                        {
                            Thread.Sleep(20);
                        }
                        SP.AbsolutePosition = newObject.AbsolutePosition;
                        SP.CrossSittingAgent(SP.ControllingClient, newObject.RootPart.UUID);
                    }
                }
            }

            return true;
        }
コード例 #60
0
ファイル: Scene.cs プロジェクト: JAllard/opensim
        /// <summary>
        /// Called when objects or attachments cross the border, or teleport, between regions.
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
        {
            //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
            //    ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);

            SceneObjectGroup newObject;
            try
            {
                newObject = (SceneObjectGroup)sog;
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[SCENE]: Problem casting object, exception {0}{1}", e.Message, e.StackTrace);
                return false;
            }

            if (newPosition != Vector3.Zero)
                newObject.RootPart.GroupPosition = newPosition;

            if (!AddSceneObject(newObject))
            {
                m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
                return false;
            }

            // For attachments, we need to wait until the agent is root
            // before we restart the scripts, or else some functions won't work.
            if (!newObject.IsAttachment)
            {
                newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
                newObject.ResumeScripts();
            }

            // Do this as late as possible so that listeners have full access to the incoming object
            EventManager.TriggerOnIncomingSceneObject(newObject);

            return true;
        }