Grease pencil workflow for composition or storyboarding Note to the readers, August 2019: Grease Pencil has gone through a major redesign for version 2.80, so you should probably check more recent resources than the (current) answers to this question

I would like to use the grease pencil for

sketching the composition of illustrations
sketching the storyboard for animations

where the illustration/animation will be done in 3D.

For the illustrations, I'd basically like to "place" the different objects of my scene in the 3D world, and I would like to know the best way of doing this. For instance, for making the setup below, I had to go back and forth from mouse to keyboard to graphic tablet in order to move the 3D cursor (to choose the depth at which the line would be drawn), go back in "draw" mode, and do the actual drawing; to replace a wrong stroke I had to hit "Undo" because I'm not sure how to reposition a stroke.

Is there a window layout and a set of hotkeys that would help me?

For the animations I'd like to do just the same, but also to be able to make elements appear/disappear, and possibly to keyframe their Rot, Loc, Scale.

Maybe this is all very simple, but I don't quite get the mindset behind all this: Are strokes objects? Where are they in the outliner? Do they have F-curves? Is their visibility keyframable? Does it change anything if I draw a stroke while being at frame #n rather than at frame #m (unlike regular objects)?

Wrapping it all up: I can't seem to find many tutorials, and the few I've found seem to focus on making 2D animations with the grease pencil itself. I'd really appreciate if you could introduce me to the right mindset that I need to work with G.P. as a "sketching" tool, and possibly some good resources about it.

To draw with the grease pencil at a specific depth and angle it's often easiest to simply place an mesh in the scene and orient it so the surface is positioned where you require the GP lines and use the Surface stroke placement to effectively draw on that surface. You can then either hide the mesh (to use it later to re-draw something in the same place) or move it to another location to draw the next stroke.

For animation of grease pencil strokes there are a couple of options.

The first is to convert the grease pencil strokes into 'real' geometry using the Convert... tool in the tool shelf.

This will create a curve from your grease pencil strokes and this can be manipulated as for any geometry.

The other (pure grease pencil) option is to use the grease pencil Enable Editing mode and the Grease Pencil tools in the properties side panel of the 3D view.

Firstly, use the Grease Pencil layers to keep your different elements separate. This allows easy manipulation of the different layers. For example, to select all of one particular layer (when in Edit mode) you can simply hide all other (by clicking the eye icon in the Grease Pencil layers list) and the press A in the 3D View to select 'All'. The layers can be assigned individual colours in the Grease Pencil properties panel if desired.

To manipulate particular GP strokes, enable editing by clicking the Enable Editing button in the Tool Shelf (T). You can now use the usual selection tools (A for 'all', Box Select (B), Circle Select (C), etc.). Once you have selected the relevant points on the strokes you can use the usual Grab G, Rotate R, Scale S tools as well as Proportional Editing, etc. to manipulate the strokes.

To keyframe the changes simply swap to a different keyframe before manipulating the GP strokes. This will automatically create a new keyframe for the new strokes' position.

Additionally, enable Onion Skinning to allow you to see how the grease pencil strokes vary between adjacent frames.


Operator docstrings displayed on buttons, not in search mode When hovering over an operator button in blender, a nice box pops up that shows at least the docstring of the operator. However, if I find the same operator with the search function (pressing space in 3dview) and hover over it, no popup is shown.

Why is that? Is there a setting to enable this?

Spacebar search uses bpy.types.Menu type class to display content in contrast of bpy.types.Panel for buttons etc.

Drawing methods in both of them will be the same, like:

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

Menu will have the items with displayed shortcuts aside with no box popup (this is probably because a menu can have a sub-menu as a popup so to not confuse).

Panel formatting has more options and does show the pop-up doc-string.

This is by some design decision and cannot be changed with current exposed api.


How to move / animate a soft body? I want to animate a softbody in a way that it moves along a NURBS curve path. The Problem, which occurred as I gave it a try is that the simulation doesn't take into account the moving along the NURBS curve. The mesh simply falls down along the Z-axis.

So my question is how can you move a soft-body along a predefined path in a way that the movement is considered by the soft-body simulation?

For the Soft Body to follow a path you need to have the Soft Body Goal enabled. The Soft Body Goal can either be defined for all vertices (if you don't specify a Vertex Group) or for specific vertices - with associated weights - as a Vertex Group.

Think of the Soft Body objects as a combination of two meshes. One is the 'actual' mesh - and this can be animated - if you disable the Softbody modifier in the modifier stack then the mesh will revert to that form.

The other 'mesh' is the Soft Body mesh. This is separate from the 'actual' mesh and its vertices are moved by the Soft Body simulation. Any simulated vertices flagged as being a 'goal' vertex will attempt to move towards the corresponding 'actual' vertex - with the strength determined by the Goal Strength and the Vertex Group Weight. If you set the weight to '1' then the simulated vertex will always exactly match the corresponding 'actual' vertex whereas lower weights will experience a smaller pull towards that 'goal' location.

Since you're seeing the Soft Body fall under the pull of gravity that indicates that you are not using the Goal - so despite you animating the 'actual' mesh, the simulated soft body vertices will not be 'pulled' towards it - so it ignores your animation.

So get it to follow the animation simply enable the 'Goal' and set a suitable Goal Strength to follow your path while still allowing it some sift body "wobble" - or use the Vertex Group so that only some of the vertices have a 'goal' and the rest will be pulled along with them following the soft body simulation.


Bevel tool not working properly I'm new to blender and i'm having a problem, the bevel tool is not behaving like i want when i press ctrl+b

My issue was incorrect normals, I used ⇧ Shift + N and it solved the problem.


How to use image as plane with matcap turned on I'm moddeling some structures and added a picture of a person as a plane in order to keep the scale right. It look like this on solid mode:

But when I turn on mat-cap, the person suddenly goes blank, like this:

Is there a way I can keep the guy visible with mat-cap turned on?

The image that you want to keep is created by a material. The purpose of a matcap is to override all of the materials with the matcap material. This includes the material on your plane. As far as I know, there is no way to exclude an object from having the matcap material.

I would suggest using a custom matcap on your other objects instead, which is essentially just a material that looks like the matcap material. CG Masters did a fantastic tutorial on how to set that up here that also includes links to images that allow you to recreate the same matcap that you are using already.

Your other option is to enable viewport ambient occlusion. This won't make the objects look like they do with a matcap, but may help give you a bit more visual clarity while modelling by making corners and creases a bit darker. The option for that can be found just under where you enable matcaps. I would definitely suggest the first way though with the manual matcap material, as it's going to do exactly what you want.


How to write python to show Toruses from an imported txt file containing center coordinates I have a question about Python. By the way, I'm beginner of Python and English. I wrote a script showing Toruses from an imported txt file containing center coordinates, but I got an error at

bpy.ops.mesh.primitive_torus_add(location=(int(temp[0]), int(temp[1]), int(temp[2])), rotation=(math.pi/2, math.pi/2, math.pi/2))

I would appreciate if you tell me how to solve it.
Here is my script

import bpy
import math

f=open(r"C:\Users\biostr\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\traj_pro.txt", "r")
lines=[]

for line in f:
    lines.append(line.strip())

for p in lines:
     temp=p.split(',')
     bpy.ops.mesh.primitive_torus_add(location=(int(temp[0]), int(temp[1]), int(temp[2])), rotation=(math.pi/2, math.pi/2, math.pi/2))
     bpy.ops.object.shade_smooth()
     obj=bpy.context.scene.objects.active
     mat=bpy.data.materials.new('Torus')
     mat.diffuse_color=(1.0, 0, 0)
     mat.alpha=0.8
     obj.data.materials.append(mat)

f.close()

Here is some lines from my txt file. Actually, my file is Atom's coordinates, can I make Toruses from this??

CRYST1   65.961   65.961   65.961  90.00  90.00  90.00 P 1           1

ATOM      1  N   GLN X   1      32.110  46.350  52.070  1.00  0.00
ATOM      2  H1  GLN X   1      32.470  45.850  52.870  1.00  0.00
ATOM      3  H2  GLN X   1      32.931  46.641  51.559  1.00  0.00
ATOM      4  H3  GLN X   1      31.568  47.112  52.451  1.00  0.00
ATOM      5  CA  GLN X   1      31.200  45.480  51.230  1.00  0.00
ATOM      6  HA  GLN X   1      30.402  45.041  51.829  1.00  0.00
ATOM      7  CB  GLN X   1      30.390  46.250  50.180  1.00  0.00
ATOM      8  HB1 GLN X   1      30.811  46.160  49.179  1.00  0.00

Below is based on on some old code but is still functional for blender 2.79. This will add a tool panel in the view3d viewport that will allow for file selection before generating a generic torus since the atom data only provides x,y,z coordinates as relevant info.

import bpy
from bpy.types import Operator
from bpy.types import Panel

class MeshGenTool():
    @classmethod
    def main(cls, context):
        scene = context.scene
        objs = importFile(scene['File'])
        for obj in objs:
            bpy.ops.mesh.primitive_torus_add(
                location=obj[0])
            MyMesh = context.object
            MyMesh.name = "MyMesh"

class MeshGenButton(bpy.types.Operator):
    """Execute generation"""
    bl_idname = "object.simple_operator"
    bl_label = "Generate"

    @classmethod
    def poll(cls, context):
        scene = context.scene
        filevalid = (scene.File is not "")
        return filevalid is True

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

def importFile(File):
    obj_loc = ()
    obj_dia = 1
    obj_data = ()
    objs = []
    f = open(File, 'r')
    for line in f:
        if line.startswith('ATOM'):
            words = line.split()
            obj_loc = (float(words[6]), float(words[7]), float(words[8]))
            obj_data = (obj_loc, obj_dia)
            objs.append(obj_data)
    return objs

class VIEW3D_PT_Blank1_Blank2(Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = "Import Atom Coords"
    bl_context = "objectmode"
    bl_label = "Import Coords"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        row = layout.row()
        col = layout.column(align=True)
        col.prop(scene, "File")
        col.operator(
            "object.simple_operator", text="Add items",
            icon='MESH_TORUS')

def register():
    bpy.utils.register_class(VIEW3D_PT_Blank1_Blank2)
    bpy.utils.register_class(MeshGenButton)
    bpy.types.Scene.File = bpy.props.StringProperty(
        name="File",
        description="Path of File to read from",
        default="",
        subtype='FILE_PATH')

def unregister():
    bpy.utils.unregister_class(VIEW3D_PT_Blank1_Blank2)
    bpy.utils.unregister_class(MeshGenButton)
    del bpy.types.Scene.File

if __name__ == "__main__":
    register()


Subdivision, rounded edges problem I'm trying to create a door handle with smooth rounded edges, like this:

I'm having a problem when trying to bevel or apply a subdivision surface modifier, mainly that I'm not able to correctly apply loop cuts to sort out the modifier.

Also bevelling the edges both with a modifier and with ctrl+b isnt having the desired effect, sometimes it doesnt even give me the option to bevel.

Here are some pictures of the nasty creases i get across some edges after i apply the subdivision surface modifier and add loop cuts

It looks like you have some duplicate vertices and/or faces in your model. The first thing to do should be to remove your duplicate vertices. In Edit Mode, select the entire mesh by pressing A. Then, press W and click "Remove Doubles". This should help to clean things up. If this doesn't fix it, make sure that you are using the Bevel Modifier before the SubSurf modifier. This will prevent your SubSurf modifier from destroying your topology. Since you have a cylinder, you want the "curved" faces sub-surfed, but not beveled. To do this, set the Bevel Modifier limit method to "Angle" and set the angle to something greater than the angle formed between two of the cylinders sides (probably about 15 degrees). To get a cleaner bevel at sharp corners, set the width method to "Width". To get the curved effect in your reference image, increase the Bevel Segments and Profile. It should look like this:


Rendering an animation, all works except frame 2? I made a text into video, and put in a melting part in there (fluid sim). I tweaked it to keep my PC from blowing up until I have that 8 core.

In the media player in Blender all shows up great.
In the render preview it all shows up great.
When I press the animate button it looks how I want it to look.

Then, on frame 2, it will get stuck in synchronizing the task for ever. So I manually went to frame 3 and that works as well.
Start the animation render from frame 3 to 200 and it all runs.

The only frame not rendering is frame 2. There must be something of at that frame but no idea what that could be.
(Since as far as I know all settings are the same from frame 1 until the last frame 300.)

res 512. render to PNG 16bit.

Who has an idea where it might get stuck on?

This could be a cache problem. Try to delete the particle cache - add a new one, then delete the old one, to be sure. Jump to the last frame in your animation, and click Update All To Frame.


How to make layout panel for addon in the render properties window visible only for EEVEE? I'm currently working on addon for EEVEE. The code below adds new panel to Render Properties window.

import bpy

class MyEeveeAddon(bpy.types.PropertyGroup):

    use_myeevee_addon : bpy.props.BoolProperty(
        name="",
        description="Enable My Eevee Addon",
        default=False
    )
    mea_int_property : bpy.props.IntProperty(
        name="Quality",
        description="Increase My Eevee Addon quality",
        default=8,
        min=0,
        max=128
    )

class RENDER_PT_my_eevee_addon_panel(bpy.types.Panel):
    """Creates a Panel in the render properties window"""
    bl_label = "My Eevee Addon"
    bl_idname = "RENDER_PT_true_mb"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "render"
    bl_category = "My Eevee Addon"
    bl_options = {'DEFAULT_CLOSED'}

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

        col = layout.column(align=True)
        row = layout.row()
        col.prop(scene.me_addon, "mea_int_property")
        col.active = scene.me_addon.use_myeevee_addon

    def draw_header(self, context):
        layout = self.layout
        scene = context.scene

        col = layout.column(align=True)
        col.prop(scene.me_addon, "use_myeevee_addon")

bpy.utils.register_class(MyEeveeAddon)
bpy.utils.register_class(RENDER_PT_my_eevee_addon_panel)
bpy.types.Scene.me_addon = bpy.props.PointerProperty(type=MyEeveeAddon)

I can't figure out how to make it appear only for EEVEE render engine (like ambient occlusion tab for example). Tried to assign PointerProperty to bpy.types.SceneEEVEE.me_addon and change context in both drawing functions to context.scene.eevee but it doesn't work this way.

I guess, the right way would be to use correct bl_context in RENDER_PT_... class, something like "eevee_render" instead of just "render", but there's no documentation exist about what strings can be used for bl_context, and I could not pick up exact meaning with selection method and not skilled enough to find it in Blender source code.

Please, can anyone help with that?

Mix in class

Following on from  your answer,
 can also create a mix in class.  An example below.

The EeveeBasePanel mix in class will make any panel inheriting it be in properties, render context, default closed and poll when the render engine is eevee.

This comes in handy if you are going to register other panels. For example I have put a test panel in the scene context, that will also be in properties,  default hidden and only poll if the render engine is eevee.

Seeing as it seems to be eevee based didn't worry about having compat engines list, or setting the category (tabbed by context rather than category in properties)

import bpy

class MyEeveeAddon(bpy.types.PropertyGroup):

    use_myeevee_addon: bpy.props.BoolProperty(
        name="",
        description="Enable My Eevee Addon",
        default=False
    )
    mea_int_property: bpy.props.IntProperty(
        name="Quality",
        description="Increase My Eevee Addon quality",
        default=8,
        min=0,
        max=128
    )

class EeveeBasePanel:
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "render"
    bl_options = {'DEFAULT_CLOSED'}

    @classmethod
    def poll(cls, context):
        return (context.engine == 'BLENDER_EEVEE')

class RENDER_PT_my_eevee_addon(EeveeBasePanel, bpy.types.Panel):
    """Creates a Panel in the render properties window"""
    bl_label = "My Eevee Addon"
    bl_idname = "RENDER_PT_true_mb"

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

        col = layout.column(align=True)
        col.prop(scene.me_addon, "mea_int_property")
        col.active = scene.me_addon.use_myeevee_addon

    def draw_header(self, context):
        layout = self.layout
        scene = context.scene

        col = layout.column(align=True)
        col.prop(scene.me_addon, "use_myeevee_addon")

class SCENE_PT_test(EeveeBasePanel, bpy.types.Panel):
    bl_label = "My Eevee Scene Test"
    bl_context = "scene"

    def draw(self, context):
        self.layout.label(text="Test")

classes = (MyEeveeAddon,
           RENDER_PT_my_eevee_addon,
           SCENE_PT_test)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.me_addon = bpy.props.PointerProperty(type=MyEeveeAddon)

def unregister():
    for cls in revrersed(classes):
        bpy.utils.register_class(cls)

if __name__ == "__main__":
    register()


How can I let the User draw a curve in BGE while playing? How can I make a Python code or mix python with blender things to make the user draw a track(will be a ball rolling over it) by leaving spacebar or click pressed to decide how will the track looks.
maybe creating a curve and making any object, like box attach to it

Note: I want it to be made in 2D.

later I could make something, I achieve to let the User press spacebar and while he moves the mouse it puts little cylinders that make kind a path thing, but they are so far one from each other, so is not exactly what I want...

Trail Object

This object represents a single step on the trail. The x-dimension should be exactly 1.0. Make it "no collision" in physics tab to avoid interaction with other objects.

To appear as a line use plan that gets scaled to 0 on the y-axis. Give it a material with wire frame to make it visible with exactly one pixel width. It should reside on an hidden layer (otherwise add object will not work).

Trailed object

Is the object that should leave a trail. Typically you add one trail per step. Then align the trail to the last position of the trailed object and change the size that it completely fills the step.

The script can be like that:

import bge

INTERNAL_PROPERTY_LAST_POSITION = "_last.position"

AXIS_X = 0

controller = bge.logic.getCurrentController()

owner = controller.owner

lastPosition = owner.get(INTERNAL_PROPERTY_LAST_POSITION)
currentPosition = owner.worldPosition.copy()
owner[INTERNAL_PROPERTY_LAST_POSITION] = currentPosition

if lastPosition is not None:
    direction = lastPosition - currentPosition
    for actuator in controller.actuators:
        actuator.instantAddObject()
        trail = actuator.objectLastCreated

        trail.alignAxisToVect(direction, AXIS_X)
        trail.worldScale = 3*[direction.length]

Result

Remarks

This creates quite a lot of trail objects. At a certain number it will cause lags.
You can increase the step size by increasing "skip" at the always sensor of the trailed object. It creates less objects but results in less precise trailing and a small delay.
trail objects with a bigger width can result in overlapping and gaps. This depends on the shape and material.


how to disable auto smoothing by default in 2.74 when I import an obj file, by default auto smoothing is enabled. Is it possible to change this option as in the old realises?

You cannot (well, not from UI or other 'user-land' ways). Note however that 'autosmooth' here is a bit of a weak name, since it actually means you are using (custom) normals as defined by the .obj, instead of auto-computed ones by Blender…

Now, if you really want to disable that by default, you'll have to open addons/io_scene_obj/import.py in your Blender installation, search for me.use_auto_smooth = True (should be around line 657 currently), and replace it by me.use_auto_smooth = False (or just comment it by adding a # in front of that line).

But again, don’t think you want to do that, at least I do not see why you would…


How to increment an object property, later i check it and disable itself if date/year mismatches I'm writing some code,to get the year, then check it  during my load screen.  If it's not 2017,I want the game object to destroy itself.. it will be a version of the game I give to friends for testing..So next year when I'm hopefully selling the game, it wont work for these test builds.  Here's my code,somethings wrong, I usually don't code in python.  I thought this would work. The object has an int property called dateok. It has another sensor to check dateok and destroy itself if the value is 1;

import datetime
import bge

cont = bge.logic.getCurrentController()

def main():

    if day.year!=2017:

        owner = cont.owner
        dateok = cont.actuators['dateok']
        value = value.get(dateok.propname) +1
        dateok.value = str(value)
        cont.activate(dateok)

I suggest you check the current date:

from datetime import datetime

if datetime.now().year>2017:
     ...


best way to join ears? HI I would like a method to join the ear to the mesh , I do not want many polygons in my whole object, I consider the rings of the edge loops must be the same size as possible, the ear has a 18 vertices around and the hole in the face of the character has only 11 vert, should I need to merge vertices, but nasty problem.

Try this:

Place the ear in the perfect position.
Select the both the ear and head mesh using shift+right click
Hit ctrl+J to join the the two meshes together
you can then enter edit mode select vertices and choose smooth vertices from the tools menu


keyframe slide on timeline I can move keyframe for transform action but how to do it for other animation keyframes like curve bevel start or end ??
here's my code:
for o in bpy.context.selected_objects :
    action = o.animation_data.action
    for i in action.fcurves:
        for keyframe in i.keyframe_points:
            keyframe.co[0]=keyframe.co[0]+10
        i.update()

Try fcurves.find...you need to access it from object.data.animation_data instead of object.animation_data (since bevel start end are part of data block). You can find the data path by right clicking on the property in the edit properties panel.
for o in bpy.context.selected_objects :
    action = o.data.animation_data.action # Note: o.data.animation_data
    fcurve = action.fcurves.find('bevel_factor_start'):
    for keyframe in fcurve.keyframe_points:
        keyframe.co[0]=keyframe.co[0]+10

```


How do I convert the module to script? Change my python type from Module to Script?
In Blender #game engine

Add these two lines at the end of the script:

cont = logic.getCurrentController()
main(cont)

The module mode calls specifically the function main through the entry point on the controller, while in the script mode you have to explicitly call the main function on the script. As the main function needs the controller reference, you get the controller and pass to it.

That's how you use a module as a script, however I would seriously recommend you to stick with the module mode: the script mode is A LOT slower than the module mode (as it is parsed at runtime) and the module mode provides much better options on code editing and organization.


Adaptive subdivision resolution cap I'm trying to render a scene that heavily features micropolygon displacements. It works just fine at 50% 1080x1920 resolution, but at 100% my memory usage goes through the roof, to around 36gigs.

I believe this is due to the higher pixel count of a full resolution render, creating an inordinately high number of polygons per pixel.

How would one cap this adaptive subdivision to be limited at a certain amount?

in the render tab under geometry settings. render px is probably what you need


Snap selection to x-y component of 3D Cursor just starting off with Blender, and wondering what the easiest way to snap a selection to part of the 3D cursors transform would be.
(TLDR: question below last pic in bold)
For example, if modelling something like a below using a boolean shape to cut out detail, it is probably necessary to align the shape with some existing edges of your model to avoid the boolean function from adding unnecessary geometry.
The below is looking from the xz plane.

Marked here is the corner with the correct xz for an edge, but a different y.

If the 3D Cursor is set to this, and we snap selection to cursor while preserving our offset, we see the xz are correct, but the y component of our selected edge is averaged about the cursor.

TLDR
So the question here is, how would I be able to move this edge to the x,z of either this vertex/the cursor, while ignoring changes to the y component of my selection?
I have looked around online in similar terms for a solution to aligning edges as so, but have struggled to find anything other than manually entering the x,z of the 3D cursor from the world properties (tedious, inefficient), or building the cut out from the point that is going to cause an issue (tedious, prone to breaking with too many points).
I am however a blender noob, so I might be missing something incredibly simple or using the wrong jargon to search. If any of you know of a work around for this, or a better method of aligning edges in general, please advise, as this seems like something that should have a simple solution.
Cheers!

I don't know of a way to snap directly to the 3D cursor itself. Usually you're snapping to a vertex. In your case you can use the preexisting vertex at the 3D cursor's location. Failing that, you can always set your pivot point to 3D cursor, duplicate any existing vertex, and scale it to 0. This will move it to the 3D cursor.
In Blender you can constrain most transformations to either a single axis, or to a plane, including when snapping. If you hit G for move, and then hit Y, you will only be able to move along the y-axis.
In your case, you want to prevent movement along the y-axis, so you would hit G, then SHIFT+Y. This will constrain movement to the x-z plane.
As for the snap tool itself, I usually recommend using the active element setting. This way you have more precise control over what is snapping to the target (the highlighted white vertex, instead of whichever vertex is closer.
Here is how I would solve your problem without even needing the 3D cursor:

Select the vertex that you want to line up to your target edge. This will set it as the active element.

Select the rest of the mesh that you want to move. You can either hit A to select all, or L to select only the contiguous parts of the mesh.

Hit G for move, then SHIFT+Y to constrain movement to the x-z plane.

Move your cursor to the vertex you want to snap to, and click.


How do I make a landscape like this? (Sea, waves, shore, beach...) How do I make a landscape as shown below?

This is something which I am getting using ANT landscape tool and TXA_ant but it nothing close to what I need,

You could create 2 objects, one for the ground:

Select some random vertices and move them up:

Extrude the whole plane down:

Create the sea:

Give it a Subdivision Surface modifier. Give it a Displace modifier with a texture Cloud in order to have a bit of noise, with Coordinates > Object and an empty as Object that you will move and keyframe. At last, give it a Wave modifier with this kind of settings:

Now give a texture to the ground that is basically a gradient on the Z axis:

Give a texture to the water that is a mix between Glass, Transparent and Glossy:

Give your whole scene an HDRI:

If you're supposed to make a part of your water flater (or decrease the modifiers effect), switch your sea object to Weight Paint mode, paint this part:

Then in the modifiers, select the group you've just selected, switch with the <-> button:


Get center of geometry of an object With Object > Transform > Origin to Geometry, an object's origin is moved to its geometry's center.
How can I get this center in script?
I don't want to move its origin, I just need to get its center.

Here's a low level way to calculate the bounding box center of an object:

import bpy

o = bpy.context.object
vcos = [ o.matrix_world * v.co for v in o.data.vertices ]
findCenter = lambda l: ( max(l) + min(l) ) / 2

x,y,z  = [ [ v[i] for v in vcos ] for i in range(3) ]
center = [ findCenter(axis) for axis in [x,y,z] ]

print( center )

EDITED:

@batFINGER proposed a much shorter and more efficient way to calculate the bounding box center (thanks!). Multiplication by the object's world matrix gives a global coordinate:

import bpy
from mathutils import Vector
o = bpy.context.object
local_bbox_center = 0.125 * sum((Vector(b) for b in o.bound_box), Vector())
global_bbox_center = o.matrix_world * local_bbox_center

It will find the center of the active object.
The bounding box center (or "range" center) is calculated as the center between the minimum and maximum value in each axis.

It does not give you the same result that origin to geometry or origin to center of mass gives, but it is the center.


Avoid obstacles overlap with BezierCurves I am trying to modify the vertices of Bezier Curve to maneuver around any obstacles if existing in their way. So far, I am able to create curves through script but still unable to detect any overlap of other objects with this curve so that the vertices (left and right hands could be modified accordingly to maneuver around that obstacle). Basically, I want to make some object follow that curve path but it should avoid every existing obstacle in their way.
from bpy import ops, context, data
from mathutils import Vector

ops.curve.primitive_bezier_curve_add(enter_editmode=False)
curve = context.active_object
curve.name = 'Trajectory'
bez_points = curve.data.splines[0].bezier_points

bez_points[0].co = Vector((0.0, 0.0, 0.0))
bez_points[0].handle_left = Vector((0.0, 0.0, 0.0)) + Vector((0.5, 0.0, 0.0))
bez_points[0].handle_right = Vector((0.0, 0.0, 0.0)) + Vector((-0.5, 0.0, 0.0))

bez_points[1].co = Vector((10.0, 10.0, 10.0))
bez_points[1].handle_left = Vector((10.0, 10.0, 10.0)) - Vector((0.5, 0.0, 0.))
bez_points[1].handle_right = Vector((10.0, 10.0, 10.0)) - Vector((-0.5, 0.0, 0.))

I want to modify the curve so that the object following that path should avoid any obstacle in their way. I have illustrated it for better understanding.

Raycast into the scene

As a proof of concept have put together a "dodgy" artillery trajectory.

Define the two end points in scene
Target from point to point and shoot a ray into scene
If it hits an object, raise elevation by one degree and try again
If it does not hit, using current aim vector,  extend the right handle of the source knot to where it intersects the plane defined by target point and source to target normal.
The incoming handle is lazily set to vertical.

Note haven't put any checks and balances in to test if there is no possible LOS trajectory A to B.
To improve could use same method going other way.  Have found only the trajectory on the vertical plane.  Spinning the aim around point to point axis could be considered to find shortest two point bezier path that misses object obstacles between two points.  Another way to put this would be we are looking at pitch, could also consider roll, moving our aim around ever increasing concentric circles until a miss
Test code.
from bpy import ops, context, data
from mathutils import Vector, Matrix
from mathutils.geometry import intersect_line_plane
from math import radians

scene = context.scene
pt0 = Vector((-5, 0, 0))
pt1 = Vector((5, 0, 0))
up = Vector((0, 0, 1))
t = d = (pt1 - pt0).normalized()
axis = d.cross(up)
d_elev = radians(1)

hit = scene.ray_cast(
        context.view_layer,
        pt0,
        d,
        )[0]

R = Matrix.Rotation(d_elev, 3, axis)
while hit:
    t = R @ t

    hit = scene.ray_cast(
            context.view_layer,
            pt0,
            t,

            )[0]

t = R @ t # rotate one more time
pt2 = intersect_line_plane(
    pt0,
    pt0 + 1000 * t,
    pt1,
    d,
    )

ops.curve.primitive_bezier_curve_add()
curve = context.active_object
curve.name = 'Trajectory'
bez_points = curve.data.splines[0].bezier_points

bez_points[0].co = pt0
bez_points[0].handle_left = pt0 - t
bez_points[0].handle_right = pt2

bez_points[1].co = pt1
bez_points[1].handle_left = pt2
bez_points[1].handle_right = pt1

Added one more rotation after miss. Raycast can be a little dodgy if it hits an edge.

Some test results of moving two cubes, active curve is last result with cubes in current location.
As mentioned this is simply a proof of concept of manipulating the handle of a bezier curve to emulate lobbing over an obstacle in LOS changing degree of elevation.
Doing this using points of a right angled triangle with right angle at destination point.
To make this a "shortest" curve that misses obstacles would require more bezier points or investigating looking from other end moving  the apex of the triangle that is the intersection of handle right of source point and handle left of destination point vectors.


Blender python - edit custom property of a specific object I am new to python. I would like to get a custom property of an object (not context.object) in a scene, for example "Object" (where my custom properties are assigned) and edit them via my custom addon - without the nessesity of selecting that object.
In other words, I would like to change a value via an operator in my addon, and such that the value would change in the Object's custom property.
My link to an object in the code:
obj = bpy.data.objects["Object"]
row.prop(obj, "custom_property_name")

You need to :
Make sure your object is actually named "Object" (case sensitive)
And the correct syntax to display a custom property would be :
row.prop(obj, '["custom_property_name"]')


Snapping to vertex when scaling (Blender 2.8) Snapping to a vertex doesn't seem to work for me. The pivot point is set to median point, and I have enabled scaling under snapping options. I don't understand why blender doesn't scale the shape to exactly the size of the circle I've selected.

Note that the "circle" I am trying to scale is not a perfect circle, since I messed it up previously due to the mirror modifier. However, also note that this ellipse was previously scaled down from the circle I'm trying to snap to, which is why I'm trying to scale it back to its original size.

The snap scale to vertex tool can be a bit finicky, so here are a bunch of things to try. Basically, any time the vertex you're snapping two doesn't perfectly line up, the snapping is way off.

I don't know your exact set up, but I would be cautious about using Median as the pivot point with a mirror modifier. The Median pivot point doesn't take into the mirror geometry, so you might not be scaling from the right point:

I almost always use the 3D cursor as the pivot point. It can be a little more tedious, but you have much finer control. Select two vertices on opposite sides of the circle and move the 3D cursor to selected.

Then, set your snapping element to 'Active' in the snap settings, and make sure you're targeting the right vertex. You can see below when I initially am snapping to the wrong vertex, it overscales my selection.


Is there a way to update my empty image? Edited in another program, saved I edited my empty image in Clip Studio, saved it, and when I go back to Blender, it doesn't refresh. Is there a way to refresh it or do I have to save it as a different file, and then drag it into blender, and then move and scale it to where I want it to be? Thanks.

you can find path to external data in File > External Data > Find missing file
or in the Texture paint or UV editing under image > Reload (Alt+R)


Get a full numeric z-depth from a rendered image I know this issue has been mentioned before but I looked at all similar questions and did not find my exact answer. So here is my problem:

I need to get a full depth map of my render. I mean the distance of all pixels from camera. Answers usually leads to the point that we get a grey level image which far pixels are black and close ones are white, which is not what I'm looking for. Because it does some normalizations and the RGB has some limitations which decrease the accuracy. What I need is to save all Z values directly to a .csv file (or .EXR but I don't know much about it and .csv works for me) that keeps the Z value of all pixels.

Is it simply possible? Or I should a script for it? If an script is needed what is the function to get the Z pass of x,y pixel?

Thanks

You can obtain depth values by plugin the depths calculated at render time to a "viewer node" in the compositor.

First make sure the rendering uses z (should be set by default):

Setup the viewer node in the compositor:

Render the image (F12).

Now you can have data from Python (principles only below):

img=bpy.data.images['Viewer Node'] # get the image corresponding to the viewer node

img.size # the image size width=img.size[0] height=img.size[1]

img.pixels # raw vector of pixels representing the depths. You'll have to reshape it to obtain a matrix, using numpy or by other means

What's remaining is to write it to a file (which is no more related to Blender).

Hope that helps.


Drive Objects Rotation depending on state of other objects sin and cos value I started to get into Drives. I want one cube(green) to rotate 90° whenever the other cube(red) is doing it's last 90° turn on the way to the full 360°. Now i've come up with following Logic depending on the red cubes rotation(rot).

[when sin(rot)<0 and cos(rot)>0 add 90° to current rotation]

Can someone show me the right way to a working expression?

This can be done two ways :
scripted expression : which should be one line of code and it may get complicated
driver function : this will make it a lot easier to control and create complex driver, we define a function then use it in the scripted expression

scripted expression :

floor(b/(2*pi))*pi/2 + (cos(b)>0 and sin(b)<0)*(b-1.5*pi) + (b< 0)*2*pi

where b is the angle  of the red cube

driver function:

we define a new function calc_angle() and add it to the driver namespace, this function calculates the angle the same as the scripted expression but its easier to read, update and reuse in multiple drivers .
run the script in blender's text editor

import bpy
from math import *

two_pi = 2*pi
pi_two = pi/2

#create new function
def calc_angle(angle):

        new_angle = floor(angle/two_pi)*pi_two

        if cos(angle) > 0 and sin(angle) < 0 :
            if angle > 0 :
                new_angle += angle-1.5*pi
            else :
                new_angle += two_pi + angle-1.5*pi
        return new_angle

#add the function to the driver namespace
bpy.app.driver_namespace['calc_angle'] = calc_angle

and setup the driver as follows :


Shift-Z Scaling Issues Whenever I hit shift-z to scale on every axis except the Z, the object scales, but flickers, and whenever I release, it renders. How do I stop this?

You don't have to keep pressing shift Z, just press once, release, and scale


How to join, and intersect objects? How do I join this two arcs in a way to connect the vertices (a vertice that connect and join these two objects). (on top and bottom).

(zoom of the picture on the top pf the object)

Given that the two edges intersect:

Select edge1 and create a new Transform Orientation from the edge's normal orientation.
Select edge2 and snap the cursor to it. ⇧ ShiftS > Cursor to Selected
Subdivide edge1 and select the created vertice. W > S
Set the Pivot center for rotation/scaling to 3D Cursor with ..
Scale the vertice to 0 along its local Y axis. SYY0

Delete edge2 (X) and connect the vertices (F).


How do I properly set up Subsurface Scattering for a human skeleton for Cycles? I have a 3D-model of a human skeleton with 8K textures and would like to properly set up Subsurface Scattering and the materials. I've looked around but I'm a little confused about which sockets to connect to which map etc.
Here's a download link for the mesh and all textures: https://www.dropbox.com/s/tlawz8o55cngdaq/HumanMaleSkeleton1.zip?dl=0
If anyone could give me an example of how to set up the materials as good and physically accurate as possible with the maps I have I would really appreciate it.

Under the green label on the right with Principled BSDF turn up Subsurface for subsurface scattering; also adjust the Subsurface color. You can also increase the Subsurface Radius very slightly.

According to the following answers: Principled BSDF subsurface scattering values for skin material the bones should probably have a subsurface value of less than 0.1. How accurate that looks mostly will depend on the lighting and your own ability to reference an image.

Because subsurface scattering varies depending on the distance from the edge of perceived light, along with the distance traveled through the mesh, I don't believe you need to map its value.


Is there a way to set depth of field to the _closest_ point on a focus object, or do it via nodes? I'd like the in-focus plane to always be 1 meter closer to the camera than the center of the focus object, or equivalently the closest point on a 1-meter sphere at the center of the focus object. I think right now Blender always focuses on the origin of the focus object, not its closest point.
Is there any way to make that work? I can write some python code if that helps, but I want it to stay correct no matter where the camera and focus object move to.
I'm using Blender 2.90, Cycles.

You can add a single bone armature object, set it as child of your mesh. Bone lenght 1 meter. Then create an empty in the same location of the tail of the bone and parent it to the bone (Ctrl P - bone). Then set a damped track constraint to the bone, targeting the camera. Then set the empty as focus of the camera DOF.


How can I export or print coordinates of each selected vertex? I am pretty new to Blender. I need to get coordinates of each selected vertex somehow. I don't really want to manually copy coordinates of each and single vertex that would just take a lot of time. I need them either printed somewhere or save them into some kind of text file.
Again I need only those vertexes I have selected, not the entire model.

Open up a new Text window and copy and past the following.

import bpy
import bmesh

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)

bm.faces.active = None

# Modify the BMesh, can do anything here...
for v in bm.verts:
    if v.select:
        print(tuple(v.co) )

Make sure you are in Edit mode with the required vertices selected and click "Run Script"

The coordinates of each selected vertices is now printed in the System Console.

If you can not see the System Console select Toggle System Console in the Window menu.

To get this code I used the Bmesh Simple Editmode template from the Templates/Python


Animation: Make object visible I have a curve wich is a graph of something. Now I want to animate the graph to get larger by the time and then being fully visible. Hard to describe, I mean something like this without kamera movement: https://www.youtube.com/watch?v=0jJqYwrjt6s
Thanks for your help!

You need to animated the bevel end factor of a curve object.

Step 1: Add curve and change its shape in edit mode.

Step 2: Set key frames for the bevel end factor in the curves panel

And the result:


How to suspend object's logic in BGE? I want to save performance in a scene which contains a lot of objects with constantly working logic bricks. How to turn it off while the player is not nearby?

You can do it with logic bricks:

Explanation: This logic setting will suspend physics (Edit Object brick/Dynamics/Suspend Dynamics) at the beginning of the game (Delay = 0)
and restore it (Edit Object brick/Dynamics/Restore Dynamics) when an object with a player property is in a 5 blender units distance.


Anti Gravity Movement I'm using Blender 2.68 to create a first person simulator of an astronaut floating around a space station. I'm using WASD to move the camera up, down, left and right and the arrow keys to rotate it.

The problem is as soon as I take my finger off the key the movement stops dead. I want the camera to continue moving after you let go of the key and then using the opposite direction key to slow down and eventually stop and then move in that direction the longer you hold the key to simulate realistic anti gravity movement.

I'm very new to Blender and don't understand the finer points yet. Hope what I've said makes sense.

If you want 0 gravity movement for your character, The first step seems rather obvious: turn off the gravity in your scene. To do this, open the world settings, and set the gravity to 0.

Great! now the scene has no gravity.

But we have a problem - the objects stop moving completely. that should not happen if we are simulating space. This is done by blender as an optimization. Essentially, when blender sees that an object is going slow enough, it just halts it's position (stopping the calculations for that object, freeing up processing power.) Once another object applies a force to the "sleeping" object, the physics calculations will resume for that object. We don't want that, so check "no sleeping" on all objects you want to continue moving indefinitely. This is perfectly fine to do on a few simple objects, but Beware - doing this on a lot of objects or a few more complex shapes could potentially eat up a lot of processing power.

These results are much closer to what we want - but we still have have a problem. The objects are slowly decelerating. Why? This is because of the dampening on each object's rotation and location, set by default. This dampening is normally to simulate air resistance, which adds to the realism on most games. We don't want that resistance here, so we can also set the dampening to 0 on the character. (Here I'm setting the dampening to 0 on both example objects, do this for all the objects you don't want to slowly lose velocity.) Changing or eliminating the angular or linear dampening should not significantly effect performance.

Now we have (for this question's sake) realistic 0 gravity movement. Now to add thrust. This is actually simpler than it might sound.

All you need is a logic setup like this.

(The X axis is forward on this example object, which is actually bad practice - it should be the Y axis. adjust your logic setup depending on which direction is forward on your character.

This setup ignores the rotation of our example cube, it only controls linear velocity. To make it work with rotation, simply use a similar setup, but influencing torque instead.


Custom Fresnel with separate wavelength input How can I create a Fresnel effect taking in consideration the custom wavelength curve generated on refractiveindex for a more accurate fresnel effect in cycles.

. The simple IOR input isn't reflecting accurately enough what happens in reality.

I can think of two approaches, either adjust blender's code and build your own version. You may even be able to get your changes accepted into the official blender sources.

Or write an osl script that calculates the way you want. As a starting point the official fresnel node is implemented as -

shader node_fresnel(
    float IOR = 1.45,
    normal Normal = N,
    output float Fac = 0.0)
{
    float f = max(IOR, 1e-5);
    float eta = backfacing() ? 1.0 / f : f;
    float cosi = dot(I, Normal);
    Fac = fresnel_dielectric_cos(cosi, eta);
}

And you can find fresnel_dielectric_cos() here


Disable Material Duplication Anyone who has used Blender for a while has probably tried to duplicate a scene via Full Copy. They would have then found that in the duplicated scene, all of the materials were duplicated as well, receiving that infuriating .001 ending. Normally, one might be able to change all the materials back to the originals and then reload the file (as suggested here) to get rid of the duplicate materials. I can do this, but I have A LOT of material slots in my project, and the work is incredibly boring.

So basically, my question is...

Is there a button, script, feature, or anything else that would disable the duplication of materials when I duplicate my scene.

Note that if the answer is a script, I will need to be walked through how to use it as my Python skills are about a -52. :)

You can run this script to replace all duplicated materials in your file. Just paste it into the Text editor and click the Run Script button.

It searches all objects, and then compares the first part of the material name (the part before the .001 suffix) with any materials named the same, and if a match is found replaces the object material with the matched material.

The idea would be to do a Full Scene copy and then run this script to remove all material duplicates.

import bpy
mats = bpy.data.materials

for obj in bpy.data.objects:
    for slt in obj.material_slots:
        part = slt.name.rpartition('.')
        if part[2].isnumeric() and part[0] in mats:
            slt.material = mats.get(part[0])

Before running the script, make sure your materials are named properly. Any material that ends with .001, .002 or 003, will be replaced by its "original version".

Credit for script goes to user liero on  this BlenderArtist.org page

Ctrl + Shift + O finishes the job by reloading the file.


GPU not rendering in Cycles I can't get my GPU to work on any scene.

I have enabled both my CPU and GPU for Cycles rendering. But during render CPU usage gets to 100% and GPU does not go up (below 5%).

Here are my settings:

I tried unchecking the CPU in preferences, and in that case 10% of my CPU is working on the rendering.

The scene I am working on is not the problem because, I tried other scene, like the BMW benchmark for GPU. And still the GPU is not working.

I have all Nvidia drivers up to date (Game ready and Studio).
I tried Blender 2.82a, and 2.83 no difference

I am looking for a solution, thank you for reading this.

Same here.

Just a quick note: Windows Task Manager doesn't show CUDA utilization by default (which is what Cycles uses). To have that show up, click on the "3D" above the graph and choose "Cuda" or "Compute_0" in the drop down that pops up. It will then show correct utilization.


Combining multiple textures with a white background I'd like to sort of "overlay" these shaders, but the only options are mix and add. Allow me to explain.

I made two images, both white background, one with red scribbles and one with blue scribbles, both 1920x1080. Image textures plugged into diffuse was my node setup. I want both scribbles to be added to the plane while the background stays the same color.

If I mix them I get the following:

The red and blue scribbles are now 50% dimmer than they would be on their own, and the white color hasn't changed in intensity.

If I add them I get the following:

The red and blue scribbles are still 50% dimmer than they normally would be (since the white background is being added over each). But the white background is now 2x brighter than normal.

Can I get a result where the white background is normal brightness and both the blue and red scribbles are at normal brightness?

Here's an example with two images with a white background:

To keep the white and mix the two colors you can use a Color MixRGB node with Multiply as the transfer mode. Then plug that to only one Diffuse BSDF shader:

Using Multiply as the transfer mode (quoting from the wiki)

Returns a darker result than either pixel in most cases (except one of them >equals white=1.0). Completely white layers do not change the background at all. >Completely black layers give a black result. The "opposite" to Screen mode.

More info here


Bake hair particle system to textured low-poly mesh I got a scene with a lot of fur (really dense hair particles). There are 1000 particles x 750 interpolated ones (with clump curve and kink) per object. Obviously, this is really slow to render and takes too much RAM to render it on GPU or on a render farm.

My idea is:

Create a low-poly mesh consisted of a bunch of planes (like trees in games) that roughly fits the object. It would be nice to adapt those planes in iterations until they really fit the fur.
Unwrap the mesh
Bake all the essential information of the particle system to a texture. Each part of a hair should select the closest (best fitting) plane and gets baked to it
Render the scene in almost no time at all

I'm pretty sure this isn't possible since I am searching for something similar for a while, but are there ways to at least approximate this workflow or parts of it? The only thing I found is this one but I don't know how to use it and if it works in my situation.

I have a technique which might be unorthodox but very efficient.
The idea is to deform your mesh into its UV map while keeping the hair attached to it, so you can render it into a UV texture :

I've used this technique on one model so far and it worked well.
Here's a part of the result :

Downsides

it doesn't perform well on long or clumped hair
it renders noticeable seams on the islands borders

How to prevent them as much as possible:

Prefer sculpting (combing) your hair manually instead of using the Clump property
use as few UV islands as possible. For that, I strongly recommend avoiding Blender's built-in UV unwrapping (which introduces important distortions) and instead, using the SLIM algorithm. You can use it by either installing the original standalone program (not the best because it requires to triangulate your mesh and split the seam edges) or better, by building the Blender SLIM branch (much easier to play with but might be harder to install depending on your OS). Hopefully this amazing algorithm will get implemented in an official release some day.

Now, to deform your mesh into its UV map, you need the UV Shape add-on (not yet updated for 2.8).
Once you have it enabled :

duplicate your model
put the copy on another layer
select your edge seams (select only one and then click on Select > Select Similar > Seam)
perform an Edge Split
in Object mode, select the UV map you want your mesh to deform into
in the Extended Tools tab of the tool shelf, enable "Use Active
Map"
leave "Rescale Islands" enabled to keep hair density consistent
click on "Create UV shape". This creates a shapekey. The hair should deform well with the mesh. Personally I did it with a rabbit's fur and it worked perfectly. Tell me in a comment if that didn't go well for you.
select the created shapekey
in Edit mode, top view, pack your islands in a square (in 3D view of course).You can rotate islands but don't rescale anything or the hair density will change.
create an orthographic camera and put it on top view
adjust the orthographic scale so the flattened mesh fits in the frame
project UVs from view
in UV/Image Editor, ensure the UV map fits the UV square. If not, don't rescale directly in the UV/Image Editor. Instead, zoom or unzoom your ortho camera and reproject UVs.
remove any lighting in your scene and set the World color to white
Render with the orthographic camera
Save the image

Now you can bake this texture on the original UV map :

on the non-original model, create a simple diffuse material with
the rendered image as the color texture
select the non-original model and then the original
bake the diffuse color from selected to active (make sure you have an
image node selected to bake into)

and voilà !

You can even render a hair normal map using a camera normal material :

Although you may want to combine it with the normal map from the hi-res mesh if you have one (I have to add a screenshot on how to combine normal maps with Cycles nodes)


How can I navigate the viewport using Python? Normally, with most actions that you want to script with Python there is a pop-up tooltip that shows you the function that you want to use.  However, for viewport navigation there are no pop-ups, you use the mouse directly for everything (scrolling to zoom, middle-click-and-drag to pan).  How can I navigate the viewport with Python?

I would suggest not to call operators at all, these are rather cumbersome way to interact with the view, Instead manipulate the view directly.

If you write an operator you can access the viewport like this...

v3d = context.space_data
rv3d = v3d.region_3d
rv3d.view_location.x += 1.0

You may also want to treat the view as a 4x4 matrix since in some cases this is more convenient since you can multiply it with other matrices to combine transformations, accessible from the view_matrix.

See RegionView3D API docs

To get started you may want to try things out in the python console...

For this you need to specify the absolute path to the 3D region.

In the Scripting screen layout you can run this from the console or editor...

rv3d = bpy.context.screen.areas[2].spaces[0].region_3d
rv3d.view_rotation.rotate(Euler((0, 0, 0.1)))
rv3d.view_location.x += 1.0
rv3d.view_distance -= 1.0

We have a template of an operator that edits the view in the text editor Operator Modal View3D


How can I get the location of an object at each keyframe? I'm trying to track the (x,y,z) location of an animated object. For a small test, I translated the default cube ('Cube') along the x axis and baked keyframes. The animation plays fine.

I adapted the suggestion for this question to try and print the location at each keyframe.

import bpy
cube=bpy.data.objects['Cube']
for f in cube.animation_data.action.fcurves:
    for k in f.keyframe_points:
        pos=cube.location
        print(pos)

Run from the shell, the output is

<Vector (0.0000, 0.0000, 0.0000)>
<Vector (0.0000, 0.0000, 0.0000)>
<Vector (0.0000, 0.0000, 0.0000)>
...
<Vector (0.0000, 0.0000, 0.0000)>

If I go to the last keyframe and execute cube.location, it correctly returns

Vector((6.924227714538574, 0.0, 0.0))

How can I get the location at each keyframe?

The reason your script was returning 0, 0, 0 is because you were printing the location of the object on the current frame.

Basically your code says:

  Print the location of the cube object the same number of times as there are number of keyframes.

So as mentioned by kilbee you need to set the scene frame to the frame that the keyframe is on in order to read the location of the object on that frame.

By combining your code with kilbee's:

import bpy

ob = bpy.context.object

for f in ob.animation_data.action.fcurves:
    for k in f.keyframe_points:
        fr = k.co[0]
        bpy.context.scene.frame_set(fr)
        pos=ob.location
        print(pos)

This way you only check frames with keyframes, as opposed to checking every frame.


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

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

So from the error message I assume that except commonly known way of adding an active image to the object material, it is possible to bake to external file directly, if material is not really needed.

I would like to know how to bake to an external file in Cycles without creating a material with active image?

I am using 2.77 and still don't see that option to bake to an external file,anyway i found this and it's probably what you want

bpy.context.scene.render.bake.filepath = "/tmp/baked.png"
bpy.context.scene.render.bake.save_mode = 'EXTERNAL'
bpy.context.scene.render.bake.use_split_materials = True # or False

or
bpy.ops.object.bake(filepath="/tmp/baked.png", save_mode='EXTERNAL', use_split_materials=True, ...)

source : blender repo


Rotating blender texture So I wanted to make a circle with lines on it like this, going this way.

But when I set up my nodes (like this),

the lines looked like this

I want to find out how to rotate the image but it is using blender's "wave texture node" And I can't seem to find out how to do that.

How do I rotate it?

Before your Wave node, put in a Texture Coordinate node (using generate) and this goes into a Mapping node. You can then modify the rotation (depends on your orientation) but here is my setup with a before shot and after shot

Before:

After:


How can I add UV coords to a mesh from script? I am adapting an old script to Blender 2.6, the script reads mesh data from a custom file type and then creates a mesh array with that data.

I managed to make almost all of it, but U can't set the UV values of each vertex to the mesh.

I create the mesh array like this:

for i in range(0,numeroparts):
    malla.append(bpy.data.meshes.new(name="2k_Part"+str(i)))
    uv = []
    xyz= []
    for j in range(0,numerovertxpart[i]):
        line=file.readline()
        x,y,z,u,v=float(line.split()[0].replace(',','.')),float(line.split()[1].replace(',','.')),float(line.split()[2].replace(',','.')),float(line.split()[3].replace(',','.')),float(line.split()[4].replace(',','.'))
        uv.append((u,v))
        xyz.append((x,y,z))
        print(x,y,z)

    aa = []
bb = []
cc = []
faces= []

for j in range(0,numerofacexpart[i]):
    line=file.readline()
    a,b,c=int(line.split()[0]),int(line.split()[1]),int(line.split()[2])
    faces.append((a,b,c))
    aa.append(a)
    bb.append(b)
    cc.append(c)
    print(a,b,c)

malla[i].from_pydata(xyz, [], faces)

for q in range(len(malla[i].polygons)):
    #malla[i].faces[q].mode |= Blender.Mesh.FaceModes['TWOSIDE']
    #malla[i].faces[q].transp = Blender.NMesh.FaceTranspModes['ALPHA']
    #malla[i].faces[q].uv=Mathutils.Vector(uv[aa[q]]), Mathutils.Vector(uv[bb[q]]), Mathutils.Vector(uv[cc[q]])

My problem is here, the lines commented out are how it worked in Blender 2.49:

for q in range(len(malla[i].polygons)):
        #malla[i].faces[q].mode |= Blender.Mesh.FaceModes['TWOSIDE']
        #malla[i].faces[q].transp = Blender.NMesh.FaceTranspModes['ALPHA']
        #malla[i].faces[q].uv=Mathutils.Vector(uv[aa[q]]), Mathutils.Vector(uv[bb[q]]), Mathutils.Vector(uv[cc[q]])

Below you find a very well-performaning solution to set mesh UVs from a source in a per-vertex format to Blender's per-loop (face corner).

This assumes you have a sequence of float pairs (UV coord),
e.g. ((0.2, 0.1), (0.8, 0.9), (0.2,0.1), ...).

import bpy
from random import random

me = bpy.context.object.data

# Sample data
vert_uvs = [(random(), random()) for i in range(len(me.vertices))]

me.uv_textures.new("test")
me.uv_layers[-1].data.foreach_set("uv", [uv for pair in [vert_uvs[l.vertex_index] for l in me.loops] for uv in pair])

Original thread: Importing UV coordinates


Why is the cursor not at the expected position? In this configuration, where the bottom edges of this object are at world origin coordinates (0,0,0), and this edge has a length of 0.196m, why is the cursor not at the expected position when I give it a 0,0,0.196 location?..

What's the right way to put the cursor where I want it to be?

Answer was simple enough: dimensions of the object have been manually changed, it messed with the scale of the object and Z scale value was a little bit under 1.0. Distances appear to be mesured before taking scale into account.


how to match the scale and position of background images I am having issues with two background images not being scaled to each other. One is set to front view with the dimensions of 310x506 pixels. The other is set to the right view with dimensions of 124x506 pixels.

Both Images have offset x of 0.00 and offset y of 5.00 in Background Settings.

I create a plane centered at location 0,0,0 and in both views the object is lined up but if I change the z to line up with the top of the image in the front view it doesn't line up with the top of the image in the right view.

What is causing this and how to I fix it?

I deal with background images by setting them to the same size before starting Blender in an external image processing package like Gimp. In your case, Ixd adjust the right view by enlarging the front view by padding the right view by adding 93 pixels on both sides of the image, so that the right view has the same dimensions as the front view, that is 310 x 506 pixels. This will make it easier to line up the images with the views.


Does fspy add-on work in blender 2.81? I have tried installing fspy in blender 2.81, however it says it is 'installed' (as can be seen in attached image) but then doesn't appear in add-ons list, and hence cannot be enabled.

You installed the wrong file; you need to install fSpy-Blender-1.0.3.zip
 (or newer) from the Releases page.

The file you're using, fspy-Blender-master.zip is likely the source code and doesn't work as addon.

It's not very clearly stated on the page and it's easy to download the wrong file(I had the same issue :)


How do I bake a texture using Cycles bake I created a interior scene and  i don't know how to bake a texture using cycles bake.

With out more detail about the situation, it's hard to say how you might go about this if there are any special considerations.

Here are the basics:

UV unwrap your object.
Create a new image in the UV/image editor (Alt + N or Image > New).
Add a texture node to the objects material(s) and select the new image. If there are more than 1 material repeat this for each one of them (easier to copy that Image Texture node and paste it into all materials):

With the texture node selected, press bake in Properties > Render settings > Bake:

The color and shading on that object will be rendered to the image specified in the selected texture node.

If you switch to textured shading once this process is complete (for each object), the viewport will look something like this:

See the wiki for more detail about the various options.

If you want to bake multiple objects to the same image:

UV Unwrap your objects in such a way so that the UV maps don't overlap. An easy way to do this is by pressing Space> Smart UV unwrap or Space> Lightmap pack with all the objects selected.
Bake each object with Clear disabled so that the existing pixels in the target image aren't erased before the baked shading is overlayed.


Working with big numbers I want to extrude a shape from an SVG file, then create its negative (boolean with a scaled cube).

I can do the obvious steps if I scale and move the shape. The real problem is that the SVG file works with big numbers (in the millions). I can not zoom out enough to see the object(s) in their original size but it would be important not to change the coordinate-space.

You can set the 3D View far clipping distance in the properties panel (press N in the 3D view to toggle it),
and/or
the Camera far clipping distance in the Lens section of the Camera tab:

By the way, it's limited to maximum 10 000 units (or 10Km), so I don't think it'll works nice with objects having scale in millions.

You should consider scaling down the objects by a factor you know (say, *0.001):

select all objects (press A)
press S, then .001
then, left click to confirm.

If you want to control the scale center point in order to keep relative coordinates of the objects, you can place you 3D cursor where you want and choose 3D cursor pivot center before scaling your objects.


How to assign different material for instance objects I have an object and I made instances of it, but everything is connected, shape & material...etc, how to assign different materials to those instanced objects ??

You can assign materials to objects, rather than their data...

... it's the little dropdown on the far right, just above 'Deselect'.


Normal map bake result for humanoid mesh projects arms on torso I'm trying to create a normal map of my high-resolution sculpt to my low-resolution mesh, but I'm getting weird results.

As the scene is setup, the high-res and low-poly meshes are overlapping each other, almost perfectly as can be seen below. But when I bake the normal map, I get weird results. Below, you can see the arms being projected onto the torso of the character, some distortion also occurs on the chin.

How can I resolve this?

Bias in Baking settings means how far away (in blender units) from the surface the geometry will be captured onto the baked texture.

If the value is too high that may cause capturing additional information that is perpendicular to the surface within the set Bias.

To fix that problem you can zoom into the model and use the grid to estimate the distance to avoid capturing unwanted detais.


blender 2.79 : Even after fresh install, no filmic color management options present Unfortunately I do not have the new option in the "Color Management" section of the "Scene" tab.
- The "Look" dropdown shows None only
- The "View" dropdown shows Default only

I chose Cycles as the renderer and tried both, CPU and CUDA.
I tried also the supported and experimental.
I wiped off all blender installs of my computer and did a fresh install.
No success.

Is there any hidden switch that enables these options?
Does anyone else have this issue?
Any hints on how to troubleshoot this?

System details:
 Windows 10 Pro (10.0.15063)
 Core i7 5820K,
 16GB RAM
 nvidia GeForce GTX 760

GOOD NEWS: SOLVED!

I figured it out: I am having three shortcuts that open blender. 1) Windows Startmenu, 2) Link on my desktop, 3) A shortcut on my ObjectDock Bar.
The latter is a Mac-style start bar  (by Stardock).
When I am starting blender from the ObjectDock shortcut, it seems to start blender in a different environment / with different permissions, where I am not aware what it is in detail (it is not the working directory).
- I started blender 10 times from there and had no filmic option available.
- I started blender 10 times from the desktop and startmenu and every time the options showed up as expected.
It was difficult to figure that out, because I randomly used one of these three shortcuts - so I randomly had the issue.
THANKS!


"Spikes" are created when I add a sub surface modifier to my model, even though everything in edit mode seems to be alright Just like my title says, I add a sub surf modified to my model and I get these weird spikes. Its like an intersection gone wrong but I am not sure what is going wrong and what I should even be looking for... Lots of 3D experience, but very little Blender experience.

I was having trouble with duplicate edges just before this started happening, so I deleted all of the bottom edges and started over. Its built pretty simply so I am not sure where its going wrong... Quite simply I just want the bottom edge to be smooth, so that is my ultimate goal.

Also, on a side note, not sure what the red lines are around the other bottom edge. I believe it is a bevel or fillet of some sort but I don't remember what I did to get it on there...

Thanks in advance]1
[]2
[]3

To remove the spikes press  Space  search for "remove doubles" then hit  F6  to open the setting popover and adjust the merge distance to something like 0.03 to merge vertices that are very close to each other. That should take core of the spikes

Your main problem is that the overall topology of your mesh is not ideal for subdivision. For clean subdivision your model should be predominantly quads.

There is a good article on different types of modeling by Gleb Alexandrov that you can view Here


script for rendering a simple scene I am beginner in python script with blender. To start, I write a script to render a simple scene using the cycle engine and a fisheye camera. here is my script:

import bpy
from mathutils import *
from math import *
#delete the cube
bpy.ops.object.delete(use_global=False)
# Add a camera fish eye.
bpy.context.scene.render.engine = 'CYCLES'
bpy.ops.object.camera_add(view_align=True, location=(0, 0, 2.5), rotation=(0, 0, 0))
bpy.context.object.rotation_euler[0] = 0
bpy.context.object.rotation_euler[1] = 0
bpy.context.object.rotation_euler[2] = 0
bpy.context.object.data.type = 'PANO'
bpy.context.object.data.cycles.fisheye_lens = 2.7
bpy.context.object.data.cycles.fisheye_fov = 3.14159
bpy.context.object.data.sensor_width = 8.8
bpy.context.object.data.sensor_height = 6.6
#Add a lamp.
bpy.ops.object.lamp_add(type='POINT', radius=1, view_align=False, location=(0, 1.5, 2.5),
layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.data.shadow_soft_size = 0.01
bpy.context.object.data.cycles.cast_shadow = True
#Import the model .mhx in the scene
bpy.ops.import_scene.makehuman_mhx(filepath="/Users/xxx/Documents/MakeHuman/v1/exports/scene1/person1.mhx")
#Set the rendering parameter
bpy.context.scene.render.resolution_x = 1360
bpy.context.scene.render.resolution_y = 1024
bpy.context.scene.render.resolution_percentage = 50
bpy.context.scene.frame_start = 1
bpy.context.scene.frame_end = 2
bpy.context.scene.frame_step = 1
bpy.context.scene.render.pixel_aspect_x = 1
bpy.context.scene.render.pixel_aspect_y = 1
bpy.context.scene.render.use_file_extension = True
bpy.context.scene.render.image_settings.color_mode ='RGBA'
bpy.context.scene.render.image_settings.file_format='PNG'
bpy.context.scene.render.filepath = "/Users/xx/Desktop/pythonscript/"
bpy.context.scene.render.image_settings.compression = 90
##sampling;=path tracing
bpy.context.scene.cycles.progressive = 'PATH'
bpy.context.scene.cycles.samples = 50
bpy.context.scene.cycles.max_bounces = 1
bpy.context.scene.cycles.min_bounces = 1
bpy.context.scene.cycles.glossy_bounces = 1
bpy.context.scene.cycles.transmission_bounces = 1
bpy.context.scene.cycles.volume_bounces = 1
bpy.context.scene.cycles.transparent_max_bounces = 1
bpy.context.scene.cycles.transparent_min_bounces = 1
bpy.context.scene.cycles.use_progressive_refine = True
bpy.context.scene.render.tile_x = 64
bpy.context.scene.render.tile_y = 64
#insert the walls
#1)the floor
bpy.ops.mesh.primitive_plane_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.dimensions[0] = 4
bpy.context.object.dimensions[1] = 4
bpy.context.object.dimensions[2] = 0
#1)Wall 1
bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 2, 1.25), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.dimensions[0] = 4
bpy.context.object.dimensions[1] = 0.05
bpy.context.object.dimensions[2] = 2.5
bpy.context.object.location[2] = 1.25
bpy.context.object.location[1] = 2

#Render results
bpy.ops.render.render(animation=True)

I remark that the image rendered using the GUI and using the script are different.

You created a second camera, but you didn't assign it to be the camera for the scene:

--- /var/tmp/se1.py     2015-06-22 16:37:30.703514909 -0400
+++ /var/tmp/se2.py     2015-06-22 16:41:47.687236739 -0400
@@ -14,6 +14,7 @@
 bpy.context.object.data.cycles.fisheye_fov = 3.14159
 bpy.context.object.data.sensor_width = 8.8
 bpy.context.object.data.sensor_height = 6.6
+bpy.context.scene.camera = bpy.context.object
 #Add a lamp.
 bpy.ops.object.lamp_add(type='POINT', radius=1, view_align=False, location=(0, 1.5, 2.5),
 layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))

You might also want to set your frame_end=1 instead of 2.

Another strange thing about this script is that it keeps creating new objects, so you can't run it repeatedly in the same scene without weirdness (probably some Z fighting) as objects and lamps accumulate.


mesh=obj.data error when no object is present I experience the following error when no object is present on the layer:

Traceback (most recent call last):
  File "C:\Users\info\Desktop\untitled.blend\studioTools_Shelf_Beta v2.py", line 352, in draw
AttributeError: 'NoneType' object has no attribute 'data'

location: <unknown location>:-1

This is part of the object shading class I wrote.

class ObjectShading(bpy.types.Panel):
    bl_label = "Viewport Shading"
    bl_idname = "ObjectShading"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = "Shading Toolbox"

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

        mesh = obj.data

        row = layout.row()
        row.prop(mesh, "use_auto_smooth", text="Break Edges")

Do I have to build in a switch that in case no object is present on the layer this class is ignored meaning the object shading tab is not evaluated? Similar to the switch here:
Ray visibility panel

Here is what I learned and this approach works - I am just curious if this is the way one should do it or if in this case a better idea should be used.

class ObjectShading(bpy.types.Panel):
    bl_label = "Viewport Shading"
    bl_idname = "ObjectShading"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = "Modeling Toolbox"

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

        mesh = obj.data

yeah an if / else construct is fine.

def draw(self, context):

    obj = context.object
    if obj and obj.data:
        # do one thing, if it has data
    elif obj:
        # probably an empty, an object without data
    else:
        # show something in the case of no object selected

Study the poll functions of the UI scripts that come with Blender to get an idea of common practices. Though the poll functions are usually to completely prevent panels or menus from showing or stopping Operators from executing. You'll find the same logic in place for hidding sections of a menu / layout.

Also be aware that sometimes you should be checking for context.active_object rather than just context.object.


Twisting rectangle with text surface I'm trying to do something similar to this is Blender:

Animation here: https://www.instagram.com/p/BqQKtNmHsCw/

I can get the shape and animation to look quite similar based on the linked answer, but how do I actually add the text uv texture to my object?

I gave it a try:

Start with a Bezier Circle (Add > Curve > Circle)
Add a cube and change the x-dimension to 2 * pi. You can calculate directly in the input field and you can use constants like pi. It should be 6.28 m and so it fits the circumference.
In Edit Mode gave the cube some additional loop cuts with CTRL+R. Scale the cube to your liking, but keep the x-dimension. In scale-mode press Shift-x to lock scaling on that axis. Delete the end faces. It should look like this:
Edit: Make even more subdivisions ;)
Add a Simple-Deform-Modifier. Set it's mode to Twist, the Axis to X and the Angle to 360°
Add a Curve-Modifier. Due to our calculation it fits perfectly.
To animate the twisting you can animate the cubes x-rotation
For Texturing unwrap your cube and place your stripes on the text created in an image editor of your choice.
You can animate the texture later. Therefore you can rotate every second stripe around 180° to let them move in opposite directions.
To animate the texture set up your material and animate the x-location.

Hope that helps! ;)


How to join a camera to an object? I'm modeling a phone and need to have a camera positioned where the phone camera is, when I try to join the camera and object it fails with a message telling me the camera doesn't have any mesh data. And all my google searching just brings up how to make a camera track an object which to be clear is not what I am after - I need to simulate the constant position and rotation of the front camera on a phone with respect to the LCD display when the entire phone is moved.

Parenting the camera to the object will solve this problem. You can do this by selecting the camera first, and then selecting the object you want to parent it to. You can parent by pressing CtrlP, and then selecting object (keep transform). This should fix the problem.


Nvidia GT 610 is not recognized I have a dedicated graphics card in my pc (Nvidia GT 610), running windows 10 pro.
But it's not detected in Cycles render settings. Pls lemme know how can i render in GPU. Kindly refer to the attached screenshots.

.

Your graphics card has a CUDA compute capability of 2.1, however GPU rendering in Blender 2.8 requires a compute capability of 3.0. That is why your graphics card isn't listed.


Why the addon installation succeeds but the API is not accessible through the bpy module? I have compiled Blender 2.79b as a Python3 module on Ubuntu 16.04 LTS. I install an addon using bpy.ops.wm.addon_install(), enable it using bpy.ops.wm.addon_enable(module='packageName) and save the user preferences using bpy.ops.wm.save_userpref(). However, after I open Python3 again and do import bpy I cannot see the addon API's being added to the bpy module. If I run the same exact "addon installation" script when using Blender with the GUI everything works fine, but not when I have compiled Blender as a Python module. So I wonder, does anyone know whether I'm doing something wrong and how I can fix this?

In case you're wondering, I am trying to install Armory addon and below is the script I used to do the installation:

installArmory.sh

wget -O armsdk.zip https://www.dropbox.com/s/a17prr2hzsjkfog/armsdk.zip?dl=1
python3 installArmory.py

installArmory.py

import bpy, os, zipfile

with zipfile.ZipFile("armsdk.zip","r") as zip_ref:
    zip_ref.extractall(os.getcwd() + '/')

# Install the addon
bpy.ops.wm.addon_install(filepath=os.getcwd() + '/armsdk/armory/blender/addon/armory.py')
bpy.ops.wm.addon_enable(module='armory')

# Set the SDK path
user_prefs = bpy.context.user_preferences
addon_prefs = user_prefs.addons['armory'].preferences
addon_prefs.sdk_path = os.getcwd() + '/armsdk'

bpy.ops.wm.save_userpref()

I think I could find a way around this but I don't think this will work for all addons that require restarting Blender, but it works for Armory.

Here are the steps:

# Install the addon
bpy.ops.wm.addon_install(filepath=os.getcwd() + '/armsdk/armory/blender/addon/armory.py')
bpy.ops.wm.addon_enable(module='armory')

# Set the SDK path (Armory-specific)
user_prefs = bpy.context.user_preferences
addon_prefs = user_prefs.addons['armory'].preferences
addon_prefs.sdk_path = os.getcwd() + '/armsdk'

# Use the `start()` function of `bpy.ops.arm_addon` to enable it.
bpy.ops.arm_addon.start()

Now arm shows up in bpy.ops. I don't think all addons have a function like start() that Armory has.


Blender's "Right" View is actually a "Left" view? "Front" view is actually "Back"? I'm working with a bunch of tools that each have separate coordinate systems and I'm having some confusion about Blender.

For example, add a Monkey to a scene and then examine the Quad view. You should see something like this:

Notice the following:

The Top view looks at the object from +z pointing to -z and sees the top of the object
The Front view looks at the object from -y pointing to +y and sees the front of the object
The Right view looks at the object from +x pointing to -x and sees the left of the object

In my mind, either the Right view should be relabeled Left OR the model itself should be rotated 180 degrees about the Z axis and the Front view moved to by pointing in the -y direction from +y. In that case, all of the views would point from + to - along the axis (consistently), and the labels for the views would all correspond to intuition.

What is the right side of a house? Or a bed? Or a keyboard or TV? Does the text in a book go from the left side to the right side, or from the right side to the left side?

Even if there's a clear agreement on what the front of an object is, what is considered the left or right side depends on the type of object, so there's no way to have a convention in Blender that always works. What we consider the left side or right side depends on how we humans typically interact with the object.


Is there a way to increase visibility of the "Edge lines" in blender 2.8 I'm currently following a tutorial using blender 2.8. As you can see in the pictures the "edge lines" are much more visible in pre 2.8 which makes it a lot easier to see the direction of the edge loops. Is there any way to change this so it becomes more like the old interface?

Cheers!

You might want to display different behavior in the sub-mod.

The old one you mention let both these option turn on, making the sub-modifer directly show in edit mode.


Invisible and black faces after switching from Cycles to Blender render engine It seems that something about the way I have jumped between Cycles and Blender render has caused issues with a file. I am new to render engines and not that experienced in Blender in general, so I have been disorganized about things and have ended up having to jump around.

Right now I want to do up this model with a diagram feel, so I switched from Cycles back to Blender render, in order to do up some flat materials and make them shadeless and such. I switched off nodes on the materials, and when there seemed to be issues, I deleted all the materials thinking maybe redoing them would help. The new materials have been assigned to the individual faces that have them.

The model renders pretty well. (It has a few issues due to quickie geometry but I can live with them for now.) But in Materials, Texture, or Solid view there are a lot of faces that turn black or xray - they make the things behind them in the same object invisible, as well as themselves. Recalculating normals has helped in some spots, but not others. In the case of the mirrors, selecting the mirrored faces and flipping those normals had no effect, or made the face x-ray. I checked for non-manifold geometry, and that isn't the cause. I get the feeling it is a normals issue, maybe I'm wrong.

I do have a version of this file from before the Cycles materials were added, but I wanted to know if there is a way to correct this.

render view looks mostly right

material view makes the mirror face black, other faces on that object invisible, and faces at the top of the tube x-ray

Cycles materials are node materials, and the majority are not compatible with Blender Renderer. Changing them back to "normal" materials by toggling the nodes in the material tab under preferences view will fix their "blackness".


Contextually grey out panel element in python 2.8 I have a panel with split column.  In the 2nd row is 3 boolean variables.
I want to grey out the 2nd and 3rd option by default.
I want the 2nd to be changeable if 1st is true, and 3rd to be changeable if both 1 and two are true.
I've read something about "poll()" but not how to actually use it, or set conditions.
Physics should only be enablable if singleMesh, and destructable only if physics enabled.

    # Create two columns, by using a split layout.
    split = layout.split()

    # First column
    col = split.column()
    col.label(text="Building Size:")
    col.prop(bpy.context.scene.user_vars, 'buildingHeight')
    col.prop(bpy.context.scene.user_vars, 'buildingWidth')
    col.prop(bpy.context.scene.user_vars, 'buildingDepth')

    # Second column, aligned
    col = split.column()
    col.label(text="Dynamics:")
    col.prop(bpy.context.scene.user_vars, 'singleMesh')
    col.prop(bpy.context.scene.user_vars, 'enablePhysics')
    col.prop(bpy.context.scene.user_vars, 'destructable_Building')

#EDIT This is what the specific solution to my example looks like.
col = split.column()
col.label(text="Dynamics:")
col.prop(vars, 'singleMesh')
sub = col.row()
sub.enabled = vars.singleMesh
sub.prop(vars, 'enablePhysics')
sub = col.row()
sub.enabled = vars.enablePhysics
sub.prop(vars, 'destructable_Building')

Set UILayout.enabled

  UILayout.enabled

  When false, this (sub)layout is grayed out

eg enable subrow in a row if context object has rigid body settings

row = self.layout.row()
sub = row.row()
sub.enabled = context.object.rigidbody is not None
sub.prop(foo, "bar")

Note that context is passed as an argument to draw methods.  Get out of the, IMO, bad habit of always addressing from bpy ie if in a draw method def draw(self, context): use context in method code not bpy.context.

The poll method works on a per Panel or Menu or Operator class et al case.  The following will ensure FooPanel only draws when there is a context object.

class FooPanel(bpy.types.Panel):

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

panels that don't poll don't show. Operators are disabled if in layout but don't poll.  It is important to have a  poll method in most cases.

Re versions, both layout enabled and poll method are avalable in all versions >= 2.50.


Material is not showing in solid mode? I was trying to apply a material to the object but it does not show up in Solid mode when I switch to Material mode the color shows up.

Solid Mode:

Material Mode:

Scroll to the very bottom of the Materials panel, go to Settings and use the Viewport Color. ;)


What is a sensible scale to work with? I know the unit in Blender are arbitrary, e.g. you can have one unit represent 1cm, 1ft or 1 mile.

I'd like to know if there's an advised (community or otherwise) scale that I should work to.

Are there any issues that might occur from basing your scale too high or too low. e.g. 1 unit = 1mm or 1 unit = 1km?

By default one BU = one meter.  This is a pretty reasonable size to go by as a rough guideline.

If you are modeling artistically you probably don't need to worry about units too much, but you should try to keep everything from ending up very small or very large, which could cause clipping issues in the viewport, making it difficult to work with. Though if this does happen, it's not hard to scale everything up/down.

If you are working precisely with units, then you can always set them the way you want in Properties > Scene > Units:


Rigify can't generate my rig Rigify can't seem to generate my rig because of an issue relating to the nose. It says "bpy_prop_collection(key): key "ORGnose" not found. Which is weird if you ask me because there are nose bones placed on Van's face (The character)

You probably deleted bones from the face. Rigify needs all of the facial bones to generate the rig.
Or you may have disconnected some of the bones that need to stay connected.
I have made a video about the face rig
https://www.youtube.com/watch?v=n8aCBKjPJRE
There is also a whole playlist of videos where I tried to explain how to avoid most of the annoying errors that Rigify throws at you.
https://www.youtube.com/playlist?list=PLdcL5aF8ZcJv68SSdwxip33M7snakl6Dx


How do I get my file to export as a .stl? I can't export my object as an .stl.  I started with a UV Sphere and I used a boolean modifier on it and joined other objects to it. I removed doubles, re-calculated normals, tried triangulation, selected the object when exporting. Nothing works and the .stl file is empty. I also uploaded it to https://netfabb.azurewebsites.net/ and it was rejected. Any suggestions?

The Local View is enabled for this object in your file.

  Local view isolates the selected object or objects, so that they are the only ones visible in the viewport.

manual page

Press NumpadSlash to exit it, select the object and try exporting again.

A side note:
- although you recalculated normals some of them are still inverted (the bottom);
- the topology of the mesh is a bit off, especially on the bottom, which can cause unexpected results when triangulated.
- scale of the mesh isn't applied (which can also be undesired);
However, this doesn't affect your current problem directly.


Problems with object orientation and angled array I need my glass panels to stick to the metal frame of my building. The axes are set to global and I've tried CTRL+A and CTRL + ALT + SPACE but nothing works.

I need my Y arrow to be perpendicular with the object and the X arrow parallel so that the glass panels array in a straight line without having to change other values in the relative offset setting

Select two vertices,
Change Transformation Orientations to Normal,
Press the add button in the Transform Orientations panel then
Select new normal, ie Edge, in the drop down list.

In Object mode, shift+S > Cursor to selected,
Shift+A  > Empty > Plane Axes,
Set the constraint as shown in the figure and
Move Empty object using added normal(Edge).


View UV seams over creased edges I'm currently UV unwrapping a model with creased edges. The problem is, when I mark UV seams on the same edges that I have creased, the edge is only highlighted in purple, for the crease, but the red highlighting for the seam does not show up. Example:

In the above picture, both indicated edges are seams but the bottom one does not have the red highlighting. While the seams still work when I unwrap, it is really inconvenient to have to remember where I put them.
Is there some way I can either change the draw order of these two overlays or make both appear at the same time?

You will need to alter the code used to build blender to make it draw the highlights differently.

You can however toggle the display of each highlight separately, so you only see one at a time. In the 3DView Properties region N you can find the mesh display panel -

Note that the mesh display settings are unique to each object, not a global setting.


Solidify Modifier: how can I remove the inner mesh in a complex artifacts? First of all I want to specify my final goal: use the Solidify Modifier in order to create a cage.

I think that my workflow, used since now,

Duplicate my low poly
Alt + S with the new mesh (i.e. cage)

isn't the way to achieve the best result, because it creates too much distorsion and doesn't preserve the original shape of my low poly, in particular with hard surfaces' meshes.

Therefore I found the solidify modifier that works pretty well. There's only one problem that i will show you with an easy example:

1) This is my High Poly

2) This is my Low Poly

I duplicate my Low poly and then with my new mesh (cage) I apply the Solidify Modifier in order to cover my high poly. The problem is that the solidify modifier double the mesh. In the final result i have my low poly, high poly and the cage, with 2 "meshes" (not divided, they are still a unique mesh in the Outliner) one inside the other like in the image below.

How can i delete the inner mesh?

In a simple mesh could be easy, like this cube, but when i have complex artifacts?

Not sure if I understand correctly but I think you may be misunderstanding what the Solidify modifier does.

It creates thickness on an object by duplication it's faces and offsetting the  by a specified distance along its normals. This makes it two sided, and creates a new set of faces virtually "duplicating" your object.

That being said you may use it for what you want by activating the options Fill Rim and Only Rim, that way only the distorted "cage" will be created, and no duplicates will be found.

Edit

See an example of an open area bellow where additional faces are created.

Have you tried the Smooth modifier instead? It wont create additional faces, and will have a similar offset effect, though it may cause some distortion in tighter corners.

Edit 2

Apparently the user's problem was with selecting linked geometry in edit mode.
You could apply the Solidify modifier with the Fill Rim option unchecked, and then enter edit mode and either hover one of the unwanted vertex and press L or select one of the unwanted vertex and press Ctrl + L to Select Linked