[Bf-python] Python API feature request

Claudio "malefico" Andaur malefico at manosdigitales.com
Wed Apr 11 15:36:04 CEST 2007


As I told Campbell in IRC, here it is a newer version of your script 
with minor tweaks done by CJD (our pythion guru) to make it work in all 
selected objects. We took the liberty to call it Captain Hook. You know, 
people just can't help it.

Regards

malefico

PS: This script resets all hook modifiers for all selected objects. 
Great timesaver for riggers who like lattices and hooks ;-)

---------------------
#!BPY

"""
Name: 'Captain Hook'
Blender: 242
Group: 'Object'
Tooltip: 'resets all hook modifiers this object uses'
"""
import bpy
scn = bpy.scenes.active
obs = scn.objects

print "Captain Hook ? working..."

for ob in obs:
    if ob.sel == True:
        for m in ob.modifiers:
            try:        m.reset()
            except:        pass
        print "procesado",ob.name
        ob.makeDisplayList()

print "finished \n"
--------------------------------------

Campbell Barton wrote:
> Just added .reset() to blender-cvs,
>
> heres the script
>
> #!BPY
>
> """
> Name: 'Reset All Hooks'
> Blender: 242
> Group: 'Object'
> Tooltip: 'resets hooks of all modifiers this object uses'
> """
> import bpy
> scn = bpy.scenes.active
> ob = scn.objects.active
>
> for m in ob.modifiers:
>     try:        m.reset()
>     except:        pass
>
> ob.makeDisplayList()
>
>
>
> Claudio "malefico" Andaur wrote:
>> Hey python gurus !
>>
>> I would like to explain a little problem I have.
>>
>> When using hooks extensively, let's say I have a character with 60-70 
>> hooks in different objects, and you need to make a little tweak on 
>> the character, it is often needed to "reset" every hook modifier 
>> which is a big big BIG pain in the ass.
>>
>> Now, we thought it would be better if we could script this resetting 
>> and apply script for the currently selected object, or groups of 
>> objects. Nice idea.
>>
>> The thing is, I've been told by python gurus here at the studio that 
>> API doesn't currently let us access to the "reset" function in Hook 
>> modifier.
>>
>> I would really appreciate if this could be added, to light up my work 
>> a little.
>>
>> Thanks in advance !
>>
>>
>> malefico.
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at projects.blender.org
>> http://projects.blender.org/mailman/listinfo/bf-python
>>
>
>




More information about the Bf-python mailing list