From e4bdb6e95a6f2a0365901ed8d1cba698f19d6d39 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 12 Aug 2011 18:06:05 +0000 Subject: Code cleanup: replace some manual setting of ob->recalc with DAG_id_tag_update, is now just as fast anyway with delayed flush. --- source/blender/editors/object/object_transform.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index f7c6ff99bde..78f3537bea9 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -246,7 +246,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op, } /* tag for updates */ - ob->recalc |= OB_RECALC_OB; + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } CTX_DATA_END; @@ -341,7 +341,8 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op)) negate_v3_v3(v3, v1); mul_m3_v3(mat, v3); } - ob->recalc |= OB_RECALC_OB; + + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } CTX_DATA_END; @@ -871,7 +872,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) (ob->dup_group==ob_other->dup_group && (ob->transflag|ob_other->transflag) & OB_DUPLIGROUP) ) ) { ob_other->flag |= OB_DONE; - ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; + DAG_id_tag_update(&ob_other->id, OB_RECALC_OB|OB_RECALC_DATA); copy_v3_v3(centn, cent); mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ @@ -890,11 +891,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - for (tob= bmain->object.first; tob; tob= tob->id.next) { - if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) { - tob->recalc= OB_RECALC_OB|OB_RECALC_DATA; - } - } + for (tob= bmain->object.first; tob; tob= tob->id.next) + if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) + DAG_id_tag_update(&tob->id, OB_RECALC_OB|OB_RECALC_DATA); if (tot_change) { DAG_ids_flush_update(bmain, 0); -- cgit v1.2.3 From c265a686d8ef83c4606a8c8846795b5b381a3dff Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 12 Aug 2011 18:11:22 +0000 Subject: Modifiers: add callback to loop over each texture assigned to a modifier. --- source/blender/blenkernel/BKE_modifier.h | 15 +++++++++++++++ source/blender/blenkernel/intern/modifier.c | 12 ++++++++++++ source/blender/modifiers/intern/MOD_armature.c | 1 + source/blender/modifiers/intern/MOD_array.c | 1 + source/blender/modifiers/intern/MOD_bevel.c | 1 + source/blender/modifiers/intern/MOD_boolean.c | 1 + source/blender/modifiers/intern/MOD_build.c | 3 ++- source/blender/modifiers/intern/MOD_cast.c | 1 + source/blender/modifiers/intern/MOD_cloth.c | 1 + source/blender/modifiers/intern/MOD_collision.c | 1 + source/blender/modifiers/intern/MOD_curve.c | 1 + source/blender/modifiers/intern/MOD_decimate.c | 1 + source/blender/modifiers/intern/MOD_displace.c | 7 +++++++ source/blender/modifiers/intern/MOD_edgesplit.c | 1 + source/blender/modifiers/intern/MOD_explode.c | 1 + source/blender/modifiers/intern/MOD_fluidsim.c | 1 + source/blender/modifiers/intern/MOD_hook.c | 1 + source/blender/modifiers/intern/MOD_lattice.c | 1 + source/blender/modifiers/intern/MOD_mask.c | 1 + source/blender/modifiers/intern/MOD_meshdeform.c | 1 + source/blender/modifiers/intern/MOD_mirror.c | 1 + source/blender/modifiers/intern/MOD_multires.c | 1 + source/blender/modifiers/intern/MOD_none.c | 1 + source/blender/modifiers/intern/MOD_particleinstance.c | 1 + source/blender/modifiers/intern/MOD_particlesystem.c | 1 + source/blender/modifiers/intern/MOD_screw.c | 1 + source/blender/modifiers/intern/MOD_shapekey.c | 3 ++- source/blender/modifiers/intern/MOD_shrinkwrap.c | 1 + source/blender/modifiers/intern/MOD_simpledeform.c | 1 + source/blender/modifiers/intern/MOD_smoke.c | 1 + source/blender/modifiers/intern/MOD_smooth.c | 1 + source/blender/modifiers/intern/MOD_softbody.c | 1 + source/blender/modifiers/intern/MOD_solidify.c | 3 ++- source/blender/modifiers/intern/MOD_subsurf.c | 2 ++ source/blender/modifiers/intern/MOD_surface.c | 1 + source/blender/modifiers/intern/MOD_uvproject.c | 1 + source/blender/modifiers/intern/MOD_warp.c | 6 ++++++ source/blender/modifiers/intern/MOD_wave.c | 7 +++++++ 38 files changed, 84 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 648e67cad8a..28950e4b2eb 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -101,6 +101,7 @@ typedef enum { typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin); typedef void (*IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin); +typedef void (*TexWalkFunc)(void *userData, struct Object *ob, struct ModifierData *md, const char *propname); typedef struct ModifierTypeInfo { /* The user visible name for this modifier */ @@ -284,6 +285,16 @@ typedef struct ModifierTypeInfo { */ void (*foreachIDLink)(struct ModifierData *md, struct Object *ob, IDWalkFunc walk, void *userData); + + /* Should call the given walk function for each texture that the + * modifier data stores. This is used for finding all textures in + * the context for the UI. + * + * This function is optional. If it is not present, it will be + * assumed the modifier has no textures. + */ + void (*foreachTexLink)(struct ModifierData *md, struct Object *ob, + TexWalkFunc walk, void *userData); } ModifierTypeInfo; ModifierTypeInfo *modifierType_getInfo (ModifierType type); @@ -315,6 +326,10 @@ void modifiers_foreachObjectLink(struct Object *ob, void modifiers_foreachIDLink(struct Object *ob, IDWalkFunc walk, void *userData); +void modifiers_foreachTexLink(struct Object *ob, + TexWalkFunc walk, + void *userData); + struct ModifierData *modifiers_findByType(struct Object *ob, ModifierType type); struct ModifierData *modifiers_findByName(struct Object *ob, const char *name); void modifiers_clearErrors(struct Object *ob); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 51f1cd61e7c..fe26c0ccd2d 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -195,6 +195,18 @@ void modifiers_foreachIDLink(Object *ob, IDWalkFunc walk, void *userData) } } +void modifiers_foreachTexLink(Object *ob, TexWalkFunc walk, void *userData) +{ + ModifierData *md = ob->modifiers.first; + + for (; md; md=md->next) { + ModifierTypeInfo *mti = modifierType_getInfo(md->type); + + if(mti->foreachTexLink) + mti->foreachTexLink(md, ob, walk, userData); + } +} + void modifier_copyData(ModifierData *md, ModifierData *target) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index a0ee047e319..0b46d950950 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -213,4 +213,5 @@ ModifierTypeInfo modifierType_Armature = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 90954fef1c7..c7fa75478f0 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -826,4 +826,5 @@ ModifierTypeInfo modifierType_Array = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 323ed71dd74..277f404f64d 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -150,4 +150,5 @@ ModifierTypeInfo modifierType_Bevel = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 4b4d0124aae..761f8dd0add 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -197,4 +197,5 @@ ModifierTypeInfo modifierType_Boolean = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index e293be5886d..1c56d81a798 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -299,5 +299,6 @@ ModifierTypeInfo modifierType_Build = { /* dependsOnTime */ dependsOnTime, /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL + /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 14b23ba4972..4061128b5ad 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -632,4 +632,5 @@ ModifierTypeInfo modifierType_Cast = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 1d2a6b2f788..f5493162322 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -229,4 +229,5 @@ ModifierTypeInfo modifierType_Cloth = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 83ba8a12163..f4a9ea62ead 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -267,4 +267,5 @@ ModifierTypeInfo modifierType_Collision = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index ecd10250c00..d928c239eac 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -162,4 +162,5 @@ ModifierTypeInfo modifierType_Curve = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index ba9dbfc31ad..e3c39752bd1 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -218,4 +218,5 @@ ModifierTypeInfo modifierType_Decimate = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index e0482e6b3fc..fb7aeacecc8 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -134,6 +134,12 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } +static void foreachTexLink(ModifierData *md, Object *ob, + TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "texture"); +} + static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { DisplaceModifierData *dmd = (DisplaceModifierData*) md; @@ -283,4 +289,5 @@ ModifierTypeInfo modifierType_Displace = { /* dependsOnNormals */ dependsOnNormals, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 8d0aea41b5c..db491742265 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -1311,4 +1311,5 @@ ModifierTypeInfo modifierType_EdgeSplit = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 5da2464ef89..3d01661bc79 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -1037,4 +1037,5 @@ ModifierTypeInfo modifierType_Explode = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 354dc33ffe0..cce288b4ad5 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -162,4 +162,5 @@ ModifierTypeInfo modifierType_Fluidsim = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index ea8d602dd7a..785abc7d4d1 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -289,4 +289,5 @@ ModifierTypeInfo modifierType_Hook = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 694f8fb3e52..31c17fb7376 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -156,4 +156,5 @@ ModifierTypeInfo modifierType_Lattice = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 94442d96367..b7cdac9e246 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -407,4 +407,5 @@ ModifierTypeInfo modifierType_Mask = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 3903f2602e4..8a0e64e7ee4 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -463,4 +463,5 @@ ModifierTypeInfo modifierType_MeshDeform = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index b1c765e5c9b..7cde87b20d9 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -363,4 +363,5 @@ ModifierTypeInfo modifierType_Mirror = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 134574ae6c4..48b1112cad2 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -131,4 +131,5 @@ ModifierTypeInfo modifierType_Multires = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index 48c5b9a4c08..8fed2150a75 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -77,4 +77,5 @@ ModifierTypeInfo modifierType_None = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 46d53e0db15..b0b43e018f7 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -350,4 +350,5 @@ ModifierTypeInfo modifierType_ParticleInstance = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 533bfd203b5..5635ba33d80 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -242,4 +242,5 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 17e350482f0..c5fdf465a0a 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -903,4 +903,5 @@ ModifierTypeInfo modifierType_Screw = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index 94d23de6573..6e55466c1e4 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -148,5 +148,6 @@ ModifierTypeInfo modifierType_ShapeKey = { /* dependsOnTime */ NULL, /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL + /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index e1fc4bc969f..ba25df19b3e 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -186,4 +186,5 @@ ModifierTypeInfo modifierType_Shrinkwrap = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 5efd6cd28ec..b2e3c9532b6 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -385,4 +385,5 @@ ModifierTypeInfo modifierType_SimpleDeform = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index b6203bb3c1d..2e156d82ec6 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -189,4 +189,5 @@ ModifierTypeInfo modifierType_Smoke = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ NULL }; diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 28a31b84ea5..16898a80b53 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -270,4 +270,5 @@ ModifierTypeInfo modifierType_Smooth = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 25996286735..c475328676b 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -87,4 +87,5 @@ ModifierTypeInfo modifierType_Softbody = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 390a780e9e6..0b1fac06e14 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -689,5 +689,6 @@ ModifierTypeInfo modifierType_Solidify = { /* dependsOnTime */ NULL, /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL + /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index f780721ca07..6c825b213b8 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -152,4 +152,6 @@ ModifierTypeInfo modifierType_Subsurf = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; + diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 382358b179e..e30b7f2392d 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -192,4 +192,5 @@ ModifierTypeInfo modifierType_Surface = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 922ae8c1e92..912c14adfdd 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -434,4 +434,5 @@ ModifierTypeInfo modifierType_UVProject = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 2c77b486263..c1c3604d598 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -140,6 +140,11 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u walk(userData, ob, (ID **)&wmd->map_object); } +static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "texture"); +} + static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) { @@ -364,4 +369,5 @@ ModifierTypeInfo modifierType_Warp = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index ca8161fe364..4b5769ff603 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -126,6 +126,12 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } +static void foreachTexLink(ModifierData *md, Object *ob, + TexWalkFunc walk, void *userData) +{ + walk(userData, ob, md, "texture"); +} + static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *UNUSED(scene), Object *UNUSED(ob), @@ -466,4 +472,5 @@ ModifierTypeInfo modifierType_Wave = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, + /* foreachTexLink */ foreachTexLink, }; -- cgit v1.2.3 From ceb9dfbdacb15829bdd82202afdc64a33a9c3c68 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 12 Aug 2011 18:13:55 +0000 Subject: Code cleanup: remove seam drawing in face select mode, was left over from when seams were edited there, now only needed in edit mode. --- source/blender/editors/space_view3d/drawmesh.c | 141 ++++++---------------- source/blender/editors/space_view3d/view3d_draw.c | 1 + 2 files changed, 41 insertions(+), 101 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index f070bae4e54..71c85483244 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -29,7 +29,6 @@ * \ingroup spview3d */ - #include #include @@ -70,24 +69,21 @@ #include "view3d_intern.h" // own include -/***/ +/**************************** Face Select Mode *******************************/ - /* Flags for marked edges */ +/* Flags for marked edges */ enum { eEdge_Visible = (1<<0), eEdge_Select = (1<<1), }; - /* Creates a hash of edges to flags indicating - * adjacent tface select/active/etc flags. - */ +/* Creates a hash of edges to flags indicating selected/visible */ static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flags) { int *flags_p; - if (!BLI_edgehash_haskey(eh, v0, v1)) { + if(!BLI_edgehash_haskey(eh, v0, v1)) BLI_edgehash_insert(eh, v0, v1, NULL); - } flags_p = (int*) BLI_edgehash_lookup_p(eh, v0, v1); *flags_p |= flags; @@ -96,26 +92,25 @@ static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flag static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me) { EdgeHash *eh = BLI_edgehash_new(); - int i; MFace *mf; + int i; - for (i=0; itotface; i++) { + for(i=0; itotface; i++) { mf = &me->mface[i]; - if (mf->v3) { - if (!(mf->flag&ME_HIDE)) { - unsigned int flags = eEdge_Visible; - if (mf->flag&ME_FACE_SEL) flags |= eEdge_Select; - - get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags); - get_marked_edge_info__orFlags(eh, mf->v2, mf->v3, flags); - if (mf->v4) { - get_marked_edge_info__orFlags(eh, mf->v3, mf->v4, flags); - get_marked_edge_info__orFlags(eh, mf->v4, mf->v1, flags); - } else { - get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags); - } + if(!(mf->flag & ME_HIDE)) { + unsigned int flags = eEdge_Visible; + if(mf->flag & ME_FACE_SEL) flags |= eEdge_Select; + + get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags); + get_marked_edge_info__orFlags(eh, mf->v2, mf->v3, flags); + + if(mf->v4) { + get_marked_edge_info__orFlags(eh, mf->v3, mf->v4, flags); + get_marked_edge_info__orFlags(eh, mf->v4, mf->v1, flags); } + else + get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags); } } @@ -123,45 +118,24 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me) } -static int draw_tfaces3D__setHiddenOpts(void *userData, int index) +static int draw_mesh_face_select__setHiddenOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; Mesh *me= data->me; MEdge *med = &me->medge[index]; uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); - if((me->drawflag & ME_DRAWSEAMS) && (med->flag&ME_SEAM)) { - return 0; - } else if(me->drawflag & ME_DRAWEDGES){ - if (me->drawflag & ME_HIDDENEDGES) { + if(me->drawflag & ME_DRAWEDGES) { + if(me->drawflag & ME_HIDDENEDGES) return 1; - } else { - return (flags & eEdge_Visible); - } - } else { - return (flags & eEdge_Select); - } -} - -static int draw_tfaces3D__setSeamOpts(void *userData, int index) -{ - struct { Mesh *me; EdgeHash *eh; } *data = userData; - Mesh *me= data->me; - MEdge *med = &data->me->medge[index]; - uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); - - if (med->flag & ME_SEAM) { - if (me->drawflag & ME_HIDDENEDGES) { - return 1; - } else { + else return (flags & eEdge_Visible); - } - } else { - return 0; } + else + return (flags & eEdge_Select); } -static int draw_tfaces3D__setSelectOpts(void *userData, int index) +static int draw_mesh_face_select__setSelectOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; MEdge *med = &data->me->medge[index]; @@ -170,45 +144,19 @@ static int draw_tfaces3D__setSelectOpts(void *userData, int index) return flags & eEdge_Select; } -#if 0 -static int draw_tfaces3D__setActiveOpts(void *userData, int index) -{ - struct { Mesh *me; EdgeHash *eh; } *data = userData; - MEdge *med = &data->me->medge[index]; - uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2); - - if (flags & eEdge_Select) { - return 1; - } else { - return 0; - } -} - -static int draw_tfaces3D__drawFaceOpts(void *userData, int index) -{ - Mesh *me = (Mesh*)userData; - - MFace *mface = &me->mface[index]; - if (!(mface->flag&ME_HIDE) && (mface->flag&ME_FACE_SEL)) - return 2; /* Don't set color */ - else - return 0; -} -#endif - /* draws unselected */ -static int draw_tfaces3D__drawFaceOptsInv(void *userData, int index) +static int draw_mesh_face_select__drawFaceOptsInv(void *userData, int index) { Mesh *me = (Mesh*)userData; MFace *mface = &me->mface[index]; - if (!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL)) + if(!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL)) return 2; /* Don't set color */ else return 0; } -static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short draw_seams) +static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) { struct { Mesh *me; EdgeHash *eh; } data; @@ -222,30 +170,16 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d /* Draw (Hidden) Edges */ setlinestyle(1); UI_ThemeColor(TH_EDGE_FACESEL); - dm->drawMappedEdges(dm, draw_tfaces3D__setHiddenOpts, &data); + dm->drawMappedEdges(dm, draw_mesh_face_select__setHiddenOpts, &data); setlinestyle(0); - /* Draw Seams */ - if(draw_seams && me->drawflag & ME_DRAWSEAMS) { - UI_ThemeColor(TH_EDGE_SEAM); - glLineWidth(2); - dm->drawMappedEdges(dm, draw_tfaces3D__setSeamOpts, &data); - glLineWidth(1); - } - /* Draw Selected Faces */ if(me->drawflag & ME_DRAWFACES) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -#if 0 - UI_ThemeColor4(TH_FACE_SELECT); - - dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOpts, (void*)me); -#else /* dull unselected faces so as not to get in the way of seeing color */ glColor4ub(96, 96, 96, 64); - dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOptsInv, (void*)me); -#endif + dm->drawMappedFacesTex(dm, draw_mesh_face_select__drawFaceOptsInv, (void*)me); glDisable(GL_BLEND); } @@ -255,7 +189,7 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d /* Draw Stippled Outline for selected faces */ glColor3ub(255, 255, 255); setlinestyle(1); - dm->drawMappedEdges(dm, draw_tfaces3D__setSelectOpts, &data); + dm->drawMappedEdges(dm, draw_mesh_face_select__setSelectOpts, &data); setlinestyle(0); bglPolygonOffset(rv3d->dist, 0.0); // resets correctly now, even after calling accumulated offsets @@ -263,6 +197,8 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d BLI_edgehash_free(data.eh, NULL); } +/***************************** Texture Drawing ******************************/ + static Material *give_current_material_or_def(Object *ob, int matnr) { extern Material defmaterial; // render module abuse... @@ -668,18 +604,21 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o if(ob->mode & OB_MODE_EDIT) { dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh); - } else if(faceselect) { + } + else if(faceselect) { if(ob->mode & OB_MODE_WEIGHT_PAINT) dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material); else dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, me); } else { - if( GPU_buffer_legacy(dm) ) + if(GPU_buffer_legacy(dm)) { dm->drawFacesTex(dm, draw_tface__set_draw_legacy); + } else { - if( !CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL) ) + if(!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL)) add_tface_color_layer(dm); + dm->drawFacesTex(dm, draw_tface__set_draw); } } @@ -692,7 +631,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o /* draw edges and selected faces over textured mesh */ if(!(ob == scene->obedit) && faceselect) - draw_tfaces3D(rv3d, me, dm, ob->mode & OB_MODE_WEIGHT_PAINT); + draw_mesh_face_select(rv3d, me, dm); /* reset from negative scale correction */ glFrontFace(GL_CCW); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 6e3f6549ba3..7cf95261211 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2769,3 +2769,4 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) v3d->flag |= V3D_INVALID_BACKBUF; } + -- cgit v1.2.3 From a7de5fc19153b36782e2bd4348e43225ba2eb22c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 12 Aug 2011 18:17:28 +0000 Subject: Code cleanup: small glsl mesh drawing code changes, getting rid of an ugly macro. --- source/blender/blenkernel/BKE_DerivedMesh.h | 4 +- source/blender/blenkernel/intern/DerivedMesh.c | 3 + source/blender/blenkernel/intern/cdderivedmesh.c | 77 +++++++++++++++--------- source/blender/gpu/GPU_extensions.h | 1 + 4 files changed, 55 insertions(+), 30 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 55ade5fe5d9..46b533f33fd 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -526,7 +526,7 @@ void weight_to_rgb(float input, float *fr, float *fg, float *fb); typedef struct DMVertexAttribs { struct { struct MTFace *array; - int emOffset, glIndex; + int emOffset, glIndex, glTexco; } tface[MAX_MTFACE]; struct { @@ -541,7 +541,7 @@ typedef struct DMVertexAttribs { struct { float (*array)[3]; - int emOffset, glIndex; + int emOffset, glIndex, glTexco; } orco; int tottface, totmcol, tottang, totorco; diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 62b8830de20..c84bcaabbd3 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1050,6 +1050,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, glEnd(); } } +#undef PASSATTRIB } static void emDM_drawFacesGLSL(DerivedMesh *dm, @@ -2767,6 +2768,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, attribs->tface[a].array = tfdata->layers[layer].data; attribs->tface[a].emOffset = tfdata->layers[layer].offset; attribs->tface[a].glIndex = gattribs->layer[b].glindex; + attribs->tface[a].glTexco = gattribs->layer[b].gltexco; } } else if(gattribs->layer[b].type == CD_MCOL) { @@ -2807,6 +2809,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, attribs->orco.array = vdata->layers[layer].data; attribs->orco.emOffset = vdata->layers[layer].offset; attribs->orco.glIndex = gattribs->layer[b].glindex; + attribs->orco.glTexco = gattribs->layer[b].gltexco; } } } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 662c872b7f1..12fb11c68b3 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -993,6 +993,50 @@ static void cdDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, userData); } +static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int a, int index, int vert, int smoothnormal) +{ + int b; + + /* orco texture coordinates */ + if(attribs->totorco) { + if(attribs->orco.glTexco) + glTexCoord3fv(attribs->orco.array[index]); + else + glVertexAttrib3fvARB(attribs->orco.glIndex, attribs->orco.array[index]); + } + + /* uv texture coordinates */ + for(b = 0; b < attribs->tottface; b++) { + MTFace *tf = &attribs->tface[b].array[a]; + + if(attribs->tface[b].glTexco) + glTexCoord2fv(tf->uv[vert]); + else + glVertexAttrib2fvARB(attribs->tface[b].glIndex, tf->uv[vert]); + } + + /* vertex colors */ + for(b = 0; b < attribs->totmcol; b++) { + MCol *cp = &attribs->mcol[b].array[a*4 + vert]; + GLubyte col[4]; + col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; + glVertexAttrib4ubvARB(attribs->mcol[b].glIndex, col); + } + + /* tangent for normal mapping */ + if(attribs->tottang) { + float *tang = attribs->tang.array[a*4 + vert]; + glVertexAttrib4fvARB(attribs->tang.glIndex, tang); + } + + /* vertex normal */ + if(smoothnormal) + glNormal3sv(mvert[index].no); + + /* vertex coordinate */ + glVertex3fv(mvert[index].co); +} + static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; @@ -1083,37 +1127,14 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo } } -#define PASSVERT(index, vert) { \ - if(attribs.totorco) \ - glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \ - for(b = 0; b < attribs.tottface; b++) { \ - MTFace *tf = &attribs.tface[b].array[a]; \ - glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \ - } \ - for(b = 0; b < attribs.totmcol; b++) { \ - MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \ - GLubyte col[4]; \ - col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \ - glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \ - } \ - if(attribs.tottang) { \ - float *tang = attribs.tang.array[a*4 + vert]; \ - glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \ - } \ - if(smoothnormal) \ - glNormal3sv(mvert[index].no); \ - glVertex3fv(mvert[index].co); \ - } + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v1, 0, smoothnormal); + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v2, 1, smoothnormal); + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal); - PASSVERT(mface->v1, 0); - PASSVERT(mface->v2, 1); - PASSVERT(mface->v3, 2); if(mface->v4) - PASSVERT(mface->v4, 3) + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v4, 3, smoothnormal); else - PASSVERT(mface->v3, 2) - -#undef PASSVERT + cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal); } glEnd(); } diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 8bf923a5679..d0c7f9d494f 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -178,6 +178,7 @@ typedef struct GPUVertexAttribs { struct { int type; int glindex; + int gltexco; char name[32]; } layer[GPU_MAX_ATTRIB]; -- cgit v1.2.3 From 0cb606a9bc76488031559e06717d576d5cc66dce Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 12 Aug 2011 18:24:17 +0000 Subject: Code cleanup: fix wrong doxygen file name. --- source/blender/editors/render/render_update.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 98f42fe97c1..b6fb60ac4f7 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -24,7 +24,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/editors/render/render_shading.c +/** \file blender/editors/render/render_update.c * \ingroup edrend */ -- cgit v1.2.3 From a7dd2649406afec5cdd9267c136ca79c92c20fab Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 12 Aug 2011 18:27:48 +0000 Subject: Nodes: make node set active function usable outside of node editor, and in doing so fix a missing updating when activating a node with multiple node editors open. --- source/blender/editors/include/ED_node.h | 6 ++- source/blender/editors/space_node/node_edit.c | 65 ++++++++++++++++--------- source/blender/editors/space_node/node_header.c | 4 +- source/blender/editors/space_node/node_intern.h | 4 +- source/blender/editors/space_node/node_select.c | 9 ++-- 5 files changed, 57 insertions(+), 31 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index dfa457c22de..cc4dd6330fb 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -33,12 +33,14 @@ #ifndef ED_NODE_H #define ED_NODE_H +struct ID; +struct Main; struct Material; struct Scene; struct Tex; struct bContext; struct bNode; -struct ID; +struct bNodeTree; struct ScrArea; /* drawnode.c */ @@ -55,6 +57,8 @@ void ED_node_texture_default(struct Tex *tex); void ED_node_link_intersect_test(struct ScrArea *sa, int test); void ED_node_link_insert(struct ScrArea *sa); +void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); + /* node ops.c */ void ED_operatormacros_node(void); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index c719f749582..984e944321e 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -479,72 +479,88 @@ static void snode_tag_changed(SpaceNode *snode, bNode *node) NodeTagIDChanged(snode->nodetree, gnode->id); } -void node_set_active(SpaceNode *snode, bNode *node) +static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) { - nodeSetActive(snode->edittree, node); + bNode *node; + + if(ntree == lookup) + return 1; + + for(node=ntree->nodes.first; node; node=node->next) + if(node->type == NODE_GROUP && node->id) + if(has_nodetree((bNodeTree*)node->id, lookup)) + return 1; + + return 0; +} + +void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) +{ + nodeSetActive(ntree, node); if(node->type!=NODE_GROUP) { int was_output= (node->flag & NODE_DO_OUTPUT); /* tree specific activate calls */ - if(snode->treetype==NTREE_SHADER) { + if(ntree->type==NTREE_SHADER) { /* when we select a material, active texture is cleared, for buttons */ if(node->id && GS(node->id->name)==ID_MA) - nodeClearActiveID(snode->edittree, ID_TE); + nodeClearActiveID(ntree, ID_TE); if(node->type==SH_NODE_OUTPUT) { bNode *tnode; - for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) if( tnode->type==SH_NODE_OUTPUT) tnode->flag &= ~NODE_DO_OUTPUT; node->flag |= NODE_DO_OUTPUT; if(was_output==0) - ED_node_changed_update(snode->id, node); + ED_node_generic_update(bmain, ntree, node); } WM_main_add_notifier(NC_MATERIAL|ND_NODES, node->id); } - else if(snode->treetype==NTREE_COMPOSIT) { - Scene *scene= (Scene*)snode->id; - + else if(ntree->type==NTREE_COMPOSIT) { /* make active viewer, currently only 1 supported... */ if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { bNode *tnode; - for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) if( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) tnode->flag &= ~NODE_DO_OUTPUT; node->flag |= NODE_DO_OUTPUT; - if(was_output==0) { - snode_tag_changed(snode, node); - - ED_node_changed_update(snode->id, node); - } + if(was_output==0) + ED_node_generic_update(bmain, ntree, node); /* addnode() doesnt link this yet... */ node->id= (ID *)BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node"); } else if(node->type==CMP_NODE_R_LAYERS) { - if(node->id==NULL || node->id==(ID *)scene) { - scene->r.actlay= node->custom1; + Scene *scene; + + for(scene=bmain->scene.first; scene; scene=scene->id.next) { + if(scene->nodetree && scene->use_nodes && has_nodetree(scene->nodetree, ntree)) { + if(node->id==NULL || node->id==(ID *)scene) { + scene->r.actlay= node->custom1; + } + } } } else if(node->type==CMP_NODE_COMPOSITE) { bNode *tnode; - for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) if( tnode->type==CMP_NODE_COMPOSITE) tnode->flag &= ~NODE_DO_OUTPUT; node->flag |= NODE_DO_OUTPUT; - ED_node_changed_update(snode->id, node); + ED_node_generic_update(bmain, ntree, node); } } - else if(snode->treetype==NTREE_TEXTURE) { + else if(ntree->type==NTREE_TEXTURE) { // XXX #if 0 if(node->id) @@ -1940,7 +1956,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace) } /* can be called from menus too, but they should do own undopush and redraws */ -bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float locy) +bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, int type, float locx, float locy) { bNode *node= NULL, *gnode; @@ -1955,7 +1971,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float return NULL; } else { - bNodeTree *ngroup= BLI_findlink(&G.main->nodetree, type-NODE_GROUP_MENU); + bNodeTree *ngroup= BLI_findlink(&bmain->nodetree, type-NODE_GROUP_MENU); if(ngroup) node= nodeAddNodeType(snode->edittree, NODE_GROUP, ngroup, NULL); } @@ -1976,7 +1992,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float } node_tree_verify_groups(snode->nodetree); - node_set_active(snode, node); + ED_node_set_active(bmain, snode->edittree, node); if(snode->nodetree->type==NTREE_COMPOSIT) { if(ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) @@ -3205,6 +3221,7 @@ void NODE_OT_show_cyclic_dependencies(wmOperatorType *ot) static int node_add_file_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -3245,7 +3262,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(C); - node = node_add_node(snode, scene, ntype, snode->mx, snode->my); + node = node_add_node(snode, bmain, scene, ntype, snode->mx, snode->my); if (!node) { BKE_report(op->reports, RPT_WARNING, "Could not add an image node."); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 4f3991e8ff8..634e49dc515 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -64,6 +64,8 @@ static void do_node_add(bContext *C, void *UNUSED(arg), int event) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); SpaceNode *snode= CTX_wm_space_node(C); ScrArea *sa= CTX_wm_area(C); ARegion *ar; @@ -87,7 +89,7 @@ static void do_node_add(bContext *C, void *UNUSED(arg), int event) else node->flag &= ~NODE_TEST; } - node= node_add_node(snode, CTX_data_scene(C), event, snode->mx, snode->my); + node= node_add_node(snode, bmain, scene, event, snode->mx, snode->my); /* select previous selection before autoconnect */ for(node= snode->edittree->nodes.first; node; node= node->next) { diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 9122235f33c..4cfde22b8a0 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -43,6 +43,7 @@ struct wmWindowManager; struct bNode; struct bNodeSocket; struct bNodeLink; +struct Main; /* temp data to pass on to modal */ typedef struct bNodeLinkDrag @@ -97,10 +98,9 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre void snode_notify(bContext *C, SpaceNode *snode); void snode_dag_update(bContext *C, SpaceNode *snode); bNode *next_node(bNodeTree *ntree); -bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float locy); +bNode *node_add_node(SpaceNode *snode, struct Main *bmain, Scene *scene, int type, float locx, float locy); void snode_set_context(SpaceNode *snode, Scene *scene); void snode_make_group_editable(SpaceNode *snode, bNode *gnode); -void node_set_active(SpaceNode *snode, bNode *node); void node_deselectall(SpaceNode *snode); int node_select_same_type(SpaceNode *snode); int node_select_same_type_np(SpaceNode *snode, int dir); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 1abcaccc939..ca673277739 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -37,10 +37,12 @@ #include "DNA_scene_types.h" #include "BKE_context.h" +#include "BKE_main.h" #include "BLI_rect.h" #include "BLI_utildefines.h" +#include "ED_node.h" #include "ED_screen.h" #include "ED_types.h" @@ -70,7 +72,7 @@ static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my) /* ****** Click Select ****** */ -static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2], short extend) +static bNode *node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const int mval[2], short extend) { bNode *node; float mx, my; @@ -92,7 +94,7 @@ static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2] else node->flag ^= SELECT; - node_set_active(snode, node); + ED_node_set_active(bmain, snode->edittree, node); } return node; @@ -100,6 +102,7 @@ static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2] static int node_select_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); int mval[2]; @@ -113,7 +116,7 @@ static int node_select_exec(bContext *C, wmOperator *op) extend = RNA_boolean_get(op->ptr, "extend"); /* perform the select */ - node= node_mouse_select(snode, ar, mval, extend); + node= node_mouse_select(bmain, snode, ar, mval, extend); /* send notifiers */ WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); -- cgit v1.2.3 From 7c7fac21740752edf11b9b602a520d7d2fb4c785 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 13 Aug 2011 09:22:14 +0000 Subject: index_to_framebuffer (used for mesh selection) was being called 3x times per call to WM_set_framebuffer_index_color(), because of the cpack define. --- source/blender/windowmanager/intern/wm_subwindow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index a87001fb1b4..8ea1f2fdd0a 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -378,7 +378,8 @@ unsigned int index_to_framebuffer(int index) void WM_set_framebuffer_index_color(int index) { - cpack(index_to_framebuffer(index)); + const int col= index_to_framebuffer(index); + cpack(col); } int WM_framebuffer_to_index(unsigned int col) -- cgit v1.2.3 From 7866b6329288213aaa1a259972b82d5754621f1f Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 13 Aug 2011 13:45:03 +0000 Subject: 2.6 Release Cycle begin: *BLENDER_VERSION_CYCLE set to alpha Idea is to set it to alpha for the first 3 weeks (B-Con1) Beta for B-Con 2 and 3 RC for B-Con 4 Release for B-Con 5 --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 88dad03db1e..162b0de1d5a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -53,7 +53,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE release +#define BLENDER_VERSION_CYCLE alpha struct ListBase; struct MemFile; -- cgit v1.2.3 From c83417b2e2b768f2d10e503b804bb423442f1884 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 13 Aug 2011 14:24:53 +0000 Subject: running bpy.ops.render.render('INVOKE_DEFAULT') would crash blender. --- source/blender/editors/space_console/console_ops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 3effea296d7..4707baa279b 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -675,7 +675,12 @@ static int scrollback_append_exec(bContext *C, wmOperator *op) console_scrollback_limit(sc); - console_textview_update_rect(sc, ar); + /* 'ar' can be null depending on the operator that runs + * rendering with invoke default for eg causes this */ + if(ar) { + console_textview_update_rect(sc, ar); + } + ED_area_tag_redraw(CTX_wm_area(C)); return OPERATOR_FINISHED; -- cgit v1.2.3 From fc128c970b0e6617cbc67d504d3f4f07c4ae45fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 03:59:22 +0000 Subject: - recently restored sequencer change data operator didnt reset the offsets after a hard cut, causing the new data to be trimmed. - add change data operator to strip panel next to image file properties since editing every image manually isnt really usable. - added new sequencer operator "Clear Offsets" (Alt+O), useful to reset the start/end frames around the strip data. --- .../editors/space_sequencer/sequencer_edit.c | 55 ++++++++++++++++++++++ .../editors/space_sequencer/sequencer_intern.h | 1 + .../editors/space_sequencer/sequencer_ops.c | 3 ++ 3 files changed, 59 insertions(+) (limited to 'source') diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index a58bec9eeb9..447426aed13 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1569,6 +1569,58 @@ void SEQUENCER_OT_delete(wmOperatorType *ot) } +/* offset clear operator */ +static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene= CTX_data_scene(C); + Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq; + + /* for effects, try to find a replacement input */ + for(seq=ed->seqbasep->first; seq; seq=seq->next) { + if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) { + seq->startofs= seq->endofs= seq->startstill= seq->endstill= 0; + } + } + + /* updates lengths etc */ + seq= ed->seqbasep->first; + while(seq) { + calc_sequence(scene, seq); + seq= seq->next; + } + + for(seq=ed->seqbasep->first; seq; seq=seq->next) { + if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) { + if(seq_test_overlap(ed->seqbasep, seq)) { + shuffle_seq(ed->seqbasep, seq, scene); + } + } + } + + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + + +void SEQUENCER_OT_offset_clear(wmOperatorType *ot) +{ + + /* identifiers */ + ot->name= "Clear Strip Offset"; + ot->idname= "SEQUENCER_OT_offset_clear"; + ot->description="Clear strip offsets from the start and end frames"; + + /* api callbacks */ + ot->exec= sequencer_offset_clear_exec; + ot->poll= sequencer_edit_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + + /* separate_images operator */ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) { @@ -2803,6 +2855,9 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) } RNA_END; + /* reset these else we wont see all the images */ + seq->anim_startofs= seq->anim_endofs= 0; + /* correct start/end frames so we dont move * important not to set seq->len= len; allow the function to handle it */ reload_sequence_new_file(scene, seq, TRUE); diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 6eef2bb8361..7ab76f9b6d7 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -93,6 +93,7 @@ void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot); void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot); void SEQUENCER_OT_duplicate(struct wmOperatorType *ot); void SEQUENCER_OT_delete(struct wmOperatorType *ot); +void SEQUENCER_OT_offset_clear(struct wmOperatorType *ot); void SEQUENCER_OT_images_separate(struct wmOperatorType *ot); void SEQUENCER_OT_meta_toggle(struct wmOperatorType *ot); void SEQUENCER_OT_meta_make(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index ebf400ad5ff..df33ce73b9c 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -68,6 +68,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_swap_inputs); WM_operatortype_append(SEQUENCER_OT_duplicate); WM_operatortype_append(SEQUENCER_OT_delete); + WM_operatortype_append(SEQUENCER_OT_offset_clear); WM_operatortype_append(SEQUENCER_OT_images_separate); WM_operatortype_append(SEQUENCER_OT_meta_toggle); WM_operatortype_append(SEQUENCER_OT_meta_make); @@ -149,6 +150,8 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", XKEY, KM_PRESS, 0, 0); -- cgit v1.2.3 From 5e968e36c5e0a18c38b064761a4b96dc282cde69 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sun, 14 Aug 2011 04:37:53 +0000 Subject: bugfix:[#25603] bad shadows in stereo mode - patch by Juha Maki-Kanto --- source/gameengine/Ketsji/KX_Light.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source') diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index 49f00e39110..3f09eee013e 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -254,8 +254,12 @@ void KX_LightObject::BindShadowBuffer(RAS_IRasterizer *ras, KX_Camera *cam, MT_T cam->NodeUpdateGS(0); /* setup rasterizer transformations */ + /* SetViewMatrix may use stereomode which we temporarily disable here */ + RAS_IRasterizer::StereoMode stereomode = ras->GetStereoMode(); + ras->SetStereoMode(RAS_IRasterizer::RAS_STEREO_NOSTEREO); ras->SetProjectionMatrix(projectionmat); ras->SetViewMatrix(modelviewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); + ras->SetStereoMode(stereomode); } void KX_LightObject::UnbindShadowBuffer(RAS_IRasterizer *ras) -- cgit v1.2.3 From 0b23d378fbac8e76d4885c3485a4dbf158aab136 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 06:43:58 +0000 Subject: fix [#28225] Solidify Modifier creates wrong results when vertex group is attached infact this is not really a bug, irrespective zero vertex group weights gave overlapping geometry which isn't useful, add an option to set the thickness factor for zero weighted verts. --- source/blender/makesdna/DNA_modifier_types.h | 4 ++-- source/blender/makesrna/intern/rna_modifier.c | 7 +++++++ source/blender/modifiers/intern/MOD_solidify.c | 26 ++++++++++++++++++-------- 3 files changed, 27 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 3787675f339..053f3b38168 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -712,16 +712,16 @@ typedef struct ShapeKeyModifierData { typedef struct SolidifyModifierData { ModifierData modifier; - char defgrp_name[32]; /* name of vertex group to use */ + char defgrp_name[32]; /* name of vertex group to use */ float offset; /* new surface offset level*/ float offset_fac; /* midpoint of the offset */ + float offset_fac_vg; /* factor for the minimum weight to use when vgroups are used, avoids 0.0 weights giving duplicate geometry */ float crease_inner; float crease_outer; float crease_rim; int flag; short mat_ofs; short mat_ofs_rim; - int pad; } SolidifyModifierData; #define MOD_SOLIDIFY_RIM (1<<0) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index ba655915fb6..5c5391b0bba 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2265,6 +2265,13 @@ static void rna_def_modifier_solidify(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg"); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_range(prop, 0, 1, 0.1, 3); + RNA_def_property_ui_text(prop, "Vertex Group Factor", "Thickness factor to use for zero vertex group influence"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "offset_fac"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 0b1fac06e14..afe6da8b38a 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -232,8 +232,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, float (*vert_nors)[3]= NULL; - float const ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); - float const ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + const float ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + const float ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + const float offset_fac_vg= smd->offset_fac_vg; + const float offset_fac_vg_inv= 1.0f - smd->offset_fac_vg; /* weights */ MDeformVert *dvert, *dv= NULL; @@ -391,8 +393,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, dv= dvert; for(i=0; ico, mv->co, mv->no, scalar_short_vgroup); @@ -405,8 +408,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, dv= dvert; for(i=0; ico, mv->co, mv->no, scalar_short_vgroup); @@ -466,15 +470,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* vertex group support */ if(dvert) { + float scalar; + dv= dvert; if(defgrp_invert) { for(i=0; i Date: Sun, 14 Aug 2011 08:39:13 +0000 Subject: patch [#28246] Fix for [#28240]: selecting more than one object in the outliner with "shift left mouse" doesn't work anymore from Alex Fraser (z0r) --- source/blender/editors/space_outliner/outliner_select.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index c571fa1de6c..620a936a944 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -660,8 +660,8 @@ int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement { switch(te->idcode) { - case ID_OB: - return tree_element_set_active_object(C, scene, soops, te, set); + /* Note: no ID_OB: objects are handled specially to allow multiple + selection. See do_outliner_item_activate. */ case ID_MA: return tree_element_active_material(C, scene, soops, te, set); case ID_WO: -- cgit v1.2.3 From 62fdee3d8ae7ea37ed42fc655058c2bf03b38be8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 10:17:41 +0000 Subject: fix [#28245] Checkboxes in menu items fail for boolean arrays. 2 bugs with displaying boolean arrays. --- .../blender/editors/interface/interface_layout.c | 102 +++++++++++++-------- 1 file changed, 62 insertions(+), 40 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index df654cf3645..a8e0ca39c58 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -355,46 +355,65 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* create buttons */ - if(type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) { - /* special check for layer layout */ - int butw, buth, unit; - int cols= (len >= 20)? 2: 1; - int colbuts= len/(2*cols); - int layer_used= 0; - - uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 0)); - - unit= UI_UNIT_X*0.75; - butw= unit; - buth= unit; - - if(ptr->type == &RNA_Armature) { - bArmature *arm= (bArmature *)ptr->data; - layer_used= arm->layer_used; + if(type == PROP_BOOLEAN) { + if(ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) { + /* special check for layer layout */ + int butw, buth, unit; + int cols= (len >= 20)? 2: 1; + int colbuts= len/(2*cols); + int layer_used= 0; + + uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 0)); + + unit= UI_UNIT_X*0.75; + butw= unit; + buth= unit; + + if(ptr->type == &RNA_Armature) { + bArmature *arm= (bArmature *)ptr->data; + layer_used= arm->layer_used; + } + + for(b=0; bbuttonspacex; + } } + else { + /* not common, but good to support non layer boolean arrays */ + int *tmparray= MEM_callocN(sizeof(int)*len, "ui_item_array"); + RNA_property_boolean_get_array(ptr, prop, tmparray); - for(b=0; bbuttonspacex; + MEM_freeN(tmparray); + + uiBlockEndAlign(block); } } else if(subtype == PROP_MATRIX) { @@ -951,13 +970,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index uiBut *but; PropertyType type; char namestr[UI_MAX_NAME_STR]; - int len, w, h, slider, toggle, expand, icon_only, no_bg; + int len, is_array, w, h, slider, toggle, expand, icon_only, no_bg; uiBlockSetCurLayout(block, layout); /* retrieve info */ type= RNA_property_type(prop); - len= RNA_property_array_length(ptr, prop); + is_array= RNA_property_array_check(ptr, prop); + len= (is_array) ? RNA_property_array_length(ptr, prop) : 0; /* set name and icon */ if(!name) @@ -967,14 +987,16 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER)) name= ui_item_name_add_colon(name, namestr); - else if(type == PROP_BOOLEAN && len && index == RNA_NO_INDEX) + else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX) name= ui_item_name_add_colon(name, namestr); else if(type == PROP_ENUM && index != RNA_ENUM_VALUE) name= ui_item_name_add_colon(name, namestr); if(layout->root->type == UI_LAYOUT_MENU) { - if(type == PROP_BOOLEAN) - icon= (RNA_property_boolean_get(ptr, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; + if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) { + if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; + else icon= (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; + } else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) { int enum_value= RNA_property_enum_get(ptr, prop); if(RNA_property_flag(prop) & PROP_ENUM_FLAG) { @@ -999,7 +1021,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index uiBlockSetEmboss(block, UI_EMBOSSN); /* array property */ - if(index == RNA_NO_INDEX && len > 0) + if(index == RNA_NO_INDEX && is_array) ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only); /* enum item */ else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) { -- cgit v1.2.3 From 540f0c64b5d42186119a1e1ccdd9aac7edd13960 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 10:28:18 +0000 Subject: add in asserts for when array/non array RNA funcions are used incorrectly, would have made previous fix a lot easier to find. also remove unused argument from RNA_property_array_check. --- source/blender/blenkernel/intern/fcurve.c | 2 +- source/blender/blenkernel/intern/node.c | 4 +-- source/blender/editors/armature/poseSlide.c | 2 +- .../blender/editors/interface/interface_layout.c | 2 +- source/blender/editors/interface/interface_utils.c | 2 +- source/blender/makesrna/RNA_access.h | 2 +- source/blender/makesrna/intern/rna_access.c | 31 +++++++++++++++++++--- source/blender/python/intern/bpy_rna.c | 10 +++---- source/blender/python/intern/bpy_rna_anim.c | 2 +- 9 files changed, 41 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index d6a9d950015..13e13fbc3ff 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1002,7 +1002,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar) /* get property to read from, and get value as appropriate */ if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) { - if(RNA_property_array_check(&ptr, prop)) { + if(RNA_property_array_check(prop)) { /* array */ if (index < RNA_property_array_length(&ptr, prop)) { switch (RNA_property_type(prop)) { diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 13469e0b58b..5f1a6c911bc 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3243,7 +3243,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) int driven, len=1, index; prop = (PropertyRNA *)link; - if (RNA_property_array_check(&ptr, prop)) + if (RNA_property_array_check(prop)) len = RNA_property_array_length(&ptr, prop); for (index=0; indexrna_path, &ptr, &prop)) { - if (RNA_property_array_check(&ptr, prop)) { + if (RNA_property_array_check(prop)) { /* array */ if (fcu->array_index < RNA_property_array_length(&ptr, prop)) { found= TRUE; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index a8e0ca39c58..e6df6a07d52 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -976,7 +976,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index /* retrieve info */ type= RNA_property_type(prop); - is_array= RNA_property_array_check(ptr, prop); + is_array= RNA_property_array_check(prop); len= (is_array) ? RNA_property_array_length(ptr, prop) : 0; /* set name and icon */ diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index f660dbb9edd..a3f56192cb5 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -143,7 +143,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper if(label_align != '\0') { PropertyType type = RNA_property_type(prop); - int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(ptr, prop)); + int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop)); name= RNA_property_ui_name(prop); diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 0033a1ff437..81deb0c2796 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -654,7 +654,7 @@ int RNA_property_flag(PropertyRNA *prop); void *RNA_property_py_data_get(PropertyRNA *prop); int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop); +int RNA_property_array_check(PropertyRNA *prop); int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dimension); int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[]); char RNA_property_array_item_char(PropertyRNA *prop, int index); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index f1056c86a4c..f100ebd6129 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -288,7 +288,7 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop) } } -static int rna_ensure_property_array_check(PointerRNA *UNUSED(ptr), PropertyRNA *prop) +static int rna_ensure_property_array_check(PropertyRNA *prop) { if(prop->magic == RNA_MAGIC) { return (prop->getlength || prop->totarraylength) ? 1:0; @@ -765,9 +765,9 @@ int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop) return rna_ensure_property_array_length(ptr, prop); } -int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop) +int RNA_property_array_check(PropertyRNA *prop) { - return rna_ensure_property_array_check(ptr, prop); + return rna_ensure_property_array_check(prop); } /* used by BPY to make an array from the python object */ @@ -1399,6 +1399,7 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); @@ -1414,6 +1415,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); /* just incase other values are passed */ if(value) value= 1; @@ -1440,6 +1442,7 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1463,6 +1466,7 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); @@ -1486,6 +1490,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1519,6 +1524,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); @@ -1541,6 +1547,7 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) == 0); return bprop->defaultvalue; } @@ -1550,6 +1557,7 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= bprop->defaultvalue; @@ -1565,6 +1573,7 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_default_array(ptr, prop, tmp); @@ -1588,6 +1597,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); @@ -1603,6 +1613,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) == 0); /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */ @@ -1628,6 +1639,7 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1688,6 +1700,7 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); @@ -1711,6 +1724,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1744,6 +1758,7 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); @@ -1772,6 +1787,7 @@ void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *pr IntPropertyRNA *iprop= (IntPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= iprop->defaultvalue; @@ -1808,6 +1824,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(idprop->type == IDP_FLOAT) @@ -1827,6 +1844,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */ @@ -1858,6 +1876,7 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val int i; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) @@ -1923,6 +1942,7 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); @@ -1948,6 +1968,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa int i; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) { @@ -1991,6 +2012,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); @@ -2013,6 +2035,7 @@ float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) == 0); return fprop->defaultvalue; } @@ -2022,6 +2045,7 @@ void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA * FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(prop->arraydimension == 0) values[0]= fprop->defaultvalue; @@ -2037,6 +2061,7 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int len= rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + BLI_assert(RNA_property_array_check(prop) != 0); if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_default_array(ptr, prop, tmp); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4447a0476f4..ba8145c2773 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -856,7 +856,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) if(type==PROP_COLLECTION) { len= pyrna_prop_collection_length(self); } - else if (RNA_property_array_check(&self->ptr, self->prop)) { + else if (RNA_property_array_check(self->prop)) { len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self); } @@ -1224,7 +1224,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) PyObject *ret; int type= RNA_property_type(prop); - if (RNA_property_array_check(ptr, prop)) { + if (RNA_property_array_check(prop)) { return pyrna_py_from_array(ptr, prop); } @@ -1369,7 +1369,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb int type= RNA_property_type(prop); - if (RNA_property_array_check(ptr, prop)) { + if (RNA_property_array_check(prop)) { /* done getting the length */ if(pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) { return -1; @@ -4088,7 +4088,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat int type= RNA_property_type(prop); int flag= RNA_property_flag(prop); - if(RNA_property_array_check(ptr, prop)) { + if(RNA_property_array_check(prop)) { int a, len; if (flag & PROP_DYNAMIC) { @@ -5519,7 +5519,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop) { BPy_PropertyRNA *pyrna; - if (RNA_property_array_check(ptr, prop) == 0) { + if (RNA_property_array_check(prop) == 0) { PyTypeObject *type; if (RNA_property_type(prop) != PROP_COLLECTION) { diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 30d83e196ba..8bde1db96ca 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -107,7 +107,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi return -1; } - if(RNA_property_array_check(&r_ptr, prop) == 0) { + if(RNA_property_array_check(prop) == 0) { if((*index) == -1) { *index= 0; } -- cgit v1.2.3 From cad6ed9bc600e9162cdad2410e405fc7ad716e2e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 11:38:17 +0000 Subject: fix for fix r39388, this added checkboxes to buttons which are not supposed to have them. now only add checkboxes when the background is not emboss - which works for menus but will work in more general cases too. --- .../blender/editors/interface/interface_intern.h | 5 +- .../blender/editors/interface/interface_layout.c | 130 ++++++++++----------- 2 files changed, 64 insertions(+), 71 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 8475090b468..242210e01bb 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -213,7 +213,7 @@ struct uiBut { BIFIconID icon; char lock; - char dt; + char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied from the block */ char changed; /* could be made into a single flag */ unsigned char unit_type; /* so buttons can support unit systems which are not RNA */ short modifier_key; @@ -306,7 +306,8 @@ struct uiBlock { void *drawextra_arg2; int flag; - char direction, dt; + char direction; + char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */ short auto_open; double auto_open_last; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e6df6a07d52..4810b3fdf54 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -355,65 +355,46 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* create buttons */ - if(type == PROP_BOOLEAN) { - if(ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) { - /* special check for layer layout */ - int butw, buth, unit; - int cols= (len >= 20)? 2: 1; - int colbuts= len/(2*cols); - int layer_used= 0; - - uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 0)); - - unit= UI_UNIT_X*0.75; - butw= unit; - buth= unit; - - if(ptr->type == &RNA_Armature) { - bArmature *arm= (bArmature *)ptr->data; - layer_used= arm->layer_used; - } - - for(b=0; bbuttonspacex; - } + if(type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) { + /* special check for layer layout */ + int butw, buth, unit; + int cols= (len >= 20)? 2: 1; + int colbuts= len/(2*cols); + int layer_used= 0; + + uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 0)); + + unit= UI_UNIT_X*0.75; + butw= unit; + buth= unit; + + if(ptr->type == &RNA_Armature) { + bArmature *arm= (bArmature *)ptr->data; + layer_used= arm->layer_used; } - else { - /* not common, but good to support non layer boolean arrays */ - int *tmparray= MEM_callocN(sizeof(int)*len, "ui_item_array"); - RNA_property_boolean_get_array(ptr, prop, tmparray); + for(b=0; bbuttonspacex; } } else if(subtype == PROP_MATRIX) { @@ -441,35 +422,46 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X*3, UI_UNIT_Y*3, ptr, prop, 0, 0, 0, -1, -1, NULL); } else { - if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) + /* note, this block of code is a bit arbitrary and has just been made + * to work with common cases, but may need to be re-worked */ + + /* special case, boolean array in a menu, this could be used in a more generic way too */ + if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) { uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y); + } + else { + int *boolarr= NULL; - if(!ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) || expand) { - /* layout for known array subtypes */ - char str[3]; + /* even if 'expand' is fale, expanding anyway */ - for(a=0; aroot->block->dt, UI_EMBOSSN, UI_EMBOSSP)) { + boolarr= MEM_callocN(sizeof(int)*len, "ui_item_array"); + RNA_property_boolean_get_array(ptr, prop, boolarr); + } + for(a=0; atype==NUM) but->type= NUMSLI; if(toggle && but->type==OPTION) but->type= TOG; } + + if(boolarr) { + MEM_freeN(boolarr); + } } } -- cgit v1.2.3 From 181104261d8b1d95744ebdf731a93646b6326aed Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 12:02:01 +0000 Subject: patch [#28247] Fix for: [#28236] Separate By Materials fails when some materials "available" to the mesh are unassigned from Alex Fraser (z0r) --- source/blender/editors/mesh/editmesh.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index ec08bfccda3..4377fb03632 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -1449,9 +1449,8 @@ static int mesh_separate_material(wmOperator *op, Main *bmain, Scene *scene, Bas /* select the material */ EM_select_by_material(em, curr_mat); /* and now separate */ - if(0==mesh_separate_selected(op, bmain, scene, editbase)) { - BKE_mesh_end_editmesh(me, em); - return 0; + if(em->totfacesel > 0) { + mesh_separate_selected(op, bmain, scene, editbase); } } -- cgit v1.2.3 From 02b24e655bdb2de67987c0332c78f16d0f557e48 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 14 Aug 2011 14:43:11 +0000 Subject: fix for bug where changing movie filepaths would reset the strip length. also fixed possible & unlikely buffer overflow. --- source/blender/blenkernel/intern/sequencer.c | 1 + source/blender/editors/space_sequencer/sequencer_edit.c | 5 ++++- source/blender/imbuf/intern/anim_movie.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index d6a152a5280..3aebbea789f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -699,6 +699,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) seq->len = 0; } seq->strip->len = seq->len; + break; case SEQ_SOUND: #ifdef WITH_AUDASPACE if(!seq->sound) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 447426aed13..ee5eb12f858 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2870,12 +2870,15 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) else { /* lame, set rna filepath */ PointerRNA seq_ptr; + PropertyRNA *prop; char filepath[FILE_MAX]; RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr); RNA_string_get(op->ptr, "filepath", filepath); - RNA_string_set(&seq_ptr, "filepath", filepath); + prop= RNA_struct_find_property(&seq_ptr, "filepath"); + RNA_property_string_set(&seq_ptr, prop, filepath); + RNA_property_update(C, &seq_ptr, prop); } WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 919b0eb0c29..8b0104fcdca 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -355,7 +355,7 @@ struct anim * IMB_open_anim( const char * name, int ib_flags) { anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct"); if (anim != NULL) { - strcpy(anim->name, name); /* fixme: possible buffer overflow here? */ + BLI_strncpy(anim->name, name, sizeof(anim->name)); anim->ib_flags = ib_flags; } return(anim); -- cgit v1.2.3 From 2c8e1e633c402e677e3f49e8a9c429f59ef6f239 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Aug 2011 03:41:31 +0000 Subject: comment unused lines. --- source/blender/blenlib/intern/BLI_ghash.c | 4 ++-- source/blender/editors/interface/interface_regions.c | 6 +++--- source/blender/makesrna/RNA_types.h | 2 +- source/blender/makesrna/intern/rna_access.c | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 3c6a20b8ad6..bfee350037a 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -128,8 +128,8 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr if (valfreefp) valfreefp(e->val); BLI_mempool_free(gh->entrypool, e); - - e= n; + /* correct but 'e' isnt used before return */ + /* e= n; */ /*UNUSED*/ if (p) p->next = n; else diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index f7460e77030..8bce27e366b 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1188,7 +1188,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, uiBut *bt; uiSafetyRct *saferct; rctf butrct; - float aspect; + /*float aspect;*/ /*UNUSED*/ int xsize, ysize, xof=0, yof=0, center; short dir1= 0, dir2=0; @@ -1223,7 +1223,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, } } - aspect= (float)(block->maxx - block->minx + 4); + /*aspect= (float)(block->maxx - block->minx + 4);*/ /*UNUSED*/ ui_block_to_window_fl(butregion, but->block, &block->minx, &block->miny); ui_block_to_window_fl(butregion, but->block, &block->maxx, &block->maxy); @@ -1232,7 +1232,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, xsize= block->maxx - block->minx+4; // 4 for shadow ysize= block->maxy - block->miny+4; - aspect/= (float)xsize; + /*aspect/= (float)xsize;*/ /*UNUSED*/ if(but) { int left=0, right=0, top=0, down=0; diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index ec213d6a496..f8199074f27 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -281,7 +281,7 @@ typedef struct ParameterList { typedef struct ParameterIterator { struct ParameterList *parms; - PointerRNA funcptr; + /* PointerRNA funcptr; */ /*UNUSED*/ void *data; int size, offset; diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index f100ebd6129..88447f6dd77 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4509,7 +4509,8 @@ int RNA_parameter_list_ret_count(ParameterList *parms) void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter) { - RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); + /* may be useful but unused now */ + /* RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); */ /*UNUSED*/ iter->parms= parms; iter->parm= parms->func->cont.properties.first; -- cgit v1.2.3 From e4f2234fffff40afa7f74dc33b5e0f8ad1a7d78f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Aug 2011 04:11:55 +0000 Subject: workaround [#28250] Append dialogue will ask to create new directory inside a .blend directory button isnt library aware, for now disable it when a libraries loaded. --- source/blender/editors/space_file/file_ops.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index d4253495e97..4dd97c63d40 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1159,6 +1159,13 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused)) return OPERATOR_FINISHED; } +/* TODO, directory operator is non-functional while a library is loaded + * until this is properly supported just disable it. */ +static int file_directory_poll(bContext *C) +{ + return ED_operator_file_active(C) && filelist_lib(CTX_wm_space_file(C)->files) == NULL; +} + void FILE_OT_directory(struct wmOperatorType *ot) { /* identifiers */ @@ -1169,7 +1176,7 @@ void FILE_OT_directory(struct wmOperatorType *ot) /* api callbacks */ ot->invoke= file_directory_invoke; ot->exec= file_directory_exec; - ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ + ot->poll= file_directory_poll; /* <- important, handler is on window level */ } void FILE_OT_refresh(struct wmOperatorType *ot) -- cgit v1.2.3 From 270ed82c7b1a6e10f80e00ede354dd16b3dd635d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 15 Aug 2011 10:03:17 +0000 Subject: Fix #28202: deactivating keymap items not saving properly. --- source/blender/makesrna/intern/rna_wm.c | 1 + source/blender/windowmanager/intern/wm_keymap.c | 3 +++ 2 files changed, 4 insertions(+) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 307cf0e175a..93adf808f83 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1746,6 +1746,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE); RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item"); RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1); + RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 2dfe4d8ccdc..6887aa4c717 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -106,6 +106,9 @@ static int wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b) (a->ptr && b->ptr && IDP_EqualsProperties(a->ptr->data, b->ptr->data)))) return 0; + if((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE)) + return 0; + return (a->propvalue == b->propvalue); } -- cgit v1.2.3 From 470b39608a33924da27a584d68c8945d28b8f4fe Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 15 Aug 2011 12:07:52 +0000 Subject: Fix #27803: editing texture did not update compositing nodes using that texture. --- source/blender/editors/render/render_update.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source') diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index b6fb60ac4f7..85e1eb016d7 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -58,6 +58,7 @@ #include "GPU_material.h" +#include "ED_node.h" #include "ED_render.h" #include "render_intern.h" // own include @@ -115,6 +116,8 @@ static void texture_changed(Main *bmain, Tex *tex) Material *ma; Lamp *la; World *wo; + Scene *scene; + bNode *node; /* icons */ BKE_icon_changed(BKE_icon_getid(&tex->id)); @@ -146,6 +149,16 @@ static void texture_changed(Main *bmain, Tex *tex) BKE_icon_changed(BKE_icon_getid(&wo->id)); } + + /* find compositing nodes */ + for(scene=bmain->scene.first; scene; scene=scene->id.next) { + if(scene->use_nodes && scene->nodetree) { + for(node=scene->nodetree->nodes.first; node; node=node->next) { + if(node->id == &tex->id) + ED_node_changed_update(&scene->id, node); + } + } + } } static void lamp_changed(Main *bmain, Lamp *la) -- cgit v1.2.3 From b62951c0d5cccaa0e391266ccab2eb2ce74bd223 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 15 Aug 2011 13:17:39 +0000 Subject: Fix #28162: texture properties didn't show correct texture datablock chooser in a particular setup with two nested material nodes. Material active texture was looking also recursively into material node, but this was already done outside of this function. --- source/blender/blenkernel/intern/texture.c | 32 ++++++------------------------ 1 file changed, 6 insertions(+), 26 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 036ba34d0c8..493baebd197 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1005,7 +1005,7 @@ void autotexname(Tex *tex) Tex *give_current_object_texture(Object *ob) { - Material *ma; + Material *ma, *node_ma; Tex *tex= NULL; if(ob==NULL) return NULL; @@ -1015,6 +1015,10 @@ Tex *give_current_object_texture(Object *ob) tex= give_current_lamp_texture(ob->data); } else { ma= give_current_material(ob, ob->actcol); + + if((node_ma=give_node_material(ma))) + ma= node_ma; + tex= give_current_material_texture(ma); } @@ -1080,17 +1084,6 @@ Tex *give_current_material_texture(Material *ma) tex= (Tex *)node->id; ma= NULL; } - else { - node= nodeGetActiveID(ma->nodetree, ID_MA); - if(node) { - ma= (Material*)node->id; - if(ma) { - mtex= ma->mtex[(int)(ma->texact)]; - if(mtex) tex= mtex->tex; - } - } - } - return tex; } if(ma) { @@ -1165,11 +1158,6 @@ void set_current_material_texture(Material *ma, Tex *newtex) id_us_plus(&newtex->id); ma= NULL; } - else { - node= nodeGetActiveID(ma->nodetree, ID_MA); - if(node) - ma= (Material*)node->id; - } } if(ma) { int act= (int)ma->texact; @@ -1198,16 +1186,8 @@ int has_current_material_texture(Material *ma) if(ma && ma->use_nodes && ma->nodetree) { node= nodeGetActiveID(ma->nodetree, ID_TE); - if(node) { + if(node) return 1; - } - else { - node= nodeGetActiveID(ma->nodetree, ID_MA); - if(node) - ma= (Material*)node->id; - else - ma= NULL; - } } return (ma != NULL); -- cgit v1.2.3 From f53143dc835232d894d08fb135f2ba4423b85482 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 15 Aug 2011 14:05:04 +0000 Subject: Fix #27718: driving modifier properties was missing updates, fixed depsgraph. --- source/blender/blenkernel/intern/depsgraph.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index d39be9d683c..667e0850111 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -301,6 +301,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node for (fcu= adt->drivers.first; fcu; fcu= fcu->next) { ChannelDriver *driver= fcu->driver; DriverVar *dvar; + int isdata_fcu = isdata || (fcu->rna_path && strstr(fcu->rna_path, "modifiers[")); /* loop over variables to get the target relationships */ for (dvar= driver->variables.first; dvar; dvar= dvar->next) { @@ -320,14 +321,14 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node ( ((dtar->rna_path) && strstr(dtar->rna_path, "pose.bones[")) || ((dtar->flag & DTAR_FLAG_STRUCT_REF) && (dtar->pchan_name[0])) )) { - dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver"); + dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver"); } /* check if ob data */ else if (dtar->rna_path && strstr(dtar->rna_path, "data.")) - dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver"); + dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver"); /* normal */ else - dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver"); + dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver"); } } } -- cgit v1.2.3 From 27b3695c4f183629443397b643a0bc13d62f6f35 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 15 Aug 2011 16:12:39 +0000 Subject: Remove message "Info: Config directory with "startup.blend" file not found." There's no reason to have it really, this situation is totally normal, and it means a terminal window is opened on Windows as long as you haven't saved any default settings yet. --- source/blender/windowmanager/intern/wm_files.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 20f9d2237c2..d9eb36eeb62 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -466,7 +466,6 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) } else { tstr[0] = '\0'; from_memory = 1; - BKE_report(reports, RPT_INFO, "Config directory with "STRINGIFY(BLENDER_STARTUP_FILE)" file not found."); } } -- cgit v1.2.3 From ae884d2e54210a8a1038c23cb7bdeaac16fdf2fb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 15 Aug 2011 16:18:04 +0000 Subject: Code cleanup: add UNUSED_FUNCTION macro to avoid warning messages about unused functions. --- source/blender/blenkernel/intern/nla.c | 2 +- source/blender/blenlib/BLI_utildefines.h | 6 ++++++ source/blender/editors/mesh/editmesh_mods.c | 2 +- source/blender/editors/mesh/editmesh_tools.c | 2 +- source/blender/editors/object/object_edit.c | 12 ++++++------ source/blender/editors/space_file/filelist.c | 22 ---------------------- source/blender/editors/space_nla/nla_edit.c | 2 +- source/blender/editors/space_node/node_edit.c | 2 +- .../editors/space_sequencer/sequencer_draw.c | 2 +- .../editors/space_sequencer/sequencer_edit.c | 16 ++++++---------- .../editors/space_sequencer/sequencer_select.c | 2 +- source/blender/editors/space_text/text_python.c | 5 +++-- source/blender/render/intern/source/rayshade.c | 2 +- source/blender/windowmanager/intern/wm_files.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 2 -- 15 files changed, 30 insertions(+), 51 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index c02b5dda9ce..bd238e72d0c 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1582,7 +1582,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt) /* Baking Tools ------------------------------------------- */ -static void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag)) +static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag)) { /* verify that data is valid diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 9af55601ff7..28ebb254f2a 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -183,6 +183,12 @@ # define UNUSED(x) UNUSED_ ## x #endif +#ifdef __GNUC__ +# define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x +#else +# define UNUSED_FUNCTION(x) UNUSED_ ## x +#endif + #ifdef __GNUC__ # define WARN_UNUSED __attribute__((warn_unused_result)) #else diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 9497370a4fa..eb6854d2548 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -1697,7 +1697,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type) /* ctrl+c in mesh editmode */ -static void mesh_copy_menu(EditMesh *em, wmOperator *op) +static void UNUSED_FUNCTION(mesh_copy_menu)(EditMesh *em, wmOperator *op) { EditSelection *ese; int ret; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index bfae101d38e..9ff2923f733 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3895,7 +3895,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot) /* XXX old bevel not ported yet */ -static void bevel_menu(EditMesh *em) +static void UNUSED_FUNCTION(bevel_menu)(EditMesh *em) { BME_Mesh *bm; BME_TransData_Head *td; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index c8d38218533..61734bc51a2 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -721,7 +721,7 @@ static void spot_interactive(Object *ob, int mode) } #endif -static void special_editmenu(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(special_editmenu)(Scene *scene, View3D *v3d) { // XXX static short numcuts= 2; Object *ob= OBACT; @@ -1343,7 +1343,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) DAG_ids_flush_update(bmain, 0); } -static void copy_attr_menu(Main *bmain, Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v3d) { Object *ob; short event; @@ -1616,7 +1616,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot) /* ********************** */ -static void image_aspect(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d) { /* all selected objects with an image map: scale in image aspect */ Base *base; @@ -1691,7 +1691,7 @@ static int vergbaseco(const void *a1, const void *a2) } -static void auto_timeoffs(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(auto_timeoffs)(Scene *scene, View3D *v3d) { Base *base, **basesort, **bs; float start, delta; @@ -1732,7 +1732,7 @@ static void auto_timeoffs(Scene *scene, View3D *v3d) } -static void ofs_timeoffs(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(ofs_timeoffs)(Scene *scene, View3D *v3d) { float offset=0.0f; @@ -1751,7 +1751,7 @@ static void ofs_timeoffs(Scene *scene, View3D *v3d) } -static void rand_timeoffs(Scene *scene, View3D *v3d) +static void UNUSED_FUNCTION(rand_timeoffs)(Scene *scene, View3D *v3d) { Base *base; float rand_ofs=0.0f; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 6736230e84f..d8be312cf39 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -602,28 +602,6 @@ short filelist_changed(struct FileList* filelist) return filelist->changed; } -static struct ImBuf * filelist_loadimage(struct FileList* filelist, int index) -{ - ImBuf *imb = NULL; - int fidx = 0; - - if ( (index < 0) || (index >= filelist->numfiltered) ) { - return NULL; - } - fidx = filelist->fidx[index]; - imb = filelist->filelist[fidx].image; - if (!imb) - { - if ( (filelist->filelist[fidx].flags & IMAGEFILE) || (filelist->filelist[fidx].flags & MOVIEFILE) ) { - imb = IMB_thumb_read(filelist->filelist[fidx].path, THB_NORMAL); - } - if (imb) { - filelist->filelist[fidx].image = imb; - } - } - return imb; -} - struct ImBuf * filelist_getimage(struct FileList* filelist, int index) { ImBuf* ibuf = NULL; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 77c91b28a63..af99087b0b8 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -951,7 +951,7 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static void NLA_OT_bake (wmOperatorType *ot) +void NLA_OT_bake (wmOperatorType *ot) { /* identifiers */ ot->name= "Bake Strips"; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 984e944321e..e8fc13e340e 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1641,7 +1641,7 @@ void NODE_OT_link_viewer(wmOperatorType *ot) /* return 0, nothing done */ -static int node_mouse_groupheader(SpaceNode *snode) +static int UNUSED_FUNCTION(node_mouse_groupheader)(SpaceNode *snode) { bNode *gnode; float mx=0, my=0; diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 98687bb90e0..dc84289a8de 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -702,7 +702,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline static Sequence *special_seq_update= 0; -static void set_special_seq_update(int val) +static void UNUSED_FUNCTION(set_special_seq_update)(int val) { // int x; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index ee5eb12f858..5429f0ee98f 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -75,10 +75,6 @@ /* own include */ #include "sequencer_intern.h" -static void error(const char *UNUSED(dummy)) {} -static void waitcursor(int UNUSED(val)) {} -static void activate_fileselect(int UNUSED(d1), const char *UNUSED(d2), const char *UNUSED(d3), void *UNUSED(d4)) {} -static int pupmenu(const char *UNUSED(dummy)) {return 0;} static int okee(const char *UNUSED(dummy)) {return 0;} @@ -139,7 +135,7 @@ void seq_rectf(Sequence *seq, rctf *rectf) rectf->ymax= seq->machine+SEQ_STRIP_OFSTOP; } -static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect */ +static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* called from fileselect */ { Editing *ed= seq_give_editing(scene, FALSE); struct SeqEffectHandle sh; @@ -762,7 +758,7 @@ static int insert_gap(Scene *scene, int gap, int cfra) return done; } -static void touch_seq_files(Scene *scene) +static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); @@ -774,7 +770,7 @@ static void touch_seq_files(Scene *scene) if(okee("Touch and print selected movies")==0) return; - waitcursor(1); + WM_cursor_wait(1); SEQP_BEGIN(ed, seq) { if(seq->flag & SELECT) { @@ -789,7 +785,7 @@ static void touch_seq_files(Scene *scene) } SEQ_END - waitcursor(0); + WM_cursor_wait(0); } /* @@ -817,7 +813,7 @@ static void set_filter_seq(Scene *scene) } */ -static void seq_remap_paths(Scene *scene) +static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) { Sequence *seq, *last_seq = seq_active_get(scene); Editing *ed= seq_give_editing(scene, FALSE); @@ -858,7 +854,7 @@ static void seq_remap_paths(Scene *scene) } -static void no_gaps(Scene *scene) +static void UNUSED_FUNCTION(no_gaps)(Scene *scene) { Editing *ed= seq_give_editing(scene, FALSE); int cfra, first= 0, done; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 8d5f372f55e..0ac23765167 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -159,7 +159,7 @@ void select_surround_from_last(Scene *scene) #endif -static void select_single_seq(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */ +static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */ { Editing *ed= seq_give_editing(scene, FALSE); diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 6e6f131655b..51b4b838171 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -43,6 +43,7 @@ #include "BKE_text.h" #include "BLI_blenlib.h" +#include "BLI_utildefines.h" #include "WM_types.h" @@ -192,7 +193,7 @@ static void confirm_suggestion(Text *text, int skipleft) // XXX static int doc_scroll= 0; -static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) +static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned short evnt, short val) { ARegion *ar= NULL; // XXX int qual= 0; // XXX @@ -375,7 +376,7 @@ static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short ; // XXX redraw_alltext(); #endif -static short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) +static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned short evnt, short val) { Text *text; TextMarker *marker, *mrk, *nxt; diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 34d3adcf15b..d62f411a7c5 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -1679,7 +1679,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int /* not used, test function for ambient occlusion (yaf: pathlight) */ /* main problem; has to be called within shading loop, giving unwanted recursion */ -static int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr) +static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *shr) { static int counter=0, only_one= 0; extern float hashvectf[]; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index d9eb36eeb62..6b3a574b6b6 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -450,7 +450,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) /* called on startup, (context entirely filled with NULLs) */ /* or called for 'New File' */ /* op can be NULL */ -int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) +int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory) { ListBase wmbase; char tstr[FILE_MAXDIR+FILE_MAXFILE]; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 105b2e8189a..1beb5b3dda3 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2010,8 +2010,6 @@ static void WM_OT_save_mainfile(wmOperatorType *ot) static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - int selected = 0; - if(!RNA_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; BLI_strncpy(filepath, G.main->name, sizeof(filepath)); -- cgit v1.2.3 From cdb5d11c5f29fdb7dd6a5d15a42f395e8194980b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Aug 2011 17:29:07 +0000 Subject: patch [#22523] Expose Object.parentinv matrix via RNA from Balajee R C (balajeerc) --- source/blender/makesrna/intern/rna_object.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 76bbfcbed41..55e1119f58e 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2025,7 +2025,14 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Input Matrix", "Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied."); RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); - + + /*parent_inverse*/ + prop= RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX); + RNA_def_property_float_sdna(prop, NULL, "parentinv"); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting"); + RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); + /* collections */ prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); -- cgit v1.2.3 From 405218df6fa57794d8d7d932eeb6c92f94aff0bc Mon Sep 17 00:00:00 2001 From: Morten Mikkelsen Date: Mon, 15 Aug 2011 17:55:25 +0000 Subject: the diffuse kernel I had first picked for dilation turned out to be not as great as I first thought. This kernel is a more basic one (trite but true) --- source/blender/imbuf/intern/filter.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 1644e653df4..3f391b91c0f 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -371,11 +371,15 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter) float weight[25]; /* build a weights buffer */ - n= 2; - k= 0; + n= 1; + /*k= 0; for(i = -n; i <= n; i++) for(j = -n; j <= n; j++) weight[k++] = sqrt((float) i * i + j * j); + */ + weight[0]=1; weight[1]=2; weight[2]=1; + weight[3]=2; weight[4]=0; weight[5]=2; + weight[6]=1; weight[7]=2; weight[8]=1; /* run passes */ for(r = 0; cannot_early_out == 1 && r < filter; r++) { @@ -393,10 +397,10 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter) float acc[4]={0,0,0,0}; k = 0; - if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) || + /*if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) || check_pixel_assigned(srcbuf, srcmask, filter_make_index(x+1, y, width, height), depth, is_float) || check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y-1, width, height), depth, is_float) || - check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float)) { + check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float))*/ { for(i= -n; i<=n; i++) { for(j=-n; j<=n; j++) { if(i != 0 || j != 0) { -- cgit v1.2.3 From b4df54151a5fe9e81e44bb75f6c9b3026b13d2e9 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Tue, 16 Aug 2011 08:40:25 +0000 Subject: 2.6 Node Muting: * Removing check if Node is in between, so in-/output nodes can be muted as well. Useful for example if you want to temporarily mute a file output node. --- source/blender/editors/space_node/node_edit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index e8fc13e340e..9cafc46ca53 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3007,10 +3007,10 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) for(node= snode->edittree->nodes.first; node; node= node->next) { if(node->flag & SELECT) { - if(node->inputs.first && node->outputs.first) { + /* Be able to mute in-/output nodes as well. - DingTo + if(node->inputs.first && node->outputs.first) { */ node->flag ^= NODE_MUTED; snode_tag_changed(snode, node); - } } } -- cgit v1.2.3 From c7f9e9a80f474cde25fa3da574b2dd1259700481 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 16 Aug 2011 10:31:28 +0000 Subject: Fix #28273: Crash playing with Follow path+Bevel+Material Crash was caused by old refactor of displists. Added additional check to makeDispListCurveTypes. --- source/blender/blenkernel/intern/displist.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 8f57490d057..c2ed6468643 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1369,6 +1369,11 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco) Curve *cu= ob->data; ListBase *dispbase; + /* The same check for duplis as in do_makeDispListCurveTypes. + Happens when curve used for constraint/bevel was converted to mesh. + check there is still needed for render displist and orco displists. */ + if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return; + freedisplist(&(ob->disp)); dispbase= &(ob->disp); freedisplist(dispbase); -- cgit v1.2.3 From e98074d327217d1fcc205aaff995a1bded08971a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 16 Aug 2011 13:10:46 +0000 Subject: remove support for deprecated Vector() * Matrix(), eventually this will be added back as row_vector_multiplication bu to avoid confusion for a bit just disable it altogether so script authors get an error on use and update their scripts. --- source/blender/python/mathutils/mathutils_Vector.c | 101 +++++++-------------- 1 file changed, 34 insertions(+), 67 deletions(-) (limited to 'source') diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 9d52f45665f..56c1334ecac 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -37,8 +37,6 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -extern void PyC_LineSpit(void); - #define MAX_DIMENSIONS 4 /* Swizzle axes get packed into a single value that is used as a closure. Each @@ -1161,28 +1159,18 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) } else if (vec1) { if (MatrixObject_Check(v2)) { - extern void PyC_LineSpit(void); - - /* VEC * MATRIX */ - /* this is deprecated!, use the reverse instead */ - float tvec[MAX_DIMENSIONS]; - /* ------ to be removed ------*/ -#ifndef MATH_STANDALONE -#ifdef WITH_ASSERT_ABORT +#if 1 PyErr_SetString(PyExc_ValueError, "(Vector * Matrix) is now removed, reverse the " "order (promoted to an Error for Debug builds)"); return NULL; #else - printf("Warning: (Vector * Matrix) is now deprecated, " - "reverse the multiplication order in the script.\n"); - PyC_LineSpit(); -#endif -#endif /* ifndef MATH_STANDALONE */ -/* ------ to be removed ------*/ + /* VEC * MATRIX */ + /* this is deprecated!, use the reverse instead */ + float tvec[MAX_DIMENSIONS]; if(BaseMath_ReadCallback((MatrixObject *)v2) == -1) return NULL; @@ -1191,9 +1179,18 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) } return newVectorObject(tvec, vec1->size, Py_NEW, Py_TYPE(vec1)); +#endif +/* ------ to be removed ------*/ } else if (QuaternionObject_Check(v2)) { /* VEC * QUAT */ +/* ------ to be removed ------*/ +#if 1 + PyErr_SetString(PyExc_ValueError, + "(Vector * Quat) is now removed, reverse the " + "order (promoted to an Error for Debug builds)"); + return NULL; +#else QuaternionObject *quat2 = (QuaternionObject*)v2; float tvec[3]; @@ -1207,26 +1204,11 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) return NULL; } - -/* ------ to be removed ------*/ -#ifndef MATH_STANDALONE -#ifdef WITH_ASSERT_ABORT - PyErr_SetString(PyExc_ValueError, - "(Vector * Quat) is now removed, reverse the " - "order (promoted to an Error for Debug builds)"); - return NULL; -#else - printf("Warning: (Vector * Quat) is now deprecated, " - "reverse the multiplication order in the script.\n"); - PyC_LineSpit(); -#endif -#endif /* ifndef MATH_STANDALONE */ -/* ------ to be removed ------*/ - - copy_v3_v3(tvec, vec1->vec); mul_qt_v3(quat2->quat, tvec); return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec1)); +#endif +/* ------ to be removed ------*/ } else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC * FLOAT */ return vector_mul_float(vec1, scalar); @@ -1260,6 +1242,14 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) /* only support vec*=float and vec*=mat vec*=vec result is a float so that wont work */ if (MatrixObject_Check(v2)) { +/* ------ to be removed ------*/ +#if 1 + PyErr_SetString(PyExc_ValueError, + "(Vector *= Matrix) is now removed, reverse the " + "order (promoted to an Error for Debug builds) " + "and uses the non in-place multiplication."); + return NULL; +#else float rvec[MAX_DIMENSIONS]; if(BaseMath_ReadCallback((MatrixObject *)v2) == -1) return NULL; @@ -1267,28 +1257,21 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) if(column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1) return NULL; - -/* ------ to be removed ------*/ -#ifndef MATH_STANDALONE -#ifdef WITH_ASSERT_ABORT - PyErr_SetString(PyExc_ValueError, - "(Vector *= Matrix) is now removed, reverse the " - "order (promoted to an Error for Debug builds) " - "and uses the non in-place multiplication."); - return NULL; -#else - printf("Warning: (Vector *= Matrix) is now deprecated, " - "reverse the (non in-place) multiplication order in the script.\n"); - PyC_LineSpit(); + memcpy(vec->vec, rvec, sizeof(float) * vec->size); #endif -#endif /* ifndef MATH_STANDALONE */ /* ------ to be removed ------*/ - - - memcpy(vec->vec, rvec, sizeof(float) * vec->size); } else if (QuaternionObject_Check(v2)) { /* VEC *= QUAT */ + +/* ------ to be removed ------*/ +#if 1 + PyErr_SetString(PyExc_ValueError, + "(Vector *= Quat) is now removed, reverse the " + "order (promoted to an Error for Debug builds) " + "and uses the non in-place multiplication."); + return NULL; +#else QuaternionObject *quat2 = (QuaternionObject*)v2; if(vec->size != 3) { @@ -1302,25 +1285,9 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) return NULL; } - -/* ------ to be removed ------*/ -#ifndef MATH_STANDALONE -#ifdef WITH_ASSERT_ABORT - PyErr_SetString(PyExc_ValueError, - "(Vector *= Quat) is now removed, reverse the " - "order (promoted to an Error for Debug builds) " - "and uses the non in-place multiplication."); - return NULL; -#else - printf("Warning: (Vector *= Quat) is now deprecated, " - "reverse the (non in-place) multiplication order in the script.\n"); - PyC_LineSpit(); + mul_qt_v3(quat2->quat, vec->vec); #endif -#endif /* ifndef MATH_STANDALONE */ /* ------ to be removed ------*/ - - - mul_qt_v3(quat2->quat, vec->vec); } else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC *= FLOAT */ mul_vn_fl(vec->vec, vec->size, scalar); -- cgit v1.2.3 From dddfb5e1738830c325e796a474d0ea14d64654f3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 16 Aug 2011 13:46:51 +0000 Subject: minor fix, armature selection outline was not being drawn for non-active, selected armature object when they were in pose mode. --- source/blender/editors/space_view3d/drawobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 78788777f49..f5c178267aa 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5477,7 +5477,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base) } } else if(ob->type==OB_ARMATURE) { - if(!(ob->mode & OB_MODE_POSE)) + if(!(ob->mode & OB_MODE_POSE && base == scene->basact)) draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, TRUE); } -- cgit v1.2.3 From feb52de6b500fe889f8a2b28d2b510087107ec88 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 16 Aug 2011 22:18:24 +0000 Subject: fix for error calling RNA_property_float_get_index on non array float rotations when displaying. --- source/blender/editors/interface/interface_regions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 8bce27e366b..a55ee01202c 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -424,7 +424,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (unit_type == PROP_UNIT_ROTATION) { if (RNA_property_type(but->rnaprop) == PROP_FLOAT) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex)); + float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", value); data->color[data->totline]= 0x888888; data->totline++; } -- cgit v1.2.3 From dd8d24ff9d48d4103e414cbe18e6c40644051f19 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 16 Aug 2011 22:44:12 +0000 Subject: fix [#28274] Cant select aditional object in edit mode. missing feature from 2.4x --- source/blender/editors/space_view3d/view3d_select.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index c6835b0cad3..86112a42d99 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1335,9 +1335,9 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce if(oldbasact != basact) { ED_base_object_activate(C, basact); /* adds notifier */ } - - WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } + + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } return retval; @@ -1841,8 +1841,8 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) int retval = 0; view3d_operator_needs_opengl(C); - - if(obedit) { + + if(obedit && center==FALSE) { if(obedit->type==OB_MESH) retval = mouse_mesh(C, event->mval, extend); else if(obedit->type==OB_ARMATURE) @@ -1889,7 +1889,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first."); - RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting (object mode only)."); + RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting, in editmode used to extend object selection."); RNA_def_boolean(ot->srna, "enumerate", 0, "Enumerate", "List objects under the mouse (object mode only)."); } -- cgit v1.2.3 From 0bac3e17dfb1cfc0b65adf1a29960cab2213d6a3 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 17 Aug 2011 12:09:02 +0000 Subject: Fix #28194, #28269: proxy object was not showing pose mode as available in 3d view header mode menu. A recent bugfix was incorrectly hiding pose and particle mode when the object data was library linked, but these modes edit object level settings so should be available. --- .../blender/editors/space_view3d/view3d_header.c | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 5b95ae63e56..70b2a3d3628 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -281,31 +281,32 @@ static char *view3d_modeselect_pup(Scene *scene) str += sprintf(str, formatstr, "Object Mode", OB_MODE_OBJECT, ICON_OBJECT_DATA); if(ob==NULL || ob->data==NULL) return string; - if(ob->id.lib || ((ID *)ob->data)->lib) return string; + if(ob->id.lib) return string; - /* if active object is editable */ - if ( ((ob->type == OB_MESH) - || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT) - || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) { - - str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); - } - else if (ob->type == OB_ARMATURE) { - if (ob->mode & OB_MODE_POSE) - str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT); - else + if(!((ID *)ob->data)->lib) { + /* if active object is editable */ + if ( ((ob->type == OB_MESH) + || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT) + || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) { + str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); - } + } + else if (ob->type == OB_ARMATURE) { + if (ob->mode & OB_MODE_POSE) + str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT); + else + str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); + } - if (ob->type == OB_MESH) { + if (ob->type == OB_MESH) { - str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT); - str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT); - str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT); - str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT); + str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT); + str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT); + str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT); + str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT); + } } - - + /* if active object is an armature */ if (ob->type==OB_ARMATURE) { str += sprintf(str, formatstr, "Pose Mode", OB_MODE_POSE, ICON_POSE_HLT); -- cgit v1.2.3 From b6dcf3b1c24fe43193ae4697b383cf1514a3caff Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 17 Aug 2011 12:52:38 +0000 Subject: Fix #28277: changing smoke border collision type did not reset cache, making it seem like the option wasn't working. --- source/blender/makesrna/intern/rna_smoke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 43d1aa24229..8abf774ff52 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -247,7 +247,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); RNA_def_property_enum_items(prop, smoke_domain_colli_items); RNA_def_property_ui_text(prop, "Border Collisions", "Selects which domain border will be treated as collision object."); - RNA_def_property_update(prop, 0, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "EffectorWeights"); -- cgit v1.2.3 From 853620926019b242dbc34336addcf1c4eaaf7569 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Wed, 17 Aug 2011 13:04:28 +0000 Subject: 2.6 RNA: * Remove some NULL RNA property update calls, they do nothing. --- source/blender/makesrna/intern/rna_object_force.c | 1 - source/blender/makesrna/intern/rna_smoke.c | 7 ------- 2 files changed, 8 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index ca679239dd3..463f65fd3d5 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -770,7 +770,6 @@ static void rna_def_pointcache(BlenderRNA *brna) prop= RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, point_cache_compress_items); RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used"); - RNA_def_property_update(prop, 0, NULL); /* flags */ prop= RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 8abf774ff52..d439c2551f1 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -241,7 +241,6 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "cache_comp"); RNA_def_property_enum_items(prop, smoke_cache_comp_items); RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used"); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); @@ -290,14 +289,12 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.001, 1); RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4); RNA_def_property_ui_text(prop, "Density", ""); - RNA_def_property_update(prop, 0, NULL); // NC_OBJECT|ND_MODIFIER prop= RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "temp"); RNA_def_property_range(prop, -10, 10); RNA_def_property_ui_range(prop, -10, 10, 1, 1); RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature"); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "psys"); @@ -309,24 +306,20 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW); RNA_def_property_ui_text(prop, "Outflow", "Deletes smoke from simulation"); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE); RNA_def_property_ui_text(prop, "Absolute Density", "Only allows given density value in emitter area."); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY); RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits it's velocity from the emitter particle"); - RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); RNA_def_property_range(prop, -2.0, 2.0); RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5); RNA_def_property_ui_text(prop, "Multiplier", "Multiplier to adjust velocity passed to smoke"); - RNA_def_property_update(prop, 0, NULL); } static void rna_def_smoke_coll_settings(BlenderRNA *brna) -- cgit v1.2.3 From feb7afe671bb4932ebbbecc2a4cfbc3aa4516366 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 17 Aug 2011 14:43:11 +0000 Subject: Fix #28262: uv unwrap in sync selection mode unwrapped all faces irrespective of selection. Changed the fix for bug #27198, live unwrap not working with sync selection. --- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index ae6836446fa..e8a7896abd5 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -205,11 +205,7 @@ static ParamHandle *construct_param_handle(Scene *scene, EditMesh *em, short imp float *uv[4]; int nverts; - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(efa->h) - continue; - } - else if((efa->h) || (sel && (efa->f & SELECT)==0)) + if((efa->h) || (sel && (efa->f & SELECT)==0)) continue; tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); @@ -586,7 +582,7 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit) return; } - liveHandle = construct_param_handle(scene, em, 0, fillholes, 1, 1); + liveHandle = construct_param_handle(scene, em, 0, fillholes, 0, 1); param_lscm_begin(liveHandle, PARAM_TRUE, abf); BKE_mesh_end_editmesh(obedit->data, em); -- cgit v1.2.3 From 1719963a08e9cc470dfaa1dbc87174c9120b59af Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 17 Aug 2011 15:55:42 +0000 Subject: Fix #28207: animating pin option for cloth didn't work, solver doesn't support it, so set the property as not animatable. --- source/blender/makesrna/intern/rna_cloth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 1ce4108bab2..1b2396a4215 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -294,6 +294,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_GOAL); RNA_def_property_ui_text(prop, "Pin Cloth", "Enable pinning of cloth vertices to other objects/positions"); RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop= RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "goalspring"); @@ -313,6 +314,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SCALING); RNA_def_property_ui_text(prop, "Stiffness Scaling", "If enabled, stiffness can be scaled along a weight painted vertex group"); RNA_def_property_update(prop, 0, "rna_cloth_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop= RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "Cdis"); -- cgit v1.2.3 From 14d2d7c75fcb9a1fd3d82d0434921117f26108e6 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 17 Aug 2011 20:17:27 +0000 Subject: BGE: Upping the max Axis Number for the Axis event type on joystick sensors from 2 to 4. The BGE supports up to 16 axis. For Axis events (not Single Axis), you get for directions per axis (up, down, left, right). So, the max should be JOYAXIS_MAX/directions = 16/4 = 4. --- source/blender/makesrna/intern/rna_sensor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 5cc8539f187..5c6a4e889fa 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -803,7 +803,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "axis"); RNA_def_property_ui_text(prop, "Axis Number", "Specify which axis pair to use, 1 is usually the main direction input"); - RNA_def_property_range(prop, 1, 2); + RNA_def_property_range(prop, 1, 4); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE); -- cgit v1.2.3 From 5c20bc02ff76a3a72992bc43f414b673e8275866 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 17 Aug 2011 20:44:15 +0000 Subject: BGE: Upon further investigation this should have been 8 since up/down and left/right both are just one axis each. So, in actuality, the number of directions = 2, not 4, and thus JOYAXIS_MAX/directions = 16/2 = 8. 8 was also the max used in 2.4x. --- source/blender/makesrna/intern/rna_sensor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 5c6a4e889fa..1f64603d6b4 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -803,7 +803,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "axis"); RNA_def_property_ui_text(prop, "Axis Number", "Specify which axis pair to use, 1 is usually the main direction input"); - RNA_def_property_range(prop, 1, 4); + RNA_def_property_range(prop, 1, 8); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE); -- cgit v1.2.3 From 591b087204b1bc9372d8c87d5bdf28a55f3ae13a Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 18 Aug 2011 02:12:23 +0000 Subject: Fix for [#28216] particles objects rotation still wrong with r39287 * The emitter object's inverse matrix wasn't in global coordinates during rendering, so the surface normals of the hair emission locations were transformed with the wrong matrix. --- source/blender/blenkernel/intern/anim.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source') diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 8aa816f9cb5..ebe7325d96a 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1245,6 +1245,8 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p sim.ob= par; sim.psys= psys; sim.psmd= psys_get_modifier(par, psys); + /* make sure emitter imat is in global coordinates instead of render view coordinates */ + invert_m4_m4(par->imat, par->obmat); /* first check for loops (particle system object used as dupli object) */ if(part->ren_as == PART_DRAW_OB) { -- cgit v1.2.3 From 83c090a555af97ae7f2f08595298d5b2e6266e85 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Aug 2011 12:09:53 +0000 Subject: fix for bad array access in transform operator, was assigning an array to a single float operator value. --- source/blender/editors/transform/transform.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c1c812e8c68..03a98bf30d8 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1356,16 +1356,15 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) ToolSettings *ts = CTX_data_tool_settings(C); int constraint_axis[3] = {0, 0, 0}; int proportional = 0; + PropertyRNA *prop; - if (RNA_struct_find_property(op->ptr, "value")) - { - if (t->flag & T_AUTOVALUES) - { - RNA_float_set_array(op->ptr, "value", t->auto_values); + if ((prop= RNA_struct_find_property(op->ptr, "value"))) { + float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; + if (RNA_property_array_check(prop)) { + RNA_property_float_set_array(op->ptr, prop, values); } - else - { - RNA_float_set_array(op->ptr, "value", t->values); + else { + RNA_property_float_set(op->ptr, prop, values[0]); } } -- cgit v1.2.3 From 2bd016fe3f08524711d1d45e8ebf12d483c6131c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Aug 2011 12:20:10 +0000 Subject: formatting edits, no functional changes. --- source/blender/python/intern/bpy_rna.c | 97 ++++++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 23 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ba8145c2773..4d8d524d7e3 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -84,7 +84,9 @@ int pyrna_struct_validity_check(BPy_StructRNA *pysrna) { if(pysrna->ptr.type) return 0; - PyErr_Format(PyExc_ReferenceError, "StructRNA of type %.200s has been removed", Py_TYPE(pysrna)->tp_name); + PyErr_Format(PyExc_ReferenceError, + "StructRNA of type %.200s has been removed", + Py_TYPE(pysrna)->tp_name); return -1; } @@ -790,18 +792,23 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self) const char *name; if(!PYRNA_STRUCT_IS_VALID(self)) { - return PyUnicode_FromFormat("", Py_TYPE(self)->tp_name); + return PyUnicode_FromFormat("", + Py_TYPE(self)->tp_name); } /* print name if available */ name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE); if(name) { - ret= PyUnicode_FromFormat("", RNA_struct_identifier(self->ptr.type), name); + ret= PyUnicode_FromFormat("", + RNA_struct_identifier(self->ptr.type), + name); MEM_freeN((void *)name); return ret; } - return PyUnicode_FromFormat("", RNA_struct_identifier(self->ptr.type), self->ptr.data); + return PyUnicode_FromFormat("", + RNA_struct_identifier(self->ptr.type), + self->ptr.data); } static PyObject *pyrna_struct_repr(BPy_StructRNA *self) @@ -811,18 +818,26 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self) return pyrna_struct_str(self); /* fallback */ if(RNA_struct_is_ID(self->ptr.type)) { - return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id->name+2); + return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]", + BKE_idcode_to_name_plural(GS(id->name)), + id->name+2); } else { PyObject *ret; const char *path; path= RNA_path_from_ID_to_struct(&self->ptr); if(path) { - ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path); + ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", + BKE_idcode_to_name_plural(GS(id->name)), + id->name+2, + path); MEM_freeN((void *)path); } else { /* cant find, print something sane */ - ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_struct_identifier(self->ptr.type)); + ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", + BKE_idcode_to_name_plural(GS(id->name)), + id->name+2, + RNA_struct_identifier(self->ptr.type)); } return ret; @@ -870,7 +885,11 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE); if(name) { - ret= PyUnicode_FromFormat("", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name); + ret= PyUnicode_FromFormat("", + type_fmt, + RNA_struct_identifier(self->ptr.type), + RNA_property_identifier(self->prop), + name); MEM_freeN((void *)name); return ret; } @@ -878,11 +897,16 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) if(RNA_property_type(self->prop) == PROP_COLLECTION) { PointerRNA r_ptr; if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { - return PyUnicode_FromFormat("", type_fmt, RNA_struct_identifier(r_ptr.type)); + return PyUnicode_FromFormat("", + type_fmt, + RNA_struct_identifier(r_ptr.type)); } } - return PyUnicode_FromFormat("", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop)); + return PyUnicode_FromFormat("", + type_fmt, + RNA_struct_identifier(self->ptr.type), + RNA_property_identifier(self->prop)); } static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) @@ -902,7 +926,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) MEM_freeN((void *)path); } else { /* cant find, print something sane */ - ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_property_identifier(self->prop)); + ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", + BKE_idcode_to_name_plural(GS(id->name)), + id->name+2, + RNA_property_identifier(self->prop)); } return ret; @@ -911,7 +938,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) static PyObject *pyrna_func_repr(BPy_FunctionRNA *self) { - return PyUnicode_FromFormat("<%.200s %.200s.%.200s()>", Py_TYPE(self)->tp_name, RNA_struct_identifier(self->ptr.type), RNA_function_identifier(self->func)); + return PyUnicode_FromFormat("<%.200s %.200s.%.200s()>", + Py_TYPE(self)->tp_name, + RNA_struct_identifier(self->ptr.type), + RNA_function_identifier(self->func)); } @@ -2995,7 +3025,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) else if (self->ptr.type == &RNA_Context) { bContext *C= self->ptr.data; if(C==NULL) { - PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context", name); + PyErr_Format(PyExc_AttributeError, + "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context", + name); ret= NULL; } else { @@ -3054,7 +3086,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) } else { #if 0 - PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" not found", name); + PyErr_Format(PyExc_AttributeError, + "bpy_struct: attribute \"%.200s\" not found", + name); ret= NULL; #endif /* Include this incase this instance is a subtype of a python class @@ -3170,7 +3204,9 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb const char *attr_str= _PyUnicode_AsString(attr); int ret= RNA_def_property_free_identifier(srna, attr_str); if (ret == -1) { - PyErr_Format(PyExc_TypeError, "struct_meta_idprop.detattr(): '%s' not a dynamic property", attr_str); + PyErr_Format(PyExc_TypeError, + "struct_meta_idprop.detattr(): '%s' not a dynamic property", + attr_str); return -1; } } @@ -3208,7 +3244,9 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject /* code just raises correct error, context prop's cant be set, unless its apart of the py class */ bContext *C= self->ptr.data; if(C==NULL) { - PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't set \"%.200s\" from context", name); + PyErr_Format(PyExc_AttributeError, + "bpy_struct: Context is 'NULL', can't set \"%.200s\" from context", + name); return -1; } else { @@ -3219,7 +3257,9 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject int done= CTX_data_get(C, name, &newptr, &newlb, &newtype); if(done==1) { - PyErr_Format(PyExc_AttributeError, "bpy_struct: Context property \"%.200s\" is read-only", name); + PyErr_Format(PyExc_AttributeError, + "bpy_struct: Context property \"%.200s\" is read-only", + name); BLI_freelistN(&newlb); return -1; } @@ -3363,7 +3403,9 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam } } - PyErr_Format(PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" not found", name); + PyErr_Format(PyExc_AttributeError, + "bpy_prop_collection: attribute \"%.200s\" not found", + name); return -1; } @@ -4048,11 +4090,14 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject * } /* error, invalid type given */ - PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct", type->tp_name); + PyErr_Format(PyExc_TypeError, + "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct", + type->tp_name); return NULL; } else { - PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): expected a single argument"); + PyErr_Format(PyExc_TypeError, + "bpy_struct.__new__(type): expected a single argument"); return NULL; } } @@ -4077,7 +4122,9 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN return (PyObject *)ret; } else { - PyErr_Format(PyExc_TypeError, "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop", type->tp_name); + PyErr_Format(PyExc_TypeError, + "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop", + type->tp_name); return NULL; } } @@ -4139,7 +4186,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat } break; default: - PyErr_Format(PyExc_TypeError, "RNA Error: unknown array type \"%d\" (pyrna_param_to_py)", type); + PyErr_Format(PyExc_TypeError, + "RNA Error: unknown array type \"%d\" (pyrna_param_to_py)", + type); ret= NULL; break; } @@ -4237,7 +4286,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat break; } default: - PyErr_Format(PyExc_TypeError, "RNA Error: unknown type \"%d\" (pyrna_param_to_py)", type); + PyErr_Format(PyExc_TypeError, + "RNA Error: unknown type \"%d\" (pyrna_param_to_py)", + type); ret= NULL; break; } -- cgit v1.2.3 From 00426038d0dbf2821e091954cc6d694d786e6898 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Aug 2011 16:26:34 +0000 Subject: disable undo for screen & wm RNA buttons, changing shading mode via the UI for eg was doing an undo push. --- source/blender/editors/interface/interface.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e31e3a26b40..3bd50074d84 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2636,6 +2636,17 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s UI_DEF_BUT_RNA_DISABLE(but); } + /* avoid undo push for buttons who's ID are screen or wm level + * we could disable undo for buttons with no ID too but but may have + * unforseen conciquences, so best check for ID's we _know_ are not + * handled by undo - campbell */ + if (but->flag & UI_BUT_UNDO) { + ID *id= ptr->id.data; + if(id && ELEM(GS(id->name), ID_SCR, ID_WM)) { + but->flag &= ~UI_BUT_UNDO; + } + } + /* If this button uses units, calculate the step from this */ if(ui_is_but_unit(but)) but->a1= ui_get_but_step_unit(but, but->a1); -- cgit v1.2.3 From 39a46cd4ed049bc462359f920af469c491b687f9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Aug 2011 17:09:23 +0000 Subject: disable undo for hard coded interface buttons: - space type switcher. - header menu toggle. - properties window header buttons. - various view3d manipulator buttons. --- source/blender/editors/screen/area.c | 8 +++- .../blender/editors/space_buttons/buttons_header.c | 52 +++++++++++----------- .../blender/editors/space_view3d/view3d_header.c | 13 ++++-- 3 files changed, 41 insertions(+), 32 deletions(-) (limited to 'source') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 82986dfbcc4..bc97cd9d3ff 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1406,6 +1406,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) "Displays current editor type. " "Click for menu of available types"); uiButSetFunc(but, spacefunc, NULL, NULL); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ return xco + UI_UNIT_X + 14; } @@ -1414,6 +1415,7 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco) { ScrArea *sa= CTX_wm_area(C); int xco= 8; + uiBut *but; if (!sa->full) xco= ED_area_header_switchbutton(C, block, yco); @@ -1421,20 +1423,22 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco) uiBlockSetEmboss(block, UI_EMBOSSN); if (sa->flag & HEADER_NO_PULLDOWN) { - uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, + but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, ICON_DISCLOSURE_TRI_RIGHT, xco,yco,UI_UNIT_X,UI_UNIT_Y-2, &(sa->flag), 0, 0, 0, 0, "Show pulldown menus"); } else { - uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, + but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, ICON_DISCLOSURE_TRI_DOWN, xco,yco,UI_UNIT_X,UI_UNIT_Y-2, &(sa->flag), 0, 0, 0, 0, "Hide pulldown menus"); } + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + uiBlockSetEmboss(block, UI_EMBOSS); return xco + UI_UNIT_X; diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 19c600be937..e631718b0cb 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -104,6 +104,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) { SpaceButs *sbuts= CTX_wm_space_buts(C); uiBlock *block; + uiBut *but; int xco, yco= 2; buttons_context_compute(C, sbuts); @@ -118,33 +119,32 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) xco -= UI_UNIT_X; // Default panels + uiBlockBeginAlign(block); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_RENDER, 0, 0, "Render"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_SCENE, 0, 0, "Scene"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_WORLD, 0, 0, "World"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_OBJECT, 0, 0, "Object"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_CONSTRAINT, 0, 0, "Object Constraints"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_MODIFIER, 0, 0, "Modifiers"); - if(sbuts->pathflag & (1<dataicon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_DATA, 0, 0, "Object Data"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_BONE, 0, 0, "Bone"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_BONE_CONSTRAINT, 0, 0, "Bone Constraints"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_MATERIAL, 0, 0, "Material"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_TEXTURE, 0, 0, "Texture"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_PARTICLE, 0, 0, "Particles"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_PHYSICS, 0, 0, "Physics"); + +#define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \ + if(sbuts->pathflag & (1<<_ctx)) { \ + but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, _tip); \ + uiButClearFlag(but, UI_BUT_UNDO); \ + } \ + + + BUTTON_HEADER_CTX(BCONTEXT_RENDER, ICON_SCENE, "Render") + BUTTON_HEADER_CTX(BCONTEXT_SCENE, ICON_SCENE_DATA, "Scene"); + BUTTON_HEADER_CTX(BCONTEXT_WORLD, ICON_WORLD, "World"); + BUTTON_HEADER_CTX(BCONTEXT_OBJECT, ICON_OBJECT_DATA, "Object"); + BUTTON_HEADER_CTX(BCONTEXT_CONSTRAINT, ICON_CONSTRAINT, "Object Constraints"); + BUTTON_HEADER_CTX(BCONTEXT_MODIFIER, ICON_MODIFIER, "Object Modifiers"); + BUTTON_HEADER_CTX(BCONTEXT_DATA, sbuts->dataicon, "Object Data"); + BUTTON_HEADER_CTX(BCONTEXT_BONE, ICON_BONE_DATA, "Bone"); + BUTTON_HEADER_CTX(BCONTEXT_BONE_CONSTRAINT, ICON_CONSTRAINT_BONE, "Bone Constraints"); + BUTTON_HEADER_CTX(BCONTEXT_MATERIAL, ICON_MATERIAL, "Material"); + BUTTON_HEADER_CTX(BCONTEXT_TEXTURE, ICON_TEXTURE, "Textures"); + BUTTON_HEADER_CTX(BCONTEXT_PARTICLE, ICON_PARTICLES, "Particles"); + BUTTON_HEADER_CTX(BCONTEXT_PHYSICS, ICON_PHYSICS, "Physics"); + +#undef BUTTON_HEADER_CTX + xco+= BUT_UNIT_X; uiBlockEndAlign(block); diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 70b2a3d3628..78dcf6c9a5c 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -466,6 +466,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) Object *ob= OBACT; Object *obedit = CTX_data_edit_object(C); uiBlock *block; + uiBut *but; uiLayout *row; const float dpi_fac= UI_DPI_FAC; @@ -513,9 +514,12 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) block= uiLayoutGetBlock(row); if(v3d->twflag & V3D_USE_MANIPULATOR) { - uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode"); - uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode"); - uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode"); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ } if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) { @@ -523,7 +527,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } str_menu = BIF_menustringTransformOrientation(C, "Orientation"); - uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); + but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ MEM_freeN((void *)str_menu); } -- cgit v1.2.3 From ccdec67fec8a39b8239e93bd04e38b4d8cbd18e7 Mon Sep 17 00:00:00 2001 From: Morten Mikkelsen Date: Thu, 18 Aug 2011 17:25:54 +0000 Subject: bugfix: genx and geny are not the image resolution. Texture space variant needs this. --- source/blender/render/intern/source/render_texture.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 5aad055a8f6..579afc21c1d 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -2084,14 +2084,21 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { if(tex->ima) { - // crazy hack solution that gives results similar to normal mapping - part 2 float vec[2]; + int dimx=512, dimy=512; + ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser); + if (ibuf) { + dimx = ibuf->x; + dimy = ibuf->y; + } + + // crazy hack solution that gives results similar to normal mapping - part 2 - vec[0] = tex->ima->gen_x*dxt[0]; - vec[1] = tex->ima->gen_y*dxt[1]; + vec[0] = dimx*dxt[0]; + vec[1] = dimy*dxt[1]; dHdx *= 1.0f/len_v2(vec); - vec[0] = tex->ima->gen_x*dyt[0]; - vec[1] = tex->ima->gen_y*dyt[1]; + vec[0] = dimx*dyt[0]; + vec[1] = dimy*dyt[1]; dHdy *= 1.0f/len_v2(vec); } } -- cgit v1.2.3 From 238955070b334062764e81c01c6d8381c332a54a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Aug 2011 18:42:42 +0000 Subject: minor change for operator OUTLINER_OT_item_activate Noticed clicking anywhere in the outliner was doing undo pushes, even in empty areas. - check if any selection is made before redrawing. - don't do an undo push when selecting outliner items since only screen data is touched here. --- .../blender/editors/space_outliner/outliner_intern.h | 3 --- .../blender/editors/space_outliner/outliner_select.c | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 85bbbd4fffb..1a6448588aa 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -143,9 +143,6 @@ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct Space void draw_outliner(const struct bContext *C); /* outliner_select.c -------------------------------------------- */ - -void outliner_select(struct SpaceOops *soops, ListBase *lb, int *index, short *selecting); - int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set); int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, TreeElement *te, int set); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 620a936a944..46a9bde8267 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -106,10 +106,11 @@ /* ****************************************************** */ /* Outliner Selection (grey-blue highlight for rows) */ -void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting) +static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting) { TreeElement *te; TreeStoreElem *tselem; + int change= 0; for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) { tselem= TREESTORE(te); @@ -131,6 +132,8 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin tselem->flag |= TSE_SELECTED; else tselem->flag &= ~TSE_SELECTED; + + change |= 1; } } else if ((tselem->flag & TSE_CLOSED)==0) { @@ -142,10 +145,12 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin * function correctly */ (*index)--; - outliner_select(soops, &te->subtree, index, selecting); + change |= outliner_select(soops, &te->subtree, index, selecting); (*index)++; } } + + return change; } /* ****************************************************** */ @@ -839,11 +844,14 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event) fmval[0], fmval[1], NULL, &row); /* select relevant row */ - outliner_select(soops, &soops->tree, &row, &selecting); + if(outliner_select(soops, &soops->tree, &row, &selecting)) { - soops->storeflag |= SO_TREESTORE_REDRAW; + soops->storeflag |= SO_TREESTORE_REDRAW; - ED_undo_push(C, "Outliner selection event"); + /* no need for undo push here, only changing outliner data which is + * scene level - campbell */ + /* ED_undo_push(C, "Outliner selection event"); */ + } } ED_region_tag_redraw(ar); -- cgit v1.2.3 From 042d4d3509069a2dab9ed3a8f5629099d09548c2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Aug 2011 19:07:37 +0000 Subject: misc changes to unterface & undo - operator strings were doing undo pushes (in fileselector text for example), this is dumb since the operators themselves handle undo. - interface code checks rna props are arrays rather then checking the array length. - disable properties window pin undoing. - sequencer refresh was calling undo, disable since this is clearnign global data not handled by undo. - added commented out code for drawing mesh vertex index/key index, useful for debugging shapekey - hook issyes. --- source/blender/editors/interface/interface.c | 53 ++++++++++++++-------- .../blender/editors/interface/interface_layout.c | 4 +- .../editors/space_buttons/buttons_context.c | 1 + .../editors/space_sequencer/sequencer_edit.c | 3 -- source/blender/editors/space_view3d/drawobject.c | 15 +++++- 5 files changed, 51 insertions(+), 25 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 3bd50074d84..935a0ef6387 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -710,6 +710,27 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but) return 1; } +/* use to check if we need to disable undo, but dont make any changes + * returns FALSE if undo needs to be disabled. */ +static int ui_but_is_rna_undo(uiBut *but) +{ + if(but->rnapoin.id.data) { + /* avoid undo push for buttons who's ID are screen or wm level + * we could disable undo for buttons with no ID too but may have + * unforseen conciquences, so best check for ID's we _know_ are not + * handled by undo - campbell */ + ID *id= but->rnapoin.id.data; + if(ELEM(GS(id->name), ID_SCR, ID_WM)) { + return FALSE; + } + else { + return TRUE; + } + } + + return TRUE; +} + /* assigns automatic keybindings to menu items for fast access * (underline key in menu) */ static void ui_menu_block_set_keyaccels(uiBlock *block) @@ -1245,12 +1266,14 @@ int ui_is_but_float(uiBut *but) int ui_is_but_unit(uiBut *but) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); - int unit_type= uiButGetUnitType(but); + const int unit_type= uiButGetUnitType(but); + Scene *scene; /* avoid getting the scene on non unit buttons */ if(unit_type == PROP_UNIT_NONE) return 0; + scene= CTX_data_scene((bContext *)but->block->evil_C); + #if 1 // removed so angle buttons get correct snapping if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION) return 0; @@ -1293,19 +1316,19 @@ double ui_get_but_val(uiBut *but) switch(RNA_property_type(prop)) { case PROP_BOOLEAN: - if(RNA_property_array_length(&but->rnapoin, prop)) + if(RNA_property_array_check(prop)) value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex); else value= RNA_property_boolean_get(&but->rnapoin, prop); break; case PROP_INT: - if(RNA_property_array_length(&but->rnapoin, prop)) + if(RNA_property_array_check(prop)) value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex); else value= RNA_property_int_get(&but->rnapoin, prop); break; case PROP_FLOAT: - if(RNA_property_array_length(&but->rnapoin, prop)) + if(RNA_property_array_check(prop)) value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex); else value= RNA_property_float_get(&but->rnapoin, prop); @@ -2506,12 +2529,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip) { + const PropertyType proptype= RNA_property_type(prop); uiBut *but; - PropertyType proptype; int freestr= 0, icon= 0; - proptype= RNA_property_type(prop); - /* use rna values if parameters are not specified */ if(!str) { if(type == MENU && proptype == PROP_ENUM) { @@ -2636,20 +2657,14 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s UI_DEF_BUT_RNA_DISABLE(but); } - /* avoid undo push for buttons who's ID are screen or wm level - * we could disable undo for buttons with no ID too but but may have - * unforseen conciquences, so best check for ID's we _know_ are not - * handled by undo - campbell */ - if (but->flag & UI_BUT_UNDO) { - ID *id= ptr->id.data; - if(id && ELEM(GS(id->name), ID_SCR, ID_WM)) { - but->flag &= ~UI_BUT_UNDO; - } + if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) { + but->flag &= ~UI_BUT_UNDO; } /* If this button uses units, calculate the step from this */ - if(ui_is_but_unit(but)) + if((proptype == PROP_FLOAT) && ui_is_but_unit(but)) { but->a1= ui_get_but_step_unit(but, but->a1); + } if(freestr) MEM_freeN((void *)str); @@ -2693,6 +2708,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip); but->optype= ot; but->opcontext= opcontext; + but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */ if(!ot) { but->flag |= UI_BUT_DISABLED; @@ -2722,6 +2738,7 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); but->optype= ot; but->opcontext= opcontext; + but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */ if(!ot) { but->flag |= UI_BUT_DISABLED; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 4810b3fdf54..3575a8527fc 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1017,12 +1017,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only); /* enum item */ else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) { - const char *identifier= RNA_property_identifier(prop); - if(icon && name[0] && !icon_only) uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); else if(icon) - uiDefIconButR(block, ROW, 0, icon, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL); + uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); else uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 8e1a4b2d16c..0d81a84deea 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -904,6 +904,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) block= uiLayoutGetBlock(row); uiBlockSetEmboss(block, UI_EMBOSSN); but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ uiButSetFunc(but, pin_cb, NULL, NULL); for(a=0; alen; a++) { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 5429f0ee98f..531ecebba5e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1228,9 +1228,6 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot) /* api callbacks */ ot->exec= sequencer_refresh_all_exec; ot->poll= sequencer_edit_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index f5c178267aa..ddc10d78cac 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2367,7 +2367,20 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E } } } - + + /* useful for debugging index vs shape key index */ +#if 0 + { + EditVert *eve; + int j; + UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col); + for(eve= em->verts.first, j= 0; eve; eve= eve->next, j++) { + sprintf(val, "%d:%d", j, eve->keyindex); + view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col); + } + } +#endif + if(v3d->zbuf) { glEnable(GL_DEPTH_TEST); bglPolygonOffset(rv3d->dist, 0.0f); -- cgit v1.2.3 From 0de911210215fb6730977c68c0b310b840638b1d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Aug 2011 20:01:30 +0000 Subject: store a pointer to the units system in the uiBlock since the button code was doing context lookups for the scene quite a lot. --- source/blender/editors/interface/interface.c | 40 +++++++++++----------- .../blender/editors/interface/interface_handlers.c | 8 ++--- .../blender/editors/interface/interface_intern.h | 4 ++- 3 files changed, 27 insertions(+), 25 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 935a0ef6387..a5ceb8bdb19 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1266,16 +1266,14 @@ int ui_is_but_float(uiBut *but) int ui_is_but_unit(uiBut *but) { + UnitSettings *unit= but->block->unit; const int unit_type= uiButGetUnitType(but); - Scene *scene; /* avoid getting the scene on non unit buttons */ if(unit_type == PROP_UNIT_NONE) return 0; - scene= CTX_data_scene((bContext *)but->block->evil_C); - #if 1 // removed so angle buttons get correct snapping - if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION) + if (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION) return 0; #endif @@ -1283,7 +1281,7 @@ int ui_is_but_unit(uiBut *but) if (unit_type == PROP_UNIT_TIME) return 0; - if (scene->unit.system == USER_UNIT_NONE) { + if (unit->system == USER_UNIT_NONE) { if (unit_type != PROP_UNIT_ROTATION) { return 0; } @@ -1482,19 +1480,20 @@ int ui_get_but_string_max_length(uiBut *but) static double ui_get_but_scale_unit(uiBut *but, double value) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + UnitSettings *unit= but->block->unit; int unit_type= uiButGetUnitType(but); if(unit_type == PROP_UNIT_LENGTH) { - return value * (double)scene->unit.scale_length; + return value * (double)unit->scale_length; } else if(unit_type == PROP_UNIT_AREA) { - return value * pow(scene->unit.scale_length, 2); + return value * pow(unit->scale_length, 2); } else if(unit_type == PROP_UNIT_VOLUME) { - return value * pow(scene->unit.scale_length, 3); + return value * pow(unit->scale_length, 3); } else if(unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */ + Scene *scene= CTX_data_scene(but->block->evil_C); return FRA2TIME(value); } else { @@ -1506,14 +1505,14 @@ static double ui_get_but_scale_unit(uiBut *but, double value) void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen) { if(ui_is_but_unit(but)) { + UnitSettings *unit= but->block->unit; int unit_type= uiButGetUnitType(but); char *orig_str; - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); orig_str= MEM_callocN(sizeof(char)*maxlen + 1, "textedit sub str"); memcpy(orig_str, str, maxlen); - bUnit_ToUnitAltName(str, maxlen, orig_str, scene->unit.system, unit_type>>16); + bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, unit_type>>16); MEM_freeN(orig_str); } @@ -1521,27 +1520,26 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen) static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); - int do_split= scene->unit.flag & USER_UNIT_OPT_SPLIT; + UnitSettings *unit= but->block->unit; + int do_split= unit->flag & USER_UNIT_OPT_SPLIT; int unit_type= uiButGetUnitType(but); int precision= but->a2; - if(scene->unit.scale_length<0.0001f) scene->unit.scale_length= 1.0f; // XXX do_versions + if(unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions /* Sanity checks */ if(precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX; else if(precision==0) precision= 2; - bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, scene->unit.system, unit_type>>16, do_split, pad); + bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, unit->system, unit_type>>16, do_split, pad); } static float ui_get_but_step_unit(uiBut *but, float step_default) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); int unit_type= uiButGetUnitType(but)>>16; float step; - step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), scene->unit.system, unit_type); + step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type); if(step > 0.0f) { /* -1 is an error value */ return (float)((double)step/ui_get_but_scale_unit(but, 1.0))*100.0f; @@ -1629,12 +1627,11 @@ static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char * { char str_unit_convert[256]; const int unit_type= uiButGetUnitType(but); - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert)); /* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */ - bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type>>16); + bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), but->block->unit->system, unit_type>>16); return (BPY_button_exec(C, str_unit_convert, value, TRUE) != -1); } @@ -1981,7 +1978,10 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor block->active= 1; block->dt= dt; block->evil_C= (void*)C; // XXX - if (scn) block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT); + if (scn) { + block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT); + block->unit= &scn->unit; + } BLI_strncpy(block->name, name, sizeof(block->name)); if(region) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6f3ca2bf003..3bd29f8de3e 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2310,13 +2310,13 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa float fac= 1.0f; if(ui_is_but_unit(but)) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + UnitSettings *unit= but->block->unit; int unit_type= uiButGetUnitType(but)>>16; - if(bUnit_IsValid(scene->unit.system, unit_type)) { - fac= (float)bUnit_BaseScalar(scene->unit.system, unit_type); + if(bUnit_IsValid(unit->system, unit_type)) { + fac= (float)bUnit_BaseScalar(unit->system, unit_type); if(ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) { - fac /= scene->unit.scale_length; + fac /= unit->scale_length; } } } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 242210e01bb..40b98bebcd0 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -332,7 +332,9 @@ struct uiBlock { void *evil_C; // XXX hack for dynamic operator enums float _hsv[3]; // XXX, only access via ui_block_hsv_get() - char color_profile; // color profile for correcting linear colors for display + char color_profile; // color profile for correcting linear colors for display + struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. + }; typedef struct uiSafetyRct { -- cgit v1.2.3 From 561b49e9258f46229ccf5a2426d3deae01028ae3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Aug 2011 10:35:47 +0000 Subject: minor style change --- source/blender/python/intern/bpy_rna.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4d8d524d7e3..accc34152b5 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4309,7 +4309,6 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject PropertyRNA *parm; PyObject *ret, *item; int i, pyargs_len, pykw_len, parms_len, ret_len, flag, err= 0, kw_tot= 0, kw_arg; - const char *parm_id; PropertyRNA *pret_single= NULL; void *retdata_single= NULL; @@ -4385,28 +4384,29 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject continue; } - parm_id= RNA_property_identifier(parm); item= NULL; if (i < pyargs_len) { item= PyTuple_GET_ITEM(args, i); - i++; - kw_arg= FALSE; } else if (kw != NULL) { - item= PyDict_GetItemString(kw, parm_id); /* borrow ref */ + item= PyDict_GetItemString(kw, RNA_property_identifier(parm)); /* borrow ref */ if(item) kw_tot++; /* make sure invalid keywords are not given */ kw_arg= TRUE; } + i++; /* current argument */ + if (item==NULL) { if(flag & PROP_REQUIRED) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s(): required parameter \"%.200s\" not specified", - RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), parm_id); + RNA_struct_identifier(self_ptr->type), + RNA_function_identifier(self_func), + RNA_property_identifier(parm)); err= -1; break; } @@ -4433,9 +4433,18 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject PyErr_Clear(); /* re-raise */ if(kw_arg==TRUE) - snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with keyword argument \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), parm_id); + BLI_snprintf(error_prefix, sizeof(error_prefix), + "%.200s.%.200s(): error with keyword argument \"%.200s\" - ", + RNA_struct_identifier(self_ptr->type), + RNA_function_identifier(self_func), + RNA_property_identifier(parm)); else - snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id); + BLI_snprintf(error_prefix, sizeof(error_prefix), + "%.200s.%.200s(): error with argument %d, \"%.200s\" - ", + RNA_struct_identifier(self_ptr->type), + RNA_function_identifier(self_func), + i, + RNA_property_identifier(parm)); pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix); -- cgit v1.2.3 From 2c1182664cb65e760742ed43fa840cd241d74b4a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Aug 2011 10:38:34 +0000 Subject: minor speedup to python/rna api keyword argument lookups. - dont use hash lookups in this case because converting the string to unicode and doing a hash lookup is slower then looping over the keys and comparing (which avoids creating and throwning away a unicode string). --- source/blender/python/intern/bpy_rna.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index accc34152b5..1b8f986e71c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4297,6 +4297,27 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat return ret; } +/* Use to replace PyDict_GetItemString() when the overhead of converting a + * string into a python unicode is higher than a non hash lookup. + * works on small dict's such as keyword args. */ +static PyObject *small_dict_get_item_string(PyObject *dict, const char *key_lookup) +{ + PyObject *key= NULL; + Py_ssize_t pos = 0; + PyObject *value = NULL; + + /* case not, search for it in the script's global dictionary */ + while (PyDict_Next(dict, &pos, &key, &value)) { + if(PyUnicode_Check(key)) { + if(strcmp(key_lookup, _PyUnicode_AsString(key))==0) { + return value; + } + } + } + + return NULL; +} + static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject *kw) { /* Note, both BPy_StructRNA and BPy_PropertyRNA can be used here */ @@ -4391,7 +4412,11 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject kw_arg= FALSE; } else if (kw != NULL) { +#if 0 item= PyDict_GetItemString(kw, RNA_property_identifier(parm)); /* borrow ref */ +#else + item= small_dict_get_item_string(kw, RNA_property_identifier(parm)); /* borrow ref */ +#endif if(item) kw_tot++; /* make sure invalid keywords are not given */ -- cgit v1.2.3 From 3a81f23e0975ea87ade780965462ad5b15b39d95 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Aug 2011 16:21:29 +0000 Subject: warning cleanup for -Wdouble-promotion --- source/blender/blenkernel/intern/cloth.c | 2 +- source/blender/blenlib/intern/jitter.c | 74 +++++++++++----------- source/blender/blenlib/intern/math_geom.c | 6 +- source/blender/blenlib/intern/math_rotation.c | 6 +- source/blender/blenlib/intern/rct.c | 8 +-- source/blender/blenlib/intern/scanfill.c | 16 ++--- .../blender/editors/interface/interface_widgets.c | 2 +- source/blender/editors/object/object_add.c | 2 +- source/blender/editors/object/object_bake.c | 4 +- .../editors/space_outliner/outliner_intern.h | 4 +- source/blender/editors/space_view3d/view3d_draw.c | 8 +-- source/blender/editors/space_view3d/view3d_edit.c | 4 +- source/blender/editors/space_view3d/view3d_fly.c | 2 +- source/blender/editors/transform/transform.c | 2 +- source/blender/makesrna/intern/rna_sequencer.c | 2 +- .../blender/render/intern/source/convertblender.c | 16 ++--- .../blender/render/intern/source/volume_precache.c | 4 +- source/blender/render/intern/source/volumetric.c | 18 +++--- source/blender/render/intern/source/voxeldata.c | 6 +- source/blender/windowmanager/intern/wm_operators.c | 2 +- 20 files changed, 94 insertions(+), 94 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index ea055e90b45..3a86389dba7 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -923,7 +923,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d for(i = 0; i < dm->getNumVerts(dm); i++) { - maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0)); + maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f)); } clmd->clothObject->bvhselftree = bvhselftree_build_from_cloth ( clmd, maxdist ); diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c index 16f0c86c449..f0e81d6b5e9 100644 --- a/source/blender/blenlib/intern/jitter.c +++ b/source/blender/blenlib/intern/jitter.c @@ -53,10 +53,10 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1) y = jit1[i+1]; for (j = 2*num-2; j>=0 ; j-=2) { if (i != j){ - vecx = jit1[j] - x - 1.0; - vecy = jit1[j+1] - y - 1.0; + vecx = jit1[j] - x - 1.0f; + vecy = jit1[j+1] - y - 1.0f; for (k = 3; k>0 ; k--){ - if( fabs(vecx)0 && len0 && len0 && len= 0 ; j-=2){ if (i != j){ - vecx = jit1[j] - x - 1.0; - vecy = jit1[j+1] - y - 1.0; + vecx = jit1[j] - x - 1.0f; + vecy = jit1[j+1] - y - 1.0f; - if( fabs(vecx) 0.0) { + else if (i > 0.0f) { const float i_sqrt= sqrt(i); /* avoid calc twice */ /* first intersection */ @@ -456,7 +456,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2], madd_v2_v2v2fl(r_p1, l1, ldir, mu); return 1; } - else if (i > 0.0) { + else if (i > 0.0f) { const float i_sqrt= sqrt(i); /* avoid calc twice */ /* first intersection */ @@ -2010,7 +2010,7 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f } if(IS_ZERO(denom)==0) - uv[1]= (float) (( (1-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom); + uv[1]= (float) (( (1.0f-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom); } } diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index dfd715ccbf2..e3e507d016a 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -213,7 +213,7 @@ void quat_to_mat4(float m[][4], const float q[4]) double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc; #ifdef DEBUG - if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0f) < (float)QUAT_EPSILON))) { + if(!((q0=dot_qtqt(q, q))==0.0f || (fabs(q0-1.0) < QUAT_EPSILON))) { fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0); } #endif @@ -492,8 +492,8 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag) else angle= (float)(-0.5*atan2(-fp[0], -fp[1])); } - co= (float)cos(angle); - si= (float)(sin(angle)/len1); + co= cosf(angle); + si= sinf(angle)/len1; q2[0]= co; q2[1]= x2*si; q2[2]= y2*si; diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 17b07b49309..31ae8adc2d4 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -233,10 +233,10 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest) void BLI_copy_rcti_rctf(rcti *tar, const rctf *src) { - tar->xmin= floor(src->xmin + 0.5); - tar->xmax= floor((src->xmax - src->xmin) + 0.5); - tar->ymin= floor(src->ymin + 0.5); - tar->ymax= floor((src->ymax - src->ymin) + 0.5); + tar->xmin= floor(src->xmin + 0.5f); + tar->xmax= floor((src->xmax - src->xmin) + 0.5f); + tar->ymin= floor(src->ymin + 0.5f); + tar->ymax= floor((src->ymax - src->ymin) + 0.5f); } void print_rctf(const char *str, rctf *rect) diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 47a07d86e66..b159106f748 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -288,7 +288,7 @@ static short testedgeside(float *v1, float *v2, float *v3) inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy]) +(v1[coy]-v2[coy])*(v1[cox]-v3[cox]); - if(inp<0.0) return 0; + if(inp < 0.0f) return 0; else if(inp==0) { if(v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0; if(v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0; @@ -312,8 +312,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed) y= eed->v1->co[coy]; fac1= eed->v2->co[coy]-y; - if(fac1==0.0) { - fac1= 1.0e10*(eed->v2->co[cox]-x); + if(fac1==0.0f) { + fac1= 1.0e10f*(eed->v2->co[cox]-x); } else fac1= (x-eed->v2->co[cox])/fac1; @@ -324,8 +324,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed) if(ed->v2==eed->v2) return 0; fac= ed->v2->co[coy]-y; - if(fac==0.0) { - fac= 1.0e10*(ed->v2->co[cox]-x); + if(fac==0.0f) { + fac= 1.0e10f*(ed->v2->co[cox]-x); } else fac= (x-ed->v2->co[cox])/fac; @@ -443,7 +443,7 @@ static void testvertexnearedge(void) vec2[1]= eed->v2->co[coy]; if(boundinsideEV(eed,eve)) { dist= dist_to_line_v2(vec1,vec2,vec3); - if(distv1, eve); @@ -816,7 +816,7 @@ int BLI_edgefill(short mat_nr) if(v2) { if( compare_v3v3(v2, eve->co, COMPLIMIT)==0) { len= normal_tri_v3( norm,v1, v2, eve->co); - if(len != 0.0) break; + if(len != 0.0f) break; } } else if(compare_v3v3(v1, eve->co, COMPLIMIT)==0) { @@ -825,7 +825,7 @@ int BLI_edgefill(short mat_nr) eve= eve->next; } - if(len==0.0) return 0; /* no fill possible */ + if(len==0.0f) return 0; /* no fill possible */ norm[0]= fabs(norm[0]); norm[1]= fabs(norm[1]); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d235fd0c16a..5da875356ea 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -180,7 +180,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y glEnable(GL_BLEND); glGetFloatv(GL_CURRENT_COLOR, color); - color[3]*= 0.125; + color[3] *= 0.125f; glColor4fv(color); /* for each AA step */ diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index cd42661f320..d5f10f1d37d 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -182,7 +182,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) } RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX); - RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -M_PI * 2.0f, M_PI * 2.0f); + RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f); prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); RNA_def_property_flag(prop, PROP_HIDDEN); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 679e4e58017..ee162464c70 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -636,14 +636,14 @@ static void apply_heights_data(void *bake_data) if(ibuf->rect_float) { float *rrgbf= ibuf->rect_float + i*4; - if(max-min > 1e-5) height= (heights[i]-min)/(max-min); + if(max-min > 1e-5f) height= (heights[i]-min)/(max-min); else height= 0; rrgbf[0]=rrgbf[1]=rrgbf[2]= height; } else { char *rrgb= (char*)ibuf->rect + i*4; - if(max-min > 1e-5) height= (heights[i]-min)/(max-min); + if(max-min > 1e-5f) height= (heights[i]-min)/(max-min); else height= 0; rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height); diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 1a6448588aa..cf4ce9c06a8 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -124,8 +124,8 @@ typedef struct TreeElement { #define OL_TOGW OL_TOG_RESTRICT_VIEWX #define OL_RNA_COLX (UI_UNIT_X*15) -#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5) -#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5) +#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5f) +#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5f) /* outliner_tree.c ----------------------------------------------- */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7cf95261211..f8837594ddb 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -721,7 +721,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) { #define ROT_AXIS_DETAIL 13 const float s = 0.05f * scale; - const float step = 2.f * M_PI / ROT_AXIS_DETAIL; + const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL); float angle; int i; @@ -1041,7 +1041,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons glBegin(GL_LINES); if(w > h) { if(golden) { - ofs = w * (1.0f-(1.0f/1.61803399)); + ofs = w * (1.0f-(1.0f/1.61803399f)); } else { ofs = h * (h / w); @@ -1059,7 +1059,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons } else { if(golden) { - ofs = h * (1.0f-(1.0f/1.61803399)); + ofs = h * (1.0f-(1.0f/1.61803399f)); } else { ofs = w * (w / h); @@ -1203,7 +1203,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) if (ca->dtx & CAM_DTX_GOLDEN) { UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399)); + drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399f)); } if (ca->dtx & CAM_DTX_GOLDEN_TRI_A) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 3e6bbc13334..979a602b4f5 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1697,7 +1697,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac) { RegionView3D *rv3d= ar->regiondata; - madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0 - dfac)); + madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0f - dfac)); } static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert) @@ -1718,7 +1718,7 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv if (zoom_invert) SWAP(float, len1, len2); - zfac = 1.0 + ((len2 - len1) * 0.01 * vod->rv3d->dist); + zfac = 1.0f + ((len2 - len1) * 0.01f * vod->rv3d->dist); } if(zfac != 1.0f) diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 046037a092f..30d1a508888 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -867,7 +867,7 @@ static int flyApply(bContext *C, FlyInfo *fly) upvec[2]=1; mul_m3_v3(mat, upvec); /*make sure we have some z rolling*/ - if (fabs(upvec[2]) > 0.00001f) { + if (fabsf(upvec[2]) > 0.00001f) { roll= upvec[2] * -5.0f; upvec[0]= 1.0f; /*rotate the view about this axis*/ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 03a98bf30d8..b234ac4ceec 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4648,7 +4648,7 @@ static int createSlideVerts(TransInfo *t) uv_new = tf->uv[k]; if (ev->tmp.l) { - if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) { + if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) { ev->tmp.l = -1; /* Tag as invalid */ BLI_linklist_free(suv->fuv_list,NULL); suv->fuv_list = NULL; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 8c4e4d9e736..476ac325848 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1481,7 +1481,7 @@ static void rna_def_wipe(BlenderRNA *brna) #if 1 /* expose as radians */ prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_funcs(prop, "rna_WipeSequence_angle_get", "rna_WipeSequence_angle_set", NULL); - RNA_def_property_range(prop, DEG2RAD(-90.0f), DEG2RAD(90.0f)); + RNA_def_property_range(prop, DEG2RAD(-90.0), DEG2RAD(90.0)); #else prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "angle"); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index b385b507707..f749d1ba004 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -192,10 +192,10 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void), /* minimal free space (starting at camera) */ starmindist= wrld->starmindist; - if (stargrid <= 0.10) return; + if (stargrid <= 0.10f) return; if (re) re->flag |= R_HALO; - else stargrid *= 1.0; /* then it draws fewer */ + else stargrid *= 1.0f; /* then it draws fewer */ if(re) invert_m4_m4(mat, re->viewmat); else unit_m4(mat); @@ -267,17 +267,17 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void), if (alpha >= clipend) alpha = 0.0; else if (alpha <= starmindist) alpha = 0.0; - else if (alpha <= 2.0 * starmindist) { + else if (alpha <= 2.0f * starmindist) { alpha = (alpha - starmindist) / starmindist; } else { - alpha -= 2.0 * starmindist; - alpha /= (clipend - 2.0 * starmindist); - alpha = 1.0 - alpha; + alpha -= 2.0f * starmindist; + alpha /= (clipend - 2.0f * starmindist); + alpha = 1.0f - alpha; } } - if (alpha != 0.0) { + if (alpha != 0.0f) { fac = force * BLI_drand(); har = initstar(re, obr, vec, fac); @@ -822,7 +822,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d if(obr->totvert==0) return; asverts= MEM_callocN(sizeof(ASvert)*obr->totvert, "all smooth verts"); - thresh= cos( M_PI*(0.5f+(float)degr)/180.0 ); + thresh= cosf((float)M_PI*(0.5f+(float)degr)/180.0f ); /* step zero: give faces normals of original mesh, if this is provided */ diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index faa915b7f6c..2037acc943f 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -400,7 +400,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi sb[j] += vp->data_b[i]; /* Displays progress every second */ - if(time-lasttime>1.0f) { + if(time-lasttime>1.0) { char str[64]; BLI_snprintf(str, sizeof(str), "Simulating multiple scattering: %d%%", (int)(100.0f * (c / total))); re->i.infostr= str; @@ -747,7 +747,7 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o caching=0; time= PIL_check_seconds_timer(); - if(time-lasttime>1.0f) { + if(time-lasttime>1.0) { char str[64]; BLI_snprintf(str, sizeof(str), "Precaching volume: %d%%", (int)(100.0f * ((float)counter / (float)totparts))); re->i.infostr= str; diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 359002d05ae..19bbb11e143 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -422,9 +422,9 @@ static void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize tau[1] += stepd * sigma_t[1]; tau[2] += stepd * sigma_t[2]; - tr[0] *= exp(-tau[0]); - tr[1] *= exp(-tau[1]); - tr[2] *= exp(-tau[2]); + tr[0] *= expf(-tau[0]); + tr[1] *= expf(-tau[1]); + tr[2] *= expf(-tau[2]); } /* Compute transmittance = e^(-attenuation) */ @@ -473,7 +473,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, if (lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) return; if ((lar->lay & shi->lay)==0) return; - if (lar->energy == 0.0) return; + if (lar->energy == 0.0f) return; if ((visifac= lamp_get_visibility(lar, co, lv, &lampdist)) == 0.f) return; @@ -613,7 +613,7 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float /* transmittance component (alpha) */ vol_get_transmittance_seg(shi, tr, stepsize, co, density); - if (t0 > t1 * 0.25) { + if (t0 > t1 * 0.25f) { /* only use depth cutoff after we've traced a little way into the volume */ if (luminance(tr) < shi->mat->vol.depth_cutoff) break; } @@ -623,9 +623,9 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float if (shi->obi->volume_precache) { float p2[3]; - p2[0] = p[0] + (step_vec[0] * 0.5); - p2[1] = p[1] + (step_vec[1] * 0.5); - p2[2] = p[2] + (step_vec[2] * 0.5); + p2[0] = p[0] + (step_vec[0] * 0.5f); + p2[1] = p[1] + (step_vec[1] * 0.5f); + p2[2] = p[2] + (step_vec[2] * 0.5f); vol_get_precached_scattering(&R, shi, scatter_col, p2); } else @@ -817,7 +817,7 @@ void shade_volume_inside(ShadeInput *shi, ShadeResult *shr) volume_trace(shi, shr, VOL_SHADE_INSIDE); shr->alpha = shr->alpha + prev_alpha; - CLAMP(shr->alpha, 0.0, 1.0); + CLAMP(shr->alpha, 0.0f, 1.0f); shi->mat = mat_backup; shi->obi = obi_backup; diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 232f7fdeede..2ba346ae4c5 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -413,9 +413,9 @@ int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres) } case TEX_REPEAT: { - co[0] = co[0] - floor(co[0]); - co[1] = co[1] - floor(co[1]); - co[2] = co[2] - floor(co[2]); + co[0] = co[0] - floorf(co[0]); + co[1] = co[1] - floorf(co[1]); + co[2] = co[2] - floorf(co[2]); break; } case TEX_EXTEND: diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1beb5b3dda3..fdf89cfd2be 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2926,7 +2926,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd case PROP_FACTOR: r1= (1 - rc->current_value) * WM_RADIAL_CONTROL_DISPLAY_SIZE; r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE; - alpha = rc->current_value / 2 + 0.5; + alpha = rc->current_value / 2.0f + 0.5f; break; case PROP_ANGLE: r1= r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE; -- cgit v1.2.3