public async Task <List <BXDAMesh> > ExportMeshes(RobotDataManager robotDataManager)
        {
            this.robotDataManager = robotDataManager;
            await Task.Run(ShowDialog).ConfigureAwait(false);

            return(exportMeshes);
        }
Example #2
0
        public DrivetrainLayoutForm(RobotDataManager robotDataManager)
        {
            this.robotDataManager = robotDataManager;
            InitializeComponent();

            controls.Add(RigidNode_Base.DriveTrainType.TANK, tankOption);
            controls.Add(RigidNode_Base.DriveTrainType.H_DRIVE, hdriveOption);
            controls.Add(RigidNode_Base.DriveTrainType.CUSTOM, customOption);

            foreach (var keyValuePair in controls)
            {
                WinFormsUtils.RecursiveControlNavigator(keyValuePair.Value, control => control.MouseDown  += (sender, args) => SelectType(keyValuePair.Key));
                WinFormsUtils.RecursiveControlNavigator(keyValuePair.Value, control => control.MouseEnter += (sender, args) =>
                {
                    if (driveTrainType != keyValuePair.Key)
                    {
                        keyValuePair.Value.BackColor = HoverColor;
                    }
                });
                WinFormsUtils.RecursiveControlNavigator(keyValuePair.Value, control => control.MouseLeave += (sender, args) =>
                {
                    if (driveTrainType != keyValuePair.Key)
                    {
                        keyValuePair.Value.BackColor = DefaultColor;
                    }
                });
            }


            SelectType(robotDataManager.RobotBaseNode.driveTrainType);
        }
Example #3
0
        public void LoadRobot(RobotDataManager robotDataManager)
        {
            SuspendLayout();

            DefinePartsLayout.Controls.Clear();
            DefinePartsLayout.RowStyles.Clear();

            jointCards.Clear();
            foreach (var node in robotDataManager.RobotBaseNode.ListAllNodes())
            {
                if (node.GetSkeletalJoint() == null || JointDriver.GetAllowedDrivers(node.GetSkeletalJoint()).Length == 0)
                {
                    continue;
                }

                var panel = new JointCardUC(node, this, robotDataManager)
                {
                    Dock = DockStyle.Top
                };
                jointCards.Add(panel);
                AddControlToNewTableRow(panel, DefinePartsLayout);
            }

            jointCards.ForEach(card => card.LoadPreviewIcon());

            ResumeLayout();
        }
Example #4
0
        public DrivetrainWeightForm(RobotDataManager robotDataManager)
        {
            InitializeComponent();
            TotalWeightKg = robotDataManager.RobotWeightKg;
            PreferMetric  = robotDataManager.RobotPreferMetric;

            SetWeightBoxValue(TotalWeightKg * (PreferMetric ? 1 : 2.20462f));
            CalculatedWeightCheck.Checked = TotalWeightKg <= 0;
            UnitBox.SelectedIndex         = PreferMetric ? 1 : 0;
        }
Example #5
0
        public JointCardUC(RigidNode_Base node, JointEditorForm jointEditorForm, RobotDataManager robotDataManager)
        {
            this.robotDataManager = robotDataManager;
            this.jointEditorForm  = jointEditorForm;
            this.node             = node;

            InitializeComponent();

            WinFormsUtils.DisableScrollSelection(this);

            AddHighlightAction(this);
        }
Example #6
0
        protected override void OnEnvironmentOpen()
        {
            AnalyticsUtils.StartSession();

            Application.UserInterfaceManager.UserInteractionDisabled = true;
            var loadingBar = new LoadingBar("Loading Export Environment...");

            loadingBar.SetProgress(new ProgressUpdate("Preparing UI Managers...", 1, 10));
            loadingBar.Show();
            HighlightManager.EnvironmentOpening(OpenAssemblyDocument);

            // Disable non-jointed components
            disabledAssemblyOccurrences = new List <ComponentOccurrence>();
            disabledAssemblyOccurrences.AddRange(InventorUtils.DisableUnconnectedComponents(OpenAssemblyDocument));

            loadingBar.SetProgress(new ProgressUpdate("Loading Robot Skeleton...", 2, 10));
            // Load robot skeleton and prepare UI
            RobotDataManager = new RobotDataManager();
            if (!RobotDataManager.LoadRobotSkeleton(new Progress <ProgressUpdate>(loadingBar.SetProgress)))
            {
                loadingBar.Close();
                Application.UserInterfaceManager.UserInteractionDisabled = false;
                InventorUtils.ForceQuitExporter(OpenAssemblyDocument);
                return;
            }

            if (RobotDataManager.wasForceQuit)
            {
                return;
            }

            loadingBar.SetProgress(new ProgressUpdate("Loading Joint Data...", 7, 10));
            RobotDataManager.LoadRobotData(OpenAssemblyDocument);

            loadingBar.SetProgress(new ProgressUpdate("Initializing UI...", 8, 10));
            // Create dockable window UI
            var uiMan = Application.UserInterfaceManager;

            advancedJointEditor.CreateDockableWindow(uiMan);
            jointViewKey.Init(uiMan);
            guideManager.Init(uiMan);

            guideManager.Visible = AddInSettingsManager.ShowGuide;

            loadingBar.SetProgress(new ProgressUpdate("Loading Robot Skeleton...", 9, 10));
            // Load skeleton into joint editors
            advancedJointEditor.LoadRobot(RobotDataManager);
            jointEditorForm.LoadRobot(RobotDataManager);
            loadingBar.Close();
            Application.UserInterfaceManager.UserInteractionDisabled = false;
        }
Example #7
0
        /// <summary>
        /// Prompts the user for the name of the robot, as well as other information.
        /// </summary>
        /// <returns>True if user pressed okay, false if they pressed cancel</returns>
        public static bool PromptExportSettings(RobotDataManager robotDataManager)
        { // TODO: Compact this down
            if (Prompt(robotDataManager.RobotName, out var robotName, out var colors, out var openSynthesis) == DialogResult.OK)
            {
                robotDataManager.RobotName = robotName;

                RobotExporterAddInServer.Instance.AddInSettingsManager.DefaultExportWithColors = colors;
                RobotExporterAddInServer.Instance.AddInSettingsManager.SaveSettings();

                return(true);
            }

            return(false);
        }
Example #8
0
 public static string JointTypeString(SkeletalJoint_Base joint, RobotDataManager robotDataManager = null)
 {
     return(StringUtils.CapitalizeFirstLetter(Enum.GetName(typeof(SkeletalJointType), joint.GetJointType()), true)
            + (joint.weight <= 0 ? ", Calculated Weight" : ", " + Math.Round(Math.Max(joint.weight, 0) * (robotDataManager != null && robotDataManager.RobotPreferMetric ? 1 : 2.20462f), 2) + (robotDataManager != null && robotDataManager.RobotPreferMetric ? " Kilograms" : " Pounds")));
 }
Example #9
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            try
            {
                Sim actor  = parameters.mActor as Sim;
                Sim target = parameters.mTarget as Sim;

                if (!AcceptCancelDialog.Show("You are about to run 'TestSim', proceed?"))
                {
                    return(OptionResult.Failure);
                }

                SimOutfit outfit = new SimOutfit(target.SimDescription.DefaultOutfitKey);

                CASPart part3 = new CASPart();
                foreach (CASPart part4 in outfit.Parts)
                {
                    if (part4.BodyType == BodyTypes.LowerBody)
                    {
                        part3 = part4;
                    }
                }

                msg += Common.NewLine + part3.Key;

                string vFXName = RobotDataManager.GetVFXName(part3.Key.InstanceId, RobotDataManager.RobotParts.InGameHoverVFX);
                msg += Common.NewLine + "A: " + vFXName;

                vFXName = RobotDataManager.GetVFXName(part3.Key.InstanceId, RobotDataManager.RobotParts.CABHoverVFX);
                msg    += Common.NewLine + "B: " + vFXName;

                outfit = target.SimDescription.GetOutfit(OutfitCategories.Everyday, 0);

                part3 = new CASPart();
                foreach (CASPart part4 in outfit.Parts)
                {
                    if (part4.BodyType == BodyTypes.LowerBody)
                    {
                        part3 = part4;
                    }
                }

                msg += Common.NewLine + part3.Key;

                vFXName = RobotDataManager.GetVFXName(part3.Key.InstanceId, RobotDataManager.RobotParts.InGameHoverVFX);
                msg    += Common.NewLine + "A: " + vFXName;

                vFXName = RobotDataManager.GetVFXName(part3.Key.InstanceId, RobotDataManager.RobotParts.CABHoverVFX);
                msg    += Common.NewLine + "B: " + vFXName;

                msg += Common.NewLine + target.CurrentWalkStyle;
            }
            catch (Exception e)
            {
                GameHitParameters <GameObject> .Exception(parameters, msg, e);
            }
            finally
            {
                Common.DebugWriteLog(msg);
            }
            return(OptionResult.SuccessClose);
        }
Example #10
0
 /// <summary>
 /// Load a list of nodes into the editor pane
 /// </summary>
 /// <param name="root">The base node</param>
 public void UpdateSkeleton(RobotDataManager robotDataManager)
 {
     this.robotDataManager = robotDataManager;
     nodeList = robotDataManager.RobotBaseNode?.ListAllNodes();
     UpdateJointList();
 }