2011-02-23 10:52:22 +00:00
/*
2008-12-01 19:02:27 +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
* 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-12-01 19:02:27 +00:00
*/
2019-02-18 08:08:12 +11:00
/** \file
* \ ingroup RNA
2011-02-27 20:20:01 +00:00
*/
2008-12-01 19:02:27 +00:00
# include <stdlib.h>
# include "DNA_curve_types.h"
2010-08-12 06:28:46 +00:00
# include "DNA_key_types.h"
2009-03-28 10:52:51 +00:00
# include "DNA_material_types.h"
2009-06-20 11:44:56 +00:00
# include "DNA_scene_types.h"
2008-12-01 19:02:27 +00:00
2012-06-29 09:16:59 +00:00
# include "BLI_utildefines.h"
2013-05-27 23:51:01 +00:00
# include "BLI_math.h"
2012-06-29 09:16:59 +00:00
2015-08-16 17:32:01 +10:00
# include "BLT_translation.h"
2014-03-22 02:50:24 +13:00
2009-08-03 15:06:56 +00:00
# include "BKE_font.h"
2013-03-07 02:44:55 +00:00
# include "RNA_access.h"
# include "RNA_define.h"
2013-10-31 03:30:20 +00:00
# include "RNA_enum_types.h"
2013-03-07 02:44:55 +00:00
# include "rna_internal.h"
2009-09-08 07:35:07 +00:00
# include "WM_types.h"
2013-09-11 21:27:14 +00:00
# ifndef RNA_RUNTIME
2017-10-18 15:07:26 +11:00
static const EnumPropertyItem beztriple_handle_type_items [ ] = {
2012-05-12 11:01:29 +00:00
{ HD_FREE , " FREE " , 0 , " Free " , " " } ,
{ HD_VECT , " VECTOR " , 0 , " Vector " , " " } ,
{ HD_ALIGN , " ALIGNED " , 0 , " Aligned " , " " } ,
{ HD_AUTO , " AUTO " , 0 , " Auto " , " " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2013-09-11 21:27:14 +00:00
# endif
2018-06-09 14:40:09 +02:00
2017-10-18 15:07:26 +11:00
const EnumPropertyItem rna_enum_keyframe_handle_type_items [ ] = {
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
{ HD_FREE , " FREE " , ICON_HANDLETYPE_FREE_VEC , " Free " , " Completely independent manually set handle " } ,
{ HD_ALIGN , " ALIGNED " , ICON_HANDLETYPE_ALIGNED_VEC , " Aligned " , " Manually set handle with rotation locked together with its pair " } ,
{ HD_VECT , " VECTOR " , ICON_HANDLETYPE_VECTOR_VEC , " Vector " , " Automatic handles that create straight lines " } ,
{ HD_AUTO , " AUTO " , ICON_HANDLETYPE_AUTO_VEC , " Automatic " , " Automatic handles that create smooth curves " } ,
{ HD_AUTO_ANIM , " AUTO_CLAMPED " , ICON_HANDLETYPE_AUTO_CLAMP_VEC , " Auto Clamped " , " Automatic handles that create smooth curves which only change direction at keyframes " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2009-06-07 13:09:18 +00:00
2017-10-18 15:07:26 +11:00
const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items [ ] = {
2014-03-22 02:50:24 +13:00
/* interpolation */
{ 0 , " " , 0 , N_ ( " Interpolation " ) , " Standard transitions between keyframes " } ,
2014-04-28 13:49:00 +12:00
{ BEZT_IPO_CONST , " CONSTANT " , ICON_IPO_CONSTANT , " Constant " , " No interpolation, value of A gets held until B is encountered " } ,
{ BEZT_IPO_LIN , " LINEAR " , ICON_IPO_LINEAR , " Linear " , " Straight-line interpolation between A and B (i.e. no ease in/out) " } ,
{ BEZT_IPO_BEZ , " BEZIER " , ICON_IPO_BEZIER , " Bezier " , " Smooth interpolation between A and B, with some control over curve shape " } ,
2018-06-09 14:40:09 +02:00
2014-03-22 02:50:24 +13:00
/* easing */
{ 0 , " " , 0 , N_ ( " Easing (by strength) " ) , " Predefined inertial transitions, useful for motion graphics (from least to most ''dramatic'') " } ,
2014-04-28 13:49:00 +12:00
{ BEZT_IPO_SINE , " SINE " , ICON_IPO_SINE , " Sinusoidal " , " Sinusoidal easing (weakest, almost linear but with a slight curvature) " } ,
{ BEZT_IPO_QUAD , " QUAD " , ICON_IPO_QUAD , " Quadratic " , " Quadratic easing " } ,
{ BEZT_IPO_CUBIC , " CUBIC " , ICON_IPO_CUBIC , " Cubic " , " Cubic easing " } ,
{ BEZT_IPO_QUART , " QUART " , ICON_IPO_QUART , " Quartic " , " Quartic easing " } ,
{ BEZT_IPO_QUINT , " QUINT " , ICON_IPO_QUINT , " Quintic " , " Quintic easing " } ,
{ BEZT_IPO_EXPO , " EXPO " , ICON_IPO_EXPO , " Exponential " , " Exponential easing (dramatic) " } ,
{ BEZT_IPO_CIRC , " CIRC " , ICON_IPO_CIRC , " Circular " , " Circular easing (strongest and most dynamic) " } ,
2018-06-09 14:40:09 +02:00
2014-03-22 02:50:24 +13:00
{ 0 , " " , 0 , N_ ( " Dynamic Effects " ) , " Simple physics-inspired easing effects " } ,
2014-04-28 13:49:00 +12:00
{ BEZT_IPO_BACK , " BACK " , ICON_IPO_BACK , " Back " , " Cubic easing with overshoot and settle " } ,
{ BEZT_IPO_BOUNCE , " BOUNCE " , ICON_IPO_BOUNCE , " Bounce " , " Exponentially decaying parabolic bounce, like when objects collide " } ,
{ BEZT_IPO_ELASTIC , " ELASTIC " , ICON_IPO_ELASTIC , " Elastic " , " Exponentially decaying sine wave, like an elastic band " } ,
2018-06-09 14:40:09 +02:00
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2009-05-08 10:50:32 +00:00
2013-09-11 21:27:14 +00:00
# ifndef RNA_RUNTIME
2017-10-18 15:07:26 +11:00
static const EnumPropertyItem curve_type_items [ ] = {
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
{ CU_POLY , " POLY " , 0 , " Poly " , " " } ,
{ CU_BEZIER , " BEZIER " , 0 , " Bezier " , " " } ,
{ CU_BSPLINE , " BSPLINE " , 0 , " BSpline " , " " } ,
{ CU_CARDINAL , " CARDINAL " , 0 , " Cardinal " , " " } ,
{ CU_NURBS , " NURBS " , 0 , " Ease " , " " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2013-09-11 21:27:14 +00:00
# endif
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-03-05 23:30:41 +00:00
static const EnumPropertyItem curve3d_fill_mode_items [ ] = {
2011-09-19 09:47:58 +00:00
{ 0 , " FULL " , 0 , " Full " , " " } ,
{ CU_BACK , " BACK " , 0 , " Back " , " " } ,
{ CU_FRONT , " FRONT " , 0 , " Front " , " " } ,
2012-05-12 11:01:29 +00:00
{ CU_FRONT | CU_BACK , " HALF " , 0 , " Half " , " " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2011-09-19 09:47:58 +00:00
2014-03-26 07:48:51 +11:00
# ifdef RNA_RUNTIME
2012-03-05 23:30:41 +00:00
static const EnumPropertyItem curve2d_fill_mode_items [ ] = {
2011-09-19 09:47:58 +00:00
{ 0 , " NONE " , 0 , " None " , " " } ,
{ CU_BACK , " BACK " , 0 , " Back " , " " } ,
{ CU_FRONT , " FRONT " , 0 , " Front " , " " } ,
2012-05-12 11:01:29 +00:00
{ CU_FRONT | CU_BACK , " BOTH " , 0 , " Both " , " " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2014-03-26 07:48:51 +11:00
# endif
2011-09-19 09:47:58 +00:00
2008-12-01 19:02:27 +00:00
# ifdef RNA_RUNTIME
2009-06-07 13:09:18 +00:00
# include "DNA_object_types.h"
# include "BKE_curve.h"
2009-08-10 21:10:09 +00:00
# include "BKE_main.h"
2009-08-03 15:06:56 +00:00
2017-06-08 10:14:53 +02:00
# include "DEG_depsgraph.h"
# include "DEG_depsgraph_build.h"
2009-08-03 15:06:56 +00:00
# include "WM_api.h"
2009-06-07 13:09:18 +00:00
2009-11-12 14:40:09 +00:00
# include "MEM_guardedalloc.h"
2012-04-28 16:49:00 +00:00
# include "ED_curve.h" /* for BKE_curve_nurbs_get */
2010-07-25 11:57:36 +00:00
2010-11-17 03:15:08 +00:00
/* highly irritating but from RNA we cant know this */
static Nurb * curve_nurb_from_point ( Curve * cu , const void * point , int * nu_index , int * pt_index )
{
2012-04-28 16:49:00 +00:00
ListBase * nurbs = BKE_curve_nurbs_get ( cu ) ;
2010-11-17 03:15:08 +00:00
Nurb * nu ;
2012-03-05 23:30:41 +00:00
int i = 0 ;
2010-11-17 03:15:08 +00:00
2012-03-05 23:30:41 +00:00
for ( nu = nurbs - > first ; nu ; nu = nu - > next , i + + ) {
if ( nu - > type = = CU_BEZIER ) {
if ( point > = ( void * ) nu - > bezt & & point < ( void * ) ( nu - > bezt + nu - > pntsu ) ) {
2010-11-17 03:15:08 +00:00
break ;
}
}
else {
2012-03-05 23:30:41 +00:00
if ( point > = ( void * ) nu - > bp & & point < ( void * ) ( nu - > bp + ( nu - > pntsu * nu - > pntsv ) ) ) {
2010-11-17 03:15:08 +00:00
break ;
}
}
}
2012-03-05 23:30:41 +00:00
if ( nu ) {
if ( nu_index ) {
* nu_index = i ;
2010-11-17 12:52:56 +00:00
}
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
if ( pt_index ) {
2012-05-12 11:01:29 +00:00
if ( nu - > type = = CU_BEZIER ) * pt_index = ( int ) ( ( BezTriple * ) point - nu - > bezt ) ;
else * pt_index = ( int ) ( ( BPoint * ) point - nu - > bp ) ;
2010-11-17 12:52:56 +00:00
}
2010-11-17 03:15:08 +00:00
}
return nu ;
}
2009-09-14 16:52:06 +00:00
static StructRNA * rna_Curve_refine ( PointerRNA * ptr )
2009-06-07 13:09:18 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
2012-04-28 16:49:00 +00:00
short obtype = BKE_curve_type_get ( cu ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
if ( obtype = = OB_FONT ) return & RNA_TextCurve ;
else if ( obtype = = OB_SURF ) return & RNA_SurfaceCurve ;
2009-06-07 13:09:18 +00:00
else return & RNA_Curve ;
}
2009-02-02 19:57:57 +00:00
static void rna_BezTriple_handle1_get ( PointerRNA * ptr , float * values )
2009-02-02 11:51:10 +00:00
{
2012-07-23 22:39:26 +00:00
BezTriple * bezt = ( BezTriple * ) ptr - > data ;
copy_v3_v3 ( values , bezt - > vec [ 0 ] ) ;
2009-02-02 11:51:10 +00:00
}
2009-02-02 19:57:57 +00:00
static void rna_BezTriple_handle1_set ( PointerRNA * ptr , const float * values )
2009-02-02 11:51:10 +00:00
{
2012-07-23 22:39:26 +00:00
BezTriple * bezt = ( BezTriple * ) ptr - > data ;
copy_v3_v3 ( bezt - > vec [ 0 ] , values ) ;
2009-02-02 11:51:10 +00:00
}
2009-02-02 19:57:57 +00:00
static void rna_BezTriple_handle2_get ( PointerRNA * ptr , float * values )
2009-02-02 11:51:10 +00:00
{
2012-07-23 22:39:26 +00:00
BezTriple * bezt = ( BezTriple * ) ptr - > data ;
copy_v3_v3 ( values , bezt - > vec [ 2 ] ) ;
2009-02-02 11:51:10 +00:00
}
2009-02-02 19:57:57 +00:00
static void rna_BezTriple_handle2_set ( PointerRNA * ptr , const float * values )
2009-02-02 11:51:10 +00:00
{
2012-07-23 22:39:26 +00:00
BezTriple * bezt = ( BezTriple * ) ptr - > data ;
copy_v3_v3 ( bezt - > vec [ 2 ] , values ) ;
2009-02-02 11:51:10 +00:00
}
2009-02-02 19:57:57 +00:00
static void rna_BezTriple_ctrlpoint_get ( PointerRNA * ptr , float * values )
2009-02-02 11:51:10 +00:00
{
2012-07-23 22:39:26 +00:00
BezTriple * bezt = ( BezTriple * ) ptr - > data ;
copy_v3_v3 ( values , bezt - > vec [ 1 ] ) ;
2009-02-02 11:51:10 +00:00
}
2009-02-02 19:57:57 +00:00
static void rna_BezTriple_ctrlpoint_set ( PointerRNA * ptr , const float * values )
2009-02-02 11:51:10 +00:00
{
2012-07-23 22:39:26 +00:00
BezTriple * bezt = ( BezTriple * ) ptr - > data ;
copy_v3_v3 ( bezt - > vec [ 1 ] , values ) ;
2009-02-02 11:51:10 +00:00
}
2011-05-31 02:14:25 +00:00
static void rna_Curve_texspace_set ( Main * UNUSED ( bmain ) , Scene * UNUSED ( scene ) , PointerRNA * ptr )
2011-01-06 11:16:35 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
2018-06-09 14:40:09 +02:00
2011-01-06 11:16:35 +00:00
if ( cu - > texflag & CU_AUTOSPACE )
2012-05-05 21:28:12 +00:00
BKE_curve_texspace_calc ( cu ) ;
2011-01-06 11:16:35 +00:00
}
2016-09-22 00:10:53 +02:00
static int rna_Curve_texspace_editable ( PointerRNA * ptr , const char * * UNUSED ( r_info ) )
2008-12-02 23:45:11 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
return ( cu - > texflag & CU_AUTOSPACE ) ? 0 : PROP_EDITABLE ;
2008-12-02 23:45:11 +00:00
}
2010-04-12 05:04:49 +00:00
static void rna_Curve_texspace_loc_get ( PointerRNA * ptr , float * values )
{
2012-03-05 23:30:41 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
2018-06-09 14:40:09 +02:00
2010-04-12 05:04:49 +00:00
if ( ! cu - > bb )
2012-05-05 21:28:12 +00:00
BKE_curve_texspace_calc ( cu ) ;
2018-06-09 14:40:09 +02:00
2010-04-12 05:04:49 +00:00
copy_v3_v3 ( values , cu - > loc ) ;
}
static void rna_Curve_texspace_loc_set ( PointerRNA * ptr , const float * values )
{
2012-03-05 23:30:41 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
2018-06-09 14:40:09 +02:00
2010-04-12 05:04:49 +00:00
copy_v3_v3 ( cu - > loc , values ) ;
}
static void rna_Curve_texspace_size_get ( PointerRNA * ptr , float * values )
{
2012-03-05 23:30:41 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
2018-06-09 14:40:09 +02:00
2010-04-12 05:04:49 +00:00
if ( ! cu - > bb )
2012-05-05 21:28:12 +00:00
BKE_curve_texspace_calc ( cu ) ;
2018-06-09 14:40:09 +02:00
2010-04-12 05:04:49 +00:00
copy_v3_v3 ( values , cu - > size ) ;
}
static void rna_Curve_texspace_size_set ( PointerRNA * ptr , const float * values )
{
2012-03-05 23:30:41 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
2018-06-09 14:40:09 +02:00
2010-04-12 05:04:49 +00:00
copy_v3_v3 ( cu - > size , values ) ;
}
2013-09-20 06:35:28 +00:00
static void rna_Curve_material_index_range ( PointerRNA * ptr , int * min , int * max ,
int * UNUSED ( softmin ) , int * UNUSED ( softmax ) )
2009-03-28 10:52:51 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-03-05 23:30:41 +00:00
* min = 0 ;
2012-11-07 12:31:05 +00:00
* max = max_ii ( 0 , cu - > totcol - 1 ) ;
2009-03-28 10:52:51 +00:00
}
2014-02-23 18:38:08 +11:00
/* simply offset by don't expose -1 */
static int rna_ChariInfo_material_index_get ( PointerRNA * ptr )
{
CharInfo * info = ptr - > data ;
return info - > mat_nr ? info - > mat_nr - 1 : 0 ;
}
static void rna_ChariInfo_material_index_set ( PointerRNA * ptr , int value )
{
CharInfo * info = ptr - > data ;
info - > mat_nr = value + 1 ;
}
2013-09-20 06:35:28 +00:00
static void rna_Curve_active_textbox_index_range ( PointerRNA * ptr , int * min , int * max ,
int * UNUSED ( softmin ) , int * UNUSED ( softmax ) )
2009-09-09 00:10:12 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-03-05 23:30:41 +00:00
* min = 0 ;
2012-11-07 12:31:05 +00:00
* max = max_ii ( 0 , cu - > totbox - 1 ) ;
2009-09-09 00:10:12 +00:00
}
2009-09-13 17:38:43 +00:00
static void rna_Curve_dimension_set ( PointerRNA * ptr , int value )
2009-03-28 10:52:51 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-03-05 23:30:41 +00:00
if ( value = = CU_3D ) cu - > flag | = CU_3D ;
2011-11-03 16:16:19 +00:00
else cu - > flag & = ~ CU_3D ;
2012-04-28 16:49:00 +00:00
BKE_curve_curve_dimension_update ( cu ) ;
2009-03-28 10:52:51 +00:00
}
2019-01-02 17:03:45 +11:00
static const EnumPropertyItem * rna_Curve_fill_mode_itemf (
bContext * UNUSED ( C ) , PointerRNA * ptr ,
PropertyRNA * UNUSED ( prop ) , bool * UNUSED ( r_free ) )
2011-09-19 09:47:58 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2011-09-19 09:47:58 +00:00
2011-09-20 06:25:15 +00:00
/* cast to quiet warning it IS a const still */
return ( EnumPropertyItem * ) ( ( cu - > flag & CU_3D ) ? curve3d_fill_mode_items : curve2d_fill_mode_items ) ;
2011-09-19 09:47:58 +00:00
}
2009-09-08 00:23:33 +00:00
static int rna_Nurb_length ( PointerRNA * ptr )
2009-09-07 15:02:43 +00:00
{
2012-05-12 11:01:29 +00:00
Nurb * nu = ( Nurb * ) ptr - > data ;
2012-03-05 23:30:41 +00:00
if ( nu - > type = = CU_BEZIER ) return 0 ;
2012-05-12 11:01:29 +00:00
return nu - > pntsv > 0 ? nu - > pntsu * nu - > pntsv : nu - > pntsu ;
2009-09-07 15:02:43 +00:00
}
static void rna_Nurb_type_set ( PointerRNA * ptr , int value )
{
2014-05-26 09:11:42 +10:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-05-12 11:01:29 +00:00
Nurb * nu = ( Nurb * ) ptr - > data ;
2014-05-26 09:11:42 +10:00
const int pntsu_prev = nu - > pntsu ;
if ( BKE_nurb_type_convert ( nu , value , true ) ) {
if ( nu - > pntsu ! = pntsu_prev ) {
cu - > actvert = CU_ACT_NONE ;
}
}
2009-09-07 15:02:43 +00:00
}
2009-03-28 10:52:51 +00:00
static void rna_BPoint_array_begin ( CollectionPropertyIterator * iter , PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Nurb * nu = ( Nurb * ) ptr - > data ;
rna_iterator_array_begin ( iter , ( void * ) nu - > bp , sizeof ( BPoint ) ,
nu - > pntsv > 0 ? nu - > pntsu * nu - > pntsv : nu - > pntsu , 0 , NULL ) ;
2009-03-28 10:52:51 +00:00
}
2011-05-31 02:14:25 +00:00
static void rna_Curve_update_data_id ( Main * UNUSED ( bmain ) , Scene * UNUSED ( scene ) , ID * id )
2009-08-03 15:06:56 +00:00
{
2017-06-08 10:14:53 +02:00
DEG_id_tag_update ( id , 0 ) ;
2012-05-12 11:01:29 +00:00
WM_main_add_notifier ( NC_GEOM | ND_DATA , id ) ;
2009-08-03 15:06:56 +00:00
}
2009-09-08 07:35:07 +00:00
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
static void rna_Curve_update_data ( Main * bmain , Scene * scene , PointerRNA * ptr )
{
rna_Curve_update_data_id ( bmain , scene , ptr - > id . data ) ;
}
2009-12-08 17:23:48 +00:00
static void rna_Curve_update_deps ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-11-05 19:32:10 +00:00
{
2017-06-08 10:14:53 +02:00
DEG_relations_tag_update ( bmain ) ;
2009-12-08 17:23:48 +00:00
rna_Curve_update_data ( bmain , scene , ptr ) ;
2009-11-05 19:32:10 +00:00
}
2010-11-17 03:15:08 +00:00
static void rna_Curve_update_points ( Main * bmain , Scene * scene , PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-03-05 23:30:41 +00:00
Nurb * nu = curve_nurb_from_point ( cu , ptr - > data , NULL , NULL ) ;
2010-11-17 03:15:08 +00:00
2012-03-05 23:30:41 +00:00
if ( nu )
2012-04-28 16:49:00 +00:00
BKE_nurb_handles_calc ( nu ) ;
2010-11-17 03:15:08 +00:00
rna_Curve_update_data ( bmain , scene , ptr ) ;
}
2010-04-01 08:49:11 +00:00
static PointerRNA rna_Curve_bevelObject_get ( PointerRNA * ptr )
2010-03-30 14:33:05 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-03-05 23:30:41 +00:00
Object * ob = cu - > bevobj ;
2010-04-01 08:49:11 +00:00
2012-03-05 23:30:41 +00:00
if ( ob )
2010-04-01 08:49:11 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_Object , ob ) ;
return rna_pointer_inherit_refine ( ptr , NULL , NULL ) ;
}
static void rna_Curve_bevelObject_set ( PointerRNA * ptr , PointerRNA value )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
Object * ob = ( Object * ) value . data ;
2010-03-30 14:33:05 +00:00
2010-03-30 18:10:05 +00:00
if ( ob ) {
2010-04-01 08:49:11 +00:00
/* if bevel object has got the save curve, as object, for which it's */
/* set as bevobj, there could be infinity loop in displist calculation */
if ( ob - > type = = OB_CURVE & & ob - > data ! = cu ) {
cu - > bevobj = ob ;
2015-10-16 21:50:23 +11:00
id_lib_extern ( ( ID * ) ob ) ;
2010-03-30 18:10:05 +00:00
}
2012-03-24 06:24:53 +00:00
}
else {
2010-04-01 08:49:11 +00:00
cu - > bevobj = NULL ;
2010-03-30 14:33:05 +00:00
}
2010-04-01 08:49:11 +00:00
}
2010-03-30 14:33:05 +00:00
2018-07-02 11:47:00 +02:00
static bool rna_Curve_otherObject_poll ( PointerRNA * ptr , PointerRNA value )
2010-08-03 06:51:36 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
Object * ob = ( Object * ) value . data ;
2010-08-03 06:51:36 +00:00
if ( ob ) {
if ( ob - > type = = OB_CURVE & & ob - > data ! = cu ) {
return 1 ;
}
}
return 0 ;
}
2010-04-01 08:49:11 +00:00
static PointerRNA rna_Curve_taperObject_get ( PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-03-05 23:30:41 +00:00
Object * ob = cu - > taperobj ;
2010-04-01 08:49:11 +00:00
2012-03-05 23:30:41 +00:00
if ( ob )
2010-04-01 08:49:11 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_Object , ob ) ;
return rna_pointer_inherit_refine ( ptr , NULL , NULL ) ;
2010-03-30 14:33:05 +00:00
}
2010-04-01 08:49:11 +00:00
static void rna_Curve_taperObject_set ( PointerRNA * ptr , PointerRNA value )
2010-03-30 14:33:05 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
Object * ob = ( Object * ) value . data ;
2010-03-30 14:33:05 +00:00
2010-03-30 18:10:05 +00:00
if ( ob ) {
2010-04-01 08:49:11 +00:00
/* if taper object has got the save curve, as object, for which it's */
2010-03-30 18:10:05 +00:00
/* set as bevobj, there could be infinity loop in displist calculation */
2010-04-01 08:49:11 +00:00
if ( ob - > type = = OB_CURVE & & ob - > data ! = cu ) {
cu - > taperobj = ob ;
2015-10-16 21:50:23 +11:00
id_lib_extern ( ( ID * ) ob ) ;
2010-03-30 18:10:05 +00:00
}
2012-03-24 06:24:53 +00:00
}
else {
2010-04-01 08:49:11 +00:00
cu - > taperobj = NULL ;
2010-03-30 14:33:05 +00:00
}
}
2009-12-08 17:23:48 +00:00
static void rna_Curve_resolution_u_update_data ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-12-04 01:38:36 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-04-28 16:49:00 +00:00
ListBase * nurbs = BKE_curve_nurbs_get ( cu ) ;
2012-03-05 23:30:41 +00:00
Nurb * nu = nurbs - > first ;
2010-07-25 11:57:36 +00:00
2012-03-05 23:30:41 +00:00
while ( nu ) {
nu - > resolu = cu - > resolu ;
nu = nu - > next ;
2009-12-04 01:38:36 +00:00
}
2018-06-09 14:40:09 +02:00
2009-12-08 17:23:48 +00:00
rna_Curve_update_data ( bmain , scene , ptr ) ;
2009-12-04 01:38:36 +00:00
}
2009-12-08 17:23:48 +00:00
static void rna_Curve_resolution_v_update_data ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-12-04 01:38:36 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-04-28 16:49:00 +00:00
ListBase * nurbs = BKE_curve_nurbs_get ( cu ) ;
2012-03-05 23:30:41 +00:00
Nurb * nu = nurbs - > first ;
2010-07-25 11:57:36 +00:00
2012-03-05 23:30:41 +00:00
while ( nu ) {
nu - > resolv = cu - > resolv ;
nu = nu - > next ;
2009-12-04 01:38:36 +00:00
}
2010-07-25 11:57:36 +00:00
2009-12-08 17:23:48 +00:00
rna_Curve_update_data ( bmain , scene , ptr ) ;
2009-12-04 01:38:36 +00:00
}
2010-09-02 07:00:34 +00:00
static float rna_Curve_offset_get ( PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2010-09-02 07:00:34 +00:00
return cu - > width - 1.0f ;
}
static void rna_Curve_offset_set ( PointerRNA * ptr , float value )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-03-05 23:30:41 +00:00
cu - > width = 1.0f + value ;
2010-09-02 07:00:34 +00:00
}
2013-04-09 00:42:01 +00:00
static int rna_Curve_body_length ( PointerRNA * ptr ) ;
2012-09-22 14:07:55 +00:00
static void rna_Curve_body_get ( PointerRNA * ptr , char * value )
2009-11-12 14:40:09 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2013-04-09 00:42:01 +00:00
BLI_strncpy ( value , cu - > str , rna_Curve_body_length ( ptr ) + 1 ) ;
2009-11-12 14:40:09 +00:00
}
2012-09-22 14:07:55 +00:00
static int rna_Curve_body_length ( PointerRNA * ptr )
2009-11-12 14:40:09 +00:00
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2014-01-03 17:04:42 +11:00
return cu - > len ;
2009-11-12 14:40:09 +00:00
}
2014-01-03 17:04:42 +11:00
/* TODO, how to handle editmode? */
2012-09-22 14:07:55 +00:00
static void rna_Curve_body_set ( PointerRNA * ptr , const char * value )
2009-11-12 14:40:09 +00:00
{
2014-01-03 17:04:42 +11:00
size_t len_bytes ;
size_t len_chars = BLI_strlen_utf8_ex ( value , & len_bytes ) ;
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2009-11-12 14:40:09 +00:00
2014-01-06 02:40:17 +11:00
cu - > len_wchar = len_chars ;
2014-01-03 17:04:42 +11:00
cu - > len = len_bytes ;
cu - > pos = len_chars ;
2009-11-12 14:40:09 +00:00
2012-03-18 09:27:36 +00:00
if ( cu - > str )
MEM_freeN ( cu - > str ) ;
if ( cu - > strinfo )
MEM_freeN ( cu - > strinfo ) ;
2009-11-12 14:40:09 +00:00
2014-01-03 17:04:42 +11:00
cu - > str = MEM_mallocN ( len_bytes + sizeof ( wchar_t ) , " str " ) ;
cu - > strinfo = MEM_callocN ( ( len_chars + 4 ) * sizeof ( CharInfo ) , " strinfo " ) ;
2009-11-12 14:40:09 +00:00
2014-01-03 17:04:42 +11:00
BLI_strncpy ( cu - > str , value , len_bytes + 1 ) ;
2009-11-12 14:40:09 +00:00
}
2010-10-04 10:06:18 +00:00
static void rna_Nurb_update_cyclic_u ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-09-08 07:35:07 +00:00
{
2012-05-12 11:01:29 +00:00
Nurb * nu = ( Nurb * ) ptr - > data ;
2009-09-08 07:35:07 +00:00
2012-03-05 23:30:41 +00:00
if ( nu - > type = = CU_BEZIER ) {
2012-04-28 16:49:00 +00:00
BKE_nurb_handles_calc ( nu ) ;
2012-03-24 06:24:53 +00:00
}
else {
2012-04-28 16:49:00 +00:00
BKE_nurb_knot_calc_u ( nu ) ;
2010-10-04 10:06:18 +00:00
}
rna_Curve_update_data ( bmain , scene , ptr ) ;
}
static void rna_Nurb_update_cyclic_v ( Main * bmain , Scene * scene , PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Nurb * nu = ( Nurb * ) ptr - > data ;
2010-10-04 10:06:18 +00:00
2012-04-28 16:49:00 +00:00
BKE_nurb_knot_calc_v ( nu ) ;
2009-09-08 07:35:07 +00:00
2009-12-08 17:23:48 +00:00
rna_Curve_update_data ( bmain , scene , ptr ) ;
2009-09-08 07:35:07 +00:00
}
2009-12-08 17:23:48 +00:00
static void rna_Nurb_update_knot_u ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-09-08 07:35:07 +00:00
{
2012-05-12 11:01:29 +00:00
Nurb * nu = ( Nurb * ) ptr - > data ;
2009-09-08 07:35:07 +00:00
2012-04-28 16:49:00 +00:00
BKE_nurb_order_clamp_u ( nu ) ;
BKE_nurb_knot_calc_u ( nu ) ;
2009-09-08 07:35:07 +00:00
2009-12-08 17:23:48 +00:00
rna_Curve_update_data ( bmain , scene , ptr ) ;
2009-09-08 07:35:07 +00:00
}
2009-12-08 17:23:48 +00:00
static void rna_Nurb_update_knot_v ( Main * bmain , Scene * scene , PointerRNA * ptr )
2009-09-08 07:35:07 +00:00
{
2012-05-12 11:01:29 +00:00
Nurb * nu = ( Nurb * ) ptr - > data ;
2009-09-08 07:35:07 +00:00
2012-04-28 16:49:00 +00:00
BKE_nurb_order_clamp_v ( nu ) ;
BKE_nurb_knot_calc_v ( nu ) ;
2009-09-08 07:35:07 +00:00
2009-12-08 17:23:48 +00:00
rna_Curve_update_data ( bmain , scene , ptr ) ;
2009-09-08 07:35:07 +00:00
}
2010-04-06 01:28:39 +00:00
static void rna_Curve_spline_points_add ( ID * id , Nurb * nu , ReportList * reports , int number )
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
{
2012-03-05 23:30:41 +00:00
if ( nu - > type = = CU_BEZIER ) {
2012-10-20 10:28:34 +00:00
BKE_report ( reports , RPT_ERROR , " Bezier spline cannot have points added " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
2012-03-05 23:30:41 +00:00
else if ( number = = 0 ) {
/* do nothing */
2012-03-24 06:24:53 +00:00
}
else {
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-04-28 16:49:00 +00:00
BKE_nurb_points_add ( nu , number ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
/* update */
2012-04-28 16:49:00 +00:00
BKE_nurb_knot_calc_u ( nu ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2010-04-06 01:28:39 +00:00
rna_Curve_update_data_id ( NULL , NULL , id ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
}
2010-04-06 01:28:39 +00:00
static void rna_Curve_spline_bezpoints_add ( ID * id , Nurb * nu , ReportList * reports , int number )
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
{
2012-03-05 23:30:41 +00:00
if ( nu - > type ! = CU_BEZIER ) {
2011-04-11 01:18:25 +00:00
BKE_report ( reports , RPT_ERROR , " Only Bezier splines can be added " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
2012-03-05 23:30:41 +00:00
else if ( number = = 0 ) {
/* do nothing */
2012-03-24 06:24:53 +00:00
}
else {
2012-04-28 16:49:00 +00:00
BKE_nurb_bezierPoints_add ( nu , number ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
/* update */
2012-04-28 16:49:00 +00:00
BKE_nurb_knot_calc_u ( nu ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2010-04-06 01:28:39 +00:00
rna_Curve_update_data_id ( NULL , NULL , id ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
}
static Nurb * rna_Curve_spline_new ( Curve * cu , int type )
{
2012-05-12 11:01:29 +00:00
Nurb * nu = ( Nurb * ) MEM_callocN ( sizeof ( Nurb ) , " spline.new " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-03-05 23:30:41 +00:00
if ( type = = CU_BEZIER ) {
BezTriple * bezt = ( BezTriple * ) MEM_callocN ( sizeof ( BezTriple ) , " spline.new.bezt " ) ;
bezt - > radius = 1.0 ;
nu - > bezt = bezt ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
else {
2012-03-05 23:30:41 +00:00
BPoint * bp = ( BPoint * ) MEM_callocN ( sizeof ( BPoint ) , " spline.new.bp " ) ;
bp - > radius = 1.0f ;
nu - > bp = bp ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
2012-03-05 23:30:41 +00:00
nu - > type = type ;
nu - > pntsu = 1 ;
nu - > pntsv = 1 ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-03-05 23:30:41 +00:00
nu - > orderu = nu - > orderv = 4 ;
nu - > resolu = nu - > resolv = 12 ;
nu - > flag = CU_SMOOTH ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2013-08-15 07:59:32 +00:00
if ( ( cu - > flag & CU_3D ) = = 0 ) {
nu - > flag | = CU_2D ;
}
2012-04-28 16:49:00 +00:00
BLI_addtail ( BKE_curve_nurbs_get ( cu ) , nu ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
return nu ;
}
2012-11-02 09:41:26 +00:00
static void rna_Curve_spline_remove ( Curve * cu , ReportList * reports , PointerRNA * nu_ptr )
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
{
2012-11-02 09:41:26 +00:00
Nurb * nu = nu_ptr - > data ;
2012-04-28 16:49:00 +00:00
ListBase * nurbs = BKE_curve_nurbs_get ( cu ) ;
2010-07-25 11:57:36 +00:00
2014-04-01 11:34:00 +11:00
if ( BLI_remlink_safe ( nurbs , nu ) = = false ) {
2012-10-20 10:28:34 +00:00
BKE_reportf ( reports , RPT_ERROR , " Curve '%s' does not contain spline given " , cu - > id . name + 2 ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
return ;
}
2012-04-28 16:49:00 +00:00
BKE_nurb_free ( nu ) ;
2012-11-02 09:41:26 +00:00
RNA_POINTER_INVALIDATE ( nu_ptr ) ;
2011-11-23 16:12:11 +00:00
2018-12-06 17:52:37 +01:00
DEG_id_tag_update ( & cu - > id , ID_RECALC_GEOMETRY ) ;
2012-05-12 11:01:29 +00:00
WM_main_add_notifier ( NC_GEOM | ND_DATA , NULL ) ;
2011-11-23 16:12:11 +00:00
}
static void rna_Curve_spline_clear ( Curve * cu )
{
2012-04-28 16:49:00 +00:00
ListBase * nurbs = BKE_curve_nurbs_get ( cu ) ;
2011-11-23 16:12:11 +00:00
2012-04-28 16:49:00 +00:00
BKE_nurbList_free ( nurbs ) ;
2011-11-23 16:12:11 +00:00
2018-12-06 17:52:37 +01:00
DEG_id_tag_update ( & cu - > id , ID_RECALC_GEOMETRY ) ;
2012-05-12 11:01:29 +00:00
WM_main_add_notifier ( NC_GEOM | ND_DATA , NULL ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
static PointerRNA rna_Curve_active_spline_get ( PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
Nurb * nu ;
2012-04-28 16:49:00 +00:00
ListBase * nurbs = BKE_curve_nurbs_get ( cu ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-03-05 23:30:41 +00:00
/* for curve outside editmode will set to -1, should be changed to be allowed outside of editmode. */
nu = BLI_findlink ( nurbs , cu - > actnu ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-03-05 23:30:41 +00:00
if ( nu )
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_Spline , nu ) ;
return rna_pointer_inherit_refine ( ptr , NULL , NULL ) ;
}
static void rna_Curve_active_spline_set ( PointerRNA * ptr , PointerRNA value )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > data ;
2012-03-05 23:30:41 +00:00
Nurb * nu = value . data ;
2012-04-28 16:49:00 +00:00
ListBase * nubase = BKE_curve_nurbs_get ( cu ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
/* -1 is ok for an unset index */
2012-03-05 23:30:41 +00:00
if ( nu = = NULL )
cu - > actnu = - 1 ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
else
2012-03-05 23:30:41 +00:00
cu - > actnu = BLI_findindex ( nubase , nu ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
2010-11-17 03:15:08 +00:00
static char * rna_Curve_spline_path ( PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-04-28 16:49:00 +00:00
ListBase * nubase = BKE_curve_nurbs_get ( cu ) ;
2012-03-05 23:30:41 +00:00
Nurb * nu = ptr - > data ;
int index = BLI_findindex ( nubase , nu ) ;
2010-11-17 03:15:08 +00:00
if ( index > = 0 )
return BLI_sprintfN ( " splines[%d] " , index ) ;
else
return BLI_strdup ( " " ) ;
}
/* use for both bezier and nurbs */
static char * rna_Curve_spline_point_path ( PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2010-11-17 03:15:08 +00:00
Nurb * nu ;
2012-03-05 23:30:41 +00:00
void * point = ptr - > data ;
2010-11-17 03:15:08 +00:00
int nu_index , pt_index ;
2012-03-05 23:30:41 +00:00
nu = curve_nurb_from_point ( cu , point , & nu_index , & pt_index ) ;
2010-11-17 03:15:08 +00:00
if ( nu ) {
2012-03-05 23:30:41 +00:00
if ( nu - > type = = CU_BEZIER ) {
2010-11-17 03:15:08 +00:00
return BLI_sprintfN ( " splines[%d].bezier_points[%d] " , nu_index , pt_index ) ;
}
else {
return BLI_sprintfN ( " splines[%d].points[%d] " , nu_index , pt_index ) ;
2012-03-05 23:30:41 +00:00
}
2010-11-17 03:15:08 +00:00
}
else {
return BLI_strdup ( " " ) ;
}
}
2010-07-30 06:48:18 +00:00
static char * rna_TextBox_path ( PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-03-05 23:30:41 +00:00
TextBox * tb = ptr - > data ;
int index = ( int ) ( tb - cu - > tb ) ;
2010-07-30 06:48:18 +00:00
if ( index > = 0 & & index < cu - > totbox )
2011-08-09 14:50:40 +00:00
return BLI_sprintfN ( " text_boxes[%d] " , index ) ;
2010-07-30 06:48:18 +00:00
else
return BLI_strdup ( " " ) ;
}
2010-11-20 17:28:05 +00:00
static void rna_Curve_splines_begin ( CollectionPropertyIterator * iter , PointerRNA * ptr )
{
2012-05-12 11:01:29 +00:00
Curve * cu = ( Curve * ) ptr - > id . data ;
2012-04-28 16:49:00 +00:00
rna_iterator_listbase_begin ( iter , BKE_curve_nurbs_get ( cu ) , NULL ) ;
2010-11-20 17:28:05 +00:00
}
2018-07-05 22:25:34 +02:00
static bool rna_Curve_is_editmode_get ( PointerRNA * ptr )
2013-07-03 22:57:00 +00:00
{
Curve * cu = ( Curve * ) ptr - > id . data ;
const short type = BKE_curve_type_get ( cu ) ;
if ( type = = OB_FONT ) {
return ( cu - > editfont ! = NULL ) ;
}
else {
return ( cu - > editnurb ! = NULL ) ;
}
}
2008-12-01 19:02:27 +00:00
# else
2015-09-21 09:44:14 +10:00
static const float tilt_limit = DEG2RADF ( 21600.0f ) ;
2009-02-02 19:57:57 +00:00
static void rna_def_bpoint ( BlenderRNA * brna )
2009-02-02 11:51:10 +00:00
{
StructRNA * srna ;
PropertyRNA * prop ;
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " SplinePoint " , NULL ) ;
2009-02-02 11:51:10 +00:00
RNA_def_struct_sdna ( srna , " BPoint " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " SplinePoint " , " Spline point without handles " ) ;
2009-02-02 11:51:10 +00:00
/* Boolean values */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " select " , PROP_BOOLEAN , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " f1 " , 0 ) ;
2010-07-15 16:56:04 +00:00
RNA_def_property_ui_text ( prop , " Select " , " Selection status " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " hide " , PROP_BOOLEAN , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " hide " , 0 ) ;
2010-07-15 16:56:04 +00:00
RNA_def_property_ui_text ( prop , " Hide " , " Visibility status " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
/* Vector value */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " co " , PROP_FLOAT , PROP_TRANSLATION ) ;
2009-11-29 16:42:51 +00:00
RNA_def_property_array ( prop , 3 ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_float_sdna ( prop , NULL , " vec " ) ;
RNA_def_property_ui_text ( prop , " Point " , " Point coordinates " ) ;
2012-04-10 08:33:30 +00:00
RNA_def_property_ui_range ( prop , - FLT_MAX , FLT_MAX , 1 , RNA_TRANSLATION_PREC_DEFAULT ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " weight " , PROP_FLOAT , PROP_NONE ) ;
2009-11-29 16:42:51 +00:00
RNA_def_property_float_sdna ( prop , NULL , " vec[3] " ) ;
2011-10-20 07:56:04 +00:00
RNA_def_property_ui_text ( prop , " Weight " , " NURBS weight " ) ;
2009-11-29 16:42:51 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
/* Number values */
2012-10-08 20:01:36 +00:00
prop = RNA_def_property ( srna , " tilt " , PROP_FLOAT , PROP_ANGLE ) ;
2013-05-27 23:51:01 +00:00
RNA_def_property_range ( prop , - tilt_limit , tilt_limit ) ;
2015-09-21 09:44:14 +10:00
RNA_def_property_ui_range ( prop , - tilt_limit , tilt_limit , 10 , 3 ) ;
2010-02-09 17:50:56 +00:00
RNA_def_property_ui_text ( prop , " Tilt " , " Tilt in 3D View " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " weight_softbody " , PROP_FLOAT , PROP_NONE ) ;
2009-11-29 16:42:51 +00:00
RNA_def_property_float_sdna ( prop , NULL , " weight " ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_range ( prop , 0.01f , 100.0f ) ;
RNA_def_property_ui_text ( prop , " Weight " , " Softbody goal weight " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " radius " , PROP_FLOAT , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_float_sdna ( prop , NULL , " radius " ) ;
2010-11-17 12:59:59 +00:00
RNA_def_property_range ( prop , 0.0f , FLT_MAX ) ;
2012-07-04 15:04:38 +00:00
RNA_def_property_ui_text ( prop , " Bevel Radius " , " Radius for beveling " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2010-11-17 03:15:08 +00:00
RNA_def_struct_path_func ( srna , " rna_Curve_spline_point_path " ) ;
2009-02-02 11:51:10 +00:00
}
2009-02-02 19:57:57 +00:00
static void rna_def_beztriple ( BlenderRNA * brna )
2009-02-02 11:51:10 +00:00
{
StructRNA * srna ;
PropertyRNA * prop ;
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " BezierSplinePoint " , NULL ) ;
2009-02-02 11:51:10 +00:00
RNA_def_struct_sdna ( srna , " BezTriple " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " Bezier Curve Point " , " Bezier curve point with two handles " ) ;
2009-02-02 11:51:10 +00:00
/* Boolean values */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " select_left_handle " , PROP_BOOLEAN , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " f1 " , 0 ) ;
RNA_def_property_ui_text ( prop , " Handle 1 selected " , " Handle 1 selection status " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " select_right_handle " , PROP_BOOLEAN , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " f3 " , 0 ) ;
RNA_def_property_ui_text ( prop , " Handle 2 selected " , " Handle 2 selection status " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " select_control_point " , PROP_BOOLEAN , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " f2 " , 0 ) ;
RNA_def_property_ui_text ( prop , " Control Point selected " , " Control point selection status " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " hide " , PROP_BOOLEAN , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " hide " , 0 ) ;
2010-07-15 16:56:04 +00:00
RNA_def_property_ui_text ( prop , " Hide " , " Visibility status " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
/* Enums */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " handle_left_type " , PROP_ENUM , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " h1 " ) ;
2009-05-08 10:50:32 +00:00
RNA_def_property_enum_items ( prop , beztriple_handle_type_items ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_ui_text ( prop , " Handle 1 Type " , " Handle types " ) ;
2010-11-17 03:15:08 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_points " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " handle_right_type " , PROP_ENUM , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " h2 " ) ;
2009-05-08 10:50:32 +00:00
RNA_def_property_enum_items ( prop , beztriple_handle_type_items ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_ui_text ( prop , " Handle 2 Type " , " Handle types " ) ;
2010-11-17 03:15:08 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_points " ) ;
2009-02-02 11:51:10 +00:00
/* Vector values */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " handle_left " , PROP_FLOAT , PROP_TRANSLATION ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_array ( prop , 3 ) ;
RNA_def_property_float_funcs ( prop , " rna_BezTriple_handle1_get " , " rna_BezTriple_handle1_set " , NULL ) ;
RNA_def_property_ui_text ( prop , " Handle 1 " , " Coordinates of the first handle " ) ;
2012-04-10 08:33:30 +00:00
RNA_def_property_ui_range ( prop , - FLT_MAX , FLT_MAX , 1 , RNA_TRANSLATION_PREC_DEFAULT ) ;
2010-11-17 03:15:08 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_points " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " co " , PROP_FLOAT , PROP_TRANSLATION ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_array ( prop , 3 ) ;
RNA_def_property_float_funcs ( prop , " rna_BezTriple_ctrlpoint_get " , " rna_BezTriple_ctrlpoint_set " , NULL ) ;
RNA_def_property_ui_text ( prop , " Control Point " , " Coordinates of the control point " ) ;
2012-04-10 08:33:30 +00:00
RNA_def_property_ui_range ( prop , - FLT_MAX , FLT_MAX , 1 , RNA_TRANSLATION_PREC_DEFAULT ) ;
2010-11-17 03:15:08 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_points " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " handle_right " , PROP_FLOAT , PROP_TRANSLATION ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_array ( prop , 3 ) ;
RNA_def_property_float_funcs ( prop , " rna_BezTriple_handle2_get " , " rna_BezTriple_handle2_set " , NULL ) ;
RNA_def_property_ui_text ( prop , " Handle 2 " , " Coordinates of the second handle " ) ;
2012-04-10 08:33:30 +00:00
RNA_def_property_ui_range ( prop , - FLT_MAX , FLT_MAX , 1 , RNA_TRANSLATION_PREC_DEFAULT ) ;
2010-11-17 03:15:08 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_points " ) ;
2009-02-02 11:51:10 +00:00
/* Number values */
2012-10-08 20:01:36 +00:00
prop = RNA_def_property ( srna , " tilt " , PROP_FLOAT , PROP_ANGLE ) ;
2015-09-21 09:44:14 +10:00
RNA_def_property_range ( prop , - tilt_limit , tilt_limit ) ;
RNA_def_property_ui_range ( prop , - tilt_limit , tilt_limit , 10 , 3 ) ;
2010-02-09 17:50:56 +00:00
RNA_def_property_ui_text ( prop , " Tilt " , " Tilt in 3D View " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-10-09 08:40:20 +00:00
prop = RNA_def_property ( srna , " weight_softbody " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " weight " ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_range ( prop , 0.01f , 100.0f ) ;
RNA_def_property_ui_text ( prop , " Weight " , " Softbody goal weight " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-02-02 11:51:10 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " radius " , PROP_FLOAT , PROP_NONE ) ;
2009-02-02 11:51:10 +00:00
RNA_def_property_float_sdna ( prop , NULL , " radius " ) ;
2010-11-17 12:59:59 +00:00
RNA_def_property_range ( prop , 0.0f , FLT_MAX ) ;
2012-07-04 15:04:38 +00:00
RNA_def_property_ui_text ( prop , " Bevel Radius " , " Radius for beveling " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2010-11-17 03:15:08 +00:00
RNA_def_struct_path_func ( srna , " rna_Curve_spline_point_path " ) ;
2009-02-02 11:51:10 +00:00
}
2012-06-29 09:16:59 +00:00
static void rna_def_path ( BlenderRNA * UNUSED ( brna ) , StructRNA * srna )
2008-12-01 19:02:27 +00:00
{
PropertyRNA * prop ;
2018-06-09 14:40:09 +02:00
2008-12-01 19:02:27 +00:00
/* number values */
2019-02-19 15:23:46 +01:00
prop = RNA_def_property ( srna , " path_duration " , PROP_INT , PROP_TIME ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_int_sdna ( prop , NULL , " pathlen " ) ;
2010-02-03 06:30:16 +00:00
RNA_def_property_range ( prop , 1 , MAXFRAME ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Path Length " ,
" The number of frames that are needed to traverse the path, "
" defining the maximum value for the 'Evaluation Time' setting " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2008-12-01 19:02:27 +00:00
/* flags */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_path " , PROP_BOOLEAN , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_PATH ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Path " , " Enable the curve to become a translation path " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_path_follow " , PROP_BOOLEAN , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_FOLLOW ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Follow " , " Make curve path children to rotate along the path " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_stretch " , PROP_BOOLEAN , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_STRETCH ) ;
2012-02-28 11:18:05 +00:00
RNA_def_property_ui_text ( prop , " Stretch " , " Option for curve-deform: "
" make deformed child to stretch along entire path " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2010-08-06 08:27:07 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_deform_bounds " , PROP_BOOLEAN , PROP_NONE ) ;
2010-08-06 08:27:07 +00:00
RNA_def_property_boolean_negative_sdna ( prop , NULL , " flag " , CU_DEFORM_BOUNDS_OFF ) ;
2012-02-28 11:18:05 +00:00
RNA_def_property_ui_text ( prop , " Bounds Clamp " , " Option for curve-deform: "
" Use the mesh bounds to clamp the deformation " ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2010-08-06 08:27:07 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_radius " , PROP_BOOLEAN , PROP_NONE ) ;
2009-09-12 16:25:49 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_PATH_RADIUS ) ;
2012-02-28 11:18:05 +00:00
RNA_def_property_ui_text ( prop , " Radius " , " Option for paths and curve-deform: "
" apply the curve radius with path following it and deforming " ) ;
2009-09-12 16:25:49 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2008-12-01 19:02:27 +00:00
}
2012-06-29 09:16:59 +00:00
static void rna_def_nurbs ( BlenderRNA * UNUSED ( brna ) , StructRNA * srna )
2008-12-01 19:02:27 +00:00
{
PropertyRNA * prop ;
2018-06-09 14:40:09 +02:00
2008-12-01 19:02:27 +00:00
/* flags */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_uv_as_generated " , PROP_BOOLEAN , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_UV_ORCO ) ;
2010-11-16 12:10:57 +00:00
RNA_def_property_ui_text ( prop , " Use UV for Mapping " , " Uses the UV values as Generated textured coordinates " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2008-12-01 19:02:27 +00:00
}
2012-06-29 09:16:59 +00:00
static void rna_def_font ( BlenderRNA * UNUSED ( brna ) , StructRNA * srna )
2008-12-01 19:02:27 +00:00
{
PropertyRNA * prop ;
2016-06-20 23:21:24 -03:00
2017-10-18 15:07:26 +11:00
static const EnumPropertyItem prop_align_items [ ] = {
2018-10-01 10:45:50 +02:00
{ CU_ALIGN_X_LEFT , " LEFT " , ICON_ALIGN_LEFT , " Left " , " Align text to the left " } ,
{ CU_ALIGN_X_MIDDLE , " CENTER " , ICON_ALIGN_CENTER , " Center " , " Center text " } ,
{ CU_ALIGN_X_RIGHT , " RIGHT " , ICON_ALIGN_RIGHT , " Right " , " Align text to the right " } ,
{ CU_ALIGN_X_JUSTIFY , " JUSTIFY " , ICON_ALIGN_JUSTIFY , " Justify " , " Align to the left and the right " } ,
{ CU_ALIGN_X_FLUSH , " FLUSH " , ICON_ALIGN_FLUSH , " Flush " , " Align to the left and the right, with equal character spacing " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2016-06-20 23:21:24 -03:00
2017-10-18 15:07:26 +11:00
static const EnumPropertyItem prop_align_y_items [ ] = {
2018-10-01 10:45:50 +02:00
{ CU_ALIGN_Y_TOP_BASELINE , " TOP_BASELINE " , ICON_ALIGN_TOP , " Top Base-Line " , " Align to top but use the base-line of the text " } ,
{ CU_ALIGN_Y_TOP , " TOP " , ICON_ALIGN_TOP , " Top " , " Align text to the top " } ,
{ CU_ALIGN_Y_CENTER , " CENTER " , ICON_ALIGN_MIDDLE , " Center " , " Align text to the middle " } ,
{ CU_ALIGN_Y_BOTTOM , " BOTTOM " , ICON_ALIGN_BOTTOM , " Bottom " , " Align text to the bottom " } ,
{ CU_ALIGN_Y_BOTTOM_BASELINE , " BOTTOM_BASELINE " , ICON_ALIGN_BOTTOM , " Bottom Base-Line " ,
2018-09-05 11:21:12 +10:00
" Align text to the bottom but use the base-line of the text " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2016-06-20 23:21:24 -03:00
} ;
2018-09-12 13:00:30 -03:00
static const EnumPropertyItem prop_overflow_items [ ] = {
{ CU_OVERFLOW_NONE , " NONE " , 0 , " Overflow " , " Let the text overflow outside the text boxes " } ,
{ CU_OVERFLOW_SCALE , " SCALE " , 0 , " Scale to Fit " , " Scale down the text to fit inside the text boxes " } ,
{ CU_OVERFLOW_TRUNCATE , " TRUNCATE " , 0 , " Truncate " , " Truncate the text that would go outside the text boxes " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2018-09-12 13:00:30 -03:00
} ;
2009-05-11 11:31:10 +00:00
/* Enums */
2016-06-20 23:21:24 -03:00
prop = RNA_def_property ( srna , " align_x " , PROP_ENUM , PROP_NONE ) ;
2010-08-19 17:31:10 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " spacemode " ) ;
2009-05-11 11:31:10 +00:00
RNA_def_property_enum_items ( prop , prop_align_items ) ;
2016-06-20 23:21:24 -03:00
RNA_def_property_ui_text ( prop , " Text Horizontal Align " , " Text horizontal align from the object center " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2016-06-20 23:21:24 -03:00
prop = RNA_def_property ( srna , " align_y " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " align_y " ) ;
RNA_def_property_enum_items ( prop , prop_align_y_items ) ;
RNA_def_property_ui_text ( prop , " Text Vertical Align " , " Text vertical align from the object center " ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-09-12 13:00:30 -03:00
prop = RNA_def_property ( srna , " overflow " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " overflow " ) ;
RNA_def_property_enum_items ( prop , prop_overflow_items ) ;
RNA_def_property_enum_default ( prop , CU_OVERFLOW_NONE ) ;
RNA_def_property_ui_text ( prop , " Textbox Overflow " ,
2018-12-24 12:31:39 +01:00
" Handle the text behavior when it doesn't fit in the text boxes " ) ;
2018-09-12 13:00:30 -03:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2008-12-01 19:02:27 +00:00
/* number values */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " size " , PROP_FLOAT , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " fsize " ) ;
2009-10-10 16:17:33 +00:00
RNA_def_property_range ( prop , 0.0001f , 10000.0f ) ;
2010-08-22 16:44:48 +00:00
RNA_def_property_ui_range ( prop , 0.01 , 10 , 1 , 3 ) ;
2008-12-19 06:05:00 +00:00
RNA_def_property_ui_text ( prop , " Font size " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " small_caps_scale " , PROP_FLOAT , PROP_NONE ) ;
2010-07-13 22:21:59 +00:00
RNA_def_property_float_sdna ( prop , NULL , " smallcaps_scale " ) ;
2010-08-22 16:44:48 +00:00
RNA_def_property_ui_range ( prop , 0 , 1.0 , 1 , 2 ) ;
2010-07-13 22:21:59 +00:00
RNA_def_property_ui_text ( prop , " Small Caps " , " Scale of small capitals " ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " space_line " , PROP_FLOAT , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " linedist " ) ;
RNA_def_property_range ( prop , 0.0f , 10.0f ) ;
2008-12-19 06:05:00 +00:00
RNA_def_property_ui_text ( prop , " Distance between lines of text " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " space_word " , PROP_FLOAT , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " wordspace " ) ;
RNA_def_property_range ( prop , 0.0f , 10.0f ) ;
2008-12-19 06:05:00 +00:00
RNA_def_property_ui_text ( prop , " Spacing between words " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " space_character " , PROP_FLOAT , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " spacing " ) ;
RNA_def_property_range ( prop , 0.0f , 10.0f ) ;
2008-12-19 06:05:00 +00:00
RNA_def_property_ui_text ( prop , " Global spacing between characters " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " shear " , PROP_FLOAT , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " shear " ) ;
RNA_def_property_range ( prop , - 1.0f , 1.0f ) ;
2008-12-19 06:05:00 +00:00
RNA_def_property_ui_text ( prop , " Shear " , " Italic angle of the characters " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2019-01-29 18:31:39 +01:00
prop = RNA_def_property ( srna , " offset_x " , PROP_FLOAT , PROP_DISTANCE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " xof " ) ;
2016-05-31 19:06:13 -03:00
RNA_def_property_range ( prop , - FLT_MAX , FLT_MAX ) ;
RNA_def_property_ui_range ( prop , - 50.0f , 50.0f , 10 , 3 ) ;
2009-11-30 14:40:45 +00:00
RNA_def_property_ui_text ( prop , " X Offset " , " Horizontal offset from the object origin " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2019-01-29 18:31:39 +01:00
prop = RNA_def_property ( srna , " offset_y " , PROP_FLOAT , PROP_DISTANCE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " yof " ) ;
2016-05-31 19:06:13 -03:00
RNA_def_property_range ( prop , - FLT_MAX , FLT_MAX ) ;
RNA_def_property_ui_range ( prop , - 50.0f , 50.0f , 10 , 3 ) ;
2009-11-30 14:40:45 +00:00
RNA_def_property_ui_text ( prop , " Y Offset " , " Vertical offset from the object origin " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " underline_position " , PROP_FLOAT , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " ulpos " ) ;
RNA_def_property_range ( prop , - 0.2f , 0.8f ) ;
2009-09-08 11:31:15 +00:00
RNA_def_property_ui_text ( prop , " Underline Position " , " Vertical position of underline " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " underline_height " , PROP_FLOAT , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " ulheight " ) ;
2014-05-15 16:00:53 +10:00
RNA_def_property_range ( prop , 0.0f , 0.8f ) ;
2009-09-08 11:31:15 +00:00
RNA_def_property_ui_text ( prop , " Underline Thickness " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " text_boxes " , PROP_COLLECTION , PROP_NONE ) ;
2009-09-09 00:10:12 +00:00
RNA_def_property_collection_sdna ( prop , NULL , " tb " , " totbox " ) ;
RNA_def_property_struct_type ( prop , " TextBox " ) ;
RNA_def_property_ui_text ( prop , " Textboxes " , " " ) ;
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " active_textbox " , PROP_INT , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_int_sdna ( prop , NULL , " actbox " ) ;
2008-12-19 06:05:00 +00:00
RNA_def_property_ui_text ( prop , " The active text box " , " " ) ;
2009-09-09 00:10:12 +00:00
RNA_def_property_int_funcs ( prop , NULL , NULL , " rna_Curve_active_textbox_index_range " ) ;
2018-06-09 14:40:09 +02:00
2008-12-01 19:02:27 +00:00
/* strings */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " family " , PROP_STRING , PROP_NONE ) ;
2012-05-12 11:01:29 +00:00
RNA_def_property_string_maxlength ( prop , MAX_ID_NAME - 2 ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Object Font " ,
2014-01-06 01:33:45 +11:00
" Use Objects as font characters (give font objects a common name "
2016-03-04 08:40:22 +11:00
" followed by the character they represent, eg. 'family-a', 'family-b', etc, "
" set this setting to 'family-', and turn on Vertex Duplication) " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " body " , PROP_STRING , PROP_NONE ) ;
2008-12-02 23:45:11 +00:00
RNA_def_property_string_sdna ( prop , NULL , " str " ) ;
2011-11-26 12:30:01 +00:00
RNA_def_property_ui_text ( prop , " Body Text " , " Content of this text object " ) ;
2009-11-12 14:40:09 +00:00
RNA_def_property_string_funcs ( prop , " rna_Curve_body_get " , " rna_Curve_body_length " , " rna_Curve_body_set " ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_string_maxlength ( prop , 8192 ) ; /* note that originally str did not have a limit! */
2009-11-12 14:40:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2010-07-17 17:50:20 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " body_format " , PROP_COLLECTION , PROP_NONE ) ;
2014-01-03 17:04:42 +11:00
RNA_def_property_collection_sdna ( prop , NULL , " strinfo " , " len_wchar " ) ;
2010-07-17 17:50:20 +00:00
RNA_def_property_struct_type ( prop , " TextCharacterFormat " ) ;
RNA_def_property_ui_text ( prop , " Character Info " , " Stores the style of each character " ) ;
2018-06-09 14:40:09 +02:00
2008-12-01 19:02:27 +00:00
/* pointers */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " follow_curve " , PROP_POINTER , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " textoncurve " ) ;
2010-08-03 06:51:36 +00:00
RNA_def_property_pointer_funcs ( prop , NULL , NULL , NULL , " rna_Curve_otherObject_poll " ) ;
2009-05-28 23:23:47 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Text on Curve " , " Curve deforming text object " ) ;
2009-11-05 19:32:10 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_deps " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " font " , PROP_POINTER , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " vfont " ) ;
RNA_def_property_ui_text ( prop , " Font " , " " ) ;
2010-01-11 05:10:57 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-09-09 00:10:12 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " font_bold " , PROP_POINTER , PROP_NONE ) ;
2010-12-06 04:05:34 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " vfontb " ) ;
2011-07-12 09:30:40 +00:00
RNA_def_property_ui_text ( prop , " Font Bold " , " " ) ;
2010-12-06 04:05:34 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " font_italic " , PROP_POINTER , PROP_NONE ) ;
2010-12-06 04:05:34 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " vfonti " ) ;
2011-07-12 09:30:40 +00:00
RNA_def_property_ui_text ( prop , " Font Italic " , " " ) ;
2010-12-06 04:05:34 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " font_bold_italic " , PROP_POINTER , PROP_NONE ) ;
2010-12-06 04:05:34 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " vfontbi " ) ;
2011-07-12 09:30:40 +00:00
RNA_def_property_ui_text ( prop , " Font Bold Italic " , " " ) ;
2010-12-06 04:05:34 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " edit_format " , PROP_POINTER , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " curinfo " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Edit Format " , " Editing settings character formatting " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2010-12-06 04:05:34 +00:00
2008-12-01 19:02:27 +00:00
/* flags */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_fast_edit " , PROP_BOOLEAN , PROP_NONE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_FAST ) ;
2011-07-12 09:30:40 +00:00
RNA_def_property_ui_text ( prop , " Fast Editing " , " Don't fill polygons while editing " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2008-12-01 19:02:27 +00:00
}
2009-06-07 13:09:18 +00:00
static void rna_def_textbox ( BlenderRNA * brna )
2008-12-01 19:02:27 +00:00
{
StructRNA * srna ;
PropertyRNA * prop ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " TextBox " , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " Text Box " , " Text bounding box for layout " ) ;
2018-06-09 14:40:09 +02:00
2008-12-01 19:02:27 +00:00
/* number values */
2019-02-18 14:56:37 +11:00
prop = RNA_def_property ( srna , " x " , PROP_FLOAT , PROP_DISTANCE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " x " ) ;
2016-05-31 19:06:13 -03:00
RNA_def_property_range ( prop , - FLT_MAX , FLT_MAX ) ;
RNA_def_property_ui_range ( prop , - 50.0f , 50.0f , 10 , 3 ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_ui_text ( prop , " Textbox X Offset " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2019-02-18 14:56:37 +11:00
prop = RNA_def_property ( srna , " y " , PROP_FLOAT , PROP_DISTANCE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " y " ) ;
2016-05-31 19:06:13 -03:00
RNA_def_property_range ( prop , - FLT_MAX , FLT_MAX ) ;
RNA_def_property_ui_range ( prop , - 50.0f , 50.0f , 10 , 3 ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_ui_text ( prop , " Textbox Y Offset " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2008-12-01 19:02:27 +00:00
2019-02-18 14:56:37 +11:00
prop = RNA_def_property ( srna , " width " , PROP_FLOAT , PROP_DISTANCE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " w " ) ;
2016-05-31 19:06:13 -03:00
RNA_def_property_range ( prop , 0.0f , FLT_MAX ) ;
RNA_def_property_ui_range ( prop , 0.0f , 50.0f , 10 , 3 ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_ui_text ( prop , " Textbox Width " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2008-12-01 19:02:27 +00:00
2019-02-18 14:56:37 +11:00
prop = RNA_def_property ( srna , " height " , PROP_FLOAT , PROP_DISTANCE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_float_sdna ( prop , NULL , " h " ) ;
2016-05-31 19:06:13 -03:00
RNA_def_property_range ( prop , 0.0f , FLT_MAX ) ;
RNA_def_property_ui_range ( prop , 0.0f , 50.0f , 10 , 3 ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_ui_text ( prop , " Textbox Height " , " " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2010-07-30 06:48:18 +00:00
RNA_def_struct_path_func ( srna , " rna_TextBox_path " ) ;
2008-12-01 19:02:27 +00:00
}
2009-06-07 13:09:18 +00:00
static void rna_def_charinfo ( BlenderRNA * brna )
2008-12-01 19:02:27 +00:00
{
StructRNA * srna ;
PropertyRNA * prop ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " TextCharacterFormat " , NULL ) ;
2009-01-10 22:57:33 +00:00
RNA_def_struct_sdna ( srna , " CharInfo " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_struct_ui_text ( srna , " Text Character Format " , " Text character formatting settings " ) ;
2018-06-09 14:40:09 +02:00
2008-12-01 19:02:27 +00:00
/* flags */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_bold " , PROP_BOOLEAN , PROP_NONE ) ;
2010-07-13 23:51:21 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_CHINFO_BOLD ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_ui_text ( prop , " Bold " , " " ) ;
2018-10-11 08:20:35 +11:00
RNA_def_property_ui_icon ( prop , ICON_BOLD , 0 ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_italic " , PROP_BOOLEAN , PROP_NONE ) ;
2010-07-13 23:51:21 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_CHINFO_ITALIC ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_ui_text ( prop , " Italic " , " " ) ;
2018-10-11 08:20:35 +11:00
RNA_def_property_ui_icon ( prop , ICON_ITALIC , 0 ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_underline " , PROP_BOOLEAN , PROP_NONE ) ;
2010-07-13 23:51:21 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_CHINFO_UNDERLINE ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_ui_text ( prop , " Underline " , " " ) ;
2018-10-11 08:20:35 +11:00
RNA_def_property_ui_icon ( prop , ICON_UNDERLINE , 0 ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2010-07-13 23:51:21 +00:00
/* probably there is no reason to expose this */
2012-05-12 11:01:29 +00:00
#if 0
2019-02-11 17:49:35 +11:00
prop = RNA_def_property ( srna , " use_wrap " , PROP_BOOLEAN , PROP_NONE ) ;
2010-07-13 23:51:21 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_CHINFO_WRAP ) ;
2008-12-01 19:02:27 +00:00
RNA_def_property_ui_text ( prop , " Wrap " , " " ) ;
2010-07-13 23:51:21 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ; */
2012-05-12 11:01:29 +00:00
# endif
2010-07-13 22:21:59 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_small_caps " , PROP_BOOLEAN , PROP_NONE ) ;
2010-07-13 23:51:21 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_CHINFO_SMALLCAPS ) ;
2010-07-13 22:21:59 +00:00
RNA_def_property_ui_text ( prop , " Small Caps " , " " ) ;
2018-10-11 08:20:35 +11:00
RNA_def_property_ui_icon ( prop , ICON_SMALL_CAPS , 0 ) ;
2010-07-13 22:21:59 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2014-02-23 18:38:08 +11:00
prop = RNA_def_property ( srna , " material_index " , PROP_INT , PROP_UNSIGNED ) ;
// RNA_def_property_int_sdna(prop, NULL, "mat_nr");
RNA_def_property_ui_text ( prop , " Material Index " , " " ) ;
RNA_def_property_int_funcs ( prop , " rna_ChariInfo_material_index_get " , " rna_ChariInfo_material_index_set " , " rna_Curve_material_index_range " ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2019-04-02 19:11:03 +02:00
prop = RNA_def_property ( srna , " kerning " , PROP_INT , PROP_UNSIGNED ) ;
RNA_def_property_int_sdna ( prop , NULL , " kern " ) ;
RNA_def_property_ui_text ( prop , " Kerning " , " Spacing between characters " ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2008-12-01 19:02:27 +00:00
}
2009-06-07 13:09:18 +00:00
static void rna_def_surface ( BlenderRNA * brna )
{
StructRNA * srna ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " SurfaceCurve " , " Curve " ) ;
2009-06-07 13:09:18 +00:00
RNA_def_struct_sdna ( srna , " Curve " ) ;
2015-10-24 02:44:43 +11:00
RNA_def_struct_ui_text ( srna , " Surface Curve " , " Curve data-block used for storing surfaces " ) ;
2009-06-07 13:09:18 +00:00
RNA_def_struct_ui_icon ( srna , ICON_SURFACE_DATA ) ;
rna_def_nurbs ( brna , srna ) ;
}
static void rna_def_text ( BlenderRNA * brna )
{
StructRNA * srna ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " TextCurve " , " Curve " ) ;
2009-06-07 13:09:18 +00:00
RNA_def_struct_sdna ( srna , " Curve " ) ;
2015-10-24 02:44:43 +11:00
RNA_def_struct_ui_text ( srna , " Text Curve " , " Curve data-block used for storing text " ) ;
2009-06-07 13:09:18 +00:00
RNA_def_struct_ui_icon ( srna , ICON_FONT_DATA ) ;
rna_def_font ( brna , srna ) ;
rna_def_nurbs ( brna , srna ) ;
}
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
/* curve.splines[0].points */
static void rna_def_curve_spline_points ( BlenderRNA * brna , PropertyRNA * cprop )
{
StructRNA * srna ;
2012-03-05 23:30:41 +00:00
/*PropertyRNA *prop; */
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
FunctionRNA * func ;
2018-10-03 09:08:54 +10:00
PropertyRNA * parm ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_srna ( cprop , " SplinePoints " ) ;
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " SplinePoints " , NULL ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_struct_sdna ( srna , " Nurb " ) ;
RNA_def_struct_ui_text ( srna , " Spline Points " , " Collection of spline points " ) ;
2012-03-05 23:30:41 +00:00
func = RNA_def_function ( srna , " add " , " rna_Curve_spline_points_add " ) ;
2011-09-19 13:23:58 +00:00
RNA_def_function_ui_description ( func , " Add a number of points to this spline " ) ;
2012-05-12 11:01:29 +00:00
RNA_def_function_flag ( func , FUNC_USE_SELF_ID | FUNC_USE_REPORTS ) ;
2018-10-03 09:08:54 +10:00
parm = RNA_def_int ( func , " count " , 1 , 0 , INT_MAX , " Number " , " Number of points to add to the spline " , 0 , INT_MAX ) ;
RNA_def_parameter_flags ( parm , 0 , PARM_REQUIRED ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-05-12 11:01:29 +00:00
#if 0
2012-10-26 04:14:10 +00:00
func = RNA_def_function ( srna , " remove " , " rna_Curve_spline_remove " ) ;
2011-09-19 13:23:58 +00:00
RNA_def_function_ui_description ( func , " Remove a spline from a curve " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_function_flag ( func , FUNC_USE_REPORTS ) ;
2012-10-26 04:14:10 +00:00
parm = RNA_def_pointer ( func , " spline " , " Spline " , " " , " The spline to remove " ) ;
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
RNA_def_parameter_flags ( parm , PROP_NEVER_NULL , PARM_REQUIRED | PARM_RNAPTR ) ;
RNA_def_parameter_clear_flags ( parm , PROP_THICK_WRAP , 0 ) ;
2012-05-12 11:01:29 +00:00
# endif
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
static void rna_def_curve_spline_bezpoints ( BlenderRNA * brna , PropertyRNA * cprop )
{
StructRNA * srna ;
2012-03-05 23:30:41 +00:00
/*PropertyRNA *prop; */
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
FunctionRNA * func ;
2018-10-03 10:20:55 +10:00
PropertyRNA * parm ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_srna ( cprop , " SplineBezierPoints " ) ;
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " SplineBezierPoints " , NULL ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_struct_sdna ( srna , " Nurb " ) ;
2016-08-26 16:14:56 +02:00
RNA_def_struct_ui_text ( srna , " Spline Bezier Points " , " Collection of spline Bezier points " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-03-05 23:30:41 +00:00
func = RNA_def_function ( srna , " add " , " rna_Curve_spline_bezpoints_add " ) ;
2011-09-19 13:23:58 +00:00
RNA_def_function_ui_description ( func , " Add a number of points to this spline " ) ;
2012-05-12 11:01:29 +00:00
RNA_def_function_flag ( func , FUNC_USE_SELF_ID | FUNC_USE_REPORTS ) ;
2018-10-03 10:20:55 +10:00
parm = RNA_def_int ( func , " count " , 1 , 0 , INT_MAX , " Number " , " Number of points to add to the spline " , 0 , INT_MAX ) ;
RNA_def_parameter_flags ( parm , 0 , PARM_REQUIRED ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-04-22 11:54:53 +00:00
#if 0
2012-05-12 11:01:29 +00:00
func = RNA_def_function ( srna , " remove " , " rna_Curve_spline_remove " ) ;
2011-09-19 13:23:58 +00:00
RNA_def_function_ui_description ( func , " Remove a spline from a curve " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_function_flag ( func , FUNC_USE_REPORTS ) ;
2012-05-12 11:01:29 +00:00
parm = RNA_def_pointer ( func , " spline " , " Spline " , " " , " The spline to remove " ) ;
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
RNA_def_parameter_flags ( parm , PROP_NEVER_NULL , PARM_REQUIRED | PARM_RNAPTR ) ;
RNA_def_parameter_clear_flags ( parm , PROP_THICK_WRAP , 0 ) ;
2012-04-22 11:54:53 +00:00
# endif
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
}
/* curve.splines */
static void rna_def_curve_splines ( BlenderRNA * brna , PropertyRNA * cprop )
{
StructRNA * srna ;
PropertyRNA * prop ;
FunctionRNA * func ;
PropertyRNA * parm ;
RNA_def_property_srna ( cprop , " CurveSplines " ) ;
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " CurveSplines " , NULL ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_struct_sdna ( srna , " Curve " ) ;
RNA_def_struct_ui_text ( srna , " Curve Splines " , " Collection of curve splines " ) ;
2012-03-05 23:30:41 +00:00
func = RNA_def_function ( srna , " new " , " rna_Curve_spline_new " ) ;
2011-09-19 13:23:58 +00:00
RNA_def_function_ui_description ( func , " Add a new spline to the curve " ) ;
2012-03-05 23:30:41 +00:00
parm = RNA_def_enum ( func , " type " , curve_type_items , CU_POLY , " " , " type for the new spline " ) ;
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
RNA_def_parameter_flags ( parm , 0 , PARM_REQUIRED ) ;
2012-03-05 23:30:41 +00:00
parm = RNA_def_pointer ( func , " spline " , " Spline " , " " , " The newly created spline " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_function_return ( func , parm ) ;
2012-03-05 23:30:41 +00:00
func = RNA_def_function ( srna , " remove " , " rna_Curve_spline_remove " ) ;
2011-09-19 13:23:58 +00:00
RNA_def_function_ui_description ( func , " Remove a spline from a curve " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_function_flag ( func , FUNC_USE_REPORTS ) ;
2012-03-05 23:30:41 +00:00
parm = RNA_def_pointer ( func , " spline " , " Spline " , " " , " The spline to remove " ) ;
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
RNA_def_parameter_flags ( parm , PROP_NEVER_NULL , PARM_REQUIRED | PARM_RNAPTR ) ;
RNA_def_parameter_clear_flags ( parm , PROP_THICK_WRAP , 0 ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
2012-03-05 23:30:41 +00:00
func = RNA_def_function ( srna , " clear " , " rna_Curve_spline_clear " ) ;
2015-03-18 15:14:32 +11:00
RNA_def_function_ui_description ( func , " Remove all splines from a curve " ) ;
2011-11-23 16:12:11 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " active " , PROP_POINTER , PROP_NONE ) ;
2015-03-18 15:14:32 +11:00
RNA_def_property_struct_type ( prop , " Spline " ) ;
2010-08-03 05:14:59 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Curve_active_spline_get " , " rna_Curve_active_spline_set " , NULL , NULL ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
RNA_def_property_ui_text ( prop , " Active Spline " , " Active curve spline " ) ;
}
2009-06-07 13:09:18 +00:00
static void rna_def_curve ( BlenderRNA * brna )
2009-01-10 22:57:33 +00:00
{
StructRNA * srna ;
PropertyRNA * prop ;
2018-06-09 14:40:09 +02:00
2017-10-18 15:07:26 +11:00
static const EnumPropertyItem curve_twist_mode_items [ ] = {
2012-05-12 11:01:29 +00:00
{ CU_TWIST_Z_UP , " Z_UP " , 0 , " Z-Up " , " Use Z-Up axis to calculate the curve twist at each point " } ,
{ CU_TWIST_MINIMUM , " MINIMUM " , 0 , " Minimum " , " Use the least twist over the entire curve " } ,
{ CU_TWIST_TANGENT , " TANGENT " , 0 , " Tangent " , " Use the tangent to calculate twist " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2009-09-11 15:35:30 +00:00
2012-03-05 23:30:41 +00:00
static const EnumPropertyItem curve_axis_items [ ] = {
2011-11-26 12:30:01 +00:00
{ 0 , " 2D " , 0 , " 2D " , " Clamp the Z axis of the curve " } ,
2012-03-18 09:27:36 +00:00
{ CU_3D , " 3D " , 0 , " 3D " ,
2012-05-12 11:01:29 +00:00
" Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2014-03-28 16:41:56 +06:00
2017-10-18 15:07:26 +11:00
static const EnumPropertyItem bevfac_mapping_items [ ] = {
2014-03-28 16:41:56 +06:00
{ CU_BEVFAC_MAP_RESOLU , " RESOLUTION " , 0 , " Resolution " , " Map the bevel factor to the number of subdivisions of a spline (U resolution) " } ,
{ CU_BEVFAC_MAP_SEGMENT , " SEGMENTS " , 0 , " Segments " , " Map the bevel factor to the length of a segment and to the number of subdivisions of a segment " } ,
{ CU_BEVFAC_MAP_SPLINE , " SPLINE " , 0 , " Spline " , " Map the bevel factor to the length of a spline " } ,
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2014-03-28 16:41:56 +06:00
} ;
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " Curve " , " ID " ) ;
2015-10-24 02:44:43 +11:00
RNA_def_struct_ui_text ( srna , " Curve " , " Curve data-block storing curves, splines and NURBS " ) ;
2009-06-03 23:16:51 +00:00
RNA_def_struct_ui_icon ( srna , ICON_CURVE_DATA ) ;
2009-06-07 13:09:18 +00:00
RNA_def_struct_refine_func ( srna , " rna_Curve_refine " ) ;
2013-12-17 22:13:15 +11:00
2009-01-10 22:57:33 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " shape_keys " , PROP_POINTER , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " key " ) ;
RNA_def_property_ui_text ( prop , " Shape Keys " , " " ) ;
2009-03-28 10:52:51 +00:00
2010-11-20 17:28:05 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " splines " , PROP_COLLECTION , PROP_NONE ) ;
2010-11-20 17:28:05 +00:00
#if 0
2009-03-28 10:52:51 +00:00
RNA_def_property_collection_sdna ( prop , NULL , " nurb " , NULL ) ;
2010-11-20 17:28:05 +00:00
# else
/* this way we get editmode nurbs too, keyframe in editmode */
2012-03-18 09:27:36 +00:00
RNA_def_property_collection_funcs ( prop , " rna_Curve_splines_begin " , " rna_iterator_listbase_next " ,
" rna_iterator_listbase_end " , " rna_iterator_listbase_get " ,
NULL , NULL , NULL , NULL ) ;
2010-11-20 17:28:05 +00:00
# endif
2010-02-10 08:53:08 +00:00
RNA_def_property_struct_type ( prop , " Spline " ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Splines " , " Collection of splines in this curve data object " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
rna_def_curve_splines ( brna , prop ) ;
2009-09-08 07:35:07 +00:00
2009-01-10 22:57:33 +00:00
rna_def_path ( brna , srna ) ;
2018-06-09 14:40:09 +02:00
2009-01-10 22:57:33 +00:00
/* Number values */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " bevel_resolution " , PROP_INT , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_int_sdna ( prop , NULL , " bevresol " ) ;
RNA_def_property_range ( prop , 0 , 32 ) ;
2013-04-08 18:55:08 +00:00
RNA_def_property_ui_range ( prop , 0 , 32 , 1.0 , - 1 ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Bevel Resolution " ,
" Bevel resolution when depth is non-zero and no specific bevel object has been defined " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-05-12 11:01:29 +00:00
prop = RNA_def_property ( srna , " offset " , PROP_FLOAT , PROP_NONE | PROP_UNIT_LENGTH ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_float_sdna ( prop , NULL , " width " ) ;
2010-09-02 07:00:34 +00:00
RNA_def_property_ui_range ( prop , - 1.0 , 1.0 , 0.1 , 3 ) ;
RNA_def_property_float_funcs ( prop , " rna_Curve_offset_get " , " rna_Curve_offset_set " , NULL ) ;
RNA_def_property_ui_text ( prop , " Offset " , " Offset the curve to adjust the width of a text " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-05-12 11:01:29 +00:00
prop = RNA_def_property ( srna , " extrude " , PROP_FLOAT , PROP_NONE | PROP_UNIT_LENGTH ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_float_sdna ( prop , NULL , " ext1 " ) ;
2010-08-22 16:44:48 +00:00
RNA_def_property_ui_range ( prop , 0 , 100.0 , 0.1 , 3 ) ;
2010-01-22 01:30:06 +00:00
RNA_def_property_range ( prop , 0.0 , FLT_MAX ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Extrude " , " Amount of curve extrusion when not using a bevel object " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-05-12 11:01:29 +00:00
prop = RNA_def_property ( srna , " bevel_depth " , PROP_FLOAT , PROP_NONE | PROP_UNIT_LENGTH ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_float_sdna ( prop , NULL , " ext2 " ) ;
2010-08-22 16:44:48 +00:00
RNA_def_property_ui_range ( prop , 0 , 100.0 , 0.1 , 3 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Bevel Depth " , " Bevel depth when not using a bevel object " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " resolution_u " , PROP_INT , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_int_sdna ( prop , NULL , " resolu " ) ;
2013-04-22 09:26:02 +00:00
RNA_def_property_range ( prop , 1 , 1024 ) ;
2013-04-08 18:55:08 +00:00
RNA_def_property_ui_range ( prop , 1 , 64 , 1 , - 1 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Resolution U " , " Surface resolution in U direction " ) ;
2009-12-04 01:38:36 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_resolution_u_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " resolution_v " , PROP_INT , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_int_sdna ( prop , NULL , " resolv " ) ;
2013-04-08 18:55:08 +00:00
RNA_def_property_ui_range ( prop , 1 , 64 , 1 , - 1 ) ;
2013-04-22 09:26:02 +00:00
RNA_def_property_range ( prop , 1 , 1024 ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Resolution V " , " Surface resolution in V direction " ) ;
2009-12-04 01:38:36 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_resolution_v_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " render_resolution_u " , PROP_INT , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_int_sdna ( prop , NULL , " resolu_ren " ) ;
2013-04-22 09:26:02 +00:00
RNA_def_property_range ( prop , 0 , 1024 ) ;
2013-04-08 18:55:08 +00:00
RNA_def_property_ui_range ( prop , 0 , 64 , 1 , - 1 ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Render Resolution U " ,
2014-05-12 08:07:33 +02:00
" Surface resolution in U direction used while rendering (zero uses preview resolution) " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " render_resolution_v " , PROP_INT , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_int_sdna ( prop , NULL , " resolv_ren " ) ;
2013-04-08 18:55:08 +00:00
RNA_def_property_ui_range ( prop , 0 , 64 , 1 , - 1 ) ;
2013-04-22 09:26:02 +00:00
RNA_def_property_range ( prop , 0 , 1024 ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Render Resolution V " ,
2014-05-12 08:07:33 +02:00
" Surface resolution in V direction used while rendering (zero uses preview resolution) " ) ;
2018-06-09 14:40:09 +02:00
2019-02-19 15:23:46 +01:00
prop = RNA_def_property ( srna , " eval_time " , PROP_FLOAT , PROP_TIME ) ;
2009-06-20 11:44:56 +00:00
RNA_def_property_float_sdna ( prop , NULL , " ctime " ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Evaluation Time " ,
" Parametric position along the length of the curve that Objects 'following' it should be "
" at (position is evaluated by dividing by the 'Path Length' value) " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2009-01-10 22:57:33 +00:00
/* pointers */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " bevel_object " , PROP_POINTER , PROP_NONE ) ;
2010-04-01 08:49:11 +00:00
RNA_def_property_struct_type ( prop , " Object " ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " bevobj " ) ;
2009-05-28 23:23:47 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Bevel Object " , " Curve object name that defines the bevel shape " ) ;
2010-04-01 08:49:11 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_deps " ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Curve_bevelObject_get " , " rna_Curve_bevelObject_set " , NULL ,
" rna_Curve_otherObject_poll " ) ;
2010-04-01 08:49:11 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " taper_object " , PROP_POINTER , PROP_NONE ) ;
2010-04-01 08:49:11 +00:00
RNA_def_property_struct_type ( prop , " Object " ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_pointer_sdna ( prop , NULL , " taperobj " ) ;
2009-05-28 23:23:47 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Taper Object " , " Curve object name that defines the taper (width) " ) ;
2010-04-01 08:49:11 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_deps " ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_Curve_taperObject_get " , " rna_Curve_taperObject_set " , NULL ,
" rna_Curve_otherObject_poll " ) ;
2010-04-01 08:49:11 +00:00
2009-01-10 22:57:33 +00:00
/* Flags */
2009-09-13 17:38:43 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " dimensions " , PROP_ENUM , PROP_NONE ) ; /* as an enum */
2009-09-13 17:38:43 +00:00
RNA_def_property_enum_bitflag_sdna ( prop , NULL , " flag " ) ;
RNA_def_property_enum_items ( prop , curve_axis_items ) ;
RNA_def_property_enum_funcs ( prop , NULL , " rna_Curve_dimension_set " , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Dimensions " , " Select 2D or 3D curve type " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " fill_mode " , PROP_ENUM , PROP_NONE ) ;
2011-09-19 09:47:58 +00:00
RNA_def_property_enum_bitflag_sdna ( prop , NULL , " flag " ) ;
RNA_def_property_enum_items ( prop , curve3d_fill_mode_items ) ;
RNA_def_property_enum_funcs ( prop , NULL , NULL , " rna_Curve_fill_mode_itemf " ) ;
RNA_def_property_ui_text ( prop , " Fill Mode " , " Mode of filling curve " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-09-11 15:35:30 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " twist_mode " , PROP_ENUM , PROP_NONE ) ;
2009-09-11 15:35:30 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " twist_mode " ) ;
RNA_def_property_enum_items ( prop , curve_twist_mode_items ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Twist Method " , " The type of tilt calculation for 3D Curves " ) ;
2009-09-11 15:35:30 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2014-03-28 16:41:56 +06:00
prop = RNA_def_property ( srna , " bevel_factor_mapping_start " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " bevfac1_mapping " ) ;
RNA_def_property_enum_items ( prop , bevfac_mapping_items ) ;
2014-03-31 21:15:56 +02:00
RNA_def_property_ui_text ( prop , " Start Mapping Type " , " Determines how the start bevel factor is mapped to a spline " ) ;
2014-03-28 16:41:56 +06:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
prop = RNA_def_property ( srna , " bevel_factor_mapping_end " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " bevfac2_mapping " ) ;
RNA_def_property_enum_items ( prop , bevfac_mapping_items ) ;
2014-03-31 21:15:56 +02:00
RNA_def_property_ui_text ( prop , " End Mapping Type " , " Determines how the end bevel factor is mapped to a spline " ) ;
2014-03-28 16:41:56 +06:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-03-05 23:30:41 +00:00
/* XXX - would be nice to have a better way to do this, only add for testing. */
prop = RNA_def_property ( srna , " twist_smooth " , PROP_FLOAT , PROP_NONE ) ;
2009-09-11 15:35:30 +00:00
RNA_def_property_float_sdna ( prop , NULL , " twist_smooth " ) ;
2011-04-17 12:13:02 +00:00
RNA_def_property_ui_range ( prop , 0 , 100.0 , 1 , 2 ) ;
2009-09-11 15:35:30 +00:00
RNA_def_property_ui_text ( prop , " Twist Smooth " , " Smoothing iteration for tangents " ) ;
2009-09-07 15:02:43 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_fill_deform " , PROP_BOOLEAN , PROP_NONE ) ;
2010-03-16 21:09:53 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_DEFORM_FILL ) ;
2012-02-02 15:15:52 +00:00
RNA_def_property_ui_text ( prop , " Fill Deformed " , " Fill curve after applying shape keys and all modifiers " ) ;
2010-03-16 21:09:53 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-02-02 15:15:52 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_fill_caps " , PROP_BOOLEAN , PROP_NONE ) ;
2012-02-02 15:15:52 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_FILL_CAPS ) ;
2012-07-03 19:09:07 +00:00
RNA_def_property_ui_text ( prop , " Fill Caps " , " Fill caps for beveled curves " ) ;
2012-02-02 15:15:52 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-11-08 08:16:44 +00:00
prop = RNA_def_property ( srna , " use_map_taper " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_MAP_TAPER ) ;
2012-11-12 19:31:31 +00:00
RNA_def_property_ui_text ( prop , " Map Taper " , " Map effect of taper object on actually beveled curve " ) ;
2012-11-08 08:16:44 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2010-04-12 05:04:49 +00:00
/* texture space */
2012-03-05 23:30:41 +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 " , CU_AUTOSPACE ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Auto Texture Space " ,
" Adjust active object's texture space automatically when transforming object " ) ;
2012-05-12 11:01:29 +00:00
RNA_def_property_update ( prop , NC_OBJECT | ND_DRAW , " rna_Curve_texspace_set " ) ;
2011-01-06 11:16:35 +00:00
2012-03-05 23:30:41 +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 " ) ;
2012-04-10 08:33:30 +00:00
RNA_def_property_ui_range ( prop , - FLT_MAX , FLT_MAX , 1 , RNA_TRANSLATION_PREC_DEFAULT ) ;
2010-04-12 05:04:49 +00:00
RNA_def_property_editable_func ( prop , " rna_Curve_texspace_editable " ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_float_funcs ( prop , " rna_Curve_texspace_loc_get " , " rna_Curve_texspace_loc_set " , NULL ) ;
2010-04-12 05:04:49 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " texspace_size " , PROP_FLOAT , PROP_XYZ ) ;
2010-04-12 05:04:49 +00:00
RNA_def_property_array ( prop , 3 ) ;
2014-02-09 08:42:45 +11:00
RNA_def_property_flag ( prop , PROP_PROPORTIONAL ) ;
2010-04-12 05:04:49 +00:00
RNA_def_property_ui_text ( prop , " Texture Space Size " , " Texture space size " ) ;
RNA_def_property_editable_func ( prop , " rna_Curve_texspace_editable " ) ;
RNA_def_property_float_funcs ( prop , " rna_Curve_texspace_size_get " , " rna_Curve_texspace_size_set " , NULL ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-04-22 11:54:53 +00:00
/* not supported yet */
#if 0
2012-05-12 11:01:29 +00:00
prop = RNA_def_property ( srna , " texspace_rot " , PROP_FLOAT , PROP_EULER ) ;
2011-11-11 13:09:14 +00:00
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 , texspace_editable ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2012-04-22 11:54:53 +00:00
# endif
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_uv_as_generated " , PROP_BOOLEAN , PROP_NONE ) ;
2010-06-14 07:43:45 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_UV_ORCO ) ;
2010-11-16 12:10:57 +00:00
RNA_def_property_ui_text ( prop , " Use UV for mapping " , " Uses the UV values as Generated textured coordinates " ) ;
2010-06-14 07:43:45 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2010-04-12 05:04:49 +00:00
/* materials */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " materials " , PROP_COLLECTION , PROP_NONE ) ;
2010-04-12 05:04:49 +00:00
RNA_def_property_collection_sdna ( prop , NULL , " mat " , " totcol " ) ;
RNA_def_property_struct_type ( prop , " Material " ) ;
RNA_def_property_ui_text ( prop , " Materials " , " " ) ;
2011-10-01 17:54:33 +00:00
RNA_def_property_srna ( prop , " IDMaterials " ) ; /* see rna_ID.c */
2013-09-11 21:27:14 +00:00
RNA_def_property_collection_funcs ( prop , NULL , NULL , NULL , NULL , NULL , NULL , NULL , " rna_IDMaterials_assign_int " ) ;
2012-05-04 17:04:20 +00:00
prop = RNA_def_property ( srna , " bevel_factor_start " , PROP_FLOAT , PROP_FACTOR ) ;
RNA_def_property_float_sdna ( prop , NULL , " bevfac1 " ) ;
RNA_def_property_range ( prop , 0 , 1.0 ) ;
RNA_def_property_ui_text ( prop , " Start Bevel Factor " , " Factor that defines from where beveling of spline happens (0=from the very beginning, 1=from the very end) " ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
prop = RNA_def_property ( srna , " bevel_factor_end " , PROP_FLOAT , PROP_FACTOR ) ;
RNA_def_property_float_sdna ( prop , NULL , " bevfac2 " ) ;
RNA_def_property_range ( prop , 0 , 1.0 ) ;
RNA_def_property_ui_text ( prop , " End Bevel Factor " , " Factor that defines to where beveling of spline happens (0=to the very beginning, 1=to the very end) " ) ;
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2013-07-03 22:57:00 +00:00
prop = RNA_def_property ( srna , " is_editmode " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_funcs ( prop , " rna_Curve_is_editmode_get " , NULL ) ;
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ;
RNA_def_property_ui_text ( prop , " Is Editmode " , " True when used in editmode " ) ;
2013-12-17 22:13:15 +11:00
rna_def_animdata_common ( srna ) ;
RNA_api_curve ( srna ) ;
2009-01-10 22:57:33 +00:00
}
2009-06-07 13:09:18 +00:00
static void rna_def_curve_nurb ( BlenderRNA * brna )
2009-03-28 10:52:51 +00:00
{
2017-10-18 15:07:26 +11:00
static const EnumPropertyItem spline_interpolation_items [ ] = {
2010-08-12 06:28:46 +00:00
{ KEY_LINEAR , " LINEAR " , 0 , " Linear " , " " } ,
{ KEY_CARDINAL , " CARDINAL " , 0 , " Cardinal " , " " } ,
{ KEY_BSPLINE , " BSPLINE " , 0 , " BSpline " , " " } ,
{ KEY_CU_EASE , " EASE " , 0 , " Ease " , " " } , /* todo, define somewhere, not one of BEZT_IPO_* */
2019-02-03 14:01:45 +11:00
{ 0 , NULL , 0 , NULL , NULL } ,
2012-05-12 11:01:29 +00:00
} ;
2009-03-28 10:52:51 +00:00
StructRNA * srna ;
PropertyRNA * prop ;
2012-03-05 23:30:41 +00:00
srna = RNA_def_struct ( brna , " Spline " , NULL ) ;
2010-03-22 09:30:00 +00:00
RNA_def_struct_sdna ( srna , " Nurb " ) ;
2012-03-18 09:27:36 +00:00
RNA_def_struct_ui_text ( srna , " Spline " ,
" Element of a curve, either NURBS, Bezier or Polyline or a character with text objects " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " points " , PROP_COLLECTION , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_collection_sdna ( prop , NULL , " bp " , NULL ) ;
2009-11-29 16:42:51 +00:00
RNA_def_property_struct_type ( prop , " SplinePoint " ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_collection_funcs ( prop , " rna_BPoint_array_begin " , " rna_iterator_array_next " ,
" rna_iterator_array_end " , " rna_iterator_array_get " , " rna_Nurb_length " ,
NULL , NULL , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Points " , " Collection of points that make up this poly or nurbs spline " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
rna_def_curve_spline_points ( brna , prop ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " bezier_points " , PROP_COLLECTION , PROP_NONE ) ;
2009-11-29 16:42:51 +00:00
RNA_def_property_struct_type ( prop , " BezierSplinePoint " ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_collection_sdna ( prop , NULL , " bezt " , " pntsu " ) ;
2011-04-11 01:18:25 +00:00
RNA_def_property_ui_text ( prop , " Bezier Points " , " Collection of points for Bezier curves only " ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
rna_def_curve_spline_bezpoints ( brna , prop ) ;
2009-03-28 10:52:51 +00:00
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " tilt_interpolation " , PROP_ENUM , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " tilt_interp " ) ;
RNA_def_property_enum_items ( prop , spline_interpolation_items ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Tilt Interpolation " , " The type of tilt interpolation for 3D, Bezier curves " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " radius_interpolation " , PROP_ENUM , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " radius_interp " ) ;
RNA_def_property_enum_items ( prop , spline_interpolation_items ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Radius Interpolation " , " The type of radius interpolation for Bezier curves " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " type " , PROP_ENUM , PROP_NONE ) ;
2009-09-07 15:02:43 +00:00
RNA_def_property_enum_items ( prop , curve_type_items ) ;
2009-09-08 00:23:33 +00:00
RNA_def_property_enum_funcs ( prop , NULL , " rna_Nurb_type_set " , NULL ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Type " , " The interpolation type for this curve element " ) ;
2009-09-07 15:02:43 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " point_count_u " , PROP_INT , PROP_UNSIGNED ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ; /* editing this needs knot recalc*/
RNA_def_property_int_sdna ( prop , NULL , " pntsu " ) ;
RNA_def_property_ui_text ( prop , " Points U " , " Total number points for the curve or surface in the U direction " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " point_count_v " , PROP_INT , PROP_UNSIGNED ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ; /* editing this needs knot recalc*/
RNA_def_property_int_sdna ( prop , NULL , " pntsv " ) ;
RNA_def_property_ui_text ( prop , " Points V " , " Total number points for the surface on the V direction " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " order_u " , PROP_INT , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_int_sdna ( prop , NULL , " orderu " ) ;
RNA_def_property_range ( prop , 2 , 6 ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Order U " ,
" NURBS order in the U direction (for splines and surfaces, higher values "
" let points influence a greater area) " ) ;
2009-09-08 07:35:07 +00:00
RNA_def_property_update ( prop , 0 , " rna_Nurb_update_knot_u " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " order_v " , PROP_INT , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_int_sdna ( prop , NULL , " orderv " ) ;
RNA_def_property_range ( prop , 2 , 6 ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Order V " ,
" NURBS order in the V direction (for surfaces only, higher values "
" let points influence a greater area) " ) ;
2009-09-08 07:35:07 +00:00
RNA_def_property_update ( prop , 0 , " rna_Nurb_update_knot_v " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " resolution_u " , PROP_INT , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_int_sdna ( prop , NULL , " resolu " ) ;
2013-04-22 09:26:02 +00:00
RNA_def_property_range ( prop , 1 , 1024 ) ;
2013-04-08 18:55:08 +00:00
RNA_def_property_ui_range ( prop , 1 , 64 , 1 , - 1 ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_ui_text ( prop , " Resolution U " , " Curve or Surface subdivisions per segment " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " resolution_v " , PROP_INT , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_int_sdna ( prop , NULL , " resolv " ) ;
2013-04-22 09:26:02 +00:00
RNA_def_property_range ( prop , 1 , 1024 ) ;
2013-04-08 18:55:08 +00:00
RNA_def_property_ui_range ( prop , 1 , 64 , 1 , - 1 ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_ui_text ( prop , " Resolution V " , " Surface subdivisions per segment " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_cyclic_u " , PROP_BOOLEAN , PROP_NONE ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flagu " , CU_NURB_CYCLIC ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Cyclic U " , " Make this curve or surface a closed loop in the U direction " ) ;
2010-10-04 10:06:18 +00:00
RNA_def_property_update ( prop , 0 , " rna_Nurb_update_cyclic_u " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_cyclic_v " , PROP_BOOLEAN , PROP_NONE ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flagv " , CU_NURB_CYCLIC ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Cyclic V " , " Make this surface a closed loop in the V direction " ) ;
2010-10-05 07:22:44 +00:00
RNA_def_property_update ( prop , 0 , " rna_Nurb_update_cyclic_v " ) ;
2009-03-28 10:52:51 +00:00
/* Note, endpoint and bezier flags should never be on at the same time! */
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_endpoint_u " , PROP_BOOLEAN , PROP_NONE ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flagu " , CU_NURB_ENDPOINT ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Endpoint U " ,
" Make this nurbs curve or surface meet the endpoints in the U direction "
" (Cyclic U must be disabled) " ) ;
2009-09-08 07:35:07 +00:00
RNA_def_property_update ( prop , 0 , " rna_Nurb_update_knot_u " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_endpoint_v " , PROP_BOOLEAN , PROP_NONE ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flagv " , CU_NURB_ENDPOINT ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Endpoint V " ,
" Make this nurbs surface meet the endpoints in the V direction "
" (Cyclic V must be disabled) " ) ;
2009-09-08 07:35:07 +00:00
RNA_def_property_update ( prop , 0 , " rna_Nurb_update_knot_v " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_bezier_u " , PROP_BOOLEAN , PROP_NONE ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flagu " , CU_NURB_BEZIER ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Bezier U " ,
" Make this nurbs curve or surface act like a Bezier spline in the U direction "
" (Order U must be 3 or 4, Cyclic U must be disabled) " ) ;
2009-09-08 07:35:07 +00:00
RNA_def_property_update ( prop , 0 , " rna_Nurb_update_knot_u " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_bezier_v " , PROP_BOOLEAN , PROP_NONE ) ;
merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
2010-03-20 16:41:01 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flagv " , CU_NURB_BEZIER ) ;
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Bezier V " ,
" Make this nurbs surface act like a Bezier spline in the V direction "
" (Order V must be 3 or 4, Cyclic V must be disabled) " ) ;
2009-09-08 07:35:07 +00:00
RNA_def_property_update ( prop , 0 , " rna_Nurb_update_knot_v " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " use_smooth " , PROP_BOOLEAN , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " flag " , CU_SMOOTH ) ;
2010-02-10 21:15:44 +00:00
RNA_def_property_ui_text ( prop , " Smooth " , " Smooth the normals of the surface or beveled curve " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " hide " , PROP_BOOLEAN , PROP_NONE ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " hide " , 1 ) ;
2012-07-03 19:09:07 +00:00
RNA_def_property_ui_text ( prop , " Hide " , " Hide this curve in Edit mode " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2009-03-28 10:52:51 +00:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " material_index " , PROP_INT , PROP_UNSIGNED ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_int_sdna ( prop , NULL , " mat_nr " ) ;
RNA_def_property_ui_text ( prop , " Material Index " , " " ) ;
RNA_def_property_int_funcs ( prop , NULL , NULL , " rna_Curve_material_index_range " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2018-06-09 14:40:09 +02:00
2012-03-05 23:30:41 +00:00
prop = RNA_def_property ( srna , " character_index " , PROP_INT , PROP_UNSIGNED ) ;
2009-03-28 10:52:51 +00:00
RNA_def_property_int_sdna ( prop , NULL , " charidx " ) ;
RNA_def_property_clear_flag ( prop , PROP_EDITABLE ) ; /* editing this needs knot recalc*/
2012-03-18 09:27:36 +00:00
RNA_def_property_ui_text ( prop , " Character Index " ,
" Location of this character in the text data (only for text curves) " ) ;
2009-08-10 21:10:09 +00:00
RNA_def_property_update ( prop , 0 , " rna_Curve_update_data " ) ;
2010-11-17 03:15:08 +00:00
RNA_def_struct_path_func ( srna , " rna_Curve_spline_path " ) ;
2018-08-20 11:10:09 +10:00
RNA_api_curve_nurb ( srna ) ;
2009-03-28 10:52:51 +00:00
}
2008-12-01 19:02:27 +00:00
void RNA_def_curve ( BlenderRNA * brna )
{
rna_def_curve ( brna ) ;
2009-06-07 13:09:18 +00:00
rna_def_surface ( brna ) ;
rna_def_text ( brna ) ;
2008-12-01 19:02:27 +00:00
rna_def_textbox ( brna ) ;
rna_def_charinfo ( brna ) ;
2009-02-02 11:51:10 +00:00
rna_def_bpoint ( brna ) ;
rna_def_beztriple ( brna ) ;
2009-03-28 10:52:51 +00:00
rna_def_curve_nurb ( brna ) ;
2008-12-01 19:02:27 +00:00
}
# endif