How do I get the current position of a prop?


https://forum.reallusion.com/Topic470050.aspx
Print Topic | Close Window

By Data Juggler - 4 Years Ago
Last night I wrote a 'Replicator' script that is kind of like Multi-Duplicate except you will be able to specify the direction to duplicate and things like Rows and Columns and even a random Scatter feature would be useful I think.

Right now I had to hard code the start position because I don't know how to get the current X, Y or Z movements for a prop (or character).

I will finish the GUI later today to let you specify direction and distances, rows and columns but this one thing I am stuck on.

Thanks for any help.

The code is on Git Hub: https://github.com/DataJuggler/PythonScripts/blob/main/ReplicateProps2Rows.py
(Edit: The code I pasted didn't look right, so you can view it on Git Hub).
By 4u2ges - 4 Years Ago
You get transform values with GetData and set with SetData

Explore it with samples at: https://wiki.reallusion.com/IC_Python_API:RLPy_RDataBlock#GetData
By Data Juggler - 4 Years Ago
Thank you, I had read that article, and searched for GetData and it is hard to find the right info.

The one thing I wish for is Visual Studio Intellisense to understand the Python libraries so I can get prompted what methods are available.

I may play around with adding references to all the ones listed and see if any of that shows up.

Thanks again. The more things I learn how to do in Python, the less I use IClone's IDE. 

I am toying with the idea of a scene designer outside of IClone that just uses shapes to represent props you can drag around for fast set construction.

I have a second question, but I will ask it another thread.
By videodv - 4 Years Ago
Hope this helps

import RLPy

# -- Get Prop --#
prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box_001")

# -- Get Transform Control and Data --#
ts_control = prop.GetControl("Transform")

time = RLPy.RTime()
transform_for_ref = RLPy.RTransform()
ts_control.GetValue(time, transform_for_ref)
propX = transform_for_ref.T().x # Get Prop X position
propY = transform_for_ref.T().y # Get Prop Y position
propZ = transform_for_ref.T().z # Get Prop Z position
        
print(propX)
print(propY)
print(propZ)


Chris.
By Data Juggler - 4 Years Ago
Yes, 4U2Guess pointed me to that also.

The only confusing thing to me is the .T().

I guess the T is a method that is used to find its current position or something.

Thanks,

I am stuck on my other issue at the moment of iterating child props. I don't see anyway to find that. I had to detach my props to be able to manipulate them via code till I solve this.