New answers tagged

0

In order to open the file browser you need the operator's invoke() function to be called. This can be accomplish by setting the execution context. Pass the argument 'INVOKE_DEFAULT' into the function call and the file browser will open. bpy.ops.wm.save_as_mainfile('INVOKE_DEFAULT') The manual explains the execution context in following way: Execution ...


1

You can use a property, which is set differently for each function in the panel. Add a property to your operator. custom_prop = bpy.props.StringProperty(default="Default Value.") Add the operator to your UI layout op = layout.operator(OPERATOR_OT_name.bl_idname) Modify the property of the operators call. op.custom_prop = "Other Value." Modifying Robert ...


0

Here is how to create addons with an interface in Blender 2.8x. I share here minimalist scripts snippets. If the addon has multiple files compress it to a .zip. To enable the addon go in Edit > Preferences..., in the Addon section and type "Minimalist Addon". I suggest you to name your main file __init__.py, it's a convention between every addons. Make sure ...


1

The .stl exporter already has the option Selection Only to export the selected objects. In Blender 2.80 the exporter options can be found in the lower left area of the file browser. In Blender 2.81 you may need to click on the cogwheel icon to show the options. Blender 2.80 Blender 2.81 and later


1

Currently the Influence is set to 0%. If you increase it to 100% the selected vertices will form a circle.


0

The Blender version in the bl_info should indicate the version of Blender it was written for. Future releases of Blender may change the API and the version information can be used to perform a simple check whether the add-on may work with the Blender release. Blender 2.8x already displays a warning when an add-on with blender lower than (2, 80, 0) is ...


0

blendergis is an excellent free addon for adding terrain and satellite found on github. easy to use a little tricky to install


0

This issue has been resolved by downloading the latest build (2.82-a) found at: builder.blender.org/download/


1

A clean approach for registration is to provide a register and unregister function in every file that contains classes that need to be registered. Provide a top level register and unregister function in the __init__.py which calls the respective functions of the imported modules. You can put the property groups in a separate file, they don't have to be in ...


0

I found it in case you still need it. You can download a zip from the GitHub page at https://github.com/porkminer/CubeSurfer, but it gives you an error when you try to istall it in Blender. I fixed it by changing the line from cubesurfer import mciso just to import mciso. The download link is https://gofile.io/?c=sEWqb3.


1

It's better to split it into separate files. The reasons for this are: Separation of concerns: It's easier to separate UI from state and logic when they are in separate files. Keeping everything in one file also results in low cohesion which is not desirable. Maintainability: Keeping everything in a single file will likely result in tight coupling, which ...


1

No there isn't. The Python API has changed between the two versions and therefore add-ons for Blender 2.79 won't run in Blender 2.80 and the other way around. You would have to modify the code of the add-on to let it run in Blender 2.79.


3

The function def loadFromFile(context, filename, isFullFilepath=True) assumes that there is a camera in your scene. It tries to retrieve it, but doesn't check if the returned value is None: scene = bpy.context.scene camera = scene.camera Later it assigns a location to the camera, which fails when there is no camera in the scene. This causes the exception ...


0

@batFINGER suggested using a custom object property instead of maintaining a list - which is a good alternative for my use case and avoids bpy.props entirely. Below are implementations written with the help of devtalk. Adding is fairly straightforward. # add an object to list obj["prop_name"] = 1 Getting a list can be done in a couple different ways ...


0

The registration of the operator was broken. The bpy.utils.register_classes_factory() generates a register() and unregister() function for all supplied classes, but doesn't call them. There was also a , missing in the class tuple. classes = ( ExportUrchin, ) def register(): for cls in classes: bpy.utils.register_class(cls) bpy.types....


0

Update: Ended up using the other solution. Other implementations were mentioned on devtalk, but bpy.props.StringProperty was quickest to implement. # __init__.py bpy.types.Scene.protected_object_names = bpy.props.StringProperty( name = "Protected Objects", description = "Objects that shouldn't be deleted." ) # this prevents an unassigned error that ...


1

There are two changes necessary to add your custom menu entry. menu_func has to be modified to add OBJECT_MT_effector_submenu to the menu Don't call bpy.ops.wm.call_menu in register The fixed menu_func looks like this: def menu_func(self, context): self.layout.menu("OBJECT_MT_effector_submenu", text="Effector")


1

The Addons project links to the Addons Catalog(archive) which gives a list of all the 2.6 scripts where you can get the details for Image as Planes which then links to the SVN repository containing the actual Python script. And hopefully that is in a usable state.


0

Try what was answered in this thread: https://blenderartists.org/t/can-a-modal-operator-use-snapping/1175190


Top 50 recent answers are included