#Reflektor - Lightweight Unity Explorer Alternative

1 messages · Page 1 of 1 (latest)

thorn furnace
olive coral
#

Great work so far!
Couple of small suggestions for now:

  1. @white steppe , there may be a bug in UitkForKsp2.API.Window.CreateFromElement. I've never used it, only used CreateFromUxml which works fine. But in Coldrifting's case the raycast window top border is created right below the main window and it cannot be moved above it.
  2. In UITK is there a way to make the window not clamp to the screen's borders? With UI filling half the screen I feel it might be better to allow it to be dragged outside it. For instance I'm trying to see how Kerbin is displayed while toggling PQS stuff in the UI, but the UI is in the way 🙂
  3. Shift as a keyboard shortcut isn't ideal as it will trigger opening the windows when you type stuff, in these windows and in windows of other mods. I see there's a config configured, but for some reason it's not shown in Settings -> Mods -> Reflektor. Maybe KeyboardShortcut isn't supported (didn't test)?
  4. Invoking methods. I also didn't have a need to do that, however I do like to quickly browse available methods. Could you display them as well?
thorn furnace
#

Thanks for the feedback. With finals mostly out of the way I'm going to start working on a refactor to bring more UE like behavior with inspecting objects, but it'll probably take a bit to finish, so Inspecting methods will have to wait a bit. That said, I did notice the keyboard bug, it keeps popping up for me for some reason with BepinEx configs, but sometimes it comes back and I can never figure out why, ha.

white steppe
#

but I definitely want to make this less obscure

#

there's been a lot of stuff in the public API of UitkForKsp2 that I've been unhappy about for some time, so I think I will start working on a 3.0.0 rework soon

#

I'll try to make the changes as minimal as I can, but there will definitely be some

white steppe
#

I'm still trying to figure out what the issue with the positioning is

#

the bounding box of the raycast window gets moved down by the height of the main window, and I can't figure out why

clear crest
#

is it a chid of the main?

white steppe
#

nope, they're both separate UIDocuments on separate game objects

#

the only thing they seemingly have in common is that their objects have a common parent object, and that they use the same panel settings (just like everything else)

#

but the RectTransforms of the game objects don't seem to be affected by this

#

they all start at 0,0

thorn furnace
white steppe
#

what I meant is changing this

if (_showHideToggleShortcut.Value.IsDown())
{
    _window.rootVisualElement.ToggleVisible();
}

if (_raycastShortcut.Value.IsDown())
{
    _raycastWindow.FireRay();
}

to this:

if (_window != null && _showHideToggleShortcut.Value.IsDown())
{
    _window.rootVisualElement.ToggleVisible();
}

if (_raycastWindow != null && _raycastShortcut.Value.IsDown())
{
    _raycastWindow.FireRay();
}
#

because the calls on these two objects throw exceptions until they are initialized

#

and Update starts running way before OnInitialized is called (where you initialize the windows)

thorn furnace
#

Ah good to know. I assumed that update waited

thorn furnace
#

Started work on the refactor. Inspection of objects is sort of working

clear crest
#

Still awesome work!

#

I might just completely replace UE with this at some point

#

Should I put this in #🔴tools-and-resources ?

thorn furnace
#

Sure, why not. I'm probably not gonna put it on CKAN or make more release builds until I finish the refactor, though.

clear crest
#

Pinning first message so it doesnt require a scroll up, though after the refactor you might wanna make a #1168292144507793488 post

thorn furnace
#

Thanks, good idea

#

Ugh, I forgot that structs are value types... This throws a bit of a wrench in the works. Not sure how to update the values...

clear crest
#

By reading field, and setting field

#

Using reflection

#

Read field, update local object, set field to be more precise

thorn furnace
#

Right, I'm just having trouble propagating the new object back to it's original location I suppose.

thorn furnace
#

On second thought, it doesn't look like unity editor forwards changes when you edit stucts, so I'll just leave them read only, lol

thorn furnace
#

Still need to get collections working, but the inspection window is shaping up nicely.

white steppe
#

that looks great!

thorn furnace
#

Thanks! Now if I could only figure out how to reduce the massive padding inside drop down boxes...

thorn furnace
#

WIP screenshot

thorn furnace
#

Merged the raycaster into the main window

clear crest
#

this is shaping up to look real nice

#

awesome job!

thorn furnace
#

Thanks! I'm really pleased with the UI of the main window now

thorn furnace
#

Still needs work with collections and UI padding, etc, but it's really starting to come together. Pushing this to the dev branch if anyone's interested in trying it out

clear crest
#

Well, uhh, trying it out might be an issue in 30 mins depending

#

cuz FS!

thorn furnace
#

Ha, true!

clear crest
#

I'm going to launch with spacewarp the moment I update, wish me luck

thorn furnace
#

o7

thorn furnace
#

So I figured out my keyboard shortcut problem. KeyboardShortcuts will work in the settings files, but they don't seem to work in the mod settings menu, at least with modifiers, despite some examples to the contrary I've seen floating around the BepinEx GitHub. Unity KeyCodes work though, so I just resort to recreating a shortcut with the primary keycode and the modifiers I want when the config is updated or at startup.

thorn furnace
#

Refactored the main browser UI to be done in UXML in unity so I could have more control over the hover stylesheets and dropdowns

white steppe
#

it's looking great!

thorn furnace
#

Thanks! I think I've refactored this main window like 4 times now, ha

thorn furnace
#

You can now change the parent transform of GameObjects, and the path bar now word wraps, which took more effort than it should have. At first I used the multi line TextField option, but it allows newlines and tabs, etc which is a pain to deal with. Turns out you can set the white-space property on the embedded .unity-text-element class inside the text field to normal to get word wrapping which still works with tabbing out.

thorn furnace
#

Making progress on the inspector again

thorn furnace
#

Lists and Dictionaries are looking a bit more functional and aesthetically pleasing now.

white steppe
#

🤩

thorn furnace
#

Been working on enum flags today. Think I got it working alright

#

Annoyingly unity has a builtin one just like the enumField, but only for the editor

thorn furnace
#

Famous last words, but I feel like I'm almost done. I've refactored the controls like 3 or 4 times now, ha

thorn furnace
clear crest
#

@thorn furnace you made my job easy by writing the netkan lol

thorn furnace
#

Np thankfully I still remember how to do it from the last time I made a ksp mod

clear crest
#

@thorn furnace this mod is literally amazing

white steppe
#

saving planet modding one Reflektion at a time

thorn furnace
#

I think I made a breakthrough on getting nested struct editing working today.

clear crest
#

Awesome!

thorn furnace
#
    private static void SetValueInternal(EditKey key, string name, object value, object? index)
    {
        while (true)
        {
            object cur = key.Source;
            switch (cur)
            {
                case IList l when index is int i:
                    l[i] = value;
                    return;
                case IDictionary dict when index is not null:
                    dict[index] = value;
                    return;
                default:
                    SetFieldProperty(cur, name, value);

                    // Invariant - root is not a struct
                    if (!cur.GetType().IsValueType)
                    {
                        return;
                    }

                    var (newPath, newName) = AdvancePath(key.Path);
                    EditKey k = new EditKey(key.Root, newPath, newPath == key.Path ? null : key._index);

                    key = k;
                    name = newName;
                    value = cur;

                    continue;
            }
        }
    }
#

Took me way longer than I should have but it seems to work in isolation for some basic test cases

#

In any case, I think the edit key concept will help reduce the issues I've seen when an object (struct usually, actually) changes unexpectedly, which screws with the dictionary I use to keep track of tabs.

white steppe
#

who would have guessed that you'd go from trying to modify the game UI to basically rewriting Unity Explorer from scratch 😆

thorn furnace
#

ADHD be like ha

clear crest
thorn furnace
#

Gotta live life one obsessive project at a time, ha

thorn furnace
#

Stuct editing looks likes it's working, at least for what I need it for

#

By the way this is ~3 structs nested

clear crest
#

Again, awesome!

thorn furnace
wicked vault
#

I'm probably doing something wrong, but after upgrading to 0.2.1.0 alpha and hitting shift-alt-E, nothing happens. shift-alt-Q and shift-alt-R work. shift-alt-Q.

thorn furnace
#

Hmm, double check your mod settings and see if the shortcut changed for some reason. If not, send a copy of your ksp 2 log file and I'll try to see what's going wrong.

#

Oh wait, nevermind, to show the inspector window you need to inspect at least one thing from the browser

wicked vault
thorn furnace
#

It's possible. I haven't tested that yet, I would probably see if Ray casting a part brings anything up, and if it does go from there

clear crest
#

@thorn furnace it'd be cool if the editor for texture2ds/sprites actually showed the texture/sprite in question and allowed you to export them for analysis

#

Like for the eeloo_scaled_d here

olive coral
#

I need that as well 🙏

thorn furnace
#

Good idea, I'll add it to the to-do list

clear crest
#

Awesome!

#

I dont even think unity explorer does this

thorn furnace
#

I think it does?

clear crest
#

Im not sure

#

I dont use it anymore

#

Got way too frustrated by how slow it was

thorn furnace
#

I'm any case I don't think it would be too difficult, just have to add a custom control for it, but it'll have to wait until Sunday

olive coral
#

It does. It shows all the textures in a material and you can export them. If Reflektor would have this, I think that would be everything from the object explorer I'm using, that would be great!

#

I have one question though. I would expect if I type in something in the top textbox that a search would be initiated. There's no search implemented, right? I use that a lot with Unity Explorer.

clear crest
#

A search in the explorer would be awesome

thorn furnace
thorn furnace
#

Images coming soon

thorn furnace
#

0.2.1.2 out now
#1188614796128559195 message

clear crest
#

@thorn furnace The texture2d is missing from the display as it's null, and it gives no indication of it being null or even existing

#

Also, can you show the layer of game objects as well?

clear crest
#

Nevermind on the first one