Repository navigation
Conversation
… hash value for "eventtype".
…aps. Added StringHash reversing to VariantMap saving in JSONValue and XMLElement.
| eventFrameElem.SetFloat("time", eventFrame.time_); | ||
| eventFrameElem.SetUInt("eventtype", eventFrame.eventType_.Value()); | ||
| if (StringHash::GetGlobalStringHashRegister() && !eventFrame.eventType_.Reverse().Empty()) | ||
| eventFrameElem.SetAttribute("eventname",eventFrame.eventType_.Reverse()); |
There was a problem hiding this comment.
space missing after ("eventname",
| keyFrameVal.Set("time", keyFrame.time_); | ||
| JSONValue valueVal; | ||
| valueVal.SetVariant(keyFrame.value_); | ||
| valueVal.SetVariant(keyFrame.value_,GetContext()); |
There was a problem hiding this comment.
space missing after (keyFrame.value_,
| eventFrameVal.Set("time", eventFrame.time_); | ||
| eventFrameVal.Set("eventtype", eventFrame.eventType_.Value()); | ||
| if (StringHash::GetGlobalStringHashRegister() && !eventFrame.eventType_.Reverse().Empty()) | ||
| eventFrameVal.Set("eventname",eventFrame.eventType_.Reverse()); |
There was a problem hiding this comment.
space missing after ("eventname",
| eventFrameVal.Set("eventtype", eventFrame.eventType_.Value()); | ||
| JSONValue eventDataVal; | ||
| eventDataVal.SetVariantMap(eventFrame.eventData_); | ||
| eventDataVal.SetVariantMap(eventFrame.eventData_,GetContext()); |
There was a problem hiding this comment.
space missing after (eventFrame.eventData_,
|
@SirNate0 So if I understand this correctly, this affects only the reading from JSON and XML files? |
|
Marking this stale since there has been no activity for 30 days. |
|
I think I need to comment on this PR. I added Therefore, I recommend to treat Having said that, I don't defend hashes in the saved text formats. It's awful. |
Since we have the optional ability to compile support for a reverse StringHash lookup, I added the ability to save the string version rather than just the hash for VariantMaps and events in ValueAnimations. Without URHO3D_HASH_DEBUG enabled, reading from these strings is still supported, but saving will simply be done by the hash value instead.
As part of this I also added support for reading a VariantMap from JSON with arbitrary string keys, they simply have to be prefixed with $ to distinguish, for example "BAD" as a string from 0xBAD as a hexadecimal number. I'm open to a different marker besides $, I just like it as I believe it would be allowed in Javascript, it's easy to type, and it would generally be reasonably clear that it's a marker and not part of the string, plus $ looks a lot like S for String.