text:
What is the low level alternative for bpy.ops.object.material_slot_add()?
I have a script which adds a material to an object. The script is using  bpy.ops.object.material_slot_add(). However, this only works when the script is used from the text editor. It has polling/context errors when used differently.
What Blender 2.75a API commands provide the low level equivalent to bpy.ops.object.material_slot_add()?

I use this operator often from the 3D view and console. It is not limited to the text editor. It also works in object mode, edit mode, sculpt mode, weight paint, texture paint... Where are you running the script from? You might have a panel in some specific screen that might be out of context, but you can probably override this context and run the operator anyway (http://blender.stackexchange.com/search?q=context+override)

The command will be used in a function which will be passed to the render handler: bpy.app.handlers.render_pre.append() . Because of challenges in getting the override set up properly and a desire to make create scripts which operate independent of the context, I'm trying to convert all bpy.ops to low level equivalents.

I don't think you have another way to add a material slot via python. I think I tried finding one before. Maybe some other person here knows something I don't. Anyway, try the solution in the answer below. Small trivial thing, but sometimes those are the hardest to debug.

Example code
Adds two material slots, m1  (if there is already an active material slot it will replace it with m1) and  m2
import bpy

mat1 = bpy.data.materials.new("m1")
mat2 = bpy.data.materials.new("m2")

ob = bpy.context.object

ob.active_material = mat1
ob.data.materials.append(mat2)

An empty slot can be added with
ob.data.materials.append(None)

Hence can add either data or object materials this way by setting the slot link.
import bpy

materials = (
    (bpy.data.materials.new("RED"), 'DATA'),
    (bpy.data.materials.new("BLUE"), 'OBJECT'),
    )

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

for m, link in materials:

    # add a material adds a slot
    print(m.name)
    me.materials.append(None)

    slot = ob.material_slots[-1]
    slot.link = link
    slot.material = m

Thankyou to @Lambdadelta for pointing out

Note if "Link Materials to" set to "Object" instead of default "Object
  Data" in the blender preferences, then ob.data.materials.append(None)
  adds a slot to all linked objects, whereas
  bpy.ops.object.material_slot_add() adds only to the active object

Note if "Link Materials to" set to "Object" instead of default "Object Data" in the blender preferences, then ob.data.materials.append(None) adds a slot to all linked objects, whereas bpy.ops.object.material_slot_add() adds only to the active object

@Lambdadelta cheers  Added as edit..  Tricky to get around as materials.clear() as doesmaterials.pop(index=index)

The only case I can think of where this operator will not work is that the object you want to add a material slot to is not selected and active. Make sure of both in your script before calling the operator:
myObj.select = True
bpy.context.scene.objects.active = myObj


text:
How can I easily model an extruded organic shape?
I am currently seeking help from the blender community to model this:

I've tried almost every tool (including subsurf) but it doesn't look like it
Can anyone show the steps on how to model that shape? I could be grateful if someone helped me
By the way,the top and "butt" (bottom left on the "sides" image) are supposed to be a little rounded and a little low-poly like (maybe both)
It also needs to be fully 3D,not 2d or flat

...which kind of object should this represent, just to understand?

The body of a character i created

Is this just supposed to be a flat image, or some kind of boxy shape? I'd be happy to help, but I'm not 100% clear on what you're looking for.

It is supposed to be 3d @jemtan990

@Problematico Can you draw it in perspective? its really hard to tell what you want.

@GiantCowFilms the image is at perspective now

@Problematico Are you trying to create a character from ''Worms'' game ;) ?

@Gonzou No,i'm trying to make a shape that i can use for a character that i created (i'm serious,it's not from worms,It''s not a OC neither)

There is an easy way to do this. Go to User Preferences (Ctrl+Alt+U-->Add-ons) and enable the Extra Objects add-on.

In Object Mode press Shift+A-->Mesh-->Pipe Joints-->Pipe Elbow and play with the settings to get the desired parameters as pictured in .gif below.

Fill the opened tips of the pipe with F key, then press Ctrl+B to bevel them. Set the desired Segments amount. Now give the object the Subsurf Modifier, select some vertices, where the pipe is bent and press Shift+E to sharpen it.

Hey bud,you almost had what i needed! sadly,i made a mistake,it is supposed to look like the image above,but because i said that the it had to be rounded on the bottom right it looked like a worm.Anyway,since your method seems useful,i will use it to make what i need

You can easily do it with a curve. Press Shift+A > Curve > Circle.
In Edit Mode do something like this:

Then:

Hope that helped you!

To create a shape like this I first extruded (E) the top and one side of the default cube, then added some loop cuts with Ctrl+R.  Adding a subsurf modifier will smooth the boxy shape out.

You can play with the proximity cuts to adjust the smoothness of the subsurfing if you want more or less boxyness.

source: Stack Exchange

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

sort: votes


text:
How to bevel selected edges
I have a rectangular box where I want to add bevels to the four edges of the sides only.  I always get bevels on all edges. How do I restrice bevels to selected edges?  I'm just learning so need details. Thanks.

Related - http://blender.stackexchange.com/questions/16321/bevel-specific-edges

If you're working with edges, switching to edge select will help as vertices have connections so you often won't get the result you want if these are close.

That was so simple.  I am struggling with shortcut keys, haven't found a good index yet. Thanks

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


text:
How to change an unknown diameter of a hole to a specific size?
I have a cube with several holes in it. Now I need to change the size of one hole to 6.34 mm diameter. What is the best way to do this?

What shape are the holes? It's easy for square shapes (as edge length = diameter).

The hole is round.

The LoopTools add-on proposed by TLousky, is obviously massively convenient and exactly what you want.

Given the above statement, the rest of this answer might be slightly academic, but can still be useful if you are interested in how something like this is scripted. My solution works on the assumption that:

the hole is a circle, and its vertices are the only things selected.
the object has all transforms applied

find the average coordinate (center of circle)
let it find the diameter by checking the distance between the average coordinate and any of the vertices.
use the average vector as a pivot point to scale away from.

code:
# This example assumes we have a mesh object in edit-mode

import bpy
import bmesh
from mathutils import Vector

def get_average_vector_of_selection(bm):
    avg_vector = Vector()
    num_vecs = 0
    for v in bm.verts:
        if v.select:
            num_vecs += 1
            avg_vector += v.co
    return (avg_vector / num_vecs)

def get_radius(bm, average):
    for v in bm.verts:
        if v.select:
            return (average-v.co).length

def scale_circle_verts(bm, new_radius):
    average = get_average_vector_of_selection(bm)
    # bpy.context.scene.cursor_location = average
    current_radius = get_radius(bm, average)
    print(current_radius)

    if new_radius == current_radius:
        return

    amount_to_rescale = current_radius / new_radius
    for v in bm.verts:
        if v.select:
            new_vec = (average).lerp(v.co, 1/amount_to_rescale)
            v.co = new_vec

obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)

scale_circle_verts(bm, new_radius=0.2)

bmesh.update_edit_mesh(me, True)

If the points are evenly distributed, then the coordinate average is the center of the circle.  If the points are NOT evenly distributed, it is probably not the center of the circle.

Another way to achieve this is using the LoopTools addon's 'Circle tool'.
If the addon is not active on your system, go to the User Settings (CtrlAltU) > Addons > Mesh > LoopTools and activate it using the small checkbox on the right:

In Edit Mode select the loop or loops you want to resize, then either from the Tool Shelf > LoopTools or the Specials Menu (W > LoopTools) choose the 'Circle tool':

Toggle the "Radius" option on, then type in the radius you want (diameter / 2) for the hole:

That works but, Whats is the unit of radius? I want to set it in cm or what ever, not scale unit!

Make a cylinder at the right place and size.

Create a vertex group and add the vertices around the hole to it.

Add a shrinkwrap modifier (to the cube), select the cylinder as the object and limit it to the vertex group.

You may have to move the vertices from the cube into roughly the right position. As you see, they follow the cylinder but as they are not evenly spaced, the resulting hole is not very regular.

Step 2 - do you mean create a vertices group of original hole's outline. How do I add to the hole in it?  Step 3 - who do I "limit it to the vertex group"?

I'll add some screenshots.

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


text:
Extrusion creates black artifacts
I am a complete beginner to Blender and to modeling, and am taking a tutorial for Absolute Beginners to create my first house.  No problems creating the point for the roof, but when I select the edges to try and extrude out the roof and create an overhang, the part I have extruded turns a scratchy grey color.  Later on when I try to add texture or color to the roof, the extended edges turn the same color as the face of the house, not the rest of the roof.  If anyone is able to translate my poor description and help, it would be much appreciated!  Thanks!!

You might have accidentally extruded twice earlier. If you press E and right click, it looks like nothing happened, but you actually extruded to the same place. Hope this helps somehow.


text:
Cannot overlay or combine render layer with video

I am tying to combine a video and a blender model using the nodes in blender render mode but only the model or only the video is coming in the render.


text:
Proper way to show users error info in the UI for addons
Are there standardized features in the python API for displaying the popup and error message that users typically see in Blender when they're not doing something the right way?
Trying to apply a modifier in edit mode, for instance...or when there is an exception, you get a popup with a red triangle and a description, and there is a message printed in the info header (see screenshot below). From my searching in the API and around the web, it seems like the answer is no.

I can otherwise just make my own panel and popup for this that replicates that functionality. The only thing left to do for this is identify the remaining parts of the API that are relevant to replicate:

UI popup

Related: http://blender.stackexchange.com/questions/717/is-it-possible-to-print-to-the-report-window-in-the-info-view

Found this an answer via TynkaTopi on the #blendercoders IRC channel:
Blender operators have a method called report() which will perform the functions noted above. You only need to pass it a TYPE (an enum, see the docs) and a MESSAGE (a string explaining the error). It flashes a popup dialog with a warning icon/message at the mouse location, prints the error message in the info header, and adds it to a text datablock containing recent reports, apparently.
I also made sure to return {'CANCELLED'} from my operator after reporting when the error occurred.
API:
https://docs.blender.org/api/current/bpy.types.Operator.html?highlight=report#bpy.types.Operator.report
Example:
self.report({"WARNING"}, "Something isn't right")
# return {"CANCELLED"}


text:
Prefetch Frames not working?
In Blender 2.92, I have Prefetch Frames enabled in the Video Sequence Editor, and a Memory Cache Limit of 16384 in the Video Sequencer > Memory Cache System settings. I've closed and reopened Blender and rebooted, but still don't see an orange stripe in the sequencer indicating that frames are being prefetched (and I do get some performance/framerate issues during playback).
Is there any reason prefetch would be working but not displaying the orange indicator stripe? Do I have to enable that in the display? Based on the performance issues it would seem that prefetch is just not working...
Edit: I should also say that I am splicing mp4's together that I recorded from my camera. It's a fairly simple setup...

The Cache is designed to be as unobtrusive as possible. That's the reason, you don't see the orange cache bars. It should be working, however. If you want to see the cache bars, you should do the following:
(1) Enable Developers Extra in the Edit > Preferences > Interface panel.
(2) Enable the cache Bars in the View > Show Cache menu of the Sequencer.

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


text:
How to carve a square using Ctrl+I?
I've been following this tutorial trying to create this lamp post:

And I'm having trouble doing the carved in square part in the center. In the video, he just does ctrl+i and scales it in. I have tried that but I can only scale in the top part:

What am I doing wrong?

ctrli is to invert the selection, not inset. If you want to inset individual faces, don't just use i, use ii, it should work.


text:
Blender 2.79 to 2.8 Menu problem
I made a model in Blender 2.79 and would like to modify it in Blender 2.8. I can open the project in 2.8, but can't seem to find this feature:

When I open up Blender 2.8 without opening my 2.79 project, I can find the feature. Help!

It is not advised to jump versions within the same project

Will it work tho'?

If you are loading the UI from the 2.79 file, look at the bottom of the 3dview. In recent 2.80 builds, there is now a preference to choose the header position used so you can set headers to always be on top.

Try to uncheck Load UI before you open the project in 2.80

Hope that helps.
Good Luck


text:
How do i make grease pencil lines to disappear?
i am Doing projection mapping with blender and need to trace a car by having different lines coming and going. how do i make grease pencil lines to disappear. as i only can figure out how to build the whole animation but not make the lines go away in the time line. Thanks in advance

In the "N" properties menu, go to colours and delete the colour which the stroke is using, and this deletes the strokes.


text:
Transparency disappearing act
Running Blender v2.79b. Created a number of meshes. Have one mesh that sits above the others, which I want to be semi-transparent; it has an alpha of  0.07. However, I cannot see all of the other meshes through it. Any pointers to where I need to look gratefully appreciated.

it's a bit hard to understand, could you please show the scene and the nodes of your material? perhaps share your file? https://blend-exchange.giantcowfilms.com/

Thanks for reaching out to help. --- Consider a helicopter flying above you. Looking up, you might see the helicopter wheels and the body, with the blades spinning above. Now consider looking from above, through the spinning blades. You'd expect to see the helicopter body. In my example, I was seeing the wheels, but not the body.

There were objects on meshes added after the transparent object was added. These objects failed to appear through the transparent object.
The transparent object was on its own mesh.
Objects, added before the transparent object was added, appeared through it.
Moving the later added objects higher, in the Scene outliner, remedied the problem.
Objects were moved by creating new meshes and making them the parent of the objects added after the transparent object.
There's probably a better way to do this, but I'm just grateful to have found a solution.

What you've come up against in your project is a trait that can be used for discriminatory masking when rendering in OpenGL. As you've correctly pointed out, the solution is in the relative ages of one (transparent) object to another that's behind it... https://blender.stackexchange.com/questions/117572/how-to-put-a-mask-into-3d-space/117941#117941


text:
Rigid body corners
I don't know how to call this problem but while I'm simulating rigid body physics I noticed that as the cube falls and hits the corner of a block (especially when the cube is high) it merge some part of cube as it bounces back
Could this be fixed?

maybe try other settings, like Mesh instead of Box, then increase the Sensitivity Margin?

@moonboots I tried changing it to mesh but it doesn't act like a box, I also tried adjusting the sensitivity even in smallest difference but its either the same result or there is a visible gap in between.


text:
Trying to Use a 2nd Curve to Deform Object Vertically
I'm trying to model a bridge with a variable depth, like this:
https://upload.wikimedia.org/wikipedia/commons/9/96/Natchez_Trace_Parkway_Bridge.jpg
I've created a curve for the alignment at the top of the bridge (on the roadway surface) and was hoping to use a second curve to deform the bottom of the bridge in the Z direction (only).  I created a vertex group for the verts on the bottom of the bridge and added the second curve modifier; the problem is that instead of pulling the verts straight down to the bottom curve, the bottom of the bridge is deformed.  Here's a more simplified example of what I'm trying to do:

I'm guessing that's done to maintain the length of the bottom of the object but that's not really what I want.  I've tried modeling the bridge along one axis and deforming the bottom first (hence the bottom curve being on the X axis in the above picture).  I've also tried placing a plane along the bottom curve and using a hook modifier to pull the verts down to the plane but that produced odd results.  I've looked around on here but all of the other examples I've found that used two curves to deform an object had a similar result.  It's a long bridge so I'd rather not have to apply the Array modifier and move each individual set of verts down to the bottom curve.
Can anyone help with this?  It's really bugging me.  Thanks in advance!!!

The brigde in your image is physically made of 2 pieces (actually 2 pieces joined by connecting pillars), is there any reason you need your model to be all one piece?

Nevermind, I see what you mean. There are ways of straight modelling this though. Use the curve modifier to make the main curve of the bridge, as you have, and then in edit mode, hide the top vertices, and then pull select sections of the bottom ones down while using proportional editing to make the bottom have a varying height.


text:
Can't export to .PLY, option grayed out
The PLY export option is grayed out meaning I can't export models to this format.

Could you clarify what the question is? It is not clear what you are asking

The only time that Export->Stanford (.ply) is disabled is when there is no active object. This can happen when you delete an object and don't select another.
The solution is to select an object.

Can you clarify the contents of your scene? PLY is a very niche model format and has a lot of limitations when it comes to the data that it can package. You might want to read up on this page.
Try just exporting a simple scene and see it that works. If you can export PLY with just some simple geometry, then it must be something contained in your scene that isn't able to be exported.

Everything seems to be working fine for me with just some simple geometry in the scene. If it's still grayed out with just some simple models in your scene, then you might want to try re-enabling the PLY export add-on in user preferences.

How to re-enable the PLY exporter in blender:

Go to File --> User Preferences (Ctrl+Alt+U).
Click on the Add-ons tab at the top of the window.
In the search box, type "ply."
Make sure the checkbox is ticked next to "Import-Export: Stanford PLY format."
Click Save User Preferences towards the bottom right hand corner of the window.

If the problem still persists, then you'll probably want to ask your client if he or she can accept another file format. PLY is a pretty non-standard format and I can't imagine what situation they would be in to only be able to use that format.
The last thing that I want to add is that you must have objects selected inside of your scene to export them. To export everything in the scene, just his A and then export.


text:
How to continuously increase a value with the mouse?
I have an issue when I want to increase / decrease values on controls like these:

Clicking the arrow will only increase/decrease a notch. I'd like to see the value change as long as I keep the click down.
How do I change this behaviour ?

Hover over the field, hold Ctrl and scroll with the mouse wheel or drag these as you would a slider.

authors: Ернар Абдикахар


text:
Can Freestyle draw lines between intersecting meshes like SoftImage?

I used a translator.
Please understand if I wrote the wrong sentence
I think the last question is difficult to understand.
So I Attached was a picture.
The problem of the picture 1 and 2.
I want to resolve, as the third picture.
And fourth and fifth picture is a way to resolve in a soft image.
So I want to know that possible a blender  tool solve same problem.
I'm sorry to bother you. But I'm really need your help.

I used translator.
Photo 1 problem occurred twice.
I want to solve as picture 3
The Softimage picture is 4 to 5 times.
4 Blender 5 times as possible too.
The request help.

No, Freestyle in Blender does not support intersecting geometry.

authors: Артем Кожевников


text:
Texture appears stretched on extruded sections of mesh
I have a maze game in blender and to make the maze I subdivided a cube I flattened out and then selected some parts, extruded it, and raised it up. But, when I put in the texture, it didn't really work (see images). The walls were just lines. I really need to know how to fix that, even if it means that I don't see the texture the right way on the top. I just need the walls to look nice on the inside.

This can happen for several reasons, the most common being that you modified the mesh after initially adding the texture, hence the stretched look. A simple fix is to just unwrap the model again.
The fastest way to get a good result with a generic box model like that is to press U > Cube Projection or Smart UV Project depending on how tiled you want certain subdivided parts to look (can read more and experiment with the unwrapping types here).
Extrusions after adding texture

Extrusions after correcting using cube projection unwrapping

Extrusions after correcting using smart uv project

I went into edit mode with the terrain selected, and I pressed U and chose the smart UV projection, and it did nothing.

@JudeNelson Is the image open in the uv editor and assigned to the mesh? Also did you select everything with A.

@JudeNelson Your view should look something like this http://i.imgur.com/i3EQQ6A.png

For anyone having problems with the unwrapping, this worked for me too:
https://www.youtube.com/watch?v=rWC7Ki7MNEw
Edit Mode > Options > Correct Face Attributes > then extrude

That's just how texture mapping works.
There's a square texture map, and then there's geometry coming off of it with no kind of seams to govern how it's lined up with the texture. It's taking the pixels on the edge and stretching them out infinitely because sides occupy literally no space.
I'm sure you've figured this out years later, but for anyone else looking this is essentially what's happening.

I understand the original user was asking about a uv texture, but this was showing up under search results for me under procedural.
Applying location, rotation, and scale (Ctrl +  A) fixed my problem.

For me, you can apply location, rotation and scale, after it unwrap again.


text:
Can't delete group instance?
I have downloaded a Blender file, and the model is visible twice.
I would like to have only 1 of them. But no matter what I try, I am unable to remove just one model.
I have uploaded the Blender file here:
http://www.pasteall.org/blend/38503
Could anybody tell me what is happening in this file?
I think the maker of this file created a linked clone or so.
Is this true?
Can anybody tell me how to have just 1 model?
Thank you very much!

The object "chainsaw" is a group instance of the group named "chainsaw" containing all the objects that make up the saw. You can delete it, or move all the objects that make up the group instance to another layer.

You will notice that if you try to edit the one that turns green when you select it, the other model updates and these objects are on different layers. This is to allow making changes while transforming or animating the model elsewhere without the destructive side effects of working with one object.
Just simply grab the other model (the rotated one) which is a group instance of the original and press X to remove it. You could also create a new file and append (ShiftF1) the original model into that from the groups folder. Additionally, to get rid of the group (the green outline), go to the object tab and under groups delete it.

Model which is called Chainsaw is a group instance. Select this model in Viewport or Outliner and click delete. You can add again this group by Shift+A => Group Instances => Chainsaw.


text:
Can I "fill" an empty object?
I have this weird object (vascular tree) which is empty inside, but closed from the top and the bottom:

However, it is empty inside, which makes me unable to use boolean on a bigger object (I want to make a hole in an object through which this object will go through). So I thought I should fill it and then try to boolean.
But, how do I fill it?
Thank you sincerely.

I believe that you are treating the Boolean operations of Blender like other CAD packages, that don't allow these operations to be done on a water-tight mesh, rather than a geometric "Solid". Booleans within Blender do have their limitations, and do not always work (when the mesh gets complex especially). However there are methods to do what you are intending to do as an end goal. Unless I'm missing the point of what you are asking here...

@RickRiggs would you suggest using a CAD package then? Do you have any specific software in mind? I would appreciate your idea.

I would go ahead and go thru the steps Duarte's answer provides. If you still have trouble, then post back, as there are usually always a way to help you within Blender with this big/knowledgeable community of users(In this case there are manual methods if your cleanup exercise fails).

All mesh, or 3D modeled virtual objects for that matter, are "hollow" or "empty inside" by definition, there is no such thing as mass, dense volume or matter inside them, with the possible exception of actual volumetric data like voxels or point clouds.
Concepts
Boolean operations on meshes are always performed as mathematical calculations over the surfaces to simulate the existence of a dense "filled" object, by combining the surfaces of the intervening objects through cutting, intersecting and or subtracting operations. The results happen only on the "shell" or faces of the mesh surface, to give the impression of having dense interior, when in reality there is none.
For that reason mostly only coherent, closed, "watertight" manifold meshes are successfully usable in fruitful Boolean operations outside of CAD applications, that use either ACIS Solid Modeling, NURBS based surfaces, or other geometry representation models more suited for these types of operations (and even these are all hollow as well, despite the application best efforts make you believe otherwise).
Open or inconsistent meshes (non-manifold) often give problems, errors, bad results, or fail completely.
Diagnosis
That being said, in your case if you can't preform a Boolean operation on your object it is most likely because your mesh is either too complex for the application to handle or has one of multiple common geometry issues.
Boolean operations on meshes are limited at best. If there are errors in your objects like discontinuities, wholes, inconsistent normals, overlapping geometry, or any other geometry problems that make your mesh non-manifold or non watertight they will fail to various degrees.
There are also complexity limits that can be handled. If you are reaching Blender, the algorithms, hardware, or available resources limits, you should break down your objects into more manageable chunks.
Possible solutions
There are many common issues with Booleans and very well known solutions to deal with them that have been thoroughly covered before. What you need to do is clean up your meshes and make sure these errors and discontinuities are gone.
Stuff you can try:

Removing doubles - Edit Mode > W > Remove Doubles (Alt + M > By Distance for 2.8+), to merge all open or coincident geometry.

Recalculate normals - In Edit Mode Ctrl + N (Alt + N for 2.8+) to make sure all surfaces are facing the same direction consistently.

Check for holes - In Edit Mode press Space Bar and search for Select non Manifold. That should highlight any remaining wholes, or problems with your mesh which you must then solve by hand, like overlapping faces, inconsistent normals, missing geometry, etc.

Ensure there are no coinciding or coplanar surfaces between the two operands -  These usually confuse the algorithm making it unable to distinguish in from out.

Eliminate any intersecting edges - If edges intersect between two operands (common with symmetric objects, geometric or orthogonal shapes, hard surface modeling, among others) operations will likely fail, this is a known limitation of current Boolean algorithm. Nudge them around very small distances, or rotate them micrometrically if need be to break perfect alignments.

Search for self intersections which are common in data obtained from scanned data like 3D Scans, photogrammetry, or other real world captured data. Solving this will be mostly a manual process as there are no current built in tools to handle them automatically, but you can turn on Mesh Analysis from the Overlays popover to get a good indication of problematic areas.

After that your Boolean operation stands a better chance to produce good results, if your mesh is not too overly complex to successfully be processed. If that is the case the you should break it apart into smaller objects making sure that each and every one of them involved in Boolean operations is a watertight "closed" manifold mesh.
For Blender 2.8+ you can also try different calculation methods for the Boolean Modifier, like the Fast or Exact options, depending on the type of mesh you have.


text:
Reducing the size of shadows
I am looking to reduce the size of the shadow being cast on the mesh in the background..

I have only one light which is a sun lamp with ray shadow on, the mesh i have receive, receive transparent and cast buffer checked and no matter how near or far i put the light I cannot get the size of the shadow to change.  Can anybody help. cheers.

You have something like this (Blender Internal)

Sunlight lamp only lets you change the angle of the light-source and not the distance of the light to the scene objects. Test this by moving the sunlight closer or further away from the objects, compared to rotating the sunlight. If you want smaller shadows, don't use a sun lamp on its own. When you only have one light-source like a sunlight on default settings, you will get sharp shadows.
You can fake ambient light by adding Ambient Occlusion or Environmental Lighting, or add a few weak lights to give you more control.
adding Ambient Occlusion would give you this:

or adding Environmental Lighting for this:

You could also mess with the shadow settings of the sunlight lamp: (softsize & samples & shadow colour). But on its own that still doesn't produce a nicely illuminated image.

The trick really is to add more lights, but make them weak so as not to saturate the scene. If you are serious about lighting I recommend you read this classic post by Ben Simonds about lighting techniques.

You can only change the angle and softness of a Sun lamp's shadow.

Sun Lamp
A Sun lamp provides light of constant intensity emitted in a single direction. A Sun lamp can be very handy for a uniform clear daylight open-space illumination. In the 3D view, the Sun light is represented by an encircled black dot with rays emitting from it, plus a dashed line indicating the direction of the light.
This direction can be changed by rotating the Sun lamp, like any other object, but because the light is emitted in a constant direction, the location of a Sun lamp does not affect the rendered result (unless you use the “sky & atmosphere” option).

For more control of the shadow you'll need to use another of the available lamp types.

Another trick is to remove shadows from the main objects and create duplicates to cast the shadow.
First under shadows of the material tab check on "receive transparent" on everything that's in shade and turn off cast shadows for the object(s). Then duplicate the mesh with separate materials from the original with "cast" and "cast only" on. You may want to make the duplicate any amount smaller, I got a visual glitch with them overlapping. Turn on transparency and adjust alpha or Fresnel, or adjust the size, location, or whatever to change how the shadow is sent.


text:
Blender debugging step problem
I know this question may not be directly related to Blender, but maybe it does! Please correct if I am wrong!
I can build and step debugging on Blender 2.78 prior to Xcode 8.1, but something get broken since Xcode 8.1, my situation is as follows:

build and run blender build from Xcode, following the directions in : https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Mac
set break point on run_cpu(), and read_node()
run blender build, select cycles render and select render mode
it should stop at both breakpoints prior to Xcode 8.1,
while not stop at read_node() since 8.1

My environment is MacOS Sierra.
For completness, the checkout commit is cf8f6d1 from blender git.

For those who also get stuck here --- after trying a week, I get a way to workaround.
Use the Xcode debug window to set command like 'b func' instead of using the GUI breakpoint (blue arrow) is working.
Obviously it is Xcode to be blamed for.


text:
How to import 12-bit tif image sequence in Video Editor?
I am having a sequence of tif files of 12-bit depth. When imported into blender  I am getting a blank screen. How to ensure that the images are imported properly into the video editor? I tried changing the input color format but with no success.

According to the Blender Manual, 12-bit TIFF is not supported (but 8 and 16 bit TIFF is): https://docs.blender.org/manual/en/dev/data_system/files/media/image_formats.html
I suggest converting the sequence to a different format (e.g. 16-bit TIFF, which is supported); there are several softwares that can achieve this. (I often use FFmpeg for this purpose—please let me know if you'd like help with FFmpeg.)

Thanks. I felt blender would auto convert the image to 16bit. Also, I'm more convinient with ImageJ; l'll be using it to convert the image to 16 bit.


text:
How to find image coordinates of the rendered vertex?
I have a simple mesh of a cube.  I would like to know what are the coordinates of each vertex in the rendered image (i.e. for each 3d vertex I'd like to know it's pixel coordinates).  Is there a way to do this?
Clarification:
I'm experimenting with a pose estimation algorithm (i.e. finding out the 3d pose of the object) from a (set of) 2d image(s).  Instead of taking an image of a real object with a real camera I synthetically render the image of a cube using blender.  In this way I know the pose of the object and the intrinsics of the camera, so I can easily validate the results of the pose estimation algorithm.
Pose estimation algorithms usually require to provide them with world points on the object and the corresponding image points.  So what I'm looking for is a way to produce a dump of correspondences of the 3d point <--> image point as a byproduct of the rendering procedure.
Thanks,
Alex

There are many ways to do this, and the answer depends on the context you are working in, so this question is too vague, you need to explain the intended purpose, I could show the C code which calculates this but I think its probably not what you want. Please give details on the format you want this data in, is a Python script that calculates this acceptable for example or do you need this for a shader, if so OSL or GLSL, or is the game engine function for this enough, do you want to know the math to calculate or just a method to do it for you... etc.

I've updated the question with the clarification note, please see if it's better now.

You still didn't give any info on the context language and APIs you expect to be using.

C++/Python are fine.  I'd expect the API to be Blenders' one...

This script gives projected the 2D pixel coordinate from a 3D world-space location.

The (0, 0) origin is the bottom left of the image(common for math, OpenGL and Blender in general). note - cursor_location should read cursor.location
A negative Z return value means the point is behind the camera:

Example:
# Test the function using the active object (which must be a camera)
# and the 3D cursor as the location to find.
import bpy
import bpy_extras

scene = bpy.context.scene
obj = bpy.context.object
co = bpy.context.scene.cursor.location

co_2d = bpy_extras.object_utils.world_to_camera_view(scene, obj, co)
print("2D Coords:", co_2d)

# If you want pixel coords
render_scale = scene.render.resolution_percentage / 100
render_size = (
    int(scene.render.resolution_x * render_scale),
    int(scene.render.resolution_y * render_scale),
)
print("Pixel Coords:", (
      round(co_2d.x * render_size[0]),
      round(co_2d.y * render_size[1]),
))

See the Python Source-Code if you're interested in exactly how this works.

This code works, but keep in mind it returns pixel (u,v) coordinates with the v axis pointing up and the origin at the bottom-left corner. If you want the (i,j) coordinates as in a matrix, with the origin on the top-left corner and i axis pointing down, do i = render_size[1] - v and j = u. I've tested this and it works, with no off-by-one errors.

@rfabbri, 0,0 for lower left is used everywhere in Blender & OpenGL, so it didnt cross my mind to mention it. Edited answer.

When we have non-zero  camera shift_x/y, this code no longer works. I am working with blender 2.79

@iNFINITEi report to Blender's bug tracker

Can we also know whether the vertex is visible (blocked by some surfaces) or not given specific camera view?

The new world_to_camera_view function returns x, y, z-depth.
This will print out the 2d coordinate list, (no z-depth)
Example 1
import bpy
from bpy_extras.object_utils import world_to_camera_view

scene = bpy.context.scene

# needed to rescale 2d coordinates
render = scene.render
res_x = render.resolution_x
res_y = render.resolution_y

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

# use generator expressions () or list comprehensions []
verts = (vert.co for vert in obj.data.vertices)
coords_2d = [world_to_camera_view(scene, cam, coord) for coord in verts]

# 2d data printout:
rnd = lambda i: round(i)

print('x,y')
for x, y, distance_to_lens in coords_2d:
    print("{},{}".format(rnd(res_x*x), rnd(res_y*y)))

this:

can become this: (here is a live d3.js rendering using svg - chrome)

Example 2
taking z-depth (distance to lens) into account (skipping code already present above):
verts = (vert.co for vert in obj.data.vertices)
coords_2d = [world_to_camera_view(scene, cam, coord) for coord in verts]

# find min max distance, between eye and coordinate.
rnd = lambda i: round(i)
rnd3 = lambda i: round(i, 3)

limit_finder = lambda f: f(coords_2d, key=lambda i: i[2])[2]
limits = limit_finder(min), limit_finder(max)
limits = [rnd3(d) for d in limits]

print('min, max\n{},{}'.format(*limits))

# x, y, d=distance_to_lens
print('x,y,d')
for x, y, d in coords_2d:
    print("{},{},{}".format(rnd(res_x*x), rnd(res_y*y), rnd3(d)))

you can generate this kind of information (here live svg sample again - chrome): Using distance to set fill-opacity of the dots.

I am not very good with python so I will not give some code here, but I will try to cover the theoretical/mathematical part of the question:
These are standard 3D graphics manipulations.
Some more information: Vectors in 3D graphics are 4 dimensional entities. The 3 first coordinates correspond to the euclidean space x,y,z coordinates, usually in local or model space and the last coordinate is the w or homogenous coordinate, which is used for perspective effects, translation in 3d space and for clipping.
Likewise, 3D space matrices are 4x4 matrices, so that they can handle the 4 dimensional vertices. Usually when a vertex is transformed to screen space, the initial value of w is 1.0. There are other values to use but they are for more advanced use.
Transforming to screen space is simply a matter of transforming the vertex by the Model matrix M, to transform the vertex to world space (where the model resides on the 3D world), by the camera matrix C, to transform it to the reference frame of the camera, or camera space, by the projection matrix P to account for projection effects (called projection space), do perspective division and clipping and finally turn the resulting coordinates to pixel space.
So if the vertex is v, you have to do P*C*M*v (remember matrix multiplications are non-commutative! Order of multiplication is important!). This has transformed the vector to projection space
After that, you need to clip the vector. If any of the vector's 3 first components is greater in absolute value than the fourth component, then it is outside the field of view of the camera and should be clipped. If the vector is not clipped, then you need to divide each of the 3 components of the vector by the w coordinate. So if the projection space vector is (x,y,z,w), after clipping you get the screen space coordinates (x/w, y/w, z/w, 1)
This will yield normalized coordinates with range {-1.0, 1.0}. To convert to pixel space, you need to know the width and height of the screen in pixels.
"Screen" here, may not refer to an actual screen, but can be the rendered image. What changes in the description is that instead of an actual screen width/height, you have the x/y resolution of the rendered image.
If (sx, sy) are the screen space vector x and y coordinates and w, h are the height and width of the screen, or image, then
x = w/2 * (1.0 + sx) will give the x position in screen space.
For the y component it may be a little more complicated because usually pixel space is counted from the bottom of the screen up, while operating systems count it on reverse. So, depending on the occasion it may be either
y = h/2 * (1.0 + sy) or
y = h/2 * (1.0 - sy)
A warning though, the names of the spaces can be different in some textbooks. I hope that I have managed to relay the general idea though.
For more information I recommend reading
http://www.glprogramming.com/red/appendixf.html

Thanks, it's a nice explanation.  Please note that it's rather unrelated to the question that was asked.

Not at all. The principles are exactly the same, you just substitute the width of the screen with the image dimensions. I will update the answer

I realize that your answer is relevant in general.  Having said that, please note that I'm looking for a way (using python api, as you note) to ask blender what are the projected image coordinates.  Thanks for your effort though.

How does this account for occlusion of a point by a surface in front of the point? If the face occludes a point and the camera i.e a point is behind a surface then it won't be visible in the image. Ideally, there should be no corresponding image coordinate if it has been occluded. Is there a way to get this?

Followed the instructions from this site: songho.ca/opengl/gl_projectionmatrix
There is also a course available at udacity which provides further informations.
The result looks like this.

import bpy
from math import tan
from mathutils import Matrix

print(79*'-' + 3*'\n')

cam = bpy.data.objects['Camera']
obj = bpy.data.objects['Cube']
scene = bpy.context.scene
mesh = obj.data
model_view = (
    cam.matrix_world.inverted() *
    obj.matrix_world
    )

width =  scene.render.resolution_x
height = scene.render.resolution_y
aspect_ratio = width / height

n = cam.data.clip_start
f = cam.data.clip_end
fov = cam.data.angle

proj = Matrix()
proj[0][0] =            1 / tan(fov / 2)
proj[1][1] = aspect_ratio / tan(fov / 2)
proj[2][2] = -(f + n) / (f - n)
proj[2][3] = - 2*f*n  / (f - n)
proj[3][2] = - 1
proj[3][3] =   0

clip = proj * model_view

for v in mesh.vertices:
    v_4d = v.co.copy()
    v_4d.resize_4d()

    v_clip  = clip * v_4d
    v_clip /= v_clip[3]
    v.co = v_clip.resized(3)

    scrn_co_x = (v.co.x + 1) / 2 * width
    scrn_co_y = (v.co.y + 1) / 2 * height
    print("screen: %.2f, %.2f" % (scrn_co_x, scrn_co_y))

Coordinates seem to match now, multiplying the y-axis by the aspect ratio instead of the x-axis.

I think you mixed up something with the proj indices. When I try your code I get a IndexError: vector[index] = x: assignment index out of range

Stackexchange messed up the code after adding another image.

TypeError: Element-wise multiplication: not supported between 'Matrix' and 'Vector' types

An alternative way to @ideasman42's answer is to first create a 3x4 P matrix (as used in computer vision) from blender's camera parameters and use that to project. This might be convenient for you since you seem to be doing computer vision work.
Use the function get_3x4_RT_matrix_from_blender listed in my answer to 3x4 camera matrix from blender camera to generate a P matrix, then project. For instance:
# Insert your camera name here
cam = bpy.data.objects['Camera.001']
P = get_3x4_P_matrix_from_blender(cam)
e1 = Vector((1, 0,    0, 1))
p1 = P * e1
p1 /= p1[2]
print("Projected e1")
print(p1)

For vertices in the object's local coordinates, you will have to first transform them to world coordinates. Here's a sketch of how to do it:
location, rotation, scale = obj.matrix_world.decompose()
R = rotation.to_matrix().transposed();
p = R*scale*vertex_local_coordinates + location
# now apend coordinate 1 to p, use P*p then divide by 3rd coordinate

You can compare that to @ideasman42's code which I made into a function
project_by_object_utils(cam, point) (see my answer to 3x4 camera matrix from blender camera). Both routines return exactly the same coordinates up to many decimal places.

Note: The origin is at the top-left corner and image y axis pointing down.

the last answer with the less likes, from Shajahan Kabir Sajuu, is awsome.
I will simplify the problem around selection of vertices: front vertices and not back ones.  the problem when using only "world_to_camera_view"
I imagined the same way of adding a raycast but his idea to use location with a little object created at every vertex is amazing.
I extended his script to several selected objects and with depsgraph to take into account geometry when modifiers not applied.
import bpy
from mathutils import Vector
from bpy_extras.object_utils import world_to_camera_view

def main(context):
    # Get context elements: scene, camera and mesh
    scene = context.scene
    cam = context.scene.camera
    objs = context.selected_objects
    cao=context.active_object       ##to restore it at the end

    limit = 0.1

    # In world coordinates, get a bvh tree and vertices
    bpy.ops.object.mode_set(mode='OBJECT')
    for obj in objs:
        if obj.type=='MESH':
            me = obj.data
            depsgraph = context.evaluated_depsgraph_get()
            obj_eval = obj.evaluated_get(depsgraph)
            for p in me.polygons:     #deselection of vertices (face then edges)
                p.select = False
            for e in me.edges:
                e.select = False

            for v in me.vertices:

                mw = obj_eval.matrix_world  #matrix on the obj_eval of the depsgraph

                # Get the 2D projection of the vertex
                co2D = world_to_camera_view( scene, cam, mw @ v.co )

                cubeMesh=bpy.ops.mesh.primitive_cube_add(location=(mw @ v.co))
                bpy.ops.transform.resize(value=(0.01, 0.01, 0.01))
                cubeObject=context.object

                # If inside the camera view
                if 0.0 <= co2D.x <= 1.0 and 0.0 <= co2D.y <= 1.0 and co2D.z >0:
                    # Try a ray cast, in order to test the vertex visibility from the camera
                    location= scene.ray_cast(context.view_layer, cam.location, (mw @ v.co - cam.location).normalized() )
                    # If the ray hits something and if this hit is close to the vertex, we assume this is the vertex
                    print(location[0],location[1]) # first value=bool, second=coords
                    if location[0] and (mw @ v.co - location[1]).length < limit:
                        v.select = True

                bpy.data.objects.remove(cubeObject,do_unlink= True) #delete object
    context.view_layer.objects.active =cao  #restore active
    cao.select_set(True)

so I think he explained it well but without testing this is hard to realize.

TypeError: Scene.ray_cast(): error with argument 1, "depsgraph" -  Function.depsgraph expected a Depsgraph type, not ViewLayer

This is my code:
import bpy
from mathutils import Vector
from bpy_extras.object_utils import world_to_camera_view

# Deselect mesh polygons and vertices
def DeselectEdgesAndPolygons( obj ):
    for p in obj.data.polygons:
        p.select = False
    for e in obj.data.edges:
        e.select = False

# Get context elements: scene, camera and mesh
scene = bpy.context.scene
cam = bpy.data.objects['Camera']
obj = bpy.data.objects['Cube']

#renderer an image and save to F drive
scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = "F:/image.png"
bpy.ops.render.render(write_still = 1)

width =  scene.render.resolution_x
height = scene.render.resolution_y

# Threshold to test if ray cast corresponds to the original vertex
limit = 0.1

# Deselect mesh elements
DeselectEdgesAndPolygons( obj )

# In world coordinates, get a bvh tree and vertices
mWorld = obj.matrix_world
vertices = [mWorld @ v.co for v in obj.data.vertices]

print( '-------------------' )

for i, v in enumerate( vertices ):
    # Get the 2D projection of the vertex
    co2D = world_to_camera_view( scene, cam, v )

    cubeMesh=bpy.ops.mesh.primitive_cube_add(location=(v))
    bpy.ops.transform.resize(value=(0.01, 0.01, 0.01))
    cubeObject=bpy.context.object

    # If inside the camera view
    if 0.0 <= co2D.x <= 1.0 and 0.0 <= co2D.y <= 1.0 and co2D.z >0:
        # Try a ray cast, in order to test the vertex visibility from the camera
        location= scene.ray_cast(bpy.context.view_layer, cam.location, (v - cam.location).normalized() )
        # If the ray hits something and if this hit is close to the vertex, we assume this is the vertex
        if location[0] and (v - location[1]).length < limit:
            print("%.2f %.2f" %(co2D.x*width,co2D.y*height))
    bpy.data.objects.remove(cubeObject,do_unlink= True)

What does your code do? Can you explain what this achieves and how?

Cool. looks like javascript...


text:
Lighting looks strange and planes are disappearing
I'm trying to make a dolphin model for 3d printing. While making the dolphin, I realized that in object mode the tailfin's lighting looks strange:

As you can see, the lighting of the fins is split, with one side being noticeably darker. To make the tailfin I first used the knife tool on a (squished) cube to make one half of the fin. Then I reflected it to make the other side and joined them in order to connect their edges with faces. When I was done, I realized the strange lighting on the tail. I first thought that I connected some faces incorrectly, but I checked and nothing seemed wrong to me.
Another strange thing I experienced was that when I tried to slice the model on the AstroPrint slicer, some of the planes on the tailfin were missing:

What's also strange is that the pieces that were missing were the pieces part of the tailfin where the lighting was abnormal. The only part that was shown is the bottom part of the fin.
I made the dolphin's body by shaping a cylinder. I made the fins by using the knife tool on a cube and connected them with the join operation. I edited them together and joined their edges with faces.
Does anyone know why this happens and how to fix this?

In 2.8 this won't be (as of 2.80.64) seen in Solid shading which won't solve the problem though. Hopefully will be changed later

In Edit Mode with everything selected, go to Mesh menu (Blender 2.79b)/Normals/Recalculate Outside.  See if that helps.

This does work, but what does the "Recalculate Outside" function really do to the mesh? It seems like something I should know more about.

Faces have a "right" side, and a "back" side, like clothing has an outside side, and an "inside-out-side".   Sometimes, Faces end up turned around the wrong way, with their "right" side facing inside, so we see their back side.   A normal is an imaginary line drawn at right angles to the "right"/outside side.  When you recalculate them, some faces get flipped so that the normals all point in the same direction, in this case, to the outside.


text:
Python: Ctrl+Click for buttons (capture invocation event)
Is it possible to get if Ctrl key is pressed when I click on my python button?
I would like make different behaviors for my button operator.
Example:
LMB - Select some objects
CtrlLMB - Deselect some objects
I don't use a modal operator / the modal() method. I've been making a simple script.

Yes, it is possible if you use an invoke() method in your operator instead of execute(), because there's a 3rd parameter given to invoke - an event object.
That object has attributes about modifier key states among a few other pieces of input info.
Here's an example script, that adds a button to the 3D View. You can hold e.g. CtrlAlt down and click on it to let the operator report Ctrl+Alt+Click in the info area:
import bpy

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

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

    def invoke(self, context, event):
        ev = []
        if event.ctrl:
            ev.append("Ctrl")
        if event.shift:
            ev.append("Shift")
        if event.alt:
            ev.append("Alt")
        if event.oskey:
            ev.append("OS")
        ev.append("Click")

        self.report({'INFO'}, "+".join(ev))
        return {'FINISHED'}

def draw_func(self, context):
    self.layout.operator(SimpleOperator.bl_idname)

def register():
    bpy.utils.register_class(SimpleOperator)
    bpy.types.VIEW3D_HT_header.prepend(draw_func)

def unregister():
    bpy.utils.unregister_class(SimpleOperator)
    bpy.types.VIEW3D_HT_header.remove(draw_func)

if __name__ == "__main__":
    register()

Note that there can also be an execute() method in the operator, but it won't be called unless the execution context is not INVOKE_*, but EXEC_*. The default behavior of the Python Console is, for instance, to execute an operator, not to invoke it.
If there's no execute() and you run bpy.ops.object.simple_operator() in the console, an error will be reported in the System Console and the operator abort with {'PASS_THROUGH'}. You can explicitly invoke it however: bpy.ops.object.simple_operator('INVOKE_DEFAULT')

As always you save me. You are my hero!

You're welcome. On a side note: It's not possible to let the button change (label or icon) based on the held down modifier keys. Actually it is, but only if you monitor their state continuously - which would require a modal operator running in the background all the time. Plus, you would need to tag_redraw() the region. See my prototype over here: http://blenderartists.org/forum/showthread.php?326991-Transform-Orientations-typical-interaction-use-case-%28workflow-UI%29

great answer, you made a touched on few points here that I tripped over for a while before I figured it out.

@CoDEmanX I've been looking for a solution to a recent problem I encountered. For my problem, I need to click on a node in the node editor to trigger LBM clicking so that the values of the 'Image Node` block get updated. I think a version of your solution will provide me what I want but I do not know how I can adapt your answer. Could you take a look at my question here and let me know if you think I am doing something wrong?


text:
Copy Custom Properties from one object to another
How to copy all object properties to another object with Python?
Could you suggest the simplest way.

Custom Properties on object level are contained in Object.keys(), but there's also a helper property _RNA_UI and some API-defined properties such as cycles_visibility.
Therefore, it's better to test for _RNA_UI and get all actual Custom Properties there:
import bpy

ob_sel = bpy.context.selected_editable_objects
ob_act = bpy.context.object

try:
    props = ob_act["_RNA_UI"]
except KeyError:
    pass
else:
    for ob in ob_sel:
        if ob == ob_act:
            continue
        for p in props.keys():
            print(p, ob_act[p])
            ob[p] = ob_act[p]

Note that properties will added or overwritten, but not removed if the target has some the source does not have. You could change that by deleting all Custom Properties of the target before copying the properties from the source object.

I got exception with "props = ob_act["_RNA_UI"]"
I got it working only like this http://pastebin.com/Di0r5JrY

My bad, try/except needs to catch KeyError, not AttributeError to make it work as intended. If you iterate over Object.keys(), keep in mind it may copy more properties than you may want.

the problem is that i always get exception or None with "props = ob_act["_RNA_UI"]". Right now i found the only way to copy all stuff to iterate over Object.keys().

Please upload a sample .blend, it appears to work just fine on my side.

Here is the test https://dl.dropboxusercontent.com/u/26887202/blender/test_RNAUI.blend   Create an object and run the script - you will get exception.

Of course there's an exception, because ["_RNA_UI"] is not created before there's any ID property. You need to catch that exception, see my code above.

I'll add to the other answer to expand a little bit.
For some reason the other method won't copy the subtype of the origin property. This can be interesting if you are working with a Color or Euler subtypes. Example :

Also there is now a is_library_overridable flag that is not copied over with the script.

We just need to add a few lines to the origin script :
import bpy

ob_sel = bpy.context.selected_editable_objects
ob_act = bpy.context.object

for ob in ob_sel:
    if ob == ob_act:
        continue
    for p in ob_act.keys():
        if p == '_RNA_UI':
            # Make sure the dictionary is initialized (Mainly for empty objects) :
            if p not in ob.keys():
                ob[p] = {}
            for sub_p in ob_act[p].keys():
                # This will copy over the subtype field :
                ob[p][sub_p] = ob_act[p][sub_p].to_dict()
        else:
            # This is a "standard" property (not under '_RNA_UI') - for some reason:
            ob[p] = ob_act[p]
    for p in ob_act.keys():
        if p == '_RNA_UI':
            continue
        # Copy over the overridable flag :
        ob.property_overridable_library_set(f'["{p}"]', ob_act.is_property_overridable_library(f'["{p}"]'))

This has been made into a handy add-on by user Scorpion81 (and the help of batFINGER) on this thread (Needs a bit of tweaking though to actually copy over the subtype and overridable flag) : https://blenderartists.org/t/addon-copy-custom-properties/591562/13


text:
How to apply transformations directly on mesh data?
I need to load some COLLADA files into a program that does not support any transformations (because it does not support scaling). I want to export these objects from a .blend file.
Is there a way to apply the transformations directly on the mesh vertex data in blender before exporting the objects to .dae?
An example:
Scale(2,2) * triangle{(0,0), (0,1), (1,1)} => triangle{(0,0), (0,2), (2,2)}

What about Ctrl+A > Apply?

I'm very inexperienced with Blender, so I really don't know what I'm doing here. It looks better now, but still a bit off. The exported transformations do not equal the identity matrix. They still contain translations although I checked location, rotation and scale. Any advice?

Finally, after applying them via the dropdown menu, everything works fine. Thanks a lot! You really saved me some hours of work :-)

Enabling in the tool panel or in the F6 menu works for me.. Are you using the latest 2.69 release?

I'm using 2.67 (will update asap) and checking the "Apply Object Transform"s resulted in the error mentioned above (translations weren't removed). CTRL + A and applying the transformations one after another works fine.

You can do this with CtrlA> Apply, then checking the transforms you want to apply with F6 or in 3D View > Tool shelf (N) > Redo menu:


text:
How to join objects with Python?
I try to do this:
bpy.ops.object.select_all()
bpy.ops.object.join()

in my script. It selects all the stuff like CtrlA but fails on join() (CtrlJ) with the following error message:

Traceback (most recent call last):   File "", line 1,
  in    File "C:\Program Files\Blender
  Foundation\Blender\2.71\scripts\modules\bpy\ops.py", line 188, in
  __ call __
      ret = op_call(self.idname_py(), None, kw) RuntimeError: Operator bpy.ops.object.join.poll() failed, context is incorrect

the message is from console.
How can I make this work?
CtrlA, CtrlJ actually works.

TO join an object you must have one object as the active object. If there is no active object selected it will not work. Try setting one object as the selected object.

Works nice, thank you. Would you put this as an answer so I can flag it?

To join an object you must have one object as the active object. If there is no active object selected it will not work. Try setting one object as the selected object.
An example would be
bpy.context.scene.objects.active = bpy.data.objects["Cube"]

If you don't want to change the real selection states, you may wanna use an override:
import bpy

scene = bpy.context.scene

obs = []
for ob in scene.objects:
    # whatever objects you want to join...
    if ob.type == 'MESH':
        obs.append(ob)

ctx = bpy.context.copy()

# one of the objects to join
ctx['active_object'] = obs[0]

ctx['selected_objects'] = obs
# In Blender 2.8x this needs to be the following instead:
#ctx['selected_editable_objects'] = obs

# We need the scene bases as well for joining.
# Remove this line in Blender >= 2.80!
ctx['selected_editable_bases'] = [scene.object_bases[ob.name] for ob in obs]

bpy.ops.object.join(ctx)

Your code is much much faster than the proposal of stacker when joining some hundred or thousand objects. Could you please explain the concept? Why do you make a copy of context?

The performance difference can probably be explained like this: http://blender.stackexchange.com/a/7360/1363 The context override was only supposed to keep the original selection intact AFAIR. If you use a copy of the context, you can change some attributes and pass it to an operator without affecting the actual context.

Oh my God this is lightning fast! Thank you so much for this. Joining 400-ish objects was the main timesucker in my project, and it has been reduced to almost zero

Any recommendation on making this work for 2.8:
AttributeError: 'Scene' object has no attribute 'object_bases'?

@oneiros Just delete that line, it's not required anymore (the collection system changed things).

I'm always getting this Warning: Active object is not a selected mesh {'CANCELLED'} error even after following these steps. I'm on Blender 2.82

@NeerajLagwankar It works for me in 2.82a, using 3 mesh objects, a lamp and a camera, with the camera being the active object in the selection. What kind of objects do you have selected?

Here is the stripped down version of blend file: Blend Exchange

I checked the code and join_mesh_shapes_exec() iterates over selected_editable_objects instead of selected_objects https://github.com/dfelinto/blender/blob/87ebc4ef4f2029a8f4fb21ea433c4ca189b243d5/source/blender/editors/mesh/meshtools.c#L686 Appears to work with ctx['selected_editable_objects'] = obs (obj_list in your example) and without setting selected_objects in the context. Note that your operator call is incomplete in the .blend file, it should be bpy.ops.object.join(ctx) (it misses .object)

Any fast joining of many objects (1000+) in Blender >3.0?

No need for bases in 2.8  join operator override.
Thought I would also post this here.  It appears at 2.80 beta version, there is no need to have the selected  editable bases context member, instead use selected editable objects
Testing this in python console. Have duped the default cube 3 times, the last dupe "Cube.003" is active and only object selected.
>>> C.object
bpy.data.objects['Cube.003']

>>> C.selected_objects
[bpy.data.objects['Cube.003']]

A list of all the mesh objects in scene to join
>>> obs = [o for o in C.scene.objects if o.type == 'MESH']
>>> obs
[bpy.data.objects['Cube'], bpy.data.objects['Cube.001'], bpy.data.objects['Cube.002'], bpy.data.objects['Cube.003']]

Make a context override dictionary, with only object, active_object, selected_objects, selected_editable_objects as members
>>> c = {}

>>> c["object"] = c["active_object"] = C.object
>>> c["selected_objects"] = c["selected_editable_objects"] = obs

Blender 2.8 - 3.1:
Run the operator with this override
>>> bpy.ops.object.join(c)
{'FINISHED'}

Blender 3.2+ :
with C.temp_override(active_object=C.active_object, selected_editable_objects=obs):
    bpy.ops.object.join()

Resulting scene after running.  All four cubes are joined as one "Cube.003", The result desired
>>> C.scene.objects[:]
[bpy.data.objects['Lamp'], bpy.data.objects['Camera'], bpy.data.objects['Cube.003']]

Risky look at obs since three of the objects no longer exist.
>>> obs
[<bpy_struct, Object invalid>, <bpy_struct, Object invalid>, <bpy_struct, Object invalid>, bpy.data.objects['Cube.003']]

Further to this, can make object copies into the data collection and join them.  Here i am copying the object 3 times, and then joining all mesh objects into file as one.
>> for i in range(3):
...     o.copy()
...

bpy.data.objects['Cube.000']
bpy.data.objects['Cube.001']
bpy.data.objects['Cube.002']

>>> obs = [o for o in D.objects if o.type == 'MESH']

"Array them to see result"
>> for  o in obs:
...     o.location.z += ob.dimensions.z
...
>>> c = {}
>>> c["object"] = c["active_object"] = C.object
>>> c["selected_objects"] = c["selected_editable_objects"] = obs

>>> bpy.ops.object.join(c)
{'FINISHED'}

the dupes will remain in data, the object "Cube.003" will be a mesh made of all others.

A full script for later reference:
import bpy

for ob in bpy.context.scene.objects:
    if ob.type == 'MESH':
        ob.select = True
        bpy.context.scene.objects.active = ob
    else:
        ob.select = False
bpy.ops.object.join()

Given the comments below CoDEmanX 's answer re speed, perhaps set active outside loop.

here's a version of stacker's answer updated to work in 3.4.1
import bpy

for ob in bpy.context.scene.objects:
    if ob.type == 'MESH':
        ob.select_set(True)
        bpy.context.view_layer.objects.active = ob
    else:
        ob.select_set(False)
bpy.ops.object.join()


text:
Is it possible to paste in edit mode?
Is there any way to use paste in edit mode, because in edit mode CtrlV is replaced by the vertices menu.
I can copy things fine but it is impossible to paste. Of course I could use ShiftD to duplicate but is there a way to copy?

You can use ctrl-c ctrl-v in object mode...

When in Edit mode, all that you are operating will be nothing but elemtents, so why not just using Shift D instead of Ctrl C and Ctrl V?

What are you expecting this to do? Are you trying to paste geometry from another file? You could paste in object mode and then join the objects..

@gandalf3 If I have a bunch of vertices selected and I copy them is there any way to paste them without using duplicate?

@Qwertieϟ Why would you want to? Copy paste is two steps, shift+D is one..

@gandalf3 I was just wondering if it was possible to use paste. duplicate is quicker but it seems odd that there would be a shortcut over paste.

When copying vertices from one object and pasting them in another, duplicate obviously won't work. What about that use case?

You can invoke copy and paste using the Spacebar menu (it shows CtrlV as shortcut for paste, but as you said that doesn't work). Simply press Space and search for copy and paste and use the appropriate entries from the list.

As pointed out by GiantCowFilms, the copy / paste functions work at object level. So even if you use them in edit mode, the whole object gets duplicated and not your selection!

Because you can use ShiftD to duplicate, there seems to be no need for copy and paste.

No, its not a bug. the copy and paste options work on the object level.

@GiantCowFilms thanks, I fixed the answer.

When copying vertices from one object and pasting them in another, duplicate obviously won't work. What about that use case?

You could duplicate, then "p" separate, which would create a new copied object of your duplication. You could then join that to any other object.

Yes, with this add-on:
https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/CutCopyPaste3D
With CTRL-insert you copy mesh data in edit mode, switch to another object and enter edit mode, and using SHIFT-insert pastes the mesh data.


text:
Part of object disappears when viewed through a transparent material
When using the Blender Game Engine, the parts of the model viewed through the windows becomes transparent and it's not a clipping problem. If I select a glass object the model viewed through the glass object shows up properly.

I have tried both solidify and double sided and it doesn't help. If I select a transparent object, the object then shows the model through the object. When I press play, then everything works right. In the image I have selected the 'glass door' on the left and the object can now been seen, but not through the other windows. I hope this is alright to answer like this, as I don't see away to include an image in  my comments.

Related: http://blender.stackexchange.com/questions/31558/alpha-transparency-making-wall-transparent
I'm assuming you're using GLSL shading mode?

Yes I am using GLSL

What does it look like inside the game engine?

It look s fine when I press 'P' to activate the play mode

My guess their normals are pointing to the opposite direction. One solution is to add a solidify modifier to it, or check in double sided in object data. The second option is maybe better for performance.


text:
Does this flat 5 sided face count as a square?
Is this a pentagon or does it count as an square for animation purposes?
It technically has 5 angles, but one of them is flat, so practically it should be a square with 4 sides, but I'm not so sure.
It also is flat on the Z-axis.

I'd generally leave it like is but I'm trying to up my game. Thank you

I think you mean quad, not square, it's definitely not square.  But no, it is not a quad, it is a pentagon (n-gon).

related: http://blender.stackexchange.com/questions/28844/will-a-straight-edge-with-4-vertices-create-ngons/28847#28847

It is a pentagon or the more common general term in 3d, a n-gon. You probably want to avoid these for anything realtime such as games or animations since they do not deform or smooth well, make adding more detail cumbersome and games are more optimal with triangulated meshes.
As a simple flat object, it's fine if you are done with the model but again as a rule of thumb, try to stick with quads and tris.
To resolve, you can either:

Use the join tool (select both vertices and press J).
Use the knife tool (K, select a star point and drag to cut, use Enter to confirm) to create a tri from the extra vertex or create quads by continuing the edge flow downwards.

It counts as a pentagon. I don't think you can change it either. Or you make it 2 squares by using cut (shortcut K in editmode) and just ad a cut from the extra vert to the center of the edge on the other side.


text:
What is the red and white circle that appears when I left click?
When I click with the left mouse button, a white and red circular scope-target-looking-pointer moves to the location of the click. I can't make any sense of it and would like to find it in the manual. What is it called?

It is the 3D cursor, at this position new objects will be created; try 'Shift'-'A'

@stacker: thanks, that answers my question and is helpful too.


text:
Antialiasing textures in cycles (Blender 2.77 and higher)
I would like to get an answer to a frustrating question.
https://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.77/Cycles
In this link is "Anti-Aliasing is now enabled for baking. (c359343)"
This the great news, and unfortunately in my case it is not working. I try to bake normal maps. I need to bake in full resolution (4k, 8k), and it is not possible to bake 4k and manually changing texture size to e.g 1024 to get in this way manually 4x AA. Currently, I must go to bake in Xnormal (Because I must use cage...Blender internal cannot by used). Xnormal uses AA in bake. The difference in quality is very high.
My question is: It is possible to bake in Cycles normalmaps with AA or if not, whether in the near future it is planned?
Sorry for my very bad english and best regards! Blender is the best! :)

Today I checked this again . It seems that Blender bakes almost everything except normal maps with AA . In Ambient Oclussion bake based on the settings in the samples overlap. In the case of the Normal Map settings do not the influence. So please someone versed in the subject matter of the transfer this information of the creators of the blender / notification a bug , etc. There may be a slight correction in the code allows you to add AA ? I see many people need this function.


text:
collection info: cannot reuse the attribute value as instance produced from the individual geometry nodes
Note: I reported bug on this but they replied this is not a bug. Then following this logic I think there should be some ways to resolve this that I don't know. I would like to ask for help in blender stack exchange. I just try to paste the content from the bug report.
I made the attribute with label 'aa' and and the sum of the face area of each geometry.
I wanted to reuse their attribute values collectively from another new node tree by creating the collection info.
However, I cannot get the value from the instance "mode" but it only produces the corresponding values in "points mode" even if I specified them in "instance mode". It looks this is a bug

Exact steps for others to reproduce the error

generate individually for each geometry a geonode to calculate the sum of its area
store the attribute as name 'aa' with the stored named attribute
and connect the sum attribute('aa') to the group output labelled as 'area'
create the new node with collection info to try to reuse the 'aa'(sum of area of each node)
try to get the value from the mode of instance but failed. It can only be retrieved with the mode of points!

However, I use the "Realize Instances" node and I can show the value in "points" but this is not what I wanted.

The individual geometry "cube" is to show how the setting is made for "instances mode" so I checked it with ticks to show I selected the adequate nodes with instance mode.

I removed the "Realize Instances", I still cannot get the thing right. It still shows the value for 'aa' is 0 by the viewer.

"Realize Instances" node converts instances to "real" geometry. There can't be any instances after this node, because they are all supposed to be realized. This is not a bug.

I understand this but I remove the "Realize Instances", I still cannot get the thing right. It still show the value for 'aa' is 0. However, I use the "Realize Instances" and I can show the value in "points" but this is not what I wanted.

Your screenshots don't show this aa being 0, your .blend file also doesn't show this.

Sorry that it is a little bit confusing and it is also the tricky point perhaps I need to further explain. The second screenshot is the individual geometry "cube" to show how the setting is made for "instances mode" so I checked it with a tick. The first screenshot is the problematic situation I encountered that even all settings are "instanced" orientated, the viewer still shows nothing or zero in the instances row. Thus, I made a question mark to show the problem. Hope you can understand this issue. I really feel this is a bug after reviewing a few times!!

After reviewing the comment again, I added a third screenshot to show how the viewer display "0" for all instances. In this setting, the "Realize Instance" has been already muted.

generate individually for each geometry a geonode to calculate the sum of its area

this is a bad error reproduction instruction, because it's too vague. Instructions how to reproduce an error shouldn't be subject to interpretation. Maybe you think the .blend file serves as a specific example, but sometimes it may be unclear which elements were specifically added to the starting project (e.g. if you have a different default template or did something not clearly visible like parenting...)
On your 1st screenshot you capture an integer attribute, but never use it, therefore the node has no meaning and can be removed. Then you capture named attribute aa as an anonymous copy, realize instances and read it. Perhaps you expect to read it before the instances were realized, but that's not how attributes work:
What Does Capture Attribute Add to Geometry
If you have good understanding of geonodes, and there indeed is an error (I don't see one), then ideally you would take two steps (two sides of a green link), presented the geometry data in the form of a table like I did in the answer linked, one table per each step, and then also the 3rd table describing what you expect either step to be instead.
It seems what is your problem is that you expect the attribute in point domain, to travel up into the instance domain, when you convert geometry to an instance. This doesn't happen automatically. The only time when something similar happens, is when you use "Instance on Points" node, but then the attribute is copied from a spawning point to an instance, not from instance's geometry to instance. Below I capture instance index, realize geometry, delete every former instance's point except the first, then the indices of instances to realized points map one-to-one and the data can be moved onto the instances:

Thank you for teaching me many things. That is very valuable. However, if I want to sort out the geometry with the maximum face area among all, what I can do to achieve this task?

Using the above setup, you can use Attribute Statistic node to find the maximum value of an attribute, and then you can use that attribute with a comparison node to delete all points /instances with another value. If you use points, they already have former index captured, so you can still access this captured index after real indices get reduced to a single integer $0$ due to deletion. And this captured index is the index of the instance that had the maximum attribute.

Thank You Markus! I spent a few days on this and eventually get thro' via your solution although I am not quite satisfied that the instancer is so limited that it is hard to convert the face domain into instance domain even if the counting is matched for the index.

I'm not sure if I understand correctly what you want to do: do you need the separate face areas of each individual object in the GN nodetree on the "Circle" object or do you just want to calculate the area sum of all objects in the collection?
If the latter, there is no need to calculate them individually with separate GN on each object. Just realize the instances from the Collection Info node, plug a Face Area node into the Attribute Statistic node and take the Sum.
If you want to keep the objects as instances, just plug them directly (without the detour through the Realize Instances node) into a Group Output or Store Named Attribute node or whatever you want to do with it:

If you want them altogether as if it was a joined object, you can even disable Separate Children on the Collection Info node which makes all objects a single instance:

The good thing about this method is, you can always add objects to the collection and their area will automatically be added to the face area without the need to put another GN nodes modifier on them to calculate their individual face area:

Thanks for your suggestion. Actually, I wanted to calculate the maximum face area among all the geometries and sort the one out with the maximum value and do some operations on it but up to now, unfortunately, I can't something similar that could accomplish this task.

@Patrick Okay, I'm sorry I have no solution for that right now. But honestly, sorting out the one with the maximum value is nowhere stated in your question. If you would tell what you really want, maybe somenone would find a way to do it even if it is not based on what you've started with.

That's very kind of you. I just worked and stuck at this stage before I can go further for the sorting so I just publish the work for discussion. I thought this a bug. Anyway, thank you for your reply.


text:
Python scripting a custom Geometry Node to generate another Geometry Nodes
I am scripting a custom Geometry Nodes(hosted by “Cube”) with python to initiate another Geometry Node from another object(i.e. Plane). I tried this using a template searched from the internet. I didn’t bother to edit the names and other stuff but trying to add a function to test the above purpose. It can generate a new geo node under the modifier stack but it is not yet initiated. The “new” button is remained “un-pressed”. Thus, I need to add a script to “press” the “new” button as follows:
bpy.ops.node.new_geometry_node_group_assign(override, modifier="nnn")

Attached blender file as reference:
However, when I do the override on the following for assigning a new geometry nodes(equivalent to press the “NEW” button on the modifier stack for the geo node, Blender either crashed quit or remained the geo node uninitiated:

bpy.ops.node.new_geometry_node_group_assign(override, modifier="nnn")
I tried many times and tweak the scripts to avoid crash but still in vain.
Can someone be kind enough to help me solve this issue?

The .blend file contains the default cube, with Geometry Nodes that do nothing, with the node tree having the Group Input directly connected to the Group Output, and a free-floating (disconnected) "is Viewport" node. There's also a plane, a light and a camera. There's a script in the Scripting workspace that seems to introduce the "is Viewport" ("is rendered view" is the opposite?) functionality in Blender version that didn't yet support it. According to the quellenform's list that would be B2.92.

So I figure you want to create custom nodes in Python? That's the way the question should be phrased then, concentrate on what you want to achieve, not on the technicalities ( https://en.wikipedia.org/wiki/XY_problem ). Asking to fix bugs is off-topic to this site.

Thanks for your reply and I tried to rephrase the title and content to explicitly express I wanted to script the custom geometry node. On the other hand, you suggest it is a bug but I am not sure whether it is a bug or just my incapability to initiate a geometry node by python but it needs to be initiated from another geometry node because I need to "apply the geo node" finally.

The two errors are are bpy.ops.node.new_geometry_node_group_assign does not recognize modifier as a keyword. Another one is, using the override dictionary returns {'CANCELLED'}. To fix this, replace bpy.ops.node.new_geometry_node_group_assign(override, modifier = 'nn') with,
with bpy.context.temp_override(**override):
    bpy.ops.node.new_geometry_node_group_assign()

Changing the modifier name of the modifier can be achieved by running obj.modifiers.active_name = 'nn'.
You may want this behavior, but I don't know if you want to create new modifiers per update of the node (on creation, on new sockets, or on link). You may just do all this stuff in the init function of the node.


text:
Get separate explicit render passes without rendering the entire image
Today I noticed that I need to render some paths separate from the combined path. (Z and AO). I checked the marks, put combined to off and also made the locations clear in the node editor for blender where to save the 2 files.
However when I start rendering blender still starts to render the whole image.
I had hoped it wouldn't so that it won't take that much time to just render the AO and Z depth.
What do I have to do in addition to get the combined render off.


text:
How do i get the ocean modifier to animate?
I have been going through many tutorials and even asked in BlenderArtists but no help. When I get to the point to insert keyframes a keyframe drop down menu appears instead. It has been very frustrating to figure it out

Possible dupe? https://blender.stackexchange.com/questions/164/can-modifiers-such-as-subdivision-and-array-be-animated

Insert keyframes for the "Time". Set the frame to 1, move your mouse on "Time" and press I

Change the frame, add some time and press I again.

For OP, also worth noting you can animate other properties, play around with them.

Here is a short video tutorial on how to animate using expressions in Blender 2.80: https://youtu.be/2oUK0n5prRY
Right click on Time
Select Add Driver
Make sure you remove the Input Variable
Then type in this expression and you are good to go:
frame * 0.1 / 10

Sure if you right click on any field there is "Add Driver" CTRL-D Choose Single Manually Later.
In a Graph Editor you change to view Drivers from F-Curve drop down.
Select and use 'n' to view Drivers TAB on right panel. The Scripted Expression Type has the Expr: field below that so you can then put in the Expression.
A better option is to use the C.scene where C is bpy.context but it's not set there, so (bpy.context.scene.frame_current / 10) would drive the ocean.
You can delete the var and don't worry about the warning like I said before.
Seems it also says it's unsafe for RenderFarm so the previous scenes[0] might be better it's all new to me so I find it lacks professionalism and clarity.
Again one should be able to just put that expression into any field directly via back-ticks or what-have-you and skip all this super confusing poorly designed hidden driver linking to graph editor expression crap.
Better yet have the ocean include a checkbox (or time link button) by default to drive it with an appropriate setting or adjustable speed slider by default [expected behavior].

I found adding a driver and changing the expression in graph editor (not sure why no one thought to allow expression editing directly in the field?!), with a reference to the current frame got it moving when playing fine.
(bpy.data.scenes[0].frame_current / 10)

The warning TIP is not important here and I just delete the variable below.
You'll have to open a node panel with the 'n' key in the graph etc. in the end it's easier just to keyframe the value, if we can't put expressions directly into the value via backticks ` like Houdini etc.
You should be able to do something directly in the field like @curframe or call a global function frame()?... alas it's free software.

Interesting. Not the easy way but no doubt it's powerful. You should explain with more details how to connect this to the ocean modifier, what can be done and how, inside blender of course.

too long? see below... or above? it's hoping around.


text:
Subsurf, triangulate and UV texture problem
I am using triangulate and next subsurf modifier on my tent project. I have huge problem with UV mapping.

Without triangulate it is porblem too, there are any freak "faces" under model, I don't know why:

Do You have any idea how to solve this problem?
I tried make subdivisions in edit mode, also making offset near edges. There is less errors but it still looks horrible but UV map is a lot of worse (I need UV for walls with "sample text" to be this "cuted triangle" like it is now).
Thanks,
A.

Blend file: https://www.dropbox.com/s/sb70islclejgmys/Tent_0.22.blend?dl=0
The mesh is the simplest as it can. It is surprise for me that sometimes it is no problem to texture complex mesh but with this simple mesh it is a problem. Maybe I am using wrong technique?

Most likely the "freak" faces you point out occur because Blender splits non-planar quads/Ngons placed there. The solution would be to redo that part of mesh with cleaner topology. Add screenshot of the mesh while in Edit mode with all selected and UV/Image Editor opened for UV  map to be visible.

Blender doesn't subsurf n-gons or triangles that well. Try retopologizing the mesh, and then applyong the subsurf and triangulate modifiers and UV them after that (you can duplicate the mesh before you apply the modifiers so you have a backup)


text:
How to create a gradient colour like on the picture and the apply it on a mesh
I am making a logo like on the picture with blender , but the colour of the text doesn't come up as it should be .

You may achieve it using the Gradient Texture and Color Ramp nodes.

Set up the material nodes as pictured below.

You may also add a Mapping Node to change the location, rotation or scale of a gradient.

Try to change the Gradient Texture's type to for example Radial, Diagonal or Quadratic Sphere and experiment with a Mapping node and Color Ramp settings for different results.

You may also add a Bright/Contrast node between Color Ramp and Diffuse nodes to make some quick color adjustments.
Here's a .blend file with the closest effect to the reference you provided:

You can achieve this by mixing a bunch of Diffuse Shader Nodes and connecting them to a couple of Mix Shader Nodes, while using Voronoi Texture as a Factor of those Mix Shader Nodes.

Here is the Node set up:

And Here is the Result:

The second way to do that would be to UV project from view the letters and then export the UV layout to an external photo editing software like Gimp or Photoshop and create your self the Gradient Texture that will lie uppon the letters. Then import this texture to Blender and use it as a Factor of Mix Shader Nodes mixing different Diffuse Shader Nodes.

The third way could be for you to UV project the letters UV layout as before and import it in to an external Photo Editing software, create whole the gradient texture there and then just add it to the letters, to the color of the Emission Shader Node.

I am a little paranoid about your spelling of Voronoi.  In any case ochen xoroshow.


text:
Why there is a layer of transparancy on my uv map?
When i take one of my objects and unwrap it onto the uv map area it will unwrap it like it should around the seams i make. but when i look at it the area on the faces is slightly white and when i export it to color behind it, any color behind it is a bit lighter then it should. another problem  i have is when i add an image to a node to add it to an object to color it, the object will turn while and not show any signs of any of the color at all even though the uv colored map was a color.

First question around transparency: When Blender exports a UV map, faces are slightly opaque by default. This is so people can more clearly distinguish the difference between what IS a face, and what isn't. Ordinarily the UV map is taken into a graphic program like GIMP, Photoshop, illustrator, etc as a layer: the actual artwork is drawn on different layers, and that final result is exported as a Blender compatible file format, WITHOUT the original underlying (or overlying) UV map.
So... export your UV map, do your artwork, and remove the UV map layer before saving your finished art.
The amount that Blender will tint faces is configurable! When exporting, look in the left column for this palette:

...And adjust the Fill Opacity to zero.
Your second question needs more detail, such as which render engine you're using (Blender Internal or Cycles [or other]), what node you're adding to color it and how the nodes are connected. A screenshot would be necessary. Good luck :)


text:
Blender 2.8 - Python - "active" removed from API - How to pick active object now?
I want to pick the active object in the scene to tweak some settings at this object. A camera.
In Blender 2.79 and lower this could be done by bpy.context.scene.objects.active And it worked fine. But in the 2.8 API they have removed the active. And i get an error now.

So how am i supposed to pick the active object now?
The 2.8 api simply says active is removed. But not how to replace it. The api changes wiki states that it is replaced by context.render_layer.objects.active. But this just throws another error.
https://en.blender.org/index.php/Dev:2.8/Source/LayersCollections/API-Changes
Code that works in Blender 2.79, but not longer in 2.8:
bl_info = {
    "name": "Create My Cam",
    "description": "Creates a camera",
    "author": "",
    "version": (1, 0, 0),
    "blender": (2, 80, 0),
    "location": "add menu",
    "warning": "", # used for warning icon and text in addons panel
    "wiki_url": "",
    "category": "Create"}

import bpy
from bpy.types import Menu

# ----------------------------------------- Adding camera
class CIC_OT_mycam(bpy.types.Operator):
    """Creates a camera"""
    bl_idname = "scene.cic_create_cam"
    bl_label = "My cam"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):

        # ----------------------------Create Camera with correct position and rotation
        bpy.ops.object.camera_add(location=(30.60861, -30.60861, 30.60861), rotation = (0.955324, 0, 0.785398)) # Create Camera.

        object = bpy.context.scene.objects.active # Pick the active object, our new created camera

        # ------------------------------Here we adjust some settings ---------------------------------
        object.data.type = 'ORTHO' # We want to set the type of the camera to orthographic
        object.data.ortho_scale = 14.123 # Let's fit the camera to a basetile in size of 10
        object.name = "My Cam" # let's rename the cam so that it cannot be confused with other cameras.
        bpy.ops.view3d.object_as_camera() # Set the current camera as the active one to look through

        return {'FINISHED'}

# -------------------------------------------------------------------------------------------

class CIC_MT_cammenu(bpy.types.Menu):
    bl_idname = "CIC_MT_cammenu"
    bl_label = "Create camera"

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

        layout.operator("scene.cic_create_cam", text="My Camera")

classes = (
    CIC_OT_mycam,
    CIC_MT_cammenu,
)

def menu_func(self, context):
    self.layout.menu("CIC_MT_cammenu")

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

    bpy.types.VIEW3D_MT_add.append(menu_func)

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

    bpy.types.VIEW3D_MT_add.remove(menu_func)

bpy.context.active_object should work.

Cool, this one works too. So two solutions available. Thanks :)

The problem is, both these solutions wouldn't work if you're trying to make an object active, because both of them are read only!

Yes, but that was not the goal. The goal here is to get the active object to perform the needed code at it and to adjust its settings.

bpy.context.object seems to still work just fine with an extra bonus of less typing.
You can use the autocomplete function(Ctrl+Space) in the Python Console to find out how things are in 2.80 as well as in previous versions.

Works like charm. Thanks. The python console was unfortunately of no help here since i had no idea which route to go. And doesn't state changes. I wouldn't have thought to look under bpy.context.object here as the replacement.

The console was how I checked it - I just looked through all the items after bpy.context. , bpy.context.scene., bpy.context.scene.collection. .

Will keep this in mind for the next time :)


text:
moving vertex is not deforming mesh?
so when i select a vertex and click g to move it, only the vertex/edges move, but the face/mesh stays in the same place. does anyone know how i can fix this/what i'm doing wrong? thanks!

not easy to understand, don't you have a second vertex at the same position? If so, delete it. But maybe share your file: https://blend-exchange.giantcowfilms.com/