Results 1 to 12 of 12

Thread: Loading Scenes and Expressions with LScript

  1. #1
    Newbie Member
    Join Date
    Jun 2006
    Location
    Virginia
    Posts
    51

    Loading Scenes and Expressions with LScript

    I know you can load items from a scene using "LoadFromScene", but can you restrict what gets loaded from that scene? For instants I do not want the lights. Can anyone point me in the right direction? Also, is there a way to load an expression file with LScript (and assign them to the correct bone too)? Thanks for any help.

    Ross

  2. #2
    Newbie Member
    Join Date
    Jun 2006
    Location
    Virginia
    Posts
    51
    So, I'm guessin' the answer is "no".....

  3. #3
    mucho mojo nikfaulkner's Avatar
    Join Date
    Feb 2003
    Location
    brighton,uk
    Posts
    315
    i think its a "no" although there was some way to parse scene data (including expressions) into a scene with lscript. i found it on here somewhere a couple of years back.
    yeah alright.... we won a BAFTA http://littleloud.com/work/bsr/

  4. #4
    Newbie Member
    Join Date
    Jun 2006
    Location
    Virginia
    Posts
    51
    Thanks, I found some of what I need!

  5. #5
    LoadFromScene is a tricky one, it doesn't always behave in a script. There is another sibling, though:

    Code:
    @version 2.7
    @warnings
    
    generic
    {
        AutoConfirm(true);
        CommandInput("LoadElementsFromScene 4 E:\\myPath\\myScene.lws");
        AutoConfirm(false);
    }
    But for the longest time you couldn't actually suppress the user dialog where the user can actually choose things, which makes the entire method somewhat flawed. That's what the AutoConfirm is supposed to be for, not sure if this is still ignored in this context.

    The general safe method instead is to write the current scene to disk with "SaveSceneCopy", re-open it as file object, hack it, and load the full thing.

    But for expressions you don't really need that. Here is a little Master script example I found, can't remember where, that attaches an expression to the selected object. The critical parts are CreateExpression() and AttachExpression().

    Code:
    @version 2.2
    @warnings
    @script master
    @name Expression Test
    
    /*
    Hello,
    
    If you run attached script you may get that expression
    thing working... It's a master class script. Run it
    and press 'Add expression' button. Then expression
    would be created and attached to the Camera Position X
    envelope...
    
    regards
    Darren
    */
    
    
        script_name = "Expression Test";
    
        exp_name = "test";
        exp = "[Light.Position.X]/2";
        exp_exp;
        
        c0..10;
    
    create
    {
        setdesc(script_name);
    }
    
    destroy
    {
        if (reqisopen())
        {
            reqend();
        }
    }
    
    flags
    {
        return(SCENE);
    }
    
    process: event, command
    {
    }
    
    load: what,io
    {
        if(what == SCENEMODE)   // processing an ASCII scene file
        {
        }
    }
    
    save: what,io
    {
        if(what == SCENEMODE)
        {
        }
    }
    
    options
    {
        reqbegin(script_name);
    
        c2 = ctlbutton("Add Expression",130,"add_exp");
        reqopen();
    }
    
    add_exp
    {
        com = string("GE_CreateExpression ",exp_name," ",exp);
        CommandInput(com);
    
        com = string("GE_AttachExpression ","Camera.Position.X"," ",exp_name);
        CommandInput(com);
    }

  6. #6
    Super Member dblincoe's Avatar
    Join Date
    Aug 2004
    Location
    Springfield, Missouri
    Posts
    816
    You do know you can exclude the lights and the camera when using "load from scene". If the check mark besides it is greyed out it won't import, if it is highlighted then it will. You can select any object, light or camera.

    Of course, you may be after another way. I just thought I'd make sure you knew that so you were't chasing something you already had.

  7. #7
    Yes, of course. I was strictly talking about automating this Load From Scene selection process in the context of a larger script. If the script is a batch process or does additional setup steps with the loaded items, it may be necessary to bypass user interaction.

    It gets a hell of a confusing when an "AutoSetup Insanely Awesome Character Rig" script comes with instructions to "Please set a checkmark for all Bone Items on the LoadFromScene dialog that pops up half-way through the setup process, and make sure to uncheck the Camera otherwise this script may overwrite your current Camera animation."
    Last edited by Blochi; 08-07-2011 at 02:44 PM.

  8. #8
    Super Member dblincoe's Avatar
    Join Date
    Aug 2004
    Location
    Springfield, Missouri
    Posts
    816
    Quote Originally Posted by Blochi View Post
    Yes, of course. I was strictly talking about automating this Load From Scene selection process in the context of a larger script. If the script is a batch process or does additional setup steps with the loaded items, it may be necessary to bypass user interaction.

    It gets a hell of a confusing when an "AutoSetup Insanely Awesome Character Rig" script comes with instructions to "Please set a checkmark for all Bone Items on the LoadFromScene dialog that pops up half-way through the setup process, and make sure to uncheck the Camera otherwise this script may overwrite your current Camera animation."
    Gotcha.

  9. #9
    Worms no more! Free fun! Dodgy's Avatar
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    8,273
    You could go through the lights before load from scene and see how many there are, then laod from scene and clear out any extra lights....
    Push the software, don't let it push YOU!
    My own plugins and work:www.mikegreen.name
    LaptopSetup:corei7 2.4GHz nvidia GT 650M 8Gig win8 64
    WorkSetup:core i7 3.4Ghz nvidia Quadro 2000 12Gig Ram Win7

  10. #10
    Newbie Member
    Join Date
    Jun 2006
    Location
    Virginia
    Posts
    51
    Thanks for the info everyone...

  11. #11
    Newbie Member
    Join Date
    Jun 2006
    Location
    Virginia
    Posts
    51
    Is there a way to make LoadFromScene import the Master Plugins by default? So, I can still use AutoConfirm(false) and I will get ther master plugins.

    Thanks,
    Ross

  12. #12
    Super Member dblincoe's Avatar
    Join Date
    Aug 2004
    Location
    Springfield, Missouri
    Posts
    816
    Regarding the lights...I've also renamed the original scene lights something like "delete me" or "kill" then in the new scene used the object filter to search for that prefix on the lights and deleted them.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •