# Application Class Reference

Related Scripting Object: Application

The Application object represents the running instance of the Softimage application and it is the top most entity of the C++ API object hierarchy. Application contains properties that return other Softimage objects such as the active scene root. More...

`#include <xsi_application.h>`

Inheritance diagram for Application:

List of all members.

## Public Member Functions
| Application ()
| ~Application ()
| Application (const CRef &in_ref)
| Application (const Application &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
Application & | operator= (const Application &in_obj)
Application & | operator= (const CRef &in_ref)
Selection | GetSelection () const
CRefArray | GetFCurveSelection () const
Dictionary | GetDictionary () const
Project | GetActiveProject () const
CStatus | PutActiveProject (const CString &in_Project) const
Model | GetActiveSceneRoot () const
CString | GetInstallationPath (siInstallationPath in_pathType) const
CString | GetVersion () const
CString | GetLicense () const
CStatus | InstallAddon (const CString &in_strFileName, siInstallationPath in_eInstallDir, bool in_bNoUI=false)
CStatus | UnInstallAddon (const CString &in_strFileName)
Command | CreateCommand (const CString &in_CommandName, siCommandCategory in_category=siNoCategory)
CStatus | AddCommand (const CRef &in_Cmd)
CStatus | RemoveCommand (const CString &name)
CommandArray | GetCommands () const
Command | GetCommandByScriptingName (const CString &scriptingName) const
CStatus | ExecuteCommand (const CString &in_name, CValueArray &in_args, CValue &io_val) const
CStatus | ExecuteCommand (const CString &in_name, const CValueArray &in_args, CValue &io_val) const
CScriptErrorDescriptor | ExecuteScriptCode (const CString &in_ScriptCode, const CString &in_ScriptLanguage)
CScriptErrorDescriptor | ExecuteScriptProcedure (const CString &in_ScriptCode, const CString &in_ScriptLanguage, const CString &in_ScriptProcedure, CValueArray &in_args, CValue &out_returnval)
CRefArray | GetEventInfos () const
CStatus | LogMessage (const CString &in_Message, siSeverityType in_Sev=siInfoMsg) const
CStatus | CreateProject (const CString &in_ProjectPath, Project &out_rProject) const
Preferences | GetPreferences () const
Desktop | GetDesktop () const
Factory | GetFactory () const
CString | GetActiveToolName () const
UIToolkit | GetUIToolkit () const
CRefArray | GetFilters () const
CRefArray | GetPlugins () const
bool | IsInteractive () const
Plugin | LoadPlugin (const CString &in_pluginPath)
CStatus | UnloadPlugin (const CString &in_pluginPath, bool in_bRemove)
CStatus | UpdatePlugins ()
CStatus | AddWorkgroup (const CString &in_workgroupPath)
CStatus | RemoveWorkgroup (const CString &in_workgroupPath)
CStringArray | GetWorkgroups ()
CStatus | RescanWorkgroups ()
CStatus | ActivateWorkgroup (const CString &in_workgroupPath, bool in_bActivate)
CRefArray | GetRenderers ()
ProjectItem | GetObjectFromID (ULONG in_nID) const

## Detailed Description

The Application object represents the running instance of the Softimage application and it is the top most entity of the C++ API object hierarchy. Application contains properties that return other Softimage objects such as the active scene root.

See also:
  Custom UI Test

Unlike most other C++ API objects, it is not necessary to intialize this object based on a CRef(), as soon as you create this object is it ready for use, as shown in the example below.

Example:
  Using the Application class

              using namespace XSI;
              Application app;
              Model root = app.GetActiveSceneRoot();

              CameraRig myCamRig;
              root.AddCameraRig( L"Camera", L"", myCamRig );

              Camera myCam(myCamRig.GetCamera());
              X3DObject myCamInterest(myCam.GetInterest());

              CString strCamName( myCam.GetName() );
              app.LogMessage( L"Camera interest" );
              app.LogMessage( strCamName + L".interest.name: " + myCam.GetInterest().GetName() );

              app.LogMessage( strCamName + L"'s near parameter: " + myCam.GetParameterValue(CString(L"near")).GetAsText() );
              app.LogMessage( strCamName + L"'s far parameter: " +  myCam.GetParameterValue(CString(L"far")).GetAsText() );
              app.LogMessage( strCamName + L"'s orthoheight parameter: " + myCam.GetParameterValue(CString(L"orthoheight")).GetAsText() );
              app.LogMessage( strCamName + L"'s fov parameter: " + myCam.GetParameterValue(CString(L"fov")).GetAsText() );

## Constructor & Destructor Documentation

Application | ( |  | ) |

Default constructor.

~Application | ( |  | ) | `[inline]`

Default destructor.

Application | ( | const CRef & | in_ref | ) |

Constructor. It is not normally necessary to use this version of the constructor, because the default constructor also produces an initialized Application object.

Parameters:

  | in_ref | constant reference object.

Application | ( | const Application & | in_obj | ) |

Copy constructor.

Parameters:

  | in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const`[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  | in_ClassID | class type.

Returns:
  True if the class is compatible, false otherwise.

Reimplemented from SIObject.

siClassID GetClassID | ( |  | ) | const`[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from SIObject.

Application& operator= | ( | const Application & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  | in_obj | constant class object.

Returns:
  The new Application object.

Application& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  | in_ref | constant class object.

Returns:
  The New Application object.

Reimplemented from SIObject.

Selection GetSelection | ( |  | ) | const

Returns the Selection object holding the selected objects represented as CRef objects.

Returns:
  Selection object.

CRefArray GetFCurveSelection | ( |  | ) | const

Returns a list of FCurve objects with selected keys represented as CRef objects.

Returns:
  Array of references to FCurve objects.

Since:
  6.0

Dictionary GetDictionary | ( |  | ) | const

Not-implemented.

Note:
  CRef::Set is the C++ API equivalent of the Dictionary::GetObject method.

Project GetActiveProject | ( |  | ) | const

Returns the active Project.

Returns:
  The active project.

CStatus PutActiveProject | ( | const CString & | in_Project | ) | const

Sets the active Project.

Parameters:

  | in_Project | The path of the project to set.

Since:
  5.0

Returns:
  CStatus::OK Success.

  CStatus::Fail Failure.

Model GetActiveSceneRoot | ( |  | ) | const

Returns the root model of the active scene of the active project.

Returns:
  The active scene model.

CString GetInstallationPath | ( | siInstallationPath | in_pathType | ) | const

Returns an installation path. The returned paths end with a slash character.

Parameters:

  | in_pathType | Installation path type (one of the siInstallationPath values).

Returns:
  The installation path.

Since:
  4.0

CString GetVersion | ( |  | ) | const

Returns the version number of the application (eg, `6.5.170.QFE1` or `XSI_Pioneer_Beta1.234-4.0`). As of v7.0, the format of the version information is:
`{ReleaseNumber}`.{BuildNumber}.{UpdateNumber}
...where the chunks represent this information:

- `{ReleaseNumber}` which can contain alphanumeric characters, as well as decimal points (``.)
  For released products, this contains `Major.Minor` designation (eg., `6.5`).
  For pre-release versions, this may be the `CodeNameMileStone` (eg., `XSI_Pioneer_Beta1`).
- `{BuildNumber}` which can also contain alphanumeric characters, but cannot contain decimal points (eg., `234` or `234-4`).
- `{UpdateNumber}` which can also contain alphanumeric characters, but cannot contain decimal points (eg., `1` or `QFE1`).

Prior to v7.0, the format of the version information is: `Major.Minor.YYYY.MMDD` (eg., `6.02.2007.0605`).

Returns:
  The version number.

Since:
  4.0

CString GetLicense | ( |  | ) | const

Returns the type of license used.

Returns:
  Advanced

  Essential

  Foundation

  Experience

Since:
  4.0

CStatus InstallAddon | ( | const CString & | in_strFileName,
|  | siInstallationPath | in_eInstallDir,
|  | bool | in_bNoUI = `false` |
| ) |  |  |

Installs an .xsiaddon file in Softimage. An add-on file is a set of customized items (like layout, toolbar, preset, etc.) that are packaged in a single file.

Parameters:

  | in_strFileName | File path of the add-on file to install.
  | in_eInstallDir | Destination directory, where the add-on is installed. siUserAddonPath and siWorkgroupAddonPath are the recommended values. If siUnknownPath is specified then the add-on will be installed at the default location specified inside the add-on file. Note: In the case of multiple workgroups, this always installs to the first workgroup in the list.
  | in_bNoUI | Use this optional parameter to avoid displaying the warning message boxes that are shown during the installation of certain addons.

Returns:
  CStatus::Ok Success

  CStatus::Fail Installation failure

Since:
  7.5

CStatus UnInstallAddon | ( | const CString & | in_strFileName | ) |

Uninstalls an .xsiaddon file from Softimage. This deletes all items that were previously installed by the specified add-on file.

Parameters:

  | in_strFileName | File path of the add-on file to uninstall.

Returns:
  CStatus::Ok Success

  CStatus::Fail Installation failure

Since:
  7.5

Command CreateCommand | ( | const CString & | in_CommandName,
|  | siCommandCategory | in_category = `siNoCategory` |
| ) |  |  |

Creates a new command. The details of the new command are defined by calling the functions on the returned Command object. Once completely defined the command is installed by passing the command object back to Softimage with a call to Application::AddCommand. If a command already exists by that name then this command will fail.

Note:
  Rather than calling this function, it is recommended that custom commands be defined as part of a self-installed plug-in. See PluginRegistrar::RegisterCommand.

Parameters:

  | in_CommandName | The unique name identifying the new command. Note that the command is not created if one with this name already exists.
  | in_category | Where (on which Softimage standard menu) the command will appear in the user interface. For more information, see the siCommandCategory enum documentation.

Returns:
  The newly created Command.

CStatus AddCommand | ( | const CRef & | in_Cmd | ) |

Installs a new Command into the system. This function is called after Application::CreateCommand.

Note:
  Rather than calling this function, it is recommended that custom commands be defined as part of a self-installed plug-in. See PluginRegistrar::RegisterCommand.

Parameters:

  | in_Cmd | Command object containing the definition of the new command

Returns:
  CStatus::OK Success.

  CStatus::Fail Failure.

See also:
  Application::CreateCommand

Since:
  4.0

CStatus RemoveCommand | ( | const CString & | name | ) |

Removes a command. This is only called for Custom Commands.

To remove a custom command that is defined as part of a self-installed plug-in remove the script file or dll rather than calling this function. Similarly, this function cannot be used to remove custom commands that are installed as part of an add-on.

Parameters:

  | name | Name of the Command, not the scripting name of the command. For example `Select` `Object` instead of `SelectObj`

Returns:
  CStatus::OK Success.

  CStatus::Fail Failure.

CommandArray GetCommands | ( |  | ) | const

Returns the CommandArray object representing all the installed commands.

Returns:
  Array of Command objects

Command GetCommandByScriptingName | ( | const CString & | scriptingName | ) | const

Returns a command by its scripting name. To return a command by its name use Application::GetCommands and CommandArray::GetItem instead.

Parameters:

  | scriptingName | The scripting name of the command you want to find.

Returns:
  The matching command

See also:
  Command::ScriptingName

Since:
  5.0

CStatus ExecuteCommand | ( | const CString & | in_name,
|  | CValueArray & | in_args,
|  | CValue & | io_val |
| ) |  |  | const

Executes a specified command identified by its scripting name.

Parameters:

  | in_name | Command scripting name.
  | in_args | Array of values containing the arguments to pass to the command. If the command is defined with output arguments, the array is updated with the new argument values returned by the command.
  | io_val | The value returned by the command.

Note:
  If the command has no return value explicitly defined, ExecuteCommand returns all output arguments in a CValueArray object. However, if the command defines a return value, you cannot extract any output arguments from it. This is because the command is not returning an output argument array, but a specific value. You can check the Return Value section in the C# and Scripting Reference to see whether it uses an explicit return value and what that value is.

Returns:
  CStatus::OK Success

  CStatus::Fail Failure

Since:
  3.5

Example:
  Adds a custom property to a sphere and extract the newly created property from the output argument returned by the AddProp command.

            using namespace XSI;

            CValueArray args(3);

            args[0] = CValue(L"Sphere");
            args[1] = CValue(L"MeshSurface");
            args[2] = CValue(L"MySphere");

            Application app;
            CValue valSphere;
            app.ExecuteCommand( L"CreatePrim", args, valSphere );

            args.Resize(5);
            args[0] = L"Annotation";
            args[1] = valSphere;
            args[2] = CValue(); // use default
            args[3] = L"MyAnnotation";
            args[4] = CValue(); // newly created property is returned as output arg

            app.ExecuteCommand( L"AddProp", args, outArg );

            // AddProp return the new property in a CValueArray object stored in the
            // 5th argument.
            CValueArray propArray(args[4]);

            // the property is stored in the first element of the array
            Property prop(propArray[0]);
            app.LogMessage( L"Property name: " + prop.GetFullName() );

            // create a model an get the newly created model from the ouptut argument
            args.Resize(4);
            args[0] = valSphere;
            args[1] = L"MyModel";
            args[2] = CValue(); // optional parent
            args[3] = CValue(); // newly created model

            CValue retVal;
            app.ExecuteCommand( L"SICreateModel", args, retVal );

            Model myModel(args[3]);
            app.LogMessage( L"Model name: " + myModel.GetFullName() );

CStatus ExecuteCommand | ( | const CString & | in_name,
|  | const CValueArray & | in_args,
|  | CValue & | io_val |
| ) |  |  | const

Executes a command.

Note:
  If the command has no return value explicitly defined, ExecuteCommand returns all output arguments in a CValueArray object. However, if the command defines a return value, you cannot extract any output arguments from it. This is because the command is not returning an output argument array, but a specific value. You can check the Return Value section in the C# and Scripting Reference to see whether it uses an explicit return value and what that value is.

Deprecated:
  3.5 This version is kept for backward compatibility, please use the new version instead.
  Parameters:

    | in_name | Command scripting name.
    | in_args | Array of values containing the arguments to pass to the command. Because this argument is defined as const, the array cannot be updated with the output argument values returned by the command. You should use the other version of ExecuteCommand defined with a CValueArray& argument if you need to access the output argument values.
    | io_val | The value returned by the command.

  Returns:
    CStatus::OK success

    CStatus::Fail failure

CScriptErrorDescriptor ExecuteScriptCode | ( | const CString & | in_ScriptCode,
|  | const CString & | in_ScriptLanguage |
| ) |  |  |

Executes a string of script code. This is a convenient way to execute script code directly from C++. For example, you may want to execute some code that is easy to implement in scripting, but hard to implement in C++. Another possible usage is in the context of a CustomDisplayHost-based script editor.

This function is best suited for small scripts or dynamically generated code. For larger scripts, you may want to consider exposing the script as a custom Command.

Parameters:

  | in_ScriptCode | A string of script code to execute.
  | in_ScriptLanguage | Scripting language (for example, `VBScript`, `JScript`, or `Python`).

Returns:
  CScriptErrorDescriptor object. If there was a script error this will be set to a failure status code and contain additional error details.

See also:
  Command, CComAPIHandler, Application::ExecuteCommand

Since:
  5.0

Example:
  ExecuteScriptCode and ExecuteScriptProcedure demo

          // Basic usage just executes the text directly
          app.ExecuteScriptCode(L"Logmessage \"Hello from VBScript\"", L"VBScript" ) ;

          // For more advanced usage it is possible to pass values and get a return value
          // by calling a procedure inside the script text

          CScriptErrorDescriptor status ;
          CValueArray fooArgs(1) ;
          fooArgs[0] = L"Argument Sent to Script" ;
          CValue retVal ;

          status = app.ExecuteScriptProcedure(
                      L"function foo( x ) \n Logmessage x \n foo = 45 \n end function",
                      L"VBScript",
                      L"foo",
                      fooArgs,
                      retVal  ) ;

          // Catch an intentional script error

          status = app.ExecuteScriptProcedure(
                  L"sub foo( x ) \n run time error! \n foo = 45 \n end sub",
                  L"VBScript",
                  L"foo",
                  fooArgs,
                  retVal ) ;

          // Show the error
          app.LogMessage( status.GetDescription() + CString( L" - " ) + CValue( status.GetErrorLineNumber() ).GetAsText() ) ;

CScriptErrorDescriptor ExecuteScriptProcedure | ( | const CString & | in_ScriptCode,
|  | const CString & | in_ScriptLanguage,
|  | const CString & | in_ScriptProcedure,
|  | CValueArray & | in_args,
|  | CValue & | out_returnval |
| ) |  |  |

This is an alternative to Application::ExecuteScriptCode which supports execution of a procedure inside script code. By calling a procedure it is possible to pass arguments into the script code and get a return value back.

Parameters:

  | in_ScriptCode | A string of script code to execute.
  | in_ScriptLanguage | Scripting language (for example, "VBScript", "JScript", or "Python").
  | in_ScriptProcedure | Optional. Name of a procedure in the script code that you want to call.
  | in_args | Optional. An array of arguments to pass to the procedure. Ignored if `in_ScriptProcedure` is not specified.

Return values:

  | out_returnval | Optional. Return value from the procedure. Ignored if `in_ScriptProcedure` is not specified.

Returns:
  CScriptErrorDescriptor object. If there was a script error this will be set to a failure status code and contain additional error details.

See also:
  Application:ExecuteScriptCode

Since:
  5.0

CRefArray GetEventInfos | ( |  | ) | const

Returns all events currently defined in Softimage.

Returns:
  CRefArray An array of EventInfo objects.

Since:
  5.0

CStatus LogMessage | ( | const CString & | in_Message,
|  | siSeverityType | in_Sev = `siInfoMsg` |
| ) |  |  | const

Sends a message to the history logging mechanism. The message appears as a Message Box, in the History Window, or on the Status Bar, depending on which `Severity` parameter you used. For more information on these options, see the siSeverityType enum.

Parameters:

  | in_Message | Message Text
  | in_Sev | Severity of the message, the default value is siInfoMsg.

Returns:
  CStatus::OK success

  CStatus::Fail failure

CStatus CreateProject | ( | const CString & | in_ProjectPath,
|  | Project & | out_rProject |
| ) |  |  | const

Creates a new project at a specific location. Existing projects won't be overwritten.

Parameters:

  | in_ProjectPath | Full path name of the project. The name of the created project corresponds to the leaf folder of the full path.

Return values:

  | out_rProject | NOT SUPPORTED, JUST PASS A DUMMY PROJECT.

Returns:
  CStatus::OK success

  CStatus::Fail failure

Preferences GetPreferences | ( |  | ) | const

Returns the Preferences object. This object is used to manage user preferences in Softimage. You can get or set preferences, import or export categories etc.

Returns:
  The Preferences object.

Since:
  4.0

Desktop GetDesktop | ( |  | ) | const

Returns the Desktop object. This object is used to manage UI objects within Softimage.

Returns:
  The Desktop object.

Since:
  4.0

Factory GetFactory | ( |  | ) | const

Returns the Factory object. This object is used to manage the creation of standalone objects within Softimage, such as unconnected scripted operators.

Returns:
  The Factory object.

Since:
  4.0

CString GetActiveToolName | ( |  | ) | const

Returns the name of the active tool. Only the following tools from the 3D view are supported: RotateTool, ScaleTool and TranslateTool. An empty string is returned if the tool is not recognized.

Returns:
  The name of the active tool.

Since:
  4.0

UIToolkit GetUIToolkit | ( |  | ) | const

Returns the UIToolkit object.

Returns:
  The UIToolkit object.

CRefArray GetFilters | ( |  | ) | const

Returns all native and custom filters currently defined in Softimage.

Returns:
  Array of Filter objects.

Since:
  4.0

CRefArray GetPlugins | ( |  | ) | const

Returns the list of all self-installable plug-ins currently loaded in Softimage.

Returns:
  Array of Plugin objects.

Since:
  4.0

bool IsInteractive | ( |  | ) | const

Returns true if the application is in interactive mode or false if it is running in batch mode.

Returns:
  True if the application is running in UI mode or false otherwise.

Since:
  4.0

Plugin LoadPlugin | ( | const CString & | in_pluginPath | ) |

Loads a self-installing plug-in file. Files with the following extensions are considered valid:

     .dllso, .vbs, .js, .pys, .py, .pls, .pl

Parameters:

  | in_pluginPath | Full path name of the plugin.

Returns:
  Plugin object representing the newly installed plug-in. If the plug-in is already installed, the existing plug-in is returned.

Since:
  4.0

CStatus UnloadPlugin | ( | const CString & | in_pluginPath,
|  | bool | in_bRemove |
| ) |  |  |

Unloads a self-installing plug-in from Softimage. All registered plug-in items are unregistered when a plug-in is unloaded; Therefore you will not be able to use these items in Softimage until you reload the plug-in.

Unloaded plug-ins can still be retrieved from Application::GetPlugins. They can be distinguished from other plug-ins by using the Plugin::IsLoaded property. An unloaded plug-in always has no registered plug-in items.

Parameters:

  | in_pluginPath | Full path name of the plugin.
  | in_bRemove | Delete the plug-in file on disk if true.

Returns:
  CStatus::OK success

  CStatus::False Already unloaded

  CStatus::Fail failure

Since:
  4.0

CStatus UpdatePlugins | ( |  | ) |

When invoked Softimage checks each loaded self-installed Plugin file and reloads it if it has changed on disk. It also scans the standard plug-in directories for any new plug-in files. This is identical to clicking the Update All button on the Plug-in Manager.

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  5.0

CStatus AddWorkgroup | ( | const CString & | in_workgroupPath | ) |

Adds a new workgroup and loads any plug-ins found in the workgroup. This function does nothing if the workgroup is already part of the workgroup list. Softimage will remember the new workgroup as part of the user Preferences.

Parameters:

  | in_workgroupPath | Complete path to root directory of a workgroup

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  5.0

CStatus RemoveWorkgroup | ( | const CString & | in_workgroupPath | ) |

Disconnects Softimage from a workgroup. Self-installed plug-ins, SPDLs and other content will be unloaded.

Parameters:

  | in_workgroupPath | Complete path to root directory of a workgroup

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  5.0

CStringArray GetWorkgroups | ( |  | ) |

Returns the list of workgroups to which Softimage is actively connected.

Returns:
  Array containing full paths to all active workgroups

Since:
  5.0

CStatus RescanWorkgroups | ( |  | ) |

Unloads all workgroup content and reloads it. This process can be time-consuming if the workgroup's content is large or the network connection is slow. Doing this will ensure that any duplicate plug-ins are loaded in the correct conflict resolution behavior. In normal circumstances calling Application::AddWorkgroup and Application::RemoveWorkgroup is faster and sufficient.

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  5.0

CStatus ActivateWorkgroup | ( | const CString & | in_workgroupPath,
|  | bool | in_bActivate |
| ) |  |  |

Activates or deactivates a workgroup. Deactivating a workgroup is very similar to calling Application::RemoveWorkgroup except that Softimage will continue to remember the workgroup path. This makes it easier for users to remember which workgroups they have connected to in the past. Softimage will not scan a deactivated workgroup for plug-ins and it will not be included in the list returned by Application::GetWorkgroups.

Note:
  Deactivated plug-ins are still stored in the `data_management.workgroup_appl_path` preference but they are prefixed with a `!` character.

Parameters:

  | in_workgroupPath | Complete path to root directory of a workgroup
  | in_bActivate | True to activate the workgroup; false to deactivate it.

Returns:
  CStatus::OK success

  CStatus::Fail failure

Since:
  5.0

CRefArray GetRenderers | ( |  | ) |

Returns the list of all rendering engines currently loaded in Softimage.

Returns:
  Array of Renderer objects.

Since:
  7.0

ProjectItem GetObjectFromID | ( | ULONG | in_nID | ) | const

Returns the object whose ID is specified. If there os no object associated to the specified ID, an empty object is returned.

Parameters:

  | in_nID | An object ID.

Returns:
  ProjectItem The object that matches the input ID.

See also:
  ProjectItem.GetObjectID

Since:
  7.0

The documentation for this class was generated from the following file:

- xsi_application.h