How to load an image from disc and assign it to a newly created image texture node? I'm trying to load an image from jpeg file and to add the material to the cube using the following code:
bpy.ops.image.open(filepath="/root/carteid_dini.png", directory="/root/", files=[{"name":"carteid_dini.png", "name":"carteid_dini.png"}], relative_path=True, show_multiview=False)

# get material reference
mat = bpy.context.view_layer.objects.active.active_material

# get texture reference
tex = bpy.data.images.get('carteid')

# create node and assing the texture to it
image_node = mat.node_tree.nodes.new('ShaderNodeTexImage')
image_node.image = tex

mat.node_tree.links.new(image_node.outputs['Color'], mat.node_tree.nodes['Principled BSDF'].inputs['Base Color'], verify_limits=True)

cube = bpy.context.active_object

if len(cube.material_slots) == 0:
    bpy.ops.object.material_slot_add()

cube.material_slots[0].material= mat

When I run this code, the newly created texture is unfortunately not loaded and the image is not selected for the 'Base Color'.
Q: How to load an image from the disc and and assign it to an arbitrary image texture node?

You can use BlendDataImages.load() to load and assign the image to the texture node in one go. Following example code is based on Control Cycles material nodes and material properties.
import bpy

# Get the material
mat = bpy.context.object.active_material
# Get the nodes
nodes = mat.node_tree.nodes

# Clear all nodes to start clean
nodes.clear()

# Create Principled Shader node
node_principled = nodes.new(type='ShaderNodeBsdfPrincipled')
node_principled.location = 0,0

# Create Image Texture node
node_tex = nodes.new('ShaderNodeTexImage')
# Assign the image
node_tex.image = bpy.data.images.load("//your_image.exr")
node_tex.location = -400,0

# Create Output node
node_output = nodes.new(type='ShaderNodeOutputMaterial')
node_output.location = 400,0

# Link all nodes
links = mat.node_tree.links
link = links.new(node_tex.outputs["Color"], node_principled.inputs["Base Color"])
link = links.new(node_principled.outputs["BSDF"], node_output.inputs["Surface"])


Using Mix Shaders for Texture Paint Layers, Black Colours Do Not Show I'm trying to set up a layering system like in Photoshop using Mix Shaders for when I texture paint in Blender. But when I use a black colour on the 2nd/top layer, it doesn't show up. It acts as an eraser. Black will show on the 1st/bottom layer, though. Every other colour shows fine. I've also tried the same approach with a Mix RGB node, but still black does not show.

After messing around with it for a bit, I figured it out. The Alpha of the second layer needs to go into the Factor of the Mix RGB node.


Blender 2.8 Boolean inconsistencies I'm trying a simple boolean add. I select the first object (sphere) then add a boolean modifier (cube).
In first attempt with sphere in position 1, the results are as expected.

When I move the sphere to the left, and apply the modifier, the sphere disappears.

Any help greatly appreciated.

I had an object of the same name that was hidden in a different collection. When I renamed the cube the modifier worked correctly. Blender doesn't like duplicate names for objects. Hope this helps someone.


How To Make An Object Fade As Another Intersects With It? I have a basic cloud texture on a plane, this is my node set-up: https://i.imgur.com/dqLENEa.png.
My question is; How do I conserve this node set up while also adding a geometry intersect fade node set up? I want the cloud to fade to total transparency the closer an object gets to it's proximity. I would also like the object to fade away the closer the camera gets to the plane. And also, this may be a very simple one, but how would I achieve a transparent circular mask over the cloud so that the edges are transparent in a circular shape? Thanks guys!

Finding a falloff that drives the transparency depending on the camera proximity.

The node setup:

Take the coordinates of the camera as "object" in "texture coordinates" node.
Get its length to the mesh "vector math" using "length"
Add a little value so that we won't reach 0 in next node
Negative power so that the value is bigger as the length decreases
Tweak the curve using "vector curve" on X: small values are 1 and bigger values have a falloff to 0 rapidly
Get the X component tweaked above
Multiply the result with the value that already drives the cloud transparency, so that transparency is due to both the texture and the result of the proximity

You may have to tune values and curve depending on your cloud/plane configuration and size.


Best way to ‘face’ this object I have this object, what is the best way to get the faces created?
I hope that makes sense.

One way to do this is with the Boolean Modifier.
First select your cutouts in edit mode and press P.
Choose Separate by Selection. Then Extrude them trough your contour object.

Then Subdivide the edges on both sides of your cutout objects and subdivide then by 2.
(this is optional)

Select the new vertices, press G twice and move them next to your cutout objects. (also optional)

Then Alt select an edge of your contour object and press F (better to press F then to go by the menu; picture a bit misleading)

Now select your contour object (which is now a plane) and add a Boolean Modifier.
Properties window > Modifier Properties tab > Add Modifier. Then choose Boolean.
Then as Object choose your cut out object and click Apply. If you have multiple separate cutout objects repeat it for every one of them.

Then hide or delete your cutout objects. And you're done.

EDIT:
Don't want to use boolean?
Make sure all geometry is part of a single object.
In Edit Mode, use F to create edges between vertices, around your cutout geometry.
Use Subdivide to have the surrounding geometry have an equal number of vertices as the cutout geometry.
Press Ctrl + E (or click the Edge button), and select Bridge Edge Loops.

If not careful, created edges between vertices can cross the cutout geometry area if they happen to be aligned that way.

Also an unequal amount of vertices can cause problems.


How to unlink two objects in the same group? The cube I was messing with somehow "coupled" to the bottle and now i can't select them individually. What happened? Doing Alt+P and Clear Parent doens't do anything.

You must have joined them into one unique object with a ctrl J, so select it, go in Edit mode, select one of the 2 meshes with L and press P (Separate) > Selection


Material is always black and on Cycles I tried to assign different materials to face - they work correctly only on Eevee rendering.

When I tried to render using Cycles - the surface always black - doesn't matter what the material or base color, only 2 properties have value - Emission and Alpha, they work correctly, face orientation is ok on this face.

And the blend file

The mesh has custom split normals in the problematic area. In order to see the split normals, switch to edit mode and enable Display Split Normals in the Viewport Overlays.

Viewport Overlays

Problematic Normals

If you have created the split normals intentionally you can edit them until they match the desired result (consult the manual for ways to edit normals). In case the custom split normals were created by accident and you don't want them, they can be deleted in Object Data Properties > Geometry Data > Clear Custom Split Normals Data.

Clear custom split normals

Fixed Normals

When custom split normals are stored, Auto Smooth is automatically enabled. It can be disabled in Object Data Properties > Normals > Auto Smooth, in case you don't need it.

Disable Auto Smooth


Removing hundreds of duplicate images So I've been slowly learning the ways of the "snake" and trying to create THE script that will remove all duplicate images after one has appended, shall we say, an entire library of characters, buildings, vehicles, etc.
I have seen the topics of going into the Outliner and remapping the duplicates, but imagine having hundreds of these one needs to Box-Select, then try to find the beginning of this list of eyemask.png.xxx. I have also seen scripts where one would match the name and remap to the name without the extra numbers. However, things get a little complicated when one's library of objects have the same named texture file (like body.png.xxx) but have their differences. And maybe the names got changed somehow so the first part doesn't quite match, yet they are exactly the same image (ever found duplicate textures in a game?).
I figured, why not remap the images to the first match Per Pixel? Yeah, that is definitely a lengthy process if the image is 4K... I have gone about the iteration in two ways:
# Purely based on if the images are sorted alphabetally and follow the .xxx pattern
import bpy

lastimg = False
lastpix = []
curpix = []
imgcnt = 0

for img in bpy.data.images:
    curimg = img
    curpix = curimg.pixels
    thesame = True
    if len(curpix) > 0 and len(lastpix) > 0 and len(curpix) == len(lastpix):
        for i in range(len(curpix)):
            if i % (len(curpix) / 4096) < 1:
                print(imgcnt,"/",len(bpy.data.images),"-",curimg.name,"-",((i/len(curpix)*100)),"%")
            if curpix[i] != lastpix[i]:
                thesame = False
                break
    else:
        thesame = False
    if thesame == True:
        curimg.user_remap(lastimg)
    else:
        lastimg = curimg
        lastpix = lastimg.pixels
    imgcnt = imgcnt + 1

print("DONE!")

# Double the iteration, making sure there are no other named textures that look the same
import bpy

imgcnt = 0

for img1 in bpy.data.images:
    for img2 in bpy.data.images:
        if img1.users > 0 and img2.users > 0 and img1.name != img2.name
            pix1 = img1.pixels
            pix2 = img2.pixels
            thesame = True
            if len(pix1) > 0 and len(pix2) > 0 and len(pix1) == len(pix2):
                for i in range(len(pix1)):
                    if i % (len(pix1) / 4096) < 1:
                        print(imgcnt,"/",len(bpy.data.images),"-",img2.name,"-",((i/len(curpix)*100)),"%")
                    if pix1[i] != pix2[i]:
                        thesame = False
                        break
            else:
                thesame = False
            if thesame == True:
                img2.user_remap(img1)
    imgcnt = imgcnt + 1

print("DONE!")

I have also attempted to hashlib the array of pixels to see if it is any quicker, but I keep getting errors. I have also attempted to convert the array of pixels to a string, but that seems just as slow. Who knew python couldn't handle 67MB in one second? :P
Is there any quicker way you guys could suggest to compare two images? Thinking that further down the line I could do the same for the materials (compare the nodes and their values and reduce duplicates).

You do not need hashlib to generate unique hashes of the pixels the hash function is enough for this.
After hashing the images it is only a matter of grouping the images by hash.
import bpy
from pprint import pprint

def duplicates(images):
    hashes = [(hash(i.pixels[:]), i.name) for i in images]
    grouped = {}

    for h, n in hashes:
        grouped.setdefault(h, []).append(n)

    return grouped

pprint(duplicates(bpy.data.images))

The output will look something like this:
{
 -6513983583712379323: ['Image1', 'Image2'],
 -2557438906662028752: ['Image3', 'Image4'],
 5740354900026072187: ['Render Result'],
 -3721407912412733414: ['Viewer Node'],
}

Note: The hash() function can only create meaningful hashes from immutable data structures. As @batFINGER pointed out in the comments image.pixels[:] is alreay a tuple (immutable) so we are good in this case. If however you want to create a hash from a list you have to convert it to a tuple first. E.g. hash(tuple([1,2,3]))


How do you get your objects local transformations back after applying them? Say I have a cube, and I rotate it randomly. I set the transform orientation from Gloabl to Local, and I move on the Z axis. The cube won't move up, it will move in whatever Z axis it has instead.
Now, say I go to Object, and Apply All Transforms; now when I move on the Z axis, it will move up and down.
Is there anyway to get the local transformation back after applying them?

As far as I know there's no way to recover those applied transform without undoing. One solution could be copying the transforms to an empty and then copy them back again from the empty when you finish.


Object made of large number of spheres i have a file containing ~ 10thousands coordinates
and I need to create an object that is 1 gold sphere for each coordinate.

I realized that if I do something like:

def createsphere(name, position, size):
    #bpy.ops.mesh.primitive_uv_sphere_add( location=position, size=size )
    bpy.ops.surface.primitive_nurbs_surface_sphere_add( location=position, size=size )

    ob = bpy.context.object
    ob.name = name
    ob.show_name = False
    me = ob.data
    me.name = name+'Mesh'
    return ob

p=read("/home/cpi/BLENDER/terrazze.xyz")

for i in p:

    if i.symbol == "C"  :
        createsphere('C', i.position,0.4)
        setMaterial(bpy.context.object, rubber)
    elif i.symbol == "H" :
        createsphere('H', i.position,0.2)
        setMaterial(bpy.context.object, gold)
    elif i.symbol == "Au" :
        createsphere('Au', i.position,1.2)
        setMaterial(bpy.context.object, gold)

I can hanlde max ~100 spheres...
What should I do to create my terraces made of gold spheres?

Thanks for your help

Carlo

Dear all,
i found something that works although I am not sure to understand all details:

 def qsphere( position, size):
   bpy.ops.mesh.primitive_uv_sphere_add( location=position, size=size )

   ob = bpy.context.active_object
   return ob

 def returnScene (passedIndex = 0):
  try:
   return bpy.data.scenes[passedIndex]
  except:
  return None

 p=read(filei)

 ob = qsphere(p[0].position,1.4) # NOTE: We only mess with the context one time.
 ob.name = geoname
 me = ob.data
  me.name = geoname
 print(me.name)
localScene = returnScene()

 for i in p[1:]:

    if i.symbol == "C"  :
       createsphere('C', i.position,0.4)
       bpy.ops.object.shade_smooth()
       setMaterial(bpy.context.object, rubber)
    elif i.symbol == "H" :
       createsphere('H', i.position,0.2)
       bpy.ops.object.shade_smooth()
      setMaterial(bpy.context.object, gold)
   elif i.symbol == "Au" :
       tempObjectName = i.symbol + returnNameForNumber(i)
      ob_temp = bpy.data.objects.new(tempObjectName, me)
       ob_temp.location=i.position
     localScene.objects.link(ob_temp)

Blender can handle a million vertices in one object better than it can handle 10,000 objects in one scene. This means you should get better performance if you create all the vertices in one object instead of many individual objects.

Using blender 2.7x -

import bpy
import bmesh
import mathutils

# create the materials used
# simple BI materials used
MatAu = bpy.data.materials.new('Mat.Au')
MatAu.diffuse_color = Color((0.8,0.7,0.2))
MatC  = bpy.data.materials.new('Mat.C')
MatC.diffuse_color = Color((0.1,0.1,0.1))
MatH  = bpy.data.materials.new('Mat.H')
MatH.diffuse_color = Color((0.8,0.7,0.2))

# create an empty mesh object and add it to the scene
sphereMesh = bpy.data.meshes.new('AllSpheres')
sphereObj  = bpy.data.objects.new('AllSpheres', sphereMesh)
bpy.context.scene.objects.link(sphereObj)
bpy.context.scene.objects.active = sphereObj

# create slots for each material then add each material to the object
while len(sphereObj.material_slots) < 3:
    bpy.ops.object.material_slot_add()
sphereObj.material_slots[0].material = MatAu
sphereObj.material_slots[1].material = MatC
sphereObj.material_slots[2].material = MatH

# test data to be swapped for data in file
# type, location, scale
data = [('C', (1.0, 1.0, 1.0), 0.2),
        ('H', (2.0, 2.0, 2.0), 0.4),
        ('Au',(3.0, 3.0, 3.0), 0.8),
        ('C', (4.0, 4.0, 4.0), 1.2),
        ('H', (5.0, 5.0, 5.0), 0.2),
        ('Au',(6.0, 6.0, 6.0), 0.8),
        ('C', (7.0, 7.0, 7.0), 0.4),
        ('H', (8.0, 8.0, 8.0), 0.8),
        ('Au',(9.0, 9.0, 9.0), 1.2),
]

bm = bmesh.new()
for i in data:
    locMatrix = mathutils.Matrix.Translation(i[1])
    scaleMatrix = mathutils.Matrix.Scale(i[2], 4)
    mesh = bmesh.ops.create_uvsphere(bm, u_segments=8, v_segments=8,
                    diameter=1.0, matrix=locMatrix*scaleMatrix)
    for v in mesh['verts']:
        for f in v.link_faces:
            if i[0] == 'Au':
                f.material_index = 0 # material_index matches material_slots[x]
            elif i[0] == 'C':
                f.material_index = 1
            elif i[0] == 'H':
                f.material_index = 2

bm.to_mesh(sphereMesh)
bm.free()

For 2.80+ some small changes are needed

import bpy
import bmesh
import mathutils

# create the materials used
# simple BI materials used
MatAu = bpy.data.materials.new('Mat.Au')
MatAu.diffuse_color = (0.8,0.7,0.2,1.0)
MatC  = bpy.data.materials.new('Mat.C')
MatC.diffuse_color = (0.1,0.1,0.1,1.0)
MatH  = bpy.data.materials.new('Mat.H')
MatH.diffuse_color = (0.8,0.7,0.2,1.0)

# create an empty mesh object and add it to the scene
sphereMesh = bpy.data.meshes.new('AllSpheres')
sphereObj  = bpy.data.objects.new('AllSpheres', sphereMesh)
bpy.context.collection.objects.link(sphereObj)
bpy.context.view_layer.objects.active = sphereObj

# create slots for each material then add each material to the object
while len(sphereObj.material_slots) < 3:
    bpy.ops.object.material_slot_add()
sphereObj.material_slots[0].material = MatAu
sphereObj.material_slots[1].material = MatC
sphereObj.material_slots[2].material = MatH

# test data to be swapped for data in file
# type, location, scale
data = [('C', (1.0, 1.0, 1.0), 0.2),
        ('H', (2.0, 2.0, 2.0), 0.4),
        ('Au',(3.0, 3.0, 3.0), 0.8),
        ('C', (4.0, 4.0, 4.0), 1.2),
        ('H', (5.0, 5.0, 5.0), 0.2),
        ('Au',(6.0, 6.0, 6.0), 0.8),
        ('C', (7.0, 7.0, 7.0), 0.4),
        ('H', (8.0, 8.0, 8.0), 0.8),
        ('Au',(9.0, 9.0, 9.0), 1.2),
]

bm = bmesh.new()
for i in data:
    locMatrix = mathutils.Matrix.Translation(i[1])
    scaleMatrix = mathutils.Matrix.Scale(i[2], 4)
    mesh = bmesh.ops.create_uvsphere(bm, u_segments=8, v_segments=8,
                    diameter=1.0, matrix=locMatrix @ scaleMatrix)
    for v in mesh['verts']:
        for f in v.link_faces:
            if i[0] == 'Au':
                f.material_index = 0 # material_index matches material_slots[x]
            elif i[0] == 'C':
                f.material_index = 1
            elif i[0] == 'H':
                f.material_index = 2

bm.to_mesh(sphereMesh)
bm.free()


How to [dynamically] pin soft body objects to another mesh? My goal is to use the Armory addon to move the two soft body meshes to interact some rigid bodies in the scene. For example, I want to apply forces the soft body objects to bring them closer to each other and grab something (a rigid body/collider mesh) in the scene. It is possible that those interactions would push each of the soft body meshes in different directions but I do not want this to be the case. Instead, I want the soft body meshes to be somehow linked to each other in a way that moving/interacting with one will affect the other one too (I basically want to build a simplified version of what is shown in this video from the 33rd second to the first minute). For instance, if a colliding mesh contacts one of the soft body meshes with high velocity from any angle I would like the two soft bodies move in the same direction as a result of this collision.

Therefore, I am looking for a way to somehow glue/attach/pin two soft body objects to something (e.g. bone or another mesh) placed on top of them. However, just pinning the top vertices of the soft body meshes will disallow me to move them freely (as shown here). So I want to have a more flexible type of pinning (hence the term "dynamic") so that the soft body meshes can still be moved towards each other when some force is applied to them so that they can interact/collide with other objects but don't fall down.

I wonder, how would this be possible? You can take a look at the .blend file that I attach to this question to get a better intuition of what I want to do. Here's a screenshot of the scene in the attached .blend file:

P.S. I'm not sure if the tag animation is correct for my question, but I thought it should be relevant. So feel free to edit the questions and remove if my question is not relevant to animation stuff.

In order to 'pin' certain vertices of a soft body in place, you can use the Soft Body Goal settings with a Vertex Group.

First select the vertices that you want to pin in Edit mode (Tab). Then add a new Vertex Group and click 'Assign' to assign them to the group. Rename the vertex group to something appropriate such as "Pin".

In the Soft Body Goal settings, set the Strength and Stiffness to high values (the closer to 1.0, the more the vertices will be attached in place to the vertices in the starting mesh that you have 'pinned'.

Only those vertices in the vertex group will be 'pinned' - the rest will continue to behave as Soft Body.

You can then either leave the original mesh in place (so it keeps those pinned vertices static) or Hook the vetices to another mesh so that they are pinned to that other mesh.


Bmesh - Append selected vertices to a List (Working script not "Reloading" correctly) In Blender2.79,the script below calculates the selected vertices and stores them in a list.
As there were issues with calculating these vertices directly on a mesh instance ,the object's mesh had to be converted to a "bmesh" instance.

When the script is run it works fine in the "First run".

But in the subsequent runs it gives the following error- AttributeError: 'bytes' object has no attribute 'verts'

Also,on updating the bmesh with bmesh.update_edit_mesh(me)results in this error-  ReferenceError: BMesh data of type BMesh has been removed

How to resolve these bmesh errors?

#-------------------------MAIN SCRIPT--------------------------
#Select vertices of default cube in Edit mode

from os import system
system("cls")

import bpy
import bmesh

scene = bpy.context.scene
ob = scene.objects.active
vert = ob.data.vertices

#Set default mode == Edit
if bpy.ops.object.mode_set.poll():
    bpy.ops.object.mode_set(mode='EDIT')

print("Active object = ",ob.name)
print("")

#Create Bmesh instance and calculate vertices
print("Vert_selected")

me = ob.data
bm = bmesh.new()
bm = bmesh.from_edit_mesh(me)

vert_selected = [v.co for v in bm.verts if v.select] #AttributeError: 'bytes' object has no attribute 'verts'
for vs_s in vert_selected :
    print(vs_s)

bpy.ops.mesh.select_all(action='DESELECT')
bm.select_flush(True)

#bm.bmesh.update_edit_mesh(me) #If mode ==Object  -> ReferenceError: BMesh data of type BMesh has been removed (Uncommenting results in Blender crash)
bm.free()
ob.update_from_editmode()

print("Script exited")

Since there was no change in the actual mesh,updating the mesh with update_edit_mesh() was not required.Also setting object context directly to "Edit"mode as opposed to a context mode_set poll() works.

Code can be found here.


Copy existing property from e.g. Properties window to a custom panel So if I have this custom panel in the 3D view, is there a way I can take a property from for example the properties window and paste it onto my panel below the "text" prop, without creating a new property?

The reason I do not want to create a new property is because I want them to share all data, such as values, keyframes, drivers etc.

    bl_info = {
    "name": "",
    "description": "",
    "author": "",
    "version": (0, 0, 1),
    "blender": (2, 70, 0),
    "location": "",
    "warning": "",
    "wiki_url": "",
    "tracker_url": "",
    "category": ""
}

import bpy

from bpy.props import (StringProperty,
                       BoolProperty,
                       IntProperty,
                       FloatProperty,
                       FloatVectorProperty,
                       EnumProperty,
                       PointerProperty,
                       )
from bpy.types import (Panel,
                       Operator,
                       AddonPreferences,
                       PropertyGroup,
                       )

class inouse_Settings(PropertyGroup):

    my_bool = BoolProperty(
        name="Enable or Disable",
        description="A bool property",
        default = False)

class UV_OT_my_panel(Panel):
    bl_space_type = 'VIEW_3D'
    bl_idname = "UV_OT_my_panel"
    bl_label = "Custom"
    bl_category = "Custom"
    bl_region_type = 'TOOLS'

    def draw(self, context):

        scn = context.scene
        mytool = scn.inhouse
        layout = self.layout

        col = layout.column(align=True)
        row = col.row(align = True)
        row.prop(mytool, "my_bool", text="Text")

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.inhouse = PointerProperty(type=inouse_Settings)

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

if __name__ == "__main__":
    register()

Of course, you can reuse all python properties at least. 'Right-Click' the property and choose Edit Source, this will open up the associated .py file in the Text Editor:

'Resolution' adapted:

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

    layout = self.layout
    row = layout.row()
    sub = row.column(align=True)
    sub.label(text="Resolution:")
    sub.prop(rd, "resolution_x", text="X")
    sub.prop(rd, "resolution_y", text="Y")
    sub.prop(rd, "resolution_percentage", text="")


Glass not Transparent I'm a novice in Blender and my problem is the roof isn't transparent everywhere, when I put camera in a certain angle the location of the transparent changes.

I use BlenderGuru pro lighting skies for the light.

What Rich said, also might be worth a shot doing ctrl a - set rotation and scale, as not doing so can cause some bizarre behavior in both editing and object mode.


Is it possible for a single object to have more than one mesh? I have two objects, A and B, each with their own meshes. Is it possible to take the mesh of A and put it inside B but still keeping it separate from the original mesh of A? How can this be done?

For elaboration, please see the image below:

No, you can't give one object two mesh datablocks at once.

However, if you need to do something like packing UVs of two meshes together you can assign a vertex group to all the vertices in the active mesh. Then you should join the meshes (CtrlJ), do the unwrap or whatever you needed to do, deselect everything, select the vertices in the group, and separate them (P > Selection). That way you have your original object back, but unwrapped together. The Texture Atlas addon can also do this.

If you need to move two meshes together, parent them both to an Empty ( CtrlP).


How do I remove modifiers from the modifier stack if they don't have an 'x' button? Some modifiers, notably particle system do not have any "minus" sign that allows for them to be removed. I want to keep the fluid settings but remove the particle system and redo it as it has gotten messed up trying something. But I can't remove it.
My workaround at the moment is to save the settings and delete the whole model and reimport it - starting again simply to remove modifiers I don't want.
Any idea how to remove unremovable modifiers?

Particle systems are controlled in the Particle systems tab.
Where you can add or remove different systems.
Click on the icon to open the tab here

Or click on the tab for particles directly

To delete a particle system click on the minus sign in the upper right.


Blender crashes when assigning materials from script - is it a bug? I wrote a script. In one part of the script, there is this line:

base_object.data.materials.append (changeable_material)

Whenever I try to run the script, Blender just shuts down, immediately, without any error or anything, within a fraction of a second.

base_object is a cube generated by the script, changeable_material is a precreated material. I don't have much experience with Blender scripting.

Is this a mistake in my code or a bug? If not a bug, how do I fix it?

Edit:

Relevant parts of the script:

import bpy

matrix_size = 3

matrix = []
cubes = []
materials = []
matrix_range = range (matrix_size)

changeable_material = bpy.data.materials.get("Material")

material_value = 0

for i in range (matrix_size):
    matrix.append([])
    cubes.append ([])
    materials.append (changeable_material.copy ())
    materials [-1].node_tree.nodes.get("Value").outputs [0].default_value = material_value
    material_value += 1 / matrix_size
    for j in range (matrix_size):
        matrix [-1].append ((i * j) % matrix_size)
        cubes [-1].append (0)

(...)

#removes all unused materials
for material in bpy.data.materials:
    if (not (material.users)):
        bpy.data.materials.remove(material)

bpy.ops.mesh.primitive_cube_add()
base_object = bpy.context.object
base_object.name = "base cube"
base_object.data.materials.append (changeable_material)

bpy.context.scene.objects.active = base_object

(...)

for i in range (matrix_size):
    for j in range (matrix_size):
        if cubes [i][j].data.materials:
            cubes [i][j].data.materials[0] = materials [matrix [i][j]]

Here is the whole:

import bpy

matrix_size = 3

(...)

materials = []
matrix_range = range (matrix_size)

changeable_material = bpy.data.materials.get("Material")

material_value = 0

for i in range (matrix_size):
    (...)
    materials.append (changeable_material.copy ())
    materials [-1].node_tree.nodes.get("Value").outputs [0].default_value = material_value
    material_value += 1 / matrix_size
    for j in range (matrix_size):
        matrix [-1].append ((i * j) % matrix_size)
        cubes [-1].append (0)

bpy.ops.object.select_all(action = "SELECT")

for i in bpy.data.objects:
    if ((i.type == "CAMERA") or (i.type == "LAMP") or (i.name == "Material_Holder")):
        i.select = False
bpy.ops.object.delete()

#removes all unused materials
for material in bpy.data.materials:
    if (not (material.users)):
        bpy.data.materials.remove(material)

bpy.ops.mesh.primitive_cube_add()
base_object = bpy.context.object
base_object.name = "base cube"
base_object.data.materials.append (changeable_material)

base_object.scale = (0.5, 0.5, 0.5)

bpy.context.scene.objects.active = base_object

arrayOne = base_object.modifiers.new (name = "arrayOne", type = "ARRAY")
arrayOne.count = matrix_size
arrayTwo = base_object.modifiers.new (name = "arrayTwo", type = "ARRAY")
arrayTwo.count = matrix_size
arrayTwo.relative_offset_displace [0] = 0
arrayTwo.relative_offset_displace [1] = 1

bpy.ops.object.modifier_apply (modifier = "arrayOne")
bpy.ops.object.modifier_apply (modifier = "arrayTwo")

base_object.select = True
bpy.ops.mesh.separate (type = "LOOSE")

for i in bpy.data.objects:
    if ("cube" in i.name):
        bpy.ops.object.select_all(action = "DESELECT")
        i.select = True
        bpy.ops.object.origin_set (type = "ORIGIN_CENTER_OF_MASS")
        cubes [int (i.location [0])][int (i.location [1])] = i

for i in range (matrix_size):
    for j in range (matrix_size):
        if cubes [i][j].data.materials:
            cubes [i][j].data.materials[0] = materials [matrix [i][j]]

From the code snippets given, it's difficult to reproduce the error.

Here's my guess:

If the object with the name 'Material_Holder' does not have the material referenced by the variable changeable_material, that material will get removed (in block with the comment #removes all unused materials). There would be problem if later this (removed) material is appended to any object (base_object.data.materials.append (changeable_material)). The crash could be related to this.

So if the changeable_material is needed later in the code, the condition should be if (not (material.users)) and material is not changeable_material before calling remove.


How to reverse normals of thick box I am trying to create a box or room that has a slight thickness to the walls, with normals reversed on everything so you can always view the inside from the outside(with backface culling checked)

I have tried adding the solidify modifier to a box, then reversing the normals, but this doesn't work as expected. I then messed around with flipping normals manually by selecting the faces I want the normals flipped on, but this also didnt work.
What other method is there?
Thanks

Check "Only Rim" within the solidify modifier. Make sure you also have "Flip normals" checked within the modifier as well.


How to fix Makehuman Textures in blender? I imported a model from Makehuman and see whats wrong with the textures and how do i fix it? Remember i have to be in Cycles render.

What you need is to set transparency to "hairy" objects, like lashes and brows.
Though the texture image contains transparent data, in Blender your material is probably set to plain diffuse, which won't read alpha channel generally.
You have to set it manually, combining the diffuse with a transparent shader, and connect the mixing factor with the image's alpha output (see the picture below).

Remember: the image texture must be PNG format. If you have it in JPG for some reason (like you edited and saved it in Photoshop), it won't work.
JPG is only RGB, while PNG is RGBA. That means with Red Green Blue channels comes a fourth one: the Alpha channel, the transparent channel.
(MakeHuman creates PNG textures by default)

In Cyclyes, the shading what you need goes like this:

Have a nice day! :)


How to "glue" a rigged model to an animation? In Blender (2.90.1): What steps need to be done to combine a rigged character model (from a .blend file) with an animation from a .fbx file?
What I've tried so far is this:

Open the model from the .blend file.
Import the animation from the .fbx file.

The result can be seen at this screenshot:

The (thin black) stick figure represents the animation from the .fbx file. Pushing play at the timeline plays its animation.
Now the question is, what needs to be done to transfer the animation from the stick figure to the cowboy model? I.e. How can you make the cowboy walk?
You help is very much appreciated.
Thank you!

In Pose mode, there's an option to add Bone Constraints (Below the Bone Context).

Select Add Bone Constraint - Copy Rotation, and select the corresponding bone in the other rig as Target.
"Corresponding" is a bit arbitrary, since for example, the cowboy rig doesn't have hip bones. So you will need to play around a bit with the options available, like Invert.


How can I rotate the pivot point of my object without rotating the object itself? I'm trying to import a 3dmodel into unreal but i need the local transform to match the global or else unreal will garble the objects' rotation/scale/translation.

Is there a way to do this in blender?  I see people doing it in every video on 3ds Max.

After some headscratching about what you mean, I figured it out. Use the shortcut CTRL+A, then apply "Rotation and Scale"

EDIT
What this does is it simply applies your rotation and scale of the object, aligning the local Z axis with the global Z axis and so on. It also applies the scale of the object, meaning textures will align properly.

Hope this helps.


Ipo module in Blender 2.74 using python I need to update a 2.49 blender code to 2.74 but I can't find in Blender 2.74 a module named Ipo. Someone can help me? Below, part of my code in 2.49 version.

  obj = Object.Get('obj'+str(visNames.index(ni)))

  ipo = Ipo.New('Object','obj'+str(visNames.index(ni))+'.ipo')
  obj.setIpo(ipo)

  curveTime = ipo.addCurve('Time')
  curveTime.setInterpolation('Linear')

  curveLocX = ipo.addCurve('LocX')
  curveLocX.setInterpolation('Linear')

  curveLocY = ipo.addCurve('LocY')
  curveLocY.setInterpolation('Linear')

  curveLocZ = ipo.addCurve('LocZ')
  curveLocZ.setInterpolation('Linear')

From 2.50 Ipo's have been replaced with Actions. While you can create an action with bpy.ops.action.new() you can also just add a keyframe to a property and the action will be created for you. Instead of Ipo curves we now use f-curves.

Starting with getting an object by name

obj = bpy.data.objects['Cube']

You can then use keyframe_insert to key all 3 axes of the objects location with

obj.keyframe_insert('location')

To key just one axis you can specify an index (X=0 Y=1 Z=2)

obj.keyframe_insert('location', index=0)

You could add multiple keyframes from a list

x = [1.0, 2.0, 3.0]
xframes = [0, 10, 20]
for i in range(len(x)):
    obj.location.x = x[i]
    obj.keyframe_insert('location', index=0, frame=xframes[i])

For the interpolation, each keyframe has it's own interpolation setting. A simple loop can set each keyframe to use the same interpolation.

objCurves = obj.animation_data.action.fcurves
for curve in objCurves:
    # here you can also test curve.array_index to find
    # the curve of a specific axis
    # array_index matches the index used in keyframe_insert
    if curve.data_path == 'location':
        for k in curve.keyframe_points:
            k.interpolation = 'LINEAR'

From blender v2.76 you can use objCurves.find() to get the specific curve that you want.

objCurves = obj.animation_data.action.fcurves
for i in [0,1,2]:
    curve = objCurves.find('location', index=i)
    for k in curve.keyframe_points:
        k.interpolation = 'LINEAR'


Add marker to 2D tracking list via clip.stabilize_2d_add() or other means My goal is to call blender form the command line with a set of arguments to use the built in 2D video stabilization tools.

I have been able to (via the bpy API):

Get parameters from command line call
load a new clip
add a marker (to track)
position the marker
'select' the marker/track (not sure if needed)

This is all possible without relying on bpy.ops

Unfortunately now I need to access the following functionality programmatically:

My main question: I can't find a way to get to that (bpy.ops.clip.stabilize_2d_add()). I have no idea what context I would need to switch to to make this a valid python call.

At this point I also notice the transition from doing everything in code to having to hunt through the UI workflow for ways to replicate UI functionality. I am wondering if I shouldn't need to call bpy.ops.clip.stabilize_2d_add() at all and should instead find the underlying functionality?

The part that comes right after this, which is making the stabilized track is completely lost to me as well. Am I going in the wrong direction?

Any help would be greatly appreciated.

You can add and adjust tracking markers without using operators.

Each movie clip has a tracking property which has a list of the tracks that have markers.

Every tracking.track is a point in that you are tracking. The markers for each track are keyframes of the tracks location.

import bpy

track_data = bpy.data.movieclips['movie_track'].tracking

for i in range(10):
    # this adds a new point to be tracked
    trck = track_data.tracks.new()
    for f in range(1,100,10):
        # this sets the location of the point at frame f
        x = (f+i) * 0.1
        y = (f+i) * 0.1
        trck.markers.insert_frame(f, co=(x,y))

# get track data
for t in track_data.tracks:
    for m in t.markers:
        print('marker on frame {} at {}'.format(m.frame, m.co))


I can't flip my pose for my animation? So I am currently following a mech tutorial on animating a run cycle. At about 7:27 in the video (after he posed/key framed the mech in the first frame), the guy copied the key frames in the first frame and pasted/flipped them (ctrl+shift+v) on frame 10. The pose was perfectly flipped for him.

On the other hand, when I tried to do it, my mech became distorted. Here is the first frame of my mech's run cycle.

And here's how my mech looks in frame 10 when I paste/flipped the pose in frame 10.

As you can see, the body becomes distorted and weird. I did some research and I tried to rename the control bones on my feet to indicate which ones are left and right, but that didn't work.

I tried to recalculate my roll (shift+N) for all my bones for the Global +Z Axis in edit mode, but that didn't work either.
I should note that when I did recalculate my roll, the z axis for most of my bones did recalculate properly, except for a few. Including the pole bones for my feet.

Here's a photo before of all of my bone's axises before I recalculated their rolls.

And here's the after image.

Does anyone know what I'm doing wrong??? How do I flip my pose correctly?
Here's a copy of my Blender file.

I guess your problem is a mix of wrong names and bad orientations.

You say that you tried to rename your bones, but in your file they are not properly renamed. The left foot must be named something like foot_L, and right foot something like foot_R, otherwise when you'll flip the pose, Blender won't be able to understand to what bone it is supposed to paste.

So when you have finished a side of your armature you should properly name all your bones, then, in Edit mode, select them all and Armature > Symmetrize so that it copy paste on the other side.

Also, you'll probably need to correct the rotation of the lower leg due to the IK: Once in Pose mode, select the lower leg, go into the Properties panel > Bone Constraints, play with Pole Angle value to correct the orientation.


How to stop Blender from simulating smoke when doing some things So I have a scene with a smoke simulation but when I hide the domain it still calculates the simulation which slows down my computer fro what it would usually be able to do at 30fps plus to 2fps. So how do I stop blender from simulating

Bake the simulation to a cache, then blender doesn't need to recalculate the simulation.

In order to bake the cache, you must save your blend file first, otherwise the buttons will be greyed out.

Read more in the blender manual section on baking smoke.

You won't need to hide the domain after you do this, unless of course you don't want to see it.


Why do I get black dotted lines on my mesh when switching to look dev mode? I just modeled this thing, but when I switch to dev look mode these black lines on the side of the mesh. What are those and how do I get rid of them? I used the knife tool to add edges to get clean quads. Is it related to that?

(Assuming Blender 2.80)
Looks like there are two edges at (nearly) the same place. Go edit mode and "Merge Vertice->by Distance". Play around with the distance value a little bit. Make a backup of the file before.


HDRI environment texture doesn't load For some reason on the current computer/blender setup that I am using the HDRI texutres from HDRheaven isn't working. I've downloaded couple of them but can't make them work. Is some checkmark missing that I'm not aware of?

You are in look 'dev mode'. Change it to 'rendered'.

Or activate 'Scene world' here:


Alternative for old ika in Blender Blender had once upon a time such IKA systems i miss. I Used the IKA to animate pneumatic pump.

I realy try to switch to armatures but stuck on it since years, they are very complex.

The way i did it in the version 1.80a was to:

add two sticks (big, small).
add an ika in both sticks
parenting the sticks to the ikas.
parenting the ika to each other ika.

The Armatures-Objects looks like a much more complex feature than i need.

Any idea how to construct this is a new blender version?

Without using an armature you can use parenting and constraints.

Starting with two cylinders, add two empties. The empties should be located at opposing ends of each cylinder.
Select a cylinder then Shift select the matching empty and parent them with ⎈ CtrlP -> Object. Repeat for other cylinder and empty.
Select a cylinder and add a TrackTo constraint. Set the target to be the empty of the opposing piston and set the axis to suit. Repeat for other cylinder.

Now as you move one of the empties the two pistons will always point towards each other. If you position one of the empties at the outer edge of a disc and parent the empty to the disc it will rotate around with it and the cylinders will follow.

Here is a sample file to look at.


How to set font size in points? I am using Metric and want to type text to export as a STL for my 3D Printer. Is there a method of knowing or setting up the text size in points (pt)? In all other programs I select the size and know that I need a size of say 155, how can I do this in Blender? The scale I have as 1.000 if that's correct?

No, there is no way to set the size of a text object in points.
A point is just another unit of measure (wikipedia), so if you know the size point that your other programs and printer are using then you can set the size in blender. Typically a point is 1/72 of a inch or 0.3515mm. So for your 155pt you could set the size to be 54.4825mm.

The quickest way to do so would be to first, set the units to be Metric.
Then in the Properties panel, N to show it. Type in 54.4825mm to the Y axis. Copy the scale from the Y axis to the X and Z axes. The text is now sized at 155pt.


Splitting giant action into many sub actions via python? I am currently working on integrating some assets into a custom engine. The engine relies on each animation being a separate action. The asset files I am working with however have all 50 animations "baked" into one singe "DefaultAction". I have resolved this issue in the past by simply copying the giant "DefaultAction" for every animation and removing the frames for the other animations. This however is rather tedious and time consuming.

I was wondering if the python api provided by blender contains the functionality required to be able to automate this task? For example, could I select the "DefaultAction" and then create multiple other actions based on the frames inside of "DefaultAction"?

Not looking for anyone to write this, just looking for confirmation that it is theoretically possible, and if so maybe a link to the classes of the api that could be used to do this. If it's doable I will see what I can put together and provide source for others as I believe this would be a valuable asset to have (since this isn't the first time I've run into this issue I suppose others have as well).

EDIT 2

I have given this a shot and think I'm close, but am having dificulty finding the right method/procedure to use to actually remove the keyframe_point from the fcurve of the action:

import bpy

base_action_name = "bend"

sub_actions = [
    ("sub_bend_001", 0, 14)
    ,("sub_bend_002", 15, 29)
]

for a in sub_actions:
    new_action = bpy.data.actions.get(base_action_name).copy()
    new_action.name = a[0]
    for fc in new_action.fcurves:
        i = 0
        for kfp in fc.keyframe_points:
            if i < a[1] or i > a[2]:
                kfp.remove(kfp) # AttributeError: 'Keyframe' object has no attribute 'remove'
            i = i + 1

Anyone know how to remove keyframe_points from an fcurve?

Got it! I was attempting to call the remove() method on a Keyframe object instead of the keyframe_points property of the FCurve. Below is working code that transforms a giant action into multiple sub-actions (working in 2.79, I'd say it should work in 2.8 as well but I don't know how extensive the changes were to the api between 2.79 and 2.8 so if you're on 2.8 your mileage may vary):
import bpy

# Define the name of the giant action containing all other sub-actions
base_action_name = "bend"

# Define the name, start, and end frame of each sub animation
sub_actions = [
    ("sub_bend_001", 0, 14)
    ,("sub_bend_002", 15, 29)
]

for a in sub_actions:
    new_action = bpy.data.actions.get(base_action_name).copy()
    new_action.name = a[0]
    for fc in new_action.fcurves:
        # Remove unwanted frames
        for i in reversed(range(0, len(fc.keyframe_points))):
            kfp = fc.keyframe_points[i]
            frame_number = int(kfp.co[0])
            if frame_number < a[1] or frame_number > a[2]:
                fc.keyframe_points.remove(kfp)
        # Shift remaining frames
        offset = fc.keyframe_points[0].co[0]
        for kfp in fc.keyframe_points:
            kfp.co[0] = kfp.co[0] - offset
            kfp.handle_left[0] = kfp.handle_left[0] - offset
            kfp.handle_right[0] = kfp.handle_right[0] - offset


Exporting a rigged object to Unity (as FBX) produces massively distorted mesh, affecting normals I've just built my first rigged model in Blender. Everything looks okay inside Blender, but when I export it as an FBX and bring it into Unity - not so much.
If I drag the whole rigged model into the scene, it's the right shape (and bends in the right places) but the lighting on it is crazy. Dragging the raw mesh into the scene and rendering it without rigging shows why: the underlying mesh is HUGELY distorted from how it was built in Blender.
I'm sure there's an option in there somewhere, either on export or on the bones or on the model. But I don't know what it is. If there are multiple settings change, I am fine with that.
Can anyone help? Thanks.

EDIT: The video posted by Aster17 includes a step correcting for object scale prior to export, along with many other steps, so refer to that for your exporting needs. I'm only accepting this answer rather than Aster17's because this answer explains what happened in this specific case in more detail.
I tracked down the cause: in the very first edit I had made when sculpting the model (after adding and subdividing a cylinder primitive) I had accidentally scaled the object rather than the vertices to make the shape longer and narrower.
This obliged Blender to similarly apply an asymmetric scale to the bones of the armature when parenting the rig to the mesh, in order to preserve its appearance. However, it seems that at some stage in the Blender->FBX->Unity workflow, the ability to cope with asymmetrically scaled normals is lost.
In short, Blender hadn't distorted the mesh at all - I had, right at the start. All Blender did was bake that distortion into the bones.
The upshot is that if you asymmetrically scale an object (as opposed to its vertices) in Blender, then Blender and Unity will come to different conclusions about the normals that should accompany that shape.


Wrap belt around an arm? I have made a basic belt to use on others models, but how can I wrap my belt around a non-cylinder form (arm), so it will fit around an arm? What I want to achieve is like the shrinkwrap modifier, but with a preservation of volume. Can you shrinkwrap the inner faces of a belt and let the rest of the object follow with the object volume intact?

Usually this kind of work - modeling accessories - is not done in this way. Instead, you select parts of original mesh (character) in adjacent places where you'd like your belt / coat / whatever to be, duplicate them into another mesh (with P > By Selection) and start moving vertices around in that new mesh in order to make it look like belt / etc.

If you already have premodeled mesh it is possible to wrap it around your character but it may be far more complicated and far less convenient.

There is basic mesh representing an arm and basic mesh representing a necklace / belt in the example below.

I splitted its vertices into several vertex groups (total 3) like so:

Option 1 - shrinkwrapping accessory

There are added 3 Shrinkwrap modifiers to belt object - one per vertex group. One of them wraps inside verts, another one - middle part and 3-rd one - outside part of mesh. All of them use different Offset value in order to make parts of belt not intersecting.

Though this is possible, it won't provide you with flexibility - if necklace shown in gifs would have some kind of jewelry or clasp or something else detailed, it would be an awful task to wrap parts of them accordingly. Also even in this very simple case mesh representing belt is slightly deformed after wrapping which is not desired of course.

It is possible though to add parts of mesh which shouldn't be deformed when wrapping into another vertex group which won't be used by any modifier. Thus it will be possible to wrap accessory by using several ways at a time.

Shrinkwrap modifier's wiki page

Option 2

You could also use proportional editing or Lattice modifier to manually wrap the belt mesh.

This way it's possible to avoid distortions of the mesh - lattice works kind of proprtional editing from this point of view, but it allows more flexibility because base mesh isn't changed (unless modificator is applied). Again, you can split mesh in several vertex groups and even assign them to different lattices (but this may be overkill).

Lattice modifier in the wiki

Shaping a fork - tutorial about using Lattice modifier

Although these ways work, they should be used only if some complex accessory is needed to be wrapped around exhisting character. In general, if accessory isn't modeled yet it's better to duplicate base mesh for it from the original character and edit duplicated parts as needed.


Making particles pile up on the floor I have a simple scene. I'm using a particle system but the particles don't collide with the floor. They disappear after reaching the floor. I would like the particle to settle on the floor after being emitted from the top. Any suggestion are appreciated.

First of all, after seeing your scene, increase your particles lifetime so they can actually reach the floor.

Then you need to create an actual collision object, because physical objects do only interact with special defined collision objects.

At deafult settings, the particles are bouncing very heavy after touching the collision object and if you want to change this bounciness you have to go to your collision object and change the stickiness.

And If you want to prevent them from gliding on the floor, increase the friction.


UV Editor, Blurred vertex, edge, face UV selection Is there any reason when I select vertexes, edges or faces in the UV editor, the selection marker blurs to extends to its surrounding elements? I am not aware of having touched anything to get that. Apparently, it doesn't affect the way the selected elements behave, but It is visually very annoying.
Thanks so much.

This is normal. The blur is to indicate what edges the vertex is (and more importantly isn't) connected to. This can be very useful when two vertices are on top of each other for whatever reason.


How do I assign a modifier to all objects using the same material How do I apply a displace modifier to all objects using the same material without selecting every object one at a time that uses that material and adding a modifier to each?

Details: Since 1 material requires all the same modifier I thought maybe I could use the node editor to apply it but don't know how if it's possible.

With the object with the material and modifier as the active object, press Shift+L and select 'Materials'. this will select all objects that share the material. Then press Ctrl+L and select 'Modifiers'. This will give all the objects the same modifiers.

Note: If you want to make a change to the modifier and have the change across all the objects, you will have to select them all again and hold Alt while making the change.


Cycles Fake Absorption Setup Explanation I would just like to understand why in the cycles fake absorption setup he ray length have to be multiplied against the backfacing value in order to tell Cycles when the ray starts and stops. I did the BlenderDiplom tutorial and there was no explanation as to why that does what it does. I can use the fake absorption setup with no problem, I would just like to understand exactly how it works so I can use it knowing exactly what it is doing.

The way the node setup you are referencing works is by coloring the inside wall of a material based on how far the ray has traveled within the material.

The backfacing output gives 1 if the ray is hitting the side opposite the normal (the "front" of the face), and 0 if the ray is hitting the side with the normal (the "front" of the face).  So the output of the first multiply node (from the left) will be ray_length * 1 = ray_length if the ray is hitting the backside of a face (meaning it is inside the object) and ray_length * 0 = 0 when the ray is hitting the front of a face (meaning it is outside of the object).

The rest of the nodes just convert the linear falloff to exponential and use that result to mix the base color with the absorption color.


NODE – exclude from tree (Node Wrangler) In Blender I can simply exclude node from a node tree with Alt+RMB, but with "Node Wrangler" addon the "Alt" key is used for Mix node.

How can I exclude node from tree with "Node Wrangler" enabled?
Thanks

Another example – that I can't do with Wrangler enabled.

There is Detach From Outputs function which does that, also leaving inputs of the node you moved out from the tree attached. Press Shift+Alt+D with node to detach:

Or from the Node Wrangler toolshelf (N in the UV editor, Node Wrangler tab):


How do I reset the transforms of an object to the original values? I think I accidently pressed something, and now I have the origin of the object away from the origin of the world, although, my other objects are working fine, and they "originate" from 0,0,0.
I tried to reset the origin (Shift+Ctrl+Alt+C, with all options in it).
I tried to move the object to 3d cursor(which is at 0,0,0, and then Origin to Geometry, Geometry to Origin), but still got those coordinates, where I messed up.
I also tried Alt+G, but it moves the object as well, which is not good in my case.
I also tried, to set the Pivot point to all the options in the list(Active, Median, 3D cursor etc).
And I also tried Alt+, to manipulate the center point, but with no luck.

Above, you can see the object is at the 3d cursor(I have the padlocks clicked, but I unclicked them eventually) and at world 0,0,0, but the location is at an offset somewhere.

On this one, you can see, the location is 0,0,0, where it supposed to be.

ctrl+a in 3d View panel will call the Apply menu:

By applying transforms you make them 0, but keep the object unchanged.

If you wanted to set the transforms to 0, you can use alt+g for location, alt+r for rotation and alt+s for scale


How to change the font and size of text editor in Blender 2.8? I played with the Blender Preference in Blender 2.8, but did not find any way to change the actual font/size used inside the text editor.

You can change it in the sidebar of the text editor, which you can open with CTRLT or View > Sidebar. The font size can also be adjusted without opening the sidebar by pressing CTRL and using the scroll wheel.


Blender: morphing object shape I have two different objects in Blender. They have the same number of vertices and in the same order: Is there a way to morph one object into the other?

Select both objects then in the mesh properties under ShapeKeys you will find an option to "Join as Shapes" in the menu under the add/remove buttons. This makes a shapekey in the active object that matches the other object.

With the shapekey selected in the list you can animate the value to morph between the two shapes. Either press I while the mouse is over the value or right-click and select Insert Keyframe.


Some faces not showing in modelling, but visible in sculpting mode I'm pretty new to blender. I was working on a model, and after some accidental key typing, I can only see some faces of my model in modelling mode, however, in layout and any mode that won't clearly show vertices, I have no problem seeing the faces. here are some pictures to illustrate
Hope you can help me and thank you.

It looks like you have accidentally deleted edges & faces (X then Only Edges and Faces).  If that's the case you need to undo or go back to an earlier backup.
But just to make sure, I suggest pressing Alt + H (Reveal Hidden) in edit mode first.


Object creation slows over time I know that this has been asked before, but the answers that others have received did not help me much.  When creating objects through Python, using bpy.ops.mesh.primitive_cube_add() there is an exponential slowdown when looping the creation of objects.  My script that I am writing takes an image and creates a grid of cubes based on every pixel.  It also assigns a material to each cube based on each pixel's color.  When running it on a 32x32 image, it is very fast (about 1 second).  When running it on a 100x100 image, the script gets slower and slower as it runs.  I also have learned that using a low-level method to create my cubes I won't experience the slowdown.  I changed my code to a low-level method, and the speeds are much faster, but I still experience the slowdown.

copy = ob.copy()
copy.data = ob.data.copy()
copy.data.materials.append(material)
copy.location.x = x - 1
copy.location.y = y - 1
copy.location.z = 1
bpy.context.scene.objects.link(copy)

Here is my current code for creating cubes.  My full addon can be accessed here: https://gist.github.com/MrSprite/ff7fda1ec4bf6850d357

Is there a faster/better way of doing this?  Because I would really like to be able to create 100,000+ cubes without waiting hours.

Thanks.

Some quick tests show that blender is designed to work with objects that have high vertex counts but not really with a large number of objects. Even with 3000 objects in a scene it takes a few seconds to select all objects, yet selecting the 33,000 vertices of those objects all joined together is almost instant.

I tested four ways to create multiple cubes.

Create 1000 cube objects - 8 seconds
Create a single mesh containing 1000 disconnected cube meshes - 0.5 seconds
As 2 then separate by loose parts to get 1000 cube objects - 5 seconds
Create a cube and a grid with 1000 verts, enable dupliverts and make real - 0.6 seconds

I am thinking your best approach would be to create a mesh that is a single plane with a vertex where you want each cube to be located, enable dupliverts, then if you want them separate for rigid body you can make the dupliverts real.

For info the script used to test these times is here.


Moving parent by moving a child To help myself with rigging my dinosaur properly i downloaded a nice, professional  dino with a nice rig. I found out in it the thing i don't understand. There's a parent-child chain: chest -> neck -> head -> jaw and there's no bone constraints on any of those bones... and somehow you move the head and the neck follows. It works like IK and it's very smooth and it's comfortable but i have no idea how it's done, despite of having the .blend file.
My question is: how to do this?

Hey that took me awhile because I'm also used to looking for bone constraints. I guess the file creator got lazy and just used auto IK in the tool shelf. It is just a check box enabled.

Here is a screen shot of the option.


Normalized z-depth shader (based on the cycles camera data node) I'm trying to create a shader that displays the normalized (0 to 1) camera Z-dpeth on top of the viewed object.

Yeah, I know I can easily do this in post with the normalize node if I render out the z depth pass, but I prefer to have this in a shader.

I tried to do this with an OSL script using the clamp function but it didn't really do what I wanted. See image below for clarification:

You can see the desired result on the right (achieved with compositor nodes), and the existing result on the left (with shader nodes).

This is the OSL script that didn't quite get me where I wanted, but might be a good start (I intended to use it between the camera data and emission nodes, the same way I use the normalize node in the compositor):

shader normalize_value(
    float inputValue = 0.0,
    output float normalizedValue = 0.0
){
    normalizedValue = clamp(inputValue, 0, 1);
}

I'm of course open to any other method, for instance involving other shader nodes (I couldn't find a way to get the same result but hey who knows!).

If it's ok to put in some values manually, you can use a Cycles shader like this. You have to know the distance of your scene from the camera and the scene size along camera z. In this example the object starts 3 units away from the camera and has a size along camera z of 2 units.

Input the values into the two red value nodes.


Marble rolls in a cylinder smooth animation I have tried everything. To smoothly get the marble into the cylinder and that it rolls through the cylinder. And then goes out of the cylinder again.
I also tried to animate frame by frame but then it stutters. It should roll through the cylinder like a marble.
What is the best solution for this?

I found an example:
https://samvandewal.com/banners/Scene1.mp4
This is wat i want.

Rigid Bodies simulation
v01

Bake to Keyframes
manually adjusted details in Graph Editor
(to synchronize jump on time into hole out)

If you would need more details to RB I can extend answer.

v02
version with Rigid Body simulation only without postpro

to avoid jumping you need more smooth curvature of Cylinder
I had to add more colliders (planes) to push ball into Cylinder and two sides colliders to don't let ball fall from Cylinder
since the animation is slow you can set Collision Margin very low like 0.01 ( in case of cylinder even less 0.001 to keep ball distance from cylinder minimal)

Note:
It really depends what whole motion should looks like, because if you need only this simple result of v02, the Hook Modifier (Timaroberts suggestion) will work faster.
If I Baked to Keyframes this simulation and Decimated keyframes to clean up result, animation curve is really simple.

And result is almost the same


Is it possible to download the manual from the Wiki and integrate it into the help menu? Is it possible to download a PDF/HTML snapshot of the Blender Manual from the Wiki and integrate into Blender's help menu?

You cannot directly download the blender wiki… well not as normally as you are asking, there are ways (and even if you did get it, as far as implementing or getting its content into Blender, that's another story).

You can reach the manual from inside Blender however and some documentation functionality is already implemented somewhat..

Hover over a button and you should see a short description etc.. This can be useful for getting operator names.

For more information, right click on the component in Blender and you can choose to go to the Online Manual or the Online Python Reference

You can also just grab a zip of the python reference for offline viewing directly from the front page.


Apply a Material just to the part of an object that was edited by a boolean modifier I am want to apply a material just to the faces of an object that were edited by a boolean modifier set to subtract.

A would be one material and B would be another. I am also doing this in a animation, so the subtraction object is changing on every frame.

This is how it works by default - materials transfer from one object to another with boolean operations. You just need to have material slots for all the materials used on both objects.
So if you just add a material slot and set it to the same material as the object that you use for boolean operation has it will transfer to that area.


Video editing: keyframe values not setting The problem I have encountered when using Blender as a video editor is that when I set keyframes the values do not stay set. Instead all keyframes adjust to a value of 0.0.

The keyframes appear in the dope sheet and graph editor. The graph shows the curve between keyframes but there is no adjustment made to the movie or sound.

Am using Blender 2.8. This is my first time using Blender as a video editor. Also first time using stackexchange. Let me know if there is anything I can supply to help explain the issue further.

So this is a common problem and not obvious.  You need to update the keyframes after setting the value, otherwise they revert back to there former state when the timline moves.  To do this just hit the I key when hovering over the value control you want to key.

You can also use auto-keying, this is probably the behaviour you are looking for ... look for the Record symbol on the left of the transport bar.

This will automatically create a key for you for each property you change at the current position on the timeline.


Cannot get shadows working with shader graph nodes I have a custom shader that is basicly just rendering a object with vertex colors. I am trying to get shadows working by using LightPath node, but everything renders black when I apply that node. Using Eevee renderer.

The way to get control of the shadows was to have a light with high intensity, and then a mesh with white albedo color. Then the node graph in the image shows how to filter the shadowed part out from the render. There's no light path node at all anymore.


How to fill ngon with faces? Is there any way to fill such a shape with faces? It would help a lot!

I'm trying to create something like this, but I have to do it for a lot of leafs. So doing it manually will be a pain.

Source: https://free3d.com/3d-model/leaf-high-resolution (RobertFreitag)

Of course I could use a more rough shape and use the alpha more, but the alpha is very heavy in big scenes.

Ok so I'm under pressure and I feel the need to edit.

I gave you the method to print a grid topology on your mesh because that's what you asked. But, unless you have good reason to use this kind of topology, it is actually not very good. You should better use this kind of topology (coming from a previous question of BSE), which use only quads, can easily be bent and modified with new edge loops, etc. In your case, if you want to keep your current mesh, you can first simplify it with some Checker Deselect and Dissolve Vertices, then fill with F and cut some edges with the knife:

Former answer:

What you can do is first fill your shape with a single face (F), create a plane, subdivide it to have a grid, delete its faces only, back to Object mode put it over the leaf object, Shift select the leaf, stay in top view, go in Edit mode, then Mesh > Knife Project. It will print the square grid on the leaf mesh.

Once filled, you could also give your face several knife cuts, it will create less faces.


What are the hotkeys to navigate the timeline? I am looking for a way to move the timeline a specific amount, scroll, etc. even if the Timeline window is not open. Is this possible?

→ 1 frame forward
← 1 frame backward

Shift+→ end frame
Shift+← start frame

↑ next keyframe
↓ previous keyframe

⎈ Ctrl⇧ Shift→ next marker
⎈ Ctrl⇧ Shift←  previous marker

Shift+↑ 10 frames forward
Shift+↓ 10 frames back


blender is painting only in black in texture painting mode I am new. just started learning. I have added material and unwrapped UV. blender is painting only in black in texture painting mode. Please help.

here is the snapshot. I don't know if it was supposed to happen. I am new and most of times blender doesn't work how tutorials describe it's working. It took me whole day to figure it out. :D


can i set the pivot of one object as that of another one? I have a clock and a dial, and i want to set the pivot point of the dial as that of the clock, so i could rotate the dial freely and its center would stay at the same place. how can i do such a thing? right now the pivot point of the dial is a bit off ever so slightly and i want it exactly in the center.

Select the clock object in object mode.  Shift s (snap) -> snap cursor to selection.  Select the dial in object mode.  Shift ctrl alt c (set origin) -> set origin to cursor.  Done.


Render separate "back part" and "front part" so I can place something in between in other program? Imagine a spinning rings like the animation in this page http://en.wikipedia.org/wiki/Gimbal_lock

If I planned to have my 2D character floating at the center and apply some crazy effects with After Effects, since that program is not a 3D program, I must render the scene as a sequence of images to further process it in After Effects.

To place something in-between I think I should have 2 set of images which is in the front and back of specified Z value. My character will be at that Z so when some part of the ring spin over it will occlude the character correctly. Is there any way to separate rendering into 2 parts like this? (Or any better way?)

A common technique in 3D is to render a Z-Depth pass. With this Z depth used as a mask in your favorite compositing app you can place any object at any depth (you threshold the mask to desired value with levels).

The advantage of this is that you have the freedom to change the Z-position of your 2D objects in postproduction. Exporting a Z-Depth pass is also often faster than rendering multiple times.

You can create Z-Depth pass with custom material, mist pass or remapping the Z pass values:

How can I get a Depth of field render pass?

Compositing fog destroys PNG alpha in Images as Planes when using Cycles

Here is how to use such pass in After Effects:

Video Copilot Explosive training (At 35 mins)

He mixes 3D debris and objects with 2D explosions through Z-depth mask.


How to make asset look more "3d" (sail of a sailboat) I am working on creating this scene using Blender

I would like to make the white sail of the sailboat look 3d, as it looks a little flat right now, especially the top part of the sailboat, where there is no light reflected. I'd appreciate any suggestions on how to do that. Currently, I am just using a white base-color principle BSDF with a glossy shader. I was thinking of possibly using cloth simulation, but I am new to Blender and I'm really intimidated by it (although I will use it if that's the best thing to do). Thank you in advance for your insight!

You can use one of these 2 solutions:
The Sculpt solution:

Create your sail, curve it a bit:

In Sculpt mode, select the Mask brush (don't use a Subdivision Surface modifier for the moment if you want the mask to be visible), paint the 3 corners:

Select the Cloth Filter brush, keep the Type > Gravity, paint until you get this kind of result:

The Cloth solution:

Create your sail, select vertices on the 3 corners and make it a vertex group, give the object a Cloth physics with the group as Pin Group, give it a constraint > Copy Scale, here on the X axis and with the edge as Target:

Create an edge under the sail, create a Force Field > Wind with a Strength of, for example, 3000:

Play the animation, the wind will blow on the surface, scale down the edge so that it folds a bit the sail, scroll in the Timeline, when you're good, apply the Cloth modifier:


Apply a modifier as a shapekey into existing shapekey or merge shapekeys? I am making a shapekey of a model shrinkwrapped to another model. The shrinkmap modifier is too inaccurate to wrap to the model alone. So, my first step was to roughly hand position the geometry around of the first model around the second, then use shrinkwrap. The rough positioning was done as a shape key. I can then apply shrinkwrap, but its as a separate shapekey. The two do not work well together. I need them to be the same shapekey. How do I apply a modifier to an existing shapekey, or merge/combine/join the two shapekeys?

In the shape keys dropdown menu there is a function named new shape from mix: set two or more shape keys to the desired value and then choose this function: at 0 you'll have the undeformed mesh, at 1 the combined effect of the different shape keys.


How can I make these inner surfaces smooth? I'm trying to get rid of those lines while still keeping that solid feel to the object. I want the object to be sharp, so smoothing would make it look like plastic.

Any help for removing those lines while still keeping the solid feel?

Thanks.

The only way to get rid of these lines inbetween the cutout is to select the affected faces and set them to smooth shading.
You then can select the edges, press CTRL+E and mark them as sharp.

Add an Edge Split modifier and make sure that the Sharp Edges checkbox is active.

Alternatively you can also select all the faces of the model, set the shading to smooth and then add the Edge Split modifier and control the Split Angle.

This should give you the desired effect.


Object turns dark when using normal map in Cycles I have been using Blender for a while, however up until recently I have only used Blender Render. I started to get interested in Cycles, and somehow it worked fine like Blender Render, up until i noticed a problem when I used a normal map. It took me some time, but i was able to narrow the problem down. Though now i hit a wall and don't know what to do now.

Here is an example:

This scene has no light source other than the background set at white and strength at 1. If i add a light source it doesn't change the problem at all.
The blue cube is just for an example of a normal Diffuse with nothing whatsoever special about it. No normals in none of the images.
The gray objects have an Anisotropic(same problem with glossy material) material on it.
Nodes can be seen here:

Top left are the gray objects with normals, the jacket with the ball behind it.

The other three do have a Normals setting on it. And here comes the problem.

As you can see, if you view it from behind(top right) it looks fine, the details of the Normals appear as they should, everything is dandy.
Bottom left you can see some dark shadows appearing.
And bottom right is completely black.
And the crazy part is, this happens when there is a lightsource as well(i have tried variations with no "background" light source as well)! I could add a lightsource with the strength of 10000 right in front of it, it would still appear pitch black in the bottom right perspective

I've already tried inverting the faces, checking to see if the vertices are correct(thus the ball in the back), with different normal textures etc. same effects happens all the time.

Try including a normal map node between the image texture and the normal input of the anisotropic BDSF.

Also include a texture coordinate node to tell blender how to wrap the texture onto a mesh.


How to create a pop-up menu to get numerical input I want to do it so that when they press a button a window comes up which says 'Subdivision Level' and then an input where whoever's using it can put in a number which changes how much subdivision to add.

Here's the code:

import bpy

class customMenu(bpy.types.Menu):
    bl_label = "Useful Menu"
    bl_idname = "view3D.custom_menu"

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

        layout.operator("bpy.ops.object.subdivision_set(level=1")
        layout.operator("object.duplicate_move")

def register():
    bpy.utils.register_class(customMenu)
    #bpy.ops.wm.call_menu(name=customMenu.bl_idname)

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

if __name__ == "__main__":
    register()

I know how to do everything else I'm just confused about how to make something which allows people to put in inputs/make a slider/make a check box in blender python.

I don't mind if as an answer you just put the code on how to make these input types or if you link a wiki article or something. I'm just having problems finding the right website and I'm pretty sure it can be done.

Here's a link to the blender tutorial that I currently want the input for. So that when I click something on the mini-menu, another mini-menu-thing will open asking how much levels you want and if you want it simple or catmull-clark etc.

I'm sorry if it's obvious but I couldn't find an answer anywhere.

You can create an operator which will show a menu when called , this is the Simple Operator example edited to fit this case :

Run the script to rigster the operator
press Space and type Simple Object Operator

import bpy
from bpy.props import IntProperty

def main(self, context):
    bpy.ops.object.subdivision_set(level=self.level)

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"
    bl_options = {'REGISTER', 'UNDO'}

    level = IntProperty(default = 1, min = 0, max = 10)

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

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

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

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

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

if __name__ == "__main__":
    register()


Changing Specific Cylinder Radius or Diameter in Blender 2.9 I'm just getting started using Blender and have found tutorials on changing the radius or diameter by mouse, but I want my work to be precise so I much rather prefer putting in the actual numbers. Again, I'm looking for a way to change the radius or diameter of a cylinder using the 2.91 version of Blender.

Use the tools parameters that appear at the bottom left of the viewport (or press F9 to have them appear on a floating window).


How can I give a single object multiple colors in cycles? I'm making a sun and I would like it to be a mix of colors - such that every face has a different color, like on a ColorRamp. So, I want the final thing instead of just being a flat orange color to also have some reds and yellows merging in with the orange so it's an array of different colors. How can I do this in Cycles, by using the node editor?

While you can assign a different material to each face on your model, I don't think that will give the result you want. I expect you want to use some noise to get colour variations, one way is to feed the noise into a colour ramp node.

There are other noise textures such as wave, voronoi, musgrave or magic that can give varying results, you may even want to mix a couple together. Just experiment with the scale, distortion and detail values to get a variation that you like.


Slow soft body physics causes the animation player to stop I just started using Blender.

I'm trying to roll a ball running down a long pipe. Just letting the soft body physics run drops down the fps in solid view mode under 1 fps , which causes the animation player to stop.

My guess is that the objects("pipeline") its collapsing with is just to big?! But shouldn't this somehow be an easy job to do?

In your case (base along pipeline) the rigid body system is better suited to do the simulation, since it isn't imperative for the ball to deform.

Nevertheless creating a simpler collision geometry is helpful.

Remove the current softbody and collision settings.
Duplicate the track object. This track_duplicate will be used to create a collision object with less resolution. Remove the wireframe modifier of the track_duplicate and decimate it with a decimate modifier. (I first used the planar option, applied it the used it with the collapse option and applied it again.)
Make the track_duplicate a passive rigid body object and set its shape to mesh.
Make the ball an active rigid body.
Hide the track_duplicate object (it will still be used for collisions) and show the original highres mesh.

You only need softbody object if they're supposed to deform.


How do I rotate an object along it's own axis (windmill) I'm trying to rotate the blades of a windmill for an animation but the windmill is already at an angle. When I keyframe it on it's own axis (after pressing control + alt + space) and rotate it the blades spin inwards during the animation before coming back at the end. I've tried locking the other axis but that keeps the blades from rotating back to the right orientation. Also, whenever I rotate the object 360 degrees it turns the 360 into a really small number (0.0001) so it plays forward hallway then backwards (with a 180 degree keyframe halfway). Any help would be appreciated!.

https://imgur.com/o45LZ75

Actually, as your wheel is not aligned with the global axis anymore, Blender will mess up with the rotation interpolation (Quaternion mode will work better than Euler but it's not perfect either). Also, the animation won’t take your 3D View Pivot Center setting into account, it will use the object's origin.
The easiest way to do it is to keep your wheel aligned with the global axis, parent it to an empty, tilt the empty the way you want, and animate the wheel. The empty parent will somehow be the new world landmark of your object and this time it will work fine.
About the rotation value: you should choose 180°, then, in the Graph Editor, shift E Linear Extrapolation so that it understands that it needs to go indefinitely with a constant speed.


Is it possible to pack a sequence of images into a .blend file? I want to pack an animated texture (a sequence of images) into a .blend file, but for some reason, I can't do that. Is it possible?

You can of course pack many image data blocks,
but you can't pack the frames of an image where the Source is set to Image Sequence.


How to export to dxf file without the geometry having a triangular mesh? I have a simple 3D model made in Blender that I need to export to AutoCAD in dxf format. In Blender I have dissolved faces to simplify the geometry of the mesh.
When I export my model to dxf I get new triangles on the faces. My client asks me to eliminate this triangulation and make the mesh as clear as possible so that it can be edited in AutoCAD.
Is there a way to export my model in Blender without creating those triangles? Is it possible to export my model in Blender to another format that can open AutoCAD avoiding that triangular mesh? Is the methodology I am applying correct or is there a better one?
Please note that I will need to create many 3D models like the one I show in the image and that my client requests that the final file be in dxf or dwg.

Unfortunately the DXF exporter always triangulates faces before exporting. I would suggest using .fbx as format instead, which can be imported by AutoCAD.


what is the node setup for a black luminance key I had to correct parts of an animation.
Which i solved by partial renders.

Those patial images have a large black areas for the black areas i would like to show the original image.

I kinda wonder if i do this correctly, because splitting rgb channels count their value compare it against a real low value.. isnt ideal (in terms of speed), i think blender can do this faster with a proper node group. How should a corect node group look like ?

You can use the Distance Key compositor node (found under the Matte menu). This calculates a "distance" in color space from the specified color - which, in your case, you should set to pure black. You can set the Tolerance to a suitably small values eg, 0.001, and Falloff low for a sharp edge.

Using the Color output from the node will give you an image where the 'background' is converted to Alpha (which you should be able to simply 'Alpha Over' to overlay it over your original render) whereas the Matte output can be used as a Mix factor as you have used in your question.


modifying the default python environment I am looking for a way to alter the default python environment generated by the text editor or the console. I want to add commonly used modules so that I don't have to import them every time.  This doesn't seem to be possible with an add-on, as described here:
https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html
or a startup script, as described here:
https://docs.blender.org/api/current/info_overview.html
but maybe I am doing something wrong.
Background: in Maya, there's a user script which is executed (not imported) at startup. If you import modules in that script, they're available from the root namespace via the text editor and console.
I am looking for similar function, due to the text editor content not being independent of the scene, and getting wiped on each new scene or session.  Relevant commands need to be either retyped, saved as part of the "startup file", or pasted from some external file every single time.  None of these are workable.
Working from an external editor in this context is problematic, as well. When prototyping and learning, I interact directly with the session, incrementally and piecemeal, but in more than single line increments as are available in the console. This would be difficult or impossible to do fluidly with an external editor, at least in the same way as it works in maya.

The console is a "start-up" script.

This doesn't seem to be possible with an add-on or a startup script,
but maybe I am doing something wrong.

Yes indeed, Maybe you are,... hard to tell, have some suggestions, won't go there.
Look at the source code.
Just as with most spaces in the blender UI the code is available. In the case of the python console  the UI in bl_ui/space_console.py and the  nuts and bolts of the python console in scripts/modules/console_python.py
A code snippet from which, where the convenience imports and variables are added.
    namespace["__builtins__"] = sys.modules["builtins"]
    namespace["bpy"] = bpy

    # weak! - but highly convenient
    namespace["C"] = bpy.context
    namespace["D"] = bpy.data

    replace_help(namespace)

    console = InteractiveConsole(locals=namespace,
                                 filename="<blender_console>")

    console.push("from mathutils import *")
    console.push("from math import *")

An option (but a bad slippery-slope don't do it option) is to edit this to suit, however
a lesser evil could be to copy, rename and  put in our user scripts/modules folder.
>>> bpy.utils.script_path_user()
'/home/batfinger/.config/blender/2.91/scripts'

For example sake have called it console_batpython.py
Purpose of the languages selector in the Python Console

and have one or a number of different options available via the menu.  Which does involve  having to select the language (... in this case python with different imports...) at least once per console
Add locals to a console.
Will find a number of run script in console addons, a couple of rippers that come to mind are by @CodemanX and @pinkvertex (the links escape me atm).
The main gist is using the module in conjunction with code as displayed in the script stub template. To run a script from the text editor and have it print to and available to inspect in the console.
Here is a script which when run adds locals to consoles in same screen.
import bpy
import bmesh
import console_python

for area in bpy.context.screen.areas:
    if area.type == 'CONSOLE':
        region = area.regions[-1]
        id = hash(region)
        con, stdout, stderr = console_python.get_console(id)
        # add to locals
        con.locals['bmesh'] = bmesh
        # update with locals from this script
        con.locals.update(locals())
        # push in some locals
        con.push("import itertools")
        con.push("foo = 3")

and in any console on the same screen as the text editor.
>>> itertools
<module 'itertools' (built-in)>

>>> bmesh
<module 'bmesh' (built-in)>

>>> foo
3

Text Editor
The concept of the text editor is to import all requirements as if it were any other module on disk. We can however write an operator based on the Text Editor > Templates > Python > External Script Stub
exec(compile(file.read(), filepath, 'exec'), global_namespace)

and replace file.read() with text_block.as_string() and add other members to global_namespace dictionary.


How to merge images into a single strip I would like to merge a few images into a single strip with the images next to each other.
Using compositor didn't work out as I expected. Thinking a bit more about it, I would prefer not to use compositor.

And use python for this now I am wondering if the python part of blender could join images like that. Blender is not PIL, so I'm not sure if this is possible. The strip can be either horizontal or vertical.

* UPDATE *
  My alternative option, is to break open the pgn or jpg codec, read images as RGB data, and output a final RGB string basedupon multiple images. while possible i wonder if there are easier methods using Blender python API, can blender python do memory based like image manipulation, like addressing pixels directly to set their values ?

You can create an empty texture of size of the resulting image strip and alpha over all of your images over it in compositor and translate them with translate node into positions and render it:

With python:

load in you image textures:

import bpy

def load_image(file_path):
    try:
        return bpy.data.images.load(filepath)
    except:
        raise NameError("Cannot load image %s" % filepath)

image_names = ['first.png', 'second.jpg', 'third.bmp']
images = []
for name in image_names:
    real_path = bpy.abspath('//' + name)
    images.append(load_image(real_path))

Get image dimension:

images[0].size[0]    # resolution x
images[0].size[1]    # resolution y

Create empty image of desired resolution for example 1024x256:

bg = bpy.ops.image.new(name="bg", width=1024, height=256, alpha=False)

How to create nodes in compositor and link them:

Controling compositor by python
Render:

render = bpy.context.scene.render
# set this
render.resolution_x = 1024
render.resolution_y = 256
# render image
render.render()
# use File_Output node or specify render.filepath to also save the result

Getting low level with manipulating image pixels:

# you get float values for each pixel like this:
# in png they are stored nicely in rgba order
image = bpy.data.images['SOME_NAME.PNG']
for i in range(0, len(image.pixels), 4):
    rgba = image.pixels[i:i+4]
    # this is also writable ofc

There are couple things to keep in mind though:

Blender uses opengl internally so the origin is in the lower left corner of the image (with the y-axis pointing upwards).
Some image programs might not save the transparency pixels
The image might have alpha premultiplied, but this shouldn't be a concern. In that case the values are in form of [r * a, g * a, b * a, a]


Texture displacement map in real-time I want to texture the displacement map and see the change in the viewport immediately.

I use the Displace Modifier.

I try Eevee and Cycles, in both cases, Blender doesn't update automatically viewport. I need to click any settings in Modifier Properties or Texture Properties. After that all ok.

Is possible to texture displacement map in real-time?

Not exactly realtime but hitting Tab twice (goes into edit and back) after a stroke of texture painting will update the geometry right away.


Extruding multiple edges simultaneously but separately Coming from C4D, I'm having a very hard time with Blender. I want to use the extrude tool to extrude several edges into not connected new edges. In Cinema 4D this could be achieved by unchecking "preserve groups". How do I do it in Blender?

Here's a short animation of what I mean:

The best I could come up with is:

(i) Extrude and tapping z to constrain to the z-axis.  (The constraint keys combined with Transformation Orientations are well put together in Blender so you should check into those as well.)

(ii) For some reason, using Rip v doesn't work for the entire edge loop so I separated the Vertices a few edges at a time.

(iii)  Scaling by normals separates them without distortion Alt+s so once the scaling was finished I used regular scaling to bring the edges back down.(again, constrained to 'z')


How to start and learning texturing I'm fairly new in blender but I reached this basic level, i can't sculpt the hair so i just model a flat surface and bend it over the head of the models.....

and Haven't yet tried to texture,i just use colored materials. I know for sure I can't .... I can't even draw at all.But, i want to learn and give some color to my models, so where do I start?

Usually how much time does it take to learn texturing?

Purpose of the Model

Before you start with creating materials you should know the differences between the different purposes of a model. There are three main categories - still renders, animations and RT game engine models/assets.

Still Renders

If you are aiming for rendering a single scene, that one particular scene frozen in time, you definitely want to use procedural material setups. And you definitely want to go crazy with them, because you want to achieve the best possible effect. This concerns not only realistic materials, all the materials of a scene should also match in style.

Since your PC "only" needs to render one image, complicated material setups that put heavy load on CPU/GPU aren't much of a deal, it's the result that matters.

Animation Rendering

If you plan to render animations for movies, you still might want to use procedural materials, but keep in mind that your PC needs to render a ton of images for every minute you have in the end in your movie clip.

The more complex your material setup, the more time it takes to render all the images you'll need for a short movie clip and in the end you might not even see all the details due to moving  characters and cameras.

Real Time Game Engine Models and Assets

Most game engines today still use texture maps for materials, because even the fastest hardware isn't capable of creating a real-time animated game world with procedurally generated materials.

You can still use procedural materials during the creation process of your model but you'll need to bake them to texture maps, before exporting and importing the model into a game engine.

Rendering Engines

Blender offers two render engines "out of the box". The modern one is called Cycles, offers node-based material setups and also an "unbiased" modern approach to lights and shadows. Blender internal render engine takes a
"biased" approach on rendering, which means that it simply ignores the more complicated functions regarding lights and shadows.

While both render engines can produce still images and animations, I highly recommend using Cycles for that purpose. Blender Internal on the other side has the advantage to give a decent preview of game assets.

You can read more about the differences and the technical background in Gandalf's answer

How to proceed

(All the points below come from personal experience. Yours or that of other people might be different. )

The non-Blender related answer is that you will need a lot of patience and determination to achieve good results.

Start small, with basic models, shapes and materials.
Get the materials to look the way you want them to look.
Do not aim for the moon at your fist shot, because landing between the stars early on can be very frustrating.

The Blender-related answer is the above, plus

the recommendation to look for tutorials all over the internet.
Watch Blender related videos on youtube and vimeo and also keep in mind that you want to watch those which are related to your goal (first point - purpose of the model).
There are some "big names" in the Blender community, like Andrew Price and Gleb Alexandrow. But you also find lots of bits and pieces of information from other people, sometimes just by watching them speedmodeling.