2008-11-07 02:58:25 +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>
|
2008-11-17 18:44:06 +00:00
|
|
|
#include <stdio.h>
|
2008-11-07 02:58:25 +00:00
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
#include "RNA_types.h"
|
|
|
|
|
|
|
|
|
|
#include "DNA_ID.h"
|
|
|
|
|
|
|
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2008-11-17 18:44:06 +00:00
|
|
|
#include "BKE_idprop.h"
|
|
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
/* name functions that ignore the first two ID characters */
|
|
|
|
|
static void rna_ID_name_get(PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
|
|
|
|
ID *id= (ID*)ptr->data;
|
|
|
|
|
BLI_strncpy(value, id->name+2, sizeof(id->name)-2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rna_ID_name_length(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
ID *id= (ID*)ptr->data;
|
|
|
|
|
return strlen(id->name+2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_ID_name_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
|
|
|
|
ID *id= (ID*)ptr->data;
|
|
|
|
|
BLI_strncpy(id->name+2, value, sizeof(id->name)-2);
|
|
|
|
|
}
|
|
|
|
|
|
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_ID_refine(PointerRNA *ptr)
|
2008-11-17 18:44:06 +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
|
|
|
ID *id= (ID*)ptr->data;
|
2008-11-17 18:44:06 +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
|
|
|
switch(GS(id->name)) {
|
2008-11-29 19:53:49 +00:00
|
|
|
case ID_CA: return &RNA_Camera;
|
2008-11-30 05:07:57 +00:00
|
|
|
case ID_GR: return &RNA_Group;
|
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
|
|
|
case ID_LA: return &RNA_Lamp;
|
2008-11-29 19:08:46 +00:00
|
|
|
case ID_LI: return &RNA_Library;
|
2008-11-30 16:38:56 +00:00
|
|
|
case ID_LT: return &RNA_Lattice;
|
2008-11-27 13:36:28 +00:00
|
|
|
case ID_MA: return &RNA_Material;
|
2008-11-29 01:04:15 +00:00
|
|
|
case ID_NT: return &RNA_NodeTree;
|
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
|
|
|
case ID_ME: return &RNA_Mesh;
|
|
|
|
|
case ID_OB: return &RNA_Object;
|
|
|
|
|
case ID_SCE: return &RNA_Scene;
|
2008-11-29 01:04:15 +00:00
|
|
|
case ID_SCR: return &RNA_Screen;
|
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
|
|
|
case ID_WM: return &RNA_WindowManager;
|
|
|
|
|
default: return &RNA_ID;
|
|
|
|
|
}
|
2008-11-17 18:44:06 +00:00
|
|
|
}
|
|
|
|
|
|
2008-11-29 19:08:46 +00:00
|
|
|
static void rna_ID_fake_user_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
|
|
|
|
ID *id= (ID*)ptr->data;
|
|
|
|
|
|
|
|
|
|
if(value && !(id->flag & LIB_FAKEUSER)) {
|
|
|
|
|
id->flag |= LIB_FAKEUSER;
|
|
|
|
|
id->us++;
|
|
|
|
|
}
|
|
|
|
|
else if(!value && (id->flag & LIB_FAKEUSER)) {
|
|
|
|
|
id->flag &= ~LIB_FAKEUSER;
|
|
|
|
|
id->us--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-07 02:58:25 +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_ID_properties(BlenderRNA *brna)
|
2008-11-17 18:44:06 +00:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
/* this is struct is used for holding the virtual
|
|
|
|
|
* PropertyRNA's for ID properties */
|
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
|
|
|
srna= RNA_def_struct(brna, "IDProperty", NULL, "ID Property");
|
2008-11-17 18:44:06 +00:00
|
|
|
|
|
|
|
|
/* IDP_STRING */
|
|
|
|
|
prop= RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
|
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_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
2008-11-17 18:44:06 +00:00
|
|
|
|
|
|
|
|
/* IDP_INT */
|
|
|
|
|
prop= RNA_def_property(srna, "int", PROP_INT, PROP_NONE);
|
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_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
2008-11-17 18:44:06 +00:00
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "intarray", PROP_INT, PROP_NONE);
|
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_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
2008-11-17 18:44:06 +00:00
|
|
|
RNA_def_property_array(prop, 1);
|
|
|
|
|
|
|
|
|
|
/* IDP_FLOAT */
|
|
|
|
|
prop= RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE);
|
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_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
2008-11-17 18:44:06 +00:00
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "floatarray", PROP_FLOAT, PROP_NONE);
|
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_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
2008-11-17 18:44:06 +00:00
|
|
|
RNA_def_property_array(prop, 1);
|
|
|
|
|
|
|
|
|
|
/* IDP_DOUBLE */
|
|
|
|
|
prop= RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
|
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_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
2008-11-17 18:44:06 +00:00
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "doublearray", PROP_FLOAT, PROP_NONE);
|
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_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
2008-11-17 18:44:06 +00:00
|
|
|
RNA_def_property_array(prop, 1);
|
|
|
|
|
|
|
|
|
|
/* IDP_GROUP */
|
|
|
|
|
prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
|
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_flag(prop, PROP_EXPORT|PROP_NOT_EDITABLE|PROP_IDPROPERTY);
|
2008-11-17 18:44:06 +00:00
|
|
|
RNA_def_property_struct_type(prop, "IDPropertyGroup");
|
|
|
|
|
|
|
|
|
|
/* IDP_ID -- not implemented yet in id properties */
|
|
|
|
|
|
|
|
|
|
/* ID property groups > level 0, since level 0 group is merged
|
|
|
|
|
* with native RNA properties. the builtin_properties will take
|
|
|
|
|
* care of the properties here */
|
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
|
|
|
srna= RNA_def_struct(brna, "IDPropertyGroup", NULL, "ID Property Group");
|
2008-11-17 18:44:06 +00:00
|
|
|
}
|
|
|
|
|
|
2008-11-29 19:08:46 +00:00
|
|
|
static void rna_def_ID(BlenderRNA *brna)
|
2008-11-07 02:58:25 +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;
|
2008-11-07 02:58:25 +00:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
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
|
|
|
srna= RNA_def_struct(brna, "ID", NULL, "ID");
|
2008-11-07 02:58:25 +00:00
|
|
|
RNA_def_struct_flag(srna, STRUCT_ID);
|
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_struct_funcs(srna, NULL, "rna_ID_refine");
|
2008-11-07 02:58:25 +00:00
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, "ID", "name");
|
2008-11-30 14:00:14 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Unique datablock ID name.");
|
2008-11-07 02:58:25 +00:00
|
|
|
RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
|
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_string_maxlength(prop, 22);
|
2008-11-07 02:58:25 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2008-11-29 19:08:46 +00:00
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_int_sdna(prop, NULL, "us");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Users", "Number of times this datablock is referenced.");
|
|
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "fake_user", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Fake User", "Saves this datablock even if it has no users");
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
|
|
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "lib");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Library", "Library file the datablock is linked from.");
|
2008-11-07 02:58:25 +00:00
|
|
|
}
|
|
|
|
|
|
2008-11-29 19:08:46 +00:00
|
|
|
static void rna_def_library(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna= RNA_def_struct(brna, "Library", "ID", "Library");
|
|
|
|
|
|
2008-11-30 00:57:32 +00:00
|
|
|
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
|
2008-11-29 19:08:46 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "name");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Filename", "Path to the library .blend file.");
|
|
|
|
|
}
|
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_def_ID(BlenderRNA *brna)
|
2008-11-17 18:44:06 +00:00
|
|
|
{
|
2008-11-30 15:55:14 +00:00
|
|
|
/* simple built-in unknown type */
|
|
|
|
|
RNA_def_struct(brna, "UnknownType", NULL, "Unknown Type");
|
|
|
|
|
|
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_ID(brna);
|
|
|
|
|
rna_def_ID_properties(brna);
|
2008-11-29 19:08:46 +00:00
|
|
|
rna_def_library(brna);
|
2008-11-17 18:44:06 +00:00
|
|
|
}
|
|
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
#endif
|
|
|
|
|
|