Excluding objects from being saved with the scene?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  02 February 2013
Excluding objects from being saved with the scene?

Hi,

I've made a script for animating bouncing objects - it creates a couple of controller objects (arrow-shaped splines) so that the user can mark maximum height and end position. The controller objects get destroyed when the user closes the script's UI.

However, if the user saves the scene whilst the script UI is open, these controller objects get saved in the scene - is there any way I can set these objects to be excluded from the save?


Thanks in advance,


Dave
 
  02 February 2013
Originally Posted by quetzlcoatl: Hi,

I've made a script for animating bouncing objects - it creates a couple of controller objects (arrow-shaped splines) so that the user can mark maximum height and end position. The controller objects get destroyed when the user closes the script's UI.

However, if the user saves the scene whilst the script UI is open, these controller objects get saved in the scene - is there any way I can set these objects to be excluded from the save?


Thanks in advance,


Dave



create a command in your script that deletes all the controllers and saves the scene.
 
  02 February 2013
Hi, thanks for replying.

The script is used by a team of 12 or so guys who are all very used to using ctrl-s to save, so I can't just add a special "Save" button to the script's UI and expect them to use it!
I tried setting up a scriptJob that runs a "delete controller objects" procedure on the writingFile event, but it didn't seem to trigger until after the file was saved - unless I'm missing something?
 
  02 February 2013
And you can let the script call undo after svaing to restore the controllers.
 
  02 February 2013
When your UI starts up, create a scriptJob attached to the 'SceneSaved' event and parented to your UI:

scriptJob -event "SceneSaved" "myFunction()" -parent "myWindow";


Obviously, 'myWindow' is your UI window and 'myFunction()' should be a global procedure that performs the following steps:

1) gathers objects for deletion (storing names and relevant attributes)

2) deletes these objects gathered in 1)

3) saves the scene

4) recreates the objects deleted in 2) with the information from 1)


Since the scriptJob will trigger right after a 'Save' has been manually performed by the user, it is safe to save the scene again via script.
All the function does is ensure your script objects are not part of the saved scene on disk.


Alternatively, you could have your script create a scriptNode when it is run. That scriptNode will also be saved with the scene. Make the scriptNode execute its payload on 'file: open', said payload being a script taht deletes unwanted objects and itself.
When the user next opens the scene (that he saved with your scripted objects), the scriptNode will quickly delete those objects before deleting itself.

The latter approach might be preferrable in case the user is operating on a large file that takes a significant time to save to disk, but it does add the the problem you were facing in the first place: what if the user closes the file without saving (and thus not saving the scriptNode you just created).
 
  02 February 2013
Originally Posted by quetzlcoatl: Hi, thanks for replying.

The script is used by a team of 12 or so guys who are all very used to using ctrl-s to save, so I can't just add a special "Save" button to the script's UI and expect them to use it!

I tried setting up a scriptJob that runs a "delete controller objects" procedure on the writingFile event, but it didn't seem to trigger until after the file was saved - unless I'm missing something?


Yes, you can save using the Ctrl+s, however, you stated your problem when using maya's saving as quoted below:

Originally Posted by quetzlcoatl: However, if the user saves the scene whilst the script UI is open, these controller objects get saved in the scene - is there any way I can set these objects to be excluded from the save?


That is why you need a procedure in your script that delete the controllers you wanted and then save the scene in one click.

Or if you need the backup of the scene that has the controllers you should also include in your script to save the scene as different name for the backup.

There are so many ways to deal with this problem of yours, when you implement a script into the pipeline, the artists should go along the process of the pipeline above the ones that they are used to do.
 
  02 February 2013
Originally Posted by Nyro: When your UI starts up, create a scriptJob attached to the 'SceneSaved' event and parented to your UI:


This doesn't seem to work in maya 2012, and it could be a while before we all move onto 2013 so I reckon I'll go with your other suggestion - a scriptNode that deletes the controllers when the files opened.

Thanks for your help everyone : )
 
  02 February 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:34 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.