User
Write something
Coffee Hangout is happening in 11 days
Heed help with Export FBX operator
I'm trying to build an operator that moves selected objects to world origin (ignoring Z axis), runs 'Export FBX' operator and after execution (either finished or cancelled) the objects should move back to their original locations. The problem that 'Export FBX' is a modal operator and if I write 'move objects back' code after bpy.ops.export_scene.fbx('INVOKE_DEFAULT') , it executes right after the operator was called even if user haven't exported objects yet. So pretty much the objects should stay at world center until user clicks 'Export FBX' or 'Cancel' button because objects need to have their pivot points at the center when I import them to other programs such as Unreal. I can't wrap my head around how to do it. I was thinking of something like "if bpy.ops.export_scene.fbx('INVOKE_DEFAULT') returns {"FINISHED"} or {"CANCELLED"} -> do the thing", but it returns {"RUNNING_MODAL"} on call. Hope it makes sense :D Help please! I'll try to attach the code in comments as it says 'failed to upload an image' when I try to attach .py file here.
VS Code can't find bpy_extras
I've been using Blender's built-in text editor to write my addon, and I finally decided to use VS Code. The addon works fine in Blender, but it won't run from VS Code. I'm not sure if it's VS Code or one of the extensions, but it's tripping on this line: from bpy_extras.io_utils import ImportHelper Exception has occurred: ImportError - cannot import name 'ImportHelper' from 'bpy_extras.io_utils' (unknown location) File "/home/gtada/Documents/blender/scripting/iges_import/operator_file_import_iges_002.py", line 75, in <module> from bpy_extras.io_utils import ImportHelper ImportError: cannot import name 'ImportHelper' from 'bpy_extras.io_utils' (unknown location) If anybody has an idea I'd love to hear it. I used the Operator File Import template which includes this module and function.
How to set boolean in operator
I have got this boolean that has an operator that'll change its value depending on whether or not the Alt key is pressed. There are two operators, one that'll execute when the alt key is pressed down and another one that'll execute when the alt key is released (img1&2). The issue is that these operators don't seem to be changing the value of the boolean. They execute but don't change the "alt_is_pressed" boolean variable. I feel like I am missing something very simple and basic, or I need to change my approach, but I'm not sure what is missing and what other way to approach this. The reason I have this operator is so that change the way the a vertex float changes its value. If alt is pressed the value of all selected vertices will equal the active selected vertex value. If alt is not pressed all selected vertices will equal their own value plus the difference from the previous value. So, if a value was 1 then it was changed to 3, the difference would be 2 so each selected vertices will equal its self plus 2. So, the vert with 0.2 will now equal 2.2, the one with 0.5 will equal 2.5 etc.(img3) Any help would be greatly appreciated. I included the code along with the images in case you want to go in and edit some things yourself.
How to set boolean in operator
A way to display custom attributes in 3D viewport panel menu
I want to find a way to display custom attributes, in a fashion not to dissimilar to the edge crease attribute, in the 3D viewport panel here(image1). I'm quite a beginner to python programming for blender (though I'm not a stranger to programming in general), so I looked up some tutorials and found this free course, which was very useful. I tried to program in this feature, combining stuff I've seen in this course and other stuff on the internet, and it doesn't work.(image2) Not surprised though, I'm just very curious as to how to fix it! The first issue I've seem to run into is that the "layout.prop()" doesn't seem to be bringing anything up in the 3D viewport panel.(image3) Despite there being a float property in the second argument it doesn't seem to work, and I have a very strong feeling that there's some basic thing I'm missing or syntax I'm misunderstanding. Another thing, if I do manage to get that float property visible in the 3D viewport panel, how will I be able to have that value change depending on the vertex selected. For instance, you may assign vertex 1 with a value of 0.95 and vertex 2 have a value of 1.21 Any help would be greatly appreciated and thank you to Victor Stepanov for this course and especially thanks for making it free!
A way to display custom attributes in 3D viewport panel menu
1-30 of 81
CG Python Academy (Free)
skool.com/cgpython
3D artists learning Blender Python.
Leaderboard (30-day)
Powered by