[Bf-python] Bf-python Digest, Vol 142, Issue 1

James Crowther jamesharrycrowther at gmail.com
Mon May 1 12:25:43 CEST 2017


Hi Dima,
	I tried the example you linked to and it doesn’t work as posted. I think, and I am hoping one of the devs can set us straight here, that you must call the macro operator in order to run multiple operators together, this is how I have actually gotten an example to work, albeit a very basic one. 

doing the following, as in the example you linked to

MacroClass.define(“transform.translate”)
MacroClass.define(“my_operator”)

only works if you call the MacroClass as an operator itself. It will then run the defined sequence of operators. Unfortunately that example doesn’t tell you that! So I had to spend a while figuring out why not. 

I think we both agree though, this feature needs some proper documentation. It might be that you’re right about it being a documentation discussion rather than python! 

Kind Regards

James

> On 1 May 2017, at 8:00 pm, bf-python-request at blender.org wrote:
> 
> Send Bf-python mailing list submissions to
> 	bf-python at blender.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists.blender.org/mailman/listinfo/bf-python
> or, via email, send a message with subject or body 'help' to
> 	bf-python-request at blender.org
> 
> You can reach the person managing the list at
> 	bf-python-owner at blender.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Bf-python digest..."
> 
> 
> Today's Topics:
> 
>   1. bpy.types.macro - use cases (James Crowther)
>   2. Re: bpy.types.macro - use cases (dima glib)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 1 May 2017 12:25:30 +1000
> From: James Crowther <jamesharrycrowther at gmail.com>
> Subject: [Bf-python] bpy.types.macro - use cases
> To: bf-python at blender.org
> Message-ID: <5E0C3780-869B-4C07-9577-ABA599080358 at gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hi there, 
> 	After spending some time researching the bpy.types.macro class both in the api an on blender stack exchange, I?m keen to learn more about macros, the code I have found suggests that it can be used to group operators together into a single operation (ref blender stack exchange - > https://blender.stackexchange.com/questions/60385/macro-operator-children-are-not-called-from-python <https://blender.stackexchange.com/questions/60385/macro-operator-children-are-not-called-from-python>). But the blender python api really doesn?t give information on what the use case for macros are. Things like modal operators overriding context are well explains, but macros seem to be a bit secretive! It would be great to see some more informative documentation on the subject. Since it appears that others (see the webpage link above) are finding it difficult to get even basic examples to work as desired. If someone could give a quick introduction to macros and what they are best used for, it would
>  be greatly appreciated!
> 
> 
> Kind Regards
> 
> James
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.blender.org/pipermail/bf-python/attachments/20170501/c599ace2/attachment-0001.htm 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 1 May 2017 12:29:01 +0300
> From: dima glib <dima.glib at gmail.com>
> Subject: Re: [Bf-python] bpy.types.macro - use cases
> To: Blender Foundation Python list <bf-python at blender.org>,
> 	bf-docboard at blender.org
> Message-ID:
> 	<CALMJNCJcmbaxAYf0aaZObKPaTujpfm+2VETt0oJfojR6_uUALw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Indeed, bpy.types.Macro is a pretty useful mechanism which is left
> completely unexplained in the official documentation. I had no idea that
> stringing operators together is even possible until I accidenatlly stumbled
> upon Macro usage in someone's code. Just in case, here's one more link to a
> stackexchange question regarding Macro:
> https://blender.stackexchange.com/questions/39716/running-code-after-a-modal-operator-finished-its-job
> 
> Hm, perhaps this discussion also concerns  bf-docboard at blender.org?
> 
> On Mon, May 1, 2017 at 5:25 AM, James Crowther <jamesharrycrowther at gmail.com
>> wrote:
> 
>> Hi there,
>> After spending some time researching the bpy.types.macro class both in the
>> api an on blender stack exchange, I?m keen to learn more about macros, the
>> code I have found suggests that it can be used to group operators together
>> into a single operation (ref blender stack exchange - > https://blender.
>> stackexchange.com/questions/60385/macro-operator-children-
>> are-not-called-from-python). But the blender python api really doesn?t
>> give information on what the use case for macros are. Things like modal
>> operators overriding context are well explains, but macros seem to be a bit
>> secretive! It would be great to see some more informative documentation on
>> the subject. Since it appears that others (see the webpage link above) are
>> finding it difficult to get even basic examples to work as desired. If
>> someone could give a quick introduction to macros and what they are best
>> used for, it would be greatly appreciated!
>> 
>> 
>> Kind Regards
>> 
>> James
>> 
>> 
>> 
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at blender.org
>> https://lists.blender.org/mailman/listinfo/bf-python
>> 
>> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.blender.org/pipermail/bf-python/attachments/20170501/6c2cb6bc/attachment-0001.htm 
> 
> ------------------------------
> 
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> https://lists.blender.org/mailman/listinfo/bf-python
> 
> 
> End of Bf-python Digest, Vol 142, Issue 1
> *****************************************




More information about the Bf-python mailing list