|
|
Copy & paste command for Modeler
About Truespace Archives
These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.
They are retained here for archive purposes only.
Copy & paste command for Modeler // Roundtable
Post by Emmanuel // Jul 27, 2007, 5:05am
|
Emmanuel
Total Posts: 439
|
I wish I could add a copy/paste command in my Modeler's toolbar.
The goal is to copy an object in one clic, and paste it in the same scene, or in an other scene or even an other session of trueSpace.
I think it should behave like the vcCopy&Paste plugin described on Moonman's page (http://www.lunadude.com/tS/tS-3dplugs.htm)... unfortunately it looks like that cool plugin is not available anymore :(
Basically, one clic on the Copy button should save the object or selection onto disk, as a file (let's call it copypaste.cob for example) ;
and one clic on the Paste button would bring it back at the same xyz location (it would simply load the copypaste.cob file).
What do you think ? |
Post by W!ZARD // Jul 27, 2007, 5:13am
|
W!ZARD
Total Posts: 2603
|
Isn't there already a copy icon in modeller? I seem to recall there is one but I never use it - the hotkey CNTRL C is what I use to copy an object or part thereof. And if I want to paste it some where else or to another scene I have a "Temp" library set up which I use for models still in the WIP stage and other library's for completed models.
I favour workspaces that are resonable clutter-free so I tend to use hotkeys for a lot of things.
I don't suppose this is much help for you but you did ask what we think! |
Post by Emmanuel // Jul 27, 2007, 7:18am
|
Emmanuel
Total Posts: 439
|
Yes, this is how I have been working for years : one "temp.cob" file on the desktop that stores files for temporary copy/paste purposes.
But the custom menu toolbar in Modeler is so cool ; I really would enjoy more 1-clic features in it :)
BTW, I could re-use one of the Recent-file node to create the Paste action. Problem is how to create the Copy one...
Any idea, someone ? |
Post by Emmanuel // Aug 10, 2007, 1:44am
|
Emmanuel
Total Posts: 439
|
Okay, it seems we can't create that copy/paste command via the file menu...
So, I am thinking of a modeler icon (tsX) :
- one left-clic on icon to save object or selection to file
- one right-clic to reload
This looks simple, so I am giving a try at tsX development :)
I downloaded tS6.6 SDK and grabbed Ken's Visual C++ tutorial from webarchive (former location was tylman.net). That tutorial was very easy to follow for a non-programmer like me and the 'step4' example runs fine in tS7.51.
I have put together the html pages from webarchive to create a pdf file. You can get it here (http://emmanuel.asset.free.fr/downloads/HOW_TO_CREATE_A_TSX.pdf).
So, now I have to place the right selection and save commands from SDK in the left-clic part of the plugin code, and a load command in the right-clic area.
Here they are :
// this function will be called when the tSX button is left-clicked
int tsxOnLeftClick()
{
// Put at beginning of exported functions if using MFC,
// or your plugin is likely to crash
AFX_MANAGE_STATE(AfxGetStaticModuleState());
tsxSOBJ* tsxGetCurrentSelection();
tsxBOOL tsxObjectSaveAs(tsxSOBJ* pSobj, char* name);
// nothing functional here now
return tsxPLUG_DONE;
}
and
// this function will be called when the tSx button is right-clicked
void tsxOnRightClick()
{
// Put at beginning of exported functions if using MFC,
// or your plugin is likely to crash
AFX_MANAGE_STATE(AfxGetStaticModuleState());
tsxSOBJ *tsxObjectLoad(char* name);
// nothing functional here now
}
Of course, a clic on the compiled tsX does nothing :rolleyes: ; I guess I have to set a file name for saved object. But what is the right syntax ?
Any idea ? |
Post by stan // Aug 10, 2007, 4:49am
|
stan
Total Posts: 1240
|
seem to be heading in right direction
AFX_MANAGE_STATE(AfxGetStaticModuleState());
tsxSOBJ* tsxGetCurrentSelection();
tsxBOOL tsxObjectSaveAs(tsxSOBJ* pSobj, char* name);
would be something like
tsxSOBJ* pObj = tsxGetCurrentSelection() ;
if ( pObj == NULL )
{
return FALSE ;
char* name = 'copyme' //bot sure on this
tsxObjectSaveAs(pObj, name);
haven't used c++ in a few month..a bit rusty |
Post by trueBlue // Aug 10, 2007, 4:54am
|
trueBlue
Total Posts: 1761
|
This is simular to the Unencapsulate script for Workspace I was fooling around with. I tried to use the tS7 Model's commands to create this. But I could not get past the save dialog to make it work. i.e. I did not want to use the save dialog. I have never tried to make a tsx.
This is want I think needs to be done if this helps.
LMB - 1.) Save the selected object to a defined area. i.e. Somewhere in the tS7 directory as a temp.cob.
RMB - 2.) Load the above temp.cob. |
Post by Emmanuel // Aug 10, 2007, 6:12am
|
Emmanuel
Total Posts: 439
|
Thank you guys !
Correct spelling was
char* name = "copypaste.cob";
However... it works :jumpy:
It does not save multiple selection though : only current object. I don't know if it can be bypassed.
Also, when I copy lights and camera, tS freezes for a few seconds. It doesn't occur with objects.
Please download and test :) |
Post by trueBlue // Aug 10, 2007, 6:29am
|
trueBlue
Total Posts: 1761
|
It will not load Emmanuel. I copied your tsx to the tsx folder and tried to load your plug in from tS7.5.1 Model. |
Post by stan // Aug 10, 2007, 7:04am
|
stan
Total Posts: 1240
|
I got the same result..must be a missing .dll which version of c++ are you using? |
Post by Emmanuel // Aug 10, 2007, 9:44am
|
Emmanuel
Total Posts: 439
|
You are right : I just tried to load the tsx on an other computer and I get that error message.
I am using C++ version 6. How can I identify the missing dll ? |
Post by stan // Aug 10, 2007, 12:45pm
|
stan
Total Posts: 1240
|
I don't know exactly which ones are needed for version 6..proffesorlaos had that same issue awhile back with a shader he made. so he sent me the c++ project and I compiled it in version 7. that I know what dll's are used and people had no problem getting them..I can do that for you too id you want..:) |
Post by frootee // Aug 13, 2007, 4:30am
|
frootee
Total Posts: 2667
|
You could also download Visual Studio Express from Microsoft. You can select a free version of the Visual C++ compiler. It is newer than VC++ 6, and most likely has the updated dll's you need.
The link is:
http://msdn.microsoft.com/express
Froo |
|