[Bf-python] Python API feature request
Campbell Barton
cbarton at metavr.com
Thu Apr 12 16:51:08 CEST 2007
be careful using the selection, since selected objects can be on the a
layer thats not seen.
This is more correct - of course for your own use what you have is fine.
scn.objects.context - checks for visibility and selection.
>> scn = bpy.scenes.active
>> obs = scn.objects.context
>>
>> print "Captain Hook ? working..."
>>
>> for ob in obs:
>> for m in ob.modifiers:
>> try: m.reset()
>> except: pass
>> print "procesado",ob.name
>> ob.makeDisplayList()
>>
>> print "finished \n"
Joe Eagar wrote:
> Claudio "malefico" Andaur wrote:
>> 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.
>>
> Please don't keep the name captain hook if this is committed to cvs,
> though. ;)
>
> Reset All Modifiers or something would be better :) And less confusing.
>
> Joe
>> 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
>>>>
>>>
>>>
>>
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at projects.blender.org
>> http://projects.blender.org/mailman/listinfo/bf-python
>>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>
--
See MetaVR Visuals Used at the Combat Studies Institute
http://www.metavr.com/casestudies/baghdadviews.html
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-python
mailing list