Change material of object between multiple scenes

If you can afford to actually make a copy just of the car object, you can have two objects with the same settings but different material. For this you need to switch the material from Data to Object, otherwise it still has the same material for the same mesh.

However, if you can't copy the object you may have to do some python trickery to get it working. Below you'll find a quick test using a scene_update_pre handler function. This is called when the renderer updates each scene, so you can use it to switch colors or do anything else needed. You will have to adjust the handler according to your blend file and material setup.


In the VSE you use these buttons:

Or you can use the right-click menu:


If you want the Undo / Redo system to work with a custom operator, you need to add bl_options = {'UNDO'} when defining the class.
Your script then becomes :
import bpy

class CreateEmptyOperator(bpy.types.Operator):
    bl_label = "Create Empty"
    bl_idname = "wm.create_empty"
    bl_options = {'UNDO'}

    def execute(self, context):
        parent = bpy.data.objects.new("Empty", None)
        context.collection.objects.link(parent)  # Use the current context when available instead of bpy.context
        return {'FINISHED'}

class MyPanel(bpy.types.Panel):
    bl_idname = "OBJECT_PT_my_panel"
    bl_label = "My Panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

    def draw(self, context):
        self.layout.operator("wm.create_empty")

bpy.utils.register_class(CreateEmptyOperator)
bpy.utils.register_class(MyPanel)


Armature moving points for no apparent reason

There could be two solutions to this problem. However, you can fix this problem easily. Solution #1 Go into the vertex groups menu, select the vertex group  For the bone that is causing your problem,  go into edit mode for your character's object, select only the vertices you don't want to be effected by the bone, and press remove. this will remove any un-wanted vertices from the bone's influence.

Pressing assign will add any selected vertices to the vertex group with 100% influence.
Pressing remove will remove any selected vertices from the vertex group's influence

Solution #2 You have no weight for the vertex causing the problem on any of your foot bones. Thus, when you move the Thigh L bone, it moves the lower leg and all the foot bones with it, but because that single vertex has no weight, no bones will move it. to fix this, go into weight paint mode, select an appropriate foot bone, and paint on some weight. Or you can select that vertex, then select the bone's vertex group and click assign.


How do I make the area brighter so I can see vertices in really dark areas or angles?

I found a really handy trick for this and maybe it will help someone else out too.

First, make a duplicate of your lamp.
Then position that second lamp so it's Behind your camera, not in front (really important)
Parent the lamp to the camera by dragging and dropping the lamp onto the camera in the hierarchy.
Finally, press 0 on your keypad to go into camera mode, then press Ctrl + F to go into free camera mode and move about normally.

You'll notice now that you have much more light then before and if you have multiple viewport windows open, you can even see the camera and lamp move around together (so you can see it working, not that useful but still cool!)

When you finished all your work on your model, delete the lamp :)

Hope this helps somebody out there! :)


I'm assuming the issue is that it's impossible/difficult to properly UV-unwrap a fluid, moving mesh?

2 solutions off the top of my head:

Use "Generated" as the Texture Coordinates, and then Use Box method on the Image node to blend the texture seams together.
If you need more control over the texture placement, use the UVProject modifier with a number of projector cameras in the scene. You might need to add an alpha feathered transition to the edge of the image manually in an external app. For an animated texture, you might need to blend it with an alpha mask image.


Model's Limbs Shortening/Flattening When Bent

Select your armature in Object mode, as you can see it has been scaled and therefore it stretches your mesh as soon as you move bones, so just apply the scale with a CtrlA and it will work fine.

As for your hair rigging, your hair is controlled by bones that are not supposed to control it, you need to assign it to the head vertex group:
Go in Edit mode, select the hair mesh (press L to automatically select the whole mesh):

Go in the Properties panel > Object Data > Vertex Groups, in the dropdown menu on the right of the vertex groups list, click on Remove From All Groups:

Select the group called Spine006 (it's the group that is controlled by your head bone, when you parent With Automatic Weight, vertex groups are automatically created with the name of the bone that is controlling them) and click on the Assign button:


VSE: Select all the strips of a given track?

Select a strip on the channel you want, then use Select > Channel > Both sides.
bpy.ops.sequencer.select_side(side='BOTH')


how do you accesses the properties of an object in another scene?

Thanks fam, I found the code in another question.

import bge
from bge import logic

for scene in logic.getSceneList():
    if scene.name == 'ground':
        ground = scene

Back = ground.objects['back']

Back ['phase'] =3

This works to change back's property from another scene


There are several problems in your file:

All the objects have un-applied scale, which can cause rigid-body simulations to behave strangely. Apply the scale to the objects mesh data with CtrlA>Scale.
The SVG/star object's origin is not centered. The origin is used to determine the center of mass, so if it's in an odd place (as in this case), it will cause strange behavior. Center the origin with CtrlShiftAltC> Origin to Center of Mass.
The SVG mesh has some strange topology/overlapping faces:

The SVG mesh is a little messy, with non-manifold geometry and overlapping faces:

Try deleting all the faces and then adding loop cuts at the intersections to get a mesh like this (click for slower speed):

Optimizations:

There are few minor optimizations you can make too:

Make the floor solid. Rigid-body simulation likes manifold meshes more than non-manifold meshes (such as a plane).

Another advantage to using a floor with thickness is you can use the Box collision shape for it, which tends to be faster and more stable than the Mesh option.
Use the Box option for the cube. It's always better to use the primitive collision shapes where possible.
Use the mesh collision shape on the SVG. Because the SVG has concave parts, only mesh will allow it to collide accurately.

Result

Example .blend


Animation flipped 180 degrees in Unity with .fbx export

Well it looks like it's caused by the existence of LocRotScale keyframes in Blender, i.e. keyframes related to the objects rather than the bones. It can be cleaned up either in Blender if possible, or those keyframes can be removed in Unity from the animation window after import.

Also, exporting with FBX version 6.1 instead of 7.4 from Blender seems to eliminate the flipping problem regardless, but not the origin problem.


Try to add additional loop, and leave it on the surface:

It will add transition between main surface and the edges


Why do the objects imported to libGDX look white?

Had you checked in blender's cycles render? If not, you probably not handle the material correctly.

In my case, this defection comes from the material arrangement as a result of my unfamiliar with blender. I think it's the material should loaded by gdx until i compared the results from the same java code with the obj file used by xoppa's tutorial. see the tutorial:

https://xoppa.github.io/blog/loading-models-using-libgdx/

The ship's material is showing.

You'd better check it.

Another way to check the material is exported correctly is open and search your obj or g3dj files.

In obj file's 'f' section, the vertex's format is position/uv/norm, see

https://people.cs.clemson.edu/~dhouse/courses/405/docs/brief-obj-file-format.html
My case is "3//0.3, ...", so there the problem is picture not mapped to vertex.

If you open the g3dj file, the lack of UV mapping will makes fbx-conv converting empty UV mapping, like:
    {
        "version": [  0,   1],
        "id": "",
        "meshes": [
            {
                "attributes": ["POSITION", "NORMAL"],
                "vertices": [ some-6-dimesional-vectors ...
This vertices lacking UV data. The "attributes" should actually 3 attribures:

    ["POSITION", "NORMAL", "TEXCOORD0"]

And the vertices should be 8 elements.
To unwrap and uv mapping, see blender manual:

https://docs.blender.org/manual/en/latest/editors/uv_image/uv/editing/unwrapping/mapping_types.html#unwrap

Hope this will be helpful although years latter.


Nothing is wrong, the denoising takes time, that's all.

In your blend, most of the area has literally nothing. The renderer notices that and renders those areas extremely fast. The denoiser still has to treat all the pixels, and does not know that there is nothing there.

As an exemple (CPU only, render size changed to 1080x1080):
100 samples, no denoise:
your file, ('as is') : ~11s  (GPU 6s)
with added background plane : ~33 s (GPU: 24s)

1 sample, default denoise settings:
your file, ('as is') : ~25s (GPU: 9s)
with added backgound : ~26 s (GPU: 10s)
(render of 1 sample w/o denoise takes <1s, with or w/o background)

I'm not going to give all the results, but for this scene, the denoising seems to add ~25s to the processing on CPU (on my system, and with the reduced output size!), independent of the presence of a background plane or the number of samples.


How to limit rotation on the last bone of an ik chain

The Chain Length of the Inverse Kinematics constraint is including the bone that has that constraint. In your case the value is 3, so it applies to Bone7, Bone6 and Bone5. Therefor Bone4 is not part of the the IK setup and it's rotation behavior cannot be limited by the Inverse Kinematics settings in the Bone Properties.
You can increase the value of the Chain Length to include Bone4. (Or put a Limit Rotation bone constraint on it in the Bone Constraint Properties tab if you don't want it to be part of the chain.)
Also when Relationship Lines are active (which can be made visible by checking the box in the Overlays menu), you can see a line from the start to the end of the chain that can help determine the length in the 3D Viewport.
Edit:
Note that if the box next to Use Tail is not checked, the bone that has the Inverse Kinematics constraint, is not part of the chain. However in this case that bone (otherwise first in the chain) is not affected by inverse kinematics, and (more importantly) the last bone in the chain cannot be constrained in the Bone Properties > Inverse Kinematics menu.


Exporting Video From Blender Video Editor

After you placed your images and set their duration in the Video Sequence Editor (VSE), all you need to do is set up the video format (lower red rectangle in the image below) you need and render as an animation (upper red rectangle).

When there's content in the VSE, it overrides anything else you have in your scene and when you render, it will render out the content in the VSE, instead of using the rendering engine to render your scene.


What is wrong with my mesh? Freestyle render is glitchy and won't show certain lines

There is an object called "Cube" still in the way. You have set certain objects to Hide in Viewport (by clicking the eye icon in next to an object the Outliner), but not set them to Disable in Renders (by clicking the camera icon next to an object in the Outliner). To show the camera icons click on Filter (the funnel icon in the Outliner) and activate them under Restriction Toggles. Then you can also disable objects in your renders.


Where can I find the viewer node for the shader editor?

The viewer node is a simple emission node, it is just created by the node wrangler addon. Once the node wrangler addon is enabled, the addon creates such a node when pressing Ctrl+Shift+RMB on the node.


Select 1 edge of that type
Shift+G >> Amount of Faces Around an Edge.

When you do this, Blender posts the following action it took in python.

As for the raw bmesh method of detecting this:

You can find the Reference in this Link

For getting the Horizontal & Vertical sets in two separate passes, I would inspect the verts like so:

Horizontal Case:

  All Edges Have the Same Z values for the start and end vertices.

Vertical Case:

  All Edges Have different Z values for the start and end vertices.


How do I achieve the traditional 3/4 perspective of JRPGs using the camera?

Keep your camera angle 45° and have your geometry dimensions like this:

Then you will get the perfect squares:


Problem with subdivision modifier making a hard edge have curves between each vert

Looks more like the topology of your mesh needs some improvements.
Look at this two images and the way they look with a subdivision modifier because of the topology.


Is there a way to adjust the radius for AutoMerge welding verts?

Ask a question, find the answer yourself:

Using AutoMerge Editing - things aren't merging, what isn't right?

Go into Edit Mode - Tool Shelf - Option Tab on the left - change Double Threshold


There aren't any rules for particular roll for particular bones.  For bones that rotate in only a single axis, fingers and such, I tend to make that the X axis simply because it makes it easy to set the roll from a cursor (select tail of bone and head of parent, snap cursor to selection, recalculate roll->cursor.)

A good way to build rigs to get easily mirrored poses is to build only one half of them and then use armature edit mode's "symmetrize" tool to create the other half.  This will provide appropriate rolls.

Another way to fix rolls is to turn on X-mirror in tool options and set the roll for one side's bones individually.  Blender recognizes bone symmetry on the basis of name, not roll, so x-mirror will apply roll changes appropriately even to bones that aren't fully mirrored (unmirrored roll.)


Seems that you can set the active UV layer through the uv_textures collection rather than uv_layers:

bpy.context.object.data.uv_textures['AO'].active = True


How do I make bunch of objects be in one plane?

enable the Objects: Align Tools addon

select all objects to be aligned. the active object will be the reference object

go to n-panel > item > align tools and choose appropriate align location axis (here, y)


How do I light up a dark scene correctly in Cycles?

"Correct lighting" is highly subjective, and so my answer is just based on my personal preferences and not some formula of doing things 'right'.

To start, I like to use at least a bit of ambient occlusion or global illumination on the scene to prevent large areas of the scene to be lost in shadow. In general you should try to avoid absolute black values.

Add a point lamp wherever your light source would be in the scene or if you have a lightbulb mesh, you could add an emission material to it for more accuracy. Then simply play around with the lamp/emission settings until you get a level of brightness you like. Try turning off AO to see the effect of only your light. Also note that you can enter a negative value into a lamp object and place it in corners of the scene that you want to look extra dark.

Hope that gives you an idea or two.


You've accidentally changed your selection mode.

The hotkey for this is W.


I got word from Blender that this is a design decision and no longer supported in blender any longer.

Closed issue.


In blender, I know of no difference between curves and paths.
I believe that a few things could be happening.

1) Make sure that the orbs are children of the curve

2) See that Data > Path Animation is checked

3) You might also want the Frames value under Data > Path Animation to be equal to the length of your animation.

If all of these are done, and it is still not working, please upload your .blend file.


What might be causing this blocky shading on my model?

The mesh is fine. The primary cause of the geometric shadow is the texture co-ordinates you have given the HDR environment. The simple HDR setup here...

...results in a smooth shadow.

As reference: Trouble Viewing Whole HDR Image as cycles world

The PBR node you have added obvious effects the edges...


How can I control bone roll animation amidst an IK?

How did I end up solving this, in case anyone else wants to do something similar:

Four bone chains.

The first one is the IK, and it pretty much follows the rotation of the entire chain pole angle, but you can add a second bone chain to the arm (four bones) then apply a constraint to copy the rotation of the shoulder bone and then a damped track to the first, IK chain bone target onto it. In this very order. This way, you'll have a chain that follows the IK chain, but has the same up of the shoulder bone. Let's call this the "shoulder chain".

Then, add a third chain, and on each bone, add a constraint copying the rotation of the hand bone (the one that acts as a target for the IK chain), then the same damped track constraint to the IK chain bones' targets. This way, you'll have a chain that follows the IK controls, but each individual bone up direction follows the hand. Let's call this the "hand chain".

Then, the fourth, deforming chain: each bone will have two copy rotation constraints, each pointing to the correspondent bone of the shoulder chain and hand chain. But the later constraint will have proportionally less influence over the bone as you go down on the chain. As I have a four-bones long chain, I put it's influence in 0.125, 0.375, 0.625 and 0.875.

This way I have a chain that both follows the IK control and I can control it's twist along the chain using the shoulder roll and the hand roll as well.


You could animate a displacement map that reveals itself as the wheels pass. If you take your UV from the road, add all the trails, and then add a mask (maybe in after effects, then you would have an animated texture) to reveal them when needed.
This would only work if you already have the animation of the vehicle.


Object is not being cut by Boolean Modifier (Cylinder). How do I make it work

make the deformed cylinder wider, and a bit taller, than the other object. Coplanar surfaces don't work so well with boolean operations.

Or you could avoid booleans and just model that shape using proportional editing.


Reflexions depend on your point of view. If you want them not do do so, the best solution, for now, is not to use them, and rather fake their appearance.

One way to do this in 2.8 is to use the "Shader to RGB" node:

The principle is quite simple: from a diffuse shader, you get the shadow information created by the scene's lighting. And you convert that information to RGB data which you can then modify that data as you wish.

Of course, you can use other data as inputs, like the specularity of a glossy shader, an absolute ramp of a normal node, ... And you can combine them as you wish, as well as mix them with textures, ...

It's the basics of "NPR" (Non-Photorealistic Rendering, you can google those letters and find quite some examples of what people did.


Is it possible to add a loop-cut like bar to a wireframe-like object?

Loop cuts can only be added to face loops. If you've applied the wireframe modifier, you essentially turned each edge into a mesh, so you won't be able to add a concentric loop cut to this object.


Collada has very limited support for materials. The file format still uses the old Blinn, Phong lighting interaction formulas. Blender supports far mature material models that cannot be exported using Collada. Note that Collada was last updated in 2008, more then 10 years ago).

It is possible to extend collada to support different material models, but that only works as both applications (exporter in Blender and importer in other application) implement this extension. This is very difficult to maintain and therefore the extensions are really not useful at all.

An better option (if supported) is to use glTF. this is a file format that was created to supersees Collada and has far better material handling.


How to achieve a plain and clean UV edge export ?

When you export the UV layout you have options on the left of the file browser. You need to set the Fill Opacity to '0':


If you are using Cycles and there is nothing else in the Background you could try a Holdout-Shader. Transparency must be enabled of course. A backround image could then be composited in.


Is it possible to call a function contained in an addon (__init__.py) already installed in blender

Yes.  Actually the next version of the glTF export addon (for upcoming Blender 2.82) will contain a new ability for 3rd-party addons to place glTF extensions into the exported file.  The code for this feature looks something like this:

    if bpy.app.version < (2, 80, 0):
        preferences = bpy.context.user_preferences
    else:
        preferences = bpy.context.preferences

    for addon_name in preferences.addons.keys():
        try:
            if hasattr(sys.modules[addon_name], 'glTF2ExportUserExtension') or hasattr(sys.modules[addon_name], 'glTF2ExportUserExtensions'):
                extension_panel_unregister_functors.append(sys.modules[addon_name].register_panel())
        except Exception:
            pass

In the code above, all addons are searched (via preferences.addons.keys()), but of course you could limit your search to a specifically-named addon, if desired.

Once an addon is found, hasattr is used to look for a specific class name within that addon.  It will call a register_panel function within that class, to register the custom extension's options into the glTF file export UI.


control+z = undo a number of times etc/menu = redo also.
alt+h to reveal hidden if hidden.


Rigify->Generate Rig doesn't create all rig layers in the properties ui

Reposting the solution as an answer as requested.

I was able to solve this by adding a new metarig into the scene and copying all the bone LocRotScale properties from the old one, using the script provided in this topic (thank you sambler): How to copy position, size from one armature to another?. Whatever the problem was, this fixed it and spared me from re-rigging everything from scratch.

The only thing I had to change in that script was my source and target armature names at the top:

import bpy

source_rig = 'metarig_old'
dest_rigs = ['metarig']

############

bone_data = {}

def edit_rig(rigname):
    bpy.ops.object.mode_set(mode='OBJECT')
    bpy.ops.object.select_all(action='DESELECT')

    bpy.data.objects[rigname].select = True
    bpy.context.scene.objects.active = bpy.data.objects[rigname]
    bpy.ops.object.mode_set(mode='EDIT')

edit_rig(source_rig)
for b in bpy.data.objects[source_rig].data.edit_bones:
    bone_data[b.name] = (b.head.copy(), b.tail.copy(), b.roll)

for arm_name in dest_rigs:
    edit_rig(arm_name)
    for b in bpy.data.objects[arm_name].data.edit_bones:
        b.head, b.tail, b.roll = bone_data[b.name]

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


Start with a plane and add loops around the general square area that will contain the button.
Add additional loops to subdivide the square.  These loops will provide additional vertices for our circular button.
Use Inset Polygon to create a smaller square area.  Use LoopTools Circle to turn the insetted quads into a perfect circle.
Move the central vertex of the circle down in the Z-axis.  This will create the depression.
Add definition by creating further edge loops around the circle.
Add a Subdivision Surface modifier and your done.

The resulting topology is all quads and neatly subdivides.


Some tips:

a good topology is very important for smooth joints transformations (try to model your finger as pictured below and you'll see how smooth it bends)

a proper mesh weights assigment is crucial for realistic bend movement (I suggest you using the With Automatic Weights parenting option. Select your mesh, then the bones and press Ctrl+P-->With Automatic Weights. This'll automatically aassign the proper, blended weights for all bones)


I have been wrestling with similar problems and I may start my own question, but in the spirit of cooperation and helping this is what I have found:

Rigify and Blender rigs do not work with CMU (without fixing the problems you mention)
Daz 3D rigs also import via FBX unreliably. The best way to get Daz characters into blender for animation is to bring them in via .dae (collada) and then exporting via obj or fbx and use mixamo for animations and for auto-rigging.
You can then retarget mixamo rigs using "bvh retargeter" to CMU - though not reliably. (https://diffeomorphic.blogspot.com/p/bvh-main.html)
N.B. you often get errors "rot & scale" when using bvh retargter. Do not use "transform rot and scale" - ONLY transform scale, otherwise you will get messed up results.
If using MB-LAb, it has it's own bvh importer and they work well with ACCAD bvh - but not so well with CMU. Do not use bvh retargeter.
If importing from MakeHuman, make sure to use the CMU skeleton.
Do not use FBX from MakeHuman to Blender, use the .mhx2 MakeHuman format and get the add-on for Blender for importing MakeHuman assets. You will get a perfectly compliant rig for CMU and BVH retargeter works perfectly with it.

Further notes;

The "rest pose" can look messed up, even though the "pose mode" works fine. I don't know why. In fact, avoid rest mode altogether unless someone else can bob and up tell us what it is useful for and when and why to use it.
Often the bvh's come with a T-pose at the beginning of the animation - it's best to use that, say for adding assets to a character.
"Daz Friendly" bvh's from cgspeed repository don't seem to work - in any configuration I can find, including with Daz 3d studio itself.
If you are struggling to parent an object to your character, you have to be in object mode with the armature in pose position then; object>select armature>switch to pose mode>select bone>parent to bone.

I hope this helps someone. I sure could have used this a week ago. It's a pretty convoluted situation.


Try something like this for your World (Environment) Shader - it's just 2 Noise Textures with the detail turned down, scaled slightly differently and subtracted from each other. I also added ColorRamps to help "define" the shapes a bit better:

If you want the background to appear plain, while still providing lighting and reflections, mix your patterned background with a plain background using the Is Camera Ray output of a Light Path node as a mix factor. I also added another ColorRamp because the colors looked a bit blurred and indistinct on the reflections. I also ended up inverting the image (by way of the ColorRamp) because it looked a bit closer to your reference image, but I don't think it really matters that much.


How can I call and edit animation keys from the Dope Sheet in Python?

Action is a read-only object that contains a lot more than just location attributes that can be modified by arithmetic.

The first tool you should know about (if you don't already) is dir(). Print the result of dir(an object) (ex: print(dir(context.object.animation_data.action))) to get a list of related members and methods. This isn't a list of everything you can do with an object but just its members. There's also help(a method) which will print some text that may or may not be helpful in describing the usage of a method.

This information might be useful, if only barely: https://docs.blender.org/manual/en/dev/animation/actions.html

As you can see, the relationships are a bit more complex. You MIGHT be able to get to "XLocation" and "YLocation" and modify them directly, but I'd be surprised if that's the intended approach.

This documentation might also help you explore the relationships between these various objects (note that animation_data contains an action object in that list, which you can drill into, to see its members):
https://docs.blender.org/api/blender_python_api_2_77_release/bpy.types.Object.html?highlight=animation_data#bpy.types.Object.animation_data

I suspect that you'll have more success transforming the fcurve object belonging to that action: https://docs.blender.org/api/blender_python_api_2_77_release/bpy.types.FCurve.html?highlight=fcurve

I'm not finding any clear clues, but it's likely that your process will look like the following:
 - for a given Object -> animation_data -> action -> ActionFCurves
 - select the keyframes in the fcurve that you care about (all of them)
 - perform some kind of transformation on them

I hope that helps!

EDIT: Unfortunately, it looks like ActionFCurves is also read-only, meaning that Blender likely intends for you to transform the keyframes belonging to it, using a different approach.

I'm not sure what that approach might be, at this point, but I hope that at least gets you closer.


Can anyone explain while my coin toss in blender mostly falls on its edge

The Rigid Body simulation uses each objects origin as the centre of mass. If you have objects where the origin is not the centre of mass you will get unexpected behaviour such as that which you are experiencing.

For objects that are constructed of a single substance (eg, coins made of a single metal) you can use the Set Origin option in the tool shelf (T) to get Blender to automatically calculate the centre of mass from the mesh by selecting 'Origin to Centre of Mass'. This will move the origin to the centre of mass based on the mesh and the simulation should behave as would be expected.

Note that you can position the 3D cursor and use the 'Origin to 3d Cursor' option to arbitrarily position the origin (centre of mass) as desired.


Typing in "False" makes the object visible and typing in "True" hides the object.


Clarifying Blender skeleton animation and OpenGL

A rotation matrix tells you what to do with the components of a vector indicating the position of a point.  For a rotation around X, a vector along X does not change.  At 90 degrees, a vector along Y becomes a vector along Z, and a Z vector becomes -Y.  Rotation about X causes Z and Y to intermingle.

The fourth row/column do not matter - that is an artifact of doing 3D geometry in projective coordinates. We sometimes call it 'w' and normally just set it to 1.0 and leave it there.  The thing being rotated is a vector representing a direction or position.

The rotation matrix does the rotating.  Generally, it intermingles components in a two-dimensional subspace, and leaves a one dimension subspace, the axis of rotation, alone.

Quaternions, in contrast, are better thought of (sometimes) as the thing being rotated. No, not rotated, but "acted upon".   For quaternions act a bit odd.

The First Quirky Principle of Quaternions is that if we want to deal with a rotation of (theta) degrees, we work on the quaternion by half that angle.

The Second Quirky Principle: instead of having three components like a vector, we add a fourth, conventionally called 'W'. We may call it the "scalar component".  All four components are involved when we "act upon" the quaternion in a way corresponding to some rotation.  I've taken to calling this action "Spotation" for "Spinor Rotation" - in quantum physics, we use "spinors" which amount to the same thing as quaternions.

Consider a rotation about X, as before.  The Y and Z components intermingle, as with a vector, but at half the rotation angle. That is, a 90 degree X rotation which would swap Y and Z (minus signs as appropriate) for a vector, will look like a 45 degree rotation has acted upon the Y and Z components of a quaternion.  (Does Blender S.E allow LaTeX?)

Y' = 1/sqrt(2) Y - 1/sqrt(2) Z
Z' = 1/sqrt(2) Y + 1/sqrt(2) Z

But according to the second quirky principle of quaternions, the "spotation" action intermingles the scalar 'W' component and the X component in a similar manner.

W' = 1/sqrt(2) W - 1/sqrt(2) X
X' = 1/sqrt(2) W + 1/sqrt(2) X

The exact algebraic rules for doing this were invented by Hamilton in the late 19th Century.

Generally, a rotation about any axis A will correspond to a "spotation" about the same axis A, but while a given vector that happens to be parallel to A will remain unaffected by the rotation, the corresponding spotation acting on a quaternion whose vector part is along A, will be affected.

We can relate quaternions to rotations by starting off with a quaternion which is pure scalar, that is,  w,x,y,z = 1,0,0,0.   Then some rotation R about some axis A by angle (theta) will act on the quaternion by converting the W component, being the only nonzero component, into a scalar + vector parallel to A.

Note that one consequence of the Two Quirky Principles of Quaternions is that a 180 degree rotation about any axis, which will just negate any vector perpendicular to the axis of rotation, corresponds to a spotation which looks like a 90 degree rotation. If the axis is along X Y or Z, it cleanly trades (with minus signs as needed) between W, Z, Y or Z.   This is a key point to why interpolation of orientation works so nicely with quaternions, as discovered by Ken Shoemake in the 1980s.  Negation of a vector does not offer any natural way to find a half-way point, but quaternions provide that nice hint.

Another interesting consequence is that a 360 rotation, easily confused with "no operation", corresponds to a 180 degree spotation - negation of all four components of the spinor. I mean, quaternion.  Two different quaternions describe the same orientation of an object.  That sometimes leads to some problems when animating spinning, tumbling, rolling objects, but easily fixed by flipping the sign of a quaternion somewhere in the timeline.

This also describes the strange antics of quantum particles such as electrons. As a theoretical physicist, I could blabber on and on about how all this arises from deep and beautiful mathematical relations between the rotation group in three dimensions, SO(3), and its double-covering group SU(2), and elegant math using "multivectors", and more, but that's getting off-topic for this site...

(Note: "Quirky Principles of Quaternions" is a phrase I made up on the spot just now, to avoid dealing with any real math. You won't find it in any textbook.)


Is there an easy way to uv map a circle to a half of a sphere?

Let's say you have half a sphere:

go to orthongraphic top view (Numpad 7, and  Numpad 5  to togle orhto or perspective)
select all faces, press U, to unwrap, and select Project from view (bounds)

The bounds option means that blender fit the UV map to fit the bounds of the UV image. Note that this will only work without distortion if the image used for UV mapping is square.


Use the color output of the color ramp to mix in a Transparent BSDF with another mix shader node. Make sure the transparent BSDF is the bottom slot of the mix shader in this case.


Copy driver transform object when creating new scene

I would submit that as a bug. I would expect a new driver if I did a full scene copy, and not have a Scene 1 object still driving a Scene 2 target.


What is the difference between 'Save as' and 'Save copy'?

Save As will save the current file as a new file, and you will continue working in that new file.

Save A Copy will save an exact copy of the file with the entered name, and you will continue working in the file you had open before the operation, leaving the copy exactly the same.


How to project a single x/y coordinate in z-direction onto a specific mesh with scripting

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

import bpy
from mathutils import Vector

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

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

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

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

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

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

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

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


Active object set, object mode set, but still "RuntimeError: Error: Modifiers cannot be applied in edit mode"?

I checked the object of interest, obj, is indeed in object mode, but there was one object, which was neither active nor selected, in edit mode. When I made all objects be in object mode, the error was gone.

for o in bpy.data.objects:
    bpy.context.scene.objects.active = o
    bpy.ops.object.mode_set(mode='OBJECT')
    o.select = False
obj.select = True
bpy.context.scene.objects.active = obj

bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(modifier='Subsurf', apply_as='DATA')

Could someone confirm if this is a bug in Blender? Two reasons:

I don't see why other objects are required to be also in object mode for us to apply modifiers to the object of interest.
GUI behavior doesn't match commandline behaviors.


Texture on box stretching on the vertical axis

Basically, the Generated coordinates take the object to have equal size along all three axes, and textures get mapped to between 0 and 1, which can cause stretching or deflating.
The Object coordinates take into consideration the object's actual size, and map textures according to that.

With this texture

I get this with Generated

this with Object and Extension set to Repeat

and this with Object and Extension set to Clip

With Generated in this case Clip or Repeat doesn't make a difference, since the image gets stretched across the entire surface either way.
The above examples I believe are the most relevant to your specific case, but for more in-depth explanations of texture coordinates, this post by PGmath is definitely good reading. Also Manipulate texture coordinates like a boss is an excellent lecture by Bartek Skorupa. Mr. Skorupa focuses mainly on Cycles, but the underlying coordinates work the same in Internal, so you shouldn't have a problem with it if you want to stick to Internal.


Execute script WITH GUI 'Context' object has no attribute 'active_object'

When calling blender from the CLI or script with arguments, it will "perform" each argument in the order it is presented, this can be important with many tasks.

What that means, is that blender -P script.py file.blend will run the given script and then open the blend file, while blender file.blend -P script.py will open the blend file and then run the script. In the second example you don't need to run bpy.ops.wm.open_mainfile and won't have the issue you are trying to solve.

That also means, your addon test example can be reduced to a single line and passed to blender without using a script.

blender file.blend --python-expr 'import bpy; bpy.ops.mesh.operator_to_test()'

Rather than combining a string to pass to os.system() I would suggest using subprocess.call() which uses a list for the arguments, preventing the need to quote and escape... effectively the list becomes sys.argv

As you are doing an automated addon test, consider using --factory-startup and --addon to control what addons are enabled. You could do one run with your normal startup file and another with factory and your addon or simply ensure your addon is enabled without having to change your startup file.

To test an addon with multiple files -

from glob import glob
from subprocess import call

for blendFile in glob('*.blend'):
    arglist = [
    'blender',
    '--factory-startup',
    '--addons',
    'addon_test',
    blendFile,
    '--python-expr',
    'import bpy; bpy.ops.mesh.operator_to_test()'
    ]
    call(arglist)

Or you can loop through multiple addons and test one at a time -

from subprocess import call

for addon in ['addon_test1', 'addon_test2']:
    arglist = [
    'blender',
    '--factory-startup',
    '--addons',
    addon,
    'test.blend',
    '--python',
    addon + '_test.py'
    ]
    call(arglist)


When Connecting the bump node I am getting these square patterns how to fix this?

This is an issue with the geometry  and the lighting.

First of all, make sure your sphere object is actually set to Smooth. (right click on object - Shade Smooth).
Then, if that doesn't solve it, try adding more subdivisions. Modifier tab - add a Subdivision modifier.
Play around with the Size setting of your light. Size is, basically, how diffuse your light is. To use a real-world example, covering a strong flashlight with a thin sheet will increase its "Size" (in Blender terms). In my experience, this artifact is most prominent when using strong lights with small size.


Rendering Smoke on GPU causes: CUDA error cuCtxCreate: Launch failed

I definitely recommend Ignac's suggestion - the TDR setting will mess up many animations if not extended.

As a side suggestion, I would download a program called 'GPU-Z' - blender will often crash before showing the actual amount of memory needed, which in my experience is double the amount stated. EG if you get a crash at 1228 MEM, it's because blender actually needed more than 2400 MEM. I usually see this during the 'Building BVH' stage.

GPU-Z will actually tell you how much memory was being used at the point of the crash. Very handy.

Hope this helps,
Regards, C.


Particles flowing through openings in objects

I tried this with my work.

Blender is not good for many types of CFD, especially particle flow traces through volumes.  (Blender's particles don't have vector/pressure fields to behave correctly, but can sort of, see bottom.)

If you need something engineering-level realistic and want a challenge, look into OpenFoam.  You can import the path traces back into blender: https://www.youtube.com/watch?v=5-GtdRLfeFI
Not animated though.  There's opportunities for better imports though, perhaps there's something better, or someone can script it for you... or perhaps just other tools like Paraview will do what you want.

Blender particles don't flow with air flow pressure, with each other smoothly around objects, etc, they're more like pellets out of a shotgun and like to bounce off/ stop suddenly on surfaces if you turn collisions on.  Not how light particles in air would behave.

There's the "fluid" type... that will get them to go with each other, but still don't slow/speed up/swirl realistically around meshes like air would.

You can make clever use of force fields and try to emulate how the particles will flow, limit the ranges and tweak a ton, add a bit of turbulence etc...
Play with simple flows first.  For what you're describing without seeing your mesh, that's what I would try.

A harder Blender option: I've got fairly close to a real looking simulation using a smoke sim, smoke flow force field driven by that smoke sim, and a particle system (volume emitter inside the smoke sim) with low mass particles, and the gravity field weight set to 0.  It works ok for very simple shapes and needs a ton of tweaking though.  It works for wide open spaces, but not when the flow opening is constricted, it slows down instead of speeding up... (see Bernoulli's principle.)  but that can be faked somewhat with more forcefields... but then you're guessing/emulating again, not simulating.


Newly added part of mesh won't move with Armature

In your Armature modifier, the effect is limited to the vertex group named Armature (not sure why).

Either :

remove the vertex group restriction in the armature modifier
add your tears to the Armature vertex group (seems safer)


How to connect two vertices of two objects in python

Not sure if this answers your question, but you can Shift-Click vertices in Edit Mode to select multiple of them. If you select 2, and then press "F", an Edge will be formed between them. If you select 3 or more and press "F", a Face will be formed between them.


You can do this procedurally by using the generated vector like this:

The Blue channel mean the Z coordinates,and by increasing the contrast you can get your mask,and you can still edit the texture without any problems.


Why won't my object follow the path I give it?

ensure both the outline and the fence element share their origin.

eg, like this, before enabling modifiers:

then, if you enable them:


Light Path node works weirdly for Background

Using a Mix Shader node and 2 background nodes will give you better results and more flexibility than multiplying the strength of the entire world. you can also sorta "mask" it out and add whatever youd like on the 2nd background node and show one thing in the sky but for diffuse light bounces to react to another thing.

but if you absolutely need to use the node's strength, then doing it without any sort of multiply works, if u need to multiply it, then add a multiply node and/or an invert node to change the background's strength, with shouldnt be a problem with my method since the strength socket is available
EDIT: with what u said in comments, that would need to be done in the compositing of the scene. you would need to enable diffuse layers for indirect diffuse, then use that as a mask/factor for the other ndoes

this will take all light bounces coming from diffuse surfaces to the camera and use them as a factor, take note this will also affect other diffuse indirect bounces though. or, you can play around with materials and use the light path node on them and experiment a little


Copy drivers from one Armature to another of the same kind

File append from the menus allows the Blender User to move an armature from one file to the other.

Now the two armatures are in the same file.
Now you can copy and paste Python Scripts or drivers from one armature to the other.  This can be done manually or from another script.  For small amounts of copies I suggest the task be done manually, otherwise via Script.

Of course you may be able to just copy and paste the text of the driver from while file to the other.  Two Blender files can be open at once.
This proposed answer is intended to be a high level guide to complete your task.  This is not a tutorial.
We have not discussed the particulars of a simple copy of a driver from one object to the other.  The detail required to do so was not given in the original question.


Is it possible to test for a previously created folder on the hard drive

I would suggest to use os.path.join() instead of +.

To test you can use os.path.exists(os.path.join(path, obj.name))


Select the bones and change pivot point as 3DCursor which on the origin point
Scale bones on X-Axis and type "-1" as value

https://www.youtube.com/watch?v=cGvalWG8HBU&t=428s
Also this tutoriol will helps you for more information about armature and bones.


How can I average out a certain range of keyframes?

Go to dope sheet

Click on the first key frame so that the cusroser is set to that
place

select the keyframes that needs to be evenly space out, can use "B"
to drag select area or any other selection

Press "S" to scale

and input number "5" if you wish to evenly space out all
keys with interval of 5 frames


How can I save and load my players position in the blender game engine?

Basically you can store the data to be saved in bge.logic.globalDict via Python.

The save actuator writes this data to a file.

The load actuator loads it back from file when you need it.

Then you modify the scene according to the data in bge.logic.globalDict via Python.

This means:

saving and loading can be easily performed by logic bricks
storing and restoring as very custom operations as you are the only one that knows what should be stored how. You need Python to do that.

As this can quickly become a quite complex task I suggest you look for other tutorials on save/load. Questions regarding the tutorial should be ask to the tutorial author.

Just in case a small hint is enough:

import bge

storage = bge.logic.globalDict

def storePosition(controller):
    if not controller.sensors[0].positive:
        return

    owner = controller.owner

    objectStorage = {}
    objectStorage["position"] = list(owner.worldPosition)

    storage[owner.name] = objectStorage

def restorePosition(controller):
    if not controller.sensors[0].positive:
        return

    owner = controller.owner

    objectStorage = storage.get(owner.name)
    if objectStorage:
        owner.worldPosition = objectStorage.get("position", owner.worldPosition)

If you do not enough python/bge-api to understand this code, I strongly suggest to learn it first.


Is there a way for me to copy the oriuentation of an object in blender game to another while the game is active?

Api reference localOrientation

from bge import logic

scene = logic.getCurrentScene()
own = logic.getCurrentController().owner # Cube.001
obj = scene.objects["Cube"]
print("obj",obj.localOrientation)
print("obj",obj.localOrientation.to_euler())
print("own",own.localOrientation)
print("own",own.localOrientation.to_euler())
obj.localOrientation = own.localOrientation
print("obj",obj.localOrientation)
print("obj",obj.localOrientation.to_euler())
print("own",own.localOrientation)
print("own",own.localOrientation.to_euler())


That's more or less how it's done. You model them, starting from a primitive.

For example, to make a bullet you might start with a cylinder or circle (ShiftA>Mesh) and then extrude (E) and scale (S) to top ring repeatedly, finally merging it into a single vertex (AltM):

Note that you must be in Edit mode in order to edit the underlying geometry of an object (you can toggle edit mode quickly with Tab).

For more complex models, you might use a different primitive. For example, most round objects (e.g. bowl) can be started with a circle, while for a more free-form object you might use a plane or even a single vertex:

This is a rather sloppy example, especially as I could have used a circle as the starting mesh, but I think you get the idea.

There are many great tutorials on modeling in blender (look around on youtube etc.), here's a list of some good resources.

Another thing you can do is watch modeling time-lapses like this one.


It's dependent on the internal edges.

Starting as shown
X > Limited Dissolve (selected) internal edges
CtrlShiftB Bevel (selected) corner vertices


After importing an obj file, I cant enable smooth shading, or at least it doesn't do anything

So the problem you have here is that the entire model is ripped. If the mesh is not connected cant be smoothed out. In order to solve this, you have to select everything and remove doubles or as it is called now (merge by distance) by pressing Alt+M. Done that the mash will be messed up, with everything still selected press Shift+N to recalculate the Normals. Now if you press smooth shading the mesh should be good to go.


How to sort objects from a collection using python?

Alright so what worked for me is this:

For every cubelet the cubelet.data.vertices are all in the same grid cell so to speak. That means it's not important which one of them I take to compare against other cubelets. If it was I could still iterate them and find a min/max/average to my desire.

So using cubelet.data.vertices[0].co works for selecting initial, unrotated cubelets, but it breaks once a cubelet is rotated. This makes sense as the rotation is part of the cubelet.matrix_world rather than the individual vertices being updated.

I've added an exampleVector function encapsulate finding an arbitrary example vector for a cubelet for comparison:

def exampleVector(cubelet):
    return cubelet.matrix_world @ cubelet.data.vertices[0].co

With this my cubeletsBySide function now looks like this:

def cubeletsBySide(cube, side):
    dimensionsBySide = {'U': 2, 'D': 2, 'F': 1, 'B': 1, 'R': 0, 'L': 0}
    revertBySide = {'U': True, 'D': False,
                    'F': True, 'B': False, 'R': False, 'L': True}
    dimension = dimensionsBySide[side]
    return sorted(
        list(cube.all_objects.values()),
        key=lambda c: exampleVector(c)[dimension],
        reverse=revertBySide[side])[:9]

Together with the rest of my code I can now perform the superflip again, which I use to verify that both side selection and rotations are working correctly:

superflip = ["R", "L", "U", "U", "F", "U'", "D", "F", "F", "R", "R", "B", "B", "L", "U", "U", "F'", "B'", "U", "R", "R", "D", "F", "F", "U", "R", "R", "U"]

currentCube = newCube('cube', (0, 0, 0))
shuffle(currentCube, superflip)


Press the LMB while hovering the cursor over the End window of a Timeline bar and define the number of frames.

You may also change the start and end frames hovering the cursor over Timeline and pressing S for start and E for the end frame of the animation.


Switching between UV maps on a single object

I find it's easiest to do this in Blender Render. (Green oval).

You only need one material and one texture, but a UV map for each couch pattern. Here I have 3 couch patterns so I'm using 3 UV maps. (Magenta circles).

Unwrap the couch for each pattern. For the red, I've used project from view. You can then scale and manipulate the mesh (in UV/Image editor) to reflect how you'd it displayed. (Red ovals).

Do this this for each couch pattern, but make sure the correct UV Map is selected and the corresponding image is loaded in the UV/Image editor. (Purple ovals). For the pink couch pattern, I've used "Sphere Projection" unwrap.

Switching between the UV Maps in the properties window (magenta circle) will switch between the patterns and how you've set them up.

In Cycles:

Add the following nodes (You can easily do this by hitting spacebar and typing in the node name): UV Map (so blender knows what mesh coordinates to use), Image Texture (so blender knows what image to use), Diffuse (so there's actually light to see the image) and then Material Output.

Then follow the steps in red to switch between couch patterns.


You need to create a solid 3D mesh out of the Text to get the Boolean Modifier working.

Select the text mesh and drag it up (z axis) a little. Use a solidify modifier and adjust its thickness until the text mesh goes through the Scoreboard mesh (you don't need to apply it).

Select the Scoreboard mesh, add a Boolean Modifier, select "Difference" as operation and "Text" as the object to use for the modifier.

Here's the .blend file with unapplied modifiers:


those shortcuts activate view alignment modes named "front" and "back"

so I can't see why you feel they could be wrong, even if those are just names, and you can choose whatever (even to work not aligned to anything, but of course it helps...)

that said, some symmetry related tool considers the default (sometimes the only possible) symmetry around X axis, so that the object shape is considered mirrored on the +Y and -Y axis

This is clearly the case of "humanoid" features (like a face) so it seems to be considered the best choice, imho.


Unrotate a square polygon with Python: all 3 axes

Use the edges.
The bmesh module has some methods for faces to calculate the tangent vector of the face based on its edges. For example sake will use the tangent vector created from two longest non connected edges.
Using the face normal, the face tangent and the cross product of the two can create a rotation matrix from the three orthogonal vectors.
The axes are the columns of a matrix, so a rotation matrix with unit vector axes x, y, and z could be
Matrix((x, y, z)).transposed()

if you recall from linear algebra, the transpose of an orthogonal matrix is also its inverse.
Test script, aligns face zero based on the matrix created as above.
import bpy
import bmesh
from mathutils import Matrix, Quaternion

ob = bpy.context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)
face = bm.faces[0]

n = face.normal
t = face.calc_tangent_edge_pair().normalized()
c = face.calc_center_median()

M = (
    Matrix.Translation(c) @
    Matrix((t.cross(n).normalized(), t, n)).to_4x4() @
    Matrix.Translation(-c)
    )

bmesh.ops.transform(
    bm,
    matrix=M,
    verts=bm.verts,
    )
bmesh.update_edit_mesh(me)


What are the differences between an environment node and a image node?

Looking at the definitions for the Image Texture node and for the Environment Texture node, the only difference I note is the available projections. As you noted, Environment Texture offers Equirectangular and Mirror Ball, whereas Image Texture offers Flat and Box.

Some things both have in common are that both will unpremultiply the alpha data, and both will convert sRGB to scene-linear color space. Other than that (and the complications of the Box projection), the files are basically identical.


Why doesn't the key to switch on all scene layers work on linux

Is your keymapping set correctly in your Ubuntu conifg? On a QWERTY keyboard, the default for enabling all layers is backtick (`... it's the top-left key, to the left of 1). Does that work for you?


VSE how to transition from one video strip to another with effect like turning (flipping) page?

In VSE I don't know how. However you can model a book, and on the pages you can build a double sided material: you need a geometry node with "backfacing" connected to the fac of a mix shader node. Connected to the mix shader's shader slots, will be the 2 movies/image sequences you want for the transition. Next, you just need to rotate the page as you want/need. There are tutorials on model a book or animate the pages, like this one: https://vimeo.com/11232299 node setup would be something like this https://blenderartists.org/forum/attachment.php?attachmentid=154566&d=1316065621&thumb=1
I talked to a friend and he recommended a external free software called VSDC video editor, as it is easier to acomplish this (http://www.videosoftdev.com/free-video-editor/download)


What is the setting that changes wire frame thickness?

In settings under system there is an option called "Virtual Pixel Mode".  Setting this to Double will increase the line width.  It also increases the size of the the UI elements, but on a high DPI display that's probably not a bad thing.


Set matrix rotation value (not add to it)

Similarly to the answer to Convert mouse movement into rotation value (not in bge), customized to make the all selected objects rotate about the active object.

Need to subtract the pivot point of the rotation, which gives the "pivot arm" vector for the rotation.  In the previous answer, where just the active object was being rotated it had been hard coded to (0, 0, 0), since that is the result of subtracting an objects global location from itself.

import bpy, math
from bpy_extras.view3d_utils import (
        location_3d_to_region_2d,
        region_2d_to_vector_3d)

from mathutils import Matrix, Vector

class CustomRotate(bpy.types.Operator):
    bl_idname = "transform.custom_rotate"
    bl_label = "Custom Rotate"
    pivot_point = Vector((0, 0))
    v2d = Vector((0, 0))
    axis = Vector((1, 0, 0))
    mw = Matrix()

    def modal(self, context, event):
        ob = context.object
        if event.type in ['LEFTMOUSE','ENTER']:
            print('finished')
            return{'FINISHED'}

        if event.type in ['ESC','RIGHTMOUSE']:
            ob.matrix_world = self.mw
            return {'CANCELLED'}

        if event.value == 'PRESS' and event.type == self.axis:
            # two times make it local
            axis = Vector([int(c == event.type) for c in 'XYZ'])
            self.axis = ob.matrix_world * axis  - ob.matrix_world * Vector()
            return {'RUNNING_MODAL'}
        elif event.value == 'PRESS' and event.type in "XYZ":
            # to rotate about global axes
            self.axis = event.type
            # local
            return {'RUNNING_MODAL'}

        v2d = Vector((event.mouse_region_x, event.mouse_region_y)) - self.pivot_point
        if not v2d.length:
            return {'PASS_THROUGH'}
        #Get rotation angle and update object rotation
        a = self.v2d.angle_signed(v2d)
        rot_mat = Matrix.Rotation(a, 4, self.axis)
        t = ob.matrix_world.translation.copy()
        #Print angle in degrees to help with testing...
        #print('alpha angle:',math.degrees(a))
        for o in context.selected_objects:
            mw = o.matrix_world
            mw.translation -=  t
            mw = rot_mat * mw
            mw.translation  += t
            o.matrix_world = mw

        self.v2d = v2d

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        region = context.region
        rv3d = context.region_data

        ob = context.object
        self.pivot_point = location_3d_to_region_2d(region, rv3d, ob.matrix_world.translation)
        self.v2d = Vector((event.mouse_region_x, event.mouse_region_y)) - self.pivot_point
        z_axis = Vector((0, 0, -1))

        self.axis = rv3d.view_matrix.transposed().to_3x3() * z_axis
        self.mw = ob.matrix_world.copy()
        context.window_manager.modal_handler_add(self)

        return {'RUNNING_MODAL'}

def register():
    bpy.utils.register_class(CustomRotate)
def unregister():
    bpy.utils.unregister_class(CustomRotate)

if __name__ == "__main__":
    register()


Bones with python: emulate armature with constraints

In short, no, Blender does not support a bone system like that. Blender uses the common approach where a bone's entire transformation matrix defines the coordinate system for their children. What I would suggest is to dive into the math required and rewrite the bone transformations from your system to a matrix that Blender would understand. I think this approach would be easier and saner than trying to emulate your bone system in Blender.

TL;DR: convert your data to Blender's model, rather than trying to force Blender to mimick your model.

  Also there is this restriction in blender that the tail of a bone needs to always point into the direction of its child.

That statement is only true if you keep the "Connected" property of the bone at its default value True. Just uncheck that checkbox and you can move the bone without affecting its parent orientation.


It sounds like your object is hidden in the viewport, but not in the render. Press ⎇ AltH in the viewport to unhide all hidden objects, or examine the outliner for objects with their eye icon disabled:

The eye icon controls object visibility in the viewport and preview render, and the camera icon controls object visibility in the final render.


Scripting metaballs with negative influence

It seems you already found the wiki docs on metaballs, lots of juicy content there indeed, perhaps after reading/running this script that documentation will make more sense.

You seem to be adding multiple separate metaball objects, instead add one metaball object, and internally to that object create metaball elements, then set their interaction type, something like this.

import bpy

scene = bpy.context.scene

# add metaball object
mball = bpy.data.metaballs.new("MyBall")
obj = bpy.data.objects.new("MyBallObject", mball)
scene.objects.link(obj)

# test with different values, for viewport do you need ultra high res?
mball.resolution = 0.16  # View resolution
# mball.render_resolution = you decide

# first metaball element doesn't exist yet - create it.
ele = mball.elements.new()
ele.co = (0.0, 0.0, 0.0)
ele.use_negative = False
ele.radius = 2.0

# adding extra metaball elements to the object
ele = mball.elements.new()
ele.co = (-0.726, 1.006, 0.559)
ele.use_negative = True
ele.radius = 0.82279

And that's it.


Is it possible to get the bounds of a compound object?

Using a wrapper class, it's possible to calculate the total bounds of all sub-objects in a somewhat efficient manner.
(Now there probably are better methods, but this is the best I could think of)

When the sub-objects are added to the root object, wrap their vertex proxies with this class and store them locally:

class VProxy (object):
    """Make vertex proxies a little more usable."""
    __slots__ = ['owner', 'mesh', 'proxy', 'XYZ', '__eq__', ]

    def __init__(this, owner, mesh, matid, vertid ):
        this.owner = owner # mesh object can't be accessed from the mesh proxy.
        this.mesh = mesh # mesh proxy
        this.proxy = proxy = mesh.getVertex( matid, vertid )

        # now for some hackery
        this.XYZ = proxy.XYZ # direct access to the updated Vector object.
        this.__eq__ = proxy.__eq__ # compared as the vertex proxy it holds. (speedy)

        # more magic can be added if needed.

    getXYZ = lambda this: this.owner.worldTransform * this.XYZ
    getXYZ.__doc__ = "Gets the position of this vertex in world coordinates."

And in the frame, simply retrieve that local store and calculate the bounds:

x,X, y,Y, z,Z = sum(map( minmax, zip(*(itrans*subProxy.getXYZ() for subProxy in subVerts)) ))

Beforehand:

minmax = lambda axis: [min(axis), max(axis)]

Where subVerts is of course the collection for a particular sub-object, and itrans is the inverse of the world transform matrix for our root object.

Now as for performance, since getXYZ is a lambda, it's faster than a basic function, but overall still slow...
The only speed we get comes from the optimised Vector and Matrix classes.


Is there a simple way to change the origin point of a lot of objects at once?

Select all your piano keys.
Set your 3D cursor to the location where you want your point of rotation.
Object -> Transform -> Origin To 3D Cursor

That will set the origin for all the piano keys at once.


You could modify the example operator a bit to make it work in a non-modal way. The operator can be run after MOUSEMOVE events instead, using a keymap entry.

Here's a quick example, modifying the operator (the main function is unchanged). It requires pressing the ctrl key to avoid running the operator all the time (since ray casts can be quite expensive on heavy scenes). This can be any suitable combination of events. You may also want to put this in a different keymap, e.g. for an addon.

class ViewOperatorRayCast(bpy.types.Operator):
    """Modal object selection with a ray cast"""
    bl_idname = "view3d.modal_operator_raycast"
    bl_label = "RayCast View Operator"

    @classmethod
    def poll(cls, context):
        return context.space_data.type == 'VIEW_3D'

    def invoke(self, context, event):
        main(context, event)
        return {'PASS_THROUGH'}

def register():
    bpy.utils.register_class(ViewOperatorRayCast)

    wm = bpy.context.window_manager
    kc = wm.keyconfigs['Blender User']
    km = kc.keymaps['3D View']
    kmi = km.keymap_items.new(ViewOperatorRayCast.bl_idname, 'MOUSEMOVE', 'ANY', ctrl=True)


How to snap an object to another without moving origin?

Select the cube you want to move, go into Edit mode, turn on snapping to vertex, select all vertices and choose one as the active by clicking on it, change pivot point to active element. You can now snap the whole cube from this vertex to one from the other cube.

To snap the center of the cube to the other cube, change pivot point back to median pooint. Also snapping target to Center instead of Closest. Play around with it, you can do it all just by changing pivot point and target options.


How to make smoke flow in different direction?

Change the Temperature Difference in the Smoke Domain to a negative number.

Form the Blender Manual

Temperature Difference

  The Temperature Difference setting controls how much smoke is affected by temperature.

  The effect this setting has on smoke depends on the per flow object

  Values above 0 will result in the smoke rising when the flow object Temperature Difference is set to a positive value, and smoke sinking when the flow object Temperature Difference is set to a negative value.

  Values below 0 will result in the opposite of positive values, i.e. smoke emitted from flow objects with a positive Temperature Difference will sink, and smoke from flow objects with a negative Temperature Difference will rise.

  Note that smoke from multiple flow objects with different temperatures will mix and warm up/cool down until an equilibrium is reached.


Time Remapper addon

Following Ideasman42's suggestion, I wrote an addon that allows you to animate time in the whole scene.

Demo video
Video tutorial
Source code

Limitations

Only for Cycles
Doesn't work for fluid simulations or motion blur
Works with Blender 2.70+
Freezes interface until frames are done rendering

Installing

Right click and save to your computer this link: https://raw.githubusercontent.com/hxxr/time-remapper/master/render_timeremapper.py

Open Blender, File > User Preferences > Addons > Install from File, then select the file you just saved.

Type "time" into the search bar and you should see the addon "Render: Time Remapper".  Enable it.

In the Properties, you should see some new buttons,

Usage

It's best to launch Blender from a terminal so that you can see the output of the addon.  If you're on Windows, then you'd launch Blender normally and go to Window > Toggle System Console.

Create your scene.  Change any rigid body objects or animated objects to Quaternion rotation mode (N-menu > set XYZ Euler to Quaternion)   Make sure to bake any physics simulations.  For Rigid Body Physics, it seems work better if you do Bake to Keyframes (T-menu > Physics > Bake to Keyframes).

There's two modes you can use it in: Speed Factor and Time-Time Curve.  Leave it on Speed Factor unless you need to go in reverse-time.

The speed factor can be animated.  Setting it to 0.5 will give 2x slow-motion, setting it to 3 will give 3x fast-motion, etc.

After keyframing it, hit TR Animation.  This will freeze Blender.  You can see the progress of the addon or any error messages by looking in the terminal.

To watch what you've saved out, press TR Playback.

(OPTIONAL) You can choose up to 3 "immune objects" that will be immune to the time remapping effects.  For example, if you want your camera to rotate around the scene without slowing down (as in the demo video above), select it as an immune object.

Using reverse motion

If you want you animation to go back in time, then change Speed Factor to Time Time Curve.

Open the Graph Editor.  You'll see a 45 degree line that shows how time (in frames) maps to the animation's intrinsic time.


How to create a typing text-object animation ?

You can use the Blender Typewriter Addon:

http://urchn.org/post/typewriter-blender-addon

copy and paste the code into the Text Editor, then press alt + p to run the script.

Select your text object and you'll find a new panel into the Font Propery Panel:

Type the text in "source_text" field (NELLY).

Go to frame 0 and insert a keyframe for the character_count = 0 (mouse over the field and press i)

Go to frame 75, change character_count to 5 (text length) and press i

EDIT: Animation Nodes Addon

If you need more control (such as animating letters size, rotation...), you could use the Animation Nodes Addon.

Here you can find a video showing an advanced text manipulation:
https://www.youtube.com/watch?v=li7R01PyXuI&index=26&list=PLFSQhJg6cGLKq8WbouMNBOHbMd7xUhuom


This is indeed a very complex geometry to create.

Create the base without the diamondshaped details as a reference.
Create a new mesh and enable Snapping to Surfaces.
Create the diamond shape from the top view. Subdivide it, add supporting edgeloops, then snap it to the reference hilt's surface.
Extrude the remaining loose edges guide them around to the back of the hilt. At this point, I removed three quarters of the geometry and added an XY mirror modifier.
Extrude the concave detail as the last step.


Instead of using background images you can use an empty to place an image in the 3DView.

You then get a reference image that is always visible as you rotate around.


how do I bevel the control point of a curve?

You could scale curve point to its hadles' plane.

First, for better results make the type of handles of the control points to Free (with all curve points selected press V > Free).

Select the handles of the curve vertice in the corner (where you'd like to make 'bevel'). Hold Shift to select both them.
Press Shift+S to snap the cursor to selection.
Select the curve vertice itself, and deselect the handles (click on them with MMB).
Press S to scale the control point to the cursor location:

Note that it's also possible to change the location of the handles in order to tweak the cursor location.


Removing cusp/crease when using array, mirror and subsurface modifier

Stack order:
Mirror
Array (With Merge option ON)
Subsurf


Cycles render for Facebook without color

You have to consider that materials in cycles get translated. As the  glTF 2.0 Exporter documentation says:

  Blender supports two material settings: One for Blender Render and one for Cycles Render. Fortunately, the glTF 2.0 Materials can be simulated using the Cycles Render by implementing a custom node tree

You can't just write materials in cycles and then translate them, this will just not work. You have to use the ones provided by the repo.

This is really well explained in the documentation (I'm assuming you're using this exporter):

https://github.com/KhronosGroup/glTF-Blender-Exporter/blob/master/docs/user.md


How to make a smooth object look less 'lumpy'

Here's a self-answer, based on information from the comments. There is a very nice trick to this, which is to model using Bézier curves instead of just relying on the subdivision surface modifier.
The basic procedure is to do shift-A -> Curve -> Bezier. Then in properties there's a curve panel where you can turn it into 2D, which makes editing easier. Then you can add a 'screw' modifier, followed by subdivision surface and, in my case, solidify.
Here's how the object looks modelled with curves:

The weird lumpiness has gone, and in addition, editing is much quicker and more painless, and it's easier to be accurate.
It looks like this when editing. I only have to change a couple of control points to change the slope of the curve - the geometry is generated automatically.


AFAIK there is no native bmesh function to do this. The way I have done that in the past was to construct a new mesh manually, and propagate it to a new mesh datablock using the Mesh.from_pydata() function the Mesh datablock offers.

code explanation

First, get the mesh itself from edit mode. the ensure_lookup_table() calls are mandatory, otherwise you cannot access faces or verts by index:

bm = bmesh.from_edit_mesh(bpy.context.object.data)
bm.faces.ensure_lookup_table()

next, retrieve a list containing all selected faces:

selFaces = [x for x in bm.faces if x.select]

If instead you want to work on tagged faces, use this list aggregator instead:

selFaces = [x for x in bm.faces if x.tag]

now use two more lists which will hold the output data for our new mesh:

py_verts = []
py_faces = []

the tricky part is in the coming loop. We need to pass on a list of Vectors of vertex coordinates and a list of lists of indices of the faces in question to the from_pydata function. So iterate over all selected faces, retrieve its vertices, and add the unique vertices to the new list, and the new index of that list to the new face index list.

for f in selFaces:
    # cur_face_indices holds the new indices of our verts per face
    cur_face_indices = []

    for v in f.verts:
        if v not in py_verts:
            # this vert is found for the first time, add it
            py_verts.append(v)

        # add the new index of the current vert to the current face index list
        cur_face_indices.append(py_verts.index(v))

    # face index list construction is complete, add it to the face list
    py_faces.append(cur_face_indices)

if you require a Mesh datablock:

Declare a new mesh data block, and run the from_pydata on it to create the new mesh:

me = D.meshes.new(name = 'output')
mat = C.object.matrix_world
me.from_pydata([mat @ x.co for x in py_verts], [], py_faces)

As you can see, there is an additional step in here, which gets the world_matrix and applies it using the @ operator on each vertex coordinates. This is basically applying the transforms of the source object on the new one. Alternatively you could also set the world matrix on the new object instead:

me = D.meshes.new(name = 'output')
me.from_pydata([x.co for x in py_verts], [], py_faces)
ob = D.objects.new(name='output', object_data = me)
ob.matrix_world = C.active_object.matrix_world

if you only require a new bmesh:

You still need to construct a mesh, but from there you should be able to retrieve the bmesh easily:

me = D.meshes.new(name = 'output')
me.from_pydata([x.co for x in py_verts], [], py_faces)
bm_new = bmesh.new()
bm_new.from_mesh(me)

complete script

Here is the full script, which has to be run from edit mode with the faces selected, and links the resulting object to the scene in the end:

import bpy, bmesh
C = bpy.context
D = bpy.data

bm = bmesh.from_edit_mesh(C.object.data)
bm.faces.ensure_lookup_table()
bm.verts.ensure_lookup_table()

# get all selected faces in a list
# replace x.select with x.tag in case that's what you are after
selFaces = [x for x in bm.faces if x.select]

# construct Python faces
# this is more involved, as we have to remap the new index
# to do this, we reconstruct a new vert list and only append new items to it
py_verts = []
py_faces = []

for f in selFaces:
    # cur_face_indices holds the new indices of our verts per face
    cur_face_indices = []

    for v in f.verts:
        if v not in py_verts:
            # this vert is found for the first time, add it
            py_verts.append(v)

        # add the new index of the current vert to the current face index list
        cur_face_indices.append(py_verts.index(v))

    # face index list construction is complete, add it to the face list
    py_faces.append(cur_face_indices)

print(py_verts, py_faces)

# now create a new mesh, and add the geometry as its data
me = D.meshes.new(name = 'output')

# get the world matrix of the active object and apply it to the mesh
# this ensures same orientation as the source for the new mesh, but with
# transforms applied
mat = C.object.matrix_world
me.from_pydata([mat @ x.co for x in py_verts], [], py_faces)

# create a new object, and link it to the current view layer for display
ob = D.objects.new(name='output', object_data = me)
C.view_layer.active_layer_collection.collection.objects.link(ob)


How can I remove these "steps" between faces from the mesh?

Go into edit mode. Hold your cursor over one of the long edges and hit 'Ctrl-R' to add an edge loop.  See where that loop is added. If it stops at the edge of the triangle, that is OK.  Keep adding edge loops between the top and bottom 'curves.' If the edge loops stopped at the triangles, do the same to the right and left 'legs,' with the same number of edge loops added.  Go into 'point/vertex' mode, select two points to bridge, and press 'F' to bridge them with an edge. You will have to subdivide edges in the middle of the triangles in order to get movable geometry in those areas. Continue doing this for a while and massaging the position of those points in XYZ space until you are happy with the surface flow.  That massaging can be done in edit mode, or you can jump over to sculpt mode.


You can check Only Origins to only transform the origin point.
It's in Sidebar > Tool > Transform, Shortcut: N

Then you can rotate the local axis, without affecting geometry.


How can I connect a texture node to a material with Python?

The cool thing about Blender is you can try stuff in the Python Console and see exactly what's happening!

The first way is NOT creating a node that can be used in a shader.  It's simply creating a texture that Blender can use for various things.

You don't want to say use_nodes=True because it doesn't make this texture into a node that can be used in a shader anyway, it just makes the Image inaccessible via the UI (if you care about that):

Anyway, this is NOT a node for a shader graph, it's JUST a texture.  Therefore, even with the use_nodes=True, the "color" output gives you simply the RGB values of the color, and you can't connect that to a node socket (and that's why you get the error message).

>>> print (texnodes["Output"].color)
<Color (r=0.6080, g=0.6080, b=0.6080)>

The second way is actually creating a node for a shader network.  It does have outputs that are socket connections, so that's why you can connect it.

When you run this:

>>> mat = bpy.data.materials.new('mat')
>>> mat.use_nodes = True

Then in your Node Editor you can actually see it:

And you run this:

>>> texture=matnodes.new("ShaderNodeTexImage")

The node pops up:

...and in the console:

>>> print (texture.outputs.keys())
['Color', 'Alpha']

you can see that the outputs look like what you see in the node, and the type is a nice socket connection type instead of an RGB value:

>>> print (texture.outputs["Color"])
<bpy_struct, NodeSocketColor("Color")>

BUT, if you notice in our node, there actually is no image.  THAT'S how we can tie this to the first method.  So supposing we had created a texture via the first method added an image to it, then:

>>> print (firstway.image)
<bpy_struct, Image("01.PNG")>

...the .image property holds the image file from the texture.  To use that in our texture node, you simply set the node .image equal to this one:

>>> texture.image = firstway.image

...and you can see in the UI that it's now set in the node:

The nice thing is that you can re-use the texture in other shaders or nodes if you want to.

I hope this helps to understand the difference.  TL;DR is that a Texture NODE contains a Texture, but a Texture cannot be used as a node itself.


Make Human to Blender with IK doesn't work as expected

Enable Autorun python scripts in user preferences


You can use the poly build tool https://oldetinkererstudio.com/poly-build-tool-blender-2-8-quick-tip/


How do you merge 2 areas of a single mesh into one?

I think you are watching sebastian lague's video.

Now that you have created arms and the body, you want to join them. First, I must tell you that ctrl+J only makes joins meaning it doesn't join the faces or vertices but it makes both the mesh to be accessible by one name.
Now for joining the hands with the body you need to follow these steps:-

You need to select two vertices one of the hand and other vertice of
the body nearest to the vertice selected before.
Press  alt + m while selecting the vertices. Select 'to center' and
now your the vertices are joined.
Repeat this step for all vertices.

The other way :-

Select your hand by hovering over it and press 'l'. Now you have
your hand selected.
Press P to separate the hand. This is the opposite of Ctrl + J.
Exit Edit mode.
Select your hand mesh and enter edit mode to extend the edges near
the top say shoulder.
Extend them by pressing E. So that the extended part touches the
body. Try to make the extended part as small as possible.
Now Exit Edit mode.
Go to modifiers tab and select boolean.
Select Union in boolean and then select your body mesh. Click Apply.
Now you have both the mesh joined. You can delete your body mesh
now.

I would recommend to follow the first way.

Hope this helps.


Once you've set up your noise curve, simply add a Stepped Interpolation modifier to make it blockish. Use the Step Size parameter to adjust the "definition".


Unless you have special reasons to use Cycles, I would consider using EEVEE for, at least, the main passes of your work, because of the Shader to RGB node.

The Shader to RGB node, which really can't be implemented in a path-tracer like Cycles without calling the whole renderer twice, allows you to take the actual light-response of a surface, capture that color, and then use it in any way you like further down the pipeline.

In that workflow, you could, for example, choose to forget coloring by Normal, and actually light a pure-white diffuse version of your model, and maybe a black highly specular version of your model, and so on.. by using different shaders all in the same node tree.

You can then grab the tones from those shaders as RGB, put them trough thresholds, quantize them, use them as masks for textures, do half-toning with them,  tint them with colors that are not actually in the scene .. almost anything.

Not your style, but there's an example here of half-toning and tinting. A search on 'NPR' and 'Shader to RGB' turns up plenty of examples, some good, some not-so-good...


Choose distinct colors based on Custom Properties

You can do it with the latest Blender Version (2.92+) and custom properties :

Download the latest version (At least 2.92+, which is currently in Beta but should be officially released pretty soon).
Select your object, and create your custom property, named "country".
In the value field, you can input a string of characters. Don't forget to press OK to validate your change.

Create another property, let's call it hash. Keep the min and max between 0 and 1.

Right click in the field and choose Add Driver. Delete the target variable, check Self and type hash(self["country"])%1000/1000. This will generate a (kinda) random number between 0 and 1 depending on the string inside the country property. The hash provides the same output if 2 inputs are the same.

Important : You have to enable python scripts globally for this to work. Go to Edit > Preferences > Save & Load and enable Auto run python scripts. You can add your Downloads folder for security, that way downloaded files won't execute custom scripts automatically.

Add a material to your object. Use this layout :

Add an Attribute node set to Object type, and input the hash custom property name. Link it to a Combine HSV node to create a random hue.

Result :


Boolean object won't disappear in render

Finally found what was wrong.

I was using the "mask" object for 2 different boolean modifiers. I created a separate object for each boolean modifier and it rendered correctly.

Thanks for all your help!


Sections of UV unwrap not taking texture painting

If your object is a single object made up of multiple meshes, and you are adding materials to these meshes, then you need to make sure the materials are all sharing the image texture that you are painting for them to show the effect the texture is meant to describe.

A color image meant to give color to the model has to be shared for all the materials to be included with the paint - and even if you aren't going to use color on several mesh parts, those materials might be sharing a single image for bumps/gloss/etc.

In the actual case above, OP needs to make sure the model in question isn't composed of multiple objects and is indeed one object - and that the materials added all share the same image texture.


Connect Color information to Diffuse node Color socket :)


You have to set the value of the keyframe in your case the "Y location" by pressing the "I" key and then selecting location, before movie the frame in the timeline or it wont set (unless you have "automatic keyframe insertion" turned on).

The "connected bar" is only a visual to tell you that the frame data (Y location) did not change between the two keyframes. It doesnt mean anything beyond that.


How do you snap the camera to view in Ubuntu

You can use the menu: View>Align View>Align Active Camera to View...

But that is just a temporary remedy that masks the symptoms of a larger problem: The shortcuts on the operating system take precedence over those of apps, so you have to decide between two options to use blender in the future:

Configure your OS so that it doesn't use the same shortcuts as blender (usually in Linux I remap all of the shortcuts that use the Ctrl key to use the Super/Windows key so that the OS doesn't create any conflicts).
Change the shortcuts on blender in the user preferences. (Just keep in mind that by changing the default to non-standard shortcuts, you might not be able to follow tutorials or other help resources).


The top and bottom vertices are missaligned.

Select all the top vertices and tyoe these letters:

 s ,  z ,  0  "Numpad zero". Not at the same time.

This will aling all these vertices in the Z axis.

Repeat these steps at the bottom vertices.

See the image below:


Where is the 'holdout' option for collections in 2.8

I've been facing the problem too, the explanation is that holdout is only working with Cycles !


Quick keyframe frame insertion for Shape Keys with `foreach_set` from data

Could be simplified to one shape key.

In the initial state of the cube, it is dimensionless (squashed down
to a flat object). In the animation, it should be clear that the Cube
starts growing from 'a flat surface'.
Also, how can I describe the scale in Z direction, when the values are
accumulative? This gets complex already.

IMO you have totally overcomplicated it, by adding a shapekey for each data point.  For this case even Using foreach methods isn't going to help particularly, ie for 4000 points of data creating as many shapekeys and keyframing 2 points per.
Am also of the opinion this could be reduced to simply keyframing object scale, a single shapekey, or solidify thickness to name but 3.

Using solidify thickness on faces defined by vert group "Group"
Shapekey emulating how scale works.

Add a default cube
Transform such that it is unit size, origin at base
Copy the coords
Scale it flat, make that the basis shape,
Make the other shape key unit.

Ok now have a shapekey that if zero has zero height Basis, and if 1 unit height. Changing the range allows scaling outside the (0, 1) range. As illustrated, but appears to be hardcoded to only 10
There is really no need for the shapekeys, since the result is same as scaling in z axis, So could instead create no shapekeys and simply keyframe scale.
Test script. Creates the unit cube illustrated above
import bpy
from mathutils import Matrix
bpy.ops.mesh.primitive_cube_add()
ob = bpy.context.object
me = ob.data
me.transform(
        Matrix.Translation((0, 0, .5)) @
        Matrix.Diagonal((.5, .5, .5, 1))
        )

coords = [None] * len(me.vertices) * 3
me.vertices.foreach_get("co", coords)
me.transform(
        Matrix.Diagonal((1, 1, 0, 1))
        )
basis = ob.shape_key_add(name="Basis")
unit = ob.shape_key_add(name="Unit")
unit.data.foreach_set("co", coords)

Some animation basics
When you add a keyframe to a shapekey, it creates an Action if there is not already one, an fcurve for the data path being animated (if there already isn't one) and inserts a 2D point for (frame, value)
It is in populating the fcurves keyframe points where foreach_set is then used.
>>> C.object.data.shape_keys.animation_data.action
bpy.data.actions['Key.018Action']

>>> action = C.object.data.shape_keys.animation_data.action
>>> for fc in action.fcurves:
...     fc.data_path
...
'key_blocks["Unit"].value'

Besides, to my understanding,
foreach_set method creates and assigns all the keyfames from a data
set at once.
This is the efficient way when you have thousands of data points. But
I just could not figure out a way to use it in shape keys

Yeah?, thanks for the tip.
Knowing where the action belongs and what the data path looks like, is the key to using the methods outlined in my answers to  links posted
Fast keyframe insertion
Editing fcurve.keyframe points in FAST mode?
Example
Using data from question

Created mesh with shapekey as above,
Make the shapekey maximum (as big as it gets from data)
Have offset data such that 2000 is frame 1, and taken one from value for example sake, to get zero at frame 1.
Created an action for the "Unit" shapekey and populated it.

Test script.
import numpy as np
import bpy
from mathutils import Matrix

data = (
    (2000, 1),
    (2001, 2.5),
    (2003, 3.4),

    (2020, 11.9),
    )

bpy.ops.mesh.primitive_cube_add()
ob = bpy.context.object
me = ob.data

d = np.array(data)
d -= (1999, 1)
frames, values = d.T

# max range of 10 ..
#unit.slider_max = values.max()

me.transform(
        Matrix.Translation((0, 0, .5)) @
        Matrix.Diagonal((.5, .5, .5, 1))
        )
me.transform(
        Matrix.Diagonal((1, 1, values.max(), 1))
        )

coords = [None] * len(me.vertices) * 3
me.vertices.foreach_get("co", coords)
me.transform(
        Matrix.Diagonal((1, 1, 0, 1))
        )
basis = ob.shape_key_add(name="Basis")
unit = ob.shape_key_add(name="Unit")
unit.data.foreach_set("co", coords)
# animation
me.shape_keys.animation_data_create()
action = bpy.data.actions.new("Grow")
action.id_root = 'KEY'
fc = action.fcurves.new(f'key_blocks["{unit.name}"].value')

values /= values.max()
fc.keyframe_points.add(count=len(frames))
fc.keyframe_points.foreach_set("co", d.ravel())

me.shape_keys.animation_data.action = action


How to activate the output of a dynamic paint canvas via python?

Try this:

import bpy
dynamic = bpy.context.selected_objects[:]
bpy.ops.object.select_all(action='DESELECT')
for i in dynamic:
    i.select = True
    bpy.context.scene.objects.active = i
    bpy.ops.dpaint.output_toggle(output='A')
    i.select = False

The [:] bit at the end of line 2 creates a copy of the list instead of using a reference to the bpy.context.selected_objects, that might be affected by changes in the state of selection of the scene's objects.

The bpy.context.scene.objects.active = i makes each object active as well as selected. Many operators act on the active object only and ignore other selected objects.


The general idea is to build a new rig (let we call it NR) which will have all specs you need (orientations, dimensions, IK, ......) and all "joints" (bones heads) in the same place as your untouchable rig (by now called UR), then set a "copy rotation" constraint on every bone of the UR, so that the UR will exactly act as stated by the NR (use "local space" on the constraint options).

After you have performed the animation, if you want to export the act (I know you will want) you will have to select (in pose mode) all bones of the UR, and go to the pose menu - animation - bake action, check the all needed boxes (Only selected bones, Visual keying and Clear Constraints). This procedure will create a new action that can be exported and played on the UR without any type of constraint.

You can choose to build the NR as a new armature on its own or a new layer of the same UR armature.

Use the "Shift S" functions (cursor to selected and selection to cursor) to build the NR bones exactly in the same location of the UR heads bones, and uncheck the "deform" option of all NR bones.


The meta rig is only used to place the bones in the right place. The mesh is eventually bound to the armature of the generated rig.
Do not apply the modifiers. You want to keep your mesh low-poly for performance and easy modifications.
You have already "parented" the body base mesh to the meta rig and created a pose to match the shape of the armor. Basically moved the hands in this pose. That's the reason why the hands are not in place.
All parts of the body, the armor, and the rig must have the same Rest Pose. This is not the case with your rig.
Corrections:

select the body base mesh ("lowman_shoes") and apply the Armature modifier. This will change the position of the hands in the A pose permanently.
select the metarig and apply All Transformations to the it (Ctrl+A), else the generated rig is placed at the wrong position.
switch to Pose mode and make the current pose the new Rest Pose (menu: Pose > Apply > Apply Pose as Rest Pose
in Edit mode, rotate the shin and thigh bones a tiny, little bit in direction of the knee. This is needed for the IK mechanics so it knows where the knees should bend.

Now everything is in place and you can generate the rig.

In Object mode, go to the Armature Properties and press the Generate Rig button
hide the metarig, the Environment collection, and the Curve guide for the "hair".
select everything else (body and the thousand parts of the armor)
make sure the rig is highlighted in orange (active object, selected last) and make it a parent for the selection (Ctrl+P, With Automatic Weights). This takes a moment or two ...
go to Pose mode and check it out

The weight painting will not be perfect, some parts (bracers) will not move and shoulder plates will deform, etc. This is because your armor has so many parts. In this case, you can duplicate everything, and create a "statue" version. Use this version to generate the Automatic Weights and transfer them back with a Transfer Data modifier.
The fingers might bend in the wrong direction (scale them S/Alt+S). It's because Rigify tries to guess the pivot points and gets confused you have to move around the fingers of the metarig a lot. But you can fix it with some settings. (Just checked it for your model. It looks ok, except for the deformation and the thumb.)


How can I automatically let vertices join in a block shape?

I am guessing you have a modifier stack like below:

Make sure Merge is not selected in Array modifier.  Also note that I created a small gap between array elements (using an offset of 1.100), but if Merge is not enabled gap should not be necesary.
Separating Each Block

You need to apply the modifiers, first Array then Curve. (order is important)
Now you have a single mesh containing all the blocks.
Go into Edit Mode.
Choose Mesh -> Separate -> By Loose Parts in menu.
Now you should have each block as a separate object.


1 - You can choose 3D cursor as pivot point and select everything and do s+z to scale on Z axis.

2 - You can use proportional editing, select the top edge and pull up. Adjust circle/influence size with mouse wheel.