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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-07-07 03:46:48 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-07-07 03:46:48 +0400
commitb7b50298148ef502d14143b0a5fa01dfac2ecce4 (patch)
tree7c47cc7777b79bb375bc2f939c34233e6671e10d /source/blender/blenkernel/intern
parent98a7ca61fa905792bd3fdfa6c29f44691c9582ac (diff)
parent3a0593cc3d5de33248b3a7b913a45729c37dc1b4 (diff)
Merged changes in the trunk up to revision 48695.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/action.c14
-rw-r--r--source/blender/blenkernel/intern/anim.c4
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c2
-rw-r--r--source/blender/blenkernel/intern/armature.c5
-rw-r--r--source/blender/blenkernel/intern/collision.c2
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c75
-rw-r--r--source/blender/blenkernel/intern/displist.c11
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c2
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c6
-rw-r--r--source/blender/blenkernel/intern/font.c2
-rw-r--r--source/blender/blenkernel/intern/image.c37
-rw-r--r--source/blender/blenkernel/intern/mask.c92
-rw-r--r--source/blender/blenkernel/intern/material.c58
-rw-r--r--source/blender/blenkernel/intern/mesh.c8
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c82
-rw-r--r--source/blender/blenkernel/intern/modifier.c7
-rw-r--r--source/blender/blenkernel/intern/nla.c2
-rw-r--r--source/blender/blenkernel/intern/node.c18
-rw-r--r--source/blender/blenkernel/intern/object.c28
-rw-r--r--source/blender/blenkernel/intern/particle_system.c4
-rw-r--r--source/blender/blenkernel/intern/smoke.c4
-rw-r--r--source/blender/blenkernel/intern/softbody.c6
-rw-r--r--source/blender/blenkernel/intern/tracking.c10
-rw-r--r--source/blender/blenkernel/intern/unit.c144
24 files changed, 439 insertions, 184 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index b3d2e3371f4..8d1707725b5 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -253,7 +253,7 @@ void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
}
/* Sync colors used for action/bone group with theme settings */
-void action_group_colors_sync(bActionGroup *grp)
+void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
{
/* only do color copying if using a custom color (i.e. not default color) */
if (grp->customCol) {
@@ -265,9 +265,15 @@ void action_group_colors_sync(bActionGroup *grp)
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
}
else {
- /* init custom colors with a generic multi-color rgb set, if not initialized already
- * (for custom color set) */
- if (grp->cs.solid[0] == 0) {
+ /* if a reference group is provided, use the custom color from there... */
+ if (ref_grp) {
+ /* assumption: reference group has a color set */
+ memcpy(&grp->cs, &ref_grp->cs, sizeof(ThemeWireColor));
+ }
+ /* otherwise, init custom color with a generic/placeholder color set if
+ * no previous theme color was used that we can just keep using
+ */
+ else if (grp->cs.solid[0] == 0) {
/* define for setting colors in theme below */
rgba_char_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255);
rgba_char_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index a0cfc4295ef..52399801691 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -78,9 +78,9 @@
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index, int level, int animated);
/* ******************************************************************** */
-/* Animation Visualisation */
+/* Animation Visualization */
-/* Initialize the default settings for animation visualisation */
+/* Initialize the default settings for animation visualization */
void animviz_settings_init(bAnimVizSettings *avs)
{
/* sanity check */
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index e5701927b07..e4ecdf245d1 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1864,7 +1864,7 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
/* prepare template for 'evaluation strip'
* - based on the transition strip's evaluation strip data
* - strip_mode is NES_TIME_TRANSITION_* based on which endpoint
- * - strip_time is the 'normalised' (i.e. in-strip) time for evaluation,
+ * - strip_time is the 'normalized' (i.e. in-strip) time for evaluation,
* which doubles up as an additional weighting factor for the strip influences
* which allows us to appear to be 'interpolating' between the two extremes
*/
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 96959398bc2..c10b1e2d4f4 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -2049,7 +2049,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
cross_v3_v3v3(raxis, rmat[1], splineVec);
rangle = dot_v3v3(rmat[1], splineVec);
- rangle = acos(MAX2(-1.0f, MIN2(1.0f, rangle)));
+ CLAMP(rangle, -1.0f, 1.0f);
+ rangle = acosf(rangle);
/* multiply the magnitude of the angle by the influence of the constraint to
* control the influence of the SplineIK effect
@@ -2207,7 +2208,7 @@ void BKE_pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4])
axis_angle_to_mat3(rmat, pchan->rotAxis, pchan->rotAngle);
}
else {
- /* quats are normalised before use to eliminate scaling issues */
+ /* quats are normalized before use to eliminate scaling issues */
float quat[4];
/* NOTE: we now don't normalize the stored values anymore, since this was kindof evil in some cases
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index d99c36b6c91..7acbcbf6c93 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -274,7 +274,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
// Decrease in magnitude of relative tangential velocity due to coulomb friction
// in original formula "magrelVel" should be the "change of relative velocity in normal direction"
- magtangent = MIN2(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre)));
+ magtangent = minf(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre)));
// Apply friction impulse.
if ( magtangent > ALMOST_ZERO ) {
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index a1e67ebd414..05a2cfee8e6 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -66,6 +66,7 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
+#include "BKE_material.h"
#include "BKE_mball.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
@@ -311,7 +312,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
- int isdata_fcu = isdata || (fcu->rna_path && strstr(fcu->rna_path, "modifiers["));
+ int isdata_fcu = (isdata) || (fcu->rna_path && strstr(fcu->rna_path, "modifiers["));
/* loop over variables to get the target relationships */
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
@@ -347,6 +348,52 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
}
}
+/* XXX: forward def for material driver handling... */
+static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Material *ma);
+
+/* recursive handling for material nodetree drivers */
+static void dag_add_material_nodetree_driver_relations(DagForest *dag, DagNode *node, bNodeTree *ntree, Material *rootma)
+{
+ bNode *n;
+ Material *ma;
+
+ /* nodetree itself */
+ if (ntree->adt) {
+ dag_add_driver_relation(ntree->adt, dag, node, 1);
+ }
+
+ /* nodetree's nodes... */
+ for (n = ntree->nodes.first; n; n = n->next) {
+ if (n->id && GS(n->id->name) == ID_MA) {
+ ma = (Material *)n->id;
+ if (ma != rootma) {
+ dag_add_material_driver_relations(dag, node, ma);
+ }
+ }
+ else if (n->type == NODE_GROUP && n->id) {
+ dag_add_material_nodetree_driver_relations(dag, node, (bNodeTree *)n->id, rootma);
+ }
+ }
+}
+
+/* recursive handling for material drivers */
+static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Material *ma)
+{
+ /* material itself */
+ if (ma->adt) {
+ dag_add_driver_relation(ma->adt, dag, node, 1);
+ }
+
+ /* textures */
+ // TODO...
+ //dag_add_texture_driver_relations(DagForest *dag, DagNode *node, ID *id);
+
+ /* material's nodetree */
+ if (ma->nodetree) {
+ dag_add_material_nodetree_driver_relations(dag, node, ma->nodetree, ma);
+ }
+}
+
static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node)
{
Base *base;
@@ -516,7 +563,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
/* softbody collision */
if ((ob->type == OB_MESH) || (ob->type == OB_CURVE) || (ob->type == OB_LATTICE)) {
- if (modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob) || ob->particlesystem.first)
+ if (modifiers_isModifierEnabled(ob, eModifierType_Softbody)
+ || modifiers_isModifierEnabled(ob, eModifierType_Cloth)
+ || modifiers_isModifierEnabled(ob, eModifierType_Smoke)
+ || modifiers_isModifierEnabled(ob, eModifierType_DynamicPaint)
+ || ob->particlesystem.first)
dag_add_collision_field_relation(dag, scene, ob, node); /* TODO: use effectorweight->group */
}
@@ -572,6 +623,20 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
break;
}
+ /* material drivers */
+ if (ob->totcol) {
+ int a;
+
+ for (a = 1; a <= ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a);
+
+ if (ma) {
+ /* recursively figure out if there are drivers, and hook these up to this object */
+ dag_add_material_driver_relations(dag, node, ma);
+ }
+ }
+ }
+
/* particles */
psys = ob->particlesystem.first;
if (psys) {
@@ -605,15 +670,15 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
/* note that this relation actually runs in the wrong direction, the problem
* is that dupli system all have this (due to parenting), and the render
* engine instancing assumes particular ordering of objects in list */
- dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualisation");
+ dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualization");
if (part->dup_ob->type == OB_MBALL)
- dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualisation");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualization");
}
if (part->ren_as == PART_DRAW_GR && part->dup_group) {
for (go = part->dup_group->gobject.first; go; go = go->next) {
node2 = dag_get_node(dag, go->ob);
- dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualisation");
+ dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualization");
}
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 2493507dca4..6e5d6ffb0e9 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1386,17 +1386,18 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
ListBase top_capbase = {NULL, NULL};
for (dlb = dlbev.first; dlb; dlb = dlb->next) {
- int i, start, steps;
- float bevfac1 = MIN2(cu->bevfac1, cu->bevfac2), bevfac2 = MAX2(cu->bevfac1, cu->bevfac2);
+ const float bevfac1 = minf(cu->bevfac1, cu->bevfac2);
+ const float bevfac2 = maxf(cu->bevfac1, cu->bevfac2);
float firstblend = 0.0f, lastblend = 0.0f;
+ int i, start, steps;
- if (cu->bevfac1 - cu->bevfac2 == 0.0f)
+ if (bevfac2 - bevfac1 == 0.0f)
continue;
start = (int)(bevfac1 * (bl->nr - 1));
steps = 2 + (int)((bevfac2) * (bl->nr - 1)) - start;
- firstblend = 1.0f - ((float)bevfac1 * (bl->nr - 1) - (int)((float)bevfac1 * (bl->nr - 1)));
- lastblend = (float)bevfac2 * (bl->nr - 1) - (int)((float)bevfac2 * (bl->nr - 1));
+ firstblend = 1.0f - (bevfac1 * (bl->nr - 1) - (int)(bevfac1 * (bl->nr - 1)));
+ lastblend = bevfac2 * (bl->nr - 1) - (int)(bevfac2 * (bl->nr - 1));
if (steps > bl->nr) {
steps = bl->nr;
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index a6467af2773..dd5751c5d1f 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -1686,7 +1686,7 @@ struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd,
c[1] = material->g;
c[2] = material->b;
}
- else { /* default grey */
+ else { /* default gray */
c[0] = 0.65f;
c[1] = 0.65f;
c[2] = 0.65f;
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index b7ede15d00b..f981ecaf810 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -285,7 +285,7 @@ static FModifierTypeInfo FMI_GENERATOR = {
* x is the evaluation 'time', and 'y' is the resultant value
*
* Functions available are
- * sin, cos, tan, sinc (normalised sin), natural log, square root
+ * sin, cos, tan, sinc (normalized sin), natural log, square root
*/
static void fcm_fn_generator_new_data(void *mdata)
@@ -297,7 +297,7 @@ static void fcm_fn_generator_new_data(void *mdata)
data->phase_multiplier = 1.0f;
}
-/* Unary 'normalised sine' function
+/* Unary 'normalized sine' function
* y = sin(PI + x) / (PI * x),
* except for x = 0 when y = 1.
*/
@@ -326,7 +326,7 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float
case FCM_GENERATOR_FN_COS: /* cosine wave */
fn = cos;
break;
- case FCM_GENERATOR_FN_SINC: /* normalised sine wave */
+ case FCM_GENERATOR_FN_SINC: /* normalized sine wave */
fn = sinc;
break;
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 061530965ef..5d33c8fbcbf 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -699,7 +699,7 @@ makebreak:
yof -= linedist;
- maxlen = MAX2(maxlen, (xof - tb->x / cu->fsize));
+ maxlen = maxf(maxlen, (xof - tb->x / cu->fsize));
linedata[lnr] = xof - tb->x / cu->fsize;
linedata2[lnr] = cnr;
linedata3[lnr] = tb->w / cu->fsize;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index beaf8f719e3..d2a2412843a 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2784,10 +2784,14 @@ ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
return BKE_image_acquire_ibuf(ima, iuser, NULL);
}
-int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr)
+int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr, short *r_is_in_range)
{
const int len = (iuser->fie_ima * iuser->frames) / 2;
+ if (r_is_in_range) {
+ *r_is_in_range = FALSE;
+ }
+
if (len == 0) {
return 0;
}
@@ -2800,10 +2804,23 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr)
cfra = ((cfra) % len);
if (cfra < 0) cfra += len;
if (cfra == 0) cfra = len;
+
+ if (r_is_in_range) {
+ *r_is_in_range = TRUE;
+ }
}
- if (cfra < 0) cfra = 0;
- else if (cfra > len) cfra = len;
+ if (cfra < 0) {
+ cfra = 0;
+ }
+ else if (cfra > len) {
+ cfra = len;
+ }
+ else {
+ if (r_is_in_range) {
+ *r_is_in_range = TRUE;
+ }
+ }
/* convert current frame to current field */
cfra = 2 * (cfra);
@@ -2812,7 +2829,6 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr)
/* transform to images space */
framenr = (cfra + iuser->fie_ima - 2) / iuser->fie_ima;
if (framenr > iuser->frames) framenr = iuser->frames;
- framenr += iuser->offset;
if (iuser->cycl) {
framenr = ((framenr) % len);
@@ -2820,6 +2836,9 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr)
if (framenr == 0) framenr = len;
}
+ /* important to apply after else we cant loop on frames 100 - 110 for eg. */
+ framenr += iuser->offset;
+
return framenr;
}
}
@@ -2827,7 +2846,15 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr)
void BKE_image_user_frame_calc(ImageUser *iuser, int cfra, int fieldnr)
{
if (iuser) {
- const int framenr = BKE_image_user_frame_get(iuser, cfra, fieldnr);
+ short is_in_range;
+ const int framenr = BKE_image_user_frame_get(iuser, cfra, fieldnr, &is_in_range);
+
+ if (is_in_range) {
+ iuser->flag |= IMA_USER_FRAME_IN_RANGE;
+ }
+ else {
+ iuser->flag &= ~IMA_USER_FRAME_IN_RANGE;
+ }
/* allows image users to handle redraws */
if (iuser->flag & IMA_ANIM_ALWAYS)
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 2767a67086b..b400332db81 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -188,6 +188,41 @@ void BKE_mask_layer_unique_name(Mask *mask, MaskLayer *masklay)
BLI_uniquename(&mask->masklayers, masklay, "MaskLayer", '.', offsetof(MaskLayer, name), sizeof(masklay->name));
}
+MaskLayer *BKE_mask_layer_copy(MaskLayer *layer)
+{
+ MaskLayer *layer_new;
+ MaskSpline *spline;
+
+ layer_new = MEM_callocN(sizeof(MaskLayer), "new mask layer");
+
+ BLI_strncpy(layer_new->name, layer->name, sizeof(layer_new->name));
+
+ layer_new->alpha = layer->alpha;
+ layer_new->blend = layer->blend;
+ layer_new->blend_flag = layer->blend_flag;
+ layer_new->flag = layer->flag;
+ layer_new->restrictflag = layer->restrictflag;
+
+ for (spline = layer->splines.first; spline; spline = spline->next) {
+ MaskSpline *spline_new = BKE_mask_spline_copy(spline);
+
+ BLI_addtail(&layer_new->splines, spline_new);
+ }
+
+ return layer_new;
+}
+
+void BKE_mask_layer_copy_list(ListBase *masklayers_new, ListBase *masklayers)
+{
+ MaskLayer *layer;
+
+ for (layer = masklayers->first; layer; layer = layer->next) {
+ MaskLayer *layer_new = BKE_mask_layer_copy(layer);
+
+ BLI_addtail(masklayers_new, layer_new);
+ }
+}
+
/* splines */
MaskSpline *BKE_mask_spline_add(MaskLayer *masklay)
@@ -988,21 +1023,34 @@ void BKE_mask_spline_free(MaskSpline *spline)
MEM_freeN(spline);
}
+static MaskSplinePoint *mask_spline_points_copy(MaskSplinePoint *points, int tot_point)
+{
+ MaskSplinePoint *npoints;
+ int i;
+
+ npoints = MEM_dupallocN(points);
+
+ for (i = 0; i < tot_point; i++) {
+ MaskSplinePoint *point = &npoints[i];
+
+ if (point->uw)
+ point->uw = MEM_dupallocN(point->uw);
+ }
+
+ return npoints;
+}
+
MaskSpline *BKE_mask_spline_copy(MaskSpline *spline)
{
MaskSpline *nspline = MEM_callocN(sizeof(MaskSpline), "new spline");
- int i;
*nspline = *spline;
nspline->points_deform = NULL;
- nspline->points = MEM_dupallocN(nspline->points);
-
- for (i = 0; i < nspline->tot_point; i++) {
- MaskSplinePoint *point = &nspline->points[i];
+ nspline->points = mask_spline_points_copy(spline->points, spline->tot_point);
- if (point->uw)
- point->uw = MEM_dupallocN(point->uw);
+ if (spline->points_deform) {
+ nspline->points_deform = mask_spline_points_copy(spline->points_deform, spline->tot_point);
}
return nspline;
@@ -1068,20 +1116,25 @@ void BKE_mask_layer_free(MaskLayer *masklay)
MEM_freeN(masklay);
}
-void BKE_mask_free(Mask *mask)
+void BKE_mask_layer_free_list(ListBase *masklayers)
{
- MaskLayer *masklay = mask->masklayers.first;
+ MaskLayer *masklay = masklayers->first;
while (masklay) {
- MaskLayer *next_masklay = masklay->next;
+ MaskLayer *masklay_next = masklay->next;
- BLI_remlink(&mask->masklayers, masklay);
+ BLI_remlink(masklayers, masklay);
BKE_mask_layer_free(masklay);
- masklay = next_masklay;
+ masklay = masklay_next;
}
}
+void BKE_mask_free(Mask *mask)
+{
+ BKE_mask_layer_free_list(&mask->masklayers);
+}
+
void BKE_mask_unlink(Main *bmain, Mask *mask)
{
bScreen *scr;
@@ -2093,9 +2146,9 @@ int BKE_mask_get_duration(Mask *mask)
}
/* rasterization */
-void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
- const short do_aspect_correct, const short do_mask_aa,
- const short do_feather)
+void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, float *buffer,
+ const short do_aspect_correct, const short do_mask_aa,
+ const short do_feather)
{
MaskLayer *masklay;
@@ -2103,7 +2156,7 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
const int buffer_size = width * height;
float *buffer_tmp = MEM_mallocN(sizeof(float) * buffer_size, __func__);
- for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+ for (masklay = masklayers->first; masklay; masklay = masklay->next) {
MaskSpline *spline;
float alpha;
@@ -2226,3 +2279,10 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
MEM_freeN(buffer_tmp);
}
+
+void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
+ const short do_aspect_correct, const short do_mask_aa,
+ const short do_feather)
+{
+ BKE_mask_rasterize_layers(&mask->masklayers, width, height, buffer, do_aspect_correct, do_mask_aa, do_feather);
+}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index c59948532ac..e0761311c98 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -36,6 +36,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
@@ -1051,6 +1052,57 @@ int material_in_material(Material *parmat, Material *mat)
else
return 0;
}
+
+
+/* ****************** */
+
+/* Update drivers for materials in a nodetree */
+static void material_node_drivers_update(Scene *scene, bNodeTree *ntree, float ctime, Material *rootma)
+{
+ bNode *node;
+ Material *ma;
+
+ /* nodetree itself */
+ if (ntree->adt && ntree->adt->drivers.first) {
+ BKE_animsys_evaluate_animdata(scene, &ntree->id, ntree->adt, ctime, ADT_RECALC_DRIVERS);
+ }
+
+ /* nodes... */
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->id && GS(node->id->name) == ID_MA) {
+ /* TODO: prevent infinite recursion here... */
+ ma = (Material *)node->id;
+ if (ma != rootma) {
+ material_drivers_update(scene, ma, ctime);
+ }
+ }
+ else if (node->type == NODE_GROUP && node->id) {
+ material_node_drivers_update(scene, (bNodeTree *)node->id,
+ ctime, rootma);
+ }
+ }
+}
+
+/* Calculate all drivers for materials
+ * FIXME: this is really a terrible method which may result in some things being calculated
+ * multiple times. However, without proper despgraph support for these things, we are forced
+ * into this sort of thing...
+ */
+void material_drivers_update(Scene *scene, Material *ma, float ctime)
+{
+ //if (G.f & G_DEBUG)
+ // printf("material_drivers_update(%s, %s)\n", scene->id.name, ma->id.name);
+
+ /* material itself */
+ if (ma->adt && ma->adt->drivers.first) {
+ BKE_animsys_evaluate_animdata(scene, &ma->id, ma->adt, ctime, ADT_RECALC_DRIVERS);
+ }
+
+ /* nodes */
+ if (ma->nodetree) {
+ material_node_drivers_update(scene, ma->nodetree, ctime, ma);
+ }
+}
/* ****************** */
#if 0 /* UNUSED */
@@ -1061,19 +1113,19 @@ static char colname_array[125][20]= {
"LightGreen", "Chartreuse", "YellowGreen", "Yellow", "Gold",
"Green", "LawnGreen", "GreenYellow", "LightOlive", "Yellow",
"DarkBlue", "DarkPurple", "HotPink", "VioletPink", "RedPink",
-"SlateGray", "DarkGrey", "PalePurple", "IndianRed", "Tomato",
+"SlateGray", "DarkGray", "PalePurple", "IndianRed", "Tomato",
"SeaGreen", "PaleGreen", "GreenKhaki", "LightBrown", "LightSalmon",
"SpringGreen", "PaleGreen", "MediumOlive", "YellowBrown", "LightGold",
"LightGreen", "LightGreen", "LightGreen", "GreenYellow", "PaleYellow",
"HalfBlue", "DarkSky", "HalfMagenta", "VioletRed", "DeepPink",
"SteelBlue", "SkyBlue", "Orchid", "LightHotPink", "HotPink",
-"SeaGreen", "SlateGray", "MediumGrey", "Burlywood", "LightPink",
+"SeaGreen", "SlateGray", "MediumGray", "Burlywood", "LightPink",
"SpringGreen", "Aquamarine", "PaleGreen", "Khaki", "PaleOrange",
"SpringGreen", "SeaGreen", "PaleGreen", "PaleWhite", "YellowWhite",
"LightBlue", "Purple", "MediumOrchid", "Magenta", "Magenta",
"RoyalBlue", "SlateBlue", "MediumOrchid", "Orchid", "Magenta",
"DeepSkyBlue", "LightSteelBlue", "LightSkyBlue", "Violet", "LightPink",
-"Cyan", "DarkTurquoise", "SkyBlue", "Grey", "Snow",
+"Cyan", "DarkTurquoise", "SkyBlue", "Gray", "Snow",
"Mint", "Mint", "Aquamarine", "MintCream", "Ivory",
"Blue", "Blue", "DarkMagenta", "DarkOrchid", "Magenta",
"SkyBlue", "RoyalBlue", "LightSlateBlue", "MediumOrchid", "Magenta",
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index e3b13ca0f17..8d81e7b595d 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -2153,7 +2153,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData
}
}
- /* note, we don't convert FGons at all, these are not even real ngons,
+ /* note, we don't convert NGons at all, these are not even real ngons,
* they have their own UV's, colors etc - its more an editing feature. */
BLI_edgehash_free(eh, NULL);
@@ -3146,19 +3146,17 @@ void BKE_mesh_translate(Mesh *me, float offset[3], int do_keys)
}
}
-
void BKE_mesh_ensure_navmesh(Mesh *me)
{
if (!CustomData_has_layer(&me->pdata, CD_RECAST)) {
int i;
int numFaces = me->totpoly;
int *recastData;
- CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
- recastData = (int *)CustomData_get_layer(&me->pdata, CD_RECAST);
+ recastData = (int *)MEM_mallocN(numFaces * sizeof(int), __func__);
for (i = 0; i < numFaces; i++) {
recastData[i] = i + 1;
}
- CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData");
+ CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_ASSIGN, recastData, numFaces, "recastData");
}
}
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 4528b748412..79e3fc19d20 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -223,7 +223,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
__func__, totvert, totedge, totloop, totpoly);
if (totedge == 0 && totpoly != 0) {
- PRINT(" logical error, %u polygons and 0 edges\n", totpoly);
+ PRINT("\tLogical error, %u polygons and 0 edges\n", totpoly);
do_edge_recalc = do_fixes;
}
@@ -233,7 +233,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
for (j = 0; j < 3; j++) {
if (!finite(mv->co[j])) {
- PRINT(" vertex %u: has invalid coordinate\n", i);
+ PRINT("\tVertex %u: has invalid coordinate\n", i);
if (do_fixes) {
zero_v3(mv->co);
@@ -247,7 +247,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
}
if (fix_normal) {
- PRINT(" vertex %u: has zero normal, assuming Z-up normal\n", i);
+ PRINT("\tVertex %u: has zero normal, assuming Z-up normal\n", i);
if (do_fixes) {
mv->no[2] = SHRT_MAX;
verts_fixed = TRUE;
@@ -258,20 +258,20 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
for (i = 0, me = medges; i < totedge; i++, me++) {
int remove = FALSE;
if (me->v1 == me->v2) {
- PRINT(" edge %u: has matching verts, both %u\n", i, me->v1);
+ PRINT("\tEdge %u: has matching verts, both %u\n", i, me->v1);
remove = do_fixes;
}
if (me->v1 >= totvert) {
- PRINT(" edge %u: v1 index out of range, %u\n", i, me->v1);
+ PRINT("\tEdge %u: v1 index out of range, %u\n", i, me->v1);
remove = do_fixes;
}
if (me->v2 >= totvert) {
- PRINT(" edge %u: v2 index out of range, %u\n", i, me->v2);
+ PRINT("\tEdge %u: v2 index out of range, %u\n", i, me->v2);
remove = do_fixes;
}
if (BLI_edgehash_haskey(edge_hash, me->v1, me->v2)) {
- PRINT(" edge %u: is a duplicate of %d\n", i,
+ PRINT("\tEdge %u: is a duplicate of %d\n", i,
GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, me->v1, me->v2)));
remove = do_fixes;
}
@@ -296,7 +296,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
PRINT(" face %u: edge " STRINGIFY(a) "/" STRINGIFY(b) \
" (%u,%u) is missing egde data\n", i, mf->a, mf->b); \
do_edge_recalc = TRUE; \
- }
+ } (void)0
MFace *mf;
MFace *mf_prev;
@@ -306,6 +306,8 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
SortFace *sf_prev;
unsigned int totsortface = 0;
+ PRINT("No Polys, only tesselated Faces\n");
+
for (i = 0, mf = mfaces, sf = sort_faces; i < totface; i++, mf++) {
int remove = FALSE;
int fidx;
@@ -315,7 +317,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
do {
fv[fidx] = *(&(mf->v1) + fidx);
if (fv[fidx] >= totvert) {
- PRINT(" face %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]);
+ PRINT("\tFace %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]);
remove = do_fixes;
}
} while (fidx--);
@@ -392,12 +394,12 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
mf_prev = mfaces + sf_prev->index;
if (mf->v4) {
- PRINT(" face %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n",
+ PRINT("\tFace %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n",
sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4,
mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4);
}
else {
- PRINT(" face %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n",
+ PRINT("\tFace %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n",
sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3,
mf_prev->v1, mf_prev->v2, mf_prev->v3);
}
@@ -433,7 +435,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
*
* Also, loops not used by polys can be discarded.
* And "intersecting" loops (i.e. loops used by more than one poly) are invalid,
- * so be sure to leave at most one poly/loop!
+ * so be sure to leave at most one poly per loop!
*/
{
SortPoly *sort_polys = MEM_callocN(sizeof(SortPoly) * totpoly, "mesh validate's sort_polys");
@@ -444,12 +446,12 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
if (mp->loopstart < 0 || mp->totloop < 3) {
/* Invalid loop data. */
- PRINT(" poly %u is invalid (loopstart: %u, totloop: %u)\n", sp->index, mp->loopstart, mp->totloop);
+ PRINT("\tPoly %u is invalid (loopstart: %u, totloop: %u)\n", sp->index, mp->loopstart, mp->totloop);
sp->invalid = TRUE;
}
else if (mp->loopstart + mp->totloop > totloop) {
/* Invalid loop data. */
- PRINT(" poly %u uses loops out of range (loopstart: %u, loopend: %u, max nbr of loops: %u)\n",
+ PRINT("\tPoly %u uses loops out of range (loopstart: %u, loopend: %u, max nbr of loops: %u)\n",
sp->index, mp->loopstart, mp->loopstart + mp->totloop - 1, totloop - 1);
sp->invalid = TRUE;
}
@@ -465,7 +467,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++, v++) {
if (ml->v >= totvert) {
/* Invalid vert idx. */
- PRINT(" loop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v);
+ PRINT("\tLoop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v);
sp->invalid = TRUE;
}
@@ -478,7 +480,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
v = sp->verts;
for (j = 0; j < mp->totloop; j++, v++) {
if ((mverts[*v].flag & ME_VERT_TMP_TAG) == 0) {
- PRINT(" poly %u has duplicate vert reference at corner (%u)\n", i, j);
+ PRINT("\tPoly %u has duplicate vert reference at corner (%u)\n", i, j);
sp->invalid = TRUE;
}
mverts[*v].flag &= ~ME_VERT_TMP_TAG;
@@ -494,7 +496,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
v2 = mloops[sp->loopstart + (j + 1) % mp->totloop].v;
if (!BLI_edgehash_haskey(edge_hash, v1, v2)) {
/* Edge not existing. */
- PRINT(" poly %u needs missing edge (%u, %u)\n", sp->index, v1, v2);
+ PRINT("\tPoly %u needs missing edge (%u, %u)\n", sp->index, v1, v2);
if (do_fixes)
do_edge_recalc = TRUE;
else
@@ -506,11 +508,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
if (do_fixes) {
int prev_e = ml->e;
ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2));
- PRINT(" loop %u has invalid edge reference (%u), fixed using edge %u\n",
+ PRINT("\tLoop %u has invalid edge reference (%u), fixed using edge %u\n",
sp->loopstart + j, prev_e, ml->e);
}
else {
- PRINT(" loop %u has invalid edge reference (%u)\n", sp->loopstart + j, ml->e);
+ PRINT("\tLoop %u has invalid edge reference (%u)\n", sp->loopstart + j, ml->e);
sp->invalid = TRUE;
}
}
@@ -522,11 +524,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
if (do_fixes) {
int prev_e = ml->e;
ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2));
- PRINT(" poly %u has invalid edge reference (%u), fixed using edge %u\n",
+ PRINT("\tPoly %u has invalid edge reference (%u), fixed using edge %u\n",
sp->index, prev_e, ml->e);
}
else {
- PRINT(" poly %u has invalid edge reference (%u)\n", sp->index, ml->e);
+ PRINT("\tPoly %u has invalid edge reference (%u)\n", sp->index, ml->e);
sp->invalid = TRUE;
}
}
@@ -544,7 +546,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
if (*v != *prev_v) {
int dlt = v - prev_v;
if (dlt > 1) {
- PRINT(" poly %u is invalid, it multi-uses vertex %u (%u times)\n",
+ PRINT("\tPoly %u is invalid, it multi-uses vertex %u (%u times)\n",
sp->index, *prev_v, dlt);
sp->invalid = TRUE;
}
@@ -552,7 +554,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
}
}
if (v - prev_v > 1) { /* Don't forget final verts! */
- PRINT(" poly %u is invalid, it multi-uses vertex %u (%u times)\n",
+ PRINT("\tPoly %u is invalid, it multi-uses vertex %u (%u times)\n",
sp->index, *prev_v, (int)(v - prev_v));
sp->invalid = TRUE;
}
@@ -610,17 +612,17 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
p2_sub = FALSE;
if (p1_sub && p2_sub) {
- PRINT(" polys %u and %u use same vertices, considering poly %u as invalid.\n",
+ PRINT("\tPolys %u and %u use same vertices, considering poly %u as invalid.\n",
prev_sp->index, sp->index, sp->index);
sp->invalid = TRUE;
}
/* XXX In fact, these might be valid? :/ */
else if (p1_sub) {
- PRINT(" %u is a sub-poly of %u, considering it as invalid.\n", sp->index, prev_sp->index);
+ PRINT("\t%u is a sub-poly of %u, considering it as invalid.\n", sp->index, prev_sp->index);
sp->invalid = TRUE;
}
else if (p2_sub) {
- PRINT(" %u is a sub-poly of %u, considering it as invalid.\n", prev_sp->index, sp->index);
+ PRINT("\t%u is a sub-poly of %u, considering it as invalid.\n", prev_sp->index, sp->index);
prev_sp->invalid = TRUE;
prev_sp = sp; /* sp is new reference poly. */
}
@@ -631,7 +633,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
}
if ((p1_nv == p2_nv) && (memcmp(p1_v, p2_v, p1_nv * sizeof(*p1_v)) == 0)) {
if (do_verbose) {
- PRINT(" polys %u and %u use same vertices (%u",
+ PRINT("\tPolys %u and %u use same vertices (%u",
prev_sp->index, sp->index, *p1_v);
for (j = 1; j < p1_nv; j++)
PRINT(", %u", p1_v[j]);
@@ -671,7 +673,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
/* Unused loops. */
if (prev_end < sp->loopstart) {
for (j = prev_end, ml = &mloops[prev_end]; j < sp->loopstart; j++, ml++) {
- PRINT(" loop %u is unused.\n", j);
+ PRINT("\tLoop %u is unused.\n", j);
if (do_fixes)
REMOVE_LOOP_TAG(ml);
}
@@ -680,7 +682,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
}
/* Multi-used loops. */
else if (prev_end > sp->loopstart) {
- PRINT(" polys %u and %u share loops from %u to %u, considering poly %u as invalid.\n",
+ PRINT("\tPolys %u and %u share loops from %u to %u, considering poly %u as invalid.\n",
prev_sp->index, sp->index, sp->loopstart, prev_end, sp->index);
if (do_fixes) {
REMOVE_POLY_TAG((&mpolys[sp->index]));
@@ -699,7 +701,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
/* We may have some remaining unused loops to get rid of! */
if (prev_end < totloop) {
for (j = prev_end, ml = &mloops[prev_end]; j < totloop; j++, ml++) {
- PRINT(" loop %u is unused.\n", j);
+ PRINT("\tLoop %u is unused.\n", j);
if (do_fixes)
REMOVE_LOOP_TAG(ml);
}
@@ -720,14 +722,14 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
for (j = 0, dw = dv->dw; j < dv->totweight; j++, dw++) {
/* note, greater then max defgroups is accounted for in our code, but not < 0 */
if (!finite(dw->weight)) {
- PRINT(" vertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
+ PRINT("\tVertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
if (do_fixes) {
dw->weight = 0.0f;
vert_weights_fixed = TRUE;
}
}
else if (dw->weight < 0.0f || dw->weight > 1.0f) {
- PRINT(" vertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
+ PRINT("\tVertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
if (do_fixes) {
CLAMP(dw->weight, 0.0f, 1.0f);
vert_weights_fixed = TRUE;
@@ -735,7 +737,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
}
if (dw->def_nr < 0) {
- PRINT(" vertex deform %u, has invalid group %d\n", i, dw->def_nr);
+ PRINT("\tVertex deform %u, has invalid group %d\n", i, dw->def_nr);
if (do_fixes) {
defvert_remove_group(dv, dw);
if (dv->dw) {
@@ -783,10 +785,10 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
int free_msel = FALSE;
for (i = 0, msel = mesh->mselect; i < mesh->totselect; i++, msel++) {
- int tot_elem;
+ int tot_elem = 0;
if (msel->index < 0) {
- PRINT("Mesh select element %d type %d index is negative, "
+ PRINT("\tMesh select element %d type %d index is negative, "
"resetting selection stack.\n", i, msel->type);
free_msel = TRUE;
break;
@@ -805,7 +807,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
}
if (msel->index > tot_elem) {
- PRINT("Mesh select element %d type %d index %d is larger than data array size %d, "
+ PRINT("\tMesh select element %d type %d index %d is larger than data array size %d, "
"resetting selection stack.\n", i, msel->type, msel->index, tot_elem);
free_msel = TRUE;
@@ -820,7 +822,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
}
}
- PRINT("BKE_mesh_validate: finished\n\n");
+ PRINT("%s: finished\n\n", __func__);
return (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc || msel_fixed);
}
@@ -829,13 +831,15 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh
{
int i = 0, has_fixes = 0;
+ PRINT("%s: Checking %d CD layers...\n", __func__, data->totlayer);
+
while (i < data->totlayer) {
CustomDataLayer *layer = &data->layers[i];
CustomDataMask mask = CD_TYPE_AS_MASK(layer->type);
int ok = 1;
if ((mask & CD_MASK_MESH) == 0) {
- PRINT("CustomDataLayer type %d which isn't in CD_MASK_MESH is stored in Mehs structure\n", layer->type);
+ PRINT("\tCustomDataLayer type %d which isn't in CD_MASK_MESH is stored in Mesh structure\n", layer->type);
if (do_fixes) {
CustomData_free_layer(data, layer->type, 0, i);
@@ -848,6 +852,8 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh
i++;
}
+ PRINT("%s: Finished\n\n", __func__);
+
return has_fixes;
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index b4c30203000..65538e5bea2 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -331,6 +331,13 @@ int modifiers_isClothEnabled(Object *ob)
return (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render));
}
+int modifiers_isModifierEnabled(Object *ob, int modifierType)
+{
+ ModifierData *md = modifiers_findByType(ob, modifierType);
+
+ return (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render));
+}
+
int modifiers_isParticleEnabled(Object *ob)
{
ModifierData *md = modifiers_findByType(ob, eModifierType_ParticleSystem);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 2b4fe72e8bb..fb15aa82fa2 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1391,7 +1391,7 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls)
/* set overlaps for this strip
* - don't use the values obtained though if the end in question
- * is directly followed/preceeded by another strip, forming an
+ * is directly followed/preceded by another strip, forming an
* 'island' of continuous strips
*/
if ((ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start) == 0)) {
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index a5e081d122d..33df8e4b503 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -633,8 +633,12 @@ bNodeTree *ntreeAddTree(const char *name, int type, int nodetype)
* - this gets called when executing compositing updates (for threaded previews)
* - when the nodetree datablock needs to be copied (i.e. when users get copied)
* - for scene duplication use ntreeSwapID() after so we don't have stale pointers.
+ *
+ * do_make_extern: keep enabled for general use, only reason _not_ to enable is when
+ * copying for internal use (threads for eg), where you wont want it to modify the
+ * scene data.
*/
-bNodeTree *ntreeCopyTree(bNodeTree *ntree)
+static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_make_extern)
{
bNodeTree *newtree;
bNode *node /*, *nnode */ /* UNUSED */, *last;
@@ -664,6 +668,11 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
last = ntree->nodes.last;
for (node= ntree->nodes.first; node; node= node->next) {
+
+ if (do_make_extern) {
+ id_lib_extern(node->id);
+ }
+
node->new_node= NULL;
/* nnode= */ nodeCopyNode(newtree, node); /* sets node->new */
@@ -709,6 +718,11 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
return newtree;
}
+bNodeTree *ntreeCopyTree(bNodeTree *ntree)
+{
+ return ntreeCopyTree_internal(ntree, TRUE);
+}
+
/* use when duplicating scenes */
void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to)
{
@@ -1131,7 +1145,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
}
/* node copy func */
- ltree= ntreeCopyTree(ntree);
+ ltree = ntreeCopyTree_internal(ntree, FALSE);
if (adt) {
AnimData *ladt= BKE_animdata_from_id(&ltree->id);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 877563ddd53..cd53bf01a67 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -853,7 +853,7 @@ Object *BKE_object_add_only_object(int type, const char *name)
ob->pc_ids.first = ob->pc_ids.last = NULL;
- /* Animation Visualisation defaults */
+ /* Animation Visualization defaults */
animviz_settings_init(&ob->avs);
return ob;
@@ -1470,7 +1470,7 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[][3])
axis_angle_to_mat3(dmat, ob->drotAxis, ob->drotAngle);
}
else {
- /* quats are normalised before use to eliminate scaling issues */
+ /* quats are normalized before use to eliminate scaling issues */
float tquat[4];
normalize_qt_qt(tquat, ob->quat);
@@ -2548,7 +2548,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
printf("recalcdata %s\n", ob->id.name + 2);
if (adt) {
- /* evaluate drivers */
+ /* evaluate drivers - datalevel */
// XXX: for mesh types, should we push this to derivedmesh instead?
BKE_animsys_evaluate_animdata(scene, data_id, adt, ctime, ADT_RECALC_DRIVERS);
}
@@ -2605,8 +2605,26 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
BKE_lattice_modifiers_calc(scene, ob);
break;
}
-
-
+
+ /* related materials */
+ /* XXX: without depsgraph tagging, this will always need to be run, which will be slow!
+ * However, not doing anything (or trying to hack around this lack) is not an option
+ * anymore, especially due to Cycles [#31834]
+ */
+ if (ob->totcol) {
+ int a;
+
+ for (a = 1; a <= ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a);
+
+ if (ma) {
+ /* recursively update drivers for this material */
+ material_drivers_update(scene, ma, ctime);
+ }
+ }
+ }
+
+ /* particles */
if (ob->particlesystem.first) {
ParticleSystem *tpsys, *psys;
DerivedMesh *dm;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 569e69f2d51..65f22ebc88f 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3320,7 +3320,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
}
}
- /* stickness was possibly added before, so cancel that before calculating new normal velocity */
+ /* stickiness was possibly added before, so cancel that before calculating new normal velocity */
/* otherwise particles go flying out of the surface because of high reversed sticky velocity */
if (v0_dot < 0.0f) {
v0_dot += pd->pdef_stickness;
@@ -3379,7 +3379,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
madd_v3_v3fl(pa->state.vel, nor, -dot);
}
- /* add stickness to surface */
+ /* add stickiness to surface */
madd_v3_v3fl(pa->state.vel, pce->nor, -pd->pdef_stickness);
/* set coordinates for next iteration */
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 32def1be647..ddcba509301 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -141,7 +141,7 @@ struct SmokeModifierData;
/* forward declerations */
static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len);
-static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct);
+static void get_cell(const float p0[3], const int res[3], float dx, const float pos[3], int cell[3], int correct);
static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs);
#else /* WITH_SMOKE */
@@ -1977,7 +1977,7 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
cb(result, input, res, pixel, tRay, correct);
}
-static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct)
+static void get_cell(const float p0[3], const int res[3], float dx, const float pos[3], int cell[3], int correct)
{
float tmp[3];
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 63f0a29821f..1d6895a8c71 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -1718,15 +1718,15 @@ static int choose_winner(float*w, float* pos, float*a, float*b, float*c, float*c
{
float mindist, cp;
int winner =1;
- mindist = ABS(dot_v3v3(pos, a));
+ mindist = fabsf(dot_v3v3(pos, a));
- cp = ABS(dot_v3v3(pos, b));
+ cp = fabsf(dot_v3v3(pos, b));
if ( mindist < cp ) {
mindist = cp;
winner =2;
}
- cp = ABS(dot_v3v3(pos, c));
+ cp = fabsf(dot_v3v3(pos, c));
if (mindist < cp ) {
mindist = cp;
winner =3;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 3dea8a85915..4342eb20d55 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -2315,10 +2315,10 @@ static int tracking_check_marker_margin(MovieTrackingTrack *track, MovieTracking
/* margin from frame boundaries */
BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max);
sub_v2_v2v2(dim, pat_max, pat_min);
- margin[0] = margin[1] = MAX2(dim[0], dim[1]) / 2.0f;
+ margin[0] = margin[1] = maxf(dim[0], dim[1]) / 2.0f;
- margin[0] = MAX2(margin[0], (float)track->margin / frame_width);
- margin[1] = MAX2(margin[1], (float)track->margin / frame_height);
+ margin[0] = maxf(margin[0], (float)track->margin / frame_width);
+ margin[1] = maxf(margin[1], (float)track->margin / frame_height);
/* do not track markers which are too close to boundary */
if (marker->pos[0] < margin[0] || marker->pos[0] > 1.0f - margin[0] ||
@@ -3028,9 +3028,9 @@ static unsigned char *detect_get_frame_ucharbuf(ImBuf *ibuf)
if (ibuf->rect_float) {
const float *rrgbf = ibuf->rect_float + pixel * 4;
- const float grey_f = 0.2126f * rrgbf[0] + 0.7152f * rrgbf[1] + 0.0722f * rrgbf[2];
+ const float gray_f = 0.2126f * rrgbf[0] + 0.7152f * rrgbf[1] + 0.0722f * rrgbf[2];
- *cp = FTOCHAR(grey_f);
+ *cp = FTOCHAR(gray_f);
}
else {
const unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4;
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 1180d2c72d5..df4d2d8cc38 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -108,107 +108,107 @@ static struct bUnitCollection buDummyCollecton = {buDummyDef, 0, 0, sizeof(buDum
/* Lengths */
static struct bUnitDef buMetricLenDef[] = {
- {"kilometer", "kilometers", "km", NULL, "Kilometers", UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
- {"hectometer", "hectometers", "hm", NULL, "100 Meters", UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS},
- {"dekameter", "dekameters", "dam",NULL, "10 Meters", UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
- {"meter", "meters", "m", NULL, "Meters", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"decimetre", "decimetres", "dm", NULL, "10 Centimeters", UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
- {"centimeter", "centimeters", "cm", NULL, "Centimeters", UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
- {"millimeter", "millimeters", "mm", NULL, "Millimeters", UN_SC_MM, 0.0, B_UNIT_DEF_NONE},
- {"micrometer", "micrometers", "µm", "um", "Micrometers", UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, // micron too?
+ {"kilometer", "kilometers", "km", NULL, "Kilometers", UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
+ {"hectometer", "hectometers", "hm", NULL, "100 Meters", UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"dekameter", "dekameters", "dam", NULL, "10 Meters", UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"meter", "meters", "m", NULL, "Meters", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"decimeter", "decimeters", "dm", NULL, "10 Centimeters", UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"centimeter", "centimeters", "cm", NULL, "Centimeters", UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
+ {"millimeter", "millimeters", "mm", NULL, "Millimeters", UN_SC_MM, 0.0, B_UNIT_DEF_NONE},
+ {"micrometer", "micrometers", "µm", "um", "Micrometers", UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, // micron too?
/* These get displayed because of float precision problems in the transform header,
* could work around, but for now probably people wont use these */
#if 0
- {"nanometer", "Nanometers", "nm", NULL, 0.000000001, 0.0, B_UNIT_DEF_NONE},
- {"picometer", "Picometers", "pm", NULL, 0.000000000001, 0.0,B_UNIT_DEF_NONE},
+ {"nanometer", "Nanometers", "nm", NULL, 0.000000001, 0.0, B_UNIT_DEF_NONE},
+ {"picometer", "Picometers", "pm", NULL, 0.000000000001, 0.0, B_UNIT_DEF_NONE},
#endif
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buMetricLenCollecton = {buMetricLenDef, 3, 0, sizeof(buMetricLenDef) / sizeof(bUnitDef)};
static struct bUnitDef buImperialLenDef[] = {
- {"mile", "miles", "mi", "m", "Miles", UN_SC_MI, 0.0, B_UNIT_DEF_NONE},
- {"furlong", "furlongs", "fur", NULL, "Furlongs",UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS},
- {"chain", "chains", "ch", NULL, "Chains", UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS},
- {"yard", "yards", "yd", NULL, "Yards", UN_SC_YD, 0.0, B_UNIT_DEF_SUPPRESS},
- {"foot", "feet", "'", "ft", "Feet", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"inch", "inches", "\"", "in", "Inches", UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
- {"thou", "thou", "thou", "mil", "Thou", UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, /* plural for thou has no 's' */
+ {"mile", "miles", "mi", "m", "Miles", UN_SC_MI, 0.0, B_UNIT_DEF_NONE},
+ {"furlong", "furlongs", "fur", NULL, "Furlongs", UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"chain", "chains", "ch", NULL, "Chains", UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"yard", "yards", "yd", NULL, "Yards", UN_SC_YD, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"foot", "feet", "'", "ft", "Feet", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"inch", "inches", "\"", "in", "Inches", UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
+ {"thou", "thou", "thou", "mil", "Thou", UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, /* plural for thou has no 's' */
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 4, 0, sizeof(buImperialLenDef) / sizeof(bUnitDef)};
/* Areas */
static struct bUnitDef buMetricAreaDef[] = {
- {"square kilometer", "square kilometers", "km²", "km2", "Square Kilometers", UN_SC_KM*UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
- {"square hectometer","square hectometers", "hm²", "hm2", "Square Hectometers", UN_SC_HM*UN_SC_HM, 0.0, B_UNIT_DEF_NONE}, /* hectare */
- {"square dekameter", "square dekameters", "dam²","dam2", "Square Dekameters", UN_SC_DAM*UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, /* are */
- {"square meter", "square meters", "m²", "m2", "Square Meters", UN_SC_M*UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"square decimetre", "square decimetres", "dm²", "dm2", "Square Decimetres", UN_SC_DM*UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
- {"square centimeter", "square centimeters", "cm²", "cm2", "Square Centimeters", UN_SC_CM*UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
- {"square millimeter", "square millimeters", "mm²", "mm2", "Square Millimeters", UN_SC_MM*UN_SC_MM, 0.0, B_UNIT_DEF_NONE},
- {"square micrometer", "square micrometers", "µm²", "um2", "Square Micrometers", UN_SC_UM*UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
- {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
+ {"square kilometer", "square kilometers", "km²", "km2", "Square Kilometers", UN_SC_KM * UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
+ {"square hectometer", "square hectometers", "hm²", "hm2", "Square Hectometers", UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_NONE}, /* hectare */
+ {"square dekameter", "square dekameters", "dam²", "dam2", "Square Dekameters", UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, /* are */
+ {"square meter", "square meters", "m²", "m2", "Square Meters", UN_SC_M * UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"square decimeter", "square decimetees", "dm²", "dm2", "Square Decimeters", UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"square centimeter", "square centimeters", "cm²", "cm2", "Square Centimeters", UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
+ {"square millimeter", "square millimeters", "mm²", "mm2", "Square Millimeters", UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE},
+ {"square micrometer", "square micrometers", "µm²", "um2", "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
+ {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buMetricAreaCollecton = {buMetricAreaDef, 3, 0, sizeof(buMetricAreaDef) / sizeof(bUnitDef)};
static struct bUnitDef buImperialAreaDef[] = {
- {"square mile", "square miles", "sq mi", "sq m","Square Miles", UN_SC_MI*UN_SC_MI, 0.0, B_UNIT_DEF_NONE},
- {"square furlong", "square furlongs", "sq fur",NULL, "Square Furlongs", UN_SC_FUR*UN_SC_FUR, 0.0,B_UNIT_DEF_SUPPRESS},
- {"square chain", "square chains", "sq ch", NULL, "Square Chains", UN_SC_CH*UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS},
- {"square yard", "square yards", "sq yd", NULL, "Square Yards", UN_SC_YD*UN_SC_YD, 0.0, B_UNIT_DEF_NONE},
- {"square foot", "square feet", "sq ft", NULL, "Square Feet", UN_SC_FT*UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"square inch", "square inches", "sq in", NULL, "Square Inches", UN_SC_IN*UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
- {"square thou", "square thous", "sq mil",NULL, "Square Thous", UN_SC_MIL*UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
+ {"square mile", "square miles", "sq mi", "sq m", "Square Miles", UN_SC_MI * UN_SC_MI, 0.0, B_UNIT_DEF_NONE},
+ {"square furlong", "square furlongs", "sq fur", NULL, "Square Furlongs", UN_SC_FUR * UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"square chain", "square chains", "sq ch", NULL, "Square Chains", UN_SC_CH * UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"square yard", "square yards", "sq yd", NULL, "Square Yards", UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE},
+ {"square foot", "square feet", "sq ft", NULL, "Square Feet", UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"square inch", "square inches", "sq in", NULL, "Square Inches", UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
+ {"square thou", "square thous", "sq mil", NULL, "Square Thous", UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buImperialAreaCollecton = {buImperialAreaDef, 4, 0, sizeof(buImperialAreaDef) / sizeof(bUnitDef)};
/* Volumes */
static struct bUnitDef buMetricVolDef[] = {
- {"cubic kilometer", "cubic kilometers", "km³", "km3", "Cubic Kilometers", UN_SC_KM*UN_SC_KM*UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
- {"cubic hectometer","cubic hectometers", "hm³", "hm3", "Cubic Hectometers", UN_SC_HM*UN_SC_HM*UN_SC_HM, 0.0, B_UNIT_DEF_NONE},
- {"cubic dekameter", "cubic dekameters", "dam³","dam3", "Cubic Dekameters", UN_SC_DAM*UN_SC_DAM*UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
- {"cubic meter", "cubic meters", "m³", "m3", "Cubic Meters", UN_SC_M*UN_SC_M*UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"cubic decimetre", "cubic decimetres", "dm³", "dm3", "Cubic Decimetres", UN_SC_DM*UN_SC_DM*UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
- {"cubic centimeter", "cubic centimeters", "cm³", "cm3", "Cubic Centimeters", UN_SC_CM*UN_SC_CM*UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
- {"cubic millimeter", "cubic millimeters", "mm³", "mm3", "Cubic Millimeters", UN_SC_MM*UN_SC_MM*UN_SC_MM, 0.0, B_UNIT_DEF_NONE},
- {"cubic micrometer", "cubic micrometers", "µm³", "um3", "Cubic Micrometers", UN_SC_UM*UN_SC_UM*UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
- {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
+ {"cubic kilometer", "cubic kilometers", "km³", "km3", "Cubic Kilometers", UN_SC_KM * UN_SC_KM * UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
+ {"cubic hectometer", "cubic hectometers", "hm³", "hm3", "Cubic Hectometers", UN_SC_HM * UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_NONE},
+ {"cubic dekameter", "cubic dekameters", "dam³", "dam3", "Cubic Dekameters", UN_SC_DAM * UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"cubic meter", "cubic meters", "m³", "m3", "Cubic Meters", UN_SC_M * UN_SC_M * UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"cubic decimeter", "cubic decimeters", "dm³", "dm3", "Cubic Decimeters", UN_SC_DM * UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"cubic centimeter", "cubic centimeters", "cm³", "cm3", "Cubic Centimeters", UN_SC_CM * UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
+ {"cubic millimeter", "cubic millimeters", "mm³", "mm3", "Cubic Millimeters", UN_SC_MM * UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE},
+ {"cubic micrometer", "cubic micrometers", "µm³", "um3", "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
+ {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buMetricVolCollecton = {buMetricVolDef, 3, 0, sizeof(buMetricVolDef) / sizeof(bUnitDef)};
static struct bUnitDef buImperialVolDef[] = {
- {"cubic mile", "cubic miles", "cu mi", "cu m","Cubic Miles", UN_SC_MI*UN_SC_MI*UN_SC_MI, 0.0, B_UNIT_DEF_NONE},
- {"cubic furlong", "cubic furlongs", "cu fur",NULL, "Cubic Furlongs", UN_SC_FUR*UN_SC_FUR*UN_SC_FUR, 0.0,B_UNIT_DEF_SUPPRESS},
- {"cubic chain", "cubic chains", "cu ch", NULL, "Cubic Chains", UN_SC_CH*UN_SC_CH*UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS},
- {"cubic yard", "cubic yards", "cu yd", NULL, "Cubic Yards", UN_SC_YD*UN_SC_YD*UN_SC_YD, 0.0, B_UNIT_DEF_NONE},
- {"cubic foot", "cubic feet", "cu ft", NULL, "Cubic Feet", UN_SC_FT*UN_SC_FT*UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"cubic inch", "cubic inches", "cu in", NULL, "Cubic Inches", UN_SC_IN*UN_SC_IN*UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
- {"cubic thou", "cubic thous", "cu mil",NULL, "Cubic Thous", UN_SC_MIL*UN_SC_MIL*UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
+ {"cubic mile", "cubic miles", "cu mi", "cu m", "Cubic Miles", UN_SC_MI * UN_SC_MI * UN_SC_MI, 0.0, B_UNIT_DEF_NONE},
+ {"cubic furlong", "cubic furlongs", "cu fur", NULL, "Cubic Furlongs", UN_SC_FUR * UN_SC_FUR * UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"cubic chain", "cubic chains", "cu ch", NULL, "Cubic Chains", UN_SC_CH * UN_SC_CH * UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"cubic yard", "cubic yards", "cu yd", NULL, "Cubic Yards", UN_SC_YD * UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE},
+ {"cubic foot", "cubic feet", "cu ft", NULL, "Cubic Feet", UN_SC_FT * UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"cubic inch", "cubic inches", "cu in", NULL , "Cubic Inches", UN_SC_IN * UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
+ {"cubic thou", "cubic thous", "cu mil", NULL, "Cubic Thous", UN_SC_MIL * UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buImperialVolCollecton = {buImperialVolDef, 4, 0, sizeof(buImperialVolDef) / sizeof(bUnitDef)};
/* Mass */
static struct bUnitDef buMetricMassDef[] = {
- {"ton", "tonnes", "ton", "t", "1000 Kilograms", UN_SC_MTON, 0.0, B_UNIT_DEF_NONE},
- {"quintal", "quintals", "ql", "q", "100 Kilograms", UN_SC_QL, 0.0, B_UNIT_DEF_NONE},
- {"kilogram", "kilograms", "kg", NULL, "Kilograms", UN_SC_KG, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"hectogram", "hectograms", "hg", NULL, "Hectograms", UN_SC_HG, 0.0, B_UNIT_DEF_NONE},
- {"dekagram", "dekagrams", "dag",NULL, "10 Grams", UN_SC_DAG, 0.0, B_UNIT_DEF_SUPPRESS},
- {"gram", "grams", "g", NULL, "Grams", UN_SC_G, 0.0, B_UNIT_DEF_NONE},
- {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
+ {"ton", "tonnes", "ton", "t", "1000 Kilograms", UN_SC_MTON, 0.0, B_UNIT_DEF_NONE},
+ {"quintal", "quintals", "ql", "q", "100 Kilograms", UN_SC_QL, 0.0, B_UNIT_DEF_NONE},
+ {"kilogram", "kilograms", "kg", NULL, "Kilograms", UN_SC_KG, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"hectogram", "hectograms", "hg", NULL, "Hectograms", UN_SC_HG, 0.0, B_UNIT_DEF_NONE},
+ {"dekagram", "dekagrams", "dag", NULL, "10 Grams", UN_SC_DAG, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"gram", "grams", "g", NULL, "Grams", UN_SC_G, 0.0, B_UNIT_DEF_NONE},
+ {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buMetricMassCollecton = {buMetricMassDef, 2, 0, sizeof(buMetricMassDef) / sizeof(bUnitDef)};
static struct bUnitDef buImperialMassDef[] = {
- {"ton", "tonnes", "ton", "t", "Tonnes", UN_SC_ITON, 0.0, B_UNIT_DEF_NONE},
+ {"ton", "tonnes", "ton", "t", "Tonnes", UN_SC_ITON, 0.0, B_UNIT_DEF_NONE},
{"centum weight", "centum weights", "cwt", NULL, "Centum weights", UN_SC_CWT, 0.0, B_UNIT_DEF_NONE},
- {"stone", "stones", "st", NULL, "Stones", UN_SC_ST, 0.0, B_UNIT_DEF_NONE},
- {"pound", "pounds", "lb", NULL, "Pounds", UN_SC_LB, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"ounce", "ounces", "oz", NULL, "Ounces", UN_SC_OZ, 0.0, B_UNIT_DEF_NONE},
+ {"stone", "stones", "st", NULL, "Stones", UN_SC_ST, 0.0, B_UNIT_DEF_NONE},
+ {"pound", "pounds", "lb", NULL, "Pounds", UN_SC_LB, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"ounce", "ounces", "oz", NULL, "Ounces", UN_SC_OZ, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buImperialMassCollecton = {buImperialMassDef, 3, 0, sizeof(buImperialMassDef) / sizeof(bUnitDef)};
@@ -218,15 +218,15 @@ static struct bUnitCollection buImperialMassCollecton = {buImperialMassDef, 3, 0
/* Velocity */
static struct bUnitDef buMetricVelDef[] = {
- {"meter per second", "meters per second", "m/s", NULL, "Meters per second", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"kilometer per hour", "kilometers per hour", "km/h", NULL, "Kilometers per hour", UN_SC_KM/3600.0f, 0.0, B_UNIT_DEF_SUPPRESS},
- {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
+ {"meter per second", "meters per second", "m/s", NULL, "Meters per second", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"kilometer per hour", "kilometers per hour", "km/h", NULL, "Kilometers per hour", UN_SC_KM / 3600.0f, 0.0, B_UNIT_DEF_SUPPRESS},
+ {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buMetricVelCollecton = {buMetricVelDef, 0, 0, sizeof(buMetricVelDef) / sizeof(bUnitDef)};
static struct bUnitDef buImperialVelDef[] = {
- {"foot per second", "feet per second", "ft/s", "fps", "Feet per second", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"mile per hour", "miles per hour", "mph", NULL, "Miles per hour", UN_SC_MI/3600.0f, 0.0,B_UNIT_DEF_SUPPRESS},
+ {"foot per second", "feet per second", "ft/s", "fps", "Feet per second", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"mile per hour", "miles per hour", "mph", NULL, "Miles per hour", UN_SC_MI / 3600.0f, 0.0, B_UNIT_DEF_SUPPRESS},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buImperialVelCollecton = {buImperialVelDef, 0, 0, sizeof(buImperialVelDef) / sizeof(bUnitDef)};
@@ -234,7 +234,7 @@ static struct bUnitCollection buImperialVelCollecton = {buImperialVelDef, 0, 0,
/* Acceleration */
static struct bUnitDef buMetricAclDef[] = {
{"meter per second squared", "meters per second squared", "m/s²", "m/s2", "Meters per second squared", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
+ {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buMetricAclCollecton = {buMetricAclDef, 0, 0, sizeof(buMetricAclDef) / sizeof(bUnitDef)};
@@ -247,12 +247,12 @@ static struct bUnitCollection buImperialAclCollecton = {buImperialAclDef, 0, 0,
/* Time */
static struct bUnitDef buNaturalTimeDef[] = {
/* weeks? - probably not needed for blender */
- {"day", "days", "d", NULL, "Days", 90000.0, 0.0, B_UNIT_DEF_NONE},
- {"hour", "hours", "hr", "h", "Hours", 3600.0, 0.0, B_UNIT_DEF_NONE},
- {"minute", "minutes", "min", "m", "Minutes", 60.0, 0.0, B_UNIT_DEF_NONE},
- {"second", "seconds", "sec", "s", "Seconds", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0, B_UNIT_DEF_NONE},
- {"microsecond", "microseconds", "µs", "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE},
+ {"day", "days", "d", NULL, "Days", 90000.0, 0.0, B_UNIT_DEF_NONE},
+ {"hour", "hours", "hr", "h", "Hours", 3600.0, 0.0, B_UNIT_DEF_NONE},
+ {"minute", "minutes", "min", "m", "Minutes", 60.0, 0.0, B_UNIT_DEF_NONE},
+ {"second", "seconds", "sec", "s", "Seconds", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0, B_UNIT_DEF_NONE},
+ {"microsecond", "microseconds", "µs", "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buNaturalTimeCollecton = {buNaturalTimeDef, 3, 0, sizeof(buNaturalTimeDef) / sizeof(bUnitDef)};