// create a constraint of this type public ConstraintCreator(EngineInstanceConstraint.ConstraintType_e type) { IconIndex = EditorManager.GUI.ShapeTreeImages.AddBitmap(Path.Combine(EditorManager.AppDataDir, @"bitmaps\Shapes\Constraint.bmp"), Color.Magenta); CategoryIconIndex = IconIndex; _type = type; }
/// <summary> /// Called when deserializing /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected ConstraintShape(SerializationInfo info, StreamingContext context) : base(info, context) { _bInside = info.GetBoolean( "_bInside" ); _eReflection = (EngineInstanceConstraint.ConstraintReflectionType_e) info.GetValue( "_eReflection", typeof(EngineInstanceConstraint.ConstraintReflectionType_e) ); _eType = (EngineInstanceConstraint.ConstraintType_e) info.GetValue( "_eType" ,typeof(EngineInstanceConstraint.ConstraintType_e) ); _fConeAngle = info.GetSingle( "_fConeAngle" ); _fIntensity = info.GetSingle( "_fIntensity" ); _fPersistance = info.GetSingle( "_fPersistance" ); _fRadius = info.GetSingle( "_fRadius" ); if (SerializationHelper.HasElement(info,"_fLength")) _fLength = info.GetSingle( "_fLength" ); _vBoxSize = (Vector3F) info.GetValue( "_vBoxSize", typeof(Vector3F) ); if (SerializationHelper.HasElement(info,"_fRandomness")) _fRandomness = info.GetSingle( "_fRandomness" ); if (SerializationHelper.HasElement(info,"_iAffectBitmask")) _iAffectBitmask = (FlagsInt32_e)info.GetValue("_iAffectBitmask", typeof(FlagsInt32_e)); if (SerializationHelper.HasElement(info, "_bInfiniteExtension")) _bInfiniteExtent = info.GetBoolean("_bInfiniteExtension"); if (SerializationHelper.HasElement(info, "_fReflectionNoise")) _fReflectionNoise = info.GetSingle("_fReflectionNoise"); // backwards compatibility if (!SerializationHelper.HasElement(info, "SupportScaling")) SetScaling_Internal(1.0f, 1.0f, 1.0f); }