2011-02-23 10:52:22 +00:00
|
|
|
/*
|
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
|
2012-03-18 09:27:36 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-04-08 16:40:46 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
2012-03-18 09:27:36 +00:00
|
|
|
*
|
2009-04-08 16:40:46 +00:00
|
|
|
* 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>
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-02-08 14:29:38 +00:00
|
|
|
|
2009-04-08 16:40:46 +00:00
|
|
|
#include "RNA_define.h"
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
#include "RNA_enum_types.h"
|
|
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
2009-04-08 16:40:46 +00:00
|
|
|
|
2009-06-15 20:28:49 +00:00
|
|
|
#include "UI_resources.h"
|
2013-02-08 14:29:38 +00:00
|
|
|
#include "UI_interface.h"
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
#include "UI_interface_icons.h"
|
2009-06-15 20:28:49 +00:00
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
2013-01-23 21:55:11 +00:00
|
|
|
#define DEF_ICON_BLANK_SKIP
|
|
|
|
|
#define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
|
|
|
|
|
#define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""},
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem rna_enum_icon_items[] = {
|
2013-01-23 21:55:11 +00:00
|
|
|
#include "UI_icons.h"
|
|
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
|
|
|
|
#undef DEF_ICON_BLANK_SKIP
|
|
|
|
|
#undef DEF_ICON
|
|
|
|
|
#undef DEF_VICO
|
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
static const char *rna_translate_ui_text(const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop,
|
|
|
|
|
int translate)
|
|
|
|
|
{
|
2013-02-09 18:17:20 +00:00
|
|
|
/* Also return text if UI labels translation is disabled. */
|
2015-08-16 17:32:01 +10:00
|
|
|
if (!text || !text[0] || !translate || !BLT_translate_iface()) {
|
2013-02-08 14:29:38 +00:00
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If a text_ctxt is specified, use it! */
|
|
|
|
|
if (text_ctxt && text_ctxt[0]) {
|
2015-08-16 17:32:01 +10:00
|
|
|
return BLT_pgettext(text_ctxt, text);
|
2013-02-08 14:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Else, if an RNA type or property is specified, use its context. */
|
2013-02-09 18:17:20 +00:00
|
|
|
#if 0
|
|
|
|
|
/* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA struct corresponding
|
|
|
|
|
* to the 'data' (in functions like prop() & co), as this is pure runtime data. Hence, messages extraction
|
|
|
|
|
* script can't determine the correct context it should use for such 'text' messages...
|
|
|
|
|
* So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc. functions,
|
|
|
|
|
* if default context is not suitable.
|
|
|
|
|
*/
|
2013-02-08 14:29:38 +00:00
|
|
|
if (prop) {
|
2015-08-16 17:32:01 +10:00
|
|
|
return BLT_pgettext(RNA_property_translation_context(prop), text);
|
2013-02-08 14:29:38 +00:00
|
|
|
}
|
2013-02-09 18:17:20 +00:00
|
|
|
#else
|
|
|
|
|
(void)prop;
|
|
|
|
|
#endif
|
2013-02-08 14:29:38 +00:00
|
|
|
if (type) {
|
2015-08-16 17:32:01 +10:00
|
|
|
return BLT_pgettext(RNA_struct_translation_context(type), text);
|
2013-02-08 14:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
2013-02-09 18:17:20 +00:00
|
|
|
/* Else, default context! */
|
2015-08-16 17:32:01 +10:00
|
|
|
return BLT_pgettext(BLT_I18NCONTEXT_DEFAULT, text);
|
2013-02-08 14:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt,
|
|
|
|
|
int translate, int icon, int expand, int slider, int toggle, int icon_only, int event,
|
2013-11-23 18:43:23 +01:00
|
|
|
int full_event, int emboss, int index, int icon_value)
|
2009-08-21 12:57:47 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
int flag = 0;
|
2009-08-21 12:57:47 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (!prop) {
|
2011-09-09 01:29:53 +00:00
|
|
|
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
2009-11-26 15:03:55 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-23 18:43:23 +01:00
|
|
|
if (icon_value && !icon) {
|
|
|
|
|
icon = icon_value;
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
|
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
flag |= (slider) ? UI_ITEM_R_SLIDER : 0;
|
|
|
|
|
flag |= (expand) ? UI_ITEM_R_EXPAND : 0;
|
|
|
|
|
flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0;
|
|
|
|
|
flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
|
|
|
|
|
flag |= (event) ? UI_ITEM_R_EVENT : 0;
|
|
|
|
|
flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
static void rna_uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
|
|
|
|
|
const char *text_ctxt, int translate, int icon)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
|
|
|
|
|
if (!prop) {
|
|
|
|
|
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
|
2014-11-24 21:03:00 +01:00
|
|
|
uiItemMenuEnumR_prop(layout, ptr, prop, name, icon);
|
2013-02-08 14:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value,
|
|
|
|
|
const char *name, const char *text_ctxt, int translate, int icon)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
|
|
|
|
|
if (!prop) {
|
|
|
|
|
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
|
|
|
|
|
|
|
|
|
|
/* XXX This will search property again :( */
|
|
|
|
|
uiItemEnumR_string(layout, ptr, propname, value, name, icon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
|
|
|
|
|
struct PointerRNA *searchptr, const char *searchpropname,
|
|
|
|
|
const char *name, const char *text_ctxt, int translate, int icon)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
|
|
|
|
|
if (!prop) {
|
|
|
|
|
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
|
|
|
|
|
|
|
|
|
|
/* XXX This will search property again :( */
|
|
|
|
|
uiItemPointerR(layout, ptr, propname, searchptr, searchpropname, name, icon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
|
2014-11-16 15:45:00 +01:00
|
|
|
int translate, int icon, int emboss, int icon_value)
|
2009-08-21 12:57:47 +00:00
|
|
|
{
|
2013-02-08 16:18:24 +00:00
|
|
|
wmOperatorType *ot;
|
|
|
|
|
int flag;
|
2013-02-08 14:29:38 +00:00
|
|
|
|
2013-02-08 16:18:24 +00:00
|
|
|
ot = WM_operatortype_find(opname, 0); /* print error next */
|
2013-02-08 14:29:38 +00:00
|
|
|
if (!ot || !ot->srna) {
|
|
|
|
|
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
|
|
|
|
|
return PointerRNA_NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
|
|
|
|
|
|
2014-11-16 15:45:00 +01:00
|
|
|
if (icon_value && !icon) {
|
|
|
|
|
icon = icon_value;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-31 16:58:26 +11:00
|
|
|
flag = 0;
|
2012-05-12 11:01:29 +00:00
|
|
|
flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
|
2013-02-08 14:29:38 +00:00
|
|
|
|
2017-10-31 16:58:26 +11:00
|
|
|
PointerRNA opptr;
|
|
|
|
|
uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag, &opptr);
|
|
|
|
|
return opptr;
|
2009-08-21 12:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
2013-05-10 23:41:41 +00:00
|
|
|
static void rna_uiItemMenuEnumO(uiLayout *layout, bContext *C, const char *opname, const char *propname, const char *name,
|
2013-02-08 14:29:38 +00:00
|
|
|
const char *text_ctxt, int translate, int icon)
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
{
|
2013-02-08 14:29:38 +00:00
|
|
|
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
|
|
|
|
|
|
|
|
|
|
if (!ot || !ot->srna) {
|
|
|
|
|
RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
|
|
|
|
|
|
2017-10-31 12:44:41 +11:00
|
|
|
uiItemMenuEnumO_ptr(layout, C, ot, propname, name, icon);
|
2013-02-08 14:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_uiItemL(uiLayout *layout, const char *name, const char *text_ctxt, int translate,
|
|
|
|
|
int icon, int icon_value)
|
|
|
|
|
{
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
|
|
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
if (icon_value && !icon) {
|
|
|
|
|
icon = icon_value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uiItemL(layout, name, icon);
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
static void rna_uiItemM(uiLayout *layout, bContext *C, const char *menuname, const char *name, const char *text_ctxt,
|
2015-06-10 17:35:46 +10:00
|
|
|
int translate, int icon, int icon_value)
|
2013-02-08 14:29:38 +00:00
|
|
|
{
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
|
|
|
|
|
|
2015-06-10 17:35:46 +10:00
|
|
|
if (icon_value && !icon) {
|
|
|
|
|
icon = icon_value;
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
uiItemM(layout, C, menuname, name, icon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
|
|
|
|
|
const char *name, const char *text_ctxt, int translate)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
|
|
|
|
|
if (!prop) {
|
|
|
|
|
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
|
|
|
|
|
|
|
|
|
|
/* XXX This will search property again :( */
|
|
|
|
|
uiTemplateAnyID(layout, ptr, propname, proptypename, name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *root_ptr,
|
|
|
|
|
const char *name, const char *text_ctxt, int translate)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
|
|
|
|
|
if (!prop) {
|
|
|
|
|
RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get translated name (label). */
|
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
|
|
|
|
|
|
|
|
|
|
/* XXX This will search property again :( */
|
|
|
|
|
uiTemplatePathBuilder(layout, ptr, propname, root_ptr, name);
|
|
|
|
|
}
|
|
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
|
|
|
|
|
{
|
2013-04-04 02:05:11 +00:00
|
|
|
return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = NULL;
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem *items = NULL, *item;
|
2014-01-04 18:08:43 +11:00
|
|
|
bool free;
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
const char *name = "";
|
|
|
|
|
|
|
|
|
|
prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
|
|
|
|
|
RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
|
|
|
|
|
|
|
|
|
|
if (items) {
|
|
|
|
|
for (item = items; item->identifier; item++) {
|
2015-01-26 16:03:11 +01:00
|
|
|
if (item->identifier[0] && STREQ(item->identifier, identifier)) {
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
name = item->name;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (free) {
|
2017-10-18 15:07:26 +11:00
|
|
|
MEM_freeN((void *)items);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, const char *propname,
|
|
|
|
|
const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = NULL;
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem *items = NULL, *item;
|
2014-01-04 18:08:43 +11:00
|
|
|
bool free;
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
const char *desc = "";
|
|
|
|
|
|
|
|
|
|
prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
|
|
|
|
|
RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
|
|
|
|
return desc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
|
|
|
|
|
|
|
|
|
|
if (items) {
|
|
|
|
|
for (item = items; item->identifier; item++) {
|
2015-01-26 16:03:11 +01:00
|
|
|
if (item->identifier[0] && STREQ(item->identifier, identifier)) {
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
desc = item->description;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (free) {
|
2017-10-18 15:07:26 +11:00
|
|
|
MEM_freeN((void *)items);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return desc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = NULL;
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem *items = NULL, *item;
|
2014-01-04 18:08:43 +11:00
|
|
|
bool free;
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
int icon = ICON_NONE;
|
|
|
|
|
|
|
|
|
|
prop = RNA_struct_find_property(ptr, propname);
|
|
|
|
|
if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
|
|
|
|
|
RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
|
|
|
|
|
return icon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RNA_property_enum_items(C, ptr, prop, &items, NULL, &free);
|
|
|
|
|
|
|
|
|
|
if (items) {
|
|
|
|
|
for (item = items; item->identifier; item++) {
|
2015-01-26 16:03:11 +01:00
|
|
|
if (item->identifier[0] && STREQ(item->identifier, identifier)) {
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
icon = item->icon;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (free) {
|
2017-10-18 15:07:26 +11:00
|
|
|
MEM_freeN((void *)items);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return icon;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-18 19:48:55 +00:00
|
|
|
#else
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
static void api_ui_item_common_text(FunctionRNA *func)
|
|
|
|
|
{
|
2014-01-16 21:43:22 +11:00
|
|
|
RNA_def_string(func, "text", NULL, 0, "", "Override automatic text of the item");
|
|
|
|
|
RNA_def_string(func, "text_ctxt", NULL, 0, "", "Override automatic translation context of the given text");
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "translate", true, "", "Translate the given text, when UI translation is enabled");
|
2013-02-08 14:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
api_ui_item_common_text(func);
|
2009-06-15 20:28:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_icon_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
|
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;
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_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;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2009-06-16 00:52:21 +00:00
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem curve_type_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{0, "NONE", 0, "None", ""},
|
|
|
|
|
{'v', "VECTOR", 0, "Vector", ""},
|
|
|
|
|
{'c', "COLOR", 0, "Color", ""},
|
2012-08-19 15:41:56 +00:00
|
|
|
{'h', "HUE", 0, "Hue", ""},
|
2012-05-12 11:01:29 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}
|
|
|
|
|
};
|
2009-06-03 00:14:12 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
static float node_socket_color_default[] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
|
|
|
|
|
2009-04-16 12:17:58 +00:00
|
|
|
/* simple layout specifiers */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "row", "uiLayoutRow");
|
|
|
|
|
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
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_function_return(func, parm);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_function_ui_description(func,
|
|
|
|
|
"Sub-layout. Items placed in this sublayout are placed next to each other "
|
|
|
|
|
"in a row");
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
|
2010-08-07 18:34:16 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "column", "uiLayoutColumn");
|
|
|
|
|
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
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_function_return(func, parm);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_function_ui_description(func,
|
|
|
|
|
"Sub-layout. Items placed in this sublayout are placed under each other "
|
|
|
|
|
"in a column");
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
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_function_return(func, parm);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
|
2009-04-08 16:40:46 +00:00
|
|
|
|
2009-04-16 12:17:58 +00:00
|
|
|
/* box layout */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "box", "uiLayoutBox");
|
|
|
|
|
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
2009-04-16 12:17:58 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Sublayout (items placed in this sublayout are placed "
|
2012-05-12 11:01:29 +00:00
|
|
|
"under each other in a column and are surrounded by a box)");
|
2010-08-07 18:34:16 +00:00
|
|
|
|
2009-04-16 12:17:58 +00:00
|
|
|
/* split layout */
|
2012-03-05 23:30:41 +00:00
|
|
|
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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
|
2009-04-08 16:40:46 +00:00
|
|
|
|
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
2014-08-11 10:39:59 +02:00
|
|
|
/* radial/pie layout */
|
|
|
|
|
func = RNA_def_function(srna, "menu_pie", "uiLayoutRadial");
|
|
|
|
|
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
RNA_def_function_ui_description(func, "Sublayout. Items placed in this sublayout are placed "
|
|
|
|
|
"in a radial fashion around the menu center)");
|
|
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
/* Icon of a rna pointer */
|
|
|
|
|
func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon");
|
|
|
|
|
parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
|
|
|
|
|
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
RNA_def_function_ui_description(func, "Return the custom icon for this data, "
|
|
|
|
|
"use it e.g. to get materials or texture icons");
|
|
|
|
|
|
|
|
|
|
/* UI name, description and icon of an enum item */
|
|
|
|
|
func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name");
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "name", NULL, 0, "", "UI name of the enum item");
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
|
|
|
|
|
api_ui_item_rna_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
RNA_def_function_ui_description(func, "Return the UI name for this enum item");
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description");
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "description", NULL, 0, "", "UI description of the enum item");
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
|
|
|
|
|
api_ui_item_rna_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
RNA_def_function_ui_description(func, "Return the UI description for this enum item");
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon");
|
|
|
|
|
parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
|
|
|
|
|
api_ui_item_rna_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
RNA_def_function_ui_description(func, "Return the icon for this enum item");
|
|
|
|
|
|
2009-04-08 16:40:46 +00:00
|
|
|
/* items */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "prop", "rna_uiItemR");
|
2011-09-19 13:23:58 +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);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
|
|
|
|
|
RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values");
|
|
|
|
|
RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values");
|
|
|
|
|
RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
|
|
|
|
|
RNA_def_boolean(func, "event", false, "", "Use button to input key events");
|
|
|
|
|
RNA_def_boolean(func, "full_event", false, "", "Use button to input full events including modifiers");
|
|
|
|
|
RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text");
|
2011-09-19 13:23:58 +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 */
|
2013-11-23 18:43:23 +01:00
|
|
|
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
|
2015-06-10 17:35:46 +10:00
|
|
|
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
|
2009-04-08 16:40:46 +00:00
|
|
|
|
2012-03-05 23:30:41 +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
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
func = RNA_def_function(srna, "prop_menu_enum", "rna_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
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
|
2009-06-16 00:52:21 +00:00
|
|
|
api_ui_item_rna_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_common(func);
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR");
|
2009-06-27 01:15:31 +00:00
|
|
|
api_ui_item_rna_common(func);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_common(func);
|
2009-06-27 01:15:31 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "operator", "rna_uiItemO");
|
2009-04-22 18:39:44 +00:00
|
|
|
api_ui_item_op_common(func);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text");
|
2014-11-16 15:45:00 +01:00
|
|
|
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
|
2015-06-10 17:35:46 +10:00
|
|
|
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
|
2017-06-26 07:36:29 +10:00
|
|
|
parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
|
2009-08-21 12:57:47 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2011-09-19 13:23:58 +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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
|
2013-05-10 23:41:41 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
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 */
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_common(func);
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
/* useful in C but not in python */
|
|
|
|
|
#if 0
|
|
|
|
|
|
2012-10-26 04:14:10 +00:00
|
|
|
func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
|
2012-05-12 11:01:29 +00:00
|
|
|
api_ui_item_op_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-05-12 11:01:29 +00:00
|
|
|
|
2012-10-26 04:14:10 +00:00
|
|
|
func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
|
2009-04-22 18:39:44 +00:00
|
|
|
api_ui_item_op_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2013-08-24 03:16:22 +00:00
|
|
|
parm = RNA_def_boolean(func, "value", false, "", "Value of the property to call the operator with");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2012-10-26 04:14:10 +00:00
|
|
|
func = RNA_def_function(srna, "operator_int", "uiItemIntO");
|
2009-04-22 18:39:44 +00:00
|
|
|
api_ui_item_op_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
|
2011-09-19 13:23:58 +00:00
|
|
|
"Value of the property to call the operator with", INT_MIN, INT_MAX);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2012-10-26 04:14:10 +00:00
|
|
|
func = RNA_def_function(srna, "operator_float", "uiItemFloatO");
|
2009-04-22 18:39:44 +00:00
|
|
|
api_ui_item_op_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
|
2011-09-19 13:23:58 +00:00
|
|
|
"Value of the property to call the operator with", -FLT_MAX, FLT_MAX);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2012-10-26 04:14:10 +00:00
|
|
|
func = RNA_def_function(srna, "operator_string", "uiItemStringO");
|
2009-04-22 18:39:44 +00:00
|
|
|
api_ui_item_op_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "value", NULL, 0, "", "Value of the property to call the operator with");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-05-12 11:01:29 +00:00
|
|
|
#endif
|
2009-04-08 16:40:46 +00:00
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
func = RNA_def_function(srna, "label", "rna_uiItemL");
|
2016-09-05 10:58:33 +02:00
|
|
|
RNA_def_function_ui_description(func, "Item. Displays text and/or icon in the layout");
|
2013-03-15 10:48:48 +00:00
|
|
|
api_ui_item_common(func);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
|
2015-06-10 17:35:46 +10:00
|
|
|
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
func = RNA_def_function(srna, "menu", "rna_uiItemM");
|
2009-06-23 00:19:10 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_common(func);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2015-06-10 17:35:46 +10:00
|
|
|
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "separator", "uiItemS");
|
2011-09-19 13:23:58 +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 */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of entry in the context");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
|
2009-12-16 10:13:26 +00:00
|
|
|
|
2009-04-22 18:39:44 +00:00
|
|
|
/* templates */
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_header", "uiTemplateHeader");
|
2009-06-23 00:19:10 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2016-09-05 10:58:33 +02:00
|
|
|
RNA_def_function_ui_description(func, "Inserts common Space header UI (editor type selector)");
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2012-03-05 23:30: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);
|
2014-01-16 21:43:22 +11:00
|
|
|
RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
|
|
|
|
|
RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
|
|
|
|
|
RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
|
2009-10-14 09:08:53 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
|
2010-01-03 08:37:18 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
api_ui_item_rna_common(func);
|
2014-01-16 21:43:22 +11:00
|
|
|
RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
|
|
|
|
|
RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
|
|
|
|
|
RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
|
2010-01-03 08:37:18 +00:00
|
|
|
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);
|
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "type_property", NULL, 0, "",
|
2012-05-12 11:01:29 +00:00
|
|
|
"Identifier of property in data giving the type of the ID-blocks to use");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2013-02-08 14:29:38 +00:00
|
|
|
api_ui_item_common_text(func);
|
2009-10-14 09:08:53 +00:00
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
|
2013-02-08 14:29:38 +00:00
|
|
|
api_ui_item_common_text(func);
|
2009-10-15 10:13:59 +00:00
|
|
|
|
2012-03-05 23:30:41 +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);
|
2015-02-11 18:38:41 +11:00
|
|
|
RNA_def_function_ui_description(func, "Generates the UI layout for modifiers");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
2009-05-21 15:34:09 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2009-05-27 00:03:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
|
2015-02-11 18:38:41 +11:00
|
|
|
RNA_def_function_ui_description(func, "Generates the UI layout for constraints");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
2009-05-27 00:03:49 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2009-05-28 23:41:12 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
|
Add drag-resize to uiTemplatePreview (mat/tex/etc. preview widget).
This is done by adding a new button type, GRIP, similar to other numbuttons
(scroll, slider, ...), which here controls the preview height.
Then, we add a new DNA struct to be able to save that height in Blend files
(note I choose not to use Panel struct for this, because we would then have the
same limitation we used to have with uiLists, only one preview per panel
and no preview outside panel).
This implies a change to template_preview UI RNA/py API (each preview needs an ID),
but this is backward compatible, as by default datablock type will be used if no ID is
given (which means e.g. all material previews with no ID will have same height).
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D342
2014-04-02 12:59:48 +02:00
|
|
|
RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps or worlds");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2015-10-24 02:44:43 +11:00
|
|
|
parm = RNA_def_pointer(func, "id", "ID", "", "ID data-block");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "show_buttons", true, "", "Show preview buttons?");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_pointer(func, "parent", "ID", "", "ID data-block");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");
|
Add drag-resize to uiTemplatePreview (mat/tex/etc. preview widget).
This is done by adding a new button type, GRIP, similar to other numbuttons
(scroll, slider, ...), which here controls the preview height.
Then, we add a new DNA struct to be able to save that height in Blend files
(note I choose not to use Panel struct for this, because we would then have the
same limitation we used to have with uiLists, only one preview per panel
and no preview outside panel).
This implies a change to template_preview UI RNA/py API (each preview needs an ID),
but this is backward compatible, as by default datablock type will be used if no ID is
given (which means e.g. all material previews with no ID will have same height).
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D342
2014-04-02 12:59:48 +02:00
|
|
|
RNA_def_string(func, "preview_id", NULL, 0, "",
|
|
|
|
|
"Identifier of this preview widget, if not set the ID type will be used "
|
|
|
|
|
"(i.e. all previews of materials without explicit ID will have the same size...)");
|
2009-05-28 23:41:12 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
|
2011-09-19 13:23:58 +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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "levels", false, "", "Show black/white levels");
|
|
|
|
|
RNA_def_boolean(func, "brush", false, "", "Show brush options");
|
2014-06-30 16:20:02 +02:00
|
|
|
RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default");
|
2009-06-03 00:14:12 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
|
2011-09-19 13:23:58 +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);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
|
2015-05-22 21:31:26 +01:00
|
|
|
|
2013-01-22 11:18:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView");
|
|
|
|
|
RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews");
|
|
|
|
|
api_ui_item_rna_common(func);
|
2015-05-22 21:31:26 +01:00
|
|
|
RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons");
|
2015-07-14 01:46:25 +10:00
|
|
|
RNA_def_float(func, "scale", 5.0f, 1.0f, 100.0f, "Scale", "Scale the icon size (by the button size)", 1.0f, 100.0f);
|
2015-05-22 21:31:26 +01:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
|
2011-09-19 13:23:58 +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);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
|
2011-09-19 13:23:58 +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);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
|
2011-09-19 13:23:58 +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);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_layers", "uiTemplateLayers");
|
2009-06-16 00:52:21 +00:00
|
|
|
api_ui_item_rna_common(func);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "used_layers_property", NULL, 0, "", "Identifier of property in data");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2009-07-21 12:38:01 +00:00
|
|
|
|
2012-11-09 11:03:53 +00:00
|
|
|
func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker");
|
2011-09-19 13:23:58 +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);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "value_slider", false, "", "Display the value slider to the right of the color wheel");
|
|
|
|
|
RNA_def_boolean(func, "lock", false, "", "Lock the color wheel display to value 1.0 regardless of actual color");
|
|
|
|
|
RNA_def_boolean(func, "lock_luminosity", false, "", "Keep the color at its original vector length");
|
2014-03-14 02:11:34 +02:00
|
|
|
RNA_def_boolean(func, "cubic", false, "", "Cubic saturation for picking values close to white");
|
2009-06-23 00:45:41 +00:00
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
func = RNA_def_function(srna, "template_palette", "uiTemplatePalette");
|
|
|
|
|
RNA_def_function_ui_description(func, "Item. A palette used to pick colors");
|
|
|
|
|
api_ui_item_rna_common(func);
|
|
|
|
|
RNA_def_boolean(func, "color", 0, "", "Display the colors as colors or values");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
|
2009-06-23 00:45:41 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "image", "Image", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2009-06-24 14:16:56 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_image", "uiTemplateImage");
|
2011-09-19 13:23:58 +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);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
|
2015-06-13 14:04:39 -03:00
|
|
|
RNA_def_boolean(func, "multiview", false, "", "Expose Multi-View options");
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
|
2011-11-21 20:19:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "User interface for setting image format options");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "color_management", false, "", "Show color management settings");
|
2011-11-21 20:19:58 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d");
|
|
|
|
|
RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options");
|
|
|
|
|
parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews");
|
|
|
|
|
RNA_def_function_ui_description(func, "User interface for setting image views output options");
|
|
|
|
|
parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
api_ui_item_rna_common(func);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
|
2011-11-07 12:55:18 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_track", "uiTemplateTrack");
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
|
|
|
|
|
api_ui_item_rna_common(func);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_marker", "uiTemplateMarker");
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
|
|
|
|
|
api_ui_item_rna_common(func);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2013-08-24 03:16:22 +00:00
|
|
|
RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
|
2011-11-07 12:55:18 +00:00
|
|
|
|
2013-04-22 11:19:12 +00:00
|
|
|
func = RNA_def_function(srna, "template_movieclip_information", "uiTemplateMovieclipInformation");
|
|
|
|
|
RNA_def_function_ui_description(func, "Item. Movie clip information data.");
|
|
|
|
|
api_ui_item_rna_common(func);
|
|
|
|
|
parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2013-04-22 11:19:12 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_list", "uiTemplateList");
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20: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);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "listtype_name", NULL, 0, "", "Identifier of the list type to use");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "list_id", NULL, 0, "",
|
2013-02-18 14:03:26 +00:00
|
|
|
"Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
|
|
|
|
|
"\" class). "
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
"If this is set, the uilist gets a custom ID, otherwise it takes the "
|
|
|
|
|
"name of the class used to define the uilist (for example, if the "
|
|
|
|
|
"class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
|
|
|
|
|
"script, then bl_idname = \"OBJECT_UL_vgroups\")");
|
|
|
|
|
parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "propname", NULL, 0, "", "Identifier of the Collection property in data");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "",
|
|
|
|
|
"Data from which to take the integer property, index of the active item");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "active_propname", NULL, 0, "",
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
"Identifier of the integer property in active_data, index of the active item");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2015-02-11 00:06:03 +01:00
|
|
|
RNA_def_string(func, "item_dyntip_propname", NULL, 0, "",
|
|
|
|
|
"Identifier of a string property in items, to use as tooltip content");
|
2013-08-27 15:27:41 +00:00
|
|
|
RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Default and minimum number of rows to display", 0, INT_MAX);
|
|
|
|
|
RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX);
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_enum(func, "type", rna_enum_uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use");
|
2013-08-27 15:27:41 +00:00
|
|
|
RNA_def_int(func, "columns", 9, 0, INT_MAX, "", "Number of items to display per row, for GRID layout", 0, INT_MAX);
|
2009-06-30 19:20:45 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
|
2009-06-30 19:20:45 +00:00
|
|
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D");
|
2009-07-11 13:32:20 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2016-09-05 10:58:33 +02:00
|
|
|
RNA_def_function_ui_description(func, "Inserts common 3DView header UI (selectors for context mode, shading, etc.)");
|
|
|
|
|
|
2011-05-02 11:34:57 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
|
2011-05-02 11:34:57 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2016-09-05 10:58:33 +02:00
|
|
|
RNA_def_function_ui_description(func, "Inserts common 3DView Edit modes header UI (selector for selection mode)");
|
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
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
|
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
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2009-11-28 17:45:23 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
|
|
|
|
|
parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "node", "Node", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2011-11-07 22:28:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
|
2011-11-07 22:28:49 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "node", "Node", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2011-11-07 22:28:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
|
2011-11-08 13:07:16 +00:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
|
|
|
|
|
parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
2011-10-04 13:24:48 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
|
|
|
|
|
RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
|
|
|
|
|
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2014-01-16 21:43:22 +11:00
|
|
|
RNA_def_string(func, "name", NULL, 0, "", "");
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
|
2014-01-16 21:43:22 +11:00
|
|
|
parm = RNA_def_string(func, "string", NULL, 1024 * 1024, "Descr", "DESCR");
|
2009-11-28 17:45:23 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
|
|
|
|
/* color management templates */
|
|
|
|
|
func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings");
|
|
|
|
|
RNA_def_function_ui_description(func, "Item. A widget to control input color space settings.");
|
|
|
|
|
api_ui_item_rna_common(func);
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings");
|
|
|
|
|
RNA_def_function_ui_description(func, "Item. A widget to control color managed view settings settings.");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
api_ui_item_rna_common(func);
|
2013-08-24 03:16:22 +00:00
|
|
|
/* RNA_def_boolean(func, "show_global_settings", false, "", "Show widgets to control global color management settings"); */
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
|
/* node socket icon */
|
|
|
|
|
func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket");
|
|
|
|
|
RNA_def_function_ui_description(func, "Node Socket Icon");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
RNA_def_float_array(func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "template_cache_file", "uiTemplateCacheFile");
|
|
|
|
|
RNA_def_function_ui_description(func, "Item(s). User interface for selecting cache files and their source paths");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
api_ui_item_rna_common(func);
|
2009-04-08 16:40:46 +00:00
|
|
|
}
|
2009-06-18 19:48:55 +00:00
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
#endif
|