diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-06-04 01:11:10 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-06-04 01:11:10 +0400 |
commit | 329b05dcd789bd8421661898697ed060c83b3286 (patch) | |
tree | 3d664826fefbe62078c878baab174e066eb48afa /source/blender/blenkernel | |
parent | eabf741a8d76aa9400a071c37227504378fc6315 (diff) | |
parent | f9856c1c2da8139651eb59ff3bf174065d0f628c (diff) |
Merged changes in the trunk up to revision 47381.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
Diffstat (limited to 'source/blender/blenkernel')
48 files changed, 269 insertions, 788 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index c1361788379..527d85c7cf3 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -112,6 +112,9 @@ struct bActionGroup *get_active_actiongroup(struct bAction *act); /* Make the given Action Group the active one */ void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select); +/* Sync colors used for action/bone group with theme settings */ +void action_group_colors_sync(struct bActionGroup *grp); + /* Add a new action group with the given name to the action */ struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]); diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index e2bca1bb93e..24386730ddb 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 263 -#define BLENDER_SUBVERSION 7 +#define BLENDER_SUBVERSION 8 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 2632a982a01..d093c9108b6 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -156,6 +156,10 @@ typedef struct bNodeType { const char *(*labelfunc)(struct bNode *); /// Optional custom resize handle polling. int (*resize_area_func)(struct bNode *node, int x, int y); + /// Optional selection area polling. + int (*select_area_func)(struct bNode *node, int x, int y); + /// Optional tweak area polling (for grabbing). + int (*tweak_area_func)(struct bNode *node, int x, int y); /// Called when the node is updated in the editor. void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node); @@ -229,7 +233,7 @@ typedef struct bNodeType { #define NODE_CLASS_CONVERTOR 8 #define NODE_CLASS_MATTE 9 #define NODE_CLASS_DISTORT 10 -#define NODE_CLASS_OP_DYNAMIC 11 +#define NODE_CLASS_OP_DYNAMIC 11 /* deprecated */ #define NODE_CLASS_PATTERN 12 #define NODE_CLASS_TEXTURE 13 #define NODE_CLASS_EXECUTION 14 @@ -434,8 +438,7 @@ void node_type_compatibility(struct bNodeType *ntype, short compatibility); #define NODE_FORLOOP 3 #define NODE_WHILELOOP 4 #define NODE_FRAME 5 -#define NODE_GROUP_MENU 10000 -#define NODE_DYNAMIC_MENU 20000 +#define NODE_REROUTE 6 /* look up a socket on a group node by the internal group socket */ struct bNodeSocket *node_group_find_input(struct bNode *gnode, struct bNodeSocket *gsock); @@ -451,6 +454,7 @@ int node_group_ungroup(struct bNodeTree *ntree, struct bNode *gnode); /* in node_common.c */ void register_node_type_frame(struct bNodeTreeType *ttype); +void register_node_type_reroute(struct bNodeTreeType *ttype); /* ************** SHADER NODES *************** */ diff --git a/source/blender/blenkernel/BKE_plugin_types.h b/source/blender/blenkernel/BKE_plugin_types.h deleted file mode 100644 index f3c5db02427..00000000000 --- a/source/blender/blenkernel/BKE_plugin_types.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BKE_PLUGIN_TYPES_H__ -#define __BKE_PLUGIN_TYPES_H__ - -/** \file BKE_plugin_types.h - * \ingroup bke - * \author nzc - */ - -struct ImBuf; - -typedef int (*TexDoitold)(int stype, void *cast, float *texvec, float *dxt, float *dyt); -typedef int (*TexDoit)(int stype, void *cast, float *texvec, float *dxt, float *dyt, float *result); -typedef void (*SeqDoit)(void *, float, float, int, int, - struct ImBuf *, struct ImBuf *, - struct ImBuf *, struct ImBuf *); - -typedef struct VarStruct { - int type; - char name[16]; - float def, min, max; - char tip[80]; -} VarStruct; - -typedef struct _PluginInfo { - char *name; - char *snames; - - int stypes; - int nvars; - VarStruct *varstr; - float *result; - float *cfra; - - void (*init)(void); - void (*callback)(int); - void (*tex_doit)(void *); - SeqDoit seq_doit; - void (*instance_init)(void *); -} PluginInfo; - -#endif - diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index f06e0e2f71a..d6c1a26fdba 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -113,9 +113,8 @@ enum { struct SeqEffectHandle { /* constructors & destructor */ - /* init & init_plugin are _only_ called on first creation */ + /* init is _only_ called on first creation */ void (*init)(struct Sequence *seq); - void (*init_plugin)(struct Sequence *seq, const char *fname); /* number of input strips needed * (called directly after construction) */ diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 339b78ae2d1..78fdd26c9e0 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -48,7 +48,6 @@ struct Material; struct MTex; struct OceanTex; struct ParticleSettings; -struct PluginTex; struct PointDensity; struct Tex; struct TexMapping; @@ -60,10 +59,6 @@ struct World; void BKE_texture_free(struct Tex *t); -int test_dlerr(const char *name, const char *symbol); -void open_plugin_tex(struct PluginTex *pit); -struct PluginTex *add_plugin_tex(char *str); -void free_plugin_tex(struct PluginTex *pit); void init_colorband(struct ColorBand *coba, int rangetype); struct ColorBand *add_colorband(int rangetype); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index a374a9091fd..baa714c9de4 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -204,7 +204,6 @@ set(SRC BKE_packedFile.h BKE_paint.h BKE_particle.h - BKE_plugin_types.h BKE_pointcache.h BKE_property.h BKE_report.h diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index e4309a64e56..d26a722b628 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -275,9 +275,9 @@ static int ccg_edgebase(int level) /***/ -#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } -#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } -#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } +#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } (void)0 +#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } (void)0 +#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } (void)0 /***/ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 7e2d881689c..3f28a4afe8d 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -426,7 +426,7 @@ void DM_update_tessface_data(DerivedMesh *dm) /* Find out loop indices. */ /* XXX Is there a better way to do this? */ - /* NOTE: This assumes tessface are valid and in sync with loop/poly… Else, most likely, segfault! */ + /* NOTE: This assumes tessface are valid and in sync with loop/poly... Else, most likely, segfault! */ for (i = mp[polyindex[mf_idx]].loopstart, not_done = mf_len; not_done; i++) { MLoop *tml = &ml[i]; if (tml->v == mf->v1) { @@ -1054,10 +1054,10 @@ static void calc_weightpaint_vert_color( } if (make_black) { /* TODO, theme color */ - r_col[3] = 0; + r_col[3] = 255; r_col[2] = 0; r_col[1] = 0; - r_col[0] = 255; + r_col[0] = 0; } else { CLAMP(input, 0.0f, 1.0f); @@ -1651,7 +1651,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos orcodm = create_orco_dm(ob, me, NULL, CD_ORCO); nextmask &= ~CD_MASK_ORCO; - DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX); + DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX | + (mti->requiredDataMask ? + mti->requiredDataMask(ob, md) : 0)); ndm = mti->applyModifier(md, ob, orcodm, app_flags & ~MOD_APPLY_USECACHE); if (ndm) { diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 233647c9ec6..b3d2e3371f4 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -252,6 +252,31 @@ 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) +{ + /* only do color copying if using a custom color (i.e. not default color) */ + if (grp->customCol) { + if (grp->customCol > 0) { + /* copy theme colors on-to group's custom color in case user tries to edit color */ + bTheme *btheme = U.themes.first; + ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)]; + + 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) { + /* 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); + rgba_char_args_set(grp->cs.active, 0x18, 0xb6, 0xe0, 255); + } + } + } +} + /* Add a new action group with the given name to the action */ bActionGroup *action_groups_add_new(bAction *act, const char name[]) { @@ -409,10 +434,9 @@ void action_groups_clear_tempflags(bAction *act) /* *************** Pose channels *************** */ -/* usually used within a loop, so we got a N^2 slowdown */ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name) { - if (ELEM(NULL, pose, name) || (name[0] == 0)) + if (ELEM(NULL, pose, name) || (name[0] == '\0')) return NULL; if (pose->chanhash) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index e8e8a100f34..b042c0091d7 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -745,7 +745,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u for (id = first; id; id = id->next) { \ AnimData *adt = BKE_animdata_from_id(id); \ if (adt) func(id, adt, user_data); \ - } + } (void)0 /* "embedded" nodetree cases (i.e. scene/material/texture->nodetree) */ #define ANIMDATA_NODETREE_IDS_CB(first, NtId_Type) \ @@ -757,7 +757,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u if (adt2) func(id, adt2, user_data); \ } \ if (adt) func(id, adt, user_data); \ - } + } (void)0 /* nodes */ ANIMDATA_IDS_CB(mainptr->nodetree.first); @@ -832,7 +832,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha for (id = first; id; id = id->next) { \ AnimData *adt = BKE_animdata_from_id(id); \ BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \ - } + } (void)0 /* another version of this macro for nodetrees */ #define RENAMEFIX_ANIM_NODETREE_IDS(first, NtId_Type) \ @@ -844,7 +844,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha BKE_animdata_fix_paths_rename((ID *)ntp, adt2, ref_id, prefix, oldName, newName, 0, 0, 1); \ } \ BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \ - } + } (void)0 /* nodes */ RENAMEFIX_ANIM_IDS(mainptr->nodetree.first); @@ -1584,7 +1584,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N PropertyRNA *prop; PointerRNA new_ptr; char *path = NULL; - /* short free_path=0; */ + /* short free_path = 0; */ /* sanity checks */ if (channels == NULL) @@ -1592,7 +1592,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N /* get RNA pointer+property info from F-Curve for more convenient handling */ /* get path, remapped as appropriate to work in its new environment */ - /* free_path= */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path); + /* free_path = */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path); /* a valid property must be available, and it must be animatable */ if (RNA_path_resolve(ptr, path, &new_ptr, &prop) == 0) { @@ -2273,7 +2273,8 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime) AnimData *adt = BKE_animdata_from_id(id); \ BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag); \ } \ - } + } (void)0 + /* another macro for the "embedded" nodetree cases * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees" * (i.e. scene/material/texture->nodetree) which we need a special exception @@ -2291,7 +2292,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime) } \ BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag); \ } \ - } + } (void)0 /* optimization: * when there are no actions, don't go over database and loop over heaps of datablocks, diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 752036c6b9f..5ad81db1979 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -734,7 +734,7 @@ static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonem } static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float vec[3], DualQuat *dq, - float mat[][3], float *co) + float mat[][3], const float co[3]) { Bone *bone = pchan->bone; float fac, contrib = 0.0; @@ -781,7 +781,7 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f } static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float weight, float vec[3], DualQuat *dq, - float mat[][3], float *co, float *contrib) + float mat[][3], const float co[3], float *contrib) { float cop[3], bbonemat[3][3]; DualQuat bbonedq; diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index e6333ed74aa..0def299c24a 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -518,7 +518,7 @@ void BKE_write_undo(bContext *C, const char *name) if ( (U.uiflag & USER_GLOBALUNDO) == 0) return; if (U.undosteps == 0) return; - /* remove all undos after (also when curundo==NULL) */ + /* remove all undos after (also when curundo == NULL) */ while (undobase.last != curundo) { uel = undobase.last; BLI_remlink(&undobase, uel); @@ -564,7 +564,7 @@ void BKE_write_undo(bContext *C, const char *name) BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); BLI_make_file_string("/", filepath, BLI_temporary_dir(), numstr); - /* success= */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); + /* success = */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); BLI_strncpy(curundo->str, filepath, sizeof(curundo->str)); } @@ -574,7 +574,7 @@ void BKE_write_undo(bContext *C, const char *name) if (curundo->prev) prevfile = &(curundo->prev->memfile); memused = MEM_get_memory_in_use(); - /* success= */ /* UNUSED */ BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags); + /* success = */ /* UNUSED */ BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags); curundo->undosize = MEM_get_memory_in_use() - memused; } diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c index 9fcb4389c62..7defa7e1be3 100644 --- a/source/blender/blenkernel/intern/bullet.c +++ b/source/blender/blenkernel/intern/bullet.c @@ -45,7 +45,7 @@ BulletSoftBody *bsbNew(void) { BulletSoftBody *bsb; - bsb= MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody"); + bsb = MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody"); bsb->flag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT; bsb->linStiff = 0.5f; diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 24583c124e6..752bdab2c00 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -383,6 +383,9 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3 nearest->dist = dist; copy_v3_v3(nearest->co, nearest_tmp); normal_tri_v3(nearest->no, t0, t1, t2); + + if (t1 == vert[face->v3].co) + nearest->flags |= BVH_ONQUAD; } t1 = t2; @@ -420,6 +423,9 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist); normal_tri_v3(hit->no, t0, t1, t2); + + if (t1 == vert[face->v3].co) + hit->flags |= BVH_ONQUAD; } t1 = t2; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index f6eee44b92c..4e6a4b4a43c 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -927,7 +927,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, //int actualFace = dm->drawObject->triangle_to_mface[i]; int actualFace = next_actualFace; MFace *mface = mf + actualFace; - /*int drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mface->flag & ME_SMOOTH);*/ /* UNUSED */ + /*int drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mface->flag & ME_SMOOTH);*/ /* UNUSED */ DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL; int flush = 0; @@ -1208,7 +1208,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, else { /* if the buffer was set, don't use it again. * prevdraw was assumed true but didnt run so set to false - [#21036] */ - /* prevdraw= 0; */ /* UNUSED */ + /* prevdraw = 0; */ /* UNUSED */ buffer = NULL; } } diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 7c5cf68affa..32e9dd7508b 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -302,6 +302,10 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // Apply repulse impulse if distance too short // I_r = -min(dt*kd, m(0, 1d/dt - v_n)) + // DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this: + // v += impulse; x_new = x + v; + // We don't use dt!! + // DG TODO: Fix usage of dt here! spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; @@ -324,7 +328,10 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM else { // Apply repulse impulse if distance too short - // I_r = -min(dt*kd, m(0, 1d/dt - v_n)) + // I_r = -min(dt*kd, max(0, 1d/dt - v_n)) + // DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this: + // v += impulse; x_new = x + v; + // We don't use dt!! float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; @@ -332,7 +339,8 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // stay on the safe side and clamp repulse float repulse = d*1.0f/spf; - float impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25 + float impulse = repulse / ( 3.0 * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25 + VECADDMUL ( i1, collpair->normal, impulse ); VECADDMUL ( i2, collpair->normal, impulse ); VECADDMUL ( i3, collpair->normal, impulse ); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index da9350cc7b9..c6a0ecc057a 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -701,7 +701,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo } \ \ BLI_addtail(list, ct); \ - } + } (void)0 /* This following macro should be used for all standard single-target *_get_tars functions * to save typing and reduce maintenance woes. It does not do the subtarget related operations @@ -720,7 +720,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo if (ct->tar) ct->type = CONSTRAINT_OBTYPE_OBJECT; \ \ BLI_addtail(list, ct); \ - } + } (void)0 /* This following macro should be used for all standard single-target *_flush_tars functions * to save typing and reduce maintenance woes. @@ -741,7 +741,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo BLI_freelinkN(list, ct); \ ct = ctn; \ } \ - } + } (void)0 /* This following macro should be used for all standard single-target *_flush_tars functions * to save typing and reduce maintenance woes. It does not do the subtarget related operations. @@ -761,7 +761,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo BLI_freelinkN(list, ct); \ ct = ctn; \ } \ - } + } (void)0 /* --------- ChildOf Constraint ------------ */ @@ -790,7 +790,7 @@ static int childof_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -805,7 +805,7 @@ static void childof_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -925,7 +925,7 @@ static int trackto_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -940,7 +940,7 @@ static void trackto_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -1108,8 +1108,8 @@ static int kinematic_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints is used twice here */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) - SINGLETARGET_GET_TARS(con, data->poletar, data->polesubtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); + SINGLETARGET_GET_TARS(con, data->poletar, data->polesubtarget, ct, list); return 2; } @@ -1124,8 +1124,8 @@ static void kinematic_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) - SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, nocopy); } } @@ -1197,7 +1197,7 @@ static int followpath_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list) + SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); return 1; } @@ -1212,7 +1212,7 @@ static void followpath_flush_tars(bConstraint *con, ListBase *list, short nocopy bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); } } @@ -1543,7 +1543,7 @@ static int loclike_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -1558,7 +1558,7 @@ static void loclike_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -1633,7 +1633,7 @@ static int rotlike_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -1648,7 +1648,7 @@ static void rotlike_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -1745,7 +1745,7 @@ static int sizelike_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -1760,7 +1760,7 @@ static void sizelike_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -1834,7 +1834,7 @@ static int translike_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -1849,7 +1849,7 @@ static void translike_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2093,7 +2093,7 @@ static int actcon_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2108,7 +2108,7 @@ static void actcon_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2255,7 +2255,7 @@ static int locktrack_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2270,7 +2270,7 @@ static void locktrack_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2565,7 +2565,7 @@ static int distlimit_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2580,7 +2580,7 @@ static void distlimit_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2692,7 +2692,7 @@ static int stretchto_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2707,7 +2707,7 @@ static void stretchto_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2866,7 +2866,7 @@ static int minmax_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2881,7 +2881,7 @@ static void minmax_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -3009,7 +3009,7 @@ static int rbj_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list) + SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); return 1; } @@ -3024,7 +3024,7 @@ static void rbj_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); } } @@ -3060,7 +3060,7 @@ static int clampto_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list) + SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); return 1; } @@ -3075,7 +3075,7 @@ static void clampto_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); } } @@ -3244,7 +3244,7 @@ static int transform_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -3259,7 +3259,7 @@ static void transform_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -3380,7 +3380,7 @@ static int shrinkwrap_get_tars(bConstraint *con, ListBase *list) bShrinkwrapConstraint *data = con->data; bConstraintTarget *ct; - SINGLETARGETNS_GET_TARS(con, data->target, ct, list) + SINGLETARGETNS_GET_TARS(con, data->target, ct, list); return 1; } @@ -3395,7 +3395,7 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, short nocopy bShrinkwrapConstraint *data = con->data; bConstraintTarget *ct = list->first; - SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, nocopy); } } @@ -3545,7 +3545,7 @@ static int damptrack_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -3560,7 +3560,7 @@ static void damptrack_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -3690,7 +3690,7 @@ static int splineik_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list) + SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); return 1; } @@ -3705,7 +3705,7 @@ static void splineik_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); } } @@ -3762,7 +3762,7 @@ static int pivotcon_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -3777,7 +3777,7 @@ static void pivotcon_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 4cdb4e1b66e..3c8f29d8440 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -267,7 +267,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res * loops requesting data from ourselfs in a context callback */ /* Ok, this looks evil... - * if (ret) done= -(-ret | -done); + * if (ret) done = -(-ret | -done); * * Values in order of importance * (0, -1, 1) - Where 1 is highest priority diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 4e7653e2473..5dc50dca45a 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1193,6 +1193,18 @@ static const char *layerType_getName(int type) return LAYERTYPENAMES[type]; } +void customData_mask_layers__print(CustomDataMask mask) +{ + int i; + + printf("mask=0x%lx:\n", (long unsigned int)mask); + for (i = 0; i < CD_NUMTYPES; i++) { + if (mask & CD_TYPE_AS_MASK(i)) { + printf(" %s\n", layerType_getName(i)); + } + } +} + /********************* CustomData functions *********************/ static void customData_update_offsets(CustomData *data); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 2b08c085417..a6ce5daf247 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2938,7 +2938,7 @@ void DAG_pose_sort(Object *ob) queue_delete(nqueue); // printf("\nordered\n"); -// for (pchan = pose->chanbase.first; pchan; pchan= pchan->next) { +// for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { // printf(" %s\n", pchan->name); // } diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index e0c3b257273..335758fec11 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -594,7 +594,7 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, float (*vertexCos)[3] = bmdm->vertexCos; float (*vertexNos)[3] = bmdm->vertexNos; float (*polyNos)[3] = bmdm->polyNos; - // int *triPolyMap= bmdm->triPolyMap; + // int *triPolyMap = bmdm->triPolyMap; BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT | BM_FACE); @@ -802,7 +802,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, BMLoop **ls = em->looptris[i]; MTexPoly *tp = has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL; MTFace mtf = {{{0}}}; - /*unsigned char *cp= NULL;*/ /*UNUSED*/ + /*unsigned char *cp = NULL;*/ /*UNUSED*/ int drawSmooth = BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH); DMDrawOption draw_option; @@ -874,7 +874,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, BMLoop **ls = em->looptris[i]; MTexPoly *tp = has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL; MTFace mtf = {{{0}}}; - /*unsigned char *cp= NULL;*/ /*UNUSED*/ + /*unsigned char *cp = NULL;*/ /*UNUSED*/ int drawSmooth = BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH); DMDrawOption draw_option; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 1d109d5f616..b5254b97844 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -929,6 +929,8 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected } } + if (point->ave) + zero_v3(point->ave); if (pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) { float xvec[3] = {1.0f, 0.0f, 0.0f}; float dave[3]; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 59c8a529d85..b7ede15d00b 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -613,7 +613,7 @@ static float fcm_cycles_time(FCurve *fcu, FModifier *fcm, float UNUSED(cvalue), /* check that cyclic is still enabled for the specified time */ if (cycles == 0) { - /* catch this case so that we don't exit when we have cycles=0 + /* catch this case so that we don't exit when we have (cycles = 0) * as this indicates infinite cycles... */ } @@ -810,7 +810,7 @@ static void fcm_python_copy(FModifier *fcm, FModifier *src) static void fcm_python_evaluate(FCurve *UNUSED(fcu), FModifier *UNUSED(fcm), float *UNUSED(cvalue), float UNUSED(evaltime)) { #ifdef WITH_PYTHON - //FMod_Python *data= (FMod_Python *)fcm->data; + //FMod_Python *data = (FMod_Python *)fcm->data; /* FIXME... need to implement this modifier... * It will need it execute a script using the custom properties diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 2ff58e2c3f9..95e659e9a2c 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -202,7 +202,7 @@ int add_to_group(Group *group, Object *object, Scene *scene, Base *base) } } -/* also used for ob==NULL */ +/* also used for (ob == NULL) */ static int rem_from_group_internal(Group *group, Object *ob) { GroupObject *go, *gon; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 80b192c7a42..a2b1fb10500 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -290,7 +290,7 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame) else ibuf->flags &= ~IB_cm_predivide; - /* this function accepts link==NULL */ + /* this function accepts (link == NULL) */ BLI_insertlinkbefore(&ima->ibufs, link, ibuf); /* now we don't want copies? */ @@ -802,7 +802,7 @@ void BKE_image_free_all_textures(void) { Tex *tex; Image *ima; - /* unsigned int totsize= 0; */ + /* unsigned int totsize = 0; */ for (ima = G.main->image.first; ima; ima = ima->id.next) ima->id.flag &= ~LIB_DOIT; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 1077b5ad7c3..9737888e0b2 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -162,14 +162,14 @@ static AdrBit2Path ma_mode_bits[] = { static AdrBit2Path *adrcode_bitmaps_to_paths(int blocktype, int adrcode, int *tot) { /* Object layers */ - if ((blocktype == ID_OB) && (adrcode == OB_LAY)) + if ((blocktype == ID_OB) && (adrcode == OB_LAY)) RET_ABP(ob_layer_bits) - else if ((blocktype == ID_MA) && (adrcode == MA_MODE)) - RET_ABP(ma_mode_bits) - // XXX TODO: add other types... + else if ((blocktype == ID_MA) && (adrcode == MA_MODE)) + RET_ABP(ma_mode_bits) + // XXX TODO: add other types... - /* Normal curve */ - return NULL; + /* Normal curve */ + return NULL; } /* *************************************************** */ diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 15db290ff14..e3495a15871 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -305,7 +305,7 @@ void init_latt_deform(Object *oblatt, Object *ob) fp = lt->latticedata = MEM_mallocN(sizeof(float) * 3 * lt->pntsu * lt->pntsv * lt->pntsw, "latticedata"); - /* for example with a particle system: ob==0 */ + /* for example with a particle system: (ob == NULL) */ if (ob == NULL) { /* in deformspace, calc matrix */ invert_m4_m4(lt->latmat, oblatt->obmat); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 6a43c48c32b..5cc328212a9 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -654,7 +654,7 @@ static ID *alloc_libblock_notest(short type) id = MEM_callocN(sizeof(Text), "text"); break; case ID_SCRIPT: - //XXX id= MEM_callocN(sizeof(Script), "script"); + //XXX id = MEM_callocN(sizeof(Script), "script"); break; case ID_SPK: id = MEM_callocN(sizeof(Speaker), "speaker"); @@ -1047,7 +1047,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor /* used by headerbuttons.c buttons.c editobject.c editseq.c */ -/* if nr==NULL no MAX_IDPUP, this for non-header browsing */ +/* if (nr == NULL) no MAX_IDPUP, this for non-header browsing */ void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) { DynStr *pupds = BLI_dynstr_new(); @@ -1325,7 +1325,7 @@ void clear_id_newpoins(void) } } -#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } +#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } (void)0 static void lib_indirect_test_id(ID *id, Library *lib) { diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 9e1b45a7479..c59948532ac 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -608,7 +608,7 @@ Material *give_current_material(Object *ob, short act) if (ob == NULL) return NULL; - /* if object cannot have material, totcolp==NULL */ + /* if object cannot have material, (totcolp == NULL) */ totcolp = give_totcolp(ob); if (totcolp == NULL || ob->totcol == 0) return NULL; @@ -841,7 +841,7 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol) int actcol_orig = ob->actcol; short i; - while (object_remove_material_slot(ob)) {}; + while (object_remove_material_slot(ob)) {} /* now we have the right number of slots */ for (i = 0; i < totcol; i++) @@ -904,7 +904,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) ma->mapto |= mtex->mapto; /* always get derivatives for these textures */ - if (ELEM3(mtex->tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)) ma->texco |= TEXCO_OSA; + if (ELEM(mtex->tex->type, TEX_IMAGE, TEX_ENVMAP)) ma->texco |= TEXCO_OSA; else if (mtex->texflag & (MTEX_COMPAT_BUMP | MTEX_3TAP_BUMP | MTEX_5TAP_BUMP | MTEX_BICUBIC_BUMP)) ma->texco |= TEXCO_OSA; if (ma->texco & (TEXCO_ORCO | TEXCO_REFL | TEXCO_NORM | TEXCO_STRAND | TEXCO_STRESS)) needuv = 1; @@ -1180,7 +1180,7 @@ int object_remove_material_slot(Object *ob) } -/* r_col = current value, col = new value, fac==0 is no change */ +/* r_col = current value, col = new value, (fac == 0) is no change */ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) { float tmp, facm = 1.0f - fac; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index bef5f2e18a3..b5b03a8924f 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -816,7 +816,7 @@ static int totindex, curindex; static void accum_mballfaces(int i1, int i2, int i3, int i4) { int *newi, *cur; - /* static int i=0; I would like to delete altogether, but I don't dare to, yet */ + /* static int i = 0; I would like to delete altogether, but I don't dare to, yet */ if (totindex == curindex) { totindex += 256; @@ -1701,7 +1701,7 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */ MetaBall *mb; MetaElem *ml; float size, totsize, obinv[4][4], obmat[4][4], vec[3]; - //float max=0.0; + //float max = 0.0f; int a, obnr, zero_size = 0; char obname[MAX_ID_NAME]; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 9eb74986b29..fd952b7b518 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1823,7 +1823,7 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, } if (origIndexFace && - /* fnors==faceNors_r */ /* NO NEED TO ALLOC YET */ + /* fnors == faceNors_r */ /* NO NEED TO ALLOC YET */ fnors != NULL && numFaces) { @@ -2004,7 +2004,7 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex, if (corners == 0) { /* Empty MDisp layers appear in at least one of the sintel.blend files. * Not sure why this happens, but it seems fine to just ignore them here. - * If corners==0 for a non-empty layer though, something went wrong. */ + * If (corners == 0) for a non-empty layer though, something went wrong. */ BLI_assert(fd->totdisp == 0); } else { diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index a60bb98ac18..669ae4f198a 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -103,11 +103,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh, MDeformVert *dverts, /* assume totvert length */ const short do_verbose, const short do_fixes) { -# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } +# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } (void)0 # define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1) -# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } -# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } +# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } (void)0 +# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } (void)0 MVert *mv = mverts; MEdge *me; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 4e8b67bd55b..d818ca09f20 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -685,7 +685,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl) multires_set_tot_level(ob, mmd, lvl); } -/* direction=1 for delete higher, direction=0 for lower (not implemented yet) */ +/* (direction = 1) for delete higher, (direction = 0) for lower (not implemented yet) */ void multiresModifier_del_levels(MultiresModifierData *mmd, Object *ob, int direction) { Mesh *me = BKE_mesh_from_object(ob); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 445105d254a..22286e57c0a 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -29,13 +29,6 @@ * \ingroup bke */ - -#if 0 /* pynodes commented for now */ -# ifdef WITH_PYTHON -# include <Python.h> -# endif -#endif - #include "MEM_guardedalloc.h" #include <stdlib.h> @@ -135,20 +128,9 @@ void ntreeInitTypes(bNodeTree *ntree) for (node= ntree->nodes.first; node; node= next) { next= node->next; - node->typeinfo= node_get_type(ntree, node->type); - - if (node->type==NODE_DYNAMIC) { - /* needed info if the pynode script fails now: */ - node->storage= ntree; - if (node->id!=NULL) { /* not an empty script node */ - node->custom1 = 0; - node->custom1 = BSET(node->custom1, NODE_DYNAMIC_ADDEXIST); - } -// if (node->typeinfo) -// node->typeinfo->initfunc(node); - } + node->typeinfo = node_get_type(ntree, node->type); - if (node->typeinfo==NULL) { + if (node->typeinfo == NULL) { printf("Error: Node type %s doesn't exist anymore, removed\n", node->name); nodeFreeNode(ntree, node); } @@ -354,26 +336,6 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp) return node; } -void nodeMakeDynamicType(bNode *node) -{ - /* find SH_DYNAMIC_NODE ntype */ - bNodeType *ntype= ntreeGetType(NTREE_SHADER)->node_types.first; - while (ntype) { - if (ntype->type==NODE_DYNAMIC) - break; - ntype= ntype->next; - } - - /* make own type struct to fill */ - if (ntype) { - /*node->typeinfo= MEM_dupallocN(ntype);*/ - bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType"); - *newtype= *ntype; - BLI_strncpy(newtype->name, ntype->name, sizeof(newtype->name)); - node->typeinfo= newtype; - } -} - /* keep socket listorder identical, for copying links */ /* ntree is the target tree */ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node) @@ -1860,6 +1822,7 @@ void nodeRegisterType(bNodeTreeType *ttype, bNodeType *ntype) static void registerCompositNodes(bNodeTreeType *ttype) { register_node_type_frame(ttype); + register_node_type_reroute(ttype); register_node_type_cmp_group(ttype); // register_node_type_cmp_forloop(ttype); @@ -1952,6 +1915,7 @@ static void registerCompositNodes(bNodeTreeType *ttype) static void registerShaderNodes(bNodeTreeType *ttype) { register_node_type_frame(ttype); + register_node_type_reroute(ttype); register_node_type_sh_group(ttype); //register_node_type_sh_forloop(ttype); @@ -1976,7 +1940,6 @@ static void registerShaderNodes(bNodeTreeType *ttype) register_node_type_sh_math(ttype); register_node_type_sh_vect_math(ttype); register_node_type_sh_squeeze(ttype); - //register_node_type_sh_dynamic(ttype); register_node_type_sh_material_ext(ttype); register_node_type_sh_invert(ttype); register_node_type_sh_seprgb(ttype); @@ -2025,6 +1988,7 @@ static void registerShaderNodes(bNodeTreeType *ttype) static void registerTextureNodes(bNodeTreeType *ttype) { register_node_type_frame(ttype); + register_node_type_reroute(ttype); register_node_type_tex_group(ttype); // register_node_type_tex_forloop(ttype); @@ -2069,30 +2033,12 @@ static void registerTextureNodes(bNodeTreeType *ttype) register_node_type_tex_proc_distnoise(ttype); } -static void free_dynamic_typeinfo(bNodeType *ntype) -{ - if (ntype->type==NODE_DYNAMIC) { - if (ntype->inputs) { - MEM_freeN(ntype->inputs); - } - if (ntype->outputs) { - MEM_freeN(ntype->outputs); - } - if (ntype->name) { - MEM_freeN((void *)ntype->name); - } - } -} - static void free_typeinfos(ListBase *list) { bNodeType *ntype, *next; for (ntype=list->first; ntype; ntype=next) { next = ntype->next; - - if (ntype->type==NODE_DYNAMIC) - free_dynamic_typeinfo(ntype); - + if (ntype->needs_free) MEM_freeN(ntype); } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 0968358a815..3304ccc73cf 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -845,6 +845,9 @@ Object *BKE_object_add_only_object(int type, const char *name) /* ob->pad3 == Contact Processing Threshold */ ob->m_contactProcessingThreshold = 1.0f; ob->obstacleRad = 1.0f; + ob->step_height = 0.15f; + ob->jump_speed = 10.0f; + ob->fall_speed = 55.0f; /* NT fluid sim defaults */ ob->fluidsimSettings = NULL; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 66dd23e76b9..9537a31838c 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2411,7 +2411,7 @@ static void get_strand_normal(Material *ma, const float surfnor[3], float surfdi static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float cfra, int editupdate) { ParticleThreadContext *ctx = threads[0].ctx; -/* Object *ob= ctx->sim.ob; */ +/* Object *ob = ctx->sim.ob; */ ParticleSystem *psys = ctx->sim.psys; ParticleSettings *part = psys->part; /* ParticleEditSettings *pset = &scene->toolsettings->particle; */ @@ -3751,9 +3751,14 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co return 1; } -#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } -#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if (event & type) { if (pvalue < 0.f) pvalue = 1.f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } -#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } +#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \ + if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0 + +#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \ + if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0 + +#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \ + if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0 static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra) { @@ -3884,26 +3889,26 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex else ptex->time = texture_value_blend(def, ptex->time, value, mtex->timefac, blend); } - SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac) - SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac) - SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac) - SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac) - SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac) - SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac) - SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac) - SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac) + SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac); + SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac); + SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac); + SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac); + SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac); + SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac); + SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac); + SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac); } } - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length); } /************************************************/ /* Particle State */ diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index fa47600deb2..cdedd818b43 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2673,6 +2673,9 @@ static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, flo force[1] += (BLI_frand()-0.5f) * part->brownfac; force[2] += (BLI_frand()-0.5f) * part->brownfac; } + + if(part->flag & PART_ROT_DYN && epoint.ave) + copy_v3_v3(pa->state.ave, epoint.ave); } /* gathers all forces that effect particles and calculates a new state for the particle */ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, float cfra) @@ -2730,7 +2733,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa } static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, float timestep) { - float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep; + float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac; if ((part->flag & PART_ROTATIONS)==0) { pa->state.rot[0]=1.0f; @@ -2738,7 +2741,9 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f return; } - if ((part->flag & PART_ROT_DYN)==0 && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) { + extrotfac = len_v3(pa->state.ave); + + if ((part->flag & PART_ROT_DYN) && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) { float angle; float len1 = len_v3(pa->prev_state.vel); float len2 = len_v3(pa->state.vel); @@ -2758,7 +2763,7 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f } rotfac = len_v3(pa->state.ave); - if (rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */ + if (rotfac == 0.0f || (part->flag & PART_ROT_DYN)==0 || extrotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */ rot1[0]=1.0f; rot1[1]=rot1[2]=rot1[3]=0; } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 90d17e53349..91023513d4d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -99,8 +99,15 @@ # include "BLI_winstuff.h" #endif -#define PTCACHE_DATA_FROM(data, type, from) if (data[type]) { memcpy(data[type], from, ptcache_data_size[type]); } -#define PTCACHE_DATA_TO(data, type, index, to) if (data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); } +#define PTCACHE_DATA_FROM(data, type, from) \ + if (data[type]) { \ + memcpy(data[type], from, ptcache_data_size[type]); \ + } (void)0 + +#define PTCACHE_DATA_TO(data, type, index, to) \ + if (data[type]) { \ + memcpy(to, (char *)(data)[type] + ((index) ? (index) * ptcache_data_size[type] : 0), ptcache_data_size[type]); \ + } (void)0 /* could be made into a pointcache option */ #define DURIAN_POINTCACHE_LIB_OK 1 diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 36963e55606..7c9d6bd05be 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -523,6 +523,9 @@ Scene *BKE_scene_add(const char *name) sce->gm.maxlogicstep = 5; sce->gm.physubstep = 1; sce->gm.maxphystep = 5; + sce->gm.lineardeactthreshold = 0.8f; + sce->gm.angulardeactthreshold = 1.0f; + sce->gm.deactivationtime = 0.0f; sce->gm.flag = GAME_DISPLAY_LISTS; sce->gm.matmode = GAME_MAT_MULTITEX; @@ -611,7 +614,7 @@ void BKE_scene_set_background(Main *bmain, Scene *scene) base->flag |= flag; /* not too nice... for recovering objects with lost data */ - //if (ob->pose==NULL) base->flag &= ~OB_POSEMODE; + //if (ob->pose == NULL) base->flag &= ~OB_POSEMODE; ob->flag = base->flag; ob->ctime = -1234567.0; /* force ipo to be calculated later */ diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index fac74d27e0d..4b6c362cd85 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -47,7 +47,6 @@ #include "BKE_fcurve.h" #include "BKE_main.h" -#include "BKE_plugin_types.h" #include "BKE_sequencer.h" #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -58,13 +57,6 @@ #include "RNA_access.h" /* **** XXX **** */ -static void error(const char *UNUSED(error), ...) { -} - -#define INT 96 -#define FLO 128 - -/* **** XXX **** */ /* Glow effect */ enum { @@ -123,281 +115,6 @@ static ImBuf *prepare_effect_imbufs( } /* ********************************************************************** - * PLUGINS - * ********************************************************************** */ - -static void open_plugin_seq(PluginSeq *pis, const char *seqname) -{ - int (*version)(void); - void * (*alloc_private)(void); - char *cp; - - /* to be sure: (is tested for) */ - pis->doit = NULL; - pis->pname = NULL; - pis->varstr = NULL; - pis->cfra = NULL; - pis->version = 0; - pis->instance_private_data = NULL; - - /* clear the error list */ - BLI_dynlib_get_error_as_string(NULL); - - /* if (pis->handle) BLI_dynlib_close(pis->handle); */ - /* pis->handle= 0; */ - - /* open the needed object */ - pis->handle = BLI_dynlib_open(pis->name); - if (test_dlerr(pis->name, pis->name)) return; - - if (pis->handle != NULL) { - /* find the address of the version function */ - version = (int (*)(void))BLI_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); - if (test_dlerr(pis->name, "plugin_seq_getversion")) return; - - if (version != NULL) { - pis->version = version(); - if (pis->version >= 2 && pis->version <= 6) { - int (*info_func)(PluginInfo *); - PluginInfo *info = (PluginInfo *) MEM_mallocN(sizeof(PluginInfo), "plugin_info"); - - info_func = (int (*)(PluginInfo *))BLI_dynlib_find_symbol(pis->handle, "plugin_getinfo"); - - if (info_func == NULL) error("No info func"); - else { - info_func(info); - - pis->pname = info->name; - pis->vars = info->nvars; - pis->cfra = info->cfra; - - pis->varstr = info->varstr; - - pis->doit = (void (*)(void))info->seq_doit; - if (info->init) - info->init(); - } - MEM_freeN(info); - - cp = BLI_dynlib_find_symbol(pis->handle, "seqname"); - if (cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR); - } - else { - printf("Plugin returned unrecognized version number\n"); - return; - } - } - alloc_private = (void * (*)(void))BLI_dynlib_find_symbol( - pis->handle, "plugin_seq_alloc_private_data"); - if (alloc_private) { - pis->instance_private_data = alloc_private(); - } - - pis->current_private_data = (void **) - BLI_dynlib_find_symbol(pis->handle, "plugin_private_data"); - } -} - -static PluginSeq *add_plugin_seq(const char *str, const char *seqname) -{ - PluginSeq *pis; - VarStruct *varstr; - int a; - - pis = MEM_callocN(sizeof(PluginSeq), "PluginSeq"); - - BLI_strncpy(pis->name, str, FILE_MAX); - open_plugin_seq(pis, seqname); - - if (pis->doit == NULL) { - if (pis->handle == NULL) error("no plugin: %s", str); - else error("in plugin: %s", str); - MEM_freeN(pis); - return NULL; - } - - /* default values */ - varstr = pis->varstr; - for (a = 0; a < pis->vars; a++, varstr++) { - if ( (varstr->type & FLO) == FLO) - pis->data[a] = varstr->def; - else if ( (varstr->type & INT) == INT) - *((int *)(pis->data + a)) = (int) varstr->def; - } - - return pis; -} - -static void free_plugin_seq(PluginSeq *pis) -{ - if (pis == NULL) return; - - /* no BLI_dynlib_close: same plugin can be opened multiple times with 1 handle */ - - if (pis->instance_private_data) { - void (*free_private)(void *); - - free_private = (void (*)(void *))BLI_dynlib_find_symbol( - pis->handle, "plugin_seq_free_private_data"); - if (free_private) { - free_private(pis->instance_private_data); - } - } - - MEM_freeN(pis); -} - -static void init_plugin(Sequence *seq, const char *fname) -{ - seq->plugin = (PluginSeq *)add_plugin_seq(fname, seq->name + 2); -} - -/* - * FIXME: should query plugin! Could be generator, that needs zero inputs... - */ -static int num_inputs_plugin(void) -{ - return 1; -} - -static void load_plugin(Sequence *seq) -{ - if (seq) { - open_plugin_seq(seq->plugin, seq->name + 2); - } -} - -static void copy_plugin(Sequence *dst, Sequence *src) -{ - if (src->plugin) { - dst->plugin = MEM_dupallocN(src->plugin); - open_plugin_seq(dst->plugin, dst->name + 2); - } -} - -static ImBuf *IMB_cast_away_list(ImBuf *i) -{ - if (!i) { - return NULL; - } - return (ImBuf *) (((void **) i) + 2); -} - -static ImBuf *do_plugin_effect( - SeqRenderData context, Sequence *seq, float cfra, - float facf0, float facf1, - struct ImBuf *ibuf1, struct ImBuf *ibuf2, - struct ImBuf *ibuf3) -{ - char *cp; - int float_rendering; - int use_temp_bufs = FALSE; /* Are needed since blur.c (and maybe some other - * old plugins) do very bad stuff - * with imbuf-internals */ - - struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3); - int x = context.rectx; - int y = context.recty; - - if (seq->plugin && seq->plugin->doit) { - - if (seq->plugin->cfra) - *(seq->plugin->cfra) = cfra; - - cp = BLI_dynlib_find_symbol( - seq->plugin->handle, "seqname"); - - /* XXX: it's crappy to limit copying buffer by it's lemgth, - * but assuming plugin stuff is using correct buffer size - * it should be fine */ - if (cp) strncpy(cp, seq->name + 2, sizeof(seq->name) - 2); - - if (seq->plugin->current_private_data) { - *seq->plugin->current_private_data = seq->plugin->instance_private_data; - } - - float_rendering = (out->rect_float != NULL); - - if (seq->plugin->version <= 3 && float_rendering) { - use_temp_bufs = TRUE; - - if (ibuf1) { - ibuf1 = IMB_dupImBuf(ibuf1); - IMB_rect_from_float(ibuf1); - imb_freerectfloatImBuf(ibuf1); - ibuf1->flags &= ~IB_rectfloat; - } - if (ibuf2) { - ibuf2 = IMB_dupImBuf(ibuf2); - IMB_rect_from_float(ibuf2); - imb_freerectfloatImBuf(ibuf2); - ibuf2->flags &= ~IB_rectfloat; - } - if (ibuf3) { - ibuf3 = IMB_dupImBuf(ibuf3); - IMB_rect_from_float(ibuf3); - imb_freerectfloatImBuf(ibuf3); - ibuf3->flags &= ~IB_rectfloat; - } - if (!out->rect) imb_addrectImBuf(out); - imb_freerectfloatImBuf(out); - out->flags &= ~IB_rectfloat; - } - - if (seq->plugin->version <= 2) { - if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1); - if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2); - if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3); - } - - if (seq->plugin->version <= 4) { - ((SeqDoit)seq->plugin->doit)( - seq->plugin->data, facf0, facf1, x, y, - IMB_cast_away_list(ibuf1), - IMB_cast_away_list(ibuf2), - IMB_cast_away_list(out), - IMB_cast_away_list(ibuf3)); - } - else { - ((SeqDoit)seq->plugin->doit)( - seq->plugin->data, facf0, facf1, x, y, - ibuf1, ibuf2, out, ibuf3); - } - - if (seq->plugin->version <= 2) { - if (!use_temp_bufs) { - if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1); - if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2); - if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3); - } - IMB_convert_rgba_to_abgr(out); - } - if (seq->plugin->version <= 3 && float_rendering) { - IMB_float_from_rect_simple(out); - } - - if (use_temp_bufs) { - if (ibuf1) IMB_freeImBuf(ibuf1); - if (ibuf2) IMB_freeImBuf(ibuf2); - if (ibuf3) IMB_freeImBuf(ibuf3); - } - } - return out; -} - -static int do_plugin_early_out(struct Sequence *UNUSED(seq), - float UNUSED(facf0), float UNUSED(facf1)) -{ - return 0; -} - -static void free_plugin(struct Sequence *seq) -{ - free_plugin_seq(seq->plugin); - seq->plugin = NULL; -} - -/* ********************************************************************** * ALPHA OVER * ********************************************************************** */ @@ -1481,8 +1198,8 @@ static void do_mul_effect_byte(float facf0, float facf1, int x, int y, fac3 = (int)(256.0f * facf1); /* formula: - * fac*(a*b) + (1-fac)*a => fac*a*(b-1)+axaux= c*px + py*s ;//+centx - * yaux= -s*px + c*py;//+centy + * fac * (a * b) + (1-fac)*a => fac * a * (b - 1) + axaux = c * px + py * s; //+centx + * yaux = -s * px + c * py; //+centy */ while (y--) { @@ -2340,7 +2057,7 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height, /* Swap buffers */ - swap = temp; temp = map; /* map=swap; */ /* UNUSED */ + swap = temp; temp = map; /* map = swap; */ /* UNUSED */ /* Tidy up */ MEM_freeN(filter); @@ -2510,7 +2227,7 @@ static void RVBlurBitmap2_float(float *map, int width, int height, /* Swap buffers */ - swap = temp; temp = map; /* map=swap; */ /* UNUSED */ + swap = temp; temp = map; /* map = swap; */ /* UNUSED */ /* Tidy up */ MEM_freeN(filter); @@ -3159,11 +2876,6 @@ static void load_noop(struct Sequence *UNUSED(seq)) } -static void init_plugin_noop(struct Sequence *UNUSED(seq), const char *UNUSED(fname)) -{ - -} - static void free_noop(struct Sequence *UNUSED(seq)) { @@ -3265,7 +2977,6 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type) int sequence_type = seq_type; rval.init = init_noop; - rval.init_plugin = init_plugin_noop; rval.num_inputs = num_inputs_default; rval.load = load_noop; rval.free = free_noop; @@ -3353,16 +3064,6 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type) rval.copy = copy_solid_color; rval.execute = do_solid_color; break; - case SEQ_PLUGIN: - rval.init_plugin = init_plugin; - rval.num_inputs = num_inputs_plugin; - rval.load = load_plugin; - rval.free = free_plugin; - rval.copy = copy_plugin; - rval.execute = do_plugin_effect; - rval.early_out = do_plugin_early_out; - rval.get_default_fac = get_default_fac_fade; - break; case SEQ_MULTICAM: rval.num_inputs = num_inputs_multicam; rval.early_out = early_out_multicam; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 8fbb3ee9800..5318c5514ca 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -612,8 +612,8 @@ void calc_sequence(Scene *scene, Sequence *seq) /* we take the largest start and smallest end */ - // seq->start= seq->startdisp= MAX2(seq->seq1->startdisp, seq->seq2->startdisp); - // seq->enddisp= MIN2(seq->seq1->enddisp, seq->seq2->enddisp); + // seq->start = seq->startdisp = MAX2(seq->seq1->startdisp, seq->seq2->startdisp); + // seq->enddisp = MIN2(seq->seq1->enddisp, seq->seq2->enddisp); if (seq->seq1) { /* XXX These resets should not be necessary, but users used to be able to @@ -929,16 +929,6 @@ const char *give_seqname(Sequence *seq) if (seq->type < SEQ_EFFECT) { return seq->strip->dir; } - else if (seq->type == SEQ_PLUGIN) { - if (!(seq->flag & SEQ_EFFECT_NOT_LOADED) && - seq->plugin && seq->plugin->doit) - { - return seq->plugin->pname; - } - else { - return "Plugin"; - } - } else { return "Effect"; } @@ -1552,8 +1542,7 @@ static void make_cb_table_byte(float lift, float gain, float gamma, for (y = 0; y < 256; y++) { float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul); - CLAMP(v, 0.0f, 1.0f); - table[y] = v * 255; + table[y] = FTOCHAR(v); } } diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 6c1c18c7cf8..464b7fda51d 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -83,8 +83,6 @@ #endif -typedef void (*Shrinkwrap_ForeachVertexCallback)(DerivedMesh *target, float *co, float *normal); - /* get derived mesh */ //TODO is anyfunction that does this? returning the derivedFinal without we caring if its in edit mode or not? DerivedMesh *object_get_derived_final(Object *ob) @@ -109,23 +107,23 @@ void space_transform_from_matrixs(SpaceTransform *data, float local[4][4], float invert_m4_m4(data->target2local, data->local2target); } -void space_transform_apply(const SpaceTransform *data, float *co) +void space_transform_apply(const SpaceTransform *data, float co[3]) { mul_v3_m4v3(co, ((SpaceTransform *)data)->local2target, co); } -void space_transform_invert(const SpaceTransform *data, float *co) +void space_transform_invert(const SpaceTransform *data, float co[3]) { mul_v3_m4v3(co, ((SpaceTransform *)data)->target2local, co); } -static void space_transform_apply_normal(const SpaceTransform *data, float *no) +static void space_transform_apply_normal(const SpaceTransform *data, float no[3]) { mul_mat3_m4_v3(((SpaceTransform *)data)->local2target, no); normalize_v3(no); // TODO: could we just determine de scale value from the matrix? } -static void space_transform_invert_normal(const SpaceTransform *data, float *no) +static void space_transform_invert_normal(const SpaceTransform *data, float no[3]) { mul_mat3_m4_v3(((SpaceTransform *)data)->target2local, no); normalize_v3(no); // TODO: could we just determine de scale value from the matrix? @@ -211,7 +209,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) * MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (front faces hits are ignored) * MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (back faces hits are ignored) */ -int normal_projection_project_vertex(char options, const float *vert, const float *dir, const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata) +int normal_projection_project_vertex(char options, const float vert[3], const float dir[3], const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata) { float tmp_co[3], tmp_no[3]; const float *co, *no; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index edb4348dc5a..7a5465edf02 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1172,7 +1172,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, sub_v3_v3v3(vel, pos, oldpos); /* Scale velocity to incorperate the object movement during this step */ - mul_v3_fl(vel, 1.0 / (totalsteps * dt)); + mul_v3_fl(vel, 1.0 / (totalsteps * dt * sds->scale)); // mul_v3_fl(vel, 1.0 / dt); // DG TODO: cap velocity to maxVelMag (or maxvel) @@ -1592,8 +1592,8 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps) /* adapt timestep for different framerates, dt = 0.1 is at 25fps */ dt *= (25.0f / fps); - // maximum timestep/"CFL" constraint: dt < dx * maxVel - maxVel = (sds->dx * 1.0); + // maximum timestep/"CFL" constraint: dt < 5.0 *dx / maxVel + maxVel = (sds->dx * 5.0); for(i = 0; i < size; i++) { @@ -1607,7 +1607,8 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps) totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps; totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps; - // totalSubsteps = 2.0f; // DEBUG + /* Disable substeps for now, since it results in numerical instability */ + totalSubsteps = 1.0f; dtSubdiv = (float)dt / (float)totalSubsteps; @@ -1867,7 +1868,7 @@ static float calc_voxel_transp(float *result, float *input, int res[3], int *pix if(result[index] < 0.0f) { -#pragma omp critical +// #pragma omp critical result[index] = *tRay; } @@ -2011,7 +2012,7 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa bv[4] = p0[2]; bv[5] = p1[2]; -#pragma omp parallel for schedule(static,1) +// #pragma omp parallel for schedule(static,1) for(z = 0; z < res[2]; z++) { size_t index = z*slabsize; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 5abc4bc3830..63f0a29821f 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3514,7 +3514,9 @@ static void lattice_to_softbody(Scene *scene, Object *ob) { Lattice *lt= ob->data; SoftBody *sb; - int totvert, totspring = 0; + int totvert, totspring = 0, a; + BodyPoint *bp; + BPoint *bpnt = lt->def; totvert= lt->pntsu*lt->pntsv*lt->pntsw; @@ -3531,18 +3533,17 @@ static void lattice_to_softbody(Scene *scene, Object *ob) /* renew ends with ob->soft with points and edges, also checks & makes ob->soft */ renew_softbody(scene, ob, totvert, totspring); sb= ob->soft; /* can be created in renew_softbody() */ + bp = sb->bpoint; - /* weights from bpoints, same code used as for mesh vertices */ - /* if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { 2.4x one*/ - /* new! take the weights from lattice vertex anyhow */ - if (ob->softflag & OB_SB_GOAL) { - BodyPoint *bp= sb->bpoint; - BPoint *bpnt= lt->def; - /* jow_go_for2_5 */ - int a; - - for (a=0; a<totvert; a++, bp++, bpnt++) { - bp->goal= bpnt->weight; + /* same code used as for mesh vertices */ + for (a = 0; a < totvert; a++, bp++, bpnt++) { + if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { + get_scalar_from_vertexgroup(ob, a, (short) (sb->vertgroup - 1), &bp->goal); + } + else { + if (ob->softflag & OB_SB_GOAL) { + bp->goal = sb->defgoal; + } } } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 8deee97f01a..a7171caaf8c 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -125,7 +125,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useArena = flags & CCG_USE_ARENA; int normalOffset = 0; - /* subdivLevels==0 is not allowed */ + /* (subdivLevels == 0) is not allowed */ subdivLevels = MAX2(subdivLevels, 1); if (prevSS) { diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 7bfd4189cc3..7de5f97588b 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -570,9 +570,6 @@ void BKE_text_unlink(Main *bmain, Text *text) if (update) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } - - /* pynodes */ - // XXX nodeDynamicUnlinkText(&text->id); /* text space */ for (scr = bmain->screen.first; scr; scr = scr->id.next) { @@ -813,7 +810,7 @@ void txt_move_up(Text *text, short sel) if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; - /* old= *charp; */ /* UNUSED */ + /* old = *charp; */ /* UNUSED */ if ((*linep)->prev) { int index = txt_utf8_offset_to_index((*linep)->line, *charp); @@ -841,7 +838,7 @@ void txt_move_down(Text *text, short sel) if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; - /* old= *charp; */ /* UNUSED */ + /* old = *charp; */ /* UNUSED */ if ((*linep)->next) { int index = txt_utf8_offset_to_index((*linep)->line, *charp); @@ -3226,8 +3223,8 @@ short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, in } /* Clears all markers in the specified group (if given) with at least the - * specified flags set. Useful for clearing temporary markers (group=0, - * flags=TMARK_TEMP) */ + * specified flags set. Useful for clearing temporary markers (group = 0, + * flags = TMARK_TEMP) */ short txt_clear_markers(Text *text, int group, int flags) { TextMarker *marker, *next; @@ -3276,7 +3273,7 @@ TextMarker *txt_prev_marker(Text *text, TextMarker *marker) if (tmp->group == marker->group) return tmp; } - return NULL; /* Only if marker==NULL */ + return NULL; /* Only if (marker == NULL) */ } /* Finds the next marker in the same group. If no other is found, the same @@ -3290,7 +3287,7 @@ TextMarker *txt_next_marker(Text *text, TextMarker *marker) if (tmp->group == marker->group) return tmp; } - return NULL; /* Only if marker==NULL */ + return NULL; /* Only if (marker == NULL) */ } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 2ec42b47e5c..7081a642b8a 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -56,7 +56,6 @@ #include "IMB_imbuf.h" -#include "BKE_plugin_types.h" #include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_main.h" @@ -72,137 +71,6 @@ #include "BKE_animsys.h" #include "BKE_colortools.h" - -/* ------------------------------------------------------------------------- */ - -/* All support for plugin textures: */ -int test_dlerr(const char *name, const char *symbol) -{ - char *err; - - err = BLI_dynlib_get_error_as_string(NULL); - if (err) { - printf("var1: %s, var2: %s, var3: %s\n", name, symbol, err); - return 1; - } - - return 0; -} - -/* ------------------------------------------------------------------------- */ - -void open_plugin_tex(PluginTex *pit) -{ - int (*version)(void); - - /* init all the happy variables */ - pit->doit = NULL; - pit->pname = NULL; - pit->stnames = NULL; - pit->varstr = NULL; - pit->result = NULL; - pit->cfra = NULL; - pit->version = 0; - pit->instance_init = NULL; - - /* clear the error list */ - BLI_dynlib_get_error_as_string(NULL); - - /* no BLI_dynlib_close! multiple opened plugins... */ - /* if (pit->handle) BLI_dynlib_close(pit->handle); */ - /* pit->handle= 0; */ - - /* open the needed object */ - pit->handle = BLI_dynlib_open(pit->name); - if (test_dlerr(pit->name, pit->name)) return; - - if (pit->handle != NULL) { - /* find the address of the version function */ - version = (int (*)(void))BLI_dynlib_find_symbol(pit->handle, "plugin_tex_getversion"); - if (test_dlerr(pit->name, "plugin_tex_getversion")) return; - - if (version != NULL) { - pit->version = version(); - if (pit->version >= 2 && pit->version <= 6) { - int (*info_func)(PluginInfo *); - PluginInfo *info = (PluginInfo *) MEM_mallocN(sizeof(PluginInfo), "plugin_info"); - - info_func = (int (*)(PluginInfo *))BLI_dynlib_find_symbol(pit->handle, "plugin_getinfo"); - if (!test_dlerr(pit->name, "plugin_getinfo")) { - info->instance_init = NULL; - - info_func(info); - - pit->doit = (int (*)(void))info->tex_doit; - pit->callback = (void (*)(unsigned short))info->callback; - pit->stypes = info->stypes; - pit->vars = info->nvars; - pit->pname = info->name; - pit->stnames = info->snames; - pit->varstr = info->varstr; - pit->result = info->result; - pit->cfra = info->cfra; - pit->instance_init = info->instance_init; - if (info->init) info->init(); - } - MEM_freeN(info); - } - else { - printf("Plugin returned unrecognized version number\n"); - return; - } - } - } -} - -/* ------------------------------------------------------------------------- */ - -/* very badlevel define to bypass linking with BIF_interface.h */ -#define INT 96 -#define FLO 128 - -PluginTex *add_plugin_tex(char *str) -{ - PluginTex *pit; - VarStruct *varstr; - int a; - - pit = MEM_callocN(sizeof(PluginTex), "plugintex"); - - BLI_strncpy(pit->name, str, sizeof(pit->name)); - open_plugin_tex(pit); - - if (pit->doit == NULL) { - if (pit->handle == NULL) {; } //XXX error("no plugin: %s", str); - else {; } //XXX error("in plugin: %s", str); - MEM_freeN(pit); - return NULL; - } - - varstr = pit->varstr; - for (a = 0; a < pit->vars; a++, varstr++) { - if ( (varstr->type & FLO) == FLO) - pit->data[a] = varstr->def; - else if ( (varstr->type & INT) == INT) - *((int *)(pit->data + a)) = (int) varstr->def; - } - - if (pit->instance_init) - pit->instance_init((void *) pit->data); - - return pit; -} - -/* ------------------------------------------------------------------------- */ - -void free_plugin_tex(PluginTex *pit) -{ - if (pit == NULL) return; - - /* no BLI_dynlib_close: same plugin can be opened multiple times, 1 handle */ - MEM_freeN(pit); -} - /* ****************** Mapping ******************* */ TexMapping *add_tex_mapping(void) @@ -550,8 +418,6 @@ int colorband_element_remove(struct ColorBand *coba, int index) void BKE_texture_free(Tex *tex) { - free_plugin_tex(tex->plugin); - if (tex->coba) MEM_freeN(tex->coba); if (tex->env) BKE_free_envmap(tex->env); if (tex->pd) BKE_free_pointdensity(tex->pd); @@ -573,10 +439,6 @@ void BKE_texture_free(Tex *tex) void default_tex(Tex *tex) { - PluginTex *pit; - VarStruct *varstr; - int a; - tex->type = TEX_CLOUDS; tex->stype = 0; tex->flag = TEX_CHECKER_ODD; @@ -644,15 +506,6 @@ void default_tex(Tex *tex) tex->ot->output = TEX_OCN_DISPLACEMENT; tex->ot->object = NULL; } - pit = tex->plugin; - if (pit) { - varstr = pit->varstr; - if (varstr) { - for (a = 0; a < pit->vars; a++, varstr++) { - pit->data[a] = varstr->def; - } - } - } tex->iuser.fie_ima = 2; tex->iuser.ok = 1; @@ -833,11 +686,6 @@ Tex *BKE_texture_copy(Tex *tex) if (texn->type == TEX_IMAGE) id_us_plus((ID *)texn->ima); else texn->ima = NULL; - if (texn->plugin) { - texn->plugin = MEM_dupallocN(texn->plugin); - open_plugin_tex(texn->plugin); - } - if (texn->coba) texn->coba = MEM_dupallocN(texn->coba); if (texn->env) texn->env = BKE_copy_envmap(texn->env); if (texn->pd) texn->pd = BKE_copy_pointdensity(texn->pd); @@ -865,11 +713,6 @@ Tex *localize_texture(Tex *tex) /* image texture: BKE_texture_free also doesn't decrease */ - if (texn->plugin) { - texn->plugin = MEM_dupallocN(texn->plugin); - open_plugin_tex(texn->plugin); - } - if (texn->coba) texn->coba = MEM_dupallocN(texn->coba); if (texn->env) { texn->env = BKE_copy_envmap(texn->env); @@ -1058,7 +901,7 @@ void autotexname(Tex *tex) { Main *bmain = G.main; char texstr[20][15] = {"None", "Clouds", "Wood", "Marble", "Magic", "Blend", - "Stucci", "Noise", "Image", "Plugin", "EnvMap", "Musgrave", + "Stucci", "Noise", "Image", "EnvMap", "Musgrave", "Voronoi", "DistNoise", "Point Density", "Voxel Data", "Ocean", "", "", ""}; Image *ima; char di[FILE_MAXDIR], fi[FILE_MAXFILE]; @@ -1079,7 +922,6 @@ void autotexname(Tex *tex) } else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); } - else if (tex->type == TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname); else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); } } @@ -1565,11 +1407,7 @@ void BKE_free_oceantex(struct OceanTex *ot) /* ------------------------------------------------------------------------- */ int BKE_texture_dependsOnTime(const struct Tex *texture) { - if (texture->plugin) { - // assume all plugins depend on time - return 1; - } - else if (texture->ima && + if (texture->ima && ELEM(texture->ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { return 1; |