Profile Picture

Loading a prop: useless if the prop already exists or if loaded twice

Posted By RobertoColombo 3 Months Ago
You don't have permission to rate!

Loading a prop: useless if the prop already exists or if loaded twice

Author
Message
RobertoColombo
RobertoColombo
Posted 3 Months Ago
View Quick Profile
Distinguished Member

Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 1.6K, Visits: 3.0K
Hi,

I want to ask RL to focus of these 2 lines of codes, taken from the example here: http://wiki.reallusion.com/IC_Python_API:Controlling_A_Simple_Prop
#-- Load Box_001.iProp --#
RLPy.RFileIO.LoadFile(ic_template_path + "//iClone Template//Props//3D Blocks//Box_001.iProp")
#-- Get Prop --#
prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box_001")
There is a problem: if the Scene already contains a "Box_001" prop or if simply the Box_001 is loaded two times, there is no way to get the correct object handler because the name of the loaded prop changes.
Perhaps it is possible to grab the object handler via 
RLPy.REventCallback.OnAfterFileLoaded event callback, but this, like most of the other APIs, is left undocumented...

IMO, the simple and most effective solution is : RLPy.RFileIO.LoadFile shall return the object handler or None if not successful. 

So, pls, RL change this otherwise loading 
via API multiple instances of the same prop or also loading a prop which already is in the scene is not feasible

Thanks

  Roberto




My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO / 
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the VB with an HDMI splitter) / DirectX: 12

Edited
3 Months Ago by RobertoColombo
The-any-Key
The-any-Key
Posted 2 Months Ago
View Quick Profile
Veteran Member

Veteran Member (672 reputation)Veteran Member (672 reputation)Veteran Member (672 reputation)Veteran Member (672 reputation)Veteran Member (672 reputation)Veteran Member (672 reputation)Veteran Member (672 reputation)Veteran Member (672 reputation)Veteran Member (672 reputation)

Group: Forum Members
Last Active: 3 hours ago
Posts: 159, Visits: 926
You can grab all props with:

prop_list=RLPy.RScene.GetProps()

Then get the latest one with

latest_inserted_prop=prop_list[-1]




iClone 7, 3DXchange 7 Pipeline, CC3 Pipeline, CT8 Pipeline, Iray, Live Face, iPhone Xr, Win 10, i9 9900K ~5GHz, Nvidia RTX 2080 8GB, 16GB Ram, M.2 SSD
Edited
2 Months Ago by The-any-Key
RobertoColombo
RobertoColombo
Posted 2 Months Ago
View Quick Profile
Distinguished Member

Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)Distinguished Member (6.5K reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 1.6K, Visits: 3.0K
Hi Jeff,

thanks.
That's anyway a work-around which I would like to avoid.
The best way (which Luke from Rl had already confirmed, but surprisingly was not in this DEVELOPMENT version) is to simply having LoadFile() returning the object handler or None if the operation is not successful.

  Roberto

My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO / 
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the VB with an HDMI splitter) / DirectX: 12

Edited
2 Months Ago by RobertoColombo



Reading This Topic