ScheduleFullUpdate() public method

Schedules this prim for a full update
public ScheduleFullUpdate ( ) : void
return void
Ejemplo n.º 1
0
        protected void SetScale(SceneObjectPart part, LSL_Vector scale)
        {
            if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
                return;

            IOpenRegionSettingsModule WSModule = m_host.ParentGroup.Scene.RequestModuleInterface<IOpenRegionSettingsModule>();
            if (WSModule != null)
            {
                if (WSModule.MinimumPrimScale != -1)
                {
                    if (scale.x < WSModule.MinimumPrimScale)
                        scale.x = WSModule.MinimumPrimScale;
                    if (scale.y < WSModule.MinimumPrimScale)
                        scale.y = WSModule.MinimumPrimScale;
                    if (scale.z < WSModule.MinimumPrimScale)
                        scale.z = WSModule.MinimumPrimScale;
                }

                if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical &&
                    WSModule.MaximumPhysPrimScale != -1)
                {
                    if (scale.x > WSModule.MaximumPhysPrimScale)
                        scale.x = WSModule.MaximumPhysPrimScale;
                    if (scale.y > WSModule.MaximumPhysPrimScale)
                        scale.y = WSModule.MaximumPhysPrimScale;
                    if (scale.z > WSModule.MaximumPhysPrimScale)
                        scale.z = WSModule.MaximumPhysPrimScale;
                }

                if (WSModule.MaximumPrimScale != -1)
                {
                    if (scale.x > WSModule.MaximumPrimScale)
                        scale.x = WSModule.MaximumPrimScale;
                    if (scale.y > WSModule.MaximumPrimScale)
                        scale.y = WSModule.MaximumPrimScale;
                    if (scale.z > WSModule.MaximumPrimScale)
                        scale.z = WSModule.MaximumPrimScale;
                }
            }

            Vector3 tmp = part.Scale;
            tmp.X = (float)scale.x;
            tmp.Y = (float)scale.y;
            tmp.Z = (float)scale.z;
            part.Scale = tmp;
            part.ScheduleFullUpdate(PrimUpdateFlags.FindBest);
            part.ParentGroup.HasGroupChanged = true;
        }
Ejemplo n.º 2
0
        private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 
        {
            if (rules.Length == 0)
            {
                part.RemoveParticleSystem();
                part.ParentGroup.HasGroupChanged = true;
            }
            else
            {
                Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues();
                LSL_Vector tempv = new LSL_Vector();

                float tempf = 0;

                for (int i = 0; i < rules.Length; i += 2)
                {
                    switch (rules.GetLSLIntegerItem(i))
                    {
                        case (int)ScriptBaseClass.PSYS_PART_FLAGS:
                            prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
                            break;

                        case (int)ScriptBaseClass.PSYS_PART_START_COLOR:
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartStartColor.R = (float)tempv.x;
                            prules.PartStartColor.G = (float)tempv.y;
                            prules.PartStartColor.B = (float)tempv.z;
                            break;

                        case (int)ScriptBaseClass.PSYS_PART_START_ALPHA:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.PartStartColor.A = tempf;
                            break;

                        case (int)ScriptBaseClass.PSYS_PART_END_COLOR:
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartEndColor.R = (float)tempv.x;
                            prules.PartEndColor.G = (float)tempv.y;
                            prules.PartEndColor.B = (float)tempv.z;
                            break;

                        case (int)ScriptBaseClass.PSYS_PART_END_ALPHA:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.PartEndColor.A = tempf;
                            break;

                        case (int)ScriptBaseClass.PSYS_PART_START_SCALE:
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartStartScaleX = (float)tempv.x;
                            prules.PartStartScaleY = (float)tempv.y;
                            break;

                        case (int)ScriptBaseClass.PSYS_PART_END_SCALE:
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartEndScaleX = (float)tempv.x;
                            prules.PartEndScaleY = (float)tempv.y;
                            break;

                        case (int)ScriptBaseClass.PSYS_PART_MAX_AGE:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.PartMaxAge = tempf;
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_ACCEL:
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartAcceleration.X = (float)tempv.x;
                            prules.PartAcceleration.Y = (float)tempv.y;
                            prules.PartAcceleration.Z = (float)tempv.z;
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
                            int tmpi = (int)rules.GetLSLIntegerItem(i + 1);
                            prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
                            break;

                        // PSYS_SRC_INNERANGLE and PSYS_SRC_ANGLE_BEGIN use the same variables. The
                        // PSYS_SRC_OUTERANGLE and PSYS_SRC_ANGLE_END also use the same variable. The
                        // client tells the difference between the two by looking at the 0x02 bit in
                        // the PartFlags variable.
                        case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.InnerAngle = (float)tempf;
                            prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.OuterAngle = (float)tempf;
                            prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
                             break;

                        case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
                            prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1));
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.BurstRate = (float)tempf;
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT:
                            prules.BurstPartCount = (byte)(int)rules.GetLSLIntegerItem(i + 1);
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.BurstRadius = (float)tempf;
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.BurstSpeedMin = (float)tempf;
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.BurstSpeedMax = (float)tempf;
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.MaxAge = (float)tempf;
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_TARGET_KEY:
                            UUID key = UUID.Zero;
                            if (UUID.TryParse(rules.Data[i + 1].ToString(), out key))
                            {
                                prules.Target = key;
                            }
                            else
                            {
                                prules.Target = part.UUID;
                            }
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_OMEGA:
                            // AL: This is an assumption, since it is the only thing that would match.
                            tempv = rules.GetVector3Item(i + 1);
                            prules.AngularVelocity.X = (float)tempv.x;
                            prules.AngularVelocity.Y = (float)tempv.y;
                            prules.AngularVelocity.Z = (float)tempv.z;
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.InnerAngle = (float)tempf;
                            prules.PartFlags |= 0x02; // Set new angle format.
                            break;

                        case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.OuterAngle = (float)tempf;
                            prules.PartFlags |= 0x02; // Set new angle format.
                            break;
                    }

                }
                prules.CRC = 1;

                part.AddNewParticleSystem(prules);
                part.ParentGroup.HasGroupChanged = true;
            }
            part.ScheduleFullUpdate(PrimUpdateFlags.Particles);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set the media entry on the face of the given part.
        /// </summary>
        /// <param name="part">/param>
        /// <param name="face"></param>
        /// <param name="me">If null, then the media entry is cleared.</param>
        public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
        {
//            m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
            
            CheckFaceParam(part, face);
            
            if (null == part.Shape.Media)
            {
                if (me == null)
                    return;
                else                            
                    part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
            }

            lock (part.Shape.Media)
                part.Shape.Media[face] = me;                      
            
            UpdateMediaUrl(part, UUID.Zero);
            
            SetPartMediaFlags(part, face, me != null);
            
            part.ScheduleFullUpdate();
            part.TriggerScriptChangedEvent(Changed.MEDIA);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Set the owner of the root part.
        /// </summary>
        /// <param name="part"></param>
        /// <param name="cAgentID"></param>
        /// <param name="cGroupID"></param>
        public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID)
        {
            part.LastOwnerID = part.OwnerID;
            part.OwnerID = cAgentID;
            part.GroupID = cGroupID;

            if (part.OwnerID != cAgentID)
            {
                // Apply Next Owner Permissions if we're not bypassing permissions
                if (!m_scene.Permissions.BypassPermissions())
                    ApplyNextOwnerPermissions();
            }

            part.ScheduleFullUpdate();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Set a light point on a part
        /// </summary>
        /// FIXME: Much of this code should probably be in SceneObjectGroup
        ///
        /// <param name="part"></param>
        /// <param name="light"></param>
        /// <param name="color"></param>
        /// <param name="intensity"></param>
        /// <param name="radius"></param>
        /// <param name="falloff"></param>
        protected void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff)
        {
            if (part == null)
                return;

            if (light)
            {
                part.Shape.LightEntry = true;
                part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f);
                part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f);
                part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f);
                part.Shape.LightIntensity = intensity;
                part.Shape.LightRadius = radius;
                part.Shape.LightFalloff = falloff;
            }
            else
            {
                part.Shape.LightEntry = false;
            }

            part.ParentGroup.HasGroupChanged = true;
            part.ScheduleFullUpdate();
        }
Ejemplo n.º 6
0
 private static void StopSound(SceneObjectPart m_host)
 {
     m_host.AdjustSoundGain(0);
     // Xantor 20080528: Clear prim data of sound instead
     if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host))
     {
         if (m_host.ParentGroup.LoopSoundMasterPrim == m_host)
         {
             foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims)
             {
                 part.Sound = UUID.Zero;
                 part.SoundFlags = 1 << 5;
                 part.SoundRadius = 0;
                 part.ScheduleFullUpdate();
                 part.SendFullUpdateToAllClients();
             }
             m_host.ParentGroup.LoopSoundMasterPrim = null;
             m_host.ParentGroup.LoopSoundSlavePrims.Clear();
         }
         else
         {
             m_host.Sound = UUID.Zero;
             m_host.SoundFlags = 1 << 5;
             m_host.SoundRadius = 0;
             m_host.ScheduleFullUpdate();
             m_host.SendFullUpdateToAllClients();
         }
     }
     else
     {
         m_host.Sound = UUID.Zero;
         m_host.SoundFlags = 1 << 5;
         m_host.SoundRadius = 0;
         m_host.ScheduleFullUpdate();
         m_host.SendFullUpdateToAllClients();
     }
 }
Ejemplo n.º 7
0
        public void PlaybackState(SceneObjectPart part)
        {
            if (part != null)
            {
                part.Undoing = true;

                if (part.ParentID == 0)
                {
                    if (Position != Vector3.Zero)
                    {
                        part.ParentGroup.AbsolutePosition = Position;
                    }
                    part.RotationOffset = Rotation;
                    if (Scale != Vector3.Zero)
                    {
                        part.Scale = Scale;
                    }

                    lock (part.ParentGroup.Children)
                    {
                        foreach (SceneObjectPart child in
                                part.ParentGroup.Children.Values.Where(child => child.UUID != part.UUID))
                        {
                            child.Undo(); //No updates here, child undo will do it on their own
                        }
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        part.OffsetPosition = Position;
                    }
						
                    part.UpdateRotation(Rotation);
                    if (Scale != Vector3.Zero)
                    {
                        part.Resize(Scale);
                    }
                }
                part.Undoing = false;
                part.ScheduleFullUpdate();
            }
        }
Ejemplo n.º 8
0
 private bool SetSlice(SceneObjectPart part, float begin, float end)
 {
     switch (GetScriptPrimType(part.Shape))
     {
         case OpenMetaverse.PrimType.Box:
         case OpenMetaverse.PrimType.Cylinder:
         case OpenMetaverse.PrimType.Prism:
             part.Shape.PathBegin = PackBeginCut(begin);
             part.Shape.PathEnd = PackEndCut(end);
             part.ScheduleFullUpdate();
             return true;
         default:
             return false;
     }
 }
Ejemplo n.º 9
0
 private bool SetTaper(SceneObjectPart part, float x, float y)
 {
     switch (GetScriptPrimType(part.Shape))
     {
         case OpenMetaverse.PrimType.Box:
         case OpenMetaverse.PrimType.Cylinder:
         case OpenMetaverse.PrimType.Prism:
             part.Shape.PathScaleX = PackTaper(x);
             part.Shape.PathScaleY = PackTaper(y);
             part.ScheduleFullUpdate();
             return true;
         case OpenMetaverse.PrimType.Torus:
         case OpenMetaverse.PrimType.Tube:
         case OpenMetaverse.PrimType.Ring:
             part.Shape.PathTaperX = PackSTaper(x);
             part.Shape.PathTaperY = PackSTaper(y);
             part.ScheduleFullUpdate();
             return true;
         default:
             return false;
     }
 }
Ejemplo n.º 10
0
 private bool SetProfilecut(SceneObjectPart part, float begin, float end)
 {
     switch (GetScriptPrimType(part.Shape))
     {
         case OpenMetaverse.PrimType.Torus:
         case OpenMetaverse.PrimType.Tube:
         case OpenMetaverse.PrimType.Ring:
             part.Shape.ProfileBegin = PackBeginCut(begin);
             part.Shape.ProfileEnd = PackEndCut(end);
             part.ScheduleFullUpdate();
             return true;
         default:
             return false;
     }
 }
Ejemplo n.º 11
0
 private bool SetSkew(SceneObjectPart part, float value)
 {
     switch (GetScriptPrimType(part.Shape))
     {
         case OpenMetaverse.PrimType.Torus:
         case OpenMetaverse.PrimType.Tube:
         case OpenMetaverse.PrimType.Ring:
             part.Shape.PathSkew = PackSkew(value);
             part.ScheduleFullUpdate();
             return true;
         default:
             return false;
     }
 }
Ejemplo n.º 12
0
 private bool SetHollowShape(SceneObjectPart part, int value)
 {
     switch (GetScriptPrimType(part.Shape))
     {
         default:
             part.Shape.HollowShape = (HollowShape)value;
             part.ScheduleFullUpdate();
             return true;
     }
 }
Ejemplo n.º 13
0
 private bool SetHollow(SceneObjectPart part, float value)
 {
     switch (GetScriptPrimType(part.Shape))
     {
         default:
             part.Shape.ProfileHollow = PackHollow(value);
             part.ScheduleFullUpdate();
             return true;
     }
 }
Ejemplo n.º 14
0
 private bool SetHoleSize(SceneObjectPart part, float x, float y)
 {
     switch (GetScriptPrimType(part.Shape))
     {
         case OpenMetaverse.PrimType.Torus:
         case OpenMetaverse.PrimType.Tube:
         case OpenMetaverse.PrimType.Ring:
             part.Shape.PathScaleX = PackHoleSize(x);
             part.Shape.PathScaleY = PackHoleSize(y);
             part.ScheduleFullUpdate();
             return true;
         default:
             return false;
     }
 }
Ejemplo n.º 15
0
        private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate)
        {

            Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation();
            pTexAnim.Flags = (Primitive.TextureAnimMode)mode;

            //ALL_SIDES
            if (face == ScriptBaseClass.ALL_SIDES)
                face = 255;

            pTexAnim.Face = (uint)face;
            pTexAnim.Length = (float)length;
            pTexAnim.Rate = (float)rate;
            pTexAnim.SizeX = (uint)sizex;
            pTexAnim.SizeY = (uint)sizey;
            pTexAnim.Start = (float)start;

            part.AddTextureAnimation(pTexAnim);
            part.ScheduleFullUpdate(PrimUpdateFlags.FindBest);
            part.ParentGroup.HasGroupChanged = true;
        }
Ejemplo n.º 16
0
 private bool SetTwist(SceneObjectPart part, float begin, float end)
 {
     switch (GetScriptPrimType(part.Shape))
     {
         case OpenMetaverse.PrimType.Box:
         case OpenMetaverse.PrimType.Cylinder:
         case OpenMetaverse.PrimType.Prism:
             part.Shape.PathTwistBegin = PackTwist180(begin);
             part.Shape.PathTwist = PackTwist180(end);
             part.ScheduleFullUpdate();
             return true;
         default:
             part.Shape.PathTwistBegin = PackTwist360(begin);
             part.Shape.PathTwist = PackTwist360(end);
             part.ScheduleFullUpdate();
             return true;
     }
 }
Ejemplo n.º 17
0
        public void doChangeObject(SceneObjectPart part, ObjectChangeData data)
        {
            // TODO  this still as excessive *.Schedule*Update()s

            if (part != null && part.ParentGroup != null)
            {
                ObjectChangeType change = data.change;
                bool togroup = ((change & ObjectChangeType.Group) != 0);
                //                bool uniform = ((what & ObjectChangeType.UniformScale) != 0);  not in use

                SceneObjectGroup group = part.ParentGroup;
                PhysicsActor pha = group.RootPart.PhysActor;

                updatetype updateType = updatetype.none;

                if (togroup)
                {
                    // related to group
                    if ((change & (ObjectChangeType.Rotation | ObjectChangeType.Position)) != 0)
                    {
                        if ((change & ObjectChangeType.Rotation) != 0)
                        {
                            group.RootPart.UpdateRotation(data.rotation);
                            updateType = updatetype.none;
                        }
                        if ((change & ObjectChangeType.Position) != 0)
                        {
                            if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position))
                                UpdateGroupPosition(data.position);
                            updateType = updatetype.groupterse;
                        }
                        else
                        // ugly rotation update of all parts
                        {
                            group.ResetChildPrimPhysicsPositions();
                        }

                    }
                    if ((change & ObjectChangeType.Scale) != 0)
                    {
                        if (pha != null)
                            pha.Building = true;

                        group.GroupResize(data.scale);
                        updateType = updatetype.none;

                        if (pha != null)
                            pha.Building = false;
                    }
                }
                else
                {
                    // related to single prim in a link-set ( ie group)
                    if (pha != null)
                        pha.Building = true;

                    // root part is special
                    // parts offset positions or rotations need to change also

                    if (part == group.RootPart)
                    {
                        if ((change & ObjectChangeType.Rotation) != 0)
                            group.UpdateRootRotation(data.rotation);
                        if ((change & ObjectChangeType.Position) != 0)
                            group.UpdateRootPosition(data.position);
                        if ((change & ObjectChangeType.Scale) != 0)
                            part.Resize(data.scale);
                    }
                    else
                    {
                        if ((change & ObjectChangeType.Position) != 0)
                        {
                            part.OffsetPosition = data.position;
                            updateType = updatetype.partterse;
                        }
                        if ((change & ObjectChangeType.Rotation) != 0)
                        {
                            part.UpdateRotation(data.rotation);
                            updateType = updatetype.none;
                        }
                        if ((change & ObjectChangeType.Scale) != 0)
                        {
                            part.Resize(data.scale);
                            updateType = updatetype.none;
                        }
                    }

                    if (pha != null)
                        pha.Building = false;
                }

                if (updateType != updatetype.none)
                {
                    group.HasGroupChanged = true;

                    switch (updateType)
                    {
                        case updatetype.partterse:
                            part.ScheduleTerseUpdate();
                            break;
                        case updatetype.partfull:
                            part.ScheduleFullUpdate();
                            break;
                        case updatetype.groupterse:
                            group.ScheduleGroupForTerseUpdate();
                            break;
                        case updatetype.groupfull:
                            group.ScheduleGroupForFullUpdate();
                            break;
                        default:
                            break;
                    }
                }
            }
        }
Ejemplo n.º 18
0
        public void PlayfwdState(SceneObjectPart part)
        {
            if (part != null)
            {
                bool ChangedScale = false;
                bool ChangedRot = false;
                bool ChangedPos = false;
                part.Undoing = true;

                if (part.UUID == part.ParentGroup.UUID)
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.ParentGroup.AbsolutePosition = Position;
                    }
                    if (Rotation != Quaternion.Identity)
                    {
                        ChangedRot = true;
                        part.UpdateRotation(Rotation);
                    }
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }

                    foreach (SceneObjectPart child in part.ParentGroup.ChildrenList)
                    {
                        if (child.UUID != part.UUID)
                            child.Redo(); //No updates here, child redo will do it on their own
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.OffsetPosition = Position;
                    }
                    if (Rotation != Quaternion.Identity)
                    {
                        ChangedRot = true;
                        part.ParentGroup.Rotation = (Rotation);
                    }
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }
                }

                part.ScheduleFullUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) | 
                    (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
                part.Undoing = false;
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Set flexi parameters of a part.
        ///
        /// FIXME: Much of this code should probably be within the part itself.
        /// </summary>
        /// <param name="part"></param>
        /// <param name="flexi"></param>
        /// <param name="softness"></param>
        /// <param name="gravity"></param>
        /// <param name="friction"></param>
        /// <param name="wind"></param>
        /// <param name="tension"></param>
        /// <param name="Force"></param>
        protected void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction,
            float wind, float tension, LSL_Vector Force)
        {
            if (part == null)
                return;

            if (flexi)
            {
                part.Shape.FlexiEntry = true;   // this setting flexi true isn't working, but the below parameters do
                                                                // work once the prim is already flexi
                part.Shape.FlexiSoftness = softness;
                part.Shape.FlexiGravity = gravity;
                part.Shape.FlexiDrag = friction;
                part.Shape.FlexiWind = wind;
                part.Shape.FlexiTension = tension;
                part.Shape.FlexiForceX = (float)Force.x;
                part.Shape.FlexiForceY = (float)Force.y;
                part.Shape.FlexiForceZ = (float)Force.z;
                part.Shape.PathCurve = (byte)Extrusion.Flexible;
            }
            else
            {
                // Other values not set, they do not seem to be sent to the viewer
                // Setting PathCurve appears to be what actually toggles the check box and turns Flexi on and off
                part.Shape.PathCurve = (byte)Extrusion.Straight;
                part.Shape.FlexiEntry = false;
            }
            part.ParentGroup.HasGroupChanged = true;
            part.ScheduleFullUpdate();
        }
Ejemplo n.º 20
0
        public void PlaybackState(SceneObjectPart part)
        {
            if (part != null)
            {
                part.Undoing = true;

                bool ChangedScale = false;
                bool ChangedRot = false;
                bool ChangedPos = false;

                if (part.ParentID == 0)
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.ParentGroup.AbsolutePosition = Position;
                    }
                    ChangedRot = true;
                    part.RotationOffset = Rotation;
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Scale = Scale;
                    }

                    lock (part.ParentGroup.Children)
                    {
                        foreach (SceneObjectPart child in
                                part.ParentGroup.Children.Values.Where(child => child.UUID != part.UUID))
                        {
                            child.Undo(); //No updates here, child undo will do it on their own
                        }
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.OffsetPosition = Position;
                    }

                    ChangedRot = true;
                    part.UpdateRotation(Rotation);
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }
                }
                part.Undoing = false;
                part.ScheduleFullUpdate();
                //part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                //                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                //                    (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Set the media entry on the face of the given part.
        /// </summary>
        /// <param name="part">/param>
        /// <param name="face"></param>
        /// <param name="me">If null, then the media entry is cleared.</param>
        public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
        {
            //            m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
            int numFaces = part.GetNumberOfSides();
            if (part.Shape.Media == null)
                part.Shape.Media = new PrimitiveBaseShape.PrimMedia(numFaces);
            else
                part.Shape.Media.Resize(numFaces);

            if (!CheckFaceParam(part, face))
                return;

            // ClearMediaEntry passes null for me so it must not be ignored!
            lock (part.Shape.Media)
                part.Shape.Media[face] = me;

            UpdateMediaUrl(part, UUID.Zero);

            SetPartMediaFlags(part, face, me != null);

            part.ScheduleFullUpdate(PrimUpdateFlags.FindBest);
            part.TriggerScriptChangedEvent(Changed.MEDIA);
        }
Ejemplo n.º 22
0
        private static void StopSound(SceneObjectPart m_host)
        {
//            m_host.AdjustSoundGain(0);
            m_host.Sound = UUID.Zero;
            m_host.SoundFlags = (byte)SoundFlags.STOP;
            m_host.SoundRadius = 0;
            m_host.SoundGain = 0;
            m_host.ScheduleFullUpdate();
            m_host.SendFullUpdateToAllClients();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Set flexi parameters of a part.
        ///
        /// FIXME: Much of this code should probably be within the part itself.
        /// </summary>
        /// <param name="part"></param>
        /// <param name="flexi"></param>
        /// <param name="softness"></param>
        /// <param name="gravity"></param>
        /// <param name="friction"></param>
        /// <param name="wind"></param>
        /// <param name="tension"></param>
        /// <param name="Force"></param>
        protected void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction,
            float wind, float tension, LSL_Vector Force)
        {
            if (part == null)
                return;

            if (flexi)
            {
                part.Shape.FlexiEntry = true;   // this setting flexi true isn't working, but the below parameters do
                                                                // work once the prim is already flexi
                part.Shape.FlexiSoftness = softness;
                part.Shape.FlexiGravity = gravity;
                part.Shape.FlexiDrag = friction;
                part.Shape.FlexiWind = wind;
                part.Shape.FlexiTension = tension;
                part.Shape.FlexiForceX = (float)Force.x;
                part.Shape.FlexiForceY = (float)Force.y;
                part.Shape.FlexiForceZ = (float)Force.z;
                part.Shape.PathCurve = 0x80;
                part.ParentGroup.HasGroupChanged = true;
                part.ScheduleFullUpdate();
            }
        }
Ejemplo n.º 24
0
        private void SetSOPFlags(SceneObjectPart part, PrimFlags flags)
        {
            //Do not set part.Flags yet,
            //part.Flags = flags;
            // DebugLog.WarnFormat("[SYNC INFO PRIM] SetSOPFlags");

            bool UsePhysics = (flags & PrimFlags.Physics) != 0;
            bool IsTemporary = (flags & PrimFlags.TemporaryOnRez) != 0;
            //bool IsVolumeDetect = part.VolumeDetectActive;
            bool IsPhantom = (flags & PrimFlags.Phantom) != 0;

            if (part.ParentGroup != null)
            {
                //part.ParentGroup.UpdatePrimFlagsBySync(part.LocalId, UsePhysics, IsTemporary, IsPhantom, part.VolumeDetectActive);
                part.ParentGroup.UpdatePrimFlags(part.LocalId, UsePhysics, IsTemporary, IsPhantom, part.VolumeDetectActive);
                //part.UpdatePrimFlagsBySync(UsePhysics, IsTemporary, IsPhantom, part.VolumeDetectActive);
            }
            part.Flags = flags;
            //DSL part.aggregateScriptEventSubscriptions();
            part.ScheduleFullUpdate();
        }
Ejemplo n.º 25
0
 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
 {
     CheckFaceParam(part, face);
     
     if (null == part.Shape.Media)
         part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
         
     lock (part.Shape.Media)
         part.Shape.Media[face] = me;
     
     UpdateMediaUrl(part, UUID.Zero);
     part.ScheduleFullUpdate(PrimUpdateFlags.FullUpdate);
     part.TriggerScriptChangedEvent(Changed.MEDIA);
 }
Ejemplo n.º 26
0
        public void PlayfwdState(SceneObjectPart part)
        {
            if (part != null)
            {
                part.Undoing = true;

                if (part.ParentID == 0)
                {
                    if (Position != Vector3.Zero)
                    {
                        part.ParentGroup.AbsolutePosition = Position;
                    }
                    part.RotationOffset = Rotation;
                    if (Scale != Vector3.Zero)
                    {
                        part.Scale = Scale;
                    }

                    foreach (SceneObjectPart child in
                                part.ParentGroup.GetParts().Where(child => child.UUID != part.UUID))
                    {
                        child.Redo(); //No updates here, child redo will do it on their own
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        part.OffsetPosition = Position;
                    }

                    part.UpdateRotation(Rotation);
                    if (Scale != Vector3.Zero)
                    {
                        part.Resize(Scale);
                    }
                }
                part.Undoing = false;
                part.ScheduleFullUpdate(PrimUpdateFlags.FindBest);
            }
        }