RRAvatar3DUserAdjustmentsLayout

Objective-C

@interface RRAvatar3DUserAdjustmentsLayout : RRAbstractLayout

Swift

class RRAvatar3DUserAdjustmentsLayout : RRAbstractLayout

This class implements the visualization of a 3D avatar to be converted to a 2D avatar. Additionally it also provides an interface for editing avatar pose and shape.

  • Default initializer. This initializer will use the avatar body model’s default config when setting the avatar.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()
  • Initializer that takes a config instance that contains information about the virtual camera used for rendering the avatar, possible body shape morphs as well as available poses for the avatar.

    Declaration

    Objective-C

    - (nonnull instancetype)
                  initWithConfig:
                      (nonnull RRAvatar3DUserAdjustmentsLayoutConfig *)config
        poseAndShapeDataProvider:
            (RRAbstractLargeObjectDataProvider *_Nullable)poseAndShapeDataProvider;

    Swift

    init(config: RRAvatar3DUserAdjustmentsLayoutConfig, poseAndShapeDataProvider: RRAbstractLargeObjectDataProvider?)

    Parameters

    config

    The configuration instance used to define the layout’s properties.

    poseAndShapeDataProvider

    A data provider for pose and shape data that is referenced within the config file.

  • Initializer that takes a state instance that contains a backup of a previous state of the layout for a given avatar. The state includes all configs and properties of the layout.

    Declaration

    Objective-C

    - (nonnull instancetype)
                   initWithState:
                       (nonnull RRAvatar3DUserAdjustmentsLayoutState *)state
                          avatar:(nonnull RRAvatar3D *)avatar
        poseAndShapeDataProvider:
            (RRAbstractLargeObjectDataProvider *_Nullable)poseAndShapeDataProvider;

    Swift

    init(state: RRAvatar3DUserAdjustmentsLayoutState, avatar: RRAvatar3D, poseAndShapeDataProvider: RRAbstractLargeObjectDataProvider?)

    Parameters

    state

    The layout state object to initialize the properties of the layout.

    avatar

    The avatar instance to edit using the layout.

    poseAndShapeDataProvider

    A data provider for pose and shape data that is referenced within the config file.

  • The instance of the 3D avatar that is rendered/edited by the layout.

    Declaration

    Objective-C

    @property (nonatomic, strong) RRAvatar3D *_Nullable avatar;

    Swift

    var avatar: RRAvatar3D? { get set }
  • This property changes the virtual camera’s vertical field of view in degrees. This property is also defined in the layout’s configuration as an initial value.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat verticalFOV;

    Swift

    var verticalFOV: CGFloat { get set }
  • This property changes the virtual camera’s vertical tilt angle in degrees. Positive angles let the camera look downwards. This property is also defined in the layout’s configuration as an initial value.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat verticalTiltAngle;

    Swift

    var verticalTiltAngle: CGFloat { get set }
  • This property changes the virtual camera’s visible vertical range minimum value in meters. A value of 0 represents the ground the avatar is standing on and negative values will add an extra margin below the avatar in the rendered image. This property is also defined in the layout’s configuration as an initial value.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat visibleVerticalRangeMin;

    Swift

    var visibleVerticalRangeMin: CGFloat { get set }
  • This property changes the virtual camera’s visible vertical range maximum value in meters. If this value is less than the avatar’s body height, the avatar will for sure be cropped in the rendered image. Make sure to have some safety margin for this value to avoid cropping the avatar’s head. This property is also defined in the layout’s configuration as an initial value.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat visibleVerticalRangeMax;

    Swift

    var visibleVerticalRangeMax: CGFloat { get set }
  • This property changes the background color of the rendered image.

    Declaration

    Objective-C

    @property (nonatomic) UIColor *_Nonnull backgroundColor;

    Swift

    var backgroundColor: UIColor { get set }
  • This property enables/disables a shadow below the avatar’s feet.

    Declaration

    Objective-C

    @property (nonatomic) BOOL shadowEnabled;

    Swift

    var shadowEnabled: Bool { get set }
  • This property enables to obtain or apply the/a state of the layout instance. The state includes all modified properties and configs used in the layout.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) RRAvatar3DUserAdjustmentsLayoutState *_Nonnull layoutState;

    Swift

    var layoutState: RRAvatar3DUserAdjustmentsLayoutState { get }
  • Retrieves a list of all interactively adjustable morphs.

    Declaration

    Objective-C

    - (NSArray<RRAdjustableMorph *> *_Nonnull)getAdjustableMorphs;

    Swift

    func getAdjustableMorphs() -> [RRAdjustableMorph]
  • Modify an adjustable morph factor to interactively change the body shape.

    Declaration

    Objective-C

    - (BOOL)modifyAdjustableMorph:(NSUInteger)morphIndex
                           factor:(CGFloat)factor
                 didFailWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func modifyAdjustableMorph(_ morphIndex: UInt, factor: CGFloat) throws

    Parameters

    morphIndex

    The index of the morph that should be adjusted

    factor

    The factor to apply to the morph. 0 is default and represents no change of the body shape.

    error

    An optional pointer to an NSError pointer. When this method fails, it will set an NSError instance to this pointer if provided.

    Return Value

    YES if successful, NO otherwise.

  • Retrieves the currently applied morph factor of a specific morph.

    Declaration

    Objective-C

    - (CGFloat)getAdjustableMorphFactor:(NSUInteger)morphIndex;

    Swift

    func getAdjustableMorphFactor(_ morphIndex: UInt) -> CGFloat

    Parameters

    morphIndex

    The index of the morph of interest.

    Return Value

    The currently applied morph factor.

  • Retrieves a list of available body pose preset names. These body poses and their names are specified in the configuration of the layout.

    Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)getBodyModelPosePresetNames;

    Swift

    func getBodyModelPosePresetNames() -> [String]

    Return Value

    A list of available body pose preset names.

  • This property specifies the index of the currently shown body pose preset. These body pose presets and their names are specified in the configuration of the layout.

    Declaration

    Objective-C

    @property (nonatomic) NSInteger bodyModelPosePresetIndex;

    Swift

    var bodyModelPosePresetIndex: Int { get set }
  • Retrieves a list of available body shape preset names. These body shapes and their names are specified in the configuration of the layout.

    Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)getBodyModelShapePresetNames;

    Swift

    func getBodyModelShapePresetNames() -> [String]

    Return Value

    A list of available body shape preset names.

  • This property specifies the index of the currently shown body shape preset. These body shape presets and their names are specified in the configuration of the layout.

    Declaration

    Objective-C

    @property (nonatomic) NSInteger bodyModelShapePresetIndex;

    Swift

    var bodyModelShapePresetIndex: Int { get set }
  • This method overrides the body shape of the edited avatar instance with the given RRBodyModel3DShape instance.

    Declaration

    Objective-C

    - (BOOL)setBodyModelShape:(nonnull RRBodyModel3DShape *)bodyModelShape
             didFailWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func setBodyModelShape(_ bodyModelShape: RRBodyModel3DShape) throws

    Parameters

    bodyModelShape

    The parametric body model’s shape to apply to the avatar.

    error

    An optional pointer to an NSError pointer. When this method fails, it will set an NSError instance to this pointer if provided.

    Return Value

    YES if successful, NO otherwise.

  • Enable automatic pose readjustments. When this option is enabled, changing the body shape can automatically readjust the pose in a natural way. This option is enabled by default using a config that is part of the template body model file which is used by the avatar.

    Declaration

    Objective-C

    - (BOOL)enablePoseReadjustment:(nonnull RRPoseReadjustmentConfig *)config
                  didFailWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func enablePoseReadjustment(_ config: RRPoseReadjustmentConfig) throws

    Parameters

    config

    The readjustment config

    error

    An optional pointer to an NSError pointer. When this method fails, it will set an NSError instance to this pointer if provided.

    Return Value

    YES if successful, NO otherwise.

  • Disable automatic pose readjustments. When this option is enabled, changing the body shape can automatically readjust the pose in a natural way.

    Declaration

    Objective-C

    - (void)disablePoseReadjustment;

    Swift

    func disablePoseReadjustment()