Skip to content

Respect enum values for TurboModule c++ codegen#56478

Open
christophpurrer wants to merge 1 commit intofacebook:mainfrom
christophpurrer:export-D101229471
Open

Respect enum values for TurboModule c++ codegen#56478
christophpurrer wants to merge 1 commit intofacebook:mainfrom
christophpurrer:export-D101229471

Conversation

@christophpurrer
Copy link
Copy Markdown
Contributor

Summary:
Defining an enum like this:

export enum CustomPropertyEditor {
  BitMask = 0,
  Entity = 1,
  Slider = 2,
  AudioEvent = 3,
  CollisionLayer = 4,
  MaterialComponentDeprecatedProperty = 5,
  MeshMaterialList = 6,
  Submesh = 7,
  // CoreUiLayout (8) removed — rendered identically to ClassOrList
  MaterialMapJson = 9,
  AnimationTable = 10,
  SkeletonAsset = 11,
  NavMeshAreaType = 12,
  VFXAsset = 13,
  Table = 14,
  VariableTable = 15,
  AudioBus = 16,
  LodSettings = 17,
  WorldSearch = 18,
  EntityMaterialList = 19,
  NpcId = 20,
  LightingModelVersion = 21,
  PlatformSelector = 22,
  ComponentReference = 23,
}

(notice number 8 ), will cause the generated enum to actually look like:

  enum class NativeEditableObjectModuleCustomPropertyEditor {
    BitMask, Entity, Slider, AudioEvent, CollisionLayer,
    MaterialComponentDeprecatedProperty, MeshMaterialList, Submesh,
    MaterialMapJson, AnimationTable, ...
  };

in other words, the values don't match up after the core ui value. This is quite dangerous and I'm surprised no one has ever noticed that

This diff fixes things such that if an integer value is explicitly assigned, the value is preserved in the generated enum.

Differential Revision: D101229471

Summary:
Defining an enum like this:

```js
export enum CustomPropertyEditor {
  BitMask = 0,
  Entity = 1,
  Slider = 2,
  AudioEvent = 3,
  CollisionLayer = 4,
  MaterialComponentDeprecatedProperty = 5,
  MeshMaterialList = 6,
  Submesh = 7,
  // CoreUiLayout (8) removed — rendered identically to ClassOrList
  MaterialMapJson = 9,
  AnimationTable = 10,
  SkeletonAsset = 11,
  NavMeshAreaType = 12,
  VFXAsset = 13,
  Table = 14,
  VariableTable = 15,
  AudioBus = 16,
  LodSettings = 17,
  WorldSearch = 18,
  EntityMaterialList = 19,
  NpcId = 20,
  LightingModelVersion = 21,
  PlatformSelector = 22,
  ComponentReference = 23,
}
```
(notice number 8 ), will cause the generated enum to actually look like:
```
  enum class NativeEditableObjectModuleCustomPropertyEditor {
    BitMask, Entity, Slider, AudioEvent, CollisionLayer,
    MaterialComponentDeprecatedProperty, MeshMaterialList, Submesh,
    MaterialMapJson, AnimationTable, ...
  };
```

in other words, the values don't match up after the core ui value. This is quite dangerous and I'm surprised no one has ever noticed that 

This diff fixes things such that if an integer value is explicitly assigned, the value is preserved in the generated enum.

Differential Revision: D101229471
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 16, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Apr 16, 2026

@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101229471.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants