[Bf-committers] Global undo & running python scripts

joeedh joeeagar at prodigy.net
Tue Feb 1 15:16:00 CET 2005


Jonathan Merritt wrote:

> Hi joeedh,
>
> joeedh wrote:
>
>>> <... snip to save bandwidth ...>
>>
>>
>> I proposed something very similar to this last year.  My frustration 
>> with bpython's ability to produce real "plugins" lead me to write the 
>> (very simple) OnSave scriptlink, and eventually to a version of your 
>> idea.
>> Anyway, I think your idea is better then mine, and you seemed to have 
>> developed it into a more logical fashion.
>>
>> joeedh
>
>
>
> Thanks. :-)  My suggestions are based mostly on the problems I had in 
> setting up the simple system of:
>    1. Start the script.
>    2. User selects an object.
>    3. The script responds.
>
> The "standard" model for this in the past seems to have been:
>    1. Start the script.
>    2. User selects an object.
>    3. User clicks a button in the script to tell it that an object has 
> been selected.
>    4. The script responds.
>
> The second model is fine for a one-off event that modifies an object, 
> or something like that, but in my script I was matching up image 
> markers with empties in a scene.  Hence, my script had to be 
> dynamically interactive.
>
> I think there's a very clear difference between "interactive" scripts 
> and "run-once" scripts.  The interactive scripts rely on a rich set of 
> information to be passed from Blender regarding all manner of changes 
> that may take place outside of the script and inside Blender's 
> internal state.  Using a scriptlink is really not completely adequate, 
> since:
>    a) users can see script links that have been put in place, and can 
> remove them while a script is running!,
>    b) script links do not allow scripts to respond in different ways 
> depending upon the event that the script is responding to.
>
> Maybe other people who have been working on interactive scripts could 
> comment here?
>
I ran into the same problems.  I managed to solve the obvious problem of 
saving data with OnSave scriptlink, but as for the rest of it I did 
pretty much exactly what you did: scene scriptlinks.  Not the best 
solution, but it does work.  Although you should be able to tell Blender 
to only redraw the scripts window (Window.Redraw(blah blah something).

Also I had to write a great deal of functions to use the Registry module 
effectively.  Oh and I wrote a script "container" similar to the script 
menus, for plugging in scripts to my interactive script system.

joeedh


More information about the Bf-committers mailing list