Difference between revisions of "Scene Query.cpp"

From The Foundry MODO SDK wiki
Jump to: navigation, search
(Created page with "Scene_Query.cpp is a basic example plugin. This wiki page is intended as a walkthrough of the code in order to help you better understand the SDK. __TOC__ ==Functionality== ...")
 
Line 8: Line 8:
  
 
==Code Walkthrough==
 
==Code Walkthrough==
 +
 +
#define ARGi_FILEPATH  0       
 +
using namespace std;
 +
const int MAXFILELENGTH = 1000;
 +
char FILEPATH[MAXFILELENGTH];
 +
 +
Here we define an argument of the form ARGi_FILEPATH to have the index value of 0. So when 0 is being passed as an argument to functions later on, it is really referring to this variable. We also define a const int that forms the upper limit for the number of characters in the file path that we will be retrieving and the character array that will hold that file path.
 +
 +
Select_Scene class declaration
 +
{| {{Dotted box}}
 +
| class Select_Scene : public CLxBasicCommand    //Select_Scene will open a file dialog and load the chosen scene
 +
{
 +
    public:
 +
        Select_Scene();
 +
        int basic_CmdFlags()        LXx_OVERRIDE;
 +
   
 +
        bool basic_Enable (CLxUser_Message &msg) LXx_OVERRIDE;
 +
   
 +
        void cmd_Interact() LXx_OVERRIDE;
 +
   
 +
        void cmd_Execute(unsigned int flags);
 +
};
 +
||}
 +
 +
Here, Clear_Button is declared as a basic command(http://sdk.luxology.com/wiki/Command:_Server_basics#Helper_Classes) with most of the basic methods associated with it. We are inheriting from basic commands because we want this plugin to perform state changes on modo.

Revision as of 00:07, 6 September 2013

Scene_Query.cpp is a basic example plugin. This wiki page is intended as a walkthrough of the code in order to help you better understand the SDK.

Functionality

When installed, Scene_Query adds two plugins to modo:ResetScene and HardReset. ResetScene opens a file dialog from which you will choose a file; the current scene will then be closed and the chosen file loaded. HardReset will close the current scene then take the last selected file and load it. To change the file HardReset loads, run ResetScene and choose a different file.

Code Walkthrough

#define ARGi_FILEPATH   0         
using namespace std;
const int MAXFILELENGTH = 1000;
char FILEPATH[MAXFILELENGTH]; 

Here we define an argument of the form ARGi_FILEPATH to have the index value of 0. So when 0 is being passed as an argument to functions later on, it is really referring to this variable. We also define a const int that forms the upper limit for the number of characters in the file path that we will be retrieving and the character array that will hold that file path.

Select_Scene class declaration

class Select_Scene : public CLxBasicCommand //Select_Scene will open a file dialog and load the chosen scene

{

   public:
       Select_Scene();
       int basic_CmdFlags()         LXx_OVERRIDE;
   
       bool basic_Enable	(CLxUser_Message &msg) LXx_OVERRIDE;
   
       void cmd_Interact() LXx_OVERRIDE;
   
       void cmd_Execute(unsigned int flags);

};

}

Here, Clear_Button is declared as a basic command(http://sdk.luxology.com/wiki/Command:_Server_basics#Helper_Classes) with most of the basic methods associated with it. We are inheriting from basic commands because we want this plugin to perform state changes on modo.