Difference between revisions of "IC Python API:RLPy RScene"
Chuck (RL) (Talk | contribs) m |
Chuck (RL) (Talk | contribs) m |
||
Line 5: | Line 5: | ||
== Description == | == Description == | ||
− | An animation project will usually contain all sorts of objects, such as characters, props, lights, cameras, particle systems, etc. The | + | An animation project will usually contain all sorts of objects, such as characters, props, lights, cameras, particle systems, etc. The [[IC_Python_API:RLPy_RScene|RScene]] class is used to manage these objects in the scene. It provides many functions for users to find and access these objects. [[IC_Python_API:RLPy_RScene|RScene]] is a static class that can be used directly without having to create an instance. This class provides functions for finding objects by name or type, deleting object, showing / hiding objects, getting and setting selected object, and so on. |
See Also: [[IC_Python_API:RLPy_RIObject|RIObject]], [[IC_Python_API:RLPy_RIAvatar|RIAvatar]], [[IC_Python_API:RLPy_RIProp|RIProp]] | See Also: [[IC_Python_API:RLPy_RIObject|RIObject]], [[IC_Python_API:RLPy_RIAvatar|RIAvatar]], [[IC_Python_API:RLPy_RIProp|RIProp]] | ||
Line 15: | Line 15: | ||
Deselect everything in the scene. | Deselect everything in the scene. | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
RLPy.RScene.ClearSelectObjects() | RLPy.RScene.ClearSelectObjects() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 39: | Line 39: | ||
:First object that fulfills the search criteria - [[IC_Python_API:RLPy_RIObject|RIObject]] | :First object that fulfills the search criteria - [[IC_Python_API:RLPy_RIObject|RIObject]] | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
# find avatar | # find avatar | ||
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "avatar_name" ) | avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "avatar_name" ) | ||
Line 58: | Line 58: | ||
Searches for all objects that match by name and type. | Searches for all objects that match by name and type. | ||
− | See Also: [[#FindObject ( eType, strName )|FindObject | + | See Also: [[#FindObject ( eType, strName )|FindObject]] |
==== Parameters ==== | ==== Parameters ==== | ||
Line 76: | Line 76: | ||
:All objects that fullfill the search criteria - [[IC_Python_API:RLPy_RIObject|RIObject]] list | :All objects that fullfill the search criteria - [[IC_Python_API:RLPy_RIObject|RIObject]] list | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
props = RLPy.RScene.FindObjects( RLPy.EObjectType_Prop, "prop_name" ) | props = RLPy.RScene.FindObjects( RLPy.EObjectType_Prop, "prop_name" ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 84: | Line 84: | ||
Get all the characters in the scene. The search results can be filtered by avatar type. | Get all the characters in the scene. The search results can be filtered by avatar type. | ||
− | See Also: [[#FindObject ( eType, strName )|FindObject]], [[#FindObjects ( args )|FindObjects | + | See Also: [[#FindObject ( eType, strName )|FindObject]], [[#FindObjects ( args )|FindObjects]] |
==== Parameters ==== | ==== Parameters ==== | ||
Line 97: | Line 97: | ||
:All avatars that fulfill the search criteria - [[IC_Python_API:RLPy_RIAvatar|RIAvatar]] list | :All avatars that fulfill the search criteria - [[IC_Python_API:RLPy_RIAvatar|RIAvatar]] list | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
# Find standard avatars | # Find standard avatars | ||
avatars = RLPy.RScene.GetAvatars( RLPy.EAvatarType_Standard ) | avatars = RLPy.RScene.GetAvatars( RLPy.EAvatarType_Standard ) | ||
Line 111: | Line 111: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === GetProps () === | + | === GetProps ( ) === |
Get all the props in the scene. | Get all the props in the scene. | ||
Line 120: | Line 120: | ||
:All props - [[IC_Python_API:RLPy_RIObject|RIObject]] list | :All props - [[IC_Python_API:RLPy_RIObject|RIObject]] list | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
props = RLPy.RScene.GetProps() | props = RLPy.RScene.GetProps() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === GetSelectedObjects () === | + | === GetSelectedObjects ( ) === |
Get all the selected object in the scene. If no objects are selected then return an empty list. | Get all the selected object in the scene. If no objects are selected then return an empty list. | ||
Line 133: | Line 133: | ||
:All selected objects - [[IC_Python_API:RLPy_RIObject|RIObject]] list | :All selected objects - [[IC_Python_API:RLPy_RIObject|RIObject]] list | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
# get selected objects | # get selected objects | ||
selection_list = RLPy.RScene.GetSelectedObjects() | selection_list = RLPy.RScene.GetSelectedObjects() | ||
Line 148: | Line 148: | ||
:'''spObject''' [IN] Object to be hidden - [[IC_Python_API:RLPy_RIObject|RIObject]] | :'''spObject''' [IN] Object to be hidden - [[IC_Python_API:RLPy_RIObject|RIObject]] | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" ) | avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" ) | ||
RLPy.RScene.Hide(avatar) | RLPy.RScene.Hide(avatar) | ||
Line 166: | Line 166: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" ) | avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" ) | ||
RLPy.RScene.RemoveObject(avatar) | RLPy.RScene.RemoveObject(avatar) | ||
Line 175: | Line 175: | ||
Select an object in the scene. | Select an object in the scene. | ||
− | See Also: [[#SelectObjects ( kObjects )|SelectObjects]], [[#ClearSelectObjects ( )|ClearSelectObjects]], [[#GetSelectedObjects ()|GetSelectedObjects]] | + | See Also: [[#SelectObjects ( kObjects )|SelectObjects]], [[#ClearSelectObjects ( )|ClearSelectObjects]], [[#GetSelectedObjects ( )|GetSelectedObjects]] |
==== Parameters ==== | ==== Parameters ==== | ||
Line 184: | Line 184: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" ) | avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" ) | ||
RLPy.RScene.SelectObject(avatar) | RLPy.RScene.SelectObject(avatar) | ||
Line 193: | Line 193: | ||
Select several objects in the scene. | Select several objects in the scene. | ||
− | See Also: [[#SelectObject ( spObject )|SelectObject]], [[#ClearSelectObjects ( )|ClearSelectObjects]], [[#GetSelectedObjects ()|GetSelectedObjects]] | + | See Also: [[#SelectObject ( spObject )|SelectObject]], [[#ClearSelectObjects ( )|ClearSelectObjects]], [[#GetSelectedObjects ( )|GetSelectedObjects]] |
==== Parameters ==== | ==== Parameters ==== | ||
Line 202: | Line 202: | ||
:Failure - RLPy.RStatus.Failure | :Failure - RLPy.RStatus.Failure | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
avatars = RLPy.RScene.FindObjects( RLPy.EObjectType_Avatar ) | avatars = RLPy.RScene.FindObjects( RLPy.EObjectType_Avatar ) | ||
RLPy.RScene.SelectObjects(avatars) | RLPy.RScene.SelectObjects(avatars) | ||
Line 216: | Line 216: | ||
:'''spObject''' [IN] Object to be shown - [[IC_Python_API:RLPy_RIObject|RIObject]] | :'''spObject''' [IN] Object to be shown - [[IC_Python_API:RLPy_RIObject|RIObject]] | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python"> |
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" ) | avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" ) | ||
RLPy.RScene.Show(avatar) | RLPy.RScene.Show(avatar) | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 00:36, 9 April 2020
Contents
- 1 Description
- 2 Member Functions
- Main article: Modules.
- Last modified: 04/9/2020
Description
An animation project will usually contain all sorts of objects, such as characters, props, lights, cameras, particle systems, etc. The RScene class is used to manage these objects in the scene. It provides many functions for users to find and access these objects. RScene is a static class that can be used directly without having to create an instance. This class provides functions for finding objects by name or type, deleting object, showing / hiding objects, getting and setting selected object, and so on.
See Also: RIObject, RIAvatar, RIProp
Member Functions
ClearSelectObjects ( )
Deselect everything in the scene.
RLPy.RScene.ClearSelectObjects()
FindObject ( eType, strName )
Searches for an object by name and type. Returns the first object that fulfills the search criteria.
Parameters
- eType [IN] Object type - RLPy.EObjectType
- RLPy.EObjectType_Object
- RLPy.EObjectType_Avatar
- RLPy.EObjectType_Prop
- RLPy.EObjectType_Camera
- RLPy.EObjectType_Particle
- RLPy.EObjectType_Light
- RLPy.EObjectType_SpotLight
- RLPy.EObjectType_PointLight
- RLPy.EObjectType_DirectionalLight
- strName [IN] Object name - string
Returns
- First object that fulfills the search criteria - RIObject
# find avatar
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "avatar_name" )
print(type(avatar)) #RLPy.RIAvatar
# find prop
prop = RLPy.RScene.FindObject( RLPy.EObjectType_Prop, "prop_name" )
print(type(prop)) #RLPy.RIProp
# find camera
camera = RLPy.RScene.FindObject( RLPy.EObjectType_Camera, "camera_name" )
print(type(camera)) #RLPy.RICamera
# find particle
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "particle_name" )
print(type(particle)) #RLPy.RIParticle
FindObjects ( args )
Searches for all objects that match by name and type.
See Also: FindObject
Parameters
- eType [IN] Object type - RLPy.EObjectType
- RLPy.EObjectType_Object
- RLPy.EObjectType_Avatar
- RLPy.EObjectType_Prop
- RLPy.EObjectType_Camera
- RLPy.EObjectType_Particle
- RLPy.EObjectType_Light
- RLPy.EObjectType_SpotLight
- RLPy.EObjectType_PointLight
- RLPy.EObjectType_DirectionalLight
- strName [IN] Object name - string
Returns
- All objects that fullfill the search criteria - RIObject list
props = RLPy.RScene.FindObjects( RLPy.EObjectType_Prop, "prop_name" )
GetAvatars ( eAvatarType )
Get all the characters in the scene. The search results can be filtered by avatar type.
See Also: FindObject, FindObjects
Parameters
- eAvatarType [IN] Character type - RLPy.EAvatarType
- RLPy.EAvatarType_Standard
- RLPy.EAvatarType_NonStandard
- RLPy.EAvatarType_NonHuman
- RLPy.EAvatarType_StandardSeries
- RLPy.EAvatarType_All
Returns
- All avatars that fulfill the search criteria - RIAvatar list
# Find standard avatars
avatars = RLPy.RScene.GetAvatars( RLPy.EAvatarType_Standard )
# Find avatars and props
result = RLPy.RScene.FindObjects( RLPy.EObjectType_Avatar | RLPy.EObjectType_Prop, "same_name" )
print(len(result))
for i in range(len(result)):
print(type(result[i])) #RLPy.RIAvatar or IC_Python_API:RLPy_RIProp|RIProp
result = RLPy.RScene.FindObjects( RLPy.EObjectType_Avatar | RLPy.EObjectType_Prop )
print(len(result)) # All avatars and props
GetProps ( )
Get all the props in the scene.
See Also: FindObject, FindObjects
Returns
- All props - RIObject list
props = RLPy.RScene.GetProps()
GetSelectedObjects ( )
Get all the selected object in the scene. If no objects are selected then return an empty list.
See Also: SelectObject, SelectObjects, ClearSelectObjects
Returns
- All selected objects - RIObject list
# get selected objects
selection_list = RLPy.RScene.GetSelectedObjects()
print(selection_list) #print selected objects
Hide ( spObject )
Hide an object in the scene.
See Also: Show
Parameters
- spObject [IN] Object to be hidden - RIObject
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" )
RLPy.RScene.Hide(avatar)
RemoveObject ( spObject )
Remove an object from the scene.
See Also: Show
Parameters
- spObject [IN] Object for removal - RIObject
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" )
RLPy.RScene.RemoveObject(avatar)
SelectObject ( spObject )
Select an object in the scene.
See Also: SelectObjects, ClearSelectObjects, GetSelectedObjects
Parameters
- spObject [IN] Object to be selected - RIObject
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" )
RLPy.RScene.SelectObject(avatar)
SelectObjects ( kObjects )
Select several objects in the scene.
See Also: SelectObject, ClearSelectObjects, GetSelectedObjects
Parameters
- kObjects [IN] Objects for seletion - RIObject list
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
avatars = RLPy.RScene.FindObjects( RLPy.EObjectType_Avatar )
RLPy.RScene.SelectObjects(avatars)
Show ( spObject )
Display an object in the scene.
See Also: Hide
Parameters
- spObject [IN] Object to be shown - RIObject
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "name" )
RLPy.RScene.Show(avatar)