2008-11-14 14:34:19 +00:00
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation (2008).
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
#include "RNA_types.h"
|
|
|
|
|
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
|
|
/* Struct */
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_Struct_identifier_get(PointerRNA *ptr, char *value)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-14 18:46:57 +00:00
|
|
|
strcpy(value, ((StructRNA*)ptr->data)->identifier);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_Struct_identifier_length(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-14 18:46:57 +00:00
|
|
|
return strlen(((StructRNA*)ptr->data)->identifier);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-12-19 04:06:24 +00:00
|
|
|
static void rna_Struct_description_get(PointerRNA *ptr, char *value)
|
|
|
|
{
|
|
|
|
strcpy(value, ((StructRNA*)ptr->data)->description);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_Struct_description_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return strlen(((StructRNA*)ptr->data)->description);
|
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_Struct_name_get(PointerRNA *ptr, char *value)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
|
|
|
strcpy(value, ((StructRNA*)ptr->data)->name);
|
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_Struct_name_length(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
|
|
|
return strlen(((StructRNA*)ptr->data)->name);
|
|
|
|
}
|
|
|
|
|
2008-12-18 23:34:19 +00:00
|
|
|
static void *rna_Struct_base_get(PointerRNA *ptr)
|
2008-12-15 13:46:50 +00:00
|
|
|
{
|
|
|
|
return ((StructRNA*)ptr->data)->from;
|
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void *rna_Struct_name_property_get(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
|
|
|
return ((StructRNA*)ptr->data)->nameproperty;
|
|
|
|
}
|
|
|
|
|
2008-11-24 12:12:24 +00:00
|
|
|
static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data)
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
{
|
2008-11-24 12:12:24 +00:00
|
|
|
IDProperty *idprop= (IDProperty*)data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
for(prop= iter->parent.type->properties.first; prop; prop=prop->next)
|
|
|
|
if(strcmp(prop->identifier, idprop->name) == 0)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-11-24 12:12:24 +00:00
|
|
|
static int rna_property_builtin(CollectionPropertyIterator *iter, void *data)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop= (PropertyRNA*)data;
|
|
|
|
return (prop->flag & PROP_BUILTIN);
|
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_Struct_properties_next(CollectionPropertyIterator *iter)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
ListBaseIterator *internal= iter->internal;
|
|
|
|
IDProperty *group;
|
|
|
|
|
|
|
|
if(internal->flag) {
|
|
|
|
/* id properties */
|
2008-11-24 12:12:24 +00:00
|
|
|
rna_iterator_listbase_next(iter);
|
2008-11-17 18:44:06 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* regular properties */
|
2008-11-24 12:12:24 +00:00
|
|
|
rna_iterator_listbase_next(iter);
|
2008-11-17 18:44:06 +00:00
|
|
|
|
|
|
|
/* try id properties */
|
|
|
|
if(!iter->valid) {
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
group= rna_idproperties_get(iter->parent.type, iter->parent.data, 0);
|
2008-11-17 18:44:06 +00:00
|
|
|
|
|
|
|
if(group) {
|
|
|
|
rna_iterator_listbase_end(iter);
|
2008-11-24 12:12:24 +00:00
|
|
|
rna_iterator_listbase_begin(iter, &group->data.group, rna_idproperty_known);
|
2008-11-17 18:44:06 +00:00
|
|
|
internal= iter->internal;
|
|
|
|
internal->flag= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_Struct_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-24 12:12:24 +00:00
|
|
|
rna_iterator_listbase_begin(iter, &((StructRNA*)ptr->data)->properties, rna_property_builtin);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void *rna_Struct_properties_get(CollectionPropertyIterator *iter)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
ListBaseIterator *internal= iter->internal;
|
|
|
|
|
|
|
|
/* we return either PropertyRNA* or IDProperty*, the rna_access.c
|
|
|
|
* functions can handle both as PropertyRNA* with some tricks */
|
|
|
|
return internal->link;
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
void rna_builtin_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
|
|
|
PointerRNA newptr;
|
|
|
|
|
|
|
|
/* we create a new with the type as the data */
|
2008-11-14 18:46:57 +00:00
|
|
|
newptr.type= &RNA_Struct;
|
2008-11-14 14:34:19 +00:00
|
|
|
newptr.data= ptr->type;
|
|
|
|
|
|
|
|
if(ptr->type->flag & STRUCT_ID) {
|
|
|
|
newptr.id.type= ptr->type;
|
|
|
|
newptr.id.data= ptr->data;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
newptr.id.type= NULL;
|
|
|
|
newptr.id.data= NULL;
|
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
rna_Struct_properties_begin(iter, &newptr);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
void rna_builtin_properties_next(CollectionPropertyIterator *iter)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-14 18:46:57 +00:00
|
|
|
rna_Struct_properties_next(iter);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
void *rna_builtin_properties_get(CollectionPropertyIterator *iter)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-14 18:46:57 +00:00
|
|
|
return rna_Struct_properties_get(iter);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
void *rna_builtin_type_get(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
|
|
|
return ptr->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Property */
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
static StructRNA *rna_Property_refine(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
|
|
|
|
|
|
|
rna_idproperty_check(&prop, ptr); /* XXX ptr? */
|
|
|
|
|
|
|
|
switch(prop->type) {
|
|
|
|
case PROP_BOOLEAN: return &RNA_BooleanProperty;
|
|
|
|
case PROP_INT: return &RNA_IntProperty;
|
|
|
|
case PROP_FLOAT: return &RNA_FloatProperty;
|
|
|
|
case PROP_STRING: return &RNA_StringProperty;
|
|
|
|
case PROP_ENUM: return &RNA_EnumProperty;
|
|
|
|
case PROP_POINTER: return &RNA_PointerProperty;
|
|
|
|
case PROP_COLLECTION: return &RNA_CollectionProperty;
|
|
|
|
default: return &RNA_Property;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_Property_identifier_get(PointerRNA *ptr, char *value)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
strcpy(value, ((PropertyRNA*)prop)->identifier);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_Property_identifier_length(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return strlen(prop->identifier);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_Property_name_get(PointerRNA *ptr, char *value)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
strcpy(value, prop->name);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_Property_name_length(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return strlen(prop->name);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_Property_description_get(PointerRNA *ptr, char *value)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
strcpy(value, prop->description);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_Property_description_length(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return strlen(prop->description);
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_Property_type_get(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return prop->type;
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_Property_subtype_get(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return prop->subtype;
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-12-31 15:02:40 +00:00
|
|
|
static int rna_Property_editable_get(PointerRNA *ptr)
|
2008-12-19 04:06:24 +00:00
|
|
|
{
|
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
2008-12-31 15:02:40 +00:00
|
|
|
return RNA_property_editable(ptr, prop);
|
2008-12-19 04:06:24 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_Property_array_length_get(PointerRNA *ptr)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return prop->arraylength;
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static int rna_IntProperty_hard_min_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((IntPropertyRNA*)prop)->hardmin;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_IntProperty_hard_max_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((IntPropertyRNA*)prop)->hardmax;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_IntProperty_soft_min_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((IntPropertyRNA*)prop)->softmin;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_IntProperty_soft_max_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((IntPropertyRNA*)prop)->softmax;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_IntProperty_step_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((IntPropertyRNA*)prop)->step;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_FloatProperty_hard_min_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((FloatPropertyRNA*)prop)->hardmin;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_FloatProperty_hard_max_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((FloatPropertyRNA*)prop)->hardmax;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_FloatProperty_soft_min_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((FloatPropertyRNA*)prop)->softmin;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_FloatProperty_soft_max_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((FloatPropertyRNA*)prop)->softmax;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_FloatProperty_step_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((FloatPropertyRNA*)prop)->step;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_FloatProperty_precision_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((FloatPropertyRNA*)prop)->precision;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_StringProperty_max_length_get(PointerRNA *ptr)
|
2008-11-14 17:05:25 +00:00
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((StringPropertyRNA*)prop)->maxlength;
|
2008-11-14 17:05:25 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
|
|
|
EnumPropertyRNA *eprop;
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
eprop= (EnumPropertyRNA*)prop;
|
|
|
|
|
2008-11-24 12:12:24 +00:00
|
|
|
rna_iterator_array_begin(iter, (void*)eprop->item, sizeof(eprop->item[0]), eprop->totitem, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_EnumPropertyItem_identifier_get(PointerRNA *ptr, char *value)
|
|
|
|
{
|
|
|
|
strcpy(value, ((EnumPropertyItem*)ptr->data)->identifier);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_EnumPropertyItem_identifier_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return strlen(((EnumPropertyItem*)ptr->data)->identifier);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_EnumPropertyItem_name_get(PointerRNA *ptr, char *value)
|
|
|
|
{
|
|
|
|
strcpy(value, ((EnumPropertyItem*)ptr->data)->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_EnumPropertyItem_name_length(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return strlen(((EnumPropertyItem*)ptr->data)->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int rna_EnumPropertyItem_value_get(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
return ((EnumPropertyItem*)ptr->data)->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *rna_PointerProperty_fixed_type_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((PointerPropertyRNA*)prop)->structtype;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *rna_CollectionProperty_fixed_type_get(PointerRNA *ptr)
|
|
|
|
{
|
2008-11-17 18:44:06 +00:00
|
|
|
PropertyRNA *prop= (PropertyRNA*)ptr->data;
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_idproperty_check(&prop, ptr);
|
2008-11-17 18:44:06 +00:00
|
|
|
return ((CollectionPropertyRNA*)prop)->structtype;
|
2008-11-14 18:46:57 +00:00
|
|
|
}
|
|
|
|
|
2008-12-15 13:46:50 +00:00
|
|
|
/* Blender RNA */
|
|
|
|
|
|
|
|
static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
rna_iterator_listbase_begin(iter, &((BlenderRNA*)ptr->data)->structs, NULL);
|
|
|
|
}
|
|
|
|
|
2008-11-14 14:34:19 +00:00
|
|
|
#else
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
static void rna_def_struct(BlenderRNA *brna)
|
2008-11-14 14:34:19 +00:00
|
|
|
{
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "Struct", NULL);
|
|
|
|
RNA_def_struct_ui_text(srna, "Struct Definition", "RNA Structure definition");
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Struct_name_get", "rna_Struct_name_length", NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Human readable name.");
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Struct_identifier_get", "rna_Struct_identifier_length", NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting.");
|
2008-12-18 05:28:17 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
2008-12-19 04:06:24 +00:00
|
|
|
prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_Struct_description_get", "rna_Struct_description_length", NULL);
|
2008-12-31 15:02:40 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Description", "Description of the Struct's purpose.");
|
2008-12-19 04:06:24 +00:00
|
|
|
|
2008-12-18 23:34:19 +00:00
|
|
|
prop= RNA_def_property(srna, "base", PROP_POINTER, PROP_NONE);
|
2008-12-15 13:46:50 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_struct_type(prop, "Struct");
|
2008-12-18 23:34:19 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", NULL, NULL);
|
2008-12-31 13:16:37 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Base", "Struct definition this is derived from.");
|
2008-12-15 13:46:50 +00:00
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
prop= RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_struct_type(prop, "StringProperty");
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Struct_name_property_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Name Property", "Property that gives the name of the struct.");
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_struct_type(prop, "Property");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", 0, 0, 0, 0);
|
|
|
|
RNA_def_property_ui_text(prop, "Properties", "Properties in the struct.");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_def_property(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
2008-11-14 14:34:19 +00:00
|
|
|
PropertyRNA *prop;
|
2008-11-14 18:46:57 +00:00
|
|
|
static EnumPropertyItem type_items[] = {
|
2008-11-24 12:12:24 +00:00
|
|
|
{PROP_BOOLEAN, "BOOLEAN", "Boolean", ""},
|
|
|
|
{PROP_INT, "INT", "Integer", ""},
|
|
|
|
{PROP_FLOAT, "FLOAT", "Float", ""},
|
|
|
|
{PROP_STRING, "STRING", "String", ""},
|
|
|
|
{PROP_ENUM, "ENUM", "Enumeration", ""},
|
|
|
|
{PROP_POINTER, "POINTER", "Pointer", ""},
|
|
|
|
{PROP_COLLECTION, "COLLECTION", "Collection", ""},
|
|
|
|
{0, NULL, NULL, NULL}};
|
2008-11-14 18:46:57 +00:00
|
|
|
static EnumPropertyItem subtype_items[] = {
|
2008-11-24 12:12:24 +00:00
|
|
|
{PROP_NONE, "NONE", "None", ""},
|
|
|
|
{PROP_UNSIGNED, "UNSIGNED", "Unsigned Number", ""},
|
|
|
|
{PROP_FILEPATH, "FILEPATH", "File Path", ""},
|
2008-12-16 16:32:48 +00:00
|
|
|
{PROP_DIRPATH, "DIRPATH", "Directory Path", ""},
|
2008-11-24 12:12:24 +00:00
|
|
|
{PROP_COLOR, "COLOR", "Color", ""},
|
|
|
|
{PROP_VECTOR, "VECTOR", "Vector", ""},
|
|
|
|
{PROP_MATRIX, "MATRIX", "Matrix", ""},
|
|
|
|
{PROP_ROTATION, "ROTATION", "Rotation", ""},
|
|
|
|
{0, NULL, NULL, NULL}};
|
2008-11-14 14:34:19 +00:00
|
|
|
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "Property", NULL);
|
|
|
|
RNA_def_struct_ui_text(srna, "Property Definition", "DOC_BROKEN2");
|
2009-01-01 15:52:51 +00:00
|
|
|
RNA_def_struct_refine_func(srna, "rna_Property_refine");
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
|
2008-11-14 14:34:19 +00:00
|
|
|
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_string_funcs(prop, "rna_Property_name_get", "rna_Property_name_length", NULL);
|
2008-11-14 17:05:25 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Human readable name.");
|
2008-11-14 14:34:19 +00:00
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
|
2008-11-14 17:05:25 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_string_funcs(prop, "rna_Property_identifier_get", "rna_Property_identifier_length", NULL);
|
2008-11-14 17:05:25 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting.");
|
2008-12-18 07:22:28 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
|
|
|
|
2008-11-14 14:34:19 +00:00
|
|
|
prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_string_funcs(prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
|
2008-11-14 17:05:25 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips.");
|
2008-11-14 14:34:19 +00:00
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_enum_items(prop, type_items);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, "rna_Property_type_get", NULL);
|
2008-11-14 17:05:25 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Type", "Data type of the property.");
|
2008-11-14 14:34:19 +00:00
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_enum_items(prop, subtype_items);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL);
|
2008-11-18 10:57:06 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Subtype", "Semantic interpretation of the property.");
|
2008-12-19 04:06:24 +00:00
|
|
|
|
2008-12-31 15:02:40 +00:00
|
|
|
prop= RNA_def_property(srna, "editable", PROP_BOOLEAN, PROP_NONE);
|
2008-12-19 04:06:24 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-12-31 15:02:40 +00:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_Property_editable_get", NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Editable", "Property is editable through RNA.");
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_def_number_property(StructRNA *srna, PropertyType type)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2008-11-18 10:57:06 +00:00
|
|
|
prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited.");
|
|
|
|
|
|
|
|
if(type == PROP_BOOLEAN)
|
|
|
|
return;
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "hard_min", type, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", NULL, NULL);
|
|
|
|
else RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_min_get", NULL, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Hard Minimum", "Minimum value used by buttons.");
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "hard_max", type, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", NULL, NULL);
|
|
|
|
else RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_max_get", NULL, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Hard Maximum", "Maximum value used by buttons.");
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "soft_min", type, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", NULL, NULL);
|
|
|
|
else RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_min_get", NULL, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Soft Minimum", "Minimum value used by buttons.");
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "soft_max", type, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", NULL, NULL);
|
|
|
|
else RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_max_get", NULL, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Soft Maximum", "Maximum value used by buttons.");
|
|
|
|
|
2008-11-18 10:57:06 +00:00
|
|
|
prop= RNA_def_property(srna, "step", type, PROP_UNSIGNED);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", NULL, NULL);
|
|
|
|
else RNA_def_property_float_funcs(prop, "rna_FloatProperty_step_get", NULL, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Step", "Step size used by number buttons, for floats 1/100th of the step size.");
|
|
|
|
|
|
|
|
if(type == PROP_FLOAT) {
|
2008-11-18 10:57:06 +00:00
|
|
|
prop= RNA_def_property(srna, "precision", PROP_INT, PROP_UNSIGNED);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_FloatProperty_precision_get", NULL, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Precision", "Number of digits after the dot used by buttons.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
static void rna_def_string_property(StructRNA *srna)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "max_length", PROP_INT, PROP_UNSIGNED);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_StringProperty_max_length_get", NULL, NULL);
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Length", "Maximum length of the string, 0 means unlimited.");
|
|
|
|
}
|
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_struct_type(prop, "EnumPropertyItem");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0);
|
|
|
|
RNA_def_property_ui_text(prop, "Items", "Possible values for the property.");
|
|
|
|
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "EnumPropertyItem", NULL);
|
|
|
|
RNA_def_struct_ui_text(srna, "Enum Item Definition", "DOC_BROKEN3");
|
2008-11-14 18:46:57 +00:00
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_name_get", "rna_EnumPropertyItem_name_length", NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Human readable name.");
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_identifier_get", "rna_EnumPropertyItem_identifier_length", NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting.");
|
2008-12-18 23:34:19 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2008-11-14 18:46:57 +00:00
|
|
|
|
2008-11-18 10:57:06 +00:00
|
|
|
prop= RNA_def_property(srna, "value", PROP_INT, PROP_UNSIGNED);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
2008-11-24 12:12:24 +00:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_EnumPropertyItem_value_get", NULL, NULL);
|
2008-11-14 18:46:57 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Value", "Value of the item.");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_def_pointer_property(StructRNA *srna, PropertyType type)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "fixed_type", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_struct_type(prop, "Struct");
|
|
|
|
if(type == PROP_POINTER)
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_PointerProperty_fixed_type_get", NULL, NULL);
|
|
|
|
else
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_CollectionProperty_fixed_type_get", NULL, NULL);
|
|
|
|
RNA_def_property_ui_text(prop, "Pointer Type", "Fixed pointer type, empty if variable type.");
|
|
|
|
}
|
|
|
|
|
2008-11-14 14:34:19 +00:00
|
|
|
void RNA_def_rna(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
2008-12-15 13:46:50 +00:00
|
|
|
PropertyRNA *prop;
|
2008-11-14 14:34:19 +00:00
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
/* Struct*/
|
|
|
|
rna_def_struct(brna);
|
2008-11-14 14:34:19 +00:00
|
|
|
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
/* Property */
|
|
|
|
rna_def_property(brna);
|
2008-11-14 14:34:19 +00:00
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
/* BooleanProperty */
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "BooleanProperty", "Property");
|
|
|
|
RNA_def_struct_ui_text(srna, "Boolean Definition", "DOC_BROKEN4");
|
2008-11-14 18:46:57 +00:00
|
|
|
rna_def_number_property(srna, PROP_BOOLEAN);
|
2008-11-14 14:34:19 +00:00
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
/* IntProperty */
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "IntProperty", "Property");
|
|
|
|
RNA_def_struct_ui_text(srna, "Int Definition", "DOC_BROKEN5");
|
2008-11-14 18:46:57 +00:00
|
|
|
rna_def_number_property(srna, PROP_INT);
|
2008-11-14 14:34:19 +00:00
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
/* FloatProperty */
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "FloatProperty", "Property");
|
|
|
|
RNA_def_struct_ui_text(srna, "Float Definition", "DOC_BROKEN6");
|
2008-11-14 18:46:57 +00:00
|
|
|
rna_def_number_property(srna, PROP_FLOAT);
|
2008-11-14 14:34:19 +00:00
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
/* StringProperty */
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "StringProperty", "Property");
|
|
|
|
RNA_def_struct_ui_text(srna, "String Definition", "DOC_BROKEN7");
|
RNA
* More ID property support. What was already possible was showing
ID properties as RNA properties. Now it is possible to define
RNA properties and have an ID property automatically created the
first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
This is useful for python and plugins, and could also be used
for operators, not sure yet what is best there, they could be done
in preprocess for speed, but not sure how to do that while keeping
operator registration a single function.
* Added quick functions to get/set properties based on names, to be
used for operators.
* Added some simple support for inheritance, was already doing this
but having it as a feature simplifies things. Two things were added
for this: when defining a struct you can give a 'from' struct whose
properties will be copied, and structs like ID, operator, modifier,
can define a refine callback that will return the more specific type
of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
list, used for testing RNA for operators.
2008-11-21 02:23:46 +00:00
|
|
|
rna_def_string_property(srna);
|
2008-11-14 17:05:25 +00:00
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
/* EnumProperty */
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "EnumProperty", "Property");
|
|
|
|
RNA_def_struct_ui_text(srna, "Enum Definition", "DOC_BROKEN8");
|
2008-11-14 18:46:57 +00:00
|
|
|
rna_def_enum_property(brna, srna);
|
2008-11-14 14:34:19 +00:00
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
/* PointerProperty */
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "PointerProperty", "Property");
|
|
|
|
RNA_def_struct_ui_text(srna, "Pointer Definition", "DOC_BROKEN9");
|
2008-11-14 18:46:57 +00:00
|
|
|
rna_def_pointer_property(srna, PROP_POINTER);
|
2008-11-14 14:34:19 +00:00
|
|
|
|
2008-11-14 18:46:57 +00:00
|
|
|
/* CollectionProperty */
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "CollectionProperty", "Property");
|
|
|
|
RNA_def_struct_ui_text(srna, "Collection Definition", "DOC_BROKEN10");
|
2008-11-14 18:46:57 +00:00
|
|
|
rna_def_pointer_property(srna, PROP_COLLECTION);
|
2008-12-15 13:46:50 +00:00
|
|
|
|
|
|
|
/* Blender RNA */
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "BlenderRNA", NULL);
|
|
|
|
RNA_def_struct_ui_text(srna, "Blender RNA", "RNA Structures");
|
2008-12-15 13:46:50 +00:00
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
RNA_def_property_struct_type(prop, "Struct");
|
|
|
|
RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
|
|
|
|
RNA_def_property_ui_text(prop, "Structs", "");
|
2008-11-14 14:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|