Пример #1
0
        public void SetPosition(Vector3 newpos, bool editPivot)
        {
            if (MultipleSelection)
            {
                //don't do anything here for multiselection
            }
            else if (EntityDef != null)
            {
                if (editPivot)
                {
                    EntityDef.SetPivotPositionFromWidget(newpos);
                }
                else
                {
                    EntityDef.SetPositionFromWidget(newpos);
                }
            }
            else if (CarGenerator != null)
            {
                CarGenerator.SetPosition(newpos);
            }
            else if (PathNode != null)
            {
                PathNode.SetPosition(newpos);
            }
            else if (NavPoly != null)
            {
                NavPoly.SetPosition(newpos);

                //if (projectForm != null)
                //{
                //    projectForm.OnWorldNavPolyModified(NavPoly);
                //}
            }
            else if (NavPoint != null)
            {
                NavPoint.SetPosition(newpos);
            }
            else if (NavPortal != null)
            {
                NavPortal.SetPosition(newpos);
            }
            else if (TrainTrackNode != null)
            {
                TrainTrackNode.SetPosition(newpos);
            }
            else if (ScenarioNode != null)
            {
                ScenarioNode.SetPosition(newpos);
            }
            else if (Audio != null)
            {
                Audio.SetPosition(newpos);
            }
        }
Пример #2
0
        public string GetFullNameString(string defval)
        {
            string name = defval;

            if (MultipleSelection)
            {
                name = "Multiple items";
            }
            else if (EntityDef != null)
            {
                name = EntityDef._CEntityDef.archetypeName.ToString();
            }
            else if (Archetype != null)
            {
                name = Archetype.Hash.ToString();
            }
            else if (CollisionBounds != null)
            {
                name = CollisionBounds.GetName();
            }
            if (Geometry != null)
            {
                name += " (" + GeometryIndex.ToString() + ")";
            }
            if (TimeCycleModifier != null)
            {
                name = TimeCycleModifier.CTimeCycleModifier.name.ToString();
            }
            if (BoxOccluder != null)
            {
                name = "BoxOccluder " + (BoxOccluder.Ymap?.Name ?? "") + ": " + BoxOccluder.Index.ToString();
            }
            if (OccludeModel != null)
            {
                name = "OccludeModel " + (OccludeModel.Ymap?.Name ?? "") + ": " + OccludeModel.Index.ToString();
            }
            if (CarGenerator != null)
            {
                name = CarGenerator.NameString();
            }
            if (EntityExtension != null)
            {
                name += ": " + EntityExtension.Name;
            }
            if (ArchetypeExtension != null)
            {
                name += ": " + ArchetypeExtension.Name;
            }
            if (WaterQuad != null)
            {
                name = "WaterQuad " + WaterQuad.ToString();
            }
            if (NavPoly != null)
            {
                name = "NavPoly " + NavPoly.ToString();
            }
            if (NavPoint != null)
            {
                name = "NavPoint " + NavPoint.ToString();
            }
            if (NavPortal != null)
            {
                name = "NavPortal " + NavPortal.ToString();
            }
            if (PathNode != null)
            {
                name = "PathNode " + PathNode.AreaID.ToString() + "." + PathNode.NodeID.ToString();// + FloatUtil.GetVector3String(PathNode.Position);
            }
            if (TrainTrackNode != null)
            {
                name = "TrainTrackNode " + FloatUtil.GetVector3String(TrainTrackNode.Position);
            }
            if (ScenarioNode != null)
            {
                name = ScenarioNode.ToString();
            }
            if (Audio != null)
            {
                name = Audio.ShortTypeName + " " + Audio.GetNameString();//  + FloatUtil.GetVector3String(Audio.InnerPos);
            }
            if (MloRoomDef != null)
            {
                name = "MloRoomDef " + MloRoomDef.RoomName;
            }
            return(name);
        }
Пример #3
0
 public void SetRotation(Quaternion newrot, bool editPivot)
 {
     if (MultipleSelectionItems != null)
     {
         if (editPivot)
         {
         }
         else
         {
             var cen   = MultipleSelectionCenter;
             var orinv = Quaternion.Invert(MultipleSelectionRotation);
             var trans = newrot * orinv;
             for (int i = 0; i < MultipleSelectionItems.Length; i++)
             {
                 if (MultipleSelectionItems[i].CollisionPoly == null)//skip polys, they use gathered verts
                 {
                     var refpos = MultipleSelectionItems[i].WidgetPosition;
                     var relpos = refpos - cen;
                     var newpos = trans.Multiply(relpos) + cen;
                     var refori = MultipleSelectionItems[i].WidgetRotation;
                     var newori = trans * refori;
                     MultipleSelectionItems[i].SetPosition(newpos, false);
                     MultipleSelectionItems[i].SetRotation(newori, false);
                 }
             }
             if (GatheredCollisionVerts != null)
             {
                 for (int i = 0; i < GatheredCollisionVerts.Length; i++)
                 {
                     var refpos = GatheredCollisionVerts[i].Position;
                     var relpos = refpos - cen;
                     var newpos = trans.Multiply(relpos) + cen;
                     GatheredCollisionVerts[i].Position = newpos;
                 }
             }
             MultipleSelectionRotation = newrot;
         }
     }
     else if (EntityDef != null)
     {
         if (editPivot)
         {
             EntityDef.SetPivotOrientationFromWidget(newrot);
         }
         else
         {
             EntityDef.SetOrientationFromWidget(newrot);
         }
     }
     else if (CarGenerator != null)
     {
         CarGenerator.SetOrientation(newrot);
     }
     else if (CollisionVertex != null)
     {
         //do nothing, but stop any poly from being rotated also
     }
     else if (CollisionPoly != null)
     {
         CollisionPoly.Orientation = newrot;
     }
     else if (CollisionBounds != null)
     {
         CollisionBounds.Orientation = newrot;
     }
     else if (ScenarioNode != null)
     {
         ScenarioNode.SetOrientation(newrot);
     }
     else if (NavPoint != null)
     {
         NavPoint.SetOrientation(newrot);
     }
     else if (NavPortal != null)
     {
         NavPortal.SetOrientation(newrot);
     }
     else if (Audio != null)
     {
         Audio.SetOrientation(newrot);
     }
 }
Пример #4
0
 public void SetPosition(Vector3 newpos, bool editPivot)
 {
     if (MultipleSelectionItems != null)
     {
         if (editPivot)
         {
         }
         else
         {
             var dpos = newpos - MultipleSelectionCenter;// oldpos;
             if (dpos == Vector3.Zero)
             {
                 return;                       //nothing moved.. (probably due to snap)
             }
             for (int i = 0; i < MultipleSelectionItems.Length; i++)
             {
                 if (MultipleSelectionItems[i].CollisionPoly == null)//skip polys, they use gathered verts
                 {
                     var refpos = MultipleSelectionItems[i].WidgetPosition;
                     MultipleSelectionItems[i].SetPosition(refpos + dpos, false);
                 }
             }
             if (GatheredCollisionVerts != null)
             {
                 for (int i = 0; i < GatheredCollisionVerts.Length; i++)
                 {
                     var refpos = GatheredCollisionVerts[i].Position;
                     GatheredCollisionVerts[i].Position = refpos + dpos;
                 }
             }
             MultipleSelectionCenter = newpos;
         }
     }
     else if (EntityDef != null)
     {
         if (editPivot)
         {
             EntityDef.SetPivotPositionFromWidget(newpos);
         }
         else
         {
             EntityDef.SetPositionFromWidget(newpos);
         }
     }
     else if (CarGenerator != null)
     {
         CarGenerator.SetPosition(newpos);
     }
     else if (PathNode != null)
     {
         PathNode.SetPosition(newpos);
     }
     else if (CollisionVertex != null)
     {
         CollisionVertex.Position = newpos;
     }
     else if (CollisionPoly != null)
     {
         CollisionPoly.Position = newpos;
     }
     else if (CollisionBounds != null)
     {
         CollisionBounds.Position = newpos;
     }
     else if (NavPoly != null)
     {
         NavPoly.SetPosition(newpos);
     }
     else if (NavPoint != null)
     {
         NavPoint.SetPosition(newpos);
     }
     else if (NavPortal != null)
     {
         NavPortal.SetPosition(newpos);
     }
     else if (TrainTrackNode != null)
     {
         TrainTrackNode.SetPosition(newpos);
     }
     else if (ScenarioNode != null)
     {
         ScenarioNode.SetPosition(newpos);
     }
     else if (Audio != null)
     {
         Audio.SetPosition(newpos);
     }
 }
Пример #5
0
        public string GetNameString(string defval)
        {
            string name = defval;

            if (MultipleSelection)
            {
                name = "Multiple items";
            }
            else if (EntityDef != null)
            {
                name = EntityDef.CEntityDef.archetypeName.ToString();
            }
            else if (Archetype != null)
            {
                name = Archetype.Hash.ToString();
            }
            else if (TimeCycleModifier != null)
            {
                name = TimeCycleModifier.CTimeCycleModifier.name.ToString();
            }
            else if (CarGenerator != null)
            {
                name = CarGenerator.CCarGen.carModel.ToString();
            }
            else if (DistantLodLights != null)
            {
                name = DistantLodLights.Ymap?.Name ?? "";
            }
            else if (CollisionBounds != null)
            {
                name = CollisionBounds.GetName();
            }
            if (EntityExtension != null)
            {
                name = EntityExtension.Name;
            }
            if (ArchetypeExtension != null)
            {
                name = ArchetypeExtension.Name;
            }
            if (WaterQuad != null)
            {
                name = "WaterQuad " + WaterQuad.ToString();
            }
            if (NavPoly != null)
            {
                name = "NavPoly " + NavPoly.ToString();
            }
            if (NavPoint != null)
            {
                name = "NavPoint " + NavPoint.ToString();
            }
            if (NavPortal != null)
            {
                name = "NavPortal " + NavPortal.ToString();
            }
            if (PathNode != null)
            {
                name = "PathNode " + PathNode.AreaID.ToString() + "." + PathNode.NodeID.ToString(); //+ FloatUtil.GetVector3String(PathNode.Position);
            }
            if (TrainTrackNode != null)
            {
                name = "TrainTrackNode " + FloatUtil.GetVector3String(TrainTrackNode.Position);
            }
            if (ScenarioNode != null)
            {
                name = ScenarioNode.ToString();
            }
            if (Audio != null)
            {
                name = Audio.ShortTypeName + " " + Audio.GetNameString();// FloatUtil.GetVector3String(Audio.InnerPos);
            }
            if (MloRoomDef != null)
            {
                name = "MloRoomDef " + MloRoomDef.RoomName;
            }
            return(name);
        }