예제 #1
0
/*!

\brief Converts Config to a Mask containing state values.
\details Defined in dmzRuntimeConfigToState.h.
\code
RuntimeContext *context (get_plugin_runtime_context ());
const dmz::String DefaultStateName ("Some_State|Another_State");
dmz::Mask value = dmz::config_to_state ("dmz.state.value", local, DefaultStateName, context);
\endcode
\param[in] Name String containing name of config context to convert.
\param[in] Source Config containing config context to convert.
\param[in] DefaultStateName String containing default state name to use
if the config context is not found.
\param[in] context Pointer to the runtime context.
\return Returns dmz::Mask containing the state values.

*/
dmz::Mask
dmz::config_to_state (
      const String &Name,
      const Config &Source,
      const String &DefaultStateName,
      RuntimeContext *context) {

   Mask defaultMask;

   Definitions defs (context);

   defs.lookup_state (DefaultStateName, defaultMask);

   return config_to_state (Name, Source, defaultMask, context);
}
예제 #2
0
void
dmz::WeaponPluginFixedLauncher::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());

   Definitions defs (context, &_log);

   _defaultHandle = activate_default_object_attribute (
      ObjectStateMask);

   _hilAttrHandle = activate_object_attribute (
      ObjectAttributeHumanInTheLoopName,
      ObjectFlagMask);

   _deadState = config_to_state (
      "state.dead.value",
      local,
      DefaultStateNameDead,
      context);

   _delay = config_to_float64 ("delay.value", local, _delay);
   _launcherOffset = config_to_vector ("offset", local);
   const Vector HPR = config_to_vector ("rotation", local);

   _launcherRotation.roll_in_place (HPR.get_z ());
   _launcherRotation.pitch_in_place (HPR.get_x ());
   _launcherRotation.yaw_in_place (HPR.get_y ());

   _launchButton = config_to_uint32 ("button.value", local, _launchButton);

   init_input_channels (
      local,
      InputEventButtonMask | InputEventChannelStateMask,
      &_log);

}
예제 #3
0
void
dmz::QtPluginCanvasLink::_init (Config &local) {

   RuntimeContext *context = get_plugin_runtime_context ();

   _canvasModuleName = config_to_string ("module.canvas.name", local);

   const String PosAttrName (
      config_to_string ("attribute.position.name", local, ObjectAttributeDefaultName));

   _defaultAttrHandle = activate_default_object_attribute (ObjectStateMask);

   _positionAttrHandle = activate_object_attribute (
      PosAttrName,
      ObjectPositionMask);

   const String FlowAttrName = config_to_string ("flow-attribute.name", local);

   if (FlowAttrName) {

      _flowAttrHandle = activate_object_attribute (FlowAttrName, ObjectStateMask);
   }

   _defs.lookup_state (
      config_to_string ("forward-flow-state.name", local),
      _forwardState);

   _defs.lookup_state (
      config_to_string ("reverse-flow-state.name", local),
      _reverseState);

   _flowStateMask = _forwardState | _reverseState;

   Handle attrHandle = activate_object_attribute (
     config_to_string ("link.name", local, ObjectAttributeNodeLinkName),
     ObjectLinkMask | ObjectUnlinkMask | ObjectLinkAttributeMask);

   _linkAttrTable.store (attrHandle, this);

   Config colorList;

   if (local.lookup_all_config ("state-color-list.state-color", colorList)) {

      QColor defaultColor (Qt::black);
      defaultColor.setAlphaF (0.75);

      ConfigIterator it;
      Config color;

      while (colorList.get_prev_config (it, color)) {

         const Mask State = config_to_state ("name", color, context);
         const QColor Value = config_to_qcolor (color, defaultColor);

         if (State) {

            ColorStruct *cs = new ColorStruct (State, Value);
            if (cs) { cs->next = _stateList; _stateList = cs; }
         }
      }
   }

   _penWidth = config_to_float32 ("pen-width.value", local, _penWidth);
   _arrowMultiplier = config_to_int32 ("arrow-multiplier.value", local, _arrowMultiplier);
}