Blender add rough/random surface I took a long break from blender recently, and I'm having the hardest time remembering the modifier that added random rotations to vertices.

All that I can find online is using the Displace modifier with a texture. But I'm 100% sure I didn't use that when I created this old model (picture below).

You probably think of using Proportional Editing with Random Editing Falloff.


Translucent polyurethane gradient material node setup Trying to recreate this gradient of cast polyurethane pieces in blender. Each of the x10 pieces is its own colour along the gradient. My limited knowledge has kept me in the principled shader unfortunately.
Rough colour codes...
#1 - E9C64C
#2 - DFB243
#3 - D49E3B
#4 - C78B35
#5 - BA792F
#6 - AB672A
#7 - 9C5625
#8 - 8C4621
#9 - 7B361C
#10 - 6A2717

I suspect all colors are the same, but what changes is the transparency and maybe the roughness. That is the data that would be useful to reproduce the material accurately.
In any case, the basic setup n cycles would be a glass shader, where you can control the roughness and a combination of volume absorption, for the color, and volume scatter for translucency.

Hex codes for color are not very useful, as they are meant for sRGB display referred images displayed on a monitor, and blender does not work that way. The same color can look very different depending on the lights and surrounding elements.


How Do I Use Armatures , I cannot get them to work with my meshes Im Trying To Learn How To Animate Movement with Armatures but all i can seem to do is move the armatures and not the actual mesh.

The easiest way is to parent the mesh to the armature with Automatic Weights, and then adjust the weights later on:

Select the mesh (Object Mode), and then select the armature
CtrlP, and then select 'Automatic weights'. Now Blender assigned weights to the mesh and parented them to the bones of the armature, depending on how the bones and mesh are relatively located.

To modify the weights:

You could select the armature and enter 'pose mode', by CtrlTab
Then you select the mesh and enter 'Weight paint mode', by CtrlTab. Now you can select a bone, while you can edit the weight paints of the mesh using the brush


Python command within script to abort without killing Blender When using the Text Editor, what is the best command to include inside a script which will abort the script at that line?

quit() and sys.exit() stop the script, but also kill Blender.

If it is meant to be temporary while drafting the script, raising an exception is probably the easiest solution.

raise Exception()

If it is not meant to be temporary you may consider reorganizing your code using additional functions or logic/control flow. Python actually runs faster if the code is wrapped in functions. (see this post on stackoverflow)

The equivalent to running the code from the text editor is (see api docs)

filename = "/full/path/to/myscript.py"
exec(compile(open(filename).read(), filename, 'exec'))

Calling sys.exit() raises an exception which is allowed to propagate and thus exits blender. (see
SystemExit,
exit(),
exec()
)

You may run your script manually with exec and catch an exception, i.e. SystemExit, with try ... except.


I don't know how to bring my model back after clicking a mesh data link on the object data tab I am not even sure what to call it. The model was not created by me, but I wanted to mess with it. It came in OBJ and I went through and combined it all together. After messing in the menus I discovered this under object data. I clicked this, and now the rest of the mesh is gone, and I don't know how to bring it back.

As mentioned in the comments the OBJ mesh I imported had several "parts". What I did was when I went into object data I was viewing the old parts from the original mesh I imported. So I deleted the original mesh with so many "parts". Afterwards the only things I seen in mesh data were my object, and my floor plane. I selected my object, and it reappeared.


Ray cast doesn't validate hit in Animation Nodes Here I have results from Intersection Line Plane (green dot) and Ray Cast (red dot). White dots represent a Line.

I don't understand why does ray casting tell me there is no hit?

The Ray Cast BVHTree node takes a Start and a Direction, not an End. To compute the ray direction vector from the line, you can subtract the start and end of the line to get the direction.


How can I round up a single edge of a plane? How can I round up a single edge of a plane?

I hope the pictures help to understand the question.

I'm using Blender v.2.78

This can be accomplished with the Edge Fillet Plus utility in the Edit Tools 2 addon. First, enable this addon in user preferences.

Then use the W menu in Edit Mode with the two edges selected:

This process converts the face to an N-Gon. To fill this shape, Alt + Right Click the line to loop select as shown above and hit F to fill the area.


How can I add a scale reference to the Z axis Blender has a convenient reference grid with 1-unit squares, centered on (0,0,0) in the X-Y plane; I want something similar on the Z axis.

I know I can add reference images to the background, and I could create one manually for this purpose ... but having to go to a separate program and import a specially created image seems excessive when I just want a simple ruler to eyeball things against. My current workaround is to add several plane meshes to make a vertical line of squares that I can measure against - but again, it feels like there should be an easier way to do it.

Is there a quick and easy way to do this? Ideally, it would let me set a custom interval for the gridlines/ruler ticks, but I'd accept the standard 1-unit ticks if that's the best I can get.

Easiest option

Orthographic views tend to be useful for this. Even if you're eyeballing there will be less distortion in the perception of location. Orthographic views will show a grid in all three orientations. -- font, left, top ... and their reverse: back, right, bottom. See the Blender manual for all options, and menus relating to this

Here Front, Top and Left are visible.

possibly interesting option

An addon called 'Chromoly Ruler' or just 'Ruler', is included in the addons_contrib. If you get blender from somewhere like builder.blender.org. It looks like this


Fire Not Showing In Rendered view or LookDev but in other views Eevee I've been losing my mind about this. Looked all over the place tried what others have. Nothing works.

I've designed a throne room and the braziers I have next to the throne must have fire. I add the smoke physics and what not. Everything looks good. Until I decide to look at it in Rendered View. Nothing was there. My fire was gone. Did the attribute thing by changing the flame attribute from "Flame" to "flame" restarted Blender. Nothing worked. Please help me out before I put a fist through my laptop.

Can you post a screenshot of your fire material nodes? And do you have Volumetrics enabled for Cycles and EEVEE?


Blender Renders Gray Full Screen so I have been following these tutorials trying to create a robot dog. I followed them to a tea and then when I go to render the animation of the dog I was told to create in this tutorial I get a fully gray screen; frame after frame.  I look for the sampling section and I cannot find it. I don't know how to fix this so that it comes up with the actually rendered animation, as well as that I had some nodes for the dogs color and other aspects and they seem to have gone as well. Can anyone help?

Link to site: https://www.youtube.com/watch?v=W4TkA5P5Qes

Dropbox Link to .blend file
https://www.dropbox.com/s/pqrrs2wcx9hsyg9/crappyDog.blend?dl=0

Your project has materials for the cycles render engine. If you render on blender internal the file will not render correctly.

Materials form different render engines are not interchangeable.


How to get local axis orientation in Python? How to get orientation of the local axis in python?

As Codemax answered. Thanks to him. Here is an example how i can rotate Localy an active object at Y-Axis.

activeObj = bpy.context.scene.objects.active
activeObjMatrix = activeObj.matrix_world
theAxis = (activeObjMatrix[0][1], activeObjMatrix[1][1], activeObjMatrix[2][1])
bpy.ops.transform.rotate(value=rotateValue, axis=theAxis)


Create reusable action/animation? I created a tank turret and I was wondering if there was a way to create script or a "property" for firing the turret instead of animating it firing each time manually (telling it to reload shells (visible to viewer), create smoke, create shell, add physics to said shell, add recoil that is based on turret angle, etc.)?

If so, are there any examples that I could watch/read to understand it a bit better?

You can actually quite a bit with just a few drivers.

Result

I'm not going to explain the entire process, but I'll cover a lot of the more interesting points.

If you haven't already, learn how drivers work (here's a tutorial I made). They're an extremely powerful way to control different object attributes.

For the barrel recoil, I created a driver that makes the barrel follows the position of an empty (the one moving back and forth). The position of each section of the barrel is just controlled by a custom curve (offset for the back section so it follows slower). This is the curve of one section:

There are three bullets at the beginning of the animation hidden in the back of the barrel. I couldn't figure out how to dynamically add them while the animation was playing. There might be a hacky way to do it with a particle system, but I decided that hiding them was the simplest solution.

The first thing to note about the bullets is that they're dropping as they follow the empty. All I did was create a driver that calculates the trajectory of the projectile using the Y position of the empty for the current distance. Because it was long (and hard to type into the expr bar), I just put it in a Python script:

Then all you have to do in the expr box is put: calc_path(x, ang, height, velocity).

Finally, the bullets are set to be animated rigid bodies. That way they can interact with the other rigid bodies in the scene. When I wanted them to simulate and bounce around on the ground, I simply animated the animated attribute in the rigid body settings:

The result isn't completely elegant, but it certainly does cut down on the amount of animation you have to do.

If you're interested in dissecting the .blend yourself, you can download it.


3D Cursor appears to be invisible while 2D animation mode / 2.82 I recently started using Blender for creating 2D animation scenes. Unluckily, I faced an issue of inability to track the 3D cursor as it is  invisible. I was amused that still I felt free to set its position manually or back it center by Shift + C. This means the 3D cursor isn't disabled, but hidden instantly in this mode. There's no related label in Settings and there's no search bar in the Settings menu idk where it is supposed to be. Oh plz help me to fix this.

You mean the window on the left? You need to turn on overlays first, the cursor should be enabled by default, but check the box if it isn't. This works the same in other viewports as well, but overlays are usually enabled by default.


Blender 2.81/2.80: How can I change the color of light of a spot - nodes seem to have no effect? When changing the color field of emission shader node of a spot light in eevee it seems not to have any effect. This is valid in the node editor as in the light tab.
How can I change the color of light of light sources in eevee?

Works the same for me in 2.8 & 2.81-

So the answer is: in the light panel. Where my screen-grab shows the blue colour swatch, just under the type-of-light buttons.

I'm guessing you chose 'use nodes' for the light with Cycles as the renderer, if you notice my screen shot does not have the option in the light panel (as I'm using Eevee).
I had to chose 'use nodes' with cycles as the renderer before switching to eevee.
So the nodes should, by rights, disappear / become ghosted or whatever when you switch to eevee, but obviously do not... Somewhat annoying / confusing!

Help menu / report a bug (or a 'paper-cut' or whatever!)


How can I make a shiny edge material in cycles? Is there a way to replicate this pseudo-shiny effect that appears on Sonic from Sonic Generations in cycles?

 Image Link

Here is Sonic's basic material setup.
The trick is Fresnel with a little help from AO.


How to Import Another Python script using Python Script If I wan't to import another python script(Test_script_1) and also run it through my python script(Test_Script_2)

Can this be done through init.py script ?
Can anyone tell me how to do that ?

Here's what I've just done, it seems to work.
My paths are:
scripts path -

C:\Users\Drew\Documents\Development\bfd-graphics\Blender Scripts

mainscript path -

C:\Users\Drew\Documents\Development\bfd-graphics\Blender Scripts\main.py

blender file path -

C:\Users\Drew\Documents\Development\graphics\3D
Assets\Prototype\Blender Projects\Templates\Builder.blend

I wanted to be able to import scripts from a completely different but known relative directory. So here is how I tackled it:
import bpy, sys
from pathlib import Path

path = Path(bpy.data.filepath)
sys.path.append(str(path.parent.parent.parent.parent.parent) + "\\Blender Scripts")

import test_import

test_import.print_a_message()

The number of parents determines where in the directory structure I am, and then I add the rest of the path as a string.


How do you get xcftools or an alternitave to work in windows? there is plenty of talk about xcftools for Linux (obviously as its only Linux compatible) but there is no mention of windows or mac. not even an alternative.

its imperative that I can work the GIMP plugin. as I do not have the money to purchase the full version of AE or PS.

I am now using GIMP and Blender as the alternative for Adobe for these, only i've ran into road block after road block. The only one which is physically stopping me from working though is the need for xcftools.

If anyone has overcome this hurdle, your wisdom would be greatly appreciated.

Is the file in a .tar.gz format by any chance?

If so,I know your answer.

Simply go to a free online file converter,then change it to a .zip format and finally import it into Blender using the "Install File" button on the User Preferences.


How to apply material on an object that is under armature I have an object and I have made a simple animation using it so it is under an armature on the outliner editor.

When I apply a material to this object, I can't see the color of material but if I render the image I can see the correct colored object.

How can I apply a material to an object under an armature and see the result on the screen?

To see your materials with proper texturing and shading change your viewport mode to either Texture or Material.


Vector math to get Curve object silhouette If you color ramp the Facing output of a Layer Weight node, you can make a mask of faces at glancing angles. This can be used as a material based silhouette mask for effects, or directly as line art.

Here is a curve beveled into a cylinder showing the effect working pretty nicely.

However, the effect doesn't work so well on larger faces, such as the sides of a cube, or down the length of this cylinder. In those cases, it shades the whole surface because it is all the same normal facing. I am trying to find a way around this problem.

I learned from this question that it is possible to use UVs and vector math to get a curve's direction. It seems it should be possible then to either use a similar method to get the silhouette of the curve, or use it to mask out of the Layerweight along the curve, or something along those lines. But I'm not strong enough on my vector math to figure out what needs to be done to make this work.

Anyone tried something like this before, or know what to do? Of course, it will only work on curve objects.

The solution is to calculate the crossproduct of the incoming and curve direction vectors. The absolute of the dotproduct of that and the normal is the facing which you can connect up to your color ramp.


How do I rotate an object that already has keyframes? I appended an object to my scene that already has the animation I want it to have, and I want to rotate it so that it's facing another direction. The problem is that after I rotate it when I go to test out the animation it snaps back into its original position. I was also hoping to scale it. Thanks in advance.

You can do so in Edit Mode. Anything you do in edit mode, rotation, scale remains like that in object mode.


Converting the Sponza Palace ceiling into square-like faces I wish to convert into "square-like" quads the ceiling of the Sponza Palace mesh (from the original by Marko Dabrovic, converted to OBJ and available at the McGuire repository).

The mesh of the ceiling is mostly quads already (in theory it should be all-quads, but I guess there was some topology problem when converting to OBJ, and this created a non-manifold mesh with some triangles at the base of the arches). The file available at the above link already has these problems, I didn't find a version without these problems, supposing there was one.

I'm no expert at Blender mesh editing. I tried to subdivide the faces, but the resulting quads, although smaller, kept the original aspect ratio. I wish to subdivide the longer edges only, so that the subdivided rectangles tend to convert into square-shaped.

So my next try was to use the "select larger" tool after selecting an edge that I wished to subdivide. It helped, but undesired faces appeared in some edges, and I couldn't progress more than one subdivision.

Do you think of some procedure I could follow? I don't really need perfect squares, I just wish quads with the longest side not longer than twice or thrice the shortest side, for example.

Also, I don't need that all quads have the same size. So, it would suffice if I could just subdivide the horizontal edges four times, for example. This would create some too large quads, and some too small ones, but it would suffice for my purposes.

If it helps, here's an image of the Sponza ceiling. Yes, what you see are quads (with some triangles at the bases -see the ugly diagonals at the bottom of some arches-, as said above):

I would just go edit mode and do some manual cuts... it is enough to fix just a quarter of the mesh, then use a mirror modifier with X and Y axis enabled to recreate the ceiling.

You have a couple of options to do the cuts:
1. K key is the knife tool, it got some useful extra keys, E to make multiple cuts, C to constraint, Ctrl to snap to to midpoint, SpaceBar to apply... do it from top view
2. J key is vertex connect path, just select endpoints of the arc and press J

first option will result in more perfect squares and second one in a more organic distribution
for the tris I suggest to rotate the edges (Ctrl E > Rotate CW) and repeat with Shift R but you could just use Dissolve Edges

here's a blend with both of this techniques: https://www.dropbox.com/s/v7t730b506t8y30/ceiling.blend?dl=1


How to pull all vertices from a specific Vertex I want to create an old tv screen look. The only way I know how to describe it is a very round screen that protrudes outwards. I haven't touched blender in awhile and I know you can have one vertex apply to all when pulling outwards. Otherwise it only affects a couple faces around it. (Sorry for the bad explanation)

Instead of this on the picture I want to pull the vertex and have it apply to the rest of the plane.

Edit Mode Proportional Editing (keyboard shortcut O). works well.


Can i redraw the UI inside an operator? I have a script which is working. At the end of the script, rendering is started. This is supposed to work as a template for people possibly unfamiliar with a freezing screen (blender is loading lots of data into cache from images used in the compositor).
For that reason i want an "Info" in the top bar saying something like "This might take a while. Now rendering...".
So i would have this in my operator

draw message
redraw UI (to show message)
Run the rest of the script

Is this possible?

use report() in your operator to display reports on the top bar

self.report({'INFO'},"This ma take some time")
# rest of the code here


Help with modelling a sword hilt I'm having some trouble modeling the bottom part og a sword, which you can see in the pictures below. I was wondering if anyone could give me some pointers on how to model something like that, because I'm a little lost ~

There are many way to model depending on experience, style and end use. Here’s one approach:

Delete the default cube.
Add a plane > Press SHIFT + “A” and select “Plane” from the drop down menu.
Go into Top View > Press “7”.
With the plane selected go into “Edit Mode” > Press “TAB”.
Subdivide once > Press “W” and select Subdivide from the drop down menu.
Select five vertices and delete them > Press “X” and select Vertices from the drop down menu.

Add two Loop Cuts > Press CTRL + “R” > Left click and drag to where you want it then Left click again to set in place.
Select three vertices and extrude . Press “E” and drag holding CTRL to snap them to the grid. Left click to set in place.

Add a Mirror Modifier (This can be done any time after step six). Check off boxes “Y” and “Clipping” in the Mirror Modifier panel.

Select all of the vertices. > Go into Front View by pressing “1”. > Press “E” to extrude. > drag downward.

Press “S” to scale outward.

Press “E” to extrude downward.

Add a Subsurf Modifier and set Shading to Smooth to finish it off.


Composite not working in blender i do render of my scene in 2 different render layers but i am unable to composite in a single image please help me. thanks

Set your main layer(s) as a mask layer.

This makes it so that when something covers up the layer in space, it becomes transparent in the renderlayer.


Make particles go to the target object and stick to it Is there any way to make particles move from one object(emitter) to another object and stick to it?

You can use keyed particle system to do that. This is often used to morph an object shape (as particles) to another object shape.

The principle is to set up a particle system (PS) on a first object, then define a second one using the same PS (and eventually a third one, etc.).

For these PS you may set there physics to "No" (as if not, they will fall or move or other).

Now create another object, with a PS (a new one) and having the same amount of particles.

Go to the key section below. And set the (keyed steps you want for it). These steps are based on the previous PS, as they are defined.

The key objects PS definition :

1- Start and end set to 1 (we want them all now)

2- Lifetime depending on what you want

3- Set to faces or volume (you choose)

4- No physics (if physics, that will work too, but theses PS will move)

You can use the same PS for the 3 (or 2 if you want 2) transition objects where particles are transiting above.

The keyed PS

1- Define start, end and lifetime as you need

2- Set physics to 'Key'

3- Add 3 (or 2...) steps in the key using the '+' button

4- For each step assign the wanted key object

You can tune the time (check 'use timing') so that the PS leaves or stays (stuck) more or less a long time from an object to another :


Z buffer read from exr file is all ones I render RGB images and their depth maps as well for a series of frames (using cycles).  Specifically, I need not a B/W depth png/jpg image, rather the actual depth values itself, which I can later read off in python.  I found the exr to be the oft suggested format in online forums, as I want to store float values as such.
So, I stored the rgb image as well as the z buffer together in a .exr file.  In python, while I could reassemble the rgb image perfectly, I discovered the Z channel info to be a matrix of ones.  It should actually contain the float depth values.
What could be going wrong here? I have checked the 'zbuf' option in output properties.
For reference, this is the code I use to separate rgb and z values from the exr file:
import sys
import numpy as np
import OpenEXR as exr
import Imath

def readEXR(filename):
    """Read color + depth data from EXR image file.

    Parameters
    ----------
    filename : str
        File path.

    Returns
    -------
    img : RGB or RGBA image in float32 format. Each color channel
          lies within the interval [0, 1].
          Color conversion from linear RGB to standard RGB is performed
          internally. See https://en.wikipedia.org/wiki/SRGB#The_forward_transformation_(CIE_XYZ_to_sRGB)
          for more information.

    Z : Depth buffer in float32 format or None if the EXR file has no Z channel.
    """
    print(filename)
    filename = str(filename)
    exrfile = exr.InputFile(filename)
    header = exrfile.header()

    dw = header['dataWindow']
    isize = (dw.max.y - dw.min.y + 1, dw.max.x - dw.min.x + 1)

    channelData = dict()

    # convert all channels in the image to numpy arrays
    for c in header['channels']:
        C = exrfile.channel(c, Imath.PixelType(Imath.PixelType.FLOAT))
        C = np.fromstring(C, dtype=np.float32)
        C = np.reshape(C, isize)

        channelData[c] = C

    colorChannels = ['R', 'G', 'B', 'A'] if 'A' in header['channels'] else ['R', 'G', 'B']
    img = np.concatenate([channelData[c][...,np.newaxis] for c in colorChannels], axis=2)

    # linear to standard RGB
    img[..., :3] = np.where(img[..., :3] <= 0.0031308,
                            12.92 * img[..., :3],
                            1.055 * np.power(img[..., :3], 1 / 2.4) - 0.055)

    # sanitize image to be in range [0, 1]
    img = np.where(img < 0.0, 0.0, np.where(img > 1.0, 1, img))

    Z = None if 'Z' not in header['channels'] else channelData['Z']

    return img, Z

def main(fpth):
    img, depth = readEXR(fpth[-1])
    print(np.max(depth))
    print(np.min(depth))

    return

if __name__ == '__main__':

    main(sys.argv[1:])

You just need to disable the compositor in Output Properties > Post Processing > Pipeline > Compositing. Basically if compositing is enabled only the Image pass gets forwarded to the composite node (even if Nodes weren't enabled) and the Depth defaults to Z=1.000

If you do need to use the compositor, make sure you also link Depth to the composite node to get an exr file with a correct Z channel:


"bpy.context.scene.object_bases" not working in 2.80? The 2.8 documentation for the context override is found here:
https://docs.blender.org/api/blender2.8/bpy.ops.html?highlight=object_bases

override['selected_bases'] = list(bpy.context.scene.object_bases)

is even listed there, but throwing

bpy.context.scene.object_bases

into the python console throws:

  Traceback (most recent call last):
   File "", line 1, in
  AttributeError: 'Scene' object has no attribute 'object_bases'

I want to merge objects as described by CodemanX here:
How to join objects with Python?
It worked in 2.79, doesnt in 2.80 and throws:

  AttributeError: 'Scene' object has no attribute 'object_bases'

My code snippet:

    proxyname = "ProxyName"
    # create empty new object
    proxymesh = bpy.data.objects.new(proxyname, bpy.data.meshes.new(proxyname))
    bpy.context.collection.objects.link(proxymesh)
    proxymesh.matrix_world = bpy.context.active_object.matrix_world
    # make new, flattened object from all meshes in selection
    duplicants = []
    duplicants.append(proxymesh)
    for obj in bpy.context.selected_objects:
        if obj.type == "MESH":
            duplicant = bpy.data.objects.new("duplicant", obj.to_mesh(bpy.context.depsgraph, True, calc_undeformed=False))
            bpy.context.collection.objects.link(duplicant)
            duplicant.matrix_world = obj.matrix_world
            duplicants.append(duplicant)
    # attach flattened objects to empty object
    ctx = bpy.context.copy()
    ctx['active_object'] = proxymesh
    ctx['selected_objects'] = duplicants
    ctx['selected_editable_bases'] = [bpy.context.scene.object_bases[duplicant.name] for duplicant in duplicants]

So basically, I would like to know how to be able to iterate through the scene's object bases in 2.80?

Appears no need for bases in 2.8  join operator override.

Testing this in python console. Have duped the default cube 3 times, the last dupe "Cube.003" is active and only object selected.

>>> C.object
bpy.data.objects['Cube.003']

>>> C.selected_objects
[bpy.data.objects['Cube.003']]

A list of all the mesh objects in scene to join

>>> obs = [o for o in C.scene.objects if o.type == 'MESH']
>>> obs
[bpy.data.objects['Cube'], bpy.data.objects['Cube.001'], bpy.data.objects['Cube.002'], bpy.data.objects['Cube.003']]

Make a context override dictionary, with only object, active_object, selected_objects, selected_editable_objects as members (possibly don't require "object")

>>> c = {}

>>> c["object"] = c["active_object"] = C.object
>>> c["selected_objects"] = c["selected_editable_objects"] = obs

Run the operator with this override

>>> bpy.ops.object.join(c)
{'FINISHED'}

Resulting scene after running.  All four cubes are joined as one "Cube.003"

>>> C.scene.objects[:]
[bpy.data.objects['Lamp'], bpy.data.objects['Camera'], bpy.data.objects['Cube.003']]

Risky look at obs since three of the objects no longer exist.

>>> obs
[<bpy_struct, Object invalid>, <bpy_struct, Object invalid>, <bpy_struct, Object invalid>, bpy.data.objects['Cube.003']]

Related

poll() failed, context incorrect? - Example: bpy.ops.view3d.background_image_add()

Scripting -- Can't figure out how to use correct contexts?

Reliable way to find out the required context for an operator?

How to find an operator's source code?


Check if object is being drawn in the scene We can have multiple objects in a 3D Blender model.
If we rotate the model, then it can be possible that certain object might
not be visible at all from the user view as it is behind other objects.

How to check in Blender python whether an object is being rendered on scene at all or not?

It's hard to know if this can be a solution for you or not, but here's what I would try:

Use either Object Index or Material Index to create a pass that will be like a mask of the object's outline.

So for example, in Cycles if you create a material with a Pass Index of 1 (as is on this cube)...

Then you could set up your nodes to get a mask from that like so:

Note that since the monkey object in front of the cube does not have a Material Index of 1, it occludes the cube.

You can set this up using the File Output node so that this gets output separately from the main render as its own file:

Then you can use an external script (in Python perhaps) to batch scan your frames and return TRUE when white pixels are found, or FALSE when the frame is all black.

This is a very specific use case, so expect to have to do custom scripting.


Scale/Dimension change when I add a curve modifier First, I have created both a plane and a curve object, then I adjusted their dimensions as desired. Noticing that the scales of both changed with the dimensions, I press CtrlA after the re-dimensioning of each of the objects, with that object being selected alone.

Till here, everything is fine, both objects have now the desired dimensions with a scale of one.

The issue is: When I add a curve modifier to the plane and choose the curve previously created in that modifier, the plane dimensions change for some reason! :s

Any idea why?!

EDIT:

Link to an example blend file:

Go to the modifier tab of the plane object and select the curve called Circle to see how the dimensions of the plane change!

Solution Found!! :D

Modifying the dimensions of the objects in EDIT mode solves the issue. It seems that my previous method of modifying dimensions in OBJECT mode does not actually modify the dimensions but applies a transform to the objects. And when the plane gets associated to the curve via the modifier, it seems that the transform of the curve gets also applied to the plane, which results in the weird change in dimensions I was observing.

Anyway, problem solved... Thanks to all those who tried to help!


Mesh is having trouble following bones correctly My Character has been plagued by several strange problems with its parenting to its bones.

First of all, his eyes are not moving with his head correctly. Every other solution I've looked up said it had something to do with the eyes not being weight painted correctly, but I've checked, double checked, triple checked, and heptoplole checked, and the head has them 100% red while no other bone has any red on them.

Also, the armature won't let me rename the bones. Each one reacts differently, but usually the mesh won't move with it fully anymore and it deforms to some degree. The head is the worst.

My blend file can be found here: http://pasteall.org/blend/index.php?id=43706
Thanks for any help!

Your "pirate" head looks better in my blender:

but the head, at least, moves wrongly because you are not seeing bones axis rotation, in stick mode: try octahedron mode:

but I also inspected weight influences, and some bones have slight influence on the head, too, so do a complete check again, maybe.

I always reccomend to get help from custom weight paint color to help visualize difficult wrong spots...

see this other old (my) answer about it: When IK bone moved wrong part of mesh deforms


fSpy importing camera into an existing scene It seems relatively easy to use fSpy’s camera to build a scene from a reference.
However, i am struggling to use it to add a camera to an existing scene.
For example, when the camera is imported, what are the criteria for where it is placed? In reference to what in the existing scene?
For context, a client sent me a photo of their largish product, which they wanted to be placed into a laboratory scene. (I cannot share screenshots bc this is an in progress, proprietary project)
I used fSpy to figure out their camera position, height, lens etc on the product.
On importing that camera into my scene, I found myself struggling to put the camera where it needed to be in the room, without messing up the height and angle along the way.
Any ideas or helpful hints?

"It seems relatively easy" indeed, but it helps if you take some time to explore the real power of f-spy.
The first piece of information you need is the lens focal length and camera sensor size used to make the original image. Without it is going to be hard to get accurate placement.
Unfortunately f-spy wrongly labels "focal length" settings for Sensor Size
You might need to refer to a Lens to Field of View calculator (there are many on the internet) to get the field of view for your lens in degrees (not in mm)
The second part of the puzzle is working with real measurements, fSpy will not guess them for you.

Then, manually move the 3 axis tool in f-spy to set the origin and alignment of the scene: the white dot will determine the placement for the "floor" on the blender scene.
Without any real measurements there all you will get from spy is the  field of view on an arbitrary scene with arbitrary scale and relative distances, making it harder for you to approximate existing elements in blender.


Rotating Array Modifier applied to a rotated object issue So initially I've learned using the Array modifier from this video but actually it is decribed in short in this Q&A. When I used it to create a spiral ladder, I got a problem, though: when I used an empty for object offset, the copy ladder step was scaled by more than 10 along Z and by 2 along X which I fixed by scaling the empty.

Now I'm trying to use the Array modifier to create a cylinder with a code of thinner cylinders emerging from it. Here's what I have before applying the modifier:

Note that:

the thin cylinder's facets were moved so that its origin is on its bottom
it was then rotated around the X axis
then it was moved along Y and its origin was moved back to the (0,0,0)
now cursor is also at (0,0,0) and I created an empty also there, at (0,0,0)

So what I'm expecting is when I set an Array modifier with the Object offset of the Empty (the Arrows one), the copies are on the same place as the original cylinder and then I rotate the Empty and get my nice cone. However, even without any rotations, just when I set Object offset to the Empty, I get this:

Man, I'm definitely missing something. I've seen this question but the origin of my thin cylinder is in the same place as the Empty. Any ideas?

Here's my .blend file:

PS and here's an idea of what I'm trying to get (I've made this one by simple creating duplicates and rotating them around Z, but I'd like to have multiple of them placed in a regular manner):

Select the smaller cylinder and apply the rotation and scale.

This can also be done by pressing CtrlA followed by O.

The result should be like this.

Then select the empty and rotate it around the Z axis.

N.B. You could also rotate the small cylinder itself around the Z axis, but I prefer doing all transforms on the empty when using one to guide an array.
And the reason why this happens, is that for every duplicate the Array modifier makes, it takes into account the transforms of both the duplicated object and of the empty. I have not read the source code, nor have I found specific information on how it calculates the transforms, but from what it looks like to me, it divides the scale of the empty by the scale of the object.
An example: The object has scale set to 0.333 and the empty has scale set to 2. The overall scale for each repetion would be 2/0.333 = 6, so each duplicate would be 6 times bigger than the previous one.
With rotation and position, it looks like it's just subtracting the position and rotation respectively of the empty from the position and the rotation respectively of the object.


How to calculate "blend" based on "spot size" and inner cone angle? For a spot lamp I have two angles -- angle of the outer cone (spot size) and angle of the inner cone that inidicates the boundary line at which light from the spot will start to blur. Based on these two angles how can I calculate "blend" of the spot?

Blender reference manual says that "blend" value can be between 0.0 and 1.0 and that:

  The falloff rate of the Spot lamp light is a ratio between the Blend and Size values; the larger the circular gap between the two, the more gradual the light fades between Blend and Size.

But I can't figure out the exact formula to calculate blend based on those two angles.

From the Blender Wiki:

  The value is proportional and represents that amount of space that the
  inner cone should occupy inside the outer cone (SpotSi).

This is quite confusing, because the value is calculated by subtracting the area of the smaller circle from the area of the larger one instead.

R = bigest Radius
r = smallest Radius

blend = π(R*R - r*r) / π(R*R)

It should be:

blend = (R*R - r*r) / (R*R)

blend = 1 -> r = 0
blend = 0 -> r = R

BUT the result is not exactly what I expected.

In this example, the smaller black circle is half as large as the radius of the larger circle.

The orange lines are the cones of the spotlight obtained from the formula:

blend = (R*R - r*r) / (R*R) = 0.75

This is the manual setting (blend 0.71):


Blender Crashes When Being Started I used Blender for a while then I stopped using it a few months back and yesterday when I tried running it, it crashed and gave me this error:

AL lib: (EE) UpdateDeviceParams: Failed to set 44100hz, got 48000hz instead
Error: EXCEPTION_ACCESS_VIOLATION

These is what I tried:
-Uninstalling then installing the newest version
-Uninstalling again then installing an older version
-Deleted every registry file and folder related to Blender
-Reinstalled 50 times
-Restarted my PC 10 times
-Installed Python 10 times (before and after Blender)

Non of this works and there I can't find the explanation why, I searched online but can't find the same case happening to someone else.

EDIT: All drivers are up-to-date!

I finally figured it out, just downloaded a file called "opengl32.dll" and put it in the Blender directory


Boolean difference removes wrong part I have a cube that is scaled about 10 times on the Z axis.
I added a plane, rotated it 45 degrees on the Y axis, and placed it just below the top of the cube. I applied a boolean difference modifier to the cube, and it cut off the bottom. How can I invert the boolean operation to cut off the top of the cube instead? The plane should be deleted after the cutting.

The Boolean modifier calculations depends on the face normals to decide what's inside and outside ; for a simple plane case the face normal is the local z_axis so it's enough to flip the plane 180°

for other case :

enter edit mode hit Ctrl+N
check inside option on the tools panel


What to do when my animation stops after 50 seconds, whereas my animation player is in active? I had an idea to make fire effects on a cube. So I created a cube; clicked F3 and activated quick smoke effect.
Then my cube started smoking.
But unfortunately it sopped after 50 seconds.
But I noticed that my animation player is in active mode.
After,when the animation player replayed the smoke effect ran only for 50 seconds and stopped again.
I also tried for quick liquid, but the result was the same.

Check under physic settings > fluid > cache, the Frame End properties.
250 frames / 25 fps = 10 seconds of animation (50 seconds seems a little out of default blender settings).


Why is the base of the object fading in and out during rendering? When I render an animation of my object (from motion tracking data) I am seeing the base fade in and out as shown in the two images below.

Does anyone know why this is happening? Here is the .blend file if that helps.

The 'fading' is actually just blurring from the vector blur node in the compositor.

If you wish to remove this effect, you can either just disable the Vector Blur node by pressing M while the node is selected in the compositor to 'Mute' the node or you could press Ctrl+X to essentially 'Cut' the node out. In future, you can use the technique of muting nodes one by one to diagnose issues with node setups.

If you remove the Vector Blur node you may be able to remove more nodes, such as the Alpha Over node the Vector Blur connects to and even the 'Foreground' render layer (as it may be the only purpose of this render layer is for the Vector Blur).


How do I move an item on its axis when its rotated? I'm not totally sure how to word this so I'll do my best.
Im trying to animate a gun, and when I want the stock to move while the character is shooting the gun, I wanna move the stock.
Basically, I wanna move the stock with the rotation instead of it just going on the regular axis.
I'm not good at explaining this, if I used the words in the wrong way then I'm sorry.

Basically, what I'm trying to explain is when I rotate something and then move it, its on the normal grid axis instead of what its facing when its rotated.

The green line from this brick isn't facing the same way as the brick.

I think what you're trying to describe is moving along the local axis. Assuming you haven't applied the rotation of the model, you should be able to press g to move the model and then the axis you want to move on TWICE. When you press the axis key twice it goes in that local axis rather than in the world view.
I can go ahead and include some images if you need! Let me know if this helps you out.


Casting shadows on baked objects I have a scene with objects and lighting, and all the objects have textures/shadows/etc... baked via cycles. For example, the ground plane texture:

Now I can set all the objects with their baked textures as shadeless and they look fine.

But I can't get the player object to cast shadows (using the same spot light).

I understand shadeless essentially turns off shadows, but I need some way to turn off all shadows except shadows emitted by the player object. Is there a way to do that? I am trying to achieve real time shadows from a player in a baked environment. Seems like it should be possible?

I've tried a ton of the checkboxes and sliders in the materials panel (like Shadows Only and Alpha Blend) but to no avail.

objects that needs to receive shadows (ground or other objects) can't be shadeless. They need a material with shadow/receive (and/or receive transparent) box checked.
Objects with baked shadows (monkey and icosphere) can have their cast, cast only, cast buffer shadows and cast approximative boxes unchecked. They won't cast shadows on the player (or anything) but it's not a real problem i guess.


Adding details to low poly model for 3d printing I am trying to add details to a model in order to 3d print it. The model itself is a WoW character, but the problem is the low poly count and the lack of details for the armor.
Please, keep in mind that I have very little experience using blender and modeling.

Asking in other forums, people suggested retopology, but I only found tutorials of using retopology to reduce details of models, not the other way around.

Hi,
if you need more details, you will have to add more vertices. You can reach it by several ways.

Globally via mesh modifiers(you can find it in context menu, which is defaultly on right side): Subdivision(Don't forget to use "Simple" option) or Multiresolution.

For specific parts: Edit mode -> Select vertices/lines/faces -> Right click -> Subdivide - You can also change some parameters(smoothness, number of cuts, ...)

There's also dyntopo - it's tool for sculpting, but it can cause unwanted results for 3d printing.

Don't forget some too detailed parts would be better to separate to more prints.

I hope this is that what you needed to know.


Using the solidify modifier with no deformed geometry I made a scaffolding out of planes. I'm trying to solidify it but it appears deformed. Here are my settings...

10/10

How should I approach fixing this issue?

You have got trifold edges, that is edges that belong to three faces.

Not only is that a bad modelling practice, that creates non manifold meshes, that could never really exist in real life.

That causes severe modelling and topology issues and will lead to trouble sooner or later, least of which are the ones you are encountering with the Solidify modifier.

Eliminate the trifold edges, either by erasing the faces and recreating them by duplicating an edge; or using the Rip operator and separating the duplicate edges.

Also make sure your Solidify has the Even Thickness option ticked

Alternatively consider using bezier curve objects for this sort of work, they seem like a more adequate tool for this sort of structure.


How do I make a hole and resize it later? When designing physical objects (mostly for 3D-printing), it is a usual scenario that I create an object with a hole and try it and then resize the hole if it doesn't fit.

I use boolean modifier for hole making, but it is very inconvenient to resize holes made this way since I have to undo the boolean modifier and removing of the cutter mesh (usually a cube or a cylinder), resize it and make the hole again. At times I just don't want to keep hole cutting as the latest action.

What can you suggest a better approach so that I can easily apply trial-and-error method for doing holes (or, in other words, resize them)?

Edit: For example, in the following file there's a piece with 3 holes, the big one is supposed to get an aluminum tube of 8 mm diameter inside it so I've made a 8.1 mm hole (ok, 8.1 cm in the default scale) but it may happen that it's not large enough and I will need, say, a 8.2 mm hole. I kept the hole-cutting cylinder and the painful part is: I applied the boolean (difference) modifier thrice (to the big cylinder and to 2 smaller parts) so changing the hole diameter will be long and annoying. Increasing the diameter is easier: actually, I don't have to undo hole cutting, but to reduce hole diameter, it is required.

Constraint Axis Scale

If your holes shapes are made by subtraction of extruded profiles along a single axis, you may consider the option to simply scale the faces in the 2D space of the plane perpendicular to that axis.

This can be done by pressing Shift just after the Scale shortcut (S) and before picking the normal axis (Z in the shown example), or by using the operator panel options.

If you need to use a different orientation than Global (e.g., local, custom, etc.), you'll have to press the keyboard combination (S -> Shift+Z) twice.

The animation above has Edge Length checkbox enabled in order to make the diameter length visible during the transformation.


Different seeds on different render layers Under the Render Properties tab there is a setting to change the seed used for ray tracing.  Is there a way to use different seeds on different render layers?

I know this is possible using multiple scenes instead of render layers and linking objects, but that is pretty cumbersome.

You can make a full copy of the scene into another and select other seed in it. You are gonna need a new scene for every diferent seed. Them, in compositing you can select scenes and layers in the render nodes.


Bones affecting the mirrored mesh I'm following a tutorial on how to make an avatar (I'm hoping to use it in vrchat). The mesh avatar is mirrored, and I named the bones with left/right so it should affect them correctly, but in pose mode when I move one arm, the mesh gets moved on the other side as well when I move the right, but when I move the left, nothing happens with the mesh. I am new to blender so detailed answers are appreciated.

I figured out the problem! When I duplicated the first side to the other and renamed it to flip them, it did not get rid of the ".001" from dupli automatically, and that's what was making the other side go wacky. I'm annoyed how easy of a fix it was.


Error while exporting a mesh from Blender Spark AR Toolkit V1.1.0 Recently Facebook released the Spark AR Toolkit for Blender. Using this add-on you can easily optimize and export Blender models for use in Facebook's Spark AR (used for creating Instagram filters). When using the Toolkit (V1.1.0) I get the following error message while pressing the "Export Mesh" button:
Python: Traceback (most recent call last):
  File "/Users/kaiyawilson-smith/Library/Application Support/Blender/2.91/scripts/addons/Spark AR Toolkit/spark_operators_export.py", line 44, in execute
    self._export_mesh()
  File "/Users/kaiyawilson-smith/Library/Application Support/Blender/2.91/scripts/addons/Spark AR Toolkit/spark_operators_export.py", line 80, in _export_mesh
    export_force_sampling=False
  File "/Applications/Blender.app/Contents/Resources/2.91/scripts/modules/bpy/ops.py", line 132, in __call__
    ret = _op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties:  expected a string enum, not bool

location: <unknown location>:-1

Does anybody know how to fix this?

I also encountered this bug using the Blender 2.91. After some spelunking the the Toolkit's code and the Blender Python API I found a solution. Apparently something changed in the Blender export scene glTF API. When the Toolkit tries to export to glTF it passes the boolean value TRUE to the export_materials argument of the export function. However, it seems the export_materials argument no longer accepts a boolean value, but instead requires an enum value type. I tested it with the EXPORT enum value and that seemed to work fine.
I've already reported this to the Facebook Spark AR team and I expect an updated version of the Toolkit to be released in the near future. But if you really want to fix this now, you can do so by editing a Toolkit source file.
First close all running instances of Blender. Then locate the file spark_operators_export.py. It's location is mentioned in the error message that Blender displays. In your case it's /Users/kaiyawilson-smith/Library/Application Support/Blender/2.91/scripts/addons/Spark AR Toolkit/spark_operators_export.py. Edit that file using a plain text editor like Notepad.
Change line 66 from
export_materials=True,
to
export_materials='EXPORT',
Restart Blender and exporting your mesh should work again.


Node.js spawn for command-line? I need blender command-line access though spawn but keep running into an ENOENT error and it is hard to pinpoint what is missing.  The command-line being passed in the sample application works in terminal.
Below are some details about the environment and the sample script I am using.

Environment (OSX El Capitan)

Installed Blender 2.76b with:
brew install Caskroom/cask/blender

Then add alias to bash_profile for terminal access:
alias blender="/Applications/blender/Blender.app/Contents/MacOS/blender"

Test Code
#!/usr/bin/env node
var child_process = require('child_process');
var arguments = [
        '-b',
        'recipe.blend',
        '-o', 'test-#',
        '-f', 0
];
console.log("values: ", arguments);
var child = child_process.spawn('blender', arguments);

child.stdout.on('data', function(data) {
    console.log('data out: ', data.toString());
});
child.stderr.on('data', function(data) {
    console.error('error out: ',data);
});
child.on('close', function(code) {
    console.log('closing code: ' + code);
});

// Raw command-line for terminal. (PASS)
// blender -b recipe.blend -o test-# -f 0

Try changing the child_process.spawn('blender', arguments); line to child_process.spawn('/Applications/blender/Blender.app/Contents/MacOS/blender', arguments);.  NodeJS won't be using your bash aliases, so unless the blender executable is in its PATH it won't be able to find the executable and will throw an ENOENT.

The other option is adjusting Node's PATH to include the path to the blender executable.  You could also pass the fullpath to the blender executable in as an environment variable.

Cheers!


How do I get the context menu in the node editor/3d editor (and more) if I preffer to use Right Click Selection? I know that people with left click selection bring up that menu with right click, however, with right click selection I simply can't find a way to bring up the context menu, and I don't want to change to left click selection.

The default key for the context menu is "w". I use it since I also use right-click select.


Rigid bodies passing through [Blender 2.73a]
I have a scene, where a helmet is falling on a surface.

It is quite complex: high-poly helmet, every link in chainmail is a separate element and all this stuff are rigid bodies. I want them to act physically correct, that is why so. All modifiers and transformations are applied: objects are clean meshes. I've already done simulation tests with this model earlier (https://www.youtube.com/watch?v=gszj0GUkigI), now I've updated the model and try to make a new simulation, but it fails:

Surface (was a passive body plane first, now an active non-dynamic cube — doesn't matter) first collides, but then chains and helmet pass through it.
I've tried everything — no idea how to fix this.

Here are screenshots of settings:

Helmet:

Chainmail:

Surface:

Scene:

(all objects are real-size, high values of steps and iterations always well helped increase accuracy)

Any ideas, why is this?

UPD

Subdivided surface, increased steps to 1600 and solver iterations to 120. No luck

Well, with some tries I've come to understanding, that problem is not in the surface, but in chains. In Blender's physics engine mass is corresponding to durability (sic!). So, realsize chains with a calculated mass near 1g each is too weak and they "break" during collisions. The only working workaround was to scale everything up several times and increase the mass of everything...


How can I find a mesh's position when affected by a constraint? So basically, I have a mesh that is moving via a constraint. However, because it is a constraint movement, I can't find the position of the mesh. So, is there any way I can find the current position of a mesh, even when affected by a constraint? (I mean like in numerical form)

Presuming you can see the model in object mode, Select it and press SH-S, choose "Cursor to selected".  The 3D cursor will jump to the model's origin point.  Press N and you can read off the 3D cursor's location.

If you want to store this within the Blender file, ADD an Empty.  It will appear at that location and it's own location readings at right will be the same as the 3D cursor's.

You haven't stated what constraint(s) you're inquiring about so I've just tested this out both with a path constraint and parenting the object object to another.  Both work as described.


Viewport Animation Paths Modo has gotten the ability to edit the motion path directly from the viewport. Cinema 4D and Maya has this as well.

Is there anything like that in Blender? What would it take to build it?

There is an add-on for that called Motion Trail that allows you to edit the curves in 3D space. You can enable in the User Preferences under the Add-on tab.


edit mode show a bunch of weird vertices after loading I was working on my mesh earlier today and after loading it tonight, I can't work on it anymore. While Object Mode show my mesh as I saved it, Edit Mode does really weird things that I can't even describe, so here are the screenshots:

I probably did something accidentally, but I have no idea what I did.

You have a Shapekey selected, so when you try to edit, you are editing that key. The key itself has most likely been messed up due to changes in model topology or vertex ordering.

If you select the Shapekey called basis, then you will be able to edit the underlying shape.


How to hide vertex colors in Texture Paint? I am currently trying to paint a texture onto a character model.  However, I cannot actually see what I am doing because one of the vertex color layers is being overlaid on top of the texture, causing it to appear solid black in most areas.

Are there any way I can stop this from happening?

Add a Vertex Color layer that is solid white and keep that one activated when you are not doing any Vertex Painting.

It does waste a layer and definitely counts as a work-around but it's the only way I know of to do this and it works.


Why is my rendered animation different to what I see in the 3D view? I’m fairly new to Blender, although I’ve managed to put together some simple animations.

I’ve made a simple ‘fruit machine’ with three wheels. Everything plays as expected in the 3D view, but when I render (whether to a sequence of .png images, or to a video) I’m getting a different result. The animation lasts for 600 frames. Everything starts off fine, but at frame 450 (for example) the rendered image is different (in the way that the second wheel is rotated) from what I see in the 3d view when I scrub the timeline.

In the 3d view, I have ‘render only’ set in the display menu.

Is there something obvious I should be checking? I can post the .blend, if someone would take a look.

(Cycles, in v2.77)

You have two UVMaps on the object where the fruits are mapped to. See this screenshot:

At the moment in the UV Maps section, UVMap_wheel02 is selected, and gets displayed in the viewport. But the other map, UVMap_wheel01, is set to be the renderable one (the camera icon behind the map indicates that). That means, if you don't manually override the UV map to be used, Cycles will pick the one which is marked as renderable, so the first one in your case. If you select the first UVMap in the editor, you see this in the viewport:

If you want to use more than one UVMap in Cycles, you can use the dedicated UVMap node to grab a map by name:

Or alternatively you can mark the UVMap_wheel02 as renderable by clicking on its camera icon in the UV Maps section.


Scroll feature prevents unchecking Deform for many bones at once I'm trying to uncheck Deform for many bones at once. To do this, I was told to use Alt Select. However, when I do that, the cursor becomes a scroll icon and won't affect the checkbox:

This happens in other panels, too:

How can I disable this scroll feature? Is there another way to disable Deform for all my selected bones?

You can press Alt+W to get the 'Disable Bone Options' menu and disable Deform for all the selected bones.


I want to sort the object numbers in order I deleted a few objects while working, and the order of the objects was messed up. So I want to arrange the names of all the objects in order. How do I do this?
In this photo, I want to arrange numbers 2729 and then 1877 in order.

The script below will rename all objects in the scene, so:

First having a base name before '.' is named from this base name (example "Cube")
Next with the base name + their rank after the first one (example "Cube.rank")

Comments below for key points:
import bpy

objects = bpy.context.scene.collection.all_objects

prev_base = ""
index = 0
sep = "."

for name in sorted(o.name for o in objects):
    #Get the base name
    splitted = name.rsplit(sep, 1)
    base = splitted[0]
    #If the base name has changed
    if base != prev_base:
        #Keep a new base
        prev_base = base
        #Rename the object
        objects[name].name = base
        #Restart to 0
        index = 0
    else:
        #Next index
        index += 1
        #Assign formatted name
        objects[name].name = base + "." + str(index).zfill(3)


How to rotate a 2d plan in ver 2.79. no option in propert panel i'm creating a 3d airplane from a 2d plan. i have built the shell overlaying it over 2d plan. Now i need to rotate the plan -90deg to work on the tail and the wing. There is currently no option in the property panel to do this. where am i going wrong? Appreciate any feedback. thanks.

Assuming you have a blueprint which contains sections with both plan and elevation views, you can assign the same image as background to each relevant Blender orthographic view.

For example: Having constructed your shell from the blueprint's elevation section in the Blender's 'Left' view, you can add (Add Image) and assign the same blueprint image to Blender's 'Top' view. You don't have to reload it from file, it will already be in Blender's list of available images. You then offset/ rotate/reflect the blueprint image (in the Blender's background image panel) so that its plan section coincides with the shell you have built, seen from the top.

The versions of the background image are visible only from the exact preset Blender view to which they were assigned.


How to display vertex colors in Viewport Shading Mode So I'm pretty new to blender and I'm trying to make some visualisations for a paper I'm hoping to publish. So far I've got my tractography and cortical matter loaded into Blender and I've managed to give some colour information on the tractography. However, I want to change the colours to the standardised tractography colours which appear by selecting paint vertex and being in the solid view. Does anyone know how I would achieve this? I've attached the vertex view that I want and the current nodes I've implemented and the colours they produce.
Thank you in advance for any help!

Well I have egg on my face. Very simple solution, after deviating away from tutorials and just playing around. Here is the solution. Thanks for the upvote and hopefully this helps someone else:


When I import images as planes it shows a random line at the top So I am making plants for a game and sometimes when I use Import Images as Planes, it has this random line at the top. I've done numerous test to see if my images were the problem, but every time I reimport the file it still has the line. I tried creating a new image, getting rid of other layers, erasing the background numerous times and it still has it. There are some images though that do not have this problem, but it seems to occur most of the time. If anyone could help, that would be more than wonderful.

The top has the random line in it.

The line is not in this image.

Image textures employ interpolation to blend pixels into the neighbouring space so as to smooth the image rather than provide a hard pixelated effect. With the image set to Repeat there is actually a copy of the image just beyond the image borders. In your case the image against the opposite edge is butter right up against the edge and so the interpolation is causing it to 'bleed' across te border - the bottom of your grass image is bleeding into the top.

To resolve this, simply set the image to Clip rather than Repeat.

The option is located under the "Texture" panel:

If you're using Cycles

If you're using Blender render


vertices don't move or extrude properly i have this problem with my model as i was following a character modeling tutorial and suddenly my vertices are stuck on their positions.. and i do not remember what settings i changed(may be its because i once selected all pressed W and smooth), but now whenever i try to move/extrude a vertex it either doesn't move at all or moves only when i drag the mouse far away.. like in the picture. Please help.

Try to disable the Snap option, it might be because your vertices stick to the grid:


Why can you see a seam in my model from far away? I have a mirrored object, which would obviously have a seam in the middle. However I'm sure the way I created the texture, it would be hard to tell.

But when seen from far away, it's extremely visible, how come?

Nathan and me:
You can change the filtering method on your image node to "closest."
However, "Closest filtering is more diagnostic than a good solution." It is better to "use texture images with significant margins."
This is needed since objects use texture space outside of their UV maps when seen from far away explained by http://wiki.polycount.com/wiki/Edge_padding.
Nathan provides the resource en.wikipedia.org/wiki/Texture_filtering


Dope sheet editor. What does the orange line between keyframes mean? I start to use the dope sheet view to see my key frames. But I don't understand why for some I have an orange line and not for others like below. What is the meaning of the orange line between keyframe?

Those orange lines represent a hold: the selected keyframes at each end have the same value, so there is no transformation in between them.
For example:

For unselected keyframes the line connecting equal keyframes will be displayed in gray.


Fast way to move one vertex point to another in the UV/Image Editor? Is there a fast way to move one selected vertex point to another point in the UV/Image Editor?

You can select the target point, ShiftS, Cursor to Selection, select the point to be moved, ShiftS, and Selection to Cursor, but this takes a long time. Is there a faster way?

You can toggle the Snap tool in the UV Editor's header by clicking the magnet icon or using the keyboard shortcut ShiftTab. Then click the popover dropdown beside it and enable the element snapping type of Vertex.

Instead of frequently toggling the Snap tool on and off by clicking the magnet icon, simply hold down Ctrl while manipulating the UVs to temporarily activate snapping. (You still have to make sure you are in Vertex snapping mode.)


Error saying mesh has no vertices when it has vertices With the following code
def weight_from_distance( scene ):
    floor = bpy.data.objects['GridGrass']
    cam   = bpy.data.objects['Camera']

    vert_distances = [
        ( cam.location - floor.matrix_world @ v.co ).length for v in floor.data.vertices
    ]

    maxDist = max( vert_distances )
    minDist = min( vert_distances )

    for i, d in enumerate( vert_distances ):
        # Normalize distance and set as vertex weight
        floor.data.vertices[i].groups[0].weight = ( d - minDist ) / ( maxDist - minDist ) #Line 16

    pSysName      = 'ParticleSystem'
    vertGroupName = 'GrassGrowth'

    floor.particle_systems[ pSysName ].vertex_group_density = vertGroupName # Update / Refresh

I get an error

Which seems to be saying that my mesh has no vertices, even though it is a huge terrain mesh with thousands of vertices?
Here's my terrain. It may be worth noting that it's a Grid.

A vertex has no vertex group.
Given the error is complaining that a collection does not have a single member (index 0) and the distances list is made from the vertices
floor.data.vertices[i].groups[0].weight = ( d - minDist ) / ( maxDist - minDist ) #Line 16

implies the error is that a vertex is assigned to no vertex group. Test for this.
if not floor.data.vertices[i].groups:
    continue

or ensure in some other way that all the vertices are assigned at least one group.
See second script in this answer re getting all the vertices in a group.  Example below edited somewhat to match above
import bpy
from collections import defaultdict

scene = bpy.context.scene

vgs = defaultdict(list)
ob = scene.objects.get("GridGrass")
assert(ob is not None) # make sure it exists
me = ob.data
for v in me.vertices:
    for g in v.groups:
        vgs[ob.vertex_groups[g.group].name].append(v)

# print all verts in GrassGrowth vg

print(vgs["GrassGrowth"])


Midi in/out for game engine via animation nodes Is there any chance you may add a node for implementing midi signals in a store-ready game engine product made in Blender? :D

Or is this just impossible (and a stupid question)?

Marius

The idea of implementing midi into animation nodes is relatively old:
https://github.com/JacquesLucke/animation_nodes/issues/332

It might be possible that we have a node for that later but then there is also the problem with the game engine. AN doesn't work with the game engine.

So unfortunally I have to say that this is just impossible.


How to tweak the radius scale of Sapling tree Gen add-on in blender v2.79? I'm following a Youtube tutorial on how to create a tree. The person in the tutorial is using Blender v2.75 while I'm using v2.79. He decreased the tree's radius scale to make it look more realistic, but I cannot find the same thing in my toolbar. I played with the custom shape settings but none of them seems to be right. Googled and found nothing helpful for this. Does anyone know where to find it in v2.79? Thank you!

Here's a link to the Youtube tutorial if that's helpful: https://youtu.be/gF6qkByl-_M?t=1037

2.79 has all 2.75 had and more. For this reason, some things got moved around/added and it can be more confusing. Allow me to help, then.
I think what you're looking for is this:


How to split an inset from another inset I want to split the insets so they are both no longer attached to each other but I have no clue how, I am attempting to make character legs.

if you hit "I" twice, it will inset individual faces. It's in the modal description:


Problems with rigid body rope I have created a a rope, using the "path" curve and rigid body simulation, like in this tutorial: https://youtu.be/Lg7jxAMs60Q

But I was faced with two problems:

During simulation, the rope becomes wider at one side and narrow on the other.
The rope slightly passes through the collision object.

As I understand, the second problem appears, because I have not applied the "Bevel object" to the curve. Is there a way to set the distance between the rope and the collision object, without turning curve into a mesh?

I tried that tutorial now, but in the tut it uses softbodies, not rigidbodies! I didn't "apply bevel"  or convert the rope to mesh, and it works well to me. That said:

I dont' get the wider side, during simulation, there must be something that you did differently, perhaps?
If you want to avoid that, you can try to just increase the "outer" softbody collision to the cylinder, I get good results with around 0.05 (default was 0.02 and with that I could "see" the rope inside the cylinder).


Why does "material_index" return zeros? I am new to bpy and I am wondering why the values material_index returns are all zeros.

This is the code I am using:

bpy.ops.object.select_all(action='SELECT')
for obj in bpy.context.selected_objects:
    bpy.context.scene.objects.active = obj
    obj.select = True
    material_ids = set()
    if obj.data is not None and hasattr(obj.data, "polygons"):
        for polygon in obj.data.polygons:
            material_ids.add(polygon.material_index)

material_ids is a set that only contains 0

Thank you for your help!

The number 'zero' is just a zero based enumerator (eg: 0th,1st,2nd...etc) for the material used on your polygon.
I think, that the enumerator order corresponds to it's position in the (Materials?) editor scroll box.
If you want to see '1'. Create a new material, select your object or a face of it and "Assign" (Button) the object to the second Material in the list. Re-run your script.
..oh, also "set" only contains unique values. So if all your polgons use material '0' there will only be one entry.


How can I make duplicates of an object using empties as placeholders? How can I make duplicates of an object using empties as placeholders? For example I have a cube as original. After that I place some empties with a certain position, rotation and scaling and then turn those empties into duplicates of the original cube?

First select the cube and create a group Ctrl + G

Then select all your empties and go to the Properties Panel > Object > Duplication click Group and then choose the newly created group from the dropdown.

If you have selected more than one empty, hit Ctrl + L with all of them selected and click on DupliGroup to have the Group property copied to all of them.


My loop cuts are not going around my whole model The loop cuts aren't going around the model as you can see they stop once it gets to the floor I checked for NGONs by selecting by trait and none where found I'm stumped.

The problem is caused by the face that I've selected in the image below (I'm usin a non-default colour theme, so my selections are blue, not orange).

If that ledge really needs to be there, you should give it some volume, but if you're not going to render any views where it's visible, you may just as well delete it, and the loop cut will work.

As it is now, Blender can't tell which direction the cut should go, so it stops before actually reaching that edge.

To delete the face, select it and press X followed by F. Then the loop cut will work as you expect.
If you really need that ledge, select the face and press Y or click Mesh -> Vertices -> Split to separate it from the rest of the mesh. If so, you should also consider solidifying it, CtrlE followed by S or Mesh -> Faces -> Solidify. To set the thickness, enter it in the tool options at the bottom of the tool shelf on the left side. To show the tool shelf if it's not visible, press T or click View -> Tool Shelf.

Now the loop cut will work. However, the ledge will not be cut, since it's no longer connected to the rest of the mesh. You will need to cut it as well, if you need it to be cut at the same places as the archway.


How to rotate a selected number of vertexes using the end vertex as the pivot point? I been  using blender 2.8 and I can't figure out how to rotate a selected number of vertexes around another vertex at the end of the selection. When I highlight the vertexes and then click on the end vertex, the rotation tool is placed in the correct position, but the vertexes are deselected. How do I keep the vertexes selected while placing the rotation tool?

Change the Pivot Point to Active Element :

The last selected vertex/edge/face (which appears white) is now the pivot point of the transformations.


How to make objects aligned according to a path or bitmap? I have some objects - balls -, I need to make them organized according to a path or a bitmap.Is this possible without using manual object moves?

EDIT:

An example:

I'd like to organize/align my objects (balls) so that they occupy all dark pixels of this bitmap

This can be done with a particle system where density is influenced by the image as a texture :

create a plane and UV-unwrap it.
add a particle system to this plane :

in the texture tab change the influence from time to Density :

the result :


Objects not moving equally? I looked for a relevant topic but couldn't find one.

It's not easy to explain, but my objects don't move at the same 'speed' when dragged/moved.
When dragging an object it doesn't directly follow my cursor, it seems to have some sort of delay varying between objects.

Thanks in advance.

Can't be certain, but looking at the gif you provided I can see that the Z value is actually increasing as you move your cursor, even though the model of the ball is not moving.

Given that fact, I suspect a Constraint or Driver is present somewhere which is translating the Z coordinate into different, limited motion. As what you're moving looks to be an animation rig and they're often built with constraints and drivers in mind that also reinforces that guess from me - but without seeing the rest of the file or further details it remains a guess.

From the values in the gif, one of the balls is at around -4 Z, and the other only at -1 Z, and if they're actually constrained to stay within, say, 0 to 3 Z, this explains why they move differently.  You can't see it, but one of them is already lower 'down' according to its own data.


Symmetrize bones not working as expected I feel like an idiot for not being able to follow this tutorial, but it seems things have changed. https://youtu.be/Q9f-WVs3ghI?t=1013

I dont want to follow the tutorial exactly because the FlipNames has changed, it leaves the .001 extension.

If I select W>symmetrize parent bones stay on the left side, and only the children bones are copied(and parented to the left side).

Here's the file https://tinyurl.com/y99pl9dt

You didn't put a .L at the end of ‘Bone.006’ and ‘Bone.007’ on the hand, and ‘Bone’ on the foot. So when you press W>Symmetrize it doesn’t make a copy of those bones, and the copied children on the right side are still connected to the parents on left side.


Maya to blender,Change view selected component I have been working with maya for a very long time and just started with Blender so navigating is quite difficult for me.
I checked online how to change the preferences and managed to get most of it except  for 1, frame selected component (vertices,edges and faces).
I have changed both the 'view selected' in preference with 'F' as the shortcut but that works only in object mode not in edit mode(thought that same shortcuts would work somehow:P)
Is there anyway to apply both with 'F' so I have frame selected in object mode as well as edit mode?

The Problem is, that there is another Shortcut bound to F in that context, with a higher priority. In Blender there are context-bound shortcuts. You have changed the shortcut for the Object context. However, if you select a mesh and go into edit mode, you are in Mesh context.

In the Preferences, sort the shortcuts by Key-Binding and locate the Mesh section. Then remove or change the shortcut, which is currently bound to F, it will probably be Make Edge/Face. However, you will have to change the other shortcuts which are bound to F for each context individually.


Camera tracking reference scene to match different shots in a common space Is there a way to create a 'reference' scene for use in solving other shots?

So method would be:

Set scene with 8 markers (e.g. orange table tennis balls)
Take master wide shot with slow track (then solve in Blender to create a master/reference project)
Without moving any of the markers, shoot each shot for scene (different angles, different crops possibly not including all markers)
Within Blender relate markers in each shot to markers in master project

My camera records focal length in meta data so I can use this in the solve.

I've done this before 'by eye' on locked off shots, but it's time consuming. I want to do a new project with moving camera and can't help thinking this would be a really simple process for a computer :-)

As far as I know there is no fully automatic way in blender to do what you want to do.

The tracking information is unique for each tracked video (or image sequence) and cannot be shared.

As a workaround you can use the Orientation settings, it should not be difficult to match different shots if you prepare your scene carefully.

To understand how this works:

Before creating the solved scene, Blender allows you to determine the scale and orientation. When you hit the Setup Tracking Scene button blender then re-creates the relationship between tracked points and camera in the 3D viewport as a set of points parented to a camera according to the information provided by the scale and orientation settings.

The key is to set these parameters meticulously for each of the tracked shots you want to reconstruct.

To set scale

With a measuring tape, measure the distance between the points that you will be using as trackers in the real world.

Once you have tracked your shot (and before pressing the Setup Tracking Scene button) shift+select the trackers that correspond to those you've measured in the real world and enter the distance information on the Distance parameter and press Apply Scale.

Set a common point as origin.

Choose a point that is present in the different scenes to be tracked to work as origin. Choose the tracker and Press the Set Origin button.

On the new 3D scene, that tracking point will be placed at the center of the world at coordinates X:0 Y:0 Z:0. Doing that in all of the tracked video clips will allow you to match a common point in the scene.

Set X axis and Y axis

Select a tracker that is aligned with the X axis (with respect to the origin) then press Set X axis. Do the same for one a different tracking point that is aligned with the Y axis.

Once you've set the orientation and scale correctly, hit the Setup Tracking Scene button. If your settings for Sensor, Lens and Lens distortion are correct, and you've manage to track the scene with a low solve error (less than 0.3 pixels). You should be able to line up different shots in a common space and scale.

You can also do some manual adjusting if the automatic tools fail. Remember that the camera solution means that all of the points and camera are parented, so if you move one element the rest will follow. See: Correct tracked camera orientation

Additional info: How can I get better results when doing camera motion tracking?


How to copy textures to other cubes I have made a massive cube made from hundreds of smaller cubes for a wreaking ball to hit and knock down. I want the cubes to be wood textured. I have my texture on one cube but I want all 700 cubes to be the same texture, there is no way I can go through and texture every single cube. How do I take the texture from the one cube and apply it to all of the other cubes?

You need to copy the material.

To do this, select all the cubes.
Next also select the cube with the texture(be sure to do that one last). The cube with the textures should have a light orange background instead of a dark orange.
Finally press Ctrl-L->Materials.
To copy the UV unwrap, use Ctrl-L->Transfer UV maps

Done!


Deleting face leaves 'hole' where it shouldn't Alright, I'm fairly new to Blender and I'm currently following this video tutorial (Blender Tutorial: Create a Spaceship Corridor in Blender by Blender Guru) in order to get familiar with basic modelling, extrusions, mirroring etc.

At 7:25 (direct link), the guy creates a little handle for the door/structure thingy he's currently modeling. He selects a face at the lower part of the mirrored model, goes to extrusion mode (E), cancels extrusion (ESC), scales it (S) and then he decides to remove the lower face.

It should now look like this:

However, when I follow the exact key combination (shown at the lower right of the video), I end up with that:

Did he somehow 'extruded' the face by moving it inwards? There aren't any keys showing up that might indicate this.

I hope this isn't a stupid question. Blender heavily relies on keyboard shortcuts for efficient working and until I'm not 100% familiar with them, a lot of it is pure sorcery. :)

From the video I see he's setting a mirror modifier (on Z and Y), and that the bottom edge of the face that is deleted is just on the lower limit of the vertical mirror (Z). So the geometry you see below is a mirrored face, mirroring the above face.

The "trick" should be that he has "merge" in the mirror modifier, so, I think that in his model the "deleted face hole" height is in the range of the "merge limit", so the modifier is "filling" the missing area.

If your does not, try increasing the "merge limit" until you get the same effect... (I tried with a simple plane, and with my mesh scale this happens setting a mirror merge of 0.1117)

Obviously it is not sane to have a "merge limit" too high, but if it works, this will confirm that it is what he did in the video.

Btw, just after that point he also set the "clipping" so that the modifier prevents him to add vertices below the Z mirror line (while he's dragging the lower edge of the lowest face remained), since there's a mirror, and adding vertices below that line could probably make accidentally troubles in the mesh, without it.


texture font not carrying over Ok so I have two files A.blend and Z.blend

Z.blend has a plane with a textured font on it...you know one of those fontname.tga files right. Start up Z.blend and it all works perfectly.

Now for A.blend, in this file I created a mesh cube that has the following logic:

Keyboard -> And -> Game: Start Game From File

So when the character walks up to the cube and presses the letter "T" for example it'll switch A.blend to Z.blend.

Now here's where my problem lies...

Once the switch has been made from A.blend to Z.blend and you go through the blend file the plane containing the fontname.tga is black as if it can't find the .tga file or texture.

Any idea on how to get the texture to show up?

Safe a .tga file in the same location as the A.blend and Z.blend file.

Go to the location where A.blend and Z.blend is saved.
Create new folder call it "texture"
drop .tga file in the texture folder.

To recap if your A.blend and Z.blend file is in E:\mesh\
then your texture must be found in E:\mesh\texture\

A second solution would be to pack the image file inside the blend file.
In your case Z.blend needs to have a packed copy of the .tga in question.

That was how blender game makers pack all their textures, when they ship their game out for others to download for play testing. In this way the client will
always have all the texture require for the game to look good.

Hope that helps.


UV problem. Artifacts appearing on material For a while now I can't find the reason for these artifacts appearing. It seems to happen when I do boolean cuts and creates overlaps in my UVs. I thought it was maybe because of the edge split modifier creating double vertices and the UV map is overlapping them. How do I fix this?

When you create new holes inside the mesh with the Boolean modifier active, Blender will wind up recalculating all of the faces affected. Normally, if you sub divide the mesh and then apply the Boolean modifier, you could get better UV textures. At this point, you can do one of the following:

Subdivide the mesh first with enough vertices to avoid this problem when you apply the Boolean modifier.
Add more vertices to certain parts of the mesh to create cleaner faces with the Boolean Modifier active.


PYTHONPATH extension? I am trying to write some scripts to test blender.  I have developed some helper tasks that I would like to use from a common module.  However when I move the task from the working script into a different file and try and get the script to import from the second file it does not work.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "E:\blender-addons\test\test_import_obj.py", line 14, in <module>
    import test_helper
ModuleNotFoundError: No module named 'test_helper'

So I figured that I needed to at least set the PYTHONPATH to the current directory.  However when I do that then the blender bit stops working

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "E:\blender-addons\test\test_import_obj.py", line 214, in <module>
    main(infile, module)
  File "E:\blender-addons\test\test_helper.py", line 22, in copy_plugin
    bpy.ops.wm.addon_install(overwrite=True, filepath=zfile)
NameError: name 'bpy' is not defined

I am using windows to develop my scripts.

What am I missing?

Don't set PYTHONPATH, but rather add your script's path to sys.path. You can do that manually in Blender's Python Console, in a script you embed in a blend file via Blender's Text Editor, or in a small add-on that you place in a path that's already searched for by Blender.

Non-scripting approaches would be to set an alternative scripts folder in the user preferences, or to use symlinks to make Blender find your code.


GPU Rendering with LuxRender - Where is SLG Path OpenCL option? Where is the option for SLG Path OpenCL?

I'm finding the online reference for Luxrender/Blender to be a little cryptic and disorganized.

To ensure I am using GPU, I found directions that included this graphic:

Yet having set up luxrender, I don't get the SLG Path OpenCL option, but rather these:

I'm guessing the problem is me, since this is my first attempt with luxrender. How do I know if I am using GPU? Is it now dictated strictly in my blender settings?

Side note: All this trouble - perhaps I should just use cycles?

SLG has been merged into LuxRender under the name "LuxCore".
It now supports almost every feature of "Classic Lux" and contains many improvements, most notably in the speed department.

So what you will want to use is either "LuxCore Path OpenCL" in your screenshot above, or switch LuxBlend into native LuxCore mode: http://www.luxrender.net/wiki/LuxBlend25_LuxCore

To use GPU rendering in LuxCore mode, go to the render settings panel and switch from CPU to OpenCL:

Note that OpenCL rendering is only available when using the Path or Biased Path engine.


Pose mirroring wrong Blender newbie here. I have a problem mirroring poses that's giving me a headache.
When I mirror, for example, the left leg, the right leg isn't
correctly mirrored; it's rotated for some reason.

I've read possible solutions and watched some videos,
but I still get bad results.

This is what I do:
First, I create the bones I need:

I placed the 3D cursor at (0, 0, 0).
I select all of them except the torso and head bones. I key Shift + D, then Esc, then Ctrl + M, then X, and finally Enter
to create a mirrored copy. Afterwards, I key W to open the Edit Mode Specials Menu and select to Flip Names.

Once that is done, I go to Pose Mode and move some bones on the right side:

Then, with those bones selected, I press Ctrl + C, then Ctrl + Shift + V to paste mirrored,
but this is what happens:

What could I be doing wrong?

I solved my problem.
For every bone in Edit Mode, I had to set the Roll value to 0.
Then, for some bones with Bone Constraints, I had to set the Pole Angle to 0 or 180.
Finally, I had to clear parents for my meshes and parent them to the bones again.


Cannot Deselect objects in when other objects are behind the selected Ones I can select the objects in all the modes, but I just can't deselect. (I even tried deselect in box select,circle select and the default ShiftRMB but nothing works.)

So if I select something which I didn't want to, I have to deselect the entire scene with A, and then go on again.

I forgot to mention one key thing, that I can deselect objects, but only when there are objects behind it I can't. Unfortunately my scene is a bit complex and has many objects behind each other and hence I just couldn't deselect any of the selected.

When you right click on an area with multiple objects, blender will cycle among these object.

You have several possibilities to overcome your issue:

changing the view a little (by panning around but, even more effectively, by zooming in) in order to free up that portion of space, and make a less ambiguous click. Note: in wireframe view, the objects you select are the ones whose edges - not faces/volume - are near your mouse pointer.
using the Outliner window, that is the top-right window in the default worktable
using Undo: Ctrl+Z. The Undo history contains selections as well! Note: there are separate histories for Object and Edit mode.
[Edit, thanks Mr Zak] you can use the other selection methods that you have mentioned (B, C), provided that you then use MMB for the selection to make it subtractive.

However, the "selection by depth" menu Alt+RMB can help you make more precise selections.


Trapped in Dope Sheet view I've used Blender a bit, so I've been enjoying how usability has improved in v2.8, but I was in Animation view - timeline, dope sheet and view - and accidentally touched the keyboard - POW! The view changed to only the dope sheet. No menu items along the top, no '+' or little black rounded triangles in the corners to let me drag open new windows, nothing.

So I re-started, and got the menus back along the top; I can open the alternative views, but Animation is stuck on just Dope Sheet, nothing else. I have tried every keystroke/combination/mouse-clicks, but the only points on the screen where I get up&down arrow (indication I can click & drag) don't do anything. Just the Dope Sheet. How do I get more windows open?

Ah! I tried ctrl-spacebar, which had no effect, but then accidentally tapped the alt key (yes, clumsy of me, I was trying to do this while holding a cup of tea), and the original view came back.

So the answer is, 3-key combination: Ctrl - Alt - Space bar.
This toggles 'full screen' for whatever view the mouse is hovering over.

Thanks moonbots!


Finding the lists of connected indices associated with disjoint mesh elements Is there a fast way (without looping over all edges/faces/verts) using ops.mesh or bmesh to get the lists of indices associated with mesh islands as shown below? These islands are part of one mesh but are disjoint from each other.

I know how to select the boundaries by running the operator Select boundary Loop or calling bpy.ops.mesh.region_to_loop() but can't find any API calls to return the vert/edge/face indices associated with the individual islands.

I'll give an alternative answer based on your own answer.

This slightly modified version of your script assumes the active object is appropriate for the operation. something like:

with bmesh:

import bpy
import bmesh

obj = bpy.context.active_object

bpy.ops.object.mode_set(mode='EDIT', toggle=False) # Go to edit mode
bpy.ops.mesh.select_all(action="DESELECT") # unselect everything

bm = bmesh.from_edit_mesh(obj.data) # load mesh
bm.faces.ensure_lookup_table()

loops = []
faces = bm.faces

while faces:
    faces[0].select_set(True) # select 1st face
    bpy.ops.mesh.select_linked() # select all linked faces makes a full loop
    loops.append([f.index for f in faces if f.select])
    bpy.ops.mesh.hide(unselected=False) # hide the detected loop
    faces = [f for f in bm.faces if not f.hide] # update faces

bpy.ops.mesh.reveal() # unhide all faces
print("Mesh has {} parts".format(len(loops)))

print("\nThe face lists are:")
for loop in loops:
    print(loop)

The output of the script is visisble from commandline/console

Mesh has 5 parts

The face lists are:
[0, 1, 3, 7, 8, 9, 10, 11, 27, 31, 32, 33, 34, 35, 36, 40]
[2, 24, 25, 26, 28, 29, 30, 38, 39]
[4, 17, 18, 19, 20, 21, 22, 23, 41]
[5, 6, 12, 13, 14, 15, 16, 42, 43]
[37]

This corresponds with the indices, proof using index visualizer:


Clean Corners for Subdivision I added a few support edges to get sharp edges and then merged some vertices, so the edge loops don't spread on my whole model. Now I have all quads, but the corners don't look right.

I know that I could get away with triangles on the bottom part, because it is a flat surface, but what about the pointy star trek polygon in the back?

Going into wireframe mode shows that the subdivision creates a fold in the model.

Creasing the sides of the star trek polygon pulls the fold out.

That basically solves my problem, because the render looks right, but the topology doesn't:


cant move a single vertex Hi i'd like to know how to move just one vertex, i need to change the position of a vertex but when i select and move  the other vertex come together. I just started blender yesterday and today is my attempt to try model with tutorials but it still very hard!! i need to do what this guy did at https://www.youtube.com/watch?v=dgUx8v6u7tM 3:24

EDIT The Proportional Editing is already disabled

You might have proportional editing on. If you want to use it you have to press G and then move MMB  up to shrink the size of the area.


Adding Named Objects in Blender with Python API Motivation: I would like to add multiple empties with sequential, but meaningful, names using the Python API with Blender.

Issue: I cannot name the objects as I add them.

Question: What can I add to the bpy.ops.object.add() code to give a name, or how can I change the name immediately after adding the object?

So far, to insert empties with (x,y,z) coordinates (1.1,1.1,1.1), (2.2,2.2,2.2), (3.3,3.3,3.3), and (4.4,4.4,4.4):

import bpy

x = (1.1,2.2,3.3,4.4)
y = (1.1,2.2,3.3,4.4)
z = (1.1,2.2,3.3,4.4)

for index,val in enumerate(x):
    bpy.ops.object.add(type='EMPTY', location=(x[index],y[index],z[index]))

They are added with sequential names:

Empty.001
Empty.002
Empty.003
Empty.004

Here is a screenshot of the output:
Screenshot of Blender after running Python script

But, I want them to have names:

SpecifiedName.001
SpecifiedName.002
SpecifiedName.003
SpecifiedName.004

I cannot seem to just add the property name = "SpecifiedName" to read:

bpy.ops.object.add(type='EMPTY', location=(x[index],y[index],z[index])) ###DOES NOT WORK!!!###

If you are curious as to the final outcome I am looking to do, I want to plot several different datasets in x,y,z coordinates. Each empty from each dataset (and cooresponding name) will be linked to an mesh like a sphere or cube. This gives me the chance to animate a flythrough or rotation of 3D scatter plot data.

When you use bpy.ops.object.add() the newly created object becomes the active object, so right after creating the object you can alter it's name with

bpy.context.active_object.name = 'new_name'

It is also possible to create objects without using operators. This approach will create the objects without altering the existing selection or active object.

import bpy

x = (1.1,2.2,3.3,4.4)
y = (1.1,2.2,3.3,4.4)
z = (1.1,2.2,3.3,4.4)

for index,val in enumerate(x):
    new_obj = bpy.data.objects.new('new_obj', None)
    new_obj.location = (x[index],y[index],z[index])
    bpy.context.scene.objects.link(new_obj)

Here 'new_obj' will be the name of the new object, if it is non-unique it will also get a numeric extension.


Need some feedback for eyelid modeling/ topology I have created a model (attached) and am now trying to rig it. But I'm not sure if the eyelid topology is any good. It'd be great if someone could take a look and correct me if it is crappy for animating blinks.
*.blend file here

You probably need to create a topology more like this one:

So that when you rig with rows of bones, you can more easily fold the eyelid this way: