0
$\begingroup$

I've purchased an Addon called 'Bmesh Clean' which basically systematically cleans up any selected mesh.

I'm trying to write my own script that will automate a process, which will include using the Bmesh Clean function, however I have no idea how to actually call it from my script, and I keep getting 'Python script fail'.

My script is very simple currently, it just imports an FBX, selects all, and then tries to call the Bmesh Clean;

#import bpy

bpy.ops.import_scene.fbx(filepath="C:\\Users\\Work\\Desktop\\my_file.fbx")
bpy.ops.object.select_all(action='SELECT')

In the Bmesh Clean, there is a 'def bmesh_clean():'

However, I cannot figure out how to call this. Using import bmesh_clean fails, I even tried the script name as import which fails too. I assume that once I've imported it correctly, I only need to call 'bmesh_clean()' on my script.

Any advice? Thanks

$\endgroup$
  • 4
    $\begingroup$ Since this is a paid add-on, we can't really help you here since we'd have to take a look at the source to see under which namespace the function or operator is registered and what context is required to execute it. Perhaps you can figure this out yourself by enabling Python tooltips in the preferences to see the function call behind the add-on UI and taking a look at the poll() function of the operator in question. $\endgroup$ – Robert Gützkow Dec 17 '19 at 12:46
0
$\begingroup$

I figured it out. Firstly, I needed tick the toggle 'Register' top right of the BMesh Clean script, I guess this basically means it compiles it for other scripts to use?

Anyway, once done, I was able to import the script correctly, and call the function.

|improve this answer|||||
$\endgroup$
  • $\begingroup$ This needs clarification. Perhaps a small code example of import statement. For example can import the info dictionary for Magic UV addon using from magic_uv import bl_info whether the addon is registered or not. Are you using the method mentioned in question, or an operator bpy.ops.bmesh.clean (guess at name as don't have addon). To use the operator would definitely need the addon to be registered. $\endgroup$ – batFINGER Dec 17 '19 at 14:55

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.