[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12608] branches/cloth/blender: svn merge -r 12496:12607 https://svn.blender.org/svnroot/bf-blender/trunk/ blender
Daniel Genrich
daniel.genrich at gmx.net
Fri Nov 16 15:41:08 CET 2007
Revision: 12608
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12608
Author: genscher
Date: 2007-11-16 15:41:07 +0100 (Fri, 16 Nov 2007)
Log Message:
-----------
svn merge -r 12496:12607 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Modified Paths:
--------------
branches/cloth/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
branches/cloth/blender/release/scripts/weightpaint_normalize.py
branches/cloth/blender/source/Makefile
branches/cloth/blender/source/blender/blenkernel/BKE_global.h
branches/cloth/blender/source/blender/blenkernel/BKE_node.h
branches/cloth/blender/source/blender/blenkernel/bad_level_call_stubs/stubs.c
branches/cloth/blender/source/blender/blenkernel/intern/action.c
branches/cloth/blender/source/blender/blenkernel/intern/armature.c
branches/cloth/blender/source/blender/blenkernel/intern/constraint.c
branches/cloth/blender/source/blender/blenkernel/intern/curve.c
branches/cloth/blender/source/blender/blenkernel/intern/image.c
branches/cloth/blender/source/blender/blenkernel/intern/ipo.c
branches/cloth/blender/source/blender/blenkernel/intern/modifier.c
branches/cloth/blender/source/blender/blenkernel/intern/object.c
branches/cloth/blender/source/blender/blenkernel/intern/softbody.c
branches/cloth/blender/source/blender/blenkernel/intern/texture.c
branches/cloth/blender/source/blender/blenlib/BLI_arithb.h
branches/cloth/blender/source/blender/blenlib/intern/arithb.c
branches/cloth/blender/source/blender/blenlib/intern/util.c
branches/cloth/blender/source/blender/blenloader/intern/readfile.c
branches/cloth/blender/source/blender/blenloader/intern/writefile.c
branches/cloth/blender/source/blender/include/BDR_editcurve.h
branches/cloth/blender/source/blender/include/BIF_editseq.h
branches/cloth/blender/source/blender/include/BIF_filelist.h
branches/cloth/blender/source/blender/include/BIF_usiblender.h
branches/cloth/blender/source/blender/include/butspace.h
branches/cloth/blender/source/blender/makesdna/DNA_armature_types.h
branches/cloth/blender/source/blender/makesdna/DNA_constraint_types.h
branches/cloth/blender/source/blender/makesdna/DNA_ipo_types.h
branches/cloth/blender/source/blender/makesdna/DNA_material_types.h
branches/cloth/blender/source/blender/makesdna/DNA_modifier_types.h
branches/cloth/blender/source/blender/makesdna/DNA_object_force.h
branches/cloth/blender/source/blender/makesdna/DNA_scene_types.h
branches/cloth/blender/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
branches/cloth/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
branches/cloth/blender/source/blender/python/BPY_interface.c
branches/cloth/blender/source/blender/python/api2_2x/Armature.c
branches/cloth/blender/source/blender/python/api2_2x/Blender.c
branches/cloth/blender/source/blender/python/api2_2x/Constraint.c
branches/cloth/blender/source/blender/python/api2_2x/CurNurb.c
branches/cloth/blender/source/blender/python/api2_2x/Geometry.c
branches/cloth/blender/source/blender/python/api2_2x/Mesh.c
branches/cloth/blender/source/blender/python/api2_2x/Scene.c
branches/cloth/blender/source/blender/python/api2_2x/Texture.c
branches/cloth/blender/source/blender/python/api2_2x/doc/Curve.py
branches/cloth/blender/source/blender/python/api2_2x/doc/Geometry.py
branches/cloth/blender/source/blender/python/api2_2x/doc/Texture.py
branches/cloth/blender/source/blender/render/extern/include/RE_shader_ext.h
branches/cloth/blender/source/blender/render/intern/source/rayshade.c
branches/cloth/blender/source/blender/render/intern/source/shadeinput.c
branches/cloth/blender/source/blender/render/intern/source/shadeoutput.c
branches/cloth/blender/source/blender/render/intern/source/texture.c
branches/cloth/blender/source/blender/src/buttons_editing.c
branches/cloth/blender/source/blender/src/buttons_object.c
branches/cloth/blender/source/blender/src/buttons_scene.c
branches/cloth/blender/source/blender/src/buttons_shading.c
branches/cloth/blender/source/blender/src/drawarmature.c
branches/cloth/blender/source/blender/src/drawimage.c
branches/cloth/blender/source/blender/src/drawnode.c
branches/cloth/blender/source/blender/src/drawobject.c
branches/cloth/blender/source/blender/src/drawtime.c
branches/cloth/blender/source/blender/src/drawview.c
branches/cloth/blender/source/blender/src/editarmature.c
branches/cloth/blender/source/blender/src/editcurve.c
branches/cloth/blender/source/blender/src/editimasel.c
branches/cloth/blender/source/blender/src/editipo.c
branches/cloth/blender/source/blender/src/editipo_lib.c
branches/cloth/blender/source/blender/src/editmesh_add.c
branches/cloth/blender/source/blender/src/editmesh_lib.c
branches/cloth/blender/source/blender/src/editobject.c
branches/cloth/blender/source/blender/src/editseq.c
branches/cloth/blender/source/blender/src/filelist.c
branches/cloth/blender/source/blender/src/filesel.c
branches/cloth/blender/source/blender/src/header_info.c
branches/cloth/blender/source/blender/src/headerbuttons.c
branches/cloth/blender/source/blender/src/interface_panel.c
branches/cloth/blender/source/blender/src/meshlaplacian.c
branches/cloth/blender/source/blender/src/outliner.c
branches/cloth/blender/source/blender/src/poseobject.c
branches/cloth/blender/source/blender/src/space.c
branches/cloth/blender/source/blender/src/toets.c
branches/cloth/blender/source/blender/src/transform_conversions.c
branches/cloth/blender/source/blender/src/transform_generics.c
branches/cloth/blender/source/blender/src/transform_manipulator.c
branches/cloth/blender/source/blender/src/usiblender.c
branches/cloth/blender/source/blender/src/view.c
branches/cloth/blender/source/blender/src/vpaint.c
branches/cloth/blender/source/creator/buildinfo.c
branches/cloth/blender/source/creator/creator.c
branches/cloth/blender/tools/Blender.py
Modified: branches/cloth/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- branches/cloth/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2007-11-16 14:24:43 UTC (rev 12607)
+++ branches/cloth/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2007-11-16 14:41:07 UTC (rev 12608)
@@ -54,7 +54,7 @@
#define WM_MOUSEWHEEL 0x020A
#endif // WM_MOUSEWHEEL
#ifndef WHEEL_DELTA
-#define WHEEL_DELTA 120 /* Value for rolling one detent */
+#define WHEEL_DELTA 120 /* Value for rolling one detent, (old convention! MS changed it) */
#endif // WHEEL_DELTA
@@ -479,7 +479,11 @@
{
// short fwKeys = LOWORD(wParam); // key flags
int zDelta = (short) HIWORD(wParam); // wheel rotation
- zDelta /= WHEEL_DELTA;
+
+ // zDelta /= WHEEL_DELTA;
+ // temporary fix below: microsoft now has added more precision, making the above division not work
+ if (zDelta <= 0 ) zDelta= -1; else zDelta= 1;
+
// short xPos = (short) LOWORD(lParam); // horizontal position of pointer
// short yPos = (short) HIWORD(lParam); // vertical position of pointer
return new GHOST_EventWheel (getSystem()->getMilliSeconds(), window, zDelta);
Modified: branches/cloth/blender/release/scripts/weightpaint_normalize.py
===================================================================
--- branches/cloth/blender/release/scripts/weightpaint_normalize.py 2007-11-16 14:24:43 UTC (rev 12607)
+++ branches/cloth/blender/release/scripts/weightpaint_normalize.py 2007-11-16 14:41:07 UTC (rev 12608)
@@ -40,55 +40,101 @@
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-from Blender import Scene, Draw
+from Blender import Scene, Draw, Object, Modifier
import BPyMesh
SMALL_NUM= 0.000001
-def actWeightNormalize(me, PREF_PEAKWEIGHT, PREF_KEEP_PROPORTION):
+
+def getArmatureGroups(ob, me):
+ arm_obs = []
+
+ arm = ob.parent
+ if arm and arm.type == 'Armature' and ob.parentType == Object.ParentTypes.ARMATURE:
+ arm_obs.append(arm)
+
+ for m in ob.modifiers:
+ if m.type== Modifier.Types.ARMATURE:
+ arm = m[Modifier.Settings.OBJECT]
+ if arm:
+ arm_obs.append(arm)
+
+ # convert to a dict and back, should be a set! :/ - python 2.3 dosnt like.
+ return dict([ (bonename, None) for arm in arm_obs for bonename in arm.data.bones.keys() ]).keys()
+
+
+
+def actWeightNormalize(me, ob, PREF_PEAKWEIGHT, PREF_ACTIVE_ONLY, PREF_ARMATURE_ONLY, PREF_KEEP_PROPORTION):
+
groupNames, vWeightDict= BPyMesh.meshWeight2Dict(me)
new_weight= max_weight= -1.0
act_group= me.activeGroup
- vWeightDictUsed=[False] * len(vWeightDict)
+ if PREF_ACTIVE_ONLY:
+ normalizeGroups = [act_group]
+ else:
+ normalizeGroups = groupNames[:]
- for i, wd in enumerate(vWeightDict):
- try:
- new_weight= wd[act_group]
- if new_weight > max_weight:
- max_weight= new_weight
- vWeightDictUsed[i]=wd
- except:
- pass
+ if PREF_ARMATURE_ONLY:
+
+ armature_groups = getArmatureGroups(ob, me)
+
+ i = len(normalizeGroups)
+ while i:
+ i-=1
+ if not normalizeGroups[i] in armature_groups:
+ del normalizeGroups[i]
- if max_weight < SMALL_NUM or new_weight == -1:
- Draw.PupMenu('No verts to normalize. exiting.')
- return
- if abs(max_weight-PREF_PEAKWEIGHT) < SMALL_NUM:
- Draw.PupMenu('Vert Weights are alredy normalized.')
- return
-
- max_weight= max_weight/PREF_PEAKWEIGHT
-
- if PREF_KEEP_PROPORTION:
- # TODO, PROPORTIONAL WEIGHT SCALING.
- for wd in vWeightDictUsed:
- if wd: # not false.
- if len(wd) == 1:
- # Only 1 group for thsi vert. Simple
- wd[act_group] /= max_weight
- else:
- # More then 1 group. will need to scale all users evenly.
- local_maxweight= max(wd.itervalues()) / PREF_PEAKWEIGHT
- for weight in wd.iterkeys():
- wd[weight] /= local_maxweight
+ for act_group in normalizeGroups:
+ vWeightDictUsed=[False] * len(vWeightDict)
+
+ for i, wd in enumerate(vWeightDict):
+ try:
+ new_weight= wd[act_group]
+ if new_weight > max_weight:
+ max_weight= new_weight
+ vWeightDictUsed[i]=wd
+ except:
+ pass
-
- else: # Simple, just scale the weights up.
- for wd in vWeightDictUsed:
- if wd: # not false.
- wd[act_group] /= max_weight
+ # These can be skipped for now, they complicate things when using multiple vgroups,
+ '''
+ if max_weight < SMALL_NUM or new_weight == -1:
+ Draw.PupMenu('No verts to normalize. exiting.')
+ #return
+ if abs(max_weight-PREF_PEAKWEIGHT) < SMALL_NUM:
+ Draw.PupMenu('Vert Weights are alredy normalized.')
+ #return
+ '''
+ max_weight= max_weight/PREF_PEAKWEIGHT
+
+ if PREF_KEEP_PROPORTION:
+ # TODO, PROPORTIONAL WEIGHT SCALING.
+ for wd in vWeightDictUsed:
+ if wd: # not false.
+ if len(wd) == 1:
+ # Only 1 group for thsi vert. Simple
+ wd[act_group] /= max_weight
+ else:
+ # More then 1 group. will need to scale all users evenly.
+ if PREF_ARMATURE_ONLY:
+ local_maxweight= max([v for k, v in wd.iteritems() if k in armature_groups]) / PREF_PEAKWEIGHT
+ if local_maxweight > 0.0:
+ # So groups that are not used in any bones are ignored.
+ for weight in wd.iterkeys():
+ if weight in armature_groups:
+ wd[weight] /= local_maxweight
+ else:
+ local_maxweight= max(wd.itervalues()) / PREF_PEAKWEIGHT
+ for weight in wd.iterkeys():
+ wd[weight] /= local_maxweight
+
+ else: # Simple, just scale the weights up. we alredy know this is in an armature group (if needed)
+ for wd in vWeightDictUsed:
+ if wd: # not false.
+ wd[act_group] /= max_weight
+
# Copy weights back to the mesh.
BPyMesh.dict2MeshWeight(me, groupNames, vWeightDict)
@@ -104,17 +150,21 @@
me= ob.getData(mesh=1)
PREF_PEAKWEIGHT= Draw.Create(1.0)
+ PREF_ACTIVE_ONLY= Draw.Create(1)
PREF_KEEP_PROPORTION= Draw.Create(1)
+ PREF_ARMATURE_ONLY= Draw.Create(0)
pup_block= [\
('Peak Weight:', PREF_PEAKWEIGHT, 0.01, 1.0, 'Upper weight for normalizing.'),\
+ ('Active Only', PREF_ACTIVE_ONLY, 'Only Normalize groups that have matching bones in an armature (when an armature is used).'),\
('Proportional', PREF_KEEP_PROPORTION, 'Scale other weights so verts (Keep weights with other groups in proportion).'),\
+ ('Armature Only', PREF_ARMATURE_ONLY, 'Only Normalize groups that have matching bones in an armature (when an armature is used).'),\
]
if not Draw.PupBlock('Clean Selected Meshes...', pup_block):
return
- actWeightNormalize(me, PREF_PEAKWEIGHT.val, PREF_KEEP_PROPORTION.val)
+ actWeightNormalize(me, ob, PREF_PEAKWEIGHT.val, PREF_ACTIVE_ONLY.val, PREF_ARMATURE_ONLY.val, PREF_KEEP_PROPORTION.val)
if __name__=='__main__':
main()
\ No newline at end of file
Modified: branches/cloth/blender/source/Makefile
===================================================================
--- branches/cloth/blender/source/Makefile 2007-11-16 14:24:43 UTC (rev 12607)
+++ branches/cloth/blender/source/Makefile 2007-11-16 14:41:07 UTC (rev 12608)
@@ -56,6 +56,7 @@
BUILDINFO_C = $(SRCHOME)/creator/buildinfo.c
BUILD_DATE := $(shell date "+%Y-%m-%d")
BUILD_TIME := $(shell date "+%H:%M:%S")
+ BUILD_REV := $(shell svnversion)
endif
############# set pyplayerlib ##################
@@ -546,7 +547,7 @@
$(DIR)/$(DEBUG_DIR)bin/blenderstatic: $(OBJS) $(GRPLIB) $(COMLIB) $(PULIB)
@echo "****> Link $@"
ifdef NAN_BUILDINFO
- $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"static"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
+ $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"static"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
endif
mkdir -p $(DIR)/$(DEBUG_DIR)bin
$(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderstatic $(BUILDINFO_O) $(OBJS) $(GRPLIB) $(COMLIB) $(PULIB) $(PYLIB) $(LLIBS) $(SADD) $(LOPTS)
@@ -560,7 +561,7 @@
$(DIR)/$(DEBUG_DIR)bin/blender$(EXT): $(OBJS) $(GRPLIB) $(COMLIB) $(PULIB)
@echo "****> Link $@"
ifdef NAN_BUILDINFO
- $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
+ $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
endif
mkdir -p $(DIR)/$(DEBUG_DIR)bin
$(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blender$(EXT) $(BUILDINFO_O) $(OBJS) $(GRPLIB) $(COMLIB) $(PULIB) $(PYLIB) $(LLIBS) $(DADD) $(LOPTS)
@@ -574,7 +575,7 @@
$(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT): $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB)
@echo "****> Link $@"
ifdef NAN_BUILDINFO
- $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
+ $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
endif
mkdir -p $(DIR)/$(DEBUG_DIR)bin
$(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT) $(BUILDINFO_O) $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB) $(PYPLAYERLIB) $(LLIBS) $(DADD) $(LOPTS)
@@ -588,7 +589,7 @@
$(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT): $(OBJS) $(COMLIB) $(SPLIB)
@echo "****> Link $@"
ifdef NAN_BUILDINFO
- $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
+ $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
endif
mkdir -p $(DIR)/$(DEBUG_DIR)bin
$(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT) $(BUILDINFO_O) $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB) $(PYLIB) $(LLIBS) $(DADD) $(LOPTS)
@@ -602,7 +603,7 @@
$(DIR)/$(DEBUG_DIR)bin/Blender3DPlugin$(SOEXT): $(PLUGAPPLIB_XPLINK)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list