Help with being unable to select a specific object I have four objects (planes) that I have worked on, and I applied image textures, etc., and they display OK in the wireframe/solid/render views, but for some reason I now can't select them, and they aren't even showing in the outliner at all (they still show if I hide all the items in the outliner).

Any ideas? Is it something dumb that I've clicked?

I am using Blender 2.76b.

The object could be inhibited from selection (arrow icon disabled in the outliner), but maybe currently outliner is also set to show only other scenes, or object types (ie: outliner is not set to "All scenes") so you don't see it, atm.


How can I translate vertex coordinates relative to the 3d cursor's coordinates? When I move a vertex by entering the coordinates in the transform (N-key) it moves relative to (0, 0, 0) in world coordinates regardless if I have "Local" or "Global" active. But I wish to make the 3d cursor's location the (0, 0, 0) origin if that is possible.

You can position the 3D cursor and then with the object selected, use Object > Set Origin > Origin to 3D Cursor. When you use Local in the Transform panel it will now move relative to the position you've set with your 3D cursor. Local is always relative to the object's origin, which is indicated by an orange dot when the object is selected in object mode.


Weird artifacts in my UV mapped texture Any ideas what's causing those chunks of geometric artifacts?  Argh.

Remove doubles in the mesh

What happens in your mesh now is  Z-fighting. Notice the clipping while rotating view around the barrel:

While in Edit mode select all and press W > Remove Doubles. It will delete ~800 double vertices.

After that you can split normals either by adding Edge Split modifier or activating Auto Smooth in Object Data tab.

Also see:

Overlapping faces:

Cause of black artifacts in render?

Overlapping faces in mirror modifier causing z-fighting

Edge Split modifier vs. Auto Smooth:

How to smooth shade an object while retaining hard edges?


How do I create a star extrusion to circle? Can anyone help me create a star extrusion to circle?

First of all, your Circle should have the same amount of vertices as your Star (or it can have more but then it will be more complicated).

Also you can add Circle in Object Mode and join (Ctrl+J) it with Star or you can just add Circle while being in Star Edit Mode.

Then select both shapes (outer edges) and press CtrlE > Bridge Edge Loops.

After that you will want to select all and Recalculate Normals - CtrlN.


Interchanging characters within the same scene Will I be able to create an image with a static setting(a playground for example) and then be able to interchange different characters into the picture without having to recreate the entire setting?

Also will I be able to change features on a character (e.g. hair) without having to recreate the entire character?

Yes. You can control these sorts of things in many ways. You can use layers, showing and hiding objects, combining meshes into different objects, and of course Linking models from different files. It is a very broad area.


Get Blender files to save with a thumbnail preview? Is there a way to have Blender save a preview of the scene for use as the file-system thumbnail preview? It would make it much easier to review old files.

To clarify, I would like to see the preview image in Finder, like normal image files.

EDIT

Mac OS X Mavericks, Blender 2.77

I have Preferences > File > Show Thumbnails & Save Preview Images check marked.

EDIT

I understand that there is a python script that extracts a thumbnail, but it does not meet my needs:

Doesn't apply the thumbnail as the icon on Mac OS for me.
Isn't generated on save / doesn't update.
The batch script requires the .blend files to be in the same directory; my files are all over.

Unless I'm using the script wrong, it's not really what I want.

Kinda Late but here's what I found...

I ran into this post about 4 months ago with the same problem you had, after some googling and some realization that this was not currently possible I decided to change my direction of googling.
With the little knowledge of Xcode and Obj-C I had I decided to attempt to slap this together...

Please note:
It's not as err "optimized" as a well seasoned coder may make it, but it's enough to do the job.
So far I have had pretty good luck with it and I hope you fellows do to
Also I've found that the thumbnails that blender makes are low-quality, so its not as pretty as I hoped it would be.
And lastly i've noticed that it does not allways succeed in creating icons for the desktop (odd).

Installation
It's quite easy, download the QuickLookViewer here and move it to either ~/Library/Quicklook or /Library/Quicklook if the folder Quicklook does not exist there feel free to create it. Please notice that the one location is local in your account and the other is global on the whole computer.
Next you need to update the Quicklook engine...
Either log out and log back in (the hard solution I might add).
Or simply type the following in Terminal and hit the return key
qlmanage -r

This will force the ql engine to reset...
last of all cheers and good luck!
I guess this is my contribution to the Blender project for now! (until they implement it later cause they should)


What does the "Camera Clip" checkbox do in the "Background Images", "Movie Clip" tab do? I have been trying to overlay graphics on a video using Blender (2.77), and part of that is setting the source movie as a background in the 3D view.  As I was setting the movie clip (and getting frustrated trying to sync the times between the timeline and the VSE), I started wondering what the "Camera Clip" checkbox does in the "Movie Clip" tab.  The tooltip says "Use Movie Clip from Active Scene Camera", but I don't know how to add a movie clip to the active scene camera except to add one as a "Background Image".

I've looked through lots of help articles and done lots of searches, but no one seems to have written a plain explanation of this checkbox.  Can anyone please provide some insight?

The Camera Clip option is referring to the active movie clip for the scene. This would normally be the clip that you are using for camera tracking.

In the scene properties you will find the setting for Active Clip. This active clip for the scene is the one referred to by the Camera Clip setting. The available clips are the clips that have been loaded into the movie clip editor for camera/object tracking.

While the same clip can be chosen in the background settings, by using the scene's active clip you can use the same setting in multiple views and change them all in one place.


Why are my Reflections colored? I've been working on a ruby material and I think is pretty good so far but it has a major error that I don't know how to fix. Every reflection on the faces of the ruby are colored and this is unrealistic as the reflections should be white.

Any help to fix this is deeply appreciated.

Glass should have no color.

If you give a glass shader a color,  you will get, as you pointed out in the question, "unrealistic" relfections. The reflections should indeed be untinted.

Here's an example:

What gives glass color mainly is the light that is absorbed as it goes through the surface.

A volume absorption node will give you a more realistic result, with "white reflections".

To understand when you should have colored highlights you can watch
 Andrew Price's video on the principled shader (https://youtu.be/4H5W6C_Mbck?t=646). The important concept is that dielectric Materials (including glass) will not have colored highlights. Reflections on metallic materials will be tinted with the color of the material.

https://physics.stackexchange.com/questions/213478/why-dont-dielectric-materials-have-coloured-reflections-like-conductors


How to remove duplicated node groups? I don't know how these duplicated node groups appeared, but I did not create them intentionally. Is there a way to remove them without breaking anything (for instance the materials that use the duplicates)? Or rather - is there a way to merge the duplicates into the original node group?

If yes, is there a way to do it with other types of datablocks, like whole materials?

It is indeed annoying when you append materials from your library file and Blender automatically creates duplicates for all node groups with the same name, even when the groups are supposed to be exactly the same.

I have created a script that eliminates these duplicates efficiently for my usage. It searches all existing node groups, materials, worlds and if finds any duplicates (ending with .001, .002, etc), it replaces them with the original group if it is found.

After running the script the eliminated node groups will have 0 users, so after you save and reopen your file, they should disappear and your group list should be clean :)

import bpy

def main():
    print("\nEliminate Node Group Duplicates:")

    #--- Search for duplicates in actual node groups
    node_groups = bpy.data.node_groups

    for group in node_groups:
        for node in group.nodes:
            if node.type == 'GROUP':
                eliminate(node)

    #--- Search for duplicates in materials
    mats = list(bpy.data.materials)
    worlds = list(bpy.data.worlds)

    for mat in mats + worlds:
        if mat.use_nodes:
            for node in mat.node_tree.nodes:
                if node.type == 'GROUP':
                    eliminate(node)

#--- Eliminate the node group duplicate with the original group if found
def eliminate(node):
    node_groups = bpy.data.node_groups

    # Get the node group name as 3-tuple (base, separator, extension)
    (base, sep, ext) = node.node_tree.name.rpartition('.')

    # Replace the numeric duplicate
    if ext.isnumeric():
        if base in node_groups:
            print("  Replace '%s' with '%s'" % (node.node_tree.name, base))
            node.node_tree.use_fake_user = False
            node.node_tree = node_groups.get(base)

#--- Execute main
main()

A variant to eliminate OSL scripts

I never used OSL scripts, but as @IPv6 have asked, I guess this should work to eliminate duplicates of OSL scripts:

import bpy

print("\nEliminate OSL Scripts:")
texts = bpy.data.texts

for mat in bpy.data.materials:
    if mat.use_nodes:
        for node in mat.node_tree.nodes:
            if node.type == 'SCRIPT':
                name = node.script.name
                (base, sep, ext) = name.rpartition('.')

                # Replace the numbered duplicate with the original if found
                if ext.isnumeric():
                    if base in texts:
                        print("  Replace '%s' with '%s'" % (name, base))

                        # Replace the script duplicate for this node
                        node.script = texts.get(base)

                        # Remove the script duplicate from bpy.data.texts ?
                        texts.get(name).user_clear()


How to extrude while obtaining better topology? I have an issue regarding the extrude operation.

If you avec a plane split in 4 face and you want to extrude each one of them in separate manner, blender will create 2 faces at the border each time. See shape 1 and 2.

Meanwhile I'm looking to get something similar to shape 3 where the topology is cleaner (now double face and less edges ).

Is there anyway to get this result in blender ?

Any help is welcome.

Here is the figure with face orientation in cas the other one isn't clear enough :

You can perform the following steps to get a clean topology with the same shape.

Select the first face and extrude downwards.

Now switch to edge select and select the other faces and the outer perimeter.

Repeat the same technique shown in the last two steps.


Maximum Object Size for Blender I am making an animation in blender than will get extremely large. Just to know the limits for when I'm working, does anyone know the maximum size of an object in blender?

Size is relative. You can have tiny objects cramped into single blender unit or large objects across hundreds of units and both would render the same size on screen.

The scale of the scene is up to you to choose, you don't have to follow the metric units.

To answer the question, the maximum absolute size is 3.402823 × 10^38 blender units, which is a limit of 32bit float.

Just be aware that there might be some computational artifacts with handling small numbers and with objects too far from scene's origin (precision limitations). These might become visible even for objects just 500 units away from origin:

Bug T43835: Strange cracks appear on model


combination of several variables in driver I am looking for a tutorial or example of a blend file showing in the drivers the combination of several variables

thanks

It's really pretty simple. You hit 'Add Variable' several times, pick the sources you want, name the variables in their top most fields more intelligently than me and then use the exact same names in the expression.

In this example, I just add the Y values of the latin gang together and drive Bombo's Y axis with them.

1.055 + 1.138 + 0.906 = 3.099


How to totally save a self-contained Blender object to ensure no data is lost? From reading questions like this, it seems that saving a .blend file does not actually save everything in it.

What settings do I need to apply so that Blender always totally saves the file every time I hit CtrlS, so that no data will be lost?

I want to be sure that any changes to textures, UV maps, etc are preserved.

I don't think there's any easy way to save everything, but the closest to what you want is to activate the automatic packing of external data.
This doesn't, however, save everything. For instance, it doesn't save the render result.

To activate this, go to File>External Data>Automatically Pack into .blend.

Video files or image sequences will not be packed.

Painted textures have to be saved as external files before they can be packed (else they will disappear).

Physics cache can be saved to disk (with different commands), but will be saved  on a folder where the original blend file is stored, but will not be packed as part of the blend file either.

For more specifics please see: https://www.blender.org/manual/data_system/data_blocks.html?highlight=pack#data-block-types


How can I get the camera's projection matrix? As asked.

I need a way to get the projection matrix of the active camera, via python.

EDIT: I think this question is different from the one asked here, because getting a matrix is different from setting the matrix.

Although, since this question was so quickly marked a duplicate, I guess the answer is the same.

With some helpful references from Campbell (ideasman42), I was able to find the relevant Blender C code that creates the perspective matrix (from properties that were actually available via bpy), and I managed to port it to Python:

def view_plane(camd, winx, winy, xasp, yasp):
    #/* fields rendering */
    ycor = yasp / xasp
    use_fields = False
    if (use_fields):
      ycor *= 2

    def BKE_camera_sensor_size(p_sensor_fit, sensor_x, sensor_y):
        #/* sensor size used to fit to. for auto, sensor_x is both x and y. */
        if (p_sensor_fit == 'VERTICAL'):
            return sensor_y;

        return sensor_x;

    if (camd.type == 'ORTHO'):
      #/* orthographic camera */
      #/* scale == 1.0 means exact 1 to 1 mapping */
      pixsize = camd.ortho_scale
    else:
      #/* perspective camera */
      sensor_size = BKE_camera_sensor_size(camd.sensor_fit, camd.sensor_width, camd.sensor_height)
      pixsize = (sensor_size * camd.clip_start) / camd.lens

    #/* determine sensor fit */
    def BKE_camera_sensor_fit(p_sensor_fit, sizex, sizey):
        if (p_sensor_fit == 'AUTO'):
            if (sizex >= sizey):
                return 'HORIZONTAL'
            else:
                return 'VERTICAL'

        return p_sensor_fit

    sensor_fit = BKE_camera_sensor_fit(camd.sensor_fit, xasp * winx, yasp * winy)

    if (sensor_fit == 'HORIZONTAL'):
      viewfac = winx
    else:
      viewfac = ycor * winy

    pixsize /= viewfac

    #/* extra zoom factor */
    pixsize *= 1 #params->zoom

    #/* compute view plane:
    # * fully centered, zbuffer fills in jittered between -.5 and +.5 */
    xmin = -0.5 * winx
    ymin = -0.5 * ycor * winy
    xmax =  0.5 * winx
    ymax =  0.5 * ycor * winy

    #/* lens shift and offset */
    dx = camd.shift_x * viewfac # + winx * params->offsetx
    dy = camd.shift_y * viewfac # + winy * params->offsety

    xmin += dx
    ymin += dy
    xmax += dx
    ymax += dy

    #/* fields offset */
    #if (params->field_second):
    #    if (params->field_odd):
    #        ymin -= 0.5 * ycor
    #        ymax -= 0.5 * ycor
    #    else:
    #        ymin += 0.5 * ycor
    #        ymax += 0.5 * ycor

    #/* the window matrix is used for clipping, and not changed during OSA steps */
    #/* using an offset of +0.5 here would give clip errors on edges */
    xmin *= pixsize
    xmax *= pixsize
    ymin *= pixsize
    ymax *= pixsize

    return xmin, xmax, ymin, ymax

def projection_matrix(camd):
    r = bpy.context.scene.render
    left, right, bottom, top = view_plane(camd, r.resolution_x, r.resolution_y, 1, 1)

    farClip, nearClip = camd.clip_end, camd.clip_start

    Xdelta = right - left
    Ydelta = top - bottom
    Zdelta = farClip - nearClip

    mat = [[0]*4 for i in range(4)]

    mat[0][0] = nearClip * 2 / Xdelta
    mat[1][1] = nearClip * 2 / Ydelta
    mat[2][0] = (right + left) / Xdelta #/* note: negate Z  */
    mat[2][1] = (top + bottom) / Ydelta
    mat[2][2] = -(farClip + nearClip) / Zdelta
    mat[2][3] = -1
    mat[3][2] = (-2 * nearClip * farClip) / Zdelta

    return sum([c for c in mat], [])

This call: projection_matrix(camera.data) will return the perspective projection matrix of the given camera object.

I don't know what the "fields" data is supposed to be, so I've set use_fields to False, and I didn't port the "fields offset" block (which you can see commented out, in view_plane function). Regardless, the resulting projection matrix seems correct, so I guess it's not all that important (for most people).


Use self and the slow python expression In putting together an answer to Changing Multiple Influences Simultaneously I came across the Slow python script warning in the drivers editor

Using a set up as outlined here driving a pose bone's constraint influence with the armature objects "prop" property

Using a traditional driver variable

And again using the use_self property of drivers. Since the drivers are on on pose bones, and the id data of a pose bone is the armature object then self.id_data is that object and self.id_data["prop"] (or self.id_data.get("prop", 0)) is the value of the custom property "prop" on that object.

However this displays the Slow Python Expression warning

What are the implications of this warning? How is it flagged?

Could be related: (possibly another question) how much of self is self... In trying to game the system with drivers tried to manipulate the self.children via a parent object driver, only to find the collection empty in the driver namespace. The method also flagged the warning

Expressions containing:

variable names: only ASCII characters.
literals: floating point and decimal integer.
globals: frame
constants: pi, True, False
operators: +, -, *, /, ==, !=, <, <=, >, >=, and, or, not,
conditional operator A if B else C
standard functions: min(), max(), radians(), degrees(), abs(), fabs(), floor(), ceil(), trunc(), round(), int(), sin(), cos(), tan(), asin(), acos(), atan(), atan2(), exp(), log(), sqrt(), pow(), fmod()
blender provided functions: lerp(), clamp(), smoothstep()

fall into Simple expression category and:

are evaluated directly, which improves performance on multi-core systems
are evaluated even when Python script execution is disabled
don't get the "Slow Python expression" flag


How to use the result of a modifier stack to create a new object? Is there a quick way to copy the result of a modifier stack to create a new object, like if you manually duplicated an object with a modifier stack and applied all the modifiers?

Note, It's possible through the Python API: How to get a new mesh with modifiers applied using Blender Python API?
But I was wondering if there's a way to do this without Python.

You can do this by converting everything to a mesh.

Object -> Convert -> To Mesh

In the operator options you may want to enable Keep Original (so as not to replace the existing objects).


How to add panel to 3D view Tool shelf in Texture Paint Mode I'm just trying to to get my addon panel to show up in the tool shelf in Texture Paint mode, but I can't figure out the correct 'bl_' combination to make it work.

I use this

bl_<prop>      | allowed
---------------+-------------------------------------------------------------
bl_space_type  | 'CLIP_EDITOR', 'CONSOLE', 'DOPESHEET_EDITOR', 'EMPTY',
               | 'FILE_BROWSER', 'GRAPH_EDITOR', 'IMAGE_EDITOR', 'INFO',
               | 'LOGIC_EDITOR', 'NLA_EDITOR', 'NODE_EDITOR', 'OUTLINER',
               | 'PROPERTIES', 'SEQUENCE_EDITOR', 'TEXT_EDITOR', 'TIMELINE',
               | 'USER_PREFERENCES', 'VIEW_3D'
---------------+-------------------------------------------------------------
bl_region_type | 'CHANNELS', 'HEADER', 'PREVIEW', 'TEMPORARY', 'TOOLS',
               | 'TOOL_PROPS', 'UI', 'WINDOW'
---------------+-------------------------------------------------------------
bl_context     | 'armature_edit', 'curve_edit', 'imagepaint', 'lattice_edit',
               | 'mball_edit', 'mesh_edit', 'objectmode', 'particlemode',
               | 'posemode', 'sculpt_mode', 'surface_edit', 'text_edit',
               | 'vertexpaint', 'weightpaint'

So for you I think it's:

bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_context = "imagepaint"


How to get material parameter by name, and check if texture is assigned to parameter I'm writing a exporter, and I have most of it already working, the missing piece now is to export the texture maps properly. I'm having trouble understanding how I can fetch those with python.

I have written custom nodes in c, and the export routine is currently written in python.

My current material export works fine, color \ float values and all that works, but as soon as I assign a texture into a color slot I'm having trouble accessing that texture.

So, my question is this:

How can I loop through each parameter in a material node, check the parameter by name (if I'm looking for a specific one), then check if a texture is assigned to that parameter?

Take for example the 'kd' slot here:

The kd color parameter I fetch like this:

nodes = mat.node_tree.nodes
r = nodes["Matte"].inputs[0].default_value[0]
g = nodes["Matte"].inputs[0].default_value[1]
b = nodes["Matte"].inputs[0].default_value[2]

And I know using the name 'matte' there is wrong, what I would like is to get the name of the 'class' of material - then check if the material is of type 'matte', instead of relying on the name. (only way I can explain it, I come from 16 years of 3dsmax, and that's one way of checking there when you write scripts). So a pointer on that too would be nice.

And now I have my next question - how can I check if a texture map is assigned like this on that parameter:

I would like to get that texture info (file path) if a texture is assigned to it.

I am going to link this here as intro:

Control Cycles material nodes and material properties in Python

To see what and if something is connected to your Kd socket:

kd_socket = nodes["Matte"].inputs[0]
# you can check if kd_socket.name returns "Kd"
# and kd_socket.type returns 'RGBA'

links = mat.node_tree.links
link = next(l for l in links if l.to_socket == kd_socket)
if link:
    image = link.from_node.image          # = bpy.data.images['Name']

In Blender everything is referenced by names, they are unique by design. If you don't know the name, you need to search through all items and pick what you want based on some criteria. You can recognize nodes by:

type: link.from_node.type         # 'TEX_IMAGE'
number of inputs/outputs, type of sockets, etc.
how the nodes are linked with links

You get the node class with:

mat.node_tree.nodes["Diffuse"].bl_idname
# 'ShaderNodeBsdfDiffuse'


Fill Brush with Radial Gradient not working with Project Paint I have modeled a leopard frog with the mirror modifier and unwrapped it, and am attempting to paint the diffuse texture in the 3D viewport. When using the draw brush, painting works fine. When using the fill brush without a gradient, it works as expected.

My problem occurs when I try to use the radial gradient option on the fill brush to paint the spots of the frog. The results are mostly crap. For example, I'll paint the top of the body, and it paints a spot on the bottom as well. Or I'll paint on the side of the body and the spot shows up on the belly instead. Sometimes, the brush won't even work and I have to fiddle with re-unwrapping and making a new image to paint on to get it to work again. I feel confident the problem is not my UV map; I have islands for the legs, body, inner mouth, hands, etc. No vertices are overlapping in the UV editor. When I texture paint from the UV window, I get no unexpected results. For some reason the fill brush just completely craps out on me when I use a radial gradient in the viewport.

I should add that I've tried toggling Occlude, Cull and Normal options in the toolbar to no effect.

I'm really at a loss for what to do here. Is there a better way to paint the spots? Is radial gradient fill just plain broken?

I think that actually we need to think in regards to how to arrive at the radial gradient dots on the target image. The gradient fill brush is going to fill the whole image, and works from clicking somewhere in the image and pulling away from center to create a radial gradient fill.

My preferred way to do this is to use a Blend texture set to radial, and in the brush settings I set it to stroke type 'Anchored' and change 'Tiled' mapping to 'View Plane'. Define your gradient there in the place in the texture panel marked 'color' and then set your stops to the colors of your choice. If you already have a gradient worked out, hover over it and press ctrl-C to copy it, and hover over this color ramp and press ctrl-V to paste it in. Click in the image area on your mesh, and the dragging away you should get a preview of the colors and size before release.


How to import .py file from another directory in animationnodes2.1? I am writing a custom node in animation nodes2.1,and i wanted to import .py file from another directory as a module,for example,i have two directories:

../nodes/my_nodes/test.py

../nodes/bvh_tree/construct.py

i wanted to import construct.py to my test.py,i tried this code:

from ..bvh_tree import construct
from construct import ConstructBVHTreeNode

but failed,the consoul gave me "no moule named construct",i was confused about the error,how to fix this problem? i had tried the way on the topic stackoverflow.com,but can not work still,anyone has an idea,Thanks in advanced!

Th import statement should be:

from .. bvh_tree.construct import ConstructBVHTreeNode

Because the from import takes the form from module import something.


How do I Fill a Subdivided / Smoothed Barrel's cutout With 2 Sided Right Angle Face? I have a barrel that I need to make a shelf in. I need to fill the cutout section. The barrel has already been subdivided and smoothed. Preferably with a right angle corner fill.. or curved corner might work. The blender file is located here: http://www.aworkofmarc.com/1/Templeton Any pearls of wisdom are greatly appreciated.

I'd do this in several stages, to make sure the topology stays nice and works well with both the subdivision modifier and the smooth shading.

Start with filling the horizontal surface. Connect the two verts that delimit this part and join them into an edge with F.
Subdivide this edge 5 times with W --> Subdivide --> crank up to 5 in the tools panel.
Then fill this surface with a grid fill (Spacebar menu --> Grid fill), using 6 spans and an offset of 6.

Repeat this process for the upper cap (6 spans and an offset of 3 for the grid fill this time):

Add a loopcut in the perimeter of the barrel, at the same height as the edge we started with in the last step. Create faces for the rim at the left and right by selecting 4 verts and filling a face (F).

Now you can fill the last hole with another grid (see span and offset params in gif below). Add another cut by selecting the two verts near the bottom and creating and edge with join J, to maintain a nice flow of vertical loops. Select the loop above which is distorted due to the current topology, and straighten it this way: make the leftmost vertex, that representing the desired height for all the verts, active by deslecting and reselecting it (Shift + RMB). Change the pivot point to active element, then scale all verts to 0 on the Z axis (S --> Z --> 0).

Now, if you like, you can add more loopcuts or increase the crease value to control the curvature of the subdivided surface.


Texture appearing in squares across the map I was following a tutorial on how to paint textures on to a object and for some reason, when I started painting, the texture didn't show up in its proper place. It just appeared in squares all around the map. if anyone has a solution to this, Please let me know.

I would start by looking at your UV map. If you try using the color grid or UV preset textures (when you create a new texture) you should be able to see if your UV map makes sense, or if it's causing the issue.

If the UV map is the problem, you can probably just UV unwrap your object again. To make a flat UV map from above your object (which should work for your terrain), switch to edit mode with Tab, toggle to orthographic view with Ctrl+5, switch to top view with Ctrl+7,  then select UV unwrap (or press U) > Project from View (Bounds).


I have a large scene with a hierarchy of nested Empties. I need to select and delete all the objects under Empties with a specific name I'm new to blender. I'm struggling with what seems like it should be a very simple task. I have a large scene(a level imported from a game) that has a lot(hundreds) of nested emptys, and geometry under them.

My goal is to "clean up" the scene, to delete all the unnecessary objects. Specifically, I want to find all the objects which have "WRAP" as a part of their name, select them, and delete them. I also need to learn  how to select all the children of the parent empty(recursively, so that if it has other empties under it, and objects under them, it all would get selected), so I could delete a whole "branch" of the tree.

For some reason it's really hard.

I have tried Shift+G > Select children. It works if I select an empty with objects under it, but doesn't work if I'm trying to select an empty that has empties under it and objects under them.
I tried Space > "Select Pattern" > *WRAP*. It doesn't seem to work, blender  gives me no feedback, just doesn't do anything. Maybe I'm using it wrong?
I tried searching for "WRAP" in the outliner. It seems to filter all the objects I need correctly, but I can't figure out how to select them all to delete them. Besides, these are still the parent empties, I'd need to learn to delete their child objects.
I tried Right Click > Select Hierarchy on a parent empty in the outliner. Just doesn't do anything.

Also all the names of the empties are grayed out for some reason(in the outliner). Sorry for the newbie question, but can you help me figure out what's up with that, and how do I make them as a normal part of the scene?

Can you guys please help me out?

(Link to download the scene)

This should be rather easy, if I didn't miss anything.

Select and delete all
Filter name through the search bar.
Press Enter to confirm the search.
Select all, shortcut A
RMB > Delete

Delete hierarchy
Deleting the whole hierarchy of empties for some reason doesn't work well in the outliner.
Just move your mouse over to the 3D viewport and it works well.
RMB > Select Hierarchy
Delete Key in the 3D viewport to delete selected.

The grayed out items are hidden objects.
To make them visible in your scene, use the outliner toggles:


New cube linked to the old object, how to make them separate? I am just starting out with blender and I don't know why the new cube that was added to the scene is tied to the old cube object.
Below image will explain

When I am selecting either of them, both get selected.
Please help me in deleting only the new cube. And please explain why it happened?

It looks like you added the little cube while you were in "Edit" mode, so it became part of the same mesh as the chair. You will need to go back into "Edit" mode, select all the faces of the little cube and delete them.

"tab" for edit mode
"alt"-a deselect all
"3" for face mode
select click a face on the little cube
"Ctrl"+l for all linked faces
"p" to separate to new item


Imported model not there This is my first time using Blender, so I hope this isn't too obvious.

I'm using Blender 2.76b (can't use the latest version due to the graphics card), and importing an .fbx of a city model (which I didn't create). When I've imported it, I can't see the model anywhere. I've tried translating it as it should be georeferenced to OSGB36, and rescaling it, however nothing is showing. The top of Blender is showing me a fair count of all the faces etc, so it would seem as though the import it working correctly. I've tried some of the different options for zooming to the feature (e.g. Numpad.), but it doesn't appear to do anything.

There are multiple reasons that the object is not visible after importing.

Check the outliner and see if there is an object. Also see if it's visibility is on.
Make sure you are in the correct layer. To display objects from all layers in the 3D view, press the backtick key.
The camera clipping planes must not be proper. If you are looking from the User Persp camera, press the N key and adjust the Start and End values for the Clip plane. If you are looking from a camera object, edit the clip start/end in the camera data properties.
In most cases pressing SHIFT+C in the viewport should frame all the objects in the scene. Refer to point 2 if 1 and 3 still does not fix the problem.


How to move multiple UV's face together to the 2D cursor I want to move all of those rectangles to be stacked on the 2D cursor, because I want to reuse a texture area for all those UVs.

Manually dragging : not accurate, no snapping
Align X/Y : The rectangle collapse into a little dot
Shift + S -> snap to cursor (offset) : They are not gathered/stacked together, they retain the original spacing
Selecting one by one and do snap to cursor (offset) : Works but time consuming, is there any operator that do this for all items?

One (not perfect, but useful) workaround: select all faces that will share the same portion of the texture and press U choosing "reset" option: all thoose faces will be UV unwrapped in a stack covering all the UV space available. This "big square" can be scaled and moved to the right place and dimensions with a single shot, even using the "Shift S, selected to cursor" option.


Can an update function common to more than one property reveal which property is using it? I'd like to use the same update function for several properties but I will need to know which property calls this function like in this script exemple.

import bpy
from bpy.types import Panel, PropertyGroup
from bpy.props import BoolProperty, PointerProperty

def update_function(self, context):
    #if firstProp use this function:
    #   do this
    #elif secondProp use this function:
    #   do that

class MyCollectionProperty(PropertyGroup):

    firstProp = BoolProperty(
            name = "Fisrt",
            default = False,
            update = update_function,
            )

    secondProp = BoolProperty(
            name = "Second",
            default = False,
            update = update_function,
            )

class TestPanel(Panel):
    bl_idname = "test_panel"
    bl_label = "Test Panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_category = "category"

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

        layout.prop(myProps, "firstProp")
        layout.prop(myProps, "secondProp")

def register():
    bpy.utils.register_module(__name__)
    bpy.types.WindowManager.myProps = PointerProperty(type = MyCollectionProperty)

def unregister():
    del bpy.types.WindowManager.myProps
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()

Is this possible or are we obliged to create a function per property?

def update_function(self, context, origin):
    if origin == 'firstProp':
        #   do this
    elif origin == 'secondProp':
        #   do that

class MyCollectionProperty(PropertyGroup):

    firstProp = BoolProperty(
            name = "Fisrt",
            default = False,
            update = lambda s, c: update_function(s, c, 'firstProp'),
            )

    secondProp = BoolProperty(
            name = "Second",
            default = False,
            update = lambda s, c: update_function(s, c, 'secondProp'),
            )

use a lambda, which passes the 'origin' to the update_function.

An update_function that prints out the value of the property

def update_function(self, context, origin):
    # - use "origin" argument to pass the member variable being modified
    # - "self" will refer to the instance of the MyCollectionProperty
    print(origin, ':' , getattr(self, origin))

    if origin == 'firstProp':
        #   do this
    elif origin == 'secondProp':
        #   do that


How can I export a video with audio? I rendered my youtube intro, but, there is no audio. How can I get blender to output a video with audio?

Go to properties panel below in out put change from png to MPEG and u will get more options below then go to audio codec change from none to MP3
and then render hope u get the audio and video


How do I catch keyboard input for a blender plugin? I'm writing a leap motion blender input plugin, largely because the existing efforts seem to have stalled.

One of the problematic issues with the leap is that after moving / scaling / rotating an object, there's no good way to 'stop' the leap input. Even using both hand, the leap often awkwardly tracks tiny jitters as you change gesture or add/remove hands.

The best solution seems to be to control the input of the leap by keyboard input; eg. hold down control to designate input mode, and release it to 'drop' the object or stop rotating the camera.

However, I'm having trouble trying to catch this sort of input from the plugin api.

I've looked at bpy.context.window_manager.keyconfigs, but it doesn't seem helpful.

How can I catch the input of keydown / keyup on control keys?

It's worth noting that I have explored the idea of adding new keyconfig's to 'start leap mode' and 'stop leap mode' using operators (eg.  cntl -Z start,  cntl-shift-Z stop, or whatever) but finding free easy-to-press key bindings is really tricky and it is, practically speaking, really awkward. So uh... if you were going to suggest that, dont? It's not really a good solution.

(Incidentally, the existing efforts at leap bindings were all tease and no action, frustratingly; that sucks. If you want to see what I've done, such as it is, the source is located here: https://github.com/shadowmint/leap-blender)

I have no means to test for your intended usage, but maybe a modal operator is viable. Based on your use case, here's an operator template you could modify:

class VIEW3D_OT_process_input(bpy.types.Operator):
    """Process input while Control key is pressed."""
    bl_idname = 'view3d.process_input'
    bl_label = 'Process Input'
    bl_options = {'REGISTER'}

def modal(self, context, event):
    if event.type == 'ESC':
        return {'FINISHED'}
    elif event.ctrl:
        pass # Input processing code.

    return {'PASS_THROUGH'}

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

Watching input event being passed as argument, the operator will keep running (by returning PASS_THROUGH) until a condition, in this case pressing Esc button, is met. The input processing code itself is only executed if Ctrl key is pressed.


Scale Faces by Specific Value in XY Axis? I need to scale some faces but I want to scale by an exact number I can type in. I can see the values in the top left as I scale the object but I can't click or edit the values as I am scaling the faces. I can't find any other tool settings or properties that would allow my to set the value manually.

You can use the operator panel to do that:

Once you have validated the scale, you can set the values manually.


Trouble getting video as plane to show it's image I've imported a .mp4 video as a plane in object mode so that I can point the camera at it and animate some 3D objects in front of the video. The image of the video won't show up though (it remains a black rectangle, and trying to play the animation doesn't change this.).
I've tried tutorials but they all seem to be for older versions of blender and don't seem to track to today. Anything I can apply like adding a light source doesn't seem to do the trick.
I'm trying to figure out how to change the viewing mode and material of the plane but I'm not sure I'm doing it right. Some of the lighting does seem to change the the black rectangle remains as such. Changing the engine from eevee to cycles doesn't seem to make any difference either.

I really won't recommend the method you are going with it is seriously troublesome and tiring. I would say use blender's built-in Video editor. You can create the effects as separate projects. In the project, go to render settings and go to film and click transparent or transparency (depending on the version you are using). Something like this:

After rendering this in OpenEXR format. The thing is most video codecs don't support alpha channels and the ones that do, aren't available in blender. So you can take the image files, plop them into the video editor built-in blender or use some 3rd party-software like kdenlive or Davinci Resolve. You can take the video file and the effects file and it will work.
Alternatively, if you still insist on using it as a background image/video. DO this. Click on the camera and go to the camera settings. Enable background images and click on the dropdown. There, click add image and click on the open button. The file explorer should pop-up and then locate and select the video file. It will come as the background video and you can happily throw in whatever effects you want. Here's the video edition of the method (WARNING: This is not the total tutorial about what you want but shows a few steps on this method and you may find this helpful):
https://www.youtube.com/watch?v=kfGXRsaBf5U
I would personally go with the 1st method but you can go with the one you prefer. Hope it helps.
P.S I also found another QnA that is related to your problem. Check it out. Link's below:
Movie Clip On Plane


Material Preview doesn't match render I've created a wood floor material using an image texture node, I'm happy with how it is displayed in the material preview.

However when I apply the material to any object, in this case the 'wood_floor', the shader seems to only apply a single color to the object rather than the textured material I've created.

Here is the blend file.

What is causing this effect and how can I get the material to apply to the entire floor object?

You have a texture but blender can't guess what coordinates to use for the texture mapping. To fix try this: In your wood floor object a texture coordinate node. Connect the object coordinates to the vector connector on your image texture node.


pose position to reset position? I've already cleared all user rotation, and also tried alt R etc... when I press the reset position button ever thing looks good, but in pose position is pressed the head legs and arms twist in a funny direction how do I fix this without redoing everything?

please I need help  thanks in advance...

Are you sure that you reset the rotation in the pose mode? Because i assume you reset the rotation for the armature rotation as object in object mode, while you are supposed to reset every bone rotation inside the pose mode.

If this is the case, enter pose mode for your armature, select all bone by pressing "A" shortcut, then reset the rotation by pressing "alt-R", and press "alt-G" to reset location if necessary


How to recenter origins of objects on one axis I want to use "Origin to Geometry" on multiple objects but only move the objects' origins on one axis. How do I do this?

Bounding box center

IIRC center to geometry is also the same as bounding box center.

Test script, finds the bounding box center cog and only translates the z component.

import bpy
from mathutils import Matrix, Vector
context = bpy.context
ob = context.object
me = ob.data

bbox = [Vector(b) for b in ob.bound_box]
cog = sum(bbox, Vector()) / 8

me.transform(Matrix.Translation((0, 0, -cog.z)))

Changing last line to

me.transform(Matrix.Translation(-cog))

will move origin to center of bounding box.


Using ipad pro and apple pencil as a graphics tablet I have an iPad Pro + Pencil and was wondering if there is any chance to use it as a graphics tablet with blender? I mean drawing on my Ipad and see on my pc monitor. Thanks.

I have not found a solution after doing some research. But, there are possible ways to work around it.
If you have a Mac, then it might be possible to use Sidecar, allowing you to use your iPad with your machine. Unfortunately, I have yet to try it, my machine is too old so it does not support it.
There are also apps that can let your iPad control another computer. While touch is definitely supported, I do not think they will have the pressure detection features of the apple pencil.


Anyway to rig this wheel? trying to rig this robot, but I've got no idea how to do the wheel, any idea?

To answer your question more fully, I switched from comments to an answer.

The first thing I did was created and rigged a very rough estimate of your model:

I then added a square-ish wheel underneath it (visible in above picture). I parented this wheel to the armature via Object (Keep Transform), not any of the Armature Deform settings. This means that when you move the armature, the wheel will move with it (assuming the transformation is in object mode). While the wheel moves in conjunction with the rest of the model, you are free to rotate it on the appropriate axis. Here is what I achieved (glitch is in gif alone):


How to make a Rigid Body fall off a conveyor belt? I've created conveyor belt and and two objects with rigid body physics.
But the first object won't fall and second object falls backwards.

How can I fix it?

Video of the problem
Blend file

This is because the rigid body simulation is only taking the initial deformation into account, behaving as if the curve modifier is applied:

To fix this, enable Deforming on the belt object:

This will make the simulator take into account deformations of the object that occur during the simulation.

Result:


Can blender use the Alpha channel of an image as transparency on a plane? I was wondering if I used Photoshop to make a portion of my picture transparent, Would Blender be able to use those transparencies while importing the photo using the Import images as a plane Add-on

Yes, Blender can use the transparency of an images (and not only for photoshop files).
When you use the Import images as planes you can change the settings to  make use of the alpha channel as transparency for a texture  (The image, of course, has to be saved as RGBA on a format that supports alpha channels: Tiff, png, openEXR and some psd files will work fine for example, jpeg images do not have alpha channel).
The settings are different depending on the render engine used:

For Cycles Render enable Use Alpha,
and then choose between diffuse and emission:

For Older Versions the settings are:

Note that on the 3D viewport the transparency will only show when shading is set to Material or Rendered.

For Blender Render use this settings:

On the 3D viewport the transparency will only show when shading is set to Texture, Material or Rendered.

A final note: When importing photoshop's .psd the transparency will work fine, but keep in mind that support for this type of format is still limited and not all features of the file might work in blender. read: Importing textured psd into blender not showing correct colors in blender


All my objects became non-selectable All the objects in my scene (around 2'000) have the selection feature disabled all of a sudden (v.2.78):

I can drag the mouse down to reselect them, but the computer lags, and a lot of them don't get highlighted when I do this.

I looked at this and this, but I cannot find out how to make the scripts work.

Is there a quick and dirty way to make all the objects in the scene selectable again?

One option is to use shortcuts in the Outliner editor - V for visibility of the objects, S - for selectability and R for renderability. Note that mouse has to be over the Outliner editor while using the shortcuts.

Open the Outliner. You need to point to Blender which objects' settings you want to edit. As they are unselectable, press A which will create blue overlay over the objects and will select them for the Outliner actions.
Press the shortcut for desired operation, in the case of the question - S for selectability.

Note that this is toggle, so it will invert current state of the adjacent property; if object-A was unselectable and object-B was selectable, objectA will become selectable and objectB the other way around.


How to set the depth of the cylinder? I have to make very large number of cylinder. So I need some fast way to make the object. I found one solution to sphere and modify for cylinder but unable to set the depth of the cylinder.

import bpy
import numpy as np
import math
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()
bpy.ops.object.select_all(action='DESELECT')

bpy.ops.mesh.primitive_cylinder_add(radius = 0.02)
cylinder =bpy.context.object

def cylinder_user(x1, y1, z1, x2, y2, z2):
    dx = x2 - x1
    dy = y2 - y1
    dz = z2 - z1
    dist = math.sqrt(dx**2 + dy**2 + dz**2)
    phi = math.atan2(dy, dx)
    theta = math.acos(dz/dist)
    return [dx,dy,dz,dist,phi,theta]

f=open('input.data')
xyz=np.zeros((11,3),dtype=np.float)
for line in f:
    l=line.split()
    xyz[int(l[0]),:]=[float(l[3]),float(l[4]),float(l[5])]

a=[10]
size=a+a
csize=np.cumsum(size)

start=0
for i in range(1):
   for j in range(start+1,csize[i]+1):
       if j>(start+1):
          ob1=cylinder.copy()
          value=cylinder_user(xyz[j-1][0], xyz[j-1][1], xyz[j-1][2], xyz[j][0], xyz[j][1], xyz[j][2])  # [dx,dy,dz,depth,phi,theta]
          ob1.location=(value[0]/2 + xyz[j-1][0], value[1]/2 + xyz[j-1][1], value[2]/2 + xyz[j-1][2])
          #ob1.depth=value[3]
          ob1.rotation_euler[1] = value[5]
          ob1.rotation_euler[2] = value[4]
          bpy.context.scene.objects.link(ob1)

       bpy.context.scene.update()
   start=csize[i]

I am unable to set the depth. The error is saying AttributeError: 'Object' object has no attribute 'depth'. my input.data look like this.

 1 1 1 0.272431 0.881136 1.12464
 2 1 1 -0.12394 -0.000412278 1.20626
 3 1 1 0.0688532 -0.508813 0.402982
 4 1 1 0.137647 -0.977714 -0.443362
 5 1 1 0.594422 -0.229495 -0.858603
 6 1 1 1.40139 0.285219 -1.016
 7 1 1 1.65654 0.778843 -0.220937
 8 1 1 0.906638 1.29492 -0.555914
 9 1 1 0.613766 0.376717 -0.665624
 10 1 1 -0.212395 0.861266 -0.512098

It is because you are trying to set the depth of an object, not a cylindre. Once the cylinder is created, it is impossible to chage the "generation" parameters. A solution would be to create a new cylindre each time in your loop instead of making a copy of the previous one.

bpy.ops.mesh.primitive_cylinder_add(radius= 0.02, depth=value[3])
ob1 = bpy.context.scene.objects.active
ob1.rotation_euler = cylinder.rotation_euler
...


Possible to use object speed/acceleration as driver variable? If I have an animated moving object, is it possible to get its speed and/or acceleration vector into a driver variable?

Some ideas I've thought of and haven't worked out:

Obviously differentiating the position F-curve is the raw math way to do it.  But finding and (repeatedly) differentiating the interpolation function seems a bit beyond Blender's Python capabilities.  And I am hoping there is an easier way.
If it is possible to get the position at the previous frame the first derivative could be approximated.  This doesn't help with acceleration though.

To be clear, I'm not talking about physics simulations, I'm talking about keyframed animation.

import bpy
import math

thecube = bpy.context.scene.objects['Cube']
def updateFramePlease():
    #get the values from these properties on this frame
    oxVal = bpy.context.scene.objects['Cube']['o_x']
    oyVal = bpy.context.scene.objects['Cube']['o_y']
    ozVal = bpy.context.scene.objects['Cube']['o_z']
    #get the current frame number
    cframe = bpy.context.scene.frame_current
    if cframe > 1:
        #if the cube has had a chance to change position get the delta of those positions
        deltaX = abs(thecube.location.x - oxVal)
        deltaY = abs(thecube.location.y - oyVal)
        deltaZ = abs(thecube.location.z - ozVal)
        #calculate the 3D linear distance travelled
        h1 = math.sqrt( (deltaX*deltaX) + (deltaY*deltaY) )
        h2 = math.sqrt( (h1*h1) + (deltaZ*deltaZ))
        #update the custom x,y,z fields before moving to the next frame
        bpy.context.scene.objects['Cube']['o_x'] = thecube.location.x
        bpy.context.scene.objects['Cube']['o_y'] = thecube.location.y
        bpy.context.scene.objects['Cube']['o_z'] = thecube.location.z
        bpy.context.scene.update()
        #answer the delta field request to have a value from this driver – Answer is the 3D linear distance
        return h2
    else:
        #if the cube has not had an opportunity to move
        return 0.0

# Add variable defined in this script into the drivers namespace.
bpy.app.driver_namespace["updateFramePlease"] = updateFramePlease

Here is everything in play:

Notice the bottom right hand corner, see the purple field, and the three below it?
These are the property objects of the Cube. The purple indicates that there is a driver driving the value. To actually add the driver, you Right click on the value part of the field and select add driver. Then in the graph editor, make sure your graph type is Drivers, then select the property to drive at the top left of the screen. Then enter the function name as the expression and hit Enter. Over on the text editor, check register, and Run Script. Now increment the frame 1 step at a time, and pay attention to those properties on the lower right.

Here's the Blend File for reference:

And here is a link that basically seems to describe exactly what you are asking for in terms of the F-Curves:

F-Curves as Drivers


How can I recreate geometry using a photograph? I am trying to change the floor covering using a picture. How can I define the floor?

For Blender 2.8x use fSpy
(For blender versions 2.7x or older read the instructions at the bottom of this post.)

fSpy is an Open source still image camera matching app that sets the parameters of the Blender camera and optionally sets the camera background image.

Download the app (https://github.com/stuffmatic/fSpy/releases) and run it.
Open the picture within fSpy

Move the red and green lines and place them along lines that would be  parallel in the real world, but that on the picture converge to a vanishing point.
Additionally set also the placement for the origin and grid (and if you know the distance between two points you can enter that as well).

In this case the tiles on the floor are perfect to set the lines, but for other images, all that matters is that the lines are on the same plane and are parallel in the real world, like walls, windows, ceilings, roads, etc. On the left side of the interface you can set what color line corresponds with what axis for the 3D envirionment. X and Y will be for horizontal lines and Z for vertical

Save the fspy project.
Download the fspy Addon for blender (https://github.com/stuffmatic/fSpy-Blender)
Open Blender 2.8, install and enable the fspy addon.

(detailed instructions on how to install the addon here)
Import the fspy project into blender.

A new camera will be created along with a camera background image.

Now you have a scene that matches that of the photograph, so that you can recreate the geometry and add whatever you want.
Start reconstructing the geometry.

You can choose to unwrap UVs Using Project from view, to place some of the original textures from the photograph.
From there on, you can create whatever materials you want and composite them on top of the original image.
Why settle with a boring old rug when you can have your own indoor soccer field?

For version 2.79
Use version 1.0.2 of the fSpy addon.
For older versions of blender use Blam Add-on!

NOTE: Blam is no longer mantained

To use Blam.

Download, install and enable the addon.

Load the image in the Movie Clip Editor.
Use the grease pencil to draw a series of lines following elements that would be parallel in the real world. Use a different layer of grease pencil for lines going in different directions.

In the Misc. tab. Set the camera calibration to use 2 vanishing points.
Determine the axis for each of the grease pencil layers.
Activate Set Background Image and click on Calibrate active camera

In the 3D viewport the camera lens will change to use the estimated focal length and will be placed using a matching perspective as the original image. The project render size will also change to match the dimensions of the original image.
Load the original image to be used as background and start reconstructing the geometry
Graphics Provided by Vecteezy.com


Blue Lines from Annotations not in any object I am just starting to use annotation grease pencil. I created one set successfully, then tried to create another one. I selected draw cursor, then proceeded to draw the the annotation curves (The blue lines you see). But when i went to change the geometry cross section nothing happened., it just went blue.
So I delete the curve to start again, and the blue lines were still there. I cannot select them, when I hide all items they are still there. It is very strange.
Anyone know what might be the problem here?

These are not bezier curves, these are annotations. Once in Edit mode you must have confused the Annotate tool with the Draw tool:

To erase the annotations, press D + right click, or select the Annotate tool and press Ctrl


How to fix those stretches ? / UV unwrapping How to fix those stretches ?
There's a blend file as well if needed

This is because you got n-gons that are "intersecting" with itself.
The easiest fix for that is to triangulate the faces that are causing problems.

Select the faces that are ngons and press

  ctrl + t

or search for Triangulate Faces


When using randomize transform => randomize scale, how do you have the randomized values all be above zero? I'm trying to Randomize Scale(only Z) of some identical boxes, the goal being to have all of their bottom faces on the same level, while top faces are on different heights.
As you can see below, some of the boxes have their Z randomized to negative values.

I know Blender accepts some simple maths when entering values, so I tried entering |6.24| (as an absolute value) to see if that will work, but no luck.
So, I'd like to know if there's a smarter way to go about this, maybe without Randomize Transform tool altogether.
Also, I'd like to know if there IS a way to use some equivalent of |x| in Blender, or is there no such feature?
Thank you for your time!

Just randomize them like you did. Then add an empty and parent all cubes to it.
Then move the empty up (z-Axis) as much as you need it.


Using shadows as texture masks? I am attempting to make an environment that has hand-painted shadows in the base color texture. This would give me more artistic control over how the shadows are cast. However, I would also like shadows to be cast by moving/animated objects that blend seamlessly with the painted environment shadows.

A good example can be seen in the gif below:

Here, the artist painted in the static shadow on the left while the box is casting a realtime shadow in Unity.

Based on his explanation here, I would imagine this could be achieved by creating an emissive base color texture with a dark/shaded version revealed by a hand-painted mask. At the same time, shadows cast by other objects could be used as additional masks to reveal the dark/shaded texture, allowing them all to blend seamlessly.

Unfortunately, I am at a complete loss as to how this might be achieved and have yet to find anybody else do the same. Is this sort of shader setup possible within Blender?

EDIT: I am using Cycles for this case.

Compositing with Shadow Pass Mask

It seems compositing and shadow pass mask is the way to go with this in Cycles.

Once everything is set the render output would be the result of compositing so there is nothing complex to repeat at all. It is possible to hide the extra texture inside the shader with very low emission values that would not add to the 'exposed' visible range of the colors so no extra render layer would be needed and the extra emission shader does't influence the render times in any meaningful way. We could use emission strength of 0.0001 and in compositing just multiply the emission pass by 10000 and since the values are 32 bit floats, there would be no loss in color detail.

You would need to add an Emission shader to all of your materials that would contain the shadow texture for them(even if you wanted the same texture it would need to be there so it does not render black). You also need to have all the passes needed to reconstruct the image enabled. If you needed an emission pass for regular use, some extra masking may be required to separate the actual values from the ones 10000 times weaker, but it could be something like this:

Just to clarify - the emission pass in compositing is multiplied with a simple Color Mix node in Multiply mode entering 10000 as R,G and B values:


How do I add a curve to a vertex to bend an edge / face Context: I'm extremely new to Blender (using Mac) and 3D modelling in general and I'm trying to add the final touches on my first model.
For my model, I am aiming to construct a 3D model of a box packaging for a product using the die cut I have received from the manufacturer. I intend to import my final model into Adobe Dimension so I can texturise it and add my mockup label.
I have managed to create my box ~90% with as accurate dimensions as I can. I have achieved this by starting out with a cube and extruded faces and adding edges. My issue lies in the remaining 10% whereby I need to add some curves to my model.
This is my model so far ~90%

What I need to adjust are the curves on the side and back to be similar to the die cut as illustrated below

Essentially, I need to adjust my faces/edges of my model to look something like this:

I come from a graphic design background and so am used to drawing objects and shapes using Pen tools and adding curves via handles. As such, I would greatly appreciate the a full walkthrough to the solution as if you were to explain it to a 5 year old :)
Thanks in advance!

Use a Bevel (Ctrl + B) on the edges you want to curve. Once you have beveled, select "Custom Profile" from the operator panel that appears, and you can define all aspects of the bevel, including custom curvature. In the example below, I deformed it heavily on purpose just to demonstrate. If you line up your object in front of a reference image, you can replicate the curve precisely.


Achieving inverse shadows? When light hits an object, it of course generally bounces away, leaving a dark area on the opposite side—a shadow.

What I would like to know is, how would I do the opposite? How would I create a material wherein the light both bounce off and be amplified as it shines through, effectively creating an inverse shadow (or "shaglow" I suppose it could be called) of light and illumination?

You can actually input values greater than one to color inputs of any shader. What that would mean is that the shader would reflect or transmit more light than it receives, which is obviously impossible in reality and in normal circumstances should not be used for realistic materials, however it is possible. You can also use Light Paths node to separately control how different kinds of calculated light rays are being rendered. So, it turns out you can chose to display a material as solid only to the camera while to the rest of the scene it can be transparent and have greater than 1 values for the light it transmits producing your desired effect:


What is the fastest way to add a poly frame to a window hole? I am proceeding like this: first I select the hole external edges.

And I make a face out of them:

Then I duplicate the face in the Y axis, and delete the old one (I don't know how to detach the new face from the main object):

Then I extrude:

Then I extrude again all faces, so to inflate the box by the right amount:

Then I delete the back face:

Then I bring the open box to intersect the wall:

Then I make FACE - INTERSECT (BOOLEAN):

Then I merge the exceeding vertexes and assign the new material:

Et voilá: frame in the wall.
I am sure this is a stupidly long and convoluted process and that there's a quick command to do this.
Please tell me it's true.
Edit: a little bit faster.
Take the 4 sides of the window, duplicate and move locally in axis, extrude along normals with negative value, delete faces in excess, then move the 4 polygons back into the wall and do the intersect boolean.
It's a bit faster. Still makes no sense.

Use the Inset tool in Outset mode. Then extrude and delete the inner face.
Outset will create new faces around the selected face.

Avoid using booleans, they will create bad topology.


Camera animation doesn't rotate along shortest path I'm new to Blender, and I'd like to animate my camera rotating around 360 degrees to show off part of a 3d model. I have a setup, and the camera will move, but instead of pivoting all the way around the camera will rotate most of the way, and then spin all the way (more than 180 degrees) back around. Here's an example

And here's the code:

camera.keyframe_insert(data_path="rotation_euler", frame=0.0, index=-1)
camera.rotation_euler.rotate_axis( 'Y', 2 * math.pi / 3 )
camera.keyframe_insert(data_path="rotation_euler", frame=frames/3., index=-1)
camera.rotation_euler.rotate_axis( 'Y', 2 * math.pi / 3 )
camera.keyframe_insert(data_path="rotation_euler", frame=2.*frames/3., index=-1)
camera.rotation_euler.rotate_axis( 'Y', 2 * math.pi / 3 )
camera.keyframe_insert(data_path="rotation_euler", frame=frames, index=-1)

Is there a good solution to this?

Instead of rotating around a global axis with rotate_axis set absolute values to the rotation channels and handle all the relative transformations in code.

camera.rotation_euler = (math.pi/2, 0, 0)
camera.keyframe_insert(data_path="rotation_euler", frame=0.0)

prevRot = camera.rotation_euler
nextRot = (prevRot[0], prevRot[1], prevRot[2] + 2 * math.pi)
# or absolute values
# nextRot = (math.pi/2, 0, 2*math.pi)

camera.rotation_euler = nextRot
camera.keyframe_insert(data_path="rotation_euler", frame=frames)

The script presumes Y is Up.


Are there any restrictions on model file-formats? (OBJ, 3DS, PLY... etc) I know that Blender can be used for both commercial and non-commercial use, almost limitlessly.

My question is that I heard once that a file with a specific extension can have problems/restrictions (which sounds weird to me but I want to make sure), so I want to know if there may be any legal or technical restrictions exporting files and using files with the .obj extension or can it be used the same as a .blend file?
I need the .obj extension because when saving to a .blend, it rotates my model incorrectly when opened in Unity and when I export to .obj and add it to unity, it works fine.

There are no legal restrictions for using any of the file types that Blender natively imports or exports.

OBJ is open source are unpatented, so its use is not restricted in any way. The other model formats that Blender supports natively are similarly unrestricted.

This is an EXCELLENT question, and one that is asked by creators far too infrequently.

It's uncommon for file type usage to be restricted, though implementing (in code) certain codecs or algorithms can require licensing. Even patenting the codec or algorithm is uncommon because it only discourages your competitors from adopting it, if they have to pay licensing fees to implement in import and export script. You might be thinking of the MP3 codec that is patented by Fraunhofer IIS and Thomson. Even in that case, making a file of that type does not require a license, but being able to make a file does. This is why Audacity doesn't support MP3s natively. Audacity would have to pay a licensing fee (or some other royalty) for the ability to use implement those algorithms. Then they wouldn't be able to afford to release it for free, anymore.

The fact that Blender is free, means that they aren't paying any licensing fees, which means there aren't any licensed algorithms (assuming they're doing what they're supposed to be doing).


"Drawing" single vertices obstructed by coordinate axes I cannot "draw" single vertices because that coordinate system Axes (Green, Red) are in my way. How can I draw vertices in straight lines instead?

Every time I want to draw a path which overlaps with the green and red thing it's not possible to do so. I'm not able to click there.

You can press Ctrl + Space to toggle the 3d manipulator between visible and hidden. Or you toggle  it by clicking on it.

If you are referring to the fact that once you extrude you no longer see the manipulator that is because after you extrude you automatically go into grab mode, which will hide the manipulator. So if you want to move it along an axis you have two ways of doing this.

Method 1 (preferred)

Press E to extrude like you normally would
Constrain the extrude to an axis by pressing either: X Y Z

Method 2

Press E to extrude like you normally would
Drop the tool, RMB or Esc
Use the 3d manipulator to move it like you are used to


Half of mesh looks darker when I attempt to add normal map Alright, so I made a model in blender, and I notice something weird when I create a new image and attach it in the node editor.  My intention is to use a high-poly model I sculpted to bake a normal map onto the low poly mesh.  However, even before I bake the normal, Something weird happens:  One half of the model appears to be darker than the other half.

The boundary between the light and dark areas of the mesh is exactly where I marked the seams for the UV.  This doesn't disappear when I look at it in either the materials or rendered views, nor does it disappear when I bake the map. After I bake the map, it doesn't disappear when I create a new image and connect it to the normal map either.  I searched around, and the most common fix for problems like this is to look at which directions the normals are facing.  Unfortunately, I've taken a look, and it appears that the normals are already facing the right direction.

Update:  I have solved this problem on the tongue by setting the normal map vector to "UV Map", but this doesn't work on the body mesh.

Extra update:  It doesn't work on any of the other meshes, even ones that have only one material attached to them.  I have no idea why the tongue normal works when nothing else does.

If anyone still suffers from this problem: change the Color Space to Non-Color on the texture node of your normal map.


Did I rigged the fingers right? I'm new to making an armature of fingers. I usually don't know if I rigged it right. Here's one of my screenshots

The index finger bones were "Keep Offset" to the Hand bone which is not connected but they were related to it.

Now my problem here is that I tried importing it on Unity while changing its Animation Type from Generic to Humanoid I tried applying it and there's an error on this area which the Finger14.L is not an ancestor of Finger02.L I tried looking at it at first it was typo error but then it's like a serious problem that those finger bones weren't connected to each other. How do I fix it.

(Revised)

Just add 5 more bones, each connecting (connected) the hand to each palm finger bone.


How can I tell if Blender is using all 64 GB of RAM? I have 64GB of RAM on my computer and I'm trying to check if Blender is using all that it can.

I still get viewport slowdown at times when working with complex objects. I know there are many settings in the preferences and I want to know how I can tell if windows 7 and Blender are working to use all 64GB of RAM.

You can tell how much memory Blender is currently using by looking in the info bar:

You can use that to see if Blender's memory usage is hitting a plateau, but it seems to me your issue is your graphics card. More memory won't make your viewport faster, that's what a graphics card will do. More memory means Blender doesn't have to swap as much data onto the hard drive. That means more memory makes:

Getting cache for simulations faster (this won't necessarily make it run faster, it'll just make the data easier to grab). Apparently it also is necessary to compute high resolution fluids (thanks gandal3)
Viewing undo history faster (again, this is just accessing the data, not computing it).
Speed up loading large images (because it won't have to swap to the hard drive every time you adjust the image)
Video editor/tracker cache will also be stored on memory if it is available (which is of course faster than storing it on the hard drive) (thanks again to gandalf3).


How to recalculate automatic weights for single bones? After I edited an already weighted model and its armature, the pose mode doesn't grab the limbs the right way anymore. Is there a way to recalculate weights for  single bones? Because I already edited the weights for other parts of the mesh and don't want to redo that again.

In Weight paint mode, select the pose bones you want to recompute the weight and press:
W > Assign automatic from bones


Cycles gives weird, blank output image while rendering Render shader mode in the viewport is fine, but when rendering a final image, I get a strange black, blank image with a grainy, blurry light source as the only visible object. Anyone know what might be causing this? I made sure the correct camera was the active one. The strange thing is, the light source in the image doesn't correspond to the locations of my actual light source in the scene.  Here's the render output image:

And here's a screenshot of my viewport:

The problem is apparently that the camera that was selected under the "Scene" panel was different from the camera that was selected as active in the scene I was working on. The scene that was set to render under "Render Layers" was different from the scene that the "Scene" camera was in, and so this caused it to give a weird, black output. It's been solved. Cycles now gives a normal image output.


object deforms strangely when using the subsurf modifier I am trying to make an axe and stomped upon this problem...having no idea how to resolve it.
1st photo is with subdivision.

second is without.

If you are just starting with blender here is lesson number one: Avoid using n-gons (faces with more than 4 vertices).

Ngons do not subdivide well.

Try to keep your topology using quads (4 vertices per face)


Insert keyframe to object's Offset Factor Python API I am trying to insert a keyframe at an object's "Follow Path" constraint programmatically. More specifically I am trying to insert a keyframe to the "Offset Factor" property of the constraint. Manually, I would constraint an object to follow a curve, select the desired frame and then right click on "Offset" -> "Insert Keyframe". However, blender's function:
object.keyframe_insert(data_path="location", frame=0)

Does not have a data_path option for the offset_factor. The "location" option is a handle to the object's location at creation (for my case (0,0,0)) and does not change with offset factor change. Is there a workaround or is it not a supported feature? In my code I am trying to set a keyframe at frame 0, offset=0 and at frame 100, offset=1:
constraint_handle.offset_factor = 0
object.keyframe_insert(data_path="location", frame=0)
constraint_handle.offset_factor = 1
object.keyframe_insert(data_path="location", frame=100)

Keyframe the constraint "object"
Same as [obj.keyframe_insert, bpy.data.particles["ParticleSettings"].lifetime]; how to insert keyframe to an existed particle setting, e.g lifetime only your object of concern to keyframe is the follow path constraint
Python console code
Object has a follow path constraint with default name
>>> ob = C.object
>>> ob.constraints['Follow Path']
bpy.data.objects['Eye.001'].constraints["Follow Path"]

Alternatively, all constraints on object of type follow path in a list
>>> constraints = [c for c in ob.constraints if c.type == 'FOLLOW_PATH']
>>> constraints
[bpy.data.objects['Eye.001'].constraints["Follow Path"]]

Getting by name, will be None if there is no constraint named "Follow Path"
>>> con = ob.constraints.get("Follow Path")

Ok, set and insert a keyframe for offset_factor at frame 1
>>> if con:
...     con.offset_factor = 0.0
...     con.keyframe_insert("offset_factor", frame=1)
...
True

True indicating the success of inserting the keyframe


What is the shortcut for edge rotate or location in keymap list? With topology management a vital tool would be the rotation of edges and I would say that it would be even more vital to have a shortcut for clockwise and counter clockwise rotation. In 2.81, is there a shortcut for this and if not, where is the function located in the keymap settings?

Just worked it out myself here, I added my own shortcut by right-clicking the function in the edge tools menu then assigning my own shortcut that way. I chose SHIFT + '<' for counter clockwise and SHIFT + '>' for clockwise.


How to make Snooker holes with boolean? I'm trying to create a Snooker table for a Snooker PC game. I use Boolean to make the Snooker holes once, but then I had to make it all again in another project. I created a new project to do that but now the modifier is not working. When I use difference boolean it cuts the pool table and stays just with the cylinder, have no idea why it isn't working. I already saw some threads talking about normals and remove doubles but it is still not working. I put the blender file here

Tables Z scale is negative, so change it from -0.192 to 0.192 and then rotate Y 180 degrees. Also cylinder scales are all negatives (X, Y and Z are all -0.304) change them all to 0.304. After you get rid of those negative scales try again if it works now as it should.


How to add bump to shader? I have a simple diffuse shader. I would like to add some bump to it. How can I do this in Cycles? Where do I plug in my checkered texture.

Per shader:
Plug it it into the Height input of a Bump node (ShiftA>Add node > Vector > Bump)

The above node setup will only bump the diffuse part of the shader, simulating a bumpy diffuse surface coated with a smooth glossy "glaze" layer.

Entire material:
If you want to apply the same bump mapping to all the shaders in your material, just plug it into the Displace input of the Material output node:

You'll notice that now the bump is applied to the glossy shader too:


How do I create four circular copies in edit mode? I am creating this simple windmill model for a tutorial:

I have created one blade. What is the most efficient method to create the other three spaced 90 degrees apart around the main shaft? Array modifiers only work in Object mode correct? I see two ways:

Create the blade as a separate object and in object mode use the array modifier.
Manually copy/paste 3 more versions of the blade and manually position each.

Appreciate any thoughts.

Go to object mode, set the 3D cursor to the center of the shaft by selecting the shaft, hit CTRL + SHIFT + ALT + C and set origin at center of mass. Then, hit SHIFT + S and click cursor to selected. Now, go back to the blade, go in edit mode select everything. Set the Pivot point (button located next to 'Mode' and 'Material' buttons in the 3D view, and choose 3D cursor. Last, hit CTRL + D to duplicate, hit R and then the axis it should go around, type 90 and ENTER. Then keep hitting SHIFT + R to redo the that duplication until you have the right amount of blades.


How to tell which objects are using a Bezier Circle as bevel object? I have a large animation (over 200 objects) that I have been working on for a while. In the animation I use a great number of tubes, made simply by defining Bezier Circles as bevel objects for Bezier Curves.

Some of the Curves share Circles as bevel objects, and I'm now starting to realise that this is a problem, since I would very much like to parent each Circle to its belonging Curve and hide it, for the sake of order.

Rather than having to manually inspect every Curve and take note of which Circle it uses, I would like to do the reverse operation, i.e. go through every Circle and take note of which Curves that uses it as bevel object. This is nice because it would allow me to duplicate Circles used multiple times and parent each new version to a Curve. Can this be done? If not in the GUI, then possibly programmatically?

TL:DR
I want to go through each Bezier Circle and see which objects that uses it as bevel object, so that I can duplicate a Circle if it is used by multiple objects, and parent each new Circle to its belonging object, such that no two objects share the same Circle as bevel object.

I think something like this might work, but for your own sanity run this only a copy of your scene, or a small representative version of your scene.

Just in case:

This finds the bevel_object
if the bevel Object is used by another BezierCurve it duplicates the bevel Object and associated Curve data,
then uses the duplicate as the replacement bevel Object.

In code form:

import bpy

scene = bpy.context.scene

bevel_names = set()
for obj in bpy.data.objects:

    if obj.type == 'CURVE':
        name = obj.name
        b_obj = obj.data.bevel_object
        print(' {0} -> {1} '.format(name, str(b_obj)))

        if b_obj:
            if b_obj.name in bevel_names:
                dup = b_obj.copy()
                dup.data = b_obj.data.copy()
                scene.objects.link(dup)
                obj.data.bevel_object = dup
                bevel_names.add(dup.name)
                # dup.parent = obj
            else:
                bevel_names.add(b_obj.name)
                #_obj.parent = obj

For the bezierCurves, it doesn't appear possible to parent the bevel object to them. A solution would be to make an empty for every BezierCurve and parent both BezierCurve and bevel Object to the empty.


Projecting multiple images onto an object with UV Project modifiers I've just about got to grips with the UV Project modifier. I've unwrapped my object into a UV map with the image I want to project, and then applied it using a camera as a projector.

However, I want to project from multiple angles. So I created another UV map the same way with my second image and created another UV Project modifier. But this won't work, because I can only select 1 UV map at a time. I want the two projections to be blended together (or, even better, chosen programmatically according to which surface normal has the closer angle to the projector when I eventually move to automating this process in Python).

Here's what it looks like when projecting from the camera on the left. It's projecting the same image it would see if the house were textured properly. Likewise, the camera on the right has an image of the properly textured house from its angle, ready to "fill in the gaps" of what the left camera cannot see.

P.S. Please try not to include steps that could only be done manually/by eye. Because I am applying research to a large collection of objects, this will have to be done programmatically eventually.

Following the last comments, this is more some guidelines than a real answer.

What you can do/code inside Blender is an addon based on the same principle as UV project modifier. The principles are the following:

Given a camera and its parameters, you can obtain its projection matrix. For instance have a look at this.
You can also use/create an UV map (to be built by the code). In this addon, I image that you could parameter one UV map by camera (that may be needed or not, depending on the way you'll define the materials/textures correspondences).
Now you can loop over your model polygons (faces), test their normals against the concerned cameras axis and so determinate which polygons are best concerned by which camera.
Knowing each polygon/camera pairs, and the previous projection matrix, you can calculate the UVs of the polygons, then associate them to the corresponding UV map.

You are done...

Eventually you can also dynamically test camera's parameters changes (tuned by user to adjust the uv/image mapping) and auto update the UV map (performance to be taken into account).

That should be relatively simple.

But the problem is you will have partially hidden polygons due to the projection (it is true too for orthographic projection) and these polygons will overlap on the UV map.

edit:

A more complete answer in an addon that calculates the UV projections of the mesh, depending of the camera positions.

As indicated above, it uses the same principle as the UV project modifier (in the UI part).

(the blank parts in the gif are parts where no image is given).

For each camera, you need to indicate the corresponding UV map and material slot to use. Then the script calculates the polygons oriented to each camera and for each polygon the projected coordinates to be assigned to the UV map.

The code below is commented for more information:

import bpy
import time
from mathutils import Vector
from operator import itemgetter

#Used to store information related to each camera setting
class UVPPCameraSetting:
    def __init__( self, scene, camera, obj, uvMap, materialSlotIndex ):
        self.camera = camera
        self.uvMap = uvMap
        self.materialSlotIndex = materialSlotIndex
        #Z axis of the camera translate in world (Z axis is opposite to view)
        self.zInWorld = Vector( (0, 0, 1) )
        self.zInWorld.rotate( self.camera.matrix_world.to_euler() )
        #To keep polygons to handle for this setting
        self.polygons = set()
        #Camera parameters
        #Matrix to convert from object coordinate to camera coordinates
        self.toCameraMatrix = camera.matrix_world.inverted() * obj.matrix_world
        #The frame is composed of the coordinates in the camera view
        frame = [v / v.z for v in camera.data.view_frame(scene=scene)]
        #Get the X, Y corners
        self.minX = min( v.x for v in frame )
        self.maxX = max( v.x for v in frame )
        self.minY = min( v.y for v in frame )
        self.maxY = max( v.y for v in frame )
        #Precalculations to avoid to repeat them when applied to the model
        self.deltaX = self.maxX - self.minX
        self.deltaY = self.maxY - self.minY
        self.offsetX = self.minX / self.deltaX
        self.offsetY = self.minY / self.deltaY

    #Calculate the UV coordinateds from the object coordinates
    def CalcUV( self, objCo ):
        #Object in camera view
        camCo = self.toCameraMatrix * objCo
        #Z is "inverted" as camera view is pointing to -Z of the camera
        z = -camCo.z
        try:
            #Translates x and y to UV coordinates
            x = (camCo.x / (self.deltaX * z)) - self.offsetX
            y = (camCo.y / (self.deltaY * z)) - self.offsetY
            return x, y, z
        except:
            #In case Z is zero
            return 0.5, 0.5, 0

def UVPerspectiveProject( scene, obj, camSettingList ):
    print( '------------------------' )
    startTime = time.time()

    matrix_world = obj.matrix_world
    rotation_world = matrix_world.to_euler()

    #Assign polygon to its corresponding camera considering faces most aligned to camera view
    for p in obj.data.polygons:
        normalInWorld = Vector( p.normal )
        normalInWorld.rotate( rotation_world )
        camSetting, maxDot = max( ((c, normalInWorld.dot( c.zInWorld)) for c in camSettingList), key=itemgetter(1) )
        camSetting.polygons.add( p.index )

    print( 'precalculations. elapse in seconds', time.time() - startTime )

    loops = obj.data.loops
    vertices = obj.data.vertices
    #For each setting,
    for cs in camSettingList:
        camera = cs.camera
        uvMap = cs.uvMap
        polygons = cs.polygons
        projectedCo = {} #Storage to avoid multiple calculations of the same world_to_camera_view
        #Go through all polygons
        for p in obj.data.polygons:
            #If the polygon corresponds to the setting
            if p.index in polygons:
                #Assign the material index
                p.material_index = cs.materialSlotIndex
                #Calculate each vertex uv projection
                for i, vi in [(i, loops[i].vertex_index) for i in p.loop_indices]:
                    if vi not in projectedCo: #not already calculated for this cam
                        x, y, z = cs.CalcUV( vertices[vi].co )
                        projectedCo[vi] = (x,y)
                    uvMap.data[i].uv = projectedCo[vi]
            #If not, uv are set to (0,0)
            else:
                for i in p.loop_indices:
                    uvMap.data[i].uv = (0, 0)

    print( 'done. elapse in seconds', time.time() - startTime )

def TargetObjExists( context ):
    try:
        scn = context.scene
        obj = scn.objects[scn.uvPerspectiveProject.object_name]
        return obj.type == 'MESH'
    except:
        pass
    return False

def IsCamera( context, camera_name ):
    try:
        camera = context.scene.objects[camera_name]
        return camera.type == 'CAMERA'
    except:
        pass
    return False

def SettingsAreOK( context ):
    try:
        scn = context.scene
        settings = scn.uvPerspectiveProject
        obj = scn.objects[settings.object_name]
        assert obj.type == 'MESH'

        for item in settings.cameras_settings:
            camera = scn.objects[item.camera_name]
            assert camera.type == 'CAMERA'
            uv_map = obj.data.uv_layers[item.uv_map_name]
            materialSlot = obj.material_slots[item.material_slot_name]

        return True
    except:
        pass
    return False

class UVPerspectiveProjectOperator( bpy.types.Operator ):
    bl_idname = "lemon.uvperspectiveprojectoperator"
    bl_label = "UV perspective project"
    bl_options = {'REGISTER'}

    @classmethod
    def poll(self, context):
        return context.mode == 'OBJECT' and SettingsAreOK( context )

    def invoke(self, context, event):
        scn = context.scene
        settings = scn.uvPerspectiveProject

        #try:
        obj = scn.objects[settings.object_name]
        cameraSettings = [UVPPCameraSetting( scn, scn.objects[item.camera_name], obj, obj.data.uv_layers[item.uv_map_name], obj.material_slots.find( item.material_slot_name ) ) for item in settings.cameras_settings]
        UVPerspectiveProject( scn, obj, cameraSettings )
        #except:
            #pass

        return { 'FINISHED' }

class UVPerspectiveProjectCamSettingsActions( bpy.types.Operator ):
    bl_idname = "lemon.uvperspectiveprojectpanelcamlistactions"
    bl_label = ""

    action = bpy.props.EnumProperty( items = ( ('UP', "Up", ""), ('DOWN', "Down", ""), ('REMOVE', "Remove", ""), ('ADD', "Add", ""), ) )

    def invoke(self, context, event):

        scn = context.scene
        settings = scn.uvPerspectiveProject
        index = settings.camera_setting_index

        if self.action == 'DOWN' and index < len(settings.cameras_settings) - 1:
            settings.cameras_settings.move( index, index + 1 )
            settings.camera_setting_index += 1

        elif self.action == 'UP' and index > 0:
            settings.cameras_settings.move( index, index - 1 )
            settings.camera_setting_index -= 1

        elif self.action == 'REMOVE':
            settings.cameras_settings.remove( settings.camera_setting_index )
            settings.camera_setting_index -= 1

        elif self.action == 'ADD':
            item = settings.cameras_settings.add()
            settings.camera_setting_index = len(settings.cameras_settings) - 1

        return {"FINISHED"}

class UVPerspectiveProjectCamSettingsPanel( bpy.types.UIList ):

    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):

        scn = context.scene
        settings = scn.uvPerspectiveProject

        try:
            obj = scn.objects[settings.object_name]
        except:
            pass

        suffix = " (" + str( index + 1 ) + ")"

        row = layout.row()
        col = row.column( align = True )
        col.prop_search( item, "camera_name", scn, "objects", text="Camera" + suffix  )
        col.prop_search( item, "uv_map_name", obj.data, "uv_layers", text="UV map" + suffix )
        col.prop_search( item, "material_slot_name", obj, "material_slots", text="Material" + suffix )

    def invoke(self, context, event):
        pass

class UVPerspectiveProjectPanel( bpy.types.Panel ):
    bl_idname = 'lemon.uvperspectiveprojectpanel'
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_label = "UV perspective project"

    @classmethod
    def poll(self, context):
        return context.mode == 'OBJECT'

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

        settings = scn.uvPerspectiveProject

        layout.row().prop_search( settings, "object_name", scn, "objects", text="Object" )

        if TargetObjExists( context ):
            layout.row().label( text="Cameras settings:" )

            row = layout.row()
            row.template_list( "UVPerspectiveProjectCamSettingsPanel", "", settings, "cameras_settings", settings, "camera_setting_index", rows = 3 )

            col = row.column( align = True )
            col.operator( UVPerspectiveProjectCamSettingsActions.bl_idname, icon='ZOOMIN', text="" ).action = 'ADD'
            col.operator( UVPerspectiveProjectCamSettingsActions.bl_idname, icon='ZOOMOUT', text="" ).action = 'REMOVE'
            col.separator()
            col.operator( UVPerspectiveProjectCamSettingsActions.bl_idname, icon='TRIA_UP', text="" ).action = 'UP'
            col.operator( UVPerspectiveProjectCamSettingsActions.bl_idname, icon='TRIA_DOWN', text="" ).action = 'DOWN'

            layout.row().operator( UVPerspectiveProjectOperator.bl_idname, text="Apply" )

class UVPerspectiveProjectCamSettingsProps( bpy.types.PropertyGroup ):
    camera_name = bpy.props.StringProperty()
    uv_map_name = bpy.props.StringProperty()
    material_slot_name = bpy.props.StringProperty()

class UVPerspectiveProjectProps( bpy.types.PropertyGroup ):
    object_name = bpy.props.StringProperty()
    cameras_settings = bpy.props.CollectionProperty( type = UVPerspectiveProjectCamSettingsProps )
    camera_setting_index = bpy.props.IntProperty()

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.uvPerspectiveProject = bpy.props.PointerProperty( type = UVPerspectiveProjectProps )

def unregister():
    del bpy.types.Scene.uvPerspectiveProject
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()


How to create a vertex on a parallel edge? I'm having this structure:

I would like to create a vertex where the arrow points to. This is the opposite of an existing vertex on the right edge, so just shifted a bit along y to the left.

Select the edge (as you did in the screenshot), press RMB > Subdivide. Hit 1 to enter Vertex Edit Mode. Select the new vertex, double-tap G to move the vertex along the edge with Vertex Slide.


Image sequence texture: no preview? I have a material assigned to a few test objects with an image sequence as a texture. If I view the scene in render preview, and scrub the timeline, (or render a sequence,) the texture behaves as expected.

However, with the viewport set to 'texture' or 'material' I only see the first frame of the sequence, wherever I am on the timeline. 'Auto Refresh' is set in the cycles texture node. Is this the expected behaviour?

Unfortunately yes, that is the expected behavior (or call it a limitation, or a missing feature, or a bug...). Images used as part of the material currently refresh only on rendered view in Cycles.

If you switch back to Material Shading or any of the other OpenGL shading views int he viewport, the material will only show last image displayed in rendered view.

Editing the material will also force a refresh, but only for the current frame.

As an alternative (or to use as reference) you use an empty as image and use an image sequence, or video file, it will refresh correctly regardless of shading mode in the viewport. (see this link: https://blender.stackexchange.com/a/13897/1853)

Images used as background will also refresh fine.

Note that images used as background and empties used as images are meant for reference only, and will display in the 3D viewport but are not renderable.