0
$\begingroup$

I have a simple operator that prints out the string "Testing operator". I change the string to "Testing updated file", then go to Blender and press F8 to reload the script. I run the operator, but I still get "Testing operator", and not the updated string.

I have the script in a separate folder (not in the Blender script path), and have installed the addon through Blender's "Install from file". The script is only one file, and I'm editing it in Notepad++.

When I try to reinstall the addon, the update takes place. However, restarting Blender does nothing.

My question is thus: how can I make the refresh function work?

Note: The reason I don't have the script in Blender's script path, is that the script can easily be deleted by accident.

Code if necessary:

bl_info = {
    "name" : "Import addon",
    "author" : "Naioai Studios",
    "version" : (1, 0, 0),
    "blender" : (2, 7, 2),
    "location" : "View 3D > Edit Mode > Tool Shelf",
    "description" :
        "Allows for semi-automatic shipping",
    "warning" : "",
    "wiki_url" : "",
    "tracker_url" : "",
    "category" : "1_Custom",
    'support': 'COMMUNITY'
}

import bpy

def main():
    print("Testing updated flflflflf")

class SimpleOperator(bpy.types.Operator):
    """Import addon for stickmen models"""
    bl_idname = "object.import_stickman"
    bl_label = "Import stickman"

    def execute(self, context):
        main()
        return {'FINISHED'}


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

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

if __name__ == "__main__":
    register()

    #test call
    bpy.ops.object.import_stickman()
$\endgroup$
9
  • $\begingroup$ once you install the addon blender will take a copy of the file and save somewhere else and wont refer to the original file (it will be reading from the copy ) that's why reinstalling solve the problem but refreshing wont $\endgroup$
    – Chebhou
    Mar 29, 2015 at 21:37
  • $\begingroup$ What then, can be done to make the refresh function work? $\endgroup$
    – Einar
    Mar 29, 2015 at 21:40
  • $\begingroup$ Is there for instance a way of forcing Blender to refer to original file, or force Blender to copy every time it refreshes? $\endgroup$
    – Einar
    Mar 29, 2015 at 21:42
  • $\begingroup$ edit the copy that blender is using (in your addon details you will see file : destination ) $\endgroup$
    – Chebhou
    Mar 29, 2015 at 21:43
  • $\begingroup$ why not execute and test the script (only the main) until you get the final script then finish by making the addon $\endgroup$
    – Chebhou
    Mar 29, 2015 at 21:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.