vrchat-community / osc

Files and Info on using OSC to communicate with VRChat
MIT License
233 stars 4 forks source link

Issues with Parameters and Avatar Names with non-alphanumeric characters #31

Closed logicmachine closed 2 years ago

logicmachine commented 2 years ago

Describe the bug Expression parameters that contains whitespaces in its name cannot be modified via OSC input. According to the debug consoles, it seems that address and value are received normally but expression parameters are not modified.

To Reproduce

  1. Upload an avatar that has an expression parameter with whitespaces in its name.
  2. Send OSC message with address for problematic parameter. (I copied its address from autogenerated JSON.)

Expected behavior Parameter will be modified similar to when its name does not contains whitespaces.

Screenshots image

Info (please complete the following information):

NarryG commented 2 years ago

Per the official OSC spec, spaces are a reserved character and cannot be included in an OSC Method or an OSC Container
OSC 1.0 Spec.

momo-the-monster commented 2 years ago

Thanks for reporting - my first thought is that we can replace spaces with underscores when generating the config and matching names. FWIW - you should be able to do this with your existing config - just change the input.address in the config to have an underscore while leaving the name of the parameter the same.

NarryG commented 2 years ago

Thanks for reporting - my first thought is that we can replace spaces with underscores when generating the config and matching names. FWIW - you should be able to do this with your existing config - just change the input.address in the config to have an underscore while leaving the name of the parameter the same.

There are other characters that don't work as well such as }. It's unlikely they're in parameter names, but it would make sense to either replace all of them, even if they're not likely to be used.
At the same time, I can see the utility in the ability to intentionally ensure OSC can't be used against a specific parameter and this could act as a way to do it (e.g. people who use pincode systems on their avatars so they can share them public with friends but random people can't use it if they clone it such that can't be bruteforced), but it is somewhat edge case behavior and probably better defined with explicit behavior rather than esoteric "these characters will cause your parameter to not respond to OSC"

momo-the-monster commented 2 years ago

@NarryG - agreed on the sanitation approach. I think we'll replace every non-alphanumeric character with either nothing or an underscore.

momo-the-monster commented 2 years ago

Fixed in next release! Any non-alphanumeric characters will be replaced with underscore. You can patch this yourself in the meantime by replacing them yourself in the config.

So a Boolean parameter named "Toggle With Space" can be modified to:

{
    "name" : "Toggle With Space",
    "input" : {
        "address" : "/avatar/parameters/Toggle_With_Space",
        "type" : "Float"
    },
    "output" : {
        "address" : "/avatar/parameters/Toggle_With_Space",
        "type" : "Bool"
    }
}