Example #1
0
void RNA_api_wm(StructRNA *srna)
{
	FunctionRNA *func;
	PropertyRNA *parm;

	func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
	RNA_def_function_ui_description(func, "Opens a file selector with an operator. "
	                                "The string properties 'filepath', 'filename', 'directory' and a 'files' "
	                                "collection are assigned when present in the operator");
	rna_generic_op_invoke(func, 0);

	func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
	parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_function_return(func, RNA_def_boolean(func, "handle", 1, "", ""));


	func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
	parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_property_range(parm, 0.0, FLT_MAX);
	RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
	RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to or None");
	parm = RNA_def_pointer(func, "result", "Timer", "", "");
	RNA_def_function_return(func, parm);


	func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
	parm = RNA_def_pointer(func, "timer", "Timer", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);


	/* invoke functions, for use with python */
	func = RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup");
	RNA_def_function_ui_description(func, "Operator popup invoke");
	rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);

	/* invoked dialog opens popup with OK button, does not auto-exec operator. */
	func = RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
	RNA_def_function_ui_description(func, "Operator dialog (non-autoexec popup) invoke");
	rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);

	/* invoke enum */
	func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
	rna_generic_op_invoke(func, 0);

	/* invoke functions, for use with python */
	func = RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
	RNA_def_function_ui_description(func, "Operator popup invoke");
	rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);

	func = RNA_def_function(srna, "invoke_confirm", "WM_operator_confirm");
	RNA_def_function_ui_description(func, "Operator confirmation");
	rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);
	
}
Example #2
0
void RNA_api_wm(StructRNA *srna)
{
  FunctionRNA *func;
  PropertyRNA *parm;

  func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
  RNA_def_function_ui_description(
      func,
      "Opens a file selector with an operator. "
      "The string properties 'filepath', 'filename', 'directory' and a 'files' "
      "collection are assigned when present in the operator");
  rna_generic_op_invoke(func, 0);

  func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
  RNA_def_function_ui_description(
      func,
      "Add a modal handler to the window manager, for the given modal operator "
      "(called by invoke() with self, just before returning {'RUNNING_MODAL'})");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
  parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
  RNA_def_function_return(
      func, RNA_def_boolean(func, "handle", 1, "", "Whether adding the handler was successful"));

  func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
  RNA_def_function_ui_description(
      func, "Add a timer to the given window, to generate periodic 'TIMER' events");
  parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
  RNA_def_property_range(parm, 0.0, FLT_MAX);
  RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
  RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to, or None");
  parm = RNA_def_pointer(func, "result", "Timer", "", "");
  RNA_def_function_return(func, parm);

  func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
  parm = RNA_def_pointer(func, "timer", "Timer", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);

  func = RNA_def_function(srna, "gizmo_group_type_ensure", "rna_gizmo_group_type_ensure");
  RNA_def_function_ui_description(
      func, "Activate an existing widget group (when the persistent option isn't set)");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
  parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);

  func = RNA_def_function(
      srna, "gizmo_group_type_unlink_delayed", "rna_gizmo_group_type_unlink_delayed");
  RNA_def_function_ui_description(func,
                                  "Unlink a widget group (when the persistent option is set)");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
  parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);

  /* Progress bar interface */
  func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
  RNA_def_function_ui_description(func, "Start progress report");
  parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
  RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
  parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
  RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");

  func = RNA_def_function(srna, "progress_update", "rna_progress_update");
  RNA_def_function_ui_description(func, "Update the progress feedback");
  parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
  RNA_def_property_ui_text(
      parm, "value", "Any value between min and max as set in progress_begin()");

  func = RNA_def_function(srna, "progress_end", "rna_progress_end");
  RNA_def_function_ui_description(func, "Terminate progress report");

  /* invoke functions, for use with python */
  func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");
  RNA_def_function_ui_description(
      func,
      "Operator popup invoke "
      "(show operator properties and execute it automatically on changes)");
  rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);

  /* invoked dialog opens popup with OK button, does not auto-exec operator. */
  func = RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
  RNA_def_function_ui_description(
      func,
      "Operator dialog (non-autoexec popup) invoke "
      "(show operator properties and only execute it on click on OK button)");
  rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);

  /* invoke enum */
  func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
  RNA_def_function_ui_description(
      func,
      "Operator search popup invoke which "
      "searches values of the operator's :class:`bpy.types.Operator.bl_property` "
      "(which must be an EnumProperty), executing it on confirmation");
  rna_generic_op_invoke(func, 0);

  /* invoke functions, for use with python */
  func = RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
  RNA_def_function_ui_description(func,
                                  "Operator popup invoke "
                                  "(only shows operator's properties, without executing it)");
  rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);

  func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm");
  RNA_def_function_ui_description(
      func,
      "Operator confirmation popup "
      "(only to let user confirm the execution, no operator properties shown)");
  rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);

  /* wrap UI_popup_menu_begin */
  func = RNA_def_function(srna, "popmenu_begin__internal", "rna_PopMenuBegin");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
  parm = RNA_def_string(func, "title", NULL, 0, "", "");
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
  parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
  RNA_def_property_enum_items(parm, rna_enum_icon_items);
  /* return */
  parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
  RNA_def_function_return(func, parm);

  /* wrap UI_popup_menu_end */
  func = RNA_def_function(srna, "popmenu_end__internal", "rna_PopMenuEnd");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
  parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);

  /* wrap UI_popover_begin */
  func = RNA_def_function(srna, "popover_begin__internal", "rna_PopoverBegin");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
  RNA_def_property(func, "ui_units_x", PROP_INT, PROP_UNSIGNED);
  /* return */
  parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
  RNA_def_function_return(func, parm);

  /* wrap UI_popover_end */
  func = RNA_def_function(srna, "popover_end__internal", "rna_PopoverEnd");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
  parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);
  RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");

  /* wrap uiPieMenuBegin */
  func = RNA_def_function(srna, "piemenu_begin__internal", "rna_PieMenuBegin");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
  parm = RNA_def_string(func, "title", NULL, 0, "", "");
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
  parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
  RNA_def_property_enum_items(parm, rna_enum_icon_items);
  parm = RNA_def_pointer(func, "event", "Event", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
  /* return */
  parm = RNA_def_pointer(func, "menu_pie", "UIPieMenu", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
  RNA_def_function_return(func, parm);

  /* wrap uiPieMenuEnd */
  func = RNA_def_function(srna, "piemenu_end__internal", "rna_PieMenuEnd");
  RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
  parm = RNA_def_pointer(func, "menu", "UIPieMenu", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);

  /* access last operator options (optionally create). */
  func = RNA_def_function(
      srna, "operator_properties_last", "rna_WindoManager_operator_properties_last");
  RNA_def_function_flag(func, FUNC_NO_SELF);
  parm = RNA_def_string(func, "operator", NULL, 0, "", "");
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
  /* return */
  parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
  RNA_def_function_return(func, parm);

  RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps");
}
Example #3
0
void RNA_api_wm(StructRNA *srna)
{
	FunctionRNA *func;
	PropertyRNA *parm;

	func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
	RNA_def_function_ui_description(func, "Opens a file selector with an operator. "
	                                "The string properties 'filepath', 'filename', 'directory' and a 'files' "
	                                "collection are assigned when present in the operator");
	rna_generic_op_invoke(func, 0);

	func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
	parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_function_return(func, RNA_def_boolean(func, "handle", 1, "", ""));


	func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
	parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_property_range(parm, 0.0, FLT_MAX);
	RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
	RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to or None");
	parm = RNA_def_pointer(func, "result", "Timer", "", "");
	RNA_def_function_return(func, parm);


	func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
	parm = RNA_def_pointer(func, "timer", "Timer", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);

	/* Progress bar interface */
	func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
	RNA_def_function_ui_description(func, "Start Progress bar");

	parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
	RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
	RNA_def_property_flag(parm, PROP_REQUIRED);

	parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");

	func = RNA_def_function(srna, "progress_update", "rna_progress_update");
	parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_property_ui_text(parm, "value", "any value between min and max as set in progress_begin()");

	func = RNA_def_function(srna, "progress_end", "rna_progress_end");
	RNA_def_function_ui_description(func, "Terminate Progress bar");

	/* invoke functions, for use with python */
	func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");
	RNA_def_function_ui_description(func, "Operator popup invoke");
	rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);

	/* invoked dialog opens popup with OK button, does not auto-exec operator. */
	func = RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
	RNA_def_function_ui_description(func, "Operator dialog (non-autoexec popup) invoke");
	rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);

	/* invoke enum */
	func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
	rna_generic_op_invoke(func, 0);

	/* invoke functions, for use with python */
	func = RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
	RNA_def_function_ui_description(func, "Operator popup invoke");
	rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);

	func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm");
	RNA_def_function_ui_description(func, "Operator confirmation");
	rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);


	/* wrap uiPupMenuBegin */
	func = RNA_def_function(srna, "pupmenu_begin__internal", "rna_PupMenuBegin");
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
	parm = RNA_def_string(func, "title", NULL, 0, "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(parm, icon_items);
	/* return */
	parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
	RNA_def_property_flag(parm, PROP_RNAPTR | PROP_NEVER_NULL);
	RNA_def_function_return(func, parm);

	/* wrap uiPupMenuEnd */
	func = RNA_def_function(srna, "pupmenu_end__internal", "rna_PupMenuEnd");
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
	parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
	RNA_def_property_flag(parm, PROP_RNAPTR | PROP_NEVER_NULL);
}