2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-11-30 20:18:55 +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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-30 20:18:55 +00:00
|
|
|
*
|
2009-07-29 12:35:09 +00:00
|
|
|
* Contributor(s): Blender Foundation (2008), Juho Vepsalainen, Jiri Hnidek
|
2008-11-30 20:18:55 +00:00
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:20:01 +00:00
|
|
|
/** \file blender/makesrna/intern/rna_meta.c
|
|
|
|
|
* \ingroup RNA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2008-11-30 20:18:55 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
2010-11-18 04:26:50 +00:00
|
|
|
#include "RNA_enum_types.h"
|
2008-11-30 20:18:55 +00:00
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
2009-01-08 13:57:29 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2008-11-30 20:18:55 +00:00
|
|
|
#include "DNA_meta_types.h"
|
|
|
|
|
|
|
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2010-04-12 05:04:49 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
|
|
2010-08-23 00:57:19 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2009-07-29 12:35:09 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
|
2009-08-03 14:40:10 +00:00
|
|
|
#include "BKE_mball.h"
|
2009-07-29 12:35:09 +00:00
|
|
|
#include "BKE_depsgraph.h"
|
2009-08-10 21:10:09 +00:00
|
|
|
#include "BKE_main.h"
|
2009-07-29 12:35:09 +00:00
|
|
|
|
|
|
|
|
#include "WM_types.h"
|
2009-07-29 14:07:51 +00:00
|
|
|
#include "WM_api.h"
|
2009-07-29 12:35:09 +00:00
|
|
|
|
2008-12-02 23:45:11 +00:00
|
|
|
static int rna_Meta_texspace_editable(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
MetaBall *mb= (MetaBall*)ptr->data;
|
2010-04-12 05:04:49 +00:00
|
|
|
return (mb->texflag & MB_AUTOSPACE)? 0: PROP_EDITABLE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Meta_texspace_loc_get(PointerRNA *ptr, float *values)
|
|
|
|
|
{
|
|
|
|
|
MetaBall *mb= (MetaBall*)ptr->data;
|
|
|
|
|
|
|
|
|
|
/* tex_space_mball() needs object.. ugh */
|
|
|
|
|
|
|
|
|
|
copy_v3_v3(values, mb->loc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Meta_texspace_loc_set(PointerRNA *ptr, const float *values)
|
|
|
|
|
{
|
|
|
|
|
MetaBall *mb= (MetaBall*)ptr->data;
|
|
|
|
|
|
|
|
|
|
copy_v3_v3(mb->loc, values);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Meta_texspace_size_get(PointerRNA *ptr, float *values)
|
|
|
|
|
{
|
|
|
|
|
MetaBall *mb= (MetaBall*)ptr->data;
|
|
|
|
|
|
|
|
|
|
/* tex_space_mball() needs object.. ugh */
|
|
|
|
|
|
|
|
|
|
copy_v3_v3(values, mb->size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Meta_texspace_size_set(PointerRNA *ptr, const float *values)
|
|
|
|
|
{
|
|
|
|
|
MetaBall *mb= (MetaBall*)ptr->data;
|
|
|
|
|
|
|
|
|
|
copy_v3_v3(mb->size, values);
|
2008-12-02 23:45:11 +00:00
|
|
|
}
|
|
|
|
|
|
2010-04-12 05:04:49 +00:00
|
|
|
|
2009-12-08 17:23:48 +00:00
|
|
|
static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
|
2009-08-03 14:40:10 +00:00
|
|
|
{
|
2009-08-10 21:10:09 +00:00
|
|
|
MetaBall *mb= ptr->id.data;
|
|
|
|
|
Object *ob;
|
|
|
|
|
|
2010-08-23 00:57:19 +00:00
|
|
|
/* cheating way for importers to avoid slow updates */
|
|
|
|
|
if(mb->id.us > 0) {
|
|
|
|
|
for(ob=bmain->object.first; ob; ob= ob->id.next)
|
|
|
|
|
if(ob->data == mb)
|
|
|
|
|
copy_mball_properties(scene, ob);
|
|
|
|
|
|
2011-01-03 12:41:16 +00:00
|
|
|
DAG_id_tag_update(&mb->id, 0);
|
2010-08-23 00:57:19 +00:00
|
|
|
WM_main_add_notifier(NC_GEOM|ND_DATA, mb);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-08 13:02:16 +00:00
|
|
|
static void rna_MetaBall_update_rotation(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
MetaElem *ml= ptr->data;
|
|
|
|
|
normalize_qt(ml->quat);
|
|
|
|
|
rna_MetaBall_update_data(bmain, scene, ptr);
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-23 00:57:19 +00:00
|
|
|
static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
|
|
|
|
|
{
|
|
|
|
|
MetaElem *ml= add_metaball_element(mb, type);
|
|
|
|
|
|
|
|
|
|
/* cheating way for importers to avoid slow updates */
|
|
|
|
|
if(mb->id.us > 0) {
|
2011-01-03 12:41:16 +00:00
|
|
|
DAG_id_tag_update(&mb->id, 0);
|
2010-08-23 00:57:19 +00:00
|
|
|
WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
|
|
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
|
2010-08-23 00:57:19 +00:00
|
|
|
return ml;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, MetaElem *ml)
|
|
|
|
|
{
|
|
|
|
|
int found= 0;
|
|
|
|
|
|
|
|
|
|
found= BLI_remlink_safe(&mb->elems, ml);
|
|
|
|
|
|
|
|
|
|
if(!found) {
|
|
|
|
|
BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" does not contain spline given", mb->id.name+2);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MEM_freeN(ml);
|
|
|
|
|
/* invalidate pointer!, no can do */
|
|
|
|
|
|
|
|
|
|
/* cheating way for importers to avoid slow updates */
|
|
|
|
|
if(mb->id.us > 0) {
|
2011-01-03 12:41:16 +00:00
|
|
|
DAG_id_tag_update(&mb->id, 0);
|
2010-08-23 00:57:19 +00:00
|
|
|
WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
|
|
|
|
|
}
|
2009-07-29 12:35:09 +00:00
|
|
|
}
|
|
|
|
|
|
2008-11-30 20:18:55 +00:00
|
|
|
#else
|
|
|
|
|
|
2009-09-14 16:52:06 +00:00
|
|
|
static void rna_def_metaelement(BlenderRNA *brna)
|
2008-11-30 20:18:55 +00:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2010-08-23 00:57:19 +00:00
|
|
|
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "MetaElement", NULL);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_struct_sdna(srna, "MetaElem");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a MetaBall datablock");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_META);
|
2010-11-18 04:26:50 +00:00
|
|
|
|
2008-12-02 23:45:11 +00:00
|
|
|
/* enums */
|
2008-11-30 20:18:55 +00:00
|
|
|
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
2010-08-23 00:57:19 +00:00
|
|
|
RNA_def_property_enum_items(prop, metaelem_type_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Type", "Metaball types");
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-11-30 20:18:55 +00:00
|
|
|
|
2008-12-02 23:45:11 +00:00
|
|
|
/* number values */
|
2010-08-18 07:14:10 +00:00
|
|
|
prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "x");
|
|
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Location", "");
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-12-02 23:45:11 +00:00
|
|
|
|
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
2009-08-10 21:31:05 +00:00
|
|
|
prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "quat");
|
2010-12-08 13:02:16 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Rotation", "Normalized quaternion rotation");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_rotation");
|
2008-12-02 23:45:11 +00:00
|
|
|
|
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
|
|
|
prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED|PROP_UNIT_LENGTH);
|
2008-12-02 23:45:11 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "rad");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Radius", "");
|
2009-11-05 02:21:04 +00:00
|
|
|
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-12-02 23:45:11 +00:00
|
|
|
|
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
|
|
|
prop= RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_DISTANCE);
|
2008-11-30 20:18:55 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "expx");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 20.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Size X", "Size of element, use of components depends on element type");
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2009-07-30 18:32:20 +00:00
|
|
|
|
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
|
|
|
prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
|
2009-07-30 18:32:20 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "expy");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 20.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Size Y", "Size of element, use of components depends on element type");
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2009-07-30 18:32:20 +00:00
|
|
|
|
user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.
* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil
* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
|
|
|
prop= RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_DISTANCE);
|
2009-07-30 18:32:20 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "expz");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 20.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Size Z", "Size of element, use of components depends on element type");
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-11-30 20:18:55 +00:00
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "s");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 10.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Stiffness", "Stiffness defines how much of the element to fill");
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-11-30 20:18:55 +00:00
|
|
|
|
2008-12-01 19:02:27 +00:00
|
|
|
/* flags */
|
2010-08-18 07:14:10 +00:00
|
|
|
prop= RNA_def_property(srna, "use_negative", PROP_BOOLEAN, PROP_NONE);
|
2008-11-30 20:18:55 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_NEGATIVE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Negative", "Set metaball as negative one");
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-11-30 20:18:55 +00:00
|
|
|
|
2008-12-02 23:45:11 +00:00
|
|
|
prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
2008-11-30 20:18:55 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_HIDE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Hide", "Hide element");
|
2009-08-10 21:10:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-11-30 20:18:55 +00:00
|
|
|
}
|
|
|
|
|
|
2010-08-23 00:57:19 +00:00
|
|
|
/* mball.elements */
|
|
|
|
|
static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "MetaBallElements");
|
|
|
|
|
srna= RNA_def_struct(brna, "MetaBallElements", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "MetaBall");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Meta Elements", "Collection of metaball elements");
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "new", "rna_MetaBall_elements_new");
|
|
|
|
|
RNA_def_function_ui_description(func, "Add a new spline to the curve.");
|
2011-01-13 04:53:55 +00:00
|
|
|
RNA_def_enum(func, "type", metaelem_type_items, MB_BALL, "", "type for the new meta element.");
|
2010-08-23 00:57:19 +00:00
|
|
|
parm= RNA_def_pointer(func, "element", "MetaElement", "", "The newly created metaelement.");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
|
|
func= RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove");
|
|
|
|
|
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
|
parm= RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove.");
|
2010-08-24 06:40:28 +00:00
|
|
|
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
|
2010-08-23 00:57:19 +00:00
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Element", "Last selected element");
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-14 16:52:06 +00:00
|
|
|
static void rna_def_metaball(BlenderRNA *brna)
|
2008-11-30 20:18:55 +00:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
static EnumPropertyItem prop_update_items[] = {
|
2010-02-11 01:11:52 +00:00
|
|
|
{MB_UPDATE_ALWAYS, "UPDATE_ALWAYS", 0, "Always", "While editing, update metaball always"},
|
|
|
|
|
{MB_UPDATE_HALFRES, "HALFRES", 0, "Half", "While editing, update metaball in half resolution"},
|
|
|
|
|
{MB_UPDATE_FAST, "FAST", 0, "Fast", "While editing, update metaball without polygonization"},
|
|
|
|
|
{MB_UPDATE_NEVER, "NEVER", 0, "Never", "While editing, don't update metaball at all"},
|
2009-06-16 00:52:21 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}};
|
2008-11-30 20:18:55 +00:00
|
|
|
|
2008-12-19 04:06:24 +00:00
|
|
|
srna= RNA_def_struct(brna, "MetaBall", "ID");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "MetaBall", "Metaball datablock to defined blobby surfaces");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_META_DATA);
|
2008-12-02 23:45:11 +00:00
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "MetaElement");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Elements", "Meta elements");
|
2010-08-23 00:57:19 +00:00
|
|
|
rna_def_metaball_elements(brna, prop);
|
2008-12-02 23:45:11 +00:00
|
|
|
|
|
|
|
|
/* enums */
|
2010-08-18 07:14:10 +00:00
|
|
|
prop= RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "flag");
|
2008-11-30 20:18:55 +00:00
|
|
|
RNA_def_property_enum_items(prop, prop_update_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Update", "Metaball edit update behavior");
|
2009-07-29 12:35:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-11-30 20:18:55 +00:00
|
|
|
|
2008-12-02 23:45:11 +00:00
|
|
|
/* number values */
|
2010-08-19 17:46:00 +00:00
|
|
|
prop= RNA_def_property(srna, "resolution", PROP_FLOAT, PROP_DISTANCE);
|
2008-11-30 20:18:55 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "wiresize");
|
|
|
|
|
RNA_def_property_range(prop, 0.050f, 1.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport");
|
2009-07-29 12:35:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-11-30 20:18:55 +00:00
|
|
|
|
2010-08-19 17:46:00 +00:00
|
|
|
prop= RNA_def_property(srna, "render_resolution", PROP_FLOAT, PROP_DISTANCE);
|
2008-11-30 20:18:55 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "rendersize");
|
|
|
|
|
RNA_def_property_range(prop, 0.050f, 1.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering");
|
2009-08-03 14:40:10 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-11-30 20:18:55 +00:00
|
|
|
|
2008-12-01 06:52:18 +00:00
|
|
|
prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
|
2008-11-30 20:18:55 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "thresh");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 5.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Threshold", "Influence of meta elements");
|
2009-07-29 12:35:09 +00:00
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
2008-12-02 23:45:11 +00:00
|
|
|
|
2010-04-12 05:04:49 +00:00
|
|
|
/* texture space */
|
2010-08-19 17:31:10 +00:00
|
|
|
prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
|
2010-04-12 05:04:49 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "texflag", MB_AUTOSPACE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object");
|
|
|
|
|
|
2010-08-19 17:31:10 +00:00
|
|
|
prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
|
2010-04-12 05:04:49 +00:00
|
|
|
RNA_def_property_array(prop, 3);
|
2010-05-04 05:15:53 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
|
2010-04-12 05:04:49 +00:00
|
|
|
RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
|
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_Meta_texspace_loc_get", "rna_Meta_texspace_loc_set", NULL);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
|
|
|
|
|
|
|
|
|
prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
|
|
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
|
|
|
|
|
RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
|
|
|
|
|
RNA_def_property_float_funcs(prop, "rna_Meta_texspace_size_get", "rna_Meta_texspace_size_set", NULL);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
|
|
|
|
|
|
|
|
|
/* not supported yet
|
|
|
|
|
prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
|
|
|
|
|
RNA_def_property_float(prop, NULL, "rot");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
|
|
|
|
|
RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");*/
|
|
|
|
|
|
|
|
|
|
/* materials */
|
|
|
|
|
prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
|
|
|
|
|
RNA_def_property_struct_type(prop, "Material");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Materials", "");
|
2010-09-03 07:25:37 +00:00
|
|
|
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
|
2009-08-03 13:09:23 +00:00
|
|
|
|
|
|
|
|
/* anim */
|
|
|
|
|
rna_def_animdata_common(srna);
|
2008-11-30 20:18:55 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-01 19:02:27 +00:00
|
|
|
void RNA_def_meta(BlenderRNA *brna)
|
|
|
|
|
{
|
2008-12-02 23:45:11 +00:00
|
|
|
rna_def_metaelement(brna);
|
2008-12-01 19:02:27 +00:00
|
|
|
rna_def_metaball(brna);
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-30 20:18:55 +00:00
|
|
|
#endif
|