[Bf-python] Problem with addon code

Jenny caretdashcaret at gmail.com
Tue Apr 14 17:25:37 CEST 2015


Hi Ryan,

I plugged in your code and the resize works fine in my add-on.
I'm on 2.74 on OSX 10.10.

<code>

bl_info = {
    "name": "Scale Test",
    "category": "Edit",
}

import bpy


class ScaleTest(bpy.types.Operator):
    """Scale Test"""
    bl_idname = "mesh.scale_test"
    bl_label = "Scale Test"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):

        bpy.ops.mesh.extrude_edges_move()
        bpy.ops.transform.resize(value=(2, 2, 2))

        return {'FINISHED'}

def register():
    bpy.utils.register_class(ScaleTest)


def unregister():
    bpy.utils.unregister_class(ScaleTest)

if __name__ == "__main__":
    register()

</code>

Can you send your .blend file?

-Jenny

On Sun, Jan 25, 2015 at 4:43 PM, Ryan Southall <R.Southall at brighton.ac.uk>
wrote:

> Forgot to change the email subject on the last post. Sorry for the
> confusion.
>
>
> Hello.
> I'm hoping someone here might have an idea as to why I can run some code
>    from the Python command window or Blender's text editor and it runs
> fine,
> but as soon as I place it into my add-on it doesn't work.
> The code in question is:
>
> bpy.ops.mesh.extrude_edges_move(MESH_OT_extrude_edges_indiv=None,
> TRANSFORM_OT_translate=None)
> bpy.ops.transform.resize(value=(2, 2, 2))
>
> The first line always works and the new edges are created but the second
> line does nothing when I place it in an add-on.
> I have another line of code later on:
>
> bpy.ops.mesh.extrude_edges_move(MESH_OT_extrude_edges_indiv=None,
> TRANSFORM_OT_translate= {"value":(0.025, 0.05)[j == 0]*(tmatrot*direc)})
>
> which does again extrude the edges but does not move the new edge when I
> place it in an add-on.
> I appreciate I'm probably missing something simple, but I just can't
> figure it out.
> I'm using 2.73 on 64-bit Arch linux platform.
> Thanks
> Ryan
>
> ___________________________________________________________
> This email has been scanned by MessageLabs' Email Security
> System on behalf of the University of Brighton.
> For more information see http://www.brighton.ac.uk/is/spam/
> ___________________________________________________________
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20150414/74916f52/attachment.html>


More information about the Bf-python mailing list