Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- import random
- x = random.randint(-6, 6)
- y = random.randint(-6, 6)
- z = random.randint(-6, 6)
- bpy.ops.mesh.primitive_cube_add(radius=1, location=(x, y, z),)
- import bpy
- class GlobalScriptRunner(bpy.types.Operator):
- """Tooltip"""
- bl_idname = "view3d.global_script_runner"
- bl_label = "Global Script Runner"
- #@classmethod
- #def poll(cls, context):
- # return context.active_object is not None
- def execute(self, context):
- print('i get called')
- textblock_name = 'generic_executor.py'
- textblock_as_string = bpy.data.texts[textblock_name].as_string()
- exec(textblock_as_string)
- return {'FINISHED'}
- def register():
- bpy.utils.register_class(GlobalScriptRunner)
- def unregister():
- bpy.utils.unregister_class(GlobalScriptRunner)
- if __name__ == "__main__":
- register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement