Profile Picture

How do I get the current position of a prop?

Posted By Data Juggler 3 Years Ago
You don't have permission to rate!
Author
Message
Data Juggler
Data Juggler
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 1.7K, Visits: 5.4K
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).


Creator of the free website:
PixelDatabase.Net
A Free Online Text Based Image Editor
https://forum.reallusion.com/uploads/images/6e6663e2-0ecf-447a-ab3d-d49d.png

Edited
3 Years Ago by Data Juggler
4u2ges
This post has been flagged as an answer
4u2ges
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (20.7K reputation)Distinguished Member (20.7K reputation)Distinguished Member (20.7K reputation)Distinguished Member (20.7K reputation)Distinguished Member (20.7K reputation)Distinguished Member (20.7K reputation)Distinguished Member (20.7K reputation)Distinguished Member (20.7K reputation)Distinguished Member (20.7K reputation)

Group: Forum Members
Last Active: 12 hours ago
Posts: 5.0K, Visits: 15.9K
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




Edited
3 Years Ago by 4u2ges
Data Juggler
Data Juggler
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 1.7K, Visits: 5.4K
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.

Creator of the free website:
PixelDatabase.Net
A Free Online Text Based Image Editor
https://forum.reallusion.com/uploads/images/6e6663e2-0ecf-447a-ab3d-d49d.png

videodv
videodv
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)Distinguished Member (2.8K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 342, Visits: 12.0K
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.
Data Juggler
Data Juggler
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)Distinguished Member (12.5K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 1.7K, Visits: 5.4K
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. 






Creator of the free website:
PixelDatabase.Net
A Free Online Text Based Image Editor
https://forum.reallusion.com/uploads/images/6e6663e2-0ecf-447a-ab3d-d49d.png




Reading This Topic