IC Python API:RLPy RVariant
From Reallusion Wiki!
Revision as of 01:10, 26 March 2019 by Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} == Detailed Description == The class acts like a union for the most common data types. A RVariant object holds a sin...")
- Main article: Modules.
Detailed Description
The class acts like a union for the most common data types. A RVariant object holds a single value of a single type() at a time. You can find out what type the variant holds, get its value using one of the toT()
functions (e.g., ToInt32()).x = RLPy.RVariant(-10)
print(x.GetType() == RLPy.RVariant.Int32) #true
f = x.ToFloat()
print(f) #-10.0
y = RLPy.RVariant(10.0)
print(y.GetType() == RLPy.RVariant.Float) #true
n = x.ToInt32()
print(n) #10
Constructor & Destructors
__init__
RLPy.RVariant.__init__ ( self, args )
Constructor, Initialize a new RVariant object with a RVariant data.
Parameters
fValue [IN] a float data - float
Member Functions
GetType
RLPy.RVariant.GetType ( self )
Get the type of this RVariant object.
Returns
The type of a RVariant object - RLPy.Type
ToFloat
RLPy.RVariant.ToFloat ( self, pSucess = None )
Convert to float.
Parameters
pSucess [IN] success or not - bool
Returns
The float value after conversion - float
ToInt32
RLPy.RVariant.ToInt32 ( self, pSucess = None )
Convert to int32_t.
Parameters
pSucess [IN] success or not - bool
Returns
The int32_t value after conversion - int
ToUInt32
RLPy.RVariant.ToUInt32 ( self, pSucess = None )
Convert to uint32_t.
Parameters
pSucess [IN] success or not - bool
Returns
The uint32_t value after conversion - int