Reset blender environment on each script run I'm building a model completely in python. This means that I start with an empty scene, and all I want to do is run a python command that creates all meshes and objects. I'm building this python script in vi, just because blender is amazing 3D software, but lousy at making a decent text editor.

Off topic: The main reason for building my model this way, is that I want to have complete control over what I build, complete reproducibility, and I get to store my model in github, having proper version control and clear change sets. I would certainly be interested in hearing some off-topic reactions on how I could do this better/differently.

While developing this script, I constantly want to reload, from scratch, change a line in my script, reload, etc. I was wondering what the best way to achieve this is. My requirements:

It has to be simple, a couple of keystrokes, since I'm doing this multiple times per minute.
I don't want to restart blender every time, just because it takes a couple of seconds to start blender, and because the blender window doesn't appear in the right spot by default (this latter is possibly fixable).
Preferably I start from a new state (as in: File -> new) or in a known saved state (File --> open). Between reruns I do things in the interface and I may accidentally alter some property without knowing it. Ideally this would be reset on the next run.
Preferably the execution is triggered by the Python Console, so that errors appear there (and not in the bash console used to start blender).

Things I've tried so far:

Loop over all objects and delete them

I can manually try to delete all objects (using the method described here): http://blenderscripting.blogspot.nl/2012/03/deleting-objects-from-scene.html
This doesn't quite work (it crashes if there are hidden objects), but this is probably solvable. However it doesn't satisfy my 3rd requirement. It does allow my to make 1 oneliner that loops over all objects, delete them, and then runs my script again.

Using bpy.ops.wm.read_homefile() to get to the new state

Using this command I can get to the new state, however this also resets the python console, meaning that any subsequent command gets ignored and I can't up-arrow anymore to get it back.

Use bpy.ops.wm.open_mainfile() to get to a known saved state

This suffers from the same problem as the previous bpy.ops.wm.read_homefile, however it allows me to save some history in the python console, so I can up-arrow to it. It works, sort of, but not ideal.

In all of the above settings, I used

exec(compile(open(filename).read(), filename, "exec"))

to execute the script.

My latest plan is to use modules (however I think it would work just as well with the above exec command), and the undo history. Calling operators from a script doesn't add them to the undo history, so if after the running of the script I push onto the undo stack, I can then cmd-Z my way to the previous state. I could probably. When I start, I run once (single is my module name):

import sys; import importlib; sys.path.append("/path/with/my/module"); import single;

Now I use the oneliner

importlib.reload(single); single.build_single((20,25,0)); bpy.ops.ed.undo_push()

whenever I want to see how my program runs. When I'm ready to do a new run, I cmd-Z until I'm back at the beginning (most of the time once, sometimes I did some manual operations and need to press it more often).

Somehow I feel however that there must be a better way to do this, to reset the scene to some saved or new state, while the python script keeps running....

EDIT 2015-5-5

I still haven't found a good solution to this problem. However since all I really needed was to make relatively simple 3D objects for printing on my 3D printer and sending of to Shapeways, I found OpenSCAD more suitable, and 100% text based, which allows me easy checkins into git and changesets. Don't get me wrong, I think Blender is the tool for amazing 3D rendered images and animations, for my use however it was overkill.

I fear that this can only give a partial answer.

I wrote an add-on (totally work in progress..but whatever) which gives the python console in Blender a second function. Hitting Enter, executes normal python stuff, but I can type commands and hit Cltr+Enter and the add-on will read the current line and parse it and react to it. One command I do tend to use a lot is wipe it removes all objects/meshes, the code for it is pretty much:

    elif m == 'wipe':
        remove_obj_and_mesh(context)
        add_scrollback('wiped objects and meshes', 'OUTPUT')
        # history_append(text=m, current_character=0, remove_duplicates=True)
        history_append(text=m, remove_duplicates=True)

This even prints the message 'wiped objects and meshes' in blue to the Python console

The code for remove_obj_and_mesh() is:

def remove_obj_and_mesh(context):
    scene = context.scene
    objs = bpy.data.objects
    meshes = bpy.data.meshes
    for obj in objs:
        if obj.type == 'MESH':
            scene.objects.unlink(obj)
            objs.remove(obj)
    for mesh in meshes:
        meshes.remove(mesh)

I've not tested that on hidden objects, but if you can link a representative file / blend state which you would like to wipe entirely or selectively, i recommend posting it and that will let us/me answer more concisely.

ps. blenderscripting.blogspot is my blog, i should probably change that code


How do I texture an ocean scene without using a background world image? I am creating an animation for a black and white ocean scene for a cinemagraph to be assembled in After Affects. I've set up my ocean and a couple of light sources to get the look I want as shown below:

This is a rendered view of the scene:

I am unable to export this b/w ocean with a transparent background (either as a png or an AVI file) because every time try to remove the world background image (b/w sunset), the ocean becomes devoid of any color too. I just need the ocean to be b/w and the background to be empty. Tried messing around with nodes and background colors without any luck. 2nd day of trying out the software, so any help with this would be much appreciated.

I guess what you need to do is deactivate the Camera option in the Ray Visibility of the World to make the world invisible to the camera but keep the reflections, and enable the Transparent option of the Render to make the background tranparent:


Create a new UV map but move the textures with the polygons? I've imported an object from an 3d data capture program in Blender, which came with an automatically generated UV Map. I'd like to create a new (more sensible) UV map based on the cleaned-up geometry, but keep the model looking the same (so the polygon-to-pixel-colour mapping is consistent).

Is this at all possible to achieve?

If the two UV maps reside on the same mesh you can use UV baking. If you create a material with the texture and the first uv layer, you can bake the diffuse color (or even the rendered result, if you make a shadeless material) and bake it to the second UV layer. Make sure to select the proper UV layers in the material texture slot, UV editor and active UV layer.


3d View layout closer Is there any way to move some of the top items in the 3D View to the left? On my laptop they are covered when I have a layout including side views (Outliner on left and Properties on right.)

I usually have  to minimize one or the other to get the shaders selectors and the options drop down there to be visible. I have the Blenderkit "Find Models" in  the middle which I rarely use (but do want to keep) and wonder if I can move that elswehere, and would it move the shaders more leftwise if I could??

See that little rounded corner where edges meet?
Hover over it, then click-and-drag it in whatever direction you want to create a new tab.

To remove a tab, right-click on that tiny darkened line that separates the tabs and select 'Join Areas'


Object is not rendered I have tried everything, but the object, the large cylinder at the center, just won't render. This happened after I applied smoothness and some modifiers, like edge modifier and subdivision surface. What is wrong?

Blender file is provided:
https://drive.google.com/file/d/0B4GHBVLRvRttWnhZOHlZVTdNRGs/view?usp=sharing

You have Duplication enabled on the cylinder.  Please see the manual for proper Dupligroup use:

EDIT: Without knowing the history behind the creation of this blend, it's hard to say why that was like that and what/how it was being duplicated.  You and @m.ardito mentioned linking from an external file.  As the manual states:

  Note that if the DupliGroup was linked from an external file the Object Data (mesh, materials, textures, transforms) will also still be linked from the original group. However, the various object’s parent-child relationships do not carry over.


how to get back a hidden part of the mesh when alt+H is not working? I was (am) working on a mesh. I selected part of it, hid it. moded the other part, then hit Alt+H and nothing, go into object mode it shows the entire mesh (object) go into edit, I cannot get it to reshow everything again.

While in Edit mode, Press Alt+H or in the menu bar select Mesh> Show/Hide> Show Hidden


Blender bones are confusing. How do they work? .

Coming from 3DS max, blender's bones are kind of confusing

In green i rigged like i usually would, creating "transition" bones that serve no other purpose than to connect more important bones together (like connecting the tail bone to the upper leg bone).

the big part of the bone would be the center of rotation. if you disconnect a bone it just turns into a dot, showing it's just a rotation point with no connections. Blender's bones don't do that witch makes it more confusing to figure out where the center of rotation is.

In red i rigged it according to all the tutorials i've followed. They always seem to connect bones with constrains instead of connecting the bones. This would be fine but blender's bones seem to work differently. As you can see the constrain connects to the top of the tail bone instead of the bottom part (the wide part) witch could cause problems with rotation. Can you make it connect to the bottom or does it not matter ?

Witch way am i supposed to rig ? additionally, if anyone has a tutorial for bone orientation i'd be grateful.

thank you very much, i'm loving blender's flexibility so far compared to other software.

When you are in Pose mode the rotation centre is the head of the bone:

What you show is the upper leg bone parented to the lower spine bone. You're talking about constraints but it's not cleat what you're talking about, in Blender, Constraints are tools used to control objects or bones, like for example Inverse Kinematics constraint, but I don't think there's any constraint between your upper leg and lower spine. I think you mean that these 2 bones are parented, upper leg is the child of lower spine. In that case there's a doted line between the two. This line appears between the parent's tail and the child's head. It won't cause any problem of rotation or please be more specific.

There are 2 kinds of parentage. The first case is the previous one: When you parent a bone to another one but you want the child to stay away you need to choose in Keep Offset mode: select the bone you want to make child, then the parent, then ctrlP > Keep Offset. If you want the child to stick to its parent, choose the Connected bone. If you extrude a bone from another one, it will be a connected child by default. You can separate it definitely with altP > Clear Parent, or keep it the child with altP > Disconnect Bone.

You'll find a lot of tutorials about bones and rigging, explaining everything here would be a bit tedious, I think BlenderStackExchange is more for punctual problems.


Create the circular distorion from an anamorphic lense I try to recreate the circular distortion of an anamorpic lense
like here

I know about this way to strech the bokeh vertically.
Bokeh - From Horizontal to Vertical

and i have seen this one were a fisheye lense is used.
https://code.blender.org/2014/08/anamorphic-bokeh/

and im using a lens distortion node in the compositor to achive additional realism.
Is there a way to create this circular distortion in the bokeh without a fisheye camera?

You can probably use radial blur to simulate the effect of lens aberration in post-processing.

But the effect is also surprisingly easy to achieve in Cycles with the camera. Just add a black, circular aperture object in front of the camera:

Here is the setup from the camera's perspective. The more closed off the circle is, the heavier the vignetting:

Blend file Download


How to animate small water surfaces in structures? I would like to model a so-called stormwater overflow (used within a sewage system) which is a concrete chamber in which the water level is rising during a storm inflow until the crest of an overflow weir is reached. Then, the water forms a small waterfall. I would like to have some waves on the water surface and one should see the water "falling down" at the overflow. It should look like this:

The use of the FluidSimulator of course would be straightforward, but it did not work properly in some first tests and was also very time-consuming. To complicate it a bit, the weir should be movable, going down while the water is overflowing, so there will be changing geometry.

So I ask whether there would be some way to "fake" the water. Ocean modifier plus some additional modifiers?

Greetings from Germany, Tschöbbel

Final:

You can fake it pretty easily with creative UV Mapping and animating Texture location. I've used Noise Texture for it as a Bump for Principled BSDF.

Let's break it down.

Mesh:

It's simple Plane with one edge Beveled. Nothing to add here.

Material:

We need to add material first, it will be easier during UV Mapping.

Again, nothing to fancy here.

Animating.

X value in Mapping node will be animated - in this example keyframes are on frame 1 with value 0 and on frame 60 with value 1. In your case axis could be different, also bigger difference between values will give faster animation.

After adding keyframes you should go to Dope Sheet editor, select both frames from X axis and choose Key > Interpolation Mode > Linear.

UV Mapping:

Go to Edit Mode, Select All and U > Unwrap.

Now changing X axis value in Mapping node should give as something like this (I'm using Node Wrangler to be able to see Color Ramp node output):

Go back to UV Image Editor, select faces where water should be flowing faster, enable Proportional Editing and scale them down along X axis as much as you want.

Final thoughts:

This is basic overview for the water flow. You should also add some Particle system for the splashing water and maybe some foam texture. I think those should be another questions otherwise this one could become to big/tutorial like answer. Or just search trough the web, there are plenty tutorials about this.


How can I get a random number that is constant per object in a driver? I would like a driver that gives different result when duplicating the object but stays constant on frame update, transformations, etc...

noise.random gets updated on frame change. I thought about using the object Id (bpy.data.objects[x].id_data.as_pointer()) but it stays on objects[x] on the duplicates instead of using the id of the duplicated objects, making all duplicates the same.

I couldn't find the path to that id in the Add Variable panel.

If possible the solution should be a simple expression. Best would be a simple RNA path.

The normal Python way

As @Mike Pan says, in the regular Python you would use a stable value (like location) and use it as a seed. This allows to get a random-like but predictable result.

def get_random_value():
    import random
    seed = obj.location.x + obj.location.y + obj.location.z
    result = random.Random( seed ).random()
    return result

If the seed remains the same, you will get the same result.
By default in Python, the current time is used as the seed. That's why the results are different each frame.

If you need to do it in a driver

You will have less control, but it's possible too :)
Use http://www.blender.org/documentation/blender_python_api_2_71_release/mathutils.noise.html#mathutils.noise.noise

noise.noise( (x,y,z) )

It gives you a result between 0.0 and 1.0, using Perlin noise by default. Imagine it as a value from a Clouds-type texture at a given pixel position. You have to provide the position as a tuple (x,y,z).

Then you can multiply the result by whatever you want.


Blender python trying to scale the uv I am trying to enlarge the uv map  using python scripting so more square in my texture. Not sure what is wrong.
bpy.ops.object.select_all(action='DESELECT')
XYZcoord = (0, 0 ,0)
ob = bpy.ops.mesh.primitive_plane_add(location=XYZcoord)
bpy.ops.transform.resize(value=( 20, 20, 20))
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.subdivide(number_cuts=10)
bpy.ops.uv.smart_project()
bpy.ops.object.mode_set(mode="OBJECT")
material_image = bpy.data.materials.new(name= "Basic_Texture")
material_image.use_nodes = True
principled_node = material_image.node_tree.nodes.get('Principled BSDF')
principled_node.inputs[7].default_value = 0.08
texImage = material_image.node_tree.nodes.new('ShaderNodeTexImage')
texImage.location = (-300, 400)
texImage.image = bpy.data.images.load("H:\\blender__texture_maps_ao_normal_height_etc\\Wooden_planks_04_2K_Base_Color.png")
material_image.node_tree.links.new(principled_node.inputs['Base Color'], texImage.outputs['Color'])
texImage_rough = material_image.node_tree.nodes.new('ShaderNodeTexImage')
texImage_rough.location = (-300, 0)
texImage_rough.image = bpy.data.images.load("H:\\blender__texture_maps_ao_normal_height_etc\\Wooden_planks_04_2K_Roughness.png")
texImage_rough.image.colorspace_settings.name = 'Non-Color'
material_image.node_tree.links.new(principled_node.inputs['Roughness'], texImage_rough.outputs['Color'])
bpy.ops.object.shade_smooth()
bpy.context.object.active_material = material_image

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.uv.select_all(action='SELECT')
bpy.ops.mesh.select_mode(type='EDGE')
bpy.context.area.ui_type = 'UV'
bpy.ops.transform.resize(value=(2, 2, 2), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
bpy.ops.object.mode_set(mode='OBJECT')
print(bpy.context.active_object)

Maybe u forget to add 'R' before the file path?
bpy.data.images.load(R"H:\blender__texture_maps_ao_normal_height_etc\Wooden_planks_04_2K_Base_Color.png")
It should raise an error in python but my blender doesn't show any error message. Everything works fine in my blender.
Edit: You can use the following code to scale your uv instead of using bpy.ops.transform.resize
See more information here
me = bpy.context.object.data
uv_layer = me.uv_layers.active.data

scale_factor = 2
for poly in me.polygons:
    for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total):
        # rearrange uv coordinate from 0~1 to -1~1 and scale it.
        uv_layer[loop_index].uv.x = (uv_layer[loop_index].uv.x - 0.5) * 2 * scale_factor / 2 + 0.5
        uv_layer[loop_index].uv.y = (uv_layer[loop_index].uv.y - 0.5) * 2 * scale_factor / 2 + 0.5


My rendered turns out extremely bright even though there is no light in the scene. The floor in the rendered view is also white. How do I fix this? Here are pictures of why render and of my scene.

In the shader editor under world remove an emission node if it's plugged into your world output and add light to the scene.


Importing FBX into Blender 2.9 results in warped mesh I'm new to Blender and want to try to edit an animated fbx file. Upon import the Rig is looking good and is animating fine, the mesh however is warped beyond recognition. How do I go about fixing this. Will I have to disconnect it from the bones and repaint all the weights or am I missing something? I've been playing with the fbx import settings but couldn't find one that would import good.
The model is supposed to be a bird, I noticed that the helper objects are also quite a bit off...

Best,
-martin

I had the same issue so I'll share what I've been able to find on it. Its caused by an error with the skeleton. If you delete it, the mesh should fix itself. Apparently blender just doesn't support importing skeletons/armatures from FBX, but third parties do.
There is a workaround - https://darisl.wordpress.com/about/importing-fbx-files-into-blender-with-full-armaturesweights/
And software you can purchase - https://blendermarket.com/products/better-fbx-importer--exporter
I have yet to verify either.


How to get the Class of selected object in Blender 2.8? What is the python code to get the Class() of selected object in Blender 2.8 ? I want to know if the selected object is grease pencil or any other.

Thanks

The selected class is not retrievable for every object, as that code is defined in C, not in Python. But the body of your question asks for the type anyways, so here you go:

objectType = bpy.context.object.type

This will yield one of the following strings in Blender2.8 (which I assume you use, as in 2.79 there are no Grease Pencil Objects):

"MESH"
"CURVE"
"SURFACE"
"META"
"FONT"
"ARMATURE"
"LATTICE"
"EMPTY"
"GPENCIL"
"CAMERA"
"LIGHT"
"SPEAKER"
"LIGHT_PROBE"

To get an updated type list (as the API changes sometimes), you can use the following code with an active object:

import bpy

types = bpy.context.object.bl_rna.properties['type'].enum_items

for t in types:
    print('type %s: %s' %(t.identifier, t.name))

Result in py console (2.8)

Convenience Variables: C = bpy.context, D = bpy.data

>>> C.object.__class__
<class 'bpy_types.Object'>

>>> types = C.object.bl_rna.properties['type'].enum_items
>>>
>>> for t in types:
...     print('type %s: %s' %(t.identifier, t.name))
...
type MESH: Mesh
type CURVE: Curve
type SURFACE: Surface
type META: Meta
type FONT: Font
type ARMATURE: Armature
type LATTICE: Lattice
type EMPTY: Empty
type GPENCIL: GPencil
type CAMERA: Camera
type LIGHT: Light
type SPEAKER: Speaker
type LIGHT_PROBE: Probe


How do we move subdivided things "correctly"? Is there a nice way to move my edges, so that the active vertex' position is exactly (0,0,0) when SubsurfModifier is active?

To do this computationally would be a headache. Every surface point is influenced by multiple control points, there is infinite number of solutions and without some constraints (a 2d plane, some symmetry constraints, etc) it's non-trivial.

The trivial solution is:

The objective is to place the marked surface vertex at (0,0,0):

Copy the object and apply the subd modifier. Measure how far the point is from (0,0,0):

Delete the duplicate and move the original object inverse of what you measured. If you don't want to move the whole object, you have to move the control geometry surrounding the point in question (all vertices that influence the location of that point)


how to change snapping degree I want to snap my object (cylinder) like this

But what i got

I use snap to face, snap with closest, and the align rotation & project individual element is on. I tried to move the main point (the yellow point) but still not work. I'm trying to use another object like cube and it works. Can someone tell me where did it go wrong please? Thank you

The Snap uses the object's Z axis to stick perpendicularly to the target face, so in your case you need to rotate the origin 90°, at least temporarily:

Enable the Affect Only Origins option in the Options panel on the top right of your 3D view:

Rotate the origin so that its Z axis points perpendicularly to its current orientation:

Disable the option, move your object until it snaps to the face you want:

You could also simply stick the object and rotate it on its own X or Y axis with R and double X or double Y.


How to deform the outer part of a torus along one axis? Thanks so much to those who answered my original question, but I don't think I was clear enough about what I was needing.  So here's a (hopefully) clearer explanation:
So here's a standard (high res) torus, can see the specs on the pic:

And so I want to scale it wider by 30% just with the default scaler, like this:

However I don't want the inner circle (the hole) to be scaled, just the outer diameter.  The result should look something like this (except with all rounded surfaces):

And with a constant Z height at the highest and lowest points of the curve, so the side (X/Y) view should look like this:

I made this which is closest I can get, by beveling the corners of a cubic shape, but the top and bottom planes are still flat.  I need it rounded.  I want it so that if you were cutting the shape radially you'd get a perfect oval cross-section shape.

Hopefully this is clear.  This should be an easy shape to make by an experienced Blender user but I just started playing with it not long ago.
Thanks again!

You can use the Proportional Editing mode :

Select only the outer ring of vertices
Activate the PET with O or with the button (blue arrow in the screenshot)
initiate the scale on the desired axis THEN control the radius of the PET with your mouse wheel

You can try different fallof profiles (the "curve" button right to the PET). "Sphere" seems a good choice.


How can an animated object kept on the surface of an ocean? I tried to set the ocean as passive rigid body (collision mesh) and a boat as active rigid body.

The boat falls through the ocean. Which technique is recommended for this?

Ideally the boat would follow a curve and the physic simulation would calculate the orientation and level (z-axis).

As gandalf3 suggested a Shrinkwrap constrained works, but not alone. Using Vertex Parent on a triangle and shrinkwrap the triangle to the ocean does the trick.

For the second requirement to follow a curve a Curve modifier must be added before the Shrinkwrap in the modifier stack.

The vertex parent trick was described here but this tutorial uses softbodies and is more complicated to setup.


AttributeError: 'Mesh' object has no attribute 'view_frame' I am trying to get the pixel coordinates of the object in the rendered image in blender using the How to find image coordinates of the rendered vertex?
But I get the error AttributeError: 'Mesh' object has no attribute 'view_frame'

# Test the function using the active object (which must be a camera)
# and the 3D cursor as the location to find.
import bpy
import bpy_extras

scene = bpy.context.scene
obj = bpy.context.object
co = bpy.context.scene.cursor_location

co_2d = bpy_extras.object_utils.world_to_camera_view(scene, obj, co)
print("2D Coords:", co_2d)

Camera object

the argument obj must be a camera

>>> bpy_extras.object_utils.world_to_camera_view(
world_to_camera_view(scene, obj, coord)
Returns the camera space coords for a 3d point.
(also known as: normalized device coordinates - NDC).
Where (0, 0) is the bottom left and (1, 1)
is the top right of the camera frame.
values outside 0-1 are also supported.
A negative 'z' value means the point is behind the camera.
Takes shift-x/y, lens angle and sensor size into account
as well as perspective/ortho projections.
:arg scene: Scene to use for frame size.
:type scene: :class:`bpy.types.Scene`
:arg obj: Camera object.
:type obj: :class:`bpy.types.Object`
:arg coord: World space location.
:type coord: :class:`mathutils.Vector`
:return: a vector where X and Y map to the view plane and
   Z is the depth on the view axis.
:rtype: :class:`mathutils.Vector`

Running your question script with a mesh object as context will produce the error shown.  Make sure obj.type == 'CAMERA'.


Can't navigate in the 3d view I started learning blender 2 days ago, but I'm still stuck in simple problem. I can't change the view using shift + right/left mouse button. The only thing I managed to do is zooming in/out. This's a screenshot from my window http://i.imgur.com/yOPJZtR.png

Did you try to enable "emulate 3 button mouse" in preferences?

windows could map your middle wheel/button to other functions (eg: double click), and it can break blender functions.

I had similar issues, and I started using a small utility called X-mouse, which can change mouse setting "per application"

And it changed my life... :D


Edge slide, same as tangential translation? I'm just starting out with Blender. Consider this model (mind the selected vertices):

The tutorial I'm following, suggest that we use the Edge->Edge Slide tool to move those vertices closer to the middle vertices.

I looked at the Blender documentation, and the Edge Slide is used to:

  Slide one or more edges across adjacent faces with a few restrictions involving the selection of edges (i.e. the selection must define a valid loop)

So far so good. But then I realised I can also do this by changing my Transformation orientation from "Global" to "Normal", where I'm allowed to move the vertices orthogonally to their normals, i.e.,

I'm new to Blender, so I don't know if there is any difference between one way or the other. I tried looking for an answer on Google, but couldn't find anything.

In case those two solutions are the same (Edge Slide vs Tangential Translation), why is there an Edge Slide tool?

Yes, they do work differently. If you look at the vertices from the top down, you can see that with Edge Slide the vertices move in the direction of the connecting edges. In Normal mode, moving on the vertex tangent does not stay true to the edge path necessarily.


Video Sequence Editor - How to make subtitles? Is there a way of adding Subtitles directly in the VSE? Or do I have to make an animation of text meshes and add it to the video via a Scene strip?

Since Blender 2.76 (or more detailled, since the Gooseberry Branch) there is a great new Text Effect Strip feature which will do the job for you! Mikeycal Meyers already made a great Tutorial on this topic.

Just Add Shift+A an E̲ffect Strip... T̲ext. You can animate it's opacity if needed and change it's size and position.


Custom hotkeys in pie menu (with out numpad) Someone tell me how to change hotkeys in the Pie menu itself?
The idea is to work only with right hand, not to reach for us and not to take hand off the mouse.
That is, reassign numbers or replace them with letters.
Thank you in advance!

There is no such functionality in Blender currently. You can just keep the hotkey that called the menu down and drag the mouse in the direction of the option you want to chose and then release the hotkey. Or you could set the Confirm Threshold to something that is convenient to you in the preferences:


How to see object from multiple perspectives in real time I'm trying to model a helmet, I have a reference image of the head from frontal view and side view, I would like to see the helmet overlapping both views of the head, and I want to be able to modify one view of the object and see the changes in the other view as well, something like a link between the two objects, the same way you would create a texture pattern.

You can use the Quad View mode in the 3D View, just go to View > Area > Toggle Quad View (Ctrl + Alt + Q) to activate.

To keep the views in sync you can toggle on the Box option under the N 3D View Sidebar > View > Quad View > Box.


Video with masked objects that need shadows I have created simple shadow objects for stills in the past where I masked out the environment around product photographs and the shadows matched fine, using the blam add on. Now I am trying to create shadow objects for a video, but the shadow objects don't match the masked objects for more than a couple frames. The solve error for the tracking is 0.14. Shouldn't objects in the virtual environment match the video almost perfectly?

They should, but there are so many factors to take into consideration, it's not a good idea to rely on only one shot. If you can pinpoint where the camera is changing, make a different scene or use a different camera for those clips and lace them together in compositing, or simply do your best with moving the shadow plane around to match where it should be going, and see if it's good enough for your purposes.


How to correct these normals along bevel? I imported a model and corrected the normals (from what I could tell) in solid display mode:

I hadn't noticed that the normals are still messed up all over this model until I used material display mode and now can see that along the bevels there are some tris that stick out even after I have set from faces.

I tried taking these faces and set normals from faces, I also tried smoothing them, flattening them,  averaging from face area, also merged all vertices in case that was causing it. I am not sure what else to try. Usually setting from face has worked.

Here is a view of the normals from the faces and some marked seams that were on the model when imported, the topology is likely an eye-sore, I am still working on cleaning it. For now I just want to learn why I cannot get these normals to match up, what am I missing?
Please let me know if further pictures are needed, and thank you in advance.

I think it was the material itself somehow causing it. I changed it to a basic material and none of the problems are showing.


Missing "Shading [Smooth|Flat]" menu on the left of the screen In a Lynda tutorial, "Shading" should be in the "Mesh Tools" menu, but I can't seem to get to that after selecting several faces of an object.  Any ideas?  Thanks in advance!!

If you want to shade in Edit Mode, you need to go to the Shading/UVs tab. From there, you can select to smooth the selected Faces, Edges, or Vertices. Or, if you want to change the whole object to Smooth Shading, you can do it from Object Mode how you usually would. Hope this helps]1


populate a dropdown (or prop_search) with a string list I want the user to be able to select a string from a list of possible options.

The value stored in the extra properties data must be the selected string (not an integer id as with EnumProperty)
The list of options is generated dynamically (content depends on the file system).

[It contains file names from one or multiple directories, restricted to certain extensions, but displayed without extension, whereas duplicate filenames (i.e. different extensions) are only displayed once]

I tried to use prop_search, but it doesn't work - see this question.

What is the best way to achieve this?

You're mistakingly asssuming that an EnumProperty can only hold integers. This works just fine:

import bpy

bpy.types.Object.my_prop = bpy.props.EnumProperty(
    items=[
        ('IDENTIFIER', 'The UI string', 'Tooltip'),
        ('JEMOEDER', 'Je moeder', 'Op je hoofd'),
    ])

For more info, see the bpy.props.EnumProperty API documentation.


Vertex Connection/Flow I´m quite new to the modeling section, for I worked with tutorials only by now, and thought that it would be a nice training to model a building by myself.

I know that quads should be used as much as possbile, and that I should avoid tris and NGons.
I usually use smooth shading and subdiv modifier, combined with autosmooth set to 89°, and then manually select the edges that shall remain hard and mark them sharp/give them a crease of one.

Now there are sections where I have more vertices on one side than I could connect properly to quads. Like in this example I set up:

I doubt connecting the left vertices to the right ones, for this would create waaaaaay to much connections to one vertex (I read that 6 is the number you should stop connecting more vertices), and I can´t add more edge loops to the right section for this would destroy the smooting created by the subdiv (more vertices = less smooth surface interpolation), and I really want to keep that smoothing. So shall I stick to an NGon here? Or is there any other solution (like telling the suvdiv to ignore some of the "extra" vertices)?

If somebody could please explain me what to do here would be really great!

To have 100% quad based mesh you can use reduction flow. From 21 > 5 faces.

And only topology view:

If you want to use Smooth Shading, use Autosmooth option:


Vertex Paint - creating gradient from selected vertices? So what I want to create vertex paint gradient from selected edge loops like this:

In this picture I did with brush, but I have some bigger models so it could be tedious. I know you can do this in weight paint like this:

So maybe a script that converts weight paint into vertex paint would be helpful?

To make the gradient as the result of the vertex paint assign a texture as a pattern to the brush or use weight paint and convert it into the vertex painted colors.

Painting vertex colors with brush pattern

In Edit mode select faces which you'd like to be affected by Vertex paint. Go to Vertex Paint mode and enable the Face Selection Masking option to make the selected faces be the only ones affected.
In the brush settings, Texture rollout assign texture with desired effect. If the resulted vertex colors should be gradient-like, procedural texture of the Blend type will be good enough.
Choose Stencil option to paint with texture in the same way as in Texture Painting. Move it in the 3D Viewport with RMB to set up painting as desired.

Converting Weight Paint into desired vertex colors

There's an addon for converting weight paint into vertex colors and vice versa.

After activating it, create a weight paint to be converted. Use Weight Gradient, Quantize tools etc. from the Toolshelf to create the final result.
In the Vertex Colors mode, 3d Viewport header find and run Paint > WeightToVertexColor.


Volumetric Lighting light pass I was wondering if anybody could help me with my render settings.

I am trying to render out a light pass (only the lights layer on with everything else as a mask) for some volumetric lighting in my project.

My intention is to add this pass to my after effects file so I can adjust it individually.

my question is - is there a specific way I am supposed to do this? I have a really strong computer, but my render times are nearly 20 minutes a frame. Most other things I render with similar settings render out only take maybe 5 minutes a frame. Even with High reflections.

I have added an atmosphere with a density of .2, my samples are at 1000, my volumetric lighting light samples are all the way down to 0, and the result is looking good, I am just wondering if there was something I could adjust to make it not take so long.

Sorry for the lengthy question, but any help would be greatly appreciated.

What you can do is to separate your scene into two layers

Volume layer: Here there will be the lights and you have to change the material of all the objects to Holdout, you have to check Transparent on the Film menu as well.

Objects layer: Here there will be all the objects with their normal materials and all the lights. Just like your normal scene, but you have to set the density of the Volume world to 0.

Then, in the compositor, you have to do the next:

You can also try the denoising feature to reduce the noise, as well as reducing the step size and Max steps for Volume Sampling in the Geometry menu.

Hope that helps


Blender particle system objects not colliding I have a simple particle System of falling balls but they won't collide to each other like in nature.
What am I doing wrong, what have I forgotten?
My aim is that the balls have volume and stack up like real putting them in a barrel o.s.l.t.

Thanks for any kind of help!

My current .blend of this http://www.filedropper.com/showdownload.php/schneemann

Add the collision pannel under Physics, turn the Particle Friction up... hope this helps.


Animating vertices from coordinates in "frame" files I have coordinates of vertices in datafiles ("frames") with filenames 000.txt, 001.txt, 002.txt, …. The files have rows like this (vertex: ID, X, Y, Z):

15   2.525695e+00 -4.162952e+00 -2.020646e+00

I am not sure how to modify the answers here (which generate the coordinates within Python) for the case of reading in coordinates from "frame" files.

Here is how I import all the "frames"/files into one giant array data:

import glob

def fileNameToData(filepath):
     file = open(filepath,'r')
     lines = file.readlines()
     data=[]
     for i in lines:
         data.append(list(map(float,i.split())))
     return data

files = glob.glob('*.txt')
files.sort()
data=[]
for f in files:
    for i in fileNameToData(f):
        data.append(i)

How could my data be used to animate the vertices?

cf. ch. 7 and 8 of 3D Scientific Visualization with Blender

Here is what I did (based upon the answer here):

import bpy #Blender Python
import bmesh #Blender mesh creation pkg
import glob

#function def:
def fileNameToData(filepath):
     #import first data file:
     file = open(filepath,'r')
     lines = file.readlines()
     data=[]
     for i in lines:
         data.append(list(map(float,i.split()[1:4])))
     return data

#number of objects / vertices
n = len(fileNameToData("000.txt")) # (000.txt is the first frame.)

#Read in all data files.
files = glob.glob('*.txt')
files.sort()
data = [] #data is of the format ((frame 1 verts: (2,3,3), (3,6,2), …), (frame 2 verts: (0,5,2), (3,3,5), …), …)
for f in files:
    data.append(fileNameToData(f))

n_frames = len(files)
bpy.context.scene.frame_end = n_frames

#add mesh object:
bpy.ops.mesh.primitive_circle_add(vertices=n)
obj = bpy.context.active_object

for i_frame in range(n_frames):
    block = obj.shape_key_add(name=str(i_frame), from_mix=False)  # returns a key_blocks member
    block.value = 1.0
    block.mute = True
    vertex_idx = 0
    for (vert, co) in zip(block.data, data[i_frame]):
        vert.co = co
    block.mute = True
    block.keyframe_insert(data_path='mute', frame=0, index=-1)
    block.mute = False
    block.keyframe_insert(data_path='mute', frame=i_frame + 1, index=-1)
    block.mute = True
    block.keyframe_insert(data_path='mute', frame=i_frame + 2, index=-1)


Python - How to Align Axis in import image as plane? I am scripting an addon to help with workflow and I cannot get the align_axis() param of the import image as the plane to work. It always aligns it to the main axis, I am trying to get it to align to a Z+ (So up.)

bpy.ops.import_image.to_plane(files=[{"name":scenename+".png", "name":scenename+".png"}], directory=filepath, shader="SHADELESS", align_axis="Z+")

Any help would be much appreciated as I cannot work out what I am doing wrong.

All the best.

Code works as intended. Just had to restart blender for change to my script to take effect.


Hard edges in cylindrical shape I'm having a hard time trying to figuring out, how to add loop or cuts in the inner edges but not adding more geometry to the overall circular shape 'because it will connect in another mesh with the same amount of polys', can a kindly person help me ?
Thanks in advance and here is a picture.

Try the Knife (K) tool: press K select a point of an edge, clic on another point in another edge, confirm the cut with enter key. Check in face mode the new faces created.


Blender Lego Man Rig I'm working on a lego mini figure to make some fun animations, but rigging the hand of the lego man isn't going too well, at first the hand looks good and nothing sticks out of the arm. When i start to rotate the hand, the back of the hand sticks out the side of the arm, is there a way to make a simple rig to fix that? the hand is parented by a bone relative, I've tried using envelope weights and automatic weights

First I would make sure your hand bone is aligned with the hand mesh's axis of rotation. It's a little hard to tell from the screenshots.

It is likely that bone envelope weights/automatic weights will parent the hand to more than just the hand bone, as they are designed for smooth deformations of non-rigid characters.

Painting this minifig's weights is actually much easier! You can do it in edit mode.
If you go into the Object Data tab of the Properties window, there should be a section that lists vertex groups. These correspond to the bones of your armature, if you've created automatic bone weights. When in edit mode, you can assign the bone weight values here directly.

I would start by using automatic weights, then going through each item in the vertex weights list, removing all vertices from that bone group (to remove the unwanted bone influence you're getting), and then assigning only the vertices you want.

This is a much faster way for rigid parts that are 100% influenced by only one bone. For smoothly deformed things like skin, weight painting is better.

You can also separate the parts and parent them as objects to the bones of your skeleton.


How do I export a .dae so that textures are included when I import it? I've recently used Blender to work on a model, and I need to export it as a dae file, but after I export it, I find that the textures don't import with the model, for some reason.

Just so you know, yes, I have these options checked.

But, no matter what program I try to import the model into, the textures do not import.

Check the texture coordinates for your object(s) and make sure they're using "UV" and not some other coordinate system (e.g. "generated," "object," etc). (Also: If you haven't already UV unwrapped and mapped your object(s), you'll need to.)  :)


Principled BSDF Glass Issue I'm going through BlenderGuru's tutorial and he's using Principled BSDF as a glass material and Cycles as the render engine. The cup by itself looks fine, so does the plate, but if you look through the cup at the plate, it's all weird and kinda dark. Same if you look through one cup at another cup.
I've set the Base colour of both the cup and plate's material to pure white (it's the same material anyway), same with Surface Colour. Roughness is set to 0, IOR is 1.5 and in Render Properties Light Paths>Max Bounces Total, Transparency and Transmissions are all set to 8 (I increased these to 12 to no avail). I also turned on Reflective Caustics and Refractive Caustics.
The last image is what BlenderGuru's realtime render looks like. No weird transparency issues there.

Anything else I can do?
Thanks!

Add a lip to the cup. This will help guide the direction of refraction rays. Most cups have a rim, and the glass shader is physically-based, so you're probably going to get weird results if you deviate from the real world.

Increase glossy bounces to something dramatically higher, like 64-128. This will help ensure enough glossy (reflection) bounces hit the rim of your cup. Also up transmission bounces to something like 64. This will help stop refraction rays from terminating too early.

Add an HDRI, more lights, and/or simply add a box or some other objects surrounding your cup. The environment is mostly causing this. At the moment, your world color is just a flat color, and you only have a small pink plane that the cup rests on. There's very litle for light to reflect off of, so you get too much refraction where there should be reflection.

See: Excessive refraction at glancing angles with glass and/or fresnel nodes?
This is how it looks when I upped glossy bounces to 128 and transmission bounces to 64. I think it's significantly improved already. It's not perfect though, and you can further improve the realism following my other steps. Most important is an HDRI or some other more realistic environment instead of endless empty space.


Convert Object texture coordinates to UV I have an object which as a texture that is positioned using Object Texture Coordinates that uses an Empty as its positioning object. I want to convert this to a UV texture.

In Edit mode I press U > Project from view (bounds) but when I change the coordinates to UV the texture doesn't look right.

Is there any way to convert from Object texture coordinates to UV and preserve how it looks?

You have to use baking.

In the UV Editor create a new image (called Baker on my pic)
Create your material in the Shader Editor
Add a new image texture node in Shader Editor. Click on the browse icon and find an image on your computer
With the image texture node active, switch to the Render tab and go the Bake settings. Under Bake Type choose Diffuse and under Influence select only color, then hit on Bake.
Save the new texture file.
Change the material's texture image to the baked.


How to spot un-weighted vertices? As you can I see have three rouge vertices that are not a part of a vertex group and/or doesn't have weights on them.

Is there an easy way to spot them without going through each bone?

More clearly: How to spot unassigned vertices in weight paint mode?

Use the options in the armature modifier: "Display modifier in edit mode" and "Adjust edit cage to the modifier result".

In complement, concerned bones are generally the one used for nearly connected vertices, you can see them in the properties panel:


Should I add a sun lamp when using an hdri environment? In experimenting with an hdr environment texture for the World (with Cycles), I do not see very pronounced shadows in my scene even though the image has an uncloudy sun.  I expect my objects to cast shadows because even though the sky is bright, the sun is much brighter.

For outdoor scenes, is it typical practice to use a Sun lamp in addition to the environment texture or am I missing some other setting?

Depends how your hdr looks like. If there is a bright light source, then you might increase contrast for the hdr.

Standard setup gives result like this:

If you increase a contrast:

You can multiply or perform any other mathematical operation to get the brightness and the contrast you like.

Also if you'd like to keep the background plate with the original colors, you could mix in original, unchanged background like this:


why I am getting Black & White when I render I use Movie Clip and Box Mask nodes to achieve a split screen effect.
When I render (but also in preview) the clips show in Black and White.
I am not sure why.
Can somebody help please?

Use a Color Mix node set to Add, instead of a Math Node. Math nodes output B&W as can be seen by the color of the output "dot":


How to invoke a dialog from a menu? More specifically - how to invoke a invoke_props_dialog from a bpy.types.Menu?

The dialog invokes properly from Search, but not from a menu.

This is an operator that invokes a dialog:

import bpy

class MyDialog(bpy.types.Operator):

    bl_idname = "tools.mydialog"
    bl_label = "My Dialog"

    string_prop = bpy.props.StringProperty(name="String Prop")

    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self)

    def execute(self, context):

        return {'FINISHED'}

bpy.utils.register_class(MyDialog)

What about doing it like this ?

import bpy

class MyDialog(bpy.types.Operator):

    bl_idname = "tools.mydialog"
    bl_label = "My Dialog"

    string_prop = bpy.props.StringProperty(name="String Prop")

    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self)

    def execute(self, context):
        # Whatsoever needs to be done...
        return {'FINISHED'}

def my_menu_addition(self, context):
    self.layout.operator(MyDialog.bl_idname)

if __name__ == "__main__":

    bpy.utils.register_class(MyDialog)
    bpy.types.INFO_MT_file.append(my_menu_addition)


Custom operator to toggle lamp energy not working I wrote this simple python script for Blender 2.69, which creates a new operator. The operator is supposed to change the energy for four lamps in the scene (essentially switching them off and on again). However, while the script runs fine and creates the operator itself, when I select the operator, it has no effect on the lamps' energy.

Entire script:

import bpy

def main(context):
    for ob in context.scene.objects:
        print(ob)

class LightsOperator(bpy.types.Operator):

    bl_idname = "object.lights_operator"
    bl_label = "Headlight Operator"

@classmethod
def poll(cls, context):
    return context.active_object is not None

def execute(self, context):

    if bpy.data.objects['headlight1'].energy==0.0:
        bpy.data.objects['headlight1'].energy = 0.8
    else:
        bpy.data.objects['headlight1'].energy = 0.0

    if bpy.data.objects['headlight2'].energy==0.0:
        bpy.data.objects['headlight2'].energy = 0.8
    else:
        bpy.data.objects['headlight2'].energy = 0.0

    if bpy.data.objects['headlight3'].energy==0.0:
        bpy.data.objects['headlight3'].energy = 0.8
    else:
        bpy.data.objects['headlight3'].energy = 0.0

    if bpy.data.objects['headlight4'].energy==0.0:
        bpy.data.objects['headlight4'].energy = 0.8
    else:
        bpy.data.objects['headlight4'].energy = 0.0

def register():
    bpy.utils.register_class(LightsOperator)

def unregister():
    bpy.utils.unregister_class(LightsOperator)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.lights_operator()

Here is a variation of the script that works on all lamp objects with their name (ob.data.name! ) starting with "headlight" (case insensitive):

import bpy

class LightsOperator(bpy.types.Operator):
    bl_idname = "object.lights_operator"
    bl_label = "Headlight Operator"

    def execute(self, context):

        for ob in context.scene.objects:
            if not ob.type == 'LAMP':
                continue
            lamp = ob.data
            if lamp.name.lower().startswith("headlight"):
                lamp.energy = 0.0 if lamp.energy >= 0.8 else 0.8

        return {'FINISHED'}

def register():
    bpy.utils.register_class(LightsOperator)

def unregister():
    bpy.utils.unregister_class(LightsOperator)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.lights_operator()

Note that it toggles the lights between 0.0 and 0.8, no matter what the initial value is. If you want to toggle only those with a specific energy, keep rounding errors in mind - it isn't really 0.8 unless you round(lamp.energy, 1):

>>> lamp.energy = 0.8

>>> lamp.energy == 0.8
False

>>> lamp.energy
0.800000011920929

>>> round(lamp.energy, 1)
0.8


Selected Faces show up lighter orange to normal When In edit mode and I press 'A' to select everything some of the faces on my mesh show up a lighter colored orange. This has caused a problem to when I import my mesh as an FBX into UE4 the faces are deleted.

I think I found your problem

You just need to go into edit mode and select all then on the left tool panel ("T") you need to remove doubles. Looks like you had extra vertices that are not needed. I think this is causing problems with your FBX export.

After you remove doubles you will see at the top a few hundred got removed and the shading got fixed.


Cannot execute boolean operation with imported SVG I imported some SVG objects, extracted them and converted them to a mesh. When I tried to perform a boolean difference operation between them, I saw the error message "Cannot execute boolean operation". When I looked in the console, I saw these errors:

uncontained hole loop does not share vertices with any face loop!
CSG failed, exception /build/buildd/blender-2.72.b+dfsg0/extern/carve/lib/triangulator.cpp:898  "didn't manage to link up hole!"
CSG failed, exception /build/buildd/blender-2.72.b+dfsg0/extern/carve/lib/triangulator.cpp:898  "didn't manage to link up hole!"
CSG failed, exception /build/buildd/blender-2.72.b+dfsg0/extern/carve/include/carve/csg_triangulator.hpp:330  unpaired.find((*i).first.first) == unpaired.end()

Here is a link to the file that I'm trying to use. I'm trying to subtract the 'QR' object from the 'BG' object. Is there something wrong with the meshes resulting from the import/extract step? What's going on here?

You could try and deal with this in another way.

I selected an upwards facing face and used shift+g->normals to select all the other faces that are facing upwards and deleted them.

Now if you select edges and press f, the faces can be filled in quickly enough.

By doing this, you can build up the large box without having to use the boolean modifier.


Image will not show through transparent object So I imported an image using the "import images as planes" plugin. Then placed it in a box, and added a transparent cylinder in front of it.

As you can see from the screenshot the brown of the box, plus other objects shows through, but the image does not.

I am guessing there is some setting I need to adjust on the image/plane to get it to show through?

Screenshot, plus the shaders created by the plugin:

It's because the import images as planes tool sets the blend mode for the material to Alpha Blend, and you're using Eevee.

Your options are to switch to Cycles or change the Blend Mode to Opaque.


Cycles. Masking objects with shaders (no compositor) Starting off I want to clear it out that it may be a duplicate question, but in fact it is not.
1. Here's my previous question Cycles. Masking shader. How to make objects disappear in plain sight.
2. Here's the one using the compositor Mask out certain objects?
3. This one uses Blender Render Mask single object

Problem description:
I need to be able to mask out (make it completely transparent) certain objects in a 3d scene. An object placed inside another object's volume (masking objects are closed mesh, water tight, manifolds) should be transparent. If only a potion of an object is inside the mask (masking object) then only that portion is transparent (invisible on the render).

The main use of this is for motion graphic designs.
Demonstrations of what is needed: (imitated with booleans)

The masking object has only one shader - transparent.

Solutions that don't fit and why:

The question at the first link[1] was by me, and the answer
was to use Transparent Depth as a factor.  The problem with
that solution is that it doesn't care whether an object is inside
something or not, it just renders transparent everything that comes
after the transparent surface (the surface of the masking object)
 As you can see,
from one side it's fine but when rotate the view so that all our
objects are behind the masking one, everything that has that shader
setup is transparent.
The answer that is given at the second link[2] uses render layers and as a consequence requires compositing. When you work in 3d and have a production scene with many objects that grow out control, that approach is simply not suitable.
At the third link [3] the solution is provided only for the Blender Render and also uses fixed coordinates for a "faked plane" which is done in nodes, not taking into account any real geometry at all.

My thoughts and commentary:
The masking object has only one shader - transparent.
Maybe there is a way to input the geometry of other meshes through pynodes and somehow use it as a factor in mixing emission and transparency.

Using Cycles, you can achieve this by combining transparent depth of the light path node and backfacing of the geometry node.
We want to be transparent what has a depth modulo 2 equal to 1, as we want to be visible what is behind the transparent object (all are considered manifold).
But back faces have an additional transparency depth because they can be behind its own transparent front face.
So we add the two (backface + transparency depth) and set transparent what is modulo 2 = 1.
Here is an example:

Note that in the provided blend file, if the two transparent cubes overlap (intersect), the blue one will reappear. But the two transparent cubes together are no more manifold when overlapping.


How to heal/fill this type of damage to a mesh? Let's say we have a pattern of vertices, like so:

I have a grave weakness in my modeling: it's quite an arduous process for me to fill those in!
Would someone be so kind as to tell me the best way to "heal" these meshes, ie, fill them in with an edge/vertice pattern that more or less matches the one I deleted?
Without knowing this, a simple mistake can be deadly..
(PS: Yes, one of those is just missing a face.)

For a flat mesh:
You can repair most issues like this by holding Alt and then right-clicking on the boundary edge. Now the perimiter of the hole will be selected. Now press Ctrl+F > Grid Fill. If it is a space with only four vertices/edges, you can simply press F to create the new face.

For a curved mesh: This is a little more complex, but still can be done. You will need to set the cursor position to the center of the curve/sphere. Now set the Pivot Point to 3D Cursor. You now are able to duplicate vertices on each loop and rotate them to the correct positions in the mesh. Simply select each quad of vertices and press F. This is more tedious, but is still effective.


video editing: add mask has no menu I'm trying to add a mask to my clip in the VSE but the menu stays empty.
Am I doing something wrong?

The first thing that you have to do is create a mask.

There are two places where you can do this:

In the Image Editor.

Or it can be created on the Movie Clip Editor

Go to the Motion Tracking Screen Layout and load in your movie. Select Mask in the bottom options panel where it probably currently says Tracking.

 -->

Click  to add a new mask, or select the one you already made from the dropdown. Make sure your mask is named, so that you recognize it:

Key Ctrl +  LMB to add a new control point. Keep clicking to mask your object. When done, key A once or twice until everything is selected and key Alt + C last to connect the polygon. If you want the mask to move, key I to insert a keyframe, move the time cursor in the Timeline, move the control points, and key I again. They will glide in between.

When you are done with the mask, go back to the Video Sequence Editor, and your mask should be there.


Can't paint texture but fill color works Here i created some poor feather and I'm trying to paint surface to give feather some color, but it won't let me  paint texture. I use cycles, so I unwrap object then switch to texture paint and choose diffuse color and click on OK then object become black as that color was choosen to start with but when I change color in palette it won't let me paint just nothing happens but if I choose fill color it will very happily fill it with choosen color.

Am I doing something wrong or?

Here is the video, note that I'm clicking or click dragging while using texture paint but I dont have cast keys plugin to show it.

It was up to settings texture mask (even tho I don't know what is this for) was set to black color/image, after removing painting works as it should.


Laptop won't follow an editing step in a tutorial I am doing I am following a basic doughnut tutorial that I am doing on my laptop.

At some point, the guy in the video says while you have proportional editing mode on and have pressed the g key, 'scroll up or down' until a round circle appears that you use to model your shape with. However, When I try this, my laptop doesn't work.

I have emulated my middle mouse button and I am holding alt + left click while scrolling. Does anyone have any idea what is going on and what I might be doing wrong?

You do not have to hold down any mouse click to scroll or change the size of the proportional editing circle. Emulating middle mouse emulates a middle mouse CLICK (ie pressing the mouse wheel down like a button).

In proportional editing, begin the editing command (whatever it is, move, scale, rotate, etc.) then you are free to scroll to make the proportional editing circle larger or smaller by simply scrolling, usually 2 fingers up or down on the trackpad.

you can also use Page Up & Down, but some laptops won't have that.


Smooth deformation of rigged vertex group I’ve been trying to rig vertex groups to bones smoothly. As in, trying to have some parts deform more, others less, painting their weights accordingly. The whole vertex group moves as a whole though, in a very unnatural manner. I thought that was the point of weight painting, so I assume I’m doing something basic wrong.

The entire vertex group moves homogenously, as a single block, sort of tearing the texture. I’d like the vertices nearer to the fulcrum to be less affected by the bone’s movement than those nearer its end.

I’ve weight painted a smooth transition.

Have also tried painting weights to another bone, as if it were a zero-sum game, to no avail.
What am I doing wrong? Thanks so much.

Welcome to Blender StackExchange!

What's going on here is that the vertices you have painted only have weights that move them, and none trying to hold them in place. When weight painting, you're essentially telling blender how much a certain bone will affect a vertex. Think of it like a tug-of-war. If there's only one person pulling, it doesn't matter how strong they are, they're going to win.

Thus, to solve this problem, you'll need to add a bone (say a head bone) that the stationary parts of your model are assigned to. Then it's just a matter of blending the two weights. A trick for this is to move the bones to a point where it doesn't deform well, then paint it until it does. Then you can reset the bone (Alt+G and Alt+R). You may find the blur brush handy as well, as that can eliminate the sharp transitions between colors that you see in the third image.


Frame Navigation Problem? When I try to drag the frame viewing slider along the frame container while in pose mode, the model deforms. It continues to move even if I drag the slider to it's original position, meaning that the more I move it, the more it twists. When I go to edit mode and back to pose mode, the model resets to the correct position. Why is this happening?

I solved the problem by remaking the armature, I think Ray Mairlot was right about a dependency cycle issue.
Ray Mairlot


Ground not rendering For some reason, my ground is not showing up. It appears in the 3d view mode, but disappears when I render it. My ground is set to render, but it won't show up.

Here is the file

The "Render Emitter" check box must be checked in the particle panel. If not, only the particles emitted are rendered.


Blender Game - How do I start the game with the cursor centered? I have a custom cursor, I need it for moving crosshairs. I have a moving ship that is only controlled with the keyboard, but in front of it are 2 empties. When I press the assigned key/button, 2 bullets come out. It works great. I also have it so that these empties turn when I move the mouse. Mouse/mouse movement - and - mouse/look. It works when firing the guns, I can move the mouse and the guns move. The problem that I am having, however, is that the cursor and the line of sight for the bullets don't line up. If I press the "reset" on the mouse/look actuator, the cursor will stay in the center while the bullets aim and move around freely. If I click off on the "reset" on the mouse/look actuator, it's better, but the cursor doesn't align to where I'm shooting. I can kind of fix this by forcing the cursor to the side, and it centers both of them for a little while, but after a minute or so, the two become separated once again. Is there a way to fix this?

This is how I have it set up right now:

Here's how the empty is set up for firing the guns:

Here's how the cursor scene is set up, which needless to say is overlayed:

And this is what it's doing. Notice how the cursor is near center, but the bullets are firing off to the side?

Basically, I want to know how do I link up the bullet line of sight with the custom cursor?

Update I have found a script that centers (well, a little off from center but that's preferable for me) the mouse upon starting.

import bge

bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2.003),
int(bge.render.getWindowHeight() / 3))

Sadly, the empties do not align to center the way that I want it to still. It still makes them shoot off to the side. Is there a way to fix this?

According to the description you really want to let the ship fire projectiles toward a point under the system mouse cursor.

I suggest to use a short Python script to position an "aiming target" empty at the desired location (e.g a collision point under the cursor). Then let the turrets turn towards that aiming target (TrackToActuator).

Setting the system mouse cursor to the middle of the screen at game start would still add to the player's comfort.


Making a smooth transition from full alpha opacity to full transparency My question is - how to create a shading setup that will smoothly interpolate between full opacity to full transparency. I'm trying to do this on a simple plane with somewhat partial results.

In the image above you can see that the rendered image is partly invisible only on the background of a different plane, and not where the scene background is. Is there a way to solve it so that I have alpha everywhere?
What I simply want to achieve is a linear gradient from one color, to a transparency, something like that:

Your issue is that you are applying the gradient to the color of the transparent shader, instead of using it to control how the two shaders are mixed. Since your factor slot is empty, they are just being mixed with a factor of 0.5 across the whole surface.
My result:

The nodes:

Explanation
To transition from a color to transparent, you essentially want to mix the two shaders, here a transparent BSDF and an emission shader, with the mix factor increasing along the gradient. For a simple gradient along the X axis, I used a color ramp, but you could apply the same process with any other gradient texture. Here, I want a value from 0 to 1 along the color ramp based on the X position on the object, so I plug in the X component of the Object coordinates as the factor to the color ramp, and use that to control the mixing.


how can I create faces from a mesh that has gaps? without creating overlapping faces? I am new to blender, I don't know how to describe what I am looking for. Basically, I have the following sets of edges and vertices, I am trying create a face out of the outer square, while leaving the 2 inner rectangles without a face. If I do 'f', I am getting a double face that is overlapping the square and the rectangles.

You will have to create more edges between the inner squares and outer square.For the faces to be constructed between.  This is one possible way of doing it, although not the only way and not optimal.


How can I convert a UV map into a mesh? Blender 2.7 is going to support sewing. It makes sense to be able to unwrap an object (clothes) in to a 2d pattern, orientate the 2d panels around the body and then 'sew' it back together to simulate how the pattern fits.

Is it currently possible to convert a UV map in to a mesh?

Currently there aren't tools to do this right at the moment, but this is a fairly simple operation. Internally the exporting UV's layout to PNG does this. its just hidden from the user and the mesh is removed immediately afterwards.


How to precisely set many camera positions for rendering? I find it very hard to set the camera because I can't fine tune it for rendering or see it when it changes. I can position the camera but how to change it when in Camera's View? Thanks very much.

Set the camera (relatively) where you want it with CTRL + ALT + NUM0, then make sure the camera is selected (it doesn't matter if you exit the view). Then, re-enter camera view mode with NUM0. Press N to bring up the transform toolbox, and you can fine tune it from there. Either drag the sliders, increment with the arrows, or enter number values.


A Black Material Problem on imported DAZ Obj materials I'm currently trying to materialize a DAZ Imported OBJ Character and the process was difficult, but I'm making good progress in the translation. However, I've run into a wall.

Im trying to simplify the materials and I'm trying to work my way to only a few materials for the model. The problem occurs when I try and take exact node groups of a material, and plug them into another material in order to effectively combine them.

This is my Node group. When I put it into another material and use the necessary UV Input node and connect it to that materials output node, I get a black mesh error. You can see the error on the straps. They should all be white.

The above image is a picture of me disconnecting the Bikini strap material, because its not necessary. I have copied the nodes into the Bikini Bra material from the bikini strap material.

In the above picture you can see how I put both the Node group along with the parent material into a mixed shader. It still doesn't work. In this picture we can see the data pane as well. My thought was that there was some kind of UV or extra data that I wasn't seeing, that somehow connected to the materials, making them specific to the nodes. Effectively only allowing me to use certain materials, excluding me from the new ones I created. Hence causing my current predicament.

The major problem seems to stem from the objects inability to deviate from the materials directly imported from DAZ, for a reason that I don't know. As long as I use the original generated material slot directly imported from DAZ, my custom node group works. The logic is working.

But if I copy and paste that same logic into another material, even if it was originally generated like the other materials. It wont work. The bikini strap example was used with two imported materials from DAZ, the only materials that seem to work.

The above image shows my Torso.004 Material working, even though I made the material a unique copy. Independent of my newly created material I will show you next.

As you can see, the newly created material, is using the same exact nodes from the torso.004 material imported from DAZ. The only difference is that I created a new material to house those same nodes that worked before.

Anna_Body is the new body material I wanted to use so it could house my different node groups into a combined single material for the mesh body. I find it peculiar that it doesn't seem to have the same data children as the other materials. Even though in the nodes, they reference the same images as the original materials do.

As above, you can see my new Anna_Body material doesn't have any of the kd.91 texture files, even though I do in fact reference them in the node group I made and put into the custom Anna_Body material.

In this picture you can see into Anna_Body Material group. I even made sure to make a copy of the image as unique so there wouldn't be any cross over conflicts. This unique node group works in the original torso.004 material as well, just not when I disable Torso.004 Material and try to use the Anna_Body Material instead. The nodes are effectively the same.

I really tried to make this as clear as possible, if you want more information I can give you pictures. Because this is a Daz proprietary model (victoria 7) I am not allowed to distribute the blend file.

Any suggestions or ideas would be welcome or even references, I've scoured the interwebs but I really don't have any idea of what I should even look into to find a solution or even the cause for this. Anything would be awesome, thanks for taking time to even consider the post.

I had a closer look at your images, and it seems like in your new material, the node group's shader output is not connected to the material output node.

Connecting these up should fix things.


How to make the Camera rotate more than one time? How can I circle the camera around more than one time?

Hope you can help me.

Double turn around a circular path -

Add a curve --> circle.  Set your total frames in the timeline to say 250.

In the path's geometry properties, set the "Frames" to 200.

At frame 1 keyframe the path's Evaluation time" which should be showing 0.000

Take the timeline cursor to (e,g,) frame 240.

In the Path's properties, set it's "Evaluation" time to twice that in the 'Frames' slot. (400) and  keyframe that.

Set an empty or other object to follow the path.


What do I need to become a Blender developer? I have been wanting to become a developer for some time. I want to keep software up to date and put some ideas in practice, like creating a remesher with flow detection.
I like to use python to write my software.

The point is, I am not a very good programmer (actually, scripter), but I'm sure that some I can write some cool tools no one will write for me.

So if I want to be a developer, where do I start?
What are the requrements for that?
What do I need to learn?
Can anyone be a developer?

Great question! There are many ways to help developing Blender. The best way is to find things to improve first, like fixing bugs. That'll help getting familiar with the code and structure of Blender. The first place to start is the wiki page https://wiki.blender.org/index.php/Dev:Contents, mostly the "Getting Started" section.

Also drop by on IRC, channel #blendercoders on Freenode. There you'll find friendly developers you can ask all kind of questions.


Bevel modifier artefact on a single vertex I made a simple object and applied a single bevel modifier on a vertex group. The modifier works fine except for a single vertex (see picture below) where it created a strange  artefact.

To avoid that I tried:

removing doubles
recalculating normals
checking for double faces
recreating the group
reopening blend file

Here is my blend file:

Has anyone an idea what is wrong with the object?

I think there’s nothing bad with your topology, EXCEPT that it can’t fill your needs, meaning it can’t properly bevel with the Bevel modifier:

You've created a vertex group to designate all the edges that are supposed to be bevelled by your Bevel modifier. At the top of your mesh you've selected all the border vertices because you want all the border edges to be bevelled.

The problem is that vertex groups don't include only the vertices, it also include all the edges between vertices. Therefore your modifier will also affect all these edges:

You can verify it, if you select all the vertex group, you'll see these edges included:

So, as you're using a Bevel modifier with Vertex Group method it will also bevel all these edges and it will give a mess of intertwining edges. Yes by chance it kind of works better on the right side but I don't think it's satisfying either:

If you create additional topology to make sure that the inner edges are not affected by the bevel, in my opinion it still won't work properly and it will make you loose the roundness you want:

So I may be wrong (edit: actually it looks like the topology proposed by Metaphor_set works with modifier) for the result you wanted) but the solution is probably to do it manually and to bring some manual corrections at the end with some join vertices and dissolve edges. The Bevel modifier can't always do everything properly:


How to modify mesh after sculpting with multiresolution modifier? I've created a character and sculpted them to an extend I like them.  I realize now, however, that I did not model the inside of the mouth.  When I try and extrude from meshes, it screws up the normals badly.  How do I modify a mesh after using multires?

The Multires modifier does not like changes on the low-poly base mesh very much. It can mess up the high-poly levels and add spikes and other abnormalities.
You can try to select and separate the new extruded mesh, remove the Multires modifier from the separated mesh, then join it again with the body object (that has the Multires modifier). Make the body object the active object (selected last) to keep the Multires modifier.
If this doesn't work then it's time for plan B.
Plan B: Shrinkwrap
Make a copy of the original unchanged object, remove the Multires modifier from the copy, add the inside of the mouth to the copy, add the Multires modifier. Finally, add a Shrinkwrap modifier and shrinkwrap it to the original mesh to transfer the sculpted details. For a better result use Wrap Method Project, and tick the Negative checkbox (project direction). Then apply the Shrinkwrap modifier.
Example videos:

Blender Sculpting Tutorial: Full Advanced Creature Creation Workflow
Projecting High-Res Models in Blender 2.8 using Shrinkwrap  (use a Multires modifier not a Subdivision Surface modifier like in this video)


blender viewport is rotating around an unknown point In blender 2.73 , when i scroll with my  MBP trackpad to rotate around my cube , it does not rotate around the cube as center. but it rotates around another point not too far from the cube.

I checked online for how to set pivot points and found menu->object-> transform->geometry_to_origin,  and a few more options , but the rotation point is still not the center of the cube itself.the only way for me to get back to normal  is to close this file and open a new file from start.

i want to rotate the view , with the cube as center , just as it did when you open a new file. what is the trick to fix this ?

To make the viewport rotate around the selected object go to User Preferences and check Rotate Around Selection:


Light bending or custom rendering engine? I want to create a short animation of the sun/moon rising and setting.
However I want to include some custom parameters to allow for the bending of light.

To elaborate, I am not talking about refraction here - instead I am talking about a competely new capability of light to bend in an arc that starts horizontal near the ground and gradually ascends into the sky (like an exponential curve). So basically I want to be able to describe how light should travel - not in a straight line but in an arc.

Is there a way that this can be done in blender or do I need custom work done?
If custom work is needed, who should I get in touch with for it?

Thanks

Nope Cycles cannot bend light in arc nor Blender Internal. Only the renderer Interstellar was rendered in is capable of it as far as I know.

You can bend light with multiple planes with refraction shaders though.

Or you can code your own renderer.


Curve bevel only beveling half a circle I beveled a curve grid with the built-in bevel option. The problem is, it's only beveling half of the circle... it's such an annoying little thing, can someone help? Here is a screenshot of an intersection on this curve, only the left half of the circle appears!

As Mr Zak suggested, the option Object Data > Shape > Fill has to be set to "full" instead of "half", as mine had.


White colors in view port vs render output Eevee Hi all, I'm hoping someone could help me with this problem here, which I believe is a shader's problem?
Left side is the render output, the right side is the viewport rendered view, eevee.
The viewport is what I want. The chairs, tablestops and cloth in the background show a nice white, and in the settings, all color settings are set to max white. So when in the render output they turn out this dark grey......I'm dumbfounded. The light source of this scene is from emissive material from the squares on the ceiling, so they look white. What's a tip that would make the emissive white more emissive and the greys more white?
Thank you.

To make emission lighting work properly in EEVEE, you need to use an Irradiance Volume (under "Light Probes" in add menu).

As you can see, without the volume, as soon as the emission object is out of camera view, the light from it disappears:

Scale the volume to encompass the area you want to boost the accuracy of the lighting (including emission values). You can adjust the detail from the properties panel.

Additionally, you need to bake the indirect lighting. Otherwise, although emission materials may glow (with bloom), they do not provide any lighting

Although I realize now I had some world lighting adding to the situation in the first image, you can still see that the lighting is more pronounced in this last photo. Also notice the lack of any light in my scene tree. All lighting is through emissions (except for a small amount of world lighting - that is a failure of my example, but does not change the effectiveness of the Irradiance Volume)

You can see the difference, as the room is now lit, even though the emission object is out of camera view:


Blender 2.80 where is the "interactive code panel" gone? For a lack of a better term, please look at the following image.
I have been trying to drag around 2.80 like a maniac, was it moved somewhere else?

It's just that the "Info" editor isn't opened here by default. To get it back, simply open it somewhere else:


How to make small objects fall properly with rigid body? I have a bunch of dominos set up in my scene. I want them to tip each other over(aka the domino effect). However, they're not falling realistically. They're falling way to slow.

My dominos are reshaped cubes, which I've applied a box-type rigid body to. But because of limitations unbeknowst to me, I can't properly use rigid body on so small objects. Therefore I've scaled them up to 40 times larger. They are now 81,284cm x 25,414cm x 177,8cm. Because they are sooooooo large, they fall reaaaaally slow.

They are standing on a plane which have been applied a passive rigidbody.

Is there any way of making them fall realistically fast?

I've tested speeding up the scene time, but turns out a bit weird/unrealistic.
I've tested bumping up the gravity, but also feels a bit weird.

File: http://www.pasteall.org/blend/26893

Normally, when simulating for the first time after adjustment, the data needs to be cached. It will look more smoother as expected when playing back from then on.

If this is not the case here, then you can adjust the Speed value located in Rigid Body Worlds panel, which lets you control the speed factor for simulation.


Animation Nodes: How to create faces from a Particle System? I just started using animation nodes and don't understand a lot quiet yet.

What do I want to achieve?
I've set up a particle system with an icosphere as emitter and used animation nodes to create splines between the particles:

This is my node setup so far (it's basically the node setup from the AN-docs):

And this is the result:

So far so good. But now i want to create triangular faces (and different objects for each face) between close edges that are already connected.

I've played around with some nodes, i.e. "Combine Mesh Data", "Create polygon indices" and others. As i'm new to AN I don't really understand the input and output format for each node so i'm stuck here.

Any help is greatly appreciated!

I looked at this question but didn't understand how to apply the provided answer to my question... :(
Create a Mesh with vertices

EDIT:

I uploaded the blend file:

And this is similar to what i want to achieve:

The shape of the faces doesn't matter that much. But it's still important which parties connect, so the faces don't go right through the center of the sphere.

Polygon Indices List

Before getting into the answer, let us first study some facts about polygon indices lists:

A polygon indices list is a list of tuples each of which include the indices of the vertices each polygon is composed of.
The order of indices of each polygon does not matter, so the polygon (triangle) with indices (0, 1, 2) is the same as (1, 2, 0), (2, 0, 1), (2, 1, 0), (1, 0, 2) and (0, 2, 1). However, the normals of the first three triangles will be the inverse of the later three, that is due to the fact that the mathematical operation used to compute polygon normals cares about the order.
A polygon indices list can not contain:

Two similar polygons, so only one of the indices mentioned in the previous point can exist in the list.
Each indices has to have at least 3 indices.
The indices should be of existing vertices, so if there are n number of vertices, the maximum index that can be used is n-1.

Generating Polygon Indices

The underlying structure used in the Find Close Points node is the KD Tree and we will be using it to generate our polygons as well. A KD Tree can provide you with the indices of the n closest vertices to a given point--Which can be any arbitrary point. If we used those indices to create a polygon where n=3 we will get the polygon indices of the triangles you wanted. if we used n=4, we will get quads and so on.

So we create a loop that takes the KD Tree that represents the vertices locations and n as inputs, a list of arbitrary vectors as an iterator and returns the created polygon indices as an output:

If we attempts to use the output directly, AN may return an error, that is because some indices might have been created more than one time, this is due to the fact that the same n vertices might be the closest to multiple arbitrary vector. So it is obvious that we have to make sure no polygon is created twice (Remember that a polygon can take multiple forms since order of indices doesn't matter).

To make sure we don't add two similar polygons, we keep track of the polygons created in previous iterations and only add the polygon generated in the current iteration if and only if it wasn't similar to any of the polygons created in the previous iterations. To keep track of the polygons already created, we create an empty polygon indices list as an input, append the created polygon and reassign the list:

Study Loops in the documentation to understand how this reassign works. We then need to check if the current polygon exist in the list of polygons we just created by appending and reassigning, this can be done by using a simple python generator:

not any(set(p) == polygon for p in polygons)

Where polygon is the set of the indices of the current polygon and polygons is the list of polygons we just created by appending and reassigning. We simply convert the polygons to sets (Because order doesn't matter, remember) and check if they are equal, If any of them is True, True will be returned and False otherwise, the not invert the boolean so that we can use it as a condition in the loop generator:

By using the condition input in the generator, we only add the polygon if all the booleans in the list is False.

And by using the loop we created, we get:

By setting the amount to four, we get quads, however, quads might not always be coplanar nor convex, so the results might be messy:

So far we have been using the vertices locations as the arbitrary vector list, and it works, but better result may come out when you use different vector lists (In my case another random vector list but with different seed):


Close a popup with an OP call I have a invoke_props_dialog popup that shows a list of modifiers. It has a OK button that calls execute() and closes it:

I want to have a similar popup with two buttons, that'd do different stuff but still close the popup. So it's like having two executes:

So I changed popup type to invoke_popup and added two buttons as operators (screenshot above), however I can't figure out how to close the popup after I press a button. I know that with invoke_popup I can simply click anywhere outide the popup area to close it however I wonder if it's possible to imidiately close it with a single click.
Here's my code:
import bpy
from bpy.props import (
    BoolVectorProperty,
)

class TestOpA(bpy.types.Operator):
  bl_idname = "object.test_op_a"
  bl_label = "My Button A"

  def execute(self, context):
    print('executed A')
    return {'FINISHED'}

class TestOpB(bpy.types.Operator):
  bl_idname = "object.test_op_b"
  bl_label = "My Button B"

  def execute(self, context):
    print('executed B')
    return {'FINISHED'}

class TestMainOp(bpy.types.Operator):
    """"""
    bl_idname = "object.test_main_op"
    bl_label = "Test Popup"
    bl_options = {'REGISTER', 'UNDO'}

    selection: BoolVectorProperty(
        size=2,
        options={'SKIP_SAVE'}
    )

    def draw(self, context):
        layout = self.layout

        layout.prop(self, 'selection', index=0, text='Prop Name 1',toggle=True)
        layout.prop(self, 'selection', index=1, text='Prop Name 2',toggle=True)

        column = layout.column()
        r = column.split(factor=0.5)
        o1 = r.operator("object.test_op_a")
        r.operator("object.test_op_b")

    def invoke(self, context, event):
        wm = context.window_manager
        wm.invoke_popup(self)
        return {'RUNNING_MODAL'}

    def execute(self, context):
        return {'FINISHED'}

def register():
    bpy.utils.register_class(TestMainOp)
    bpy.utils.register_class(TestOpA)
    bpy.utils.register_class(TestOpB)

def unregister():
    bpy.utils.unregister_class(TestMainOp)
    bpy.utils.unregister_class(TestOpA)
    bpy.utils.unregister_class(TestOpB)

if __name__ == "__main__":
    register()

One way to solve it would be by moving the cursor out of the panel temporarily, like so:
def close_panel(event):
    x, y = event.mouse_x, event.mouse_y
    bpy.context.window.cursor_warp(10, 10)

    move_back = lambda: bpy.context.window.cursor_warp(x, y)
    bpy.app.timers.register(move_back, first_interval=0.001)

How this works is: first, we grab the X and Y values of the current mouse position, because in the next line the event is updated, and we lose the original coordinates.
Next, we move the cursor way over to the bottom left corner of the screen (not 0, 0 though because that doesn't close the panel for some reason).
Then, we prepare a function which moves the cursor back to where it was originally.
And finally, we use bpy.app.timers to delay starting our function by 1 millisecond, to give Blender time to realize the cursor is no longer on the panel, and close it.


A Simple way to make a wreath I am trying to figure out how to make a Christmas wreath in blender. The only tutorial I have found is time elapsed and super complicated. I was wondering if there is an easier way to make a wreath in blender, or if there is some tutorial that I am missing.
Here is an idea of what I want to accomplish.

I made a simple wreath by using a particle system to make the shape of the wreath and only modeling one branch object then distributing it around with the particle system (no combing the particles).

Start with a torus (I scaled it along the Z to make it thinner).
Add a particle system to that torus. All you really have to set in the particle system is the Type (set it to "Hair") Length, and the Number of the particles. There are 1000 strands my wreath.

The important part are the force fields. All the below force fields are in the exact same spot as the torus, except for the two wind ones.

First add a Vortex Force Field, this is to make the strands curve around in more of a wreath shape.
On the left is just how the particle system looks, and on the right is with the vortex force field.

Add a plain Force type force field. This is to enlarge the center hole in the wreath.
Add a Wind force field. Rote it so that it points up. Here you need to set the Maximum Distance so that the wind only affects the strands on the bottom. You want to adjust the strength so that it just pushes the strands on the front or back side of the wreath into shape.
When you have that one adjusted to your liking duplicate it ShiftD, move it to the top and rotate it so that it is pointing down.
In the image below the wreath on the left has no wind force fields, see how the strands stick straight out the wrong way. On the right is what it looks like after adding the two wind forces, the strands are smushed into a wreath shape.

Now model a branch, it can be simple, but keep the length about the same size as the length of the strands. Do note that the stem of my branch has loop cuts all along it (they are the only part selected). That allows it to bend along with the particle strands.

Add a particle instance modifier to the branch you just modeled. The reason I'm using this modifier instead of the more common method of just setting the object in the particle settings is because the particle instance modifier will deform the object, as opposed to the just rendering the object in the particle system, which will keep it straight.

Set the Object to the Torus we added first.
Then check the all important Create Along Paths checkbox. Because I have my branch along the Y axis, the Y axis is selected.

Granted you are probably going to need to tweak your wreath some. Any time you're using force fields to model something it can be rather finicky. For that reason my blend is attached. Look through it, copy the settings, learn from it.

Here is the full blend