Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-03-18 20:34:57 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-03-18 20:34:57 +0400
commit4638e5f99a9ba59ad0b8a1fd52b12e876480b9e8 (patch)
tree2444f12b4612440f44cf02835cdf5951b6564e92 /source/blender/makesrna/intern/rna_access.c
parent7bfef29f2f2a1b262d28abdc6e30fcd9c1f1caad (diff)
Merge of the PyNodes branch (aka "custom nodes") into trunk.
PyNodes opens up the node system in Blender to scripters and adds a number of UI-level improvements. === Dynamic node type registration === Node types can now be added at runtime, using the RNA registration mechanism from python. This enables addons such as render engines to create a complete user interface with nodes. Examples of how such nodes can be defined can be found in my personal wiki docs atm [1] and as a script template in release/scripts/templates_py/custom_nodes.py [2]. === Node group improvements === Each node editor now has a tree history of edited node groups, which allows opening and editing nested node groups. The node editor also supports pinning now, so that different spaces can be used to edit different node groups simultaneously. For more ramblings and rationale see (really old) blog post on code.blender.org [3]. The interface of node groups has been overhauled. Sockets of a node group are no longer displayed in columns on either side, but instead special input/output nodes are used to mirror group sockets inside a node tree. This solves the problem of long node lines in groups and allows more adaptable node layout. Internal sockets can be exposed from a group by either connecting to the extension sockets in input/output nodes (shown as empty circle) or by adding sockets from the node property bar in the "Interface" panel. Further details such as the socket name can also be changed there. [1] http://wiki.blender.org/index.php/User:Phonybone/Python_Nodes [2] http://projects.blender.org/scm/viewvc.php/trunk/blender/release/scripts/templates_py/custom_nodes.py?view=markup&root=bf-blender [3] http://code.blender.org/index.php/2012/01/improving-node-group-interface-editing/
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index f3efbd0d53e..92ce8122597 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -282,6 +282,20 @@ static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
return NULL;
}
+static void rna_idproperty_free(PointerRNA *ptr, const char *name)
+{
+ IDProperty *group = RNA_struct_idprops(ptr, 0);
+
+ if (group) {
+ IDProperty *idprop = IDP_GetPropertyFromGroup(group, name);
+ if (idprop) {
+ IDP_RemFromGroup(group, idprop);
+ IDP_FreeProperty(idprop);
+ MEM_freeN(idprop);
+ }
+ }
+}
+
static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
{
if (prop->magic == RNA_MAGIC) {
@@ -477,7 +491,7 @@ static const char *rna_ensure_property_description(PropertyRNA *prop)
description = ((IDProperty *)prop)->name; /* XXX - not correct */
}
- return TIP_(description);
+ return description;
}
static const char *rna_ensure_property_name(PropertyRNA *prop)
@@ -489,7 +503,7 @@ static const char *rna_ensure_property_name(PropertyRNA *prop)
else
name = ((IDProperty *)prop)->name;
- return CTX_IFACE_(prop->translation_context, name);
+ return name;
}
/* Structs */
@@ -515,6 +529,11 @@ const char *RNA_struct_ui_name(StructRNA *type)
return CTX_IFACE_(type->translation_context, type->name);
}
+const char *RNA_struct_ui_name_raw(StructRNA *type)
+{
+ return type->name;
+}
+
int RNA_struct_ui_icon(StructRNA *type)
{
if (type)
@@ -528,6 +547,11 @@ const char *RNA_struct_ui_description(StructRNA *type)
return TIP_(type->description);
}
+const char *RNA_struct_ui_description_raw(StructRNA *type)
+{
+ return type->description;
+}
+
const char *RNA_struct_translation_context(StructRNA *type)
{
return type->translation_context ? type->translation_context : BLF_I18NCONTEXT_DEFAULT;
@@ -778,7 +802,7 @@ const char *RNA_property_identifier(PropertyRNA *prop)
const char *RNA_property_description(PropertyRNA *prop)
{
- return rna_ensure_property_description(prop);
+ return TIP_(rna_ensure_property_description(prop));
}
PropertyType RNA_property_type(PropertyRNA *prop)
@@ -1401,11 +1425,21 @@ int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, Property
const char *RNA_property_ui_name(PropertyRNA *prop)
{
+ return CTX_IFACE_(prop->translation_context, rna_ensure_property_name(prop));
+}
+
+const char *RNA_property_ui_name_raw(PropertyRNA *prop)
+{
return rna_ensure_property_name(prop);
}
const char *RNA_property_ui_description(PropertyRNA *prop)
{
+ return TIP_(rna_ensure_property_description(prop));
+}
+
+const char *RNA_property_ui_description_raw(PropertyRNA *prop)
+{
return rna_ensure_property_description(prop);
}
@@ -4797,6 +4831,13 @@ bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
}
}
+void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop)
+{
+ if (prop->flag & PROP_IDPROPERTY) {
+ rna_idproperty_free(ptr, prop->identifier);
+ }
+}
+
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
@@ -4825,6 +4866,15 @@ bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
}
}
+void RNA_struct_property_unset(PointerRNA *ptr, const char *identifier)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
+
+ if (prop) {
+ RNA_property_unset(ptr, prop);
+ }
+}
+
bool RNA_property_is_idprop(PropertyRNA *prop)
{
return (prop->magic != RNA_MAGIC);
@@ -5190,6 +5240,11 @@ const char *RNA_function_identifier(FunctionRNA *func)
const char *RNA_function_ui_description(FunctionRNA *func)
{
+ return TIP_(func->description);
+}
+
+const char *RNA_function_ui_description_raw(FunctionRNA *func)
+{
return func->description;
}