How to use Spirals after Patch 2.7 Hi my question is how do i add Turns, Radius and Height as will be seen in the picture below.

As you know if you want to use spirals you need to have them on as an addon and its really easy to use but now its different from the new version, in the old one it looked like this:

And here you see the old spiral tab which is easy to use and change your spiral and to place a spiral you just had "spirals" as an extra object but now you got this:

Here under "Curve" as expected you see all the spirals under "Curve Profiles" and "Add Curve:spirals"  which were also in the older version but under the Spiral tab as "Spiral Type" but now because they moved all the spiral types and removed the Spiral Tab i don't know where i can change my spiral like in the number of Turns, Height and Radius.

All of the options are there, just select Add curves Spirals (it doesn't matter which one, you can change them later.

The options are on the toolshelf.

It the toolshelf is not open you can press T to access it. Or pRess F6 to get a floating window with the same options.


How can I make the outside of a sphere transparent I want to make the outside of a sphere transparent so that when I'm looking at it, all I see is the inside of the opposite face. If I'm close enough to the sphere that I can only see a small section of the outside then I want to look through that section and see the majority of the inside of the sphere. To do this I just need to make it so the sphere is transparent when viewed from the outside but that the inside face is visible.

This can be done using the technique from my answer here, but with just a transparent shader for the "outside" material:

This setup makes the frontsides of faces invisible to camera rays and the backsides of faces invisible to non camera rays.


Blender 2.8 (Python) - convert text to mesh I would greatly appreciate any tips and/or sample scripts on how (in Python / Blender 2.8) to convert a text object into a mesh object.

The laziest way to do it is to use the same operation that the Alt-c performs when done interactively : bpy.ops.object.convert(target="MESH") .  Unfortunately, this shares the problem of every function in bpy.ops.  You have to set up the interactive environment (what object is active/selected).  It would look something like this:

import bpy

def mission1(obj):
    scn = bpy.context.scene
    for o2 in scn.objects:
        o2.select = ( o2 == obj )
    scn.objects.active = obj

    bpy.ops.object.convert(target="MESH")

mission1(bpy.data.objects['Text.001'])

If there is a way to accomplish this without using bpy.ops, I was too lazy to dig it up.


Create and render a cube in python from the commandline? So after googling and testing(updating from <2.8) several scripts to no avail[0], how can I create and render a cube in python from the commandline?
blender -b -P blender_basic_example.py
#blender_basic_example.py
import bpy

def strVector3(v3):
    return str(v3.x) + "," + str(v3.y) + "," + str(v3.z)

# create a new cube
bpy.ops.mesh.primitive_cube_add()

# newly created cube will be automatically selected
cube = bpy.context.selected_objects[0]
# change name
cube.name = "MyLittleCube"

# change its location
cube.location = (0.0, 5.0, 0.0)

# done
print("Done creating MyCube at position " + strVector3(cube.location) +
      " with name " + cube.name)

But where's the rendered picture?
[0] Rendering a cube as png file using Blender's Python API

add
bpy.ops.render.render(animation=True)

at your end of your python code
Basically you've done all right - the cube will be created. You just forgot to tell Blender to render it out.


Shading issue with textured solid model Seems like something went wrong here.
Already tried to re-unwrap the wrong displayed parts of the mesh, also changing shading mode from smooth to flat and back to smooth. It still looks like this:

However, it seems like it actually doesn't have to do with the material shading. What else can I do to let it being displayed correctly?

Recalculating the normals did NOT work. It still only appears in "textured solid", pure solid mode shows the model like it should. Else no errors in the texture itself.

 .blend-file:

You have a vertex color layer on the object which is causing this.
Remove it in Properties > Object Data > Vertex Colors:


Blender 2.8 - light / lamp object I must be missing something completely obvious.

In Blender 2.8, starting with a new scene (File > New > General) I am looking at a cube, light and camera.  The light doesn't appear to do anything.  If I move the light, nothing changes.  Changing the settings for the light doesn't seem to make a difference, nor does changing the render engine.

I would like to get the light working, so that I can see shadows.  The shadows should move when I move the light.  I should get different results when I change the type of light or its settings.

Your suggestions would be appreciated!

Make sure the Eevee render engine is turned on, and make sure you're using the rendered view and not solid view. the light should affect the cube after that (although if you want reflections or anything you need to turn that on in screen space reflections)

If this doesnt work it may be due to hardware limitations


Is chromatic aberration possible in blender Can I separate individual colors of an image/video and add another color around it in other position to achieve chromatic aberration

You can fake Chromatic aberration in the Compositor.
Just add the Lens Distortion node and adjust the Dispersion value.


Blender render engine is rendering just part of an object When I zoom out in the view window, my object is not being shown entirely.

Can anyone help understand why this is happening and how to fix it?

My Hardware specification:
i7 2.80GHz
NVidia GTX 1050 4GB
8GB RAM
Windows 10

As pointed out by @rcgauer in the comments, it is a duplicated => post Where can the viewport clipping parameters be changed?

I just changed the end clip property in the View group as suggested by @adhi post linked above and it worked fine.


How to improve topology around an E-pole? I'm trying to find a way to make the area around the E-pole less stretched (marked in blue on the pics below) while keeping the mesh geometry as clean as possible. Is there any solution or method I could apply?

Just for info, the selected part in white will finally be separated from the rest.

As I'm quite new in 3D modelling, let me know any flaw you might notice on my model. Thanks in advance for your helpful feedback.

I think I finally got it right by simplifying the mesh a bit. First, I dissolved 3 edges-loops parts on the left side which were not contributing anything to the geometry. Then, I added 3 new vertical edges to the bottom face-loop with the knife tool. By doing so, the E-pole moved a bit higher on the left and is now no longer pinching (see pic below).


Inheritance of objects With bpy, how could I make a subclass of an Object and use it ?

I made a subclass of bpy.types.Object, but I don't know how to add it to my scene. The only way I know to add objects is using bpy.data.objects.new.

But I don't see any way of adding a subclass.

As the Blender Documentation states:

  Those of you familiar with other Python API’s may be surprised that
  new data-blocks in the bpy API can’t be created by calling the class.

As you stated, that makes bpy.data.objects.new the only way to create new objects.

For my purposes, I created a new class which did not inherit from bpy.type.Object but defined a self.object property and initialized it with the new function. I then wrote all the methods I needed and modified self. object inside them.

I defined one base class, and then one additional class for cameras, lamps and objects:

class ExtendedObject():
    def __init__(self,name,  obj, loc):
        self.name = name
        self.object = obj
        self.object.location = loc
        # additional properties

class ExtendedCamera(ExtendedObject):
    def __init__(self, name, loc):
        self.data = bpy.data.camera.new(name)
        super(ExtendedObject, self).__init__(name, bpy.data.objects.new(name, self.data), loc)

# classes for lamps and 'normal' objects.

I don't know if this is the best way to do it, but it worked out for me.
Hope that can help you. If not, try to describe me the purpose of your class.


How to keep clean geometry, when beveling boolean cutouts I want to model this gun:

So I started to cut out the rough shapes from a cube (using the boolean modifier)
Then I tried to clean up the geometry to be able to round the edges of the handguard.

But it does not work. When I try to bevel it like in the last pic top right it just gets really messy.

I think I took the wrong approach. How would you go about adding clean and workable geometry to such a piece and would you use the Bevel tool to create the round shapes?

The artifacts are caused by beveling too tight geometry.
It good to keep some space near edges specifically for beveling.


Object Info returns 0. Random materials for different objects According to the blender documentation:

  The Object Info node gives information about the object instance. This can be useful to give some variation to a single material assigned to multiple instances, either manually controlled through the object index, based on the object location, or randomized for each instance. For example a Noise texture can give random colors or a Color ramp can give a range of colors to be randomly picked from.

https://docs.blender.org/manual/de/dev/render/cycles/nodes/types/input/object_info.html

But how do you actually achieve the effect mentioned in the description? When I try randomize the texture for multiple objects the value of the location, object index or random output of the object info always returns 0.

I found the mistake myself. The object info values are only applied once the scene gets rendered. Therefore I could not see any changes myself in the editor.


Low poly normals when baking with Cycles Blender novice here. I'm trying to make some models to use in the Unity3D engine.

I modeled a high poly tube and the low poly counterpart. Now I'd like to bake the normal map from the HP to the LP in order to make it look better. Unfortunately the normal map is horrible, it seems that I somehow tried to bake from the lowpoly to the lowpoly.

I followed this process:

Make the high poly
Make the low poly
Unwrap the low poly
Switch to Cycles renderer and assign a 1024x1024 image
Switch to Normals under Bake
Bake
..
no profit?

This is my high poly and perfectly smooth tube and its counterpart, the low poly and perfectly jagged tube:

This is the result from the bake with "Selected to active":

I may have been missing something during the process. What could be?

Firstly, make sure everything is smooth shaded. Then see to it that all normals are facing in the right direction. Or you can simply go to Edit Mode and press Shift+N and normals will align to the face direction. If this does not help you, check your UV and make sure there are no overlapping UVs.


Which is faster: A math node tree or an OSL shader? In terms of render times for Cycles materials, which is faster? A material node tree containing many (~20-50) math nodes or a single OSL shader script node performing the same calculation.

Answer is hard to give, so I will rephrase the question to will an OSL script node eventually be faster than an SVM node graph with math nodes. The answer to this question is yes. Then the next question, when will this benefit happen. this one depends on many parameters. Would I recomment to migrate to OSL script fore solely this reason? No.

I did a test on this subject. As GPU depends on many other stuff I will stick to a SVM CPU vs OSL CPU comparison.

Specs of my test machine:

Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 cores)
Running on Linux
Using official Blender 2.79 release

Test scenes

I constructed 5 scenes for this test.

SVM-0: SVM without the math nodes

SVM-math: SVM with the math nodes

OSL-0: OSL without the math nodes

OSL-math: OSL with the math nodes

OSL-scipt: OSL with the script node

The scene uses around 12 math nodes. I used the emission shader as it will not scatter new rays.

SVM-0  SVM-math | OSL-0  OSL-math OSL-script
------ -------- | ------ -------- ----------
22.90  25.86    | 25.47  27.70    26.05
22.87  25.80    | 25.40  27.64    26.01
22.86  25.84    | 25.38  27.68    25.99
22.92  25.84    | 25.42  27.65    26.04
22.91  25.79    | 25.44  27.63    26.04
-----  -------- | ------ -------- ----------
22.892 25.826   | 25.422 27.660   26.026

What is important in these numbers:
 - SVM average time in the math nodes is 2.934
 - OSL average time in the math nodes is 2.238
 - OSL average time in script node is 0.604

SVM math nodes scales linear. Meaning adding more math nodes will add on average a constant performance penalty.

There is a positive effect on using script nodes. Where is the theoretically break even?

((26.026-22.892)/0.604)*12=62.2649

But different scenes will have different results. For example: the test scenes are constructed that the shader is full screen. Normally you have many different objects and materials in the scene. So let's calculate the number of samples that are needed.

1920*1080*128*62.2649 = 16526399569.92 # resolution * samples * breakeven

On my machine the benefit would happen around 16,526,399,569.92 samples that pass though a node graph where 62 mathnodes were replaced with a single script node.

Note: on different machines different things will happen and that can influence the results.

There are also other stuff to be aware off: SVM codebase is fully shared between CPU/Cuda/OpenCL. As GPU's don't have the ability to have a stack the cycles developers
came up with an idea to implement a fixed stack that could compile on all devices. This stack is limited to 256.
When node graphs get too large SVM will not become an option anymore so the artist might want to switch to OSL.

Would I still recommend it?

No. reason: other materials setup have other cost penalties in OSL. So this theoretically benefit in practice might be much higher. So for this reason I would stick to SVM.


Animating water surface from .csv temporal xyz data I am looking for a tool to create nice animations from the output of my numerical model. So far I have gridded xyz data points for both the surface elevation and the elevation of white-water above the surface. So two x,y,z .csv files for each time step. Each file would have around 600,000 points and depending on the frequency of outputs, up to 10,000 time-steps to animate.

I'm looking for a way to import these into blender, generate a surface and create a nice animation. In the end I'm aiming for realistic looking water. Is there a way to accomplish this in blender, or should I look for another application? Thanks!

There is this .csv import script: BA thread (which might or might not work for you)

This is related: Csv Import pointcloud into Blender

If your data format is really custom and nothing helps, you have 2 options:

Export something standard which blender and other software understands (I recommend):

.mdd Lightwave point cache file (load into MeshCache modifier)
.pc2 point cache file (load into MeshCache modifier)
.obj sequence imported as mesh shape-keys: BA thread

Write a custom importer script that can interpret your custom .csv data.

Blender API
There are templates for import/export scripts in Text Editor
You can see other scripts and how they work in \<blender version>\scripts\addons\ - also good to see how formats from option 1 work


Getting to a file easily/quickly in blender's file browser I have become used to the convenience of the following when searching for and opening a file in Windows (7)

Start typing the name of the file into an edit box and have files beginning with the same characters start showing up as a list underneath
Type part of the file name wrapped in asterisks (like *orange_tex*), press enter, and have the list of files filtered based on that wildcard.

But I find that Blender's file browsing page (the page you're on if your loading a texture into your scene, for example) is difficult to use if you're in a directory with a large number of files in it.  You kind of have to know the full name of the file or sort by file name alphabetically and scan visually for it.

So I am wondering if there is actually something built into this file browser that I'm not aware of that will make it easier to find a particular file quickly within a large list.   Does anyone know of such a thing?

Blender's file selector doesn't support this kind of filtering, but since you ask this question, here is some related functionality.

You can use Tab to auto-complete when typing a file name as you would in a shell..
You can also filter files by typing wildcards into the filename field *. followed by an extension eg foo*.blend, project*.*. When you press Enter, this will highlight all files with the extension in the current directory. (you can use A to clear the highlighting).
When opening files, you can use the filters available in the header to help narrow your search etc..

Search (Addon)

There is an addon that can further help you when searching for files called File Browser Search. It presents you with a list of results that matched your query.


Why curve modifiers deform my mesh I have this: a plane, as you can see.

Object mode:

And a Curve:

When I try to create a rolling mat effect, using the curve modifiers, the plan is deform like this:

What I want is to keep the mat dimensions. Thanks.

Check the radius of each control point of your curve and set them to 1. You can select all of them and set the "mean radius".

Most likely you scaled down or up your curve then applied the transform. This actually keeps the curve at the same position but changes the radius of each control point.

Note : You can deactivate the use of the radius of control points altogether by toggling "radius" in the curve properties. That means any deformation using this curve will consider every control point with a radius of 1 :


How to attach the Character to a moving base I'm trying to create an elevator, I use Character's physics, Character goes up normally with the elevator, but when descending it goes down slower than the elevator, I already used a script to increase gravity, and Character got heavier than the elevator, however, when he steps in the elevator during the descent, the character bounces. I tried to parent them, but I couldn't get Character to respect the collision of the elevator walls.
And I realized that it is also a problem for me to create a platform that moves, because the Character keeps falling due to the speed.
Thank you for your time, God bless you!

I think this is what you are looking for : walk around and stick to animated objects.blend

Original Blender.Artists Thread link here

Video showing the following script in action here

THIS SCRIPT DOES NOT WORK WELL WITH CHARACTER PHYSICS!

USE DYNAMIC PHYSICS INSTEAD!

# Walk and stick on animated objects and planets v3
# by cotaks

# w,s,a,d and spacebar to move

# able to walk speheres and animated objects:
# like elevators/platforms/planets/beveled cubes/etc.
# when you jump off one of the objects, it will automatically turn +z axis back up

# it' a small script but very adjustable, i added more comments then script itself haha
# have fun with it.

from bge import logic

# from player origin to the floor
heigth_offset = 1.0

# length of the raycast
# increase this to be able to jump higher before falling of an object
# (also tweak jump force(brick) and (lower) gravity force)
ray_distance = 0.5

# creates some player gravity, default 30.
# (lower ables to jump off objects, higher means you can jump at all sides of the object)
# adjust the player jump force(brick), or adjust the gravity_force, i suggest keeping it 20+
#just experiment around with it till you are statisfied with the results
gravity_force = 30

def cast_ray(own, vector):

    total_distance = ray_distance + heigth_offset
    return own.rayCast(vector, own, total_distance)

def stick_to_it(cont):

    own = cont.owner

    vector_z    = own.worldPosition - own.worldOrientation.col[2]
    ray_z       = cast_ray(own, vector_z)

    if ray_z and ray_z[0] is not None:

    # this could be usefull if you use python for movement, stops the sliding
    # if you use this make sure you add a + to line 48 and 49 (so it becomes +=)
    #own.linearVelocity.x = 0
    #own.linearVelocity.y = 0

    # creates some player gravity
    vector = -own.worldOrientation.col[2] * gravity_force
    counter_gravity = own.applyForce(vector,False)

    # match our speed with the ground speed (add a + before the = if you use the above code)
    own.linearVelocity.x = ray_z[0].linearVelocity.x
    own.linearVelocity.y = ray_z[0].linearVelocity.y

    # align to the floor
    own.alignAxisToVect(ray_z[2],2, 0.3)

    # counters default gravity stops sliding down from the sides with player friction at 0
    # if you use player (material) friction (default 0.500) then you can remove this line
    own.applyForce((0,0,9.8*own.mass),False)

else:
    # put head (z axis) back up
    own.alignAxisToVect([0,0,2],2, 0.1)

def update_physics(cont):
    # for the (animated) object(s), or any object that needs to update it
    # (if you want to walk on animated objects(with bones) they need this part)
    # always(true pulse)-python(module)-scriptname.update_physics
    # if you have multiple animated objects, your better of making using for loop here
    # if you use it remove the own.reinstancePhysicsMesh() and uncomment the for loop code
    # with the for loop the animated objects needs a property called: update_physics
    own = cont.owner
    own.reinstancePhysicsMesh()

#    if not 'update_list' in own:
#        own['update_list'] = [obj for obj in own.scene.objects if 'update_physics' in obj]
#
#    for obj in own['update_list']:
#        obj.reinstancePhysicsMesh()

Just add this script to your character like that :


Installing sculpting brushes permanently I wonder if there is a way to install brushes (sculpting ones) to be accessible all the time when I open Blender. I know I could APPEND these and use them but everytime I close Blender and then start it up again I have to repeat the process.

Found out that I should be able to append them and save the Startup File but it does NOT work for me. Any ideas?

Sincerely, Jan

You'll need to set fake user for all appended brushes and then "Save Startup File".


Import Image with Drag and Drop as Plane I will import a lot of images to my project. Drag and drop is easiest way to do that for me. But if I drag and drop any image to my screen it been importing as background reference by default. How can I change this setting to "drag and drop image as plane that visible to render"? I don't want change visibility setting for each image every time. I want drag, drop and render.

To import a lot of images at once ... it is much faster to use included addon Images as Planes, just enable it in User Preferences. Addon imports multiple images, you can set a basic material and set distance between images to bring them organised
Note - by drag&drop you import only one image per drag, then you will have to convert Empties to Planes (as pointed by Jachym Michal)


How to spread objects along axis? I have a set of closely positioned objects. I want to make animation of spreading them along one axis with preferably equal gaps. I don't want to use parenting because i want to be able to rotate them freely around they centers later.

What is the simplest way to do this. Can it be achieved with animation nodes plugin or do i have to use only Blender animation curves and make all movements manually?

The following animation shows what i want to achieve with small number of objects.

Two keyframes will suffice, if the centers of the objects are already spread out in the correct order.

Check the manipulate center points button.

⇧ Shift RMB select the objects.
Press I and choose Location to keyframe the location.
Move the cursor in the timeline to the second position. I have the dopesheet open to see the created keyframes.
Press S to scale the objects. Because of the Manipulate Center Points only button, the objects will only be moved, but not scaled. You can constrain the movent to a specific axis, by pressing S>X, S>Y or S>Z.
Repeat 3 to insert a second keyframe.


Different ways to call an imported function from a separate py file, returns error Not sure if this is a normal python behaviour or a Blender thing

I have a file named operators.py and a file named functions.py.
also a __innit__.py that calls the operators.

Method 1 :

in functions.py:

def someFunction(self, context):
    print("I did it!")

in operators.py:

from functions import someFunction

and then later I call the function with:

someFunction(self, context)

The above resulted in:

ImportError: cannot import name 'someFunction'

Method 2 :

in functions.py:

def someFunction(self, context):
    print("I did it!")

in operators.py:

import functions

and then later I call the function with:

functions.someFunction(self, context)

The above resulted in:

AttributeError: module 'functions' has no attribute 'someFunction'

So blender did get and import the module but it can't get the functions working.

Your function seems to be in a class (guessed from the self parameter).

Method using self are meant to be used on instances.

You should either instanciate the class it belongs to in order to have an instance on which to call the method, or make the function static, or make the function a module function (out of a class definition).

Also the package init file should be named __init__.py, not __innit__.py.


Face color from distance to object, regardless of origin? I'm using the node setup from this answer:

Particle color distance to empty in Eeevee?

Is there a way of having this to work without needing the origins of the affected object to be at the center of the world?

Yes. This made me realize the setup from my answer is not optimal. You want to simply get the length of the vector from your empty to the pixel on your mesh :


Creating a 3D object from a side and top view outline? So, I have some knives with handles that I'd like to 3d laser-engrave pockets for the knives into wooden cutting boards, using bump maps that I generate with Blender.

I have traced the side view and the top view of the knife, and from those two dimensions, I should be able to create a 3D model that I can export as a bump map.

Any ideas on how to do this? I'm pretty new to this.

Thank you!

One way of doing this is to first start with a clean blender file, then in the 3d view press N to open up the side editing panel. Then scroll to the bottom of the panel, and check the box next to the "Background Images". After opening it, add your reference images (top and side view). Then change the "Axis" to be the correct view for each of your reference images. After that, you will want to add in a plane. After rotating the plane 90 degrees along the "y" axis and setting your view to the top orthographic view, you should now see your reference image with the plane near it. In edit mode, and in wireframe view select you whole plane and move, scale, and rotate it so that it matches up with one side of your knife handle.  Then with the whole plane selected use E to extrude G to translate R to rotate and S to scale until you have a rough outline of your knife handle which should look a little like this: It is important that when extruding, and applying your transformations that you have the entire face selected, and not just a row of vertices. After you have done this, you can leave top orthographic view, and apply a subsurf modifier. Don't change any values yet, otherwise it will be difficult when scaling your knife to see the side view. Now go into side orthographic view, and using the values in the side panel translate, rotate, and scale your reference image until it is the correct size of your model. At this point, your height will most likely not match your reference image. It should look somewhat like this: Then scale the knife handle along the "z" axis until the size matches your reference image. Now you will want to adjust the view value on the subsurf modifier to be higher (I used around a 5) to get a smooth knife so your normal map will not look jagged (smooth shading will not do anything in this case). It should look like this:  You are now done with modeling, and it is time to make your normal map. First set the origin of the knife to the geometry by pressing Shift+Ctrl+Alt+C. Now press Alt+G to center your model. Now add a plane and scale it up to just be slightly bigger than your knife handle (press Alt+G to center your plane as well). This plane will be what you bake your texture to (it simulates the top of your cutting board). Now go into edit mode with your plane selected and press U to UV unwrap the plane, then press Unwrap. Now open up a UV/Image Editor, and a Node Editor panel. In the UV/Image panel select Image, then select New Image, then set the resolution to something 4k or higher (4096x4096) then click Ok. You should now have a black image. In your Node Editior panel (with the plane selected) add a new material, then add a Image Texture node, and load your new black image into it. Now in the Render section of your Properties panel scroll all the way down and under Bake change the Bake Type to Normal. Then check Selected to Active and change your Ray Distance to 1.000 (you may need to increase this value if your texture dosen't bake properly). Now in order to bake your texture make sure you have your Image Texture node selected in the Node Editor. Then select your knife handle, then Shift click your plane, so that both are selected in that order, then click on bake. Your black image should now be transformed into a normal map of your knife. To save it, in the Image Editor click on Image, and select Save As Image. You are now done and it should look something like this:

  Edit: I just realized that you said Bump Map and not Normal Map. You should just be able to convert the Normal Map to a black an white image to get your Bump Map.

I hope this helped, if you are interested in learning more about modeling, or just Blender in general, I would recommend watching Blender tutorials on YouTube. That is how I learned everything that I know today (and it's free). A great person who makes Blender tutorials is Andrew Price, I would recommend checking him out on YouTube if you wish to learn more. Good luck on your cutting board project

-Tom


Tilting a specific section of non-uniform curve I'm new to Blender and am trying to model a bracket for 3d printing.
I need to bend the highlighted section of the model. The lowest point of the bend should remain fixed and the elements connected to the top part of the bend should maintain their relationship.
.. I hope that makes sense..?
I have tried attaching the model to a mesh, as well as the 'simple deform > bend' modifier but so far either i'm doing it wrong, or these are the wrong tools.
Any help would be greatly appreciated!
I want to take this highlighted section of the model:

And bend/lean it so that the top section tilts about 2mm to the right (the total hight of the model is 150mm)

Thanks in advance!
GK

The easiest way to do this is just by selecting the entire top section, moving your camera to the side view using 1, 3, or 7 on the number pad, and rotating with r and transforming with g. Other than that the only thing I can think of is rigging, which might be more trouble than it's worth in t his case.


Sewing clothes using a cloth modifier and a collision object I am trying to model clothes in Blender. I've looked at several tutorials, but the sewing option in Blender doesn't give the desired result. I've been trying it over and over again, but it doesn't seem to work. If anybody could be so kind to check what I am doing wrong, that would be greatly appreciated!

There seem to be a number of issues causing you problems here.

The most important one seems to be simply that the garment is too small for the model - it is quite literally coming apart at the seams :

To resolve this you need to scale the dress so as to give it more fabric to fit around the body.

The above issue is made worse as the collision bounds are such that the cloth isn't actually getting close enough to the surface of the body - the Outer collision setting on the model is currently set to 0.1 meaning that there is a significant gap between the skin and the dress - which further compounds the issue of insufficient cloth to fit! Try changing that to, say, 0.02 for a better fit.

Another issue is the strength of the sewing - currently you have the sewing springs set to 10 right from the start of the animation. This means that the full force is being applied from the first frame, pulling the cloth violently together. Once this overcomes the collision bounds the cloth is below the surface of the body and cannot escape, resulting in fighting between the vertices until the cloth is eventually torn through the model - it's better to apply the forces gradually to gently bring the edges together. This allows the cloth to settle into place rather than being forced together quickly.

The trick is to set keyframes to control the forces more carefully, starting at zero and increasing over a number of frames. One problem with this is that the cloth will naturally fall under the force of gravity before it is pulled together but, again, keyframing gravity to gradually increase can avoid this. In fact, it's useful to start with a weak reverse gravity (eg, weight of 0.5) to that the cloth initially floats gently up, before increasing back to full gravity after 10 or so frames after it has settled.

After this, it should just be a matter of a little bit of fine tuning - such as giving slightly more space around the arm holes and moving it up slightly so that the arm holes can close up around the arms without colliding, changing the collision bounds slightly (reducing Cloth collision settings to 0.5 seems to give be. You could also increase the cloth Quality steps and also collision Quality.

Here's the result :

There still seems to be a bit of overlapping vertices on the shoulders - I think this is due to the arm fabric intersecting with the shoulder. Adding slightly more cloth should do the trick. You could also subdivide the cloth to add more detail for a more realistic fit - although this will slow down the simulation.

Here's the amended Blend


Copying and Pasting Fcurve modifiers Through Python I posted this on blenderartist.org, but to no avail.

I want to be able copy the Fcurve modifiers applied to ShapeKey drivers and paste them onto their counterparts on other objects, the other object's ShapeKey drivers.

This is manually quite simple to do; as in, you just copy the all the fcurve modifiers on a Driver from the graph editor, select the other object and again in the graph editor paste them whichever fcurve you want, in this case, its drivers... But with scripting in Blender, it turns out to be an enigma, whereas there is only the ability to add and remove an fmodifier to an fcurve, example:

bpy.data.shape_keys['Key'].animation_data.drivers[0].modifiers.new()
bpy.data.shape_keys['Key'].animation_data.drivers[0].modifiers.remove()

But bpy.ops.graph.fmodifier_copy() seems unbelievably tricky and seems not to play well within a script, like I think you need the area type to graph editor and invoke the command, which sounds pretty redundant.

And since the Blender API is almost totally devoid of real-world examples explaining the application of its commands and procedures, I'm totally stuck. I searched far and wide, even tried digging through other scripts.

How can I accomplish this task?

I don't think it is possible to get/set the active fcurve / driver. So you can not override the context for bpy.ops.graph.fmodifier_copy

You might use from_existing and adjust the data_path attribute from the returned driver accordingly if you want to copy the driver or try out this script:

import bpy

sk = bpy.data.shape_keys['Key']

source = sk.animation_data.drivers[0]
target = sk.animation_data.drivers[1]

for mod in source.modifiers:
    copy = target.modifiers.new(mod.type)
    for prop in mod.bl_rna.properties:
        if not prop.is_readonly:
            setattr(copy, prop.identifier, getattr(mod, prop.identifier))


Gravity simulation doesn't work (Cloth Simulation) my object isn't falling down in the cloth simulation I run. I didn't found any solution on the internet. I'm sure it's a simple one tho...

Thanks in advance,
Tobi

I'm a little new to Blender, so I don't know if this will help, but you can also try checking the Gravity in the Scene Properties tab.  According to the Blender documentation, the default setting should be -9.810 to simulate Earth's gravity.
Good Luck!
Source:
https://docs.blender.org/manual/en/latest/physics/forces/gravity.html


How to create a dashed line? What is the simplest way to create a horizontal or vertical dashed 2D line in Blender?

Just for fun, you can use a simple plane with the Array modifier :).


I'm getting no output from the Image node when using sverchok Nothing on output in Image node (Image Decompose too). I have tried different types and sizes of images, but still can't get result from this node. May be there is some special requirments on images used with this node?

Screenshot:

And this is how it should look when node function properly:

The Image Decompose node (a beta node) requires the first 2 output sockets to be connected, before it produces any output. The docs mention this: http://nikitron.cc.ua/sverch/html/nodes/beta/image_decompose.html

I wrote this node and admit that this requirement is not the most intuitive, and should probably be revised.

But regarding the Image Node (in Generators), if you open the System Console and see the output of Sverchok you'll get an error, which hints at the problem. A bug.

File "C:\Users\....\sverchok\nodes\generator\image.py", line 112, in process
    if 'edgs' in self.outputs and len(self.outputs['edgs'].is_linked) > 0:
    Node Image had exception object of type 'bool' has no len()

i'll file a sverchok bug report about that -- this is fixed in the next update.


How do I select parts of my model to independently rotate? I'm a noob. I have a 3D scan of a casting of my teeth. I want to select each tooth and rotate them independently, but I don't even know where to begin. I am sure that there is a very easy method to do this, but I don't have a clue what it is.

Thank you in advance for the answers.

:)

TL;DR
Turning your teeth can be somewhat painful, and the results can be ugly! You have been warned!
Summary:

Go into Edit Mode (Tab).
Make your selection somehow (C circle select, for instance).
separate the object (P).
Go back to Object Mode (Tab).
Move the origin to the center of mass (ShiftCtrlAltC)
Rotate somehow (RR for instance).
optional: fill the gaps.

Walk-through:
It's not going to be an easy job: 3D scans tend to be very messy and extremely dense in terms of vertex count! Also: teeth are usually very close to each other and they don't stand on a perfectly circular base area (so it's impossible to turn them without clashes). But you can try :)
This is a very poor attempt at making a set of teeth: say you want to move the second from the right.

Tab to the edit mode, then navigate (zoom in/out by turning the mouse wheel, turn around by pressing the mouse wheel, move around by holding Shift while pressing the mouse wheel) until you have your tooth "aligned" with the view (use Z to change to wireframe if needed). When you have it from the right point of view, hide all the rest from the view, by hitting AltB and making a rectangle.

Now select your tooth vertices with precision. Use C to enable a "circle select" (you control the size of the circle by scrolling the mouse wheel). Add new vertices, then click the right mouse button to exit the selection, then turn around, press C again, and so on. You can always CtrlZ to undo.

Bring the rest into view by using AltB again. Then hit P > "Selection". This will separate your tooth from the rest of the mesh. You can now exit edit mode: Tab.

Select your "loose tooth", hit ShiftCtrlAltC > "Origin to center of mass". Then use RR to rotate: R then Z will help but only if your model is correctly aligned Z-up.

Unfortunately now there is a gap between the tooth and the underlying surface. Filling it is another level of complexity...
A very rough way would be: selecting both your objects (tooth and the rest of your jaw), CtrlJ to join them. Tab into edit mode. A to deselect all. ShiftCtrlAltM to select the boundaries of the two holes. Spacebar > Bridge Edge Loops to fill the hole. The filling wil be very rough though:


Generate 3d mesh from 2d sprite? I would like to know if it's possible to automatically generate a mesh based on a texture. Let's say I have a sprite like this:

And I would like to turn it into something like this:

Doesn't need to be exactly like this example, I'm fine if the mesh has flat colors and a flat surface with no additional details.
Is there a way to create a mesh like this from a sprite, preferably in a non-destructive way? The way I imagined it possibly working is by using a flat plane as the mesh, applying the sprite as a texture and using some sort of modifier to add depth to the plane based on the texture. Is there a modifier of some sort that would allow me to do that?
Bonus: if you know how to add detail to the generated mesh like in the example above, please post it too! I don't personally need it, but I imagine other people might find use for it.

You can use Hair particle system with Cube as Render > Object.
Cubes are emitted based on texture Density.

Sprite to Cubes
Like here your image 16 x 16 px ...

add Plane, Subdivide by 4 to get 16x16 grid, delete one row to get 15x15 faces, because Cubes will be emitted from vertices
add Particle System > Hair, Source > Vertices with disabled Random, Render > Object (assign Cube), Texture > add New and under Texture Properties assign your image, enable ColorRamp (that switch image to Black&White), under Influence enable Density.

Colors per cube should be easily taken from texture.
Like here, I just cant figure out what is wrong with setup in my file.
Edit: If this is still valid https://developer.blender.org/T42706 - emit from vertex is the issue.

Color per Cube
So you would have to go to Modifier Properties > Convert. Join Ctrl+J Cubes (if you want cubes as one object). In Edit mode with all selected Unwrap > From View. Switch to UV layout and in UV Editor switch to Individual Origins and Scale S the UV a bit.

Shader is smart enough ... UVMap is used automatically.

Notes:

You can use plane and use Subdivision Surface Modifier and Particle System after, just se Use modifier stack if enabled under Particle System
You can Separate P by Loose parts back into individual cubes if you need it.
You can use just a Plane (instead of Cube) for whole proces to make it lighter and use Solidify modifier as final touch :)
By default are images interpolated, to keep lowers images pixelated choose in Shader editor in Texture node > Closest. For Particle System Texture go to Properties Editor > Texture > Sampling > Interpolation disabled
in some of my screens is missing one Cube at a hat because I used Mapping > Generated instead UV


Trouble referencing images on local Viewport I'm facing issues when I tried to draw with reference images aside to help with complex topology. I add them in Quad View area, they are fine and appear in local view, but the moment I disable perspective mode, they started to act strange. I don't know what's going on, please help.
(With Display Perspective enabled)

(Without Display Perspective enabled)

Everything was supposed to be well after re-enabling Display Perspective.

When Display Perspective is disabled in the settings of the Empty then it always disappears as soon as you change your view from orthographic into perspective view. Enable it to see the Empty in perspective view as well.
When enabled and the frame is there but appears empty, that's because the face normal (or the orientation axis of the Empty, since there is no real "face") is pointing the other way. Above the Display Orthographic setting, switch Side to "Back" or "Both". At the moment it's set to "Front" but your view is on the back of the Empty. Or you simply rotate it 180° on the Z axis if you want to keep one side transparent.
Another reason if it still doesn't appear is that Only Axis Aligned is checked. This makes the image disappear if the view is rotated off-axis.
Best is you check out all the settings in the red framed area in this image. The settings shown there are the default values.


Lamp energy in BGE does not get higher than 10! Using Blender 2.69. Trying to control lamp strength by setting "own.energy += 1;" in controller script and printing own.energy to console. It works insofar as I can see the lamp changing strength in game mode. However.....
For some reason, the value of own.energy does not get higher than 10! Even if I directly assign 20 or 100 to it! When it starts as 20, as soon as I activate the script it gets back to 10. What can be wrong here??

10.0 is the limit for lamps. You really should not need it that bright. If you do, consider using a Constant falloff instead of a mathematical fall-off. Maybe adjust world Mist values?
Note also that Sun and Spot are the only lamps that cast shadows. And those start and end values have to be set just so.


How do I fix the Problem With Half my Object disappearing? I am having a slight problem with a moon rover I am creating for a game. When I try to render it (in Blender Game) half the object disappears, or becomes hollow.
Here is a picture from camera perspective of the Object in editor:

Here is a picture when I press P to start the Engine:

I am currently using Blender Version 2.74
How can I fix this Error?

Most likely the face normals are facing the wrong way. Select the object that produces error, go into edit mode, select all with A and recalculate normals with CTRL+N.


graph editor - moving key up and down on particular frame is there any option to move a key in one axis up and down in graph editor , like in maya we press shift +click and drag ,

For example if i am moving a key up and down on amy frame its shift's to other frame .

If you grab the keyframe and click X or Y, it will only move horizontally or vertically, like an object in the 3D view.


Where is UV/Image editor I am trying to map a unwrapped cube texture on an actual cube. I found many tutorials that talk about unwrapping the model and working on the UV map, but there is literally no information on where to open the editor in the first place.
So simple question: how to open the editor and view my unwrapped cube?

Just to illustrate Moonboots' comment with a gif :).


How do you make the camera point in the same direction throughout a animation? I am trying to make a animation looking at a building facade. As the camera moves along the path it rotates or points the wrong way.
How do I lock the view of the camera so that it continues to point in one direction and not rotate?
Sorry if this has been asked before
Cheers

Use [Track To] Constraint or perhaps secondly the [Locked Track] Constraint on the Camera.
You can use this constraint as a complement to the camera  moving along a path.
Often you may use a third object to as a target to look at specific locations of another object.  In the building example you could move any non rendered object to focus the track on floors or windows.

These constraints will point the camera at a target which can be moving or stationary.

There are free video tutorials on the settings of these constraints on various websites.  You can also experiment to determine the correct settings for you in a few minutes.


Blender 2.79 not open properly I can't understand blender 2.79b open like this, I am trying to install again but the same problem

Go to File -> Load Factory Settings. It will reset to default layout.

When save this layout by File -> Save Startup File


Blender on Second Monitor suddenly lags I run a 3 monitor setup. I'm on windows 7 with 3.4ghz quad core, 32gig RAM, Titan GTX, and 770. My primary monitor is on the Titan, and the secondary 2 monitors are on the 770. I have been used to running my 3D viewport on the main monitor, and a secondary window on the 2nd monitor (usually node editor) and then a web browser on the 3rd monitor.

My second monitor recently took a knock and started having problems, so I got a new one. The new monitor has become the primary monitor, and the previous primary monitor is now the 2nd monitor. And now, whenever I put a second blender window on the 2nd monitor, it lags horribly and is unusable. If I put it on the 3rd monitor, it works fine (but that monitor is small, so I don't want it there.) Other programs work fine on my 2nd monitor.

What can I do about this? Nothing else about my setup has changed. All drivers are up to date.

Update:
If I switch to a basic theme, the problem goes away. But why is this suddenly necessary when I never had this before?

Update 2:
I have noticed that monitor 3 runs things just fine with no lag. I vaguely remember in the past when I had a different 3 monitors with an older setup (had a 580 instead of Titan) I had the slowdown issue, but on monitor 3 instead of 2. Perhaps it is able to run 2 monitors without slowdown, and my resuffling of monitors means the poor performance is now on current monitor 2, when before it was on monitor 3?

I still don't know the answer to the overall issue, but I have found why this occurred for me specifically.

First, turning off Windows Aero (or doing anything that disables it) will solve this problem. With Aero on, it seems that I get normal performance on 2 of the 3 monitors. In the past, my web browsing monitor was the odd man out. After some flipping things around, I found that whichever monitor was plugged in second (out of 3) will be the one that has issues. So un plugging and re-plugging the screen I wanted good performance on solved the problem, even with Aero enabled.

There must be a lot of variables going on behind the scene that I don't understand, so if anyone ever figures that out I'll be happy to pick a new answer. But for now, this does shed some light on the situation.


How can I simulate Real camera "white balance" parameter in KELVINs There is some presets in Color Management tab under "look" setting or via curves, but no custom setting that can bet set up with kelvins.

'Looks' is meant to simulate the way different films respond to light, not quite the same as white balance.

To render lights at different colour temperature, you can use the 'Blackbody' material node to convert a Kelvins Temperature to an RGB colour:


How to Influence Mesh Positioning According to Bone Movement? The above gif summarizes this question. I'm not sure how it is done, though (but I do have the file of the gif, long story).

The rods seem to elongate while keeping their thickness, and they are acting like they have "Track To" constraints. Could someone please help?

File attached below

If you want to "read" and understand your armature's behaviour, activate the second bone layer and the "X-rays" function in the armature properties panel, then select the colored bones and analyze the bone constraints (IK and damped track).

This Stretch setting is also important for this rig.


Shortcut to switch between layers? I usually use layers in Blender, as you know they are pretty handy. I have been trying to look for a shortcut to switch between layers. Any idea?

Thank you for the help,
W

Use the keyboard
For Top 1 to 10 Layers Press 1222267890

and

For Bottom 1 to 10 Layers Press Alt+1, Alt+2 and so on.

If you're are using a Laptop, Go to File -> User Preferences -> Input -> Emulate 3 Button Mouse and Emulate Numpad


rigid body on windscreen of a car I have a jeep, and I want the windscreen of the jeep to bounce up and down because of the movement of the car between these two positions by using rigid body physics:

I tried using the hinge rigid body constraint, which works perfectly fine to let the windscreen drop down by gravity, but when I try to move the jeep the windscreen doesn't come with it, like it isn't parented anymore. When I select animated in the rigid body physics tab, the windscreen moves with the jeep, but the rigid body physics don't work.

How can I set up the rigid body physics so that the windscreen bounces up and down, but is still parented to the car?

It could work in a way like this (see the example .blend in the linked zip file below):

add an empty with the Z (mandatory!) axis along the axis of rotation you expect for the windscreen
add a (physics) "rigid body" passive setting for the body of the car (or whatever should "hold" the windscreen), set it to "animated"
add a (physics) "rigid body" active setting for the windscreen
set a (physics) "rigid body constraint" setting for the empty and set the windscreen as object 1 and the "body" (or whatever) as object 2
set Z axis limits for this constraint ( I used -5°/+80°)
select windscreen, then the "body" (or whatever) and CTRL-P to parent the them. Do the same with the empty.

now, if the car is animated and then stops, the windscreen behaves similarly to what you expect. You may have to adjust settings, damping, friction, etc.

to see my example, open the .blend in this .zip, and press ALT-A to start the animation: http://amrc.altervista.org/wp-content/uploads/2015/10/rigid.blend_.zip


Baked Texture Map Is Blurry I'm assuming this has something to do with the baked image being too small (but it's 2048), but I'm getting this weird blurring in spots (not to mention, the whole texture is a little blurry up-close). Any idea how to fix?

Here's the whole texture map:

And here's the tiny blurs, too:

"Diffuse" blurry is caused by the texture resolution, but the long stipes of blur are probably caused by the bake advanced settings.

After the texture is baked, Blender apply a margin on the UV island edges. From the manual page:

  Baked result is extended this many pixels beyond the border of each UV “island,” to soften seams in the texture.

Inside the orangish area you can see the texture, outside it the margin. The blurring effect is probably caused by the interpolation between pixel color that occours during the boundary extension.

Margins are not bad. They are useful to hide the seams; problems occour when they overlap with the islands in the neighborhood.

Try to lower the margin size or increase the space between the UV islands  to avoid overlapping in the baked images.


Align Grease Pencil with Camera Angle I placed the camera on a certain position and want to start drawing with the grease pencil, but the lines appears somewhere else. Sure I can move them in front of the camera but I want it to be aligned correctly.
Someone asked here a similar question but it doesn't work for Blender 2.9. anymore.
Attach the grease pencil to the camera
Edit
What I've tried:

I position a new camera and and set it as active camera

set it as active camera and added a blank grease pencil object.

started drawing. looking good for the first impression but

its seems that it's aligned to the first camera

The grease pencil strokes are aligned to the window in which you draw. Strokes will appear in a plane that is perpendicluar to the Z axis of the camera (or to whatever other view you want to draw in).
Here is an example that shows how to draw in camera view (press Numpad 0).

The distance to the camera, in which the grease pencil layer appears, is determined by the placement of the 3D cursor.

Note that the link posted on the question refers to the annotation tool, which is a different tool than the Grease Pencil


Rain 3D Character Rendering Problems so I made a pose with blender's free 3d character rain. I setup the lights and pressed render but this is what I get...
https://imgur.com/gallery/WcE0zWX
The second image shows the render mode, and as you can see her legs are visible. Rain comes with a CloudRig menu in which you can mask/hide her arms or legs. But I didn't do that. Does anyone else has this same issue and how can I fix it?
I used cycles render.
Thanks!

For whatever reason, there is a mask modifier on the GEO-rain_jeans object, set to only visible render. If you remove the mask modifier or disable it, the jeans will render normally.


Should I enable both my CPU and GPU in the CUDA preferences? I am using blender 2.8 on windows 10. I have a question about System CUDA options. There are two checkboxes one for my graphics card GeForce GTX 2060 and another option for Intel Core i7-4790 CPU @ 3.60 GHz. Should I check both boxes? Also I have no open CL option?

It depends if you want to use only your GPU for rendering or GPU + CPU. You will have to test what gives you a better rendering performance. Using a fast GPU with a slow CPU may result in longer render times than using the GPU alone, while a combination with fast CPU may improve the performance.

Currently you shouldn't use GPU + CPU rendering if you're rendering a scene with volumetrics in Cycles, because the CPU implementation of Cycles uses equi-angular sampling and the GPU implementation doesn't. This could result in visible tiling in the render with more noise being present in the GPU tiles.

The OpenCL options are only for AMD graphics cards in Blender. This may be a bit confusing since OpenCL isn't only for AMD products, but Cycles uses CUDA for Nvidia graphics cards, hence the separate configuration.


Is it possible to be able to hold the spacebar to make a player jump higher? Game Engine I would like to be able to have a min jump height as 1 meter, and max jup height as 3 meter. When the spacebar is pressed and released quickly, the player jumps up one meter. When the spacebar is held down for a longer time, the player jumps up 3 meters instead of one.

Is this possible to make in the logic bricks or python for BGE?

Yes, it is possible.

Typically you measure the time between pressed and released. Minimum is one frame, so you will always been able to measure the time.

You need to define how you want to convert the time to jump height (or force or velocity or whatever.

Due to it's dynamic nature I suggest to implement the usage of the result that in Python.


Help me understand why my cycles render is so slow This is NOT about asking how to speed up cycles renders. I am just confused to why a scene has taken so long to render.

Here we go:

I have a camera (WOW) looking up into treetops. Pretty simple. These leaves have subsurface scattering with a black/white texture to apply some change in the colour/subsurface. The trees are a bunch of vertices with a skin modifier, textured. Some simple volumetric clouds. I have a weak volumetrics box to apply a light beam effect surrounding my camera reaching to just above the trees.

For the render settings, I used CPU (I know, kill me. But I started one on GPU and got different results and was just as slow!). Rendered at 4,096 samples at 2,800 x 1,800 (W x H).

I was rendering on a single iMac, which in the past, has done more complex scenes with higher settings within 6 hours easy.

Now for the render time:

99 hours and 52 minutes.

NEARLY 100 HOURS!!! Is it me or is that WAY too long!?!

I would upload the image but it is over 2mb :(

Any reasons into why it is taking so long would be grateful.

I'm not too sure about the implementation of volumetrics in Cycles, but roughly speaking:

without volumetrics, a ray direction must be evaluated only once every time it hits a surface. So the ray virtually travels freely (no computations) through the empty space, then it hits a surface and (if it hasn't bounced back and forth too many times, depending on your "Bounces" settings), it triggers a single new calculation to decide where the ray should move next. Repeat a few times (up to a dozen) until it finally hits a light or the sky.
with volumetrics, every little interval of space the ray travels, the path tracer has to flip a coin to decide whether it will be scattered or not (until it finally gets scattered enough times to reach the "Volumetric bounces" cap). So along its trip there's a LOT of calculations involved.

If your scene is covered for the most part by volumetric regions, this will require a lot of extra calculation per each single ray (and you are casting 20 BILLION rays in your setup!).

Subsurface scattering is also very computationally intense.

So the reason why your render takes so long is that, even if your geometry and your shaders are "simple" (meaning: it took not too long for you to set them up), they are all over the place and are requiring a ton of calculations per ray (meaning: it takes a lot for the renderer to evaluate them)!


Control factor mixing vectors (Animation nodes) I want to add some random location to a circualar array in animation nodes.
The goal is to keep the cubes in the circle.
But I don't know how to control the factor like when using a mix shader in material nodes.

When using 'project', the cubes are placed in within the outer circle. But then there then I also need to clamp somehow to prevent the cubus going inside each other in the middle.

I believe both these options can be solved using the right node? Like a 'map range' node but that one won't connect.

The end result should look something like this:

Simply set max and min vectors then mix it using random numbers,


Reassign position and scale of the navigation gizmo in the will to build a -limited Blender edition- easy to use for 3D model visualization, I want to move and scale the navigation gizmo. It seems that is not declared in a python file.

I'm answering myself in case this helps anyone in the future. The file to edit is \blender\source\blender\editors\space_view3d\view3d_gizmo_navigate.


How do I make my background image in VSE visible? I imported my background image. It shows in default view but won't show in VSE, how do I make it visible?

The background image on the viewport is for reference only. It will not render.
Add a strip with your background image, place it under the scene strip, and make the blend mode for the scene strip Alpha Over

To make the background transparent please read: How do I render a background image as a sky in blender 2.7x


Is it possible to animate the opacity of a grease pencil layer? I'm trying to have a grease pencil fade in and out over a number of frames. I'm able to get this behaviour in the blender viewport, but not when I render. I've created a minimal example which is available here:

The minimal example has a grey square, drawn in the default "Lines" layer of the default "Stroke" grease pencil. The opacity of this layer is set to transition from 1 at the start to around 0.1 at the end. When I play in the blender viewport, I see a smooth transition. When I hit "render animation", I see no change in opacity for different frames, and the rendered opacity matches whichever frame I have selected in the UI. "Render animation" will still correctly render motion, if I add location keyframes, but the opacity still behaves in the described manner.

Is there a way to make the render output respect the transition between opacity values?

Steps to create the minimal example:

Draw a square in a new 2D animation
Set end frame to 20 in the timeline
Create a keyframe for the opacity property of the "Lines" layer, at frame 0
Create another keyframe for the opacity property of the "Lines" layer, at frame 20
In the graph editor, drag the opacity at frame 20 down to around 0.1

This appears to have been a bug in blender 2.81. The example above behaves as expected in blender 2.82.


How to model this Shape? I tried to model the inner half, then the outside individually, but still can't get this shape.

I only want to know about the upper half.

Here is a try, I've followed the profile shape, switch view, add some vertical edges, mirror, begin to draw all the holes with additional edges, extrude one time to give thickness, extrude a second time to dig the holes, put some additional edge loops to sharp the angles. At the end I've added the circle drawing with the help of the knife or knife project tools, but I could have created it earlier (on the basic plane, before the first extrude).


Object Shows up in the rendered tab but not in the actual render I am new to blender and have been following Blender Guru's beginner tutorial series. I just finished my coffee cup and went to render it and it does not show up, but it will show up in the rendered tab.

Your cup influencing plane, but is not visible.

Check your render layer settings:

On the left - all active layers

On the right - active layers for "RenderLayer" named render layer. You have one of them (with cup) switched OFF. That's why cup influence scene, but is not visible.


How to prevent malicious code execution loading blend files? Since I download from time to time example files from blogs, wikis etc. I would like to know how I can avoid execution of malicious code.

Is it enough to disable the autoexec switch and see what is in the text editor?

Yes, It is enough to open a blend file with Trusted Source disabled. *

But looking the the text editor is not the only place that can contain code. Animation driver expressions can also contain code too.

Take care, even when the file is not trusted you could inadvertently run a script by...

Starting the game engine.
Rendering with freestyle.
Executing a command in the Python console.

If you are in a situation where you need to load blend files you don't trust (an online render-farm for example). Suggest to sandbox the environment Blender runs in (see containers).

* There is the possibility of crafting a file which makes use of a buffer overrun exploit, these are much more involved then writing malicious Python scripts.

For reference, this is a known pain-point, see these threads:

"Python Security gets in the way"http://lists.blender.org/pipermail/bf-committers/2010-April/027216.html
"Python Sandbox"http://lists.blender.org/pipermail/bf-committers/2010-March/026778.html
"Please turn off Auto Run Python Scripts by default"http://lists.blender.org/pipermail/bf-committers/2013-June/040502.html
"Trusted blend files and scripted drivers bug and annoyance"http://lists.blender.org/pipermail/bf-committers/2013-August/041464.html
"Keymaps and presets - Security issues?"http://lists.blender.org/pipermail/bf-committers/2015-June/045523.html


Hair points in weird direction All of my hair particles point in one direction.

Regardless of the object. This is the standard cube with the standard particle settings.

I'm using 2.79.

Under Particle Settings -> Source enable the check mark Use Modifier Stack


Making a light source invisible to everything except shadow rays I saw this in another answer and I would like to know how to do it:

"Making a light source invisible to everything except shadow rays will cause it to only block light from other light sources and not influence anything else."

Thank you!

There are two ways to do this.

Materials nodes:

Ray visibility:

Using these ray visibility checkboxes instead of nodes will speed up render times a little, however you lose the flexibility of nodes.


Understanding colliders I understand how to add a collider to  a single mesh in blender, but... I want to know if it is possible to enlarge said collider. For instance, I have a model of a briefcase but I want the collider to be a bit larger. How do I do that?

In addition, is it possible for me to create a single bounding box and keep a bunch of objects inside? For instance if I have the model of a nightstand could I put a collider around it and also put the lamp, cell phone and any other component within that bounding box?

Many thanks in advance!

The easiest way to do this is simple to create an invisible box, parent your objects to it, and then remove your objects from the physics simulation. The box will then do the collisions on their behalf.

Steps:

Remove you meshes from the phsical simulation

Parent your mesh to you box
Make your box invisible, and set the simulation to Rigid Body


Save Collections as separate blend file is there a method to write each collection and its content of a given blend file into separate blend files, each new blend with the name of the collection?
The process should be:

Take a blend file x.blend with n collections
specify the target folder where to save the output
each collection n of x.blend is then saved into the given target folder as a separated blend file n.blend, named after the collection.

Thanks for help!

The following uses hard coded windows paths for the ip_path, op_path but as the intention was to specify your own path and file this should be no issue.

Open a new blender file (the script will be removing all content from collections in the current file while running).
Copy the code into a text editor.
Modify the ip_path, ip_fname, op_path for your specific targets.
Run the script.

import bpy
import os

# folder containing blend files
ip_path = "C:\\Blender Projects\\bridge\\"
ip_fname = "bridge_002.blend"

# target folder
op_path = "C:\\Blender Projects\\bridge\\temp\\"

blendfiles = [ip_fname,]

def clear_cur_colls():
    while len(bpy.data.collections) > 0:
        bpy.data.collections.remove(bpy.data.collections[0])
    override = bpy.context.copy()
    override["area.type"] = ['OUTLINER']
    override["display_mode"] = ['ORPHAN_DATA']
    bpy.ops.outliner.orphans_purge(override)

def get_coll_names(assets_path):
    names = []
    with bpy.data.libraries.load(assets_path) as (data_from, data_to):
        names = [name for name in data_from.collections]
    return names

for file in blendfiles:
    # prep to make a folder based on blend file name
    filepath = os.path.join(ip_path, file)

    # make a folder based on blend file name to store new files
    if not os.path.isdir(op_path):
        os.mkdir(op_path)
    # get each object from blend file
    colls = get_coll_names(filepath)
    for coll in colls:
        # clear the current file
        clear_cur_colls()
        # append the object
        bpy.ops.wm.append(filepath=file, directory=str(filepath)+"\\Collection\\", filename=coll)
        # save blend file
        bpy.ops.wm.save_as_mainfile(filepath=os.path.join(op_path, coll+".blend"))

clear_cur_colls()


How to assign mesh to certain bones? Image shows it all, I'm trying to assign the teeth to the jaw bone but I'm new to blender and I don't know how rip

For this I would assign the weights directly by going into edit mode, selecting the teeth, and assigning the weight to the jaw in the object data tab of the properties window:

Don't forget to also remove the influence from other bones.

This works well for teeth because they move 100% with the jaw bone. For smoother things that are influenced by multiple bones you will need to use weight painting.


Bone is deforming vertexes but shouldn't I prepared descriptions on the photos:

Vertices are assigned well:

What I would like to achieve is to move whole arm with keeping constant distances between vertices.
I assigned only blue vertices, made minimum and maximum scale to 1.
I tried to turn off deforming but arm didn't track bone then.
I tried some other options but it was only random shots, I knew they shouldn't work.
File to download:

I solved this issue:

These 4 vertexes was added to the previous (selected) bone and it made a problem!
I removed them from selected bone and problem disappeared. I think I don't understand this system yet.

You have to assign the vertices in the vertex group of that bone to adjust which vertices to be deformed by the bone, not a limit scale.
Do this, select the armature and SHFT+Select the mesh making sure that the mesh is the active object. Then go to edit mode, and on the right properties panel go to the vertex groups tab, and select the vertex group assigned to the bone of the character's arm. It should have the name of the bone.
Make sure no vertices are selected before selecting any vertex groups by pressing A once. Then select the vertex group for the bone.
The vertices assigned to that bone should appear. If some are showing up that you do not want to deform from that bone, deselect them.
After this, press CTRL+I to select inverse, and then press "Remove". This will then remove the vertices selected from that vertex group, so that they don't deform with that bone.
EDIT:
So I found the issue to be that you have an unnecessary bone in between the arm and the shoulder. By deleting this bone, the arm deforms properly.

Now the arm deforms properly:


Animation nodes - sorted group transformation Let's say i have a 5x5x5 group of cubes, my goal is to have them all sorted from top to bottom, scaling down to a set size one by one with about a frame of delay between each cube, after scaling they then move to a set location with the same order and delay

I attempted to create this effect using animation nodes by running a group list (containing the objects) through two "sort list" nodes, sorting by x location and z location. Creating the scaling effect was successful using a loop subprogram, but once I attempted to have the objects translate from point A (the original positions of the individual objects) to point B (set location to converge on) it seems as though their changing location interfered with the initial sorting nodes and causes them to move very irregularly, even continuing to move when I pause the timeline.

Any help with correcting my method or another method of achieving this affect would be greatly appreciated. I am new to using animation nodes and my knowledge of it is very limited,  but I'm excited to hear what you have to say and to learn more about it. If any of my explanation needs clarification im happy to answer any questions

You can sort objects by using AN tools menu in T Tools tab:

Select all cubes, then in index panel press sort, and setup sort method. After this the objects will get unique integer value, that you can use in sort node. To copy this id, press RMB on this value slider and chose copy data path.

And paste this data path in sort list, after "e"

Also you should try use initial transforms, that can be used similar way.


Blender 2.82, two GPU but only one render in Cycle I'm not sure is this should be like that but, I have two GTX 970 graphic cards...and when I try to render something in cycles, I've notice that only one GPU works about 30-40 % and second one stays on 0%.

I'm little bit confused because I see two tiles in render window....

See screenshots below....

Any idea how to use full potential I have in my PC?

Thanks!

This is what I get as an answer on Reddit....I think this info will be useful for others.

Windows Task manager does not report multiple GPU correctly. Use a free app called CPUID HWmonitor. Everything else looks good. Make sure you have the latest Nvidia gfx drivers for your GPUs installed.

https://www.nvidia.com/Download/driverResults.aspx/156780/en-us


Render 3D mesh to 2D SVG export So I came across this post about a new native method to render to SVG. That sounds great and all but how can it actually be done? Which buttons give me an SVG file at the end and where are they?

It seems pretty common for many blender/gimp plugins to simply not say how to use them. Even if the installation goes fine, there's no mechanism to find out what new buttons or menus exist.

Similar questions:

Can blender export 2D curves to svg?
Is there a line render engine for Blender?

Non-native:

http://blenderartists.org/forum/showthread.php?282824-SVG-output-script

Install via File->Preferences->Addons->Install From File...

Couldn't find any menu additions trying to add this to recent blender versions, but pretty sure I had it working in the past.
https://github.com/hvfrancesco/freestylesvg

Check Freestyle in the Render tab of the Properties window (bottom right). In the Render Layers tab, change Frestyle->Control Mode to Python Scripting Mode and load one of the scripts from the link. The blender file must be saved for this to work and then the SVG just appears in the output directory (or maybe the same dir as .blend, I've forgotten) after rendering.

Native:

https://developer.blender.org/D785

The latest blender in fedora 21 doesn't have this addon, it's pretty new. Rather than find a recent binary build I just compiled from the source. Checking out the blender repository also gets the addon scripts. The one in question is release/scripts/addons/render_freestyle_svg.py. Hopefully this'll make it into the stable releases soon.

This addon needs to be enabled via File->Preferences->Addons (search for and check "Render: Freestyle SVG Exporter"). With this enabled, an additional section appears below Freestyle called Freestyle SVG Export in the Render tab of Properties (bottom left). Check this, and next time you render, a file will simply appear in the output directory. By default the output directory is /tmp/ and my render was /tmp/0001.svg.


What is the simplest way to turn off all but one layer in python I have a simple python script where i am importing many files and placing them in layers. But when I turn on another layer, the previous ones remain on.

What is the simplest way to turn off all but one specific layer via python, preferably through bpy.data.scenes instead of bpy.ops

not sure how terse you want this ;)

bpy.context.scene.layers = [i == 6 for i in range(20)]

The layer with index 6 will be flipped on, the others off.


'Clear Sharp' doesn't seem to be working I'm having a weird issue where 'Clear Sharp' seems to do nothing to edges that Blender half recognizes as sharp.

I have a model that does not show to have any edges marked as sharp:

Nothing seems wrong when in object mode either:

But when I render the model without a subsurf modifier, I get this as a result:

And when I go to the Select Menu and hit 'Sharp Edges', those same edges become selected:

However neither doing so from this selection nor selecting all will clear them if I do a Mesh > Edge > Clear Sharp

Before I discovered this was the case, I thought something was just wrong with the normals, but smoothing vertex/edge/faces did nothing and neither did recalculating normals or checking auto smooth or adding an edge split modifier. I'm not sure what else to try.

Here's the blend file: https://www.dropbox.com/s/9h6arxu9fn74yrm/SharpEdgeProblem.blend?dl=0

edit: A few extra things to note: this topology was the result of the add-on RetopoFlow 2.0, but I have had this issue before with a different model simply by importing an OBJ file and deleting edge loops.

There are no sharp edges on the mesh. What you are observing there is geometry obstructing itself or forming some unexpected shadows because of the way it is triangulated. When rendered, the mesh is triangulated and some faces that may look smooth when you rotate them in the 3d view get divided into triangles that obstruct each other looking at them at some angles or produce unexpected shadows:

There is nothing to do about it - the geometry is just not detailed enough to be rendered nicely, you do need to use Subsurf modifier or modify the geometry some other way.


Reset Blender inputs? I am NOT looking to factory reset my ENTIRE blender, i am just looking to reset the default key map,  i did something, an option popped up to change binds and before i could react i mis-clicked and am stuck with deleting by right click instead of selecting by right clicking, ive looked around but so far, only factory resetting? has popped up which resets my entire blender, which i'm not looking to do. i feel that i have to repeat that because all i have found is to factory reset.

i am running 2.79 sorry i didnt specify

First, the new shortcut should not remain each time you start blender, unless you save user settings.

The only trick is finding it. Open User preferences and go to the Input tab. In 2.80+ this is now under Keymap.

Use the search field to find "delete". Alternatively, you may want to search for the key-binding, in which case you can search for "right mouse".

If you changed an existing shortcut, there will be an arrow to go back to factory settings. If it is a new shortcut you added, there will be an X to remove the shortcut.

After correcting the shortcut, click Save User Settings.


removing intersecting geometry in blender 2.9 In blender 2.79 we could use the boolean carve solver to just keep the meshes on the outer surface, eg:
this:

could be maintained to this:

but, the carve solver was dropped since 2.8. Does anyone have any workaround or technique to achieve this in blender > 2.8?(except for  the remeshing in blender sculpt mode, which is destructive as well as requires too much density to cover the details)

You could use a boolean modifier, with "difference" or "union" to join them

it also worked in 2.9


How to give only a part of an object a ring texture I managed to give a ring texture to an object, but I only want to restrict that texture to a part of an object, as highlighted in the picture.

How can I do that? I tried to mix in some color ramps as factors, min/max settings in the coordinate mappings but couldn't get it to work.

You can add a second material to the material slots of the object and then select all the vertices/faces you want to assign this material too in edit mode and hit the "assign" button in the materials property tab:


Copy relative positions of empties to bone rotations in a smaller armature I have an armature and a set of empties that line up with each endpoint of a bone by their relative positions, but not by their literal locations or overall scale.

The empties are animated in the way I would like the armature bones to move.

How can I map the relative positions of these empties to the bones' rotations? I'm using Blender 2.79.

(I do NOT want to just match the literal locations of the empties to each other by scaling them down or scaling up the bones, as pictured below.)

UPDATE! Thank you to batFINGER for letting me know about the Track To object constraint. Now I can do this:

(Yes, I did start with the tutorial from Remington Graphics on using a Kinect for motion tracking. He did not mention in his video how to assign the Motion Tracking data to an armature that isn't what he set up in his free .blend file, which is what I set out to do here. While he uses Stretch To constraints, I use Track To and Copy Rotation.)

Rotation constraints.

Going off the image in question, contend this can be done with two copy rotation pose bone constraints.

Add a copy rotation constraint from base pose bone targeting base emtpy. Check the offset property.  Do for corresponding bone - empty pairs down the chain.


Is there anything like Arnold's Clip Geo in Cycles? I saw this from Lee Griggs and I wonder if there's anything similar in Cycles:
https://docs.arnoldrenderer.com/display/A5NodeRef/clip_geo
I know something similar is possible with the shader nodes:
Cycles. Masking objects with shaders (no compositor)
But as you can see, the inside part in the Cycles version looks empty, the geometry is just missing. Whereas in the Arnold version, the geometry is still solid.

Apparently, it's doable only with a boolean? I think I saw a node setup once which was quite close but I can't find it anymore.
There's also Blender BIM which now I'm going to test.
But if anyone has a better idea, please, let me know.


Why do I get this message "baking map saved to internal image, save it externally or pack it" when baking textures? I made this rock model in Blender and now I want to import it into UE4. When I try to bake the normal map, I get an empty purple map and the message "baking map saved to internal image, save it externally or pack it". I'm having the same problem when I try to bake other maps as well. Does anyone know How can I solve this problem ? I want to add more details to my material but with this problem I can't do anything.
your help would be appreciated.

The message "baking map saved to internal image, save it externally or pack it" means that blender has created this image but the images is not saved to a place in the computer, that's why it says save it externally as an image file, you could also "pack" it, which means that it is saved as part of the blend file. If you don't do any of this and close the program the image would be lost.
Bu default blender does not save images as part of the .blend file, it references the image files from the directory where they are stored.
As for why the maps are not working, it not sure, but I suggest checking that your object UVs are well unwrapped.


Snap a bunch of keyframes to the cursor? I have an object with several keyframes at different times. there is an option to grab all keyframes and snap the first (or the last) keyframe to the position of cursor?
(like after effect when hit shift)

Within the Dope Sheet and the Graph Editor you can snap the selected keyframes using the snap menu - Key->snap or Shift-S and choose one of several options.

You can de-select all keyframes by pressing A then use box select B to draw a box around the desired keyframes.

The DopeSheet also has 'summary lines' for example the 'Cube' line. Selecting a keyframe in a summary line will select all related keyframes.

Also a common method to align things in blender is to apply a scale of zero.

In the Dope Sheet selecting the keyframes you want to align and pressing S then 0 will align them all to the current frame.

In the Graph Editor you will want to ensure you only affect the frame by scaling the desired points along the x axis (S-X-0). Here they will scale to a frame between the earliest and latest selected, then you probably want to move them to the frame you want (G-X)

The same scaling trick applies to aligning almost anything. Objects in object mode (you need to make sure you turn on manipulate centre points for object alignment), vertices in edit mode, curve points, armature bones, nodes...


Can't get transparent glass in Eevee So I am trying to make a glassy transparent cup according to a tutorial but I seem to have misclicked something and now every default material when I change the viewport into preview material is the default forest one that comes with BLENDER 2.90. However, when I render the object with the camera it shows the way I want it.
I have tried removing the material from the cup or the liquid and adding a new one with the default white color. when I turn the Transparency to 1 and Roughness to 0 it becomes the forest HDRI again.
This is what I mean

blend file: https://pasteall.org/blend/154d7b8156aa42bbb0c41dcb332a32ab

Preview and render use different render engines, that's why it looks different.
Just enable refraction in Eevee and both will look right.

Properties > Material > Viewport Display
Check Screen space refraction
Specify Refraction depth (glass thickness)

More thorough answer: My glass material isn't transparent in Eevee


How to rotate a set of control points while masking I'm making another lightsaber fight.  It involves quite a bit of masking.  A lot of times, when I'm masking around an arm for example, the arm will somewhat rotate in the next frame. How come I can't press A to select all the control points, and then R to rotate them around their midpoint?  I can use G to translate, however, I cannot use S to scale (R and S only adjust the control points individually).  How can I change this?  Thanks.

Select "Median Point" as the pivot point for the mask.


Water simulation does not flow into the bucket I wanted to make a simple scene where water is flowing into a bucket. I had set the domain nicely outside the obstacle i.e., the bucket and a small uv sphere as the inflow. After that when I bake it, the water doesn't even go into the bucket it just flows away from it.

The collision shape of the bucket is probably not set correctly. It needs to be set to "Mesh" and not "Cube", "Convex Hull", or any of the other options.

Seem my answer to What causes this weird collission? for a more elaborate explanation.


Annotation Tool - How to control placement of drawing Even in orthographic views there is 0 control over the depth at which it draws. you draw a line, then pan even a tiny amount and it's obvious the line is nowhere near where it first appeared. I have even experienced it seeming to draw behind the viewport camera position? Not to mention trying to point to a specific vertex or face, where it will randomly draw in front or behind the mesh. I was wondering if anybody has managed to use this tool successfully. Am I missing a vital setting?
I am in 2.9 by the way.
thanks for reading!

By default the depth is determined by the 3D cursor position.
All the settings are in the N panel > Tool > Active Tool > Placement, you can choose between:

3D Cursor: The annotation is drawn perpendicularly to your view and it is placed where your 3D cursor is.
View: The annotation does not depend on the 3D view.
Surface, The annotation is drawn on the surface of the objects.

Also good to know: Ctrl left click to erase (if you use the D shortcut to draw annotation, the erase shortcut is D and right click).
Click on N panel > Tool > Active Tool > Note to set the thickness and color of the stroke.
CLick on the "+" and "-" button to create or delete an annotation, click on the eye icon to switch it visibility:

If you move in the Timeline and draw again, by default it will create a new annotation that starts at this frame. If you want to keep the previous one, click on the Note > Frame: X (Locked) button. To unlock, click again on this button. To delete this annotation on all its frames, click on the X button.


SVG file doesn't show up in blender I made a vector image in Adobe Illustrator and exported it into a svg file.(I did my best to make the lines closed but please still check if there's any problem with the vector image.)
But when I import it in blender, nothing comes out. I also zoomed in but there was absolutely nothing on the editor. Neither scale didn't work. Weird thing is I can still see the list of curves of svg file in outliner.

I've even tried with simple circle shape but the result was same. Please give a help.

Replicating your steps:

I vectorized your design and I saved it in SVG.

Imported in Blender and I noticed the svg comes too small.

Not so small as yours.

I entered Edit mode Tab, then Select all A, then S, then 50 and finally Enter.

This made it big enough.

In your case, I think S, 200 could be enough.

See the image below:


Get list of operators in a menu layout I would like to get the list of operators, and their order, in a menu. For example I need to get that list for the file menu (bpy.types.INFO_MT_file).

The idea is to add an element in a specific point of the menu, which is not possible with the append or prepend function. But if I can get the list of operators, I can rebuild an entire menu and insert my element where I want, that will do the trick.

So far I can do it with my plugins (overwriting the INFO_MT_file Class). But if another plugin do the same thing as I'm doing, we will destroy each other's layout. So any way to get a menu's children ?

Cheers !

Inserting layout elements in between is not supported and I wouldn't recommend to hack such a feature in with Python.

You can get the filename of the file from which a draw function originates, granted it is a python script:

bpy.types.INFO_MT_file.draw.__code__.co_filename

... then check the code of that file.

Here is an example how to "inject" code:

bl_info = {
    "name": "Menu Insert In-Between",
    "author": "CoDEmanX",
    "version": (1, 0),
    "blender": (2, 65, 0),
    "location": "File menu"}

import bpy

def main():
    insert_after = 'layout.menu("INFO_MT_file_open_recent"'
    insert_code = '    layout.operator("object.select_all", text="Some OT")\n'
    bpy_type = "INFO_MT_file"
    bpy_type_class = getattr(bpy.types, bpy_type)
    #module = bpy_type_class.__module__

    filepath = bpy_type_class.draw.__code__.co_filename
    if filepath == "<string>":
        print("Aborting, modifications are active")
        return
    try:
        file = open(filepath, "r")
        lines = file.readlines()
    except:
        print("%s couldn't be accessed, aborting." % filepath)
        return

    line_start = bpy_type_class.draw.__code__.co_firstlineno - 1

    for i in range(line_start, len(lines)):
        line = lines[i]
        if not line[0].isspace() and line.lstrip()[0] not in ("#", "\n", "\r"):
            break

    line_end = i

    # Unindent draw func by one level, since it won't sit inside a class
    lines = [l[4:] for l in lines[line_start:line_end]]

    for i, line in enumerate(lines, 1):
        if insert_after in line:
            print("FOUND INSERT LINE")
            lines.insert(i, insert_code)
            break
    else:
        print("COULDN'T FIND INSERTION POINT")
        return

    # Debug output
    #f = open("D:\\s.txt", "w").writelines(lines)

    l = {}
    exec("".join(lines), {}, l)
    print(l)

    #bpy_type_class.draw.__code__ = code_object # Doesn't work, since a single func is not a module

    bpy_type_class.draw = l['draw'] # exec defined our custom draw() func!

def register():
    print("register menu inbetween adder")
    main()

def unregister():
    print("unregister menu inbetween adder")

if __name__ == "__main__":
    register()

But the problem remains: if a second addon tries to do the same, it will revert what the first did, unless you write a system that solely manages adding stuff.

It is also possible to replace the UILayout type to intercept every draw operation, which also allows to "remove" stuff like operators or properties from interface. The problem is worse here however: if a second script tries to replace the UILayout type, the entire layout system will crash and all elements disappear from UI unless they are drawn by C code alone.

You can find an implementation here:

http://wiki.blender.org/index.php?title=Dev:2.5/Py/Scripts/Cookbook/Code_snippets/Interface&oldid=226944#Advanced_Topics


How do you remove a draw handler after it's been added? I'm making an attempt to use batFINGER's method from this answer for drawing some text on screen without a modal operator, but I'm finding I can't get the text to go away once it's been drawn.

class DrawingClass:
    def __init__(self, context, prop):
        self.prop = prop
        self.handle = bpy.types.SpaceView3D.draw_handler_add(
                self.draw_text_callback,(context,),
                'WINDOW', 'POST_PIXEL')

    def draw_text_callback(self, context):
        font_id = 0

        sel_obj_1 = (int(bpy.context.selected_objects[0].location[0]))
        blf.position(font_id, sel_obj_1, 10, 0)
        blf.size(font_id, 12, 72)
        blf.draw(font_id, "%s %s" % (context.selected_objects, self.prop))
        scene.frame_set(scene.frame_current)

    def remove_handle(self):
        bpy.types.SpaceView3D.draw_handler_remove(self.handle, 'WINDOW')

I then call the DrawingClass with a checkbox in the UI:

def get_draw_screen(self):
    bpy.context.scene.frame_set(bpy.context.scene.frame_current)
    return self["vp_draw_screen"]

def set_draw_screen(self, value):
    context = bpy.context
    test = DrawingClass(context, "TURKEY PALS")
    self["vp_draw_screen"] = value
    if value:
        test
    else:
        test.remove_handle()
    bpy.context.scene.frame_set(bpy.context.scene.frame_current)

When you check the checkbox the name of the selected object will draw on screen and will update with the scene selection, but unchecking the box doesn't stop the text from drawing.

Checking the box again appears to draw a new instance on top of the previous one.

I'm guessing that each time I check the box a new instance of DrawingClass is being created, but I don't know how to access the instance again to remove them.

I've found answers explaining how to remove app handlers like this one here but can't quite figure out how to apply it to this situation.

Thanks for any help!

Your method makes a new instance.  What you want to do is make some kind of global variable for dc.

Could declare a global variable, make a get set property on some blender class. Another way to do this is to use the driver_namespace

import bpy
import blf

class DrawingClass:
    def __init__(self, context, prop):
        self.prop = prop
        self.handle = bpy.types.SpaceView3D.draw_handler_add(
                   self.draw_text_callback,(context,),
                   'WINDOW', 'POST_PIXEL')

    def draw_text_callback(self, context):
        font_id = 0  # XXX, need to find out how best to get this.

        # draw some text
        blf.position(font_id, 15, 50, 0)
        blf.size(font_id, 20, 72)
        blf.draw(font_id, "%s %s" % (context.scene.name, self.prop))

    def remove_handle(self):
         bpy.types.SpaceView3D.draw_handler_remove(self.handle, 'WINDOW')

context = bpy.context
dns = bpy.app.driver_namespace
dns["dc"] = DrawingClass(context, "Draw This On Screen")

After running the above, can then remove handle from this class with (from py console)

>>> dns = bpy.app.driver_namespace
>>> dc = dns.get("dc")
>>> dc
<__main__.DrawingClass object at 0x7f04830967b8>

>>> dc.remove_handle(
remove_handle(self)
>>> dc.remove_handle()

And the class stops drawing to the screen.


What's up with the shading? My shading on my chinook is really bugging me. I have put an edge split modifier on my model and this has elimated the majority of my issue but it still persists. As far as I can see, there are no existing ngons.

I want the beveled edges to have no shading issues. It should all be beveled. no sharp edges (anything that looks irregular is not what i want)

Are you subdividing? If so, this sort of topology works...


How to view objects with a subsurf modifier more simply? I am doing this tutorial. From about 16:00 till 21:00 min he is modelling the first part of the screen resulting in this:

When doing this his viewport in right view looks very simple and more handy than mine:

When I am in right view my screen looks like this. How can I get that same viewport view ?

And ... I really have great difficulties to follow this tutorial from 16:00 - 21:00 min ... but would like to get it done. Ideas ?

You can check 'Optimal Display' on the subsurf modifier to simplify the view to not show the new subsurf faces:

This has to be done on every object you want to view simplified. You can do this by hand or by selecting all the objects you want to enable 'Optimal Display' on, enabling 'Optimal Display' on one of them and then right clicking on 'Optimal Display' and choosing 'Copy To Selected'.