sker65 / go-dmd-clock

Tools for goDMD clock / pin2dmd
http://go-dmd.de/
6 stars 6 forks source link

Export to VNI mangles Keyframe Duration field #123

Closed djrobx closed 4 years ago

djrobx commented 6 years ago

In the editor there is a Duration that is supposed to specify how long a palette lasts. Editing this field works, you can see it populate properly in the saved XML.

However, once I export my project to VNI, these durations become corrupted with very large values. If you save the project again the XML will have the corrupt values. You no longer see them in the editor, because the UI does some kind of input validation to not show the large values.

djrobx commented 6 years ago

And I have confirmed this happens with palette only changes. See below XML save. I think it is picking up the animation from the drop-down that is left behind (something is always selected).

To reproduce create a palette change keyframe in an existing project with some animations. Ensure something was selected for the animation frame even though it is not used. Set a duration of 100ms. Save XML. Review XML and observe the correctly set value:

100

Now, export the project to VNI. Save XML again and review:

<palMapping>
  <palIndex>11</palIndex>
  <durationInMillis>106592</durationInMillis>  <-----------
  <durationInFrames>0</durationInFrames>
  <hashIndex>0</hashIndex>
  <name>KeyFrame 15</name>
  <animatisonIndex>0</animatisonIndex>
  <animationName>tmnt_104</animationName>
  <frameIndex>17292</frameIndex>
  <frameSeqName>data east</frameSeqName>
  <crc32>2fRjNg==</crc32>
  <switchMode>PALETTE</switchMode>      <----------
  <withMask>false</withMask>
  <maskNumber>0</maskNumber>
</palMapping>
slippifishi commented 5 years ago

Would love some clarification on this bug and if I need to worry about it or not. Half of my projects have now got mangled fields, though I have been able to keep my latest ones clean through careful closing and reopening of the editor between exports.

It doesn't seem to affect the output (that is, my colouring still works as expected) but I am worried that these values might come back to haunt me later on.

djrobx commented 5 years ago

It only appears to affect palette change keyframes. Once mangled they become high numbers, so the palette change will stick "indefinitely'.

You can work around it by always using a color mask, where duration lives in the color mask frame.

slippifishi commented 5 years ago

Thanks for clearing that up Rob, sorry I didn't see your response sooner. Ashamed to say I have only ever used one palette switch in all my projects and have used color mask/replace for everything else ever since so that explains why I haven't noticed any impact. Sometimes I will add a few extra frames onto the end of a color mask scene to drag it out longer if I want it to cover a transition or something.

djrobx commented 5 years ago

Yeah it's probably more of a thing when augmenting a SAM colorization where you might want to use the keyframe algorithm to pick up something that PinballBrowser wouldn't generate a palette change for (and color masks weren't supposed to be used on 4 bit color).

Remember that you can edit the mask frame durations ("delay"). You don't need to add extra frames, you can modify the final one to go on as long as you want. I used that trick to make a mask "stick" through things I couldn't keyframe well quite a bit. Just have to make sure something else will change the mask when it's done. :)

lucky01 commented 4 years ago

fixed here https://github.com/lucky01/go-dmd-clock/commit/b4239325bd3792bcec8e4169ba310608e98675e2

Set 0 (persistent) as default duration for palette switches. Scroll forward in the recording and press "Fetch Duration" to set a timed end of the palette.