Initial release now available!
https://github.com/coldrifting/Reflektor/
#Reflektor - Lightweight Unity Explorer Alternative
1 messages · Page 1 of 1 (latest)
Great work so far!
Couple of small suggestions for now:
- @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. - 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 🙂
- 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
KeyboardShortcutisn't supported (didn't test)? - 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?
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.
Thanks, I'll look into it!
as for point #2, yes, there is:
- when calling the
Create/CreateFromElement/CreateFromUxmlmethod, passfalsefor themakeDraggableparameter (last one) - on your root element, call
element.AddManipulator(new DragManipulator(true)), where the parameter of the DragManipulator constructor isallowDraggingOffScreen
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
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
is it a chid of the main?
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
(by the way, there should be null checks for _window and _raycastWindow in these two ifs, to prevent the log exception spam before OnInitialized runs: https://github.com/coldrifting/Reflektor/blob/4dac49a3490df0e2f830ae5a4783fcfee2d851c3/Reflektor/Reflektor.cs#L84C1-L93C1)
Shouldn't the config manager always return a value for those, since they should be bound? I know it's not working right now, but in theory
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)
Ah good to know. I assumed that update waited
Started work on the refactor. Inspection of objects is sort of working
Still awesome work!
I might just completely replace UE with this at some point
Should I put this in #🔴tools-and-resources ?
Sure, why not. I'm probably not gonna put it on CKAN or make more release builds until I finish the refactor, though.
Pinning first message so it doesnt require a scroll up, though after the refactor you might wanna make a #1168292144507793488 post
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...
By reading field, and setting field
Using reflection
Read field, update local object, set field to be more precise
Right, I'm just having trouble propagating the new object back to it's original location I suppose.
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
Still need to get collections working, but the inspection window is shaping up nicely.
that looks great!
Thanks! Now if I could only figure out how to reduce the massive padding inside drop down boxes...
WIP screenshot
Thanks! I'm really pleased with the UI of the main window now
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
Ha, true!
I'm going to launch with spacewarp the moment I update, wish me luck
o7
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.
Refactored the main browser UI to be done in UXML in unity so I could have more control over the hover stylesheets and dropdowns
it's looking great!
Thanks! I think I've refactored this main window like 4 times now, ha
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.
Making progress on the inspector again
Lists and Dictionaries are looking a bit more functional and aesthetically pleasing now.
🤩
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
Famous last words, but I feel like I'm almost done. I've refactored the controls like 3 or 4 times now, ha
Release Canidate out now! https://github.com/coldrifting/Reflektor/releases/tag/v0.2.0.rc1
@thorn furnace you made my job easy by writing the netkan lol
Np thankfully I still remember how to do it from the last time I made a ksp mod
@thorn furnace this mod is literally amazing
ty!
saving planet modding one Reflektion at a time
I think I made a breakthrough on getting nested struct editing working today.
Awesome!
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.
who would have guessed that you'd go from trying to modify the game UI to basically rewriting Unity Explorer from scratch 😆
ADHD be like ha
How do you think I'm able to crank out all these tools lol
Gotta live life one obsessive project at a time, ha
Stuct editing looks likes it's working, at least for what I need it for
By the way this is ~3 structs nested
Again, awesome!
Version 0.2.1.0alpha out now! https://github.com/coldrifting/Reflektor/releases/tag/v0.2.1.0alpha Might contain bugs, I had to rewrite a lot of the program, ha
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.
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
ah, I see. I haven't done any C# coding for KSP but I've made patches with patch manager. Would I be able to use this mod to look at a specific part and interact with it to test changing properties before I make a patch? If so, how do I target an instance of a part?
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
@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
I need that as well 🙏
Good idea, I'll add it to the to-do list
I think it does?
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
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.
A search in the explorer would be awesome
Not yet, but you can paste in game object paths there right now
0.2.1.2 out now
#1188614796128559195 message
@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?
Nevermind on the first one