IC8 Python API:RLPy RCustomValue

From Reallusion Wiki!
Jump to: navigation, search

Description

This class stores a dynamically typed custom value and exposes conversions to supported scalar, string, handle, array, and map forms.

Constructor & Destructor

__init__ (self, *args)

Initializes a new custom value instance.

Parameters

  • args

Member Functions

AssignTo (self, kTargetValue)

Assigns this custom value to the target custom value.

Parameters

  • kTargetValue

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

Clear (self)

Clears the value stored by this custom value.

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

GetType (self)

Returns the type.

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

GetValue (self, *args)

Returns the value stored in this custom value.

Parameters

  • args

SetValue (self, *args)

Stores a value in this custom value.

Parameters

  • args

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

ToBoolean (self)

Converts the stored custom value to a Boolean.

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

ToChar (self)

Returns the stored custom value as a character.

ToDouble (self)

Converts the stored custom value to a double-precision number.

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

ToFloat (self)

Converts the stored custom value to a floating-point number.

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

ToHandle (self)

Returns the stored value as a handle, or None when the value is not a handle.

ToInt64 (self)

Converts the stored custom value to a 64-bit integer.

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

ToInteger (self)

Converts the stored custom value to an integer.

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

ToMap (self)

Returns the stored value as a custom-value map.

ToString (self)

Converts the stored custom value to a string.

ToWString (self)

Converts the stored custom value to a wide string.

__eq__ (self, kValue)

Reports whether this value equals another value.

Parameters

  • kValue

Sample code

Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.

import RLPy

def run_script():
    integer_value = RLPy.RCustomValue(17)
    float_value = RLPy.RCustomValue(1.75)
    text_value = RLPy.RCustomValue("sample")
    boolean_value = RLPy.RCustomValue(True)

    numeric_results = (
        integer_value.ToInteger(),
        integer_value.ToInt64(),
        float_value.ToFloat(),
        float_value.ToDouble(),
    )
    boolean_result = boolean_value.ToBoolean()
    equality_result = integer_value == RLPy.RCustomValue(17)

    target = RLPy.RCustomValue()
    integer_value.AssignTo(target)
    moved_results = (integer_value.GetType(), target.ToInteger())

    mutable = RLPy.RCustomValue()
    mutable.SetValue(22)
    set_integer = mutable.ToInteger()
    mutable.SetValue(3.25)
    set_float = mutable.ToDouble()
    mutable.SetValue("updated")
    set_text_type = mutable.GetType()
    mutable.SetValue(False)
    set_boolean = mutable.ToBoolean()

    cleared = RLPy.RCustomValue(33)
    cleared.Clear()
    clear_type = cleared.GetType()
    return {
        "types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
        "numeric": numeric_results,
        "boolean": boolean_result,
        "equal": equality_result,
        "assigned": moved_results,
        "set_value": (set_integer, set_float, set_text_type, set_boolean),
    }

Properties

thisown

Indicates whether this SWIG proxy owns the underlying C++ object.