Skip to content

Instantly share code, notes, and snippets.

@yakumo-proj
Last active June 13, 2022 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yakumo-proj/4c3f35a39617d0c45302b7ecb16daaec to your computer and use it in GitHub Desktop.
Save yakumo-proj/4c3f35a39617d0c45302b7ecb16daaec to your computer and use it in GitHub Desktop.
protocol buffer definition(analyzed) for .vroid(clothing_editor/clothing_defs.bin).
syntax = "proto3";
import "google/protobuf/wrappers.proto";
//import "google/protobuf/any.proto";
package Sayo.VRoid;
option csharp_namespace = "Sayo.VRoid";
// clothing_defs.bin file format
message ClothingDefs {
// Common  
message ColorRGBA {
float r = 1;
float g = 2;
float b = 3;
float a = 4;
};
//Common
message Name {
google.protobuf.StringValue userDefinedString = 1;
google.protobuf.StringValue localizationKey = 2;
string fallbackString = 4;
reserved 3, 5 to max;
};
//3: clothingSets
message ClothingSet {
uint32 schemaVersion = 1;
string id = 2;
Name name = 3;
string presetId = 4;
bool edited = 5;
string baseModelDefinitionId = 6;
repeated string partGroupIds = 7;
string commonResourceDefinitionId = 9;
reserved 8, 10 to max;
};
//4: partGroups
message PartGroup {
enum PartSubCategories {
None = 0;
Face = 4;
ClothingTops = 5;
ClothingBottoms = 6;
AccessoryNeck = 9;
Shoes = 12;
reserved 1 to 3, 7, 8, 10, 11, 13 to max;
};
uint32 schemaVersion = 1;
string id = 2;
Name name = 3;
string presetId = 4;
bool edited = 5;
string partGroupDefinitionId = 6;
repeated string partIds = 7;
PartSubCategories partSubCategory = 8;
reserved 9 to max;
};
//5: parts
message Part {
uint32 schemaVersion = 1;
string id = 2;
repeated string partCategories = 5;
string meshId = 6;
repeated string materialIds = 7;
repeated string additionalSkeletonIds = 8;
repeated string attachmentIds = 9;
string blendShapeValueSetId = 10;
reserved 3, 4, 11 to max;
};
//6: materials
message Material {
message ColorArray {
repeated ColorRGBA values = 1;
};
message FloatArray {
repeated float values = 1;
};
message TextureParamValue {
message Body {
message TextureOffset {
reserved 1 to max;
};
message TextureScale {
float x = 1;
float y = 2;
};
string textureId = 1;
TextureOffset textureOffset = 2;
TextureScale textureScale = 3;
reserved 4 to max;
};
Body body = 1;
};
message EditInfo {
Name name = 1;
repeated string parameterNames = 2;
google.protobuf.StringValue instanceId = 3;
reserved 4 to max;
};
uint32 schemaVersion = 1;
string id = 2;
string presetMaterialId = 3;
string objectName = 4;
Name name = 5;
string shaderId = 6;
uint32 renderQueue = 7;
repeated string shaderKeywords = 8;
map<string, ColorArray> colorArrayParameters = 9;
map<string, FloatArray> floatArrayParameters = 10;
map<string, TextureParamValue> textureParameters = 12;
repeated EditInfo colorParameterEditInfos = 14;
repeated EditInfo textureParameterEditInfos = 17;
google.protobuf.StringValue guideTextureId = 19;
reserved 11, 13, 15, 16, 18, 20 to max;
};
//7: colors
message Color {
string id = 1;
Name name = 2;
ColorRGBA value = 3;
reserved 4 to max;
};
//10: colorPaintTextures
message ColorPaintTexture {
string id = 1;
string presetId = 2;
Name name = 3;
string objectName = 4;
google.protobuf.StringValue canvasId = 5;
reserved 6 to max;
};
//13: blendShapeValueSets
message BlendShapeValueSet {
message Keys {
string id = 1;
Name name = 2;
bool shownInverted = 3;
float value = 4;
reserved 5 to max;
};
uint32 schemaVersion = 1;
string id = 2;
repeated Keys keys = 3;
reserved 4 to max;
};
//14: commonResourceDefinition
message CommonResourceDefinition {
message MatcapWarpTexture {
string id = 1;
string objectName = 3;
string sourceTextureId = 4;
ColorRGBA baseColor = 5;
float strength = 6;
float compression = 7;
float rotation = 8;
bool flip = 9;
reserved 2, 10 to max;
};
repeated ClothingDefs.ColorPaintTexture colorPaintTextures = 3;
repeated MatcapWarpTexture matcapWarpTextures = 4;
reserved 1, 2, 5 to max;
};
// member definition
uint32 schemaVersion = 1;
string id = 2;
map<string, ClothingSet> clothingSets = 3;
map<string, PartGroup> partGroups = 4;
map<string, Part> parts = 5;
map<string, Material> materials = 6;
map<string, Color> colors = 7;
map<string, ColorPaintTexture> colorPaintTextures = 10;
map<string, BlendShapeValueSet> blendShapeValueSets = 13;
CommonResourceDefinition commonResourceDefinition = 14;
string facePartGroupId = 15;
string currentClothingSetId = 16;
string currentClothingPresetId= 17;
reserved 8, 9, 11, 12, 18 to max;
};
// Protobuf(clothing_defs.bin) to JSON sample
// usage: VRoidProtobufTest.exe "clothing_defs.bin" "parsed.json"
using System;
using System.IO;
using Google.Protobuf;
using PB = Sayo.VRoid.ClothingDefs;
namespace VRoidProtobufTest
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 2) return;
using var input = File.OpenRead(args[0]);
var parsed = PB.Parser.ParseFrom(input);
File.WriteAllText(args[1], parsed.ToString());
Console.WriteLine("done.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment