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"
|
|
|
|
|
|
|
|
#include "BLF_translation.h"
|
|
|
|
|
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), ""},
|
|
|
|
EnumPropertyItem icon_items[] = {
|
|
|
|
#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. */
|
|
|
|
if (!text || !text[0] || !translate || !BLF_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]) {
|
2013-02-09 18:17:20 +00:00
|
|
|
return BLF_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) {
|
2013-02-09 18:17:20 +00:00
|
|
|
return BLF_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) {
|
2013-02-09 18:17:20 +00:00
|
|
|
return BLF_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! */
|
|
|
|
return BLF_pgettext(BLF_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,
|
|
|
|
int full_event, int emboss, int index)
|
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-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);
|
|
|
|
|
|
|
|
/* XXX This will search property again :( */
|
|
|
|
uiItemMenuEnumR(layout, ptr, propname, name, icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
int translate, int icon, int emboss)
|
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);
|
|
|
|
|
2013-02-08 16:18:24 +00:00
|
|
|
flag = UI_ITEM_O_RETURN_PROPS;
|
2012-05-12 11:01:29 +00:00
|
|
|
flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
|
2013-02-08 14:29:38 +00:00
|
|
|
|
|
|
|
return uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
|
2009-08-21 12:57:47 +00:00
|
|
|
}
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
static void rna_uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, const char *name,
|
|
|
|
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);
|
|
|
|
|
|
|
|
/* XXX This will search operator again :( */
|
|
|
|
uiItemMenuEnumO(layout, opname, propname, name, icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
int translate, int icon)
|
|
|
|
{
|
|
|
|
/* Get translated name (label). */
|
|
|
|
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
|
|
|
|
|
|
|
|
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;
|
|
|
|
EnumPropertyItem *items = NULL, *item;
|
|
|
|
int free;
|
|
|
|
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++) {
|
|
|
|
if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
|
|
|
|
name = item->name;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (free) {
|
|
|
|
MEM_freeN(items);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, const char *propname,
|
|
|
|
const char *identifier)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop = NULL;
|
|
|
|
EnumPropertyItem *items = NULL, *item;
|
|
|
|
int free;
|
|
|
|
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++) {
|
|
|
|
if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
|
|
|
|
desc = item->description;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (free) {
|
|
|
|
MEM_freeN(items);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return desc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop = NULL;
|
|
|
|
EnumPropertyItem *items = NULL, *item;
|
|
|
|
int free;
|
|
|
|
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++) {
|
|
|
|
if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
|
|
|
|
icon = item->icon;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (free) {
|
|
|
|
MEM_freeN(items);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
RNA_def_string(func, "text", "", 0, "", "Override automatic text of the item");
|
|
|
|
RNA_def_string(func, "text_ctxt", "", 0, "", "Override automatic translation context of the given text");
|
|
|
|
RNA_def_boolean(func, "translate", true, "", "Translate the given text, when UI translation is enabled");
|
|
|
|
}
|
|
|
|
|
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);
|
2009-06-15 20:28:49 +00:00
|
|
|
RNA_def_property_enum_items(prop, icon_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
|
2009-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;
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator");
|
2010-06-26 20:00:45 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2010-03-23 15:25:33 +00:00
|
|
|
}
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2010-03-23 15:25:33 +00:00
|
|
|
static void api_ui_item_op_common(FunctionRNA *func)
|
|
|
|
{
|
|
|
|
api_ui_item_op(func);
|
2009-04-22 18:39:44 +00:00
|
|
|
api_ui_item_common(func);
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:52:21 +00:00
|
|
|
static void api_ui_item_rna_common(FunctionRNA *func)
|
|
|
|
{
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
|
2009-06-16 00:52:21 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
}
|
|
|
|
|
2009-04-08 16:40:46 +00:00
|
|
|
void RNA_api_ui_layout(StructRNA *srna)
|
|
|
|
{
|
|
|
|
FunctionRNA *func;
|
2009-04-11 01:52:27 +00:00
|
|
|
PropertyRNA *parm;
|
|
|
|
|
2009-06-03 00:14:12 +00:00
|
|
|
static EnumPropertyItem curve_type_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{0, "NONE", 0, "None", ""},
|
|
|
|
{'v', "VECTOR", 0, "Vector", ""},
|
|
|
|
{'c', "COLOR", 0, "Color", ""},
|
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");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "align", 0, "", "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");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "align", 0, "", "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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
|
2009-04-08 16:40:46 +00:00
|
|
|
|
2009-04-16 12:17:58 +00:00
|
|
|
/* box layout */
|
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);
|
|
|
|
RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
|
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
|
|
|
/* 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");
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
|
|
|
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");
|
|
|
|
parm = RNA_def_string(func, "name", "", 0, "", "UI name of the enum item");
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
|
|
|
|
api_ui_item_rna_common(func);
|
|
|
|
parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
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");
|
|
|
|
parm = RNA_def_string(func, "description", "", 0, "", "UI description of the enum item");
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
|
|
|
|
api_ui_item_rna_common(func);
|
|
|
|
parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
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);
|
|
|
|
parm = RNA_def_string(func, "identifier", "", 0, "", "Identifier of the enum item");
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail");
|
|
|
|
RNA_def_boolean(func, "slider", 0, "", "Use slider widget for numeric values");
|
|
|
|
RNA_def_boolean(func, "toggle", 0, "", "Use toggle widget for boolean values");
|
|
|
|
RNA_def_boolean(func, "icon_only", 0, "", "Draw only icons in buttons, no text");
|
|
|
|
RNA_def_boolean(func, "event", 0, "", "Use button to input key events");
|
|
|
|
RNA_def_boolean(func, "full_event", 0, "", "Use button to input full events including modifiers");
|
|
|
|
RNA_def_boolean(func, "emboss", 1, "", "Draw the button itself, just the icon/text");
|
|
|
|
RNA_def_int(func, "index", -1, -2, INT_MAX, "",
|
|
|
|
"The index of this button, when set a single member of an array can be accessed, "
|
|
|
|
"when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */
|
2009-04-08 16:40:46 +00:00
|
|
|
|
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);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "value", "", 0, "", "Enum property value");
|
2009-07-02 19:41:31 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_common(func);
|
2009-04-22 18:39:44 +00:00
|
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "search_property", "", 0, "", "Identifier of search collection property");
|
2009-06-27 01:15:31 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_common(func);
|
2009-06-27 01:15:31 +00:00
|
|
|
|
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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "emboss", 1, "", "Draw the button itself, just the icon/text");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "properties", "OperatorProperties", "",
|
2012-05-12 11:01:29 +00:00
|
|
|
"Operator properties to fill in, return when 'properties' is set to true");
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_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");
|
|
|
|
parm = RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator");
|
2009-04-11 01:52:27 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
|
2009-04-22 18:39:44 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
2013-02-08 14:29:38 +00:00
|
|
|
func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
|
2009-04-22 18:39:44 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_common(func);
|
2009-04-22 18:39:44 +00:00
|
|
|
|
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);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_string(func, "value", "", 0, "", "Enum property value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
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);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
|
2009-04-22 18:39:44 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with");
|
2009-11-23 11:43:38 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED); */
|
2009-04-22 18:39:44 +00:00
|
|
|
|
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);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
|
2009-04-22 18:39:44 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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);
|
2009-11-23 11:43:38 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
|
2009-04-22 18:39:44 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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);
|
2009-11-23 11:43:38 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
|
2009-04-22 18:39:44 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-10-26 04:14:10 +00:00
|
|
|
parm = RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
#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");
|
|
|
|
RNA_def_function_ui_description(func, "Item. Display 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);
|
|
|
|
RNA_def_property_ui_text(parm, "Icon Value",
|
|
|
|
"Override automatic icon of the item "
|
|
|
|
"(use it e.g. with custom material icons returned by icon()...)");
|
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);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu");
|
2010-03-23 15:25:33 +00:00
|
|
|
api_ui_item_common(func);
|
2009-04-22 18:39:44 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
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");
|
|
|
|
parm = RNA_def_string(func, "name", "", 0, "Name", "Name of entry in the context");
|
2009-05-28 23:13:42 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
|
2009-12-16 10:13:26 +00:00
|
|
|
|
2009-04-22 18:39:44 +00:00
|
|
|
/* templates */
|
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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "menus", 1, "", "The header has menus, and should show menu expander");
|
2009-04-22 18:39:44 +00:00
|
|
|
|
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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block");
|
|
|
|
RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block");
|
|
|
|
RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block");
|
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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block");
|
|
|
|
RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block");
|
|
|
|
RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block");
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
|
2009-10-14 09:08:53 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "type_property", "", 0, "",
|
2012-05-12 11:01:29 +00:00
|
|
|
"Identifier of property in data giving the type of the ID-blocks to use");
|
2009-10-14 09:08:53 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
|
2009-10-15 10:13:59 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Layout . Generates the UI layout for modifiers");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
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");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Layout . Generates the UI layout for constraints");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
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");
|
2011-09-23 13:31:48 +00:00
|
|
|
RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps, etc");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "id", "ID", "", "ID datablock");
|
2009-05-28 23:41:12 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2011-01-13 04:53:55 +00:00
|
|
|
RNA_def_boolean(func, "show_buttons", 1, "", "Show preview buttons?");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_pointer(func, "parent", "ID", "", "ID datablock");
|
|
|
|
RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");
|
2009-05-28 23:41:12 +00:00
|
|
|
|
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");
|
|
|
|
RNA_def_boolean(func, "levels", 0, "", "Show black/white levels");
|
|
|
|
RNA_def_boolean(func, "brush", 0, "", "Show brush options");
|
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);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail");
|
2009-06-13 11:21:02 +00: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);
|
|
|
|
|
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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_string(func, "used_layers_property", "", 0, "", "Identifier of property in data");
|
2009-11-29 02:42:47 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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);
|
2009-11-29 02:42:47 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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);
|
|
|
|
RNA_def_boolean(func, "value_slider", 0, "", "Display the value slider to the right of the color wheel");
|
2010-01-27 00:22:29 +00:00
|
|
|
RNA_def_boolean(func, "lock", 0, "", "Lock the color wheel display to value 1.0 regardless of actual color");
|
2010-07-04 20:59:10 +00:00
|
|
|
RNA_def_boolean(func, "lock_luminosity", 0, "", "Keep the color at its original vector length");
|
2010-07-05 15:52:25 +00:00
|
|
|
RNA_def_boolean(func, "cubic", 1, "", "Cubic saturation for picking values close to white");
|
2009-06-23 00:45:41 +00:00
|
|
|
|
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", "", "");
|
2009-06-23 00:45:41 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
|
2009-06-23 00:45:41 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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", "", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
|
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", "", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
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
|
|
|
RNA_def_boolean(func, "color_management", 0, "", "Show color management settings");
|
2011-11-21 20:19:58 +00: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);
|
|
|
|
RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
|
|
|
|
|
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", "", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
|
|
|
|
|
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);
|
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_string(func, "listtype_name", "", 0, "", "Identifier of the list type to use");
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
parm = RNA_def_string(func, "list_id", "", 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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_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
|
|
|
parm = RNA_def_string(func, "propname", "", 0, "", "Identifier of the Collection property in data");
|
2009-09-17 14:35:08 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_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");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
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_string(func, "active_propname", "", 0, "",
|
|
|
|
"Identifier of the integer property in active_data, index of the active item");
|
2009-06-24 14:16:56 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX);
|
|
|
|
RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX);
|
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_enum(func, "type", uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use");
|
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);
|
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);
|
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", "", "");
|
2011-11-07 22:28:49 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "node", "Node", "", "");
|
2011-11-07 22:28:49 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
|
2011-11-07 22:28:49 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
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", "", "");
|
2011-11-07 22:28:49 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "node", "Node", "", "");
|
2011-11-07 22:28:49 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
|
2011-11-07 22:28:49 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
|
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", "", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
|
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");
|
2013-03-18 18:25:05 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
|
2013-03-18 16:34:57 +00:00
|
|
|
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
|
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
|
|
|
RNA_def_string(func, "name", "", 0, "", "");
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
|
2012-05-12 11:01:29 +00:00
|
|
|
parm = RNA_def_string(func, "string", "", 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);
|
|
|
|
/* RNA_def_boolean(func, "show_global_settings", 0, "", "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);
|
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
|