Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-03-20 19:41:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-03-20 19:41:01 +0300
commit391cc2d004c5fc231ac546d89f64ae4ba5c062c0 (patch)
treea89e10b9b3d496e99079cd0778c09495ccc8ad1b /source/blender
parent7178f10b81006082937de8fa8be90076f478da64 (diff)
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
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_curve.h11
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c26
-rw-r--r--source/blender/blenkernel/intern/curve.c102
-rw-r--r--source/blender/blenkernel/intern/displist.c18
-rw-r--r--source/blender/blenkernel/intern/font.c2
-rw-r--r--source/blender/blenkernel/intern/mesh.c2
-rw-r--r--source/blender/blenlib/BLI_listbase.h1
-rw-r--r--source/blender/blenlib/intern/freetypefont.c2
-rw-r--r--source/blender/blenlib/intern/listbase.c11
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/curve/editcurve.c70
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c2
-rw-r--r--source/blender/editors/include/ED_object.h1
-rw-r--r--source/blender/editors/interface/interface_regions.c9
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/object/object_edit.c28
-rw-r--r--source/blender/editors/object/object_relations.c6
-rw-r--r--source/blender/editors/object/object_transform.c2
-rw-r--r--source/blender/editors/render/render_shading.c1
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c11
-rw-r--r--source/blender/editors/space_view3d/drawobject.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c5
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
-rw-r--r--source/blender/makesdna/DNA_anim_types.h1
-rw-r--r--source/blender/makesdna/DNA_curve_types.h4
-rw-r--r--source/blender/makesrna/RNA_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_curve.c269
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c65
-rw-r--r--source/blender/makesrna/intern/rna_nla.c5
-rw-r--r--source/blender/makesrna/intern/rna_object.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c10
-rw-r--r--source/blender/python/doc/sphinx_doc_gen.py2
-rw-r--r--source/blender/python/doc/sphinx_doc_gen.sh25
-rw-r--r--source/blender/python/generic/IDProp.c4
-rw-r--r--source/blender/python/intern/bpy_rna.c11
36 files changed, 534 insertions, 191 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 5fb44c52307..7119a725630 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -40,12 +40,12 @@ struct ListBase;
struct BezTriple;
struct BevList;
-#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_CYCLIC) ? (nu->orderu-1) : 0) )
-#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_CYCLIC) ? (nu->orderv-1) : 0) )
+#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_NURB_CYCLIC) ? (nu->orderu-1) : 0) )
+#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_NURB_CYCLIC) ? (nu->orderv-1) : 0) )
/* Non cyclic nurbs have 1 less segment */
-#define SEGMENTSU(nu) ( ((nu)->flagu & CU_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 )
-#define SEGMENTSV(nu) ( ((nu)->flagv & CU_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 )
+#define SEGMENTSU(nu) ( ((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 )
+#define SEGMENTSV(nu) ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 )
#define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1)
#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || cu->bevobj || cu->ext1!=0.0 || cu->ext2!=0.0) ? 1:0)
@@ -89,6 +89,9 @@ void sethandlesNurb(ListBase *editnurb, short code);
void switchdirectionNurb( struct Nurb *nu);
+void addNurbPoints(struct Nurb *nu, int number);
+void addNurbPointsBezier(struct Nurb *nu, int number);
+
float (*curve_getVertexCos(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3];
void curve_applyVertexCos(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]);
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 31743a6bd1a..1e9103fb951 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -771,6 +771,8 @@ static short animsys_remap_path (AnimMapper *remap, char *path, char **dst)
/* Write the given value to a setting using RNA, and return success */
static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
{
+ // printf("%p %s %i %f\n", ptr, path, array_index, value);
+
PropertyRNA *prop;
PointerRNA new_ptr;
@@ -780,22 +782,35 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
/* set value - only for animatable numerical values */
if (RNA_property_animateable(&new_ptr, prop))
{
+ int array_len= RNA_property_array_length(&new_ptr, prop);
+
+ if(array_len && array_index >= array_len)
+ {
+ if (G.f & G_DEBUG) {
+ printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d \n",
+ (ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>",
+ path, array_index, array_len-1);
+ }
+
+ return 0;
+ }
+
switch (RNA_property_type(prop))
{
case PROP_BOOLEAN:
- if (RNA_property_array_length(&new_ptr, prop))
+ if (array_len)
RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value);
else
RNA_property_boolean_set(&new_ptr, prop, (int)value);
break;
case PROP_INT:
- if (RNA_property_array_length(&new_ptr, prop))
+ if (array_len)
RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
else
RNA_property_int_set(&new_ptr, prop, (int)value);
break;
case PROP_FLOAT:
- if (RNA_property_array_length(&new_ptr, prop))
+ if (array_len)
RNA_property_float_set_index(&new_ptr, prop, array_index, value);
else
RNA_property_float_set(&new_ptr, prop, value);
@@ -817,7 +832,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
// XXX don't tag as failed yet though, as there are some legit situations (Action Constraint)
// where some channels will not exist, but shouldn't lock up Action
if (G.f & G_DEBUG) {
- printf("Animato: Invalid path. ID = '%s', '%s [%d]' \n",
+ printf("Animato: Invalid path. ID = '%s', '%s[%d]' \n",
(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>",
path, array_index);
}
@@ -989,6 +1004,9 @@ static void nlastrip_evaluate_controls (NlaStrip *strip, float ctime)
/* execute these settings as per normal */
animsys_evaluate_fcurves(&strip_ptr, &strip->fcurves, NULL, ctime);
}
+
+ if (strip->flag & NLASTRIP_FLAG_USR_TIME && strip->flag & NLASTRIP_FLAG_USR_TIME_CYCLIC)
+ strip->strip_time= fmod(strip->strip_time - strip->actstart, strip->actend - strip->actstart);
}
/* gets the strip active at the current time for a list of strips for evaluation purposes */
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 2430e417e51..b476ebf4994 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -519,7 +519,47 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
bp++;
}
}
+}
+
+/* be sure to call makeknots after this */
+void addNurbPoints(Nurb *nu, int number)
+{
+ BPoint *tmp= nu->bp;
+ int i;
+ nu->bp= (BPoint *)MEM_mallocN((nu->pntsu + number) * sizeof(BPoint), "rna_Curve_spline_points_add");
+
+ if(tmp) {
+ memmove(nu->bp, tmp, nu->pntsu * sizeof(BPoint));
+ MEM_freeN(tmp);
+ }
+
+ memset(nu->bp + nu->pntsu, 0, number * sizeof(BPoint));
+
+ for(i=0, tmp= nu->bp + nu->pntsu; i < number; i++, tmp++) {
+ tmp->radius= 1.0f;
+ }
+
+ nu->pntsu += number;
+}
+
+void addNurbPointsBezier(Nurb *nu, int number)
+{
+ BezTriple *tmp= nu->bezt;
+ int i;
+ nu->bezt= (BezTriple *)MEM_mallocN((nu->pntsu + number) * sizeof(BezTriple), "rna_Curve_spline_points_add");
+
+ if(tmp) {
+ memmove(nu->bezt, tmp, nu->pntsu * sizeof(BezTriple));
+ MEM_freeN(tmp);
+ }
+
+ memset(nu->bezt + nu->pntsu, 0, number * sizeof(BezTriple));
+
+ for(i=0, tmp= nu->bezt + nu->pntsu; i < number; i++, tmp++) {
+ tmp->radius= 1.0f;
+ }
+ nu->pntsu += number;
}
/* ~~~~~~~~~~~~~~~~~~~~Non Uniform Rational B Spline calculations ~~~~~~~~~~~ */
@@ -603,7 +643,7 @@ void makeknots(Nurb *nu, short uv)
if(nu->knotsu) MEM_freeN(nu->knotsu);
if(check_valid_nurb_u(nu)) {
nu->knotsu= MEM_callocN(4+sizeof(float)*KNOTSU(nu), "makeknots");
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */
makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu);
} else {
@@ -616,7 +656,7 @@ void makeknots(Nurb *nu, short uv)
if(nu->knotsv) MEM_freeN(nu->knotsv);
if(check_valid_nurb_v(nu)) {
nu->knotsv= MEM_callocN(4+sizeof(float)*KNOTSV(nu), "makeknots");
- if(nu->flagv & CU_CYCLIC) {
+ if(nu->flagv & CU_NURB_CYCLIC) {
calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */
makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv);
} else {
@@ -734,18 +774,18 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
fp= nu->knotsu;
ustart= fp[nu->orderu-1];
- if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
+ if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
else uend= fp[nu->pntsu];
- ustep= (uend-ustart)/((nu->flagu & CU_CYCLIC) ? totu : totu - 1);
+ ustep= (uend-ustart)/((nu->flagu & CU_NURB_CYCLIC) ? totu : totu - 1);
basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbfaces3");
fp= nu->knotsv;
vstart= fp[nu->orderv-1];
- if(nu->flagv & CU_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
+ if(nu->flagv & CU_NURB_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
else vend= fp[nu->pntsv];
- vstep= (vend-vstart)/((nu->flagv & CU_CYCLIC) ? totv : totv - 1);
+ vstep= (vend-vstart)/((nu->flagv & CU_NURB_CYCLIC) ? totv : totv - 1);
len= KNOTSV(nu);
basisv= (float *)MEM_mallocN(sizeof(float)*len*totv, "makeNurbfaces3");
@@ -753,7 +793,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
jend= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces5");
/* precalculation of basisv and jstart,jend */
- if(nu->flagv & CU_CYCLIC) cycl= nu->orderv-1;
+ if(nu->flagv & CU_NURB_CYCLIC) cycl= nu->orderv-1;
else cycl= 0;
v= vstart;
basis= basisv;
@@ -764,7 +804,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
v+= vstep;
}
- if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1;
+ if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1;
else cycl= 0;
in= coord_array;
u= ustart;
@@ -882,13 +922,13 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
fp= nu->knotsu;
ustart= fp[nu->orderu-1];
- if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
+ if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
else uend= fp[nu->pntsu];
- ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_CYCLIC) ? 0 : 1));
+ ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_NURB_CYCLIC) ? 0 : 1));
basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbcurve3");
- if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1;
+ if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1;
else cycl= 0;
u= ustart;
@@ -1022,8 +1062,8 @@ float *make_orco_surf(Object *ob)
sizeu = nu->pntsu*nu->resolu;
sizev = nu->pntsv*nu->resolv;
- if (nu->flagu & CU_CYCLIC) sizeu++;
- if (nu->flagv & CU_CYCLIC) sizev++;
+ if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
+ if (nu->flagv & CU_NURB_CYCLIC) sizev++;
if(nu->pntsv>1) tot+= sizeu * sizev;
nu= nu->next;
@@ -1036,8 +1076,8 @@ float *make_orco_surf(Object *ob)
if(nu->pntsv>1) {
sizeu = nu->pntsu*nu->resolu;
sizev = nu->pntsv*nu->resolv;
- if (nu->flagu & CU_CYCLIC) sizeu++;
- if (nu->flagv & CU_CYCLIC) sizev++;
+ if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
+ if (nu->flagv & CU_NURB_CYCLIC) sizev++;
if(cu->flag & CU_UV_ORCO) {
for(b=0; b< sizeu; b++) {
@@ -1063,12 +1103,12 @@ float *make_orco_surf(Object *ob)
for(b=0; b<sizeu; b++) {
int use_b= b;
- if (b==sizeu-1 && (nu->flagu & CU_CYCLIC))
+ if (b==sizeu-1 && (nu->flagu & CU_NURB_CYCLIC))
use_b= 0;
for(a=0; a<sizev; a++) {
int use_a= a;
- if (a==sizev-1 && (nu->flagv & CU_CYCLIC))
+ if (a==sizev-1 && (nu->flagv & CU_NURB_CYCLIC))
use_a= 0;
tdata = _tdata + 3 * (use_b * (nu->pntsv*nu->resolv) + use_a);
@@ -1511,14 +1551,14 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
/* returns a point */
if(prevbezt==nu->bezt) {
- if(nu->flagu & CU_CYCLIC) pprev= last;
+ if(nu->flagu & CU_NURB_CYCLIC) pprev= last;
else pprev= prevbezt;
}
else pprev= prevbezt-1;
/* next point */
if(bezt==last) {
- if(nu->flagu & CU_CYCLIC) next= nu->bezt;
+ if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
else next= bezt;
}
else next= bezt+1;
@@ -1977,7 +2017,7 @@ void makeBevelList(Object *ob)
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList2");
BLI_addtail(&(cu->bev), bl);
- if(nu->flagu & CU_CYCLIC) bl->poly= 0;
+ if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bl->nr= len;
bl->dupe_nr= 0;
@@ -1995,17 +2035,17 @@ void makeBevelList(Object *ob)
}
else if(nu->type == CU_BEZIER) {
- len= resolu*(nu->pntsu+ (nu->flagu & CU_CYCLIC) -1)+1; /* in case last point is not cyclic */
+ len= resolu*(nu->pntsu+ (nu->flagu & CU_NURB_CYCLIC) -1)+1; /* in case last point is not cyclic */
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelBPoints");
BLI_addtail(&(cu->bev), bl);
- if(nu->flagu & CU_CYCLIC) bl->poly= 0;
+ if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
a= nu->pntsu-1;
bezt= nu->bezt;
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
a++;
prevbezt= nu->bezt+(nu->pntsu-1);
}
@@ -2066,7 +2106,7 @@ void makeBevelList(Object *ob)
bezt++;
}
- if((nu->flagu & CU_CYCLIC)==0) { /* not cyclic: endpoint */
+ if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic: endpoint */
VECCOPY(bevp->vec, prevbezt->vec[1]);
bevp->alfa= prevbezt->alfa;
bevp->radius= prevbezt->radius;
@@ -2081,7 +2121,7 @@ void makeBevelList(Object *ob)
BLI_addtail(&(cu->bev), bl);
bl->nr= len;
bl->dupe_nr= 0;
- if(nu->flagu & CU_CYCLIC) bl->poly= 0;
+ if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
@@ -2521,7 +2561,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
a= nu->pntsu;
bezt= nu->bezt;
- if(nu->flagu & CU_CYCLIC) prev= bezt+(a-1);
+ if(nu->flagu & CU_NURB_CYCLIC) prev= bezt+(a-1);
else prev= 0;
next= bezt+1;
@@ -2529,7 +2569,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
calchandleNurb(bezt, prev, next, 0);
prev= bezt;
if(a==1) {
- if(nu->flagu & CU_CYCLIC) next= nu->bezt;
+ if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
else next= 0;
}
else next++;
@@ -2986,7 +3026,7 @@ int check_valid_nurb_u( struct Nurb *nu )
if (nu->type != CU_NURBS) return 1; /* not a nurb, lets assume its valid */
if (nu->pntsu < nu->orderu) return 0;
- if (((nu->flag & CU_CYCLIC)==0) && ((nu->flagu>>1) & 2)) { /* Bezier U Endpoints */
+ if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) { /* Bezier U Endpoints */
if (nu->orderu==4) {
if (nu->pntsu < 5) return 0; /* bezier with 4 orderu needs 5 points */
} else if (nu->orderu != 3) return 0; /* order must be 3 or 4 */
@@ -3000,7 +3040,7 @@ int check_valid_nurb_v( struct Nurb *nu)
if (nu->type != CU_NURBS) return 1; /* not a nurb, lets assume its valid */
if (nu->pntsv < nu->orderv) return 0;
- if (((nu->flag & CU_CYCLIC)==0) && ((nu->flagv>>1) & 2)) { /* Bezier V Endpoints */
+ if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) { /* Bezier V Endpoints */
if (nu->orderv==4) {
if (nu->pntsv < 5) return 0; /* bezier with 4 orderu needs 5 points */
} else if (nu->orderv != 3) return 0; /* order must be 3 or 4 */
@@ -3015,7 +3055,7 @@ int clamp_nurb_order_u( struct Nurb *nu )
nu->orderu= nu->pntsu;
change= 1;
}
- if(((nu->flag & CU_CYCLIC)==0) && (nu->flagu>>1)&2) {
+ if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
CLAMP(nu->orderu, 3,4);
change= 1;
}
@@ -3029,7 +3069,7 @@ int clamp_nurb_order_v( struct Nurb *nu)
nu->orderv= nu->pntsv;
change= 1;
}
- if(((nu->flag & CU_CYCLIC)==0) && (nu->flagv>>1)&2) {
+ if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
CLAMP(nu->orderv, 3,4);
change= 1;
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 56eabc0f5ef..07ecf4c92a9 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -840,17 +840,17 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
/* count */
len= 0;
a= nu->pntsu-1;
- if(nu->flagu & CU_CYCLIC) a++;
+ if(nu->flagu & CU_NURB_CYCLIC) a++;
prevbezt= nu->bezt;
bezt= prevbezt+1;
while(a--) {
- if(a==0 && (nu->flagu & CU_CYCLIC)) bezt= nu->bezt;
+ if(a==0 && (nu->flagu & CU_NURB_CYCLIC)) bezt= nu->bezt;
if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) len++;
else len+= resolu;
- if(a==0 && (nu->flagu & CU_CYCLIC)==0) len++;
+ if(a==0 && (nu->flagu & CU_NURB_CYCLIC)==0) len++;
prevbezt= bezt;
bezt++;
@@ -867,7 +867,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
data= dl->verts;
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
dl->type= DL_POLY;
a= nu->pntsu;
}
@@ -920,7 +920,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
dl->charidx = nu->charidx;
data= dl->verts;
- if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY;
+ if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
makeNurbcurve(nu, data, NULL, NULL, resolu, 3*sizeof(float));
}
@@ -935,7 +935,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
dl->charidx = nu->charidx;
data= dl->verts;
- if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY;
+ if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
a= len;
@@ -1610,7 +1610,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
dl->rt= nu->flag;
data= dl->verts;
- if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY;
+ if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
makeNurbcurve(nu, data, NULL, NULL, nu->resolu, 3*sizeof(float));
@@ -1631,8 +1631,8 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
dl->parts= (nu->pntsu*nu->resolu); /* in reverse, because makeNurbfaces works that way */
dl->nr= (nu->pntsv*nu->resolv);
- if(nu->flagv & CU_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
- if(nu->flagu & CU_CYCLIC) dl->flag|= DL_CYCL_V;
+ if(nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
+ if(nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V;
makeNurbfaces(nu, data, 0);
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index efd93aa362d..8ec4814dc94 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -473,7 +473,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
nu2->pntsv = 1;
nu2->orderu = 4;
nu2->orderv = 1;
- nu2->flagu = CU_CYCLIC;
+ nu2->flagu = CU_NURB_CYCLIC;
bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint),"underline_bp");
if (bp == 0){
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 8d2dfcd1989..08130f51b0e 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1165,7 +1165,7 @@ void mesh_to_curve(Scene *scene, Object *ob)
nu->pntsu= totpoly;
nu->pntsv= 1;
nu->orderu= 4;
- nu->flagu= 2 | (closed ? CU_CYCLIC:0); /* endpoint */
+ nu->flagu= CU_NURB_ENDPOINT | (closed ? CU_NURB_CYCLIC:0); /* endpoint */
nu->resolu= 12;
nu->bp= (BPoint *)MEM_callocN(sizeof(BPoint)*totpoly, "bpoints");
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index f2fec215c2b..1f6a1ee5a97 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -49,6 +49,7 @@ int BLI_findstringindex(struct ListBase *listbase, const char *id, int offset);
void BLI_freelistN(struct ListBase *listbase);
void BLI_addtail(struct ListBase *listbase, void *vlink);
void BLI_remlink(struct ListBase *listbase, void *vlink);
+int BLI_remlink_safe(struct ListBase *listbase, void *vlink);
void BLI_addhead(struct ListBase *listbase, void *vlink);
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink);
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index b08631b9317..d06ca7b44d6 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -150,7 +150,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
nu->pntsu = onpoints[j];
nu->resolu= 8;
nu->flag= CU_2D;
- nu->flagu= CU_CYCLIC;
+ nu->flagu= CU_NURB_CYCLIC;
nu->bezt = bezt;
//individual curve loop, start-end
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 5d046dce023..0a6831558d1 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -108,6 +108,17 @@ void BLI_remlink(ListBase *listbase, void *vlink)
if (listbase->first == link) listbase->first = link->next;
}
+int BLI_remlink_safe(ListBase *listbase, void *vlink)
+{
+ if(BLI_findindex(listbase, vlink) != -1) {
+ BLI_remlink(listbase, vlink);
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
void BLI_freelinkN(ListBase *listbase, void *vlink)
{
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index b4666923a03..5d9531e6b37 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -545,7 +545,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob)
/* apply current transform from parent (not yet destroyed),
* then calculate new parent inverse matrix
*/
- ED_object_apply_obmat(ob);
+ object_apply_mat4(ob, ob->obmat);
what_does_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index de4f426eb65..dfc76aff3dd 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -929,9 +929,9 @@ static void adduplicateflagNurb(Object *obedit, short flag)
bezt1++;
}
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
if(starta!=0 || enda!=nu->pntsu-1) {
- newnu->flagu &= ~CU_CYCLIC;
+ newnu->flagu &= ~CU_NURB_CYCLIC;
}
}
}
@@ -966,9 +966,9 @@ static void adduplicateflagNurb(Object *obedit, short flag)
bp1++;
}
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
if(starta!=0 || enda!=nu->pntsu-1) {
- newnu->flagu &= ~CU_CYCLIC;
+ newnu->flagu &= ~CU_NURB_CYCLIC;
}
}
@@ -1904,7 +1904,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
newly created. Old points are discarded.
*/
/* count */
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bezt= nu->bezt;
prevbezt= bezt+(a-1);
@@ -1925,7 +1925,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
beztnew =
(BezTriple*)MEM_mallocN((amount + nu->pntsu) * sizeof(BezTriple), "subdivNurb");
beztn= beztnew;
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bezt= nu->bezt;
prevbezt= bezt+(a-1);
@@ -1957,7 +1957,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
mid_v3_v3v3(beztn->vec[1], vec+9, vec+12);
VECCOPY(beztn->vec[2], vec+12);
/* handle of next bezt */
- if(a==0 && (nu->flagu & CU_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);}
+ if(a==0 && (nu->flagu & CU_NURB_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);}
else {VECCOPY(bezt->vec[0], vec+6);}
beztn->radius = (prevbezt->radius + bezt->radius)/2.0f;
@@ -1970,7 +1970,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
bezt++;
}
/* last point */
- if((nu->flagu & CU_CYCLIC)==0) memcpy(beztn, prevbezt, sizeof(BezTriple));
+ if((nu->flagu & CU_NURB_CYCLIC)==0) memcpy(beztn, prevbezt, sizeof(BezTriple));
MEM_freeN(nu->bezt);
nu->bezt= beztnew;
@@ -1987,7 +1987,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
stable... nzc 30-5-'00
*/
/* count */
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bp= nu->bp;
prevbp= bp+(a-1);
@@ -2009,7 +2009,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
(BPoint*)MEM_mallocN((amount + nu->pntsu) * sizeof(BPoint), "subdivNurb2");
bpn= bpnew;
- if(nu->flagu & CU_CYCLIC) {
+ if(nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bp= nu->bp;
prevbp= bp+(a-1);
@@ -2036,7 +2036,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
prevbp= bp;
bp++;
}
- if((nu->flagu & CU_CYCLIC)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* last point */
+ if((nu->flagu & CU_NURB_CYCLIC)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* last point */
MEM_freeN(nu->bp);
nu->bp= bpnew;
@@ -2423,8 +2423,8 @@ static int convertspline(short type, Nurb *nu)
else if(type==CU_NURBS) {
nu->type = CU_NURBS;
nu->orderu= 4;
- nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */
- nu->flagu += 4;
+ nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
+ nu->flagu |= CU_NURB_BEZIER;
makeknots(nu, 1);
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
@@ -2473,11 +2473,11 @@ static int convertspline(short type, Nurb *nu)
nu->orderu= 4;
nu->orderv= 1;
nu->type = type;
- if(nu->flagu & CU_CYCLIC) c= nu->orderu-1;
+ if(nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1;
else c= 0;
if(type== CU_NURBS) {
- nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */
- nu->flagu += 4;
+ nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
+ nu->flagu |= CU_NURB_BEZIER;
makeknots(nu, 1);
}
}
@@ -2992,7 +2992,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
/* find both nurbs and points, nu1 will be put behind nu2 */
for(nu= editnurb->first; nu; nu= nu->next) {
- if((nu->flagu & CU_CYCLIC)==0) { /* not cyclic */
+ if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic */
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
if(nu1==0) {
@@ -3284,7 +3284,7 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, flo
for(nu= editnurb->first; nu; nu= nu->next) {
if(isNurbsel(nu)) {
nu->orderv= 4;
- nu->flagv |= CU_CYCLIC;
+ nu->flagv |= CU_NURB_CYCLIC;
makeknots(nu, 2);
}
}
@@ -3587,7 +3587,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
bp= nu->bp;
while(a--) {
if( bp->f1 & SELECT ) {
- nu->flagu ^= CU_CYCLIC;
+ nu->flagu ^= CU_NURB_CYCLIC;
break;
}
bp++;
@@ -3598,7 +3598,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
bezt= nu->bezt;
while(a--) {
if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
- nu->flagu ^= CU_CYCLIC;
+ nu->flagu ^= CU_NURB_CYCLIC;
break;
}
bezt++;
@@ -3611,7 +3611,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
bp= nu->bp;
while(a--) {
if( bp->f1 & SELECT ) {
- nu->flagu ^= CU_CYCLIC;
+ nu->flagu ^= CU_NURB_CYCLIC;
makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */
break;
}
@@ -3626,11 +3626,11 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
if( bp->f1 & SELECT) {
if(direction==0 && nu->pntsu>1) {
- nu->flagu ^= CU_CYCLIC;
+ nu->flagu ^= CU_NURB_CYCLIC;
makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */
}
if(direction==1 && nu->pntsv>1) {
- nu->flagv ^= CU_CYCLIC;
+ nu->flagv ^= CU_NURB_CYCLIC;
makeknots(nu, 2); /* 2==v type is ignored for cyclic curves */
}
break;
@@ -4430,10 +4430,10 @@ static int delete_exec(bContext *C, wmOperator *op)
bezt2= bezt+1;
if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) ;
else { /* maybe do not make cyclic */
- if(a==0 && (nu->flagu & CU_CYCLIC) ) {
+ if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
bezt2= bezt+(nu->pntsu-1);
if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
- nu->flagu &= ~CU_CYCLIC;
+ nu->flagu &= ~CU_NURB_CYCLIC;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
@@ -4456,10 +4456,10 @@ static int delete_exec(bContext *C, wmOperator *op)
bp2= bp+1;
if( bp2->f1 & 1 ) ;
else { /* maybe do not make cyclic */
- if(a==0 && (nu->flagu & CU_CYCLIC) ) {
+ if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
bp2= bp+(nu->pntsu-1);
if( bp2->f1 & SELECT ) {
- nu->flagu &= ~CU_CYCLIC;
+ nu->flagu &= ~CU_NURB_CYCLIC;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
@@ -4484,14 +4484,14 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(editnurb, nu);
freeNurb(nu); nu = NULL;
}
- else if(nu1->flagu & CU_CYCLIC) { /* cyclic */
+ else if(nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bezt =
(BezTriple*)MEM_mallocN((cut+1) * sizeof(BezTriple), "delNurb1");
memcpy(bezt, nu1->bezt,(cut+1)*sizeof(BezTriple));
a= nu1->pntsu-cut-1;
memcpy(nu1->bezt, bezt2, a*sizeof(BezTriple));
memcpy(nu1->bezt+a, bezt, (cut+1)*sizeof(BezTriple));
- nu1->flagu &= ~CU_CYCLIC;
+ nu1->flagu &= ~CU_NURB_CYCLIC;
MEM_freeN(bezt);
calchandlesNurb(nu);
}
@@ -4526,14 +4526,14 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(editnurb, nu);
freeNurb(nu); nu= NULL;
}
- else if(nu1->flagu & CU_CYCLIC) { /* cyclic */
+ else if(nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bp =
(BPoint*)MEM_mallocN((cut+1) * sizeof(BPoint), "delNurb5");
memcpy(bp, nu1->bp,(cut+1)*sizeof(BPoint));
a= nu1->pntsu-cut-1;
memcpy(nu1->bp, bp2, a*sizeof(BPoint));
memcpy(nu1->bp+a, bp, (cut+1)*sizeof(BPoint));
- nu1->flagu &= ~CU_CYCLIC;
+ nu1->flagu &= ~CU_NURB_CYCLIC;
MEM_freeN(bp);
}
else { /* add new curve */
@@ -4849,7 +4849,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
nu->pntsu= 5;
nu->pntsv= 1;
nu->orderu= 5;
- nu->flagu= 2; /* endpoint */
+ nu->flagu= CU_NURB_ENDPOINT; /* endpoint */
nu->resolu= 8;
nu->bp= callocstructN(BPoint, 5, "addNurbprim3");
@@ -4888,7 +4888,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
if (!force_3d) nu->flag |= CU_2D;
nu->pntsu= 4;
nu->bezt= callocstructN(BezTriple, 4, "addNurbprim1");
- nu->flagu= CU_CYCLIC;
+ nu->flagu= CU_NURB_CYCLIC;
bezt= nu->bezt;
bezt->h1= bezt->h2= HD_AUTO;
@@ -4925,7 +4925,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
nu->pntsv= 1;
nu->orderu= 4;
nu->bp= callocstructN(BPoint, 8, "addNurbprim6");
- nu->flagu= CU_CYCLIC;
+ nu->flagu= CU_NURB_CYCLIC;
bp= nu->bp;
for(a=0; a<8; a++) {
@@ -5047,7 +5047,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
mul_m4_v3(mat,bp->vec);
bp++;
}
- nu->flagu= 4;
+ nu->flagu= CU_NURB_BEZIER;
makeknots(nu, 1);
BLI_addtail(editnurb, nu); /* temporal for spin */
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 7bcfc81bf26..5c9b939aa1f 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -423,7 +423,7 @@ static void gp_stroke_to_path (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cur
nu->pntsu= gps->totpoints;
nu->pntsv= 1;
nu->orderu= gps->totpoints;
- nu->flagu= 2; /* endpoint */
+ nu->flagu= CU_NURB_ENDPOINT;
nu->resolu= 32;
nu->bp= (BPoint *)MEM_callocN(sizeof(BPoint)*gps->totpoints, "bpoints");
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 8045f2a9130..ba80a15d050 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -62,7 +62,6 @@ void ED_base_object_activate(struct bContext *C, struct Base *base);
void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base);
-void ED_object_apply_obmat(struct Object *ob);
/* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */
struct Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int dupflag);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index e29a6703bb8..e12db3674d4 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -413,6 +413,15 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
data->linedark[data->totline]= 1;
data->totline++;
+
+ if(but->rnapoin.id.data) {
+ ID *id= but->rnapoin.id.data;
+ if(id->lib && id->lib->name) {
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name);
+ data->linedark[data->totline]= 1;
+ data->totline++;
+ }
+ }
}
else if (but->optype) {
PointerRNA *opptr;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index b1405d1d12e..484a67b94db 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1118,7 +1118,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base)
ob->lay= base->lay;
copy_m4_m4(ob->obmat, dob->mat);
- ED_object_apply_obmat(ob);
+ object_apply_mat4(ob, ob->obmat);
}
copy_object_set_idnew(C, 0);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 807fa00d806..65e8fbeeb8f 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -150,34 +150,6 @@ static int pupmenu(const char *msg) {return 0;}
static bContext *C;
static void error_libdata() {}
-/* ********************************** */
-
-/* --------------------------------- */
-
-void ED_object_apply_obmat(Object *ob)
-{
- float mat[3][3], imat[3][3], tmat[3][3];
-
- /* from obmat to loc rot size */
-
- if(ob==NULL) return;
- copy_m3_m4(mat, ob->obmat);
-
- VECCOPY(ob->loc, ob->obmat[3]);
-
- mat3_to_eul( ob->rot,mat);
- eul_to_mat3( tmat,ob->rot);
-
- invert_m3_m3(imat, tmat);
-
- mul_m3_m3m3(tmat, imat, mat);
-
- ob->size[0]= tmat[0][0];
- ob->size[1]= tmat[1][1];
- ob->size[2]= tmat[2][2];
-
-}
-
/* ********* clear/set restrict view *********/
static int object_restrictview_clear_exec(bContext *C, wmOperator *op)
{
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index f55e7594c24..94eae2a7ab9 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -430,7 +430,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
else if(type == 1) {
ob->parent= NULL;
ob->track= NULL;
- ED_object_apply_obmat(ob);
+ object_apply_mat4(ob, ob->obmat);
}
else if(type == 2)
unit_m4(ob->parentinv);
@@ -572,7 +572,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
Object workob;
/* apply transformation of previous parenting */
- ED_object_apply_obmat(ob);
+ object_apply_mat4(ob, ob->obmat);
/* set the parent (except for follow-path constraint option) */
if(partype != PAR_PATH_CONST)
@@ -887,7 +887,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
}
if(type == 1)
- ED_object_apply_obmat(ob);
+ object_apply_mat4(ob, ob->obmat);
}
CTX_DATA_END;
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index db15322bbc4..ca6feabdf80 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -392,7 +392,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
/* a change was made, adjust the children to compensate */
for(ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) {
if(ob_child->parent == ob) {
- ED_object_apply_obmat(ob_child);
+ object_apply_mat4(ob_child, ob_child->obmat);
what_does_parent(scene, ob_child, &workob);
invert_m4_m4(ob_child->parentinv, workob.obmat);
}
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index d7f3436713c..e29a81612fa 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -40,6 +40,7 @@
#include "DNA_space_types.h"
#include "DNA_world_types.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_font.h"
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 944a93a713f..62a325b59f4 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -379,7 +379,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
{
PointerRNA strip_ptr;
uiLayout *layout= pa->layout;
- uiLayout *column, *subcolumn;
+ uiLayout *column, *subcolumn, *subrow;
uiBlock *block;
/* check context and also validity of pointer */
@@ -398,10 +398,13 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
column= uiLayoutColumn(layout, 1);
- uiItemR(column, NULL, 0, &strip_ptr, "animated_time", 0);
-
+ subrow= uiLayoutRow(column, 0);
+ uiItemR(subrow, NULL, 0, &strip_ptr, "animated_time", 0);
+ uiItemR(subrow, NULL, 0, &strip_ptr, "animated_time_cyclic", 0);
+
subcolumn= uiLayoutColumn(column, 1);
- uiLayoutSetEnabled(subcolumn, RNA_boolean_get(&strip_ptr, "animated_time"));
+ subrow= uiLayoutRow(subcolumn, 0);
+ uiLayoutSetEnabled(subrow, RNA_boolean_get(&strip_ptr, "animated_time"));
uiItemR(subcolumn, NULL, 0, &strip_ptr, "strip_time", 0);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 8fedc56df67..5a495488afa 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5773,7 +5773,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
break;
case OB_CAMERA:
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0 || (rv3d->persp==RV3D_CAMOB && v3d->camera==ob)) /* special exception for active camera */
drawcamera(scene, v3d, rv3d, ob, flag);
break;
case OB_LATTICE:
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index b1f5e959388..79448ecf875 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2352,11 +2352,11 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
/* Draw particle edit brush XXX (removed) */
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
- if(rv3d->persp==RV3D_CAMOB) drawviewborder(scene, ar, v3d);
- if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar);
+ if(rv3d->persp==RV3D_CAMOB) drawviewborder(scene, ar, v3d);
+ if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar);
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
// if (v3d->flag2 & V3D_DISPGP)
draw_gpencil_3dview((bContext *)C, 0);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index f09b127bfdd..efc3c80de5f 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1353,11 +1353,12 @@ static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview wi
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(pchan->bone->flag & BONE_SELECTED) {
if(pchan->bone->layer & arm->layer) {
+ bPoseChannel *pchan_tx= pchan->custom_tx ? pchan->custom_tx : pchan;
ok= 1;
- VECCOPY(vec, pchan->pose_head);
+ VECCOPY(vec, pchan_tx->pose_head);
mul_m4_v3(ob->obmat, vec);
DO_MINMAX(vec, min, max);
- VECCOPY(vec, pchan->pose_tail);
+ VECCOPY(vec, pchan_tx->pose_tail);
mul_m4_v3(ob->obmat, vec);
DO_MINMAX(vec, min, max);
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 828d5368834..02c4a1d91ed 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -2288,12 +2288,12 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
break;
case FLY_MODAL_DIR_UP:
- if (fly->speed < 0.0f) fly->speed= -fly->speed;
+ if (fly->speed > 0.0f) fly->speed= -fly->speed;
fly->axis= 1;
break;
case FLY_MODAL_DIR_DOWN:
- if (fly->speed > 0.0f) fly->speed= -fly->speed;
+ if (fly->speed < 0.0f) fly->speed= -fly->speed;
fly->axis= 1;
break;
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 83f68758da9..8c2fc7db390 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -601,6 +601,7 @@ typedef enum eNlaStrip_Flag {
/* strip influence is controlled by local F-Curve */
NLASTRIP_FLAG_USR_INFLUENCE = (1<<5),
NLASTRIP_FLAG_USR_TIME = (1<<6),
+ NLASTRIP_FLAG_USR_TIME_CYCLIC = (1<<7),
/* NLA strip length is synced to the length of the referenced action */
NLASTRIP_FLAG_SYNC_LENGTH = (1<<9),
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 1e2cc2745a4..82418899172 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -288,7 +288,9 @@ typedef struct Curve {
/* flagu flagv (nurb) */
-#define CU_CYCLIC 1
+#define CU_NURB_CYCLIC 1
+#define CU_NURB_ENDPOINT 2
+#define CU_NURB_BEZIER 4
/* *************** BEZTRIPLE **************** */
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 178cdacf3c3..77eff6ad4c5 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -334,6 +334,7 @@ typedef struct ExtensionRNA {
#define MainMaterials Main
#define MainMeshes Main
#define MainLamps Main
+#define MainImages Main
#define MainObjects Main
#define MainTexts Main
#define MainActions Main
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 24701ed866d..579ebfc9332 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -50,6 +50,14 @@ EnumPropertyItem beztriple_interpolation_mode_items[] = {
{BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""},
{0, NULL, 0, NULL, NULL}};
+EnumPropertyItem curve_type_items[] = {
+ {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", ""},
+ {0, NULL, 0, NULL, NULL}};
+
#ifdef RNA_RUNTIME
#include "DNA_object_types.h"
@@ -72,22 +80,6 @@ static StructRNA *rna_Curve_refine(PointerRNA *ptr)
else return &RNA_Curve;
}
-
-static PointerRNA rna_Curve_active_nurb_get(PointerRNA *ptr)
-{
- Curve *cu= (Curve*)ptr->data;
- Nurb *nu= NULL;
-
- if(cu->editnurb)
- nu = BLI_findlink(cu->editnurb, cu->actnu);
-
- if(nu)
- return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu);
-
- return rna_pointer_inherit_refine(ptr, NULL, NULL);
-}
-
-
static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
{
BezTriple *bt= (BezTriple*)ptr->data;
@@ -208,14 +200,17 @@ static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA
rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
}
-static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Curve_update_data_id(Main *bmain, Scene *scene, ID *id)
{
- ID *id= ptr->id.data;
-
DAG_id_flush_update(id, OB_RECALC_DATA);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
}
+static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ rna_Curve_update_data_id(bmain, scene, ptr->id.data);
+}
+
static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_scene_sort(scene);
@@ -316,6 +311,119 @@ static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
rna_Curve_update_data(bmain, scene, ptr);
}
+static void rna_Curve_spline_points_add(ID *id, Nurb *nu, bContext *C, ReportList *reports, int number)
+{
+ if(nu->type == CU_BEZIER) {
+ BKE_report(reports, RPT_ERROR, "Bezier spline can't have points added");
+ }
+ else if(number==0) {
+ // do nothing
+ } else {
+
+ addNurbPoints(nu, number);
+
+ /* update */
+ makeknots(nu, 1);
+
+ rna_Curve_update_data_id(CTX_data_main(C), CTX_data_scene(C), id);
+ }
+}
+
+static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, bContext *C, ReportList *reports, int number)
+{
+ if(nu->type != CU_BEZIER) {
+ BKE_report(reports, RPT_ERROR, "Only bezier splines can be added");
+ }
+ else if(number==0) {
+ // do nothing
+ } else {
+ addNurbPointsBezier(nu, number);
+
+ /* update */
+ makeknots(nu, 1);
+
+ rna_Curve_update_data_id(CTX_data_main(C), CTX_data_scene(C), id);
+ }
+}
+
+static Nurb *rna_Curve_spline_new(Curve *cu, int type)
+{
+ Nurb *nu= ( Nurb * ) MEM_callocN( sizeof( Nurb ), "spline.new" );
+
+ if(type==CU_BEZIER) {
+ BezTriple *bezt= (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt");
+ bezt->radius= 1.0;
+ nu->bezt= bezt;
+ }
+ else {
+ BPoint *bp= (BPoint *)MEM_callocN(sizeof(BPoint), "spline.new.bp");
+ bp->radius= 1.0f;
+ nu->bp= bp;
+ }
+
+ nu->type= type;
+ nu->pntsu= 1;
+ nu->pntsv= 1;
+
+ nu->orderu= nu->orderv= 4;
+ nu->resolu= nu->resolv= 12;
+ nu->flag= CU_SMOOTH;
+
+ BLI_addtail(&cu->nurb, nu);
+
+ return nu;
+}
+
+static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
+{
+ /* todo, check we're in the list */
+ int found= 0;
+ if(cu->editnurb) {
+ found= BLI_remlink_safe(cu->editnurb, nu);
+ }
+ else {
+ found= BLI_remlink_safe(&cu->nurb, nu);
+ }
+
+ if(!found) {
+ BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" does not contain spline given", cu->id.name+2);
+ return;
+ }
+
+ freeNurb(nu);
+ /* invalidate pointer!, no can do */
+}
+
+static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr)
+{
+ Curve *cu= (Curve*)ptr->data;
+ Nurb *nu;
+
+ if(cu->editnurb)
+ nu= BLI_findlink(cu->editnurb, cu->actnu);
+ else
+ nu= BLI_findlink(&cu->nurb, cu->actnu); // currently set to -1, should be changed to be allowed outside of editmode.
+
+ if(nu)
+ 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)
+{
+ Curve *cu= (Curve*)ptr->data;
+ Nurb *nu= value.data;
+
+ /* -1 is ok for an unset index */
+ if(nu==NULL)
+ cu->actnu= -1;
+ else if(cu->editnurb)
+ cu->actnu= BLI_findindex(cu->editnurb, nu);
+ else
+ cu->actnu= BLI_findindex(&cu->nurb, nu);
+}
+
#else
static void rna_def_bpoint(BlenderRNA *brna)
@@ -725,6 +833,100 @@ static void rna_def_text(BlenderRNA *brna)
rna_def_nurbs(brna, srna);
}
+
+/* curve.splines[0].points */
+static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ //PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "SplinePoints");
+ srna= RNA_def_struct(brna, "SplinePoints", NULL);
+ RNA_def_struct_sdna(srna, "Nurb");
+ RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points");
+
+ func= RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline.");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_SELF_ID|FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "number", 1, INT_MIN, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
+
+ /*
+ func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+ RNA_def_function_ui_description(func, "Remove a spline from a curve.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ */
+}
+
+static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ //PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "SplineBezierPoints");
+ srna= RNA_def_struct(brna, "SplineBezierPoints", NULL);
+ RNA_def_struct_sdna(srna, "Nurb");
+ RNA_def_struct_ui_text(srna, "Spline Bezier Points", "Collection of spline bezirt points");
+
+ func= RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline.");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_SELF_ID|FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "number", 1, INT_MIN, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
+
+ /*
+ func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+ RNA_def_function_ui_description(func, "Remove a spline from a curve.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ */
+}
+
+/* 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");
+ srna= RNA_def_struct(brna, "CurveSplines", NULL);
+ RNA_def_struct_sdna(srna, "Curve");
+ RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines");
+
+ func= RNA_def_function(srna, "new", "rna_Curve_spline_new");
+ RNA_def_function_ui_description(func, "Add a new spline to the curve.");
+ parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+ RNA_def_function_ui_description(func, "Remove a spline from a curve.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_pointer_funcs(prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline");
+ /* Could call: ED_base_object_activate(C, scene->basact);
+ * but would be a bad level call and it seems the notifier is enough */
+ RNA_def_property_update(prop, NC_SCENE|ND_OB_ACTIVE, NULL);
+}
+
+
static void rna_def_curve(BlenderRNA *brna)
{
StructRNA *srna;
@@ -757,12 +959,7 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL);
RNA_def_property_struct_type(prop, "Spline");
RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
-
- prop= RNA_def_property(srna, "active_spline", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Spline");
- RNA_def_property_pointer_funcs(prop, "rna_Curve_active_nurb_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Spline", "The active editmode spline");
-
+ rna_def_curve_splines(brna, prop);
prop= RNA_def_property(srna, "draw_handles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES);
@@ -888,14 +1085,6 @@ static void rna_def_curve(BlenderRNA *brna)
static void rna_def_curve_nurb(BlenderRNA *brna)
{
- static EnumPropertyItem curve_type_items[] = {
- {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", ""},
- {0, NULL, 0, NULL, NULL}};
-
static EnumPropertyItem spline_interpolation_items[] = {
{BEZT_IPO_CONST, "LINEAR", 0, "Linear", ""},
{BEZT_IPO_LIN, "CARDINAL", 0, "Cardinal", ""},
@@ -915,11 +1104,13 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "SplinePoint");
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", 0, 0);
RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline");
+ rna_def_curve_spline_points(brna, prop);
prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "BezierSplinePoint");
RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu");
RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for bezier curves only");
+ rna_def_curve_spline_bezpoints(brna, prop);
prop= RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
@@ -982,34 +1173,34 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop= RNA_def_property(srna, "cyclic_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_CYCLIC);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction");
RNA_def_property_update(prop, 0, "rna_Nurb_update_handle_data"); /* only needed for cyclic_u because cyclic_v cant do bezier */
prop= RNA_def_property(srna, "cyclic_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_CYCLIC);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* Note, endpoint and bezier flags should never be on at the same time! */
prop= RNA_def_property(srna, "endpoint_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagu", 2);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT);
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)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
prop= RNA_def_property(srna, "endpoint_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", 2);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT);
RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
prop= RNA_def_property(srna, "bezier_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagu", 4);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER);
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)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
prop= RNA_def_property(srna, "bezier_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", 4);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER);
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)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 5f007c63b9e..9433294fdd3 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -69,11 +69,6 @@ Tex *rna_Main_add_texture(Main *bmain, char *name)
return add_texture(name);
}
-Image *rna_Main_add_image(Main *bmain, char *filename)
-{
- return BKE_add_image_file(filename, 0);
-}
-
Camera *rna_Main_cameras_new(Main *bmain, char* name)
{
return add_camera(name);
@@ -227,6 +222,27 @@ void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
/* XXX python now has invalid pointer? */
}
+Image *rna_Main_images_new(Main *bmain, char* name, int width, int height, int float_buffer)
+{
+ float color[4]= {0.0, 0.0, 0.0, 1.0};
+ Image *image= BKE_add_image_size(width, height, name, float_buffer, 0, color);
+ image->id.us--;
+ return image;
+}
+Image *rna_Main_images_load(Main *bmain, char *filename)
+{
+ return BKE_add_image_file(filename, 0);
+}
+void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
+{
+ if(ID_REAL_USERS(image) <= 0)
+ free_libblock(&bmain->image, image);
+ else
+ BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d.", image->id.name+2, ID_REAL_USERS(image));
+
+ /* XXX python now has invalid pointer? */
+}
+
Tex *rna_Main_textures_new(Main *bmain, char* name)
{
Tex *tex= add_texture(name);
@@ -309,15 +325,20 @@ void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
void RNA_api_main(StructRNA *srna)
{
+ /*
FunctionRNA *func;
PropertyRNA *parm;
-
+ */
+ /* maybe we want to add functions in 'bpy.data' still?
+ * for now they are all in collections bpy.data.images.new(...) */
+ /*
func= RNA_def_function(srna, "add_image", "rna_Main_add_image");
RNA_def_function_ui_description(func, "Add a new image.");
parm= RNA_def_string(func, "filename", "", 0, "", "Filename to load image from.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_pointer(func, "image", "Image", "", "New image.");
RNA_def_function_return(func, parm);
+ */
}
@@ -491,8 +512,40 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
}
void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+ RNA_def_property_srna(cprop, "MainImages");
+ srna= RNA_def_struct(brna, "MainImages", NULL);
+ RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
+
+ func= RNA_def_function(srna, "new", "rna_Main_images_new");
+ RNA_def_function_ui_description(func, "Add a new image to the main database");
+ parm= RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image.", 0, INT_MAX);
+ parm= RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image.", 0, INT_MAX);
+ parm= RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
+ /* return type */
+ parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "load", "rna_Main_images_load");
+ RNA_def_function_ui_description(func, "Load a new image into the main database");
+ parm= RNA_def_string(func, "filename", "File Name", 0, "", "path of the file to load.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Main_images_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove an image from the current blendfile.");
+ parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
}
+
void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
{
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 9cbe46dac58..b3f4aab7599 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -411,6 +411,11 @@ static void rna_def_nlastrip(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME);
RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set");
RNA_def_property_ui_text(prop, "Animated Strip Time", "Strip time is controlled by an F-Curve rather than automatically determined");
+
+ prop= RNA_def_property(srna, "animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME_CYCLIC);
+ RNA_def_property_ui_text(prop, "Cyclic Strip Time", "Cycle the animated time within the action start & end");
+ RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); // is there a better update flag?
/* settings */
prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 117a1d5bc60..21a1b7994a5 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -125,7 +125,7 @@ void rna_Object_update(Main *bmain, Scene *scene, PointerRNA *ptr)
void rna_Object_matrix_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ED_object_apply_obmat(ptr->id.data);
+ object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat);
rna_Object_update(bmain, scene, ptr);
}
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 1686f3e69db..1fb24c2da28 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -178,12 +178,12 @@ static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base*)internal->link)->object);
}
-static Base *rna_Scene_link_object(Scene *scene, ReportList *reports, Object *ob)
+static Base *rna_Scene_object_link(Scene *scene, ReportList *reports, Object *ob)
{
Base *base;
if (ob->type != OB_EMPTY && ob->data==NULL) {
- BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not an Empty type and has no Object Data set.");
+ BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not an Empty type and has no Object Data set.", ob->id.name+2);
return NULL;
}
@@ -204,7 +204,7 @@ static Base *rna_Scene_link_object(Scene *scene, ReportList *reports, Object *ob
return base;
}
-static void rna_Scene_unlink_object(Scene *scene, bContext *C, ReportList *reports, Object *ob)
+static void rna_Scene_object_unlink(Scene *scene, bContext *C, ReportList *reports, Object *ob)
{
Base *base= object_in_scene(ob, scene);
if (!base) {
@@ -2604,7 +2604,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "Scene");
RNA_def_struct_ui_text(srna, "Scene Objects", "Collection of scene objects");
- func= RNA_def_function(srna, "link", "rna_Scene_link_object");
+ func= RNA_def_function(srna, "link", "rna_Scene_object_link");
RNA_def_function_ui_description(func, "Link object to scene.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene.");
@@ -2612,7 +2612,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base.");
RNA_def_function_return(func, parm);
- func= RNA_def_function(srna, "unlink", "rna_Scene_unlink_object");
+ func= RNA_def_function(srna, "unlink", "rna_Scene_object_unlink");
RNA_def_function_ui_description(func, "Unlink object from scene.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene.");
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py
index 701aad651cf..944dbb082a6 100644
--- a/source/blender/python/doc/sphinx_doc_gen.py
+++ b/source/blender/python/doc/sphinx_doc_gen.py
@@ -277,6 +277,8 @@ def rna2sphinx(BASEPATH):
fw("\n")
fw("An introduction to blender and python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
fw("\n")
+ fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n")
+ fw("\n")
fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n")
fw(" \n")
fw(" The following areas are subject to change.\n")
diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/source/blender/python/doc/sphinx_doc_gen.sh
new file mode 100644
index 00000000000..3f5460a0626
--- /dev/null
+++ b/source/blender/python/doc/sphinx_doc_gen.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+# run from the blender source dir
+# bash source/blender/python/doc/sphinx_doc_gen.sh
+# ssh upload means you need a login into the server
+
+BLENDER="./blender.bin"
+SSH_HOST="ideasman42@emo.blender.org"
+SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
+
+# clear doc dir
+rm -rf ./source/blender/python/doc/sphinx-in ./source/blender/python/doc/sphinx-out
+$BLENDER -b -P ./source/blender/python/doc/sphinx_doc_gen.py
+
+# html
+sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
+cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html
+ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD'/*'
+rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD/
+
+# pdf
+sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
+cd source/blender/python/doc/sphinx-out
+make
+cd ../../../../../
+rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD/blender_python_reference_250.pdf
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index eb883be5a56..f7eb800ef23 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -24,10 +24,8 @@
*/
#include "BKE_idprop.h"
-
#include "IDProp.h"
-
-#define BSTR_EQ(a, b) (*(a) == *(b) && !strcmp(a, b))
+#include "MEM_guardedalloc.h"
/*** Function to wrap ID properties ***/
PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index c9906bb1599..dcbdc6d64d4 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -359,7 +359,7 @@ static PyObject *pyrna_struct_repr( BPy_StructRNA *self )
return pyob;
}
- return PyUnicode_FromFormat( "<bpy_struct, %.200s>", RNA_struct_identifier(self->ptr.type));
+ return PyUnicode_FromFormat( "<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data);
}
static PyObject *pyrna_prop_repr( BPy_PropertyRNA *self )
@@ -1663,8 +1663,9 @@ int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_pre
{
char *path;
PropertyRNA *prop;
+ int array_len;
- if (!PyArg_ParseTuple(args, "s|if", &path, &index, &cfra)) {
+ if (!PyArg_ParseTuple(args, "s|if", &path, index, cfra)) {
PyErr_Format(PyExc_TypeError, "%.200s expected a string and optionally an int and float arguments", error_prefix);
return -1;
}
@@ -1693,6 +1694,12 @@ int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_pre
return -1;
}
+ array_len= RNA_property_array_length(ptr, prop);
+ if((*index) != -1 && (*index) >= array_len) {
+ PyErr_Format( PyExc_TypeError, "%.200s index out of range \"%s\", given %d, array length is %d", error_prefix, path, *index, array_len);
+ return -1;
+ }
+
if(*cfra==FLT_MAX)
*cfra= CTX_data_scene(BPy_GetContext())->r.cfra;