tS7.6 - Copy to Object

free scripts, plugins, models, textures
Post Reply
User avatar
trueBlue
Captain
Posts: 1551
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

tS7.6 - Copy to Object

Post by trueBlue » 02 Feb 2010, 02:28

tS76 Copy to Object
Copy to Object.PNG
Copy to Object.PNG (7.92 KiB) Viewed 954 times
Copy - With your object selected that you want to copy, select the Copy button.
Apply - With your object selected that you want to apply the copied attributes to, select the Apply button.
Auto ON - Enables you to apply the copied attributes to several objects by selecting them in 3D Space.

Top Menu starting from the left:
1.) Save - Drag the floating panel where you want it and select the button. Next time you open the floating panel it will open in your saved position.
2.) Open - Opens the floating panel.
3.) Exit - Closes the floating panel and the panel in the Link Editor.

Note: It works better if your copy object's Scale is anything other then Workspaces's default Scale: X =1, Y = 1, and Z = 1.
What this script does is apply the Copies object's WldMatrix to the other object's Matrix.
I may update this later to include applying each attribute separately.
Attachments
tS76 Copy to Object.zip
(42.52 KiB) Downloaded 39 times

Saul
Senior Chief Petty Officer
Posts: 192
Joined: 22 May 2009, 16:50

Re: tS7.6 - Copy to Object

Post by Saul » 02 Feb 2010, 14:22

Thanks trueBlue, that does it for simple objects but not for encapsulated, is there a trick to make it copy the co-ords, transform etc of an encapsulated object?

User avatar
trueBlue
Captain
Posts: 1551
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: tS7.6 - Copy to Object

Post by trueBlue » 02 Feb 2010, 17:14

Ah right! Try this version.
Edit: Does not work as expected in Model with Glued as Siblings objects.
Should work in Workspace for encapsulated objects though.

User avatar
trueBlue
Captain
Posts: 1551
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: tS7.6 - Copy to Object

Post by trueBlue » 24 Jan 2018, 19:40

Updating this project and need some feedback.
tS7.61 Transform.RsScn.
There is a Help file on the panel.
Careful with the Auto ON button as it uses the Selection Change Event when activated.
Be sure to turn it OFF!
See how this works with Objects and Encapsulated Objects included with the scene.
With the Cubes selected in 3D Space use your Arrow Down key to enter into selecting the Objects, then you can select with your mouse.

Encapsulated objects in tS is so weird!
Attachments
Transform.RsScn
(444.04 KiB) Downloaded 17 times

stan
Master Chief Petty Officer
Posts: 471
Joined: 21 May 2009, 17:20

Re: tS7.6 - Copy to Object

Post by stan » 24 Jan 2018, 21:20

the original and the latest both work fine. encaps center is the first one glued offset by location is that why they seem weird?

you made your first object at 0,0,0 in the group so it landed on the target. If you encap at any place in the scene it adds the offset from 0,0,0 to the first object.so doesn't land on the target. If you do a normalize location it jumps to that location, not 0,0,0.

User avatar
trueBlue
Captain
Posts: 1551
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: tS7.6 - Copy to Object

Post by trueBlue » 25 Jan 2018, 18:19

Thanks for checking it out Stan!
Hope all is well with you. :D
What I am not sure of is if I am writing :bananatyping: the script RIGHT with regards to the Encapsulated_Objects.
If checked it is suppose to be using the Object's ObjMatrix
If unchecked it is suppose to be using the Object's WldMatrix
Not seeing any difference if it is checked or not.
stan wrote:
24 Jan 2018, 21:20
the original and the latest both work fine. encaps center is the first one glued offset by location is that why they seem weird?

you made your first object at 0,0,0 in the group so it landed on the target. If you encap at any place in the scene it adds the offset from 0,0,0 to the first object.so doesn't land on the target. If you do a normalize location it jumps to that location, not 0,0,0.
That's an awesome tS7 tip.

stan
Master Chief Petty Officer
Posts: 471
Joined: 21 May 2009, 17:20

Re: tS7.6 - Copy to Object

Post by stan » 25 Jan 2018, 21:06

encapnocheck.jpg
encapchecked.jpg
here you can see the cube,3 is set to target cube,6 in both cases in the encap
.LOCATION UNCHECKED
end result cube, 3 wldmatrix
unchecked
tx 22.087
ty 13.969
tz 2.000

checked
tx 10.557
ty 6.628
tz 1.000


cube, 6 objmatrix
tx -0.972
ty -0.714
tz -0.000
wldmatrix
tx 10.557
ty 6.628
tz 1.000
LOCATION CHECKED
cube, 3
both unchecked and checked
tx 22.411
ty 3.356
tz 3.000
I was not checking location on my first tests.

Maybe there should.be a test to see if at least one box is checked or do nothing. Like this
if((!Location )&& (!Rotation) && (!Scale)){System.Alert('hi');return;}

Node.Value(currentSelected, 'Matrix') = Tmatrix;

I see is that you are using TARGET when maybe you should be getting matrix of SOURCE.
TARGET would be object selected.That mixed me up when I first used it. Look at Simon's coolpowers. That might have mixed you up in the code.
Omatrix is the obj selected so you are feeding it's wldmatrix into it's matrix
Omatrix = Node.Value(currentSelected, 'WldMatrix')
Tmatrix.SetTransX(Omatrix.GetTransX());
Node.Value(currentSelected, 'Matrix') = Tmatrix;

this is how I think you wanted it, at least it goes to cube, 6 location when encap checked or does noting when not.:
but when I try to get it to target Object cube, 4 : if encap off it does nothing, encap on it goes to cube, 4.
Must have location checked or it moves without a return stop like I mentioned.
encapscript.JPG

stan
Master Chief Petty Officer
Posts: 471
Joined: 21 May 2009, 17:20

Re: tS7.6 - Copy to Object

Post by stan » 25 Jan 2018, 21:37

tried the cube outside of group with cube, 3.in group.
It doesn't go to the proper place because of the owner matrix.
obj panel has value of cube the orange one. Cube, 3 is above the obj panel. You would need to ungroup it first them reset the owner. to get that.
encaptocube.jpg

User avatar
trueBlue
Captain
Posts: 1551
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: tS7.6 - Copy to Object

Post by trueBlue » 25 Jan 2018, 23:46

Thanks again Stan!
Did some more testing again as I learn about tS7 Encapsulation.
I think(?) my script is working as expected. The Encapsulated Objects if checked is only useful inside one encapsulated object and not outside.
As a test I selected one of the Cubes inside the group as a Target and then transformed other cubes inside the group.

With Encapsulated Objects unchecked it did not move as expected.
Unchecked.PNG
With Encapsulated Objects checked it did.
Checked.PNG
UPDATE: Now it is not working as expected!!!
My head hurts!
I'll test your suggestions and see if that works better.

User avatar
trueBlue
Captain
Posts: 1551
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: tS7.6 - Copy to Object

Post by trueBlue » 26 Jan 2018, 03:57

Okay I think I got it!
I changed from WldMatrix to Matrix

Code: Select all

	// Target 
	Tmatrix = Node.Value(Target, 'Matrix')
	// Object
	Omatrix = Node.Value(currentSelected, 'Matrix')
Removed the EncapsulatedObjects switch.
Added an on load script that adds the Target if a 3D object is selected before loading the script.
One remaining issue with the on load script will create an error if an object within a group is selected before loading.
Errrrr!
Transform Objects.RsObj
(74.98 KiB) Downloaded 15 times

Post Reply