Rotate camera using eulers Question: My camera towards the target object located at (0,0,0). I know the current camera location (camx, camy, camz), camera rotation eulers. How can I calculate the new camera rotation eulers so that my camera can rotate any angles a long the camera z axis.

Following is the detailed description:
My camera is located at [camx,camy,camz] and the target object is located at [0,0,0]. In order to ensure the camera can correctly facing the object center, the following code is used to calculate the camera rotation eulers:

Vector = (0-camx,0-camy,0-camz)

direction = mathutils.Vector(Vector)

rot_quat = direction.to_track_quat('-Z', 'Y')

myeulers = rot_quat.to_euler()

cam.rotation_euler = myeulers

Everything works fine and the object is located in the center of the rendered image.

Now, I would like to rotate the camera like e.g. 45,90,180,360 degrees along the camera z axis so that the object in the rendered images is also rotated. Thus, I directly change the camera Z euler angle. However, after rendering, the object is not located in the rendered image center. In some images the object is missing. I guess the main reason is that the camera is rotated according to the world coordinate, the the local camera coordinate.

Do some of you know how to calculate the camera euler angles so that it can rotate only around the camera z axis? I need to use Python since those euler angles and the rendered images will be used for CNN training. Thank you very much!

Problem solved! Check the following code:
(1) Step one: Select camera and change the transformation orientation into 'Local'
(2) Step two: Write in Python:

cam = bpy.data.objects["Camera"]

cam.select = True

bpy.ops.transform.rotate(value=-1, constraint_axis=(False, False, True), constraint_orientation='LOCAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)

print(cam.rotation_euler)

Here you can change -1 into any angle you want to roll


How to clear values in measurelt (Toolpanel>display)) I am using helplines to determine the outer angles of the cylinder. I need these angles to align the cubes exactly to the cylindersides. Measurelt puts values on top of each other however, making them unreadable (see image) Is there a way to clear these values (then I can also get rid of the light blue angle font which is hardly readable)?
And if there is an easier way to align these cubes tot the cylinder I would like to hear that too. I know I can duplicate the sides of the cylinder and make them into cubes with the right angle, but that is not what I want.

Perhaps a quicker way to do this particular job is with an array?

Create your 14-sided cylinder at the origin.
Create your cube at the origin
In Edit mode move/scale the mesh of your cube to  your desired position with respect to one of the the cylinder's faces (probably down X in your example).. leaving its origin behind.
Create an empty at the origin
Assign an Array modifier to the cube with 'Object Offset' and the empty as target
Rotate the empty in Z, entering '360/14' as the angle
set the array count to 14

You can then select the empty and the cube array together, and translate them in Z to adjust the vertical position of the cubes. and if you edit the cube, all the arrayed instances of it will be edited too.

If/when you need the cubes to be independent, you can apply the modifier.


How are animations done in blender? When I try to make an animation, evrything goes in one motion. For example lets say I have two objects. If I want to make one object to move, then make it stationary, and then the other to move, then make that one stationary, then on the first object the same process. I can't do that. If I try and do that, both of the objects will move together. How to do it?

You would just need to add another keyframe for the second object that should stay on its current position until the first moving object has finished its movement. Otherwise the position of your second object would also be interpolated between the keyframes.

In this example the location of both objects is keyframed at frame 1 the sphere reaches its final location at frame 20. The cube stops at frame 42. To have the cube stand still another keyframe for the cubes starting position is added at frame 20.


How to automate this process (SVG to mesh > planar decimation > solidify > collapse decimation) to 300 files? I just learned using blender. I set up my first milestone to finish my first task and I did with the help of tutorials and other questions on here. I tried using the record script but with no success whatsoever. I need to convert my svg files into a mesh first, then do a planar decimation with an angle limit 0.1. Then solidify to a thickness of 0.009 and finally do collapse decimation to a ratio of 0.1.

I found a script on here from this post How to loop through 100 files to do solidify through script? and tweaked it a little bit. I failed to make it apply for SVGs so I tested it with a couple of stl files and it works perfectly, unfortunately I need to add more to it and my editing is not working well.

When I run this script with just the planar decimation at an angle of 0.1 it does not give me the same outcome as done manually.

I tried using the info header to get a command for a rotation of -97 on the y-axis but it always fails, even when I run it alone; same for the smart UV unwrapping.

Thanks!!

import bpy
import glob
import os

def process(stl_fname):
    print('Processing %r' % stl_fname)

    # Determine output filename.
    out_fname = stl_fname.replace('.stl', '-solid.stl')
    if out_fname == stl_fname:
        raise ValueError('stl_fname should end in .stl')

    # Perform the processing.

    bpy.ops.object.modifier_add(type='DECIMATE')
    bpy.context.object.modifiers["Decimate"].decimate_type = 'DISSOLVE'
    bpy.context.object.modifiers["Decimate"].angle_limit = 0.00174533

    bpy.ops.import_mesh.stl(filepath=stl_fname)
    bpy.ops.object.modifier_add(type='SOLIDIFY')
    bpy.context.object.modifiers["Solidify"].thickness = 0.009

    bpy.ops.object.modifier_add(type='DECIMATE')
    bpy.context.object.modifiers["Decimate"].ratio = 0.1

    bpy.context.object.rotation_euler[1] = -1.69297

    bpy.ops.object.editmode_toggle()
    bpy.ops.uv.smart_project(angle_limit=89)

    print('Writing to %r' % out_fname)
    bpy.ops.export_mesh.stl(filepath=out_fname)
    bpy.ops.object.delete()

# Start with nothing in the scene
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()

# Process *.stl
here = bpy.path.abspath('//')
for stl_fname in glob.glob(os.path.join(here, '*.stl')):
    if '-solid.stl' in stl_fname:
        print('Skipping %r' % stl_fname)
        continue

    process(stl_fname)

This is pretty quick and dirty so be sure to test a small sample 1st, but i think it covers everything you asked for. Running the script will add a toolbar in the 3d view port, the values you had set in the example are properties you can change before importing and exporting all the files in the directories. Have fun with it.

import bpy
import os
from bpy.types import Operator
from bpy.types import Panel
from math import radians

bl_info = {
    "name": "AutoSVG",
    "author": "Your Name Here",
    "version": (1, 0),
    "blender": (2, 79, 0),
    "location": "View3D > Tools panel 'T' > AutoSVG > AutoSVG",
    "description": "",
    "warning": "",
    "wiki_url": "",
    "category": "",
    }

def makeprop():
    bpy.types.Scene.auto_svg_dir_in = bpy.props.StringProperty(
        name="bpy.types.Scene.auto_svg_dir_in",
        description="",
        default="",
        subtype="DIR_PATH",
        )
    bpy.types.Scene.auto_svg_decimate_angle = bpy.props.FloatProperty(
        name="bpy.types.Scene.auto_svg_decimate_angle",
        description="",
        default=radians(0.00174533),
        subtype="ANGLE",
        )
    bpy.types.Scene.auto_svg_thickness = bpy.props.FloatProperty(
        name="bpy.types.Scene.auto_svg_thickness",
        description="",
        default=0.009,
        subtype="DISTANCE",
        unit='LENGTH'
        )
    bpy.types.Scene.auto_svg_ratio = bpy.props.FloatProperty(
        name="bpy.types.Scene.auto_svg_ratio",
        description="",
        default=0.1,
        )
    bpy.types.Scene.auto_svg_rotation = bpy.props.FloatProperty(
        name="bpy.types.Scene.auto_svg_rotation",
        description="",
        default=radians(-1.69297),
        subtype="ANGLE",
        )
    bpy.types.Scene.auto_svg_uv_angle = bpy.props.FloatProperty(
        name="bpy.types.Scene.auto_svg_uv_angle",
        description="",
        default=radians(89),
        subtype="ANGLE",
        )
    bpy.types.Scene.auto_obj_dir_out = bpy.props.StringProperty(
        name="bpy.types.Scene.auto_obj_dir_out",
        description="",
        default="",
        subtype="DIR_PATH",
        )

def delprop():
    del bpy.types.Scene.auto_svg_dir_in
    del bpy.types.Scene.auto_svg_decimate_angle
    del bpy.types.Scene.auto_svg_thickness
    del bpy.types.Scene.auto_svg_ratio
    del bpy.types.Scene.auto_svg_rotation
    del bpy.types.Scene.auto_svg_uv_angle
    del bpy.types.Scene.auto_obj_dir_out

def begin(scene):
    for files in os.listdir(scene.auto_svg_dir_in):
        if not files.endswith(".svg"):
            print("unexpected file type : ", files)
            continue
        bpy.ops.import_curve.svg(
            filepath=str(os.path.join(scene.auto_svg_dir_in, files)))
        bpy.ops.object.select_all(action='DESELECT')
        my_svg = bpy.data.objects['Curve']
        my_svg.select = True
        scene.objects.active = my_svg
        my_svg.name = files.rstrip(".svg")
        bpy.ops.object.convert(target='MESH')
        bpy.ops.object.modifier_add(type='DECIMATE')
        bpy.context.object.modifiers["Decimate"].decimate_type = 'DISSOLVE'
        bpy.context.object.modifiers["Decimate"].angle_limit = (
            scene.auto_svg_decimate_angle)
        bpy.ops.object.modifier_add(type='SOLIDIFY')
        bpy.context.object.modifiers["Solidify"].thickness = (
            scene.auto_svg_thickness)
        bpy.ops.object.modifier_add(type='DECIMATE')
        bpy.context.object.modifiers["Decimate.001"].ratio = (
            scene.auto_svg_ratio)
        bpy.context.object.rotation_euler[1] = scene.auto_svg_rotation
        bpy.ops.object.editmode_toggle()
        bpy.ops.mesh.select_all(action='TOGGLE')
        bpy.ops.uv.smart_project(angle_limit=scene.auto_svg_uv_angle)
        bpy.ops.object.editmode_toggle()
        bpy.ops.export_scene.obj(
            filepath=str(os.path.join(
                scene.auto_obj_dir_out, files.replace(".svg", ".obj"))))
        bpy.ops.object.delete()

class Auto_SVG_Tool():
    @classmethod
    def main(cls, context):
        scene = bpy.context.scene
        print("start button pressed")
        filevalid = ((scene.auto_svg_dir_in is not "") and
                     (scene.auto_obj_dir_out is not ""))
        if not filevalid:
            print("invalid file location or name")
            return
        begin(scene)

class Auto_SVG_Button(bpy.types.Operator):
    """Execute generation"""
    bl_idname = "file.autosvg_operator"
    bl_label = "Generate"

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

class VIEW3D_PT_Blank1_Blank2(Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = "AutoSVG"
    bl_context = "objectmode"
    bl_label = "AutoSVG"

    def draw(self, context):
        scene = context.scene
        layout = self.layout
        row = layout.row()
        col = layout.column(align=True)
        col.prop(scene, "auto_svg_dir_in", "Input Dir")
        col.separator()
        col.prop(scene, "auto_svg_decimate_angle", "Decimate angle")
        col.prop(scene, "auto_svg_thickness", "Solidify Thickness")
        col.prop(scene, "auto_svg_ratio", "Decimate Ratio")
        col.prop(scene, "auto_svg_rotation", "Object rotation")
        col.prop(scene, "auto_svg_uv_angle", "UV project angle lim")
        col.separator()
        col.prop(scene, "auto_obj_dir_out", "Output Dir")
        col.separator()
        col.operator("file.autosvg_operator", text="Start Files")

def register():
    print("registered")
    bpy.utils.register_class(VIEW3D_PT_Blank1_Blank2)
    bpy.utils.register_class(Auto_SVG_Button)
    makeprop()

def unregister():
    print("un-registered")
    bpy.utils.unregister_class(VIEW3D_PT_Blank1_Blank2)
    bpy.utils.unregister_class(Auto_SVG_Button)
    delprop()

if __name__ == "__main__":
    register()

changes include:
PEP8 compliance check via http://pep8online.com.
Removed several unused options in properties per batFINGER recommendations.
Invert logic in if statements per Dr. Sybren recommendation reducing indents.
Exported to .obj instead of .stl to preserve UV's.
Due to handling of bpy.ops.export_scene.obj() removed debug print commands.
Renamed curves based on imported file name.


Transluscent leaf using principled shader I this setup as shown in the screenshot. The image transparency plugs into the mix factor, the transparent and principled nodes plug into the mix shader inputs. I'm trying to figure out how to introduce translucency into the setup. Any help would be appreciated.

Final result:

I will show you two methods, first one (Translucent) is recommended because it's a lot faster approach and also with less geometry. For both of them you will need Mix Shader with Transparent BSDF and Alpha from Image Texture as a Factor.

Example above is rendered with only 32 samples. Beneath both meshes there is a light source to show the effect.

Translucent:

Simple mix between Principled BSDF and Translucent BSDF, both with Image Texture as a Color. Factor between them will allow you to control how much light will go trough mesh.

Subsurface:

For this method to work you will need to add some thickness to your mesh. I've added Solidify Modifier with pretty low value:

And node setup:

Choose color of Subsurface to be close to the Image Texture and set Subsurface strength.


Textures not showing after Collada Export I am using blender 2.76b. I am trying to export my model to dae file. My model has an Icosphere and Sphere with image textures applied to both. I have checked the Copy and Include Material Textures while exporting.

When I render the scene the object look fine with image textures applied to it. As Copy is checked, Blender automatically exports the image textures in the same directory as dae file.

When I try to import this dae file in Shiva3d or Sketchup, I can see the objects but I am not able to see the object with image textures applied to it.

I am facing the same problem when exporting to 3ds file

I can't figure out what the problem is. Can any help me figure out the problem

=======================================================================

I am successfully able to export the textures UV Map to dae file. Please have a look at the output below. The problem is that the textures are getting applied to individual faces rather than whole object.

I want the textures to be applied to the whole object and not individual faces. How do I fix this problem.

Don't export from cycles but from the Blender internal.
Make sure the model is unwrapped.
Make sure the mapping coordinates is set to UV Map.
Make sure the UV map is assigned.

This video shows the steps for applying the texture to a sphere (with "cillinder projection"):

https://www.youtube.com/watch?v=DaA_YJx7Auw&feature=youtu.be


How do you texture multiple objects with a single image? I have a jigsaw puzzle with 4 pieces.  Each piece is a different object in the scene.  I have an image that I want to span across the top face of each jigsaw piece.  How do you texture multiple objects with a single image?

https://drive.brainsick.com/blender/texturing/multipleobjects/2x2puzzle.blend
https://drive.brainsick.com/blender/texturing/multipleobjects/apple.jpg

Looking for a technique that will scale across 1000+ piece puzzles.

USING TEXTURE ATLAS ADD ON

Instal an add on in User Preferences (Ctrl+Alt+U).

Select all objects in Object mode then press '+' button in the Texture Atlas panel.

Press Start Manual Unwrap button.

Go to the Edit Mode, select all meshes (A) and unwrap it as you like (in my case U-->Project from View (Bounds)), then press Finish Manual Unwrap button.

It will create one UV map for all the pieces.

JOINING, UNWRAPPING, SEPARATING MESHES

Remove doubles for all your pieces (in Edit Mode press W-->Remove Doubles) and join all objects in Object Mode with Ctrl+J. Unwrap it in Edit mode, then separate meshes with P-->By Loose Parts.


What is Location in Python? I would like to know what variable Blender uses to determine location. Something like position_x = 0 or something? I dunno.

You can access an object by calling it in the collections (= all things stored in 'bpy.data')
For example:

import bpy

cube = bpy.data.objects["Cube"]

You can search in the console for things you can access from there, like the attributes of the object: i.g. type bpy.data.objects["Cube"]. in the console and press SPACE+. and it will show you all the attributes and methods of this object. One of these is location.

So to get an objects location:

cube_loc = bpy.data.objects["Cube"].location

or to set an objects location:

bpy.data.objects["Cube"].location = (1,1,1)


Game-ready hair mesh technique like Zbrush's imm brushes or better I wanted to figure out the best approach for game-ready hair that would likely be running in Unity as its game engine. I've found that Zbrush has imm brush/ hair strips and cards as a popular method.
1. How would this process be done in Blender or a technique to get results similar?
2. Would it take around the same time or would it be faster/easier just to invest in Zbrush?
3. If the substitute technique can't achieve effects as good as this hair strip method, what should I do instead with Blender?

With the game aspect in mind, I do want it to be able to be ran in a game engine of course, with performance generally in mind.

I want  to put this down for anyone who may read this answer for future reference. This was a breakthrough for me, and I hope it may be one for anyone who had similar problems to me.

If you

Don't want to pay money for the hair tool addon,
Don't want to pay money for Zbrush,
Don't want to use a particle-based hair system for Blender,
Don't want as limited control over hair strands in Zbrush,
Or if you just want to stay in Blender,

You may want to consider this following technique/addon. It's called Bevel Curve Tools, and it allows Blender users to use a hair-strip technique similar to Zbrush's imm brushes method while potentially being even better.

In addition to being free, this is supposedly better than Zbrush for controlling polycount for hair strips, easier to control tapering, generally less restricted than Zbrush's method. You can even duplicate a hair strand you may have made with its own beveling, which means you can easily manipulate it to add variation and change it to your liking. I'll be vague here since the video link below elaborates on it in much more detail if you're really interested.

For further details, please consider checking out this Youtube video on how to use these addon. And of course, free downloads to the addons themselves are both on the video's description and will be at the bottom of this post in case you are confident with learning the tool on your own.

Good luck.

Github Bevel Curve Tools Download

Github 2 Blender Sculpt Tools (This is for extra features for Bevel Curve Tools, download this if you think you need it.)

How to use Bevel Curve Tools (Youtube Video)


Why is this material so bright even without any lights? I am following a tutorial from Blender Guru making a donut. When rendering with Cycles my sprinkles glow, even hiding the light does not help. Cant find a way to fix this.

Your roughness value on the principled bsdf is way to high, it should be between 0-1. Having a really high value like that can make the shader behave abnormally.


Creating a Grease Pencil Material in Blender 2.8 I would like to pre-define a material for a grease pencil in an addon.  However, when a new material is created from python, it is not a grease pencil material (mat.is_grease_pencil = False).  It is not possible to set the mat.grease_pencil.color of this material, because this part of the data structure does not exist, etc.

What is the python equivalent of clicking the "New (add a new material)" button when a grease pencil object is active?

# Create a grease pencil object
bpy.ops.object.gpencil_add(type='EMPTY')
bpy.ops.object.mode_set(mode='PAINT_GPENCIL')
gp_obj = bpy.data.objects['GPencil']
bpy.context.view_layer.objects.active = gp_obj

# Create a net material
gp_mat = bpy.data.materials.new("my_gp_material")  # This is not a grease pencil material
gp_mat.grease_pencil.color = [0,1,0,1]  # This is not possible, as mat.grease_pencil is None
gp_obj.data.materials.append(gp_mat)  # Trying to draw after this will crash Blender

Thanks for your help!

Use bpy.data.materials.create_gpencil_data(mat) to add grease pencil material settings

import bpy
context = bpy.context
space = context.space_data

# Create material for grease pencil
if "Bright Material" in bpy.data.materials.keys():
    gp_mat = bpy.data.materials["Bright Material"]
else:
    gp_mat = bpy.data.materials.new("Bright Material")

if not gp_mat.is_grease_pencil:
    bpy.data.materials.create_gpencil_data(gp_mat)
    gp_mat.grease_pencil.color = (1, 0, 0.818649, 1)

# Add grease pencil object
gp_data = bpy.data.grease_pencils.new("Bright Pencil")
gp_ob = bpy.data.objects.new("Bright Pencil", gp_data)
context.scene.collection.objects.link(gp_ob)
if space.local_view:
    gp_ob.local_view_set(space, True)

for ob in context.selected_objects:
    ob.select_set(False)
gp_ob.select_set(True)
context.view_layer.objects.active = gp_ob
bpy.ops.object.mode_set(mode='PAINT_GPENCIL')

# Assign the material to the grease pencil for drawing
gp_data.materials.append(gp_mat)

# Draw, using the material defined
bpy.ops.gpencil.draw(wait_for_input=False)


Scripted expressions editor gives unexpected results Does anyone know why when I type in driver editor / scripted expression I get funny values?
This is my examle:
I drive spotlight angle with an cubes translate Z value witch is limited to value between 5 and 8(limit location constraint).
So when I leave "var" alone (which is 5 value) the result is 180° instead of 5?
Does anyone knwo why and how to remap the range from 5-8 to be 1-180?
Thanks in advance!

I answered my self when I posted this question :D
The scripted expression is working in radians by default and is auto converted to degrees in the spotlight object. So what I did was: var - 5 and got my range just in the sweetspot.
Now it goes approximately from 1 to 172 deg.
I'm not sure for the precise math behind it, but it is working for me. If you need in depth how the math is functioning, check degrees to radians conversion.
Cheers!


How to slide a edge by 10cm increments? I made a loop cut, slided it first all the way to the top, then slid it down and got 10 cm away from the top, which is good. I've tried to do the same thing for the bottom edge loop (to try to slide it 10cm away from the bottom) and it snaps to 9,5cm instead of 10cm. The only way I could fix this is by turning incrementing off, but is there something I can press to keep incrementing on?

Why does the second loop even increment to 9,5cm, instead of 10cm like the first one?

Edge Slide and loop cuts go by a “factor”, not a distance. So the snapping constrains that factor--in my quick test, to multiples of 0.1.

In your case you can select all the points and type in the exact value for the Z-coordinate that you want. This might be the easiest way.


Rendering flat faces shows too many tris! I am rendering out images of some low-poly cars I am working on. I am having difficulty with making the quads look as good in the render as they do in the scene view...in the below pic the scene view is on the left and render on the right. Any suggestions? Is this just a matter of modelling/flattening each face or is there a way to tweak this in the render?

Ah found the answer:

"Set smooth shading and add an edge-split modifier with the Edge Angle set to 0 degrees"

https://blenderartists.org/t/making-mesh-render-faces-as-quads-not-triangles-in-sculpt-mode/518770/7


Normal Map has seams when applied in Cycles I baked it with bake type normal, space tangent in blender cycles. The map itself seems to look fine, but when applied to the normal slot it looks broken at the seams.

I had to set the image texture to Non-Color-Data.

Now it works.


How to reset areas layout without losing data? Suppose I resized, duplicated, closed and created numerous areas in Blender. Now how can I return back? If I choose File - Defaults - Load factory settings I will not only restore layout, but also drop any objects in the scene.
How to restore layout only?

Save the project.
Go to the top menu and select: File>New to open an empty file with the default layout.
Again on the File Menu, select "File Open", when the window to select files appears press N  (or press the gear icon on the top right) to open the options tab.
Uncheck "load UI" and then select your file and open it.

The file should now open with the default user interface and layout.
I'm the future you can avoid creating a messy interface by using a layout instead of subdividing windows.


No search items in AN I have no search items in Animation nodes ( Shift+A, S - type item name. But list is empty)
How can I fix this?
Blender version I tryed 2.83.6 LTS and 2.9 LTS. AN version 2.1.8

Please use [ctrl+a, f] instead .
Description

shift+a shows this popup :-

If f is pressed now, you will virtually press the "Search..." which show nothing.
For some unknown reasons, the button is  currently  broken.

ctrl+a shows this popup, which is what you want:-


How to make the sequencer 'Preview' area fullscreen with python? How do I, with python, select the sequencer area which has a view type as preview, to make it active/context? (And not select the "strip" window)

EDIT: My overall goal is to add a windowless, fullscreen, correctly scaled video-preview function to the VSE view menu(shortcuts: alt+F10, alt+F11 and home). In the video-editing workspace, there are two areas which are sequencer areas. One is the view type: sequencer(with strips) and one is view type: preview. When adding the function to the menu with SEQUENCER_MT_view, it is added to both areas, but I only want to make the preview area full screen, not the strip area. So I need help to make sure that the full-screen functions only will make the preview area full screen. How do I do that?

Where I am now(after help from SNU) - But get the working code from Snu further down:

import bpy

class SEQUENCE_MT_true_fullscreen(bpy.types.Operator):
    """True fullscreen preview. Close in upper right corner"""
    bl_label = "True Fullscreen"
    bl_idname = "sequencer.true_fullscreen"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        scene=bpy.context.scene

        if not bpy.context.scene.sequence_editor: #create sequence, if missing
            bpy.context.scene.sequence_editor_create()

        context = bpy.context
        for area in bpy.context.screen.areas:
            if area.type == 'SEQUENCE_EDITOR':
                if area.spaces[0].view_type == 'PREVIEW':
                   override = bpy.context.copy()
                   override['space_data'] = area.spaces.active
                   override['region'] = area.regions[-1]
                   override['area'] = area
                   override['screen'] = context.screen
                   bpy.ops.screen.screen_full_area(override, use_hide_panels=True)
                   bpy.ops.wm.window_fullscreen_toggle()
                   #bpy.ops.sequencer.view_all_preview() #uncomment this to crash
                   break

        return {'FINISHED'}

def menu_append(self, context):
    self.layout.operator(SEQUENCE_MT_true_fullscreen.bl_idname)

def register():
    bpy.utils.register_class(SEQUENCE_MT_true_fullscreen)
    bpy.types.SEQUENCER_MT_view.append(menu_append) # add to "view" vse header menu

def unregister():
    bpy.utils.unregister_class(SEQUENCE_MT_true_fullscreen)
    bpy.types.SEQUENCER_MT_view.remove(menu_append)

if __name__ == "__main__":
    register()

After realizing I wanted this feature as well, I have been giving this some thought.  The script shouldn't be trying to figure out which preview to full-screen (there may be more than one preview), it should let the user decide that.  This can be accomplished by moving the check for the space view_type into the menu_append function, and having the operator just use the passed in context.

I was also thinking about how to close this preview, and I think the best way to do so would be to just use a modal operator for the whole thing, and revert everything once it ends.

So, after some reworking, here's the code I came up with:

import bpy

class SEQUENCE_MT_true_fullscreen(bpy.types.Operator):
    """True fullscreen preview"""
    bl_label = "True Fullscreen"
    bl_idname = "sequencer.true_fullscreen"

    runs = 0
    original_area = None

    def invoke(self, context, event):
        self.original_area = context.area
        bpy.ops.wm.window_fullscreen_toggle()
        self.runs = 0
        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def modal(self, context, event):
        if self.runs == 0:
            override = context.copy()
            bpy.ops.screen.screen_full_area(override, use_hide_panels=True) #This has to be delayed because if it is run in the invoke function, it crashes blender...
        if self.runs == 1:
            bpy.ops.sequencer.view_all_preview() #This has to be delayed because if it is run right after the screen_full_area, it crashes blender...
        self.runs = self.runs + 1
        if event.type in {'RIGHTMOUSE', 'ESC'}:
            bpy.ops.wm.window_fullscreen_toggle()
            bpy.ops.screen.header()
            bpy.ops.screen.back_to_previous()
            override = context.copy()
            area = self.original_area
            override['area'] = area
            override['space_data'] = area.spaces.active
            for region in area.regions:
                if region.type == 'PREVIEW':
                    break
            override['region'] = region
            bpy.ops.sequencer.view_all_preview(override)
            return {'FINISHED'}
        return {'PASS_THROUGH'}

def true_fullscreen_menu(self, context):
    if context.area.spaces[0].view_type == 'PREVIEW':
        self.layout.operator(SEQUENCE_MT_true_fullscreen.bl_idname)

def register():
    bpy.utils.register_class(SEQUENCE_MT_true_fullscreen)
    bpy.types.SEQUENCER_MT_view.append(true_fullscreen_menu) # add to "view" vse header menu

def unregister():
    bpy.utils.unregister_class(SEQUENCE_MT_true_fullscreen)
    bpy.types.SEQUENCER_MT_view.remove(true_fullscreen_menu)

if __name__ == "__main__":
    register()

Note that I had to use the modal operator to delay a couple operators, or blender crashed -_-

edit: fixed that last issue!


How to add dirt to a glass shader? I am rendering an image of a grotty old looking light-bulb. I can make a decent clear glass material, but, not a perfect one.

I simply cannot get the dirt textures to overlay properly.

How can I add dirt to my glass shader without ruining the glass material underneath it.

There is also an emission shader on the filament inside the bulb.

I tried looking for tutorial but they are all based on non transparent materials.

You can try adding a scratches map to your glass material. A quick Google search for "scratch bump map" can lead to some good results.

For the nodes, I would suggest two Glass BSDF shaders, one with 0 roughness and one with 0.4 roughness, run into a Mix Shader (0.4 Roughness one in top shader input). Use the image as a fac in the Mix Shader. You can add a Bright/Contrast node between the Image Texture and the Mix Shader. Adjust the Bright: value to affect the roughness.

Unfortunately, I can't post screenshots right now.


Access Bone Coordinates using Python API I'm trying to export bone coordinates using ob.find_armature().data.bones.

I made a test file that has two connected bones, and set these position values manually in the UI.

Bone 1 Coordinates

Head: (1, 1, 1)
Tail: (2, 2, 2)

Bone 2 Coordinates (connected to Bone 1)

Head: (2, 2, 2)
Tail: (3, 3, 3)

So I go to access the bone data in python, and here's what I get.

Bone 1 Coordinates

Head: (1, 1, 1)
Tail: (2, 2, 2)
I guess these are absolute world coordinates.

Bone 2 Coordinates (connected to Bone 1)

Head: (0, 0, 0) These must be relative to the last bone's tail.
Tail: (-0.00000, 1.732051, 0.000000) What are these?

Proof and test Blend file: https://app.box.com/s/olb6hzi3p0z4ejqbtyfk

API docs:

  head - Location of head end of the bone relative to its parent

  head_local - Location of head end of the bone relative to armature

  tail - Location of tail end of the bone

  tail_local - Location of tail end of the bone relative to armature

Since Bone 1 has no parent, the vector between object origin and bone head is used.

Bone 2's head it at Bone 1's tail (Connected is ticked), thus Bone 2's head is at (0, 0, 0) because there is no distance between both.

Bone 2's tail is at (0, 1.732, 0) because it's given relative to its parent bone. Bone 1 and 2 face the very same direction, all it takes is the length of the bone to define its endpoint (Bone direction is on the Y-axis in Blender). Tail minus head is

(3, 3, 3) - (2, 2, 2) = (1, 1, 1)

and the length

sqrt(12 + 12 + 12) = ~1.732


Can't select keyframes on timeline? I opened up my project and everything was fine. But when I selected the keyframes, the yellow timeline thing would go over my keyframes?

How does this even work!?

A keyframe does not have to be aligned to a rendered frame. While that may sound a bit un-intuitive, a frame is a point in time, for example 24 frames in a second. A keyframe can define a value at any point in time not just on a specific frame.

It is normally considered better to have keyframes aligned to frames to get cleaner animation results. To help with this the Dopesheet and Graph Editors can auto-snap when editing keyframes.

Having keyframes that aren't aligned to a frame means you moved the keyframes in the Dopesheet or Graph editor with snapping turned off. You can simply enable snapping and align them, if you enable snapping to nearest frame then select all the keyframes and start moving a little bit they will all snap to the nearest frame without destroying your animation.


How to export Blender 2.8 for Elements 3D/After Effects (+ Node material)? I'm new to Blender, but thanks to a few tutorials online, managed to create a cool fireball effect I'd like to utilize in one of my upcoming videos (hence Elements 3D / After Effects).

But, despite exporting the object and loading the mtl files into Elements 3D, all I get is the following:

The animation works great, and I'm getting the opacity, but that's about it.

To help clarify, below are some screenshots of what I'm trying to produce... but everything about the material was created using a node tree, which might be the issue?

Desire Result:

Full Node Tree:

Zoom in:

Just to show material location (within isosphere)

Any help would be greatly appreciated! I tried learning how to bake this using a YouTube tutorial, but I think because I'm not using Principled BSDF, it's not working? I'm honestly unsure. Sorry for such a newbie question!

I don't now about Elements 3D / After Effects material system, but I'm sure there is no direct solution for node setup export.

Nonetheless typical workflow is to bake material textures in Blender and apply them in other editor.
I prefer Principled-Baker addon.


How to install numpy for blender-python (OSX) I've been googling for this, and I can't find a definitive answer.

Here are of the options I can find:

https://plus.google.com/106742462387083223310/posts/696yEuzhf2b
which suggests: 'sudo python3.2 setup.py install --install-lib /usr/lib/blender/scripts/modules/'

but I don't see how that has anything to do with numpy, so I'm going to skip this one for now.
http://blenderartists.org/forum/showthread.php?324822-Another-NumPy-issue
Install numpy using existing Python3, and then manually copy /numpy folder over
I've tried this, as below, and it fails just the same as in that thread
Delete Blender's Python, forcing it to fall back upon  the system Python installation
I'm reluctant to do this as I want this module to be publicly usable, and I don't like the idea of requiring people to cobble their blender to make it work.

So, going with (2):

I'm on OS X and I have a separate Python3 courtesy of Homebrew.

piBookAir:~ pi$ pip install numpy

piBookAir:~ pi$ python3
Python 3.3.4 (default, Mar  8 2014, 14:52:56)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> print( numpy.__file__ )
/usr/local/lib/python3.3/site-packages/numpy/__init__.py

So now I copy the /numpy folder over to ~/BlenderScripts/modules/
(I have set ~/BlenderScripts as my scripts folder)

I restart Blender, go into the Python console:

The error is "ImportError: cannot import name add_newdocs"

What am I doing wrong?

Also, if I may bundle two questions into one, can I copy my ~/BlenderScripts onto a fresh system (maybe with a different operating system) and expect a script that imports numpy to still work?

Numpy is included in Blender 2.70 on Windows, Mac OS X and Linux.


Why is the curve modifier deforming strangely? I modelled a part of a bicycle chain added an Array and a Curve Modifier

everything worked nicely until I added cogs and translated and scaled the chain parts to fit the cogs.

I tried to apply transformations, re-added the Curve Modifier but had no success, it still deforms the chain that strange:

Before I messed it up it looked like this:

How could it be fixed?

.blend

If you want the chain to follow the curve, move it to the origin of the curve (they need a common center).

Select the curve, press Shift-S and select Cursor to Selected
select the chain, press Shift-S and select Selection to Cursor

Then apply your curve modifier and the chain will follow the curve correctly.

The deformation is fixed scaling the object


How to automatically rename empties created with hook operator I need to rename each new empties I've made. Can you help me?
import bpy, bmesh

#select vertex

bpy.ops.object.mode_set(mode = 'OBJECT')
obj = bpy.context.active_object
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_mode(type="VERT")
bpy.ops.mesh.select_all(action = 'DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
for vert in range(len(obj.data.vertices)):
    obj.data.vertices[vert].select = True
    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.ops.object.hook_add_newob()

The hook is the object of last modifier.
When a modifier is added it is going to be the last one on the modifiers stack. Since the operator has added both the modifier and the empty and assigned it to the object property of the modifier, then
new_mod = obj.modifiers[-1]
new_mod.object.name = "Foo"

The whole process of adding hooks can be achieved without using the operator as demonstrated here, or any operator had the empties not been added with one
How can I animate a vertex translation of a triangular mesh?
and the "opposite" ie parenting empties to verts so they follow verts
Blender python to hook vertex and empty
Have used foreach_set to deselect all edges and faces and each vert.  Basically for a 3 vertex object
me.vertices.foreach_set("select", [True, False, False])

is equivalent to
me.vertices[0].select = True
me.vertices[1].select = False
me.vertices[2].select = False

Test Script.
import bpy

obj = bpy.context.object
me = obj.data
# deselect all faces and edges
me.polygons.foreach_set("select", (False,) * len(me.polygons))
me.edges.foreach_set("select", (False,) * len(me.edges))
n = len(me.vertices)
for i in range(n):
    bpy.ops.object.mode_set(mode='OBJECT')
    me.vertices.foreach_set("select", [i == j for j in range(n)])
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.object.hook_add_newob()
    obj.modifiers[-1].object.name = f"Hook_{i}"

bpy.ops.object.mode_set(mode = 'OBJECT')


Can't find Color Balance node I'm using Blender 2.78 on a Mac and I can't find the color balance node in cycles, do I need to install an add on or enable it?

Thanks

The color balance node only exists in the Compositor window, not in the Shader Editor.

To go to the compositor, press this icon at the bottom of the node panel editor and check Use Nodes

In Blender 2.8x and further:

In versions 2.7x or earlier: select the compositing option.

and select use nodes:


Hand rig not deforming properly After watching about 20 rigging tutorials is till can't figure it out,
I've already created the bones but I just need to parent them and that's the part I cant figure out. Can someone who does know how to do it make a simple rig out of it and send it to me so i can use it and finally understand it?
My blend file can be found here: File

Select your mesh and hit ALT+P then choose Clear Parent
Delete all vertex groups

Enter Edit mode and select all using P then hit the Space Bar and write Flip Normals

Select your mesh then select your armature using Shift+Right Click and hit Ctrl+P and choose Automatic Weighting

Set Pivot to Median centre and now the arms and fingers will be deforming nicely


Drivers and value limits on Node Groups Let's say you want to use drivers to avoid the max value to be lower than the min value on a node group. As you can see the driver works, the value is changing, but is not limiting the max value.
Video: click to see the video
This could be a very good way to make better controls for nodegroups (smarter)

Once you have your thresholds set, disconnect the noodles on the inside of the group and reconnect them.  For whatever reason the values don't update properly while actively in use anywhere down the chain.


How can I align faces that share an edge in Python? (without moving the common edge) I need to set a face's direction from a Python script using bpy modules.
I tried the below code, but it does not work correctly.

obj = bpy.context.active_object
bm = bmesh.from_edit_mesh(obj.data)
faces = []
for f in bm.faces:
    if f.select:
        faces.append(f)
    if len(faces) >= 2:
        break
c = faces[0].normal.dot(faces[1].normal) / (faces[0].normal.magnitude * faces[1].normal.magnitude)
c = min(1, max(-1, c))
angle = acos(c)

cv = []
for l0 in faces[0].loops:
    for l1 in faces[1].loops:
        if l0.vert.index == l1.vert.index:
            cv.append(l0.vert)

ov = []
for l1 in faces[1].loops:
    for c in cv:
        if c.index == l1.vert.index:
            break
    else:
        ov.append(l1.vert)

axis = cv[1].co - cv[0].co
axis.normalize()

mat = Matrix.Rotation(-angle, 4, axis)

for o in ov:
    o.co = mat * o.co

I don't get it why this code doesn't correctly.
Is there any method to arrange face's direction from python scripts?
Here, I show what I want to do.

Before:

After:

Any idea?

Here's a slightly different approach that worked for me. It rotates the active face to align it with the other selected face (that is not active).

It uses the common edge as the pivot point for the rotation. It doesn't have any tests for making sure only two faces are selected etc, so will only work with two faces selected in edit mode.

import bpy, bmesh

o  = bpy.context.object
bm = bmesh.from_edit_mesh( o.data )

active   = bm.select_history.active
selected = list( # Find non-active face using set boolean difference
    set( bm.select_history ).difference(
        set( [ bm.select_history.active ] )
    )
)[0]

# Calculate the rotation difference between the selected and active faces' normals
rot = active.normal.rotation_difference( selected.normal ).to_matrix()

# The pivot is the common edge's center point
# Intersect both faces' edge sets to find the common edge
pivot = list(
    set( active.edges[:] ).intersection(
        set( selected.edges )
    )
)[0]

pivot_coos = [ o.matrix_world * v.co for v in pivot.verts ]
pivot_vec  = ( pivot_coos[0] + pivot_coos[1] ) / 2 # Calculate edge center

bmesh.ops.rotate(
    bm,                      # BMESH object
    cent   = pivot_vec,      # Rotation pivot point (edge center)
    matrix = rot,            # Rotation value
    verts  = active.verts,   # What verts to rotate (active face's verts)
    space  = o.matrix_world  # Rotate in object world space
)


2.8 how to restore timeline cursor jump to left click in older versions of blender you could just click anywhere in the timeline and the cursor would jump to where you clicked, instead now it defaults to box select.

how do I change it back so i can just click anywhere in the time line?

If you're in left click mode then Shift + right click will get the playhead to move the position you click.


Object appears mottled in views and renders Anyone know why my object appears corrupted and spottled after decimate? I tried flipping normals, deleting uv's and adding a material, to no avail.

Yup found your problem it's indeed an issue with your Normal data on the model.

These are the steps

Goto Properies panel "Data" tab.
Goto "Geometry Data" Header
Select "Clear Custom Split normal Data"

That's all to it. There is a history to this thing, can't remember them at the moment may add to the answer later.


Mirror is going in different direction Im made the half model and when im using mirror modifier its going little bit off the direction it should be.Im using reference image. with the reference image i have made the half model and when mirror the reference image not match. Any suggestion or help Thanks

Without Mirror

Mirror Modifier

Not mirror perfect

Reference image

The point is you have rotated the mesh in order to align it to the reference image.

But this is difficult to do that and to align the mesh with its origin (which is used by the mirror as point of symmetry).

Generally, reference images are rotated and scaled before so that they are aligned to the 3D view axis.

But you can correct it:

Reset the Z rotation to 0°
Snap the 3D cursor at the object origin (in object mode, having the mesh selected: ShiftS then 'cursor to origin')
Enter edit mode
Activate the mirror
Set the 3D cursor as pivot point
Select all the vertices
And try to rotate/move the vertices so that the mirrored part is well aligned and mirrored

Once done, come back to object mode and rotate to check if your mesh is OK comparing to the reference.

Your blend file, a bit (but not perfectly) corrected :


"Copy to selected" dose not work with curves ? or Nurbs? I want to set "preview U resolution" of all the selected curves to 48.

I select all the curves and shift select one curve change its
"preview U resolution" to 48.
Set "preview U resolution" to 48.
Then right-click to "Copy to selected"

Copy selected is grayed out! Why ? does it not work on curve objects? or Nurbs ?

Note: it works fine on mesh objects

i learnt of copying through script from another post. And here is what i have changed to suit this purpose.

import bpy
active_obj = bpy.context.object

for obj in bpy.context.selected_objects:
    if obj != active_obj:
        # resolution U
        obj.data.resolution_u = active_obj.data.resolution_u
        # We could also access other proerties like bevel
        obj.data.bevel_depth = active_obj.data.bevel_depth


Export constraints and inverse kinematics Is it possible to export constraints (for example limit rotation constrains) and inverse kinematics from blender? These exports would be imported into WorldViz to interact with the object in virtual reality(No fixed animations).

Which file-format would I need to use?

Optional:

Is there a way to export to cmfx? (This file-format is used by WorldViz)

FBX or collada can bake effects of the constraints while exporting animations, that’s all. There is no way to export constraint/IK systems themselves, afaik.

Further more, I’m not sure that would make sense at all, seeing how hard it is already to support basics of exchange between applications that all have different ways of handling common topics (referring to animation and armatures e.g.), I would suspect things rather complex and advanced like constraints to be a plain nightmare.


Howto get the filepath of a rendered animation frame with python I want to modify every frame in an animation after it has been saved as an image. Since bpy.data.images["Render Result"] doesn't have associated data I need to load it from disk.

How do I get the path of the last rendered frame in a render_post handler?

The filepath is stored in:

bpy.context.scene.render.filepath

However there is a function to find the output filename for a frame (the same function blender users internally).

output = bpy.context.scene.render.frame_path(frame=10)

example use:

>>> bpy.context.scene.render.filepath = "/test/some_###_anim.png"
>>> bpy.context.scene.render.frame_path(frame=10)
'/test/some_010_anim.png'


How is the direction of interpolation determined? I keyframed two poses and expected the arm to move upward (shortest way) like:

But what actually happens is that the lower arm moves the other way around to reach the second pose.

Is the interpolated movement always clockwise? Can the direction be influenced, or could there be some other reason for this behaviour?

I use quaternions if this matters.

The issue you are having looks like it's related to the way quaternion rotations work.

A bone in the rest position would normally have values of 1,0,0,0, a W value of 0.001 will leave the bone in roughly the same place, yet a W value of 0.0 will flip the bone in the opposite direction.

I'm pretty sure this only happens using quaternions when all 4 values are 0.0.

So it would appear that your animation curves manage to travel from positive to negative values to cause the flipping.

An easy solution may be to add a pose in between to define a pose between the two extreme poses, instead of having it take the shortest path.


Expand box/UI/drop down in AddonPreferences to show more user preferences This Code works fine CodeManx:- https://blender.stackexchange.com/a/19158/78916, but how would I get this work in  an AddonPreferences cutom boxex? I can get it to work but it references 'object' 'cube' I would like to have it reference a UI file! Not asking for a script but something I can read to get my head around building custom UI's for the AddonPreferences, driving me crazy to get anything other that this, reference wise. HardOps has a perfect example of what I want in a expand panel on the UI tab, those are perfect to what I want, but I've a hard time following the code in 'Hops' python! An Expand box/panel is what I want (I think) but I just cant get anything to work in AddonPreferences, where do I need to look and what to read?

Right guys, thanks for he pointers, batFINGER pointed me in the right direction, I did look at the link brockmann posted and have seen that link on my quest travels. I don't know if I've found the right direction as I've used WM for the toggle but had in my head that all when hovered would point back to preferences! BUT I've got the look that I was looking for, I was after changing the icons ref toggle state but cant get anything to work but happy as it is, achieved my goal, thanks for the help, here is my code/effort:-
import bpy

preference.py file that gets imported from _init.py
from bpy.props import ( StringProperty,
BoolProperty,
FloatProperty,
)
from bpy.types import (AddonPreferences,
)
class AddonPreferences use (bl_idname = package) if multiple file.
class PREFS_PT_MyPrefs(AddonPreferences):
bl_idname = package
# prop listings strings
some_folder = StringProperty(
    name="Assets Folder",
    subtype='DIR_PATH',
    )

# prop listings bools
bpy.types.WindowManager.prop_toggle1 = bpy.props.BoolProperty()
bpy.types.WindowManager.prop_toggle2 = bpy.props.BoolProperty()

# prop listings float
test_ing = bpy.props.FloatProperty(default=1.0)

# user prefs panel
def draw(self, context):
    layout = self.layout

    # prop 1
    wm = context.window_manager

    box = layout.box()
    box.prop(wm, 'prop_toggle1', icon='TEXTURE', text='HEADER', expand=False, emboss=True)

    if wm.prop_toggle1:
        box.prop(self, "test_ing", text='TESTING')

    # prop 2
    box = layout.box()
    box.prop(wm, 'prop_toggle2', icon='FILE' , text='HEADER', expand=False, emboss=True)

    if wm.prop_toggle2:
        box.prop(self, "some_folder", text='TESTING')

    # keep adding prop toggles!!!
    # Class registered on __init__.py file


how to move 3dcursor with axis constraint i am trying to use 3dcursor to set at center bottom of the object.
"shift S" can set the cursor at center, then i would like to move only Z axis to snaps to the some other bottom vertex.
i could do this with maya using "D" (move the pivot) and "V"(snap to vertex) with active manipulater axis.

moving cursol as pressing "Z" also could do similar,but it slips from the start position.

please if someone know other tips for this??

for now, i copy the z position from vertex first, and paste it to cursor z position.

To do this, you should first enable Face Snapping. Press the magnet icon to enable snapping, and open the drop-down menu and select Face. You can toggle snapping using Shift+Tab. Also, Ctrl+Shift+Tab can be used to bring up the snapping type menu.

From there, use the Cursor tool and press Z to lock the motion to the z-axis. Holding down LMB and hovering over the face of the cube will then move the 3D Cursor downwards to the face.
Tip: You can also move the 3D Cursor by pressing Shift+RMB.


Why do we have to apply location, scale, rotation onto a mesh and what are its consequences? I'm asking as everyone in tutorials apply it onto the mesh but they don't explain it properly.
It seems to me that it causes some problems. But I still didn't get why it causes problems if I don't apply location, rotation, scale to a mesh.

It's not only physics but most of all modifiers that require it. When you don't apply Loc, Rot, Scale the modifs give undesired effects in the way they remember previous state. Try it!


Clamping camera to path, existing keyframe positions are thrown out when path is extended? I'm using a Clamp constraint to animate a camera along a path for a long, continuous fly-by shot with pauses and target changes along the way. I'm keyframing on the transform of the camera dolly, but every time the path is modified, particularly extended, the position of the dolly in all the previous keyframes is thrown out, requiring lengthy repositioning and re-keying to correct all the timing. I've experimented with using a Track constraint instead, and animating the Offset, but this still suffers the same issue when the path is modified.

This behaviour suggests to me that, even when keying on a transform rather than an offset, Blender is doing some math and quietly converting everything to a relative offest. When the length of the path is modified then all the previously keyed positions also change because they're relative to the length of the path rather than being, say, fixed distances from the start of the path.

Is there a way to 'lock' an object to a fixed position in a keyframe so that it doesn't move when the length of the path is extended, i.e. if object A is X units from the start of the path in keyframe Y, when segments are added to the path then object A is still X units from the start of the path in keyframe Y.

Gracious thanks for any advice, it's much appreciated and may save me from this slow descent into madness. My apologies if my description is not clear, if this question has already been solved elsewhere, but especially if I am doing something really dumb, missing a trick, or otherwise dementedly trying to stuff a round thing into a square hole.

Maybe there's another solution but here is a trick that may satisfy you:

Create your curve, give it the right direction, put its origin at the beginning.

Create an object (here a sphere), in Edit mode select all the vertices and assign them a vertex group, in Object mode put the object at the exact same beginning point as the curve, give it a Curve modifier with the curve as Object.

Create your camera, give it a Copy Location constraint with the sphere as Target, and the sphere's vertex group as Vertex Group.

Now when you move your sphere forwards on the right axis (here the Y axis), it follows the curve and the camera follows as well. If you extrude the curve, it won't move the camera's position.


How to evenly distribute vertices in an uv map? I try to make a UV map for my object that fits the form of an already existing UV map. I manually positioning the outer edge of the map so it matches the existing map. But the innards are not in good shape.
Now I want to select one of the loops and make the vertices have all the same space between them. I tried to use Looptools but they are not available in UV Image Editor.

How can it be done automatically to even out the spacing of all the inner vertices on a selected loop?

Select the loop and enable the Sculpt tool:

With holding Shift smooth the selected vertices. This will space them evenly:

Make sure the sculpt brush has Lock Borders enabled:


Advice on how to model this piece of a chair? I'm trying to model the Yksi Chair from the Fredericia website. I've modelled a couple other simpler pieces of furniture, and I'm doing this for practice. I can do pretty much everything, but I'm struggling with the backrest on this chair. Here are some more photos of the chair for reference:

I've gone through BlenderGuru's chair modeling tutorial, and I tried applying the same techniques (mirror mod, use plane to outline shape, subsurf mod, solidify mod) but I just can't seem to get it right. I've also tried making the basic curve of the top part with a bezier curve, converting to a mesh, and then extruding the points down and repositioning/scaling them to fit the bottom. It's okay so far, but it still doesn't look straight and even like it does in the photos. The "arm" portions of mine always somehow get twisted or warped along the way, and it doesn't look like one uniform piece like it should. In my current attempt (there have been many) I have it as good as I can get, but then that little nubby bit that connects to the legs is also giving me problems. I can never seem to extrude it in the right direction, and I have to resort to snapping it along one of the edges until it looks good enough.
Can anyone offer tips or advice on how to model a piece like that? What method do you go for?
Here's my .blend file:

Maybe you should simply extrude a plane along the shape, in front, left and top view, then extrude inwards, then bevel, etc...


Connect two cylinders at the corner of a bench seat I have another problem within Blender. I can't find a way to connect two cylinders at the corner of a bench seat. I have four corners to connect.

Here is a picture:

Only one of the corners is depicted. I tried selecting the two faces I want covered and making Edge/Face, however that doesn't work. I don't want to select two edges at a time and make edge/face. That's going to be tedious and will take a while.

Here is the .blend: Blendfile

I'm not trying to achieve what this question asks. This is what would be an "L joint" if the cylinders' connection were to be called one.

Well it can be achieved with Bridge Edge Loops function:

Align 'end cap' polygons at the beginnings of the desired curve. The trick is to maintain same distance from the angle point
Select both caps and press W > Bridge Edge Loops
Tweak connection properties


Freestyle is confusing me - Cycles Blender I have been trying for the past 3 days to try and get freestyle to work in Blender cycles, but I can only find tutorials for Blender  Internal.

I don't like working in Internal, but I can't figure out how to get the freestyle to work in Cycles!

I am not a seasoned blender-ist, so please explain with pictures

So the thing is Cycyles viewport rendering doesnot support freestyle yet so you will have to render the scene to see the freestyle in action!


Making a shader that would "fill" an open mesh? I made a material that mixes two shaders using an empty which acts like a kind of mask for those shaders.
If I move my empty up, there will be more blue shader.
If I move it down, there will be more transparent shader.

My goal here is to make a glass that would be filled with water; using a single mesh with this special material, and moving my empty to "fill" the glass.

It is working quite well, but...
As the material goes along the mesh, it shows up like if the mesh missed a face; has its "cap not filled".
I was wondering if it was possible to tweak my blue shader so the mesh would always seems closed ?

Thanks !

Staying inside Cycles alone might not produce the desired results..

Here i'm using the Z component of the Geometry's position socket to compare with a scalar value (Representing the distance from the ground)

Most likely you'll need to animate a boolean intersection with a plane, one slice of will be the glass/transparent material, the other slice will be the solid/diffuse material (or whatever you want).

Here i've separated them spatially to indicate they this method uses two X Objects to and two planes, both planes point in opposite directions:

The closest I get without making it complicated is this:

It uses the Normal of the upper cut to decide how much to mix between glass and transparent. The normals pointing downwards (on the cutting surface) are the faces that are mixed to Transparent most. The exact shader mixing is something you'll need to decide on yourself.


How to have multiple soft bodies in a single object? I want to use soft body physics on a human character. It means breasts physics is different than butt, thighs or belly. Is there any way to apply multiple soft bodies on single object? Like vertex groups with separated soft body properties or something : /

Final:

Overview:

For the Soft Body object I've used two Vertex Groups. One for Goal and second one for Springs. I've assigned different weights for selected parts. You can also draw weights in Weight Paint mode.

Vertex Groups:

Soft Body:


Camera following a circular path around object stops after 1 rotation, I want to have it loop over and over I set my camera to rotate around an object by having it follow a bezier circle, but it stops moving after 1 rotation.I have linked the video here. https://imgur.com/a/ABqRpse

There are options in the Graph Editor tab : Channels > Extrapolation Mode > Make Cyclic or Shift + E and Make Cyclic from Graph Editor, that will put your animation in a loop.


Problem with bpy.context.selected_objects I have a script which includes the line:

ListObjects = [ o for o in bpy.context.selected_objects if o.type == 'MESH' ]
print(ListObjects)

That works as a standalone script. But within a larger script it fails with:

AttributeError: 'Context' object has no attribute 'selected_objects'

I have tried to follow the advice here: bpy.context.selected_objects by using:

ListObjects = [ o for o in bpy.context.scene.objects if o.select]

But that fails with:

AttributeError: 'Object' object has no attribute 'select'

Has the o.select attribute changed in 2.80, or am I using it incorrectly? Something to do with needing to use an override, perhaps?

So the thing that is you should always use context that passed by the operator instead of bpy.context. Unless you want to override context with the one you need in rare case.

And Blender 2.80 does change the object.select to its private(?) value, one should consider use object.select_set(bool) and object.select_get() for select value manipulation.

So assume that your function got a context passed in:
ListObjects = [ o for o in context.scene.objects if o.select_get()]
will give you a more reliable context.


Where is the UV Maps Panel? I am looking for the UV Maps Panel, which is "in the Mesh Tab." I am totally lost on this.
There are buttons at the top which say View, Select, Add, Mesh. When I click on the Mesh button there are a lot of menu items, but no UV Maps panel. I'm guessing that this isn't even the Mesh tab. I would appreciate the info.

Just to illustrate @moonboots' comment.
Properties editor > Object Data (Green Icon) > UV Maps


Can the viewport rotation be changed? I had just upgraded from using blender version 2.75 to 2.77 and I immediately found a difference between the two. Here are the differences:

default perspective 2.75

default for 2.77

When I do a custom rotation using the same coordinates, the view becomes different.

2.75

2.77

In 2.77 it's no longer rotating directly along the z-axis.

How can I rotate the viewport on the z-axis in 2.77 as it was on 2.75 (or 2.76?)

Different screenshot would be useful in your question, specifically screenshots with an expanded properties shelf (T key) in each version. My starting guess is that the models shown in the two versions may not have identical rotation settings to start with, in which case applying the rotation might resolve this issue.


Blender 2.76b and Three.js exporter not showing in Addons list after install? I've been trying to install the Three.js exporter in Blender 2.76b on Ubuntu 14.04 and it's not showing up in the Addon's list in Blender.

I put the io_three folder in /usr/libs/Blender/scripts/Addons folder using Nautilus in gksudo mode and it's still not showing up when I open blender, any suggestions?

I even tried installing an older version of the addon as well and still no go. Do I need to install an older version of Blender to get it to work? I got it to work in Windows no problem.

I checked my console output, apparently I had 2 versions of blender installed and I installed it to the wrong folder:

It outputs connect failed: No such file or directory
Read new prefs: /home/USER/.config/blender/2.76/config/userpref.blend

I didn't even know I had a .config folder, I put it in the ../config/scripts/addons folder and now it works great!


How can I use Cycles to render in Google Cloud? I want to try the free trial on Google Cloud.

Its possible render through google cloud using blender cycles?

I am not good in programming so I did it this way...

I install VM whit 8 cores Hight cpu 2,6ghz xeon whit 8gb ram... 50 gb HDD and Windows server 2012 .... Its exatly 274 dollars... On your free trial you have free 300 dollars... What is amazing...

After install VM , you can log in using Remote Desktom Connection... Open Internet Explorer, download Blender Zip file from blender.org...

And you can render under blender GUI..

Noob way whit using mouse and 0 commands...

:)


How would I set a precise width of a road comprised of multiple edges? I have a road shrink-wrapped to a terrain created by using the OpenSteetMap add-on.

In object mode, the dimensions cover the entire range of the terrain that the road covers. The dimensions report the width and breadth of the road network on the terrain.

I would like to set the width of the road segments in the overall road network.

Scale and Extrude don't seem to be the answer.  I have been going through a few books and on-line courses and have not found a solution.

Is there a modifier or other transform that can be used to set the width of the one or more individual road segments in Edit mode?

My suggestion is to use a curve which will keep the segments of consistent size.

1.) Create the curve:

Create a plane for the road surface (although you could use a cube) and loop cut it multiple times (the more the merrier) and scale it out:

Add the Curve modifier to the plane and select the curve.  You can also scale it to the desired length:

Finally, use the MeasureIt addon (included with Blender) and proportional editing to get the segment the exact width you want.


How can use draw tool in sculpture mode? (red line) It looks like this, without any error messages.
But when I click & drag, the red line appears and draw tool isn't working.
I tried changing tablet api and it was not helpful...
How can I fix this? Is there anybody having a same problem?

The red line is from the "Stabilize Stroke" brush settings. It adds a delay to your stroke indicated by the red line. Drag further and the draw tool will work at the end of the line.
You can turn it off in the brush settings. Open the sidebar in Sculpt mode (N) or look at the tool panel on the right side of the screen: Brush Settings → Stroke → Stabilize Stroke


What is vertex and edge shading? I know how shading works with faces:

That's set by choosing Smooth/Flat under Faces in the Shading menu:

But what do the other two options—Edges and Vertices—do?

This feature makes it possible to sharpen or soften individual components of a mesh instead of soften or sharpen the entire mesh. Especially for Low Poly Modeling it can be useful to have more control about the object's appearance and thus to define a more complex shape with less geometry.

Result of sharpen the selected edges only:

Note: In Order to make it work, enable Auto Smooth Option in the Properties Panel > Data.

When sharpening vertices, the connected edges are also affected:

Render result of sharpen edges only:


(Rigging) Character with Spikes on Back: What do I Parent the Spikes to? I’ve had a long week and I’m exhausted. Been watching hours and hours of tutorials. Probably not enough on rigging. I’m struggling with this.

Even once the spikes were joined with the rest of the mesh they wouldn't move in Pose Mode. I added bones for the spikes (tried with them separate from the rest of the armature. Didn't work, so I tried connecting them to the spine). I select the mesh spikes and then select the Meta-Rig: Parent -> With Automatic Weights. I also tried joining the spikes to the body mesh.
When I move the Meta-Rig around in Pose Mode, the spikes don’t move with everything—the armature bones move, but the mesh spikes stretch and deform. I don't want to animate the spikes, just need them to move with the body; they protrude from the character's back.  What am I doing wrong here?

Don't add bones to the spikes, but instead, just have the weight the spikes to the max with the corresponding "spine" bone. So for example, take the top two spikes, and weight paint them so they only move with the top back bone before the neck. You'd only need to add bones to the spikes if you intend to move them with the bones that you placed inside them. If they're static, just weight them to whatever back-bone makes sense for the position.
The same goes for other things that protrude/hang off a character. For example, if your character had a backpack, you'd set the weight for the backpack to move with the back bone. If your character had a watch, you'd weight the entire watch to move with the forearm's bone.


How to make x-axis mirror work on newly created bones? (2.79) I'm rigging a model from scratch, but I'm not sure how to make it detect two bones as the "same" one, so that when I transform one bone (in edit mode) it transforms both. How do I make it so that it sees the bones that way? Is there a specific way in which I need to create the bones, or is there a shortcut I can use, or something else?

Example of it not working:

In order for the Mirror Option to know what it should mirror, you need to name the bones according to some guidelines on the wiki (https://docs.blender.org/manual/en/latest/animation/armatures/bones/editing/naming.html). There are also Tools to for example flip the side in the name or mirror bones and their names. You find them in the Armature Menu > Names.


Why is my spot light not working? I'm trying to follow along with a blender beginner tutorial, and I'm having trouble with spot lights. All other lights seem to work fine but I can't get spot lights to work.

Light isn't really doing anything to the scene, I can delete it and it'll look the same.

You can find the blend file here - https://drive.google.com/open?id=0ByReRoh-9WDQNVRoLXAzRjVCOWM

There are two solution to this problem and they came from a scale of a scene.

After switching units to metrics (or imperial) you can see that your plate has radius over 3m, Lamp is 13m high above and size of 9cm.

You can crank up a light source Strength to something really high like 5000 and change Size accordingly.
You can scale down objects similarly to real world scales and make it a little bit physically correct. Then light won't need enormous values.


multi resolution needed in order to sculpt? I just finished my first sculpt in blender and I think I managed it using a low poly mesh to start and then everything sculpted using dynamic topology enabled.
My question is with Blender 2.73a is there a need to apply the multi resolution modifier to the mesh before I start sculpting? What is the benefit of doing that?

Thanks

You can sculpt a simple mesh (a cube) without anything else.

You can sculpt any mesh and use dyntopo. You'll get a full triangulated mesh with as much topo as you want/can, exactly where you need it.

You can sculpt on a quad based mesh with multires. You'll get a new level of details with each subdiv. The whole mesh is subdivided.

But using a multires on dyntopo is exactly what you shouldn't do. Multires (or subdivision) is not supposed to work well with triangles.

Both have pros and cons, they are a different way to do sculpting.

a Cube with quad and a cube with triangulated faces, with a subdivision (same as multires):


Double clicking to do the 'edge ring' or 'edge loop' selection in Blender 2.8 In 2.79, I can double click any vertex/edge/face to do edge-ring selection or edge-loop selection. I just need to click the proper spot to switch between these two modes. But seems this feature is gone in 2.8 ? Does anyone know what happen? This is handy because i can simply double click it while in 2.8 i can have the same functions but need to press alt or ctrl etc. Does anyone know how to get this double click feature back in 2.8 ?

Thanks

Enable "Emulate 3 Button Mouse" in Preferences > Input to get double-click loop selection back. There's a discussion on the dev forum about it. Basically, double-click broke two features – Selection Cycling and Select All Boundaries – according to the developers, which is why they disabled it without having 3 Button Mouse emulation enabled.


repeating hole pattern or texture on surfaces (climbing wall drill holes) Im trying to replicate the drilling holes which can be found on climbing walls. They are uniform in shape and should tile with the same distance and should not be cut on corners (getting half holes for example). I've tried different methods like using a texture and using different nodes (polka dot generation with all sort of different math nodes) to replicate this effect but none of them seem to do the thing I want to do or I get some weird black mesh results and it srews up (I am also pretty new to Blender and not very good at it).

This is an example of what I want to achieve.

My question is, what would be the best method and how would I achieve this? cutting physical holes in the mesh, or make a texture with some sort of bump/displacement mapping since the camera is a bit in the back and does not really show the actual holes from a distance.

Be advised that my mesh is not just one flat surface but consists of different surfaces with different angles. This is what I currently have;

preferably I'd use the node editor (im using cycles render engine) for maximum control but I haven't found any decent solutions which actually make it sort of look like the holes I want them to be. If anyone has some sort of solution or can point me in the right direction that would be much appreciated.

You could try particles. However this is destructive and you have only little control over the positions of the holes.


Blender 2.8 Undo History I'm trying out Blender 2.8 and can't find Undo History. The online manual for Blender 2.80 > User Interface > Tools > Undo & Redo says"There is also an Undo History of the last actions taken, recorded by Blender. You can access the history pop-up with Ctrl-Alt-Z."
Ctrl-Alt-Z does not produce the History box.


How to scale only one side of a mesh/scale unevenly? I'm trying to scale a cyllinder, but keep 1 side the same, like in the image. You can see there that a cyllinder (represented by a black rectangle) has a certain size, but I want to make it uneven, like a cone that does not end in a closed point. Just a cyllinder with one wide end and one narrow end, represented by the red lines. You can see a wide and narrow/normal end. ]

How do I do that?

Thanks in advance,

DiaborMagics

You can use Proportional Editing for that. Go into Edit mode and enable Proportional Editing (the button in the toolbar at the bottom - click it and set 'Enabled') and set it to Linear mode (the selection will appear once you've enabled Proportional Editing). It should look like this :

Then select the vertices at the end of the mesh that you want to scale. Press S to scale. Drag them to the size you want and then scroll the mouse wheel (or equivalent) to change the range of the proportional edit tool until you have the desired influence.

I've purposefully used a cylinder with a number of loop cuts in the image above to demonstrate how the rest of the mesh is affected by the proportional edit.


Can I use a vertex shader and Cycles at the same time? For my latest project, I to radically alter the vertices of my Mesh object depending on where they are on the scene.  For this, I wanted to the the linear algebra and use a shader, with something like gl_Position = gl_ModelViewProjectionMatrix...

Sadly, I can't figure out how to use one of these while simultaneously having a cycles shader present (am I correct in saying cycles is only a color shader, ie, you can't use it to double the size of an object?)

A python script would be good.  Shape keys would be good, but they would have to be able to interpolate such that they are applied to ONLY part of the mesh at a time!  Which leaves me with vertex shaders.

Thanks in advance.  (PS: I'm trying to project part of the scene as 2D and part of the scene as 3D, if someone has a wildly different approach!)

Cycles uses a very different rendering system and is independent of openGL, so features are going to be different and you won't be able to combine these shaders. There is an experimental real displacement feature that might help, but I think you would be better trying python if you have some idea what the code should look like.

You could use an application handler on the frame_change_pre event to create this effect.
(https://www.blender.org/api/blender_python_api_2_77_1/bpy.app.handlers.html?highlight=handler)

If the changes are fairly simple, a bunch of shapekeys for various parts of the mesh may be easier, and just key/animate them manually.


faces falling below the sculpted face when re-topologizing I have sculpted a human head in Blender, and now I am doing re-topology. This is for the first time I am doing, and I am kind of new to Blender, and in this 3D field for that matter.

See the picture below

The portion I marked with blue marker, it shows that the retopologized grids are there but it falls below the sculpted face, though I am using "snap to grid" and "srinkwrap" modifier and I suppose it is due to less geometry.

If I give more geometry, the retopology in that portion looks messy and increases polygons.

My question is if I bake a normal map will those raised portions of my sculpt be captured in the baked image and then be transformed to my low poly retopology model?

If not, how to achieve that?

The reason for the faces being below the surface is that the vertices and edges that make up the faces in those regions are not on the highest points of your mesh. When the faces are made, they connect in a straight line, which in this case goes through a portion of your mesh. The two ways to deal with this are to add more vertices so that the faces can follow the contour of your mesh better, or reposition your vertices so that the detail is better preserved. If your end goal is baking normals, you will want both objects to be as close as possible. Here are a few tips to make your retopology process a bit easier:

1) Instead of starting at one point and working your way around the ear, start by identifying where you want your edge loops to be, and what details you want to highlight.

2) To do this, I've always found it easiest to use snapping set to face, and then Ctrl click to extrude a single vertex and create your edge loops. If you enable automatic snapping (the little magnet icon) each new vertex will snap to the surface where you click.

3) Place your edge loops at the highest and lowest points possible. If there is a ridge or bump, place the loop so it is on the highest point. Do the same for any valleys or indents.

4) Keep in mind that you will have to connect all of these loops together eventually, so plan where each vertex will connect to the others.

5) Finally, begin connecting your edge loops to each other. You won't have enough edge loops to simply fill single faces between edges, so add more vertices where necessary. If you use some topology guides and plan your topology carefully, it shouldn't be to difficult to add in extra detail where you need it.


OBJ files and vertex colours I would like to import a dental scan obj file. When the file is opened in windows 3d print viewer the tissue and tooth colours are visible.
When you import into blender, the colours do not show up. This may be a simple setting? Here is a photo of windows Print 3d Viewer.

The .obj format specification doesn't contain any description of vertex color attributes. Some software like MeshLab or Agisoft Metashape extend the .obj format and include the vertex colors after the coordinates.

v 3.112696 -9.640543 15.350909 0.592157 0.517647 0.537255

Since it is not covered by the specification, Blender provides no ability to import vertex colors. There are other formats that do allow to store vertex color which can be imported into Blender, for example .ply.


Limiting minimal scale to 1 still goes to negative values So if I limit objects scale (by a constraint) to minimum of 1 and maximum of 2 and start scaling it, it still manages to go over on inverting it self to negative values keeping the limits to -1 and -2.
Checking "For Transform" does not help.

This is known essue, and now it has "To Do" status:

https://developer.blender.org/T37623

And this is one of two unsolved problems from 2018 TO DO animation list:

https://developer.blender.org/T55365

It's sounds easy, until you try to make it work on matrix transformations.


BGE: Change Actuator's Track-to Time value using Python? I want to change the Time value for an Edit Object: 'Track to' actuator in-game. Seems like something that should be achievable with Python - but I can't find any documentation on this.

To add to the confusion, the documentation I could find refers to refers to this actuator as the TrackTo Actuator, although no such actuator appears in the list of actuator types:

Instead, Track To is listed as a subset of Edit Object. It is also listed this way in the documentation for the Edit Object Actuator: Track To
(Although this page doesn't go into any details about Python).

This Blender Artists thread was helpful for at least getting one object to track to another, but the Time value is not mentioned. And I can't even get the tracking to update with each tick.

After reading that thread I looked to the API to try to better understand alignAxisToVect(). It takes three arguments, one being a factor of how much to align, but it seems that any updating over time would need to be programmed manually, and I'm not sure if it would look smooth.

There is an angularDamping attribute as well, which seems like it ought to do something similar to the track-to Time value. But at this point I'm speculating.

If anyone knows how to get at this Time value or emulate its functionality with Python so that it can be updated in-game, please share.

Try in Python:

cont.actuators["TrackToActuator"].time = any_value

Reference in API

Edit - example file by Mentalist (from link in comment):


Why is my textured material showing up as a solid color? I'm trying to use a simple oak texture on this cube but it just shows up as a solid color.

I tried every option in the image texture (linear, cubic, flat, etc.) none of them worked in fact  I saw no difference between them.

Do you have Cycles render engine enabled?
If so, try adding a texture coordinate into the vector input to tell blender how to wrap the texture to a given object.


Export grease pencil lines with a transparent background How can I export (as PNG frames) the lines of grease pencil on a transparent background?

Theres an entry in the Context-Render panel named "Film". Open it and
set a hook at "Transparent".


Animate transparency of entire layer Blender noob here. I'm learning my way around but could use some assistance. I'm working on a project having to do with human anatomy. I have a 3D model complete with skin, skeleton, muscles, organs and so on. Each of those are on a separate layer. I am trying to animate the transparency of the muscles however that layer is made up of several meshes/textures and I can't figure out how to simply fade them on screen. I have already done something similar with the skin layer but that is all one mesh. What's the easiest way to do this? Just so it's clear, I have my transparency set to about 20% on the skin to show the organs. See below
I then want to fade the muscle group on so it looks like this.

Is there a way to add keyframes to entire layer? I'd appreciate any help. Thanks!

I am not animation expert but I think what you want to do is... make your separate completed renders for organs, muscles, and then skin. then, in the compositor, create your fade-in animation from one completed render image to the next by using the alpha-over node. This example probably explains it better than I can - https://docs.blender.org/manual/en/dev/compositing/types/color/alpha_over.html


Get edge lengths with python How can I get the length of an edge with a script? I want to identify a face by its vertex group and get the lengths of its edges. I've gotten as far as identifying the vertex group so I can select it or get the indices - what next? Do I have to do some complicated math to get distances between points in 3d space or is there a direct way to get the edge length as it is displayed in the overlay? The angle would be great too, but I'm trying to take small bites.

That was easier than I expected!

import bpy
import bmesh
obj=bpy.data.objects["Cube"]
obj.select_set(True)
i = 0
for mat_slot in obj.material_slots:
    #enter edit mode
    bpy.ops.object.mode_set(mode="EDIT")
    #deselect all
    bpy.ops.mesh.select_all(action='DESELECT')
    #choose the active slot based on the loop number
    bpy.context.object.active_material_index = i
    #select the faces of the active slot
    bpy.ops.object.material_slot_select()
    #make a bmesh from the mesh
    me = bpy.context.object.data
    bm = bmesh.from_edit_mesh(me)
    #list to populate with lengths
    edge_lengths = []
    #if edge is selected, get its length
    for e in bm.edges:
        if e.select:
            edge_lengths.append(e.calc_length())
    print(edge_lengths)
    i=i+1
bpy.ops.object.mode_set(mode="OBJECT")


What's the difference between alpha over and add? When compositing something in the node editor, what's the difference between the alpha over node (Colour -> Alpha Over)  and the add node (Math -> Add)?

The alpha over node chooses between two colour values, the mixRGB node mixes two colours together.

The Fac value is a scale between the two output options, 0.0 being 100% input one and 1.0 being 100% of the calculated output value.

The output of the alpha over node will be between the two input values, while the output of the mixRGB node will be between the first input and the combination of the two inputs. The different blend types in the mixRGB node choose how the two inputs are combined.

So if you had one input with 0.2 red and a second with 0.4 red, then the alpha over node will output a red between 0.2 and 0.4 - the two different input values - while a mixRGB set to add will output a value between 0.2 and 0.6 - 0.6 being the two red values added together.

The math node is meant to be used with single numeric values, like the Fac input. If you do use a math node with colour inputs, the input value will be calculated as the average of the three colour channels. So if the input colour was R:0.1 G:0.0 B:0.0 the input value used in its calculation would be 0.333. If you connect a math output node to a colour input, you will get the same result value for each channel. Similar to the mixRGB node, the operation chosen will decide how the output value is calculated.

Notice the colour of each socket on a node, while most will attempt to work with each other, you should connect matching socket types.


Add Red Text in Tooptip? is it possible to add a custom red text in tooltip ?

here is an example:

Currently this feature is not available through the Python API, only for operators implemented in C.

The operator in your screenshot select_ungrouped() is implemented in source\blender\editors\mesh\editmesh_select.c

Operators can use a poll function to check whether they can be executed in the current context. This functionality for select_ungrouped() is implemented in edbm_select_ungrouped_poll(). In this function the message in red is set through:

CTX_wm_operator_poll_msg_set(C, "Must be in vertex selection mode");

If a message is set through this function and the operator is disabled because poll returns false, it will be displayed beneath the operator's description as a tooltip in the UI. This behavior is implemented in source\blender\editors\interface\interface_region_tooltip.c

The documentation mentions this feature in the Gotchas page.

  Blender does have the functionality for poll functions to describe why they fail, but its currently not used much, if you’re interested to help improve our API feel free to add calls to CTX_wm_operator_poll_msg_set where its not obvious why poll fails.


Creating an explosion in blender game engine? I'm making a game in the blender game engine and i wanted to make a explosive, I've looked all over the internet, and blender.stackexchange, but no results other than videos. I cannot view long videos since as i have slow internet and a download limit.

So to make it clear, i want a explosion, I've made one, pretty bad one but it works, but it does make things fly away, it just pushes them since as it's a expanding sphere.

download the .blend here: https://www.dropbox.com/s/4psdrb2zf8xcs7x/Cube%20assault%20%3B%29.blend?dl=0

Expanding sphere (or hemisphere) is a good way to create an explosion. You might want to scale it faster.


Deform Helix Around Spline in Animation Nodes I know in this answer it has been shown how to create a helix in animation nodes: How to make a rope winding animation?
However, I'm wondering if there is anyway make a helix deform to the curves of a spline, achieving a similar result to the below image where I applied curve modifier to a helix curve.

All you have to do is change the basis of the parametric equation to the tangent, normal, and cotangent of the spline. The cotangent is computed by crossing the normal and the tangent vectors.

Note that the samples vectors are not normalized.


Render Passes separately Is there anyway to render passes other than combined separately ? I would like to render the Z pass, the mist or the normal pass separately but even if I disable the Combined pass, blender still renders the whole image everytime.

The Combined pass is useless in Cycles as far as I know, it doesn't change anything if it is enabled or not. In Blender Internal you can exclude from this pass other passes (like Shadow pass etc.) which might be useful, but not in Cycles.

If you are just after the normal, zdepth or mist passes, consider using some very fast rendering material on all objects (like material with no shader at all, just naked output node), because these passes depend only on the geometry and camera. Use the overwrite material option for Render Layers.

If you are using objects with displacement or normal textures, you will have to render these material for the normal pass to account for this. You can simplify these materials for bare minimum (a Glossy shader set to Sharp renders fast) and delete scene lighting to speed up the rendering. You can also limit the scene bounces or glossy/diffuse bounces, depending what shader you used.

If you are only after zdepth, you can also use just one render sample, the output is not nice anyway: Is Z-Render Pass accuracy dependent on sample count? Are others like object id? (Cycles) It's better to obtain this pass in a different way than directly.

If you need to customize how Blender saves and handles these passes, the place to do this is in Compositor. Enable it and connect the pass you want directly to the output node (and you can pretend the Combined pass does not exist). You can also use the File Output node to add how many file outputs you need to save all the different passes separately if not using OpenEXR Multilayer.


Sample Color tool. Eyedropper reverts to a pointer In the Shader editor if I click to change the colour in one of the colour swatch windows on a Principled node and then select the eyedropper or Colour Sample tool, as soon as I move the mouse it reverts to a pointer and won't allow me to select a colour from an adjacent Image Editor window.
See the gif below, it's a little difficult to describe.

I've worked it out, it's not an error after all. Once you select the Eyedropper, when you move the mouse the cursor will revert to a pointer, however the next click will change the color wherever you click in the Blender window. Just not immediately intuitive because the cursor doesn't remain as a pipette.


Can I edit the motion path? Can I change the motion path only by editing the line in the motion path?
I want to change the path by editing the line created by the motion path

Instead of following the white line I want my bone to follow the red one

No, you can not interact with the Motion Path (the white dotted line with yellow keyframe indicators). It is merely a visual reference.

You can edit the motion of the object ...

by setting additional keyframes.
by changing the keyframe interpolation or bezier types in the dopesheet
by changing the F-Curves of the animated channels in the graph editor
by animating it along a path with a Follow Path Constraint

Editability of the motion path may be achieved through the addon Motion Trail Addon:

Blender Addon List
BlenderArtist post

Motion Path Addon (gif)


blender game: spawn object has anybody an idea why this script doesn't work? The object "Sphere" is on a separate layer.

"addOne" is a property who generates random integers from 1–10.

import random
from bge import logic
import bpy

cont = logic.getCurrentController()
own = cont.owner
scene = logic.getCurrentScene()

if own["addOne"] == 1:

unitll here the script does work

    scene.addObject("Sphere")

or on the other hand, if I run a script that says for example

bpy.ops.mesh.primitive_cylinder_add(radius=1, depth=2, view_align=False, enter_editmode=False, location=(-24.4838, 0.107069, 1.23061e-07), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))

the cylinder doesn't apper in the game itself but only in my 3d view (where you actualy work). Can anybody help me?

thank you in advance,
Sputi

First point is that bpy is not available while the game engine is running, similarly bge is only available when the game engine is running.

When developing in the game engine you might find using the console to be helpful. In the console you will see the following -

Python script error - object 'Cube', controller 'Python':
Traceback (most recent call last):
  File "Text", line 11, in <module>
KeyError: 'value = gameOb[key]: KX_GameObject, key "addOne" does not exist'

To expand on that, you have set own as the owner of the script controller that is running the current script. The syntax of own["xxx"] will give you access to a game property called 'xxx'. I expect you want to access a sensor that you have named 'addOne', for this you want to use cont.sensors['addOne'] and you may want to use it's positive property.

Also scene.adObject takes at least two arguments, the second being an object to use as the initial location when created - empties are good for this.

import random
from bge import logic

cont = logic.getCurrentController()
own = cont.owner
scene = logic.getCurrentScene()

if cont.sensors['addOne'].positive:
    scene.addObject("Sphere","Empty")


Is it possible to edit 2 nodes at the same time ? In 2 windows In each window one different node to edit, im trying to, but when i switch one the other one switches too...


Can I apply something like a mask to apply proportional editing to only some connected vertices in blender 2.8? Can I apply something like a mask to apply proportional editing to only some connected vertices in blender 2.8?  For example I only want to move the verts on the right side of this leg in proportional editing in the following image:

Given this, is it possible to exclude the verts on the left(the front of the model) leg from this edit to prevent distorting the verts I have just positioned?  I though you could apply masks in blender some how, but I can't find anything on masks for proportional edits in 2.8.

Working with Proportional Edit, I think that you could get by here with just scrolling down the circumference of your brush and get it to work. Hiding the verts you don't want to affect could work as well, but that might be to much to do for a simple block out.


Denoising Not Showing In Blender Cycles Ive gotten blend 2.79b and I heard about the denoising feature. I went into the render layers tab but it's no were to be found. I'm in cycles render.

The image posted as part of the question shows that you are using an old version of blender (2.76).

Denoiser was introduced in version 2.79