roavatar-renderer 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +126 -8
  2. package/dist/index.js +865 -304
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -252,7 +252,7 @@ export declare class AnimatorWrapper extends InstanceWrapper {
252
252
  loadAvatarAnimation(id: bigint, isEmote?: boolean, forceLoop?: boolean): Promise<Response | undefined>;
253
253
  /**
254
254
  * Switches to new animation
255
- * @param name Animation name, such as "idle", "walk", "emote.1234" or "id.1234"
255
+ * @param name Animation name, such as "idle", "walk", "emote.1234" or "id.1234", can also specify sub animation like "idle:0"
256
256
  * @param type
257
257
  * @returns If animation sucessfully played
258
258
  */
@@ -273,6 +273,7 @@ declare class AnimatorWrapperData {
273
273
  toolTracks: AnimationTrack[];
274
274
  toolAddedConnection?: Connection;
275
275
  toolRemovedConnection?: Connection;
276
+ forceTransitionTime: number | undefined;
276
277
  }
277
278
 
278
279
  export declare const animNamesR15: AnimationSet;
@@ -315,6 +316,7 @@ export declare const API: {
315
316
  WearOutfit: (auth: Authentication, outfit: Outfit, onlyItems: boolean) => Promise<[boolean, boolean]>;
316
317
  SaveOutfitNoRetry: (auth: Authentication, outfit: Outfit) => Promise<Response>;
317
318
  GetAvatarDetails: (userId: number) => Promise<Response | Outfit>;
319
+ GetUserAvatarModel: (userId: number) => Promise<Response | OutfitModel>;
318
320
  GetAvatarModel: () => Promise<Response | OutfitModel>;
319
321
  UpdateAvatarModel: (auth: Authentication, model: OutfitModel, updateTypes?: AvatarModelUpdateType[]) => Promise<Response>;
320
322
  GetOutfitModel: (id: number | string, creatorId: number) => Promise<Response | OutfitModel>;
@@ -683,7 +685,7 @@ export declare function awaitTimeout<T>(promise: Promise<T>, time?: number): Pro
683
685
  */
684
686
  export declare function awaitTimeoutThrows<T>(promise: Promise<T>, time?: number): Promise<T>;
685
687
 
686
- declare class BackgroundRenderer {
688
+ export declare class BackgroundRenderer {
687
689
  auth: Authentication;
688
690
  avatarCyclorama?: Instance;
689
691
  backgroundData?: Instance;
@@ -748,6 +750,8 @@ declare class BackgroundRenderer {
748
750
  destroy(): void;
749
751
  }
750
752
 
753
+ export declare type BackgroundRendererErrorType = "avatarCyclorama" | "backgroundData";
754
+
751
755
  /**
752
756
  * @category Mesh
753
757
  */
@@ -1008,6 +1012,8 @@ declare class Cache_2<K, V> {
1008
1012
  }
1009
1013
  export { Cache_2 as Cache }
1010
1014
 
1015
+ export declare function calculateBaseDistanceToCamera(fieldOfViewRad: number, minExtent: Vector3, maxExtent: Vector3, marginScale: number): number;
1016
+
1011
1017
  /**
1012
1018
  * @category Mesh
1013
1019
  */
@@ -1015,6 +1021,39 @@ export declare function calculateMagnitude3D(x: number, y: number, z: number): n
1015
1021
 
1016
1022
  export declare function calculateMotor6Doffset(motor: Instance, includeTransform?: boolean): CFrame;
1017
1023
 
1024
+ export declare type CameraOptions = {
1025
+ optFieldOfView?: number;
1026
+ optFieldOfViewForDistanceScale?: number;
1027
+ minExtent: Vector3;
1028
+ maxExtent: Vector3;
1029
+ extentScale: number;
1030
+ optCameraDistanceScale?: number;
1031
+ targetCFrame: CFrame;
1032
+ optCameraXRot?: number;
1033
+ optCameraYRot?: number;
1034
+ };
1035
+
1036
+ /**@category DataModelEnum */
1037
+ export declare const CameraType: {
1038
+ Fixed: number;
1039
+ Attach: number;
1040
+ Watch: number;
1041
+ Track: number;
1042
+ Follow: number;
1043
+ Custom: number;
1044
+ Scriptable: number;
1045
+ Orbital: number;
1046
+ };
1047
+
1048
+ /**
1049
+ * @category InstanceWrapper
1050
+ */
1051
+ export declare class CameraWrapper extends InstanceWrapper {
1052
+ static className: string;
1053
+ static requiredProperties: string[];
1054
+ setup(): void;
1055
+ }
1056
+
1018
1057
  /** @category Outfit */
1019
1058
  export declare const CatalogBundleTypes: string[];
1020
1059
 
@@ -1033,6 +1072,7 @@ export declare class CFrame {
1033
1072
  Position: Vec3;
1034
1073
  Orientation: Vec3;
1035
1074
  constructor(x?: number, y?: number, z?: number);
1075
+ static Angles(x: number, y: number, z: number): CFrame;
1036
1076
  clone(): CFrame;
1037
1077
  getTHREEMatrix(): THREE.Matrix4;
1038
1078
  getMatrix(): THREE.Matrix4Tuple;
@@ -1042,8 +1082,12 @@ export declare class CFrame {
1042
1082
  upVector(): Vec3;
1043
1083
  static lookAt(eye: Vec3, target: Vec3, up?: Vec3): CFrame;
1044
1084
  static fromEulerAngles(rx: number, ry: number, rz: number, order?: THREE.EulerOrder): CFrame;
1085
+ rotationOnly(): CFrame;
1086
+ toEulerAngles(order?: THREE.EulerOrder): Vec3;
1045
1087
  inverse(): CFrame;
1046
1088
  multiply(cf: CFrame): CFrame;
1089
+ multiplyVector(vector: Vector3): Vector3;
1090
+ removeNaN(newValue?: number): CFrame;
1047
1091
  isSame(other: CFrame): boolean;
1048
1092
  }
1049
1093
 
@@ -1133,6 +1177,21 @@ export declare class Connection {
1133
1177
  Disconnect(): void;
1134
1178
  }
1135
1179
 
1180
+ export declare const CONSTANTS_CameraPresetsUtility: {
1181
+ GOLDEN_RATIO: number;
1182
+ UPVECTOR_ORENTATION_TRESHOLD: number;
1183
+ AVATAR_ROTATION_DEGREE: number;
1184
+ };
1185
+
1186
+ export declare const CONSTANTS_CameraUtility: {
1187
+ DefaultHeadMarginScale: number;
1188
+ DefaultBodyMarginScale: number;
1189
+ DefaultBodyPartMarginScale: number;
1190
+ XRotForFullBody: number;
1191
+ XRotForCloseup: number;
1192
+ DistanceScaleForFullBody: number;
1193
+ };
1194
+
1136
1195
  /**
1137
1196
  * @category InstanceWrapper
1138
1197
  */
@@ -1206,6 +1265,8 @@ export declare class COREMESH {
1206
1265
 
1207
1266
  export declare function createContentMap(): void;
1208
1267
 
1268
+ export declare function createThumbnailCamera(): Instance;
1269
+
1209
1270
  /**
1210
1271
  * @category Mesh
1211
1272
  */
@@ -1700,12 +1761,26 @@ export declare function generateOutfitModelThumbnail(auth: Authentication, outfi
1700
1761
  * console.log(result)
1701
1762
  * ```
1702
1763
  */
1703
- export declare function generateOutfitThumbnail(auth: Authentication, outfit: Outfit, size?: Vec2, type?: ThumbnailType, quality?: number, gltfAutoDownload?: boolean, includeAnimations?: boolean, renderSceneParam?: RBXRendererScene): Promise<ThumbnailResult>;
1764
+ export declare function generateOutfitThumbnail(auth: Authentication, outfit: Outfit | OutfitModel, size?: Vec2, type?: ThumbnailType, quality?: number, gltfAutoDownload?: boolean, includeAnimations?: boolean, renderSceneParam?: RBXRendererScene, thumbnailCameraType?: ThumbnailCameraType): Promise<ThumbnailResult>;
1704
1765
 
1705
1766
  export declare function generateUUIDv4(): string;
1706
1767
 
1707
1768
  export declare function GetAttachedPart(accessory: Instance, rig: Instance): Instance | undefined;
1708
1769
 
1770
+ export declare function getAvatarCameraCFrame(character: Instance, applyEmote?: () => void, isFallbackEmoteApplied?: boolean, fieldOfViewDeg?: number, cameraOptionsOverride?: Partial<CameraOptions>): Instance | undefined;
1771
+
1772
+ export declare function getCameraCFrame(targetCFrame: CFrame, relativePos: Vector3): CFrame;
1773
+
1774
+ /**
1775
+ * Calculates the CFrame the camera should be at when generating a customized avatar thumbnail
1776
+ * @param rig Character
1777
+ * @param fov Customized fov
1778
+ * @param yRot Customized yRot
1779
+ * @returns Thumbnail camera cframe
1780
+ * @category ThumbnailGenerator
1781
+ */
1782
+ export declare function getCameraCFrameForAvatarCustomized(rig: Instance, fov: number, yRot: number): CFrame | undefined;
1783
+
1709
1784
  /**
1710
1785
  * @deprecated Use getThumbnailCameraCFrame instead
1711
1786
  * @param rig
@@ -1720,11 +1795,12 @@ export declare function getCameraCFrameForAvatarNonCustomized(rig: Instance): CF
1720
1795
  * @param yRot Customized yRot
1721
1796
  * @param distance Customized distanceScale
1722
1797
  * @returns Thumbnail camera cframe
1723
- * @deprecated Use new Thumbnails category instead
1724
1798
  * @category ThumbnailGenerator
1725
1799
  */
1726
1800
  export declare function getCameraCFrameForHeadshotCustomized(rig: Instance, fov: number, yRot: number, distance: number): CFrame | undefined;
1727
1801
 
1802
+ export declare function getCharacterTorsoCFrame(character: Instance): CFrame;
1803
+
1728
1804
  /**
1729
1805
  * @category Mesh
1730
1806
  */
@@ -1745,8 +1821,12 @@ export declare function getExtentsForParts(parts: Instance[], includeTransform?:
1745
1821
 
1746
1822
  export declare function getExtentsWorld(rig: Instance): [Vector3, Vector3];
1747
1823
 
1824
+ export declare function getFullBodyCameraCFrame(character: Instance, applyEmote?: () => void, isFallbackEmoteApplied?: boolean, fieldOfViewDeg?: number, characterInitialCFrame?: CFrame, autoZoom?: boolean): CFrame | undefined;
1825
+
1748
1826
  export declare function getHeadExtents(rig: Instance): [Vector3, Vector3] | undefined;
1749
1827
 
1828
+ export declare function getHeadshotCameraCFrame(character: Instance, applyEmote?: () => void, isFallbackEmoteApplied?: boolean, fieldOfViewDeg?: number, cameraOptionsOverride?: Partial<CameraOptions>): Instance | undefined;
1829
+
1750
1830
  /**@category API */
1751
1831
  export declare interface GetInfoForId_Result {
1752
1832
  "description": string;
@@ -2123,6 +2203,7 @@ export declare class InstanceWrapper {
2123
2203
  static requiredProperties: string[];
2124
2204
  instance: Instance;
2125
2205
  constructor(instance: Instance);
2206
+ addProp(name: string, type: number, value: unknown): void;
2126
2207
  setup(): void;
2127
2208
  static(): typeof InstanceWrapper;
2128
2209
  static IsA(className: string): any;
@@ -2310,7 +2391,7 @@ export declare class LocalOutfit {
2310
2391
  constructor(outfit: Outfit);
2311
2392
  toJson(): LocalOutfitJson;
2312
2393
  fromJson(data: LocalOutfitJson): this;
2313
- update(outfit: Outfit): void;
2394
+ update(outfitModel: Outfit | OutfitModel): void;
2314
2395
  /**
2315
2396
  * @deprecated Use toOutfitModel() instead
2316
2397
  */
@@ -2937,7 +3018,7 @@ export declare const OutfitOrigin: {
2937
3018
  *
2938
3019
  * const outfitRenderer = new OutfitRenderer(auth, outfit, renderScene)
2939
3020
  * outfitRenderer.startAnimating()
2940
- * outfitRenderer.setMainAnimation("anim.1234") //animation with id 1234, check documentation for other possible values
3021
+ * outfitRenderer.setMainAnimation("id.1234") //animation with id 1234, check documentation for other possible values
2941
3022
  *
2942
3023
  * outfitRenderer.onRenderSuccess.Connect(() => {
2943
3024
  * //handle Instance tree + renderDesc being successfuly
@@ -2968,7 +3049,7 @@ export declare class OutfitRenderer {
2968
3049
  currentRigType: AvatarType;
2969
3050
  doCameraUpdateOnLoad: boolean; /**Makes camera update when new avatar has loaded */
2970
3051
  doCameraUpdate: boolean; /**Does camera update every frame */
2971
- doAddInstance: boolean; /**If outfitRenderer should call RBXRenderer.addInstance() */
3052
+ doAddInstance: boolean; /**If outfitRenderer should call RBXRenderer.addInstance(), setting this to false will make OutfitRenderer return success early */
2972
3053
  forceAnimationLoop: boolean; /**If future loaded animations should be set to loop */
2973
3054
  backgroundRenderer: BackgroundRenderer;
2974
3055
  currentlyChangingRig: boolean;
@@ -3009,6 +3090,9 @@ export declare class OutfitRenderer {
3009
3090
  * @returns void
3010
3091
  */
3011
3092
  onRenderError: Event_2;
3093
+ get humanoid(): Instance | undefined;
3094
+ get animator(): Instance | undefined;
3095
+ get animatorW(): AnimatorWrapper | undefined;
3012
3096
  /**
3013
3097
  * Creates a new OutfitRenderer which makes it easy to render outfits
3014
3098
  * @param auth The authentication object, you should have one you use for everything
@@ -3048,9 +3132,15 @@ export declare class OutfitRenderer {
3048
3132
  * Stops updating the animation of the outfit per frame
3049
3133
  */
3050
3134
  stopAnimating(): void;
3135
+ /**
3136
+ * Checks if the provided animation set is loaded
3137
+ * @param name The name of the animation, for example "idle", "run", but NOT "emote.1234" or "id.1234" as they are not in the animation set
3138
+ * @returns If the animation is loaded
3139
+ */
3140
+ hasAnimationSetAnimation(name: string): boolean;
3051
3141
  /**
3052
3142
  * Sets the current animation being played
3053
- * @param name The name of the animation, for example "idle", "run", "emote.1234" or "anim.1234"
3143
+ * @param name The name of the animation, for example "idle", "run", "emote.1234" or "id.1234"
3054
3144
  * @returns If the animation started playing, it may start playing later if it has been queued despite returning false
3055
3145
  */
3056
3146
  setMainAnimation(name: string): Promise<boolean>;
@@ -3086,6 +3176,16 @@ export declare const ParticleEmitterShapeInOut: {
3086
3176
  InAndOut: number;
3087
3177
  };
3088
3178
 
3179
+ /**
3180
+ * @category InstanceWrapper
3181
+ */
3182
+ export declare class ParticleEmitterWrapper extends InstanceWrapper {
3183
+ static className: string;
3184
+ static requiredProperties: string[];
3185
+ setup(): void;
3186
+ Emit(count?: number): void;
3187
+ }
3188
+
3089
3189
  /**@category DataModelEnum */
3090
3190
  export declare const ParticleFlipbookLayout: {
3091
3191
  None: number;
@@ -3208,6 +3308,10 @@ declare class QuantizedTransform {
3208
3308
  clone(): QuantizedTransform;
3209
3309
  }
3210
3310
 
3311
+ export declare const R15BodyPartNames: string[];
3312
+
3313
+ export declare const R6BodyPartNames: string[];
3314
+
3211
3315
  export declare function rad(degrees: number): number;
3212
3316
 
3213
3317
  /**
@@ -3749,6 +3853,14 @@ export declare interface Search_Result {
3749
3853
  }[];
3750
3854
  }
3751
3855
 
3856
+ export declare function setupAccessoryCamera(accessoryModel: Instance, camera: Instance): void;
3857
+
3858
+ export declare function setupBodyPartCamera(mannequin: Instance, faceRight: boolean, focusPartNames: string[], camera: Instance): void;
3859
+
3860
+ export declare function setupCamera(camera: Instance, cameraOptions: CameraOptions): void;
3861
+
3862
+ export declare function setupHeadCamera(headModel: Instance, camera: Instance): void;
3863
+
3752
3864
  /**
3753
3865
  * Gives a scene the default appearance for thumbnails
3754
3866
  * @param renderScene RBXRenderScene to setup
@@ -3859,6 +3971,11 @@ export declare const StringBufferProperties: string[];
3859
3971
 
3860
3972
  declare type ThreePoseCorrective = Vec3;
3861
3973
 
3974
+ /**
3975
+ * @deprecated Use new Thumbnails category instead
3976
+ * @category ThumbnailGenerator */
3977
+ export declare type ThumbnailCameraType = "default" | "avatarHeadshot" | "avatarFullbody" | "fullbody";
3978
+
3862
3979
  export declare class ThumbnailCustomization {
3863
3980
  thumbnailType: number;
3864
3981
  emoteAssetId: number;
@@ -4064,6 +4181,7 @@ export declare class Vector3 {
4064
4181
  normalize(): Vector3;
4065
4182
  clone(): Vector3;
4066
4183
  isSame(other: Vector3): boolean;
4184
+ lerp(other: Vector3, t: number): Vector3;
4067
4185
  static new(X: number, Y: number, Z: number): Vector3;
4068
4186
  }
4069
4187