How to NOT duplicate data when copy-pasting? In Blender, there are two ways of duplicating things:

The Duplicate Objects (Shift + D) command, and
The Copy and Paste function that we're all familiar with (Ctrl + C and Ctrl + V).

Both of these create new instances of objects... That can be manipulated without affecting the other...

As many of us know, we can disable data duplication for the first method by simply going to:
File > User Preferences > Editing > Duplicate Data, and unchecking the things they want to be linked to the original instance, rather than copied.

As a result, it does not create new instances of the texture file (in the image viewer) or material data, etc.
Question:
How do you do that with copy-paste?
Of course, things that do not exist that are copied in should have an instance created.
tl;dr Is it possible to merge Duplicate Objects with Copy and Paste?

The "object" doesn't store the actual data, like the mesh. That's stored in a datablock.

Each object normally has its own datablock, but you can assign any datablock to any object (of the same type), effectively creating linked clones. When you edit one object, you're actually editing the datablock, so any other objects with the same datablock will change in tandem.

Anything on the Object tab (the orange cube in the screenshot below) is part of the object, not the datablock. These settings will not be shared between objects.

The datablock selector


Bake lights (lamps) to vertex color Is it possible to somehow bake vertex colors from lamps?

No, I don't think you can directly, as far as I know, but what you could probably do instead is a multi-step process to achieve your desired final result.

You can only bake to a texture, so bake said lamp influence to an image based texture, then use said texture to create a new vertex color layer from it using an addon to translate from image to vertex colors.

Rough steps: Create your desired mesh, add a "neutral" material to it, like say a purely diffuse white material that will receive clean colors from lamps.

Unwrap said mesh to a new UV Map, create a new texture and bake that object to said texture.

Save the image, then use the addon UV/Bake Texture to Vertex Colors to create a new Vertex Color layer based on said texture.


How to apply a texture to only one side of a plane How can you have an image as a texture (in this case on cloth) that is only applied to one side of a plane?

I would like the reverse side to be a solid color.

Please see below image where the cloth has the image texture on both sides.

In Cycles you may use a Backfacing output of the Geometry node as a factor for applying two materials for each side of a plane. Set up the material nodes as pictured below. You may do it in the same way in Blender Internal. The only difference is in BI the output of the Geometry node is called Front/Back.


how to hide mesh but keep hair particles I'm using hair on my mesh but when I comb the mesh the hair goes through it. I don't want the mesh anyways so instead of figuring out how to stop the hair from going through the mesh I'm trying to figure out how make the mesh invisible but not the hair. When I use a transparency node it effects hair and mesh

I added the particle instance modifier like it says in this question Hiding source of particle instancing but it didn't hide the mesh.

Thanks in advance

PropertiesEditor-->Particles-->Render-->Emitter.

this will hide the mesh in render view


What format, codec, and color settings should be used for youtube? There are probably 10,000 threads and articles dedicated to this and I've read about half of them but none of the suggestions are helping.

My scene has the exact contrast and saturation that I need for an LED promo video I'm working on.  But when I upload to youtube (or Vimeo) it completely loses both.  I know that youtube reformats and re-compresses, that's not the problem.

It looks like it's reading the video's format as 16-235 and so the contrast gets squashed.  But I'm outputting in sRGB color space and I've also tried VD16.  I've outputted MP4, MKV, AVI, MOV.  I've used H.264, MPG2, and DIVX codecs.  Nothing seems to work.

It's actually worse than the gif shows.  The screenshot / photo-edit / .gif conversion really degrades the images:

Basically, is their another format and/or color space I should be encoding with?

EDIT: The video is comprised of PNG images that were previously rendered and I used Filmic.

EDIT 2: As troy_s states I need to set the range.  As I said earlier it looks like it's a 16-235, but I don't know how to set it to 0-255 in Blender.  Is there a way to do this?

That sure looks like a broken encode. If using FFMPEG, you need to set the range to broadcast and the encoding weights to 709.

If you hunt through the other tidbits here, I explain how broken ranges or double ups will give you exactly what you are seeing.


Assign button missing from material tab Can somebody tell me where the "assign" button, for assigning a material has gone?

Here is where it should be, but it has gone away:

Why does this happen?

You need to be in Edit Mode. That way you can select the vertices to assign to. Otherwise Blender has to use the mesh as one whole surface when applying new materials.


Is it possible to create a loop with Hair Dynamics? I have a walk cycle of a character I created that uses hair strands with dynamics turned on.

I was wondering if it was possible to make the hair dynamics loop along with the animation. Because as of right now, every time the animation loops, the hair physics restart which looks strange.

if you're able to have the forces on the hair dynamics be equal in the beginning and the end of the loop, you can bake the hair from a negative frame to get it to settle in the same position that it will be in on the final frame of the animation.


Normal direction screwing up rendering in blender/UE4 but not keyshot? I'm playing around with a 3d tank model from a video game so I can 3d print it. The model consists of 4 parts, the hull, suspension, turret, and gun. I noticed the normals on all 4 of them are flipped in the wrong direction, but the suspension and gun still render normally in all rendering software.

pictures on imgur

The hull and turret render as a dark silhouette in blender internal/cycles (first screenshot) and appear transparent in UE4, but render normally in keyshot. The entire model looks fine in the blender viewport (second screenshot).

In UE4 (third screenshot) you can tell the normals are wrong since the front faces appear transparent (while the back faces appear because their normal is facing the camera). Same thing happens when you enable "backface culling" in blender. What's weird and pissing me off about this, is that the gun and suspension have their normals facing in the wrong direction too, but they render normally (and backface culling behaves normally on them).

I tried flipping the normals and recalculating them ("make normals consistent" box ticked in blender), except they still render incorrectly but now the shadows are in the wrong direction too. I can't manually correct each face since the model has 30k+ faces... This is really stumping me since I've only been using blender for a couple days... Also the models have a copyright on them (they're from a game) so I can't upload it for someone to help with unfortunately.

I already used these two threads and neither worked:

Select normals pointing in a certain direction

How to make all faces flip to the right/consistent direction?

The solution is to recalculate the normals and then export it as a .dae.

When reopening it, it renders correctly.


Moving Back and Forth - Animation Node(PYTHON) vs Unity (C-SHARP) Boolean Switch Logic public class ChangeDirection : MonoBehaviour {
public bool movePositive = true;

// Update is called once per frame
void Update () {
    // CHECK IF MAX REACHED AND MOVING POSITIVE DIRECTION
    if (this.transform.position.y <= 4f && movePositive) {
        // MOVES IN POSITIVE DIRECTION
        this.transform.position += Vector3.up * Time.deltaTime * 5f;
    }
    else {
        movePositive = false;
    }
    // CHECK IF MIN REACHED AND MOVING NEGATIVE DIRECTION

    if (this.transform.position.y >= -4f && !movePositive) {

        // MOVES IN NEGATIVE DIRECTION
        this.transform.position += Vector3.down * Time.deltaTime * 5f;
    }
    else {
        movePositive = true;
    }
 }
}

NOT C-SHARP QUESTION EXACTLY - I NEED TO IMPLEMENT A BOOL LOGIC IN PYTHON
The code above moves an object back and forth within specified limit making one bool switching True and False,
Hits the max and moves in negative direction and hits the min and moves in positive direction.

But as you can see in the image, I can't do the same thing with the same logic. How can it be implemented in Python script with Animaton Node - Blender?

Adding the code extra if you have problem with image

move_pos = True

if input_x < 20 and move_pos:
    input_x += 1
else:
    move_pos = False

if input_x > -20 and not move_pos:
    input_x -= 1
else:
    move_pos = True

output_x = input_x

I see no good reason to discretize such simple animation. A parametric approach might be better. To move an object between 0 and 1 in 20 frames, you can use such node tree:

To see why it works, plot the function. Another approach would be to use the animation nodes in Animation Nodes:


How to close/open a view panel I can't find a way to close a view panel, in particular the horizontal at the bottom, is pretty useless to me at this moment.

An alternative to iKlsR's answer:
You can close a panel by right clicking on the line between the two pannels (i.e. the shadowed area. Your mouse will turn into a double-sided arrow when you hover) and clicking join area:


which is best for blender rendering cpu or gpu I am trying to learn Blender , my current system with i5 3230M with 8GB works all right but struggling , So I am planning to build a budget pc. It ll be really helpful if you anyone could help me out on important question . is it best to have a good cpu (like i7 7700) and no graphics or to have mediocre cpu (like Ryzen 3 1200) and a graphics card (like GTX 1050Ti 8GB).

I read cpu can take advantage of copious ram for large scenes and gpu can be faster under normal rendering circumstances.

Any suggestions save for a particular cpu or gpu , Thanks a lot in advance.

I’d go pure cpu for now, it’s quite easy to max a gpu’s 4-6gb ram cap

Whilst you can upgrade normal system ram

Plus cpu’s Are closing the gap substantially on GPUs in blender

To put it into perspective:
Amd’s Threadripper 1950x £800 can render a scene at 90% the speed of a gp100 Nvidia gpu (£4000 card 16gb cap) but if the scene gets over that 16gn limit then and wins hands down

Check this http://download.blender.org/institute/benchmark/latest_snapshot.html


Why does the lighting on this object not work properly? Imported obj As you can see, the sun is pointing at it from a direction, and the light is on the other side?
I exported an OBJ from Daz3d and then imported it into blender. Even when I remove the material, the pink, it still doesn't work. Other objects in the scene receive light properly. What is going on and how do I fix it?

It's a split normals problem that happens with some imported objects, go into the Properties panel > Object Data > Geometry Data > Clear Custom Split Normals Data


Adding an animated watermark on a video I'm trying to add an animated logo watermark made of looping image sequence on a 1080p video using alpha over node in the compositor, but the rendering is 2-3 seconds for each frame and that can take a lot of time for long videos. Is there another method to do that to increase the processing speed?

After doing some tests I found out that Video Sequence Editor gives 5-10 times faster result than the Compositor.

I added a Transform Strip to the Logo image sequence, changed Blend to Alpha Over and adjusted Position and Uniform Scale, then duplicated both Logo and Transform strips to match the video length.


Using UV Mapping on an Equirectangular Projection Background: I am attempting to create a Unity application for viewing asteroids. I have a wavefront object that I got from NASA's PDS SBN. Right now, I am looking to replicate the version of Eros from the 3D Asteroid Catalogue (click "Grayscale" on the website to see the texture), but in Unity instead of ThreeJS. I believe I need to create a UV map in Blender so that I can apply it to the object in Unity.

Thanks to lemon in a previous post, I was able to get a cylindrical texture map on the asteroid. But I did not realize that I couldn't import this directly into Unity.

For reference, the wavefront file I'm using is located here, and the simple cylindrical projection I'm using is located here (warning, large image file).

Question: I have a wavefront object and a texture which is an equirectangular projection. I want to apply this equirectangular projection too the object in Unity.

I believe that I need to do this by getting a UV for the texture. To create a UV, I want to unwrap the object's mesh in a way that is identical to an equirectangular projection. What is the best way to do this?

Attempted Solutions: Here is an image of the working equirectangular projection in Blender:

That works well, but this does not import to Unity. So I attempted to create a UV map that emulates the equirectangular projection. I unwrapped the mesh as a cylinder and applied it to the asteroid with an image texture node. Here is what the unwrapped mesh looks like:

I'm not sure if this is the right unwrapping or not, because when I try to display the asteroid, I get something very garbled. Here is a picture of my attempt at rendering the asteroid with its texture on:

I'm confident that I am applying this completely wrong, I'm just not sure why. Here is what my unwrapped mesh looks like -- the entire asteroid is covered, so the streaks & the weird band around the asteroid don't make

Two bake solutions.

Bake from the original object

A solution can be baking the model from this answer on to a copy of the mesh.

To do that:

From the original mesh, enter edit mode and unwrap it (the way you want, smart UV project will do).
In object mode duplicate the object, so that both original and copy will have a UV map which will be needed to bake even if the UV map of the original mesh is not directly used.

The UV map I have created is the following:

Create a new material for the copied mesh.
Add a unconnected image texture in it, call it for instance 'bake' and save it to disk.

Like so:

Now the bake setting:

Use Cycles and if possible GPU
Set the bake mode to diffuse (we want the color)
Influence color only (for the same reason)
Selected (original mesh) to active (target mesh)
Ray distance to some little amount to avoid overlapping effects between the two meshes

Now make sure the two objects are at the exact same position.

Select the original mesh, shift select the target, and use the bake button above.

Here are the resulting meshes:

(I cannot share the blend file as too large for this site).

Bake from the environment texture

Another possibility is to bake from the environment texture.

As we know that the original texture is an equirectangular projection, we can set it as environment texture.

Here too the object is previously unwrapped the way you want.

The bake setting is simple (the object will have to be at the world center):

Now we have to setup the environment texture. As for your previous question the tricky part is to find the good mapping in this context (180 degrees and inverted axis):

Once done, select your object and hit the "bake" button.

The result is similar:


Shader Editor not match selected material I selected the glass which is glass, but under the shading, all the nodes are the donuts. What did I do wrong that the nodes are not matching with the selection?

Thanks a lot!

You selected an object. That does not necessarily select the material you intended to select on it. You need to do that in the Material tab in the Properties Editor:

In order to assign materials to different parts of an object you need to select desired faces in edit mode and click assign in the Material tab in the Properties Editor:

It is also quite important to name your materials appropriately. It might not be a problem for you now to have Material.001, Material.002 and Material.003, but once you work on anything more than a few objects with 3 or 4 materials, it will get very confusing if you don't name things. It's better to make a habit out of it.


How to project a single x/y coordinate in z-direction onto a specific mesh with scripting I want to place a number of objects on the surface of a mesh (think: terrain, (displaced) ground plane mesh) along the global z-normal. I know my objects' x/y coordinates and need to find the corresponding z value on the mesh surface to do the translation of my objects.

I'd prefer a solution involving scripting. Performance is not a big issue, but the method should be fast enough to handle up to a couple of thousands of objects.

I have found a number of approaches, but I'm unsure where to dig deeper and would appreciate some pointers.

What I looked into so far:

Raycast: I understand that I could place 2 empties - number one just underneath my object, number two shifted far away down along the z-normal, cast a ray and would get a hit on my mesh if it is between the two. However, there may be situations when my target mesh is obstructed and there is no direct line of sight. Still looks like the most promising approach so far. (related issue)
closest_point_on_mesh: that sounds good too and would avoid the line-of-sight issue, but I don't see a way to restrict this to the z-normal
mathutils-geometry: intersect_line_plane sounds also interesting, but my target is not a "plane" (or triangle) but a mesh. I'm unsure how to apply this function to a mesh - do I have to step through all the faces? Is that efficient and if yes, how is this done?
BVH: mytree.ray_cast or mytree.find?
Snapping: maybe in this case, using userspace functions like snapping make sense? But I'd prefer something without reliance on context.

I've tried to use lattice/shrinkwrap to place all (joined) objects in one go, but the shrinkwrap modifier deforms them, which is not what I want.

Thank you!

The script below will move a list of Suzanne's to the surface point directly above them on the terrain object using ray casting. You don't need to worry about obstruction by other objects since the ray is cast directly within the target object's (terrain) local space.

import bpy
from mathutils import Vector

def obj_ray_cast(obj, matrix, ray_origin, ray_target):
    """Wrapper for ray casting that moves the ray into object space"""

    # get the ray relative to the object
    matrix_inv        = matrix.inverted()
    ray_origin_obj    = matrix_inv * ray_origin
    ray_target_obj    = matrix_inv * ray_target
    ray_direction_obj = ray_target_obj - ray_origin_obj

    # cast the ray
    success, location, normal, face_index = obj.ray_cast(ray_origin_obj, ray_direction_obj)

    if success:
        return location, normal, face_index
    else:
        return None, None, None

objects = [ o for o in bpy.context.scene.objects if "Suzanne" in o.name ]

targetObj = bpy.data.objects['Landscape']
mw        = targetObj.matrix_world

for o in objects:
    ray_origin = o.location
    ray_target = o.location + Vector((0,0,100))

    location, normal, face_index = obj_ray_cast(targetObj, mw, ray_origin, ray_target)
    if location: o.location = location


shading issue with bevel modifier I created this object which has a bevel modifier and a mirror one(x and z axis). The top faces are of the same height so they should shade even but they shade some bumping out as showing in the picture. I tried selecting faces which have not equal to 4 sides and turned out none, so there was no Ngons. Also I checked these was no vertex that unintentionally created and overlaid. So what actually causes this issue?
top view

side view from a certain angle

turn on showing wireframe

It has to do with your Bevel modifier and your Shade Smooth. If you apply the Bevel, you have this topology:

The small face I highlight is slightly tilted compared to the top flat face. As you have shade smoothed the object, Blender tries to smoothly transition from the big face to the slightly tilted small face. As each face is actually made of 2 triangles in a 3D object, and as the top face is rather big and elongated, the transition between these triangles is pretty noticeable, it creates some sort of artifacts.
You can easily fix the problem if you select the top faces:

Then press i to inset, and B to keep the borders stick to the mirror axis:

This time, as the next faces of the top face are flat as well, there is no more noticeable shading problem:


Hide an object from reflecting in the ocean modifier using nodes I asked this question the other day and it got closed as being a duplicate.
The answer that I was directed to did help, but didn't solve the full problem.
To clarify, I followed this answer which did nothing and I tried all the different combinations of the Light Path node trying to find one that worked before eventually changing the material from Alpha Hashed to Alpha Blended.
It disappeared from the ocean. I thought I had found the solution but then when I went back to the camera view I realised it was still being reflected in the sun's shine on the ocean.
Here is the issue and the node setup I have:

(If you look on the original question you will see that initially it was showing all over the ocean)
Is there something I have missed?

This answer uses a reflexion plane for the mirror. And it seems that "Screen space reflections" alone won't produce the wanted ligth path.
Consider adding a "reflexion plane" and scale it until it covers the grid reflexion area:


Run Blender from a USB thumb drive (including Preferences)? Mainly I want to know if this can be done on OS X. Answers pertaining other operating systems are also welcome though.

I know that it is possible to launch Blender.app from a USB thumb drive and use it on a Mac. But I believe a new Preferences folder is created in ~/Library/Application Support/Blender/2.76 (or whatever the Blender version number is)

Is there a way to get Blender to also use preferences from a folder on the USB drive?
If Python is not installed on the Mac, are there any workarounds that don't involve installing it on the system? (Not planning on running my own scripts, but add-ons may rely on it?)
Will I get hassled by Gatekeeper, even if I'm running the app from an external drive, and not modifying the Mac?

The goal here would be to have my own startup .blend, keyboard shortcuts, and add-ons that I would normally have at home - as soon as I plug in to another Mac, without needing to change the configuration of that Mac.

Thanks!

There are three places blender looks for addons and config files, they are referred to as local, user and system - If config files are found in the local location then the user and system locations are ignored.

So for your blender preferences you need to place them inside blender.app. Which would be blender.app/Contents/MacOS/2.76/config/startup.blend You can also add any extra addons here, you should be able to use blender.app/Contents/MacOS/2.76/scripts/addons which will match with the normal settings directories and keep all your additions in one place. If the addons don't work there then put them in blender.app/Contents/Resources/2.76/scripts/addons_contrib

You will also find the bundled python included with blender while you are adding your config files, unless deleted, this copy of python will be used by blender before any system installed python and you shouldn't have any trouble adding any third party modules here (as long as any dependant libraries are available).

I haven't used a mac for a few years so I can't comment on how this will interact with gatekeeper, but remember the gatekeeper settings on the machine will be the biggest factor.


Unwrapping a circle into a line of segments? How can I UV unwrap a circle (which is divided into segments) into a straight line of segments (triangles) - I can only get segments placed randomly.

I.E. a row of triangular segments with the circumference flattened into a straight line, giving a saw-tooth a pattern like /\/\/\/\/\

Rollout Fan

Test run, cone: 12 segments, triangle fan view, default UV map, aligned to view

Script, templated from  text editor > templates > python > Operator Mesh UV  Logic:

For the selected vertex, get all the linked tri faces.
Transform the selection such that vertex coordinate is zero, vertex normal
is z axis, ie translate by the vector coordinate and rotate such that
the normal is now up, using the rotation difference.
Calculate the perimeter by summing lengths of all  edges that dont
include center vertex of faces .
Much like a Mercator projection, map the angle difference of Y axis
to each transformed perimeter vertex to U.  Will be in range -pi to
pi, or -180 to 180 degrees.

To Install:

Run the script in text editor Only once to register

To Run:

In edit mode select the center vertex of the circle fan
Run the operator, F3 Circle Unfold

NOTE:

The script is written for 2.8.  Have added addon header to reflect this.

For prior versions replace @ with * except @classmethod and blender version to "blender" : (2, 78, 0) if installing as addon.

bl_info = {
    "name": "UV Unfurl Circle",
    "author": "batFINGER",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "View3D > UV > Circle Unfurl",
    "description": "Select circle center vertex, to unfurl UV",
    "warning": "",
    "wiki_url": "",
    "category": "UV",
}

import bpy
import bmesh
from mathutils import Vector, Matrix

def main(obj, up=Vector((0, 0, 1)), to=Vector((0, 1))):

    from math import pi
    me = obj.data
    bm = bmesh.from_edit_mesh(me)

    uv_layer = bm.loops.layers.uv.verify()
    v = bm.select_history.active
    if not isinstance(v, bmesh.types.BMVert):
        print("Not a vert")
        return False

    tris = [t for t in v.link_faces if len(t.edges) == 3]
    n = v.normal
    T = Matrix.Translation(-v.co)
    R = n.rotation_difference(up).to_matrix().to_4x4()

    # calc perimeter

    p = sum(e.calc_length() for f in tris for e in f.edges
            if not any(v in e.verts for x in e.verts))

    for f in tris:
        f.select = True
        e = next(e for e in f.edges if v not in e.verts)
        e.select = True
        ec = sum([v.co for v in e.verts], Vector()) / 2
        fu = R @ (T @ ec)
        fx = to.xy.angle_signed(fu.xy)

        for l in f.loops:
            luv = l[uv_layer]
            y = 0

            if l.vert is v:
                x,y = fx, (ec - v.co).length
            else:
                u = R @ (T @ l.vert.co)
                x = to.xy.angle_signed(u.xy)
                if abs(fx - x) >= 1.5 * pi:
                    x -= 2 * pi if x > 0 else -2 * pi
            luv.uv = (x + pi) / (2 * pi), y / p

    bmesh.update_edit_mesh(me)

class UV_OT_circle_unfurl(bpy.types.Operator):
    """Circle Unfurl
    Select circle fan center vertex
    Unfurl perimeter to U = 0
    """
    bl_idname = "uv.circle_unfurl"
    bl_label = "UV Circle Unfurl"

    @classmethod
    def poll(cls, context):
        return (context.mode == 'EDIT_MESH')

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

def draw(self, context):
    ''' menu item '''
    self.layout.operator("uv.circle_unfurl")

def register():
    bpy.utils.register_class(UV_OT_circle_unfurl)
    bpy.types.VIEW3D_MT_uv_map.append(draw)

def unregister():
    bpy.types.VIEW3D_MT_uv_map.remove(draw)
    bpy.utils.unregister_class(UV_OT_circle_unfurl)

if __name__ == "__main__":
    register()


How to extrude inwards without leaving faces? Here is the image to explain what i want

left box shows how i have set loopcuts (green is the face that i am extruding and moving). Middle one is what i want to get. The right is the issue with blender. the red faces will remain. (i have removed doubles on those faces) So is it possible to extrude inwards so that you dont have those faces hanging ? I know i could just delete those faces and thats it. but if you have lot of elements with similar idea it will get time consuming.  Thanks

Follow these steps

1) Go on Face select

2) Select the faces you want to "block" and click on Offset Edge slide

In this way these 2 faces will be indipendent from the others

3) Move your middle face in the position you prefer. Remember: move it, not extrude.

4) Select all your mesh and press w --> Remove doubles


Use filmic and output mask with absolute color values I would like to output both images where the color management (like filmic) is applied and save an object-ID pass. The catch is, the object-ID pass needs to contain the object as absolute white #FFFFFF. This of course doesn't work since the color management is set globally for the project and the "File Output"-node always applies the color management.

Is there any way to circumvent this? Since performance is critical I can't do a second render with switched color management.

Ok I found a way to do it. Instead of doing an alpha over with the ID Mask between black and white, I use black and a value node. The value node is set to a high value, high enough for the filmic color space transformation to map it to the maximum value 255/#FFFFFF in the output.

This has two problems though, 1) it depends on the "alpha over"-node to accept higher values than usually available (this should be ok, since internal representation is floating point), 2) I just took some high value instead of basing it on what value is mapped to white.


Is it possible to have a node value correspond to how much light is hitting that pixel? The puzzle I'm facing comes from when I was participating in Nodevember, so although I can think of ways to manage this by using baked image sequences or sync'ing up a mask to roughly match the movement of the light source, I'd rather achieve this purely using nodes.

In my scene, I have only a single light source that moves around and this means that the camera can sometimes see the dark side of the object.

I want the dark side of the object to become an emission shader and the side with light hitting it to be a diffuse shader.

I've tried having both shaders cover the whole object and turning the brightness of the light up very high so the emission is barely visible over the reflections from the diffuse shader on the side where the light hits but they are still visible.

Is there any way to add a node that outputs a value based on how much light hits it?

In the image below, both shaders cover the whole object, the light source is off to the right, the emission shader is emitting blue for the land, yellow for the cities and nothing for the oceans in the left half of the earth which is in darkness but you can see the yellow cities on the right, daytime half and the whole thing is tinged a bit blue.

I think you need to bake diffuse indirect/direct to a texture and then use that as a source for incoming light. IFAIK it would be hard to know in forehand how much light ended up hitting a particular point on a surface before everything is calculated.

Another way would to do this in compositing where you could render the globe with a white material and use the inverted image as a mask where to let the light show.


Why is my mesh flipping? (Rigid body simulation) I'm attempting to run a simple rigid body simulation with the following parameters: A plane as a "floor" set as a passive rigid body, and a mesh "scrabble tile" as an active rigid body and all defaults except for "Box" as the collision shape.

I'd like the scrabble tile to start face up, fall, and settle on the ground. The problem is that at frame 2, the mesh seems to completely flip so that the bottom side of the tile is facing up, for no apparent reason. See screenshots (can't post a 3rd, but if you rotate underneath the tile in frame 2, you'd see the text).

Any advice on fixing this would be greatly appreciated. Thanks!

Here is frame 1 (good):

Here is frame 2 (bad):

I had the same problem in blender 3.0, the cause was the object having a negative scale. It worked fine after updating the object's scale with positive values.
This link posted in one of the previous answers was useful:

https://blenderartists.org/forum/showthread.php?311350-Rigid-Body-Tools-turns-my-object-upside-down.


Is it possible to bake a single frame of a smoke simulation? I have a Photograph where I want to edit in some rendered storm clouds and therefore downloaded Blender and started to have a look into it. I'm following this tutorial to build a cloud with Cycles.

My computer isn't really fast with graphics and if I try to bake with 300 divisions and 5 high res divisions, Blender crashes.
I was able to figure out that a bake at 250 devisions and 5 high res devisions works, however it will take about a day. I only need a still render.

To reduce the baking time, I set the scene duration to a total of 15 frames, adjusted the baking frame span from 1 to 15, and I put in a temperature difference in the smoke domain settings at 0.2 because I want the smoke rise a bit to give it some texture. The still I want to render is at about frame 7.

I tried to set in the frame settings for baking 6 to 8 however then frame 7 looks like the smoke was just emitted at this frame only and not the first one.

Is it possible to bake a single frame?

You can't bake a single frame in the middle of a simulation because blender needs to know what the state of the simulation in the previous frame was in order to compute the state for the next frame.

As an alternative, you could try using the cloud generator script for BI (tutorial), or modeling your clouds manually.


Phyton code to get text remaining at the same size all the time to be readable I want to get the text with a fix dimensions although there is near or far from the camera.

At the moment I have a text facing the camera all the time with this code:

"from bge import logic

scene = logic.getCurrentScene()

text = scene.objects["Text"]

camera = scene.cameras[0]

text.worldOrientation = camera.worldOrientation"

What I need is that the text remain at the same size all the time to be readable (not too small neither too big).

thanks

Place the text in an overlay scene. This way the distance to the camera (in that scene) is constant and the object size appears to be always the same.


Cycles, UV Project Camera Modifier projects forwards and backwards I would like to project photographs as decal textures from multiple cameras onto some simple geometry to build a photo projected environment.  The UV Project modifier seems perfect for this, especially since it's a live projection (unlike UV Mapping -> Project From View) that can be changed interactively.

However, I found that the texture is projected forwards AND backwards onto the geometry (In other words: projected along both the positive and negative axis of the vector normal to the camera), even though I have "decal"ed the texture using the Mapping node with Min/Max turned on.

Is there a workaround for this?

If you are using an ortho projection, I think it's easier to use nodes than a modifier.

Using object coordinates, for a specified object (an empty here) is much like using a UV project modifier.

I showed you a backface to demonstrate what I'm doing.  In addition to the object coordinates, I'm also getting the distance to the object (by taking the square root of the dot product of the vector to that object with itself.)  In this case, as shown, I'm limiting the distance enough so that it doesn't show through the other side of the mesh.  (I could also limit drawing to only faces on the negative Z side of my object, by multiplying alpha with object.z<0 instead, in which case it would only project in one direction.  Cameras point in their -Z axis.)  Note that I can just scale the empty in its local Z axis if I want adjust the "clip" of this.

If you need something with perspective, you can still use the UV project modifier-- but just like I did with this object, you can measure the distance to your UV projector in nodes, and then limit what you draw with it to one direction or to faces within a given distance.

Here my projection is only hitting faces in front of the camera that I'm using to project.

Hopefully it's clear from this how you could establish other distances or planes to limit the drawing of the projection as well.


Why hairs not growing in the vertex area Hair going on the side but not on the top area. I have weight paint and made the vertex group yet no hairs grow on the vertex area. On the stomach and near nose. (I tried flip normal's, scale is 0) Any suggestion or help. Thanks

Render view

Solid View

Vertex view

No group assign

Your hairs are growing but they are apparently combed down inside the mesh. You can use the puff-brush in the particle edit tools to get them back out. Seems like you are growing your hair with a global down direction, I'd rather recommend growing them normally and then grooming your model with the particle edit toolset.


How do I smooth only the outside edges of a complex object? I would like to convert the edges on this object to a perfect circle and leave all other edges undisturbed.  What is the easiest way to do this?

I agree with the quad based topology would be the answer on this. Please see my suggestion: I have added the blend. file for this as well.


Can't get script to auto execute I am an experienced python programmer, but just getting into the Blender API. I am stuck on trying to get a script to execute when the Blender file is loaded. I want to do all sorts of setup in this script, but to start with, I'm just trying to change the python path to add my working directory, so that .py files can be imported from there.

So, I opened a text editor window in a fresh project, then created a new text block, into which I typed the following 2 lines:

import sys
sys.path.append('/Path/To/My/Blender/Project')

When I use the "run script" button, and check sys.path in the console, my path has indeed been added.

So then, I checked the register toggle for the text block, and set the user preferences to auto run python scripts. I saved the .blend file, exited Blender, and re-started by double clicking the .blend file.

When I check sys.path, it is the normal blender path, but if I then run the script that should have auto run, sys.path changes as it should. So it would seem that my script is not running on load.

I am on Xubuntu 14.04 (Trusty) and my Blender version is 2.78. I must be making some really simple mistake, but I can't seem to find it. Thanks for any suggestions.

I had the same problem and got my answer here: https://blender.stackexchange.com/a/84392/38217

Note that this executes on ANY Blender File you open, but maybe it will suffice.

import bpy
import sys

@bpy.app.handlers.persistent
def setup_path(*args):
    sys.path.append('/Path/To/My/Blender/Project')
bpy.app.handlers.load_post.append(setup_path)
setup_path()

  Put this code into a Python file and place it into
  ~/.config/blender/2.78/scrips/startup/setup-path.py (replace
  ~/config/blender with %APPDATA%/Blender Foundation/Blender on Windows,
  and something along those lines on MacOS).


Blender 2.8 (Shading/Textured Solid) Hello,

Dropping into 2.8 as noted in another thread and trying to get to grips with the new interface. There is one thing I am having hard finding, or finding the equivalent of and that is the "Textured Solid" option.

I would really appreciate the help :)

Unfortunately Blender Render has been completely removed in Blender 2.8, so this functionality is no longer available.

Could't agree more about having to use materials slowing down my workflow when I'm going to be exporting to something that completely ignores the materials anyway.

However there are at least ways of speeding the process up, and you can still get the same visual feel as Textured Solid.

The button to the right of the colour option lets you quickly pick a new input node type while avoiding the node editor. So you can quickly switch to an image like this:

Then just select the image with the dropdown that appears.

You can get a similar visual feel as "Textured Solid" in the viewport by setting your shading up like this:

(I have both of these set up this way in my startup file. Then when I need to add a new texture, I just duplicate the material and change the texture.)


What Value is Filmic Using to calculate Maximum Scene sRGB Intensities? What Value is the Filmic color-space Using to calculate Maximum Scene sRGB Intensities?

Another set of questions follow:

How is this value retrieved from Blender's 3D scene?
Is this a global calculation, or is it based on camera rays received?

If your question is which scene referred value would become the display referred (1.0, 1.0, 1.0) triplet after the Filmic View Transform has done its job,  the answer (currently) is:

(2 to the power of 6.5) * 0.18

which in numbers is

16.291740238....

The 0.18 is the scene referred value that Filmic deliberately has chosen as the 'middle grey' reference value. The 2 to the power of 6.5 part basically comes from the maximum value being defined as 6.5 stops over middle grey. A table of sample values is provided in the readme of Troy Sobotka's filmic-blender GitHub repository.

The value is taken from the resulting pixel values after the rendering stage. In photographic terms, that would be the amount of energy that lands on the film stock or digital sensor. So in essence, camera rays received.

Be aware that these values are deliberate choices by Troy Sobotka, and are bound to change with future iterations of Filmic. Also it's worth noting that any scene referred value above the given 16.291740238 will also give display referred (1.0, 1.0, 1.0) in sRGB color space.

User remco together with Troy himself pointed out to me:

  That 0.18 (or 18%) is the gray value that is (or was) considered to
  correspond to the gray that the human eye sees as halfway between
  black and white, and used on e.g. exposition targets (Kodak grey
  card). Thus, it's not a completely arbitrary choice.

It is important for me to point out that with deliberate i was never attempting to say arbitrary. Designing a View Transform like filmic-blender is both a matter of color science and craftsmanship. Thus there is some level of freedom for the one designing it to define the boundaries. The high clip value which the initial question was asking for is such a choice. It could technically be at a different energy level, but in a rendering context the choice made has proven to serve a high number of use cases well. The scene referred 0.18 middle grey value however is a convention which I missed in the initial answer, so thanks for the comments.


Artifacts while sculpting I am trying to sculpt a human head with dynamic topology. It worked so far but now I am getting artifacts when I use the smooth brush.

And when I use the smooth brush

But other brushes like the clay brush are still working without causing those weird artifacts.

Any idea why this is happening?

.blend file

Make sure that under Symmetry \ Lock you turn Lock off. You had lock set to x axis. So the smooth brush was still working but the vertices did not move in the x axis.


How do i play a video through an object on blender 2.8? does doing this work the same way as of in the stable version of blender 2.79? And another thing is that the video i am wanting to add to a plain is 2 minutes and 44 seconds long is there a duration limit on putting a video on an object?

How do i play a video through an object on blender 2.8? does doing this work the same way as of in the stable version of
  blender 2.79?

Yes. Import >Images as Planes.

You can also drag and drop as an active empty to bench it.

  And another thing is that the video i am wanting to add to a plain is
  2 minutes and 44 seconds long is there a duration limit on putting a
  video on an object?

To my knowledge, no. However, it seems to play slower with large files. my best experience has been when using Eevee. 3 minutes should play fine.

Blender's 2.8 latest build supports this feature.
https://builder.blender.org/download/

Plays butter smooth on my PC.

Import images as planes is an add-on

To enable it, go to Edit -> Preferences -> Add-ons.


Problem with bpy.ops.sculpt.mask_expand I want create simple button.
class Interactive_mask(bpy.types.Operator):
    def execute(self, context):
        bpy.ops.object.mode_set(mode='SCULPT')
        bpy.ops.sculpt.sculptmode_toggle()
        bpy.ops.sculpt.mask_expand(invert=True, smooth_iterations=2, use_normals=False, keep_previous_mask=False,)

        return {'FINISHED'}

And I have problem with bpy.ops.sculpt.mask_expand When I press my button i have such a error
RuntimeError: Operator bpy.ops.sculpt.mask_expand()failed, context is incorrect
What I should change or add to code ?

Not in sculpt mode.
Result in python console of changing absolute mode of object to 'SCULPT' followed by toggling mode
>>> bpy.ops.object.mode_set(mode='SCULPT')
{'FINISHED'}

>>> bpy.ops.sculpt.sculptmode_toggle()
{'FINISHED'}

>>> C.mode
'OBJECT'

hence out of context, since bpy.ops.sculpt.* operators require sculpt mode for context.
Remove toggle to remain in sculpt mode or  move to  the last line to toggle.
Tip
Making a poll method for your operator returning false for selected objects that cannot be sculpted will disable button in UI and remove it from context operator search.


Blender Not responding : What to do? I need to unwrap a huge mesh and Blender stops responding each time I try.
Blender continues to use my cpu at 15%. Does that mean I have to wait and the operation will eventually be successful?
In this case, is it possible to force Blender to use 90% of my cpu to go faster?
Thanks for your help, I loose a lots of time of this.

Here's an answer with a short little gif to show what I meant in my comment.
You can unwrap parts of the mesh at a time and they will stay in place.
Hope this helps!


moving camera with HDRI environment texture image I have a character walking in an environment texture image (HDRI) and a camera pointing at him, if camera is just in the same position, ok!, but if camera is rotating or following a path, there is no relation between the walking charater and the background environment and in some circunstances it seems the character is walking backward (damn!). How can solve this easily? help.

The issue is that the background HDRi is infinitely far away. Moving the camera parallel to a moving object will not create the illusion of movement, since the background will always be the same: there is no shift in perspective or elements that transform somehow.

A camera move like this

Will result in:

The HDRi is generated at a single point in space and is valid for only that point. So the only possible motion that would be realistic is rotation with no camera displacement. Any displacement would require different visual information for every position in the 3d world (like in Google Street view, where you have the 360 view for one point, translating the view will generate a completely new view)

In real life the motion in the background would be according to the distance from the camera to the object, objects that are close would appear to move at a faster speed than those very far away.

Possible solutions would be to use different layers of background planes that would move at different rates. In the far background the HDRi could even remain stationary without braking the illusion of movement.

As an alternative the moving element could move in a circular path around the camera and the camera just rotate following the moving object, the background would seem to move (when in reality the view is changing). This would create the illusion like it does in cartoons where the characters move in an ever looping background.

Alternatively the moving object could stay stationary and by animating the coordinates for the background, the background could rotate creating the illusion of movement.

In the World section of the Material nodes add a Texture Coordinate node and a Mapping node to control the placement of the Environment texture. By changing the rotation on the mapping node you can place the HDR where you need it.


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:


New Bevel API - custom curve I am trying for the first time to have a look at some python API.

So my goal would be to create a bevel modifier with the custom curve that I create:

  point_init(&profile->path[0], 1.0f, 0.0f, 0, HD_VECT, HD_VECT);
  point_init(&profile->path[1], 1.0f, 0.25f, 0, HD_VECT, HD_VECT);
  point_init(&profile->path[2], 0.75f, 0.25f, 0, HD_VECT, HD_VECT);
  point_init(&profile->path[10], 0.0f, 1.0f, 0, HD_VECT, HD_VECT);

So I can use use_custom_profile

The API doc:
https://docs.blender.org/api/current/bpy.types.BevelModifier.html?highlight=b

I don't understand is this:

  custom_profile
  The path for the custom profile

  Type: CurveProfile, (readonly)

Does this mean that it's not possible to give CurveProfile the points I want?

Thanks :)

Add the modifier adjust settings

When using a custom profile, 2 points are created at (1, 0) and (0, 0).  Add points between these.

When finished adding points update the profile.

import bpy

pts = (
    (0.4, 0.7),
    (0.6, 0.3)
    )
context = bpy.context
ob = context.object
bm = ob.modifiers.new(
        name="Bevo",
        type='BEVEL',
        )
bm.use_custom_profile = True

bm.segments = 4
bm.width = 0.4

points = bm.custom_profile.points

for p in pts:
    pt = points.add(*p)
    pt.handle_type_1 = 'AUTO'
    pt.handle_type_2 = 'AUTO'
    pt.select = True

bm.custom_profile.update()

To work out new features, recommend using the python console and auto complete.  The API is pretty consistent. This is akin to adding fcurve keyframe points, or bezier curve points.

>>> bm = C.object.modifiers.new(name="Foo", type='BEVEL')
>>> bm.custom_profile.points.
                             add(
                             as_bytes(
                             bl_rna

Yes also found the ordering tricky, without testing it appears the first and last points could be indices 0, 1


Adding 3D object to Video Clip I have been a long time dabbler with Blender (back in the NaN days) but I've never really become proficient at it. Thus I am finding it difficult to do everything I need for this one project using tutorials. I am trying to:

Motion track a single point on a video - Done
Add a particle stream at an offset point to the motion tracked point - Done
Match the duration to a mouth movement. - Done
Render that all back out. - Fail

This fails because of my lack of knowledge. What I have tried:

render out with a background image of the video clip - fail, only get the particles with a black background.
Setup nodes with the movie and the render as inputs - fail, either only get the video, or the particles with a black background.

I have tried various iterations of this but I have never been able to get the video to render out.

Blend File

Any assistance would be appreciated.

Your problem is in the Compositor - you don't have your render layer hooked up to a Composite output node, in fact I didn't find any nodes when I switched on 'Use Nodes' so I rigged up a simple set up. Your scene didn't have enough light so I turned on AO, and I set your Shading tab to use alpha instead of render sky. I hooked the render layer alpha to the mix factor of the color mix node, and plugged the image node into the other color as a background(this is wher eyour video footage goes). The file should help a little to fix the original file hopefully. redone file


how to make current obj solid and other obj as wireframe? when in edit mode, i want the current obj as solid shaded while all other object displayed as wireframe . How can i do this ?
Also how if i want other obj to be hidden , so everytime i go to edit mode, only showing my current obj. Is there any setting to automate this rather than manually hide/unhide obj.

If the viewport is in wireframe shading, going into edit mode will show transparent faces on the edited object, while the others only show wireframe. To have the active object fully solid while the others are wireframe, you need to set the max draw of all other objects to wire. You can select all objects and use copy to selected to set them all the same.

You can press numpad-/ to go into local view, this shows only the selected object/s, you can then go into edit mode without the others being visible.


Python: Up-Vector math for Curve I've been working on python Curve Deformation tool. I need some help with the math. Possibly someone can help here. I cannot find correct UpVec for my custom curve.

Here are the screens which explain the problem:

Here is my tool in action:
https://youtu.be/Nxu6-0xm3Io

Here is the code I did but it's buggy in some angles. It inverts to 180 degrees on some angles:
https://github.com/mifth/mifthtools/blob/96e73eb3a2613b3f1396ddd7c4bdd9d0419ca5e3/blender/addons/mira_tools/mi_curve_guide.py#L515-L537

All I do is just cross direction of the point to global X and Y axis. Any help will be appreciated to get the quality of upVec as in Blender Curves.

And you can get the tool here:
https://github.com/mifth/mifthtools
http://blenderartists.org/forum/showthread.php?366107-MiraTools

Thanks.

There are 3 ways for upVec to be found:

2 and 3 versions were suggested by mano-wii from here http://blenderartists.org/forum/showthread.php?361154-Coordinates-of-resolution-points-of-a-Bezier-Curve

1) Cross vec. https://github.com/mifth/mifthtools/blob/6b0469faea18d3375c3f3257963d7c85f327c44c/blender/addons/mira_tools/mi_curve_guide.py#L486-L488

2) Project vec.
http://blenderartists.org/forum/showthread.php?361154-Coordinates-of-resolution-points-of-a-Bezier-Curve&p=2866256&viewfull=1#post2866256
https://github.com/mifth/mifthtools/blob/6b0469faea18d3375c3f3257963d7c85f327c44c/blender/addons/mira_tools/mi_curve_guide.py#L490-L492

3) Dot vec.
http://blenderartists.org/forum/showthread.php?361154-Coordinates-of-resolution-points-of-a-Bezier-Curve&p=2866427&viewfull=1#post2866427
https://github.com/mifth/mifthtools/blob/6b0469faea18d3375c3f3257963d7c85f327c44c/blender/addons/mira_tools/mi_curve_guide.py#L494-L497

I choosed Cross vec for my approach for the upVec searching.
You can comment/uncomment any of approaches and try testing.

Also,I found another issue:
One direction can has different upVecs.
http://i.imgur.com/itANWG6.png

To fix this issue I have to pick first point upVec and then check all points after. If a current upVecAngle is more than 90 degrees - we need to invert upVec.
Here is the code to fix this issue:
https://github.com/mifth/mifthtools/blob/6b0469faea18d3375c3f3257963d7c85f327c44c/blender/addons/mira_tools/mi_curve_guide.py#L504-L509

And you can see the result of my custom curve in editmode here:
https://www.youtube.com/watch?v=VXWSUwOul-s


How to prevent a cloth from entering another mesh? I am trying to create a cloth simulation on a human body. I created a shirt and I am trying to see the pattern of folds and how it drapes on a human. I applied cloth modifier to the shirt and collision modifier to the human. The simulation seems just fine, but here is the problem. The shirt starts entering into the human body and develops some weird folds and sharp features. How can I avoid such intersection of cloth and the body? I don't want to do a shrink wrap - I want to simulate a realistic shirt on a human.

Blender cloth sim are perfect for dropping tablecloths onto tables, they rarely work well for shirts (although they will work for skirts).

That said, if you have it working, more or less, here are some tips for better shirt sims:

Under collision, enable Self Collision, this will try and help with the cloth hitting itself.
Lower all the distance settings way down, including collision.
Your shirt mesh density and topology will have a huge impact. In general, an all quad mesh with nice flowing loops works best. There is a sweet spot in terms of mesh density, ballpark for a shirt the arm loops should have 8-12 vertices. Any more and the sim may tend to crumble.
Sometimes you want subsurf above the sim and sometimes below it, for low poly shirts you want it above.  And make sure the viewport/render levels are the same.

For convincing shirt stretches, you usually apply the simple sim, and use multi-res sculpting for the folds.


Add sound to animation preview I want to make an animation in time to a song so when I hit play on the timeline I need to be able to hear the song so I can finely tune the animations to start and end at the right time.

Is it possible to have sound play on an animation while it is playing in the 3d viewport before it has been rendered.

To get 3D Sound you could add a Speaker to the scene

and choose the sound file in the Properties window

You can adjust the playback time in the NLA editor:

Or as another variant you could just use the Video Sequence Editor and add a sound file there. This will be plain playback with no positional audio.

The synchronization of audio and video/viewport playback can be set in the timeline. AV-sync will drop frames in the viewport if the scene is too heavy, so the timing will still be correct.


Connect Float output to Float input causes an error I am playing around with animation nodes, so I have a bunch of instances along a spline. As you see in the working node tree, instances 31.00 and a Math node socket B also set as 31.00.

So now you think, OK I'll drive the math value by the number of instances, which would be the same float number. Wrong! If you do this everything goes RED and the whole world is destroyed!!!

Why can I not connect these two nodes?

As pointed out by Jacques, in the problems panel we can see what has caused this issue. I highlighted this in red.

What I needed to do was to use another socket on the subprogram and loop input nodes, I have also highlighted these in red on the node tree.

Finally here is what the node tree produces, nothing spectacular but at least I'm learning how to use the amazing Animation Nodes addon.


How can child reach parent object position and stick on it? I'm going to make an animation of the stone golem creation. Each stone on the ground flies up and reaches parent's position. I mean one stone should be placed on foot, another on arm etc etc. I want to every stone smoothly reach specific place on the armature while golem wakes up.

How can I make this kind of effect?

You can do this using Child of constraint. It works like parenting, but it has influence value. If influence sets to 0 object is free, if 1 - object follows to target.

You can make smooth transition between parenting and free position by animating this value:


How to flip the mirror modifier? So I may edit the mirrored side So using the mirror modifier, I understand I manipulate the components of my object in edit mode. This gets reflected to the mirrored object.

What I want to know is if there is an option to use the mirrored side to edit if I need to, say in another view for example I may only have a background ref image that suits that side.

You can have the mirror modifier allow editing of both sides in edit mode by clicking the triangle icon in the modifier:

However, moving the mirrored side may be confusing, as it will always behave as if you are editing the corresponding selection on the non-mirrored side.
Flipping the model manually
There a few was to do this, but the fastest way I know of is pressing CtrlMX (or Y or Z, depending on your mirror axis) in object mode, making sure the pivot point is at the same spot as the mirror point.


How to fill a mesh inner geometry to make a completely solid model My mesh object is based on a CT bone scan so there are many inner geometries due to natural spaces in human bones. But I need a model that has no inner geometries. How do I fill inner holes and spaces with completely solid mesh?

Thanks

Update: I attached a screenshot of the "holes" in my mesh after boolean op.

booleaned:

original:

If your geometry has true interior faces

see an older version of the answer:

If there is no disjoint interior geometry.

a manual way..

First in edit mode unselect all geometry.
use box select (b) to select the visible outer faces, and rotate the model around and add to the selected set by doing more box selects until all outer faces are selected. You can also use the other selection methods, C enters a mode that lets you "paint" selections by leftclicking and dragging the mouse around (esc to exit that mode).
Then hit Z to see the model as see-through, you'll notice many unselected verts, those would be considered interior for your purposes.
Ctrl+I to invert selection.

X , delete vertices.

Holes

The problem then would be that the model now has holes that need to be filled.

A strategy to continue this in Blender is to select all edges that only attach to 1 face. You do this by selecting one such edge, and then doing

Select -> Select Similar -> Amount of Faces around an Edge.

I don't think you'll get away with hitting F (to Fill) and Ctrl + T to triangulate the result. (as shown below)

There are applications like MeshMixer that can do these tasks automatically, but I say this not as an endorsement - rather as an avenue to explore if you need to do this type of processing a lot. When you relinquish control to a program there's always a trade-off.


Vertex color value has weird offset in value when assigned from script What might explain this difference in values?

mesh.vertex_colors.active.data[loop_index].color[3] = colorItem.alpha
print(str(colorItem.alpha) + " / " + str(mesh.vertex_colors.active.data[loop_index].color[3]))

outputs
0.03125 / 0.0313725508749485

Looking at the blender sources, the colors seem to get rounded.

static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values)
{
  MLoopCol *mlcol = (MLoopCol *)ptr->data;

  mlcol->r = round_fl_to_uchar_clamp(values[0] * 255.0f);
  mlcol->g = round_fl_to_uchar_clamp(values[1] * 255.0f);
  mlcol->b = round_fl_to_uchar_clamp(values[2] * 255.0f);
  mlcol->a = round_fl_to_uchar_clamp(values[3] * 255.0f);
}


2.79b to run script using command line in windows, preferably with a desktop shortcut or exe Here's the code i have written so far, it's working inside blender text editor.
I however like to run this script without opening blender, with command-line, better yet to create a shortcut icon on a PC to run it, hoping to make this friendly and available for people who do not know blender well.

import bpy
import os

# get the current path and make a new folder for the exported meshes
path = bpy.path.abspath('//stl/')

if not os.path.exists(path):
    os.makedirs(path)

# deselect all meshes
bpy.ops.object.select_all(action='DESELECT')

# select the object
#object.select = True
object = bpy.data.objects['pboard']
object.hide_select = False
object.select = True
bpy.context.scene.objects.active = object

# export object with its name as file name
fPath = str((path + object.name + '.stl'))

#bpy.context.active_object = object
bpy.ops.export_mesh.stl(filepath=fPath, use_selection=True)

object.hide_select = True

Find the blender.exe and Right Click and select Create Shortcut

Due to permissions I cannot create a shortcut in the Blender folder so it offers to create it on the Desktop.

Find the shortcut and Right Click and select Properties

In the Target box append

 -b c:\tmp\target.blend --python c:\tmp\exportscript.py

to the fully quoted blender.exe
e.g.

"C:\Program Files\Blender Foundation\Blender\blender.exe" -b c:\tmp\target.blend --python c:\tmp\exportscript.py

Where target.blend is the blender file with the "pboard" object to export and exportscript.py is the original posters code with the "path" value set to match your environment.

I created a c:\tmp folder that has full permissions for the blender user and set the path

path = "C:\\tmp\\stl\\"

Now when I double click the shortcut, a command window flashes open briefly before closing. The file C:\tmp\stl\pboard.stl" is then available.


File format for importing from Autodesk and Tinker CAD? How can I import 3D models created in Autodesk and Tinker cad into Blender 2.69?  What file format should they be saved in?

Welcome to Blender SE!

Which Autodesk product are you using?

This documentation talks about what file types Blender can import. Depending on what Autodesk product you're using, Blender might be able to just open the file that it uses. OBJ is usually the most widely supported, but materials can be difficult and it doesn't support any proprietary features: OBJ will only export the mesh and sometimes materials (no shapes, no rigs, no animations, etc).

I can't tell for sure, but I'd be willing to wager than Tinker supports exporting OBJ files.

If all you want is the model, OBJ is your best bet. In which case:

Export your original file as an OBJ
Open Blender and File -> Import... your OBJ into a new scene, or a scene you've already started.


Call operator with tweak popup window I'm making a panel with buttons to do different actions for modeling. One one of my button I want to merge vertex by distance when I click on it, but merge to center when I CTRL + Click.

I got this working just fine except that I would like my regular click to show the context panel that shows up when you call with from Vertex -> Merge Vertices -> By Distance where you can adjust the threshold and what not.

I mean this window:

I noticed that when I call the function with

row.operator("mesh.remove_doubles")

the context panel does show up, but when I call it inside invoke to get the event.CTRL it does not show up.

def invoke(self, context, event):
    if event.ctrl:
        bpy.ops.mesh.merge(type='CENTER')
    else:
        bpy.ops.mesh.remove_doubles()

    return {'FINISHED'}

Any way to run the same method in the invoke ?
Thanks!

Ok so that's what ended up having that works the way I wanted

import bpy

class Weld(bpy.types.Operator):
    bl_idname = "edit.weld"
    bl_label = "Weld"
    bl_description = "Weld vertices by distance\nHold CTRL to weld at center"
    bl_options = {'REGISTER', 'UNDO'}

    merge_dist: bpy.props.FloatProperty(
        name="Merge Distance",
        description="Merge Distance",
        min=0.0,
        step=0.1,
        default=0.02
    )

    @classmethod
    def poll(cls, context):

        if context.active_object.mode != 'EDIT':
            return False
        if len(context.selected_objects) < 1:
            return False

        return True

    def invoke(self, context, event):
        if event.ctrl:
            bpy.ops.mesh.merge(type='CENTER')
            return{'PASS_THROUGH'}
        else:
            return{'FINISHED'}

    def execute(self, context):
        bpy.ops.mesh.remove_doubles(threshold=self.merge_dist)
        return {'FINISHED'}


Reverse explosion with voxels What I have: an array of vertices obtained through a simple Sverchok node that states the position of each voxel(many thousands of them).

What I would like to do is to create a reverse explosion effect, where the voxels(in the shape of cubes), that at the beginning are scattered in space, start to head towards the center one after another, until they have formed the bunny.

What I've managed to do so far is this, using particles systems, but it's not exactly that effect that I would like, since here the particles are moving all at the same time, whereas what I want is them to move one after another (more or less).

I'm new to animation, could this be done in a not too complicated way?

From this answer, I've changed or set the following:

1- Keyed object
2- Particle
3- Surrounding sphere (viewed as bounds)
4- Bunny (viewed as bounds)

On the right the setting for keyed object (the 2nd PS has 10 for the time parameter).

Above the setting for the surrounding sphere (250 for the 'end' parameter).

And below the setting for the bunny:


How can I make an infinite loop in Python in Blender？ I ran a simple program like this:

while True:
    print("test")

If I do so, nothing will be output with the screen frozen.

With other software, this is not the case, and it is printed properly.

Is Blender not able to do this?

Is there any workaround?

The reason I want to do this is because I want to communicate with an external application using Blender.

For example, “while true:” appears in the program as introduced in the following video.
https://www.youtube.com/watch?v=4xZRfzOtxzA

However, there is no error in the sample program in the video.

I also tried running the following program.

i = 0
while True:
    print("test")
    i+=1
    if i == 1000000:
        break

Then, the screen does not freeze, but "test" is not printed every time a while loop.

But "test" is printed all at once after all while loops have finished.

This does not happen when you run Python from Autodesk Maya or the Windows command prompt.

Normally, "test" is printed for each while loop.

Why is Blender such a specification?

I want to know under what conditions I can turn the while loop without freezing.

Blender scripts are not subprocesses: if you trigger an infinite loop in a script/addon, Blender will freeze as well until the script finishes what it is doing.

The reason why you can't see an outout is that Blender's print() funtion displays the text in the console window, that you can open in Window -> Toggle System Console

If you execute your script then you'll see that your text keeps being written and the script is working

If your code is very long you could make it a subprocess or execute externally (but you rarely need to do it), while if you just need to execute it once in a while you can use modal operators

with modal operators, for instance, you can  execute your script every 0.1 seconds and make it print your text, so in that 0.1 second Blender has time to update the UI


How are vertex normals being calculated regarding object origin? There is simple uneven surface:

Its origin point is located where 3D cursor is. Once selected edge loop is extruded its vertex normals are expected to be as a continuation of connecting edge, like:

However they are shifted            and are oriented down:

If changing origin point they change their orientation. They get approximately desired orientation if origin point is snapped to 2 vertices of the edge loop not selected on the first screenshot.

Are vertex normals oriented regarding the origin point location ?
How to orient vertex normals of the mesh to be oriented as a continuation of adjacent edges ? (this could be useful for some cases like scaling along normals etc.)

To workaround this extrude faces of that surface to form a volume; faces will be extruded along their normals which have roughly the same orientation as vertex normals in this case (except for the corners where vector differs because of one additional orientation):

Then vectors are suitable for such tasks like scaling along normals as they roughly got desired orientation.
This is more a workaround as extrusion might not be convenient, but it's always possible to hide faces around mentioned and work only with those needed.


Randomly switch camera and start animation with Python What I have set up:

I have camera_0, camera_1, camera_2, camera_3, and camera_4.
In front of each camera stands a character. (character_0, character_1 and so on)
Each one of the characters has an animation.

What my script should do:

After completing character_0's animation with camera_0, switch randomly to one of the other cameras (1–4).
Start characters_X's animation with camera_X.
After that character's animation ends, again switch randomly to another camera.
Continue in a loop.

The animation should be played in the game engine.

Is that even possible in Blender using Python?

Something to get started:

import random
import bge

cont = bge.logic.getCurrentController()
own = cont.owner

if not own.isPlayingAction():
    # create radom number between 0..3
    x = int(random.uniform(0,4))
    print(x)

    scene = bge.logic.getCurrentScene()
    # set active camera
    cam_name = 'Camera.00'+str(x)
    camera = scene.objects[cam_name]
    scene.active_camera = camera

    # play action
    own.playAction('CubeAction', 0, 20, play_mode=bge.logic.KX_ACTION_MODE_PLAY)

The script above can be used from a Python controller

Note that this plays the Action for the attached object, if the camera views don't overlap this could already work for you.


animate Scaling part of an object driven by another object So the idea is, i want to animate "Scale" an object driven by another object
visual representation:

 2.

its kinda hard to describe, but i want an object/empty to drive an object's scale / displacement / deform
What I have tried:

I tried using the dynamic paint to drive the weight map, and use that data to deform / displace
Using shape keys

if anyone have better way to do it, i'll love to hear them
thanks !

Consider using a cast modifier.
Make sure you original mesh has many vertices.
Use the object field to determine the origin.
The object field can be an empty to control the origin.
When you move the empty the displacement will move also.
If your axis is World Z axis aligned you may choose to keep z unchanged in the modifier.
More to follow.
Consider also using a shrink wrap if you want more control over the modified shape.  Not yet shown.
Create slanted end at a pipe / cylinder by Rotation
I do not know your artistic vision for the deformation.  Here is a less smooth modification.


Blender 2.8 - No xyz arrows on vertices in edit mode? I stopped using blender for 2 years. Back then with 2.7 everything was cool. But now they changed so much, that I don't understand anything. Everything feels so weird, what did they done to that masterpiece?! In Blender 2.7 there were arrows on the vertices in edit mode:

Where are the arrows now? They were very useful

The gizmos can be brought back from the gizmo menu:

Tools also have gizmos by default:


Faster rendered viewport shading I'm trying to preview how a specular material looks on an object when it moves, so I tried rendered viewport shading mode, but this mode is extremely slow even with a very simple object.  So slow that if I play a simple rotation animation nothing draws to the screen.  I'm running an i7 with a GeForce 730m, I feel like I should be getting better performance than this.  Am I missing something here or is it really not possible to preview an animation with materials without rendering a video?

Rendered shading is the same as a final render (mostly), so unless you have a very simple scene and a small render farm, you probably aren't going to get even near real-time (as in > 1-2fps) renders.

Some things you can do to help:

Render a small low resolution part of the viewport (e.g. with render border) See Render Border's related check boxes - How do they work?
Reduce the number of samples (Render settings > Sampling) and bounces (Render settings > Light paths)
If you still want to use the viewport (though I would recommend rendering a quick image sequence), turn down the framerate so each frame has some time to converge.


Where did the 'adaptive' check go in the subsurface modifier from 2.80, in 2.81? Where did the 'adaptive' check go in the subsurface modifier from 2.80, in 2.81?

The adaptive subdivision feature is only available when you use the Cycles render engine and set the Feature Set to Experimental in the Render Properties.

Once the experimental feature set is enabled you will see the additional panel for the subdivision settings in the render properties and the subdivision surface modifier will have the options as shown in your screenshot.


My object moves with no keyframes My sphere moves on its own. Whenever I place a cube next to it, it shoots off into the distance. When the cube isn't there, it just falls to the ground. I don't have any keyframes to my knowledge. What am I missing here?
I've just started learning blender so I imagine its something obvious. Ill attach my file.

You have Rigid Body Physics added to your objects.
If you do not want rigid body properties in your scene, you may remove the Rigid Body World from the scene properties.


Can't see the object in rendered image after motion tracking I was watching camera tracking tutorials in youtube (Blender 2.8 Camera tracking tutorial (part 1)) and did exactly as shown in the video, but after motion tracking in the composite tab I can't see the suzanne object in the rendered view , after pressing the f12 I can only see the suzanne object but not the background, even though I can see everything in the "set up tracking scene in 3d view".

The problem is that the render layer has no alpha channel.
Enable Film> Transparent.


Plane to only reflect object? So I'm using cycles and I would like the plane that my object is sitting on to be invisible apart from the reflection from the object. So all you see is empty space, the object and its reflection and no plane. Thanks in advance

to make the plane invisible apart from reflection ,uncheck all the options in Ray Visibility except Glossy

this will make the object appear only as a reflection on objects with glossy shader

render :


What could I improve on on my monkey model? So I made this monkey model and I am no expert on modeling so I was wondering if you guys could take a look and give me feedback! If you want to look at the file download it at:https://drive.google.com/file/d/0ByrMQl4A3FTwcUVSalF2WXZ5Slk/view?usp=sharing  Thanks!]1

JUST SOME TIPS: The body part topology of your model is decent, though hands and legs' topology is too dense. Try to keep it as simple as it can be (start to model fingers using a circle with only 8 vertices).

Do the same for the toes (see my topology suggestion below).

Always start with a simpliest shapes and then slowly add more geometry.
Your question reminds me this one: How to retopologize my model? Wish I have more time right now to retopologize this model for you and show you some simple solutions, but I'm quite busy right now :(.

Remember, that simple and smart topology is a key to make the model bend well while animating (simple finger model topology bend example here: How do rigs relate to weights?)


Jump/Scroll to selected object in the outliner? How can I jump to the selected object in the out-liner, I've got over 200 objects in my scene, all named cube.___ ... and I can't seem to find my selected object. How can I jump to it?

You can use Numpad . while hovering over the outliner, just like in the 3D view.


Fireflies plague my render! I'm trying to render out an animation, but I keep running into a lot of fireflies. I would like to try to avoid the denoise addon since Im rendering an animation, but at the very least I would like to get my samples down (I'm using 500). My scene is relatively simple, its two low poly hallways with lights and doorways, and the emission on the lights is cranked up the 60 (I use filmic blender color management so it doesn't blow out the image). The only thing in my scene that I think could cause all of these fireflies is the lights, but Im not sure why as Ive used bright lights with filmic blender before and it worked just fine. Also most materials in the scene are over .5 roughness, and I got rid of the metallic materials in my scene and the fireflies were still there. Any help would be appreciated, thanks!

Blend File:

I think the fireflies are mostly due to your lights being ONLY at 60, this is a very small number for filmic, it produces a small amout of light rays hence you get the fireflies.
What I did was crank up the lights to about 3000 to get plenty of light in there, that got rid of majority of the fireflies, I also added a weak sun lamp to add some extra ambient light.
Than I went to the compositor and used curves to bring the render closer to the draker moody lighting (I assumed that's what you ware going for)
Either way the settings can be tweaked in the compositor as you please, the scene is not over exposed by any means so you can take the curves node off if you prefer it brighter. I'll attach the modified blend file:

Keep in mind that firefly free does not mean noise free, if you don't want to use the denoiser be perpared to render each frame at like 4000 samples or higher (even than I don't know if you'll get rid of all the noise)
Here is a render at 512 samples:

Before compositing

After compositing

As you can see there is no firelflies but still plenty of noise.

Using the denoiser for animation is not as bad as people make it out to be, it mostly gets lost in compression. I've rendered out a section of your animation at 128 samples and half the resoulution with the denoiser on: https://youtu.be/Rs4SdF9vNUU

There was some flicker but it mostly looked like film grain and in this youtube clip most of it got lost in compression anyway. If you up the samples to 256 or 512 it will definitly look fine, maybe not perfect but it's better than rendering for a month.

In the end it's your animation so you can do whatever you want with it, either way the fireflies are fixed.


Why do I have these weird reflections? For some reason some objects in my scene have these weird reflections, but others don't. All objects in my scene have the same material, but some behave differently. If i make the specular value 0 the reflection goes away, but then it looks different than the other materials, and I want them to all behave the same.  Please help!
Attached is a link to a video of me showing you the problem. You can see the weird effect on the door, and on the wall.
https://drive.google.com/drive/folders/1inH5VpxNH4FzB5Dj2GUt-8H5olSETlda?usp=sharing
FYI (to the moderators) I tried using blender exchange but the upload never worked.

Just posting this so I can post the pic. I suspect the problem is that you have your light radius set too large. It's hard to tell from the video, but it looks like you have a point light above your "room". As you can see from the image below, a large light bleeds through the walls and reflects off the roof similarly to how it does in your video. If you have a point light with a radius that is large, consider reducing the size. If you don't want it coming through the walls, also consider enabling contact shadows, but bear in mind, this may require your walls to have some thickness to work properly. See below:


Why is TAB Key not working to cycle into Edit Mode? Using Blender 2.79a, Usually I cannot get into edit mode using the Tab key the first time I go to use it with any object, but after I click the "Edit Object Button" I can usually cycle back and forth from Object Mode to Edit Mode using the Tab key.

Notes:

When hitting the Tab key. Nothing happens.
This is the same with all blend files.
I have set up custom key shortcuts, but to my knowledge have not change anything to do with Edit or Object mode.

Why does this only happen sometimes? I have ruled out having anything under my tab key that would cause this issue.

Has anyone else run into this problem? Or do you have any suggestions?

Thank you in advance!

Solved

It's not enough to just restore your key config, you have to reset it, much like cegaton said.

Go to the Input panel. Hover the "Add or Remove Key-config Preset" dropdown box, and click on "Blender". Then Save User Settings

Thank you everyone.


can't download blender 2.8 zip file I can't download blender 2.8 zip file.I tried to download on blender website,but they show us blender msi file not zip file

https://www.blender.org/download/

You have to click on the thing to get download options.


Cycles Shader to assigns a color based on how many light sources hit the surface I would like to create a Cycles Material that assigns a color to the points of an object's surface based on how many light sources hit that point.

If, for example, there are 10 light lamps into the scene (and no ambient occlusion nor emissions from anywhere), each will contribute with a (0.1, 0.1, 0.1)RGB to the final color of the object surface if any of its rays hit it.

Do you think it is possible? Any suggestions about how to achieve this?

Thanks!

EDIT: (To be a little more specific). For an academic paper I'm writing, which will be a bit long to describe, I need to know how many lights are contributing to the color of a specific point of a surface. My idea was to paint this point with a tint obtained by adding the colors of those lights that hit it. In this way I don't know which lights are hitting a surface point (which could have been even better) but at least I know how many of them contribute to its final color.

This is possible using the Toon shader which can be set to produce completely 'flat' shading that is only dependent on the incident lamps. By also setting the lamps to 'Constant' shading the effect of each lamp can effectively be clamped to a constant contribution for each visible lamp.

Start by setting your lamps to 'Constant' illumination :

Adjust the Light Falloff node to adjust the Strength of the lamp. This will result in each lamp contributing the same illumination to a surface regardless of distance.

For the mesh material, use the Toon shader with the Size and Smooth values set to 1.0 to give completely 'flat' shading. Also, set the Render properties Light Paths for 'Bounces' to zero as we don't want to take account of any bounced rays :

This can produce the following result :

Blend file included

Note that you may also want to reduce the lamp size from the default size so as to ensure sharp shadow edges.


How can I convert the data from an image node into data for a mix node I want to use a grayscale image to smoothly blend two shaders together onto one mesh using a mix shader and an image node. How can I convert the data from the image node into data for the mix shader?

Plug the output of the image node into the Mix Factor of the mix node:


How can I create a diffuse map that looks and reacts like a Vertex Weight map? Goal: Create a animation of the gradient pressure map on the top of a seat as the user sits down.

What I've tried: Dynamic painting works well, but I can't figure out how to get the gradient colors along the borders of the paint similar to the surface type:"weight" setting in dynamic painting.

It would be perfect if I could figure out how to create a series of images that look like the vertex weight paint mode with surface type:"weight" setting in dynamic painting to use as a diffuse shader.

You have two options:
Image sequence

With the canvas object selected, set the format to image, then set the UV map and output path/format:

Bake the image sequence, then load it into your material with an image node:

Result:

Vertex paint:
You can also bake to vertex colors and use a node setup like this, using an attribute node to get the vertex color:


Cycles, Materials Baked to Texture Lost Shading I'm very new to Blender, so this is probably a quick fix that I'm not noticing.  But, after having spent 2 days researching how I could fix this and coming up empty, I felt I should ask for help.

I've been trying to teach myself materials and node use through tutorials, and I just tried baking the materials to a texture.  I'm using Voronoi nodes to give polished detail to the steel part of the model, as seen in this picture.

But, when I bake the image to texture, I only get the gray base without the polished streaks from the Voronoi node.

Here is the node setup for the steel material.

And it was baked as Diffuse with only the color attribute selected.

If any more information is needed I'll gladly provide it.  Something inside is nagging me saying that this is a very simple fix that I'm just not noticing it.

EDIT 1:  I've added my Blender file.

EDIT 2 - SOLUTION: Thanks to Carlo I was able to figure out what was going wrong and play around until I fixed it.  The problem I had was I was feeding the Voronoi node into a Bump feeding into the Diffuse normal, instead of feeding it in with the color.  I knew it was something silly simple I was doing wrong.  Also, like he mentioned, the Lighten node was destroying it too.  First thing first, I got rid of the Bump, and I put in a multiply mix, then set the contrast to low.  I got an effect that I'm actually liking better than the original because the polish streaks aren't so pronounced, but just barely noticeable.  Compare this material setup picture with the original and you'll see where I altered the nodes.

Thanks so much Blender.se community.  I really needed this.  And, I'm sure I'll be back again in the future as I continue my Blender learning adventure.  Have a great day!

"Lighten" mode needs brighter color in order to show something

With your setup are baking the Color component of the Diffuse pass. This means that the bake texture will show only the exact color input that's being provided to every diffuse shader in the nodes of your scene; no bump map/normals are being considered in this process, so the only way your texture could show some variations comes from the Mix factor of the Color Mix node (in your case set to Lighten blending mode)

Regardless of what color texture is coming into the factor, the output of the node will always be the light grey you see in the baked texture you are showing in your question: you are infact trying to Lighten a bright color with a darker one.

The manual is not quite clear about what the blending mode is doing:

  Like bleach makes your whites whiter. Use with a mask to lighten up a little.

I may guess is adding the second color only when it's brighter than the first one, but it's a fact that using a second color darker than the first one results in a color that is always the same of the first one.


Where to find particular colour the theme? If you see in the image selected channel' Text is not at all readable.

I am aware of theme colour setting in Preferences panel. But i am not able to find the fallowing

So where do change the colour of background
And where do i change the colour of highlight text colour

The problem was the Channels were showing Group colors Over the default theme. Deselecting that option"Show Group Colors" from View menu brought back the readability.


Batch Generate Previews Not Working Even for the default cube, when I go to File -> Data Previews -> Batch Generate Previews, it seems that it's doing something.
Then I save the file but when I try to append the cube to another project I get no Image preview!
Does anyone know what I'm doing wrong or what I'm missing? I'm running blender 2.78c.

You might be using it wrong, I think you misunderstood how it is supposed to work.

Generate Data previews is not meant to be used for a currently open file, you are supposed to use it on any saved file in your harddrive, not being worked on at the moment.

If you batch generate previews for an open file, Blender will work to generate them then save them to the file. However when you save the open file Blender will write to disk the version it had previously loaded into memory, prior to thumbnail generation, thus not yet containing the generated previews.

It wil then overwrite the the preview file with non generated version, thus effectively erasing the work done.


Blender Python Add-on issue Im manage to make a simple script to generate a stair in python.
Now I would like to add it as a new mesh, and being able to have a menu where I can modify the value instead of changing the code.
I start from the template addon_addObject

I can recreate my stairs but stuck with creating the parameters. Here is the code.
Thank you for any help

import bpy
from bpy.types import Operator
from bpy.props import (FloatVectorProperty, FloatProperty, IntProperty)
from bpy_extras.object_utils import AddObjectHelper, object_data_add
from mathutils import Vector

def add_object(self, context):

    #step variable
    cubsize = 2
    posx = 0
    posy = 5
    posz = 2

    scalx = 10
    scaly = 5
    scalz = 0.5

    #step numbers
    step = 20

    #step generators
    for i in range (step):
        bpy.ops.mesh.primitive_cube_add(size=cubsize, location=(posx, cubsize*i+posy*i,cubsize*i+posz*i))
        bpy.ops.transform.resize(value=(scalx, scaly, scalz))

    bpy.ops.object.select_pattern(pattern="Cube*")
    bpy.ops.object.join()
    bpy.context.object.name = "G_stair"

class OBJECT_OT_add_object(Operator, AddObjectHelper):
    """Create a new Mesh Object"""
    bl_idname = "mesh.add_object"
    bl_label = "parameter stair"
    bl_options = {'REGISTER', 'UNDO', 'PRESET'}

    step: IntProperty(
        name="step",
        default=10,
        subtype='TRANSLATION',
        description="scaling",
    )

    def execute(self, context):
        add_object(self, context)

        return {'FINISHED'}

# Registration

def add_object_button(self, context):
    self.layout.operator(
        OBJECT_OT_add_object.bl_idname,
        text="stair",
        icon='PLUGIN')

def register():
    bpy.utils.register_class(OBJECT_OT_add_object)
    bpy.types.VIEW3D_MT_mesh_add.append(add_object_button)

def unregister():
    bpy.utils.unregister_class(OBJECT_OT_add_object)
    bpy.types.VIEW3D_MT_mesh_add.remove(add_object_button)

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

TRANSLATION is Not a subtype of an int property

when the code is run you will be getting messages to the system console that

TypeError: IntProperty(subtype='TRANSLATION'): subtype not found in ('PIXEL', 'UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE')
ValueError: bpy_struct "MESH_OT_add_object" registration error: step could not register

recommend subtype = 'DISTANCE'

No error now, but.. it will have no dimension unit

If instead we change to a floatproperty

step: FloattProperty(
    name="step",
    default=10,
    subtype='DISTANCE',
    description="scaling",
)

Why??

If we look at the FloatProperty will see that it has a unit setting which Intproperty does not.

:arg unit: Enumerator in ['NONE', 'LENGTH', 'AREA', 'VOLUME', 'ROTATION', 'TIME', 'VELOCITY', 'ACCELERATION', 'MASS', 'CAMERA', 'POWER'].
:type unit: string

Hence the same result is achieved using

step: FloatProperty(
    name="step",
    default=10,
    unit='LENGTH',
    description="scaling",
)

Note in this case, step is a unit-less int with minimum 0.  ie make sure your translation props are floats.

To get step in your method it will be

self.step

For example

#step generators
for i in range (self.step):
    ...

The AddObjectHelper class writes its gear first see How to link the adjust last operation menu to object? Blender 2.80 - 2.81

Python performance with Blender operators

Will find if you try and create a huge staircase calling 2 * (step + 1) operators may slow this down considerably.

Another way to do this would be to add an array modifier with both x and z offset, and the choice to apply or not

Copying an object with python without actually creating a new object

Putting it together

import bpy
from bpy.types import Operator
from bpy.props import (FloatVectorProperty,
                       FloatProperty,
                       BoolProperty,
                       IntProperty)
from bpy_extras.object_utils import AddObjectHelper
from mathutils import Matrix

def steps(context, count, size, scale, offset, align, location, rotation, apply_modifier):
    bpy.ops.mesh.primitive_cube_add(
            size=size,
            align=align,
            location=location,
            rotation=rotation
            )
    obj = context.active_object
    obj.data.transform(Matrix.Diagonal(scale).to_4x4())
    # add two array modifiers

    arrays = {"x": offset,}

    for axis, displace in arrays.items():
        mod = obj.modifiers.new(axis, 'ARRAY')
        mod.use_relative_offset = False
        mod.use_constant_offset = True
        mod.count = count
        mod.constant_offset_displace = displace
        if apply_modifier:
            bpy.ops.object.modifier_apply(modifier=mod.name)

class OBJECT_OT_add_object(Operator, AddObjectHelper):
    """Create a new Mesh Object"""
    bl_idname = "mesh.add_object"
    bl_label = "parameter stair"
    bl_options = {'REGISTER', 'UNDO', 'PRESET'}

    size : FloatProperty(
        name="Size",
        default=2,
        unit='LENGTH',
        )

    count: IntProperty(
        name="Steps",
        default=10,
        description="Number of Steps",
        min=0,
    )

    scale : FloatVectorProperty(
        name="Scale",
        default=(1, 1, 1),
        )

    offset : FloatVectorProperty(
        name="Offset",
        subtype='TRANSLATION',
        default=(0, 1, 1),
        )

    apply_modifier : BoolProperty(
        name="Apply Array Modifier",
        default=True,
        )

    def execute(self, context):
        steps(
            context,
            self.count,
            self.size,
            self.scale,
            self.offset,
            self.align,
            self.location,
            self.rotation,
            self.apply_modifier,
            )

        return {'FINISHED'}

# Registration

def add_object_button(self, context):
    self.layout.operator(
        OBJECT_OT_add_object.bl_idname,
        text="stair",
        icon='PLUGIN')

def register():
    bpy.utils.register_class(OBJECT_OT_add_object)
    bpy.types.VIEW3D_MT_mesh_add.append(add_object_button)

def unregister():
    bpy.utils.unregister_class(OBJECT_OT_add_object)
    bpy.types.VIEW3D_MT_mesh_add.remove(add_object_button)

if __name__ == "__main__":
    register()


How to create a slope Hey so i want to do a straight slope between the cubes, as shown by the black drawing. Any easy way of doing it? My solution of creating another cube cute it in half and try to get it to fit but that cant be the easiest way?

Thanks :)

Tab into edit mode
Select and delete these interior faces

Select these verts and hit f to make them a face

Select these verts and hit f to make them a face

Select these verts and hit f to make them a face