Using Python loop to attach empty to each bone in Armature I'm stuck at the part of my loop where the empty gets constrained to the bone.
I don't know how to refer to the bones and empties I want to constrain since their names vary as the loop runs. Here's what I have so far:

##Loop that runs on every bone in rig
for bone in metarig:
    ## print each bones name
    print (bone.name)
    ##create Cubeshaped Empty of radius 0.6 at origin
    makeEmpty = bpy.ops.object.empty_add(type='CUBE', location=(0, 0, 0), radius=(0.1))
    ##rename newly created empty
    bpy.context.selected_objects[0].name = ("empty_A_" + (bone.name))

Up to here above code works, when I end the loop here I get all my empties named correctly.

The Next command errors out: I'm trying to define the Constraint owner and targets without using explicit names, since this is a loop? What's the correct way? I also tried calling it by its name ("empty_A_" + (bone.name)) that doesn't work.

## Create reference for current empty
    emptyobj = bpy.context.selected_objects[0]
## also tried referring to it by its name, the following also errors out
    emptyobj = bpy.context.("empty_A_" + (bone.name))

## then I want to do this, not sure if this will work since I'm stuck at the above line,
    targetbone = bone
    myConstraint = emptyobj.constraints.new(type='CHILD_OF')
    myConstraint.target = targetbone

Any guidance would be greatly appreciated, been stuck on this for a while now :(.

Script for 2.8

Test Script:

Select your armature object in object mode. Adds an empty at each pose bone location. Creates a child of constraint for each.

As it is for 2.8 uses @ for matrix multiplication.  For prior, globally replace @ with *

import bpy

context = bpy.context
ob = context.object
mw = ob.matrix_world

mts = []
for pb in ob.pose.bones:
    bpy.ops.object.empty_add(location = (mw @ pb.matrix).translation)
    #bpy.ops.object.empty_add()
    mt = context.object
    mt.name = "MT_%s" % pb.name
    cl = mt.constraints.new(type='CHILD_OF')
    cl.target = ob
    cl.subtarget = pb.name

    mwi = (mw @ pb.matrix).inverted()
    cl.inverse_matrix = mwi

Notes:

after an add object operator, the newly added object is context.object or context.active_object.  Do not rely on it being context.selected_objects[0]
The target for the constraint is the armature object, the subtarget is the bone, by name.


How to make grid scale in 3d view? While working in blender I accidentally pressed some buttons from keyboard and mouse which made the grid look strange in 3d view (attached screenshot). How can I get the grid to it's default state, like when you open blender for the first time?
I tried to make a new file, but when I append the object the grid changes back, like in the image.

In the properties panel right from your viewport (press N if not visible) you can change grid settings as you need them.


Cycles: Generate 3d coordinates before modifier stack is resolved Im trying to create a volumetric material that uses a 3d texture. I need this volumetric to be animated along a curve. Right now, I have the material using generated coordinates. But the 3d texture does not bend with the object. Is there a way I can have a 3d coordinate space that is calculated before the bend of the object? Or perhaps a way to bend my coordinates to match the geometry?

Repro Steps:

-Create a cylinder with multiple divisions down its length.

-Rotate the cylinder 90* on the Y axis

-Scale the cylinder to 1,1,4

-Create a curve and add a curve modifier to the cylinder using the created curve

-In cycles create a musgrave texture with Generated texture coordinates as the vector input

-Create a colour ramp to clamp the texture values

-Create an emmisive shader and plug the colour ramp into the color of the shader

-plug the shader into the volumetric output

-notice how the texture does not curve with the geometry

It can be done!

Approaching it on a Surface

Before we try to do this with a 3-dimensional texture, let's attempt it in 2-dimensions. This is actually fairly straightforward. We can create a proxy mesh by duplicating our object (Shift + D), removing the modifiers from our duplicated object, then setting the Texture Mesh setting for our original object to the mesh of the second object:

Result:

Hey, that works perfectly! Unfortunately, it doesn't work for 3D textures. When we attempt this with a volumetric texture it does absolutely nothing.

Approaching it in a Volume

The best way to do this in a volume (believe me, I've tested others) is to create a proxy mesh, then take the coordinates from the proxy mesh.

What should our proxy mesh look like?

Unfortunately, Blender does not provide an easy way to transfer volumetric data on and off of meshes. Our saving grace is the Point Density node in Cycles. The Point Density node will create a volumetric texture based off of the vertices of any mesh, and interpolate between them. It follows, then, that our coordinate proxy mesh should be a 3D grid of points.

Creating the proxy mesh

We'll start by adding a plane, then in Edit Mode, moving and scaling it so it has the same size and location of the bottom of the cylinder's bounding box (in the image, I enabled the bounding box display):

Next, we need to have more points in our coordinate grid. Use the Loop Cut tool (Ctrl + R) to add lots of loop cuts in both directions, trying to make the faces roughly square (I did $63$ and $15$, to get a $64\times16$ grid:

Next, in Object Mode add an Array modifier. Use Constant Offset in the $Z$ direction to create a "stack" of planes (I used an offset of $0.125$). Add enough planes to fill the bounding box of the cylinder:

Apply the Array modifier and add a Curve modifier. Set up the Curve modifier the same way that it is set up on the cylinder. Check to make sure everything deforms properly (proxy mesh set to Wireframe display):

Now the hard part:

Creating a coordinate system

The Point Density node can only take color from Vertex Colors, Weights, and Normals. By far the most customizable of these options is Vertex Colors. We need to find a way to put Texture Coordinates into Vertex Colors.

Let's use Animation Nodes! After downloading and installing the add-on, go into the Node Editor and add a new NodeTree.

Before we start adding nodes, we need to figure out how to emulate Generated texture coordinates. According to the Blender Manual:

  Generated
  Automatically-generated texture coordinates from the vertex positions of the mesh without deformation, keeping them sticking to the surface under animation. Range from 0.0 to 1. 0 over the bounding box of the undeformed mesh.

This means we need to normalize the vectors representing the positions of our vertices and put them in the positive-positive-positive octant. Here is the formula we will use:

$$\mathbf p'=\frac{\mathbf p - \mathbf c}{\mathbf d} + \mathbf{0.5}$$

where $\mathbf p$ is a point in 3D space, $\mathbf c$ is the center of the bounding box, and $\mathbf d$ is the vector of the longest diagonal of the bounding box (i.e. the dimensions).

Let's get our inputs first. Add the following nodes (press Shift + A to bring up the list of nodes or Ctrl + A to search):

The object in the Object Input node is our coordinate proxy object. The text in the Object Attribute node is dimensions. Note that "Use Modifiers" is unchecked. This ensures that the coordinates we get don't include the Curve modifier. Next, we'll use Vector Math nodes to implement the above formula:

The Convert node will be added automatically. We have one more issue with the texture coordinates: texture coordinates are encoded in a linear color space, while Vertex Colors are encoded in sRGB. From the linked Wikipedia page, we get the formula for encoding colors in sRGB:

  $$C_\text{srgb}=\begin{cases}
12.92C_\text{linear}, & C_\text{linear} \leq 0.0031308\\
1.055C_\text{linear}^{1/2.4}-0.055, & C_\text{linear} > 0.0031308
\end{cases}$$

To utilize this, create a loop subprogram by adding a Loop Input node. Create this loop:

The numbers are truncated in the screenshot. Here they are, row by row:

0.003131
12.92
0.416667  1.055  0.055

Now, add 3 Invoke Subprogram nodes with Separate and Combine Vector nodes to encode the $R$, $G$, and $B$ channels.

Now, we need to get our vectors into a Vertex Color. @Omar Ahmed has already made fabulous explanation of how to do this. You can find his answer here. I will copy the relevant parts below, but I recommend reading his answer for a detailed (and illustrated!) explanation of how Vertex Colors work in Blender.

First, create this loop:

Then, create this script (make sure to name things properly):

Here is the script:

#Create a vertex color map named "Normals" if it is not already created.
if "Coords" in Object.data.vertex_colors:
    map = Object.data.vertex_colors["Coords"]
else:
    map = Object.data.vertex_colors.new("Coords")

#Loop over Colors and assign them to the vertex color map.
for i, color in enumerate(Colors):
    map.data[i].color = color

Finally, link up the last nodes (for an explanation of how they work, see the answer linked above). Here's the final tree:

Getting the coordinate system into Cycles

We will be using the Point Density node as I mentioned above. On the Cylinder object, create a new material. Add a Point Density node. Set it to Object Vertices, with the Coordinate Proxy as the object and the Color Source as Vertex Color. Choose the Coords Vertex Color. Next, disable visibility for the proxy object, and link the Color output of the Point Density node to an Emission node plugged into the Volume socket of the material output (in the picture I'm using the Node Wrangler add-on to get an Emission node):

Activate Rendered View in the viewport (Shift + Z). Position the 3D View so that you are looking at one of the "caps" of the cylinder. Adjust the Radius parameter of the Point Density node to be just big enough that there are no "gaps" ($0.1$ worked for me):

Now we have our coordinates! Use the Color output just like you would normal texture coordinates, and volumetric texture-ize away!

Just remember that anything you do to animate the cylinder also needs to be done to the proxy.

(Requires Animation Nodes)


Is there a way to convert an imported svg into a grease pencil layer? I have an svg path, made in illustrator that I would like to import into Blender and convert into a grease pencil animation. is this a thing that is possible?

A workaround is possible i.a. with a script, but your imported .svg needs to be curves in the first place. See the answers to the following question


Why isn't a button added in the panel by running this script? This script was suppose to create a tab on tools panel and add a button in it.

But after I run just the panel is added. Any directions what I am doing wrong?

import bpy
from bpy.types import Menu, Panel, UIList

class View3DPanel():
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

class MyPoseLibraryPanel(View3DPanel, Panel):
    bl_label = "Legs"
    bl_context = "posemode"
    bl_category = "My Pose Library"

    def draw(self, context):
        layout = self.layout
        col = layout.column(align=True)
        layout.operator("bpy.ops.pose.select_all(action='TOGGLE')", text="Legs.Idle.1", icon="MOD_ARMATURE")

def register():
    bpy.utils.register_module(__name__)

def unregister():
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()

print("my stuff loaded")

Line 16 should read:

layout.operator("pose.select_all", text="Legs.Idle.1", icon="MOD_ARMATURE")

You aren't giving the full path and the parameters. You are choosing an operator so Blender already knows that it is in "bpy.ops". When the user pushes the button, he will set the values.

If you want to make sure you use your own hard-coded values, make your own operator class, that calls the bpy.ops.pose.select_all() operator inside of it with desired parameters, or catch the result of the operator layout definition in a variable, and set the parameters like this:

# catch the defined operator in a variable
myOperator = layout.operator("pose.select_all", text="Legs.Idle.1", icon="MOD_ARMATURE")

# set the options on that var. Add as many as needed
myOperator.action='TOGGLE'


Best way to mirror duplicate a rigged object? okay so I'd been working on this Bird wing rig and had achieved success in finishing it, But i had only created it one wing. So now i have to make a duplicate for the wing on the other side and also mirror the armature in a way that the same functionality remains. is there a quick way to do that?, because if i have to repeat the entire process again for other one im screwd.

edit: writing the way i made the rig

the feathers you see each one of them have 2 constraints targetted to their adjacent neighbors, this allows for the spread out function and fit in function

the feathers are divided into two groups, one is PARENTED to the farthest object from the bird (the one that looks like a triangle), and the other group is also parented but to its neighboring object which is the second object from the bird.

both of those above objects are parented as BONE RELATIVE to the armature.

im also sharing the blendfile in a minute
here
Blend file download

Few explanations about the method to do it, but I have found nothing conventional to apply here on this initial particular (but well working) way of rigging a wing.

This was mainly manual editing (so not sure to remember all the steps) :

define a center and set a center bone at this location
parent the first wing bone to this center bone
rename the bones with .LEFT as suffix, select them all and "symetrize" to obtain the .RIGHT bones
duplicate wing parts and feathers and scale X, -1, with the center previously defined as pivot
Edit each part of the right wing in order to arrange the normals
Parent (with automatic weights) the wings (not the feathers) with the armature
For the feathers (on the right), select them by group (object mode) in order to bone parent to the corresponding wing part

And the result as given in the comments above :

Nothing "magical" !!


How to create a spaceship and force field transition effect I have put together a scene in which a space fighter exits a force field from a carrier. I would like to create an effect that when the fighter flies through the force field, the field glows darker as the ship transitions through it, then the field returns to it's original status once the ship passed through. The force field was created with a mesh and some shading. I then added a dynamic paint canvass to the field, and a dynamic paint brush to the ship but that isn't working. I am including an image of my setup. Am unsure at this point what to do. Maybe add a collision object? Can someone please assist me with setting this up? Am using Blender 2.91. With thanks
The effect I am looking for wouold be similar to this video on Youtube.
https://www.youtube.com/watch?v=q6IW4Y9i-vE

A sci-fi energy shield (force shield, force barrier VFX) is fairly easy to create with Dynamic Paint.

You just need ...

a subdivided plane that is the Canvas for the Dynamic Paint physics. Set Surface Type to Waves and tick the Open Borders checkbox. Add a Solidify modifier if you want to look at the shield from both sides.
an object (a spaceship or Suzanne) that is the Brush. Increase Waves > Factor to 2 to enhance the effect
create a shader that uses the y coordinate of the wave deformation to colorize the shield. In the material settings set Blend Mode to Alpha Blend and enable Bloom in Eevee render settings.

In Blender 2.92+ you can use a Vertex Weight Proximity modifier and Geometry Nodes to add some sparkle. Just create a vertex group ("proxy"), assign all mesh vertices to it, and use it in the Vertex Weight Proximity modifier and for the Density Attribute of the Point Distribute node in the Geometry node setup.

In the example, both objects (the plane and Suzanne) have each a Vertex Weight Proximity modifier and a set of Geometry nodes to have the little spheres on both objects when they are close together.


How do I subdivide F-Curves? My apologies if this question doesn't make sense, I'm brand new to animation.

I've been fiddling around with the F-Curves and would like to subdivide two F-Curves to have another keyframe between two curves without affecting the overall shape of the original curve.

For example, here is my curve:

The reason this can't be solved by just keyframing the midpoint (frame 200) is because:

A. The midpoint of the keyframes isn't always the midpoint of the curve, like in this photo:

And B. Even if the middle of the curve is the midpoint of the two keyframes, adding a keyframe changes the curves shape:

Even though I could change the added keyframe to vector, I'd have to manually line it up with the old line, and the process of doing that is too lengthy/not perfectly accurate.

So, how do I subdivide F-curves and end up with the same line I had before, yet another handle in the middle?

Subdividing Bezier curves is normally done using De Casteljau's algorithm.  However, fcurves aren't pure Bezier curves.  It is not hard to make a bezier curve "run backwards" along the time axis.  Since this would create ambiguities in the animation system, blender prevents that by using modified handle coordinates whenever the handles could make the curve backtrack in the time axis.  Once we understand that math, we have what is needed to properly subdivide the fcurve.

Here is an excerpt from http://web.purplefrog.com/~thoth/blender/python-cookbook/subdivide-fcurve.html which demonstrates the technique:

def correct_bezpart(p):
    if p[1].x <= p[2].x:
        return p

    scale = (p[3].x - p[0].x) / ( (p[1].x - p[0].x) + (p[3].x - p[2].x) )

    p = list(p)

    p[1] = p[0] + scale * (p[1]-p[0])
    p[2] = p[3] + scale * (p[2]-p[3])

    return p

def interp(v0, t, v1):
    return (1-t)*v0 + t*v1

def de_casteljeu( p , t):
    q = [0,0,0,0]
    r = [0,0,0,0]

    q[0] = p[0]
    r[3] = p[3]

    q[1] = interp(p[0], t, p[1])
    x    = interp(p[1], t, p[2])
    r[2] = interp(p[2], t, p[3])

    #print([ r[2], '= interp(', p[2], t, p[3], ")" ])

    q[2] = interp(q[1], t, x)
    r[1] = interp(x, t, r[2])

    q[3] = r[0] = interp(q[2], t, r[1])

    return (q,r)

def subdivide_fcurve(fc, frame):

    orig_keyframe_count = len(fc.keyframe_points)

    fc.keyframe_points.add(1) # do this before we have any keyframe_points[i] references that would be invalidated
    kp9 = fc.keyframe_points[orig_keyframe_count]

    for i in range(1, orig_keyframe_count):
        kp0 = fc.keyframe_points[i-1]
        kp1 = fc.keyframe_points[i]
        if (kp1.co.x >=frame):
            break

    p = (kp0.co, kp0.handle_right, kp1.handle_left, kp1.co)
    p = correct_bezpart(p)

    t = tForFrame(frame, p[0].x, p[1].x, p[2].x, p[3].x)

    q,r = de_casteljeu(p,t)

    kp0.handle_right_type='FREE'
    kp9.handle_left_type='FREE'
    kp9.handle_right_type='FREE'
    kp1.handle_left_type='FREE'

    kp0.handle_right = q[1]
    kp9.handle_left = q[2]
    kp9.co = q[3]
    kp9.handle_right = r[1]
    kp1.handle_left = r[2]

    fc.update()

#

def bez_root_score(t):
    return max(abs(t.imag), 0-t.real, t.real-1)

def favorite_root(roots):
    """ Since we are confident that at least one of the roots is real, pick the one that has the imaginary component closest to zero
    """
    fav = roots[0]
    score = bez_root_score(fav)

    for i in range(1, len(roots)):
        if bez_root_score(roots[i]) < score:
            fav = roots[i]
            score = bez_root_score(roots[i])
    return fav

def tForFrame(fr, p0, p1, p2, p3):
    """
    fr = (1-t)**3 *p0 + 3*(1-t)**2 *t *p1 + 3*(1-t)* t**2 * p2 + t**3 *p3
    """

    import numpy

    coefficients = [
        -p0+3*p1-3*p2+p3,
        3*p0-6*p1+3*p2,
        -3*p0+3*p1,
        p0-fr
    ]

    roots = numpy.roots(coefficients)
    #print(roots)

    rval = favorite_root(roots).real

    sanity = bez(rval, p0,p1,p2,p3)
    if abs(sanity-fr) >1e-6:
        print(["defective", sanity, fr])
        print(roots)
        print([rval, "for", fr, p0, p1,p2,p3])

    if rval<0 or rval>1:
        print(["wiggy, bez(",rval,p0, p1,p2,p3,") = ",fr])
        print(roots)
        print([rval, "for", fr, p0, p1,p2,p3])
    return rval

def bez(t, p0, p1, p2, p3):
    s = 1-t

    return s*s*s*p0 + 3*s*s*t*p1 + 3*s*t*t*p2 + t*t*t*p3

def mission2(obj):
    create_sample_fcurve(obj)

    subdivide_fcurve(obj.animation_data.action.fcurves[1], 33)

#
#

random.seed=4262

mission2(bpy.context.active_object)


Need help downsizing an OBJ file I am a complete novice to 3D. I am trying to downsize a file of a train engine that is 400+MB so that I can import it into Adobe Dimension for a layout. Currently the file is too big to be used practically.

I've tried Decimate but I know I'm doing something wrong because I can only get one section to downsize, not the entire train. I've tried eliminating the hidden polys, but no luck there either.

I get the files from a third party (not sure what software is used originally), then an engineer converts it from either STP or IGS to OBJ. If anyone knows a better way to achieve a smaller file, it would be a great help. Thanks!

One thing I could recommend is joining all of the meshes (selecting them all) and then pressing control j (join meshes). This will work if you have a lot of different objects. My guess is that you only applied the decimate modifier to one specific object and that you are only decimating that part. Could you share a screenshot or two so I could see better what the problem might be?


How to weld two control points of a curve? Is it possible to weld or merge two control points of a curve?

Unfortunately there is not.
If it is a Poly type curve composed exclusively of straight linear segments, then you can safely convert it to a mesh object, remove doubles as mesh, then convert back to a curve.
If there are curved segments converting to mesh will be a destructive process, so the only way is to manually go over the duplicate vertex, and erase/fill.
Make sure you place the cursor over the existing handle first, so when you erase one vertex you can fix the handle position for the following one, then erase the vertex and press F to fill the gap or Alt+C to close the curve if it is the last gap. Then you can send the handle to the correct position using the snap menu with Shift + S > Selection to Cursor.

Alternatively you can use Lichtso's Curve CAD Blender addon, which among other features has a builtin Merge Ends feature for Bezier curves, vaguely similar to Remove Doubles for meshes.

Merge Ends
Merges two end control points into one while preserving the relative
positions of their handles.

After installing and activating the addon in User Preferences, you can access the functionality while in Edit Mode in a Bezier curve object, by pressing W > Specials Menu > Bezier CAD > Merge Ends
For Blender 2.8+ Curve CAD addon is shipped by default and has a Remove Doubles operator that works like the mesh counterpart.
You can find it by default under the 3D View Sidebar, Edit Tab, Sanitize > Remove Doubles.


Console vs scripting python constants Using 2.67b for python scripting I get this:
while importing math, numpy on the scripting console, internal variables seem to be fine
but when running scripts need to manually define numbers likely to be enabled when importing math, numpy like PI, E, C and several others I think.

Could that be a version problem or do you have to manually define each variables and constants over the scripting editor?

The python console has various convenience imports, from math import *  being one of them.

Text from the console:

PYTHON INTERACTIVE CONSOLE 3.3.2 (default, May 21 2013, 15:40:45)  [GCC 4.8.0 20130502 (prerelease)]

Command History:     Up/Down Arrow
Cursor:              Left/Right Home/End
Remove:              Backspace/Delete
Execute:             Enter
Autocomplete:        Ctrl-Space
Zoom:                Ctrl +/-, Ctrl-Wheel
Builtin Modules:     bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, blf, mathutils
Convenience Imports: from mathutils import *; from math import *
Convenience Variables: C = bpy.context, D = bpy.data

>>> pi
3.141592653589793

Importing the entirety of a module using * when not experimenting in the console is generally seen as bad practice / not pythonic, and explained in part here.

  Remember, you can never know for sure what names a module exports, so
  either take what you need — from module import name1, name2, or keep
  them in the module and access on a per-need basis

For scripting outside of the console use explicit imports. Create a template with all your frequently used imports, similar to this, and place it in the ../scripts/templates_py/ folder:

import bpy
import mathutils
from mathutils import Vector, Matrix
from math import pi, sin, cos, tan

this article goes into great detail about code structure and includes a short section on imports, definitely food for thought if the topic isn't well understood.


select multiple bones from different armatures Is there a way to select multiple bones not belonging to the same armature? And to create selection sets with bones from different armatures?

For your first question: You can in 2.8, to do so you need to disable the Lock Object Modes option.

Edit: About your second question, I quote you: "You can select bones from different armatures and then add them at the same selection set. Although unfortunately the selection set will only be visible in one of the armatures and not in all of them"


How to lighten or color viewpoint render view? I have a quick question regarding adjusting the brightness of the render view background in order to assist in dark-colored designs.

I enter Shift + Z to do the quick viewpoint render function, and it allows me to take snapshots of multiple views of what I made. Unfortunately, the background color of the viewpoint is too dark for some of my creations.

Does anyone know how to brighten up the background, or even color it?

Thank you,

If you are talking about quick renders background in the viewpoint, it depends on your world settings.

The quick render considering the World setting's parameter as the "background" shading settings. You should be able to change the quick renders background by changing the world's background settings.

  On Cycles :

I'll take cycle's example first. Down below you have Cycle's world settings.
the "Surface" Panel is for the background of the world (which is an Emission shader).

The quick render using this option for background, changing the color of the "Surface" emission shader should do the job.

For example, if I change my "Surface" Emission color to red, my sky / background / environment turns red

  On Internal :

If you work on internal. Then the World setting tab is a bit bigger.
You have the "World" panel for the background's texture, and for your case the "Ambient occlusion" and "Environment lighting" tabs might interest you, to allow the background's light to affect your scene like a sky.

I really invite you to play around with those settings.


Way to disable "gradient" in ortho views? Is there an option for controlling the 3D-view background gradient (and perhaps the grid for some situations) when switching between ortho and perspective?

Specifically, when I switch to top or side orthographic view the grid takes on a color opposite the gradient and it's slightly irritating... I would turn the gradient off but I like my theme the way it is.

Modal Timer Handler,

Run script, adds a button to info header.  Uses no gradient in ortho mode and gradient in perspective view for all 3d views on screen when ON.  Add a comment if you want changes re side view etc, or setting a default, prob gradient on when OFF.

wm.event_timer_add(2.0, context.window) makes it tick over every 2 seconds. Change for faster / slower updates.

import bpy
from bpy.props import BoolProperty

class ModalTimerOperator(bpy.types.Operator):
    """Operator which runs its self from a timer"""
    bl_idname = "wm.modal_timer_operator"
    bl_label = "Modal Timer Operator"

    _timer = None

    def modal(self, context, event):
        screen = context.screen
        theme = context.user_preferences.themes[0]

        if not screen.toggle_grad:
            self.cancel(context)
            return {'CANCELLED'}

        if event.type == 'TIMER':
            views = [(a, s) for a in screen.areas
               if a.type.startswith("VI")
               for s in a.spaces
               if s.type.startswith("VI")]

            for a, s in views:
                theme.view_3d.space.gradients.show_grad = s.region_3d.is_perspective

        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        self._timer = wm.event_timer_add(2.0, context.window)
        wm.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)

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

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

if __name__ == "__main__":
    register()

def theme_gradient_toggle(screen, context):
    if screen.toggle_grad:
        bpy.ops.wm.modal_timer_operator('INVOKE_DEFAULT')

bpy.types.Screen.toggle_grad = BoolProperty("Auto Gradient", update=theme_gradient_toggle)
# draw a button in the info header
def draw_button(self, context):
    screen = context.screen
    text = "ON" if screen.toggle_grad else "OFF"
    self.layout.prop(context.screen, "toggle_grad", toggle=True, text=text, icon='RADIOBUT_%s' % text)

bpy.types.INFO_HT_header.prepend(draw_button)
#bpy.types.INFO_HT_header.remove(draw_button)


Make a custom Slider to translate a object I would like to translate a plane along its normal by using a slider.
I'd like to be able to move this slider that would indicate the distance of the current translation and do the translation in the 3D view. Moving the plane along its normal in the 3D view would also act on the slider and make it change its value so that we can see the quantity of the translation.

Is there anyway to script that?

You can use custom properties bpy.props.

But I don't see any benefit here.

Simply parent your plane to an empty object. Use the empty to transform the plane and the z-location of the plane to translate the plane along its normal.


How can I combine multiple textures so that they blend together? I've seen many examples of this, and I can't seem to find the answer anywhere online. The best I've been able to do is, in Texture Paint, edit the actual texture image file.
But what if I could simply unwrap a texture as terrain, and be able to mix, say, a rocky texture with a grassy one, and have one blend into the other smoothly, rather than an abrupt edge?
I've seen this executed beautifully before, and if anyone could give me any insights, I'd really appreciate it! I feel like it's the missing piece that would improve my creations.

The traditional way to do this was vertex colors. The amount of (say) red would be the blend factor between the textures. Use a node setup like this.

Set the 3D View to Material preview and switch to Vertex Paint mode. Paint black where you want the first texture to show through, and red where you want the second.

Alternatively, you could use a third texture to control the blend amount and paint it in Texture Paint mode.


Export Model With Material Colors to MeshLab I would like to export a model from Blender with the colors and open/import it in Meshlab. Here my model:

I read about it a bit already and did not find any conclusive answer. I know that the info should be stored in e.g. the .mtl file while using the .obj format. But neither did .obj, nor any other format worked. So therefore I might miss some necassery step. Like applying (?) the colors to the vertices ? I am just guessing here. Also the add material in export window did not help. I am guessing this is pure basics.

A second question regarding the same piece is how I can get rid of all the internals of my model (here with a boolean modifier using union). So e.g. in this wireframe model I want to get rid of the black part of the Letter R:

So my final model would be yellow letter R, black cube and "hollow" inside without anything inside.

How can I achieve this ? Thanks.

For importing the mesh with colors into MeshLab:

In Blender, select File > Export > Wavefront (.obj), and select a location to save the .obj to.

When the file browser opens as part of the export process, look at the panel to the left, and make sure "Write materials" is checked:

Next, open MeshLab, and choose File > Import Mesh... and select the .obj you exported from Blender. This will import the mesh, but the mesh will be grey:

To enable the mesh colors you exported from Blender, in MeshLab you need to navigate to Render > Color and click "Per Face". Your mesh will now be displayed with the colors you specified in Blender:

For the second part of your question, you should be able to select the black wireframe by right-clicking on it, and then delete it by pressing X. Does that achieve what you need? If that doesn't work, or if you encounter problems, could you upload your .blend file please?


Some weight painted faces not effected? As you can see in the image above the red area, there is a sharp corner I can't smooth out, I've tried painting it various different ways but no dice. It's like there is a ring around the mesh or something, because Its kind of the same problem on the belly.

Also before I started editing, the model was originally in pieces so I joined them together with Ctrl+J, I dunno if that's the problem.

This kind of issues arise when you try to smooth the weights of the main area bone (in your case the neck bone) but you forget to smooth the neighbour bones (probably the head bone).

In particular if two adiacent vertices have the same minimum weight (let's say 0.001) to the head bone, but one belongs to the head bone only while the other has a tiny amount of weight from the neck bone also, their deformation will be completely different, no matter if they look the same pale blue in weight paint mode: if a vertex belong to a single bone/vertex group only, it will follow the movements of that bone exactly, even if its weight is very tiny.

I'm pretty sure that if you highlight the head weights, you will see that they end exactly where you have the sharp corner, and this is where you'll have to use the smooth brush until you reach the desired deformations.


I can't remove or delete a curve from an object I have an object made up of a collection of curves (that I created from a mesh), and I need to move one of them into its own object so I can style it individually. Failing that, I want to delete it entirely.

Nothing I try seems to work. I've tried separating it out into a new object, but it doesn't go, and the new object is empty. I've also tried "delete segments" and "delete vertices" (I don't really know what those two options mean), but nothing changes.

Can anyone tell me the super-simple thing I need to do to separate it and/or remove it, please?

Thank you very much.

-- Dunstan

I think the problem is you are selecting only a single vertex. To separate you will need more than one vertex selected.

Under Edit Mode either manually select the whole spline, or only the desired segments before separating. Alternatively select only one single vertex from the Spline you wish to separate, and press Ctrl+L to select all linked vertex > Press P to separate whole segment.

You should now end up with another object that contains new spline.

Seeing as you already seem to have attempted separation by selecting a single vertex, you may need to do some cleanup.

Although apparently nothing happened, you probably succeeded in separating a single vertex curve object. These are very hard to select, and nearly impossible to see. In Object Mode either hide the larger curve objects, or use Border Select and Border Deselect to attempt to select the single-vertex curves and remove them.

On a side note, if by "styling" you simply mean assinging a different material , you can style each separate spline inside the same curve object individually by assigning it to a separate material slot, and choosing a different material for each slot.

You can also control bevel thickness on a per-vertex basis with the Radius property, Alt+S in Edit Mode for the currently selected vertex.


Quick keyframe frame insertion for Shape Keys with `foreach_set` from data I would like to animate an objects' shape keys from a data set. Imagine a default cube that will get longer (side face vertices will move in +X direction) according to a data.
The date looks like this {'2000':1, '2001':2.5, '2003':3.4, ... '2020':11.9}
As you can see, we have time versus accumulative values. In reality, the data set has 4000 data points.
In the function below, I can receive a new value, add a shape key for it and move my target face in the desired direction. Frame by frame, this works just fine. However the code execution gets really slow after about 100 keyframes insertion.
I am looking for a way to create this animation from the data set quickly. After research, I found about foreach_set function of Blender API. However I could not find a way to use it for my case.
Could anybody please explain me how to use foreach_set function for FAST shape key animation from a dataset?
Relevant questions I could find. However they were not helpful for my case:
Fast keyframe insertion
Editing fcurve.keyframe points in FAST mode?
Thanks in advance!
def resize_bar(obj_name, newValue = 0, active_face = 2, start_frame = 1, end_frame = 2):
    # Get the active mesh
    obj = bpy.data.objects[obj_name]
    obj_mesh = bpy.data.objects[obj_name].data
    obj_mesh_matrix = bpy.data.objects[obj_name].matrix_world
    # get base shape key ready
    if start_frame == 1:
        basis_key = obj.shape_key_add(name="Basis", from_mix=False)
        basis_key.keyframe_insert('value', frame=start_frame)
    # Get a BMesh representation
    bm = bmesh.new()   # create an empty BMesh
    bm.from_mesh(obj_mesh)   # fill it in from a Mesh
    # get top face of mesh
    bm.faces.ensure_lookup_table()
    top_face = bm.faces[active_face]
    top_normal = bm.faces[active_face].normal
    # add shape key and insert a key frame before transformation
    new_shape_key = obj.shape_key_add(name=str(start_frame), from_mix=False)
    new_shape_key.value = 1.0
    new_shape_key.keyframe_insert(data_path='value', frame=start_frame)
    # apply transformations
    bmesh.ops.translate(bm, vec=newValue*top_normal, verts=top_face.verts)
    bm.to_mesh(obj_mesh)
    bm.free()
    obj_mesh.update()
    # insert a new key frame after transformation
    new_shape_key.value = 0.0
    new_shape_key.keyframe_insert(data_path='value', frame=start_frame+end_frame)

Could be simplified to one shape key.

In the initial state of the cube, it is dimensionless (squashed down
to a flat object). In the animation, it should be clear that the Cube
starts growing from 'a flat surface'.
Also, how can I describe the scale in Z direction, when the values are
accumulative? This gets complex already.

IMO you have totally overcomplicated it, by adding a shapekey for each data point.  For this case even Using foreach methods isn't going to help particularly, ie for 4000 points of data creating as many shapekeys and keyframing 2 points per.
Am also of the opinion this could be reduced to simply keyframing object scale, a single shapekey, or solidify thickness to name but 3.

Using solidify thickness on faces defined by vert group "Group"
Shapekey emulating how scale works.

Add a default cube
Transform such that it is unit size, origin at base
Copy the coords
Scale it flat, make that the basis shape,
Make the other shape key unit.

Ok now have a shapekey that if zero has zero height Basis, and if 1 unit height. Changing the range allows scaling outside the (0, 1) range. As illustrated, but appears to be hardcoded to only 10
There is really no need for the shapekeys, since the result is same as scaling in z axis, So could instead create no shapekeys and simply keyframe scale.
Test script. Creates the unit cube illustrated above
import bpy
from mathutils import Matrix
bpy.ops.mesh.primitive_cube_add()
ob = bpy.context.object
me = ob.data
me.transform(
        Matrix.Translation((0, 0, .5)) @
        Matrix.Diagonal((.5, .5, .5, 1))
        )

coords = [None] * len(me.vertices) * 3
me.vertices.foreach_get("co", coords)
me.transform(
        Matrix.Diagonal((1, 1, 0, 1))
        )
basis = ob.shape_key_add(name="Basis")
unit = ob.shape_key_add(name="Unit")
unit.data.foreach_set("co", coords)

Some animation basics
When you add a keyframe to a shapekey, it creates an Action if there is not already one, an fcurve for the data path being animated (if there already isn't one) and inserts a 2D point for (frame, value)
It is in populating the fcurves keyframe points where foreach_set is then used.
>>> C.object.data.shape_keys.animation_data.action
bpy.data.actions['Key.018Action']

>>> action = C.object.data.shape_keys.animation_data.action
>>> for fc in action.fcurves:
...     fc.data_path
...
'key_blocks["Unit"].value'

Besides, to my understanding,
foreach_set method creates and assigns all the keyfames from a data
set at once.
This is the efficient way when you have thousands of data points. But
I just could not figure out a way to use it in shape keys

Yeah?, thanks for the tip.
Knowing where the action belongs and what the data path looks like, is the key to using the methods outlined in my answers to  links posted
Fast keyframe insertion
Editing fcurve.keyframe points in FAST mode?
Example
Using data from question

Created mesh with shapekey as above,
Make the shapekey maximum (as big as it gets from data)
Have offset data such that 2000 is frame 1, and taken one from value for example sake, to get zero at frame 1.
Created an action for the "Unit" shapekey and populated it.

Test script.
import numpy as np
import bpy
from mathutils import Matrix

data = (
    (2000, 1),
    (2001, 2.5),
    (2003, 3.4),

    (2020, 11.9),
    )

bpy.ops.mesh.primitive_cube_add()
ob = bpy.context.object
me = ob.data

d = np.array(data)
d -= (1999, 1)
frames, values = d.T

# max range of 10 ..
#unit.slider_max = values.max()

me.transform(
        Matrix.Translation((0, 0, .5)) @
        Matrix.Diagonal((.5, .5, .5, 1))
        )
me.transform(
        Matrix.Diagonal((1, 1, values.max(), 1))
        )

coords = [None] * len(me.vertices) * 3
me.vertices.foreach_get("co", coords)
me.transform(
        Matrix.Diagonal((1, 1, 0, 1))
        )
basis = ob.shape_key_add(name="Basis")
unit = ob.shape_key_add(name="Unit")
unit.data.foreach_set("co", coords)
# animation
me.shape_keys.animation_data_create()
action = bpy.data.actions.new("Grow")
action.id_root = 'KEY'
fc = action.fcurves.new(f'key_blocks["{unit.name}"].value')

values /= values.max()
fc.keyframe_points.add(count=len(frames))
fc.keyframe_points.foreach_set("co", d.ravel())

me.shape_keys.animation_data.action = action


List of bones to file, is it possible? Good day, I'm new to Blender, and actually to the whole 3D world. I have come with a non regular issue and I hope you guys can give me hand.

I have list of rigged models, each one with their very own set of bones. I'm looking, to put it in some way, all the bones of each model to find which bones they have in common to then build an specific project with that list.

However, the list is pretty much of something around 25~ models and they are fully rigged (regular bones, face bones, hair bones and so on), and doing this by hand seems like a extreme hassle.

This comes with yet another terrible issue: I don't know Python, so I'm pretty much against the wall right now and about to pull my hair. So I wanted to ask, is it possible to get the bone list from Blender? Or is there a script already made for that task? I hopeyou can help me guys, it would mean a lot for me. Thank you in advance for reading and for your time!

So here's the plan:

to import all the armatures into 1 file
to run a script to compare them between each other and export the names of bones they have in common.

Importing (several options):

Just CtrlC, CtrlV from a file to another.
Or ShiftF1 to append an object. Navigate to a .blend file, select Object, and pick the armature object.

After all the armatures are in the same scene, switch to Scripting screen layout.

you can select it from the top menu bar (you should be in the Default screen now)
or you can use  CtrlLeft Arrow and CtrlRight Arrow to switch between the screens.

In the Text editor, make a new text file and paste the code in:

import bpy

bone_names = []
for armature in [ob for ob in bpy.data.objects if ob.type == 'ARMATURE']:
    for bone in armature.data.bones:
        bone_names.append(bone.name)

common_names = set([name for name in bone_names if bone_names.count(name) > 1])

print(common_names)

Run the script, it will print the output into the Console window (Window > Toggle System Console).

If you want to print it into a text-file or json-file that's easy too just give me a file-path and I'll edit the script.


Can shapes with rounded corners be extruded with even thickness? What I want to achieve is to extrude and scale the inner shape to the outer one like this:

The center of the shape seems to be attracted by the roundings, I tried to use bounding box center but this is still not what I want. Is there an easier solution then separated / extrude / join the parts?

There is a way to use the inset tool like an extrude for a flat shape.

Select the loop of vertices you want to extrude inwards.
Fill in the area with a face F
Inset the selected area I
Delete the face

You do get small size variations in the new edge lengths around the curve compared to the straight sides but the amount is very small.

This only works gong inwards so you will want to scale your shape up to the larger size and then inset to the smaller size. With a bit of effort you can create a bounding box around your shape, fill it in with faces and press O while insetting to change to outset to enlarge your shape. Note in this example that the corners overlap and need cleaning.


How to repair procedural texture for animation? I made an eye and for texturing I used a procedural approach. It looks fine when the character is in rest position, however when in pose position the whole eye turns red (the materials don't work well anymore?). The file can be downloaded here: https://www.dropbox.com/s/oy4utqa1l0grppk/blendstackexhange.blend?dl=0
 I have 2 materials: one for the sclera and one for the iris. The shape of the eye is the following(the selected part is the iris):

Material preview in edit mode:

Is there a fix for this? Here is a picture of the eyes in rest and pose position:

EDIT:
Here is my node setup:
The iris:

And the sclera:

if you uncheck this (bind to vertex groups), it works. Although i am not sure whether you need this... ;)


Importing new brushes into existing .blend file Can I import new brushes into an existing blender 2.8 file? I'm able to open a new file and have the brushes show up, but not in an older model.

Thanks,
MC

File -> Append. Then click on the file with brushes you need and on the folder Brushes


How do you paint on only one island in UV Paint view? To be clear, I know how to select a UV island in 3d mode and paint just on it. But there are times when I want to paint directly in the UV layout itself (2d view). But sometimes the islands in UV unwrap are really close and can easily cross paint.

For example, the eye unwrap may be next to the body unwrap and if I do a broad stroke across the body it can easily bleed into the eye unwrap. In 3d view you can select an island and only paint in THAT island. I want to know how to do so in the UV Paint 2d view.

Image below is an example (not mine), I am talking about trying to paint in the right side window on only one uv island at a time without bleeding outside of it.

There is not an option or method to painting to restricting paint in the 2d UV/Image editor as it is in the 3d view. For this reason, it is much easier to use the face selection masking in the 3d view with the use of the L  key to select the linked island faces, and then paint in your solid color there.

(This is the main reason I got into making my early versions of EZ Draw addon that was originally the Artist Paint Panel addon - I had worked out a way to use curves converted to mesh and project to uv through the camera view on an image plane to use as a masking object. Spirou4D spent a lot of work fixing my mistakes and we got a working grease pencil mask as well, and this was my work around for not being able to mask or limit paint in the 2d view.)
I can recommend that you look at the Options tab and the Fill tool - turn up the fill tool to full strength and turn off the Occlude, Cull and Normal so that your brush will go all the way through the mesh. Use the Face Selection masking and drop in the base colors where you want, and then after you can then turn the occlude and other options back on so that you can go back to regular projection.

After you do, you can come back to paint with textures and brush masks/mask tool painting to rework those areas, and I think you might be able to save a copy of the flat colors as an ID image for use in the compositor, though I haven't done much experimentation with that.
Also: Select a single face in the area you want to paint in 3d view, and then press Shift+Numpad7 to align to top view and then you can quickly set your paint view without too much trouble.


Texture Painting: brush wants to be dragged from a site to another i was painting in blender using a stencil brush to paint bump information on my model. it worked great until i hit some button i think and now instead of freely drag the brush around i have to drag it from a side to another and it shows a little white line from the point I start to drag it to the point i relase it. i'd like to return to my free drag mode without having to create a new brush. anyone knows how to do it?

Looks like you enabled Smooth Stroke option:

The smoothness of the brush is driven instead by its shape.

It can be customized by defining points (or choosing one of the six a presets) in the editor of the Curve panel:

On the right, the different result you can get by using each preset.


Blender 2.8 Viewport object visibility problem I have this annoying problem to which I can't seem to find a solution
Is there a way to enable in viewport to display rendered only objects, check out image below to see what I mean.

In 2.79 it was possible to link object visibility via drivers, so viewport would display in real time the objects that would be rendered (by linking visibility to render via driver). But in 2.8 visibility cannot be animated anymore!
Is there any hidden option that allows me to do this what I want? please help me out because I've been looking for hours
Thanks!

Using a driver for visibility properties works in the current build of blender. There are some related changes that may be affect what you are trying to do.

In 2.7x pressing D adds a driver to the property under the cursor, in 2.80 that is now ⎈ CtrlD to add a driver.

In 2.7x the property hide will hide the object in the viewport, in 2.80 that is now called hide_viewport so scripts or drivers may need to be updated with this change.


python open file browser to Group directory of blend file? Is it possible in 2.79 to open the file browser to the internals of a specified blend?

I have a template.blend, that will have several Groups in it. Currently, I have a button that opens the file browser to the directory the template.blend is in.

It's 2 clicks to get to Groups, and I have to rely on the user knowing they should be looking in Group and not Objects or anywhere else.

Selecting a group then appends it to the scene.

Is it possible to open the file browser inside of the blend, so the user is only presented with Groups to append?

A view similar to:

Edit: Possibly related question

Via the link or append operator

Test script, template file as a scene property in way of example, possibly better set as an addon preference.

import bpy
from bpy.props import StringProperty

class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        col = layout.column()
        col.prop(scene, "template_file")
        # check if fp exists
        col.operator_context = 'INVOKE_DEFAULT'
        if True:
            # write an op to
            directory = "%s/Group/" % (scene.template_file)
            op = col.operator("wm.append")
            op.directory = directory
            op.instance_groups = True

def register():
    bpy.types.Scene.template_file = StringProperty(
            subtype='FILE_PATH')

    bpy.utils.register_class(HelloWorldPanel)

def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)
    # del prop

if __name__ == "__main__":
    register()

Alternatively A file test.blend that has 5 groups in it.

>>> fp = "/home/batfinger/Desktop/test.blend"
>>> with bpy.data.libraries.load(fp) as (data_in, data_out):
...     pass
...

>>> data_in.groups
['Group.004', 'Group.003', 'Group.002', 'Group.001', 'Group']

a group name above can be passed as filename argument to operator as show in
Appending an Object Without A Link

Links re linking appending from files.

How to Link/Append a data-block using the Python API?

Import group from external blend file

How to search through multiple Blender files to find a specific object?


Can a Cycles/Blender Internal materials be shared on their own? I would like to know how I can export a material to let a friend use, without sending them a huge .blend file just to append the material from.

While its possible to invent some file-format to store Blender materials, this is currently not a common way to share materials.

Typically for this would be done by appending materials into a new Blend file, saving it, and sending this to a 3rd party.

In rare cases a material may depend on objects (using empties for mapping), in those cases you could create a group of objects in your Blend file and append that instead of the materials (the materials will load in too).


Object renders without proper shading just signed up to write this question.

So I recently downloaded an .obj file to animate around in Blender.

Now in textured view, whenever I move around my lighting, it shades just fine like this:

But when I start rendering, the object comes out with plain textures, no shading of any sort:

Can anyone tell me what's wrong?

This is the link to the files and the original .obj file all included! (Google Drive)

I shall await your answers...

...please.

P.S: I use Blender render

In the Nov material tab you have to raise some diffuse and specular values, and uncheck the "use alpha" option of the NovLight ke emission texture.


How to render an image with edits based on custom input, from the command-line? I would like to write a webservice, which renders images using blender using the passed pose of the camera.
This means I need to start blender within python, pass the scene, place the camera and render an image to a file.

Does anyone have a hint where to start looking first?

Ok, so I'll attempt to answer this one. Some of it will be pseudocode, and some will be actual code.

The basic pipeline would be:

Javascript submission of camera data in the form of text variables to your web service. The syntax of this data will be up to you since you're building the web service api yourself.
Once the request has been made and received by the web service, your back end code will need to generate a Shell script command to call an instance of your blender application on the server.

Syntax would something like:

blender -b scene.blend -P pythonscript.py -o //outputpath -F PNG -x 1 -a -- camVar1 camVar2 camVar3

where

scene.blend is your scene file on the server
pythonscript.py is your launch script that will process your input
variables
everything following the "--" are raw input variables and the camVar values are written into the command from the backend code

Your pythonscript.py file will start like this:

import sys

# these variables are read backwards from the end of the shell command
camVar1 = sys.argv[-3]
camVar2 = sys.argv[-2]
camVar3 = sys.argv[-1]

See also: How to pass command line arguments to a Blender Python script?

Then in the same python script you can set the camera properties from the input variables, and render out the image to the output folder.

The web service backend would have to be monitoring the output path for the rendered image to be written, and then serve it back to the initial web request. It may not be fast enough for an immediate web response, so you may have to serve the image via a image link notification.


Why does Automatic Weights paint distant vertices? I have a face mesh with several lip bones (upper/lower left/right + corners) all parented to a head bone. There used to be eyelids and nose bones which I deleted because I thought it would help Automatic Weight paint accuracy (clearly it didn't). The upper right /lip/ bone's weights are highlighted in the below image and the bone itself is very small and around where the red weights are. Why did AW paint vertices so far away, e.g. clear into the lower AND upper eyelids??? Is there some way to limit how far away from the bone AW paints?
The only related question I could find mentions needing to fix origins and apply rotations/scales/etc. That didn't help my issue, and I'm not sure where origins should ideally be placed. I don't know how to use the Vertex Proximity modifier.
File:

I finally have a theory. I believe you may be gettting a bone heat weighting error. That happens when you try to bind a mesh to an armature when the mesh is made out of too many different or intersecting parts, and Blender can't figure out how to weight the vertices. I was able to fix this by breaking up all the parts first in Edit Mode with p for the Separate menu, and then Separate by Loose Parts. Then I selected the face mesh and Shift + selected the head mesh, and joined them with Ctrl + j. Then I went into Edit Mode for this new head object and cleaned up this mesh so that the two newly joined mesh parts would be sure to have their verticies merged (Mesh > Cleanup > Merge By Distance). After that, I was able to do the normal binding operation by selecting this new version of the head mesh in Object Mode, Shift + selecting the armature, then Ctrl + p to parent it, and choose Automatic Weights. There were no issues with distant vertices getting bound to the armature.
I recommend that the entire mesh to be bound to the armature is a single, continuous mesh with no other, distinctly separate objects having been prior joined to it. Just as importantly, you should make sure that no other mesh parts are physically colliding or intersecting the mesh anywhere. When they intersect, or are joined together, and then you try to start a binding operation, this issue arises. Your model has eye objects intersecting with one another, and also intersecting with your face. Your face and head have intersecting geometry around the lobe of the ears also. This isn't clean modeling and you don't want it.
When you clean up your model so that all parts are separate (not joined together) and not intersecting one another (not colliding), you will be able to bind those mesh parts to the armature without any problems.


How do I escape from the cancel status? I accidentally entered this mode, I don't know even that this is a mode or something. Anyway, I'm in the situation like below:

Even though I'm in the rendered mode, nothing is rendered. How can I fix that? I've googled with several keywords but couldn't find yet...

I think this is somewhat related to this question. I solved this by restarting the blender in the end...


How can I apply these textures to my model? I bought a model (terrain model) that comes with these textures, but I don't know how to configure the nodes to apply the textures to the model (especially the mask texture).

First of all you should change the Color Space of the Height texture to "Non-Color" since you only have to use it to give height information for the material; basically black means "no height here", while white means "yes we have height here" and all the grey values in between mean "we have some degree of height here".
I don't think you need the mask map since it's not used on models but for mixing other materials usually.
The mix shader is useless in this case because you only have one shader (Diffuse).
Be sure to play with the Strentgh value of your bump node, 1 is usually too much so I'm pretty sure you wanna lower it.
If you have some other texture like specular and roughness you should substitute the diffuse node with a Principled BSDF so that you can connect them in the proper channel, they have to be set to "Non-Color" too by the way since,  like the height map, they don't give color information.
In the end you should have something like the image below, notice the Specular and Roughness channel on the Principled node.

I hope my answer helps you, if you have have questions feel free to ask.


What is the plugin that allows you to have a circular GUI for selection? As seen here https://youtu.be/joq0xWyZoU4?t=1m3s

He works really fast so I couldn't clip a screenshot, but its the circular pattern of buttons that pop up around your cursor. What is the name of the plugin or setting that this makes this happen?

The plugin I was thinking of is Pie Menus, thanks to @batFinger for the answer.


Where can I find the Add node? Can somebody please team me where I can find the Blue topped ADD node
it's driving me mad....
I was following a tutorial by Blender guru and he showed a node tree
of a glass hack. cannot recreate it as I cannot locate the node

Many thanks

The blue Add node is a math node. Search Math, click on the result, and this will pop up.


How to smooth transition between two parts of the object How to smooth transition between two parts of the object?

No idea what to do to make it look smooth after subdiv

I would try using the 'Intersect' or 'Union' modes for the Boolean modifier. Add it to either part of your model and select the other part in the "Object:" box.


Blender using my CPU instead of GPU even though all settings are set to GPU I have a problem where no matter what I do Blender utilizes my CPU instead of my selected GPU.
I have a fairly older CPU and a much stronger newer GPU - RTX 2060, that's why I want to utilize it.
I tried everything but I can not find the solution.
I am using Blender 2.92
I enabled CUDA ( Also tried OptiX - did not work) in my preferences, checked the compatibility and selected my GPU.
Cycles is selected with GPU compute
I tried reinstalling blender several time with no change.
No matter what I change whenever I try to render a liquid simulation for example, my CPU usage is 100% and my GPU is 0%.
I have no idea what else to do.
EDIT 1:
Checked again in task manager specifically CUDA and not general GPU and it remains at 0%
EDIT 2:
Problem was, I'm just stupid and did not realise you exclusively use CPU for physics.

It might be that you looking the performance of integrated gpu, that's why it shows 0%.
In task manager make sure you are looking the stats of your dedicated gpu.
Also change graph to cuda


Blender 2.78a crashes when setting up IK system Okay, this has wasted fifteen minutes of my entire life.

I'm using Blender 2.78a with a Windows 32-bit OS. I was just following a character creation tutorial in Youtube
and I made it till the end of setting up the bones. I added a bone constraints (IK) to my character's leg bone, and tried to set the Bone field to the IK bone I just created a while ago. Just when I select the bone, Blender crashes.

I tried doing this over and over again and luckily, Blender didn't crash one time. But when I try to grab or rotate the IK bone that controls the leg bone, Blender crashes again. Now every time I try to open the blender file in Blender's splash screen, Blender crashes.

I managed to get this screenshot luckily one time :

There's this other screenshot :

Someone PLEASE help me! I can'r proceed with 3D modelling if I don't fix this error (or maybe if I buy Win64). Thanks :)

P.S.

Mind my spelling of Character in the splash screen - I saved it in a hurry :)

Blender shouldn't crash if you do something like this, so this is possibly a bug. Please try a recent daily build from the buildbot to see if it has already been fixed. If not, please report it at our bug tracker.


Trouble enabling Cube surfer addon Every time I have tried to enable the Cube Surfer addon but this error message comes up.
FYI I have the correct versions of everything.

I have had this problem with some other add ons as well. Sometimes it's when I have tried to click a button in an addon (after 'successfully' installing)

Technically this is off-topic for blender.stackexchange but I expect several people will be interested and have trouble getting this addon working so I will add this info here.

Cube surfer is written in cython not python. The cython project is a kind of hybrid between C code and python code. You need to convert the .pyx file in CubeSurfer to a c file then compile it into a shared library. You will need to install cython and a compiler if you don't have them already.

There is a setup64.py to build it included with CubeSurfer, it is only setup for windows, for other platforms you will need to make some changes.

If you have trouble building this you will need to ask for help on irc or stack.overflow or the CubeSurfer developer

It could be possible that builders may offer this addon pre-compiled with graphicall builds - there don't appear to be any yet.


How can I group into one layer all similar items? I'd like to get all of my spheres (x.003, x.004, x.005, etc...) into a group called "Sphere" (the first one in the list).

Something like that:

Cylinder
 Cylinder.001
Sphere
 Sphere.001
 Sphere.002
 Sphere.003
 Sphere.004
 Sphere.005

Can someone explain me how to order them?

If i understood the question here the answer
If you have made the single sphere as a group ok

Select the 1st sphere and hold shift and select other spheres and group.

To find group go to outliner > drop down menu select group

Unlink group the old group (i.e. made before with 1 sphere). Right click on the old group and click unlink group


Baking normal maps in blender: "Error: No objects or images found to bake to" This happens pretty much every time I try to bake normal maps. It's quite a broad error message and I still don't know exactly what the problems I'm having are, only that if I keep clicking things for half an hour eventually it sometimes just works.

My understanding of the things needed:

A "Generated" blender Image that the normals are written to (In UV/Image Editor, click Image->New)

Tell blender that this is the bake output, below (this is the really confusing bit which blender seems to try to guess and fails)

A UV Map for the low poly model (you only need the geometry of the high poly and it doesn't need a UV map)
Under Bake, in the rendering tab:

Bake Mode = Normals
Normal Space = Tangent
Selected to Active = ✓ (for the next bit)

Select the high rez object first, then the low poly object
With the two objects selected, click Bake (you may have to move the mouse to see the error pops up)

Now, from what I can tell the only difference between cycles and blender render (with regard to the setup and apart from the internals of baking) is how blender finds the output image:

Cycles

Have a material using an ImageTexture node which points to your normal map output. Then this answer says the node must be selected, but this doesn't mention selecting.
Blender Render

Have a texture attached to the material that uses the image. This tutorial is pretty vague on assigning the output image. Sometimes I've found hitting tab to go to edit mode and selecting the normal map image in the UV editor to help, or at least it seemed to.

I would like to know the exact details of what blender goes looking for when you hit Bake, rather than have to guess by following tutorials. For example, it seems to look for the high and low poly objects in your selection and based off the order you select them. How does it find the normal map/image to write to for both cycles and blender render? Does the Texture need to Influence Normals or does it just need to reference the Image? etc...

Cycles
Cycles bakes to the last selected image texture node in the object's material. Note that the node doesn't need to be connected to anything.
Blender Internal
This one is a bit confusing and non intuitive. You are mostly correct, you must assign all the faces to the texture as a Face texture.
This is done by selecting the target image in the UV image editor while all faces are selected in edit mode.


Can't render spot light with texture I am trying to render a scene with a spot light and a texture attached to it. Rendering works fine with the Blender renderer. With either cycles or Mitsuba renderers the texture is not rendered.

Any ideas?

Thanks

-Arrigo

You probably need to set up a new cycles material for the spotlight. Blender Internal and Cycles use different shaders/materials for objects and lamps.


2 related(?) questions: How to scale or extrude multiple selections together? I have seemingly related questions with gif examples provided below.

Context: In Edit Mode, when I select multiple faces or edges, if I try to scale or extrude them, the resulting behavior is unintuitive based on my expectations. I can't really figure out (a) why Blender is behaving in the manner it is, and (b) how to accomplish my goals quickly. To illustrate, I'll share two examples:

(1) Goal: In Edit Mode, my goal is to Scale two edge loops so that they both Scale evenly together outward.

Expected Behavior: When I select two edge loops and press "S", I want them to scale evenly together outward, just like when I scale one edge loop.

Actual Behavior: When I select two edge loops and press "S", the loops begin to slide along the mesh object.

Questions: Why is it scaling in this manner? Any suggestions for a quick workflow to achieve my goal?

(2) Goal: In Edit Mode, my goal is to Extrude two separate faces so that they both Extrude evenly together outward -- in this case, the "top" face should extrude increasingly positive on Z axis, and the "bottom" face should increase increasingly negative on Z axis, evenly together.

Expected Behavior: In Edit Mode, when I select two faces and press "E", the two faces should extrude outwards evenly (in this case, in opposite axis directions), just like when I select only one face it extrudes.

Actual Behavior: In Edit Mode, when I select two faces and press "E", the faces begin to slide in unison along what looks to be the X axis.

Questions: Why is it extruding in this manner? Any suggestions for a quick workflow to achieve my goal?

Thanks so much in advance for your assistance!

In Blender, you can change the behavior of these operations like extrude and scale to suite your needs by setting the Pivot Point. The select menu is located in the bottom bar in 3D view.

In your case, you need to extrude or scale selected loops / faces individualy, so you need to select the Pivot Point to Individual Origins:

You can also use the shortcut Ctrl. for that.
For switching back to Bounding Box Center, use ,

The result - scale:

Extrude


Blender destroys sculpt whenever saving I've been working on this sculpt for over two hours now and all I am doing right now is I have disabled DynTopo to move the mouth a bit more inwards. It works like a charm. After that I hit ctrl+S to save. Then it suddenly reverts to the state before I have moved the mouth inwards and when I hit ctrl+Z that abomination happens you see in the second screenshot. A bit help in that would be highly appreciated, I would hate to loose the work. If I Ctrl-Z further the artifacts just keep getting worse.

Go to edit > preferences.
on interface tab find and enable "developer extras"
now go to experimental tab and enable undo legacy

your undoes will become slower but more accurate.
consider sending a bug report.
Here is how:
https://wiki.blender.org/wiki/Process/Bug_Reports


Unable to separate by loose parts I am unable to separate all the loose parts of an object which I combined from several objects.

After combining all the objects, I removed doubles.

Now I want to separate the parts again to do some additional editing.

I used the following steps to try to separate the parts

selected the object
tabbed into edit mode
clicked p
clicked on "By loose Parts"
tabbed back into object mode
unselected everything with A
clicked on part I wanted to edit and noticed two other parts  were still connected.

I repeated the process of separating by loose parts, but they will not separate.

How can I disconnect the two side panels?

I have highlighted the faces/vertices, I think might be causing the problem.  When the file is opened they should be visible.  At this stage all the components of the arm assembly are joined.  When separated by loose parts the two side panels stay joined to the main arm.

Is it possible the problem occurs because I extruded the highlighted parts through the two side panels without cutting a hole in them first?

Thank you in advance for any suggestions you may have to help me solve this issue.

Well it's been about a week and with no real help here, I tinkered and finally came up with a solution.  Deleting the connecting vertices between the side panels and the arm.  There were two cylinders I had extruded from the arm through the side panels, which caused the problem.

You can test yourself by using the sample file I uploaded here at moonboots  request

tab into object mode
select object
tab into edit mode
select all faces
click P and select "by loose parts"
tab back to object mode
deselect all
select long arm and notice side panels are still connected
tab into edit mode
using faces select mode, press Alt and LMB to select all faces of first cylinder in the center of the arm.
press Shift-Alt-LMB and select all center faces of 2nd cylinder
press delete button and select vertices
tab into object mode and deselect all
verify side panels have been separated from arm by selecting each item

I now just had a few missing faces that needed to be filled in, but I preserved the location and size of all the pieces so they would fit in the model.  Also I was able to finish the editing I needed to do, to prepare my model for 3D printing.  You can verify how the assembly fits into the total model by clicking on the eye icon next to "frame" in the outliner.


Why does Blender not update the screen properly, despite not lagging? Whenever I do something (for example use the mouse wheel to zoom in or out) I need to press another key for my initial action to be recorded and updated. It is really frustrating and I can not work like this, being an absolute beginner with 3D modeling and animations.

Does anyone know how to fix this?

My guess would be that you are looking for the "Release Confirms" option in the "Editing" tab of the "User Preferences" window.


Trouble selecting the objects when i try to select a house or the walls or any object that i have made it just doesn't get selected until i click exactly in the middle. it's so annoying because i have to click few times to select the object that i want.  i opened a new project and it works just fine anywhere i click on the object it gets selected. but in my main project file it just doesn't work. maybe i turned on something? i don't know

You can change the selection style by left clicking on the select mode for several seconds and a selection mode menu will appear.  But this may not be the issue you're encountering...


Superimposing architectural models onto street photographs I wanted to use 3D MAX to create architectural renders, but I have a Mac, so I am looking into Blender as an alternative solution.

The models look amazing and the rendering is fab, but I am struggling to find a tutorial to help me superimpose my model onto the photograph of a street or equivalent. I have to supply images of the model in situ, so I am really hoping there is a way. Please can someone help me?

Thank you

If you want to place your models so they look like they are part of a photograph, you should be looking for VFX (video effects) tutorials.
CG Geek has a few on YouTube, where he adds objects to video footage, but the same techniques apply for still photographs.
Blender Guru has some too.  Try searching for "How to render onto a photo background" on his website.


Anvil, extra lines thingies As you can see at the bottom of the anvil are a little bit more shape down there, I am sorry I forget what you call them, but if some one could help me and get rid of them, that would be nice.

(Left)

If you have a bottom face which is a large Ngon with a concave edge, Catmull-Clark subdivision will cut the corner,even if the face has holding loops on its perimeter.

(Right)

You need to give the subdivision convex faces to work with, preferably quads. I seem to remember Andrew's Anvil does it like this.


Colours disappear when exporting to Blend4Web I am a beginner with Blender. When I export the blender file to Blender4web file all colours are gone.

The problem is that your .blend is using .tga and .tif files, which are not supported in Blend4Web (since they are not web-friendly formats).

If you convert these to .png (or .jpg where lossy is acceptable) you should be fine. This will also cut your file sizes down drastically and probably even improve your Viewport performance within Blender. Remember that since your delivery platform is a web browser, smaller and lower-res images are better whenever possible.

Another issue I noticed (unrelated to images) is that you'll need to either scale down your model or increase the clipping distance.


Unable to edit individual objects made by the Array modifier I created an object and multiplied it with an Array Modifier, but the problem is:

X - original object

X X1 X2 X3 X4 X5 ... Xn - final object (array size = n)

I'm only able to edit X, and if I do, all the others Xn will change as well.
How can I reverse this? If i want to edit only, for example, X4 face or vertex.

This is intended functionality - it is supposed to work like that. An array modifier makes an array of a single object so if you change that object, all the array is supposed to change as well.

You can apply the modifier and edit the generated geometry as you wish or if you wish to have multiple objects you can duplicate them with Shift+d. If you perform the transforms with the duplicate operator(move or scale or rotate the object right after pressing Shift+d before confirming it) you can then repeat the action with Shift+r to make an array quickly.

I assume that by 'edit' you mean going into edit mode and changing the geometry. You can still influence, deform or even change the geometry of parts of the object that is generated with the Array modifier by using other modifiers without editing the actual original object:


How do I correct my curve deformed array? I want to join the ends I have fiddled with the numbers on the array modifier's relative offset options but cant seem to make the ends fit together.

I have also tried fiddling with the curve shape.

You may scale the curve (S) holding Shift button to precisely close the object's ends.

You can also select the curve, go to curve data header and check the Stretch and Bounds Clamp checkboxes located in the Shape panel.


How can I use weight painting correctly in Blender? Before when I was weight painting, I noticed that after changing the weight of a bone some other bones would be dramatically changed as well. When I try to undo the unexpected weights the whole mesh becomes broken. Now, when I try to subtract the weight, instead of subtracting it adds. Can someone please help me? I've been spending hours on this!

This is my blend file:
http://pasteall.org/blend/index.php?id=50825

The reason why you have this issue is that you have Auto Normalize enabled:

Either try to understand how to work with it (because it's honestly useful), either disable it.


Hide mesh light source but keep the light it EMITS using EEVEE? I've made a mesh that has an emission shader and I'd like to hide the mesh but keep the light that it emits. Is it possible? I know it's possible in cycles. But I wish to know about EEVEE.
I've tried using the 'hide from render' ( in the outliner ) button but it doesn't work.

You can do it with a shader like this - This will exclude the object from visibility, but will allow the cast lights and shadows to operate. However, since you are using an emission object to cast your "light", you will need to bake the lighting from it using an Irradiance Volume, before it will show up in the render. Also - remember to set the Blend Mode to Aplha Clip.

To get the full effect, make sure to enable "bloom" in Render Properties.


How can I remove natural gaps on a 3D model with Blender before printing? I have a 3D dental model that I will use in an academic study. On this model, there are some small gaps marked by the yellow arrows on the figure. These gaps are the natural areas between the teeth and gum. However, I cannot print the model with these gaps. Can I automatically turn off these gaps with Blender?

You could select all objects in edit mode, press space to search, and type in "Fill Holes". It depends on the model how clean the fill will be, but it might be printable then. The best way would be to go into edit mode and select inner and outer edge ring of each tooth with "alt clicking" and use "bridge edge loops" (when searching with space bar).


Need help to recreate a metal material with multiple colors This is the reference I would like to recreate:

Would be great if someone had an idea how to do it.

I tried something, more complex than I expected. The mesh is not flat, a bit deformed (large area proportional edited vertices, very low distance)

Basic scratch texture form CGTextures.com, not reworked, not tilabled.
Lights are a pain, could use a ref to get something decent. It looks like something is throwing light (ground reflection?) on the seats shadows.
I think the Blue/green colors are due to the use of acid on copper, could be textured.


Why does a UV Map cover the entire model? Briefly, I have done extensive research with tutorials etc regarding a problem I am experiencing and it is my hope that perhaps someone could allow some insight!
I am successfully utilizing projection painting of an image to a model's head, however, upon exporting the model and observing through a web page the uv map covers the entire model rather than just the head area. which has remained the selected in edit mode. The uv map only suggests the head area which is continually repeated over the entire model even after attempting to deselect "Repeat" in image mapping which I changed to "Clip".

Move the vertices you would like to ignore off the UV Map ... to some side.  Use this in combination with Clip.


How do I fix my tree leaves turning black when I increase their number? I've been working on this tree, following a tutorial on YouTube, and performing every detail in the video.

Everything has been looking alright except for my particle system which I have set up for my leaves which are a png I made with photoshop and taking a picture of tree leaves outside.

Now in this particle system, if I set the number of emitted particles to higher than 100, all heck breaks loose. If the number is under 100, it looks perfect, but looks like a dying tree as I lose many leaves. That is cool and all, but I also want a live looking tree. Whenever I set this number above 100 like 200 or 500, I get these giant black lumps that seem to disappear when I try to zoom in and inspect them.

I didn't seem to have this problem before when I used a different leaf png, but I really like this one I made and it is the one I need for the tree.

I've inspected the png and I can't seem to find anything wrong with it. I even erased the stems thinking maybe they were too numerous and caused the black masses, but to no avail. I even flipped the leaf plane normal thinking maybe it's a simple thing, but still no fix.

Here is an image that explains the problem. On the left is the tree with a low emission or number of leaves, on the right is the tree with a lot of leaves where the blackness becomes a problem.

Your problem is likely caused by too many transparent objects being stacked in front of each other. Cycles' rays will just try to cross a fixed amount of layers before giving up and rendering black.

You can increase this "fixed amount":

→ In the Render settings for Cycles, under Light Paths, increase the value for the Transparency bounces until the problem goes away.


BGE Record gameplay? Is there any way to simply record the gameplay within BGE? Im not using animation, I just want to record myself moving the camera around.

Yes, there is a Record Animation function:

https://docs.blender.org/manual/en/dev/game_engine/physics/introduction.html


"Legacy WGL is unable to select between OpenGL versions" error Is there a chance of fixing this? (the autodesk maya was working fine and I want to try this program, could someone help me with this?)

I reported this as a bug (I actually asked the same question Warning! Legacy WGL is unable to select between different OpenGL versions) and this is what the blender developer site said:

"Your GPU is too old. You may be able to still use it if you update your drivers."

The bug report is available here.


How do I prevent rigid body objects from falling down before they are hit? I have done BlenderGuru's Quick Rigid Body Fun on Rigid Body Collisions.

Regarding this .blend file:

When you play the animation, the cubes start falling down long before they are hit by the wrecking ball. This is because of gravity and because there is some space between the cubes. How can you prevent the cubes falling down or at least arrange that the cubes don't fall down before they are hit by the wrecking ball?

P.S Blender Guru says it is necessary to have some space between the cubes because if there is no space the wall will explode. I have here another .blend file...

...where there is no space between the cubes, so I don't think he is right. But the stones don't behave like there is a wall .... hmmmm ???

The simplest answer to this is to apply transforms to all of the cubes. Ctrl+A>Scale and then in the physics panel, enable deactivation and start deactivated for all cubes so that the simulation does not take over the objects until they interact. Just enable the option for one, then choose copy from active in the Tool shelf with all cubes selected.


Wierd shading when cutting faces I'm a blender newbie. I'm trying to build an helmet, and I've got to the point where I have to cut the global object I've built so far to get the visor.

After creating the bulk shape (basically a half sphere on top of a cylinder), I've selected the knife tool and started cutting and everything seemed fine, until I reached this point.

Here, the shading is weird:

I thought maybe was just something with the calculation of the new normals so I used Tools > Shading: Smooth and now the weird "box", the most visible problem, is gone. That line on the upper side, however, remains.

How can I fix this? Is there something I can do or is related to something I did/didn't do when I cut the faces to get the visor shape?

Thanks!

Shading issues most commonly occur because of the presence of non-quad geometry (especially near edges).

As can be seen in your picture, the "quads" surrounding your highlighted section have more than 4 vertices apiece. This is as a result of your use of the knife tool. There are a myriad of methods you can employ to "correct" the geometry (often this involves moving unavoidable n-gons to flat sections to avoid shading issues), but could also involve simply extending the new edges all the way around the mesh - it all depends on how "clean" and "orderly" you need the final mesh to be.

A second reason for shading issues (and what seems to also be the case here) is a case of supporting geometry. Generally, supporting geometry is used to sharpen the appearance of edges,however, it can have the side effect of causing "ugly creases" to appear (especially on curved surfaces) when there is uneven spacing between edges or edge loops. If two edges on a curved surface are too close together, they will highlight the "crease" between two flat faces that are being shaded to appear smooth.

I suggest you spend a bit of time practicing some simple topology exercises, just to get a feel for the "rules" so to speak, as well as what you can and can't get away with without causing shading issues.

Best of luck.


Use an object change to trigger Python script So I'm fairly new to the Blender API, and I have a script that needs to be run every time the 3D cursor is moved. I can get the current location with bpy.context.scene.cursor_location, but that's only usable from the script itself.

Can this be used to trigger my script?

A quick and dirty solution would be to use a scene_update_post handler.

Event handler access in Blender.

import bpy
def my_handler(scene):
    cursorLoc = bpy.context.scene.cursor_location
    # do something
    print(cursorLoc)

bpy.app.handlers.scene_update_post.append(my_handler)

Run the script once, then your function will be called as soon as the scene updates.

This is highly inefficient and will affect the performance depending on the design of the script. It provides an easy solution though and Blender was always fast enough for me to not notice a difference.


Removing overlapping objects, made with particles I have some "bricks" that I put on an object with the particle system, but many of them are overlapping.
I could use "random size" in the particle menu, but i want to keep the bricks somewhat uniform size.

Is there a way to avoid this with any of the options in the particle menu? Or, maybe after converting the particles to meshes, would it be possible to remove the overlapping ones ?

It is a static scene, no physics are involved.

go to emit from tab in particle system settings (you have to have the advanced checked), there you should have selected faces by default (if you didn't change it), then select one in particles/face.
Before:

After:

Faces:

If this doesn't work for you (you have too small faces or something) you can convert the particle system (mdifiers - particle system - convert) and then delete the overlapping bricks.


Is there any way to have a projection without size changing? Blender implements an othogonal projection so the further is an object, the smallest it is. In my case, I would like to get a plane (x-z p.e.) where the feel of depth is lost so if 2 objects have the same size, no matter how far they are between each other that they are going to be seen as of the same size, even if one is centered in the image and the other one is far away. Is it possible to do this?

I think you need to switch your camera lens to Orthographic:

You can get the same effect for your 3D view (not a camera) by pressing 5 on Numpad.


Can I bake light from Nishita Sky Texture? I want to bake the light from a Nishita Sky Texture to a model in Blender 2.9.
I thought it was possible, but now I can't manage to do it. I have Nishita set up as the sky in Cycles (obviously) but it won't bake on to the models.
Trying again with a simple scene below (even added a new Img Text to Bake in shader): NADA

The bake is working correctly.
But if you are using flat sides (i.e. base cube with an open face), each side of the faces are baked and that makes conflicts.
Above in the picture, I have solidified that volume and unwrapped it.
I've used no other particular settings. Here is the file:


Is it possible to create a particle system which uses collection of objects or merge a collection into 1 object? I have a collection which contains 5 leaf objects and 1 carrot object, is it possible to merge it in one object or just use a collection for a particle system?

Solved my problem.

Create new particle system -> Render -> Render As -> Collection


UV map quality decreases after importing wavefront object that is exported as obj before I have a blender model and the mtl folder that I found before:

blender file link: https://drive.google.com/open?id=0BxFdejPeV4z3WEpMTVJGTDRsLXM

I am opening blender file and adding uv map files by selecting File-> External Data -> Find missing files  and selecting "mtl_files" folder (I also added mtl file from google drive : https://drive.google.com/open?id=0BxFdejPeV4z3el80Y1djazRTX3M)

After adding mtl and uv map files it seems like this:

After that I am trying to export this file as wavefront with only this 6 options marked (File -> Export -> Wavefront):

Lastly I imported the obj file that I exported before and its uv map quality decreases a lot (if it cannot find the mtl path I am selecting the File-> External Data-> Find missing files and selecting mtl_files folder again), and it seems like that:

I have no any idea why this happens, I am doing the same process with a spider man model and it just works fine.

I solved my problem by enabling "normal map" from texture tab of properties. After I enabled this option, everthing seemed normal again (Properties tab-> Texture tab -> Show material textures -> select the normal -> mage sampling -> Enable Normal Map ).


Why is the boolean modifier not working with my model? I want to cut the hole with the boolean modifier but it's not working. Anyone have any ideas why?

Also, how can I trim a part from the model.

Here is my blend file:

It's a common problem with Boolean operation in blender; it won't work if there's incomplete or bad geometry. The problem is, the boolean is a prime culprit for CREATING the bad geometry.

Ensure your meshes have no loose geometry, remove doubles and dissolve messy faces/unnecessary vertices. Really inspect both objects before using Booleans.

By turning on surface normal lines you can spot weird geometry a little easier, if the line isn't quite centred, something is probably wrong.

I've heard that combining the Boolean modify with a solidify modifier creates better geometry.

I've highlighted the areas of concern - there's probably more.
Lots of unnecessary vertices.
Two faces ontop of each other (pairs of blue lines)
Face normal pointing out across the surface from the vertices.

And inside the oval, you've got some faces that don't have normals, so they're a bit bonkers.. See second picture.

Everything should be neat shapes, quads or triangles preferably.

I feel for you, it's not nice when it happens.

Apart from manually dissolving bad faces, snapping unwanted vertices to existing vertices and then 'removing doubles', this post explains some of the problems with non-manifold geometry.


Why won't the boolean modifier work properly? I want to cut out the "cylinder" inside this shape I made to create a coffee cup, but after choosing Difference as the operation and the cylinder as the object, all I'm left with is the cylinder.

The outer shape was originally made using several connected bezier curves, closing the shape and then converting it to mesh using Alt+C in object mode.
I have tried removing doubles as a means of resolving this issue (as suggested on other questions) on both objects, but it always says 0 vertices removed.

P.S: I am not very experienced with blender, so excuse my noob-ness.

EDIT:

It will be rather hard using Boolean in this case because there are a lot of self-intersecting parts in the mesh and modifier won't give expected results just after it's added; additional complexity is provided by form of the mesh.
It's possible to cut through it without using Boolean modifier, however form of the cup which should be cut out won't be taken into account.

Knife Project

To cut through this mesh use Knife Project tool. For details see How would you cut a shape out of an object using another object

Enter Edit mode of the cup's design, select its bottom, and separate it by selection (P > By Selection). The bottom part shouldn't be cut through. If skipping this step the hole will be all through the mesh.

Enter Edit mode for cylinder and delete everything but the top face.
In Object mode select ex-cylinder (now that Ngon), then select design of the cup, press Numpad 7 to enter Top View.

Enter Edit mode of the highpoly cup and on the Toolshelf panel (T in 3D View) find Knife Project. After executing in the operator's options check Cut Through. This is done to make tool to cut through all mesh, not just what is seen from the current view.

If the inner part of the mesh shouldn't be filled with loops, then it's ready (you can recreate the cylinder and join it to "hide" the inner geometry). If this open geometry is undesired then you should manually select parts of loops and use Bridge Edge Loops, like this:

Boolean

It is possible to cut the cylinder out using modifier, though it's much more complex. It didn't work before because of self-intersections in the mesh; thus you should get rid of them.

To do that, in Edit mode select all and press Ctrl+F > Intersect. Make sure in operator's options check Self-Intersect. It's a kind of Boolean but in Edit mode.

It made all intersected parts to be cut by each other. The only (easy one) thing left is to delete those parts which were cut.
Example of such selecting these "self-intersecting" parts is shown below:

Note that this is not the only part you should select in order to make Boolean work right afterwards. This is quite time-consuming process so prepare to use some selecting tools like Loop Select, Select Loop-Inner Region and so on.
Once these parts are deleted select all and access Mesh > Clean-Up > Delete Loose, and (there too) Degenerate Dissolve.
Note:  removing doubles will delete supporting vertices around intersecting parts, so shading and form of mesh can be corrupted.

Still the resulting mesh seems to cause Blender not responding sometimes, so it may be unnecessary complex and heavy. It's worth using 1-st way, leave some parts of geometry and hide them with cylinder of the cup itself.
You can take a look at the file if it meets your needs.