text:
Rendering to multichannel .exr has empty rgb layer
When I render to a mulitchannel .exr file and open it in Nuke, the rgb layer is always empty (black).
Instead, the information for the beauty pass is found in a seperate layer called "combined". Why is Blender not putting the result of the combined pass into the rgb layer of the .exr file?
Can I somehow re-route that?

Can confirm this method works fine in Nuke too https://blender.stackexchange.com/a/78156/111749

The OpenEXR file format stores pixel data in 2 ways (Scan Lines or Tiles), and read/writes data in 2 modes (Arbitrary Channels or RGBA Only).

Excerpt from http://www.openexr.com/ReadingAndWritingImageFiles.pdf

In our case, Blender only stores data via the Scan Line method, so our main focus in our the read/write interface in use.
When the OpenEXR format is chosen in Blender, the output class used is the OutputFile class, and the EXR format used is the RGBA Only format which renders out the single beauty pass with no channel information. This means that it only contains a single RGBA frame buffer.

Excerpt from http://www.openexr.com/ReadingAndWritingImageFiles.pdf:

When the OpenEXR Multilayer format is chosen in Blender, the output class used is the RgbaOutputFile class, and the EXR format used is the Arbitrary Channel mode which organizes all image data into Layers and Passes/Channels. There is no RGBA buffer that does not exist inside a Layer and Pass/Channel.

Excerpt from http://www.openexr.com/ReadingAndWritingImageFiles.pdf:

If we have an arbitrary Layer named "Foreground", then Blender automatically calls the beauty pass/channel "Combined" (we don't have control over the channel name, unfortunately). The image data would be defined as "Foreground.Combined.R", "Foreground.Combined.G", etc.
If Nuke is ingesting a MultiChannel EXR file, it should not be trying to read a master RGBA beauty pass because none exists. Image data only exists at the Layer.Channel level.
It probably would be more helpful if Blender could name a Layer as "rgb" (which it can) and the beauty pass "rgba" instead of "Combined" (which it can't).

Let me understand this. So you are saying, that a multi-channel exr file has no rgba layer by default?
Also, all other 3d apps that save multi-channel .exr files put their beauty pass into an rgb layer.

That's my current understanding of the docs. In a multichannel file every RGBA channel would exist within a named Layer. In addition Blender forces the beauty channel to be named "Combined".

I see. Thats really strange that "combined" cannot be changed to "rgba"
I guess thats how all other apps write it out. They name their beauty layer "rgba", or maybe its just the first layer written to the exr file?
Opening such an .exr file from blender in Photoshop also just displays black, btw. So its not only happening in Nuke. Definately a "blender"-thing going on ;)

Your beauty pass will be in its own channel in a MultiLayer OpenEXR, but you can make that the default channel by giving it an empty layer name. The default channels are called "R", "G", "B", and "A", instead of "Beauty.R", "Beauty.G", "Beauty.B", "Beauty.A". Nuke and After Effects should display the default RGBA if you leave the channel name blank in Blender composite. Example in this blog post the image below shows the blank channel name in File Output node:

I have confirmed that this works in After Effects.

Please note if you want to promote your own product/blog you must disclose your affiliation, otherwise your answer may be flagged as spam. Please read How to not be a spammer

Thanks for the heads up. Removed link and posted cropped image.


text:
My composite won't render
I'm modeling the Earth, and I did some stuff in the Compositing nodes. The stuff I did to the earth, won't render. I already have Compositing checkbox in the Render tab under Post processing scroll checked. I don't know what to do.
Here are my node things if that helps:

First you should render the scene as there isn't any data in the Render Layer. Then make sure to connect output of nodes into Composite node in order to render and Viewer node to preview it. See difference between these nodes.

Yep, what Mr Zak said. Also, if you're just doing an F12 still render, the compositor output will go to the UV Editor, where you'll have to manually save the image to disk. This happens automatically if you're rendering out an animation.

Wait so what so which node to I connect to the composite? Sorry I'm new to this.

To render final result which you created connect last node in the tree (MixRGB node set to Add operation in your case) to the output which is Composite node.  Viewer node can be connected too, though this is only for your convenience (to preview).

source: Stack Exchange

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

sort: votes


text:
How to render in blender with compositing
I have started using blender for a couple of weeks now and I got familiar with the compositing interface. The problem is if I change the color from, lets say, gray to red through compositing it will still render as grey. How do I fix it so that it will composite?

I would check 2 things first:

Do you have the Compositing checkbox in the Post Processing panel under Render settings checked? If not the render process will bypass the compositor.

Do you have your compositing nodetree connected to the Composite node? If you only have the Viewer node hooked up you won't see the effects of your composite.

I saw this question in the review, and did not realize it already had an answer. good one.

Yes I have done both of those things they dont pop up in the render though.

Ok, probably be best if you post your blend file then.

I think it would have been to clarify in comments before answering.

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


text:
How to make peeling edges of a paper
I want to model a piece of paper that has curled edges, similar to those created when one keeps a sheet of paper unprotected for a long time, the edges will somewhat shrink. I tried creating a thinned cube and beveling it, but it only gives me rounded corners.
Any thoughts? I am trying to create this effect:

I would suggest to give a look at the Page Curl Tool @ blendswap.com

https://www.blender.org/manual/modeling/curves/editing/deform.html

There are 2 main ways to curl a plane, using the SimpleDeform>Bend modifier, or using the Curve modifier with a curled curve object. I personally think the Curve solution is more accurate and controllable.

Create a curve with a long flat portion and curled portion at the end.
Line the curve up diagonally with the plane so that the curl part of the curve is beyond the corner of the page
Add the Curve modifier to the page and select the curly curve object
You may need to reposition the page or the curl object to get them to line up properly.
Keyframe the position of the curve so that it moved diagonally across the corner of the page. As it does so the corner will curl up.
You will need the page mesh to be fairly subdivied, and may also need to add a subsurf modifier to smooth it out even more.


text:
How can I create a flowing, rippling water surface effect that follows the curves of a river mesh?
How would I create a simple but nice looking river?
Even a small creek or stream of water i just want to know some good ways of doing this!

To get the most from this site it is recommended to show what you've tried, this gives us an idea of your level or familiarity with Blender, and helps give answers. As it stands the question is too vague and we have no idea what kind of answers would be most suitable. Do you know how to model?

You have tagged your question with both 'game-engine' and 'blender-render' which one are you using?

i would recommend this video for your question https://www.youtube.com/watch?v=xNWIUqETWfA

Since the OP accepted the answer as useful, I've gone ahead and edited the question to be more specific. Let me know if it's acceptable.

One of the tricky things about rivers is how to animate the water ripples along the path of the curving river. The best way that I have found to do this is by adding a Displacement Modifier set to UV texture coordinates and using a Noise/Cloud texture as well as UV unwrapping the mesh first before extrusion.

There are two important secrets to this technique.

One is UV unwrapping the river water mesh as a straight line first before you alter it to fit the river shape. If you start with a plane, unwrap it right away, then the UV map will stay straight even if you extrude the plane edges to form the curved river shape.

Secondly, you need to enable the AnimAll addon so that you can
animate the UV map.

Once you do that you can set two keyframes for
    the UV map and then animate it moving from top to bottom. In the Tools panel on the left, choose the Animation tab (after enabling the AnimAll addon). Select the UV checkbox, and click the Insert keyframe button at the appropriate frames after moving the UV map.

This will
    move the texture image along the river and will also move the
    displacement along the river. Once your UV's are set and animated you can use those texture coordinates for material textures or displacement modifier textures.

Here's a test scene using this technique:

@sketcherskt I'm glad this answer helped you. It would be great if you could modify your question so that it more accurately reflected what you were looking for. This way the post will be clearer and will help others more effectively in the future.

I just edited the question to be more specific. Let me know if it does not reflect the main point of your original question.

hey todd mcintosh how was i suppose to know how to make a river and be that specific i thought how to make a river would be enough info and it seemed so but im glad you edited my question to make it more specific.

also how do i add keyframes to uv's?

You use the AnimAll addon to give you keyframe ability on the UV map. I've added an extra screen shot in the answer.

Hey I Kinda Put this project to the side but im still having trouble where you say "Once you do that you can set two keyframes for the UV map and then animate it moving from top to bottom." my uv map looks like a plane with just 4 verts making a squire. but yours has many lines and verts.

Yeah, you UV unwrap the plane because that's easier, then you extrude the  edge in the direction of the river. Once done, you can add some more edge loops in the middle if need be. Because you unwrapped it first, your UV map is straight even though the mesh is curvy. Then you can key frame the UV map vertically in a straight line and the movement on the mesh follows the curves of the river without distortion.

I don't get how to "move the UV map" ... where do you select it and grab it ??? i miss this step... help please

There's a grid of vertices in the Image editor panel when your object is in Edit mode. You can select all of them in the image area and move them with the G command just like you would in mesh mode.


text:
Using a previously made animation and trying to move 1 object in all keyframes
I'm using an already existing animation in StoneHearth because I want it to be similar in style to the original.
What I'm trying to do is basically take this walking animation where a guy is holding two swords in his hands, and I want to move the 'offhand sword' away from his hand and onto his side because I'm going to replace the model with a sheath. I can do this for one keyframe but then the other 192 keyframes move it back to his hand. So I'm wondering if there is a way for me to move the object to his side and then make it attached there for the rest of the key frames.

Can you delete the extra keyframes that you don't need? That's probably easier than going in and manually changing them all.

You may want to post the .blend file if people are having difficulty answering your question in a satisfactory way.


text:
I cannot get a scene to render in blender
I am using Blender version 2.74 with cycles and I have a scene that I cannot get to render. When I click render it will just stay on the viewport will just show a checkerboard and show no signs of rendering. It seems to be using all of the memory on my computer but barely any of the CPU. This must have something to do with the model because I can easily render other models. I have tried disabling all the particle systems on the one object I am rendering but still nothing will happen.
Here is the link to the .blend if anyone is interested.
If anyone can help that would be very appreciated. Thank you.

Thanks for that. I guess I just need more RAM. Also, just out of curiosity, how much RAM do you have?

Your ParticleSystem2 setup for your pebbles is what is bogging down the render. It's currently set for 30k particles with 100x children to render which I think is the source of your infinite render time.
I would cut down on the number child particles by quite a bit. I would also use a blend texture from foreground to background to effect the particle density so it would give me more particles near the camera and less particles in the background. You may have to apply the curve modifier to get the blend texture to work properly.
You could also use a pebble texture for the background pebbles instead of actual geometry particles, which will cut down on your particle count as well.

Yeah, that makes sense. I thought it wasn't the particle system because I thought disabling them in the viewport would prevent them from rendering and when I disabled them it still wouldn't render. Now I realize that I have to also disable them for rendering. I guess I just have to cut down on the particles. Thank you.


text:
The process of rendering animation in Cycles Render
I am a relative noob to Blender. I have started using it to create animations and motion graphics to use for my video projects.
I made a trophy in Blender and animated the camera to add some motion to the scene. I have seen how to render to AVI or MPEG in Blender Render, but can't find how the optimal way to handle your rendered animation in Cycles render.
I rendered out to PNG's and I have seen some stuff to add the sequence to the video timeline, but after that I am stuck. I guess since I plan to do several short animations for intro slides and effects in my videos I would like to know the "proper or best method" to get the high quality animation into my Magix Video Pro x6 editing program. (They "Magix" advertise on the website to be compatible with Blender AVI files).
So since after I wasted about 40 minutes searching on youtube, google and forums, I am hoping somebody can show me the right method to get my animation into its own video object.  I thank you all in advance... sharing is caring :)

You could render it out to an AVI video file and import it into Magix that way.
In my opinion it's better to render out to an image sequence and then import that into Magix. The reason being is you eliminate one phase of video compression that way and Magix has better source material to encode to your final video file.
If you render out your animation to a series of PNG files (you can set the amount of file compression in the Output settings), Magix should be capable of importing the image sequence into its timeline.

Edit: Just realised this was posted a year ago lol
In your question, you said that you have rendered the animation to PNG.
What you could do is use the VSE to add the frames and send it to an AVI and import it into your editing program. See below for pictures:
Click shift-a and add image.

Be sure to set the resolution and start and end frames, as well as the output location.

Be sure to set the codec to h.264 and the color to RGB. Set the format and the codec. Check lossless only if you need to. Press F-12## Heading ## to render out the image.
Note: This works for both Cycles and Blender and the process is identical.

"Greenshot" might help you with your Screenshots and some pretty red boxes and other hints... ;-)


text:
How can I transfer a collection of float values to a node socket?
How can I transfer a collection of float values to a node socket?
This is what I've tried:

Create a list of float values and convert each of them to a string
Pass the string to the socket
In the right place in the script, I will retrieve the float values by accessing the string values from within an eval() function:

list_x = eval(self.inputs['Points'].VectorProperty.x)
list_y = eval(self.inputs['Points'].VectorProperty.y)
list_point = list(zip(list_x, list_y))
I understand that this is not correct. But what is the correct way to do this?

Is there something wrong with just using a float vector as is?

In the case you are describing you can use the NodeSocketVector a socket. It is a built in NodeSocket.
class MyNode(Node):
    def init(self):
        self.outputs.new('NodeSocketVector', name="Vector")

    def get_output_vector_value(self):
        return self.inputs[0].default_value


text:
Vertices not behaving smoothly after Subdivide
This model was made by extruding 2 Bezier curves. I tried joining them at the four vertices but the subsurface doesn't work.
This is the result. I've tried to delete and recreate the vertices several ways but I always get the same or similar result.

This looks like the normals are flipped on half of the model, so subdivision surface claims the outermost edge as the interpolated midpoint between these faces.

Face orientation (normals) was the problem. Once I rebuilt the parts from scratch and made sure to extrude both wireframe in the same direction the issue went away.

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


text:
why my objects normals are not correct

As you can see I have switched viewport to Normals but the tree doesn't show it correctly while a sphere that I spawned shows correct normals
I tried recalculating, set by face and the normals are correctly positioned
How to fix this?

I've attached a edited blend file with a part of this tree

Hello and welcome. As it stands this question is unanswerable and was put on hold for lack of essential details to understand the issue. Obviously only you have access to your scene, so unless you describe it thoroughly you alone know your exact setup, settings and what steps you took to arrive where your are now. Describe in detail what the issue is, supported by settings screenshots with the [edit] button above. Don't post comments or ask a new question, editing will automatically queue it for review so it can be reopened.

It's not quite accurate to say that you're displaying normals.  What's more accurate to say is, you're using the solid view preview, using matcaps aka sphere maps, using the matcap that looks like a normal map.  That's not necessarily quite the same thing as displaying normals.

We can see that it's using that matcap, but that you have the "Color" on the overlays set to "Material", and you've specified a viewport color for your material, over there on the properties view.  So what Blender is doing is giving you the output of this matcap multiplied with your material's viewport color.  When you make a new mesh, it doesn't have that material, so that matcap will be multiplied with a different color, probably, white.
That may have seemed like splitting hairs when I was saying this wasn't technically a view of your normals, but maybe now its more clear why this wouldn't be a good way to, say, make a fast render of a normal pass.  If you want something that actually is a view of your normals, you can switch to a material view and set the render pass to "Normal":

Tried doing that but look how it came out in normal pass                                   https://www.flickr.com/photos/195780152@N06/52135985161/in/dateposted-public/             idk how to make a hyperlink out of it so sorry for the mess

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


text:
Copy light location in relation to object
I am just starting out with blender and could use some help.
I imported an .fbx from Revit and it works great. I have some streetlights in this project and when i change one of them in blender then all of them change.
Exactly like I want. But now I want to add a lightsource to all of the streetlights, and blender won't add them to all streetlights. I set the lightsource as a child of the streetlight. So when I duplicate the streetlight the lightsource will also copy with it's parrent. However I allready have all the streetlights placed (in original model). So this doesn't help me.
Is there some way to copy the location of the lightsource in relation to the streetlight, and then paste a new lightsource to a different streetlight using those coordinates? Or is there a different way to add the lightsources to all the streetlights?

https://blender.stackexchange.com/questions/24391/how-to-create-an-array-of-lamps

Something along these lines may work. This version assumes that your lamp-posts are instances, and the only transforms responsible for putting them where they are, are their own, without the interference of parenting or constraints. You may need to arrange that, by, for instance, clearing their parenting, keeping their transforms.

Make a backup of your file
Alt D create an instance of one of your lamp-posts
(Probably, you'll want to isolate it / hide everything else, so you can see what you're doing)
Ctrl A, or via the Header > Object menu, > Clear all its transforms
Position your light where you would like it, relative to the lamp-post
M Add the light and the lamp-post to a new collection, called, say, 'Practical'
With Shift C the 3D cursor at World 0, Shift A add a new Collection Instance to the scene, based on the new collection.
Unhide your original lamp-posts, select them, and then your
'Practical' Collection Instance, so it is the active object.

Now we want to make a copy of the Collection Instance in the place of all the existing lamp-posts. I'm surprised there isn't an operator / add-on to do this without scripting, but unless someone finds one for us, here goes.. run this script:
import bpy

C = bpy.context
D = bpy.data

src = C.active_object
src.select_set(False)
sel = C.selected_objects

cp_col  = D.collections.new('Practicals')
C.scene.collection.children.link(cp_col)

for ob in sel:
    cp = src.copy()
    cp.matrix_world = ob.matrix_world
    cp_col.objects.link(cp)

it should create the copies in place, and put them in a new collection called 'Practicals'. (plural)
Hopefully, you should now be able to hide the original lamp-posts, and see them replaced with practical, light-bearing instances. And be left in a state from which you can change all the lights / do whatever you like, by editing the objects in the 'Practical' collection from which the Collection Instance is derived.

Hello Robin Betts,
Thank you for your response! and sorry I am reacting so late. But I just got back to this.
I followed your steps as best as I could. And it seems to work mostly.
It copied the light and object to the right location, and with the right orientation. However the scale doesnt translate well. Both the light and the object where too small. It also left the old objects. So I have to delete those. All in all this is not a bad result. I just have to scale the objects with their own origin and delete the old ones. But maybe you know why the scale is wrong? Thanks so much!!

OK, sorry, maybe bullet 4  should have been: 'Clear Translation and Rotation, and Apply Scale'. When modelling, I'm always careful not to leave any object-level scale transform hanging around.  I scale in Edit mode, or apply scale as soon as possible. The old lamp-posts were left in place intentionally, for safety. If they are all in, or all linked to, a collection of their own, it's not hard to delete them all at once, when you know you're good to go.


text:
How to make Selection Sets select also hidden bones
I'm an absolute beginner with blender and I'm trying to evaluate switching from Maya to Blender for work, but there are things that I can't manage to solve.
Let's say that I have a selection set with all the bones I want to key for a character. I key them all, and do my animation. But some bones switch their visibility on and off during the animation. So if I want to do some retiming that involves the whole character, I need to be able to select and adjust the keys for all the bones, not only the ones that are visible at a certain frame.
For now, I haven't been able to find a way to manage this, cause when a bone is hidden it doesn't get selected, even if it is in the selection set. Does anyone know how to do this?

what do you mean by "some bones switch their visibility on and off during the animation"?

I mean that some bones could be hidden at frame 1 and they could be visible at frame 133, for example. And some other bones could be visible at the beginning and get hidden during the animation, and then become visible again. What I mean is that the visibility of the bones changes during the animation, and I'd like to still be able to select them with the selection set even if in one particular frame they are hidden.

How are they invisible? Hidden by what? If you're talking about object hiding the bone you need to enable the In Front option in the Properties editor > Object Data > Viewport Display

no, sorry, I mean there's a custom attribute that drives the bone's visibility in the viewport or the visibility of the entire bone layer.

oh ok I see, I've never used keyframes on the bones visibility


text:
Why are lamps and mesh lights not illuminating anything?
There are several techniques to do a 3 point lighting system.
How do you properly light a scene while using mesh planes as emission light sources?
I'm following this tutorial, however despite setting up planes to act a lighting sources, the scene is still very dark.

Actual Blender file here:
https://dl.dropboxusercontent.com/u/460997/clock%20copy.blend

In your file, Clamp direct  and Clamp indirect have both been set to .03 in Render settings > Sampling.
This is forcing all the samples to return a value less than or equal to .03, which results in the apparent lack of light.
Set them both to zero to disable clamping:

Then it should work as expected:


text:
Render on more than one computer?
Is there a way to use other computers that are sitting idle on my network to render my images?
From google, I've found this project, however it appears that is designed to let everyone use your hardware, in exchange for using theirs. Also, there is no guarantee to how soon your project will start rendering.
I have a bunch of servers sitting around that were bit coin mining. Is there a way to use them for blender?

You could set them all to output to a shared directory, see http://blender.stackexchange.com/a/5263/599

If you can connect all the machines to the same filesystem, whether physically or with something like sshfs, then you can use the placeholders and overwrite options to create a simple renderfarm.

Set all the blender instances to output to the same shared directory.  Presumably you'd have one blender instance per machine, but you can have more (e.g. one for CPU one for GPU).
Disable overwrite so that blender won't render frames for which files already exist in the output directory.
Enable placeholders so that an empty file is created when blender starts rendering a frame, "reserving" that frame so that blender instances with overwrite disabled will automatically skip it.

Start all rendering on all instances.
If everything is set up properly, instances will skip frames which are already rendered or being rendered by other instances.

You could use Sheep it it provides services for collaborative rendering.

You machines will render your own projects first.

When your machines render frames from other projects you earn credits, more credits increase the priority of your projects.

The service only accepts projects up to 500MB (including packed caches in a zip file).

the client-software can be run from a browser as Java-Applet (I had problems with the latest Java), therefore I would recommend to use the alternative to download a standalone client.

FAQ

If want to try it and would like to have working scripts to start the client, leave a message and I will add them here.
Network Render
Blender has an addon for Network Rendering in order to use it you can enable it in the User Preferences:

Manual
Web Interface
Video, tutorials

Does using Sheepit mean each computer has to download the whole blend file?

@GregZaal Yes, I'm pretty sure that's the case. using Sheepit is only really practical if you have a fast network connection, as it downloads it's own version of blender each time it renders. (There is a preference when submitting a project to set the version to be used.)

@GregZaal exactly as gandalf3 explained and you should also know that the .blend file is downloaded to a /tmp directory and could be stolen by anyone who participates in rendering your project.


text:
Can you add more loop subdivides later?
If you create an object, then subdivide it (ctrl +  r), how can you later add more loop subdivides?
For example, if I try and add more loop cuts, the are confined to only a portion of the cube.

Yes and no.
One thing you can do is this:

Switch to edge select mode (⎈ Ctrl↹ Tab)
Select an edge ring (⎈ Ctrl⎇ Alt RMB)
Multi select edge loops (Fastest to access via the Space menu)
Subdivide

Example:

However this only lets you double the number of existing loops.
Without deleting loops/other manual tricks, I don't think there is currently a way of getting a precise number of evenly distributed loops, especially on more complex objects.
See Is there any way to edit parameters for an object after it is created?

I don't know if there is a better way of doing it, but you could try selecting the edges from the original loop cut and using limited dissolve (press x, click limited dissolve) and re-doing the loop cut after.  might need to use a different dissolve option.  Again, just a quick thought...there may be a better way


text:
Controlling armature through python
I need to control an armature using Python so that I can animate a biped model using data from a text file.  I've been using this tutorial and some other sources to try and do so, but I can never see any results in the rendered game window.
The code I have thus far is:
import GameLogic

arm = GameLogic.getCurrentController().owner

print(arm.channels['Upperleg.L'].rotation_euler)

arm.channels['Upperleg.L'].rotation_euler = [5, 5, 5]
arm.update()

print(arm.channels['Upperleg.L'].rotation_euler)

In the console, the values for BL_ArmatureChannel.rotation_euler are changing...
<Vector <0.0000, 0.0000, 0.0000>>
<Vector <5.0000, 5.0000, 5.0000>>

...but nothing is happening with the model linked to the armature (not visually at least).  If I change BL_ArmatureChannel.rotation_euler to BL_ArmatureChannel.joint_rotation the values being printed in the console don't change at all.
On my armature, I have an "Always" sensor attached to a "Python" controller to execute the script.  There are no IK constraints on the armature and no other sensors/controllers/actuators.
Any help on this matter would be greatly appreciated.  I have a tight deadline on this project and I can't seem to get this very simple (but necessary) part of it working.

I'm afraid dynamically changing the mesh connected to the armature is not possible inside the Blender game engine without implementing it as a new feature in the source code.
All deformations of meshes must either be done vertex by vertex or through actions in the Dope sheet editor.
If you create action logic bricks that correspond to the limb movement you are trying to get to work, you should be able to get limited model deformation movements going. Changing an action actuator's start and end frames is possible when the game engine is running. This gives you some of the control you seek.

I see, thank you for letting me know.  That makes sense now, all the tutorials/examples I've seen of BL_ArmatureChannel.joint_rotation() used robot models with non-deforming meshes.  I've already switched this project over to Unity, which is capable of script-based mesh deformations via armature rotations, so I'll just stick with that.  Thanks again.

I realize I'm a few months late but there are actually several ways to control a mesh deforming armature from within BGE without rewriting the source code. Here's probably the simplest method:

Create an anchor object such as a cube. The size, shape, and location are
unimportant.
In pose mode, select the armature you want to use and add the bone
constraint "copy rotation", then choose your anchor for the target.

The rest should be pretty self explanatory. As you rotate the anchor (using python or logic bricks) the armature mimics it and deforms the vertex group it's assigned to. If you're using this with something complex, like a humanoid model, then you'll probably want to use a script. If you're uncertain how to do this a good example is the "brik" ragdoll plugin. The source for brik will show you how to easily search for bones in any armature and automatically create, name and assign anchors in just a few lines of code.

I think you just forgot to set the mode as stated in the manual:
bge.types.BL_ArmatureChannel
Excerpt:  rotation_euler Note: This field is only used if rotation_mode is > 0.
This worked for me (v2.69):
tA.channels['middleBone'].rotation_mode = logic.ROT_MODE_XYZ
tA.channels['middleBone'].rotation_euler = ( 0.5, 0, 0 )
tA.update()

This worked for me too, though I have GameLogic.ROT_MODE_XYZ, I assume @user3054986 must have import GameLogic as logic. (I'm psyched I've been looking for this the last few days, thanks!)


text:
Weird Armature Deformation
When I apply an armature to a character (with automatic weight), my character gets a really weird bend on any parts of its body. I have rigged a character before, so I don't know how it went wrong. I've repeated the process multiple times and got the same results. I even tried exporting it as a mesh and loading it into a new blender file, but I still get the distortions. I have the blender file available, but don't know how to share it, so if you need it, tell me how.
EDIT: Here's the file: http://pasteall.org/blend/23791. The bones are in place, but the modifiers need to be applied before applying the bones. (With automatic weights.)
 .

While you can rig with a Mirror modifier on your mesh, it is best in your case here to just apply it, you won't be able to rig your character properly if it is active with your current naming scheme. You might also want to then change your Pivot center from 3D Cursor to Bounding Box Center by using , (comma) or selecting it from the view header, having it set to rotate around the 3D Cursor can also lead to some weird behaviour when trying to pose if you don't know what to expect. You might also want to recalculate your mesh normals at this point with CtrlN.

…and finally, try again..

For some help in parenting the mesh to the armature, you can refer to How can I automatically generate vertex groups for an armature?. It wouldn't hurt to add some more geometry (loopcuts) to the arms and legs to help the character deform better either.

I found out that all my normals were inside out. i recalculated them and tried the armature again, and it worked. I couldn't answer my own question because of my low rep.

@Ripspace Ah, there were several problems including that. Unless you know what your are doing, it is not considered wise to rig with a mirror modifier on your mesh.

I applied the mirror mod as well. Changing the pivot point is a good thing you pointed out as well.

@Ripspace Ok, I was working with the file you uploaded so I pretty much covered all the possible reasons why it could have happened.

@Ripspace Actually, keeping the Mirror modifier is OK as long as bone naming is symmetrical (with .L or .R suffix) and no shape key is involved. This armature's bone naming could be much better.

@Adhi Instead of getting into the technicalities, I thought it best to have OP just play it safe and get it to work. I added it to the answer.

@iKlsR No mere technicality. I just fix bone naming, redo automatic weighting, and the result is a decent start. I'll just point out the importance of proper bone naming for automatic weighting, then.

I've read all of the comments. I plan on renaming the bones; I just needed it to work first. I'm making a video game, so naming is actually very important to me.

@ColinRCasto Then try using the button I outline in the answer and selecting the pivot point that you want and to recalculate normals, you need to be in Edit mode.


text:
Why can't I see my texture in prevew and render view?
I have painted in substance painter and imported the texture. I can see the texture in texture mode. When I render or preview render it  the bottom mesh (body skin) is showing just a basic color. The other mesh (antenna) is showing in both texture mode and in render. I have assigned the texture and uv map also. Any suggestion or help why I can't see it?
Texture Mode

Preview Render

Nodes

Can you please share a bit more, like your whole node setup and the active texture in the UV-Editor? Best would be a part of the blend-file.

@quiliup i have edited uploaded the nodes. It with the node wrangler addon set

You have Subsurface scattering set to 1.00 This is a lot, the green color will overwrite the texture. Try a lower value of Subsurface (0.2 or 0.3 would be my guess)


text:
How do you optimize Blender/mesh for sculpting with multiresolution modifier?
When I sculpt using Multirezolution modifier I use the following tricks:

I start with a base model which has 1000-5000 vertices
For each subdivision level I try to finish all work which can be done there
I only do fine details when I reach multimillion faces level
If things are too slow -- I make a copy of my model, move it to different layer,
apply Multires, sculpt, and then reapply my changes using 'Reshape' button of Multirez modifier

Can you advise on other settings to make Multirez perform faster?
I would like to clarify -- there are situations where Dyntopo is not a right choice: for example after you done with exploratory sculpting, went through retopology, created UV maps, and reintroduced details level lost during retopology.

Edit: This post was made when the referenced tools were still considered experimental and not a part of the official builds.  Now these tools and more are available from official builds.
There is a new option for adding fine detail but it is not fully in trunk yet.  You would have to grab the GSOC Paint build from Graphicall.org.
Psy-f's build has curve and line tools that work as precision stroke brushes.  Maybe that definition is not exactly correct but it's close enough I think. They work in sculpt mode as well but this requires extra geometry which is going to slow you down.
The idea here is to attach a 32 bit texture map(currently available) to your models UV's and then use that as a bump map. As is, this will not create real geometry but instead will create the illusion of extra detail which can be baked as a normal map.  This seems to me to be the ideal situation for smaller detail since anyone would be hard pressed to tell the difference between real displacement and normal maps when it comes to the small scale that you are hoping to work with.  This technique will also dramatically decrease your render times and the possibility of your computer locking up.
If, however, you insist on using true displacement then you can use this bump map in combination with the displacement modifier at a later stage.  This will allow you to work with a lower poly model during the sculpt/modelling process and then you can crank up the multi-res detail in combination with a displacement modifier when it's time to render.
Even still, without the most excellent curve and line tools you can still paint bump maps but it's much harder to get the precision that these new brush tools provide.

it is an interesting workflow

Psy-fi's paint branch is now in trunk.

I'll update the answer to reflect this.  Thanks for the notice.

Try the new Dynamic Topology! From the wiki:

Dynamic topology is a new sculpting mode that subdivides the mesh as needed, whereas regular sculpting only affects the shape of a mesh. This makes it possible to sculpt complex shapes out of a simple mesh, rather than just adding details onto a modeled base mesh.

To start using Dynamic Topology, remove or apply your Multiresolution, then enter Sculpt Mode and select Enable Dynamic Topology under the Topology tab of the Sculpt toolbox.
This eliminates the need for Multiresolution, because the resolution is automatically adjusted as you sculpt. You can hit the Optimize button to optimize your mesh.
To adjust your resolution change the Detail Size (ShiftD). This is measured in pixels: any attempt to sculpt on surfaces with a lower vertex density than this pixel length will be subdivided. This means that you can very easily adjust this by zooming in or out, or manually with the Detail Size setting.

 source
Here's an example of using Grab (no dynamic topology) vs. Snake Hook (with dynamic topology):

I would highly recommend Kent Trammell's video series Creature Modeling for Production (USD $48), which uses dynamic topology, among many other tools.

I love Dyntopo, however for many cases multirez is a better choice


text:
Is there something similar to curves' tilt for skin modifier?
I want to create shoelaces with skin modifier. I use Ctrl-A Y to flatten cross-section, and all looks good, but when I start to move vertices the angle of flattened part gets distorted and it does not confirm to the shoe surface. For curves I would use Tilt to solve this problem, but I do not know if something like this is possible for skin modifier as well.
Is there a 'tilt-like' way to control skin modifier? Am I better off to use curves in this situation?

I would use curves

Is there any particular reason you want to use skin?

I do enjoy using skin modifier wrapped between two subsurface modifiers when I can. I do it because I can use the same tools I use for retopo and modeling and I tend to be faster at making what I need than with curves

Unless you're planning on animating the laces later, I would use curves, as  GianCowFilms has already suggested.

From the very nature of the Skin modifier, this is not possible. Vertices do not have any rotational data, only location data. Because of this, it would be impossible to "tilt" the Skin modifier result, as it uses vertices to interpolate the resulting mesh.
Most of the examples I have seen the modeller is using curves. By using extrusion and bevel you can make great flat laces, and round ones are even easier. They also are completely editable at all times.
I would strongly recommend using curves for this.
There is one example here that you can see. There is also a solution for one of the issues you might run into.


text:
Rendering animation frames with GPU and CPU
Assuming I am not using any shaders which are CPU only, would you recommend against mixing GPU and CPU Cycles network rendering of an animation?

Which rendering engine?

BI doesn't support GPU for final rendering, so I assume Cycles?

Yes, Cycles, I'll edit the question

I don't have a GPU myself, but I don't see any reason why you wouldn't want to. Do you have any specific concerns?

Related: Cycles hybrid rendering

possible duplicate of Should I open two blenders to render with my GPU/CPU?

No, I would not recommend against it, mainly because even if there are problems with hybrid rendering with the native network renderer, it's REALLY easy to get around it. By rendering to a network location and turning ON "Placeholders" and turning OFF "Overwrite," any computers rendering to that location will sort it all out themselves, very nicely. This doesn't automate nearly as well as the Network Renderer (i.e. not at all), so if that's important to you, that would take some scripting.
But in short, there is a way to cooperatively render with multiple computers using a mix of GPU & CPU.


text:
Can I copy UV map to many objects with the same and/or symmetrical topology?
I made a shoe, which needed to fit 7 different characters. So I made a mirror object for another leg, and then copied resulting 2 boots 7 times and changed shape to fit the 7 characters. Then I found I have a problem in my UV map layout.
Is it possible to fix it once and then propagate it through all 14 objects, or I have to start again from 1 shoe?

Does Ctrl+L > Transfer UV layouts work?

@gandalf3, it does work for identical, thank you, I wish I could accept comment as an answer. And it worked for me for symmetrical objects as well.

I used the suggestion given by gandalf3 and made it all work for my case. Here is the procedure:

I have 14 shoes objects with identical broken UV, 7 of them are mirrored (using CtrlM mesh mirroring).
I fix UV on one of the shoes
I go to its mirrored version of the fixed shoe, flip normals and then use CtrlL -> Transfer UV layouts. (If I do not flip normals transfer does not work right and resulting texture is a mess).
I flip normals on the mirrored object again. At this point one size of the shoes has right texture with correct UV map for both mirrored and not mirrored mesh.
I use mirrored mesh to transfer to all 7 mirrored sizes  by selecting all mirrored objects and selecting last the mirrored object with corrected UV and using CtrlL -> Transfer UV layouts.
Repeat the same procedure for not mirrored 7 sizes.

I've asked a similar question here to get a solution, and I've finally figured out on my own how to fix this. In my case that was about to transfer uvs from one static character with the uvs done, to the same character mesh animated/rigged, whitout uvs.. CTRL+L gave as result a mess, so I've finally simply deleted the half of my static character, I deleted as well the half of my animated character, and this way I could transfer uvs properly. After that I just had to apply again a mirror modifier to get my full character...It seems transfer uvs has some troubles with overlapped uvs no!?

sounds like a good approach. The difference was that in my case I did not have mirror modifier, my other boot was made by applying mesh mirror Ctrl+M


text:
Creation of a seamless texture from a model
I would like to create a seamless normal map from a model I constructed.
First I made a model

Then I baked a texture in Cycles as a Normal map to a squared plane, with a non-seamless result

As a next step I unwrapped a square plane, arranged its duplicates that shared the same mesh (made with Alt-D) to see a seamless pattern, and by manipulating uv map, made sure that the texture on the plane is seamless

What is a good way to transfer the seamless part of the square back to a new texture? I managed to do that with baking Emit like below, but I guess there is a better way?

"Baking Emit" method is clunky because after it is done I have to crop transparent part from the image and resize it back to 1024x1024 size

You don't need that much texture, if it is truly a repeating pattern you only need one single tile or module of image, you can either get away with a much smaller texture, or get a lot better definition from the same size. Anyway you are probably better off baking or rendering a seamless pattern directly from the original object by properly adjusting and orthographic camera above it, or a correclty sized plane

it is a good point Duarte, I could use much smaller texture, and by proper calculations figure out exact parameters for orthographic camera. I would still like to know though if there is a way to 'crop' an image using uv-map data

The Vector Mapping node does have a min and max limiting factor which could, I think, be used for image cropping.

CGMasters has a tutorial on making tiling textures.

Thanks sambler, great tutorial, although a bit tangental to the question

Use another UV map for target image
The parts you must crop are created by the usage of the same UV map for both the source image and the target.
If you create another UVmap for your object that is filling completely your target image space and set up proper relations for the images coordinates like in the image below, you should be able to achieve a cropping of the image.

good point! No image manipulation anymore, however still baking a perfectly fine image second time (in Emit mode)


text:
How to project an image of high dynamic range?
Versions: Blender 2.7.6.2, Gimp 2.9.3 (development version)
I am trying to make a texturing workflow based on using projecting images from camera to a model. In the menu in Texture mode there is an External tab which contains Apply and Apply Camera Image. Both of these buttons depend on bpy.ops.paint.project_image(image=image_name) function.
When I project a high dynamic range image, for example 16bit PNG or 16-32-floating exr onto 32 bit texture image all seems to work well. However when I save the resulting texture in Gimp and look at its histogram this is what I see:

It seems that in reality projected image only has 8-bit information. Is there a way to manipulate context for the project_image to make it output
16-32 bit dynamic range? Or may be there is another way to achieve high dynamic range projections?
Waveforms from a blender file example:
I used a the the same crop where all files had visual information.

Baked into 32-bit texture (EXR)

Camera render (EXR)

Projection of the Camera render (also EXR)

Is there a .blend file which we could download to troubleshoot the steps you took to create the 32bit render?

And here is a related question

Development version of Gimp 2.9.3 does work with 32 bit

Don't use GIMP for that. It's a development version and it's possible that some things don't work.
Open the EXR in Blender instead and use the waveform monitor or histogram set to full sample to evaluate whether there is posterization or not.

Of course I did check if it is a Gimp problem. It is not.

I submitted an issue to Blender Development

I'm voting to close this question as off-topic because the problem was caused by a bug which has been solved in this commit.

The ability to project high dynamic precision images had been added to Blender's master branch by Campbell Barton. Thanks Campbell!
See the corresponding issue


text:
How to clean weight groups by script?
After transferring weights from one object to another vertices might get multiple groups with very low weights. In weight painting view there is a tool 'Clean' that allows to remove all the groups with low weights.

To automate the process I am trying a script like
for obj in bpy.context.visible_objects:
    if obj.name[-2:] == '-l':
        obj.vertex_group_clean(group_select_mode='ALL', limit=0.005, keep_single=True)

In this snippet I go through visible objects, and if their name ends with "-l" I
want to run vertex_group_clean method, but the script fails with AttributeError: 'Object' object has no attribute 'vertex_group_clean'
What do I do wrong?

I did come up with a solution, but probably not the most elegant one. The vertex_group_clean method is an accessor to a menu, it is not a method to an object. So in the solution I select and activate an object, then switch to weight view, select all the vertices, do cleaning, and switch back to object view.
def active(obj):
    bpy.ops.object.select_all(action='DESELECT')
    obj.select=True
    bpy.context.scene.objects.active = obj
    bpy.ops.object.mode_set(mode = 'OBJECT')

for obj in bpy.context.visible_objects:
    if obj.name[-2:] == '-l':
        active(obj)
        bpy.ops.paint.weight_paint_toggle()
        bpy.ops.paint.vert_select_all(action="SELECT")
        bpy.ops.object.vertex_group_clean(group_select_mode='ALL', limit=0.005, keep_single=True)
        bpy.ops.paint.vert_select_all(action="DESELECT")
        bpy.ops.paint.weight_paint_toggle()

It does the job, but I hope there is a better way to write this :)

Do you mean bpy.ops.object.vertex_group_clean(...) ?  Have a look at this post

oups, @batFINGER, yes that was a typo, fixing it


text:
Locking a vertex group from modification
In a mesh there is a group of vertices which should not move after being positioned once. I would like to find a way to lock them in place for the whole duration of the project.
Currently I 'lock' them by hiding them and then sculpting. I imagine it is possible also to create shape keys for the vertices. Or I could write a script which would save position of the vertices.
Is there a better way to do it?

When I read your topic I was going to suggest hiding them. Btw, is it only sculpting or is it modifiers and edit mode also?

I would like to lock them completely

I think you outlined most of the the good ways, but here is another option:
Mask modifier:
You could try using the Mask modifier:

Add a mask modifier, select your vertex group and enable Invert so the vertex group is hidden.

Enable Edit mode visibility and Apply to edit cage so that there is no way to select the vertex group elements in edit mode:

This will basically function like hiding geometry, except it gives more control and does not interfere with normal hiding.
Note that it does not work in sculpt mode (hidden geometry will still be sculpted)
Shape keys:
However, I Think Shape keys is the way to go as it works for both modeling and sculpting.
To set this up:

Add vertex group of all the geometry to want to modify (excluding the geometry you want to lock)

Add two shape keys, a Basis and a shape key. Set the Value of the shape key to 1 and do your modeling sculpting etc.

Set the Blend group to your "modifiable" group. Now only the modifiable geometry will be moved to the new shapekey position, the rest will remain in the Basis position:

I also found out how to save location of selected vertices with scripts (from Edit mode). I am not sure though how stable vertex indices are.
to dump data:
import bpy
import bmesh
import mathutils
import os

obj = bpy.context.active_object

bm = bmesh.from_edit_mesh(obj.data)
sel_verts = [ vert for vert in bm.verts if vert.select ]
print("number of verts: {}".format(len(sel_verts)))

path = os.path.dirname(os.path.dirname(__file__))
file_path = os.path.join(path,
                        'scripts',
                        "%s_dump.tab" % obj.name)
f = open(file_path, 'w')
for v in sel_verts:
    row = "%s\t%s\t%s\t%s\n" % (v.index,
                                v.co.x,
                                v.co.y,
                                v.co.z)
    f.write(row)
f.close()

And to restore:
import bpy
import bmesh
import os

obj = bpy.context.active_object
path = os.path.dirname(os.path.dirname(__file__))
file_path = os.path.join(path,
                        'scripts',
                        "%s_dump.tab" % obj.name)
f = open(file_path)

verts = {}

for line in f:
    (index, x, y, z) = line.strip().split("\t")
    verts[int(index)] = { 'x': float(x),
                          'y': float(y),
                          'z': float(z) }

bm = bmesh.from_edit_mesh(obj.data)
for v in bm.verts:
  if v.index in verts:
      vv = verts[v.index]
      v.co.x = vv['x']
      v.co.y = vv['y']
      v.co.z = vv['z']

bmesh.update_edit_mesh(obj.data, True)


text:
How to bake in Cycles to an external file
When I try to bake in Cycles without creating a material with an active image first, I get an error message (Blender 2.77)

No active image found, add a material or bake to an external file

So from the error message I assume that except commonly known way of adding an active image to the object material, it is possible to bake to external file directly, if material is not really needed.
I would like to know how to bake to an external file in Cycles without creating a material with active image?

Not so sure what you're asking, so the steps to create a bake is simply unwrapping your object, creating a new file image by pressing the new button in the render window, and then baking as you wish, so what differently are you trying to do here?

@Luka ash -- this is how baking works for Blender internal, did you make it to work for Cycles as well?

If by "file" you mean "image texture" the solution is quite easy.
Just add a texture node to your node setup that is not connected anywhere. Then go to UV image editor, create a new image and use this in the texture node you created before - like in my setup below (the active image in the red square).

That's 'normal way', and the error message implies there is other day of doing this

Actually the correct answer... I don't understand how a python script can be the accepted answer. OP asked for saving in external file. In General, Docs say "The baking happens into the respective active textures of the object materials. The active texture is the last selected Image Texture node of the material node tree" Source - you can unpack that into an external file easily.


text:
How to save normal map texture from Blender?
Normal map's neutral color has to correspond to #8080FF HEX value. In this case the resulting normal will be exactly the same as the normal of its underlying face. When I made a normal map texture in Blender and imported it into a game engine, I found that at seams I often get strong artifacts, because all my normals got skewed by the texture color offset (my neutral color was BCBCFF)
I am trying to save a normal map from Blender (OS is Ubuntu 15.10) so its neutral color corresponds to 8080FF. Here is what I am doing so far:

Generate a texture -- Color space 'Raw', 32bit float.
Bake normal map in Cycles or Blender Internal
To check that I have #8080FF as neutral -- in the paint mode I select 8080FF color, paint over neutral color region, and I can see the neutral color is identical to #8080FF
Save image as 16 bit PNG or OpenEXR
When I check the neutral color in Gimp it shows BCBCFF value

What am I missing?

Apparently what I was missing (Windows or Linux) is to check Save as Render box for PNG/OpenEXR. So the following worked for me to generate an external normal map texture:

Generate an image in Raw Color Space and with Float Buffer:

Note that Float Buffer is important, as 8bit dynamic range is not enough for a quality Normal Map. The Raw Color Space maps 8080FF as neutral color in Blender

Bake a normal map in Cycles or Blender Internal
Save resulting map as 16bit PNG with Save as Render checked.

Actually I do not think now that 16 bit or 8 bit is a big deal, but getting the correct RGB values obviously is.


text:
How can I delete or remove a modifier?
I have added a mirror modifier and a surface subdivision modifier but I can't understand how to remove them.

Try the X in the modifier header?

Ops i don't know why I did not notice it until now

Hey eezacque, I added an example image to your answer to make it even clearer for future users. Hope you don't mind ;)

You can also hover the mouse over the modifier panel and hit 'X' to delete it (something I've only just realised myself...) :^)


text:
How to add an image as a plane in Blender 3.0?
I am trying to add an image as a plane in Blender 3.0 but I can't find how.
I have tried shift + A but I can add images only as reference or background. What is the procedure in Blender 3.0 in earlier versions there was an option for it.
What I am trying to do is to render an image in Blender 3.0.

It's a built-in addon. Search for 'Images as planes' in Preferences > Edit > Addons tab.

@JohnEason ah thanks, strange that a new version of blender lack this feature which is quite important for me

That has always been a Blender-supplied addon right back to at least Blender version 2.8.3 so I guess it was enabled in the dim and distant past in the version you were previously using. I guess that you installed 3.0 from scratch rather than updating from your previous Blender version because otherwise the addon settings would have been transferred automatically.

@JohnEason could you write an answer so I can accept it?

Ok. Now added as an answer.

That has always been a built-in addon in Blender, from version 2.8x to version 4.1x. For a new installation of Blender it may not be enabled by default so go to Edit > Preferences > Addons tab, type 'Images' into the search field, and check Import Export: Images as Planes as shown below. For Blender version 4.2+, please see this thread.

The option will then appear on the main Add menu and the ⇧ Shift+A menu.


text:
How to set color object using python and Blender 3.0 individually using a template object
I have tried all the previous solutions but I can not change the colour of objects individually depending on a condition, the following code will produce 4 red cube instead of 2 red and 2 green:
template_object = bpy.data.objects.get('Cube')
matg = bpy.data.materials.new("Green")
matg.diffuse_color = (0,1,0,0.8)
matr = bpy.data.materials.new("Red")
matr.diffuse_color = (1,0,0,0.8)

manlist = [
{"color" :"red"},
{"color": "green"},
{"color": "green"},
{"color": "red"},
]
for man in manlist:
    ob = template_object.copy()
    if man['color'] == 'red':
        ob.active_material = matr
        print('red')
    if man['color'] == 'green':
        ob.active_material = matg
        print('green')
    bpy.context.collection.objects.link(ob)

You do know that the 'diffuse_color' is only used in viewport display and that you need to set the color in the principled shader to change it for render?

Ah, your underlying problem is that your copies all have linked meshes, so you're actually getting them all set to whichever color you used last.

I didn't mention it in my answer, but you could simplify your loop by having manlist simply be a list of materials, something like manlist = [ matr, matg, matg, matr] Then the if statements could be replaced by ob.active_material = man.  It makes manlist less readable but the code much shorter.

As Marty Fouts points out in the comments, your material slot is linked to a mesh, and all objects are linked to the same mesh. Probably the best way to resolve this is to link the material slot to the object:
import bpy

template_object = bpy.data.objects.get('Cube')
template_object.material_slots[0].link = 'OBJECT'
matg = bpy.data.materials.new("Green")
matg.diffuse_color = (0,1,0,0.8)
matr = bpy.data.materials.new("Red")
matr.diffuse_color = (1,0,0,0.8)

manlist = [
{"color" :"red"},
{"color": "green"},
{"color": "green"},
{"color": "red"},
]
for man in manlist:
    ob = template_object.copy()
    if man['color'] == 'red':
        ob.active_material = matr
        print('red')
    if man['color'] == 'green':
        ob.active_material = matg
        print('green')
    bpy.context.collection.objects.link(ob)

Hah! Beat you by 10 seconds.  (or maybe you beat me by 10).

You have two basic problems.
First, diffuse_color is only the display color used for an object in Solid Viewport shading.  You need to actually create a material if you want the color in rendering.  Here's green:
matg = bpy.data.materials.new("Green")
matg.use_nodes = True
tree = matg.node_tree
nodes = tree.nodes
bsdf = nodes["Principled BSDF"]
bsdf.inputs["Base Color"].default_value = (0, 1, 0, 0.8)
matg.diffuse_color = (0, 1, 0, 0.8)

(Notice that while I was at it, I gave you a green color instead of a blue one for "Green")
Red would similar:
matr = bpy.data.materials.new("Red")
matg.use_nodes = True
tree = matg.node_tree
nodes = tree.nodes
bsdf = nodes["Principled BSDF"]
bsdf.inputs["Base Color"].default_value = (1, 0, 0, 0.8)
matg.diffuse_color = (1, 0, 0, 0.8)

Second, your assignment loop is OK, except that the mesh copy() command is linking the mesh of the template object to each of the four new objects, so you only have one mesh.  You're setting the color of that mesh by the last entry in your loop and that happens to be red.
There are several ways to duplicate the mesh without linking.  It seems like using the duplicate operator would work, but I'll leave it to you to select an appropriate one.  But here's how to do it with duplicate
for man in manlist:
    bpy.ops.object.duplicate()
    ob = bpy.context.active_object
    if man['color'] == 'red':
        ob.active_material = matr
        print('red')
    if man['color'] == 'green':
        ob.active_material = matg
        print('green')
    bpy.context.collection.objects.link(ob)

Thanks a lot Marty, it seems that using template_object.material_slots[0].link = 'OBJECT' I can render the color using diffuse color, maybe is just the alpha channel that is not working?

Here is how I create color for an object using Goo package to create a cell object:
#====================== Colors =========================
# Green
matg = bpy.data.materials.new("Green")
matg.diffuse_color = (0,0.1,0,0.8)
# Red
matr = bpy.data.materials.new("red")
matr.diffuse_color = (0.1,0,0,0.8)

#================== Cell A Collection ==================
# Create a collection for cell A
cA_collection = bpy.data.collections.new("A_Cells")
# link the collection to the scene for visualization
bpy.context.scene.collection.children.link(cA_collection)
# Define cell A1
cA1 = goo.Cell("cell_A1", loc = (2,2,0))
# Make a Blender mesh object for cell
goo.make_cell(cA1)
# The created cell is the active object
obj = bpy.context.active_object
# Set the object color
obj.active_material = matg
# Remove object from all collections not used in a scene
object inside the collection
bpy.ops.collection.objects_remove_all()
# Add the active cell to our specific collection
bpy.data.collections['A_Cells'].objects.link(obj)


text:
How to change a ui color from within the console?
I'm trying to change ui colors from within (blender's) console.
I'll admit it's a peculiar idea (common sense suggest to import the "xml") but I want to propose 3 or 4 "color hacks" for blender's default color theme, its the sort of change every pro would suggest at first moments notice (its not supposed to be a redesign or revamp).
But how to rise to attention at "blendernation"? By posting an unreachable xml at "blenderartists"?
Instead of downloading, saving, unwrapping and installing a file my "color hack" could simply be pasted into the console and previewed in a nondestructive manner (blender discard unsaved ui changes when it quits) -- ie it'll help my "color hack" to rise to attention of blender's Bartholomew.
Thanks in advance.
Curious how the fixes look like, or what is it good for? Its all about the "setting buttons", here the user can distinguish between a "function" and a "setting" button.

Here's an example script:
import bpy

ui = bpy.context.user_preferences.themes[0].user_interface

#>>> C.user_preferences.themes[0].user_interface.wcol_radio.inner[:]
wcol_radio_inner = (0.275, 0.275, 0.275, 1.0)

#>>> C.user_preferences.themes[0].user_interface.wcol_radio.inner_sel[:]
wcol_radio_inner_sel = (0.33, 0.5, 0.76, 1.0)

#>>> C.user_preferences.themes[0].user_interface.wcol_radio.show_shaded
wcol_radio_show_shaded = True

#>>> C.user_preferences.themes[0].user_interface.wcol_radio.shadetop
wcol_radio_shadetop = 15

#>>> C.user_preferences.themes[0].user_interface.wcol_radio.shadedown
wcol_radio_shadedown = -15

#>>> C.user_preferences.themes[0].user_interface.wcol_radio.text
wcol_radio_text = (1, 1, 1)

ui.wcol_regular.inner = wcol_radio_inner
ui.wcol_regular.inner_sel = wcol_radio_inner_sel
ui.wcol_regular.show_shaded = wcol_radio_show_shaded
ui.wcol_regular.shadetop = wcol_radio_shadetop
ui.wcol_regular.shadedown = wcol_radio_shadedown
ui.wcol_regular.text = wcol_radio_text

ui.wcol_toggle.inner = wcol_radio_inner
ui.wcol_toggle.inner_sel = wcol_radio_inner_sel
ui.wcol_toggle.show_shaded = wcol_radio_show_shaded
ui.wcol_toggle.shadetop = wcol_radio_shadetop
ui.wcol_toggle.shadedown = wcol_radio_shadedown
ui.wcol_toggle.text = wcol_radio_text

Note that you need to run this from the text editor, this wouldn't really work as addon - at the time of registration, we are not allowed to access the context.
BTW, with the above theme, the toggle buttons in the text editor sidebar for wrapping etc. look really odd.
Looking at the 2.69 testbuild 1, the transform manipulators in the View3D header appear like props:

But it's odd that the enable/disable button draws not the same. For selection mode, it's arguable whether this should look like a property set, as it actually changes something (mesh selection, e.g. verts+edges selected, go to face mode, nothing selected).

Nooo he didnt like my "color hack" T_T how depressing. Just kidding just kidding, thanks for the answer ^_^

The "color hacks" affect a butch of "setting" and or "toggle" buttons... also the "pressed" buttons need to be colored with the default "blueish" color (of blender's "radio buttons"). The great advantage of my "hack" is that it becomes clear whether or not something is a "toggle" or a "action".

Note that in the new version (now=2.93), user_preferences have to be preferences instead.  Related references : https://docs.blender.org/api/current/bpy.types.Preferences.html
and https://docs.blender.org/api/current/bpy.types.ThemeUserInterface.html .

For themable things in editors use:
bpy.context.user_preferences.themes[0].<editor>.<thing> = <color>
The python console has completion to help with the names of things.
The 3D view is also an editor, the following example sets lamps to white:
bpy.context.user_preferences.themes[0].view_3d.lamp = (1,1,1)

Is this CoDEmanX's snippet "bpy.context.user_preferences.themes[0].user_interface" put to work... or what I wanted to ask? I wont mind if my answer gets delete but this worked for me:
def scriptrunner():
    global gui
    global Bucket
    global Spray
    global getPresets

    # swatch: Standard (unchanged) colors of blenders ui
    # alias: A batch of solid colors
    # snuff: Some tryout colors
    #
    swatch, solid, snuff = getPresets()

    # Blenders standard widgets
    #
    print(dir(gui))

    # Changes for the glowing "Checkboxes"
    # ("unglow" can be removed to keep the default)
    #
    unglow = Bucket()
    unglow.text = solid.black
    unglow.text_sel = solid.black
    unglow.apply(gui, 'wcol_option')

    # Changes for the "Slider widget"
    # ("brighten" can be deleted to keep the default)
    #
    brighten = Bucket()
    brighten.inner = (0.600, 0.600, 0.600, 1.0)
    brighten.inner_sel = (0.580, 0.580, 0.580, 1.0)
    brighten.item = (0.671, 0.671, 0.671, 1.0)
    brighten.shadedown = 4
    brighten.shadetop = -24
    brighten.show_shaded = True
    brighten.apply(gui, 'wcol_numslider')

    # Changes for the commands aka "Tool widget"
    #
    defocus = Bucket()
    defocus.outline = (0.404, 0.404, 0.404)
    defocus.inner = (0.518, 0.518, 0.518, 1.0)
    defocus.inner_sel = (0.392, 0.392, 0.392, 1.0)
    defocus.item = (0.098, 0.098, 0.098, 1.0)
    defocus.shadedown = -5
    defocus.shadetop = 10
    defocus.show_shaded = True
    defocus.apply(gui, 'wcol_tool')

    # Over paints the "Frames of sadness"
    #
    allUnframed = Spray([
        'wcol_num',
        'wcol_numslider',
        'wcol_text', ])

    for i, q in allUnframed:
        allUnframed[i].outline = (0.380, 0.380, 0.380)
        allUnframed[i].apply(gui, q)

    # It'll "bind" the colors of the "Toggle buttons"
    #
    allBindings = Spray([
        'wcol_menu',
        'wcol_option',
        'wcol_radio',
        'wcol_regular',
        'wcol_toggle', ])

    for i, q in allBindings:
        allBindings[i].inner = swatch.charcoal
        allBindings[i].inner_sel = swatch.skyblue
        allBindings[i].apply(gui, q)

    # Additional tweaks to the previous "Toggle buttons"
    #
    allUnframed = Spray([
        'wcol_menu',
        'wcol_option',
        'wcol_radio',
        'wcol_regular',
        'wcol_toggle', ])

    for i, q in allUnframed:
        allUnframed[i].outline = (0.200, 0.200, 0.200)
        allUnframed[i].apply(gui, q)

    # Brightens some text fonts
    # ("allBindings" created dark "text" on dark "buttons")
    #
    allAdjusted = Spray([
        'wcol_regular',
        'wcol_toggle', ])

    for i, q in allAdjusted:
        allAdjusted[i].text = (0.900, 0.900, 0.900)
        allAdjusted[i].text_sel = solid.black
        allAdjusted[i].show_shaded = True  #its OFF by default...
        allAdjusted[i].shadedown = -15
        allAdjusted[i].shadetop = 15
        allAdjusted[i].apply(gui, q)

    return True

def getPresets():
    global Presetfactory
    swatch = Presetfactory()
    solid = Presetfactory()
    snuff = Presetfactory()

    # skyblue: The color of "Inner Selected" of "Radio Widgets"
    # charcoal: The ubiquitos charcoal for toggles and switches
    #
    @swatch
    def skyblue():
        return (0.337, 0.502, 0.761, 1.0)
    @swatch
    def charcoal():
        return (0.275, 0.275, 0.275, 1.0)

    # A batch of opaque (or solid) colors.
    #
    @solid
    def black():
        return (0.000, 0.000, 0.000)
    @solid
    def white():
        return (1.000, 1.000, 1.000)

    # A batch of tryout colors
    #
    @snuff
    def white():
        return (1.000, 1.000, 1.000, 1.0)
    @snuff
    def red():
        return (0.900, 0.010, 0.010, 1.0)
    @snuff
    def yellow():
        return (1.000, 1.000, 0.000, 1.0)

    return swatch, solid, snuff

# (All "buckets" and "sprays" are interfaces...
#  ...only "fill()" gets to see "gui")
#
class Bucket():
    def __init__(self):
        self.scriptwork = {
            'text': None,
            'text_sel': None,
            'inner': None,
            'inner_sel': None,
            'item': None,
            'outline': None,
            'shadedown': None,
            'shadetop': None,
            'show_shaded': None, }

    def apply(self, gui, firstname):
        #
        # Pythons "setattr()" accesses blenders:
        # >> gui.<button>.<setting> = <color>

        knockout = self.scriptwork
        for q in knockout.keys():
            if knockout[q] != None:
                setattr(
                    getattr(gui, firstname), q, knockout[q] )

        # Prevents multiple reruns
        # (the pending changes were already applied)
        #
        for q in knockout.keys():
            knockout[q] = None

    def __getattr__(self, label):
        return self.scriptwork[label]

    def __setattr__(self, label, contents):
        if label != 'scriptwork':
            if label not in self.__dict__['scriptwork'].keys():
                print("Attention, unkown gui property:", label)
                print("Available are:", self.__dict__['scriptwork'].keys())
        if label == 'scriptwork':
            self.__dict__['scriptwork'] = contents
            return None
        self.__dict__['scriptwork'][label] = contents
        return None
    pass

class Spray():
    def __init__(self, dispatch):
        global Bucket
        self.scriptwork = {
            'bucketnames': dispatch,
            'buckets': [Bucket() for q in dispatch ], }

    def __iter__(self):
        for f in range(len(self.scriptwork['bucketnames'])):
            i = 0 + f
            q = '' + self.scriptwork['bucketnames'][f]
            yield i, q

    def __getitem__(self, frame):
        return self.scriptwork['buckets'][frame]
    pass

# (Steals and stores the decorator user)
#
class Presetfactory():
    def __init__(self):
        self.scriptwork = {}

    def __call__(self, target):
        firstname = '' + target.__name__
        self.scriptwork[firstname] = target
        return "Succeffully collected the preset."

    def __getattr__(self, label):
        return self.scriptwork[label]()
    pass

# (This script accesses blenders's "user_interface")
#
import bpy
gui = bpy.context.user_preferences.themes[0].user_interface
scriptrunner()

I would look into the property system to store variable rather than using globals. - http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Properties

@neomonkeus the script doesn't use "globals" to store values... the script uses the "global" keyword to fetch function and or class definitions.


text:
How do I Attach a Rigid Body to a Bone?
I'm trying to make rigid body physics interact with an (Armature-)animated character.
For starters, I created a short piece of chain falling onto an animated box. The chain consists of 5 individual rigid bodies, the animated box also is a rigid body with the 'Animated' property set. When the animated box moves, I expect the chain to react to this.

As you can see, what I get instead is that the chain rests on the original pose of the animated box (as if it was static), even though it has moved out of the way.

The animated box is of type 'Active', set to 'Animated' and 'Dynamic', rigid body deactivation is turned off.
The chain links are the same, except they're not set to 'Animated'.

Because you are using the armature-driven mesh to interact in a rigid body world, you need to toggle the Deforming in the settings for that animated box.

Wow, thank you for the elaborate screenshot :)  However, my Blender 2.69 seems to be missing that very option. Here's what I see in my properties panel when I select the animated box mesh: http://i.imgur.com/iB9IOPm.png.

Ah, right. Actually it is in the development version, you can download the daily builds here. It will be with the coming 2.70. See here and here.

Lately, there is a nice tutorial in CGCookie.com to show you how to do the similar thing without this new feature. See here. It is a bit complex, but probably works to you.


text:
Can Vertex Paint Normalize Color Channels?
I'm using vertex colors to control texture splatting on my model. Each color channel controls the blending weight of a texture:
pixel = (texture1 * vertex.r) + (texture2 * vertex.g) + (texture3 * vertex.b);

To achieve consistent results, I want the sum of all color channels to be 1.0 in all cases.
Otherwise I would sum up multiple textures resulting in brightness > 1. Here's an example of what would happen if colors aren't normalized (that lower left corner has been painted with all three color channels set to 1, so its brightness is r+g+b=3):

Is there a way to "normalize" a color (just like I would normalize vertex group weights) in Blender?

I assume the code you posted there is for a GLSL shader?  Could you not just use vert_NORM = normalize(vertex);?

It's pseudocode to illustrate what the shader would do. I could normalize in the shader, but then I wouldn't get an accurate preview in Blender (no color normalize operate in Blender's node-based materials). It would also do the normalization millions of times per second whereas it could just do it once during preprocessing (but maybe I'm micro-optimizing here).

I've managed to script myself a solution:
import bpy
import random
import math
from mathutils import Color, Vector

bl_info = {
  "name": "Vertex Color Normalizer",
  "description": "Allows the vertex colors of a mesh to be normalized (useful if colors control texture splatting).",
  "author": "Markus Ewald",
  "version": (1, 0),
  "blender": (2, 65, 0),
  "location": "View3D > Add > Mesh",
  "warning": "", # used for warning icon and text in addons panel
  "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
              "Scripts/VertexColorNormalizer",
  "category": "Paint"
}

class VertexColorNormalizer(bpy.types.Operator):
    bl_idname = "object.normalize_vertex_colors"
    bl_label = "Normalize Vertex Colors"
    bl_description = "Normalize vertex colors to enable additive texture splatting"

    def execute(self, context):

        # What I want to do:
        # - Iterate over the colors of all the vertices in active mesh
        # - Normalize each color (divide by sqrt(r *r + g * g + b * b))
        # - Assign it back to the vertex

        for i in context.active_object.data.vertex_colors[0].data:
            r = i.color[0]
            g = i.color[1]
            b = i.color[2]

            magnitude = math.sqrt(r * r + g * g + b * b)
            if magnitude > 1:
                normalized_color = (r / magnitude, g / magnitude, b / magnitude)
                i.color = Color((normalized_color))

        return {'FINISHED'}

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

if __name__ == "__main__":
    register()

Save as C:\Users\<Login>\AppData\Roaming\Blender Foundation\Blender\2.72\scripts\addons\NormalizeVertexColors.py
Start Blender, activate Preferences, Addons, Paint, "Vertex Color Normalizer"
Select target mesh, spacebar, type 'normalize' and pick the "Normalize Vertex Colors" entry

My knowledge of Python or the Blender object model are too limited to let this happen automatically when painting vertices, but it's better than nothing, I guess :)


text:
Array Modifier deforming mesh
I am using an array modifier to create a long fence along a curve. I have modeled a small section of the fence so that I can use an array modifier to fill in the rest. I am using a curve as the path for the array modifier. The curve follows the path of the terrain. The fence is getting deformed as it is follow the curve. It is making the fence unrealistic.

The planks going from pole  should be straight like they are in the original model.

If I use a low poly fence that is made up of simple boxes only the deformation the planks behave like I expect them to.

This is the behaviour I expect from the high poly fence. I think the low poly fence works because there are no vertices to deform in the planks beside the endpoints.
How can I prevent the planks from deforming with the curve?
I want it to distort the poles, so that it looks like the are follow the surface of the terrain. I do not want to planks to be bend, only stretched to connect to the poles as needed
blend file

@gandalf3 I want it to distort the poles, so that it looks like the are follow the surface of the terrain. I do not want to planks to be bend, only stretched to connect to the poles as needed.

The curve contains too many unnecessary points. Additional curvatures will bend the object where you don't want.
For better control in this case, I suggest to separate planks from poles, making them as two individual objects. Then use one simplified curve (or two curves) to control each of them.


text:
How to add bump to shader?
I have a simple diffuse shader. I would like to add some bump to it. How can I do this in Cycles? Where do I plug in my checkered texture.

Per shader:
Plug it it into the Height input of a Bump node (ShiftA>Add node > Vector > Bump)

The above node setup will only bump the diffuse part of the shader, simulating a bumpy diffuse surface coated with a smooth glossy "glaze" layer.

Entire material:
If you want to apply the same bump mapping to all the shaders in your material, just plug it into the Displace input of the Material output node:

You'll notice that now the bump is applied to the glossy shader too:


text:
Python - Set material to material slot
I am using the Blender Internal render engine. I have an material slot with no material assigned to it. How can I assign a material to a slot using python? This should work in edit mode as well. Basically I would like to assign materials to specific faces.

This code creates 10 materials and appends it to the active object (should be a mesh). The diffuse color of every material is random. The .material_index poperty is set to the new materials by index (even if the object has materials assigned before the operation).
import bpy
from random import random

ob = bpy.context.object
me = ob.data

mat_offset = len(me.materials)
mat_count = 10

mats = []
for i in range(mat_count):
    mat = bpy.data.materials.new("Mat_%i" % i)
    mat.diffuse_color = random(), random(), random()
    me.materials.append(mat)

# Can't assign materials in editmode
bpy.ops.object.mode_set(mode='OBJECT')

i = 0
for poly in me.polygons:
    if poly.select:
        poly.material_index = i % mat_count + mat_offset
        i += 1

If you want to use UV mapped textures, you'll also have to deal with me.uv_layersand me.uv_textures. It's not enough to assign materials to faces, you also need to set the texture image for every face.

What if I want to use the face selection from the select random tool?

Updated my example to only assign new materials to selected polygons. Note that if there's no material before the operation, unselected polygons will use the first material (.material_index has a default of 0, which is automatically the first material).

@CoDEmanX I want to go over all of my materials and select (or get indices of) faces to which that specific material has been applied to. I haven't been able to find a good solution for doing that as of now. I would appreciate if you can take a look at my question here and see if you can offer a solution?

That would be -
import bpy

D = bpy.data

if len(D.objects['Cube'].material_slots) < 1:
    # if there is no slot then we append to create the slot and assign
    D.objects['Cube'].data.materials.append(D.materials['Material'])
else:
    # we always want the material in slot[0]
    D.objects['Cube'].material_slots[0].material = D.materials['Material']

This doesn't work when I want to assign random faces a material in edit mode.

@Vader Perhaps the source of this addon has some clues.

@gandalf3 I already know how to do this on object level. I need to do it in edit mode though. This tut only does objects.

@Vader Your question is assigning a material to a slot not assigning a material to faces.

@sambler updated question.

Abandon the approach of edit mode/non-edit mode and just focus on the datablock. Materials for faces are specified via material_index inside the datablock of a mesh type object.
Add a Suzanne mesh to the scene and try this code:
import bpy, random

ob = bpy.data.objects.get("Suzanne")
if ob != None:
    # Create a materials.
    mat_one = bpy.data.materials.get("mat_one")
    if mat_one == None:
        mat_one = bpy.data.materials.new("mat_one")
    mat_one.diffuse_color = (random.random(),random.random(),random.random())

    mat_two = bpy.data.materials.get("mat_two")
    if mat_two == None:
        mat_two = bpy.data.materials.new("mat_two")
    mat_two.diffuse_color = (random.random(),random.random(),random.random())

     # Add materials to slots.
    ob.data.materials.append(mat_one)
    ob.data.materials.append(mat_two)

    # Determine random count and poly count.
    rnd_face_count = 12
    l = len(ob.data.polygons)

    # Note: By default all faces have a material index of 0.
    for i in range(rnd_face_count):
        # Generate a random face index.
        rnd_face_index = random.randint(0,(l-1))
        ob.data.polygons[rnd_face_index].material_index = 1

This is not the cleanest code but it shows one way to accomplish the task mentioned. If you run this code twice, however, you will discover that you are building up a list of new materials on the Suzanne object.

This sequence would assign the currently selected material to the first slot:
bpy.context.object.active_material_index = 0
bpy.ops.object.material_slot_assign()

The material-utils addon makes heavy use of the API methods for materials, there you should find further details. SVN space_view3d_materials_utils.py

I need to specify the material that is assigned though

I used sambler's answer for the .append() idea,
but I referenced context, instead of name:
(R, G, B are standard 0-255 values)
obj = bpy.context.object
colorstring  = 'r' + str(R) + ' g' + str(G) + ' b' + str(B)

if colorstring in bpy.data.materials.keys():
  obj.data.materials.append(bpy.data.materials[colorstring])

else:
  material  = bpy.data.materials.new(colorstring)
  obj.data.materials.append(material)
  material.diffuse_color  = (R / 255, G / 255, B / 255)
  bpy.ops.object.material_slot_assign()

Just to put in my two cents:
I have created my object, and I have a list that contains the index to what material slot each face should be assigned to. Running this code:
 i = 0
    for poly in bpy.context.object.data.polygons:
        poly.material_index = MyTextures[i]
        i += 1

did the trick for what I needed it to do.
Now if I can only find the simple solution for assigning the UV's I will be almost done with my project.


text:
Python - move UV for selected items
I want to use python to move the UVs of the selected objects. I am having trouble with moving the UVs. When I run my script I moves the objects instead, not the UVs. All object have exactly 1 UV map.
My approach the problem:
for mesh in selection:

for UVs in mesh

select all UVs

move UVs

Here is my code.
import bpy

scene = bpy.context.scene
for count, ob in enumerate(bpy.context.selected_objects):
    if ob.type == 'MESH':
        scene.objects.active = ob
        bpy.ops.object.mode_set(mode='EDIT', toggle=False)

        bpy.ops.mesh.reveal()
        bpy.ops.mesh.select_all(action='SELECT')

        # execute any editmode tool
        move_x = count % 10
        move_y = count // 10
        bpy.ops.transform.translate(value=(move_x, move_y, 0), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=0.263331)

        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)

It's all about context, at no point are you in the image editor. The same bpy.ops.transform.translate() is used in the 3d view and the image editor. Basically, you could just save the current area, switch to the editor, perform transforms and switch back. Granted, there are much more elegant ways to do this but for a 3 line hack, it works quite well.
import bpy

#+ grab the current area
original_area = bpy.context.area.type

view_layer = bpy.context.view_layer
for count, ob in enumerate(bpy.context.selected_objects):
    if ob.type == 'MESH':
        view_layer.objects.active = ob
        #+ switch to the UV editor to perform transforms etc
        bpy.context.area.ui_type = 'UV'
        bpy.ops.object.mode_set(mode='EDIT', toggle=False)

        bpy.ops.mesh.reveal()
        bpy.ops.mesh.select_all(action='SELECT')
        #+ select the uvs
        bpy.ops.uv.select_all(action='SELECT')

        bpy.ops.transform.translate(value=(0.125, 0, 0), constraint_axis=(True, False, False))

        #+ return to the original mode where the script was run
        bpy.context.area.type = original_area
        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)

So the command for transform in the UV view and 3d view is the same? Is there a unique command for moving in the UV?

@Vader No and it wouldn't work, you need to be in that space by some means when doing any operations in it.

This does not work, the UVs. Stay in place

@Vader Are you using the exact same code in the example? It works on my end. Unwrap a mesh or several, go to object mode and run the script.

Instead of using the value 0.125 I am using count.

never mind, it is working now. I am not sure why though, but it is. Case closed

https://blender.stackexchange.com/questions/75061/scale-uv-map-script


text:
Smart UV project unmapping outside of UV space
I am unwrapping a mesh using the Smart UV Project unwrapper. When I unwrap my mesh some of the UVs are outside of the UV grid. This is undesirable for the following reasons:

tileable textures will look wrong
I cannot texture paint the areas outside of the region

I really like how the Smart UV Project method works other than that. __How can I have the Smart UV Project method only unwrap inside of the UV grid?

blend file

There is an option in the header > UVs menu to constrain the UVs to the grid, however this only affects transforms. Other than that, all I can think of is writing a python script to fit UVs to the grid.

The only way to do this with smart unwrap it to pack the islands after the are created. CTRL P

It is not possible to unwrap using the Smart UV Project method with the constraint that everything must be inside of the UV grid. You will have to fit them in the UV grid after creating them either manually or through a python script.


text:
Reel in anchor using physics
I want to animate an anchor being pulled in by a motor on the boat. The anchor is attached to some chains. I am having trouble with the physics. I am using the built in physics system, not the Blender Game Engine. On the boat I have a motor that is turning. Is is attached to the chain which is attached to the anchor. How can I use physics to animate the reeling in of an anchor?
blend file
The motor

The anchor

my attempt so far:
as you can see it's not working like it should.
http://www.pasteall.org/pic/show.php?id=67306

I can't test now, but it looks like you are not using Mesh collision for the chain links, which is necessary for concave shapes. I would actually recommend using constraints instead, and disable collisions between linked links. I'll add an answer as soon as I can..

Mesh collision can be one of the problem. But there seem to be other problems however in this case.

There are several issues with your file:

The object origins are not centered. The origins are used to calculate the center of mass, which means that they can result in strange behavior if they are not correctly centered. Press CtrlShiftAltC> Origin to center of mass to snap the origin to the center of mass.

The intersecting concave links are using the Convex Hull collision shape. Because the hole in the middle of each link is a concave shape, the links then collide and fly apart. To the simulator it appears as if the links are inside one another.
However, note for a chain I recommend using Constraints instead.

Some objects have unapplied transforms. In many cases applying the scale and rotation can improve the stability and behavior of a simulation. Just beware when applying transforms to animated objects.

Animated is not enabled on the capstan. Enabling this is important if you want to control rigid bodies with the animation system.

Setting up Constraints for a chain:

Select all the links in the chain.

Press Connect in 3D View > Tool Shelf > Physics > Rigid body tools, then set the constraint type to Point (sort of a ball joint) and the Connection Pattern to Chain by distance:

By default the new constraints (added to the empties) will have Disable collisions enabled which disables collisions between objects constrained to each other. I recommend leaving this setting on, and keeping the collision shape on Convex Hull as nothing besides the links themselves are likely to try and pass through the hole.

 (For Blender 2.8)

The blend files are not available - death links. Too bad. The solution from gandalf3 looks like a really great anchor/chain example.

@user1209926 Thanks for letting me know, I've re-made the example in Blender 2.8. In general I have copies of all the .blends I've uploaded so please don't hesitate to ask (this was an exception since it was actually a modified version of the .blend from the OP)


text:
How to fix topology seams
I am trying to model a part of an airplane. I have a problem with some slight distortions in the mesh. How can I fix this so that it  looks like a smooth continuous surface.

What it should look like:

blend file

I found a method that works to some extent, it is not perfect but I think it is the best that can be done with the topology.

Duplicate the mesh

we will use this to create a seamless version

Delete the faces where the cutout for the seat is

this is the geometry that is causing the problem

Select the edges at the ends of the hole and use the Grid Fill tool, Ctrl + F

The grid fille we fill the hole with some nice polygons, these will not look distorted

Add a subdivision surface modifier to the mesh

Select the mesh with the topology for the hole
In edit mode select the faces at the hole and a few faces and around it as well

Add the faces to a vertex group.

Add a shrink wrap modifier to the mesh with the hole

Select as the Target the mesh without the hole
Select as the Vertex Group the vertex group we created in step 8

Final Result


text:
Create a flat plane with beveled edges

As you may infer from this question, I'm a complete noob. I've gone through quite a few tutorial videos but I still don't understand how I can create this shape...

Do you mean the beveled edges?

You can do this by modifying a simple plane.

Add a plane: Shift A -> Mesh -> Plane
Go into edit mode: Tab
Go into vertices mode: Ctrl Tab -> 1
Select all vertices: A
Bevel vertices: Ctrl Shift B

This will create an ngon, ideally we would only like quads (faces with only four vertices)
If you want to fix this you can easily connect two vertices.

Select two opposing vertices and connect them by J
Repeat until all ngons are gone