text:
Update all materials, but keep their color and textures
I am working with a very large scene file that was imported as .obj. This gave me basic blender internal materials with colors and textures. I then used an addon to convert all of the BI materials to Cycles ones (https://blenderartists.org/forum/showthread.php?394600-Materials-Specials-amp-conversion)
What I have now is every material is a Diffuse Node with a color, or with an image texture node hooked up to it with the appropriate texture.
What I would like to do now is make a more complex node setup (likely in a group), and then copy it to all the objects in the file, but have them keep their own diffuse color and texture.
Are there any existing addons or scripts that can do this?

Sorry late to the party but I had a related question yesterday and I think this solves your issue.
This approach is based on this great answer  as well as this great answer (thanks to @zeffii and @p2or). It's a simple operator, you can either install it like an Add-on or paste and run it in blenders text editor per session.

Select all desired objects in the '3d View' (allows to limit the selection)
In the 'Node Editor' select that Material Node, you'd like to replace
From the header menu, select Node > Switch Shader Node
Select your desired Node Type from the list

SwitchShaderNode.py
# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

bl_info = {
    "name": "Switch Shader Node Type",
    "author": "brockmann",
    "description": "Switch active shader node within all shaders of selected objects",
    "version": (0, 0, 1),
    "blender": (2, 90, 0),
    "category": "Node"
}

import bpy
import itertools
from bpy.props import EnumProperty
from bpy.types import Operator

# ------------------------------------------------------------------------
#   Replace the node (by zeffii and p2or)
#   based on https://blender.stackexchange.com/q/42306/3710
# ------------------------------------------------------------------------

def replace_node(node, new_node_type):
    node_tree = node.id_data
    props_to_copy = 'name location height width'.split(' ')

    reconnections = []
    mappings = itertools.chain.from_iterable([node.inputs, node.outputs])
    for i in (i for i in mappings if i.is_linked):
        for L in i.links:
            reconnections.append([L.from_socket.path_from_id(), L.to_socket.path_from_id()])
    props = {j: getattr(node, j) for j in props_to_copy}

    # get first color attribute
    if hasattr(node, "inputs"):
        for socket_input in node.inputs:
            if socket_input.type == 'RGBA':
                clr = socket_input.default_value
                break

    ids = ([node.bl_rna.identifier for node in bpy.types.ShaderNode.__subclasses__()])
    if new_node_type not in ids:
        new_node = node_tree.nodes.new("ShaderNodeGroup")
        new_node.node_tree = bpy.data.node_groups[new_node_type]
    else:
        new_node = node_tree.nodes.new(type=new_node_type)

    for prop in props_to_copy:
        setattr(new_node, prop, props[prop])

    # set first color attribute
    if hasattr(new_node, "inputs"):
        for new_socket_input in new_node.inputs:
            if new_socket_input.type == 'RGBA':
                #setattr(new_socket_input, "default_value", clr)
                new_socket_input.default_value = clr
                break

    nodes = node_tree.nodes
    temp_name = node.name
    nodes.remove(node)
    new_node.name = new_node_type

    reconnections_new = []
    for i in reconnections:
        reconnections_new.append([s.replace(temp_name, new_node.name) for s in i])

    for str_from, str_to in reconnections_new:
        try:
            node_tree.links.new(eval(str_from), eval(str_to))
        except:
            pass

    node_tree.nodes.active = new_node

# ------------------------------------------------------------------------
#   Search Popup Operator
#   based on https://blender.stackexchange.com/a/45069/3710
# ------------------------------------------------------------------------

def shader_node_callback(scene, context):
    names = ([node.bl_rna.name for node in bpy.types.ShaderNode.__subclasses__()])
    ids = ([node.bl_rna.identifier for node in bpy.types.ShaderNode.__subclasses__()])
    d = dict(zip(ids,names))
    for i in bpy.data.node_groups: d.update({i.name:i.name})
    return [(key, val, "") for key, val in d.items()]

class NODE_OT_switchShaderNode(Operator):
    """Switch Shader Node for all Objects in Selection"""
    bl_idname = "node.switch_shader_node"
    bl_label = "Switch Shader Node (Selected Objects)"
    bl_property = "shader_node_selection"
    bl_options = {'REGISTER', 'UNDO'}
    #bl_property = "shader_node_selection"

    shader_node_selection: EnumProperty(
        name="Switch Shader Node",
        description="",
        items=shader_node_callback)

    @classmethod
    def poll(cls, context):
        space = context.space_data
        return space.type == 'NODE_EDITOR'

    def execute(self, context):
        space = context.space_data
        node_active = context.active_node.type
        node_selected = context.selected_nodes

        if not (len(node_selected) == 1) and node_active:
            self.report({'ERROR'}, "1 node must be selected")
            return {'FINISHED'}

        rel_mats = []
        for o in context.selected_objects:
            if o.type not in ["EMPTY", "LAMP", "SPEAKER", "CAMERA"]:
                for m in o.material_slots:
                    rel_mats.append(m.material)

        replaced_nodes = []
        for i in rel_mats:
            nodes = i.node_tree.nodes
            for n in nodes:
                if n.type == node_active:
                    replace_node(n, self.shader_node_selection)
                    replaced_nodes.append(i.name)

        out = [node_active, self.shader_node_selection, len(replaced_nodes)]
        out_str = "Replaced {0} by {1} for {2} Materials".format(out[0], out[1], out[2])
        self.report({'INFO'}, (out_str))
        return {'FINISHED'}

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

        return {'FINISHED'}

def draw_switch_op(self, context):
    layout = self.layout
    layout.separator()
    layout.operator(SwitchShaderNodeOperator.bl_idname, icon='AUTO')

# ------------------------------------------------------------------------
#   Register
# ------------------------------------------------------------------------

def register():
    bpy.utils.register_class(NODE_OT_switchShaderNode)
    bpy.types.NODE_MT_node.append(draw_switch_op)

def unregister():
    bpy.utils.unregister_class(NODE_OT_switchShaderNode)
    bpy.types.NODE_MT_node.remove(draw_switch_op)

if __name__ == "__main__":
    register()

    # test call
    #bpy.ops.node.switch_shader_node('INVOKE_DEFAULT')

This is great! I just need a way to handle the texture and color preservation and hookup now. It seems the full answer is split across a couple of the answers here.

Ooops, forgot to copy the color... Done. What do you mean by texture preservation? No experience with BI, can you share a test file to play with? Thanks @Drudge

I just mean keeping the texture node (if there is one) and reconnecting it to the color input.

returning to this after a long time, I can confirm that this script works great for switching the selected node type to my Group without breaking connections to Texture nodes. However, it does not carry over the color of the Diffuse node I'm replacing. I need a way to create an RGB node in each material that has a diffuse, have it copy the Diffuse's color, and then hook the RGB to the diffuse. Any ideas?

import bpy
for material in bpy.data.materials:
    if (material.use_nodes):
        nodes = material.node_tree.nodes
        links = material.node_tree.links
        for node in nodes:
            if (node.name=='Material Output'):
                out = node
            elif  (node.name=='Image Texture'):
                img = node
            elif: (node.name=='Diffuse BSDF'):
                diff = node
                # if diffuse node is not linked,then save it's colorvalue
                if not(node.inputs[0].is_linked):
                    color = node.inputs[0].default_value
                else:
                # else we should set color to None, and be aware
                    color = None
            else:
                nodes.remove(node)

        hold = nodes.new('ShaderNodeHoldout')
        geo = nodes.new('ShaderNodeNewGeometry')
        mix = nodes.new('ShaderNodeMixShader')
        RGB = nodes.new('ShaderNodeRGB')
        if (color==None):
            if (img==None):
                #No image and diffuse was not empty, set color to grey
                RGB.outputs[0].default_value = (0.7,0.7,0.7)
                img = RGB
        else:
            RGB.outputs[0].default_value = color
            img = RGB

        links.new(out.inputs[0],mix.outputs[0])
        links.new(mix.inputs[0],geo.outputs[6])
        links.new(mix.inputs[1],diff.outputs[0])
        links.new(mix.inputs[2],hold.outputs[0])
        links.new(diff.inputs[0],img.outputs[0])

This code does almost what you want.
It saves one image texture node, one material output node, and deletes everything else, and then adds emission and holdout node and connects them via backfacing. As for part of your own shader, i think you can save it as a node group and append it into node setup via python too

Do you know how to make it take the color in the diffuse node and make an RGB node that matches it, then hook that to a node group input?

updated code in my answer  a bit

I don't know if that's exactly what do you want, if you have your material already made just:

select all the objects you want to have that material, and select for last the one that has the material.
It should have an orange border, while the other ones should have a red border.
Now press Ctrl + l and click on "materials", and that should do it.

You would need to create a script that looped through each material in the scene. Here's generally what the script should do.
First create your group node with an RGB input.
Then have your script loop through each material in the scene and have it:

Add your new custom group node to the material.
If the material has an image texture, connect the output of the image node into the group node. If the material only has a diffuse node, copy the RGB value from the node, create an RGB node, set the color and then plug it into the group node.
Delete the original Diffuse node.

I don't have time to write out the script right now, but those are the steps that should happen.
If you are really stuck, I could be hired to write this for you.


text:
Cycles Object vector as UV map
Is there any way to bake the Object vector that you get from the Cycles texture coordinate node to UVs so that it can be used for image textures? This would be for Dynamic Paint, or just a quicker or more convenient way to get a clean UV unwrap.
Object texture coordinates do the job well for most of my procedural texturing needs. There are times where I want to use image textures, but getting clean UV unwraps is always a nightmare.

You can surely bake every color information you can get with the node editor by using an emission shader. What I don't get is how you intend to use it (and why you need to bake it). Could you be more precise or set up a quick example?

Dynamic paint bakes to either vertex colors or an image texture using UVs. It needs clean UVs. The quick UV options that are available either cause bad seams that bleed on the texture, or are very distorted on complex objects. I use Object and/or Generated for procedural textures because they are cleaner. It would save a lot of time setting up Dynamic paint if I could use it there as well.

Could you add some precisions to your question ? Pictures for instance. Thanks

this question already has two answers here: http://blender.stackexchange.com/questions/58932/apply-object-texture-coordinates/58945#58945

@aliasguru Thanks. It looks like that does answer it, but ends with the saved coordinates being an image texture, which I assume will eat RAM on render? Is there any way to get this to be a UV map? If you want to make a proper answer to this, I can award you the bounty.

Ahhh now I see where you want to take it. I was about to test the memory consumption during rendering using the posted method, but actually you want an unwrap that replicates what Object Coordinates would give you. Need to think about this in the evening...

After a few tries I have to admit I don't find a solution. The already posted answer (see link above) works, but it does indeed add a memory overhead when rendering. Testing with a 1K baked UV texture, there is additional 13MB showing up in the Viewport render diagnostics. Which isn't too bad, given the fact it is a 32bit tex. I was thinking about then baking those colors into the vertices (which can only be done with Blender Internal), so I can read out the color values, and then place the UVs via Python according to this. But by then, you'll have a clean unwrap anyways, it's kinda pointless.

@aliasguru Thank you for trying! I don't know the proper protocol, but I will need to award this bounty somehow. If you want to make a proper answer saying that, I can give it to you.

I've posted an answer, but please wait the four days, it's possible that someone finally comes up with a working solution. There is some very talented people around here on this site. You can afaik also not award the bounty, then only half of the points are given to an answer, and only if it was upvoted at least twice, see here, 'how is a bounty awarded': http://blender.stackexchange.com/help/bounty

The bottom line is:
This is theoretically impossible
If you think about it, object, generated, mirror (and any other auto-generated texture coordinates) can be as detailed as is necessary -- they are not based on the detail of the mesh. UV maps, on the other hand, are very much related to the detail/design of the mesh object. This is often called comparing apples and oranges :)
That being said, the only way to fake it would be to use a texture (to get much more detail than a mesh, but less than auto-generated coords) as mentioned here. If it would be easy to convert the clean object or generated coordinates into uv-maps, game devs would be using it everyday...but there isn't. So for right now we just need to stick to smart unwrap and our uv seams ; )
Finally, if you're still not convinced, take a look at this mess of auto-generated coordinates...

Here I am mixing three different texture coordinates (generated, window, and reflection) and using the result in the checker texture's vector input. This material is applied to a cube and however you manipulate the uvs, you will never be able to mimic this mapping because these texture coordinates act like textures themselves: the massive amount of warping from the checker texture is only because of the strange texture coordinates. Oh, and about the texture coordinates acting like textures themselves...have you ever tried to apply a texture as the model (I mean a diffuse/albedo/color texture not a displacement map)?
Yet another reason as to why this would not be feasible or even desirable is that the texture coordinates, excluding uvs, are all volumetric while the uvs are two-dimensional. Therefore, as soon as you "converted" to uvs you would have lost the most important benefit that the object texture coordinate gives you: flexibility.
I hope this helps to clear up your question effectively.

Good to know. Can you explain a bit more of what's going on in this image, and how it relates?

@Drudge I've updated my answer...I hope that clears it up for you.

BTW this is why you can't use uv mapping for volumetrics : )

After a few tries I have to admit I don't find a solution. The already posted answer here Apply Object Texture Coordinates works, but it does indeed add a memory overhead when rendering. Testing with a 1K baked UV texture, there is additional 13MB showing up in the Viewport render diagnostics. Which isn't too bad, given the fact it is a 32bit Texture.
I was then thinking about baking those colors into the vertices (which can only be done with Blender Internal), so I can read out the color values, and then place the UVs via Python according to this. But by then, you'll have a clean unwrap anyways, it's kinda pointless. Maybe someone else has a better idea?

source: Stack Exchange

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

sort: votes


text:
Flatten shading on cylinder

This image shows two of the same curve, one beveled into a cylinder, and one extruded into a flat plane. The material is a Diffuse mixed with glossy at .1 fac.
The top cylinder gets a strong highlight down its length and visible shadows at the glancing edges due to it's curve. The flat one's gloss is much more spread out due to it being flat.
What i want is to render shading like the flat strand, but on the cylinder. It seems this should be possible with some sort of normal changing or the like? I want the effect of the flat ribbon, but if I actually use flat ribbons then they disappear at certain angles, whereas the cylinder always has the same thickness.
If I were working directly with the mesh, then I'd scale it on the view axis till it was flat. Can something like this be done to the normals within the material?
UPDATE:
Here's a picture showing the difference better. This is just the gloss, and I bent the bottom ribbon more to emphasize the difference.

The ribbon gets full lighting on it's whole surface because it is flat. The cylinder is less lit at glancing angles. I want to get the same sort of shading on the cylinder that I have on the ribbon.

This is gloss only with Incoming plugged into the normal socket. It is flattening things out, but has also fundamentally changed how the shading is working.

How about a shadeless material? (Specify your renderer btw)

@Leander shadeless is no good. I do want shading, just a specific sort. Note that the lower curve is not shadeless, it has just ended up looking all one color because it's normals all face in the same direction.

Try plugging the Incoming value from an Input > Geometry node into the Normal input on the shaders.  I think this is what you are going for but I'm not completely sure.

@PGmath I have given that a try, but it does not produce the same effect. I don't know why, as I don't fully understand what Incoming is actually doing, and I can't find a detailed explanation either.

Can you specify a little more what you're going for?  I don't understand why you can't either 1.) use an emission shader or 2.) set roughness on Diffuse to 1.00.

I'm trying to eliminate the shading from the cylinder's curve, not from its bend. I've added a picture showing only the gloss so you can see the difference.

Oh try normalizing the incoming value, that should fix the weird shading.

@PGmath no luck!

Can you upload the blend with your lighting setup?

What you're asking seems impossible to me. According to your second image, you would like reflections to bend only according to the "facing" of the curve. But the cylinder itself is also curving away from the camera on its sides. So how would Blender know if the facing curvature is caused by the bezier curve or the cylinder's sides ?

@ChameleonScales yeah it would somehow need to remove the data based on the curve or something. Hmm. It probably isn't possible.

I believe you are after this shading effect:

It is possible with some vector math on normals. The goal is to change normals to be pointing towards camera, but the Incoming output from Geometry node will override all normals equally, ignoring in which direction the curve is heading. Luckily we can determine the local vector of the tube's direction:
Can I color a curve in Cycles by the direction it's running?
The rest is a matter of 2 vector cross products to get a vector incoming to camera but also orthogonal to the curve's direction:

If you want to do this on meshes, you will have to write your own OSL shader.

Yep, that's it! One question though: How could I use a normal map with that node setup?

@Drudge technicaly with this math (check Andrew's answer): https://blender.stackexchange.com/questions/38298/how-to-combine-two-normal-maps. The math in more detail is here: http://blog.selfshadow.com/publications/blending-in-detail/. But the normal map details added to these vectors will be skewed towards the tube edges, that cannot be avoided. I am not sure if the result will be any good.

okay, that's working. Now I also want to get it working in a pretty strange usecase. I'm experimenting with the new Bevel Normal node (https://blenderartists.org/forum/showthread.php?436279-V-ray-got-rounded-hard-edge-shader/page7) and want to use this effect with it. However, that creates a whole new source of Normals (a modified version of the Geometry Normal output, but coming out of the Bevel node.) Any idea if I can use the two together somehow? Thanks!

@Drudge You would have to get the difference of beveled normals minus ordinary normals, and add this to these flattened normals. Not sure again how it would look, it might produce artifacts. This beveled edges functionality is years far from usable though, so I wouldn't worry about it much. The whole way that Cycles works would have to change for it to be fast enough.

I guess that gets into some funky math then. It works pretty well right now. Low on options, but speed seems fine. Thanks!

If you're using Cycles, try increasing the roughness of your glossy shader. If you're using BI, decrease the specular hardness. (This may not be what you want, but hopefully it'll help.)
Edit: From your second picture, it looks like you want an anisotropic shader. That way, you can control the glossy roughness independently for X/Y.
(This is for Cycles; if you're using BI try tangent shading.)

This is the kind of shader you might need for it, essentially light doesnt have shades and is a single color to be sure your environment isnt affected this light is only there if the lightray shines towards the camera.
So  you can still place it in a dark scene for example, without causing some red glow or so.

the effect :

Shadeless in Cycles? Interesting.

I think you gave yourself a really big clue.
"The top cylinder gets a strong highlight down its length and visible shadows at the glancing edges due to it's curve. The flat one's gloss is much more spread out due to it being flat."
When portraying reflective surfaces lighting is as much a factor as the material. Here's an example of what I think your node set up is with HDRi lighting.

Here's the reverse node set up with the same HDRi lighting.

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


text:
Linking materials with groups and drivers
I am working on a project setup and trying to understand how it will all work behind the scenes. It involves several layers of linking, material groups, and drivers.
Can I have a value in one file drive a driver on an object linked in from another file? For example: If a material on an asset within it's own file has a driver based on some custom value of a scene, how can I have it take that value from the scene it is linked into rather than the scene within it's own file?
Or, inversely, if I setup a driver in the main file, how can I have it drive the appropriate parameter of objects that I link in?
An example of this would be if each of my materials or material groups had an input for wetness. Different materials are effected differently, and will need to be setup within their own file. These assets are then linked into whatever scene file I'm composing a scene in. A rainy scene will have a wetness of 1, and a dry 0. That needs to properly connect to each material's wetness input and drive it.
EDIT: This question was originally too complex and involved several questions, I have simplified it.

It's an interesting scenario, but too broad for one question on here. Most of what you're asking about should work, but you may have some issues with some of the driver setups. I would recommend building out a test project, which would then allow you to post more specific questions that would be more straightforward for us to answer.

@ToddMcIntosh I've simplified it.

The limitations of Blender's linking system make this a little awkward, but you can make it work with the proxy system. Proxies are Blender's funky solution to editing linked properties. You can "make a proxy" of a certain object from a linked group. This makes a local copy of that object which will then push any changes into the linked object it was copied from. Here's generally how it's meant to work in practice.
Your asset has an armature in its source file. This armature object is set up to control all other objects and materials in the asset via drivers, constraints, parenting, modifiers, or whatever. You pack everything into a group, then link that group. With the group selected, you hit Object > Make Proxy in the 3D view, and select your control rig from the object list in the prompt. You now have a control proxy that you can move and manipulate to control your linked asset.
It doesn't necessarily need to be an armature, you might just use an empty in this case. But essentially what you need to do is connect your material's wetness in the source file to some property of this empty/armature via a driver. A custom property on the object datablock is probably easiest:

Once you make a proxy of your control object, you will then be able to adjust this "wet" property from the main scene. Word of warning though: it will affect ALL instances of this group in the scene, not just the one you had selected when you hit 'make proxy'. Best way to get around that is to add a symlink to your source file, then link the group again by select the symlink. Blender organizes links by filepath, so it will believe this is a different asset even though it's reading the same one. You can then make the new linked copy its own proxy and control them separately.

Thanks, that is great info! Can you explain what a symlink is?

Symlink is short for symbolic link. Often called a "shortcut" in Windows parlance. It's a filesystem level shortcut to another file. It appears to oblivious apps to be another file entirely, which is handy. Exactly how you create them will vary by operating system. Google "symlink " for some info on how they work in your system of choice.

@Drudge I have given an example of creating symlinks on Linux at https://blender.stackexchange.com/a/1154/228 (a comment to my answer also gives an example for windows)


text:
What values should I be passing for self and context in my python script
I'm trying to call a method from within the same class. I've found that if I have no args apart from self and context, I can simply call it using 'UpdateObjectProperties' and it works perfectly. However I want to add other arguments to it and when I do that I have to add in self and context too. I don't know what values to add there to get it to work. I've included an exert of my script here. Not the whole thing as it is several hundred lines long but that should include all necessary info. There will be more enum properties calling the method than just AIInput. Any ideas?
#Input field information can be found here
class PanelProperties(bpy.types.PropertyGroup):
    """Input field information"""

    #Create a tuple containing the objects shape keys
    def GetVisemeList(self, context):
        curIndex = 0
        ListForTuple = []
        for shapekey in bpy.context.active_object.data.shape_keys.key_blocks.keys():
            currentKeyIdentifier = shapekey
            currentKeyName = shapekey
            currentKeyInfo = ""
            newTuple = (currentKeyIdentifier, currentKeyName, currentKeyInfo)
            ListForTuple.append(newTuple)
            curIndex = curIndex + 1
        FinalTuple = tuple(ListForTuple)
        return FinalTuple

    #This method is called when the property is updated. It is the one I'm having trouble with.
    def UpdateObjectProperties(self, context, stringName, value):
        scene = bpy.context.scene
        if 'TextToSpeech_toolprops2' in scene:
            obj = bpy.context.active_object
            rna_ui = obj.get('_RNA_UI')
            if rna_ui is None:
                obj['_RNA_UI'] = {}
                rna_ui = obj['_RNA_UI']

            obj[stringName] = value

            rna_ui[stringName] = {"description":stringName,
                    "default": "",
                    "min":0,
                    "max":1,
                    "soft_min":0,
                    "soft_max":1}

    #Info for the inputs is found here

    AIInput : bpy.props.EnumProperty(
        name= "AI",
        description = "Viseme Shape",
        items = GetVisemeList,
        update = UpdateObjectProperties('self = ??????', 'context = ??????', "AI", bpy.types.scene.TextToSpeech_tool.AIInput)

class TEXTTOSPEECHANIM_PT_main_panel(bpy.types.Panel):
    """Creates a panel in the main window for the Text to Speech Animation Tool"""
    bl_label = "Text To Speech Animation"
    bl_idname = "TEXTTOSPEECHANIM_PT_main_panel"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = "Text To Anim"

    def draw(self,context):
        layout = self.layout
        scene = context.scene
        mytool = scene.TextToSpeech_tool
        mytool2 = scene.TextToSpeech_toolprops2

        row = layout.row()
        row.label(text = ".wav directory")
        layout.operator(OT_IdentifierFileSelector.bl_idname, icon="FILE_FOLDER", text="Select .wav file")
        layout.label(text = bpy.context.scene.TextToSpeech_toolprops2.AudioDirectory)
        layout.operator(SimpleOperator.bl_idname, text="Get Sentence Data")
        layout.prop(mytool2, "StartFrame")
        layout.prop(mytool2, "FramesPerSecond")
        layout.operator(SimpleOperator2.bl_idname, text="Animate")

classes = [PanelProperties, TEXTTOSPEECHANIM_PT_main_panel]

def register():
    SimpleOperator
    for cls in classes:
        bpy.utils.register_class(cls)

    bpy.types.Scene.TextToSpeech_tool = bpy.props.PointerProperty(type= PanelProperties)

def unregister():
    SimpleOperator
    for cls in classes:
        bpy.utils.unregister_class(cls)
        del bpy.types.Scene.TextToSpeech_tool

if __name__ == "__main__":
    register()
```

It is an update callback.
Started as a long comment, will throw it together as an answer Will hunt down some links that explain this (probable dupes).
This is what I think you are after
Using a single worker method for properties
Centralizing properties updates in one function?
Firstly going to suggest that if context is passed as an argument use it, not bpy.context Possibly only semantics atm, but if it changes such that the context passed doesn't match global context will cause all sorts of issues...
In the API docs style guide it is recommended to use CamelCase for class names, hence for clarity have changed method & property names to snake_case to coincide with the rest of blender.
The value assigned to update, get, set and items (if items is to be dynamically built via callback) are methods.  Consult the bpy.props docs. update and items are expected to  have arguments (self, context)  a getter (self) and a setter (self, value) where value is the value being set.
def get_viseme_list(self, context):
    ...
    # return the enum items as a list

def update_viseme_list(self, context):
    # self is in this case scene.tts_tool
    # self.id_data is scene
    # the value being updated is self.ai_input

    print(self, self.id_data, self.ai_input)

ai_input : bpy.props.EnumProperty(
    name= "AI",
    description = "Viseme Shape",
    items = get_viseme_list,
    update = update_viseme_list
)

at issue here somewhat is you have defined a scene property that both populates from & updates the context object, that's Ok I suppose if that is the intention, albeit somewhat confusing.  Especially in the case of
scene = bpy.data.scenes["Some other not context scene"]
scene.tts_tool.ai_input = 'P'

in which case context.object may or may not be an object of the scene.
Consider instead using
bpy.types.Object.tts_tool = bpy.props.PointerProperty(type= PanelProperties)

(or Mesh or even Key)
Go Cats.

I think that first link you posted is spot on in terms of what I'm after. I apologize for any confusing naming conventions and code. I am very new at this. Thank you for taking the time to answer :). I'll use your suggestions.

Cheers, happy to help, & abs no apologies necessary.  Will close as dupe of first link.

But why do you want constant values as parameters? You could just use the normal use case you know with the two parameters and "read"/use your values inside the function.

Because the AIInput EnumProperty values aren't the only ones I'm going to be using. There are about ten and to keep things neat I don't want to have to repeat the method that many times.

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


text:
Store a variable Vector of integer as bpy.props
I am new in Blender dev. I am trying to create an add-on, and I need to store an array of integers. The problem is that I don't know the size of this array.
I used for testing the IntVectorProperty:
bpy.props.IntVectorProperty(
    name='Name',
    description='Desc',
    default=[0,0],
    subtype='NONE',
    size=2
)

But the size is a required field.
Do you have any suggestions?

There they create a new custom property that I can use as bpy.props, right? Ok, if this is the cleanest way to do it, I could give it a try. Thank you!
I'd like to keep the question open. If I solve it I can provide the code for size varying int arrays

You might want to use a CollectionProperty instead which you can vary the size at runtime

Yes, the collection property solved my problem. Thanks

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


text:
rigify not working on my facial model
followed this tutorial to add facial movements
https://www.youtube.com/watch?v=HiDft_K7D_k&t=536s
followed every step as mentioned
and applied rigging movements
but im not able to move the facial structure

when i tried to move the lip part the bone is moving rather than the face
not able to understand why is this not working

Is it only the face that has the problem? If the bones move but not the mesh it could be the weight paint, or the armature modifier, or something else.  You can share your file at https://pasteall.org/blend/ if you want. (after the upload you need to post the URL here, it's the only way to access the file)

@Blunder i cant paste it as its more than 24mb
any alternatives ???

https://www.dropbox.com/s/5bc7vx7svbvywv7/eyes%20faceschnaged.blend?dl=0
aaded it in dropbox please have a look

Oh, I missed your answer. It's the infamous "Bone Heat Weighting: failed to find solution for one or more bones" error you get here.


text:
rigid movements are not working after generating rig using rigify addon

this is my mesh which is in .fbx format
and i have added armature (basic human )

moved all my bones such that they are inside the mesh
applied scale for mesh
applied scale and location for bones
and selected body mesh along with bones and parented them with automatic wieghts
its fine till here without any errors
and im able to move the mesh when i moved the bone

but after generating rigid and when i get into pose mode and try to move something
nothing is being changed
Attached my blender file
please have a look
https://www.dropbox.com/s/pdqwts0n55gk7bt/stacko.blend?dl=0

The mistake is step 6 "and selected body mesh along with bones and parented them with automatic wieghts"
You parented the mesh to the metarig, and then the generated rig to the mesh:

metarig → mesh → rig

That's wrong. Correct relationship is:

rig → mesh

Clear the parent relationship (Alt+P) of the mesh and the rigs. The metarig is only used to lay out the bone structure. Then you generate the actual rig (default name is "rig"). This one is the parent for the mesh (P, With Automatic Weights. The rig must be active object = selected last)
Side notes:
The layout of the bones of the metarig is not ideal and you should adjust the position of some bones:

the "knee" of the bones don't match the knee of the mesh. Move it higher
the head bone is too short, it should touch the top of the head
the hand bones (last ones of the arms) should match the mesh's hands. That is, be inside of the hands.
the right heel bones (heel.02.r) is rotated. It should lay on the ground like the left one. Select the left one and use the menu entry Armature > Symmetrize to fix it.
toe and heel bones should touch the ground and the edges of the mesh
arms (bones) are not symmetrical

wheni tried to parent bones to mesh as you said I not getting automatic weights option
instead im getting(object)
i'm confused
first ill take the bones inside the mesh select it and then parent to the mesh
and then generate rig
is it ???

First, you edit the metarig and place the bones in the mesh. Then in Object mode, generate the rig from the metarig with the Generate Rig button. Finally, parent the mesh (child) and the generated rig (parent) With Automatic Weights. The rig must be highlighted in orange (in Blender's default theme), the mesh is highlighted in a darker reddish color.  If you chose the wrong order and try to make the rig the child then there is no With Automatic Weights option.

i appreciate your amazingly detailed explanation and i did everything as you mentioned removed parent for mesh and bone. gnerated rig with rigify  and tried to connect mesh to generatd rig(parent) but when i tried to do that im getting error "loop in parents"

Have you cleared the parent relationship of all 3 objects (metarig, body mesh, generated rig)? The error is because you parented them as shown above. And when you try to parent the "tail" with the "head" of this hierarchy then Blender complains that you try to create a loop. The parent cannot be a child of its own child, you know? Dissolve this hierarchy. You can check the relationship in the outliner and in the Object Properties tab,  Relations section, Parent inputbox.

thanks  for contributing your knowledge to the community
it helped me so much :)

The reason for this is because your weight paint body is blue all over.
I changed the arm manually by weight painting and then i could move the arm by using the rig.

@Chrisi just changed the the wightpaint from blue to other and tried to move still its same
the mesh isnt moving just the rig part is moving


text:
eyes rig : rotation issue in blender
Hello i have been following this tutorial
https://www.youtube.com/watch?v=vvEuroezCng&t=464s
to make eyes and add movement to it
everything is going good till 3:45secconds
when i tried to rotate as he mentioned by clicklon on "r -90"

instead of getting this

im getting something like this
im not sure what possibly could have gone wrong
tried this several time made sure that i didnt miss any step
but still couldn't figure out why The results is totally different

hello please share your file: https://pasteall.org/blend/

https://pasteall.org/blend/c894af7c05c94993a224eb2801b45966

done please have a look

It works fine, only press R-90 if you are in side view, if you are not, press RX-90 to precise the rotation angle, otherwise the rotation will happen according to your current view, which will give the unexpected result you show.


text:
Strange L.E.D.-esque glare surrounding mesh (EEVEE rendering)
When trying to work with a mesh, I'm noticing these crazy bright glares surrounding and shape-shifting around my object.
These glowy shapes take place only in the viewport shading mode of EEVEE. I would definitely like to render my animated object in EEVEE rather than doing it in Cycles.
I am working off of a 2016 Macbook Pro
 - (2.5 GHz Quad-Core Intel Core i7)
 - (16 GB 1600 MHz DDR3)
 - (Intel Iris Pro 1536 MB)
I've also attached an image for reference. Any help is greatly appreciated! Thank you!

Looks like a graphics glitch, likely caused by a problem problem with your graphics driver. What version of macOS are you using? Can you try the most recent experimental version of Blender and see if the issue still occurs?

My MacOS is up to date (Catalina version 10.15.1). Are there any other things I can I do to troubleshoot my graphics driver? Is there a graphics driver reset I can try on my Mac?


text:
How to get out of 2D view
I created some UV spheres and my work progressed nicely. At some point I inadvertently must have pressed some button and I see only flat black circles instead of spheres. Also the sidebar shows that the Dimension setting for the z-Axis is 0. Any other value I enter here is ignored.

I have chosen top orthographic view on purpose. Changing to user perspective does not solve the problem. Tilted user perspective looks like this

Oh, I see. So those are supposed to be 3D? That's strange... I'm looking into it, but i'll admit, I've never seen anything like that before.

Hi. If you need to reply to a user you can use the comment box below their answer instead of editing their answer. I have undone your edit to the answer below and added an edit to the question to include the information. If you still need to comment on Christopher Bennett's answer, use the comment box below it. Thanks.

The CLOSEST I can find to people having similar issues to you has to do with rotation/scale not being applied, but I don't know if that will solve your problem.

Hi Ray Mairlot. I could not figure out how to add an image in the comment box. Therefore I edited the answer.

Thanks Christopher, your hint solved the problem in the end. Some of the Bezier curves which are used as the targets for the follow path constraint  of the spheres had a z-axis value of 0 in the scale property.

Ahhh. Interesting. I thought that might be the case with something, but in the image you provided, it shows a z-scale of 0.200 so I dismissed it.  Glad you found the problem.

You have entered orthographic mode. Press Numpad 5 to toggle it on and off, or simply hold down the Scroll Wheel and move the mouse you will be out of it. If you want to use orthographic modes in the future:
Numpad 1 = front orthographic
Numpad 3 = side orthographic
Numpad 7 = top orthographic
Numpad 5 = flip (ex: top flips to bottom)


text:
How to export an animated object from Blender to an .usdz-file for Reality Composer (AR)?
I'm totally new to Blender.
I only need it to make a rectangle with an animation that extrudes or scales over one axis over time.
So I keyframed X-Scale of a rectangle and tried to export it in an .abc-file, then tried to convert it to a .usdz-file via my terminal.

But when I do this I only get a simple cube without animation and without material.
Does anyone know how to do this?
Thanks in advance.

export animated .DAE file first, and then open with Xcode, Xcode allows you export .USDZ file, this step works great for me, hope it helps.


text:
Is there a way to display a multi-lines message in panel / popup?
My add-on performs diverse measurements on an arbitrary number of selected objects. The measurements results are printed to the console and saved to drive as tabulated data and .csv files respectively. I'd like to also display them in the GUI in a pop-up window.
I have not found any way to display multi-lines messages in a panel and nothing in the API (v2.81) struck me as related.
I am currently going around by showing in the panel the 5 first and last measurements (head()-like and tail()-like previews).
Would anybody have an idea on how to display tabular data of arbitrary length in a panel?
Many thanks in advance.
EDIT (in response to @RayMairlot):
The message to be displayed has n-lines (each line being a set of measurements - fixed width - for one object). I can't know beforehand how many lines there will be (depends on the number of objects measured) and row.label() only display text on a single line (\n are not recognized). Thus, I am currently building my pop-up panel with a a fixed number of  row.label()statements (e.g. 10), that I populate with the  5 first and last lines of the message (measurements of the 5 first and last objects). I am not satisfied with this solution, it is just a workaround (better a preview of the results than no results displayed at all :-) ).
What I would need is either:

a way to dynamically add row = layout.row() and row.label(text) statements to the panel to match the number of rows to display as it is invoked
OR a way to display multilines messages (containing \n) in a single row.label(text)or equivalent.

I hope this clarifies.

Can you elaborate on why you currently have to display the 5 first and last messages instead of all the data?

edited my original question to clarify this point.

https://blender.stackexchange.com/questions/159503/displaying-text-inside-an-addon-panel

Example using an UIList based on the answer of Create an interface which is similar to the material list box? and my modification for Displaying text inside an addon Panel to get some kind of log window as part of a popup. I've removed all superfluous operators and added a CUSTOM_OT_popup operator calling invoke_props_dialog in its invoke method as well as a check method for proper drawing:

# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

bl_info = {
    "name": "log-uilist-dev",
    "description": "",
    "author": "p2or, brockmann",
    "version": (0, 1),
    "blender": (2, 80, 0),
    "location": "Text Editor",
    "warning": "", # used for warning icon and text in addons panel
    "wiki_url": "",
    "tracker_url": "",
    "category": "Development"
}

import bpy

from bpy.props import (IntProperty,
                       BoolProperty,
                       StringProperty,
                       EnumProperty,
                       CollectionProperty)

from bpy.types import (Operator,
                       Panel,
                       PropertyGroup,
                       UIList)

# -------------------------------------------------------------------
#   Operators
# -------------------------------------------------------------------

class CUSTOM_OT_actions(Operator):
    """Move items up and down, add and remove"""
    bl_idname = "custom.list_action"
    bl_label = "List Actions"
    bl_description = "Move items up and down, add and remove"
    bl_options = {'REGISTER'}

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

    list_item: StringProperty()

    def invoke(self, context, event):
        scn = context.scene
        idx = scn.custom_index

        try:
            item = scn.custom[idx]
        except IndexError:
            pass
        else:
            if self.action == 'DOWN' and idx < len(scn.custom) - 1:
                item_next = scn.custom[idx+1].name
                scn.custom.move(idx, idx+1)
                scn.custom_index += 1
                info = 'Item "%s" moved to position %d' % (item.name, scn.custom_index + 1)
                self.report({'INFO'}, info)

            elif self.action == 'UP' and idx >= 1:
                item_prev = scn.custom[idx-1].name
                scn.custom.move(idx, idx-1)
                scn.custom_index -= 1
                info = 'Item "%s" moved to position %d' % (item.name, scn.custom_index + 1)
                self.report({'INFO'}, info)

            elif self.action == 'REMOVE':
                info = 'Item "%s" removed from list' % (scn.custom[idx].name)
                scn.custom_index -= 1
                scn.custom.remove(idx)
                self.report({'INFO'}, info)

        if self.action == 'ADD':
            if self.list_item:
                item = scn.custom.add()
                item.name = self.list_item
                item.coll_id = len(scn.custom)
                scn.custom_index = len(scn.custom)-1
                info = '"%s" added to list' % (item.name)
                self.report({'INFO'}, info)

        return {"FINISHED"}

class CUSTOM_OT_clearList(Operator):
    """Clear all items of the list"""
    bl_idname = "custom.clear_list"
    bl_label = "Clear List"
    bl_description = "Clear all items of the list"
    bl_options = {'INTERNAL'}

    @classmethod
    def poll(cls, context):
        return bool(context.scene.custom)

    def invoke(self, context, event):
        return context.window_manager.invoke_confirm(self, event)

    def execute(self, context):
        if bool(context.scene.custom):
            context.scene.custom.clear()
            self.report({'INFO'}, "All items removed")
        else:
            self.report({'INFO'}, "Nothing to remove")
        return{'FINISHED'}

# -------------------------------------------------------------------
#   Drawing
# -------------------------------------------------------------------

class CUSTOM_UL_items(UIList):
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
        split = layout.split(factor=0.2)
        split.label(text="%d" % (index))
        #split.prop(item, "name", text="", emboss=False, translate=False, icon=custom_icon)
        split.label(text=item.name) # avoids renaming the item by accident

    def invoke(self, context, event):
        pass

class CUSTOM_OT_popup(Operator):
    bl_idname = "custom.call_popup"
    bl_label = "Log Window"
    bl_options = {'REGISTER'}

    @classmethod
    def poll(cls, context):
        return True

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

    def check(self, context):
        return True

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

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

        rows = 7
        row = layout.row()
        row.template_list("CUSTOM_UL_items", "", scn, "custom", scn, "custom_index", rows=rows)

        row = layout.row()
        add = row.operator(CUSTOM_OT_actions.bl_idname, icon="ADD", text="Add Log Line")
        add.list_item = "Error %d" % (len(scn.custom))
        add.action = 'ADD'

        row = layout.row().operator("custom.clear_list", icon="X")
        row = layout.row()

# -------------------------------------------------------------------
#   Collection
# -------------------------------------------------------------------

class CUSTOM_objectCollection(PropertyGroup):
    #name: StringProperty() -> Instantiated by default
    coll_type: StringProperty()
    coll_id: IntProperty()

# -------------------------------------------------------------------
#   Register & Unregister
# -------------------------------------------------------------------

classes = (
    CUSTOM_OT_actions,
    CUSTOM_OT_clearList,
    CUSTOM_UL_items,
    CUSTOM_objectCollection,
    CUSTOM_OT_popup
)

def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)

    # Custom scene properties
    bpy.types.Scene.custom = CollectionProperty(type=CUSTOM_objectCollection)
    bpy.types.Scene.custom_index = IntProperty()

def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):
        unregister_class(cls)

    del bpy.types.Scene.custom
    del bpy.types.Scene.custom_index

if __name__ == "__main__":
    register()

Note: the naming of the classes and variables might be off a little.


text:
What does scene.objects.unlink really do?
From the Blender Python API:

unlink(object)   Unlink object from scene
Parameters: object (Object, (never None)) – Object to remove from
  scene

Does the object directly get removed from the scene or rather the ObjectBase which links to the Object and hence the Object gets removed too?

It removes the object from that scene.
The reason the method is not called remove is that the object its self is not removed. Objects can exist in multiple scenes and groups. So scenes link to objects but don't store them (this is why you have bpy.data.objects).
The object-base is freed, mostly object-base is not exposed to the api, but in some cases accessing is important.

i'm interested in how blender works behind the python-api. can you point me to the c-source-file where the unlinking happens?

@ni-ko-o-kin, Scenes store a list of 'Base' types, DNA_scene_types.h, struct Scene.base is a linked list of Base types. scene.c has most functions for manipulating these. Search for sce->base in this file.


text:
Cycles Subsurface shader: GPU compute and CPU compute give totally different results
Blender 2.67
Windows 7
Geforce gtx460
Head model with subsurface scattering and one texture
Cpu render - fine, but slow.
gpu render - face comes out black! (it was working at first it changed for some reason)
any suggestions? why should this happen.
Here is an image of the problem

I don't think it's even rendering the SSS shader and is replacing it with the holdout shader (it will do that whenever the shader is either broken or not supported. BTW I got that reference :D)

Note that you can fake SSS on the gpu with the Light path node, see this thread on BlenderArtists

same problem in cycles with gts 240. what is SSS ?

The SSS shader has not been implemented for GPU rendering yet. It will always render black.
Update: SSS now works on GPU, so they should look the same.
If you're looking for quick renders, SSS is not a good idea. If you can get away with a simple Diffuse BSDF shader with a bit of Translucent BSDF, that'd be great.

Thanks for the Advice Greg, In the end I used the SSS Shader and used CPU render, here is how it turned out http://www.blenderartists.org/forum/showthread.php?297366-General-Zod


text:
How to change the current action on dope sheet editor with script?
I am trying to load multiple animations, I use dope sheet editor to manage the animations. I have a couple of matrices, what I want to use bone by bone, then insert keyframe one by one. My problem is that I found no way to select the actual animation I would like to set the keyframe.
I am pretty tired of googling since I found only outdated 2.5x stuff.
So my question is: how to change current action on dope sheet with script?

For me this just worked fine:
#reguirement: you got action called "Idle"
csontvaz_objektumkent = bpy.data.objects[0] #this is actually the armature, but I use index
                                            #because I am lazy
bpy.context.scene.objects.active = csontvaz_objektumkent
csontvaz_objektumkent.animation_data_create()
csontvaz_objektumkent.animation_data.action = bpy.data.actions["Idle"]

I am sorry if it looks bad: I am pretty new to BPY.

Edited the answer, because you need to have the armature object selected to have the dope sheet change the animation. Without that this wont work.


text:
Blender and MBdyn
I was looking for aerodynamic simulation possibilities in blender and after some research landed to this page:
http://blenderartists.org/forum/showthread.php?139557-Multibody-Dynamic-Simulation-Available-Now.
It took me about an hour to figure out that it won't work for 2.6x so I downloaded 2.49 portable, followed all the steps and got ready to run the script. When running the script, it would show missing module (tempfile, numpy, scipy) errors. Finally the last (I hope) error I got was that I cannot run scipy from the numpy source directory.
I've got no hint why is it caused.
Has anyone got a solution for the directory error, possibly for running MBDyn?

When writing questions on this site, please take the time and effort to at least put spaces after commas and full stops.

BlenderAndMBDyn v2 for Blender 2.72+ is now available at https://github.com/gdbaldw/BlenderAndMBDyn


text:
How to select objects based on materials?
Is it possible to select all objects that have a particular material assigned to them?
E.g. if I have many objects that use the same material and I want to select them for Copy to Selected, how can I do this?

Object mode:
Select > Select linked > Material or ShiftL > Material.
Edit mode: Select face that has the material applied to:
Select > Select Similar > Material
or ShiftG > Material

Download the Material Utilities addon
Select all objects with A
Access Material Utilities ShiftQ. Select "Select by Material".
Choose the material you want to select by

Thank you very useful in my case where I need to find materials that I want to delete and I don't know where are applied, cause I have appended object from another file.

Another way would be this:

in the Outliner set "Display Mode" to "Blender File" ( in the top, the dropdown menu next to the "Editor Type" dropdown)
there should be a list with all materials (in the top is search bar)
right-click on the material and select "Select Linked" from the context menu (Be aware that hidden Objects will not be selected)


text:
Bone Heat Weighting: failed to find solution for one or more bones :RIGIFY connecting mesh with bones
hello i want to connect my face mesh with rigify bones
when i tried to parent mesh with bones
im getting this error :
Bone Heat Weighting: failed to find solution for one or more bones

I'm new to blender i've researched a bit about it
searched about the same in all other threads
but nothing seems to be worked
and followed this tutorial
https://www.youtube.com/watch?v=EuHkd61RhDs

but still its of no use
im not sure how to connect rigify bones to my mesh properly and use it
attached my blender file please have a look
https://www.dropbox.com/s/5bc7vx7svbvywv7/eyes%20faceschnaged.blend?dl=0

hello, please share your file: https://pasteall.org/blend/

added the link in the question itself .
added dropbox link
please check

apply the scale of both the head and the armature, move a bit the armature within the bead, parent, it seems to work

added scale to face mesh added scale and location to bones and tried to parent it
still the same

done done its working thank you so much :D

Oh ok, nice, I didn't understand what you meant by "added scale to face mesh"   ;)

Apply the scale of both the head and the armature, move a bit the armature within the bead, parent, it seems to work


text:
Import .obj error, Sequences of dimension 0 Contain 3 items, not 2
Good afternoon,
I'm having issues importing a .obj file of the USS Ticonderoga (purchased from vendor). Whenever I try to import it, I get the error shown in the image below (sequences of dimension 0 should contain 3 items not 2). The .mtl file is in the same directory as the .obj file. Blender version is 2.91.
I can confirm that the .obj file is openable using 3DView.

Can confirm this is a bug in Blender's OBJ importer. I filed a bug report for you: https://developer.blender.org/T89421
You can work around the bug in the meantime. Your model should have come with a .mtl file. Open it in a text editor and look for any lines that have a -s, like this
map_Kd -s 2.000 2.000 texture.jpg

The Kd, 2.000, and texture.jpg parts might be different for you. The important part is that there are two numbers after -s. You need to add a third number, a 1
map_Kd -s 2.000 2.000 1 texture.jpg

Do that for all these lines, save, and the import should now work.


text:
Jagged Edges with Eevee Render
Im very new to Blender and was following a tutorial online to create metallic like shapes/type. Every time I render I get the following quality of really jagged or pixelated edges within the shape. Even within render mode it looks jagged and low quality.
After looking at various threads on this forum, upping the sampling and resolution % I cannot seem to find a way to solve this issue.
Can anyone help or advise on ways around this?
Thanks

Probably topology.  Good subsurf topology is: all quad; no 6+ poles; 3 and 5 poles placed on most planar parts of mesh; planar, square faces.  Can't say whether your meshes meet those criteria without a wireframe.  Online tutorials are often of limited value.

can you provide a blend file so we can check it out?

@Chris Yeah of course here it is https://we.tl/t-uJihg5tz42


text:
How do I fix this shading?

All of my Blender models have this type of shading and I have no idea how to fix it.

Select the object. Go to object property (box icon over the right-side panel of properties), go to NORMAL, check "smooth" normals. Use 15º, if that doesn't work, use 63º.
If you still get bad shading, you need to refine your faces modeling (to be more parallel instead of crossing to the nearest vertex).


text:
Why are my textures on a sculpted plane so blocky and how can I fix it?
I added a plane and then sculpted it, but when I went to add a texture it turned out all blocky and distorted. I've tried with many different textures and all of them do this. I'm new to blender so does anyone know how to fix this?

hello, could you please pack your image (File > External Data > Pack All Into .blend) and share your file? https://pasteall.org/blend/

@moonboots: please don't steal my text :D ...and i wonder...why doesn't ctrl-t help here, if it is plugged in UV? and maybe apply scale?

hey I was first on share your file! you only arrived one year and a half ago

Looks like inverted normals. SHIFT N with everything selected in edit mode


text:
Correct place to store data required for custom addon
When planning for a blender addon, I found I need to download and store some dependencies(not python package, but some binaries, text file etc).
After reading manual and searching google for hours I can't find a solid answer explaining which path should I be using.
Should I be fine just using script's parent directory (one returned from pathlib.Path(__file__).parent which would be user_dir/scripts/addons/) or should be using something else, perhaps ./datafiles/ ?

It would be logical to store the data in the add-on's folder so when the user wants to migrate Blender's preferences they can just copy their preferences folder. If you store it elsewhere it can cause confusion when moving the preferences so that's sort of expected location for everything that your add-on uses. There are of course exceptions - if for example your add-on deals with assets that take significant amount of space, you might want to let them choose. I would say you should not store anything outside the add-on's folder unless you have a very good reason for it. There are no official rules as far as I know. Add-ons can do whatever is needed.

That makes tons of sense! one thing might be that one of file I need is about 8GB in size so it might be troublesome  as you mentioned... but since this will be mere POC/prototype so people can live with that I guess!


text:
Modeling Airplane Nose Shape
I need help recreating the nose shape of the airplane you see in the images below. I also have the .blend file included because I think it would be easier to see everything that I have already tried and so you can see the shape that I'm trying to go for.
http://pasteall.org/blend/index.php?id=53057
Please look through the different layers in the .blend file. The second layer has an airplane that was downloaded online for reference which I'm trying to recreate, and the rest of the layers are just attempts. I have tried using the bridge operation mostly and the loop tools addon to create the circle at the end. The third layer is my mesh but merged with the front of the other airplane. I also had to apply one subdivision so I had more vertices to work with. Also, the name of the airplane is SR22T if you may need more reference images.

(source: discordapp.net)

Not to be nosy  ... Can you point out specifically what you think is deficient in words and diagram?  Perhaps a close up of the nose  of your work would help .  I am aware that you included a file.

link The outline you see is separating the mesh I already have and the nose from the other model

Also, I found this timelapse of someone modeling a similar airplane but I couldn't find the first part https://youtu.be/3pV3j7QPbAk

 I fixed it by using creases and looptools for the end bits


text:
Why do my vertices look so big?

How do I get my vertices back to their original size?

Go to Edit > Preferences > Themes > 3D Viewport
scroll down to see the option, default is 3 pixels.


text:
3D models show up as boxes
So I'm complete new to using Blender Cycles. I've seen others do it. I've watched tutorials. I've tried googling help. I've spent hours worth of time trying to figure this out, but I can't seem to find anyone who has had my problem: I'm using Blender Cycles 2.79, I've gotten the XPS tools, I've activated them in my user preferences and all that fun stuff. My goal is to import already made 3d models (like Xnalara) into blender so I can practice posing them. But every time I try to import the model onto my main screen to work with, it just creates another box/square and an error pop-up (unboundlocalerror: local variable 'imagefilepath' referenced before assignment). I've downloaded programs like python and file viewer if that helps. But I'd like to know what exactly I'm doing wrong or if there's something else I need to get these models actually working on blender.
I have downloaded the latest version of xps tools. Would this help for a better understanding?

knowing nothing about XPS tools I would say that an image file referenced in the file being imported does not exist.

this sounds more like a Python error within the Add-on. Have you tried downloading the latest version at https://github.com/johnzero7/XNALaraMesh ?


text:
How do you resurface these objects into one object?
This question looked as if it were the answer, but when I tried to follow the answer, I didn't get the expected result.
How do I join two separate objects so I can edit them as one mesh?
Here is what happened.
https://www.dropbox.com/s/y2aijftpztba4li/tori.blend?dl=0
My next step was to mark the inner vertices of the torii and add another face, and also add a face to the ends.  Would I have to then have to manually delete the interior parts of the object to create a manifold?

If I had attempted to create the face for each vertex, I expect that  might work.  So is that the answer, or do it with python?

If this is the effect you're looking to achieve

the way I managed it using the blend file you uploaded to dropbox was:
1) [if not already activated,] activate the Mesh:LoopTools addon by means of User Preferences > Addons > Mesh:LoopTools;
2) delete the outer edges joining the two torii in your blend file;
3) Select the each of the edge loops you did on the two torii by deselecting all vertices A key, followed by selecting the same edge loop you had selected on one torus, holding the shift key and selecting the same edge loop you had on the other torus; and
4) In the Edges menu (CTRLE key) choosing the "Bridge Edge Loops" option.
Caveats
As the screenshot shows, I performed these steps in 2.71. My memory on this is just a bit hazy, but it seems to me that up until some version of Blender (2.6?) the Mesh:LoopTools Addon may not have been included in the distribution, and you may need to find it and install it from the Blender Addons repository.
Your two torii seem to have the same number of segments; if the two torii do not have the same number of segments the results may not be shown as here, and you may need to adjust the results differently.
In order for this method to work, the two meshes you want to join need to be part of the same object. If you add the second torus to the first as a different object, the two torii need to be combined into the same object as in the method set out in the other question you cited, and then the expanded object manipulated in edit mode.

Note: The steps appear to work even if the number of segments aren't the same.

It depends upon how you define "work". While testing my answer, on one instance I omitted a segment of edge loop in one torus; when I performed the bridge operation, I did get a bridge, but it would have required significant manual "beautifying of the segments..

Agreed.  Results are not guaranteed if the number of segments aren't the same.  Thus far, I haven't figured out when it will fail.


text:
How to get real Z-buffer value from Blender
This is in follow up to my previous post. I see that i can render the zbuffer into an image from the answer to my previous post. But can I get the real Z values some how using blender?
I found this page that talks about it in OpenGL but I am not sure how to access the values in blender. If someone has done this before, please help me out.
Thanks in advance!
Karthik

Hey thanks! The reason I am using the blender is to get render the zbuffer out into a file that I can use for non-visualization purpose. So basically I need the depth values (Float and unnormalized). I am writing them out to .hdr file and getting it now. But I would like to know if I can use python scripting to get to the object that holds these values when I render it out. Because I again have to read the .hdr files externally into a text file to get hold of these values for my project.

I currently have the same problem. This solution might help you: http://blender.stackexchange.com/questions/35770/depth-map-with-distance-along-the-camera-z-axis But it requires to change all the materials in your scene. Did you find a better solution in the meantime?


text:
Graphics device is not getting populated
I have been following the post about the GPU enabling in blender and found that the device name is not populated. Does this mean the device is not configured with blender?

GTX Titan X is the graphics card I have. I see no options when I click on Graphics device.

THanks! I followed that post and before that I didn't even have the option of CUDA. Now I have that but my device is not recognized.

Have you tried rendering on it? It could be that it's working, but the name is strange for some reason (related: http://blender.stackexchange.com/q/31795/599)

Yes it is rendering the scene. But there is no difference in the time of computation. Does it depend on something else?


text:
Rigidbody.objects_add.poll() failed!
After the script that was working as mentioned in my earlier post. I am trying to create a blend file that has the scene setup and a script that has the locations of the objects available in the blend scene. I am able to see the new positions created by the script to the objects in the blend scene. But I am not able to bake them all. I get the below error.
RuntimeError: Operator bpy.ops.rigidbody.objects_add.poll() failed, context is incorrect

This is relevant to the lines
bpy.ops.rigidbody.objects_add(type='ACTIVE')
bpy.ops.ptcache.bake_all(bake=True)

Let me know if you have come across this kind of error. How do I make the context correct. When I try to the print the objects that are in the scene, I am able to see the objects in the blend file. What does the context here mean?
Thanks in advance!

My rigidbody objects where already added in the scene. So I actually donot need to objects_add method at all.

You should deselect non mesh objects before adding rigid body objects
 bpy.ops.object.select_all(action='DESELECT') #clear selection
 candidate_list = [item.name for item in bpy.data.objects if item.type == "MESH"]
for object_name in candidate_list:
    bpy.data.objects[object_name].select = True

this also should be done when clearing the scene if you want to keep the camera and light sources. and regarding the context see this answer poll() failed, context incorrect?


text:
How to bundle python libraries into addon?
I would like to distribute a Python addon that depends on two libraries: Numpy and PyAudio. I have seen all kinds of sorcery related to installing stuff via pip inside of Blender's Python interpreter, but this is different: I would want to generate a single .zip containing everything instead of messing around install-time. (As for example here: Including 3rd party modules in a Blender addon)
Is there a humane way to do this?

Isn't the question you linked to doing exactly that?

Possible duplicate of Including 3rd party modules in a Blender addon


text:
programmatically generate road with moving car
I am a Direct2D/C++ programmer and I want to experiment the procedural 3D animation of a street based on a text file. In the text file, I would be having something like this,

Length (in meters)  Curvature(Angle)     Uphill (Angle)       Downhill(Angle)

1000                     -                   -                      20°

300                      20° (left)          -                       -

500                      5° (right)          30°                     -

This means, for 1 kilometre the street is straight with 20° downhill. The next 300 meters the street has 20° curve (no uphill and no downhill). After that for the next 500 meters the street has 5° towards right direction with 30° uphill. So, programmatically I need to generate road details (terrain).
As for beginning, the street does not have any landscape (no trees, no buildings, no traffic signs, etc.) and only one car is moving inside the lane in a variable speed. I need to see the car movement using chase cam view.
Is it possible to implement my requirement using Blender (if needed, with some add-ons)? Or, am I better off with some other tool?

Consider a script below in the screen image below
![https://i.sstatic.net/mnBXM.png][https://i.sstatic.net/mnBXM.png]

Here are some roads in spirals because rather than straight line segments. Spirals are easier to see.  You can see how the script has changed the extrude and depth settings in the geometry panel.  The curve is shown in edit mode to display the vertex points of the curve.

This script expects points in 3D space [x,y,z,1].  2D space can be promoted to 3D.  The script was rotting and is being recycled and needs to be cleaned up to suit you.  It will serve as a starting point.  Many data structures are present in the example.
Plot400 plots curve segments based on a start point and end point.  To be compatible with the function,your data will be transformed from current state to simple segments.  Perhaps that missing step in available already at nominal cost from your data provider. Your data must be transformed via standard rotation matrices (sin cos).  Even though it is a curve in a general sense the segments are created in straight line segments. You will end up with a blender curve object type.
Because a curve exists you may exploit the Path Constraint in Blender for your car or camera to follow.  The target of the Path Constraint will be the curve path created above. One can change path constraint influence as an object changes path.

Could you post a link to the script?

@MajidFouladpour the image link is now clickable and thus more readable.  I suggest you click and hand type the 30 lines you need.  It will take me quite some hours to find the file from long ago, once I start.

This is definitely possible with Blender, and not at all outside the scope of Blender (which is a scriptable animation tool) But you do have to learn the Python API since I don't think any existing addons do this.
Example of Blender generating scenes: http://cgchan.com/suicidator/

@javafan, nope, this site is for Blender only - better ask in unity forums


text:
Handler-script updates in viewport but not in render
I'm completely stuck :-/
I've made a handler-script, that takes with every new frame a new line from the
text-editor and puts that line into the text-object in 3d-space.
It works absolutely fine - but when I want to render it, is it not working any more.
Why is that?? Other handler scripts from me are working fine...
import bpy

'''Text-Objekt muss angewählt sein und im Object-Mode
##################################################'''

def Text_Line_by_Line(Scene):

    FrameNumber = bpy.context.scene.frame_current - 1 #aktuelle Frame-Nummer minus 1 weil python 1 = 0

    TextFile = bpy.data.texts['Text'] #<------------Text-Name eingeben
    TextLine = TextFile.lines[FrameNumber].body  # Nimmt die Text-Line als String

    bpy.ops.object.editmode_toggle()
    # Vorherigen Text löschen
    bpy.ops.font.select_all() #selektieren
    bpy.ops.font.delete()   #löschen

    bpy.ops.font.text_insert(text=TextLine)  #Fügt den Text ein

    bpy.ops.object.editmode_toggle()

bpy.app.handlers.frame_change_pre.clear()
bpy.app.handlers.frame_change_pre.append(Text_Line_by_Line)

Don't use operators in handlers

For the most part don't use operators in handlers. When rendering for example, the context needed will not be there.  I imagine edit mode toggle means nada to the renderer.
Use API methods and the passed argument scene
In example below, displays a line of bpy.data.texts["Text"] as the body of text object scene.objects["Text"]
import bpy

# pass arguments to build a handler
def text_body_handler(obname, textname):
    # the handler method
    def text_body(scene):
        text = bpy.data.texts.get(textname)
        text_ob = scene.objects.get(obname)
        if not text and text_ob:
            print("Error: check names")
            return
        f = scene.frame_current
        lines = len(text.lines)
        if text_ob and f <= lines:
            text_ob.data.body = text.lines[f-1].body

    return text_body

bpy.app.handlers.frame_change_post.clear()
bpy.app.handlers.frame_change_post.append(text_body_handler("Text", "Text"))

Textblock bpy.data.texts["Text"]
I had written him a letter
which I had,
for want of better Knowledge,
sent to where I met him
down the Lachlan, years ago,
He was shearing when I knew him,
so I sent the letter to him,
Just ‘on spec’, addressed as follows,
‘Clancy, of The Overflow’.

Wow.... Thank you sooo much! Your script is working perfect. Here I can see clearly, that I've got no idea about programming... I can't understand your script - but it works and I'm very happy :) I wish you a great time!

Hi @Andi. In case the answer is "wow" or even solved your issue, please learn how to accept and upvote it for future visitors. Cheers


text:
can dynamic paint be the origin of particle?
i wonder if it is possible to have a particle sytem A that rains down to another object, where it would act as paint on a canvas. (so far i get it working)
But next i wonder could this canvas paint be used to be a origin of another particle system on the canvas object ?

by origin you mean the density map for an other particle system that controls where particles spawn

yes thats what i mean


text:
Ctrl Alt Numpad 0 keeps moving my object?
Trying to follow along with a tutorial and in that tutorial the idea is to look at an object I created from the front and then set the camera to the current view.
The steps to do this are:

Numpad 1 (Front perspective)
Ctrl+Alt+Numpad 0 (Align Camera to View)

For some reason whenever I do this I don't see anything in the camera and then panning the view around I see that my object seems to have moved to where I wanted the camera and my camera hasn't moved at all.

The answer was to first select the camera and press Ctrl+Numpad 0 and then perform the Ctrl+Alt+Numpad 0
User CD38 on http://blenderartists.org/forum/archive/index.php/t-78116.html explains:

I'm pretty sure you made the body into the camera at some point with
  an accidental Ctrl-zero when it was selected. You need to be careful
  with those Numpad-zero commands. Here they are:

zero alone: changes the viewport so you're looking
  through the active camera. ("I wonder what the camera's seeing?")
Ctrl-alt-zero: moves the camera to match the current 3D
  viewport. ("I like this angle; let's put the camera here.")
  This is why your humanoid is jumping around and looking
  inside itself. Very mind-bending.
Ctrl-zero : makes the selected object into the active
  camera. Anything can be a "camera." In this case it's your
  humanoid object. This is poorly documented and seems to cause
  all kinds of grief because it's an easy misstep.

Select the real camera with the RMB and do Ctrl-zero and all should be
  well.

(I found this answer and decided to document it here on stackexchange because I had a hard time finding the answer and would have expected this question and answer on this site)

Speaking of non-documented, Googling "blender move view to camera" gave me no relevant results. I didn't realize there was a plain NumZero until I ran into this question by chance. This saves me so much time setting up cameras.

Also, when you want to switch to an different camera during your animation go to the frame number when you want to switch from camera. Select/activate the camera where you want to switch to and press Ctrl + B .


text:
Can you reduce detail with a normal/bump map?
The usual workflow is to take a high detail model, such as a sculpt, create a lower detail copy, then bake a normal map off the high detail to use on the low. Is it viable to do the reverse?
I need to keep the overall geometry of my model intact for various reasons, but I would actually like to eliminate certain surface details with a texture within some parts of my material setup, while having the rest of the geometry intact for other parts.
Note that I don't necessarily mean a lower detail model in terms of vertex count, but rather in visible details. For example, here are two UV spheres. One has been crumpled. If I rendered it, it would have complex shading due to being crumpled, and the wireframe sphere would have smooth shading.

I want to give the crumpled sphere the smooth shading of the non-crumpled sphere, but keep it's geometry complex. This would cause it's silhouette to still have the high detail of the crumpled sphere.
Can this be done?

Does this only need to work for spherical normals, or do you need to apply this towards mapping the normals of other meshes, too?

Bake Normals to Object's Space
Normals map are often baked on Tangent space, but as in the "reverted" process you brought Object's space is probably more appropriate

The following image is showing a low poly shape at the top, while in the middle and in the bottom there is the high poly mesh. The lower rigth texture is the result of the baking of the Normals of the low poly to the high poly.
The shape in the middle is using that texture as imput for Normal map of a diffuse shader.
In the right of the 3D view, the shapes are duplicated with a different material showing the Normal map used for the shading.

Looks like some of the ridges and valleys don't bump up as in the lower shape, so coming back to your main question, I would answer yes.

This looks good. I have it working in some simple tests, but when I try to test on more complex objects I get errors to do with Cuda and the bake fails, or if I change it to CPU it crashes. Sooo I need to figure that out before I can tell if this really works.

In the case of a spherical object, it is pretty simple. Just add a Normal Edit modifier and enable Auto Smooth in the Normals panel of the Object Data menu.

Before:

After:

That certainly works for spheres! But how about other shapes? I used a sphere as an example because it was easy to demonstrate, but it is not the end goal.

To reduce normal influence you can change the intensity in the node settings. If you were sculpting with the multires you can work in layers that way.
I wouldn't really suggest projecting a low res mesh onto a high res one and if that is what you want to do I'd suggest retopoing you're mesh and working from that.

You can always go into sculpting mode, hit s for a smooth brush and smooth as much as you'd like.


text:
Blender on Second Monitor suddenly lags
I run a 3 monitor setup. I'm on windows 7 with 3.4ghz quad core, 32gig RAM, Titan GTX, and 770. My primary monitor is on the Titan, and the secondary 2 monitors are on the 770. I have been used to running my 3D viewport on the main monitor, and a secondary window on the 2nd monitor (usually node editor) and then a web browser on the 3rd monitor.
My second monitor recently took a knock and started having problems, so I got a new one. The new monitor has become the primary monitor, and the previous primary monitor is now the 2nd monitor. And now, whenever I put a second blender window on the 2nd monitor, it lags horribly and is unusable. If I put it on the 3rd monitor, it works fine (but that monitor is small, so I don't want it there.) Other programs work fine on my 2nd monitor.
What can I do about this? Nothing else about my setup has changed. All drivers are up to date.
Update:
If I switch to a basic theme, the problem goes away. But why is this suddenly necessary when I never had this before?
Update 2:
I have noticed that monitor 3 runs things just fine with no lag. I vaguely remember in the past when I had a different 3 monitors with an older setup (had a 580 instead of Titan) I had the slowdown issue, but on monitor 3 instead of 2. Perhaps it is able to run 2 monitors without slowdown, and my resuffling of monitors means the poor performance is now on current monitor 2, when before it was on monitor 3?

Becus it used to work fine and you haven't updated blender it is probebly not blender. You should poste it in superuser or another computer focused forum.

@AlfonsMarklén It is an issue that exists only within Blender. None of my other programs are having problems. It is something to do with how Blender is interacting with the rest of the system. And on google I can find other examples of people asking about the same problem with Blender over the years, but none have solutions. If I post a question relevant to only a single program on SuperUser, they'll just send me back here.

Then you should talk to one of the devs and see if they can fix it

@cegaton Yes. And hooked up to the exact same port with the same cable even.

Try playing with the window draw method under File > User PReferences > System > Window Draw Method see if any of those helps, saving preferences and restarting blender in between changes.

@DuarteFarrajotaRamos Tried that, but no luck!

I've had a similar problem in an old WIndows XP machine a few years ago. See if this is related http://blender.stackexchange.com/questions/68311/blender-2-78-with-windows-10-lags-when-interacting-with-the-ui

@DuarteFarrajotaRamos Thanks, but no luck there either. I haven't touched my drivers since switching monitors either.

I'm out of ideas, it's possible that your 770 card can't keep up with the higher resolution of the new monitor but it's impossible to say for sure. Try isolating the problem by checking if it is the card itself. Try switching each monitor to a different card and see if any combination doesn't lag anymore. I am using a dual monitor dual card system myself and have no such problems.

@DuarteFarrajotaRamos Both monitors are the same resolution, and I have tried switching it to the other card. Same problems!

I still don't know the answer to the overall issue, but I have found why this occurred for me specifically.
First, turning off Windows Aero (or doing anything that disables it) will solve this problem. With Aero on, it seems that I get normal performance on 2 of the 3 monitors. In the past, my web browsing monitor was the odd man out. After some flipping things around, I found that whichever monitor was plugged in second (out of 3) will be the one that has issues. So un plugging and re-plugging the screen I wanted good performance on solved the problem, even with Aero enabled.
There must be a lot of variables going on behind the scene that I don't understand, so if anyone ever figures that out I'll be happy to pick a new answer. But for now, this does shed some light on the situation.


text:
Driver based on Render Layer
I want to drive a property in a Cycles material based on the current Render Layer or Scene being rendered. Is there any such property? If not, is this something that could be made as an addon, or is there some technical limitation that prevents it?

Might be a job for a handler instead https://www.blender.org/api/blender_python_api_current/bpy.app.handlers.html?highlight=render.  Drivers and nodes sometimes don't play nicely with each other.

Interesting. How do I find out more about how to use these?

Can you provide an example case?

Avoid drivers inside nodes, it causes only trouble and does not update or work properly. As batFINGER wrote, this is job for handler (which is dirty for this usecase but the only sane option).

Ditto on @LeonCheung forgot to request same..  The which scene part is quite simple I'm not sure on the render_layers.

I just want to use it to drive a mix node's Fac.

You can use Animation Nodes addon to control both:
Basic setup for driving by active render layer:

Explanation:

Scene Input node: Used for reading scene data. (Note: this node can only be found by searching via Ctrl + A. And, considering the huge amount of all kinds of nodes in AN, as a beginner, you may want to create the following nodes by searching as well.)
Expression node: This is a very powerful node, which can do a lot of things. In this case, it is used for reading the name of the active render layer from data path.
Compare node: It outputs the comparison result between A and B. In this case it means: if A is equal to B, or more specific: if the active render layer name is RenderLayer.2, then it outputs True,  a boolean value, otherwise False.
Switch node: It outputs either one of the two values based on the condition input from the previous node.
Cycles Material Output node: Used for controlling Cycles material parameters, very intuitive to understand I bet.

Basic setup for driving by selected scene:

Explanation:

Mostly the same as above.

You can download the addon here. More info see here. If you really want to drive things like that without coding yourself, it is worth learning it a bit.

Ah, great. Could I trouble you to add a bit of explanation on what exactly these setups are doing? Thank you!

Sure, updated. Be free to ask. :)

Finally getting around to setting this up, but I've run into a problem: This drives the property based on my current selected render layer in the UI, not based on the render layer that is actually rendering. Is there a way to change this? I also discovered that you need to set the expression type to String, and also change the compare node to String in Advanced Node settings.

Unfortunately Cycles material is kinda global data, which means few variables can be applied to different users (objects) based on the same material. However you can still use some tricks to have different look on different objects that use the same mat.  One trick is by setting different object index number for objects in different render layers, then use the Object Index value (located on Object Info node within Cycles) as the variable. This is quite doable with or without AN.

Sorry if I am misunderstanding, but i'm not having an issue within the Cycles material. The issue is that the data path driving the expression is linked the layer i have actively selected in the UI, not the layer that is actually being rendered.

I see. But what if a object is on both render layers? What should the material look like in such case anyway?

When it is rendering layer 1, it should be mix fac 0. When it is rendering layer 2, it should be mix fac 1. Currently I can do this by clicking on layer one, rendering, then clicking on layer 2, and re-rendering it by  hitting the button on the render layer node in the compositor. But manually doing this wouldn't work so well if I add more layers, or if I want to leave it rendering for awhile.(The secondary layers are for masks based on textures and geometry inputs already setup within the material.)

In that case, things will become much more complicated I bet. Additional coding will be inevitable, with which I can hardly help. Sorry man.

How would I achieve the same with Blender 2.8?


text:
Manipulate individual UV islands in Cycles
Is it possible to somehow use UV islands as a factor for things in Cycles? For example, I want to use a different procedural texture on each UV island, or factor between different shaders for each UV island?
I know this is not a readily available output from any node, but is there a way to construct something like it from available nodes, even if it's not precise?
I would like to achieve an effect similar to manually rotating UVs in the UV/Image editor, but without actually changing the map. For example, consider if I had a character in a T pose whose arms and legs were unwrapped as separate islands. If I use a horizontal wave texture, it would be parallel to the arms, but perpendicular to the legs. If i wanted it parallel to the legs, I'd rotate the leg's UV island by 90 degrees. I would like to be able to do this with nodes inside a material without having to touch the UV map or create multiple UV maps.

Blender doesn't store anything about UV islands. Everytime you want to select a UV island, there is a code to search all the linked vertices - they are not stored in memory in a per-uv-island data structure.
As such - to answer your question - accessing UV islands from within Cycles (without using OSL shaders) is now impossible. Maybe some magic with OSL that would read vertex and UV data would work.
The least you can do is to section the UV space as @Carlo suggested, but that is not what you asked for and does not help when your UV space can't be easily sectioned.
UV data is not designed to store mask info. Use images to store masks or Vertex Colors. Using Vertex Colors has the advantage that they are not dependent on your UV island location or orientation, only on your vertex-to-UV_island mapping. Both images or vertex colors can be updated with code procedurally if your UV unwrap changes.

Take advantage of the island's location
Each UV island belongs to a portion of the UV space. This means that for island that have different position, you'll get different vectors. You can use this info for creating masks.
In the following example, a math node set to "less than" filter the portion of UV space that can be found between U=0->0.2 and V=0->0.2, more or less the space higlighted by the box selection.
The single UV island that can be found inside this portion corresponds to the "face" of suzanne (not head, not ears...they are outside the box), so only that part will be shown white (1), while the rest will be black (0).

You can use the math node output as a factor for everithing you whish (e.g. mixing two shaders, switch between different textures...).
In the provided example, for clarity's sake I preferrred to show a harsh dicotomy between the diffrence of UV islands treatment, but nothing prevent you to use smooth gradients or something else.

That is useful. So it selects based on the UV grid, but not specifically by island? If there were multiple islands in that area, we'd see all of them? And if an island was half in and half out, we'd only get the half inside? I have updated the question with some more info as well.

As told by @Jerryno, there are no info around about the specific UV island. The best you can get for now is to use their location (with all the problems that this approach brings in). Yes, you'll see all the island that would fall into your filtered area and yes, you'll see only the half that is inside.


text:
Follow path object goes to infinity and wont stop
I have been struggling for the past 2 hours to make an object follow a path. The problem is that the object doesn't stop at the end of the curve (doesn't matter if I use path or Bezier) it just goes beyond infinity. If u guys could help me with this problem I would be really thankful.

add bezier path

add object

add object constraint "follow path" to object -> target: bezier path

Tap animate path

on bezierpath: Check "Clamp"


text:
What type of value does Blender use for the Point Rotate Node when set to Attribute?
I really dont understand what value type Blender uses for this node.
I have tried many diferenr values but dont understand.
The nodes I am usign:

The rotation when the value is 1:

The rotation when the value is 2:

The rotation when the value is 3:

Thanks, hope someone can help!

It uses angles measured as radians, not degrees.

Oh, thanks! just some time ago learned about radians.

@nathan For me to mark this question as like "done" without a answer but a comment, sould you add your comment as a answer and if so could you ad it as an answer?

Last time I added an answer that short, it just got moved to a comment, despite solving the poster's problem, so I'm not going to bother.  If you want to mark the question as done, you can feel free to post your answer and mark it.

Okay, thank you!


text:
Stairs on normal map
I try to bake a normal map usin cycles render but have a strange artifacts. It's look like a stairs on output image.
How can i fix it ?

could you please share your file (at least a part of it)? https://blend-exchange.giantcowfilms.com/