Workspace Copy

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

Workspace Copy

Post by trueBlue »

The Workspace Copy command:
Node.Copy('', '')
Only copies one object at a time and the copied object is hidden underneath the selected object in the Link Editor
:roll:

@Clinton
Looking at your Mirror Matrix scripts, It looks like you have a way to make a proper Copy script that can copy multiple selected items and rearrange the copies in the Link Editor
Any way you could make this into a single script?
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Workspace Copy

Post by clintonman »

I think so, but I just discovered that the con remove trick doesn't work for lights. They seem to have a bunch of LE2Data connectors.
Also doesn't work for command scripts, they have 4 LE2Data connectors.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Workspace Copy

Post by trueBlue »

Yep it does not work for Lights or Scripts unless they are encapsulated 2D or 3D
I'll look into the Lights and see if I can fix the multiple LE2Data connectors
This is how I discovered removing the LE2Data connector
I noticed that the unreleased Gear primitive had several LE2Data connectors
LE2Data, LE2Data, 1, LE2Data, 2, LE2Data, 3 etc..

Try this on a new jScript

Code: Select all

var sel = Node.Copy('', '');
Node.ConRemove(sel, 'LE2Data')
Node.ConRemove(sel, 'LE2Data')
Node.ConRemove(sel, 'LE2Data')
Node.ConRemove(sel, 'LE2Data')
Node.ConRemove(sel, 'LE2Data, 1')
Node.ConRemove(sel, 'LE2Data, 2')
Node.ConRemove(sel, 'LE2Data, 3')
Works for Lights too!
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Workspace Copy

Post by clintonman »

trueBlue wrote: 09 Dec 2020, 04:16 Yep it does not work for Lights or Scripts unless they are encapsulated 2D or 3D
I'll look into the Lights and see if I can fix the multiple LE2Data connectors
This is how I discovered removing the LE2Data connector
I noticed that the unreleased Gear primitive had several LE2Data connectors
LE2Data, LE2Data, 1, LE2Data, 2, LE2Data, 3 etc..

Try this on a new jScript

Code: Select all

var sel = Node.Copy('', '');
Node.ConRemove(sel, 'LE2Data')
Node.ConRemove(sel, 'LE2Data')
Node.ConRemove(sel, 'LE2Data')
Node.ConRemove(sel, 'LE2Data')
Node.ConRemove(sel, 'LE2Data, 1')
Node.ConRemove(sel, 'LE2Data, 2')
Node.ConRemove(sel, 'LE2Data, 3')
Works for Lights too!
It does work. My test shows that the LE2Data, 123 isn't needed.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Workspace Copy

Post by trueBlue »

Does not seem to hurt and as said I saw 'LE2Data, 123'
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Workspace Copy

Post by clintonman »

Here is what I came up with. enjoy.
Attachments
tB Copy Request.RsObj
(5.34 KiB) Downloaded 161 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Workspace Copy

Post by trueBlue »

Sweeeeet! :worship:
Almost perfect...
I selected several Lights, Cameras, and Scripts
Ran your script
Everything copied and rearranged except the Scripts did not rearrange
I added:

Code: Select all

Node.ConRemove(currentCopy, "LE2Data, 1");
Node.ConRemove(currentCopy, "LE2Data, 2");
Node.ConRemove(currentCopy, "LE2Data, 3");
Now the Scripts rearrange too!
Thank you! :D

Need to stop the error if it is ran with nothing selected
Invalid procedure call or argument Error code: 0x800a0005
Line: 17, Char: 2 Script text: var currentCopy = Node.Copy(currentNode, Node.Owner(currentNode));
I tried several different ways without success

A good object to test the above changes, use the GearObj.RsObj in the Objects - Script objects library
It has a hidden LE2Data, 3 con
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Workspace Copy

Post by clintonman »

Gear was a good sample.
In this case the "LE2Data, 2" wasn't really needed
I altered the code to add more plain vanilla "LE2Data con removes, added LE2Data123... with check for skipped value and added a try catch statement because the error is a tS bug that we can't fix. If you delete something tS still thinks it exists when you look for it in script.
Attachments
tB Copy Request.RsObj
(6.04 KiB) Downloaded 158 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Workspace Copy

Post by trueBlue »

YAY!!! :worship:
Perfect! :bananathumb:
Thank you so much! :D

I updated the Copy script in Commands
Updated all toolbars with the Copy icon
LMB runs Activity.Run('/Scripts/Commands/Copy')
RMB uses Node.Copy('', '')

Window.Shortcuts.xml
Workspace 3D Window & Link Editor Window
Ctrl + C
Activity.Run('/Scripts/Commands/Copy')
Post Reply