Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various additions and improvements (read comments) #30

Merged
merged 12 commits into from
Nov 1, 2018

Conversation

colinator27
Copy link
Member

I just did a bunch of work on the tool and library.

Here's a copy of what I said on my commit with the changes:

Implemented various structures, added some editors, fixed some bugs, cleaned up

- Implemented Timeline data structure internally, added semi-partial editor
- Added partial editor for Shaders
- Added semi-partial editor for Extensions
- Implemented physics shape vertices on GameObjects (could cause errors without them)
- Renamed variables in gameobject event actions to their proper names/meanings (as well as the Awake variable in GameObjects)
- Made string references in the editor more clear as to when they are null or empty

There's only one issue with it, and it is that the vertex shader attributes list editor (in a new shader editor) is currently a bit buggy, and I'm not quite sure how to fix it. Let me know what you think.

colinator27 and others added 6 commits September 17, 2018 14:43
…cleaned up

- Implemented Timeline data structure internally, added semi-partial editor
- Added partial editor for Shaders
- Added semi-partial editor for Extensions
- Implemented physics shape vertices on GameObjects (could cause errors without them)
- Renamed variables in gameobject event actions to their proper names/meanings (as well as the Awake variable in GameObjects)
- Made string references in the editor more clear as to when they are null or empty
Copy link
Member

@krzys-h krzys-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I will check and merge this soon

@@ -372,6 +372,12 @@ private async void DecompileCode(UndertaleCode code)
possibleObjects.Add(data.Fonts[id]);
if (id < data.Sounds.Count)
possibleObjects.Add(data.Sounds[id]);
if (id < data.Shaders.Count)
possibleObjects.Add(data.Shaders[id]);
if (id < data.Extensions.Count)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can extensions actually be referenced in scripts by ID? If not, then this is just cluttering up the context menu list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of recall that being possible somewhere, but now I'm not so sure. I put it in just to be safe, but if it's unnecessary, I guess it's okay to get rid of it.

UndertaleModTool/Editors/UndertaleShaderEditor.xaml Outdated Show resolved Hide resolved
@krzys-h
Copy link
Member

krzys-h commented Oct 10, 2018

What exactly do you mean by the shader attributes being buggy? I noticed four things:

  1. If you create a new shader in UndertaleModTool, the list is not editable. This is because UndertaleShader class does not initialize it so the list object is null, this can be fixed by simply doing:
private List<UndertaleString> _VertexShaderAttributes = new List<UndertaleString>();
  1. The text fields being "(null)" or "(empty)" replace the default background, causing these fields to look weird when inside a selected list item:
    image
    image
    This can probably be fixed with some more XAML style magic
  2. To remove an item, you need to click on the list item without selecting the textbox and click delete - most other editors leave a bit of margin on the left so that it's easier to do that
  3. The box for the list is larger than it should be, but this is probably because of the message on the left forcing the whole row to be bigger

And while you're adding editors with a TODO message, could you also add one for the global initialization scripts (or whatever this is) as well? (UndertaleGlobal)

@colinator27
Copy link
Member Author

Thanks for the feedback, some of these things I didn't even have the time to fully test. I'll try to fix some of these when I get the chance.

To add to that list, though (I really should have explained everything I noticed, I don't know why I didn't now):

  1. If you edit a string in the list and select to "only change this one value", for some reason it fails to update the string object in the list. It works when you select "change all occurrences" for obvious reasons, as I'm assuming the string reference remains the same.

By the way, by that global initialization script editor, do you want it to be linked to by the editor somewhere, like in the tree?

@krzys-h
Copy link
Member

krzys-h commented Oct 10, 2018

I think it should work similarly to the "general info" tab, because the chunk does not contain any objects itself and just points to entries in the CODE block

@krzys-h
Copy link
Member

krzys-h commented Oct 11, 2018

The reason the editor fails to update objects is probably because you need to manually specify Mode=TwoWay, UpdateSourceTrigger=PropertyChanged (or LostFocus when using a plain TextBox and not UndertaleString/ObjectReference) for bindings inside CellTemplate. This is because DataGrid by default has a read-only CellTemplate and read-write EditableCellTemplate activated by double-clicking, but I decided not to do that to make editing simpler. Look at how other editors (e.g. the paths or sprite textures) do it.

@colinator27
Copy link
Member Author

I apologize for the long time it's been taking to work on these changes. I've been pretty busy and I just got started on it now.

…issue

- Added global init editor (kind of?). Not sure how to make it appear like "General info"
- Added margin to string references in shader editor
- Removed "buggy editor" message to get a more final look
- I was unable to get the string references to update, and also have yet to figure out how to keep the background of the textbox white when highlighted in a list
- Room editor issue fixed: now it accounts for scale properly, at least for the most part.
@colinator27
Copy link
Member Author

I forgot to include this in the commit message, but I also fixed the vertex shader attribute list not being initialized and removed extensions from the "possible objects" list.

@colinator27
Copy link
Member Author

colinator27 commented Oct 22, 2018

I also just did some additional work on demystifying the GMS2 room format, as well as part of the old room format that somehow wasn't implemented yet (room creation code).

Edit: Sorry if there's a lot of these messages, I tried to do this when GitHub had an outage... I believe it's all gone now though.

@krzys-h
Copy link
Member

krzys-h commented Oct 25, 2018

Thanks!

I tried to get that shader attributes editor to work and I have no idea how to do it. In other places it works fine when the UndertaleString is wrapped inside another object. I know this is ugly, but how about something like that as a temporary workaround:

class VertexShaderAttribute : UndertaleObject
{
    public UndertaleString Name;
}
List<VertexShaderAttribute> VertexShaderAttributes;

For the general info editor, the easiest way would be probably to literally replicate how the general info editor works, just with one List instead of the other objects (look for GeneralInfoEditor in MainWindow.xaml.cs)

Is there anything else unfinished except these two things? (and the string editor background, but that's a minor thing that can be fixed later) I would like to merge this soon, there are quite a few improvements in this pull request and it would be nice to release a new version with them.

… changes.

- UndertaleShader.VertexShaderAttribute is a new class, and the list of them is now integrated with UndertaleIO's SimpleList because of that
- (of course, if you didn't read the commit title, the editor for it is now operational as far as I can tell)
- The code for selecting tree items was honestly a little messy, so I cleaned it up a bit
- Global init script editor (todo version) has been added completely now
@colinator27
Copy link
Member Author

The UndertaleObject implementation works like a charm... I managed to also take advantage of the existing UndertaleIO code to make it more consistent, like UndertaleSimpleList.

You can read the description of the last commit for everything else I just changed. That should be about it, except I still haven't gotten the string editor background to work, of course. I tried working on it before but to no avail...

- I properly named every variable for Backgrounds, with proper types etc.
- Background editor now supports GMS2 values when available
- Fixed chunk padding issues- before, determining the last chunk was not done properly
- Fixed an issue with the EXTN chunk losing data at the end - this was due to an oversight I made when documenting the chunk, but now it's implemented. Basically for each extension there is, there are 16 bytes of data appended to the end, based off of some product ID for each.
@colinator27
Copy link
Member Author

colinator27 commented Oct 27, 2018

One minor problem still remains: when moving scaled objects around in the room editor, their center origins do not update until you stop moving them.

@colinator27
Copy link
Member Author

Also, I just realized I may have broken a bunch of stuff... hold on.

@colinator27
Copy link
Member Author

Alright, so that's fixed. I accidentally included padding calculations in the loop that detects the last chunk, but I just found out that the chunk length includes the padding in it.

…e files can now load (no exporting, however)
@colinator27
Copy link
Member Author

colinator27 commented Oct 27, 2018

So now instead of getting an exception message when loading bytecode version 14, now it just loads the file but ignores the sections with code. It also disables exporting because at that point it's useless and would likely fail anyway.

This can easily be changed in the future if/when support for bytecode 14 gets added, because I made the check for whether or not bytecode is supported happen in one place.

@krzys-h
Copy link
Member

krzys-h commented Nov 1, 2018

I kinda need your CanSave changes right now so... time to merge this... pleasedon'tbreak

Next time, could you please avoid useless merge commits at the beginning (if you have remotes set up correctly just do git fetch && git reset --hard upstram/master && git push -f before you start) and split your changes into smaller pull requests so that they are easier to review?

@krzys-h krzys-h merged commit cbed055 into UnderminersTeam:master Nov 1, 2018
@colinator27
Copy link
Member Author

Ah, all right, will do. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants