Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / JScript: SaveScene() inside OnClick problem
  RSS 2.0 ATOM  

JScript: SaveScene() inside OnClick problem
Rate this thread
 
30145
 
Permlink of this thread  
avatar
  • Total Posts: 1
  • Joined: 03 September 2008 01:59 AM

hi,

i’m using XSI 5.11 and can’t get around my problem.

i have a PPG with several buttons that do specific task. on one of the button, it does something like this:

function paPublishScene_OnClicked(){
SaveScene();
CaptureViewport( 2, 0 );
LogMessage( “Saved and Captured” );
}

somehow after XSI successfully captured the viewport, the script processing just stop! it won’t reach the 3rd line (the LogMessage part).

i applied the function to PPGLayout.logic through paPublishScene_OnClicked.toString()

somehow the SaveScene() is messed up with lines of code after it and it only happen if i applied it to OnClicked. running the script from script editor will do just fine.

is this a bug in XSI 5.11? is there a way to get around it? please help.

i tried with RegisterTimerEvent before but it won’t do any good. what i did is trigger the event before save, and shutdown the event afterward. it still the same, SaveScene() will causes ALL script processing stop after a bit of time (it does reach the CaptureViewport part but not the LogMessage part).

a bit more info: i am using Alienbrain 7.5.2.4592 for asset management.

any help is greatly appreciated. many thanks



Replies: 0
avatar

Hello,

I just included your code within a ‘OnClicked’ button event from a custom property, and it works fine. But I was using XSI7.0.

Anyway, is here the plugin file, so you can have a try:

// paPublishScenePlugin

function XSILoadPlugin(in_reg)
{
    in_reg
.Author "ChristopherC";
    
in_reg.Name "paPublishScenePlugin";
    
in_reg.Email "";
    
in_reg.URL "";
    
in_reg.Major 1;
    
in_reg.Minor 0;

    
in_reg.RegisterProperty("paPublishSceneProp");


    return 
true;
}


function paPublishSceneProp_DefineLayout(in_ctxt)
{
    
var layout in_ctxt.Source;
    
layout.Clear();

    var 
item layout.AddButton("save""save");


    return 
true;
}


function paPublishSceneProp_save_OnClicked()
{
    SaveScene
();
    
CaptureViewport(2false);
    
LogMessage("Saved and Captured");
}

And this is how to create the above property:

var prop Application.ActiveSceneRoot.AddProperty("paPublishSceneProp");
InspectObj(prop.FullName);

Hope it helps,
cheers.



Replies: 0