Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8886057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:27:56+00:00 2026-06-14T21:27:56+00:00

Here is an add-on I’m trying to create: import bpy import os import sys

  • 0

Here is an add-on I’m trying to create:

import bpy
import os
import sys
import subprocess
import time
from threading import * 


class Repeat(Thread):
    def __init__(self,delay,function,*args,**kwargs):
        Thread.__init__(self)
        self.abort = Event()
        self.delay = delay
        self.args = args
        self.kwargs = kwargs
        self.function = function
    def stop(self):
        self.abort.set()
    def run(self):
        while not self.abort.isSet():
            self.function(*self.args,**self.kwargs)
            self.abort.wait(self.delay)

class ExportToGIMP(bpy.types.Operator):
    bl_idname = "uv.exporttogimp"
    bl_label = "Export to GIMP"

    def execute(self, context):
        f = open("/home/antoni4040/blender.txt", "w").close() 
        self.filepath = os.path.join(os.path.dirname(bpy.data.filepath), "Layout")
        bpy.ops.uv.export_layout(filepath=self.filepath, check_existing=True, export_all=False, modified=False, mode='PNG', size=(1024, 1024), opacity=0.25, tessellated=False)
        self.files = os.path.dirname(bpy.data.filepath)
        cmd = " (python-fu-bgsync RUN-NONINTERACTIVE)"
        subprocess.Popen(['gimp', '-b', cmd])
        file = Repeat(3, self.up)
        file.start()
        return {'FINISHED'};

    def doit(self):
        r = Repeat(3, self.update)
        r.start()

    def up(self):
        f = open("/home/antoni4040/blender.txt", "r")
        string = f.read()
        if "ok" in string:
            self.materialize()
            self.doit()
            file.stop()
        else:
            pass     

    def update(self):
        self.layout_texture.image.reload()
        for area in bpy.data.screens['Default'].areas:
            if area.type in ['IMAGE_EDITOR', 'VIEW_3D']:
                area.tag_redraw()

    def materialize(self):
        self.layout_texture = bpy.data.textures.new(name = "Layout_Texture", type = "IMAGE")
        self.material = bpy.data.materials.new(name="Layout")
        self.object = bpy.context.active_object
        self.material_texture = self.material.texture_slots.add()
        self.material_texture.texture = self.layout_texture
        self.material_texture.texture_coords = "UV"
        self.filepath2 = "/home/antoni4040/Έγγραφα/Layout1.png"
        self.texture_image = bpy.data.images.load(self.filepath2)                       
        self.layout_texture.image = self.texture_image
        self.con_obj = self.object.data
        self.con_obj.materials.append(self.material)
        bpy.data.screens['UV Editing'].areas[1].spaces[0].image = self.texture_image

def exporttogimp_menu(self, context):
    self.layout.operator(ExportToGIMP.bl_idname, text="Export To GIMP")

bpy.utils.register_class(ExportToGIMP)
bpy.types.IMAGE_MT_uvs.append(exporttogimp_menu)

Which works along with this:

#!/usr/bin/env python
# -*- coding: utf-8 -*-


from gimpfu import *
import time
import sys  

def blender_gimp_sync():
    im_dir = "/home/antoni4040/Έγγραφα/Layout.png"
    image = gimp.pdb.gimp_file_load(im_dir, im_dir)
    gimp.Display(image)
    layer = gimp.pdb.gimp_layer_new(image, 1024, 1024, RGBA_IMAGE, "PaintHere", 100.0, NORMAL_MODE) 
    image.add_layer(layer)
    drawable = pdb.gimp_image_get_active_layer(image)
    num = 1
    while True:
        time.sleep(3.0)
        if image is not None:  
            ims_dir = "/home/antoni4040/Έγγραφα/Layout1.png"
            gimp.pdb.file_png_save(image, drawable, ims_dir, ims_dir, 0, 0, 0, 0, 0, 0, 0)
            f = open("/home/antoni4040/blender.txt", "w")
            f.write("ok")
        else:
            pass

register(
    "python_fu_bgsync",
    "Blender-Gimp Sync",
    "Syncronize Gimp with Blender for texturing",
    "Antonis Karvelas",
    "Antonis Karvelas",
    "2012",
    "Sync",
    "",
    [],
    [],
    blender_gimp_sync,
    menu="<Image>/Image/Blender-Gimp"
)   
main()

But, I always get a segmentation fault error…
Why is that happening? What I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:27:58+00:00Added an answer on June 14, 2026 at 9:27 pm

    Well, you can find this in the code Templates as “Operator Modal Timer”, that shows how to do things continuously in Blender:

    import bpy
    
    
    class ModalTimerOperator(bpy.types.Operator):
        """Operator which runs its self from a timer"""
        bl_idname = "wm.modal_timer_operator"
        bl_label = "Modal Timer Operator"
    
        _timer = None
    
        def modal(self, context, event):
            if event.type == 'ESC':
                return self.cancel(context)
    
            if event.type == 'TIMER':
                # change theme color, silly!
                color = context.user_preferences.themes[0].view_3d.space.back
                color.s = 1.0
                color.h += 0.01
    
            return {'PASS_THROUGH'}
    
        def execute(self, context):
            self._timer = context.window_manager.event_timer_add(0.1, context.window)
            context.window_manager.modal_handler_add(self)
            return {'RUNNING_MODAL'}
    
        def cancel(self, context):
            context.window_manager.event_timer_remove(self._timer)
            return {'CANCELLED'}
    
    
    def register():
        bpy.utils.register_class(ModalTimerOperator)
    
    
    def unregister():
        bpy.utils.unregister_class(ModalTimerOperator)
    
    
    if __name__ == "__main__":
        register()
    
        # test call
        bpy.ops.wm.modal_timer_operator()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So here's my schema (give or take): cmds.Add(@CREATE TABLE [Services] ([Id] INTEGER PRIMARY KEY,
Here's the line from App.Config: <add key=CheckFileFormatString value=P{0}\t&quot;{1}, {2}&quot;\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}/> Here's the code that puts
I'm Trying here to add many arrays to one NSMutableArray Actually am adding the
I am trying to add an annotation from property list. I found a solution
I'm trying to let a user to do a 'Click here to add more
I'm trying here to add a specific dialog bean for action on Alfresco Explorer
Recently I asked here how to add a new JPanel to JFrame . The
I am new to SVN. SVN-add is here to 'prepare a file to be
here my simple code to add filename and their associated icon to virtualtreeview PFileInfoRec
Here is an old add in to quickly comment out HTML code. Maybe I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.