Example #1
0
 public AnimationData(ConfigNode node)
 {
     deployLabel       = node.GetStringValue("deployLabel", "Deploy");
     retractLabel      = node.GetStringValue("retractLabel", "Retract");
     toggleLabel       = node.GetStringValue("toggleLabel", "Toggle");
     deployLimitActive = node.GetBoolValue("deployLimitActive", false);
     activeEditor      = node.GetBoolValue("activeEditor", true);
     activeFlight      = node.GetBoolValue("activeFlight", true);
     activeUnfocused   = node.GetBoolValue("activeUnfocused", false);
     activeUncommanded = node.GetBoolValue("activeUncommanded", false);
     activeEVAOnly     = node.GetBoolValue("activeEVAOnly", false);
     unfocusedRange    = node.GetFloatValue("unfocusedRange", 4f);
     oneShot           = node.GetBoolValue("oneShot", false);
     looping           = node.GetBoolValue("looping", false);
     //the actual animation data for the model
     mads = ModelAnimationData.parseAnimationData(node.GetNodes("ANIMATION"));
 }
Example #2
0
        public ModelDefinition(ConfigNode node)
        {
            configNode        = node;
            name              = node.GetStringValue("name", String.Empty);
            title             = node.GetStringValue("title", name);
            description       = node.GetStringValue("description", title);
            icon              = node.GetStringValue("icon");
            modelName         = node.GetStringValue("modelName", String.Empty);
            upgradeUnlockName = node.GetStringValue("upgradeUnlock", upgradeUnlockName);
            height            = node.GetFloatValue("height", height);
            volume            = node.GetFloatValue("volume", volume);
            mass              = node.GetFloatValue("mass", mass);
            cost              = node.GetFloatValue("cost", cost);
            diameter          = node.GetFloatValue("diameter", diameter);
            verticalOffset    = node.GetFloatValue("verticalOffset", verticalOffset);
            if (node.GetBoolValue("invertForTop", false))
            {
                orientation = ModelOrientation.BOTTOM;
            }
            else if (node.GetBoolValue("invertForBottom", false))
            {
                orientation = ModelOrientation.TOP;
            }
            invertAxis            = node.GetVector3("invertAxis", invertAxis);
            fairingDisabled       = node.GetBoolValue("fairingDisabled", fairingDisabled);
            fairingTopOffset      = node.GetFloatValue("fairingTopOffset", fairingTopOffset);
            rcsVerticalPosition   = node.GetFloatValue("rcsVerticalPosition", rcsVerticalPosition);
            rcsHorizontalPosition = node.GetFloatValue("rcsHorizontalPosition", rcsHorizontalPosition);
            rcsVerticalRotation   = node.GetFloatValue("rcsVerticalRotation", rcsVerticalRotation);
            rcsHorizontalRotation = node.GetFloatValue("rcsHorizontalRotation", rcsHorizontalRotation);

            ConfigNode[] subModelNodes = node.GetNodes("SUBMODEL");
            int          len           = subModelNodes.Length;

            subModelData = new SubModelData[len];
            for (int i = 0; i < len; i++)
            {
                subModelData[i] = new SubModelData(subModelNodes[i]);
            }

            defaultTextureSet = node.GetStringValue("defaultTextureSet");

            String[] attachNodeStrings = node.GetValues("node");
            len            = attachNodeStrings.Length;
            attachNodeData = new AttachNodeBaseData[len];
            for (int i = 0; i < len; i++)
            {
                attachNodeData[i] = new AttachNodeBaseData(attachNodeStrings[i]);
            }

            ConfigNode[] textureSetNodes = node.GetNodes("TEXTURESET");
            len         = textureSetNodes.Length;
            textureSets = new TextureSet[len];
            for (int i = 0; i < len; i++)
            {
                textureSets[i] = new TextureSet(textureSetNodes[i]);
            }
            if (node.HasValue("surface"))
            {
                surfaceNode = new AttachNodeBaseData(node.GetStringValue("surface"));
            }
            else
            {
                String val = (diameter * 0.5f) + ",0,0,1,0,0,2";
                surfaceNode = new AttachNodeBaseData(val);
            }

            if (node.HasNode("COMPOUNDMODEL"))
            {
                compoundModelData = new CompoundModelData(node.GetNode("COMPOUNDMODEL"));
            }

            if (node.HasNode("ANIMATION"))
            {
                animationData = ModelAnimationData.parseAnimationData(node.GetNodes("ANIMATION"));
            }
            else
            {
                animationData = new ModelAnimationData[0];
            }

            if (node.HasNode("CONSTRAINT"))
            {
                constraintData = node.GetNode("CONSTRAINT");
            }
        }