blender_mmd_tools armatures won't work I know I shouldn't blame blender for this, but it's not like there's a blender_mmd_tools stack exchange. I don't know a better place to ask.

When I upload a pmx model, there doesn't seem to be an armature. At least, I can't see one on the 3D view. It's visible on the outliner. It seems to have all the bones. But when I select it on there, I can't change the 3D view to edit or pose mode.

Has anyone else had this problem? Should I try an older version of blender? An older pmx model?

I've used this. Usually what I do is first import the model and once it's on the grid, don't touch it. You'll see a small plain axes in the middle, its basically a plus. Delete that and then go to the armature in the upper right hand corner and click the eye to view it.


Why does trying to render with Cuda on a remote server fail? I’m trying to do a remote render on a server with linux, when I do renders by Cpu it’s fine, but when I want to use cuda I have errors. The script that I use is this

These are my Gpu

When calling the render

blender -b finaltestcuda.blend -E CYCLES -P script.py -f 1

This error appears

I don't know your specific error code, getting this ***** to run on server took me forever. What helped was getting the latest Daily Build and installing it instead of the default blender package. Also try a similar code to mine if nothing works (mine works for two Titans XP's, you'll have to rewrite it for your GPUs I guess).  If I remember correctly enabling all devices enabled CPU and caused blender to only use that.

def gpuSettings():
    bpy.context.scene.render.engine = 'CYCLES'
    bpy.data.scenes["Scene"].cycles.device = 'GPU'
    bpy.data.scenes["Scene"].cycles.feature_set = 'SUPPORTED'
    bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'

    # Switch render engine to cycles
    cprefs = bpy.context.user_preferences.addons['cycles'].preferences

    for device in cprefs.devices:
        if device.name == 'TITAN Xp':
            device.use = True
        else:
            device.use = False

    #print('Compute_device_type: ', cprefs.compute_device_type)
    for device in cprefs.devices:
        if device.use == True:
            print('USED: ', device.name)
        else:
            print('NOT_USED: ', device.name)
    print('Will be used: ' + bpy.data.scenes["Scene"].cycles.device)
    print('Feature set: ' + bpy.data.scenes["Scene"].cycles.feature_set)
    print('Render engine: ' + bpy.context.scene.render.engine)
    return


Way to color shade selected object Is there possibility to get color overlay over selected object (in object mode). Just like when you select something in edit mode.

Default indication is border over mesh, but this can be very unclear in some situations and you end up tab-ing into edit mode or looking in scene graph to see which mesh have you selected.

One work around for the problem of not being able to see which mesh is selected (because the  edges are blocked from view); is to turn on display Wire.

In the Properties window on the Object tab, under the Display category there are several options for different things that can be displayed in the 3D view along with the object. Check the button for Wire and Draw All Edges, then the edges will be overlaid on on mesh, which when selected will change to be the selection color.

I have created an addon called Selected Wireframe that will turn on Wire and Draw All Edges for all the selected objects. It will respect the object's wire and Draw All Edges settings, and leave the object unchanged when not selected.

Usage is simple, after installing and enabling the addon, just click the Show Wire button in the Tools tab of the Tool Shelf. Then when you do not want the wirefrmes displaying on the selected object, click the Hide Wire button in the same place.


Simple Python for loop causes Blender to suddenly hog 75% of all ram If I create a plane, and want to subdivide it, I can issue the Python command:

>>> bpy.ops.mesh.subdivide()

But if I want to subdivide 20 times, using:

>>> for i in range(20):
...   bpy.ops.mesh.subdivide()

this causes Blender to get stuck in an infinite loop, eventually taking up 75% of all available RAM.

Why would this happen, and how can I execute said loop?

Well, one problem I can think of is that you're asking blender to subdivide a mesh  by cutting everything in half 20 times in a row.  That's 2**20 = around 1 million cuts on every edge, meaning a square face would be cut into 1 trillion faces.

If this is really what you want, you can do it in a single step using a single

bpy.ops.mesh.subdivide(number_cuts=1048576)

My suspicion is that this is not really what you want to do.  Mostly because I can't think of any machines that can stash the vertices and face loops for several trillion faces.


save screenshots into local file system in blender game engine in python In blender render, it is ok to render a scene and save the scene image into the local file system with the code shown below

bpy.data.scenes['Scene'].render.filepath = '/home/user/Documents/image.jpg'
bpy.ops.render.render( write_still=True )

Now instead of working on the blender render, I am using the blender game engine to create a game, the blender game engine is working for me. but I I don't know how can to script to save the game screenshot into the local file system?

This is the same code but for the game engine:

from bge import render

render.makeScreenshot('Screenshot#.png')

On Windows 10 you need to run as Admin to be able to save screenshots to the primary disk.


array modifier overlapping any help?

i tried changing the mirage meter but no luck.

https://www.dropbox.com/s/d8e3vht6vdg5pl6/s.blend?dl=0
this is the file also its 2.8

First select your object, the view that you prefer (in my case I'm using orthographic view). Then enter edit mode.

Now, you have a plane at the bottom, so to get a better view, let's hide that plane. To do so, rotate the view like the image. Please make sure you are in face selection, look at the top left of the image.

With the bottom plane selected, press H to hide the selection and then it will look like this.

Now go to top view => (numpad 7) and please make sure you are in orthographic view => (numpad 5)

Change to vertex selection on the top left corner

Change Wireframe (top right corner of image)

Now let's get to work:

First, select the vertex like in the image.

Then press S then Y then 0 (zero) and ENTER. What this means is that you are telling blender to "S" = scale all the selected vertices in the "Y" axis to 0, this will cause to all selected vertices to align in that axis.

Press Alt + A if you are in Blender 2.8 or just A if you are in a previous version to deselect the vertices. Then select the left side vertices like this.

Now repeat the alignment procedure but in the X axis, press S then X then 0 then ENTER.

Let's repeat the procedure on the right side.
First deselect all the vertices with (Alt A or A) depending on Blender version.
Now select the vertices like in the image.

Again S then X then 0 then ENTER.

Finally do the same on the bottom. Select the vertices (Don't forget to deselect the side vertices first).

Align the vertices on the Y axis (S then Y then 0 then ENTER).

Let's take a look at your object. Press Z and select solid.

Look that there are some discrepancies. There is a tiny gap and lack of roundness. Let's fix this.

Select the four vertices like in the image, now press "S" => scale then "X" for the x axis, hold down Shift and slowly move the mouse cursor to the center of the object to get the vertices closer to each other in the selected axis. Do this until you like the results.

Now for the gap, let's select the top and bottom vertices like in the image.

Press S then Y then hold shift and slowly move the mouse until the gap is closed.

Here is the result.

Hope this can help you. If you have any doubts let me know.


My eye won't track to my bone armature When I added an object constraint to my eye mesh, I selected my armature as my target and my bone as the one that I want my eye to track to, but it's not working.

Here's what it looks like:

And every time I move my bone, the eye doesn't track to it. There appears to be a red bar right next to the word Track To in the Constraints Panel, maybe there might be an error?

Your problem is that the "up" axis is set to Z and the "to" axis is set to Z. The constraint can't point Z up and track it to the armature at the same time. If you want to track to the Z axis use a different axis as "up".


Character's Underlying Mesh is showing through top mesh of Jeans I downloaded a character model/rig and have been experiencing problems with the mesh of the jeans. When the character is facing forward, the jeans look fine. Once you rotate the character or move the legs, the underlying body mesh shows through the jeans. How can I fix this?
Rig facing forward:

Rig slightly rotated on Z axis:

As you can see the skin mesh is showing from underneath the jeans mesh. What could be going wrong here and how can it be fixed?

You could delete this part of your mesh. If you prefer a non-destructive way you could give your object a Mask modifier:

In Edit mode, select the part you want to make invisible, assign it to a group.
Back in Object mode, give your object a Mask modifier, in the Vertex Group field, choose the group you've created, click on the arrow on the right to invert the masking effect.


Multiple mesh faces, one UV face Consider the under-construction flower mesh:

For each leaf shape, I want one single UV face. Is it possible to merge UV islands or is the only solution to overlap them manually?

I am not aware of a method to merge the UV islands.  The best way that I am aware of is to turn on the vertex snapping to overlap the islands.

Then you can hold down CTRL (or click the magnet to automatically snap) and drag the vertices to the desired locations.


How to shade an object blue outside of my two decals using cycle nodes I'm SUPER frustrated with the UVmapping in Blender.  I'm also a frustrated with working with nodes which admittedly is mostly my own ignorance.

I have an object I want to be blue except for the two decals I have placed.  But blue only appears on the faces that I've uvmapped the decals onto.  I've marked in the photo below some locations that should be blue.

Here is my node setup.

I must be missing something.

Here is my blend file...  https://drive.google.com/open?id=0B8ZnFrE6fxi_R29mZnBkXzF5dm8

EDIT:

I also tried this setup which produces the exact same unwanted result.  It is curious because it worked for the rear portion of my Zamboni but it isn't working here.

So it seems Blender is just really arbitrarily annoying and my nodes were right.
 Tried to replicate the solution provided below but have the front decal wrap around a bit...

I am so pissed at Blender right now.

Edit:

Ok it is working after I had the uvmap overflow the bounds of the image in the vertical direction like in the answer below and still have the decal wrap around a bit on the sides of the Zamboni.  Seems like a bug to me.

Your troubles arise from the fact that UV mapping affects not only the color of the texture but (obiouvsly) also their Alpha channel. When you add a bizzarre (because of UV mapping) alpha with another alpha you get your strange behaviour.

To solve you can edit the "front" UV map so that nothing is overlapping the decal except the faces you want to be textured.

Then take the first texture and color combine it with your blue, so that everything is blue except the grid; then color combine this output with the second texture, so that everything is like the first combination except where you want the second decal.

To better understand nodes behaviour, enable the "node wrangler" addon, and control click over a node: it will instantly create an "emission viewer" shader to read the node's outputs (if you Ctrl click twice on a texture node you'll see its alpha channel).


Landscape addon, tools don't show My problem is that when I create a landscape via Shift + A, I normally get my options at the right side of the toolbar, but now (has you can see), there are only three options and I cant figure it out, how I'm able to modify the landscape as I'm used to.

There's a little plus symbol at the bottom of the toolbar. Drag it up


How to make objects clickable hyperlinks in WebGL? I am making a webpage, and I am using WebGL for animation and making characters in blender. I want to know how to make those characters hyperlink so that when I click on any character it takes me to another webpage.

First (if you haven't already), download the Blend4Web SDK and be sure to install it correctly. The SDK is different from the standalone add-on, so make sure you get the SDK (which includes the full-featured add-on, and also a lot more).

Set your render engine to Blend4Web.

Enable Blend4Web's Logic Editor and create a new node tree by clicking the [+] button.

In Blender's Node Editor, set the node tree type to Blend4Web logic, and select your node tree.

Make a node setup like this to instruct it to redirect to another URL when an object is clicked:

This node setup specifies that IF Suzanne (the monkey) is clicked, the redirect will happen, ELSE go back to listening for a click. That's why the "Miss" output routes back into the "Previous" input in a loop.

You can click the Fast Preview button on the right of the 3D Viewport's menu to preview it in your browser.

Once you're happy with the results, choose File > Export > Blend4Web (.html) to generate the standalone HTML file with all the 3D and interactivity data bundled into it.

Here's an example .blend (requires that the Blend4Web SDK be installed):

And here's an example HTML file generated from the .blend to demonstrate the functionality (requires that WebGL be enabled in your browser).


List of vertices at intersection of two objects I am using python to form the union of two cylinders through the use of boolean modifiers as shown in the image. How can I obtain a list of the vertices at the intersection of the two objects that are created when the modifier is applied?

Just a possible way to do this (there might be a better method to do this):

First set up materials on both objects (as in my answer in the link) and apply the boolean modifier: How to colour an indent that's been produced by a Boolean modifyer in 2.8

Then select by each individual materials, loop through them and save those vertices that are in common for both material selections. These should be the vertices you are looking for!

Happy blending!


How to duplicate view layers? right now only there's the possibility of creating new view layers, but every time you create a view layer it defaults all layers to visible, and sometimes in the scene there are views that are too similar and when you got a lot of collections it gets painful to adjust the same over and over. Is there a way?

UPDATE
This answer is obsolete, blender has now this functionality
This little script lets you duplicate a view layer with its visibility settings only, render passes and cycles settings, render and selectable are settings that are shared among all layers.
import bpy
context = bpy.context
old_layer = context.window.view_layer
new_layer = context.scene.view_layers.new(old_layer.name)
collection = old_layer.layer_collection
new_collection = new_layer.layer_collection

for prop in dir(new_layer):
    try:
        attr = getattr(old_layer,prop)
        setattr(new_layer, prop, attr)
    except:
        pass

cycles = old_layer.cycles
new_cycles = new_layer.cycles
for prop in dir(new_cycles):
    try:
        attr = getattr(cycles,prop)
        setattr(new_cycles, prop, attr)
    except:
        pass

def recursive_attributes(collection, new_collection):
    new_collection.exclude = collection.exclude
    new_collection.holdout = collection.holdout
    new_collection.indirect_only = collection.indirect_only
    new_collection.hide_viewport = collection.hide_viewport

    for i, _ in enumerate(new_collection.children):
        old_child = collection.children[i]
        new_child = new_collection.children[i]
        recursive_attributes(old_child, new_child)

    for i, _ in enumerate(new_collection.collection.objects):
        tmp = collection.collection.objects[i].hide_get()
        new_collection.collection.objects[i].hide_set(tmp)

    return 0

recursive_attributes(collection, new_collection)
context.window.view_layer = new_layer


How to scale a mesh evenly without causing the faces to intersect? I'm still pretty new to Blender and 3d modeling in general so I probably don't have the right vocabulary to describe exactly what I'm trying to do, but I hope the question is clear enough.

What I need is to scale a mesh evenly but without creating intersecting geometry as shrink/fatten tool does. In other words I want the scaled mesh to fit neatly inside/outside of the original unscaled one.

Here's a mesh off thingiverse that is complex enough to illustrate the issues I have when using either scale or shrink/fatten tools.

As you can see the duplicate mesh that is simply scaled along the axes naturally doesn't fit inside the bigger one at all, and the one edited with the shrink tool while being kind of closer to what I want intersects both on itself and with the original mesh.

I've been stuck with this for a while now and would be grateful for any tips you can provide.

ALTS is to scale along the Normals and if your vertices are all on the same plane they should only move up and down. If not, select all and scale the Z axis to Zero, and then remove doubles - just to keep things simple.

You could start by trying to scale the model just on the X axis and then the Y and see where the distortion starts. After that you will probably need to proportional scale - and it might be handy to turn on connected. You can also move and rotate proportionally.

What you might be thinking when you say 'scale evenly' is probably more correctly offsetting. There are tricks and work-a rounds but most software I have come across runs into trouble with intersecting surfaces.


Problems with Solidify I'm looking to solidify this surface, however when I do the shading is strange. Autosmooth is already activated and my other solidified modifiers on other surfaces works as expected. Any ideas? Thanks in advance!
Blender File Here

Go into the Properties panel > Object Data > Geometry Data > and Clear Custom Split Normals Data, it will reset the split normals which I guess created the problem:


How can I invert any key frames to start the animation from the last key frame? So recently I've found a cool tutorial on youtube about disintegrating a text. The text gets vanished over time. I want the same effect but I want to reveal the text out of nothing. My question is how can I make the last key frame to be the first key frame?
In case anyone want to see the video here is the link.
https://youtu.be/wm4rDDRcbDQ

Set your marker right in the middle of your frames (e.g. if you have 500 frames, set it on 250), mark all keyframes, then right click and then choose
mirror by times over current frame


Move multiple objects to new vertices in animation, assign automatically During animation from keyframe A to keyframe B, I would like to move many objects from their starting positions to the location of vertices in an object.
Example:
Start:

End:
Is there a way to assign them automatically, getting the shortest path for all and avoiding collisions / keeping a minimum distance?
I would need to do this for dozens or hundreds of similar objects and several times, so manual is not an option.

You may be able to use particle systems to do this. The Harmonic force-field can set up a one-to one correspondence between particles in source and target systems. With damping set to 1, source particles stop at their target-partners locations.

On the target, set up a particle system with no physics,
[vertex-count] particles emitted from vertices, all at frame 1.
In 'Force Field Settings', set the target system to generate a Harmonic field, with quite a high strength, and Damping of 1:

Set up a  source particle system, set the emission as for the target, this time from the source object, and in its 'Field Weights' set it to respond to the Harmonic field of the target.

So far, so good. The source system will be attracted to, and land on the target system (which you will be hide, in any render)
The remaining question is how to avoid collisions between the source particles on their journey to the target..

Here, in the 'Force Field Settings' of the source system, I've given the particles a 'Charge'. This does, at least, seem to cause enough repulsion between particles to avoid interpenetration:

Options might include giving the source system 'Boid' rather than 'Newtonian' Physics, with an 'Avoid' rule, and plenty of 'Personal Space'. If the worst comes to the worst, you could have a third particle system with 'Keyed' physics, which would let you mix-and-match between other particle systems, picking the parts of their behaviours which work for you.

Have a play, anyway, it might be a starting-point.


Rename a Collection using Python? Is there a way to access a collection's name other than through bpy.context so it can be renamed?

Collections are ID objects
In blender any ID object is stored in bpy.data  Objects in bpy.data.objects meshes in bpy.data.meshes collections in bpy.data.collections etc etc
To rename a collection named "Bob" to "Frank"
import bpy

col = bpy.data.collections.get("Bob")
if col:
    col.name = "Frank"

Note if there is already a collection named "Frank" then numbers are appended "Frank.001"... as per unique naming convention.
Related
How to rename objects with python?


Blender mist pass final render looks darker than viewport No other special settings, just create new default file and enable mist pass then I got this result.

Just change color management view Transform to Raw. Seems mist pass wont apply the filmic color filter.


Can unofficial Blender addons be included in a project as a text block and automatically register on load? I am a keen user of Bassam's typewriter.py addon. It's not part of the official distribution, so I thought I could make my .blend projects more portable by including it as a text block.

I always need to run the block even though I checked the register checkbox.
Are there any more requirements to having the .py extension that I need to do before the script will run on load?

http://www.blendernation.com/2013/01/25/typewriter-blender-addon/

Yes, if the addon is a single file (rather then a python package containing an __init__.py file).

At the end of the script, remove these two lines:

if __name__ == "__main__":
    register()

And add this line:

register()

In Python __name__ refers to the module name, which in this case is the name of the textblock (without .py, however if you run the script directly __name__ will be "__main__").

Removing this check before calling the register() function will run no matter how its executed.

Note, if you do this - The script won't be listed in the preferences as an addon, this wont cause problems, but a user has no way to disable besides restarting blender.


set specific bone as child of object The pencil in picture follows a path, and the hand bones connected with IK,
I want the last smallest bone to follow the pencil location.

when I add constrain in edit or pose mode, it parents the entire armature, so the entire arm follows.

How to parent only the last bone while other two follow IK?

Edit: the solution is in the IK target - an "empty" named handGrip, parented to pencil.

If you want the IK-Handle to stay in the same position as the pencil, simply use a Bone Constraint on the IK-Handle. Select the IK-Handle in Pose Mode and add the Copy Location Constraint from the Bone Constraint Menu (not the regular Object Constraints, see screenshot). Choose the pencil as a target, the bone will then follow the pencils origin.

If that origin is not where you would like, simply parent an Empty to the pencil in the place you want the hand to grip it and target the Bone Constraint to that Empty.


Workbench Outlines not appearing when rendering animation from command line The "Outlines" feature of the Workbench render engine Properties / Render Properties / Options / Outline provides the expected results when rendering an animation from the UI Render / Render Animation (Ctrl + F12).
Using the command line (for something like blender -b myfile.blend -a with proper paths) on the same file gives a result which seems to completely ignore the outlines.
I tried this with multiple projects and Blender versions 2.80, 2.83, 2.91 & 2.92 alpha on a Linux Mint 19.3 environment, all with the same results.
Searching online for bugs and/or implemented features returned nothing of relevance.
Any information on this? Maybe a setting I might have missed? Or a plug-in interfering?

I ran into the same problem today, and I found a solution by using the OpenGL render in a python script as such:
import bpy

# Most cited way of rendering via python:
#bpy.ops.render.render(animation=True)
# Produces no outline as by using blender -b myfile.blend -a

# Render with OpenGL:
bpy.ops.render.opengl(animation=True, view_context=False)
# Produces outlines as in the GUI

This can be used from a terminal like so:
blender myBlenderFile.blend --python myPythonScript.py

Note however that I omitted the background flag -b due to that OpenGL does not support Blender running in the background. So depending on why you want to render from a terminal this solution might not be valid.
It worked well for me, however. Furthermore, it also resulted in a render speed increase as it seems like it better utilized multiple CPU threads.
"Standard" example where outline doesn't take

OpenGL example where outline works


Creating face on subdivided edge distorted in top orthographic mode While modeling a gun in Blender 2.9, some parts of the faces are drawn weird in wireframe mode.
Example 1:
Example 2:
I then try to create a face using these edges (done automatically when I'm subdividing but I noticed it when troubleshooting the problem)
Before creating face:
After creating face:
It would be very helpful if someone could not only help me fix this issue, but give me some pointers on how to avoid having this issue in the future. Thanks :)

This is because faces are not meant to be bent. All polygonal faces are secretly changed into triangles in the rendering engine, so if they are bent, it will split them arbitrarily. Create multiple faces one at a time, working your way around that corner. Select three or more vertices, and even if an edge to make them a face is missing, it will be auto-created.
Also, the top and bottom pre-existing faces seem to have mismatching edges round the corner, as in they are not exact copies of each-other and the differences seem random.


Subdivison Surface Modifier / UV islands boundary Problem I have some subdivision + UV boundary problem
My English is poor. So I prepare image

As  you see the picture
The Blender's result of UV islands boundaries are different with other DCC, after subdivision
I think my blender "smooth, keep corners" option didn't work properly
I need the same Result, Like Maya and 3Ds Max

I use blender for modeling and Texture painting
But I cannot do texture paint with This kind of UV islands boundary result to export to other DCC
Please!! Help me!!

Thanks!!

to get the same result as Maya/3DS Max, follow these steps:

apply SubSurf modifier with Sharp option instead of Smooth, keep corners

your uv layout will be changed into this (notice the sharp borders)

select uv's borders and pin them (press P key), so those vertices will keep the position in the uv-space (pinned vertices are red)

select all vertices (in the uv editor) and press U to update all the other vertices - you should get this result


How to store and then restore selection mode (vert, edge, face) with and without BMesh? I want to store selection mode, then switch to other mode, bevel (or other operation), then restore first selection mode.
Thanks!

bpy.context.tool_settings.mesh_select_mode[:]

will get your current edit selection mode.
It returns which selection mode is active as True. For example:
bpy.context.tool_settings.mesh_select_mode[:]

returns:
(False, True, False)

meaning Vert mode False, Edge mode True, Face mode False
You can also request the state of a single mode using its number (starting at 0):
bpy.context.tool_settings.mesh_select_mode[1]

returns (in my case):
True

because I am in Edge Selection Mode.
https://docs.blender.org/api/current/bpy.types.ToolSettings.html#bpy.types.ToolSettings.mesh_select_mode


All animations are not exporting in .glb format? I tried creating a ps1 style character in blender by following a tutorial. I created 7 animations in there as you can see below.

But when I reimport the .glb file inside blender, it only shows basic_attack1, basic_attack2, basic_attack3, basic_attack4
I need to export it as .glb file. I am using blender 2.91.0.
Below is my export settings for animation.

heres the file,

The Blender documentation has a section on how to ensure that your scene can export to glTF. It looks like only some of your actions are marked as NLA tracks, which is probably why not all are exported. See:
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html


Set Material to VertexGroup I have 3 vertexgroups VG1 VG2 VG3 and 3 materials with exactly the same name VG1 VG2 VG2 as the vertexgroups, how I can assign each material to the corresponding vertexgroup in python? Also how I can get a list of faces in a vertexgroup?

EDITED:

A slightly more sophisticated version of the previous script, that now finds all the vertex groups of all the vertices of each polygon, isolates the most frequent vertex group and uses it to choose the correct material from the list. Also uses the method to find the material name that matches the vertex group name, as suggested by @batFINGER.

Try this (with the selected object):

import bpy

o = bpy.context.object

for p in o.data.polygons:
    # Get all the vertex groups of all the vertices of this polygon
    verts_vertexGroups = [ g.group for v in p.vertices for g in o.data.vertices[ v ].groups ]

    # Find the most frequent (mode) of all vertex groups
    counts    = [ verts_vertexGroups.count( idx ) for idx in verts_vertexGroups ]
    modeIndex = counts.index( max( counts ) )
    mode      = verts_vertexGroups[ modeIndex ]

    groupName = o.vertex_groups[ mode ].name

    # Now find the material slot with the same VG's name
    ms_index = o.material_slots.find( groupName )

    # Set material to polygon
    if ms_index != -1: # material found
        p.material_index = ms_index


Is There a Shortcut to Make a Bezier Curve Straight I want to know if I can straighten a bezier curve from the start without having to mess around till it gets straight.

Can you make your question more clear, what do you mean make it straighten?
Do you mean you want to "unwrap" it as in keeping it's length and making it linear, or do you want to make individual segments linear?

You can either use the toolbar button Set Spline Type to make a whole spline into a Polyline that will force all segments to be lines, or you can select a bunch of vertex and press V to access the Handle Type menu and make selected vertex into Vector type that will make segments between them straight.

Alternatively if you just want to make a 2D "planar" spline you can just press the 2D button in the Properties Window>Object Data Tab of your bezier curve object.


How to tell whether Object is a duplicate? Say I duplicate (not linked duplicate) the default Cube, "Cube", N times and name the duplicates "Cube.001" to "Cube.NNN". How can I tell, aside from the name, that "Cube.NNN" is a duplicate of "Cube"? Is it possible to determine the object, that "Cube.NNN" was duplicated from? I need this for my export program to avoid exporting the geometry of duplicates.

It's possible to check the vertices of both meshes via unit_test_compare for a first quick test:

import bpy

first_obj = bpy.data.objects['Cube']
first_obj_mesh = first_obj.data

second_obj = bpy.data.objects['Suzanne']
second_obj_mesh = second_obj.data

print(first_obj_mesh.unit_test_compare(second_obj_mesh))

Console Output:

  Number of verts don't match

For Linked Duplicates iterate through the mesh objects in the scene and check if mesh data block is associated with multiple objects:

import bpy

obj = bpy.data.objects['Cube']
obj_mesh = obj.data

mesh_dict = {}
for i in bpy.data.objects:
    if i.type == 'MESH':
        mesh_dict.setdefault(i.data, []).append(i)

print(mesh_dict[obj_mesh])

Note: Of course, it's always possible to compare the geometry, even if it would take long time for calculation and a bit of math, depending on your requirements.


How to find a lost vertex? I have what I thought was a clean model of a shot glass made from seven circles of 32 vertices each. The inside and outside 'bottoms' converge to a single vertex. That should make it 226 vertices in total however it reports there to be 227 vertices. I have 'removed doubles' but cannot find the extra one. What am I missing?

Select a good vertex, Ctrl+L to select
 all good 226 vertices, then Ctrl+I invert selection, then delete the extra vertex.


Create Multiple Edges at once and align them very precisely with extrude? (Watch Video as Ex.) Visit https://www.youtube.com/watch?v=TrZU6-jr8VU
time at 20:26 - 20:43.

I know that you can create an edge with ⎈ CtrlF but how does he manage to create multiple edges at once and align them with other edges very precisely? If you know, can you please tell me what the controls are or what tools he used.

It looks to me like he's using Extrude (E) in combination with transform snapping (magnet icon in the header).
You can also toggle transform snapping on the fly by holding ⎈ Ctrl during the modal transform (no need to click the magnet icon constantly):

Where it looks like he extrudes several individual edges, I think he extruded faces but they where hidden due to backface-culling and inverted normals. In the example gif I selected these and flipped their normals with ⎈ Ctrl⇧ ShiftN to make them visible.

Note that in the video he merged double vertices manually after extruding (W > Remove doubles), but it's possible to have blender do this on the fly by enabling automerge in the header.


Manipulate Vertex group names in the bmesh API When importing an object with my own script (Yes, I need one, no functional script exists) I want to import it with help of the bmesh-module. It seems to be the best choice for the job as it is as close as you can get to data-only and is kind of standalone (keeps the blender-data clean until everything is ready). There is one problem I am facing now: How do I give names to the vertexGroups? This is what I got so far:

import bmesh
mesh = bmesh.new()
# add vertices
layer = mesh.verts.layers.deform.new() # a new deform layer, why is this singleton??
for vert in mesh.verts:
    vert[layer][0] = 0.5 # assign a value of 0.5 to the first group
    # .... more groups

I suppose you know that Blender handles animation via vertex-groups so I have to make sure that the right vertex-group (index) has the correct name assigned to it.

Do I have to name the groups on the object itself? If yes, do I have to create the group beforehands (before mesh.to_mesh(object.data))? Am I guaranteed that the order is kept?

Vertex group names are stored in the object, not the mesh.

The order of groups just has to be aligned between the mesh and the object.

So yes, you have to name the group on the object.


How can I prevent invisible faces when exporting to FBX file? I started recently learning how to use Blender to create 3D models, to use them later in Unity3D.

Translating the vertices of a hollow cylinder, I created the following model. Please pay special attention to the selected face.

After finishing translating all the vertices, I noticed these "faces" were accidentally deformed or even deleted. So, I deleted them and remade them selecting the corresponding vertices and hitting the Make Edge/Face button. The result is the screenshot posted here, and they look good from Blender.

However, when I export it to FBX file and insert it in Unity3D, this selected face and the one equivalent at the other side are completely invisible from any angle. I tried flipping normals but they still remain invisible.

I also tried to press CtrlShiftAltM just in case there was some undetected non-manifold geometry, as suggested in this answer from another question.

I barely can guess that this is probably because of the twisted geometry of the face itself, but I can't figure out in detail the true causes.

What kind of techniques may help to correct this issue?

This issue is due to the fact that there are N-gons in your model (an N-gon being an N sided polygon). Either FBX doesn't support these or Unity can't import them, but, either way, the solution is to get rid of them. There are many ways to do this, but the fastest is probably to select those faces and Triangulate them (Ctrl + T) and, possibly, convert those to Quads (four sided polygons) (Alt + J).

Another approach, which might get you cleaner results is to use the Bridge Edge Loops tool; this tool doesn't appear to have a shortcut, but you can invoke it either from Edges menu with Ctrl+E > Bridge Edge Loops or by pressing Space (search for operators) and typing it's name. For this tool, you should have two edge loops selected, so delete the N-gon face and select the edges that were there before (Alt + RMB (selection button)) and then execute Bridge Edge Loops.


Blender throws Error: Exception_Access_Violation when Duet Display installed As the title suggests, Blender would throw Error: Exception_Access_Violationand not load when I have Duet Display installed. Duet works fine with or without Blender, but Blender will only work when Duet is not installed. I've read about this problem here
before and understand that it is related to OpenGL. I've already tried to talk to Duet Display, but they weren't helpful (such as asking if Duet Display was working on my iPad).

I would like to be able to use Blender and Duet Display on my PC. Is there a way I can do this?

My Lenovo ThinkPad Yoga 370's specs:

Intel Core i5-7300
8 GB RAM
64-bit Windows 10
Intel HD Graphics 620

Thank you!

It turns out Lenovo's System Update and Windows update doesn't do anything to update the graphics driver. Go to Intel's support site, look for your graphics card (in my case Intel HD Graphics 620), and manually install the graphics driver. This solved the problem for me.


Why my blender will show such an error color in render preview mode? I don't know why my render preview mode viewport will show such an error color, any kind of helps are appreciating !!!

Thank you all for replying my post, I have already solved this issue by switching (forcing) my graphics card preference in NVIDIA Control Panel to NVIDIA GTX 1060, ( By default is Intel Integrated Card), and the error shown in the picture disappeared right away after i restarted blender. It seems like blender is not compatible with my Integrated Graphics Card, ( or maybe blender cannot run on Integrated gpu at all?) By the way, this error will only show up in Eevee render mode, Cycles is working fine.


rig problem: knees bend sideways instead of forward and backward The knees bend sideways instead of forward and backward(normal) I tried:
"Recalculate Roll > View Axis" but that didn't do anything. How to fix it?

I'm not sure how to embed the GIF:

Imgur

You need to set the IK Pole Target and pole angle. Follow JerryNo's answers How to IK rig legs and How to Set/Calculate pole angle of IK constraint


Problem rigging weight paint I'm new here and a beginner of blender.
i have a problem with rigging, some parts of my mesh deform. i'm italian so sorry if i speak very badly.
that's the problem:

the back is deforming when i rotate the on the x axis the leg.
the model is only one mesh, i don't know if that can be a problem, the piece of armor on the leg is connected to the back.

sorry for the question or my writing, i'm following a lot of tutorials but i cannot resolve this.
Thanks in advance

So, here is my opinion:

First you need to put the Armature modifier above the Subsurf modifier, and enable the Preserve Volume option.
You should add a little more weight on the butt for the leg, you'll see that it works better when you rotate the leg
Maybe add a hip bone and weight paint to add a little bit more precision in the mesh control?


Understanding the Cycles 'Script' node I've finally found a good example on the internet for a problem that I had in Blender, but it is made by the text window that looks like this -

And then it makes a result like this -

And it is using this node:
.

Please give me an explanation of this node, and how it is used.

The cycles script node connects OSL scripts into cycles, pretty much like an addon for the render engine. While you can use an OSL script to define the final appearance of the material, you can also use them as small steps that add custom noise or pattern inputs or custom math functions.

There is a self published e-book by Michel Anders called Open Shading Language for Blender: A practical primer. You will want some programming knowledge before reading it at it doesn't teach the core language.

You will also find that OSL is very similar to RenderMan scripts. Which is not surprising as it was created by Larry Gritz who worked on RenderMan at Pixar for several years before starting OSL. You will find that many RenderMan scripts are easily converted to OSL and any tutorials should also easily translate.

I have a github repository that has over 100 OSL scripts, including preview renders and node tree snapshots used to create them. Some of these scripts come from various websites including Michel Anders blog and the Blender Artists forum while others are conversions of older RenderMan scripts and a couple are OSL versions of quite complex node setups.

Some samples of scripts that define the entire material and connect to the output node -

These two samples use the same hexagonal pattern script within different node trees -


Deleting an Object in the Blender Game Engine using a Mouse Click Event This might be a simple question, but how would one delete an object on a mouse click when the object is clicked? Picture below.

Logic bricks or python is accepted. Thanks in advance

Add these logic bricks to the object you want to be deleted it the game!

https://i.stack.imgur.com/3Ei4h.png


Compositor: obtain facing from normals pass to affect glare? Is there a way to obtain the "facing" of individual pixels on a rendered image by using the normals pass?  IE: if a surface's angle points away from the camera, it becomes darker, and when a surface's angle points towards the camera, it will become brighter.

Edit: The reason I'm asking is because I'm trying to develop a custom glare node in the compositor.  Bright areas will get weak fog glow, but I also want to produce a star-like glare over bright points which are facing the camera.  I don't know whether this is accurate to reality or not, though.  If there is a better method for doing so, or to realistically accomplish the effect, I'm all ears.

This works like a dream. ridiculously simple too. the normal node can be found under vector in the add node menu(shift-a).


Turn Off Tree Reflections For Glass And Gloss BSDF? I'm pretty experienced with Blender, but one thing I can't seem to figure out is how to turn off those weird tree reflections in the Glass/Gloss BSDF.

Let me just propose another solution:

1) Switch to your World lighting
This will use your environment texture for lighting.
If there's no HDRi set, no image texture will be reflected.
You're done.

No texture is reflected, only homogenous light

2) Enable your scene lights
This will give you a better preview of your render.
You can combine it with your World lighting.

No image texture is reflected, plus your scene lights are enabled.

Why not just turn lighting strength to zero.

It makes all materials look the same (black).
While this works for getting rid of texture reflections, it is not often desired.
Simply switching to you World settings is usually more convenient.

Scene looks with lighting strength set to zero.


Blender 2.8: any alternative for changing between modes other than the (uncomfortable) pie menu? I seem to have finally switched my brain to using 2.8 shortcuts. However, the switching between weight paint/object/pose mode when painting weights for armature still gives me a lot of trouble.

It used to be so simple and elegant when Ctrl+Tab was just for Weight paint. Now it enters a confusing pie menu where I have to manually click/point towards the correct section. It adds a whole new step into what should be a very quick operation. Sure, with time I guess I could get used to it, but it seems regressive to actually ADD another step to an previously single-step operation.

I know I've got the option of using 2.79 or even the 2.79 hotkey scheme, but I don't wanna get stuck in the past. Generally I'm up for re-learning interface, it's just this single change that's really bugging me.

Is there really no single-step method to select weight paint mode now?

You can simply change the keymap in User Preferences. Or - the fast way - in the top left corner, where you have the dropdown for the modes: Click once to show all the modes, then right click on Weight Paint -> Assign Shortcut.

You can do that with almost everything in Blender 2.8.
Another Option is (in the same Context Menu) "Add to Quick Favorites". Then it will appear under the Menu that you get when pressing "Q".

Hope that helps!


My model looks fine in blender but does not render all faces in Unity I created a simple arch bridge in Blender and it looks fine in blender but if I import the blend file into unity, some of the faces don't render at all. Can someone check my model and tell me where I'm going wrong? I have recalculated the normals, and I was not using any modifiers when I created the mesh. Any insight would be appreciated. The blend file is here

https://www.dropbox.com/s/qw3h9ueqfm6vl9o/arch.blend?dl=1

the mesh looks like this in Unity:

https://www.dropbox.com/s/tprxy8psyupkt51/2017-01-28.png?dl=0

The model is only loosely connected, and the top face is completely separate from the rest of the model. You can see for yourself by selecting the object's faces in Editor mode and dragging them away:

Since the faces aren't properly joined together, Blender is unable to recalculate the normals because it can't find any edges joining faces that are pointing in opposite directions.

You can fix this very easily. First select the entire mesh in editor mode and apply Remove Doubles. Then recalculate the normals again.


Emission material won't work while another emission in my scene is on I'm having trouble with an emission material that refuses to emit while another material in seperate object is emitting. In the attached screenshots you will see that the emission from the lamp wont work while emmision from my neon sign is on. Can someone tell me whats wrong? Thanks.

It's an issue with object size, basically it seems like Blender can't find your lamp filament.

Actually the emission is still working, only it's influence is being disregarded because it can't be found easily. In theory with an unpractical amount of samples it would eventually become visible. If you increase the number of preview samples to an insane amount the light will actually start to become visible in the form of very spaced fireflies.

The Cycles rendering algorithm is having trouble finding your very tiny light source (lamp filament) when there is a comparatively very big and bright light source around (neon sign).

My advice to you is that it's not recommended to use such small light sources, hidden away behind so many layers of glass, as actual means of lighting up your scene.

Fake the light coming from the filament, and add an actual lamp object in its place instead to actually light up your scene.

Also see https://blender.stackexchange.com/a/65171/19307


"Remove double" is deforming my mesh On a mesh imported into Blender from a specific format with a conversion plug-in, I get duplicated vertices in the same positions, and the different faces of the mesh aren't connected to each-others.

As far as I can tell, this would be solved by the "Remove double" function, however using it deforms the mesh.

What can I do to merge all the duplicated vertices in the mesh, but without deforming it ?

(This mesh was under PMX format, in order to be used with MikuMikuDance. I imported it in Blender to rig it.)

Faces aren't connected to each others :

Normal mesh :

Deformed mesh :

When removing doubles from the imported mesh the normals split in a custom way aren't preserved, making some dark patches to appear. Probably some of split normals were saved while others weren't because removing doubles doesn't choose to preserve given vertex just because it stores some custom data.

In anyway if removing doubles make sure to remove imported normals as well. That will make model lose its look as it was done before exported though.

If the lost shading is important and irretrievable possible solutions can be to manually join double vertices to control which vertex goes where (long way) or recreating shading as it was before removing normals (may be even longer).

Another way would be to duplicate the object before removing custom split normals, remove doubles,  work with it and once done use Data Transfer modifier to copy normals from one mesh to another.

Adding another layer of custom normals with "Add Custom Split Normals  Data" in the Geometry rollout can eliminate the problem but this solution doesn't seem to be stable as it works somehow differently for different objects.


Jagged edges from joining with boolean modifier I am sculpting a mesh and joined the head to the body with a boolean modifier and every time I join any meshes together they form these edges that I can't sculpt away. Both meshes have had all modifiers applied and the only difference is that the head was not sculpted and contained a different number of vertices from where I joined it to the body.

Umm I dont know if you already solve this, but I Have those kind of problems when I use zbrush usually is because your object wasnt dynamesh prior to merging, and you only merge them together in their plain sculpt mode so you are not adding geo to the object but intersecting the geometry of both meshes, also boolean is horrible because you get ngons everywhere, thats why some geometry can collapse on itself like is doing in your picture. Probably blender works similar to the dynamesh in zbrush.


Make object in glass material not look like its underwater? My object inside my glass dome is just a normal cube, but when I render the image, my cube looks like its underwater. Is there a way I can keep the glass dome and and have my cube look normal?
render.png

If you're using a Glass Shader, try bringing the IOR closer to 1, but not all the way to 1 because that will cause you to loose the dome reflections.
Default IOR - 1.45 - Cube is bent

IOR at 1.0 - too low - Cube is normal but glass shape (reflections and refraction) is completely lost.

IOR at 1.10 - More realistic - Glass is still visible without bending the cube noticeably. However, notice the background is refracted differently as well - you will have to find an appropriate balance that works for your project.


Custom Path for Save Versions I love the save versions feature but not lovin' these versions to be saved next to my file.. I prefer them to be saved in another hard-drive or folder as well..

I can't find a configuration to change the path of these versions.. does It exist yet or should I suggest It? :)

There's an addon written by Jonathan Stroem to allow saving the backup blend files into a subfolder. I'm sure you could easily modify it to write the file somewhere else on your system.

Config blender to save backup files in subfolder


Shading artifacts / Tricky modelling situation I hope someone can help me out with this.

I'm modelling a moka pot, similar to this one:

This is what my mesh looks like in the snout area:

As shown in Fig. 3, I marked the planes around the front of the snout as smooth, to get a nice rounded edge. However, in rendered view I get weird artifacts, such as can be seen here:

Does anyone know why I'm getting these weird results? Nothing I do seems to help.

Here's the .blend file:

coffee.blend

You should simplify your topology. Something simple is more controlable.


Blender 2.8 API how to get a list of custom transform orientations I'm trying to update a script I used in 2.79 to delete all custom transform orientations (CTOs).

The new API replaced bpy.context.scene.transform_orientations with bpy.context.scene.transform_orientations_slots. The problem is, for some reason, this is returning only the active CTO, not a list of the CTOs that I created. I couldn't find a way to return a list of CTOs so I can later iterate through them and delete them.

Tried:

Researching the matter, the closest thing I could find is bpy.ops.transform.select_orientation(orientation="some_CTO_name").

However this is not useful in my case, since the argument will only accept a string enum.

Also the info window isn't helping. When I change the Transform Orientation manually, the listener is printing bpy.context.scene.type = "TO_Name". Trying to use this in the console or the script will throw an AttributeError: 'Scene' object has no attribute 'type'.

The Script:

Following is the script. If you try it, it will only delete the CTO if it's already active. My question is, how to get the list of the CTOs?

import bpy
orient = bpy.context.scene.transform_orientation_slots
views = [area.spaces.active for area in bpy.context.screen.areas if area.type == 'VIEW_3D']
areas = [area for area in bpy.context.window.screen.areas if area.type == 'VIEW_3D']

for o in orient:
    if views and areas:
        views[0] = o
        override = bpy.context.copy()
        override['area']= areas[0]
        try:
            bpy.ops.transform.delete_orientation(override)
        except:
            pass

orient_slot = bpy.context.scene.transform_orientation_slots[0]
custom = orient_slot.custom_orientation
custom.matrix

reference:
https://blenderartists.org/t/2-80-cheat-sheet-for-updating-add-ons/1148974


How to render a video based on "material preview" viewport shading I am trying to make a technical animation and i want to render a video based on the "material preview" shader type which looks like this:

I do not want a rendered view for my video, I tried adding a sun lamp and it looks really bad:

Is there a way to render a video based on material preview(top example) instead of rendered view? Thanks!

You can render animation from viewport, by choosing View -> Viewport Render Animation
[
You may want to disable overlays (icon is located in top right by default), or disable specific parts of it in the drop-down menu.


Can I drive multiple drivers with a Vector from one procedure call? Suppose I have a Python function get_loc() that returns a Vector, which I want to use to drive the location of an object interactively (e.g., triggered by me moving another object).  I can set up a scripted expression on each axis, e.g. "get_loc()[0]" for X, "get_loc()[1]" for Y, "get_loc()[2]" for Z.  But I assume this is calling get_loc() three times.

Is there a way (maybe using custom properties or bpy.props) to have the function called just once?  I can do it the "easy way", but it seems inefficient.

[My real application is a little more complicated than this.  The procedure actually returns the location and rotation for one object and the Z translation for another.]

As you point out drivers need to return a float or int (bool). You can however add just about any type to the drivers namespace.

Not knowing the complete ins and outs of your setup you could look at setting up

i) A frame change handler and use something like globals, or an ID property to select objects and then set the location with your get_loc method.

def fc_handler(scene):
    obs = [o for o in scene.objects if "drive_me" in o.keys()]
    for o in obs:
        o.location = get_loc()

bpy.app.handlers.frame_change_pre.append(fc_handler)

ii) A mix of drivers and a frame_change handler, eg set up a "Mover" class and make an instance available to the driver_namespace, update it if needbe in a frame_change handler

class Mover():
    def setloc(self, frame):
        self.x, self.y, self.z = get_loc()
    def __init__(self):

        pass # set up a class

mover = Mover()
bpy.app.driver_namespace["mover"] = mover

Then properties can be driven with mover.x, mover.y or something more adventurous mover.jiggle(var1, var2)

Using the drivernamespace is a handy way to test things from the python console

>>> dm = bpy.app.driver_namespace['DriverManager']
>>> dm
<sound_drivers.sounddriver.DriverManager object at 0x7facfaa903c8>

For an interactive tool I would use a modal operator. Here is an edited snippet from  script editor > templates > python > Operator Modal Timer, Op performs commands on timer tick or event. A scene bool property update method to start. To stop the operator set it to False.  Eg use toggle button in a UI.

def toggle_modal_timer(self, context):
    if self.modal_timer:
        bpy.ops.wm.modal_timer_operator('INVOKE_DEFAULT')

bpy.types.Scene.modal_timer = BoolProperty(default=False, update=toggle_modal_timer)

def get(self):
    # here is a handy spot to return a manager class
    # using dns can declare it anywhere.
    # using context we have it available on context pass.
    dns = bpy.app.driver_namespace
    return dns.get('mover', None)

bpy.types.Context.controller = property(get)

class ModalTimerOperator(bpy.types.Operator):
    """Operator which runs its self from a timer"""
    bl_idname = "wm.modal_timer_operator"
    bl_label = "Modal Timer Operator"

    _timer = None

    def modal(self, context, event):
        scene = context.scene
        controller = context.controller

        if not scene.modal_timer:
            return self.cancel(context)
        #print(event.type, dir(event))
        if event.type in {'LEFTMOUSE'} and event.value == 'RELEASE':
            print("LEFT MOUSE RELEASE")

manipulating context.controller will effect any drivers with mover in their scripted expression.  You can get "tricky" with the Mover class  by passing a name reference and the locals() dictionary via drivers' scripted expressions.

Of course you can also manipulate objects directly in the operator.


Only part of texture paint is pink I have an object that has been created by joining two objects. The entire thing has been uv mapped. When I go to "texture paint" the entire model is pink, which I expect. I click "Add Texture Paint Slot" and add a blank texture, which renders a large part of the model black (and paintable). However, all of the faces of the second object (and by "second" here, I am referring to the order of the objects when they were joined) are pink. I can paint directly on the part of the texture that is black, but I can't paint on the pink part.

Any guidance or suggestions would be appreciated!

Select all faces and assign them to the same material. It is likely that your two objects had different materials on them, and that you added the texture paint slot to your first object's material. Now that all the geometry is in the same object, what previously was the second object is still using its material, which didn't get the texture.


Add two edge loops aroung selected edge loop (hard surface modeling) Does anyone know if there is an addon to add two edge loops adjacent to an existing edge loop, to make "creases" while using a subsurface modifier? I don't wanna mark sharp edges or mark creases, I want to manually (by this addon) add 2 edge loops close to a selected, exsiting edge loop. Ideally this addon would allow me to choose an offset, and also apply these pair of edge loops to as many edge loops I select. I don't think this exists already in Blender so I'm guessing I need to code that??

Just to make sure I expressed myself correctly, here's what I want to do:

Just use the Bevel operator for this Ctrl+B by default, no addons needed.

You can control how many additional loops are added from the operator options panel F6 by default.


Whats the best way to make & animate Crater/s in eevee 9.2 I want to make and animate craters formation. I've tried boolean, which allows me to animate them, but they don't look as good and don't add the collection of dirt that gathers at the top of the crater when formed, and I've tried a crater height map, which does look the best add does provide some animation ability but not flex ability, like if I wanted to add more than one and some overlap. I know there's a way in cycles, but I'm only using EEVEE to animate and render in.
I like Boolean because I can change the texture of the crater and keyframe it.

I recommend dynamic paint, set to displacement. If that doesn’t work, try using a displacement modifier with a color ramp on the texture to make it the right shape for a crater.


How to animate spirals on packed spheres using Animation Nodes? I will like to animate a list of parametric spirals over a list of packed spheres. The effect I am after is illustrated in this gif by Étienne Jacob :

By looking at the gif above, we will divide our implementation into two parts:

Sphere Packing, where we try to find a list of locations and radii for the sphere such that they are non intersecting and look packed.
Generating Spirals, this part is relatively easy, all we have to do is find a parametric equation for the spiral over the spheres and replicate it over the list of locations and radii we have got.

Sphere Packing

There are multiple algorithms we can use to generate point locations and radii. Some are iterative, others are generative (but expensive), and others are "approximative." We don't really care about execution time because the output is readily cached. Perfect packing is not needed either since smaller circles will usually go unnoticed.

Our algorithms will be as follows:

Initialize an empty vector and float lists for locations and radii.
Define a function that generates a random location, preferably uniform in density.
For some arbitrary number:

Generate a random point $p$.
Loop over the point and radii lists and compute the smallest signed distance between the point $p$ and the nearest sphere surface point.
If the signed distance is positive (meaning the point is outside all of the existing spheres), append that point $p$ and radii (which is defined as any scalar that is smaller that or equal the positive distance).

The smallest signed distance between the point $p$ and the nearest surface point is equal to the distance between $p$ and the nearest sphere minus its radius.

If the distance is smaller than the radius, then the signed distance will be negative, telling us that the point $p$ is inside of the spheres, and that's why we don't append it. Moreover, the radius of the sphere at point $p$ has to be smaller than the positive distance so as not to intersect the other circle.

To find the smallest signed distance, we loop over the point and radii lists and reassign an initially infinity float parameter if the current signed distance is smaller than the value of the parameter. This is is the equivalent to a KD Tree search except we are subtracting some value defined as the radius.

Next, we create a loop that has an arbitrary number of iterations controlling the maximum number of spheres. However, it does not strictly define the number of spheres itself! The loop has two main parameters: (1) a vector list that will include the spheres locations and (2) a float list that will contain the radii locations. Both inputs are undefined, meaning that they are initially empty lists that we will append to later. In this loop, we generate a random point (we will talk about that algorithm later on), compute the smallest signed distance using the loop we created before and append the sphere location if it is positive. The append condition is implemented as a form of reassign condition for both lists. It is important that we copy the lists at each iteration, ensuring the append doesn't overwrite the original list rendering our reassign condition useless. I chose to define the radius as the positive distance bounded by some arbitrary constant called the Max Radius, though any other positive value less than the distance will work.

Again, the random point generation is a choice and it may vary based on our needs. I can see that in the reference gif, the random points are uniformly distributed inside a circle, so our random generator can be created as define in the document about Disk Point Picking, that is, the random point is defined by the parametric equation:

$$
\begin{aligned}
x &= \sqrt{r} \cos t\\
y &= \sqrt{r} \sin t
\end{aligned}
$$

Where $r$ and $t$ are uniform random variables, $t$ ranging from zero to two $\pi$ and $r$ ranging from zero to some max radius. Th result would be something like this:

Had I used a normalized random vector, it would have been like this:

Spiral

All we have to do now is generate a spiral on those spheres. A possible parametric equation would be the ones described in this question and answers, that is:

$$
\begin{aligned}
x &= \sqrt{1-t^2}\cos (a \pi t)\\
y &= \sqrt{1-t^2}\sin (a \pi t)\\
z &= t
\end{aligned}
$$

Where $t$ ranges between negative one and one and $a$ controls the number of revolutions. Which results:

But since sin and cos and periodic, we can animate them by adding a phase shift:

We can now transform this by some transformation matrix defined by the sphere locations and radii. Create a spline from it. And we are going to put that in a group to be able to use it easily.

Final Implementation

By looping over spheres, randomizing some of the parameters and transforming, as follows:

We get:

You can now render this as you wish. Maybe through in some random colors or make it particles like the reference gif.

Blend File:


could not create merged face I asked a similar question here Part of mesh goes outside but the solution for merging the faces doesn't work on this model. The model is here:

Basically, the problem with the turtle is in the picture:

The right leg of the turtle gets distached from the main body of the turtle. I tried joining the faces of the turtle like the recommendation in the earlier question I posted the link to, but I get the error message of "could not create merged face". So I need to find what's causing this.

Also on another note, the left leg while it doesn't get detached from the mesh, it still gets deformed in not a nice way.

Thank you in advance! :)

Instead of creating new faces I used the merge vertices function of blender, here's the final result:

I noticed where the leg of the turtle meets the body of the turtle they are not connected.

All the vertices looked like the second vertex down, on both sides.

How to fix

First of all go to where the right leg and body meet, in edit mode.
From their select one vertex attached to the body. Then select the corresponding vertex on the leg like this:

Once there press Alt + M and finally press A. Once completed do the same to all the vertices, on both sides of the leg.
If you play the animation now the leg will be deformed, to fix this simply re-set the parent of the mesh to the armature. I did this using automatic weights.

Happy Blendering!


How to animate rotation of an object without modifiers I'm trying to recreate this rig from this video

I've managed to create shape but for animation I cannot find a way to rotate object around it's Z axis without influence on modifiers. Do you have any ideas how to perform this in Blender?
Thanks!

Parent your object to an empty and rotate the empty. So, in details:

Create your object, put its origin to its geometry, create 2 empties at the exact same point, parent the object to one of the empties, let say the cube.

Give your object a first Simple Deform modifier, Twist mode, Angle 360°.

Give your object a second Simple Deform modifier, Bend mode, Angle 360°, with the other empty (here a Plain Axes) as Axis. Now when you rotate the first empty (Cube) on the Z axis it should rotate the way you want.


How to animate the render size? I have a lot of camera background images for reference in an architectural project. I made an animation where, for each frame:

The camera position is defined, corresponding to one of the images
the same image is used as viewport background. Images have been grouped in a video, and the video is used as a camera background instead.

This way I can change my reference image and match the point of view by just changing the current frame.

However some of the images are in portrait mode, some in landscape mode, and the render size ("resolution") has to be switched accordingly, frame by frame.

This works manually, but I'd like to do this automatically.

Example: Selecting frame 30 to set the (animated) camera viewpoint to some actual picture which was shot in portrait mode and inserted in frame 30 of the background video:

The 30rd background video frame is stretched because the "resolution" is not set accordingly. Is there a bypass?

I think the only way to do that is to use a python script to adjust and render each frame.

import bpy

res_landscape = [1920,1080]
res_portrait = [1080,1920]

frame_res = {
    1: res_landscape,
    2: res_landscape,
    3: res_portrait,
    4: res_portrait,
    5: res_landscape,
    }

scn = bpy.context.scene

for f,r in frame_res.items():
    scn.frame_set(f)
    scn.render.resolution_x = r[0]
    scn.render.resolution_y = r[1]
    scn.render.filepath = '//renders/image{:03}.jpg'.format(f)
    bpy.ops.render.render('INVOKE_DEFAULT', write_still=True)


World Space Ambient Occlusion Gotta question about Eevee rendering.
Normally, Eevee uses screen space ambient occlusion and screen space stuff obviously generates lots of artifacts, like the one on the picture, where the occlusion on the building ceases near the edge of the estacade, which is closer to the camera. Is there any way to use more realistic AO rendering method for Eevee? Something that might be called "world space ambient occlusion"? Something closer to Cycles, at the obvious performance cost?

Well I assume you are already familiar with how cycles and Eevee rendering works. Like you said Eevee uses fake/cheat method. What you are asking for is achieve Cycles like AO which is physically accurate (depends on the values on a given scene). Currently there's no proven working method that achieves that, I can suggest you to bake the AO in Eevee like we bake in light from Cycles.


How can I reset Physics for fluid simulation? I created a water simulation, added a cube as domain and applied collision to the ground. It didnt work, the water just went through. So, I decided then to apply Boolean to the cube domain that way it could get the shape of the ground and avoid to apply another collision object. The simulation just baked as it were a cube, it didn't follow the shape after Boolean. the water it's just passing through as shown in the picture.

I have tried different ways but can't get to reset the water simulation and follow the shape of the ground.
I never hit the bake button but it seems to be saved somewhere. How can I reset previous bake of water simulation?

Regular physics Collision has no effect on liquids. If you are using correct Fluid Collision, check that the normals are the right way on your plane.
Because the mesh of a fluid domain is actually completely replaced by the mesh generated by the simulation, the domain itself always must be cuboidal and aligned with the world axes and will thus will automatically be a bounding box of whatever mesh the domain was originally,
To clear the cache of a fluid domain: Seek to scene frame 1, then force the fluid cache to delete by changing the domain resolution, then change it back. The cache will reset unless you baked it.


Bake Animation Nodes text animation Is it possible to bake an Animation Nodes animation that uses Trim Text and Text Object Output nodes?

I've been following this tutorial to create a typewriter text animation effect.

I eventually want to remove the node tree but keep the animation and have seen that Animation Nodes has a Bake to Keyframes option.

However, when I press this nothing happens. If I remove the node tree the text remains static. Is there any way to bake this animation? I have also tried exporting the file to an Alembic file but the output is only a few hundred bytes in size and doesn't work.

Blender does not allow key-framing text data, so you can't really bake this animation to key-frames. What you can do is separate the texts using the Separate Text node and then animate the scale or the visibility of the individual characters as follows:


Is HD7670 4GB DDR5 128 Bit compatible with Blender Operating System: Windows 10 Pro 64-bit (10.0, Build 18362) (18362.19h1_release.190318-1202)
             Language: English (Regional Setting: English)
  System Manufacturer: Dell Inc.
         System Model: OptiPlex 390
                 BIOS: Default System BIOS (type: BIOS)
            Processor: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz (4 CPUs), ~3.1GHz
               Memory: 8192MB RAM
  Available OS Memory: 8090MB RAM
            Page File: 5779MB used, 4229MB available
          Windows Dir: C:\Windows
      DirectX Version: DirectX 12
  DX Setup Parameters: Not found

I'm using blender V2.79, running windows 10, please view the specs for more details. I'm about to buy this card from a friend HD7670 4GB DDR5 128 Bit. I want to know if it's compatible with my Blender version on workstation?

The AMD Radeon HD 7670 is from the Radeon HD 7000 series and has the TeraScale 2 architecture.

Blender 2.79:

The minimum requirements for AMD GPUs, in order to run Blender, are:

  Blender 2.79 runs on all systems that support OpenGL 2.1 and above, with recent graphics drivers. For macOS, version 10.9 and later are supported.

The minimum requirements for GPU rendering with OpenCL are:

  OpenCL

  OpenCL is supported for GPU rendering with AMD graphics cards. (We only support graphics cards with GCN architecture 2.0 and above). To make sure your GPU is supported checkout this Wikipedia page.

Conclusion for Blender 2.79:

It would be possible to run Blender 2.79 with the AMD Radeon HD 7670 graphics card, however you already have an integrated GPU in the Intel i5-2400 that satisfies this requirement as well. The AMD Radeon HD 7670 does not meet the requirements for GPU rendering.

Blender 2.8x:

The minimum requirements for AMD GPUs, in order to run Blender, are:

  AMD: GCN 1st gen and newer

The minimum requirements for GPU rendering with OpenCL are:

  AMD

  OpenCL is supported for GPU rendering with AMD graphics cards. Blender supports graphics cards with GCN generation 2 and above. To make sure your GPU is supported, see the list of GCN generations with the GCN generation and supported graphics cards.

  AMD OpenCL GPU rendering is supported on Windows and Linux, but not on macOS.

Conclusion for Blender 2.8x:

The AMD Radeon HD 7670 graphics card is not supported for Blender 2.8x.

I wouldn't recommend buying the AMD Radeon HD 7670.


Joining and rotating several kitchen doors I am trying to make my kitchen in Blender, and because I have so many single meshes I would like to join them. But I also want to be able to open the dors, one at a time (hope you understand- I am Danish and not very good at English).
I have tried the Pivot Point, but I cannot make it work the way I want.
Is it not possible?

Join all the meshes you don't want to animate, like floors and walls, with ctrlJ.

About the doors: Keep them as separate objects. You can parent them to the house object (ctrlP > Object) so that when you'll move the house on your scene they will follow.

You can't use the Pivot Point of the 3D View to animate them, because it's not taken into account in animations, so come back to Median Point for example. You have to use bones, or, even simpler, use origin point:

In Edit mode Select the face where you want the rotation axis to be (ie hinge of the door), press shiftS > Cursor to Selected, go back in Object mode and press shiftctrlaltC > Origin to 3D Cursor. Now the pivot point will be correct.


Mirror modifier is not working, no mirrored object? I'm learning how to use the mirror modifier and I am having some trouble.  When I apply the modifier to my object I don't see a mirrored version of it.  What am I doing wrong?

The mirror modifier mirrors the object around the object origin (the yellow dot in the center of the cube).

Since the origin is in the center of the cube, the mirrored half is the same as the existing geometry of the cube, and no change is apparent.

If you move the cube in Edit mode (which won't move the origin), you'll notice the cube is mirrored as you might expect:

Note that in addition to moving the object origin (CtrlAltShiftC) where you want to mirror, you can specify a Mirror Object:

This will use the origin of the specified object (usually an empty) instead.


How do I get the normal vector of a selected vertex?(BMESH) I'm trying to Orient my gizmo according to the normals, but I can't do it exactly. Sometimes perfect, sometimes not. Can you tell me what's wrong?

ob = position_matrix()
orig_loc, orig_rot, orig_scale = ob.decompose()

uniques = bpy.context.objects_in_mode_unique_data

# Selected Object(EDIT_MODE)
bms = {}
for obj in uniques:
    bms[obj] = bmesh.from_edit_mesh(obj.data)

# Selected Vertex
verts = []
for obj in bms:
    verts.extend([v for v in bms[obj].verts if v.select])

# Get Faces Normal
faces_normal = []
for vert in verts:
    faces_normal.extend([f.normal for f in vert.link_faces])

# Delete Duplicate Vector
def del_duplicate(list):
    newList = []
    for i in list:
        if i not in newList:
            newList.append(i)
    return newList

# Tangent
faces_tang = []
for vert in verts:
    faces_tang.extend([f.calc_tangent_edge() for f in vert.link_faces])

faces_normal_Sort = del_duplicate(faces_normal)
faces_tang_Sort = del_duplicate(faces_tang)

normal_vector = Vector(sum(faces_normal_Sort, Vector())).normalized()
tangent_vector = Vector(sum(faces_tang_Sort, Vector())).normalized()

axis_dst = Vector((0, 0, 1))
axis_dst2 = Vector((0, -1, 0))

vec1 = normal_vector @ ob.inverted()
matrix_normal = axis_dst.rotation_difference(vec1).to_matrix().to_4x4() #@
ob.inverted()

vec2 = tangent_vector @ ob.inverted()
matrix_tang = axis_dst2 @ matrix_normal.inverted()
mat_tmp = matrix_tang.rotation_difference(vec2).to_matrix().to_4x4()

matrix_rotate = mat_tmp @ matrix_normal

matrix_rotate = matrix_rotate.to_4x4()

Track to Quaternion

To align to vertex normal.

The normal orientation with respect to vertices appear to be a track to quaternion, tracking Z in direction of normal, and using -Y as up.  Since the only options for up in Vector.to_track_quat(to, up) are 'X', 'Y', 'Z' track with Y up and inverting the scale in X and Y.

Simple example. Run in object mode, adds an empty displayed as arrows, at each vertex aligned to normal.

import bpy
from mathutils import Matrix

context = bpy.context

ob = context.object
mw = ob.matrix_world
me = ob.data
Sx = Matrix.Scale(-1, 4, (1, 0, 0))
Sy = Matrix.Scale(-1, 4, (0, 1, 0))

S = Sx @ Sy

for v in me.vertices:
    R = v.normal.to_track_quat('Z', 'Y').to_matrix().to_4x4()
    R.translation = mw @ v.co

    bpy.ops.object.empty_add()
    mt = context.object
    mt.empty_display_type = 'ARROWS'
    mt.matrix_world = R @ S

Related

Align to face normal vector


How to transfer an animation from a tree of empties onto an armature (space conversion)? I'm writing an importer for a game format and everything is fully functional except for the animations, which are still not affecting the skeleton as intended.

Note that the conversion from node to blender bone format is done with the following code, so the bones are reliable and their original matrices can easily
retrieved from the bones:

bone.head = mathutils.Vector((0,0,0))
bone.tail = mathutils.Vector((1,0,0))
bone.transform(node_bind_matrix_worldspace)

Now the animations, I can correctly visualize them as a tree of parented animated empty objects, but I need to transfer these transformations onto an armature.

My assumptions are:
- empty transformations are relative to the parent empty (ie. there is no rest pose; the original, unkeyframed transformation is simply overwritten)
- bone transformations are relative to the bone's own rest pose
- the coordinate axes used by blender bones and my animated empties are different

Which means that to get from the empty object transformations to a bone transformations, I think I have to do two things:
- remove the rest pose from the transformations
- change the coordinate system (the blender bones point in Y-direction, while the empties point in X-direction)

My keyframes are stored in 4x4 matrices called key_mat. To remove the rest pose from the transformations, I do:

key_mat = key_mat * node_rest_mat.inverted()

(I've also tried the "commute", ie. key_mat = node_rest_mat.inverted() * key_mat)

To change the coordinate system, I do the following and it seems to work on the tree of empties:

matrix_swap = mathutils.Euler((math.radians(90), 0,
math.radians(90))).to_matrix().to_4x4().inverted()
#...
key_mat = matrix_swap.inverted() * key_mat * matrix_swap

I have also tried axis_conversion(...) from bpy_extras.io_utils but could not get the same result.

The result has the Y axis pointing forward as intended, and is globally rotated as well. Local animations are preserved, so it should be good.

If I do the steps as described above and put everything together, I'm getting a distorted skeletal animation but not the desired result:

I just can't seem to produce code that puts those two together into something that creates equivalent animations on the skeleton.
Any ideas on how to correctly transfer the keyframes from these empties onto the bones?

Now I got it!

Bones are calculated using this code. Then the rotations are corrected locally, and finally the bones are rotated into the desired spot as if you rotated the whole skeleton in object mode and applied the rotation.

Overview:

#first create the matrices to correct the transformations
matrix_swap = mathutils.Euler((math.radians(90), 0, math.radians(90))).to_matrix().to_4x4()
rotateback = mathutils.Euler((math.radians(-90), math.radians(-90), 0)).to_matrix().to_4x4()

#create and pose the bone
bind = matrix_swap * bind * matrix_swap.inverted()
tail, roll = mat3_to_vec_roll(bind.to_3x3())
bone.head = bind.to_translation()
bone.tail = tail + bone.head
bone.roll = roll
bone.transform(rotateback)

#bring the keyframe into the right space
#we must make this matrix relative to the rest pose to conform with how blender bones work
key_matrix = fallback_matrix[bone_name].inverted() * key_matrix
key_matrix =  matrix_swap * key_matrix *matrix_swap.inverted()

The complete importer code is available on github.

Below is my original answer:

Not really an ideal solution, but at least progress.

This brings the keyframe from relative to the parent space into relative to the bone's own rest pose space:

key_mat = node_rest_mat.inverted() * key_mat

The keyframe would then work on the bone if the bone was oriented like the empty.

So I tried to orient the bones like the empties, ie. give them the same local orientation. I could not get it to work with the following 'reliable' bone creation code that I'd like to use:

 bone.head = mathutils.Vector((0,0,0))
 bone.tail = mathutils.Vector((1,0,0))
 bone.transform(node_bind_matrix_worldspace)

Probably I was doing wrong matrix math with the bones... Instead I had to resort to this answer. I have used that in previous scripts but discarded it in favor of the above code, as manually calculating head, tail and roll tends to mess up the roll on some bones.

I will keep at it and see if I can do it with a nicely aligned skeleton...


Anyway to use light information as a mask? Is there anyway to set up a node mask that sees how much light is hitting an object and adjusts its transparency based on how lit an area is?

Like if I had a textured ball, and wanted the texture to lower its opacity when a lamp shines onto it, but moved the camera around to the dark areas the texture is still visible . Is this possible in Blender?

Sort of.

Create a light. Create an Empty and use the Copy Location constraint with the light as the target.

Use the following node tree as the texture for the object. Be sure to note the Empty selected as the Object in the Texture Coordinate node.

In this case, I'm just mixing between red and blue. Transparency doesn't seem to work, but you could create a second view layer, use this texture with an emission shader and use that as a mask in the compositor.


UV mapping results in stretched texture on simple mesh I've got a very simple mesh for which I can't figure out why I am not able to get an undistorted texture (using Blender 2.80, but exporting to FBX and importing in 2.79 has the same results):

Another interesting thing is that if I adjust the UV map (e.g. make it shorter) it doesn't seem to have any effect on the texture. I have already applied the scale/rotation, prior to uv unwrapping. I've tried subdividing the long faces and unwrapping again, but that didn't appear to help. I've also tried recreating the object from scratch in a new file, and initially the uv mapping resulted in textures as I expected, after a bit of poking around in the uv mapping, it ended up stretching the same as the original.

The maddening thing is the geometry is so simple I'm pretty sure I could calculate the uv coordinates manually.

Any suggestions what might be wrong? Blend file

The reason is that your generated checker texture does not use the UV-Map.
Go to the Shading workspace, add a UV-Map node and connect it to the Vector input of your Checker Texture.


Change active object through scripting Currently running 2.79

I'm having issues figuring out how to select objects:
This is my code, what I want it to do is create two spheres, and then resize the first created sphere after the second is created

def sphere(x, y, z, radius, resolution=30):
    bpy.ops.mesh.primitive_uv_sphere_add(segments=resolution, ring_count=resolution, view_align=False, enter_editmode=False, location=(x, y, z))
    bpy.ops.transform.resize(value=(radius, radius, radius), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
def renameActive(name):
   bpy.context.active_object.name = name
def scale(x, y, z):
    bpy.ops.transform.resize(value=(xScale, yScale, zScale), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
#change active
sphere(3,0,0,1)
renameActive("RescaleLater")
sphere(0,0,0,1)
renameActive("leaveAlone")
scene = bpy.context.scene
objs = scene.objects
rescaleSphere = objs['RescaleLater']
scene.objects.active= rescaleSphere
print(objs.active)
scale(1,2,1)

After running this, console shows:

  < bpy_struct, Object("RescaleLater")>

So the active object should be what is being rescaled, but as shown below the sphere titled leaveAlone is being scaled.

This is what shows up; the leaveAlone sphere has been resized but in the scene outliner RescaleLater has its name highlighted, though it's not actually 'active' in the sense where I can edit it through scripting as the activated object.

More elaboration:
I know I can just resize immediately after creating the first sphere, but I need to figure this out to implement applying Boolean modifiers on specific objects (I can create the Boolean modifiers and tie them to the correct objects but haven't been able to apply), my code is more complex but this I've simplified it to this to get to the core problem of not being able to manually set the active object through python scripting. I can provide full code if helpful. Have also tried all the other versions of this question that I've seen here/elsewhere but haven't found something that works.

You could return the sphere object from createSphere so you can access it directly later:

def sphere(x, y, z, radius, resolution=30):
    bpy.ops.mesh.primitive_uv_sphere_add(segments=resolution, ring_count=resolution, view_align=False, enter_editmode=False, location=(x, y, z))
    bpy.ops.transform.resize(value=(radius, radius, radius), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
    return bpy.context.active_object

Now the sphere creation, renaming and scaling could look as follows:

first_sphere = sphere(3,0,0,1)
first_sphere.name = "RescaleLater"
second_sphere = sphere(0,0,0,1)
second_sphere.name = "leaveAlone"
# Rescale first sphere
first_sphere.scale = (1, 2, 1)

Another way to retrieve and object: from bpy.data.objects, if you know the name of the object

obj = bpy.data.objects.get("ObjectName")
if obj:
    obj.scale = (1, 2, 1)


Fluid flowing through linked obstacle I have linked an object from another .blend file that has fluid obstacle physics. I have an inflow fluid object flowing onto it and a fluid domain object surrounding it.

However, the fluid simply flows through the linked obstacle object. Are there any properties I need to tweak or is this not possible?

Fluids ignore the linked object but you can create a proxy of the object and make that a fluid obstacle.  Sorry.
Hopefully, unlike me, you've moved on by now, and this isn't the worst news you've had all week.


Armature not in edit mode I have a script that creates an armature in the first run, and then finds it in the second run. When I try to add a bone to it in the second run, I get this error: Armature 'Armature' not in edit mode, cannot add an editbone.

if armature_name in bpy.data.objects.keys():
    armature = bpy.data.objects[armature_name]
    armature_data = armature.data
    print ('armature found')
else:
    bpy.ops.object.armature_add(location = (0.0, 0.0, 0.0))
    armature = bpy.context.object
    armature.name = armature_name
    armature_data = armature.data
    armature_created = True
    print ('armature created')

#I was in object mode before
bpy.ops.object.editmode_toggle()
#Also tried bpy.ops.object.mode_set(mode='EDIT')

#This crashes the second time
bone = armature_data.edit_bones.new(bone_name)

What am I doing wrong? Why am I not in edit mode? It seems that I am in edit mode, but the armature thinks I'm not.

It's more reliable to tell Blender which mode to switch to instead of relying on editmode_toggle(), because there's an enter editmode option, so you can't be sure what mode an object is in after creation:

bpy.ops.object.mode_set(mode='EDIT')

BTW: this is better than your current code:

try:
    armature = bpy.data.objects[armature_name]
except KeyError:
    # create armature


Change Metaball stickyness I am using simple Metaball objects to create a very simple key-framed animation where two objects collide and "stick" to each other.

The natural elasticity and stickyness of Metaballs makes it very simple and quick to setup an animation. However, I would love for the two shapes to be more "sticky" together, such as the effect you get when you eat melted cheese for example.

Changing Threshold makes the "Joint" area very big and it doesn't look like the desired effect:

This is what I want (without changing object size or distance to each other):

How can two Metaball objects "stick" with each other more than the default setting?

Play with the values for Threshold and resolution

From the Manual:
Threshold (Influence)

Threshold defines how much a meta’s surface “influences” other metas. It controls the field level at which the surface is computed. The setting is global to a group of Meta objects. As the threshold increases, the influence that each meta has on each other increases.
There are two types of influence: positive or negative. The type can be toggled on the Active Element panel while in Edit Mode, using the Negative button. You could think of positive as attraction and negative as repulsion of meshes. A negative meta will push away or repel the meshes of positive Meta objects.


How to lessen geometry of an object during animation I'm  using Blender 2.8 to animate the growth of a curve that is beveled using python and Animation Nodes 2.1.4 (running Ubuntu 18.04 64bit) The animation generates about 2.6+ million vertices and faces when the animation finally reaches the end.

At each frame the vertices and faces are increased due to its "growth".  Is there a way to decimate or control the amount of vertices / faces in Animation Nodes or does anyone know of another way to prevent the generation of so many vertices / faces or to lessen them during the animation process?

Here's the Animation Nodes.

Python Code: used to generate the data:

import math
import numpy as np

def lorenz(x, y, z, s=10, r=28, b=2.667):

    x_dot = s*(y - x)
    y_dot = r*x - y - x*z
    z_dot = x*y - b*z
    return x_dot, y_dot, z_dot

dt = 0.008
#num_steps = 150

# Need one more for the initial values
xlist = np.empty(num_steps + 1)
ylist = np.empty(num_steps + 1)
zlist = np.empty(num_steps + 1)

# Set initial values
xlist[0], ylist[0], zlist[0] = (0., 1., 1.05)

# Step through "time", calculating the partial derivatives at the current point
# and using them to estimate the next point
for i in range(num_steps):
    x_dot, y_dot, z_dot = lorenz(xlist[i], ylist[i], zlist[i])
    xlist[i + 1] = xlist[i] + (x_dot * dt)
    ylist[i + 1] = ylist[i] + (y_dot * dt)
    zlist[i + 1] = zlist[i] + (z_dot * dt)

Example of animation of the Lorenz Attractor being generated:

I've also attached the blend file.

You can use the Slice List node to reduce the number of spline points. To do so, disable the Start and End options of the node and enable the Step option. The higher the step is, the less spline points you will get.


Loft splines Does not close object,Animation nodes I have 2 closed curves and I connected them using the Loft splines node,
But the resulted mesh have a face missing.

How can I close it?

This was a bug in the Animation Nodes addon. The problem appeared when you tried to loft cyclic splines.

The bug is fixed now. Please download a new version (uninstall the old version at first).

Btw a quick tip: when the normals of the output object show in the wrong direction it helps when you insert a "Reverse List" node as shown in the example.