2011-02-23 10:52:22 +00:00
/*
2010-03-21 01:14:04 +00:00
* $ Id $
2009-04-08 16:40:46 +00:00
*
* * * * * * BEGIN GPL LICENSE BLOCK * * * * *
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
2010-02-12 13:34:04 +00:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
2009-04-08 16:40:46 +00:00
*
* The Original Code is Copyright ( C ) 2009 Blender Foundation .
* All rights reserved .
*
*
* Contributor ( s ) : Blender Foundation
*
* * * * * * END GPL LICENSE BLOCK * * * * *
*/
2011-02-27 20:20:01 +00:00
/** \file blender/makesrna/intern/rna_ui_api.c
* \ ingroup RNA
*/
2009-04-08 16:40:46 +00:00
# include <stdlib.h>
# include <stdio.h>
# include "RNA_define.h"
2009-06-15 20:28:49 +00:00
# include "UI_resources.h"
2009-06-18 19:48:55 +00:00
# ifdef RNA_RUNTIME
2010-11-17 09:45:45 +00:00
static void rna_uiItemR ( uiLayout * layout , PointerRNA * ptr , const char * propname , const char * name , int icon , int expand , int slider , int toggle , int icon_only , int event , int full_event , int emboss , int index )
2009-08-21 12:57:47 +00:00
{
2009-11-26 15:03:55 +00:00
PropertyRNA * prop = RNA_struct_find_property ( ptr , propname ) ;
2009-08-21 12:57:47 +00:00
int flag = 0 ;
2009-11-26 15:03:55 +00:00
if ( ! prop ) {
2010-08-17 13:14:41 +00:00
printf ( " rna_uiItemR: property not found: %s.%s \n " , RNA_struct_identifier ( ptr - > type ) , propname ) ;
2009-11-26 15:03:55 +00:00
return ;
}
2009-08-21 12:57:47 +00:00
flag | = ( slider ) ? UI_ITEM_R_SLIDER : 0 ;
flag | = ( expand ) ? UI_ITEM_R_EXPAND : 0 ;
flag | = ( toggle ) ? UI_ITEM_R_TOGGLE : 0 ;
2009-09-13 22:33:47 +00:00
flag | = ( icon_only ) ? UI_ITEM_R_ICON_ONLY : 0 ;
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
flag | = ( event ) ? UI_ITEM_R_EVENT : 0 ;
flag | = ( full_event ) ? UI_ITEM_R_FULL_EVENT : 0 ;
2010-06-26 20:00:45 +00:00
flag | = ( emboss ) ? 0 : UI_ITEM_R_NO_BG ;
2009-11-26 15:03:55 +00:00
2010-03-23 15:31:12 +00:00
uiItemFullR ( layout , ptr , prop , index , 0 , flag , name , icon ) ;
2009-08-21 12:57:47 +00:00
}
2010-11-17 09:45:45 +00:00
static PointerRNA rna_uiItemO ( uiLayout * layout , const char * opname , const char * name , int icon , int emboss )
2009-08-21 12:57:47 +00:00
{
2010-06-26 20:00:45 +00:00
int flag = UI_ITEM_O_RETURN_PROPS ;
flag | = ( emboss ) ? 0 : UI_ITEM_R_NO_BG ;
return uiItemFullO ( layout , opname , name , icon , NULL , uiLayoutGetOperatorContext ( layout ) , flag ) ;
2009-08-21 12:57:47 +00:00
}
2009-06-18 19:48:55 +00:00
# else
2010-11-02 21:43:47 +00:00
# define DEF_ICON_BLANK_SKIP
2010-11-02 13:12:30 +00:00
# define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
# define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""},
2009-06-15 20:28:49 +00:00
static EnumPropertyItem icon_items [ ] = {
# include "UI_icons.h"
2009-06-16 00:52:21 +00:00
{ 0 , NULL , 0 , NULL , NULL } } ;
2010-11-02 21:43:47 +00:00
# undef DEF_ICON_BLANK_SKIP
2009-06-15 20:28:49 +00:00
# undef DEF_ICON
2010-11-02 13:12:30 +00:00
# undef DEF_VICO
2009-04-11 01:52:27 +00:00
static void api_ui_item_common ( FunctionRNA * func )
{
2009-06-15 20:28:49 +00:00
PropertyRNA * prop ;
2009-04-11 01:52:27 +00:00
RNA_def_string ( func , " text " , " " , 0 , " " , " Override automatic text of the item. " ) ;
2009-06-15 20:28:49 +00:00
prop = RNA_def_property ( func , " icon " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_items ( prop , icon_items ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Icon " , " Override automatic icon of the item " ) ;
2009-06-15 20:28:49 +00:00
2009-04-11 01:52:27 +00:00
}
2010-03-23 15:25:33 +00:00
static void api_ui_item_op ( FunctionRNA * func )
2009-04-22 18:39:44 +00:00
{
PropertyRNA * parm ;
2010-03-23 15:25:33 +00:00
parm = RNA_def_string ( func , " operator " , " " , 0 , " " , " Identifier of the operator. " ) ;
2010-06-26 20:00:45 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2010-03-23 15:25:33 +00:00
}
2009-04-22 18:39:44 +00:00
2010-03-23 15:25:33 +00:00
static void api_ui_item_op_common ( FunctionRNA * func )
{
api_ui_item_op ( func ) ;
2009-04-22 18:39:44 +00:00
api_ui_item_common ( func ) ;
}
2009-06-16 00:52:21 +00:00
static void api_ui_item_rna_common ( FunctionRNA * func )
{
PropertyRNA * parm ;
parm = RNA_def_pointer ( func , " data " , " AnyType " , " " , " Data from which to take property. " ) ;
2009-09-16 18:04:01 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL ) ;
2009-06-16 00:52:21 +00:00
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in data. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
}
2009-04-08 16:40:46 +00:00
void RNA_api_ui_layout ( StructRNA * srna )
{
FunctionRNA * func ;
2009-04-11 01:52:27 +00:00
PropertyRNA * parm ;
2009-06-03 00:14:12 +00:00
static EnumPropertyItem curve_type_items [ ] = {
2009-06-16 00:52:21 +00:00
{ 0 , " NONE " , 0 , " None " , " " } ,
{ ' v ' , " VECTOR " , 0 , " Vector " , " " } ,
{ ' c ' , " COLOR " , 0 , " Color " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-07-21 01:26:17 +00:00
static EnumPropertyItem list_type_items [ ] = {
{ 0 , " DEFAULT " , 0 , " None " , " " } ,
{ ' c ' , " COMPACT " , 0 , " Compact " , " " } ,
{ ' i ' , " ICONS " , 0 , " Icons " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-06-03 00:14:12 +00:00
2009-04-16 12:17:58 +00:00
/* simple layout specifiers */
func = RNA_def_function ( srna , " row " , " uiLayoutRow " ) ;
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
parm = RNA_def_pointer ( func , " layout " , " UILayout " , " " , " Sub-layout to put items in. " ) ;
RNA_def_function_return ( func , parm ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Sub-layout. Items placed in this sublayout are placed next to each other in a row. " ) ;
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
RNA_def_boolean ( func , " align " , 0 , " " , " Align buttons to each other. " ) ;
2010-08-07 18:34:16 +00:00
2009-04-16 12:17:58 +00:00
func = RNA_def_function ( srna , " column " , " uiLayoutColumn " ) ;
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
parm = RNA_def_pointer ( func , " layout " , " UILayout " , " " , " Sub-layout to put items in. " ) ;
RNA_def_function_return ( func , parm ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Sub-layout. Items placed in this sublayout are placed under each other in a column. " ) ;
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
RNA_def_boolean ( func , " align " , 0 , " " , " Align buttons to each other. " ) ;
2009-04-16 12:17:58 +00:00
func = RNA_def_function ( srna , " column_flow " , " uiLayoutColumnFlow " ) ;
2011-01-13 04:53:55 +00:00
RNA_def_int ( func , " columns " , 0 , 0 , INT_MAX , " " , " Number of columns, 0 is automatic. " , 0 , INT_MAX ) ;
UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
This means the layout engine now works at button level, and makes it
easier to write templates. Otherwise you had to store all info and
create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
These can contain regular buttons, and can be put in a Free layout,
which means you can specify manual coordinates, but still get nested
correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
in the last added layout specifier, i.e. one level up in the layout
hierarchy. This doesn't work well in always, so now when creating things
like rows or columns it always returns a layout which you have to add
the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
required width/height of all nested layouts, and then in the second
pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
buttons).
* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
parm = RNA_def_pointer ( func , " layout " , " UILayout " , " " , " Sub-layout to put items in. " ) ;
RNA_def_function_return ( func , parm ) ;
RNA_def_boolean ( func , " align " , 0 , " " , " Align buttons to each other. " ) ;
2009-04-08 16:40:46 +00:00
2009-04-16 12:17:58 +00:00
/* box layout */
func = RNA_def_function ( srna , " box " , " uiLayoutBox " ) ;
parm = RNA_def_pointer ( func , " layout " , " UILayout " , " " , " Sub-layout to put items in. " ) ;
RNA_def_function_return ( func , parm ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Sublayout. Items placed in this sublayout are placed under each other in a column and are surrounded by a box. " ) ;
2009-04-16 12:17:58 +00:00
/* split layout */
func = RNA_def_function ( srna , " split " , " uiLayoutSplit " ) ;
parm = RNA_def_pointer ( func , " layout " , " UILayout " , " " , " Sub-layout to put items in. " ) ;
2009-04-11 01:52:27 +00:00
RNA_def_function_return ( func , parm ) ;
2009-08-18 12:56:43 +00:00
RNA_def_float ( func , " percentage " , 0.0f , 0.0f , 1.0f , " Percentage " , " Percentage of width to split at. " , 0.0f , 1.0f ) ;
2009-12-10 14:47:07 +00:00
RNA_def_boolean ( func , " align " , 0 , " " , " Align buttons to each other. " ) ;
2009-04-08 16:40:46 +00:00
/* items */
2009-11-23 00:27:30 +00:00
func = RNA_def_function ( srna , " prop " , " rna_uiItemR " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. Exposes an RNA item and places it into the layout. " ) ;
2009-06-16 00:52:21 +00:00
api_ui_item_rna_common ( func ) ;
2010-03-23 15:25:33 +00:00
api_ui_item_common ( func ) ;
2009-04-16 12:17:58 +00:00
RNA_def_boolean ( func , " expand " , 0 , " " , " Expand button to show more detail. " ) ;
2009-05-27 00:03:49 +00:00
RNA_def_boolean ( func , " slider " , 0 , " " , " Use slider widget for numeric values. " ) ;
RNA_def_boolean ( func , " toggle " , 0 , " " , " Use toggle widget for boolean values. " ) ;
2009-09-16 18:04:01 +00:00
RNA_def_boolean ( func , " icon_only " , 0 , " " , " Draw only icons in buttons, no text. " ) ;
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
RNA_def_boolean ( func , " event " , 0 , " " , " Use button to input key events. " ) ;
RNA_def_boolean ( func , " full_event " , 0 , " " , " Use button to input full events including modifiers. " ) ;
2010-06-26 20:00:45 +00:00
RNA_def_boolean ( func , " emboss " , 1 , " " , " Draw the button itself, just the icon/text. " ) ;
2009-11-26 15:03:55 +00:00
RNA_def_int ( func , " index " , - 1 , - 2 , INT_MAX , " " , " The index of this button, when set a single member of an array can be accessed, when set to -1 all array members are used. " , - 2 , INT_MAX ) ; /* RNA_NO_INDEX == -1 */
2009-04-08 16:40:46 +00:00
2009-11-23 00:27:30 +00:00
func = RNA_def_function ( srna , " props_enum " , " uiItemsEnumR " ) ;
2009-06-16 00:52:21 +00:00
api_ui_item_rna_common ( func ) ;
2009-04-22 18:39:44 +00:00
2009-11-23 00:27:30 +00:00
func = RNA_def_function ( srna , " prop_menu_enum " , " uiItemMenuEnumR " ) ;
2009-06-16 00:52:21 +00:00
api_ui_item_rna_common ( func ) ;
2010-03-23 15:25:33 +00:00
api_ui_item_common ( func ) ;
2009-04-22 18:39:44 +00:00
2009-11-23 11:43:38 +00:00
func = RNA_def_function ( srna , " prop_enum " , " uiItemEnumR_string " ) ;
2009-06-16 00:52:21 +00:00
api_ui_item_rna_common ( func ) ;
2009-04-22 18:39:44 +00:00
parm = RNA_def_string ( func , " value " , " " , 0 , " " , " Enum property value. " ) ;
2009-07-02 19:41:31 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2010-03-23 15:25:33 +00:00
api_ui_item_common ( func ) ;
2009-04-22 18:39:44 +00:00
2010-08-23 05:47:45 +00:00
func = RNA_def_function ( srna , " prop_search " , " uiItemPointerR " ) ;
2009-06-27 01:15:31 +00:00
api_ui_item_rna_common ( func ) ;
parm = RNA_def_pointer ( func , " search_data " , " AnyType " , " " , " Data from which to take collection to search in. " ) ;
2009-09-16 18:04:01 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL ) ;
2009-06-27 01:15:31 +00:00
parm = RNA_def_string ( func , " search_property " , " " , 0 , " " , " Identifier of search collection property. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2010-03-23 15:25:33 +00:00
api_ui_item_common ( func ) ;
2009-06-27 01:15:31 +00:00
2009-11-23 00:27:30 +00:00
func = RNA_def_function ( srna , " operator " , " rna_uiItemO " ) ;
2009-04-22 18:39:44 +00:00
api_ui_item_op_common ( func ) ;
2010-06-26 20:00:45 +00:00
RNA_def_boolean ( func , " emboss " , 1 , " " , " Draw the button itself, just the icon/text. " ) ;
2009-11-23 11:43:38 +00:00
parm = RNA_def_pointer ( func , " properties " , " OperatorProperties " , " " , " Operator properties to fill in, return when 'properties' is set to true. " ) ;
2009-08-21 12:57:47 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR ) ;
RNA_def_function_return ( func , parm ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. Places a button into the layout to call an Operator. " ) ;
2009-04-22 18:39:44 +00:00
2011-02-18 06:07:41 +00:00
/* func= RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
2009-04-22 18:39:44 +00:00
api_ui_item_op_common ( func ) ;
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in operator. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_string ( func , " value " , " " , 0 , " " , " Enum property value. " ) ;
2009-11-23 11:43:38 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ; */
2009-04-22 18:39:44 +00:00
2011-02-18 06:07:41 +00:00
func = RNA_def_function ( srna , " operator_enum " , " uiItemsEnumO " ) ;
2009-04-11 01:52:27 +00:00
parm = RNA_def_string ( func , " operator " , " " , 0 , " " , " Identifier of the operator. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2009-04-22 18:39:44 +00:00
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in operator. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2009-11-23 00:27:30 +00:00
func = RNA_def_function ( srna , " operator_menu_enum " , " uiItemMenuEnumO " ) ;
2010-03-23 15:25:33 +00:00
api_ui_item_op ( func ) ; /* cant use api_ui_item_op_common because property must come right after */
2009-04-22 18:39:44 +00:00
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in operator. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2010-03-23 15:25:33 +00:00
api_ui_item_common ( func ) ;
2009-04-22 18:39:44 +00:00
2009-11-23 11:43:38 +00:00
/* func= RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
2009-04-22 18:39:44 +00:00
api_ui_item_op_common ( func ) ;
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in operator. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_boolean ( func , " value " , 0 , " " , " Value of the property to call the operator with. " ) ;
2009-11-23 11:43:38 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ; */
2009-04-22 18:39:44 +00:00
2009-11-23 11:43:38 +00:00
/* func= RNA_def_function(srna, "operator_int", "uiItemIntO");
2009-04-22 18:39:44 +00:00
api_ui_item_op_common ( func ) ;
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in operator. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_int ( func , " value " , 0 , INT_MIN , INT_MAX , " " , " Value of the property to call the operator with. " , INT_MIN , INT_MAX ) ;
2009-11-23 11:43:38 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ; */
2009-04-22 18:39:44 +00:00
2009-11-23 11:43:38 +00:00
/* func= RNA_def_function(srna, "operator_float", "uiItemFloatO");
2009-04-22 18:39:44 +00:00
api_ui_item_op_common ( func ) ;
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in operator. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_float ( func , " value " , 0 , - FLT_MAX , FLT_MAX , " " , " Value of the property to call the operator with. " , - FLT_MAX , FLT_MAX ) ;
2009-11-23 11:43:38 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ; */
2009-04-22 18:39:44 +00:00
2009-11-23 11:43:38 +00:00
/* func= RNA_def_function(srna, "operator_string", "uiItemStringO");
2009-04-22 18:39:44 +00:00
api_ui_item_op_common ( func ) ;
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in operator. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_string ( func , " value " , " " , 0 , " " , " Value of the property to call the operator with. " ) ;
2009-11-23 11:43:38 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ; */
2009-04-08 16:40:46 +00:00
2009-11-23 00:27:30 +00:00
func = RNA_def_function ( srna , " label " , " uiItemL " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. Display text in the layout. " ) ;
2009-04-11 01:52:27 +00:00
api_ui_item_common ( func ) ;
2009-04-22 18:39:44 +00:00
2009-11-23 00:27:30 +00:00
func = RNA_def_function ( srna , " menu " , " uiItemM " ) ;
2009-06-23 00:19:10 +00:00
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
2009-04-22 18:39:44 +00:00
parm = RNA_def_string ( func , " menu " , " " , 0 , " " , " Identifier of the menu. " ) ;
2010-03-23 15:25:33 +00:00
api_ui_item_common ( func ) ;
2009-04-22 18:39:44 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2009-11-23 00:27:30 +00:00
func = RNA_def_function ( srna , " separator " , " uiItemS " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. Inserts empty space into the layout between items. " ) ;
2009-04-22 18:39:44 +00:00
2009-05-28 23:13:42 +00:00
/* context */
2010-09-03 07:25:37 +00:00
func = RNA_def_function ( srna , " context_pointer_set " , " uiLayoutSetContextPointer " ) ;
2009-05-28 23:13:42 +00:00
parm = RNA_def_string ( func , " name " , " " , 0 , " Name " , " Name of entry in the context. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_pointer ( func , " data " , " AnyType " , " " , " Pointer to put in context. " ) ;
2009-06-16 00:52:21 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR ) ;
2009-12-16 10:13:26 +00:00
2009-04-22 18:39:44 +00:00
/* templates */
func = RNA_def_function ( srna , " template_header " , " uiTemplateHeader " ) ;
2009-06-23 00:19:10 +00:00
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
2009-08-18 12:56:43 +00:00
RNA_def_boolean ( func , " menus " , 1 , " " , " The header has menus, and should show menu expander. " ) ;
2009-04-22 18:39:44 +00:00
2009-06-07 13:20:41 +00:00
func = RNA_def_function ( srna , " template_ID " , " uiTemplateID " ) ;
2009-06-23 00:19:10 +00:00
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
2009-06-16 00:52:21 +00:00
api_ui_item_rna_common ( func ) ;
2009-04-22 18:39:44 +00:00
RNA_def_string ( func , " new " , " " , 0 , " " , " Operator identifier to create a new ID block. " ) ;
2009-09-04 21:02:43 +00:00
RNA_def_string ( func , " open " , " " , 0 , " " , " Operator identifier to open a file for creating a new ID block. " ) ;
2009-04-22 18:39:44 +00:00
RNA_def_string ( func , " unlink " , " " , 0 , " " , " Operator identifier to unlink the ID block. " ) ;
2009-10-14 09:08:53 +00:00
2010-01-03 08:37:18 +00:00
func = RNA_def_function ( srna , " template_ID_preview " , " uiTemplateIDPreview " ) ;
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
api_ui_item_rna_common ( func ) ;
RNA_def_string ( func , " new " , " " , 0 , " " , " Operator identifier to create a new ID block. " ) ;
RNA_def_string ( func , " open " , " " , 0 , " " , " Operator identifier to open a file for creating a new ID block. " ) ;
RNA_def_string ( func , " unlink " , " " , 0 , " " , " Operator identifier to unlink the ID block. " ) ;
RNA_def_int ( func , " rows " , 0 , 0 , INT_MAX , " Number of thumbnail preview rows to display " , " " , 0 , INT_MAX ) ;
RNA_def_int ( func , " cols " , 0 , 0 , INT_MAX , " Number of thumbnail preview columns to display " , " " , 0 , INT_MAX ) ;
2009-10-14 09:08:53 +00:00
func = RNA_def_function ( srna , " template_any_ID " , " uiTemplateAnyID " ) ;
parm = RNA_def_pointer ( func , " data " , " AnyType " , " " , " Data from which to take property. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL ) ;
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in data. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_string ( func , " type_property " , " " , 0 , " " , " Identifier of property in data giving the type of the ID-blocks to use. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2011-01-10 03:58:07 +00:00
RNA_def_string ( func , " text " , " " , 0 , " " , " Custom label to display in UI. " ) ;
2009-10-14 09:08:53 +00:00
2009-10-15 10:13:59 +00:00
func = RNA_def_function ( srna , " template_path_builder " , " uiTemplatePathBuilder " ) ;
parm = RNA_def_pointer ( func , " data " , " AnyType " , " " , " Data from which to take property. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL ) ;
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in data. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_pointer ( func , " root " , " ID " , " " , " ID-block from which path is evaluated from. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR ) ;
2011-01-10 03:58:07 +00:00
RNA_def_string ( func , " text " , " " , 0 , " " , " Custom label to display in UI. " ) ;
2009-10-15 10:13:59 +00:00
2009-05-21 15:34:09 +00:00
func = RNA_def_function ( srna , " template_modifier " , " uiTemplateModifier " ) ;
2010-01-25 11:39:56 +00:00
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Layout . Generates the UI layout for modifiers. " ) ;
2009-06-16 00:52:21 +00:00
parm = RNA_def_pointer ( func , " data " , " Modifier " , " " , " Modifier data. " ) ;
2009-09-16 18:04:01 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL ) ;
2009-05-21 15:34:09 +00:00
parm = RNA_def_pointer ( func , " layout " , " UILayout " , " " , " Sub-layout to put items in. " ) ;
RNA_def_function_return ( func , parm ) ;
2009-05-27 00:03:49 +00:00
func = RNA_def_function ( srna , " template_constraint " , " uiTemplateConstraint " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Layout . Generates the UI layout for constraints. " ) ;
2009-06-16 00:52:21 +00:00
parm = RNA_def_pointer ( func , " data " , " Constraint " , " " , " Constraint data. " ) ;
2009-09-16 18:04:01 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL ) ;
2009-05-27 00:03:49 +00:00
parm = RNA_def_pointer ( func , " layout " , " UILayout " , " " , " Sub-layout to put items in. " ) ;
RNA_def_function_return ( func , parm ) ;
2009-05-28 23:41:12 +00:00
func = RNA_def_function ( srna , " template_preview " , " uiTemplatePreview " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. A preview window for materials, textures, lamps, etc. " ) ;
2009-05-28 23:41:12 +00:00
parm = RNA_def_pointer ( func , " id " , " ID " , " " , " ID datablock. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2011-01-13 04:53:55 +00:00
RNA_def_boolean ( func , " show_buttons " , 1 , " " , " Show preview buttons? " ) ;
2009-09-16 18:04:01 +00:00
RNA_def_pointer ( func , " parent " , " ID " , " " , " ID datablock. " ) ;
RNA_def_pointer ( func , " slot " , " TextureSlot " , " " , " Texture slot. " ) ;
2009-05-28 23:41:12 +00:00
2009-06-03 00:14:12 +00:00
func = RNA_def_function ( srna , " template_curve_mapping " , " uiTemplateCurveMapping " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. A curve mapping widget used for e.g falloff curves for lamps. " ) ;
2009-09-16 18:47:42 +00:00
api_ui_item_rna_common ( func ) ;
2009-06-03 00:14:12 +00:00
RNA_def_enum ( func , " type " , curve_type_items , 0 , " Type " , " Type of curves to display. " ) ;
2009-09-16 18:47:42 +00:00
RNA_def_boolean ( func , " levels " , 0 , " " , " Show black/white levels. " ) ;
2010-01-04 17:28:37 +00:00
RNA_def_boolean ( func , " brush " , 0 , " " , " Show brush options. " ) ;
2009-06-03 00:14:12 +00:00
func = RNA_def_function ( srna , " template_color_ramp " , " uiTemplateColorRamp " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. A color ramp widget. " ) ;
2009-09-16 18:47:42 +00:00
api_ui_item_rna_common ( func ) ;
2009-06-03 00:14:12 +00:00
RNA_def_boolean ( func , " expand " , 0 , " " , " Expand button to show more detail. " ) ;
2009-06-13 11:21:02 +00:00
2010-01-19 01:32:06 +00:00
func = RNA_def_function ( srna , " template_histogram " , " uiTemplateHistogram " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. A histogramm widget to analyze imaga data. " ) ;
2010-01-19 01:32:06 +00:00
api_ui_item_rna_common ( func ) ;
2010-04-06 02:05:54 +00:00
func = RNA_def_function ( srna , " template_waveform " , " uiTemplateWaveform " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. A waveform widget to analyze imaga data. " ) ;
2010-04-06 02:05:54 +00:00
api_ui_item_rna_common ( func ) ;
func = RNA_def_function ( srna , " template_vectorscope " , " uiTemplateVectorscope " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. A vectorscope widget to analyze imaga data. " ) ;
2010-04-06 02:05:54 +00:00
api_ui_item_rna_common ( func ) ;
2009-06-13 11:21:02 +00:00
func = RNA_def_function ( srna , " template_layers " , " uiTemplateLayers " ) ;
2009-06-16 00:52:21 +00:00
api_ui_item_rna_common ( func ) ;
2009-11-29 02:42:47 +00:00
parm = RNA_def_pointer ( func , " used_layers_data " , " AnyType " , " " , " Data from which to take property. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR ) ;
parm = RNA_def_string ( func , " used_layers_property " , " " , 0 , " " , " Identifier of property in data. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_int ( func , " active_layer " , 0 , 0 , INT_MAX , " Active Layer " , " " , 0 , INT_MAX ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2009-07-21 12:38:01 +00:00
2010-01-07 09:55:11 +00:00
func = RNA_def_function ( srna , " template_color_wheel " , " uiTemplateColorWheel " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. A color wheel widget to pick colors. " ) ;
2010-01-07 09:55:11 +00:00
api_ui_item_rna_common ( func ) ;
RNA_def_boolean ( func , " value_slider " , 0 , " " , " Display the value slider to the right of the color wheel " ) ;
2010-01-27 00:22:29 +00:00
RNA_def_boolean ( func , " lock " , 0 , " " , " Lock the color wheel display to value 1.0 regardless of actual color " ) ;
2010-07-04 20:59:10 +00:00
RNA_def_boolean ( func , " lock_luminosity " , 0 , " " , " Keep the color at its original vector length " ) ;
2010-07-05 15:52:25 +00:00
RNA_def_boolean ( func , " cubic " , 1 , " " , " Cubic saturation for picking values close to white " ) ;
2009-06-23 00:45:41 +00:00
func = RNA_def_function ( srna , " template_image_layers " , " uiTemplateImageLayers " ) ;
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
parm = RNA_def_pointer ( func , " image " , " Image " , " " , " " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
parm = RNA_def_pointer ( func , " image_user " , " ImageUser " , " " , " " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2009-06-24 14:16:56 +00:00
2009-09-16 19:27:08 +00:00
func = RNA_def_function ( srna , " template_image " , " uiTemplateImage " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item(s). User interface for selecting images and their source paths. " ) ;
2009-09-16 19:27:08 +00:00
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
api_ui_item_rna_common ( func ) ;
parm = RNA_def_pointer ( func , " image_user " , " ImageUser " , " " , " " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR ) ;
RNA_def_boolean ( func , " compact " , 0 , " " , " Use more compact layout. " ) ;
2009-06-24 14:16:56 +00:00
func = RNA_def_function ( srna , " template_list " , " uiTemplateList " ) ;
2010-08-07 18:34:16 +00:00
RNA_def_function_ui_description ( func , " Item. A list widget to display data. e.g. vertexgroups. " ) ;
2009-07-21 01:26:17 +00:00
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
2009-09-17 14:35:08 +00:00
parm = RNA_def_pointer ( func , " data " , " AnyType " , " " , " Data from which to take property. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR ) ;
parm = RNA_def_string ( func , " property " , " " , 0 , " " , " Identifier of property in data. " ) ;
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2009-07-01 22:25:49 +00:00
parm = RNA_def_pointer ( func , " active_data " , " AnyType " , " " , " Data from which to take property for the active element. " ) ;
2009-09-16 19:27:08 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL ) ;
2009-06-27 01:15:31 +00:00
parm = RNA_def_string ( func , " active_property " , " " , 0 , " " , " Identifier of property in data, for the active element. " ) ;
2009-06-24 14:16:56 +00:00
RNA_def_property_flag ( parm , PROP_REQUIRED ) ;
2011-01-09 01:17:56 +00:00
RNA_def_int ( func , " rows " , 5 , 0 , INT_MAX , " " , " Number of rows to display. " , 0 , INT_MAX ) ;
RNA_def_int ( func , " maxrows " , 5 , 0 , INT_MAX , " " , " Maximum number of rows to display. " , 0 , INT_MAX ) ;
RNA_def_enum ( func , " type " , list_type_items , 0 , " Type " , " Type of list to use. " ) ;
2009-06-30 19:20:45 +00:00
func = RNA_def_function ( srna , " template_running_jobs " , " uiTemplateRunningJobs " ) ;
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
2011-01-10 03:58:07 +00:00
RNA_def_function ( srna , " template_operator_search " , " uiTemplateOperatorSearch " ) ;
2009-07-11 13:32:20 +00:00
func = RNA_def_function ( srna , " template_header_3D " , " uiTemplateHeader3D " ) ;
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again).
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
2010-03-02 11:48:40 +00:00
func = RNA_def_function ( srna , " template_reports_banner " , " uiTemplateReportsBanner " ) ;
RNA_def_function_flag ( func , FUNC_USE_CONTEXT ) ;
2009-11-28 17:45:23 +00:00
func = RNA_def_function ( srna , " introspect " , " uiLayoutIntrospect " ) ;
parm = RNA_def_string ( func , " string " , " " , 1024 * 1024 , " Descr " , " DESCR " ) ;
RNA_def_function_return ( func , parm ) ;
2009-04-08 16:40:46 +00:00
}
2009-06-18 19:48:55 +00:00
# endif