Universe.Region.SceneObjectGroup.SetGroup C# (CSharp) Method

SetGroup() public method

Set the user group to which this scene object belongs.
public SetGroup ( UUID GroupID2, UUID attemptingUserID, bool needsUpdate ) : void
GroupID2 UUID
attemptingUserID UUID
needsUpdate bool
return void
        public void SetGroup(UUID GroupID2, UUID attemptingUserID, bool needsUpdate)
        {
            IGroupsModule module = Scene.RequestModuleInterface<IGroupsModule>();
            if (module != null)
                if (GroupID2 != UUID.Zero && !module.GroupPermissionCheck(attemptingUserID, GroupID2, GroupPowers.None))
                    return; // No settings to groups you arn't in
            foreach (SceneObjectPart part in m_partsList)
            {
                part.SetGroup(GroupID2);
                part.Inventory.ChangeInventoryGroup(GroupID2);
            }

            HasGroupChanged = true;
            IScenePresence sp = Scene.GetScenePresence(attemptingUserID);
            if (sp != null && needsUpdate)
                GetProperties(sp.ControllingClient);
        }

Usage Example

        /// <summary>
        ///     Create a New SceneObjectGroup/Part by raycasting
        /// </summary>
        /// <param name="ownerID"></param>
        /// <param name="groupID"></param>
        /// <param name="pos"></param>
        /// <param name="rot"></param>
        /// <param name="shape"></param>
        public virtual ISceneEntity AddNewPrim (
            UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
        {
            SceneObjectGroup sceneObject = new SceneObjectGroup (ownerID, pos, rot, shape, m_DefaultObjectName,
                                                                m_parentScene);

            // If an entity creator has been registered for this prim type then use that
            if (m_entityCreators.ContainsKey ((PCode)shape.PCode)) {
                sceneObject =
                    (SceneObjectGroup)
                    m_entityCreators [(PCode)shape.PCode].CreateEntity (sceneObject, ownerID, groupID, pos, rot, shape);
            } else {
                // Otherwise, use this default creation code;
                sceneObject.SetGroup (groupID, ownerID, false);
                AddPrimToScene (sceneObject);
                sceneObject.ScheduleGroupUpdate (PrimUpdateFlags.ForcedFullUpdate);
            }


            return sceneObject;
        }
SceneObjectGroup