IC8 Python API:RLPy RRgb

From Reallusion Wiki!
Jump to: navigation, search

Description

Primary color class that stores data for red (R), green (G), and blue (B). The value stored in RRgb ranges from 0-1, which represents 0 to 255 in color value. You can swtich between these two representations in different ways; For example, the range of values retrieved by R is 0 to 1, and the range of values retrieved by Red is 0 to 255. In addition, preset colors are provided for direct usage: {|class="wikitable" !Constant !Value |- |RLPy.RRgb.BLACK |RLPy.RRgb(0, 0, 0) |- |RLPy.RRgb.WHITE |RLPy.RRgb(1, 1, 1) |- |RLPy.RRgb.RED |RLPy.RRgb(1, 0, 0) |- |RLPy.RRgb.GREEN |RLPy.RRgb(0, 1, 0) |- |RLPy.RRgb.BLUE |RLPy.RRgb(0, 0, 1) |- |RLPy.RRgb.YELLOW |RLPy.RRgb(1, 1, 0) |- |RLPy.RRgb.CYAN |RLPy.RRgb(0, 1, 1) |- |RLPy.RRgb.MAGENTA |RLPy.RRgb(1, 0, 1) |} RRgb does not include alpha data. Use RColor instead if alpha channel is needed. This class also provides ways to convert to other color formats: See Also: RColor

Constructor & Destructor

__init__ (self, *args)

Initializes a new RGB color value instance.

Parameters

  • args

Member Functions

B (self, *args)

Get the blue value of this color (0-1). See Also: Blue

Parameters

  • args

Sample code

Calls `RLPy.RRgb.B` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(0, 0, 1)
    print(color1.B())               # 1

Blue (self)

Get the blue value of this color (0-255). See Also: B

Sample code

Calls `RLPy.RRgb.Blue` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(0, 0, 1)
    print(color1.Blue())            # 255

From (self, r, g, b)

Adjust color using 32 bit (0-255).

Parameters

  • r
  • g
  • b

FromCOLORREF (self, arg2)

Adjust color using COLORREF (0xbbggrr). See Also: ToCOLORREF

Parameters

  • arg2

FromXRGB (self, arg2)

Assign this color using hexadecimal (0xrrggbb). See Also: ToXRGB

Parameters

  • arg2

G (self, *args)

Get the green value of this color (0-1). See Also: Green

Parameters

  • args

Sample code

Calls `RLPy.RRgb.G` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(0, 1, 0)
    print(color1.G())               # 1

Green (self)

Get the green value of this color (0-255). See Also: G

Sample code

Calls `RLPy.RRgb.Green` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(0, 1, 0)
    print(color1.Green())           # 255

Normalize (self)

Normalize RGB values so that their sum equals 1.

Sample code

Calls `RLPy.RRgb.Normalize` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(1, 1, 0)
    color1.Normalize()              # (0.5, 0.5, 0)

R (self, *args)

Get the red value of this color (0-1). See Also: Red

Parameters

  • args

Sample code

Calls `RLPy.RRgb.R` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(1, 0, 0)
    print(color1.R())               # 1

Red (self)

Get the red value of this color (0-255). See Also: R

Sample code

Calls `RLPy.RRgb.Red` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(1, 0, 0)
    print(color1.Red())            # 255

Saturate (self)

Clamp the RGB values to a range of 0 and 1. Values under 0 will become 0, and values over 1 will become 1.

Sample code

Calls `RLPy.RRgb.Saturate` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(1.2, -0.3, 0.5)
    color1.Saturate()              # (1, 0, 0.5)

ToCOLORREF (self)

Output COLORREF data from this color (0xbbggrr). See Also: FromCOLORREF

Sample code

Calls `RLPy.RRgb.ToCOLORREF` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(0, 0, 1)
    print(int(color1.ToCOLORREF()))          # 0xff0000

ToVector3f (self)

Output 3D vector data from this color.

Sample code

Calls `RLPy.RRgb.ToVector3f` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(0, 0, 1)
    print(color1.ToVector3f())

ToXRGB (self)

Output hexadecimal data from this color (0xrrggbb) See Also: FromXRGB

Sample code

Calls `RLPy.RRgb.ToXRGB` with the inputs shown in the example.

def run_script():
    import RLPy
    color1 = RLPy.RRgb(0, 0, 1)
    print(int(color1.ToXRGB()))              # 0xff

__add__ (self, arg2)

Adds another value to this value and returns the result.

Parameters

  • arg2

__eq__ (self, arg2)

Reports whether this value equals another value.

Parameters

  • arg2

__iadd__ (self, arg2)

Adds another value to this value in place.

Parameters

  • arg2

__imul__ (self, *args)

Multiplies this value by another value in place.

Parameters

  • args

__isub__ (self, arg2)

Subtracts another value from this value in place.

Parameters

  • arg2

__itruediv__ (self, *args)

Divides this value by another value in place.

Parameters

  • args

__lt__ (self, arg2)

Reports whether this value is less than another value.

Parameters

  • arg2

__mul__ (self, *args)

Multiplies this value by another value and returns the result.

Parameters

  • args

__ne__ (self, arg2)

Reports whether this value differs from another value.

Parameters

  • arg2

__neg__ (self)

Returns the negated value.

__sub__ (self, arg2)

Subtracts another value from this value and returns the result.

Parameters

  • arg2

__truediv__ (self, *args)

Divides this value by another value and returns the result.

Parameters

  • args

Properties

thisown

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

Constants

BLACK

BLUE

CYAN

GREEN

MAGENTA

RED

WHITE

YELLOW