text:
How to serialize and deserialize material
Apparently there is quenform who does not want my solution so I give the solution by asking a question...
However it is a question which was until now without an answer...
I can serialize and deserialize any Blender material configuration in JSON. It is possible for me to save my materials in a FreeCAD file and restore all these materials in Blender from this FreeCAD file.
Serialize:
    # browse all materiels in the Blender scene
    for bmat in bpy.data.materials:
        if not bmat.use_nodes:
            continue
            msg = f"Blender material: {bmat.name}, don't use node, skipped...\n"
            warnings.append(msg)
            App.Console.PrintMessage(msg)
            continue
        if bmat.name in materials and materials[bmat.name].Material.get(root):
            msg = f"FreeCAD material: {bmat.name}, already has a Blender configuration, skipped...\n"
            warnings.append(msg)
            App.Console.PrintMessage(msg)
            continue

        matdata = {}
        for node in bmat.node_tree.nodes:
            links = {}
            inputs = {}
            outputs = {}
            sockets = {}

            if node.inputs:
                link, input = _getInputData(warnings, bmat, node)
                links.update(link)
                inputs.update(input)

            if node.outputs:
                output = _getOutputs(warnings, bmat, node)
                outputs.update(output)

            sockets = _getSocketProperties(warnings, node, bmat.name, node.name, [])

            matdata[node.name] = {'Type':     node.__class__.__name__,
                                  'Sockets':  sockets,
                                  'Link':     links,
                                  'Inputs':   inputs,
                                  'Outputs':  outputs}

        if matdata:
            if bmat.name in materials:
                mat = materials[bmat.name]
            else:
                mat = makeMaterial(bmat.name)
                materials[bmat.name] = mat
            temp = mat.Material.copy()
            temp[root] = json.dumps(tuple(matdata.keys()))
            for node, data in matdata.items():
                temp[root + '.' + node] = json.dumps(data)
            mat.Material = temp

def _getInputData(warnings, bmat, node):
    links = {}
    inputs = {}
    for input in node.inputs:
        for link in input.links:
            links[input.name] = (link.from_node.name, link.from_socket.name)
        if input.type == 'VALUE':
            v = input.default_value
            value = v
        elif input.type == 'VECTOR':
            v = input.default_value
            value = (v[0], v[1], v[2])
        elif input.type == 'RGBA':
            v = input.default_value
            value = (v[0], v[1], v[2], v[3])
        elif input.type == 'SHADER':
            continue
        else:
            msg = f"FreeCAD material {bmat.name} on node {node.name} can't read input: {input.name} type {input.type} is not supported, skipping...\n"
            warnings.append(msg)
            App.Console.PrintMessage(msg)
            continue
        App.Console.PrintMessage(f"Material Name: {bmat.name} Node: {node.name} Input: {input.name} - Value: {value}\n")
        inputs[input.name] = value
    return links, inputs

def _getOutputs(warnings, bmat, node):
    outputs = {}
    for output in node.outputs:
        if output.type == 'VALUE':
            v = output.default_value
            value = v
        elif output.type == 'VECTOR':
            v = output.default_value
            value = (v[0], v[1], v[2])
        elif output.type == 'RGBA':
            v = output.default_value
            value = (v[0], v[1], v[2], v[3])
        elif output.type == 'SHADER':
            continue
        else:
            msg = f"FreeCAD material {bmat.name} on node {node.name} can't read output: {output.name} type {output.type} is not supported, skipping...\n"
            warnings.append(msg)
            App.Console.PrintMessage(msg)
            continue
        App.Console.PrintMessage(f"Material Name: {bmat.name} Node: {node.name} output: {output.name} - Value: {value}\n")
        outputs[output.name] = value
    return outputs

def _getSocketProperties(warnings, obj, mat, node, properties):
    data = {}
    skipping = ('rna_type', 'inputs', 'outputs', 'dimensions', 'type',
                'is_hidden', 'from_node', 'from_socket', 'to_node', 'to_socket')
    for p in dir(obj):
        if p not in skipping and not (p.startswith('_') or p.startswith('bl_')):
            v = getattr(obj, p)
            if v is None or isinstance(v, bpy.types.bpy_func):
                continue
            elif isinstance(v, (str, int, float, bool)):
                value = v
            elif isinstance(v, mathutils.Color):
                value = {'r': v.r, 'g': v.g, 'b': v.b}
            elif isinstance(v, mathutils.Euler):
                value = {'x': v.x, 'y': v.y, 'z': v.z, 'order': v.order}
            elif isinstance(v, mathutils.Vector):
                if len(v) == 2:
                    value = {'x': v.x, 'y': v.y}
                elif len(v) == 3:
                    value = {'x': v.x, 'y': v.y, 'z': v.z}
                elif len(v) == 4:
                    value = {'x': v.x, 'y': v.y, 'z': v.z, 'w': v.w}
            elif isinstance(v, bpy.types.bpy_prop_array):
                value = []
                for d in v:
                    value.append(d)
            elif isinstance(v, bpy.types.bpy_prop_collection):
                value = {}
                properties.append(p)
                for k, d in v.items():
                    value[k] = _getSocketProperties(warnings, d, mat, node, properties)
            elif isinstance(v, bpy.types.TexMapping):
                properties.append(p)
                value = _getSocketProperties(warnings, v, mat, node, properties)
            elif isinstance(v, bpy.types.ColorRamp):
                properties.append(p)
                value = _getSocketProperties(warnings, v, mat, node, properties)
            elif isinstance(v, bpy.types.ColorMapping):
                properties.append(p)
                value = _getSocketProperties(warnings, v, mat, node, properties)
            else:
                msg = f"FreeCAD material {mat} on node {node} can't read property: {p} type {type(v)} is not supported, skipping...\n"
                warnings.append(msg)
                App.Console.PrintMessage(msg)
                continue
            data[p] = value
            properties.append(p)
            App.Console.PrintMessage(f"Node socket: {node} property: {'.'.join(properties)} value: {str(value)}\n")
    return data

Deserialize:
def _setMaterialNodes(bmat, mat, root):
    links = {}
    sockets = {}
    inputs = {}
    outputs = {}
    data = mat.Material.get(root)
    print("_setMaterialNodes() 1 data: %s" % data)
    if data:
        nodes = json.loads(data)
        for name in nodes:
            link, socket, input, output = _createNode(bmat, mat, root, name)
            links.update(link)
            sockets.update(socket)
            inputs.update(input)
            outputs.update(output)
        for node, link in links.items():
            bnode = bmat.node_tree.nodes[node]
            _setLinks(bmat, bnode, link)
        for node, socket in sockets.items():
            bnode = bmat.node_tree.nodes[node]
            _setSockets(bnode, socket)
        for node, input in inputs.items():
            bnode = bmat.node_tree.nodes[node]
            _setInputs(bnode, input)
        for node, output in outputs.items():
            bnode = bmat.node_tree.nodes[node]
            _setOutputs(bnode, output)

def _createNode(bmat, mat, root, name):
    links = {}
    sockets = {}
    inputs = {}
    outputs = {}
    data = mat.Material.get(root + '.' + name)
    if data:
        node = json.loads(data)
        print(f"Create Node socket {name} of type {node['Type']}")
        bnode = bmat.node_tree.nodes.new(type=node['Type'])
        bnode.name = name
        links[bnode.name] = node['Link']
        sockets[bnode.name] = node['Sockets']
        inputs[bnode.name] = node['Inputs']
        outputs[bnode.name] = node['Outputs']
    return links, sockets, inputs, outputs

def _setLinks(bmat, bnode, links):
    for input, outputs in links.items():
        _setLink(bmat, bnode, input, *outputs)

def _setLink(bmat, bnode, input, node2, output):
    bmat.node_tree.links.new(bmat.node_tree.nodes[node2].outputs[output],
                             bnode.inputs[input])

def _setSockets(obj, sockets):
    for property, value in sockets.items():
        if isinstance(value, dict):
            if property.isnumeric():
                _setSockets(obj[int(property)], value)
            else:
                _setSockets(getattr(obj, property), value)
        else:
            setattr(obj, property, value)

def _setInputs(bnode, inputs):
    for input, value in inputs.items():
        binput = bnode.inputs.get(input)
        if binput:
            binput.default_value = value
        else:
            print("_setInputs() ERROR *********************************************")

def _setOutputs(bnode, outputs):
    for output, value in outputs.items():
        boutput = bnode.outputs.get(output)
        if boutput:
            boutput.default_value = value
        else:
            print("_setOutputs() ERROR *********************************************")

Hi, thanks for the post. While answering your own question is possible and even encouraged, it should be done respecting the site structure. Could you break this up into two posts, rephrasing the problem to read like an actual question or expose a problem, while the solution is written as separate answer in the proper section below? Maybe add a short description of the steps accompanied by a few images illustrating the workflow and final results. See How do I write a good answer?

I think that those looking for a solution to this problem will be satisfied with this answer, which is certainly poorly formulated but which has the merit of being the only one.

I'm not questioning the quality of the answer which seems fine to me, just asking that you edit it to respect the site structure and post it in the actual answer section below.

If you give the same answer six times to different questions, then this is obviously a duplicate. Perhaps it would be possible if you didn't write all the answers in the same way, but were more specific about the questions asked. Thank you for your understanding!

By the way, I think your answer is best placed here: How do I deserialize materials? or here: Any way of serializing Blender cycles materials data?

I took the trouble to try to give answers to everyone who asks the question of how to serialize and deserialize Blender material. You have deleted all these answers. If you have a better answer give it there

@quellenform If I gave the same answer six times it was:
1 - six questions asking how to serialize and deserialize blender material, exactly the same question.
2 - there is only one answer that answers these six questions and it is the same answer, I do not have six solutions to propose.
3 - I'm not here to write prose... In any case, given how long it took you to delete everything, I don't think you took the time to read what my solution was. It seems simpler to say duplicate. I wonder what you're for

As a moderator, it is my job to filter duplicates, among other things, and I am not here to debate btw. Your posts were reported several times by the system, as duplicates are not permitted according to the site rules. They have therefore been removed. If the questions are so similar that one and the same answer is the solution, then the questions are duplicates and should be closed as such, and it would be helpful of you to report them as such instead of posting content multiple times. Please read the rules of this Q&A platform carefully before posting here. Thank you for your understanding.

However, everything is half as bad as it looks: Simply write your answer to the question to which your answer best fits and which best solves the problem. Mark all other similar questions to which your answer could fit as duplicates or refer to your post from there in the comments. This will help keep the site tidy and help others find your solution to the problem.

Well then do your job, because it's really six duplicate questions that I tried to answer, I'm not here to manage the organization of your site but just to provide technical solutions when I can...

Thank you for your feedback! Just for a better understanding: We moderators work here on a voluntary, unpaid and honorary basis. This is neither "my organization" nor "my site". In order for things to run smoothly here, we are dependent on committed people who help us to steer all the content in the right direction and provide added value for others. Every unnecessary discussion and nagging creates work that is not necessary.


text:
How do I disable type-to-search in add menus in Blender 4.0?
In previous versions of Blender, Add menus had hotkeys so you could quickly add an object with two keypresses, like so: https://blenderdaily.xyz/tips/underlined-letters
In Blender 4.0 this has been updated to be more user friendly, so typing instead starts searching by name for objects to add.  I find this quite annoying.
How do I restore the old behavior?

This is not possible, at least in 4.0. You can read discussion about that here: https://projects.blender.org/blender/blender/pulls/110855

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Looking to have a property equal 0 unless another variable is on
So I've got a small project I'm working on, and I'm wondering if there's an expression I can use to get this result. I want this property to stay 0 unless two other properties are both 1, in which case this property can be either 0 or 1. But I'm not familiar with Python so I don't know how I'd write that.

You might be better off with a driver for something this simple. But without knowing more details it's impossible to help. What "property" are you needing? Scene? Object? Mesh? Custom property? Modifier property?..... the list goes on and on :)

Add the variables to your driver, name them, and then check if they are equal to $1$ by using the equality operator: ==
The way you describe combining both comparisons is the and (mathematically $∧$):

Result:

You can use get, set and update callbacks.
import bpy

def set_value_c(self, value):
    self["value_c"] = value if self.value_a and self.value_b else False

def get_value_c(self):
    return self["value_c"]

def update_value_c(self, context):
    if self.value_c:
        if not self.value_a or not self.value_b:
            self.value_c = False

class MyPG(bpy.types.PropertyGroup):
    value_a: bpy.props.BoolProperty(update=update_value_c)
    value_b: bpy.props.BoolProperty(update=update_value_c)
    value_c: bpy.props.BoolProperty(set=set_value_c, get=get_value_c)

class HelloWorldPanel(bpy.types.Panel):
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        self.layout.prop(context.active_object.my_pg, "value_a")
        self.layout.prop(context.active_object.my_pg, "value_b")
        self.layout.prop(context.active_object.my_pg, "value_c")

def register():
    bpy.utils.register_class(MyPG)
    bpy.types.Object.my_pg = bpy.props.PointerProperty(type=MyPG)
    bpy.utils.register_class(HelloWorldPanel)

if __name__ == "__main__":
    register()

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Where to put the Object info node..?
Hi I'm trying to restrict the geo shape to "Black" logo. I followed a youtube tutorial for the geo node but I want to change the cube shape into "Black" logo. Where should I put the object info node???

Probably the easiest way to do it is to launch a ray cast from  front and back of the logo, so that we can hit the object's volume. Here is the example with 3D noise texture, just for clarity:

The direction of the ray cast is important, you have to run it from "front" side.


text:
Randomize Transform overrides the original location&rotation
I'm trying to make a cube that is already shattered. The shattered pieces will rotate as they move forward fast. At the end, the pieces will locate themselves to the original cube shape like it was never shattered.
To make this, I used the cell fracture to break up the cube and added a keyframe. I moved the keyframe to the end, and used randomize transform to make the location & rotation random.
The problem is here: I made a keyframe using randomize transform at the first frame, and I tried to used the randomize transform on the 20th frame to make a more dynamic animation, while keeping the original location at the end of the frame. but as soon as I add a key frame on the 20th frame using randomize transform, the original location at the end of the frame gets affected and gets disrupted, allowing the original location to be altered. I must keep the original location & rotation at the last frame but I think the randomize transform overrides the existing keyframe. What should I do at this point?


text:
How can I remove darkness from behind objects?
I am getting problem like below image. First trees row getting darkness of behind second trees row. you can understand clearly using below image.
I am using z-transparency to hide my plan background.
How can remove darkness of behind row from front row trees.? any one can help me.?

** Edited **

This is working for me. It give output like above image.

Your image alpha channel must be used for the mix factor between the transparent area and the color information (diffuse). So, just connect the Alpha output of the image node to the factor input of your Mix Shader node. This makes it so that only the parts of the image that are transparent are actually appear as transparent.
Just a proposal. Unfortunately we don't know you node tree for your tree planes.

Please add more detail to your answer, or it might get flagged/deleted.

Sorry, but I have saved my post to early and have seen the info about the post length later.

hey @ChristophWerner i have try your node connection but not working for me.

May I see your tree image in blender please? Maybe it has no alpha? actually it should work like described. What do you see as result after using my proposal?

There is a slight problem with your node setup.

First, flip the inputs to the mix shader.
Next, plug the color from the texture into the diffuse shader.
Finally, change the color of the transparent shader to pure white.

This may be caused by a translucent shader.
What that shader does, is when light is coming from behind an object, the object gets lit. This could cause that effect, because the other trees are blocking the light coming from the back.
Perhaps you accidentally used a translucent shader instead of a transparent shader?
Please share node setup if you would like a clear answer, as it is hard to answer with this information.
Also check out Andrew's shader encyclopedia for info on those shaders, and more. http://www.blenderguru.com/articles/cycles-shader-encyclopedia/

No man i used transparent shader, see above node connection image.I share it.

Hmmm. I'm not sure. If you upload the .blend file it might help, but maybe not. Are you using Internal or Cycles? Where is your light? Are you just using world lighting?

I am working with cycles and i am using world light.

I'm not sure what's wrong with yours... I honestly don't know why anything is showing up at all with your node setup. The transparent should be going into the top of the mix, and the diffuse into the bottom. If you change them that may fix it. There is just something weird going on. I have a feeling it has to do with the alpha mask for your trees being only partial, and partly off. I duplicated your scene (with mix flipped) and it works fine for me. If you want more help, you really need to upload the blend file.

Oh wait!!! I know what's wrong. I'll add another answer with the correct result.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
HOw to attach cloth to rigged character same like ncloth of maya.?
I have problem with attaching cloths to my rigged character. I can simply attach cloth to rigged character by using automatic weight painting. but it is not working perfectly that i want.
In Maya we can create and attach n-cloth with using some constraints and weight transfers but how can i do same working dress in blender. any one can help me on this topic.
I know this will work in blender after some tricks, but i don`t know that.
Maya ncloth tutorial link is here.

Do ctrl+P It could help If not i dont know but i do want that bounty >:)

Related: http://blender.stackexchange.com/q/14242/599

can you make a video tutorial like above link. then bounty yours. because i cant do it my self. @gandalf3

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
weird uv unwrapping for a cylinder-ish object wall
New to Blender, I'm following a tutorial, and supposedly I'm doing the exact steps, but the walls turn into this weird shape after UV unwrapping. Any ideas?

Hello, maybe choose the front orthogonal view and unwrap with the Cylinder Projection mode?

It seems that the vertical seam doesn't reach the top and bottom circular seams. Comparing the number of edge loops in the UV map with the ones on the 3D model, I think the model has some overlapping geometry, try to run Mesh > Merge > By Distance in Edit Mode with everything selected.


text:
How can I fix the rotation on the legs?
fellow blender artists!
What you see here is work in progress, for an ad I'm working on, with CGI involved. I'm posting this as I will need some help and feedback from you guys.

Also, for more information about the project you can see this post.
Alright so let's get to it. These legs have to be animated so that they're fully functioning, and for that reason I have set up bones with IK constraints, and to some extent it currently works, however, with some issues involved.

So here you can see the bones, every bone starting from the centre of the coffee pod, who I'll call Jimmy for my own amusement.
The first bones of every leg (The ones inside Jimmy) are out of the IK chain, while the IK controllers are the last, small bones facing downwards.
Problem 1 - Clipping
Alright, so in this image you can see how the joint (actually attached joined with the first part of the leg) and the first part of the leg clip into one another.

This seems to be, or at least from my understanding, a child problem of
Problem 2 - Bone Rotation
In the way I have engineered these legs, each one of the parts basically would have to rotate up and down, with a very minimal movement to the sides, maybe only from the top part.
(I am still unsure which option would be best here, or even if to re-engineer the first part so that it can rotate sideways)
However, what happens in reality is that the bones rotate sideways as well, over the Z-axis, from what my understanding is.
So what I have tried to do is to restrict that movement by using the "Lock IK" option, "Stiffness" and the "Limit Rotation Constraint" from the Bone Constraints tab, and limiting the different axis's to 0, or basically trying different combinations, but I can't seem to work it out.

This problem leaves us with two sub issues, one I've already shared with you, Clipping, and the other:

We get movements like these, when trying to animate a walk cycle, for example.
Another thing that has been helpful to some extent, is the Pole Target option, as I have noticed that it can add some additional stiffness to my bone rotation. The problem here is, that this is not a human elbow, or knee. Hence, sometimes I'll need the middle part to rotate upwards, and sometimes downwards.

Also, I am not sure about this, but does blender disregard the limit rotation constraints when there is a pole target active? There seems to be something happening there.
Anyways, I think this is what is preventing me from moving forwards at the moment, I hope you guys can help me out here and give me some feedback!
I'm open to ideas non-related to these issues as well, so feel free to shoot.
Thanks in advance!

P.S. Jimmy is thankful as well.

If you're just looking for a walking mechanical spider creature with animation, see this detailed Polyfjord tutorial which should give you some ideas.

@JohnEason I have watched some of his stuff, he indeed has amazing tutorials! However, that isn't going to be helpful in my case. Thanks anyways.

since we have no idea how you did it, we can only advise you to watch some beginner rigging tutorials. Or...you provide your blend file so we can tell you exactly what you did wrong. thx. Generally speaking it's a pretty basic rig you have there. All you have to do is lock the right axes and do the right settings in the rig.

You want IK locks and only them-- can't tell you why they didn't work for you in your first attempt, not without file.  Yes, pole Ts override on the first bone; so don't use pole Ts, or don't move targets to a place that will give you a wrong solution.  Don't combine other constraints, like "limit rotation" with IK control, it probably won't work like you expect.  If you need a bone to bend through the straight, you will need to do that manually and to time it carefully.  Also: recommend aiming for one question per post.

@Chris Hey there! Here's the blend file! I'll be more than thankful if you can take a look :) https://we.tl/t-Chpe7YEyvD

@Nathan I see, thank you for your comment! Here's the blend file :) https://we.tl/t-Chpe7YEyvD

When we put the armature of one leg into rest position and look at its axes, we see that its axes are not aligned with the desired rotation of the bone.  This is easiest to see when using an octohedral display with axes enabled (which I recommend using while rigging.  Other views obscure information that the rigger needs; think of them as being views that the animator wants, not the rigger.)

We want to use IK axis locks, but there is no single bone axis that corresponds to the axis in which we want to allow rotation.
Unfortunately, the meshes are bone parented rather than bone (relative) parented, so we have to unparent them if we want to change the bone's rest axes. So, first, unparent the mesh objects with keep transform, then reparent to the bone with bone(relative).  I'll do this with a single mesh object.
To get the right axis, I'll adopt the view of a mesh face (with a face in mesh edit mode selected, ctrl shift numpad 7 for me), then use a recalculate roll operation:

Now I can set appropriate IK axis locks for the bone. The bone should be allowed to rotate in its (new) Z axis but in no other, so we'll lock X and Y axes, then set the armature back to posed position to check:

I've only done one bone, but we can see that it's no longer rotating wonky to solve the IK.

Thank you for your help! I will try and follow up with these steps and see if I am able to work it out. I can’t express enough how happy I am that you exist. Will keep you in touch! As long as that is alright:)

your answer was indeed correct, I did not realise that the local axes of the bones were all messed up, since I had it all in stick mode. Now I just need to figure out how to stop the bones from glitching, as they don't know in which direction to bend, and a pole target messes things up. Thank you once more!

I would expect the answer to be, don't use a pole target.  They are optional and they don't do what most beginners expect-- they won't rotate your bone through the straight line (except in very special circumstances, circumstances which should be avoided anyways.)  To rotate your bone through the straight line to the other angle, pose some rotation, which gets evaluated prior to the IK in order to determine the way that the IK bends the bone.

Will try and see if I can make it happen, right now it's just jumping from one rotation to the other. Thank you so much!

Yes, you have to do it very carefully.  For a 2-chain, there's no way to do this without discontinuity except at the time that the bone is extended perfectly straight.  For a 3-chain, there are more times when you can do it without discontinuity, but it's going to depend on the other bones and the IK target.

I have been trying for a while now, it just jumps from position to position and I can't seem to make it happen. I also tried to duplicate the 2nd bone, put it underneath the original, unparented it, and set a copy rotation to the original with target duplicate, didn't work. This might have been obvious for you, but I was hoping for it hahah. At this point I'm not sure what I should do.

Considering that it's a different question, you should ask in a different post, and provide a file showing what you've done so far (including keyframes to demonstrate the discontinuity.)  That's what I'd recommend.

@RobinBetts I have accepted Nathan’s answer, but can’t upvote it, sadly, as k don’t have enough reputation.

@imdcookie oops! sorry, didn't see that .. comment deleted :)


text:
How to create an inset on a cube using the Blender API
I'm attempting to inset the top face of a cube using the Blender API using the code below. If anyone could help me understand why I am not seeing any inset within edit mode after running my script that would be much appreciated. The cube is successfully created, but no inset is visible.
Thanks in advance :)
bpy.ops.mesh.primitive_cube_add(size=1)

cube = bpy.context.object

bpy.context.view_layer.objects.active = cube

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

bpy.ops.mesh.select_mode(type='FACE')

bpy.ops.mesh.select_all(action='DESELECT')

cube.data.polygons[4].select = True

bpy.ops.mesh.inset(thickness=0.2)

cube.data.update()

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

Operators in bpy.ops are for interactive use through the UI and should be avoided in scripts because they depend on context. Using them through scripts may yield unexpected results at best, or fail entirely at worst. Manipulate data directly from bpy.data instead.

try this:

create a cube, select it, then run the code.
In Edit mode you see the result of the picture.
Beware: this insets all faces, i hope you can adapt the code that it only insets one face, if not, let me know.
import bpy
import bmesh

me = bpy.context.object.data
bm = bmesh.new()
bm.from_mesh(me)
faces = bm.faces[:]

insetFaces=bmesh.ops.inset_individual(bm, faces=faces,thickness=.10, depth=.0)

bm.to_mesh(me)
bm.free()


text:
Anisotropic effect doesn't work (blender 4.0)
I faced with the problem that anisotropic effect doesn't applies neither using eevee renderer, nor cycles. Could you help me? File is attached

It works fine but you need to be in Rendered preview mode and in Cycles. The Material preview uses Eevee and Anisotropic doesn't work in Eevee (as indicated here):

Anisotropy only works with cycles (as indicated here). You need to be in render mode in order to use cycles. In the image you sent, you are in preview mode, so you'll have to switch modes

The default world scene is dark and unlit, so you wont see anything. Lighten your scene so you can see the effect


text:
Problem with Shade Smooth
I have a trunk in Blender. I applied 'Shade Smooth' to it, and it looks good. Now, I've divided the trunk in the middle, resulting in two objects. Both have 'Shade Smooth' applied, but now there's an edge created at the intersection due to 'Shade Smooth.' How do I get rid of this? How can I achieve a smooth transition with 'Shade Smooth'?

Trunk with 'Shade Flat' But looks not gut in Game

You haven't said how you divided the trunk. It would be helpful if you could share your Blend file with just the trunk in it so that we can see what you've done.  You can share it via https://blend-exchange.com/ following the instructions there to copy the link on that page and then edit your question here and paste the link into it.

Are you sure the cut parts do not contain non manifold edges? Go in Edit mode and inspect the meshes.

One part has a darker orange outline and the other has a brighter outline... so there are two separate objects. Is there overlapping geometry? It looks like it because the brighter outline extends to where the darker outline is. This can cause shading issues as well, but most likely a file upload would be best to check what is going on there.

If you haven’t tried Shade Auto Smooth give that a go. Then if your exporting for game check your face normals. If any of them are red. In edit mode highlight them, go to UV tab, normals and then flip them so they are blue.
Try to merge any unneeded vertices as well and any faces that are overlapping that don’t need to be turn into single faces. Hope any of that helps


text:
Joining meshes - how to deal with remapping of the textures?
I have a model (from external source). It has a large number of meshes, which I don't need and would just clump the whole thing.
So I'd like to reduce the number by joining some of the meshes, specifically ones that will be immovable and share a texture file. But when I do it just with Ctrl-J, it messes up the texture  - I guess it messes up the UV map, hence the texture mapping.
To be clear, I want to join ONLY meshes that already share a texture file, and have a UV map on that file.
Is there some reasonable way to do this automagically? To do it manually would not be much different than leaving the multiplicity of meshes alone.

It doesn't mess with the UV map, you probably have materials based on object or generated coordinate system, and that's the problem. How to upload a blend file on BSE - good practices and advice

Can't use BSE due to copyright, but I figured it out, I just needed to rename UV maps on the meshes to the same name.

For future questions: you can (and should, regardless of copyrights!) minimize your problem by stripping it away of stuff that is copyrightable.

When joining the meshes which refer to the same image picture, to keep the texture correct the meshes UV maps must have the same name.


text:
How to develop a VSE file format importer for DNG + CR2 image files?
This question isn't about the usual workflow (batch convert to a readable format).
Instead I'm looking for a solution to import DNG + CR2 RAW files directly into blender (without decoding/converting the files again).
Reason: Saving Time and Resources.
Why: Because we all have better things to do besides batching conversions :)
Update: @Sambler : How do you compile blender? With make or make full? Somehow mine can't display the dng-raw. I always get a blank/transparent preview with in a thumbnail resolution (256x). Please read further down below the last comments for more details. Many thanks in advance.

@ all developer - how to start developing this feature?

DNG SDK + Infos link

RAW Format discussion

Related: http://blender.stackexchange.com/q/57139/2843

@Samoth; thanks ... I had to start a new question because it somehow was missleading. This isn't about getting the "video job" done. I was more hoping for a developer back-and-forth discussion... so, no offend - just curiosity

@cegaton - thanks for mentioning the tools. So, I'm not looking for a work-around. I want to make this happen in blender. But it feels like stackexchange is the wrong place for this...

First off blender seems to read CR2 files without issue, at least with the few samples I downloaded. It could read more data, that is blender loads one of the samples I have in the natural resolution, while the OpenImageIO file viewer automatically rotates it to match the rotation of the camera. Blender's file browser will filter out CR2 files by default but if you disable the filter and select a CR2 file it will read it. Adding CR2 to the list of available file formats is all that is needed here. Once loaded blender says the CR2 file has a TIFF file_format. This would be a minor change that should be accepted as a bug report, test with a variety of files to make sure first.
For DNG, blender only sees the thumbnail - or the thumbnail is found first and mistakenly read as the image data. (if you have one without a thumbnail try it).
From what I have read, DNG is a variation of TIFF/EP so I see two options, first is to adjust blender's TIFF reading code, the other is to use OpenImageIO to read DNG files. The image viewer built as part of OpenImageIO can read the sample DNG files that I have found, so this may be a viable option for adding support. For reference using OpenImageIO to read PSD files was added here, it is possible that this code added for PSD may only need minor changes to also work with DNG.
I'm not sure this will be considered an acceptable bug report as it is adding support for a new file format. You may want to add DNG image support to the requests page or you could talk to some of the developers at #blendercoders on IRC to see if someone is interested in adding this image support, unless you want to submit a patch for it yourself.
Update:
A quick test with just adding to the file suffix list shows that telling blender to use OpenImageIO to open DNG and CR2 files works. Simply adding the file suffixes to the code used for PSD files allows DNG and CR2 files to be opened. As mentioned at the start this brings in CR2 files rotated based on image metadata the same as opening the images using iv. Images opened this way report their file_format as JPEG so further work to distinguish DNG and CR2 files from PSD and JPEG will be needed but should be minimal.

thank you - great answer! I already tried the CR2 with success. Now I'm dealing with the DNG Thumbnail. I'll try your suggested work around. Keep you updated.

Update: During building I encountered some issues: (http://blender.stackexchange.com/questions/57249/building-blender-results-in-errror-opencolorio-1-0-9-failed-to-compile-exiting)

When I load a DNG Sequence blender suddenly shuts down. Could you try the footage if it's working on your blender version? Which version do you have? Thanks

I don't have any trouble with your sequence. This is your first build? are you sure it works with other sequences? I built using the git master from a few days ago (4/7) and have oiio 1.6.15 which was released 6 days ago. Try running blender in gdb and do a backtrace when it stops, this might give a clue as to where it fails.

thanks for the note. yeah, I'm first build virgin :) Currently I'm having issues related to libtiff4/5.
Do you know how to force selecting a version?
Package libtiff-dev is a virtual package provided by:
libtiff4-dev 3.9.6-11
libtiff5-dev 4.0.3-12.3+deb8u1
You should explicitly select one to install.
E: Package 'libtiff-dev' has no installation candidate
ERROR! apt-get failed to install requested packages, exiting.
libtiff5-dev 4.0.3-12.3+deb8u1 is installed already, beside libtiff4. libtiff4-dev is not installed.
Any suggestion how to move on?

@ Sambler; I've tried now original footage from the blackmagic 4k camera (CinemaDNG RAW); but the dng shows "blank". I suppose it does show the empty thumbnail like you referred above. Can you suggest any DNG Stripper which might be handy on this, without converting dng's? Thanks.

https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/cinemadng/pdfs/CinemaDNG_Format_Specification_v1_1.pdf
5.4 Including Additional Images In The Same DNG Data Set
The DNG dataset may include additional images, such as rendered previews, thumbnails, or reduced resolution
versions, all of which can be used as proxies when editing. A compliant CinemaDNG decoder should ignore these
images.
5.5 Including Additional Tags For Optional TIFF/EP Compliance
The DNG dataset may include additional tags for compliance with TIFF/EP. Compliance with TIFF/EP is not
required....

Update: After "converting" them from CinemaDNG to DNG with Adobe DNG  Converter the thumbnails can be seen within blender. Even tho I disabled "JPG Preview" within the settings. ... any clue to get the real dng in blender without converting them?
Download DNG for Testing (Not Converted; orignal from Camera): http://wikisend.com/download/968202/AS-BMPC-01_1_2016-07-14_0342_C0017_000004.dng

The patch I linked to in the update allows blender to open dng files using OpenImageIO, more work needs to be done so that they are properly identified and can be saved as dng, but by adding the file suffixes I am able to open the dng files that I have found so far. To test without a modified blender, try opening the files with iv which is the image viewer app that is part of the oiio source, if iv opens it ok then using oiio in blender will get the same result. iconvert or oiiotool might be able to remove the thumbnails.

thanks sambler; i'll try the tools ...
you say; you are able to open the dng - have you tried this with the one I uploaded to wikisend? Do you see the actual RAWImage of the DNG?

after fizzling a bit around with oiiotool I've found the following section: Page 253 https://raw.githubusercontent.com/OpenImageIO/oiio/master/src/doc/openimageio.pdf -> But this is used via python bindings + tga's; any work around to get rid of thumbnails dng without to convert them? I'm a o not able to open the DNG in notepad - can you tell why?

Yes I have opened the dng sequence you added earlier and the dng file you added today using my patched version of blender. The new one shows as 4032x2192 and is of a tree/bush with power lines in the background.

So, after doing everything again - just to be sure - DNG won't display. Tho, the Filter changes did work; but I can't see the image.
Steps: 1. get blender source, 2. apply sambler patch, 3. compile, 4. make, 5. start blender (vse) + load test dng = result http://wikisend.com/download/585108/dng.jpg
Have you changed anything else? Or do I need any additional package/addon? Do you see what I'm missing out here ...? thx sambler

Update: Did you compile blender via "make" or "make full"?

I can't test "make full" because of a resulting error/conflict with some packages(have to dig deeper to tell you the exact output...)


text:
Cull Particle Simulation when not visible to the camera
Since effects like particle Systems take a lot of memory, particularly in a big scene, can the memory use be conserved by deactivating simulations and particle systems when not within visible range of the Camera?
Not very different from viewport culling where cameras ignores drawing polygons that are behind or occluded by other objects.
The Camera would be moving, so this process have to be automated.

I think this video is the best answer to your question Vertex Weight Proximity
By adding arrayed plane to your camera as a child you can point which part of particles (or anything that is using vertex groups) are to show up.


text:
Make changes to the Radius of the default Circle?
How can I create a circle with a certain diameter/radius?
I know there's a way, but I don't know how to.

Here are the steps you can follow.

Hit ShiftA on the keyboard.
Select Circle.
Hit T to activate the Tool panel.
Under the "Add Circle" Header, key in the radius of the circle you need.

Note Take care not to move the circle before you change it's radius the option would be unavailable if you moved the circle before hitting T

The operator properties are also available in a floating panel by pressing F6

The easiest way to create a circle with a designated radius is to add the circle mesh primitive. In the characteristics panel for the primitive, it allows you to specify the radius.


text:
Missing import option for 3ds format in the GUI?
I would like to import a .3ds model into Blender.
I looked at this video, and this thread, both are very old and don't seem to apply to the version of Blender I am currently using (2.76).
I have tried the FILE > IMPORT command, which gave me this menu:

It seems weird that previous versions of Blender (as I suppose was the case because of the links above) would support 3ds and that the import function went away in later versions.
But I'm still new to this, so I might just be looking in the wrong menu.

First you need to activate the 3DS import addon.
To do that:

Go to the user perferences window via the keyboard shortcut CtrlAltU, or the File Menu --> User Preferences.
Go to the addons tab
Choose the Import-Export addons from the left vertical category list.
Find the "Import-Export: Autodesk 3DS format" row, then press on the checkbox on the right.
If you want this to be available every time you open blender, Click on the "Save User Preferences" below.

Or visually:

After you do this, you'll have the 3DS format available in the File --> Import menu.

This is the step you can take to turn on the import feature for .3ds format

Go to user preferences.
Go to the Add-on tab.
Click on the import-export category.
Look for Autodesk 3DS Format.
Click on the checkbox to activate it.

You should now be able to import 3ds format.


text:
How to Have Selected Faces Emit Smoke
I'm working on a very large scale project and I want to try to make an object with Smoke Inflow but only from certain faces. How would I select or define those certain faces in Edit Mode?

Anand mbs is correct about selecting faces, but to use those selected faces in a Smoke Simulation, you need to do some more stuff.
Selecting The Faces
At the bottom of the 3D Viewport and while in Edit Mode, you can click a button that looks the following to switch into Face Select mode.

However, also while in Edit Mode, you can key Ctrl + Tab to open a pop-up menu like the following. You can then either click the bottom option (Face) or key 3 to have Blender automatically select the third option down.

Separating Faces
We're not quite done yet. RMB select the first face and then Shift + RMB select the rest that you want smoke to emit from. Key Shift + D to duplicate the faces. Key P to bring up the SeParation pop-up menu. It looks like the following. Key 1 or click on Selection to separate the faces from the original mesh.

Smoke Simulation
Tab back into Object Mode. Select the mesh that is made up of the separated faces. This will be your Inflow object. It is also probably wise to Parent the faces mesh to the original. Parenting will guarantee that the faces mesh follows the original during transforms. Select the faces mesh, then the original, then key Ctrl + P and either 2 or select Object (Keep Transform) from the resulting pop-up menu.

you can change the selection mode from the above option. 1) vertices, 2) edge, 3) face.
Refer https://www.blender.org/manual/modeling/meshes/selecting/faces.html
also refer this link

Your question doesn't provide enough information. If you want to set up those faces so you can select them easier, you can assign them to their own vertex group and then select that to get to them.

Your answer talks about selecting faces, but not how to incorporate them in a Smoke Simulation.

@ShadyPuck , at first I am sure that the smoke simulation was not mentioned. The question is edited

@anandmbs You can check the editing history and see that it indeed was.


text:
Getting "experimental" true displacement to work
I have been trying to achieve a true mesh displacement on meshes for quite some time, without ever getting it to work.
If I understand it correctly, this experimental feature would allow me to easily displace the vertices of a mesh - or to create new mesh vertexes where needed - to get a displaced mesh in the result, based off an image, but without using a bump map (simpler, faster?).
This all sounds very exciting in theory, but I am having a really hard time finding examples or tutorials that are both recent and whose links function. So I think there is the need for a question here which will call upon detailed and recent answers to bridge that gap.
I'll start with a simple ico sphere:

Then, following Aldrik's answer here, I will change the Feature Set to the Experimental one:

I then add a pink granite image to the mesh:

Mark Seams, Unwrap, add image in the UV Editor:

and finally, in the Object Data panel, change the Displacement method from Bump to True as explained in Aldrik's answer:

no result yet:

if I click "Use Subdivision" this is what I get (so I won't click it right now):

Looking into the Node Editor, nothing seems to have changed with the Displacement of the mesh:

so I tried to replicate the node setup seen in the first image of this similar question (Linear isn't an option, Clip, Single and Repeat are):

... but the result is a white ICO Sphere, similar to Image 1.
So, can the "Experimental Feature Set" be used to create actual displacement, and modify a mesh?
This is what I'm trying to obtain - but with the image of the texture actually displaying on the mesh (image from here):

.blend file:

I don't recommend true displacement in blender yet. Here is why: http://blender.stackexchange.com/a/45874/7777

Thanks Jerryno for highlighting the limits of this technique. In my case it is perfect for what I'm trying to do, and I think it is very quick compared to creating bump maps with crazy bump, etc. If you have a quick and easy way of getting the same results that is supported and not experimental, feel free to post it in a comment.

Time for update ... True Displacement (called also micro-displacement) ... you make it work in Blender in three steps ...
1. Render Engine
... is still available for Cycles render engine and still under Experimental Feature Set ... Dicing Rate specify details in pixels.

2. Modifier
Add Subdivision Surface modifier and enable Adaptive Subdivision this feature is available (appears) only for modifier stacked as last (if there is more modifiers).

3. Material
Under Material Properties > Settings > Surface switch from Bump to Displacement ...

... and under Shader Editor > Add > Vector > Displacement node ... for input socket use your height map or procedural texture ... output socket plug into Material Output > Displacement socket.

Thank you for following up with this!


text:
Object doesn't render in Cycles
I'm trying to design a car and I added a flat cylinder on the hood for the hood ornament.

Material display

Rendered display
Here's what I get when I render the hood:

The hood ornament isn't showing.
I made sure that the object wasn't ticked off in the Outliner Panel:

And also made sure that "None" wasn't selected in the "Object" tab of the Properties panel as suggested here.

You might also want to check your render layers.

I added a blend file with fewer elements to make it lighter, and renamed the object that won't render "won't render"

Very curious indeed ! I have no idea, however some test reviewed that the object has no problem rendering in Blender internal. I have also tried importing and exporting. I will try fbx format next.... Yah it worked.

You enabled duplication (Frames) just click None and your object will be rendered.

AH! missed that one.


text:
Can this low-light animation in Cycles be rendered sharply and in HD, and how?
I am directing a series of animations in Blender in which the camera floats around dimly-lit rooms to reveal its contents.
The scenes are usually lit only by a couple of elements in the room, usually neon lights or emission objects, and usually contain transparency or reflection objects which are necessary to the scene.
Here is one example scene:

This image is the scene rendered as a single image, without too much noise 1000 samples at 50% of the default 1920 x 1080 resolution:

This render took 50 minutes.
Since the animation is 180 frames long, rendering it with these settings would take:
180 * 50 minutes = 6.25 days
This is obviously too long, especially since ideally I would like to make animations longer than 180 frames, add more reflection or transparency objects, and even render at 100% someday.
(The result is 2 days on my other computer, which is still a little too long for me).
Lower amount of samples (i.e. 300) are faster but obviously produce grainier results.
I've read many questions about this problem, both on Stack and elsewhere, and watched several tutorials, but most of them mostly recommend adding light sources to the scene, or disabling transparency/reflections or other modifications which I think would denature the scene.
I tried changing the Exposure, the emission strength, and other settings but it never really kept the scene's mood right.
I even considered just switching to another render engine, but feel that I need advice about that.
My question is: is it possible to render this scene in HD, and with as little grain as possible?
Please post examples of the results you get and how you achieved them.

If in all scenes only moving object is the camera, then you may consider baking the textures at desired quality.

I would strongly recommend that you render the scene with just enough lighting so that most object are well illuminated. Then using post production methods or compositor make those scene dark like the image you posted. Sometimes dark scenes, sometimes can cause slow rendering speed. I also agree with markac above that you could bake some of the material since the final scene is so dark... . honestly if I were you I would use blender render for such a dark looking scene.

If you have two computers, why not render it out on the faster one in two days like you said and use your other one while it's busy?

To be honest, this scene is relatively light-weight already.
A single frame at 1000 samples at 50% resolution takes almost exactly 20 minutes on my CPU (a quad core intel xeon, though the clock rate is only 2.5 GHz). Naturally using a GPU (or both CPU and GPU at once) would help dramatically.
Rendering simply takes time. Even the giant renderfarms at ILM or pixar spend as much as four hours or more[better citation needed] rendering a single frame in some scenes.
If you want to render the scene exactly as it is in a short time frame, you might consider sending it off to a renderfarm such as SheepIt, a free distributed blender-specific renderfarm where blenderusers from all over the world donate and exchange their processing time.
Optimizations
For reference:
Default setup (100 samples, 40% resolution, frame 20):  1:19

As far as things you can do without changing the result go, this scene is already pretty optimized.
You can shave off a few seconds by reducing the bounces. (an optimization of a few seconds at preview resolution and samples can turn into minutes at full quality)
Reduced bounces: 0:59

Keep in mind that tile size can also have a sizable impact on rendertime, but the nature of this impact heavily depends on the scene and your hardware.

Scene changing optimizations
By using an arealamp to do the main illumination and dimming the letters, allowing the less-noisy area lamp do all the work, a lot of the noise is less noticeable. Adding a glare node helps cover the noise directly behind the letters somewhat:

Yes, the rendertime increased (thanks to the glare node), but now the result appears slightly less noisy.
Taking this to the extreme you could even make the letters visible only to the camera:

Now it's nearly at a point where you might be able to get away with 100 samples for the final render (you might still want to use 200-300 or so).

Other options

As mentioned above, use a renderfarm. Here's a list of renderfarms which support or even specialize in blender/cycles.

Render it overnight or in the background over the course a few weeks (perhaps using only a single core while using the computer for other things)

Bake the lighting for diffuse materials (only valid if no light sources are animated)

Full resolution at 55sec on a nvidia GTX970 GPU render on my end. 100 samples

@hawkenfox What tile-size?

Also it is extremely important to animate the noise seed for the samples. This will make the noise pattern different every frame so it will be less visible and behave more like a natural film grain. Just go to Render -> Sampling and press the little clock next to the Seed value.


text:
Rendering Geometry Nodes animation using a renderfarm service
I'm new to animating in Blender. I made three simple animations using Geometry Nodes in Blender 3.1.0 Alpha. All three are grids of rectangles, animating procedurally. There are also some procedural materials which I've rigged up in the Shader Editor.
I want to render them out in a higher quality, as I limited the initial output quality in order to get them rendered out in time. I was hoping to do this by using a render farm, but I saw that services such as Rebus Farm and DropAndRender don't support my version of Blender.
Is it possible to render out an animation made in Blender 3.1.0 Alpha Geometry Nodes using a render farm this way? And if not, how would I best go about preparing the animations such that I can use a render farm? Any help is much appreciated, since I'm not sure how most of this works.

A bit late to answer, but it may benefit someone else who has the same question.
Geometry nodes might create issues if the project is created with a Blender version and rendered with an older version on the farm. So I advise using the same (or a newer) Blender version for the final render. If this is not possible, render some test frames first with the Blender version available on the farm, to make sure everything renders correctly with that setup.
If you still need a farm for your project, we have full support for Blender 3.1 at RenderStreet, including Geometry nodes.

I reckon you can always export your scene into alembic, though it will not conserve the materials, you will have to transfer them back.
That being said, 3.1 has been released now, so render farm services should probably have this version available soon if it isn't the case already.
Also, that is part of why you shouldn't use unreleased versions of softwares for your projects, they literally have no support.

It's not always possible to avoid using unreleased versions; especially if they have bug fixes for bugs that are stopping your project.  It's also a somewhat risky but useful way to get a head start on a project.  Unreleased versions have varying degrees of support.  They're made available so that users can test them and developers do fix bugs in alpha and beta releases  as a way of getting to a final release.

Thanks for your feedback. You raise a good point by stating that it's unwise in cases like these to work in the latest (unreleased/unsupported) versions of software. Unfortunately I need the renders by coming Tuesday, which will be probably be too short before any renderfarms will be compatible with 3.1.
About transferring back materials: What do you mean by this? My materials are dependant on instances of the GN-modifier, so I don't know if it will be possible to get the same result.

Probably not, but maybe.  Render farms typically support a range of Blender versions and have instructions for how to set up your render.  It usually takes them a while to add a new release of Blender, so what you want to do won't work until two things are true, but should work once they are:

You install official 3.1, which was just released, on your machine and make sure that the official version will handle your file.  There are usually changes between alpha and final, but often they don't affect files.

The render farm installs official 3.1 and makes it available.

Alright, I will have to look into how to make my file compatible with the versions the renderfarms can run, if at all. Good lesson here to not work in the unreleased/unsupported versions of software. Thanks for your feedback!

Don't take away "never work with unreleased" because there are times when you can get away with it.  Take away "working with pre-released versions entails certain risks; don't use them if you can't afford to take those risks".

We Fox Renderfarm support Blender 3.1.0 Alpha Geometry Nodes.

We support Blender 3.1.0 at GarageFarm.NET already (official stable release) since the release day.
We had available Alpha, and Beta builds some time already on our end. Of course, we cannot support all daily releases, but we can always add support for specific daily build upon request. Just let us know, and we will help you :)
Geometry nodes should evaluate correctly when rendering on multiple render nodes, as far as we know. However, it is still a relatively new feature, under constant development, so we recommend rendering a test first. You can render a few frames from your animation evenly spread over the rendering range via the step parameter (for example, render 1to250, to render every 20th frame, set range this way 1to250s20).
You can test your project with the free trial credits that we offer.


text:
Blender 2.83.0 suddenly begins crashing on startup with call to libc.8.so
Blender version 2.83.0 has been running nicely on my system for several
months.  Suddenly a couple of days ago, it started crashing on startup just after a call to libc.so.6. I suspected an out of memory problem since all other versions of blender (various 2.7x versions) also quit working at the same time, and so I closed everything else running on my system. This action did not fix the problem for any version of Blender, so I suspected memory fragmentation, since my system stays up for a long time without being rebooted. After I rebooted all other versions of blender worked, only 2.83.0 kept failing. I haven't found a solution to this problem online other than the usual install new graphics drivers, etc. which don't seem to address my problem since the program had been running just fine.  I've looked for munged configuration or cache files but have not found any likely candidates. Moving the config files aside as one poster suggests did not fix the problem.  Any help would be appreciated.
System is an HP Pavilion A6109n;
graphics: VGA compatible controller:
Advanced Micro Devices, Inc. [AMD/ATI] RV710 [Radeon HD 4350/4550];
OS is Fedora 31.
Blender is being run from the command line without any options
crash log:
# Blender 2.83.0, Commit date: 1970-01-01 00:00, Hash unknown

# backtrace
blender(BLI_system_backtrace+0x37) [0x55d78fa6ea27]
blender(+0xcff2ba) [0x55d78d7042ba]
/lib64/libc.so.6(+0x3c6b0) [0x7f74bb93a6b0]
blender(GPU_draw_list_command_add+0x5f) [0x55d78f94891f]
blender(+0x10bcb2d) [0x55d78dac1b2d]
blender(+0x10be0b7) [0x55d78dac30b7]
blender(+0x10e8264) [0x55d78daed264]
blender(+0x10b5b3e) [0x55d78dabab3e]
blender(DRW_draw_render_loop_ex+0x2f0) [0x55d78dabae60]
blender(view3d_main_region_draw+0x93) [0x55d78e14af63]
blender(ED_region_do_draw+0x851) [0x55d78dd22221]
blender(wm_draw_update+0x4ba) [0x55d78d9d4c3a]
blender(WM_main+0x30) [0x55d78d9d2b90]
blender(main+0x321) [0x55d78d6d6821]
/lib64/libc.so.6(__libc_start_main+0xf3) [0x7f74bb9251a3]
blender(_start+0x2e) [0x55d78d7006ae]
```

Never mind. Version 2.83.1 works on my system.

This problem has been resolved by verion 2.83.1


text:
Rigging is not working properly on this character - how to fix it?
I am trying to rig this character I made, but several different courses of action are all ending up with their own problems. I have rigged characters a few times before (not many, but it's not completely unknown territory) but doing it the way I remember is not working out.
For context, this is my character and the list of objects. It's a little witch composed of a hat, hair, body, eyes, a pair of earrings, boots (with star accessories on the side) and a dress split in sleeves, top (with decoration star), skirt, and a waist hem.

I have been using Rigify on this character, considering the body is a template I have made before for another character and it worked completely fine.
The options I tried and how they went wrong:

Joining all parts without removing intersecting geometry. Probably self-explanatory why it went wrong.
Joining a few parts (with boolean - union), then selecting the resulting objects and rigging. First I joined hair with hat, full dress, and the remaining except the boots, but only the body-attached parts were successful (dress, hair and boots weren't acting as part of an armature). Then I did hair with hat, dress minus sleeves, body including not only head parts but also the limbs accessories, and the same issue happened. Then I put all together except hat and hair, but moving the arms would affect the skirt as well. Putting all together caused several different problems (sometimes only the chin would move as a head, sometimes I got a bone error that I forgot to register, sometimes the skirt would fold weirdly when moving legs).

I didn't try to keep all as separate objects because it didn't work with my other character and my memory is struggling a bit to run Blender, but if it's a possible solution I can try.
Another thing that may be a hint of an issue is that when rigging went through, the Rigify parts meant to be joints wouldn't move, only the red parts.
Edit: I decided to attempt the separate parts approach, it worked better than everything I had done so far - but the hair still acts disjointed and some parts are being set to parents to objects that shouldn't be affected. I'm now trying again to join a few parts into unique objects to see what happens, but it wouldn't solve the hair problem (which I suspect to be a weight issue, considering the geometry is a lot more present there? I never worked much on weight painting for rigging so I'm not sure).

The first thing I see in your screenshot is that one side of the character's face is darker than the other side with a harsh seam in the center. This looks a lot like flipped normals which almost always is problematic.

@GordonBrinkmann At first I also considered that, but I double checked the normals, the seam was from some bad mirroring results and the dark side is probably from angle and stuff. I got caught in the rigging issues and ended up forgetting to smooth it after applying mirror.

The thing is, it doesn't look like different shading due to slightly different angles, it looks like flipped faces. Maybe duplicate faces there? Some correct, some flipped? Now that you're reminded to smooth them, does it change and look better? And what do you mean by saying, "only the red parts" move? Do you talk of weight painting? Because you don't show anything red in your question. If you talk of weights, of course only red parts move, because red means the bones influence them. Did you simply join mesh parts in one object or did you correctly parent mesh parts to bones?

Your new last sentence might be a hint: "I never worked much on weight painting for rigging so I'm no[t] sure". But to deform rigged objects with bones, correct weight painting is essential and you cannot always depend on automatic weights. All in all your problem seems be rooted in weight painting (among other things maybe), but this screenshot doesn't give any information on how the parts are weighted and so the question is unanswerable apart from some wild guesses. Maybe you should upload the file, follow the instructions here to edit it in your question: https://blend-exchange.com

@GordonBrinkmann I still have to test the smoothing. I'll check the normals again as well. As for the red parts, I mean the Rigify posing limb outlines, I could only move parts like feet and hands. I had been doing Rigify rigs parented with automatic weights, which does seem like a lot of issues considering last time I manually did the work of weight painting and parenting it didn't give me as many problems. I might keep working on this issue later though as I just noticed it's a bit late. Thanks for the help so far!

As @GordonBrinkmann says, please share your blend file via https://blend-exchange.com/ following the instructions there so that we can look at your file directly.


text:
Why does blender shutdown while trying to delete vertices?
So I'm trying to print the head of the Leviathan axe from God of War 4. The model I received is a highly detailed model with stock, handle, and wrappings. I'm trying to delete everything but the axe head, but no matter how low of vertices, even just one, while I select ... Blender closes when I try to delete it. What is wrong and how do I fix this?

Are there any error that jump out at you when it shutdown or it's just goes blank? It could be your system being short in memory or your graphic card ran out of vram as the model is highly detailed? If it's highly detail can you describe how many polygon and vertices your model has? If deleting vertices is an issue have you tried selecting faces and delete the faces first? It's also useful to note that selection made in small batch will help slower system to cope with ram issue.

It just closes, no error screen. No matter what I pick to delete it closes, even if it's just one. I understand it that it's mostly likely because of how detailed it is. Is there anyway to lower it to where I can work with it without problems?

Edit mode > select a vertex on the axe head you want > hit L > hit P and separate the mesh to a different object. If not setup a google drive file so I could see what's happening there... it could be file corruption as well.


text:
Checker Patterns appearing on the Render

File link-https://www.blendswap.com/blends/view/5387
For some reason my render have these black and white checks. Please help me to remove them.  Thanks

There is no material assignd to those areas. You are seeing the default "Alpha" pattern. Meaning those areas are currently transparent.

It seems to be caused by the "use mist" in each material. I don't know why it works like that but disabling the "use mist" makes the objects solid.

Also that file isn't exactly great with scene and model work. You'd probably be better off creating your own sets. Forget about Blender Internal as the next big release won't even have it. Go with Cycles.

It appears that you are rendering with transparent background. Essentially the opposite of this question :)
To change this in your scene, (Blender Internal) go to the properties panel and change Shading alpha to sky rather than transparent.

Objects are transparent too. Which shouldn't be related to the skybox.


text:
How to Import a finished 3D model with texture into a new blender file?
So I've made a 2x2 wooden floor, using normal maps, reflection maps... just so when I would need that wooden floor to use in an interior scene, I could just import it without having to spend another hour on the node editor to get all the numbers just right.
So I made a plane, UV unwrapped it, went to the node editor, and imported all the different maps (normal, displacement, gloss, refl...). Now I have the finished product but I want to import it in a different blender file. Is there a way to do this?
Thanks in advance.

For most things, there are multiple ways to complete them in Blender, and importing a material is one of them. The procedure outlined by Zac Perry in his answer above certainly works, but if you are wanting to append just a material, an alternate method is to do steps 1 through 4 as Zac outlines them in his answer, but in step 5, instead of going to the object folder, and appending the object, you can go to the material folder, and append the material.
In the same manner, if you wanted just to append a texture from one file to another, and assign it in the new file to a different material, you can do that by navigating to the texture folder, and appending it from there.
Both of these (and for that matter, appending an object as suggested by Zac) become orders of magntitude easier if one takes the time to give meaningful names to objects, materials, and textures, and for that matter, to meshes, too.

These are the steps.

Save your completed blender file,
Create a new blender Scene, goto File > New.
Goto File > Append.
Navigate to the blend file containing the completed model
Browse and goto object folder, and import the objects you want.

Note:
You will need to know the name of the object you are importing, as there is no visual aid in identifying the model except for its name.

just a minor, but important point: what you describe in your step two is not merely a new Blender "scene", but a new Blender file. In fact, one file can contain multiple scenes, and you need not have a new file to have a new scene, but the steps you describe do create a new scene, but only because you've also.created a new file.


text:
Contradiction in GPL Licensing FAQ
The Blender FAQ page (https://www.blender.org/support/faq/) answers these two questions:

Can my organization use Blender internally without giving up our valuable changes to our competitors?
  Yes. The GNU GPL does allow your organization to use a modified version of Blender internally without offering the source-code as long as you do not distribute it outside your company or organization.
Can I change Blender and give it to my co-workers or employees?
  Yes, but if you make modifications you must comply with the GPL and if they request the source code you have to distribute that to them as well. You can charge for the version of blender you give to your friends even, but it must be licensed under the GPL, and you may not charge an unreasonable fee for the source code.

Don't these two answers contradict them selves?
Example:
Our developers modify Blender and hand it to our production team to do some work for the company.
Individuals from our production team then may then ask for source code and are allowed to distribute it (under GPL)??
That would definitely be in contradiction with the claim that we can "use a modified version of Blender internally without offering the source-code as long as you do not distribute it outside your company".
Or am I getting this wrong?
(I apologize if this question does not belong here, but I could not find other place to post it.)

I'm voting to close this question as off-topic because it is not about Blender, but about interpretting the consequences of GPL.

OK, I'm beginning grasp the idea behind these statements. The way to handle this would be to prevent the modified version of leaving the company. Employees may get the source code upon request but should not be allowed to take any of it out of the company as it contains proprietary information (e.g. algorithms, know-how = "valuable changes"). Such things are usually regulated by company rules/contracts/NDAs.

@zeffi - Actually, this is a question about Blender FAQ which interpret GPL. If you know where else I could post it so the Blender FAQ would be corrected/ammended/explained, please do let me know.

This site is about providing support for the use of Blender as a tool, but you are looking to understand how the GPL works --that FAQ should not be considered legally binding advice (nor are the answers you may receive here). Consult perhaps Software Feedome - Compliance Guide and a copyright lawyer specializing in OpenSource / GPL.   --- it's not that we don't want to help you but this question is way beyond the scope of BSE.

This question might be on-topic at the Law SE or the Open source SE sites.

Can my organization use Blender internally without giving up our valuable changes to our competitors?

The question starts with Can..? and indeed it's possible. All your coworkers and people who come in contact would have to willingly not distribute it any further and to your competitors.
If anyone decides that he wants the source code and he wants to either build upon it or further distribute it (even to your competition), he has all the rights to do it, because the software is licenced GPL.

Yes GPL works that way. If the users requests for the code they must be made available by the license. It's the GPL license that gave blender the developmental edge. Of cos companies may look at it in a "20th century" business model point of view and think that it would be a bad idea to give out your source code.
Then again, if you are truly creative that fear should not exist. I think blender is the pinnacle of how opensource software can change the way people work in a very radical way ... "made by artist, for the artist" indeed.

OK, but then the answer to the first FAQ question should be modified because it is not complete.
Allowing employess to distribute source code outside the company is exactly "giving up our valuable changes to our competitors".

I don't think Blender has any developmental edge as it has only a handful of developers compared to commercial projects.

If you have used commercial software and paid for it's full price, you will soon realised how phenomenal blender is. 3dsmax for the past 10 year hasn't changed much... it's interface is old and it's so slow to install and load. 3dsmax still crash on exit, it does the same thing 5 years ago and still does it today. Sure they have added tools which doesn't improve workflow, I really think the difference on blender is that it's opensource ... anyone who is willing to put in time an help out with coding can do so.

I use commercial and also I use Blender. I wouldn't call Blender "phenomenal". It has it's own strengths but also not so few weaknesses. I understand that for a hobbyist it is great tool, but for a professional to whom time=money are commercial solutions like maya, houdini, zbrush and others well worth the price. You can surely make the same quality art with Blender, but it requires much more effort and usually workarounds.

Strangely I find blender more effective as a professional tool. Anyway each to his own. Some of my client prefers my blender work over my 3dsmax.


text:
How do I freeze (apply) an animation?
I am creating a model for 3d printing, and what I want is the result of an animation sequence.
I have done this previously with the cloth modifier. in that case you can just apply the modify, and it freezes the model in whatever frame it was at at that moment.
What I am doing now is a rigid body animation - a bunch of things falling I a pile basically. There does not seem to be an apply button here. I can see an "Animated Transforms to delta" option in Object - Apply, but that just gives an error that there is no animation data.
I want to do some further editing, so just exporting what I have to STL file is not going to work.

You can go to the desired frame, select all involved objects, press K and choose "Insert Visual Loc Rot Keyframe", then delete the rigid body functions.
If an object "jumps" out of place, just move the timeline cursor, in order to relaod the animation data stored.
Then you can remove all animation data from the dopesheet.


text:
Follow curve, but keep vertical alignment
I am wanting to model a railing on a footbridge that follows a complex curve; first going to the right, but then descending as it curves, and then descending but straight.
I can get the base object to follow the curve, but when it starts to do down, the verticals of the unit go normal to the curve, rather than staying vertical.
The tilt tool allows them to be adjusted around the axis of the curve, but not around an axis normal to the curve.
I did find this, but the first solution does not work for me; it is described as abusing a bug in Blender four years ago so I guess has been fixed? The second solution will only work for a helix.
I also am aware of "dupliverts" but I want the base object to appear all along the curve, not just as the vertices (I also cannot get them to work for me, but that is another issue).
Just for background, this is the bridge I am trying to model - it is to 3d print.
https://www.networkrailmediacentre.co.uk/news/innovative-first-of-its-kind-railway-footbridge-replaces-one-of-the-uks-most-dangerous-level-crossings

see Gorgious' answer here: https://blender.stackexchange.com/questions/165628/lamp-posts-correctly-oriented-instances-on-a-3d-curve/165691#165691 or use geometry nodes

Thanks, that was enough to get me going in the right direction.


text:
Vertices are underneath the mesh after adding a solidify modifier, how to fix it?
I am doing my donut tutorial. After duplicating my mesh and adding a solidify modifier, vertices appeared under the mesh in edit mode and I am not sure how to fix it, please help

Hello, I'm not sure what you mean, could you please share your file? https://blend-exchange.com/

Enter "donut icing" (without the quotes) into the search field at the top of this page and you will get a long list of questions and answers about the same problem.


text:
How to change the size of points in the geometry nodes?
I am new to blender. Currently, I am trying to make a donut and I am stuck with making the sprinkles. My points in geometry nodes are too big, how do I change the size of them?

you can use the "set point radius" node for that:

In complement to Chris answer, you'll need to use this radius, when instancing, if you want to change instance size(s):

I was following the same tutorial and had the same problem. It turns out I needed to scale the geometry nodes to fit the donut. I hope this helps anyone who comes across this problem again.
Select both the donut and the geometry node, hit Ctrl + A, select Apply > Scale option.


text:
How to create new vertices to connect edges?
I've just started to make my first donut in Blender and accidentally deleted my vertices. Now I cannot connect my edges and there is a whole in a mesh.

Pleae share your file via https://blend-exchange.com/ following the instructions there to copy the link on that page and then edit your question here and paste the link into it. Then I can show you how to reconnect it without having to create a new model myself.

In your case, just create a Loop Cut (CMD + R [macOS], CTRL+R [win]) on the surfaces on which you accidently deleted your vertices and merge them (in your case probably only one, according to your screenshot) afterwards by pressing M.

I think he'd still have to merge verts after doing that.

y, thx, i edited my answer

Thank you so much for your help!!!


text:
Black shadowy mesh in Edit Mode
I am in Edit Mode trying to visualize the bottom part of my model.
But the bottom meshes are black and so are the parts on the other side.

I looked at this question and this question but I don't think they are related to my problem.
I'm in Edit Mode with Material shading turned on (to be able to see the reference images imported as planes), and would like to see the faces and vertices on the sides that are currently dark.

My first guess is that this is a face-normals issue; if this is the case, the first answer in the first question you looked at should resolve it. Select the whole mesh, and under the shading tab in the tool shelf (on the left) try recalculate normals.

You've set viewport shading to material  (the drop down right to edit mode) it seems that there is no light in this direction either add another light source or change to a different mode.

Recalculating normals didn't change the black parts of the mesh, but stacker's answer was the right one: in material view, the shadows appear closer to final render and adding a light solved it. @stacker please make your comment an answer to be upvoted and accepted.

You've set the viewport shading to material (the drop down right to edit mode) it seems that there is no light in this direction either add another light source or change to a different mode.


text:
Why are my leaves white when I render, but have the right color in Material view?
I am trying to make leaves fall to the floor.
The leaves are transparent PNGs imported as images as planes, in which I modified the color of the non-transparent pixels (they were grey to begin with and I wanted to add some color) using this node setup:

The material view seems to interpret what I am trying to do:

but the render shows white leaves:

Not sure I understand why that's happening...

It's because in your node setup, you connected Diffuse shader output with Emission shader color input. This is wrong. You can't connect two shaders like that. If you want to control color value of Emission shader with other node, use RGB node for example.


text:
Why is the Displace modifier moving my mesh instead of moving the geometry?
When I am using the Displace modifier, my whole mesh moves up or down on the Z axis, but the mesh isn't actually displaced.

I am trying to use an image to displace the geometry of the mesh. But the geometry is staying flat. What am I not seeing?
Blend:

I cannot find how to pack the image on file :(

Go to your textures tab, select the drop down called "Image Texture" and select under Modifiers "Displace"

In the new tab select the button called "Open" under image and select your desired image.

There, should be fine now.

Thanks. I tried but it doesn't displace the mesh

@fabriced Done.

Please show the textures you are using in a Blender Screen Image.  The file have posted does not have images.  They are not packed into the Blender file.  Do you have the textures on your hard disk?  Did someone send you a file?

Thanks the photos really helped! Although the method isn't really precise, is it? Or do I have to give the mesh a larger number of subdivisions? But won't that slow down everything?

@atomicbezierslinger Did you mean to post this as a comment to the question?

@fabriced You do have to use a lot of sub divs if you want it to be precise, but generally this is used for making things seem more naturally bumpy. You could use bump maps that are a lovely thing or just project the image on to the plane.

Make sure your textures are visible.
Make sure you use a high density mesh.
UV Map both planes if you are planning to use them. Use UV Map.
When I used my own textures and UV Mapped I saw displacement. For the single flat plane I created a high density mesh with Control R and I saw some displacement. You have two planes in your file.


text:
Is it possible to make an optically functional camera lens in cycles?
I am interested and intrigued at the idea of designing a camera lens (or camera lenses) in Blender, that would function optically like "normal" camera lenses and project an image on a plane.
By "optically functional camera lens", I mean something like this, where the image of the scene comes into the lens and out the other end onto a plane (image courtesy of this site):

This is not a tutorial request, I am just asking before I get into this time-consuming project if someone knows whether or not this would technically work or if it wouldn't, because of the current limitations of Blender's caustics simulator (and yes, I understand that the rendering could take a very long time...). I am not extremely knowledgeable about optics and cannot tell if the two are related.
Oddly (or maybe just because people aren't masochists), I can't find much on the subject, besides from this old post with broken links.

Yes the two are related - caustics and the image of the tree on the film. They are the same. So because of this limitation Cycles can't do that

Related - http://blender.stackexchange.com/questions/9091/can-blender-be-used-for-simple-optical-modeling

I already tried things like this, but on a much smaller scale. If you want to be sure that your project works, you should try Luxrender because it is based on a physical simulation.

Thanks! I'd love to see some of your tests to decide is it's worth it to get into this


text:
How to understand the scale of blender lighting values?
Is there a standard comparison for light power / values in Blender Cycles?
What I mean is that under a certain value lights tend to have a weak effect, but over a certain threshold the interplay of lights can be volatile and compete.
Its not for my lack of knowledge in lighting that I usually struggle with light power in Blender, but simply I lack a comparison to it's real-world representation?

Example:
Maybe by necessity I might crank up a light over 100 (and yet, embarrassingly enough the light-object itself is already quite huge) and in doing so other lights are competed with.
Maybe it's real world comparison would cook anyone in the room due to the shear heat...

Perception problem...
Its this lack of relative value in blender, as it reflects reality that I often stumble on lighting. This is where I need help.
Maybe I have a mental defect and this problem is unique to me. But if not, the question is:
How am I to understand the scale of blender lighting values as it compares to real-world use?

are you talking about the light objects, or just a mesh with a emission material?

Generally mesh with emission material - I use this because I assume its more "real world" but I'm sure the issue exists in both areas.

It seems light intensity in Cycles is controlled by irradiance measured in Lux. according to this answer http://blender.stackexchange.com/questions/45209/what-kind-of-units-does-the-cycles-emission-strength-use see if this helps

That is a great comment you linked to that helps explain the mechanics a bit. For guys like me who might want to simulate a lightbulb or maybe a sunlit window, how can we know which values correspond to which real-life states? By knowing this its possible to create a more realistic scene that doesn't involve tons of post-work.


text:
Face smooth rendering in cycles without using Subsurf?
Perhaps this goes against the function of cycles on some philosophical level, but I must ask anyway...
Do I have to subsurf my model to get rid of the hard shadows between faces? If so, the subsurf must be rather high (like 3).
I'd much rather the face smoothing of the model itself be observed rather than forcing hard edges.
Any advice on this?
In the example provided, you can see face-edges that are otherwise smooth in viewport (and game engines). Subdividing removes the spiky-ness of the spikes...so that is the conundrum.

EXAMPLE

Could you show us some examples?

Give me a moment to render some...

Example provided.

Related https://blender.stackexchange.com/questions/27982/how-to-avoid-terminator-artifacts-while-still-using-smooth-shading-and-the-new-p and https://blender.stackexchange.com/questions/92619/is-there-a-way-to-solve-terminator-artifacts


text:
Set all panels to be closed by default or remember settings by file?
I'm currently working on a very small screen, and I'd like to have all the panels closed by default and only open the ones I need manually, or if possible even just remember my last open panels when I save a project. Is it possible?

(open (1) and closed (2) panels in the editor)
I know I can use Ctrl+LMB to open a panel singularly, and that alone is a great help, but this would be even better.


text:
Animate Emission Textures individually using Blender scripting
I am trying to create firefly animation using Blender scripting. So far I could create firefly moments but I couldn't figure out how to animate emission textures individually. In this script there will be 9 spheres created but only the 9th sphere material is working properly. Others are only working for certain amount of frames.
import bpy
import random
import math

# Deselect all objects
bpy.ops.object.select_all(action="DESELECT")

# Set the number of frames in the animation
bpy.context.scene.frame_end = 350

# Set the frame rate
bpy.context.scene.render.fps = 30

# Add the spheres
spheres = []
for i in range(10):
    # Add the sphere and select it
    bpy.ops.mesh.primitive_uv_sphere_add(
        location=(random.uniform(-100, 100), random.uniform(-100, 100), 0)
    )
    sphere = bpy.context.active_object

    spheres.append(sphere)

    # Add a new material to the sphere
    mat = bpy.data.materials.new(name="EmissionMaterial")

    # Set the material's properties
    mat.diffuse_color = (1, 1, 0, 1)  # Yellow
    mat.specular_intensity = 0
    mat.use_nodes = True
    node_tree = mat.node_tree

    # Add an emission node
    emission_node = node_tree.nodes.new(type="ShaderNodeEmission")
    emission_node.inputs[1].default_value = random.uniform(-100, 50)  # Initial emission strength
    emission_node.inputs[0].default_value = (1, 1, 0, 1)  # Yellow

    # Set the emission node as the output node
    node_tree.nodes.remove(node_tree.nodes[1])  # Remove the default diffuse node
    output_node = node_tree.nodes.new(type="ShaderNodeOutputMaterial")
    node_tree.links.new(emission_node.outputs[0], output_node.inputs[0])

    sphere.data.materials.append(mat)

    # Set the sphere's scale
    scale = random.uniform(1, 2)
    sphere.scale = (scale, scale, scale)

    # Set the sphere's initial keyframe
    sphere.keyframe_insert(data_path="location", frame=1)

    # Set the emission initial keyframe
    emission_node.inputs[1].keyframe_insert(data_path="default_value", frame=1)

    # Set a random emission strength
    emission_node.inputs[1].default_value = random.uniform(-100, 50)

    # Set the keyframe
    emission_node.inputs[1].keyframe_insert(data_path="default_value", frame=i , index=-1)

# Animate the spheres
for i in range(1, 351):
     # Set a random emission strength
    emission_node.inputs[1].default_value = random.uniform(-100, 50)

    # Set the keyframe
    emission_node.inputs[1].keyframe_insert(data_path="default_value", frame=i , index=-1)

    for sphere in spheres:
        # Calculate the sphere's new location
        x = sphere.location.x + random.uniform(-1, 1)
        y = sphere.location.y + random.uniform(-1, 1)
        z = sphere.location.z + random.uniform(-2, 2)

        # Set the sphere's location
        sphere.location = (x, y, z)

        # Set the sphere's keyframe
        sphere.keyframe_insert(data_path="location", frame=i, index=-1)

        # Set a random emission strength
        emission_node.inputs[1].default_value = random.uniform(-100, 50)

        # Set the keyframe
        emission_node.inputs[1].keyframe_insert(data_path="default_value", frame=i , index=-1)
```

You will need to keep track of each emission node for each sphere, add a list to hold the emission nodes;
# Add the spheres
spheres = []
emission_nodes = []
for i in range(10):
    .
    .
    .

...adding each emission node to the list as you create the spheres;
    .
    .
    .
    # Set a random emission strength
    emission_node.inputs[1].default_value = random.uniform(-100, 50)

    # Set the keyframe
    emission_node.inputs[1].keyframe_insert(data_path="default_value", frame=i , index=-1)

    # Add the emission node to the list of emission nodes
    emission_nodes.append(emission_node)

And then randomize the default_value for the sphere's emission node, note the use of enumerate() to get the index for the sphere that matches the index for the emission node;
# Animate the spheres
for i in range(1, 351):
    for index, sphere in enumerate(spheres):
        # Calculate the sphere's new location
        x = sphere.location.x + random.uniform(-1, 1)
        y = sphere.location.y + random.uniform(-1, 1)
        z = sphere.location.z + random.uniform(-2, 2)

        # Set the sphere's location
        sphere.location = (x, y, z)

        # Set the sphere's keyframe
        sphere.keyframe_insert(data_path="location", frame=i, index=-1)

        # get the emission_node for this sphere
        emission_node = emission_nodes[index]

        # Set a random emission strength
        emission_node.inputs[1].default_value = random.uniform(-100, 50)

        # Set the keyframe
        emission_node.inputs[1].keyframe_insert(data_path="default_value", frame=i , index=-1)

Actually I want to have blinking light effect on all my spheres but in code, only one spheres  behave so.

I've changed the answer. The range is correct if you want to go from black to yellow of course.


text:
Rigging my human armature makes eyes be sucked into the skull
I've been following a course on Udemy and I got to the part where I have to parent my mesh to a rig with automatic weights right after rigging the default human armature in blender 2.79. The problem is that my rig ended up looking like in pic related, where the eyelids have been sucked into the skull through the eye-sockets and the eye themselves have the bone pointing inwards instead of outwards. What am I doing wrong?

EDIT:
1) The problem seems to start as soon as I press the 'Generate rig' button. The bones deform at that moment, without even allowing me to parent the mesh first, in fact, when I parent the mesh to the unrigged armature, the thing works completely fine...

Automatic weights are not sufficient for eyes.  You need to be adjusting your weights kinda manually.  The rim of the eyelid needs to be fully weighted to eyelid bones, and you're probably not going to get that with just autoweights.

The one picture where it looks like we can see the rest pose of the bones that actually deform the eyelid is the left side of the fourth picture.  But those bones only barely follow the eyelid.  If you have a ring of bones, and you want autoweights to be close, these bones need to exactly describe the rim of the resting mesh's eyelids.  They need to be placed almost exactly between the outward-facing and eyeward-facing faces of the mesh.  The bones I see there are not placed carefully. (Additionally, it doesn't look there are enough of them, at least, not for the upper eyelid.  You've got like two bones for the top and six for the bottom.)

Just looking at the pictures, I am not positive but it could be that you need to fix the weight paint issues. Select the rig in Pose Mode and then Shift select the model (both should be selected) then go into Weight Paint (its in the Object/Edit mode menu. From there you can right click on whatever bone and see the weight influence. Red= full control and Blue is unaffected. If the eye are red then you can pull up the paint menu with T and select the Subtract brush. (Default is Draw). Weight is 1.0 meaning you will paint red and 0 is blue meaning you will kill the influence of the bone on the mesh. So if you lighten the color of the mesh affected by the eyebone then it should fix the problem.
If all that wasn't the issue, then try to delete doubles. Make sure your mesh has no double verts. Un-parent the mesh (Alt+P), delete all the vertex groups (go to the vertex tab it is next to the materials tab) and then select the mesh and press W and remove doubles. Then parent the mesh to the armature again. The order in case you messed it up is, select the mesh (child) then shift select the armature (parent) hit Ctrl+P parent with auto weights. Hopefully that fixes your issue. Please respond if it helped you fix your problem.

No, that didn't fix it T.T, it seems that the problem comes from the rigging itself. The eye bone flips inwards and the eyelid bones go berserk as soon as I press the 'generate rig' button. Parenting, for now, has nothing to do with the deformation... thanks for the comment though anything helps!