restart Softimage

Discussions concerning plugins for SOFTIMAGE©
missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

restart Softimage

Post by missingkey » 24 Jan 2014, 00:03

Hey All,

I was just been familiarizing myself with self-installing plugins, and just thought I'd share...

It's a restart softimage command... Hoooraayyyyyy!!! lmao

It adds a "Restart SI" command to the file menu, closes your current SI session (without saving), and opens a fresh SI App.

There is also a command "Save Kill Restart Reopen", which saves your current scene, kills SI, reopens SI, reopens your scene

and Another command to just open up another instance of the SI app.

As simple as it sounds, It's kinda nice having it. Enjoy!
Attachments
restartSI.png
restartSI.png (11.1 KiB) Viewed 3018 times
restartSI.zip
(1.2 KiB) Downloaded 147 times
Last edited by missingkey on 24 Jan 2014, 23:57, edited 10 times in total.

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: restart Softimage

Post by Hirazi Blue » 24 Jan 2014, 00:09

I am sure the "without saving" feature will make it a.veritable hit.
But seriously: thanks, might come in handy!
;)
Stay safe, sane & healthy!

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: restart Softimage

Post by missingkey » 24 Jan 2014, 00:30

Hey Thanks!

I just updated it to be linux friendly. It doesn't work in linux yet, but it's friendly. lol

btw, it's nothing pretty, it just kills the process. Use at your own risk.

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: restart Softimage

Post by missingkey » 24 Jan 2014, 01:14

okay it works in linux too now. I updated the linked file in the first post.

sorry for the confusion.
Last edited by missingkey on 24 Jan 2014, 18:16, edited 1 time in total.

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: restart Softimage

Post by Hirazi Blue » 24 Jan 2014, 10:50

You might want to explicitly clarify if the version in your first post has already been updated to the Linux one or not.
;)
Stay safe, sane & healthy!

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: restart Softimage

Post by missingkey » 24 Jan 2014, 20:47

Hi, Yeah, sorry for the confusion. I removed the file from my previous post, and updated the file linked in the first post.

I'm working on another option for saving the scene, killing SI, and reopening the scene.

It works well when I'm working on an existing scene. But I'm trying to throw in a condition that when the scene name is "Untitled", it does a "SaveSceneAs", then i'm trying to get the current project and scene after saving it, So that I can reopen them when SI relaunches, but it doesn't define the new variables correctly or maybe not quick enough, and SI just starts with an empty scene.

any ideas?

Code: Select all

def saveKillRestartSI_Execute(  ):
	si = Application
	log = si.LogMessage
	
	import os, sys
	import subprocess as sub
	from signal import SIGTERM
	
	pid = os.getpid()
	scene = str( si.ActiveProject.ActiveScene ) + ".scn"	
	project = str( si.ActiveProject )
	scenePath = project + "/" + scene
	
	def saveKillRestartSI():
	
		if sys.platform == "linux2":
			siPath = os.getenv( "XSI_BINDIR" ) + "/XSI.bin"	
			
		elif sys.platform == "win32":
			siPath = os.getenv( "XSI_BINDIR" ) + "/XSI.exe"				
		
		else:
			log( "Dude, what OS are you using?" )
			
		if scene == "Scene.scn":
			si.SaveSceneAs()
			scene2 = str( si.ActiveProject.ActiveScene ) + ".scn"	
			project2 = str( si.ActiveProject )
			scenePath2 = project2 + "/" + scene2
			sub.Popen( [ siPath, scenePath2 ] )
			os.kill( pid, SIGTERM )
			
		else:
			si.SaveSceneAs( scenePath )
			sub.Popen( [ siPath, scenePath ] )
			os.kill( pid, SIGTERM )
	
	saveKillRestartSI()

User avatar
myara
Posts: 403
Joined: 28 Sep 2011, 10:33

Re: restart Softimage

Post by myara » 30 Jan 2014, 07:02

It does open the saved scene here, but it doesn't kill my SI. I haven't installed Python in this PC, only using the SI default python so that may be the cause.

I see also that it doesn't use xsi.bat but xsi.exe so it doesn't run setenv.bat which may not be a good thing.

And btw, the File name isn't always the same as the scene name so you may want to get ActiveScene.FileName.value instead.
M.Yara
Character Modeler | Softimage Generalist (sort of)

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: restart Softimage

Post by missingkey » 30 Jan 2014, 08:54

Hey thanks, that's great feedback.

I'll have to look into why it doesnt work with just Si python. Seems strange.

I also didn't know about using xsi.bat instead of xsi.exe, or about the file name. Many thanks! This helps me a lot.

luceric
Posts: 1251
Joined: 22 Jun 2009, 00:08

Re: restart Softimage

Post by luceric » 30 Jan 2014, 12:52

you should call the Quit() command. if you kill Softimage, that's gonna be reported to autodesk as an unclean crash exit.

all you needed to do quit Softimage without saving was to call NewScene with the False parameter to not save the scene, before calling Quit()

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: restart Softimage

Post by missingkey » 30 Jan 2014, 16:22

Haha, That is much simpler, many thanks for the tip. I had a feeling there was a way to do within SI, and not have to use os.kill()

This is really helpful, thanks guys!

Is there a way so that when SI reopens, it doesn't ask to save the empty scene before loading your saved scene?

luceric
Posts: 1251
Joined: 22 Jun 2009, 00:08

Re: restart Softimage

Post by luceric » 30 Jan 2014, 16:32

It shouldn't be asking to save on an empty scene. Maybe a plug in dirties the scene. Anyway
running "Xsi.bat (name of the scene)" should load the scene directly.
Last edited by luceric on 30 Jan 2014, 19:53, edited 1 time in total.

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: restart Softimage

Post by Hirazi Blue » 30 Jan 2014, 17:00

Is there any easy way to figure out which plugin would cause this?
The described problem has been one of my "small annoying things" for years now...
~x(
Stay safe, sane & healthy!

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: restart Softimage

Post by missingkey » 30 Jan 2014, 17:22

so in the past. It hasn't done this (at least for me). If I never changed/dirtied a fresh new "untitled" scene, it would never ask me to save. But now, It almost seems like no matter what. SI asks if I want to save.

I'd love to figure this out, lol.

User avatar
csaez
Posts: 253
Joined: 09 Jul 2012, 15:31
Skype: csaezmargotta
Location: Sydney, Australia
Contact:

Re: restart Softimage

Post by csaez » 30 Jan 2014, 17:23

Hirazi Blue wrote:Is there any easy way to figure out which plugin would cause this?
The described problem has been one of my "small annoying things" for years now...
~x(
:)

Code: Select all

print [e.Name for e in Application.EventInfos if "Startup" in e.Type]

missingkey
Posts: 91
Joined: 19 Dec 2012, 18:16

Re: restart Softimage

Post by missingkey » 30 Jan 2014, 17:27

this is my output from the line of code above:

Code: Select all

#  [u'XSISeqCamStartup', u'OnStartupInitNetview', u'OneClickStartup', u'XSI_Startup', u'mi_decl_fixup_startup', u'RTShaderSetCategoriesEvent']
Not sure where to go from here. lol.

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: restart Softimage

Post by Hirazi Blue » 30 Jan 2014, 17:28

csaez wrote:

Code: Select all

print [e.Name for e in Application.EventInfos if "Startup" in e.Type]
But that would give you a list of Events at Startup, not necessarily the plugins that dirty the scene in the manner described above? Or am I missing something here?
Stay safe, sane & healthy!

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests