diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2007-04-30 23:20:43 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2007-04-30 23:20:43 +0400 |
commit | c40997656e5808ff20d6befb184fd78fb630170c (patch) | |
tree | 5d3e9db27b462b19cfb1972f26fef1be6133f621 | |
parent | 469208a10121e6e859b6fe7025bafe3d9f892fd7 (diff) |
Really minor updates related to code I wrote for the Cast modifier:
- modifier.c: moved a check out of a loop, removed an unneeded var, made a couple cosmetic changes.
- DNA_modifier_types.h: added parentheses to cast and smooth modifier defines that used bit-shifting (like 1<<1, etc.).
Note: realized they were needed when I tried to use "flag &= ~MOD_CAST_Z" in modifier.c. Since MOD_CAST_Z is #defined as 1<<3, ~MOD_CAST_Z ended up as ~1<<3 while I wanted ~(1<<3). There are other places in that header file and others in Blender where it'd be safer to add the parentheses...
- Updated the epydoc documentation for the features added by Ben Batt to the cast modifier; fixed small typo in API_intro.py.
BTW, thanks Ben Batt (artificer) for checking, improving with a couple features and committing these modifiers :).
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 24 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 16 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/API_intro.py | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Modifier.py | 4 |
4 files changed, 24 insertions, 22 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index b4fd28312b8..707f050d56e 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -3637,9 +3637,11 @@ static void castModifier_sphere_do( facm = 1.0f - fac; flag = cmd->flag; - type = cmd->type; /* projection type: sphere or cylinder */ + if (type == MOD_CAST_TYPE_CYLINDER) + flag &= ~MOD_CAST_Z; + ctrl_ob = cmd->object; /* spherify's center is {0, 0, 0} (the ob's own center in its local @@ -3680,7 +3682,7 @@ static void castModifier_sphere_do( if ((ob->type == OB_MESH) && dm && defgrp_index >= 0) dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); - if(cmd->flag & MOD_CAST_SIZE_FROM_RADIUS) { + if(flag & MOD_CAST_SIZE_FROM_RADIUS) { len = cmd->radius; } else { @@ -3743,7 +3745,7 @@ static void castModifier_sphere_do( tmp_co[0] = fac*vec[0]*len + facm*tmp_co[0]; if (flag & MOD_CAST_Y) tmp_co[1] = fac*vec[1]*len + facm*tmp_co[1]; - if (flag & MOD_CAST_Z && type != MOD_CAST_TYPE_CYLINDER) + if (flag & MOD_CAST_Z) tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2]; if(ctrl_ob) { @@ -3787,7 +3789,7 @@ static void castModifier_sphere_do( tmp_co[0] = fac*vec[0]*len + facm*tmp_co[0]; if (flag & MOD_CAST_Y) tmp_co[1] = fac*vec[1]*len + facm*tmp_co[1]; - if (flag & MOD_CAST_Z && type != MOD_CAST_TYPE_CYLINDER) + if (flag & MOD_CAST_Z) tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2]; if(ctrl_ob) { @@ -3811,7 +3813,7 @@ static void castModifier_cuboid_do( int i, defgrp_index = -1; int has_radius = 0; - short flag, type; + short flag; float fac, facm; float min[3], max[3], bb[8][3]; float center[3] = {0.0f, 0.0f, 0.0f}; @@ -3822,8 +3824,6 @@ static void castModifier_cuboid_do( flag = cmd->flag; - type = cmd->type; /* projection type: sphere or cylinder */ - ctrl_ob = cmd->object; /* now we check which options the user wants */ @@ -3861,12 +3861,12 @@ static void castModifier_cuboid_do( Mat4MulVecfl(ob->imat, center); } - if((cmd->flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) { + if((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) { for(i = 0; i < 3; i++) { min[i] = -cmd->radius; max[i] = cmd->radius; } - } else if(!(cmd->flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) { + } else if(!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) { for(i = 0; i < 3; i++) { min[i] = -cmd->size; max[i] = cmd->size; @@ -3877,9 +3877,9 @@ static void castModifier_cuboid_do( * may have changed the vertex data. */ INIT_MINMAX(min, max); - /* Cast's center is the ob's own center in its local space,by default, - * but if the user defined a control object, we use its location, - * transformed to ob's local space. */ + /* Cast's center is the ob's own center in its local space, + * by default, but if the user defined a control object, we use + * its location, transformed to ob's local space. */ if (ctrl_ob) { float vec[3]; diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 99f3a65bf43..2d296ad10fa 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -236,9 +236,9 @@ typedef struct DecimateModifierData { } DecimateModifierData; /* Smooth modifier flags */ -#define MOD_SMOOTH_X 1<<1 -#define MOD_SMOOTH_Y 1<<2 -#define MOD_SMOOTH_Z 1<<3 +#define MOD_SMOOTH_X (1<<1) +#define MOD_SMOOTH_Y (1<<2) +#define MOD_SMOOTH_Z (1<<3) typedef struct SmoothModifierData { ModifierData modifier; @@ -249,11 +249,11 @@ typedef struct SmoothModifierData { } SmoothModifierData; /* Cast modifier flags */ -#define MOD_CAST_X 1<<1 -#define MOD_CAST_Y 1<<2 -#define MOD_CAST_Z 1<<3 -#define MOD_CAST_USE_OB_TRANSFORM 1<<4 -#define MOD_CAST_SIZE_FROM_RADIUS 1<<5 +#define MOD_CAST_X (1<<1) +#define MOD_CAST_Y (1<<2) +#define MOD_CAST_Z (1<<3) +#define MOD_CAST_USE_OB_TRANSFORM (1<<4) +#define MOD_CAST_SIZE_FROM_RADIUS (1<<5) /* Cast modifier projection types */ #define MOD_CAST_TYPE_SPHERE 0 diff --git a/source/blender/python/api2_2x/doc/API_intro.py b/source/blender/python/api2_2x/doc/API_intro.py index 74022f45d9c..a630c47229e 100644 --- a/source/blender/python/api2_2x/doc/API_intro.py +++ b/source/blender/python/api2_2x/doc/API_intro.py @@ -12,7 +12,7 @@ The Blender Python API Reference ----------- - L{Blender} - - L{bpy<Bpy>} (experemantal) + - L{bpy<Bpy>} (experimental) Submodules: ----------- diff --git a/source/blender/python/api2_2x/doc/Modifier.py b/source/blender/python/api2_2x/doc/Modifier.py index 1b00fce7721..e05f1dfe32d 100644 --- a/source/blender/python/api2_2x/doc/Modifier.py +++ b/source/blender/python/api2_2x/doc/Modifier.py @@ -127,7 +127,9 @@ Example:: - REPEAT - Used for Smooth only (int [0, 30], default: 1) - RADIUS - Used for Cast only (float [0.0, 100.0], default: 0.0) - - USE_OB_SCALE - Used for Cast only (bool, default: False) + - SIZE - Used for Cast only (float [0.0, 100.0], default: 0.0) + - SIZE_FROM_RADIUS - Used for Cast only (bool, default: True) + - USE_OB_TRANSFORM - Used for Cast only (bool, default: False) """ class ModSeq: |