2008-10-31 23:50:02 +00:00
|
|
|
/**
|
2002-10-12 11:37:38 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-01-07 19:13:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
2008-10-31 23:50:02 +00:00
|
|
|
* Contributor(s): Blender Foundation (2008).
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
#include "RNA_access.h"
|
2008-10-31 23:50:02 +00:00
|
|
|
#include "RNA_define.h"
|
|
|
|
#include "RNA_types.h"
|
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
#include "rna_internal.h"
|
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
#include "DNA_object_types.h"
|
2008-12-02 01:05:23 +00:00
|
|
|
#include "DNA_property_types.h"
|
2008-10-31 23:50:02 +00:00
|
|
|
|
|
|
|
#ifdef RNA_RUNTIME
|
2008-12-02 23:45:11 +00:00
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
void RNA_def_object(BlenderRNA *brna)
|
|
|
|
{
|
2008-11-07 02:58:25 +00:00
|
|
|
StructRNA *srna;
|
2008-10-31 23:50:02 +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, "Object", "ID", "Object");
|
2008-11-07 02:58:25 +00:00
|
|
|
|
2008-11-18 10:57:06 +00:00
|
|
|
prop= RNA_def_property(srna, "data", 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_struct_type(prop, "ID");
|
2008-11-18 10:57:06 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Data", "Object data.");
|
2008-10-31 23:50:02 +00:00
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
|
2008-11-14 17:05:25 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Parent", "Parent Object");
|
2008-10-31 23:50:02 +00:00
|
|
|
|
2008-11-07 02:58:25 +00:00
|
|
|
prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE);
|
2008-11-14 17:05:25 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track).");
|
2008-11-18 10:57:06 +00:00
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "loc", PROP_FLOAT, PROP_VECTOR);
|
2008-11-29 14:35:50 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Location", "");
|
2008-12-02 10:10:07 +00:00
|
|
|
|
|
|
|
//prop= RNA_def_property(srna, "rot", PROP_FLOAT, PROP_ROTATION);
|
|
|
|
//RNA_def_property_ui_text(prop, "Rotation", "");
|
|
|
|
prop= RNA_def_property(srna, "rot", PROP_FLOAT, PROP_VECTOR);
|
|
|
|
RNA_def_property_ui_text(prop, "Rotation", "");
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_VECTOR);
|
|
|
|
RNA_def_property_ui_text(prop, "Scale", "");
|
2008-12-12 23:30:23 +00:00
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_struct_type(prop, "Constraint");
|
|
|
|
RNA_def_property_ui_text(prop, "Constraints", "");
|
|
|
|
|
2008-12-01 13:01:48 +00:00
|
|
|
prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Modifier");
|
|
|
|
RNA_def_property_ui_text(prop, "Modifiers", "");
|
2008-12-01 13:01:48 +00:00
|
|
|
|
2008-11-29 16:07:49 +00:00
|
|
|
prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_struct_type(prop, "Sensor");
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Sensors", "");
|
2008-11-30 14:40:00 +00:00
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_struct_type(prop, "Controller");
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Controllers", "");
|
2008-11-30 14:40:00 +00:00
|
|
|
|
2008-11-30 19:52:21 +00:00
|
|
|
prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_struct_type(prop, "Actuator");
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Actuators", "");
|
2008-11-30 19:52:21 +00:00
|
|
|
|
2008-12-02 23:45:11 +00:00
|
|
|
prop= RNA_def_property(srna, "game_properties", PROP_COLLECTION, PROP_NONE);
|
2008-11-30 19:52:21 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_struct_type(prop, "GameProperty");
|
|
|
|
RNA_def_property_ui_text(prop, "Game Properties", "Game engine properties.");
|
2008-10-31 23:50:02 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#endif
|
2002-10-30 02:07:20 +00:00
|
|
|
|