Queries (lxu-queries.hpp)

From The Foundry MODO SDK wiki
Revision as of 18:27, 16 August 2013 by Adissid (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Classes for querying commands.


This class encapsulates querying the result of a command. The process is fairly simple.

  • constructor -- takes the name of the command
  • Arguments() -- returns an Attributes Interface as CLxUser_Attributes allowing other non-query arguments to be set
  • Query() -- performs the query on the given argument index
        CLxCommandQuery          query ("item.channel");
        CLxUser_Attributes      &args = query.Arguments ();

        int arg_name = args.FindIndex ("name");
        int arg_value = args.FindIndex ("value");

        args.Set (arg_name, "camera$focalLen");
        query.Query (arg_value);

Once queried, general properties of the results can be read back.

  • ValueType() -- returns the type of the queried value
  • Count() -- returns the number of results
  • SetIndex() -- selects a specific result index

With one of the results selected, different methods are provided to read the value in different intrinsic types.

  • GetInt()
  • GetFloat()
  • GetString()
        n = query.Count ();
        for (i = 0; i < n; i++) {
                query.SetIndex (i);
                foclen = query.GetFloat ();


Subclass of CLxCommandQuery, this assumes querying for user values.

  • Query() -- performs the query on a named user value
        CLxReadUserValue user;

        if (user.Query ("my_user_value"))
                my_int = user.GetInt ();