protected override void OnAttach()
        {
            base.OnAttach();
            base.Slot.Tag  = "Developer";
            this.Slot.Name = "Leftover LogiX Component Remover";
            NeosCanvasPanel neosCanvasPanel = base.Slot.AttachComponent <NeosCanvasPanel>();

            neosCanvasPanel.Panel.AddCloseButton();
            neosCanvasPanel.Panel.AddParentButton();
            neosCanvasPanel.Panel.Title = "Leftover LogiX Component Remover";
            neosCanvasPanel.CanvasSize  = new float2(300f, 200f);
            UIBuilder uIBuilder = new UIBuilder(neosCanvasPanel.Canvas);

            uIBuilder.VerticalLayout(4f);
            uIBuilder.FitContent(SizeFit.Disabled, SizeFit.MinSize);
            uIBuilder.Style.Height = 24f;
            _text = "Process root slot:";
            uIBuilder.Text(in _text);
            uIBuilder.Next("Root");
            uIBuilder.Current.AttachComponent <RefEditor>().Setup(ProcessRoot);
            uIBuilder.Spacer(24f);
            _text = "Remove LogixInterfaceProxy components";
            uIBuilder.Button(in _text, RemoveLogixInterfaceProxies);
            _text = "Remove LogixReference components";
            uIBuilder.Button(in _text, RemoveLogixReferences);
            uIBuilder.Spacer(24f);
            _text = "------";
            ResultsText.Target = uIBuilder.Text(in _text);
        }
Example #2
0
        protected override void OnAttach()
        {
            base.OnAttach();
            sep = "\t";
            //CONTAINING SLOT AND BASE CANVAS
            mainSlot = this.LocalUserSpace.AddSlot("LogiX Node Browser");
            NeosPanel neosPanel = mainSlot.AttachComponent <NeosPanel>(true, (Action <NeosPanel>)null);

            neosPanel.Title           = "Logix/Componer browser";
            neosPanel.Padding.Value   = 0.005f;
            neosPanel.ZPadding.Value  = 0.005f;
            neosPanel.Thickness.Value = 0.01f;
            neosPanel.AddCloseButton();
            neosPanel.AddParentButton();
            UIBuilder uiBuilder1 = new UIBuilder(neosPanel.ContentSlot, 1000f, 1000f, 0.0005f);
            //Canvas component = neosPanel.ContentSlot.GetComponent<Canvas>((Predicate<Canvas>)null, false);
            color color1 = new color(1f, 1f, 1f, 0.2f);

            uiBuilder1.Panel(in color1, false);

            //Search Footer
            RectTransform searchFooter, mainContent;

            uiBuilder1.HorizontalFooter(64f, out searchFooter, out mainContent);
            UIBuilder searchUI     = new UIBuilder(searchFooter);
            TextField textfield    = searchUI.TextField();
            Action    sendRequest  = this.BuildSearchLogix(textfield.Text.Content.ReferenceID);
            var       editorEvents = textfield.Slot.AddSlot("logix").AttachComponent <Interaction.TextEditorEvents>();

            editorEvents.Source.Value           = textfield.Editor;
            editorEvents.EditingFinished.Target = sendRequest;


            //MAIN CONTENT
            //Horizontal split
            List <RectTransform> rectTransformList = (new UIBuilder(mainContent)).SplitHorizontally(0.4f, 0.6f);

            //RIGHT SIDE
            Slot rightSlot = rectTransformList[1].Slot;

            logixNodeSelector = rightSlot.AttachComponent <LogixNodeSelector2>();
            Slot contentSlot   = rightSlot.FindChild(s => s.Name == "Content");
            Slot containerSlot = contentSlot[0];

            nodesContainerSlot     = containerSlot;
            contentSlot.ActiveSelf = false;
            rightSlot.FindChild(s => s.Name == "Panel").Destroy();
            rightSlot.FindChild(s => s.Name == "Handle").Destroy();
            rightSlot.FindChild(s => s.Name == "Header").Destroy();
            rightSlot.FindChild(s => s.Name == "HandleAnchor").Destroy();
            containerSlot.Parent = rightSlot;


            //LEFT SIDE
            RectTransform hierarchyHeader, nodeHierarchy;
            Slot          leftSlot   = rectTransformList[0].Slot;
            UIBuilder     uiBuilder2 = new UIBuilder(leftSlot);

            //header
            uiBuilder2.HorizontalHeader(64f, out hierarchyHeader, out nodeHierarchy);
            UIBuilder uiBuilder3 = new UIBuilder(hierarchyHeader);

            uiBuilder3.HorizontalLayout(4f, 0.0f, 4f, 0.0f, 4f, new Alignment?());
            uiBuilder3.Style.FlexibleWidth = 100f;
            //hierarchyHeader = uiBuilder3.CurrentRect;
            uiBuilder3.HorizontalLayout(4f, 0.0f, 0.0f, 4.0f, 0.0f);

            //hierarchy container
            UIBuilder uiBuilderContent = new UIBuilder(nodeHierarchy);
            color     color2           = new color(1f, 1f, 1f, 0.2f);

            uiBuilderContent.Panel(in color2, false);
            //nodeHierarchy = uiBuilderContent.CurrentRect;
            uiBuilderContent.ScrollArea(new Alignment?());
            uiBuilderContent.VerticalLayout(4.0f, 0.0f, Alignment.TopLeft);
            uiBuilderContent.FitContent(SizeFit.Disabled, SizeFit.MinSize);
            componentHierarchy = uiBuilderContent.CurrentRect.Slot;
            logixHierarchy     = componentHierarchy.Duplicate();

            //Logix/Comp buttons
            uiBuilder3.Style.FlexibleWidth = -1f;
            uiBuilder3.Style.MinWidth      = 64f;
            Button logixButton = uiBuilder3.Button("LogiX");
            var    component1  = logixButton.Slot.AttachComponent <ButtonValueSet <bool> >();

            component1.TargetValue.Target = logixHierarchy.ActiveSelf_Field;
            component1.SetValue.Value     = true;
            var component2 = logixButton.Slot.AttachComponent <ButtonValueSet <bool> >();

            component2.TargetValue.Target = componentHierarchy.ActiveSelf_Field;
            component2.SetValue.Value     = false;
            Button compButton = uiBuilder3.Button("Comps");
            var    component3 = compButton.Slot.AttachComponent <ButtonValueSet <bool> >();

            component3.TargetValue.Target = logixHierarchy.ActiveSelf_Field;
            component3.SetValue.Value     = false;
            var component4 = compButton.Slot.AttachComponent <ButtonValueSet <bool> >();

            component4.TargetValue.Target = componentHierarchy.ActiveSelf_Field;
            component4.SetValue.Value     = true;

            components_string2 = "NiceName" + sep + "Name" + sep + "FullName" + sep + "Folder" + sep + "Description" + sep + "Type\n";
            logix_string2      = components_string2;
            buildLayer("", componentHierarchy);
            buildLayer("/LogiX", logixHierarchy);

            componentHierarchy.ActiveSelf = false;
            logixHierarchy.ActiveSelf     = true;

            components_string += "\n ";
            logix_string      += "\n ";
            //components_string2 += "\n ";
            //logix_string2 += "\n ";
            System.IO.File.WriteAllText(@"C:\Program Files (x86)\Steam\steamapps\common\NeosVR\components_string.txt", components_string);
            System.IO.File.WriteAllText(@"C:\Program Files (x86)\Steam\steamapps\common\NeosVR\logix_string.txt", logix_string);
            System.IO.File.WriteAllText(@"C:\Program Files (x86)\Steam\steamapps\common\NeosVR\components_string2.txt", components_string2);
            System.IO.File.WriteAllText(@"C:\Program Files (x86)\Steam\steamapps\common\NeosVR\logix_string2.txt", logix_string2);

            //this.MakeVariableSelector();
        }
Example #3
0
        private void OpenConnectedPanel()
        {
            UIBuilder uiBuilder1 = panel.SwapPanel(NeosSwapCanvasPanel.Slide.None, 0.5f);

            //uiBuilder1.VerticalLayout(4f, 0.0f, new Alignment?());
            uiBuilder1.VerticalLayout(4f, 0, new Alignment?());
            uiBuilder1.FitContent(SizeFit.Disabled, SizeFit.PreferredSize);
            uiBuilder1.Style.PreferredHeight = 65f;
            uiBuilder1.Style.MinHeight       = 32f;
            uiBuilder1.Style.TextAutoSizeMin = 45f;
            uiBuilder1.Style.TextAutoSizeMax = 65f;

            //status text
            //SyncRef<Text> status = this._status;
            //LocaleString localeString1 = (LocaleString)"";
            //ref LocaleString local1 = ref localeString1;
            //Alignment? alignment1 = new Alignment?();
            //Text text1 = uiBuilder1.Text(in local1, true, alignment1, true, (string)null);
            //status.Target = text1;

            //Title
            uiBuilder1.Style.PreferredHeight = 200f;
            Text text4 = uiBuilder1.Text("MetaGenNeos");

            text4.AutoSizeMax.Value = 150f;
            text4.Size.Value        = 150f;

            //Description
            uiBuilder1.Style.MinHeight = 350f;
            Text text1 = uiBuilder1.Text("<b>This recording system is currenlty in Beta. Expect bugs</b>. MetaGen is a project to explore the intersection between AI and VR technologies, for Science, Art, and Wonder. See more details at http://metagen.ai");

            uiBuilder1.Style.MinHeight = 32f;

            ////Recording checkbox
            //uiBuilder1.Style.PreferredHeight = 100f;
            //uiBuilder1.Style.MinHeight = 100f;
            //Checkbox checkbox_record_user = uiBuilder1.Checkbox("Record me (local)",false);
            //this._recordUserCheckbox.Target = checkbox_record_user;
            //if (!mg.admin_mode)
            //{
            //    recordUserOverride = uiBuilder1.Current.AttachComponent<ValueUserOverride<bool>>();
            //    recordUserOverride.CreateOverrideOnWrite.Value = true;
            //    recordUserOverride.Target.Target = checkbox_record_user.State;
            //}

            ////Data submission checkbox
            //uiBuilder1.Style.MinHeight = 350f;
            //Text text2 = uiBuilder1.Text("<b>By checking this box you agree to license the recorded data as CC0 (Public domain), as part of the MetaGen Public Dataset (intended for research in AI and other sciences).</b>");
            //text2.HorizontalAlign.Value = CodeX.TextHorizontalAlignment.Left;
            //uiBuilder1.Style.PreferredHeight = 100f;
            //uiBuilder1.Style.MinHeight = 100f;
            //Checkbox checkbox_public_domain = uiBuilder1.Checkbox("Public domain",false);
            //this._publicDomainCheckbox.Target = checkbox_public_domain;
            //if (!mg.admin_mode)
            //{
            //    publicDomainOverride = uiBuilder1.Current.AttachComponent<ValueUserOverride<bool>>();
            //    publicDomainOverride.Target.Target = checkbox_public_domain.State;
            //}

            //recording time
            uiBuilder1.Style.PreferredHeight = 75f;
            uiBuilder1.Style.MinHeight       = 75f;
            SyncRef <Text> recording_time = this._recordingTime;
            LocaleString   localeString2  = (LocaleString)"";
            Text           text3          = uiBuilder1.Text(localeString2);

            recording_time.Target = text3;

            uiBuilder1.Style.PreferredHeight = 100f;
            uiBuilder1.Style.MinHeight       = 100f;

            //animation checkbox
            Checkbox animCheckbox = uiBuilder1.Checkbox("Generate animation", true);

            this._animationsCheckbox.Target = animCheckbox;

            //Generate bvh checkbox
            Checkbox checkbox5 = uiBuilder1.Checkbox("Generate bvh", false);

            this._generateBvhCheckbox.Target = checkbox5;

            //Recording voices checkbox
            Checkbox recording_voices_checkbox = uiBuilder1.Checkbox("Record voices", true);

            this._recordVoicesCheckbox.Target = recording_voices_checkbox;

#if NOHL
            //Recording hearing checkbox
            Checkbox recording_hearing_checkbox = uiBuilder1.Checkbox("Record hearing", true);
            this._recordHearingCheckbox.Target = recording_hearing_checkbox;
#endif

            //video checkbox
            //Checkbox videoCheckbox = uiBuilder1.Checkbox("Record vision",true);
#if NOHL
            Checkbox videoCheckbox = uiBuilder1.Checkbox("Record vision", false);
            this._videoCheckbox.Target = videoCheckbox;
#endif

            //record button
            uiBuilder1.Style.PreferredHeight = 120f;
            uiBuilder1.Style.MinHeight       = 120f;
            SyncRef <Button> recordButton = this._recordButton;
            Button           button1      = uiBuilder1.Button("");
            recordButton.Target = button1;
            ButtonValueSet <bool> comp1 = button1.Slot.AttachComponent <ButtonValueSet <bool> >();
            comp1.SetValue.Value     = true;
            comp1.TargetValue.Target = record_button_pressed.Target;

            ////Hiding for now as its WIP
            ////interact button
            uiBuilder1.Style.PreferredHeight = 120f;
            uiBuilder1.Style.MinHeight       = 120f;
            SyncRef <Button> interactButton = this._interactButton;
            Button           button1b       = uiBuilder1.Button("Toggle Interaction");
            interactButton.Target = button1b;
            ButtonValueSet <bool> comp1b = button1b.Slot.AttachComponent <ButtonValueSet <bool> >();
            comp1b.SetValue.Value     = true;
            comp1b.TargetValue.Target = interact_button_pressed.Target;

            //Text for debug play section
            uiBuilder1.Style.PreferredHeight = 200f;
            uiBuilder1.Style.MinHeight       = 100f;
            Text text5 = uiBuilder1.Text("Debug play");
            text4.AutoSizeMax.Value          = 130f;
            text4.Size.Value                 = 130f;
            uiBuilder1.Style.MinHeight       = 100f;
            uiBuilder1.Style.PreferredHeight = 100f;

            //Recording index
            uiBuilder1.Style.PreferredHeight = 75f;
            uiBuilder1.Style.MinHeight       = 75f;
            Text      text6  = uiBuilder1.Text("Recording index:");
            TextField field1 = uiBuilder1.TextField("0");
            this._recordIndexField.Target = field1;

            uiBuilder1.Style.MinHeight       = 100f;
            uiBuilder1.Style.PreferredHeight = 100f;

            //Voices checkbox
            Checkbox checkbox1 = uiBuilder1.Checkbox("Voices", true);
            this._voicesCheckbox.Target = checkbox1;

            //Hearing checkbox
            Checkbox checkbox2 = uiBuilder1.Checkbox("Hearing", false);
            this._hearingCheckbox.Target = checkbox2;

            //External source checkpoint
            Checkbox checkbox3 = uiBuilder1.Checkbox("External source", false);
            this._externalSourceCheckbox.Target = checkbox3;

            //animation checkbox2
            Checkbox animCheckbox2 = uiBuilder1.Checkbox("Generate animation", false);
            this._animationsCheckbox2.Target = animCheckbox2;

            //Generate bvh checkbox
            Checkbox bvhCheckbox2 = uiBuilder1.Checkbox("Generate bvh", false);
            this._generateBvhCheckbox2.Target = bvhCheckbox2;

            //Avatar ref
            uiBuilder1.Style.PreferredHeight = 75f;
            uiBuilder1.Style.MinHeight       = 75f;
            Text text7 = uiBuilder1.Text("Avatar slot:");
            uiBuilder1.Next("Root");
            ReferenceField <Slot> refField = uiBuilder1.Current.AttachComponent <ReferenceField <Slot> >();
            this._avatarRefField.Target = refField;
            RefEditor avatarRefEditor = uiBuilder1.Current.AttachComponent <RefEditor>();
            avatarRefEditor.Setup(refField.Reference);

            uiBuilder1.Style.MinHeight       = 100f;
            uiBuilder1.Style.PreferredHeight = 100f;

            //play button
            SyncRef <Button> streamButton = this._playButton;
            Button           button2      = uiBuilder1.Button("");
            streamButton.Target = button2;
            ButtonValueSet <bool> comp2 = button2.Slot.AttachComponent <ButtonValueSet <bool> >();
            comp2.SetValue.Value     = true;
            comp2.TargetValue.Target = play_button_pressed.Target;

            ////UI slot ref
            //uiBuilder1.Style.PreferredHeight = 75f;
            //uiBuilder1.Style.MinHeight = 75f;
            //Text text8 = uiBuilder1.Text("UI slot:");
            //uiBuilder1.Next("Root");
            //ReferenceField<Slot> refField2 = uiBuilder1.Current.AttachComponent<ReferenceField<Slot>>();
            //this._uiTemplateRefField.Target = refField2;
            //RefEditor uiTemplateRefEditor = uiBuilder1.Current.AttachComponent<RefEditor>();
            //uiTemplateRefEditor.Setup(refField2.Reference);

            //uiBuilder1.Style.MinHeight = 100f;
            //uiBuilder1.Style.PreferredHeight = 100f;

            ////swapUI button
            //Button button3 = uiBuilder1.Button("");
            //this._swapUIButton.Target = button3;
            //ButtonValueSet<bool> comp3 = button3.Slot.AttachComponent<ButtonValueSet<bool>>();
            //comp3.SetValue.Value = true;
            //comp3.TargetValue.Target = swapUI_button_pressed.Target;
        }
        protected override void OnAttach()
        {
            base.OnAttach();
            // Create the UI for the wizard.
            this.Slot.Name = "MeshCollider Management Wizard";
            base.Slot.Tag  = "Developer";
            NeosCanvasPanel neosCanvasPanel = base.Slot.AttachComponent <NeosCanvasPanel>();

            neosCanvasPanel.Panel.AddCloseButton();
            neosCanvasPanel.Panel.AddParentButton();
            neosCanvasPanel.Panel.Title = "MeshCollider Management Wizard";
            neosCanvasPanel.CanvasSize  = new float2(800f, 900f);
            UIBuilder            uIBuilder = new UIBuilder(neosCanvasPanel.Canvas);
            List <RectTransform> rectList  = uIBuilder.SplitHorizontally(0.5f, 0.5f);
            // Build left hand side UI - options and buttons.
            UIBuilder uIBuilder2  = new UIBuilder(rectList[0].Slot);
            Slot      _layoutRoot = uIBuilder2.VerticalLayout(4f, 0f, new Alignment()).Slot;

            uIBuilder2.FitContent(SizeFit.Disabled, SizeFit.MinSize);
            uIBuilder2.Style.Height = 24f;
            UIBuilder uIBuilder3 = uIBuilder2;

            // Slot reference to which changes will be applied.
            _text = "Process root slot:";
            uIBuilder3.Text(in _text);
            uIBuilder3.Next("Root");
            uIBuilder3.Current.AttachComponent <RefEditor>().Setup(ProcessRoot);
            uIBuilder3.Spacer(24f);
            // Basic filtering settings for which MeshColliders are accepted for changes or listing.
            _text = "Ignore inactive:";
            uIBuilder3.HorizontalElementWithLabel(in _text, 0.9f, () => uIBuilder3.BooleanMemberEditor(IgnoreInactive));
            _text = "Ignore disabled:";
            uIBuilder3.HorizontalElementWithLabel(in _text, 0.9f, () => uIBuilder3.BooleanMemberEditor(IgnoreDisabled));
            _text = "Ignore non-persistent:";
            uIBuilder3.HorizontalElementWithLabel(in _text, 0.9f, () => uIBuilder3.BooleanMemberEditor(IgnoreNonPersistent));
            _text = "Ignore user hierarchies:";
            uIBuilder3.HorizontalElementWithLabel(in _text, 0.9f, () => uIBuilder3.BooleanMemberEditor(IgnoreUserHierarchies));
            _text      = "Tag:";
            tag.Target = uIBuilder3.HorizontalElementWithLabel(in _text, 0.2f, () => uIBuilder3.TextField());
            _text      = "Tag handling mode:";
            uIBuilder3.Text(in _text);
            uIBuilder3.EnumMemberEditor(useTagMode);
            uIBuilder3.Spacer(24f);
            // Settings for highlighing individual colliders.
            _text = "Highlight duration:";
            uIBuilder3.HorizontalElementWithLabel(in _text, 0.8f, () => uIBuilder3.PrimitiveMemberEditor(HighlightDuration));
            _text = "Highlight color:";
            uIBuilder3.Text(in _text);
            uIBuilder3.ColorMemberEditor(HighlightColor);
            uIBuilder3.Spacer(24f);
            // Controls for specific replacement collider settings.
            _text = "Replacement collider component:";
            uIBuilder3.Text(in _text);
            uIBuilder3.EnumMemberEditor(replacementColliderComponent);
            _text = "Replacement setup action:";
            uIBuilder3.Text(in _text);
            uIBuilder3.EnumMemberEditor(setupBoundsType);
            uIBuilder3.Spacer(24f);
            _text = "Preserve existing collider settings:";
            uIBuilder3.HorizontalElementWithLabel(in _text, 0.9f, () => uIBuilder3.BooleanMemberEditor(PreserveColliderSettings));
            _text = "Set collision Type:";
            uIBuilder3.Text(in _text);
            Slot _hideTextSlot = _layoutRoot.GetAllChildren().Last();

            uIBuilder3.EnumMemberEditor(setColliderType);
            Slot _hideEnumSlot = _layoutRoot.GetAllChildren().Last().Parent.Parent;

            _text = "Collider Mass:";
            Slot _hideFloatSlot = uIBuilder3.HorizontalElementWithLabel(in _text, 0.9f, () => uIBuilder3.PrimitiveMemberEditor(Mass)).Slot.Parent;

            _text = "Set CharacterCollider:";
            Slot _hideBoolSlot1 = uIBuilder3.HorizontalElementWithLabel(in _text, 0.9f, () => uIBuilder3.BooleanMemberEditor(SetCharacterCollider)).Slot.Parent;

            _text = "Set IgnoreRaycasts:";
            Slot _hideBoolSlot2 = uIBuilder3.HorizontalElementWithLabel(in _text, 0.9f, () => uIBuilder3.BooleanMemberEditor(SetIgnoreRaycasts)).Slot.Parent;

            uIBuilder3.Spacer(24f);
            // Hide some options if preserving existing settings.
            var _valCopy        = _layoutRoot.AttachComponent <ValueCopy <bool> >();
            var _boolValDriver  = _layoutRoot.AttachComponent <BooleanValueDriver <bool> >();
            var _valMultiDriver = _layoutRoot.AttachComponent <ValueMultiDriver <bool> >();

            _valCopy.Source.Target            = PreserveColliderSettings;
            _valCopy.Target.Target            = _boolValDriver.State;
            _boolValDriver.TrueValue.Value    = false;
            _boolValDriver.FalseValue.Value   = true;
            _boolValDriver.TargetField.Target = _valMultiDriver.Value;
            for (int i = 0; i < 5; i++)
            {
                _valMultiDriver.Drives.Add();
            }
            _valMultiDriver.Drives[0].Target = _hideTextSlot.ActiveSelf_Field;
            _valMultiDriver.Drives[1].Target = _hideEnumSlot.ActiveSelf_Field;
            _valMultiDriver.Drives[2].Target = _hideBoolSlot1.ActiveSelf_Field;
            _valMultiDriver.Drives[3].Target = _hideBoolSlot2.ActiveSelf_Field;
            _valMultiDriver.Drives[4].Target = _hideFloatSlot.ActiveSelf_Field;
            // Buttons for batch actions.
            _text = "List matching MeshColliders";
            uIBuilder3.Button(in _text, PopulateList);
            _text = "Replace all matching MeshColliders";
            uIBuilder3.Button(in _text, ReplaceAll);
            _text = "Remove all matching MeshColliders";
            uIBuilder3.Button(in _text, RemoveAll);
            uIBuilder3.Spacer(24f);
            _text = "------";
            resultsText.Target = uIBuilder3.Text(in _text);
            // Build right hand side UI - list of found MeshColliders.
            UIBuilder uIBuilder4 = new UIBuilder(rectList[1].Slot);

            uIBuilder4.ScrollArea();
            uIBuilder4.VerticalLayout(10f, 4f);
            _scrollAreaRoot = uIBuilder4.FitContent(SizeFit.Disabled, SizeFit.MinSize).Slot;
            // Prepare UIBuilder for addding elements to MeshCollider list.
            _listBuilder = uIBuilder4;
            _listBuilder.Style.MinHeight = 40f;
        }