text:
How to copy nodes and their links from one node tree/material to another - in python?
I'm trying to copy nodes from one node tree/material to another, in python.
As far as I can tell there is no good way to do this.
I have even tried context switching and then either try to use
bpy.ops.node.clipboard_copy() or bpy.ops.node.group_make() on the selected nodes.
But both will fail due to wrong context, even though I have successfully changed the area.type to "NODE_EDITOR" or the area.ui_type to "ShaderNodeTree".
So, I'm at a loss here. I don't want to have to figure out the entire tree structure and re-create all individual nodes.
I can select the nodes I need easily though. I would also be fine with somehow merging both trees and removing what I don't need.
Any help with this would be really appreciated. Blender 2.80.
Just getting the node ops to work after a context switch to the node editor, would suffice already.
To clarify: I'm running my tool from VIEW_3D in object mode. I'm switching the context to the node editor like so:
def change_context(string):
    area = bpy.context.area
    old_type = area.type
    area.type = string
    return old_type

This works, in that it switches the 3d view to the node editor, but following this with calling bpy.ops.node.group_make() or bpy.ops.node.copy() will fail:
RuntimeError: Operator bpy.ops.node.group_make.poll() failed, context is incorrect

Calling the node ops from the search bar in proper, manually changed context works. So I suspect my context switching is incomplete?
edit2: video demo
https://www.youtube.com/watch?v=N9tZLqHvcL4

running group_make() from node editor, works fine
switching area to node editor and running it, fails

Do you really need to switch the context? Where do you call it?

@jaroslav-jerryno-novotny I'm aware of these things, as I said, I don't want to recreate arbitarry node trees, node by node.

Ok, then I don't have a solution..

@brockmann You tell me, he node ops don't work, in VIEW_3D, obviously, but also won't work in NODE_EDITOR.

You want to call it from 3d View? Obviously? What I'm going to I tell you? Sorry, don't get it @MACHIN3

@brockmann Ideally, I wouldn't need any of the ops and could create a node group from the nodes I need, then create a new empty group in the other tree and link the node group's tree. But, there doesn't seem to be a way to create a group without the node op. Same for ungrouping.

Did you ever find a solution for this? I had the same approach before I found this and ran into the same issue. I stumbled upon this simple script which calls the poll function for all area types. I tried this with the 2.8 types for group_make and none of the types returned True.

With a little more testing I found the C code for the operators poll function and it seems like it is testing if the attribute space.edit_tree is not None. When you set the areas type to NODE_EDITOR it seems like that attribute is None while the operator is still running. Afterwards it's set though. I'll do some more testing to see if I can figure out how to set it.

@JoshuaKnauber I haven't found anything so far, but also haven't looked much and instead focused on other things.If you find anything let me know please.

Hm ok, I tried it again with a macro operator so setting the context can finish properly but that didn't help. I'll let you know if I find anything else.

After some experimenting, I couldn't find any way of doing this with bpy.data or with the operator for making a group, so I decided to write my own:
This operator takes in the name of the node group that should be created and then moves all selected nodes from the actives object active material in a node group with that name. It also copies all the links between the nodes and the property values. It doesn't just copy the input values but also dropdowns and similar options.
Here's the code:
class NODE_OT_MakeGroup(bpy.types.Operator):
    bl_idname = "node.group_make_no_context"
    bl_label = "Make Context Free Group"
    bl_description = "Make group from selected nodes without context"
    bl_options = { "REGISTER", "UNDO" }

    name: bpy.props.StringProperty( default="NodeGroup" )

    @classmethod
    def poll( cls, context ):
        """run operator only if an active object with an active material exists"""

        if context.active_object:
            if context.active_object.active_material:
                if context.active_object.active_material.use_nodes:
                    return True
        return False

    def get_selected_nodes(self,context):
        """returns a list of the selected nodes from the active objects active material"""

        nodes = []
        for node in context.active_object.active_material.node_tree.nodes:
            if node.select:
                nodes.append(node)
        return nodes

    def copy_attributes(self, attributes, old_prop, new_prop):
        """copies the list of attributes from the old to the new prop if the attribute exists"""

        #check if the attribute exists and copy it
        for attr in attributes:
            if hasattr( new_prop, attr ):
                setattr( new_prop, attr, getattr( old_prop, attr ) )

    def get_node_attributes(self, node):
        """returns a list of all propertie identifiers if they shoulnd't be ignored"""

        #all attributes that shouldn't be copied
        ignore_attributes = ( "rna_type", "type", "dimensions", "inputs", "outputs", "internal_links", "select")

        attributes = []
        for attr in node.bl_rna.properties:
            #check if the attribute should be copied and add it to the list of attributes to copy
            if not attr.identifier in ignore_attributes and not attr.identifier.split("_")[0] == "bl":
                attributes.append(attr.identifier)

        return attributes

    def copy_nodes(self, nodes, group):
        """copies all nodes from the given list into the group with their attributes"""

        #the attributes that should be copied for every link
        input_attributes = ( "default_value", "name" )
        output_attributes = ( "default_value", "name" )

        for node in nodes:
            #create a new node in the group and find and copy its attributes
            new_node = group.nodes.new( node.bl_idname )
            node_attributes = self.get_node_attributes( node )
            self.copy_attributes( node_attributes, node, new_node )

            #copy the attributes for all inputs
            for i, inp in enumerate(node.inputs):
                self.copy_attributes( input_attributes, inp, new_node.inputs[i] )

            #copy the attributes for all outputs
            for i, out in enumerate(node.outputs):
                self.copy_attributes( output_attributes, out, new_node.outputs[i] )

    def copy_links(self, context, nodes, group):
        """copies all links between the nodes in the list to the nodes in the group"""

        for node in nodes:
            #find the corresponding node in the created group
            new_node = group.nodes[ node.name ]

            #enumerate over every link in the nodes inputs
            for i, inp in enumerate( node.inputs ):
                for link in inp.links:
                    #find the connected node for the link in the group
                    connected_node = group.nodes[ link.from_node.name ]
                    #connect the group nodes
                    group.links.new( connected_node.outputs[ link.from_socket.name ], new_node.inputs[i] )

    def add_group_nodes(self, group):
        """adds the group input and output node and positions them correctly"""

        #add group input and output
        group_input = group.nodes.new("NodeGroupInput")
        group_output = group.nodes.new("NodeGroupOutput")

        #if there are any nodes in the group, find the mini and maxi x position of all nodes and position the group nodes
        if len(group.nodes) > 0:
            min_pos = 9999999
            max_pos = -9999999

            for node in group.nodes:
                if node.location[0] < min_pos:
                    min_pos = node.location[0]
                elif node.location[0] + node.width > max_pos:
                    max_pos = node.location[0]

            group_input.location = (min_pos - 250, 0)
            group_output.location = (max_pos + 250, 0)

    def execute( self, context ):
        """creates the node group, copies all attributes and links and adds the group input and output"""

        #create new node group
        group = bpy.data.node_groups.new( name=self.name, type="ShaderNodeTree" )
        #get the list of all selected nodes from the active objects active material
        nodes = self.get_selected_nodes(context)

        #copy all nodes from the list to the created group with all their attributes
        self.copy_nodes( nodes, group )
        #copy the links between the nodes to the created groups nodes
        self.copy_links( context, nodes, group )

        #add the group input and output node to the created group
        self.add_group_nodes(group)

        return { "FINISHED" }

I'm sure there are some improvements that could be done to this and of course, it's not a perfect solution because that operator basically already exists, but I think it's the best option while these are not working. I tried it with 2.83 and it seems to work fine for all cases I tested.
EDIT:
Here's a version that was better suited for my personal case. It has an additional parameter to specify a specific material. If it doesn't get a value for that parameter it defaults to the active objects active material. Otherwise, it's the same as the one above:
class NODE_OT_MakeGroup(bpy.types.Operator):
    bl_idname = "node.group_make_no_context"
    bl_label = "Make Context Free Group"
    bl_description = "Make group from selected nodes without context"
    bl_options = { "REGISTER", "UNDO" }

    name: bpy.props.StringProperty( default="NodeGroup" )
    material: bpy.props.StringProperty( default="")

    def get_selected_nodes(self,context):
        """returns a list of the selected nodes from the material"""

        nodes = []
        for node in bpy.data.materials[self.material].node_tree.nodes:
            if node.select:
                nodes.append(node)
        return nodes

    def copy_attributes(self, attributes, old_prop, new_prop):
        """copies the list of attributes from the old to the new prop if the attribute exists"""

        #check if the attribute exists and copy it
        for attr in attributes:
            if hasattr( new_prop, attr ):
                setattr( new_prop, attr, getattr( old_prop, attr ) )

    def get_node_attributes(self, node):
        """returns a list of all propertie identifiers if they shoulnd't be ignored"""

        #all attributes that shouldn't be copied
        ignore_attributes = ( "rna_type", "type", "dimensions", "inputs", "outputs", "internal_links", "select")

        attributes = []
        for attr in node.bl_rna.properties:
            #check if the attribute should be copied and add it to the list of attributes to copy
            if not attr.identifier in ignore_attributes and not attr.identifier.split("_")[0] == "bl":
                attributes.append(attr.identifier)

        return attributes

    def copy_nodes(self, nodes, group):
        """copies all nodes from the given list into the group with their attributes"""

        #the attributes that should be copied for every link
        input_attributes = ( "default_value", "name" )
        output_attributes = ( "default_value", "name" )

        for node in nodes:
            #create a new node in the group and find and copy its attributes
            new_node = group.nodes.new( node.bl_idname )
            node_attributes = self.get_node_attributes( node )
            self.copy_attributes( node_attributes, node, new_node )

            #copy the attributes for all inputs
            for i, inp in enumerate(node.inputs):
                self.copy_attributes( input_attributes, inp, new_node.inputs[i] )

            #copy the attributes for all outputs
            for i, out in enumerate(node.outputs):
                self.copy_attributes( output_attributes, out, new_node.outputs[i] )

    def copy_links(self, context, nodes, group):
        """copies all links between the nodes in the list to the nodes in the group"""

        for node in nodes:
            #find the corresponding node in the created group
            new_node = group.nodes[ node.name ]

            #enumerate over every link in the nodes inputs
            for i, inp in enumerate( node.inputs ):
                for link in inp.links:
                    #find the connected node for the link in the group
                    connected_node = group.nodes[ link.from_node.name ]
                    #connect the group nodes
                    group.links.new( connected_node.outputs[ link.from_socket.name ], new_node.inputs[i] )

    def add_group_nodes(self, group):
        """adds the group input and output node and positions them correctly"""

        #add group input and output
        group_input = group.nodes.new("NodeGroupInput")
        group_output = group.nodes.new("NodeGroupOutput")

        #if there are any nodes in the group, find the min and maxi x position of all nodes and position the group nodes
        if len(group.nodes) > 0:
            min_pos = 9999999
            max_pos = -9999999

            for node in group.nodes:
                if node.location[0] < min_pos:
                    min_pos = node.location[0]
                elif node.location[0] + node.width > max_pos:
                    max_pos = node.location[0]

            group_input.location = (min_pos - 250, 0)
            group_output.location = (max_pos + 250, 0)

    def execute( self, context ):
        """creates the node group, copies all attributes and links and adds the group input and output"""

        #set material if not given
        if not self.material:
            self.material = bpy.context.active_object.active_material.name

        #create new node group
        group = bpy.data.node_groups.new( name=self.name, type="ShaderNodeTree" )
        #get the list of all selected nodes from the active objects active material
        nodes = self.get_selected_nodes(context)

        #copy all nodes from the list to the created group with all their attributes
        self.copy_nodes( nodes, group )
        #copy the links between the nodes to the created groups nodes
        self.copy_links( context, nodes, group )

        #add the group input and output node to the created group
        self.add_group_nodes(group)

        return { "FINISHED" }

You can see here, the key is:bpy.ops.wm.redraw_timer(type='DRAW_SWAP', iterations=1)
area.ui_type = 'ShaderNodeTree'
if area.spaces.active.node_tree != you_node_tree:
    area.spaces.active.shader_type ='OBJECT'
    bpy.ops.wm.redraw_timer(type='DRAW_SWAP', iterations=1)
bpy.ops.node.clipboard_copy()

refer to:
https://docs.blender.org/api/current/bpy.types.SpaceNodeEditor.html#bpy.types.SpaceNodeEditor
Update viewport while running script

Here's the example of copying nodes using clipboard:
import bpy

def get_shader_editor_context():
    for screen in bpy.data.screens:
        for area in screen.areas:
            if area.type == "NODE_EDITOR":
                for space in area.spaces:
                    if space.tree_type == "ShaderNodeTree":
                        context_override = {"area": area, "space": space, "screen": screen}
                        return context_override

def copy_node_graph_to_active_object(material):
    temp_override = get_shader_editor_context()
    old_material = bpy.context.object.active_material
    new_material = material

    # remove all nodes from the current material
    for n in old_material.node_tree.nodes[:]:
        old_material.node_tree.nodes.remove(n)

    # change current material and make other window's shader editor is updated
    bpy.context.object.active_material = new_material
    temp_override['space'].node_tree = new_material.node_tree

    # select all nodes and copy them to clipboard
    for node in new_material.node_tree.nodes:
        node.select = True
    bpy.ops.node.clipboard_copy(temp_override)

    # back to original material
    bpy.context.object.active_material = old_material
    temp_override['space'].node_tree = old_material.node_tree
    bpy.ops.node.clipboard_paste(temp_override, offset=(0,0))

copy_node_graph_to_active_object(bpy.data.materials['test'])

```


text:
Rotate (generated) UVs of environment texture without mapping node
I'm trying to rotate an environment texture (around Z), but without the mapping node, as it lacks sockets.
I've successfully rebuilt, the node tree detailed here: Use another node to control Vector Mapping
Works great for Object UVs, but not for generated UVs of an environment map.
I've tried translating it along U, which also didnt work. Any suggestions?
edit: the linked node tree works for environment maps, IF you connect the Z channel from the initial separate node to the final combine node.

In what way did it not work? - this might give a clue as to what’s going wrong. Can you edit your post to include your current (not working) node setup so that people can replicate your setup. One thing, bear in mind thst the environment is effectively at infinity - so translation will not work - it’s all about angle of incidence compared to the normal from an infinite sphere.

This is a node setup for a z-axis rotation.  The other 2 axis' are just as easy but adding all three axis' into one formula gets very complicated.
To rotate the image, adjust the Value node that is located at the top-left in the "Deg 2 Rad" frame.
Note: The math nodes all have two "value" fields but only the upper field is used for trigonometry so just ignore any values in the lower fields.

This one works on environment maps as well. Thank you so much Marc!

source: Stack Exchange

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

sort: votes


text:
eGPU performance on Linux
I'm looking to improve my hardware, and I have decided to invest in a GPU (like the TITAN RTX, GeForce RTX 2070 Super, or something similar).
I'd like to use this as an external GPU. My question is, does using an external GPU vs. an internal one have any performance issues in Blender?
I am using Linux (Manjaro KDE).

Adding a GPU internal or external will help you render faster no matter what. You shouldn't see any performance issues in blender. Only if you were planning on using that GPU for gaming you would probably have a bit of a slowdown, but since you are using Linux I doubt that you are gaming much.

I am running an eGPU on Linux and I can confirm the speed is on par with other systems. My setup is a Dell XPS 13 (9370) with a Quad Core i7 (8550U) and a Razer Core X eGPU enclosure with a Radeon RX 580. To give you some numbers, the BMW scene renders in a little over 262 seconds. Here is the result of my render:
https://opendata.blender.org/benchmarks/3b842bbd-ed59-4352-a1f1-f6ef10a25864/
That's below the median time for that scene (266 seconds) on systems with the same configuration (BMW + Linux + OpenCL + RX 580 + Blender 2.90):
https://opendata.blender.org/benchmarks/query/?device_name=Radeon%20RX%20580&device_type=OPENCL&os=Linux&benchmark=bmw27&blender_version=2.90
From the OpenData results we can't distinguish eGPU's from dGPU's, but I think desktop setups are far more common than eGPU setups. On my machine, rendering on the GPU is about 2.5 x faster, which is what I measure most of the time. As a reference, the same scene renders in 663 seconds on the CPU. Here is my result:
https://opendata.blender.org/benchmarks/fffb4aed-f259-40d8-b307-827f1580c919/
I also tested with combined GPU + CPU render but the result is more or less the same as the GPU alone, often even slower. That's because the CPU is more efficient rendering small tiles (64 x 64 px) while the GPU prefers larger tiles. So if you increase the tile size, the CPU will negatively influence the result. While with smaller tile sizes, the GPU will not work at its full capacity.
On the elementary OS StackExchange, I've outlined my setup:
https://elementaryos.stackexchange.com/questions/26197/can-i-use-an-egpu-with-elementary-os-and-if-so-how-do-i-set-it-up/26198
I've never used Manjaro, so I'm not sure how it will translate.

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


text:
Collision detection in cycles
I want an object to do something if another object collides with it, very similar to the "Collision"-logic-brick in the bge. Is there any way to use a similar method in another engine?
I am aware of a python command collision. Maybe it can integrated into a driver.

I dont know about the blender logic operations but this is what I can do in this case:

Add a driver for the operation you want to apply to the object.
Add a distance variable and set the object to itself and the other object.
Add a custom property and call it margin which will be the margin of the object (the distance in which the object will interact from the origin point).
Add this custom property to a single property variable.
Type "ternary conditional operator" like this in the expression.
Now when ever the "Cube.001" touch the "cube" the scale will change to 2 instead of 1 (and of course you can change the operation)

Is this also pssible with a particle system? Meaning a particle touches the obkect and the object transforms.

So you want the action to be applied when the particle system touch the object?

Exacly: A particle hits, an action is performed.

I can't think of a solution other than scripting,But if you want to apply this action based on the location of the particle in a material or something,you may want to try dynamic paint.

There are great solutions over here: There are some great solutions here: https://blender.stackexchange.com/questions/71289/using-overlap-to-check-if-two-meshes-are-intersecting/

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

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


text:
How to slow down sensivity of grabbing objects via the user preferences
I would like to slow down the sensitivity of the Grab function (G) in Blender. Is there a way to do that permanently, not just with holding down Shift or changing the scene scale?

It often can be fixed by changing Pivot Point. If it's set to 3D Cursor, grabbing / moving objects can be faster depending on whether cursor is far away or not.

There is no way to scale down the cursor speed in Blender when grabbing, (aside from holding shift as you've mentioned).


text:
When I saved the file (Ctrl + S) the texture disappeared
I was painting the textures onto the model when I decided to do an incremental save as to not lose all my work, so I pressed Ctrl S and saved the blend file.
When I looked at Blender again (I did not close Blender at all) the object was black and I can't find the texture image I saved? Sorry, I'm really new to Blender. Here's a screen:

I advise is that you go on UV / Image Editor and choose the Image menu and click save the image, choose the output file format the image and click save the image, so you do not lose your work.


text:
delete overlapped part of faces

I have more than a thousand places where this happens in a single mesh object. As you can see in the image, part of the faces are overlapping. I want to delete the overlapped part of the faces.
Boolean modifier won't work because it's a single mesh that has many places where this happens.
Remesh modifier won't work because it creates big blobs of new mesh were there doesn't exist anything.
Blender doesn't recognize that as an "interior face" too so the seletect "interior faces" and delete method won't work either. How do I delete the overlapped part of the faces?

remesh worked for me on this simple model. How complex is your actual model? Or do you mean that you want to keep the mesh separated entities with the intersecting faces removed?

sorry I only put one problem remesh caused, it wasn't the important one, I edited the post.

Perhaps uploading a simplified .blend to http://blend-exchange.giantcowfilms.com/ will help to further inspect and find a solution.

for remesh you have to tune the amount of detail levels to fit the mesh you are trying to clean up. Honestly not the best choice, but I would think a manual clean up is unavoidable if you have a huge scene.

Unfortunately, in Blender you can't delete "part" of a face. What you'll have to do is divide the faces that overlap into two faces each, with the division edge of one face in the same plane as the end of the other face. Then you can delete the faces that adjoin.

You could try using Intersect tool. In Edit mode, with all selected press Ctrl+F > intersect and choose Self-Intersect in Last Operator menu. Note though that it will work if meshes actually intersect and aren't just placed near each other. Also it may (and likely will) create zero-area faces and double vertices. So the mesh still will have a lot of to clean-up See also - http://blender.stackexchange.com/questions/5752/simplify-mesh-by-cutting-out-inside-parts

You can't really ask for a magic tool that will adapt to your own particular way of modeling. And also magic answers because we don't know how you have been proceeding, why do you have this problem multiple times in your mesh ? Are you duplicating parts of the mesh ? If so then you should set up your first model so that when you link all your pieces together they can be nicely joined with a 'remove doubles'.

AFAIK there is no one-klick method for this and every possible way to pull this off requires a decent amount of work. Let's break down what we actually can do with the limited information about your model/scene you provide.
Let's assume (by the look of the screenshots) that your model is a minecraft-like structure where the original blocks (before joining) only touch each other's faces and never intersect and they also don't have merged vertices. What we then can do with this, is separating the model into individual primitives quite easily.
Tab into edit mode, hit A to select everything, then P to start separating and select "by loose parts" in the menu.

Now, that we have separate blocks we could try combining the meshes step by step using the boolean modifier with the union operator.
The bad news is that the boolean modifier might not work as expected on many occasions (if you have mesh intersections or the meshes simply have no connecting faces...) and with "more than a thousand" partly hidden faces this method will be so much work that you easily could reconstruct your model from scratch as well.

Update
There's an awesome new "Voxel" remesh feature in Blender 2.83 Beta / 2.90 Alpha. It will merge geometry intersections and get rid of interior faces (elements must be in a single mesh object). Voxel remesh gives it a slightly softened and beveled edges / intersection look but use another remesh modifier after it like Remesh “Blocks” or maybe a Decimate based on face angles etc to get rid of slightly beveled intersections. Finally, apply modifiers, and snap vertices to grid (may need to adjust global grid size).
End of update
Might have some good news for ya! So I just tried using Knife project to add extra seams where the boxes meet. The only reason we are making cuts, is so we can then merge overlapping vertices (W, "Remove Doubles") which will form the face inside that we want to delete. Then we can take advantage of a selection tool "Select" "Interior Faces", and finally delete "Faces Only".
Even if you scene is very dense, this technique will save you much more time than doing it by hand. You can begin to plan for and create different knife projection meshes to cut different groups. You can even reuse knife project meshes. Once you make your cuts, and merge doubles, you can let the Select Interior Faces tool do the hardest part, and then delete Faces Only.
You can see what the cut did in the image below (including some triangulation of a couple of faces but you can easily fix that with Alt+J which converts triangles to quads):

To use Knife Project, I had to join the boxes into one object (Ctrl + J), and then I needed a separate plane object that would serve as the projected knife. Line up the plane perfectly using snapping, so cuts line up with the existing vertices. Then, select the plane in object mode, and Shift select the combined box object. Enter Edit mode, and your boxes will now be in Edit Mode, while your selected plane stays in object mode. Change your view to Orthorgraphic, and Front or Side (which ever lines the plane up to cut the boxes right.
If you have rotated your boxes to some odd degree that does not line up with global front, side, or top views, you can still line up your view with Shift + NumPad7 (or + NumPad3 or + NumPad1) while a face is selected. This will align your view to the top/side/front relative to the normal of that selected face. This is an amazing shortcut that can help you precision model on faces that are at odd angles not lined up with global front, side, or top views. Be sure that your plane is lined up exactly for best cutting results. Make use of snapping tools as needed. Do your cut while in Orthographic mode, and check the box "Cut Through" under the Knife Tool Sidebar (it only appears after you click Knife Project).
Once you have your cut perfect, while your boxes are in Edit Mode, press "W", "Remove Doubles".
Finally, there is a lovely tool we can use to automatically select internal faces like the one we just made. From the menu, choose Select, Interior Faces (or spacebar and type "Select Interior Faces"). Now you can delete them with "X" "Faces Only". I hope this helps.

select interior face don't always work. And the original question is that is there a easy way to do this, he has indicated he has thousands of these similar situation , and if it's done by hand on each part is tedious. His question is about automating the process.

Yeah I can see how Select Interior Faces doesn't seem to work when I tried it on a more complex model with interior faces at odd angles. At least, my method MIGHT work if he gets his cuts EXACT. This really is a tough problem.


text:
Animation Nodes: Is it possible to instance nested instances?
Edit: This thread is not concerned with Instances and their usage in normal blender but with the usage of instance object node in animation nodes
I struggle with a probably simple question. I created a simple circle array. The elements of the array are created with object instance node. In my advanced case i want to create smaller circles, offset them and so on. I can do this by simply copying the circle-array-loop but it is not handy.
I tried to to it with a simple example but i does not work out. I created a simple loop that offsets 4 instances of a cube. I created an object list output for the loop to put the results in a new object instance node and offset it with a new loop. But it works only with the first element.
Some advice?

Here is my current project including node tree. By instancing the loop i thought I'll be able to change the number of orbiting circles on the fly (inluding some math for the radius)...

Unfortunally the Object Instancer does not work in subprograms, because node it has to monitor the scene to keep track of a specific set of objects. It's very similiar to the Separate Text Object node.
There are two main ways to work around that:

Calculate the number of objects you need and create that many before the loop starts. For a simple grid there is also a template:

Make the first row of instances using AN and then use the array modifier like I did in this audio animation:

For that the source object needs an array modifier and you have to activate Copy Full Object in the Object Instancer node so that the modifiers are copied to the instances as well.

[EDIT]:
I just created a node tree that does parts of what you want to archieve. You may be able to use it as a reference:

Basically I use approach 1. here. The first loop splits the long object list into multiple shorter lists with equal length. The second loop calculates the positions of the objects.

It is a shame. My life would have been so easy. :D
Thank you for the provided examples. In my current project i'll need to find a different solutionen, but they are very helpfull to understand AN better. Thans for that.

Wow. I would upvote it, if I had not done this earlier. Thank you a lot. Exactly what I wanted to do...

Is it possible to implement in the future the Instancer within a Loop feature or Instancer which can handle object list as an input?

This answer isn't specific to animation nodes, but it may still be useful to use this with animation nodes.

Instance of instances are supported via Groups, which can be instanced using empties that instances those groups (dupli-groups).
There are some limitations however:

You can't add modifiers to dupli-groups (that apply to all instances)Though the instances themselves may have modifiers.
The state of the mesh-data in the dupli-group can't different between instances.A character being instanced for eg, could not have a different pose in each group instance.

Is your answer really related to animation nodes or to normal workflow in blender?

I don't think it is likely to happen in AN, since AN clearly tells you that you cannot put Instancer node in a subprogram.
One way to do this in AN is to generate location list one time for all instances.
For 2D Grid or even 3D Grid array, you can simply use the preset, which can be found in the Templates menu at the right side of the header.
Besides, as @ideasman42 said, using dupli-group is not a bad workaround. You can first create instances for the first loop, then group them manually, then use them as dupli-group of a target object (it has to be a non-empty object! Because AN cannot create instance for empty. So here you have to use dupli-group instead of group instance. Don't worry, the target itself won't be actually rendered once you use dupli-group for it), then you can create instances for this target object as the second loop. Something like this:

Probably my basic example is misleading as it does not point to my usecase. I'll add a new image.
I want to use an object, create instances and distribute them evenly on an circle. I achieved this by calculating X and Y-coordinates with simple math.
Elsewhere Jaques helped me to use matrices to rotate the result around world origin. That works great, but my idea was to us an second instance object node to duplicate my circle and to give the instances different values for radius and rotation.
I can do that by duplicating the loop and it is okay, I only hoped it can be done with less nodes.


text:
How do I create a 10-sided die as one object?
What I'm looking to do is create a 10-sided die, specifically in the shape of a 'pentagonal trapezohedron', i.e., a polyhedron that has 10 kite shaped sides.
With the following link I was able to produce a d4, d6, d8, d12, d20, & d30:
How do I create an 8 sided die from one object?
What I'm looking for is something similar for a 10-sided die.
Thanks

Fastest manual method for me so far, can be done under a minute with ease (faster if the settings in operators have been pre-saved):

Add a Cone with such settings:

Select the base vertices (Z for wireframe mode), move them 1.0 units up in Z, hit . for 3D cursor Pivot center, duplicate all with CtrlD and rotate with R 180°. Remove doubles with W5. This is what you should have:

Select every other vertex on the perimeter and the bottom vertex. Move 0.19 units up in Z.

Select all faces, hit AltJ to merge to quads. For Max Shape Angle input 50°:

Center the thing in object mode with CtrlShiftAltC Origin To Geometry and AltG. You are done with the dice:

If you choose "Triangle fan" as the base fill type instead of "Nothing" you can even skip the duplicate, rotate and merge steps in 2.

@OliverGiesen very true, so it can be done even faster :)

I'm not sure how to model that with the least amount of steps, it might have a simple answer but i've added a solution after the code section anyway.
The wikipedia page of Pentagonal_trapezohedron links to a .wrl file file but Blender fails to import it (for reasons that are not important here). The coordinates in the wrl are enough to build the script below. This could be added to the Mesh Extra objects addon, but for now just run the script from the TextEditor
# be in object mode with nothing selected.

import bpy

Verts = [
    0.5257311, 0.381966, 0.8506508,
    -0.2008114, 0.618034, 0.8506508,
    -0.6498394, 0, 0.8506508,
    0.5257311, -1.618034, 0.8506508,
    1.051462, 0, -0.2008114,
    0.8506508, 0.618034, 0.2008114,
    -0.5257311, 1.618034, -0.8506508,
    -1.051462, 0, 0.2008114,
    -0.8506508, -0.618034, -0.2008114,
    0.2008114, -0.618034, -0.8506508,
    0.6498394, 0, -0.8506508,
    -0.5257311, -0.381966, -0.8506508,
]

Faces = [
    3,0,1,2,
    0,3,4,5,
    1,0,5,6,
    2,1,6,7,
    3,2,7,8,
    4,3,9,10,
    5,4,10,6,
    7,6,11,8,
    3,8,11,9,
    10,9,11,6,
]

def deflate(x, stride):
    return [x[i: i + stride] for i in range(0, len(x), stride)]

Verts = deflate(Verts, 3)
Faces = deflate(Faces, 4)

mesh = bpy.data.meshes.new("Base_Data")
mesh.from_pydata(Verts, [], Faces)
mesh.update()

obj = bpy.data.objects.new("Pentagonal_Trapezohedron", mesh)

scene = bpy.context.scene
scene.objects.link(obj)
obj.select = True

Manual way

This is based on trigonometric principles, but not perfect. Blender is an Arts package which only aims to approach visual accuracy not numeric accuracy.

add a dodecahedron with the Mesh Extra Objects add-on
notice its sides are built using two faces: 1 quad (trapezoid), 1 triangle (isosceles)
the quads have a long edge and an opposing shorter edge.
the long edge can be copied and placed at the tip of the short edge to get 1 'terminator' point
repeat this process on the opposite face to find the 2nd 'terminator'.
then edge-fill around.
optional cleanup: Remove Doubles, followed by a Limited dissolve  and you'll get nice Kite shaped quads.

The edges in blue above are marked to show that they are the same edge, with the same length.
here's the opposite side using orange to show the corresponding edges:

Great answer! To nit-pick, the only thing you can improve, is that the manual way brings to faces that aren't 100.00% flat.

@Carlo thanks for pointing that out. I 'll think about a different approach.

@Carlo, perhaps you wish to examine the alternative. I think it doesn't suffer from the same problem.

Thanks, I'll give it a look ASAP. I agree with you in saying that high numerical precision should not be one of Blender's goal. I was amazed by the fact that extruding the faces of the default dodecahedron by 1 unit (not 1.02, or 0.7563..., but a 1.000) would leads to the perfect result. Sadly it was not, but it gets incredibly close to that anyway!

I think it's 0.9822 , but with rounding it's only going to get so close :)

Even faster:
0) Assure 3D cursor to (0,0,0) (Shift-C)

1) Add a Cone with 5 sides, depth 2.0, radius 2.25 (+/- to taste) (Shift-A M Y, Open Tool Shelf T)

2) Duplicate it (Shift-D and Enter) and rotate the duplicate 180º around X ( R X 180 Enter )

3) Select the first cone, Add a Boolean Modifier, Intersect the second cone, Apply.

4) Delete the second cone. ( X Enter )

Done.
This is by far the fastest and most accurate method I've found (this is the sixth one!) -- it takes about 30 seconds!  Vary the radius on the cone to get more or less sloped faces. 2.25 seems about like a d10.


text:
How to create and change the color of a Node based material with a script
I want to do an animation of a blender object which changes the color over time, in dependence of the temperature. Therefore zeffi already wrote a script which transforms different colormaps into blender. (Set color of Blender object based on external data (e. g. temperature) using a colormap)
Now I would like to create a node based material with a script, set the colormap to jet and when the temperature changes, I would like to change also the color.
Can someone post a little piece of script, how I can achieve this?
Thanks

do you have some kind of text file with the temperature over time?

related:   http://blender.stackexchange.com/q/23436/47 ,  http://blender.stackexchange.com/a/5445/47 Scripting a node material is pretty well documented. and http://blender.stackexchange.com/questions/23882/how-can-i-change-the-color-of-a-material-using-python-script?rq=1

This question is really 3 or 4 questions rolled into one, we encourage you to split problems up into separate concepts so they can be asked and answered separately. The scripting of materials, and material animation are definitely easy to find using the this site's search feature. The only part of this question that isn't readily found relates to the add-on you mention (which is mine so I feel some responsibility for answering questions about it: see below) .

I can answer one of your questions but you will need to download and install the add-on again if you haven't yet. The add-on now lets you access functionality via the script shown below.

This assumes a recent version of the octave_gradients add-on is available locally.

code for using the add-on inside a script:
import bpy
import addon_utils

addon_utils.enable("octave_gradients")

# add material, or reuse existing one
mymat = bpy.data.materials.get('lazy_cube')
if not mymat:
    mymat = bpy.data.materials.new('lazy_cube')
    mymat.use_nodes = True

nodes = mymat.node_tree.nodes

if not 'ColorRamp' in nodes:
    nodes.new(type="ShaderNodeValToRGB")
ColorRamp = nodes['ColorRamp']

# reuse the Octave Gradient maker code, when calling from this context,
# it will add a function called 'external_octave' to the driver_namespace
# this function doesn't care what context you are in, all it wants
# is a reference to the ColorRamp node, and a number between 0..13
bpy.ops.scene.gradient_pusher()
external_octave = bpy.app.driver_namespace['external_octave']

# force ramp theme
external_octave(ColorRamp, 12)  # jet=12

# hook the ColorRamp up to the DiffuseBSDF node.
DiffuseBSDF = nodes.get("Diffuse BSDF")
mymat.node_tree.links.new(ColorRamp.outputs[0], DiffuseBSDF.inputs[0])

What you should be able to solve on your own is how to get temperatures into a range of 0 to 1, so the color ramp can map them.

I have updated the readme on https://github.com/zeffii/octave_gradients to include comprehensive explanation of how to use it in the context of a script.

Thanks for your quick answer!
When I try running your script, I get an Error:
AttributeError: 'NoneType' object has no attribute 'inputs' Error: Python script fail, look in the console for now...
It refers to this line:
mymat.node_tree.links.new(ColorRamp.outputs[0], DiffuseBSDF.inputs[0])
Do you know why I get this failure message?

nope, do this (to see if it works). start with an empty .blend file, add the script to the TextEditor and hit Run. Then go to the nodeview, materials view, and see if it created a material called 'lazy_cube'

Not that this is necessarily the answer you want, but it's very easy to change colors using vert colors (can be changed in a script very easily). In your noodle you can use vert colors to change what texture is shown. You could also probably have a material that uses alpha and lets the vert color show through your texture. Guessing.


text:
Fluid sim problem: fluid growing in volume
I'm trying to generate a small amount of water in a clear bottle, then pour the water out of the bottle. It's all going well, except that from the moment the water collides, it starts to grow and grow until it's filling the bottle, then tapers off until it finally all pours out. I'm starting with a small fluid object less than 1/10 the volume of the bottle, but it seems like every collision causes the fluid to double! I'm not using outflow, and it's not a problem with failing to apply scale. What am I doing wrong?
I've been trying to solve this on and off for months!
Thanks!

Is it possible you could upload your .blend?

I can try. Where?

http://blend-exchange.giantcowfilms.com/ or http://www.pasteall.org/blend/

See http://meta.blender.stackexchange.com/q/658/599

Did that work? I'm finding it a little confusing, I'll admit

I couldn't really get my head around what's going on in your blend file, but the basics of the fluid sim are all wrong. The domain should not have any key framed properties, and yes, scale should be applied.
My guess is that since the euler scale of the domain is off, the impact value of the obstacle (the bottle) gets calculated as if it was greater than 1. Decreasing the impact value decreases the problem you have, but really, the fluid sim should be set up properly.


text:
How do I link two mirrored sides?
So I've created an X and I used a mirror to make the right side of the X and have it symmetrical to the left side. As shown in the picture:
The problem I am having is when the image is rendered it looks like this:

At the axis of symmetry for the X there is a weird black line? I think it's due to two lines meeting at the same points? I don't know how to fix this and I would really appreciate any help. This is my first time using blender ._.

Have you checked the merge option in the modifier panel ?

@Aleph Yes that option is checked. http://i.imgur.com/B8D8ZHG.png

And why not applying the modifier and 'w'-> 'removed all doubles'? Unless you want to have the possibility of a further modification...

@Aleph What does "remove all doubles" do?

It merge the overlapping vertices, try my answer above, I've added some precisions :)

I think it's not necessary to apply mirror modifier in order to get rid of artifacts. First check whether these vertices (located on the mirror plane) are co-planar or select them and scale by Y axis to 0. Second, check whether there are internal faces.

Actually, this can be many things:

First try to change the merge limit value, and have a render.

If it doesn't work :

in Edit mode, while zooming at maximum, make the twins vertices (of the top of your object, for example) -one for each side or your mirrored object - the closest as possible, overlapping themselves.
Try a Render, it should solve the pb.

If not :

if you don't plan to have further modification on your shape, once it's finished, in Edit mode, you can apply the mirror modifier, then press A (it will select all the vertices), then W, then remove doubles, it will merge the overlapped vertices
And try a render :)

thanks for the assistance  :D this worked perfectly, I changed the merge limit until the vertices merged. (and remove doubles sounds like it will be useful in the future :P )


text:
Remove weird black outline on Texture when in viewport shading
When using the "Texture" option for Color in viewport shading, and your material has the texture interpolation set to "Linear" I get these black outlines around the edges where it's turning transparent. I'm using a 32x64 pixel texture. I'm trying to imitate the Trilinear/Bilinear Filter Mode, that you get in unity to achieve a non pixellated look.

I've seen this before, and I don't remember how to fix it. The short version is that the alpha channel is getting blurred from scaling just like the color channels, but the image will only be either fully transparent or not transparent at all with how the material is set up, so the fuzzy half-transparent areas render as opaque instead.

Could it be that the Alpha setting in the Image Texture node is Premultiplied? At least that's how I get those black borders in semi-transparent areas when using the Texture in Solid mode. If this is the case, try changing it to Straight. But the problem here is, the Solid mode cannot show semi-transparency and it can also depend on what colors the image has stored in the transparent areas when you would remove the alpha channel.


text:
How to completely remove objects from the scene with a script?
Using blender 2.79, I'm trying to clean the blender scene from created objects.
Objects disappear, all counters are OK, but adding new objects into scene lag the same way as no objects were killed.
I use this approach:
objects_created = []
cnt = 0

# source is some source which generates data items to create meshes
source_item = source.get_next()
while source_item:

    # create a mesh data
    name, bm = bmesh_from_source_item(source_item)
    source_item = source.get_next()

    mesh = bpy.data.meshes.new(name)
    bm.to_mesh(mesh)
    # create an object with this mesh data
    obj = bpy.data.objects.new(name, mesh)
    # link it to the scene
    bpy.context.scene.objects.link(obj)
    # and store the reference to kill it later
    objects_created.append(obj)

    cnt += 1

    if cnt % MY_CHUNK_SIZE == 0:

        # process created objects (say, export them to fbx)
        process_objects(objects_created)
        # and delete them one by one in reversed order
        while len(objects_created):
            obj = objects_created.pop()
            obj_data = obj.data
            # first the object
            bpy.data.objects.remove(obj)
            # then its data
            bpy.data.meshes.remove(obj_data)

        # even updating the scene
        bpy.context.scene.update()
        # and even force GC to perform
        gc.collect()

Adding objects speed degrades as total object count increases.
So, the idea is to process objects in chunks to speed things up.
But after cleaning objects this way, there is no speed improvements on next chunk items creating at all!
It seems that (data.objects, data.meshes, scene.objects) are not everything to address here.
So, What am I missing here?

I'm assuming you're running this on a low spec computer. The bmesh data will still be in memory. Try bm.free after bm.to_mesh(mesh) to free up that memory

Thank you. I added bm.free(). Memory maybe now is better, but it's still as slow as before, so there is something else that is somehow growing. :-(

Why process then in "chunks"? Why not just one at a time?

The entire dataset is about 135 000 items. Chunks are 10 000. The speed degrades fast. First 500 items are handled in about 3 seconds. After 5000, the same 500 take 20+ seconds. The more, the worse. So, chunks is my hope to process them all as fast as we (blender and I) can.

Well, it sounds like a memory issue. Does your memory keep increasing? May not even be a Blender issue, might be a Windows memory issue as Windows is notorious for not freeing used memory in some cases. (assuming you're using Windows)

Yes, I run it under windows. According to task manager, there is no substantial memory growth. When it starts to slow down, there is enough free RAM (gigs). It looks like blender registers something, which has bad access time on its elements. Maybe it's something to do with blender's undo system (?). Anyway it looks like a major design flaw. Now I'd rather give it up, and consider blend file reload, as a last resort. BTW I never faced windows memory leaks which were caused not by the user level programs, but the windows core itself.

Blenders undo is limited exactly for that reason, but might be worth checking how many undo levels you have. Preferences -> System -> Memory and Limits. Try dialing it back to 1 and see how you go?

No, setting undo_steps=2 (it's minimal value the UI allows to set), and even disabling 'Global undo' (use_global_undo=False) flag changes nothing.
Hope, that it would be enough to just reload the file with something like bpy.ops.wm.revert_mainfile(), and not to restart the process completely. Assuming that I'm inside the Operator.execute() myself :-)

It seems that there is no reliable way to clean the scene up without reloading the .blend file.
So, I ended up with this approach. It's not a trivial task as well, but it works, though.
if someone will find it interesting, the code is in this answer.


text:
Deform the mesh by armature located aside the mesh
Can i deform the mesh by armature located aside the mesh?
I spent several experiments with origin but i noticed that it does not affect the way that I expected. Mesh follow up the bone but relative to the center of selected bone. If push the mesh to armature it's seems right. But i need make they apart

Not exactly what you asked, but this could achieve a similar effect: set two identical armatures, one inside the object performing the deform, one "external"  (aside) driving the deform, each internal bone connected to its external peer through copy rotation constraints...

example file:


text:
Apply a different material to every face
I just wanted to know if it was possible to apply a different material to every face. So if a model has 200 faces there is 200 materials. I could do this the manual way but I would rather not.
Thanks for the help

So you have 200 different materials and you want to assign them? Random?

Yeah, that’s fine as long as each face has its own material

It should be possible, but if not manually, you'll need a python script to automate this task.But you added the "texturing" tag, so if you just wish to set a different texture to each face, you could do this with a "simple" UVmap.

Any idea how I can achieve that? Link would help as well

see my updated comment above, but to learn scripting, start here https://docs.blender.org/manual/en/dev/advanced/scripting/index.html, then see also https://wiki.blender.org/index.php/Dev:Py/Scripts/Cookbook/Materials/Multiple_Materials

This answer creates a material for every face.


text:
Movie clip repeat
I'm using a movie clip node in the scene node settings. I'd like this to loop, but I've yet to figure out how to accomplish this. Could somebody please give me a hand?

I guess a "movie clip" node can't be looped, sadly. Depending on your needs, you could revert to use a "movie" texture, which can be set as "cyclic", maybe?

@m.ardito I've been unable to add a image/movie texture node into the scene settings at all. Perhaps this would solve the problem, but it seems to be impossible.

As I said in comments, it could much depend on your needs, since "in the scene node settings" doesn't say a lot on what you're trying to do, but to use a video/movie texture in nodes you can use a setup like this in compositing nodes, for example:

I've highlighted relevant settings in the image above.
Of course you'll need to add to this simple node setup other

I didn't even know about this node! Thank you so much! :-)


text:
Physically correct water material
I'm making some water effects currently, but I'm running into a persistent question—what exactly would be the material setups, index of refraction, etc., to get truly physically correct water—be it fresh, salty, or otherwise polluted?

The Principled BSDF node is "physically accurate"...

It depends on what kind of water you're modeling. Principled is fine if you've got an opaque water with small displacement. If you're water is translucent, then you need to take into account the lengths of light paths through the water, possibly through Volume Absorption or Volume Scatter. Remember that principled only models surfaces, not volumes. If you have variable depth water than you have to account for that, most visible in breaking waves or curls. If the water is mixed, say at the outlet of a freshwater river into a sea, then you'll need textures to control the mix

That's a big question. I don't have a complete answer, but I can answer for some parameters. I've made this answer a Community Wiki, so maybe others can fill in more.
Index of Refraction
The index of refraction (IOR) of Water doesn't vary much. It's approximately 1.333. This scubageek article references a table from "L. W. Tilton and J. K. Taylor, J. Res. Nat. Bur. Stand., 20, 419 (RP1085) 1938.":
Table 1: Index of refraction of water as a
function of wave length and water temperature.
----------------------------------------------
  Wave Length
   (Angstroms)   T=10 C   T=20 C   T=30 C

      7065      1.3307   1.3300   1.3290
      5893      1.3337   1.3330   1.3319
      5016      1.3371   1.3364   1.3353
      4047      1.3435   1.3427   1.3417

It also references a table from "E. Dorsey, "Properties of Ordinary Water-Substance", (Reinhold Publishing Corporation 1940)." to show that the Index of Refraction doesn't change too much based on salinity. In the table below, they refer to the index of refraction as n(w):
Table 2. Changes in index of refraction due to salinity
--------------------------------------------------------
salinity
(gm/kg)     increase in n(w)          example
--------------------------------------------------------
   5            0.00097           northern Baltic Sea
  10            0.00194
  15            0.00290
  20            0.00386           bight of Biafra
  25            0.00482
  30            0.00577
  35            0.00673           Atlantic surface
  40            0.00769           northern Red Sea

Since our base value is ~1.33, an increase of 0.007 is a relatively small change. I suspect it would be noticeable if high-salinity water was in the process of mixing with low-salinity water, but it's probably too small to notice a difference if all the water has the same salinity.
Scattering
The appearance of an underwater environment is significantly affected by how light reflects off tiny particles in the water. Light tends to hit these particles and scatter off in different directions. If light scattered evenly in all directions, that would be referred to as isotropic scattering. However, light in water doesn't scatter evenly in all directions, so the term for that is anisotropic scattering.
Principled Volume Shaders, added in Blender 2.80, use Henyey-Greenstein scattering anisotropy. The Henyey-Greenstein function basically describes what proportion of light goes in each direction. It gives you a parameter you can adjust to make it kinda match different materials. -1 would be back-scattering, 0 would be isotropic scattering, and 1 would be forward scattering. As oceanoptics describes, the Henyey-Greenstein is an imperfect approximation for water scattering, especially at very large or very small angles, but a value of 0.924 looks reasonable.
This does vary based on what's in the water. There's also a question as to what color this should be.
Absorption
I'm not sure how to translate this into density / color, but this graph from p.454 of "Optical propagation in linear media: atmospheric gases and particles, solid-state components, and water" (2006) by Michael E. Thomas on light penetration of seawater illustrates the absorption of various wavelengths of light. It can be handy to view with a map of wavelength to color beside it, so I grabbed a copy of the Linear Visible Spectrum from Wikipedia.


text:
Red highlight in Material shading mode?
So, when I go into the Material shading mode in Cycles, everything seems to have this strange red light shining on it from below (relative to the view, of course). Does anybody have an idea as to why this is? [EDIT added photo.]

In my default scene with cycles, there isn't any colored light. Add additional info/screenshot. It may be a material, texture, light, world illumination, matcap or OpenGL setting which changes the color.

Are you sure that there isn't some red light in your scene? (Alt H to unhide everything on the current layer.)

Positive. It happens in practically every scene I have. I even appended some models into a completely fresh file and it still appeared. I removed the HDRi, everything I could think of.

Check your prefs in the systems tab. This is just the default viewport lighting. You can change it. It does not effect your renderings.


text:
Sparkly particles
I'm currently working on a number of almost ethereal object, and I'd like them to emit a number of sparkly, glittery particles (almost like pixie dust, best example I can think of). I'd like them to have a bit of some "star" lines coming from them—this perhaps could be achieved by making the particles brighter in certain areas?
Sort of a combination of what appears in these two images:

How exactly would I go about doing this? Billboards, or object particles, what sorts of materials, etc.?
(Note: this should work with the glare node on "fog glow")

Please provide image/animation example.

Added reference images.

Edited to provide differences from linked question.

Utilize chosen method from provided link and add to it this one: https://blender.stackexchange.com/questions/97873/separate-compositor-glare Glare Node > Streaks in Compositing. I'm sure there are plenty of resources about it.

I accidentally referred to the "bloom node" in my description. I fixed and clarified what I meant.

Those methods are working with Fog Glow. My answer is even using it on the gifs there.


text:
How to make a usable walkcycle
I'm trying to make a walk cycle on a character, but there's a problem. When I loop the walkcycle, the steps kind of ease in and out, making the feet slide even when the character is moving at a constant speed.
Could somebody please point out how to fix this issue? Is there a process to create a walkcycle that ensures that the feet move at a constant speed while they're on the ground?
EDIT This is different from the "duplicate" question in that I am not looking for a general answer on how to make a movement be steady, but specifically how to work with a walk cycle.

I think you're problem is related to the relationship between the first and last position of the cycle.  Did you copy the first position's key frames to the last position?

If you are trying to do a basic walk cycle, a good tutorial to start with is https://www.youtube.com/watch?v=gFf5eGCjUUg

Related

@MartyFouts If I understand you aright, then yes.


text:
Making a material that does not reflect HDR
I'm trying to make a glossy, reflective material that will reflect other objects, (preferably with the Principled shader), but I'd like it if it did not reflect the HDR I'm using to light the scene.
Could somebody please tell me how to achieve this?
EDIT To be more specific, in this scene I'm using the lighting method described here, and I'm trying to have the HDR that's lighting the scene be the one not reflected by the material.

If the HDR is lighting the scene, it reflects off all the surfaces. Do you want the HDR to be visible only for diffuse surfaces and be invisible for glossy surfaces? This you can do with the Light Path node.

@JaroslavJerrynoNovotny I'd like it to be invisible only for one single material, if possible. The light of the HDR bouncing off of other objects should be reflected so that those objects can be seen in the reflection, but the HDR itself should not.

This maybe will be added at some point but without writing a python script I'm pretty sure this isn't possible as of 2.9.3. In almost every situation you will be anyway wanting to change it in the world shader type, if you start modifying these values for every object individually then things will be looking incorrect. So in some way this is a safeguard. It probably out of exactly that reason will never be added.


text:
Watching an animation as it renders?
I'm rendering an animation (as an FFmpeg video, Quicktime container) and I'd like to watch it (in its rendered state) as it's being rendered, similarly to how you can play an animation while baking a fluid simulation.
Is there any way to do this in Blender?

I haven't found a way to watch the animation as it renders, but you may be able to play the animation from the viewport.  Go to the timeline, and there should be a play button at the bottom.  Additionally, the UV editor shows each frame so that you can see what they look like rendered.

I clarified the question—I'd like to watch the rendered version of the animation as it is rendered.
(Additionally, it doesn't seem to be possible to play the animation in the viewport during a render. Assuming I'm correct, I'd recommend removing that part of the answer to avoid potential downvotes. :-) )


text:
row.operator() pass an argument to the called function
I had this working for Blender 2.x long ago but I'm unable to get that old script to work in 3.x and 4.x.
All I want to do is create a panel with buttons. The buttons, when clicked, do execute the same function but with different ('hardcoded') parameters.
How it worked for 2.x:
class MyPanel(bpy.types.Panel):
    bl_idname = 'VIEW3D_PT_MyPanel'
    bl_label = "MyPanel"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

    def draw(self, context):
        layout = self.layout
        ob = context.object
        row = layout.row()
        row.operator("vhsl.selectbygroupname", text = 'sel. group 1').param = 'tngrp1'
        row.operator("vhsl.selectbygroupname", text = 'sel. group 2').param = 'tngrp2'
        row.operator("vhsl.selectbygroupname", text = 'sel. group 3').param = 'tngrp3'

class OpSelectByGroupName(bpy.types.Operator):
    bl_idname = "vhsl.selectbygroupname"
    bl_label = "Select by Group name"
    param = bpy.props.StringProperty()
    def execute(self, context):
        print('Button OpSelectByGroupName clicked')
        bpy.ops.object.mode_set(mode="EDIT")
        bpy.ops.mesh.select_all(action = 'DESELECT') #Deselecting all
        bpy.ops.object.vertex_group_set_active(group=self.param)
        bpy.ops.object.vertex_group_select()
        return {'FINISHED'}

When executed in 3.x or 4.x it results in:
AttributeError: 'VHSL_OT_selectbygroupname' object has no attribute 'param'

Does this answer your question? Can´t see the inputs in dialog box- blender 2.93


text:
I can't access my Blend file. There's an error that reads "failed to read blend file - missing DNA block"
Blender randomly quit while I was working. I tried to re-open my file and I can't. There's an error message displayed indicating "missing DNA block" and it can't read the file. I'm new to Blender. Is this fixable? Is there a way to prevent it?

See if File > Recover > Autosave allows you to load a recent version. - This will depend how you have Edit > Preferences > Save & Load > Auto-Save set up of course... Mine's set to 1 minute so I wouldn't lose much if I ever has a crash.

That worked. Thanks!

@JohnEason Is there a way to save a backup of the backup? Like how you can keep 2 older version when saving manually? I've had a couple instances where even the autosave file was corrupted. It's rare but it happens

Not automatically to my knowledge, but if the backup was corrupted, surely a backup of that would be corrupted too?

@Philadelphia_Collins83 I've never heard of an error like that so I'm not sure how you could prevent it if you don't know what's caused it in the first place!


text:
Why is there a white or black border when I import an image?
I'm trying to create a newspaper in Blender. I've already created the image in Illustrator and tried importing it as an image texture. If it's a png, there's a black border. If it's a jpeg, there's a white border. There is no border in my Illustrator file. I also tried extending the newspaper background over the edge of the canvas in Illustrator to ensure there would be no empty space but it makes no difference. There are a handful of images that I've imported into Blender as image textures within this same project and there were no issues. I'm stuck. Please advise.

I don't know how you created the image, but it seems to me as if there is transparency in it in Illustrator. PNG files can store transparency, but if you do not use the Alpha channel of the texture in Blender, the transparent part will be set to 0, i.e. black. JPG files cannot store transparency, so when you are saving the file the transparent part will be replaced with white in the file itself.

I have a hard time understanding what issue you are getting. One thing I've experienced is to change the Expansion (repeat, clip, etc) from the Image Texture node. The more precise you are on your issue, the greater the chance we can help you.

You're exporting from illustrator in the target format right?

@GordonBrinkmann The background of the Illustrator file, whether exported as a PNG or JPEG, is set to have a transparent background. This has never previously been an issue. For some reason, I'm ending up with a border even though my project within Illustrator extends to the edge of the Artboard.

@Lutzi I apologize if I'm not providing enough information about the problem. I'm very new to Blender. I'll take a look at Expansion.

@Jakemoyo Yes, I'm exporting from Illustrator. So far I've tried exporting as a PNG and a JPEG.

Thank you to everyone that responded. I was able to correct the problem by significantly increasing the size of my artwork beyond the canvas edges within Illustrator.


text:
I'm creating cigarette smoke using Quick Smoke. Is there a way to make the smoke appear more wispy?
I'm trying to create cigarette smoke using Quick Smoke but it looks too much like a cloud of smoke. Is there a way to make it appear more wispy?
*image is a Cycles render using Blender version 4.02.


text:
Why is texture painting not working?
Please advise-
I've watched a few different tutorials for texture painting but I'm not sure what I'm still doing wrong. Texture painting is not working. I'm trying to add an orange/red color over the yellow shape but nothing is happening.

Hello could you please pack your images and share your file so that we can give a try?

I apologize, I'm so new to this that I don't quite know what you're asking for or how to do that. Could you explain? Otherwise I can look up how to pack images and share my file.

Do a File > External Data > Pack Resources, then share your file on https://blend-exchange.com/ (read instructions) or another platform like workupload

Thank you! I'll do that in a bit.

Close the texture you've selected:

Also note that you've enabled the Stabilize Stroke option:

It works now. Thank you!!

Just so I know for future projects- why did I need to close out of the texture I created?

You were just painting black (your texture) on the surface, not the desired color

Got it, thank you!


text:
Cloth repels and glitches through object
So, as I referenced in an earlier question, I made a character with hair made of cloth. I try and animate this hair, and I have managed to pin it in place, and make it look right, but when I start the animation, the cloth seems to almost push away from itself and the head it is attached to. I did not add any force field modifiers, and I am wondering why it won't just lay flat. First it bounces away from everything, and then it hovers a little bit away.
Is there a setting that makes cloth try and hover over other folds of cloth, and/or objects?
I want to figure out how to get the cloth to just sit on her head, without bouncing or constricting or pushing.
Maybe soft body? I don't know the difference between them...

That should be the cloth self collision: if you need it, to avoid the jump, the inital mesh parts are not "in contact"...

....Hmm. The cloth collision and self collision is set to the smallest distance. But it still kinda "floats" away from the object and tends to glitch out and get stuck. Maybe its not pushing its self away, but its pulling itself away? I don't know what setting that would be though.. bounciness? It seems to pull itself together now, and deflate almost, so its not as big. I want it to stay the same shape, but move and wave like cloth. Or like hair that is made of giant pixels :/

try this file... maybe you get some hints

I tried to separate well the unpinned geometry (exagerating a bit but...) and subdivided also the hair so they get a better cloth structure

I'm not sure that helped.... It was interesting, but my goal to to get the hair to connect to the head, but not bounce off.
... Mostly, It needs to act the same as if it were just clothes. Almost like a dress or a skirt even, the cloth hanging down and swishing, or swirling then the object moves, and not be perpetually pushing away from itself and glitching out.

I think the problem is the vertex groups on the hair because when I remove all but the "hairtop" (which is used for pinning ) then the simulation works fine.
But then the hair doesnt follow the armature...

Hmm, that might be it. The cloth is made from another rig that I used as a basis, so I'll try that out.


text:
Move rigid body gear using particles
So I was trying to make a particle simulation where the particles collide with a fixed gear that rotates when the particles collide with it.
The gear

As you can see I have locked the locations of the gear and limited the rotation to the Y axis only in the transform locks in the object settings, I also added rigid body active and collide physics to it (collide because I need the particle system to collide with it).
Without the particle system

The cubes are active rigid body objects that also have the same transformation lock settings as the gear, and the groundfloor is a passive rigid body. In this case we can clearly see that the gear rotates when colliding with the cubes
Now with the particle system

I added a plane and added a particle system to with the particles set to object (Cube), as you can see the particles surely collides with the gear but the gear doesnt rotate like it did previously when the same thing was done with cubes.
So how do I make the particles collide and rotate/move a rigid body object ?

Possible duplicate of Is there a way to make particles behave like rigid body objects?

No, this question provides the solution as copying the properties to other rigid bodies or making the duplicated rigid bodies real. My question was to make the particle system MOVE the rigid body gear.

One answerer does stipulate they tried exhaustively to make particles react with rigid bodies directly.  As a workaround dropping the particles over the animation produced by rigid bodies could probably look ok.?  A request, could you post your blend please

I was just looking into this over the weekend. I believe a recent tutorial on Vit Prochazka's youtube channel has the answer you seek. I'd love to try and explain it here, bit it is quite convoluted and it requires the Animation Nodes add-on.
Seems an elegant solution though, I hope it helps:
https://www.youtube.com/watch?v=G1ysjPeLKSQ&t

Sure it's not just an animation nodes way to set up the "without the particle system" as shown in question?

The tutorial I linked shows how to use a particle emitter to emit rigid bodies... which I thought was the aim. Apologies if I have led you astray, but it does use the particle emitter (but the physics from the rigid bodies world). Cheers!

Strictly speaking it is just an animation nodes way to set up "without the particle system" except that it allows the rigid body objects to be emitted throughout the animation - rather than all having to exist on the start frame as shown in the question. That said, it would be better if the answer could include details of the steps needed to set this up rather than effectively being just a link answer.

Maybe, although I think it would just be trying to re-invent the wheel in this case... to write this process out here would be very lengthy and very time consuming, and the link provides all the info effectively. If someone wants to take a few hours to write it out, feel free. Or, just click the link... I'm sure you won't break a finger or anything in doing so.


text:
Draw a 2d box using Bgl in viewport
I have been trying read up a lot on opengl drawing using python and have been trying to create a script which display a text and a 2d shape on the viewport (a rectangle or square). From reading the blender docs I could only find little to no information about it and only got me to display text. The 2d shape drawing is still out of my knowledge. In this code I'm trying to draw a text and a draw a 2d quad in a modal operator but unfortunately the quad doesn't show up but the text is working properly.
How do I draw a 2d shape in a modal operator using bgl ?
import bpy
import blf
import bgl

def draw_textandbox(self, context):

    font_id = 0
    x_offset = 0
    y_offset = 0

    #The Text-------------------------
    bgl.glColor4f(1,1,1,0.8)
    blf.position(font_id, 80, 500, 0)
    blf.size(font_id, 27, 70)
    blf.draw(font_id, "LEVELS:" )

    #The Box, This is the part i wanted to work but unfortunately it doesnt
    bgl.glColor4f(1,0,0,0.8)
    bgl.glBegin(bgl.GL_QUADS)

    bgl.glVertex2f(200, 400)
    bgl.glEnd()

So I looked up on samblers example script in the question that batfinger linked, and I worked something out, It would seem that using bg.GL_POLYGON is better than using bl.GL_QUADS because you can add as much as vertices as you want. Nevertheless, it got my job done done of drawing a 2d rectangle/square.
def draw_poly(points):
  for i in range(len(points)):
        bgl.glVertex2f(points[i][0],points[i][1])

def draw_callback_px(self, context):
  panel_points = [[10.0, 550.0],  #[x, y]
                  [10.0, 685.0],  #[x, y]
                  [150.0, 685.0], #[x, y]
                  [150.0, 550.0], #[x, y]
                  ]

  # draw poly
  bgl.glColor4f(1.0, 0.085, 0.0, 0.2)
  bgl.glEnable(bgl.GL_BLEND)
  bgl.glBegin(bgl.GL_POLYGON)
  draw_poly(panel_points)
  bgl.glEnd()

  # restore opengl defaults
  bgl.glLineWidth(1)
  bgl.glDisable(bgl.GL_BLEND)
  bgl.glColor4f(0.0, 0.0, 0.0, 1.0)

It's a quadrilateral, you need to define 4 verts.
Test method, x and y are pixel coordinates of bottom left corner of rectangle, h and w the height and width (in pixels) respectively.
def draw_box(self, x, y, w, h, color=(0.0, 0.0, 0.0, 1.0)):
    #bgl.glDepthRange (0.1, 1.0)
    bgl.glColor4f(*color)
    bgl.glBegin(bgl.GL_QUADS)

    bgl.glVertex2f(x + w, y + h)
    bgl.glVertex2f(x, y + h)
    bgl.glVertex2f(x, y)
    bgl.glVertex2f(x + w, y)
    bgl.glEnd()

Run-able Example

So the x, y, w, and h are vertex coordinates ?

Note that repeated calls to draw_box() to draw multiple quads in one frame is inefficient. It'll be better to add more calls to glVertex2f() between the glBegin() and glEnd() calls.

@dr.Sybren any news on bgl support (or its repacement) in 2.8

@batfinger I wouldn't know yet.

@Retrax Example

It seems that due to 2.8 api changes the bgl module was kinda depreciated...? Here's an updated solution for the 2.83 that uses the new gpu module instead of bgl
https://docs.blender.org/api/blender2.8/gpu.html?highlight=gpu#module-gpu
import bpy
import gpu
from gpu_extras.batch import batch_for_shader

vertices = (
    (100, 100), (300, 100),
    (100, 200), (300, 200))

indices = (
    (0, 1, 2), (2, 1, 3))

shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)

def draw():
    shader.bind()
    shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
    batch.draw(shader)

bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')


text:
Is there any way to move/deform procedural work along a mesh as a normal texture would?
I made a head and colored it proceduraly. Now I want to deform and move it, but the procedural work won't "follow" the mesh as a UV texture would. Is there any way to do it?
I don't work with scripts, so I would like a solution as "code-ignorant friendly" as possible, if possible.
By the way, it's all made with color ramps, math nodes, texture cords, mapping and (of course) procedural textures, and I don't want to bake anything (personal project). Guess this info may help.
Maybe constraints may work in some way, I guess. Didn't try it out yet though

Please ignore the left eye, I am still trying to figure out how to work with array mod alongside procedurals.
Nodes setup:

I am essentially using mappings set to texture to control where transitions made by the color ramps may occour and using it as mask to determine where each separated material will appear or how it will blend to the other materials. Nothing fancy.
Important

I missed essential info before, the mesh in the "moved example" was transformed with lattice mod! I moved the mesh down just a little bit so I had no noticeable clue that could make me logically suspect the lattice, then proceeded to ask for help without further investigation.
  Through these 3 days I learned about coordinate spaces and understood further the texture coordinate node. Procedurals works with coordinates originated on something's origin, in this case the mesh's origin. That's the reason they don't deform with the mesh, but move with the coordinates.
Also, this was my first time working with procedurals on this scale and manner, I didn't know the procedural work, with the presented nodes setup, was expected to behave perfectly as a UV texture as long as there's no deform on the mesh, only moves and rotation. And I didn't know about coordinate spaces yet. Then I realized that's the reason my question has no answers yet even tough it's "simple", maybe it's because everyone was thinking it was an issue they never saw, since they didn't know about the lattice.

Just bear with me, I am still a newbie afterall. Hehehe...
I just answered my question right now, there's no issue anymore, but you can still enlighten us more if you want

Welcome to the site. A few things, dont take it personally that I edit your post, like you said "let's cut to the chase," that is what we want in questions, just the necessary information to formulate a good clear question. Please add what texture coordinates you are using (a picture of the nodes might be good). Last SE has a reputation requirement for everything because is is a system of trust. No offense but when a new user comes here SE does not know if they are a spam bot, a troll, or a great new user.

Noooooo my smileys... you added new tags though, very appreciated. I have no idea how to reply yet so I just added another comment. As I thought! The nodes setup might be necessary, not even know why I didn't include them. New pics comming soon

@Vinis To reply, just type "@" and then the person's name!

@10Replies Tnx mate

Your images are too small its hard to see understand anything about your node setup. Anyway I bet it is all caused by procedural textures using the Object Texture Coordinates. Since deforming an object only moves it in Local Space, not World Space the textures won't "move along with it". For this sort of work it is most common to use UV Texture Coordinates and not so much procedural ones. You would probably be advised to unwrap your mesh and use UV coordinates instead for your textures, since they are per-vertex and stick with your mesh as it deforms.

@DuarteFarrajotaRamos How did you see the Texture Cords there? Kidding. It's really small but that's as big as I can make the image to fit the file size limit. There's already a ignored group, maybe if I ignore another group I can make the image bigger, they have essentially the same stuff going on anyways... Thanks for the tips, gotta test it out right now

@Vinis hay glad to see you got this figured out. Now, instead of editing your question and explaining what you did to solve it, post an answer. This is exactly what answer are for, so the question and the answer(s) can be separate. PS it is perfectly ok to answer your own question.

@David Yep, I thought it was considered a lame way to get points here. Thanks for clarifying. I even thought about answering, but it isn't really an answer...

Hi, feed your procedural textures with UV coords. You won't be able to have 3d procedural textures, only 2d, but the texture will follow deformations.

It was the lattice!
As you probably know, procedurals need some coordinate space to originate, and it can be something's origin or the world's point zero. In this case the nodes setup could generate a perfectly fine texture that could move along with the mesh as a UV, but since procedurals aren't really a texture but a "projection" (can't think of a better definition) they move with the mesh's coordinates, but not with the vertexes. And this means that as long there's no deformation on the mesh everything is fine... But the lattice was deforming the mesh...
Hope you find it useful if you're started on procedurals. For this, coordinate spaces are really important. I came up with a metaphor about it:
Think of procedurals as a beam of light made of x-rays that need something else's origin as it's emitter. As it reaches the mesh's surface, it illuminate the surface the way it wants then go right through the object and keep going, because it's x-ray. Changing the surface won't change the beam of light


text:
How to combine Meshes created with python
I have a "good practice" question. I am importing multiple meshes as Mesh objects with python. Before assigning them to an object and linking them to a scene, I would like to join certain meshes.
The only way I find to do this is to create objects, select them and then join them.
Is there a way to join the meshes without making them into objects?
Thanks a lot.
(Edit: Sadly I can't use bmesh for this operation, because i'm using custom split normals)

Can you alter the importer code?

yes because I am writing the importer.

in which case, can you append each mesh to previous while importing?  . can you elaborate somewhat on what data you are importing from, are you importing each seperately, do they share the same local coords?

Yes, that is excactly the question. How can I append the mesh to another mesh without creating actual object datablocks or using bmesh (loss of custom vertex normals)?
I am importing a custom data format (so i import all the meshes together) and I want to merge specific meshes to a single mesh datablock and only then create an object and link it to the scene. they share the coords // I am looking for something like the bmesh option answer below. just with mesh. i don't want to append the vertex and polygon sets)

Even using TLousky's bmesh solution, you have your custom normals from the import data, reassign them after join. Your q implies to me you know what meshes you want to join on import, ie you are importing multiple meshes at once from one or more files.  Your comment implies you are using from_pydata in your importer, in which case why not append (after offsetting index) the vert and polygon lists (and custom normals etc) at this stage if you know those two meshes are to be joined.

You can use the bmesh module to do this. You start with creating a new, empty bmesh object with bm = bmesh.new(), then every time you want to add a mesh to this bmesh, you can use bm.from_mesh( mesh ):
import bpy, bmesh

# Reference to existing meshes, replace these with your code generated meshes
m1 = bpy.data.meshes[0]
m2 = bpy.data.meshes[1]

bm = bmesh.new()

bm.from_mesh( m1 ) # Add mesh 1 to bmesh
bm.from_mesh( m2 ) # Add mesh 2 to bmesh

m3 = bpy.data.meshes.new( "newMesh" )
bm.to_mesh( m3 )

o = bpy.data.objects.new( "new", m3 )
bpy.context.scene.objects.link( o )

That would be really great, but sadly I can't use bmesh since I am using custom split vertex normals. Thanks a lot for your answer though! i hope it will help someone else too


text:
How to save an .exr file with 32 bit with python
I'd like to create a picture in blender and save it as a 32 bit exr.
import bpy

# in case of re-runnign this code,
# get the old 'foo' image out of the way
if 'foo' in bpy.data.images:
    bpy.data.images['foo'].name='bar'

#create an HDR image with name 'foo'
bpy.ops.image.new(name='foo', width=512, height=512, alpha=False, float=True)

#find the image with name 'foo'
image=bpy.data.images['foo']

# set it up for saving an exr HDR image
image.filepath_raw =  '/tmp/foo.exr'
image.file_format = 'OPEN_EXR'
# TODO here: image.save_as_32_bit=True (instead of 16)

#save image to disc
image.save()

The above code makes 16 bit exr according to imagemagick.
I want to use bpy.ops.image.save_as somehow from python, in conjuction with this code, to emulate the behaviour of Image->Save as Image with the option [Float (Full)] rather than [Float (Half)]
The Save as dialogue points to a thing called ImageFormatSettings. Where can I supply this in python?

Thank you

You can change the color depth like this:
image_settings = bpy.context.scene.render.image_settings
image_settings.file_format = "OPEN_EXR"
image_setting.color_depth = '32'

Note that '32' is a string and not an integer/float.
Then save the image like this:
img = bpy.data.images['myImage'] # your image here
img.save_render("C:\\Users\\daddy\\me\\Documents\\myImage.exr") # save to desination

this does not work for me -> [enum '32' not found in ('8', '16')] also, the question is about how i can save the image with 32 bit, I don't think setting the color depth in the renderer will solve the problem (the image internally is already 32 bit). Please elaborate if i am wrong.

Updated answer. If you use save_render instead of ops, it will use the scene's image settings. The error you got was because it has to be set to EXR before you can access the 32 bit option(my bad).

I always use img.save(), it doesn't work.
Although it could export exr files, it couldn't use imag_settings to set things like bit depth and encodingType, so my data never exceeded [0,1].
I spent a day looking for the official blender documentation, but I couldn't find the relevant function, so this is the solution
set image_settings with the bpy.context.scene.render，and use render_save to export file.
Anyone wants to export exr correctly according to their own requirements, the following code may give you an idea.
image_settings = bpy.context.scene.render.image_settings
    image_settings.file_format = "OPEN_EXR"
    image_settings.color_depth = '32'
    image_settings.compression = 0
    image_settings.exr_codec = "ZIP"
    image_settings.color_management = 'OVERRIDE'
    image_settings.color_mode = 'RGBA'

    Pos_to_RGB_Image1.save_render(filepath=Pos_to_RGB_Image1.filepath_raw)


text:
Modify properties in the .blend file (command line)
I'm writing an application which will display a nice looking 3D model of a building. The building will have some areas which will change their color depending on some data points provided by the application.
The application will invoke blender's command line rendering feature to generate a PNG out of the .blend file, which then can be displayed in the UI.
The point where I'm stuck is how to change some material colors in the .blend file.
All hints are appreciated.

Welcome to the site :) What do you mean by changing colors?

Thank you :). Imagine rendering a room of the building red or green, so the material's color (or some lamp's color) must therefore be changed.

That could be too broad for this site. Material or lamp color? Might be a good idea to split up the question. What render engine are you using? Cycles or Internal?

I think the material color would be the better approach. The rendering engine is not chosen, yet. I can live with any of them.
The only constraint will be that it's automatable.

Changing the color depends on the engine... Anyway, you can run a given python script file via -P option, see the manual

related: http://blender.stackexchange.com/questions/1101/blender-rendering-automation-build-script

The following command line will do the job (-P will run the given python script before rendering):
blender -b OG1.blend  -P ChangeColor.py -o Render.png -f 0

ChangeColor.py:
import bpy

bpy.data.materials["NameOfMaterial"].diffuse_color = (0, 1.0, 0)

The value ranges for the color channels are [0 to 1.0].
Thank you for your help, poor! Blender ist just too awesome! <3


text:
Make particles face outwards of object center?
I created a planet (deformed Ico Sphere) that I added a particle system to. The particles are supposed to be trees, and so they should face the sky (outwards of center). However I am unable to make this happen.
Here is an image showing the problem:

My current rotation settings:

EDIT: To clarify, all trees should face outwards of planet center, like so:

The planet's ground isn't ideally spherical, so particles won't point exactly outwards of object's shape because normals don't. You could try to add another perfect icosphere inside of this one and add trees as particles to it.. but they won't touch ground exactly, sometimes flying in the air.

Unfortunately you are not able to do that simply with particle system, but there is a workround:

Go to Modifier stack, clock Convert button on Particle System panel to convert these particle trees to real duplicates. Then disable the renderability and visibility button, or delete the particle system. (You may want to then deselect the earth, then group all selected trees for easy control in the following steps)
Select one of the trees, add a Track To constraint, set the "earth" as target (or use an empty object that shares the same origin location).
Use Copy Constraints To Selected Objects operation to copy the constraints to all trees. (You can find it in Objects > Constraints menu, or simply search it by hitting specebar).

It's also possible to copy constraints with Object > Constraints > Copy Constraints To Selected Objects menu.

I think you want to use the object/global Z

Edit after your clarification:
If you want to orient towards face the normal, you need first to rotate your object on X axis 90° in edit mode:

Unfortunately that's not the case. As you can see in the picture you provided, trees on the side are facing upwards and they should be facing outwards of center (to the left or right respectively)

But they are rotated towards the face normal. And i need them to be rotated outwards of object center. The sphere is deformed and so the normal doesn't face that way like yours do. link

Then Mr Zak solution it's a viable option. Otherwise you can convert the particle system and add a trackTo constraint to every instance (apply to 1 then copy constraint) and make it track a distant object. Adjusting the influence will blend between the face-normal and the global-Z


text:
Why did my cursor change to a circle?
My cursor switched to a circle and I don’t know how to switch it back. Now I can’t select any objects except for where the orange dot is located. How can I fix this?

Hey, I believe you mistakenly pressed the C key, which is used to select vertex or deselect them. To remove the circle cursor just press right click on your mouse or return.

Press W to alternate between selection types.

Pressing W activates the selection tool and toggles selection mode after it is active, not types of cursors. Could you clarify that in your answer

Or maybe Circle Tool has been permanently activated.

To deactivate the selecting tool, right click on your mouse or press Return or ESC.

This will not work if the Select tool was accidentally switched to Select Circle by pressing W, which is most likely the case here. Pressing W multiple times will go through all different Select modes, but after the default Select Box, the Select Circle tool is the first to come up when you press W just once.


text:
Why is it a struggle to zoom into smaller objects?
I just shrunk a few objects to their actual real-life size- two donuts and a countertop. The screen isn't frozen and everything else seems to work just fine. I can zoom in or pan around the large objects. But now I struggle to zoom in or pan around the small objects. What happened? Is there a way to fix this or avoid it in the future?

Given the accepted answer, I'm guessing this wasn't the issue, but I've found that the absolute size (that is, the size in "blender units" as opposed to "physical units") of objects can be problematic if it is very large or very small. It's possible to change the absolute size in Scene Properties ⇒ Units ⇒ Unit Scale.

Thank you for your comment! I'm totally new to this and I'm adding your comment to my notes.

I can think of a few possibilities: Possibly the origin of your small objects is not centered. Go to Object > Set Origin > Center of Mass. Or you are locked in Camera to View (which can cause zoom issues).
Press NumPad 0 to toggle in/out of the camera.
Or your navigation preferences are limited.
Go to Edit > Preferences > Navigation and try these settings:

You can zoom by holding Ctrl+MMB and drag. This is a more accurate way to zoom.

Thank you! I'll try that.


text:
I baked the data for my smoke simulation but the smoke isn't showing up in the viewpart or render. BUT I think the data baked correctly?
I baked the data for my smoke simulation but the smoke isn't showing up. However, the domain appears small and constrained around the dissolve object at the beginning (image 1). After I press play, the domain expands which tells me the data baked correctly (image 2). Images 3 & 4 show the principled volume shaders used for both the domain and dissolve object as recommended by the tutorial I followed. What information am I missing? Why isn't the smoke showing up?
I'm very new to Blender. So I would also appreciate any suggestions of tutorials to look up that would help with this issue.

Delete those cubes and domains you have, make a new simple shape you want the smoke to emit from, press the spacebar and use quick smoke, which should get you started.

Thank you! That works so much better.