Drive shape key based on relative camera orientation?

This answer targets a beginners level and will include lots of lengthy explanations.

I understand that this answer doesn't utilize drivers as requested, but for this example a simple python script is very easy to produce and maintain, which is why I wanted to add this method.

A slight problem is, that a change of position implies a change of viewing angle with perspective cameras. In the next image there is no difference between both objects orientation, but through the camera, the objects appear clearly at an angle.

I would use a script which check's the camera's and object's transformations on each scene update.

Let's start with a condensed example. Create a camera Camera and a mesh Cube. Then add the Basis shapekey and a Key 1 key, very similiar to the setup in the question.

Paste the following python script in the text editor and click the Run Script button. I have made an effort to document it well.

# import the bpy module, with it we can access the data of the blend file
import bpy

# bpy.context.scene stores the active scene.
# The scene stores a collection of objects, from which
# objects can be accessed directly with their name.
# Get the Camera and Cube by their names and store them
# in "cam" and "obj" variables respectively
cam = bpy.context.scene.objects['Camera']
obj = bpy.context.scene.objects['Cube']

# define a method which will get called on every scene_update
def drive_shapekey(scene):
    # store the transformed obj.matrix in the obj_mat variable
    obj_mat = cam.matrix_world.inverted() * obj.matrix_world

    # print it to the blender console for possible inspection
    print(obj_mat)

    # get the location, rotation and scale from the matrix
    obj_loc, obj_rot, obj_sca = obj_mat.decompose()

    # access the shapekey "Key 1", note that there has to be a
    # shapekey with that exact name
    key1 = obj.data.shape_keys.key_blocks["Key 1"]

    # access the "Key 1" shapekey value
    # here, we assign the absolute value of the objects x location
    # transformed by the inverted camera matrix (!)
    key1.value = abs(obj_loc.x)

# We have to store the method in the scene_update_pre collection.
# First, loop through the collection and possibly remove other
# methods, then append our "drive_shapekey" method. This method
# will then get called on each scene_update_pre cycle.
pre_handlers = bpy.app.handlers.scene_update_pre
[pre_handlers.remove(h) for h in pre_handlers]
pre_handlers.append(drive_shapekey)

One of the more complex lines is
obj_mat = cam.matrix_world.inverted() * obj.matrix_world

The matrix_world is the global transformation of an object (global meaning with parenting already applied). If a location Vector would get multiplied by an object's matrix it will appear is if moved as a child of the object. By multiplying the object's matrix with the camera's inverted matrix, we get the object's matrix in camera space. This may be a confusing concept. The following gif demonstrates multiplying a position vector with the camera matrix or the inverted camera matrix.

The result of the above script is an interactive handler, which update the shapekey value, based on the relative position between the object and the camera.

In the next step, we'll chose the value, which we want to influence the shapekey: the difference between camera and object orientation. Once we have the object's matrix in camera space, we can ignore whatever values were on the camera, since they have been transfered to the object. Only change the code of the drive_shapekey method and leave the other lines intact. In this sample, we use the rotation value of the transformed object matrix by compared a vector with its rotated counterpart.

def drive_shapekey(scene):
    obj_mat = cam.matrix_world.inverted() * obj.matrix_world
    eul = obj_mat.to_euler('ZYX')

    vec_a = mathutils.Vector((0.0, 0.0, 1.0))
    vec_b = vec_a.copy()
    vec_b.rotate(eul)
    difference = vec_a.dot(vec_b)
    key1 = obj.data.shape_keys.key_blocks["Key 1"]
    key1.value = difference

Result of the change in the script.

Now we have to fix the rotational offset of the camera. The shapekey should extend if the camera faces the blue face. We'll compare the (transformed) vectors which we want to align. At the top of the script import the math module as well.
import math
Then turn on the axes on the objects, and choose two axes which you want to align. In my case it's the camera's negative Z (0, 0, -1) and the object's positive Y (0, 1, 0).

def drive_shapekey(scene):
    obj_mat = cam.matrix_world.inverted() * obj.matrix_world

    obj_eul = obj_mat.to_euler('XYZ')
    cam_vec = mathutils.Vector((0.0, 0.0, -1.0))
    obj_vec = mathutils.Vector((0.0, 1.0, 0.0))
    obj_vec.rotate(obj_eul)
    difference = cam_vec.dot(obj_vec)

    key1 = obj.data.shape_keys.key_blocks["Key 1"]
    key1.value = difference

The difference in initial orientation has been taken into account.

Next we are going to add the positional relation to the script. Previously, we compare a camera related vector, but now we need to compare a camera-object relation vector (on the right side).

In our case, the needed vector pointing from the camera to the object is simply the object's location (normalized). This is because the camera is at (0, 0, 0), since we earlier applied the camera's world matrix to the object and we're in camera-relative space from then on.

Now, the dot product is only 1 if the object is actually facing the camera from any position.

The completed script.

import bpy
import mathutils

cam = bpy.context.scene.objects['Camera']
obj = bpy.context.scene.objects['Cube']

def drive_shapekey(scene):
    obj_mat = cam.matrix_world.inverted() * obj.matrix_world

    obj_eul = obj_mat.to_euler('XYZ')
    cam_vec = obj_mat.to_translation().normalized()
    obj_vec = mathutils.Vector((0.0, 1.0, 0.0))
    obj_vec.rotate(obj_eul)
    difference = cam_vec.dot(obj_vec)

    key1 = obj.data.shape_keys.key_blocks["Key 1"]
    key1.value = difference

pre_handlers = bpy.app.handlers.scene_update_pre
[pre_handlers.remove(h) for h in pre_handlers if h.__name__ == "drive_shapekey"]
pre_handlers.append(drive_shapekey)

As suggest in the comments by batFINGER: Checking for the name in the second line from the end will prevent other handler to get removed.

There seems to be the need to control shapekey on multiple object (as seen in the question's edit). This isn't that difficult if the parameters are properly understood.

The lookup up name in the key_blocks 'Key 1' is simply the name of the shapekey on the object. If your shapekey has a different name, the code should be changed accordingly.

The next codeblock will update the cameraFacingKey shapekey on multiple objects: Cube and otherCube using a single method. It relies on both of them having the same shapekey name. The import and handler statements shouldn't be changed.
This code creates python list with a list comprehension. In the drive_shapekey(scene) method it loops over all objects in the objs list.

cam = bpy.context.scene.objects['Camera']
obj_names = ['Cube', 'otherCube']
objs = [bpy.context.scene.objects[name] for name in obj_names]

def drive_shapekey(scene):
    for obj in objs:
        obj_mat = cam.matrix_world.inverted() * obj.matrix_world

        obj_eul = obj_mat.to_euler('XYZ')
        cam_vec = obj_mat.to_translation().normalized()
        obj_vec = mathutils.Vector((0.0, 1.0, 0.0))
        obj_vec.rotate(obj_eul)
        difference = cam_vec.dot(obj_vec)

        key1 = obj.data.shape_keys.key_blocks["cameraFacingKey"]
        key1.value = difference


Corrupted UV map on exported and re-imported object

try to choose project from view instead of unwrap .


How can I create a crashing wave effect?

A simple solution to get you started is to use a particle system and the smoke simulator.  Initial testing on my end used a camera set high on the Z axis facing down to the emitter object within the smoke domain.  Track the smoke within the domain to the particle system.  Emit for about 20 frames with a lifetime of 20 on the particles. the object I used was an icosphere cut in half with the rounded side facing the positive Z axis also the object emitted from the faces.  Under Emitter velocity, I set the Normal to 15, initial velocity on the particles per axis at X & Y = 0, Z = 5.  As the particles move out from the emitter, the smoke will follow their path.  As for the crashing of the waves exploding onto the dock, use an object within the domain as both a particle obstacle and a smoke collision object under the physics tab.  Within whatever render setting you should be able to control the material and or color of the smoke to simulate water and foam.  Run the animation and tweak to your needs. Hope this helps.


Edit: So my solution is not completely accurate, because as you say the big cable and the tubes do not join at the same point of the plug.
*Create an empty at the cable end, select the empty, shift select the cable, go in Edit mode, select 3 vertices, press CtrlP:

Parent the plug to the empty:

Give the cable a Curve modifier, move the cable along the curve:


You might need to adjust how you are trying to parent objects in order to solve the issue you are having.

When you want to parent an object to a bone that you plan to move with pose mode, you should try to parent it to the bone, rather than parent to the armature object.

Here is a simple workflow that should work for your situation.

Select the armature that you want to follow the bone in another armature
Now select the armature that contains the bone that you wish to parent to.
Use the parenting menu and select bone, or bone relative, depending on whether you want your child armature to retain its offset or not.

Hope that helps, happy blendering!

Note that:

If the armature containing the bone you want to parent to has multiple bones, you will need to select the proper one before doing so.

You can do that by going into pose mode prior to parenting, choose the bone that is to be the parent, then go back to object mode.


Newtonian Size - Where to find in Blender 2.8

In Blender 2.8 particle size is under Viewport Display!


How can I get rotation in the X and Y Axis in object mode?

Shift+Z after entering rotation mode will bound the rotation to only the x and y axis.
In general, Shift+axis letter will bind the translation to all axes apart from the chosen axis.


You must unckeck Individual.

See the image below with the Individual checked:


just use a generic rigid body joint constraint -> 6dof and lock all the values to 0

Also, you are going to want to check linked collision (so it won't collide with the chassis)

one thing to note, rigid body joints are broken in 2.73a if you delete any item, it remove ALL rigid body joints in the scene...


Why does rendered fire on transparent background look different than on preview?

To closely match viewport and final render you have to give both the same render settings...which ends up for you waiting for the viewport rendering the same time as for the final render.
Second thing: The human optical perception can easily be tricked into "seeing" something, which isn't there or looks different, which is identical. Example:
Totally different greys are identical
If it doesn't came out totally different (for example a red rose turns blue) it is the result of subtle differences in the render settings playing games with your optical persception. So far the theoretical part of it. :)

If the alpha channel has a greater influence of the results, check the setting of the viewport regarding transperancy and the handling of the alpha channel.


My Character Run Animation is not Playing in Game Engine

Solution

Activate an action actuator that plays the run action starting at frame 1 ending at frame 11. Let it play in Loop stop mode to get an endless cycle.

Details

You need to parent the skin mesh objects (with Armature Deform option) to the armature.


I personally don't see any other solution than delete the inner ellipse and re-extrude inwards, bevel, etc.
If you want to redo this kind of shape from scratch, here are several ways to do it, the less destructive would be with a curve, but if you begin with a mesh you can now custom the profile:

Create your ellipse object, select the top edge:

Bevel it with CtrlB, give it enough segments:

Enable the Custom option and draw your profile:

A similar custom profile has also been implemented for the curves, go in the Properties panel > Object Data > Geometry > Bevel and click on Profile:

You will have much more control on the bevel shape if you use the Object option though:

Or of course you can use a mesh as a profile along a curve with the Array and Curve modifiers:


Joining Rigid Body objects after baking to shorten BVH building time

If you link the objects with ⎈ CtrlL > Object data, one copy of the mesh data will be shared between all 20k objects (as opposed to 20k copies of the same data).

While not as efficient as whole-object instances (e.g. dupli objects), AFAIK this is about as close as you can get while still keeping the rigid body sim.


Convert Bsurface (without object) to mesh

Found my answer in this comunity and blenderartist.The problem was that i needed to click on the little arrow (selection off/on) next to the object.
Wasn't aware of that.
Thanks, lluis
i leave here the posts:
https://blenderartists.org/forum/showthread.php?441827-Bsurface-without-object&p=3263344&highlight=#post3263344
https://blenderartists.org/forum/showthread.php?441827-Bsurface-without-object&p=3263344&highlight=#post3263344


exporting animated model to unity 5 totally deform the mesh

I found I had better luck using the FBX 6.1 ASCII settings when exporting to Unity.  Are you animating using bones? I never had any luck importing shape key animations into Unity.

These are the settings I used and had the most success.


How can I rotate the pivot point of my object without rotating the object itself?

After some headscratching about what you mean, I figured it out. Use the shortcut CTRL+A, then apply "Rotation and Scale"

EDIT
What this does is it simply applies your rotation and scale of the object, aligning the local Z axis with the global Z axis and so on. It also applies the scale of the object, meaning textures will align properly.

Hope this helps.


In edit mode, you can select the vertices that you want to scale the most (those that will be the widest part) then turn on proportional editing. Press S to scale, and use the mouse wheel to control the radius of influence.


How do I create a background material in Blender 2.8?

I discovered the answer on my own. Turns out that the "material" properties panel on the right side of the screen in shader view has a "Surface" property. Setting that to "Background" (and then rebinding the texture in the shader graph) will cause the GLTF exporter to use the KHR_materials_unlit extension.


How can i extrude a text or element to the sides correctly?

I found a solution, to do what i wanted is to Scale Normals ( ALT + S)

Extruding along an edge without creating new faces


Teeth always broken when I rig every character with auto-rig pro

Automatic weights are a feature of Blender, not any individual rig or addon.

The weight calculation uses the bones' size and position relative to the mesh and each other to calculate which bones receive which weights. Changing this can have an effect on the weight calculation, but can also lead to bad pivot points for bones, so be careful. The algorithm used is also designed to blend weights smoothly between nearby bones, so for things that have fairly rigid assignments such as teeth, having to correct afterwards is very common. It seems like you have got lucky previously with rigify.

In my experience, automatic weights will always require some manual correction for good deformation.


you can change the outer setting in the physics tab. this changes the size of the collision box and will stop the object from sticking


Maybe learning a bit of Uv unwrapping can help
https://www.youtube.com/watch?v=Y7M-B6xnaEM
https://www.youtube.com/watch?v=cS6B5PAzlWI


You could parent all the objects to one object and rotate that on the Z axis.
Select all objects with ⇧ Shift + Click, on the last object press Ctrl + P then choose Parent to Object.
Now rotate the last object you selected and everything will rotate with it.


How to hide the alpha of image planes? (Images as Particles)

If you want to mix in another (non-principled) material this way, you would have to add transparency to it separately. You could do this with a Transparency material and another mix node, controlled by the image's alpha channel.
However, in your use case, I don't see why you would need another shader, especially not a glossy one - I see nothing like that in the reference image, and it wouldn't be physically accurate. Instead, I would recommend you decrease the roughness of your existing shader if you want more shine.
(Alternatively, you can use the clearcoat settings - these may work well for the natural fats that cover leaves, or to simulate wet leaves.)


How to render very high resolutions without running out of memory?

If you want to render scenes that require more memory then your system has, I think your best option is to render the image in sections (tiles).

I think there are more then one script to do this, but I found one here:
    http://blenderscripting.blogspot.com.au/2011/07/calculate-tile-render-ratio-snippet.html

Update: made an improved version of the script linked above:

This uses environment variables so you don't have to do manual edits to the file to change settings.

Example usage:

TILE_X=10 TILE_Y=10 PERCENT=1000 blender -b /path/to.blend -P render_tiles.py

You can also save the file with very high resolution and omit the PERCENT var(which will be set to 100).

Once completed, the montage command to join the images is printed.
This depends on ImageMagick's montage command, eg:

Run this command to join images:
    montage -tile 10x10 -border 0 -mode concatenate '/tmp/render_*.*' final.png

Heres the script: render_tiles.py

def main():
    import os
    import bpy
    from bpy import context

    scene = context.scene
    render = scene.render

    tiles_x = int(os.environ.get("TILE_X", "4"))
    tiles_y = int(os.environ.get("TILE_Y", "4"))
    resolution_percentage = int(os.environ.get("PERCENT", "100"))

    slice_x = 1.0 / tiles_x
    slice_y = 1.0 / tiles_y

    # use border and crop
    render.use_border = True
    render.use_crop_to_border = True

    # set resolution percentage
    render.resolution_percentage = resolution_percentage

    filepath_orig = render.filepath

    # track progress
    tiles_done = 0
    tiles_total = tiles_x * tiles_y

    for div_y in range(tiles_x):
        for div_x in range(tiles_y):

            render.border_min_x = slice_x * div_x
            render.border_max_x = slice_x * (div_x + 1)
            render.border_min_y = 1.0 - (slice_y * (div_y + 1))
            render.border_max_y = 1.0 - (slice_y * div_y)

            cell_name = "%04d_%02d_%02d" % (tiles_done + 1, div_x + 1, div_y + 1)

            render.filepath = "%s_%s" % (filepath_orig, cell_name)

            bpy.ops.render.render(write_still=True)

            print("Rendered %s (%d of %d)" % (cell_name, tiles_done, tiles_total))

            tiles_done += 1

    print("Finished: %d tiles" % tiles_done)

    print("Run this command to join images:")
    print("    montage -tile %dx%d -border 0 -mode concatenate %r final.png" %
          (tiles_x, tiles_y, bpy.path.abspath(filepath_orig) + "*.*" ))

if __name__ == "__main__":
    main()


You can use a gradient texture in the node editor to determine the color. In the node setup in the photo, I am using a gradient texture with generated coordinates. I then rotated it to the correct axis with the mapping node, and also scaled it for a better effect. I then plugged the output of the gradient in a color ramp node, setting black to brown and white to green, giving the color scheme you want. Hope this helps!


you need to deactivate the X-RAY box in each object, I do not know exactly what could be the cause of this because you did not put a reference image and the information is very poor although it basically describes the problem

change this and correct another part of what is still seen with transparency, you have many errors not related to the question, it is no longer a question of only one answer, it has become a cluster of answers not directly related

to the animals, uncheck the box backface culling, in the tab Color / Game Settings / backface culling, in the Object / Display / Maximum Draw Type tab, all objects need are in SOLID


A general answer to this is because there are either no lights in your scene or you haven't computed the smoke simulation yet. To add a lamp to your scene, use ShiftA > Lamp and choose one. To simulate the smoke, you can just hit AltA or bake it to disk under Smoke Cache in the Physics panel (you must save the file first).

Also, the default Point lamp is a bit weak and might not illuminate the smoke properly depending on the angle viewed. A Hemi or Sun lamp should be sufficient for most tests.

Without any light

With a hemi lamp


If I understand right, you need joining cubes without inner vertices.

You can do it in second using Bool Tool addon:

Just select all cubes, (one of them must be active) in BoolTool menu click on "Brush" -> "Union" -> "Apply All" - done

Download Bool Tool


Python scripts run blocking in Blender, which means Blender will wait and UI be locked until finished. You won't see an animation therefore, no matter if you use time.sleep() or not.

Use a frame change handler to register a callback function, that changes objects on every frame change (before or after):

http://www.blender.org/documentation/blender_python_api_2_70_release/bpy.app.handlers.html


I pressed something, and my object went curved

You most likely added a sub-surface modifier on your object. You can do this by pressing

Ctrl+1 throughCtrl+5, adding a sub-division surface with the respective amount of divisions.

Because you were pressing Alt+2 before it happened, your finger probably landed on Ctrl when it slipped.

In your second screenshot, you do not have your object selected, so the modifier would not display. in the modifiers panel

You can remove it by going to the modifiers panel and deleting the modifier.


Why won't Blender let me import .svg files?

It works fine for me, however they come out very small initially:

Once imported and selected, you can scale them up with S. Once properly sized, it's also probably a good idea to apply the scale with ⎈ CtrlA.

Also remember to delete the default cube, otherwise they will appear inside it.


Separate By Loose Parts without mesh warping

First of all I think your Q is a bit out of naming convention (or my understanding).
Mesh is not wrapped, but seems to me as Vertex Normals issue. I had no time to investigate deeper, but disabled Auto Smooth Properties > Data > Normals solved it.

Edit: yet not sure why Auto Smooth react so wierd, but since its Vertex Normal issue it is better to search for Set Normals from Face that fix that and you can use Auto Smooth as well.

There would be still visible edges of separated parts, but that is simply because blender dont know  there is a face next to it so cant optimised. Probably there is another function to search in radious or there is a way to fix it manually, but for sure "seams" are gone when you connect parts together like Merge by Distance.


Changing textures realtime in game engine

You can use texture bind ID.

Once you have it, you can pass a image buffer into it I think.


how to rig this object (function compass)?

The trick is to use IK constraints mostly. Here's my setup:

Main is the root bone
pointer is a child of tip 1
big 1 is a child of pointer
big 2 is a child of big 1
small 1 is a child of big 1, not connected
small 2 is a child of small 1
small target is a child of big 2, not connected, no inherited rotation
tip 1 is a child of Main, not connected
tip 2 is a child of small 1 but doesn't inherit rotation
tip 3 is a child of Main

tip 2 might need a copy rotation constraint to tip 1 or tip 3 if you rotate the whole rig other than around Z.

Main is there to move everything. A handle of sorts for the whole compass.

pointer has a locked track constraint pointing to tip 3. Since the IKs are parented to it, they act in local space and won't flip even if the compass turns upside down using Main.

big 2 has an IK Constraint pointing to tip 3, chain length 2, it's the classic and simplest arm or leg rig.
small 2 has an IK Constraint to small target, chain length 2. Same thing, just upside down and parented to the big IK bones.

Now the rig moves correctly whether you move tip 1 or tip 3.


The easiest way to do this effect is to animate the Y offset in sync with the bottom crop.
So enable Crop and Offset and insert a keyframe with 0 value for Offset > Position Y, Crop Top and Crop Bottom where you want the animation to start.
Divide your video's height by 2 then go to the frame when you want the animation to finish and insert a keyframe at that same value for all three fields.
Done!


Adding specific uv map to UVMap node in python script

If you have enabled Developer Extras in the preferences, you can see the attribute name linked to the field while hovering over it : uv_map

The field is a StringProperty, meaning you have to set it to a str value. It doesn't matter if it doesn't exist yet on the object data. If it doesn't it will be filled with red.
See :
import bpy

uv_map_node = bpy.context.object.active_material.node_tree.nodes.new('ShaderNodeUVMap')
uv_map_node.uv_map = "test"

uv_map_node2 = bpy.context.object.active_material.node_tree.nodes.new('ShaderNodeUVMap')
uv_map_node2.uv_map = "UVMap"


How do I Download an External File from URL and Display Progress in a Panel without blocking the UI?

Okay, I think I've found the solution to this issue.

Instead of calling a single download file command with urlretrieve, I opened a remote urllib.request using the chunk size argument, as well as opening a local file for writing. I used a modal operator to read a new chunk from the URL and write the chunk to the file. Keeping the chunk size around 16kB seemed to work well.

In order to get the download size progress updated to a panel label, I needed to use a second modal operator running to get the label to update.

Curiously, in the Event.Timer statement of the second MO, I needed to update any random property in the scene context to get the Status Label to really update properly. Perhaps someone could explain that bit further.

This is what I used to trigger the update in the second MO:

bpy.context.window_manager.name = bpy.context.window_manager.name

Here's my code sample, feel free to comment:

import bpy
import sys
import urllib
from urllib import request

scn = bpy.context.scene
fileDwnProgress = ""
url = "REMOTEFILEURL"
theFile = "LOCALFILEPATH"

def strMsgLabel_Get(self):
    global fileDwnProgress
    return fileDwnProgress

bpy.types.Scene.strMsgLabel = bpy.props.StringProperty(
    name="Status",
    description="Message Label",
    get=strMsgLabel_Get,
    set=None)

class OBJECT_PT_TESTPANEL(bpy.types.Panel):
    bl_label = "DOWNLOAD TEST PANEL"
    bl_space_type = "NODE_EDITOR"
    bl_region_type = "UI"
    bl_context = "object"

    def draw_header(self, context):
        layout = self.layout
        layout.label(text="", icon="INFO")

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.label(text=scn.strMsgLabel)

class mdFileDownload(bpy.types.Operator):

    bl_idname = "wm.md_file_download"
    bl_label = "File Download"

    _timer = None
    _transferring = False
    _download = False
    _chunkSize = 16 * 1024  #(16kB seems good chunk size)
    _fileSize = 0
    _fp = None
    _req = None
    _chunk = None

    def modal(self, context, event):

        global fileDwnProgress
        global url
        global theFile

        if event.type == 'TIMER' and not self._transferring and not self._download:

            self._fp = open(theFile, 'wb')
            self._req = urllib.request.urlopen(url)
            self._transferring = True

        if event.type == 'TIMER' and self._transferring:

            self._chunk = self._req.read(self._chunkSize)

            if sys.getsizeof(self._chunk) < self._chunkSize:
                self._fp.write(self._chunk)
                self._fileSize += self._chunkSize
                self._transferring = False
                self._download = True
                self._fp.close()
            else:
                self._fp.write(self._chunk)
                self._fileSize += self._chunkSize

            progress = str(round((self._fileSize/1024/1024),1)) + " MB"
            fileDwnProgress = progress

        if self._download:
            fileDwnProgress = "Download complete!"
            self.cancel(context)

        return {'PASS_THROUGH'}

    def execute(self, context):
        # print(var)
        wm = context.window_manager
        self._timer = wm.event_timer_add(0.01, context.window)
        wm.modal_handler_add(self)
        self._transferring = False
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)

class mdDownloadMonitor(bpy.types.Operator):

    bl_idname = "wm.md_download_monitor"
    bl_label = "Download progress monitor"

    _timer = None

    def modal(self, context, event):

        if event.type == 'TIMER':
            #this is required to trigger the update
            bpy.context.window_manager.name = bpy.context.window_manager.name

        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        self._timer = wm.event_timer_add(0.01, context.window)
        wm.modal_handler_add(self)
        bpy.ops.wm.md_file_download()
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)

def register():

    bpy.utils.register_class(OBJECT_PT_TESTPANEL)
    bpy.utils.register_class(mdFileDownload)
    bpy.utils.register_class(mdDownloadMonitor)

def unregister():
    bpy.utils.unregister_class(OBJECT_PT_TESTPANEL)
    bpy.utils.unregister_class(mdFileDownload)
    bpy.utils.unregister_class(mdDownloadMonitor)
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()

bpy.ops.wm.md_download_monitor()


I'd do away with sculpting, create it from a base icosphere instead.
Add an icosphere, subdivide it as necessary (about 2 in the example below), then on top of it add a Subdiv Modifier and set shading to smooth.
Then in Edit Mode select clusters of contiguous faces, spaced wherever you want craters to be.
Press E to extrude them with the option Along Normals, followed by a small Inset for the ridges, then another final Extrude Along Normals to create the depression.
Repeat for more craters, you can adjust crater radius either by insetting once before the first extrusion, or by scaling the extruded faces after the first extrusion.


Using Vector Curves Nodes for transitions

To achieve an abrubt transition, you only need the Greater Then Node.

It seems that Vector Curves Node had some problem with too close points.
Everything works well when points are more distant.


Use Transform strip: https://docs.blender.org/manual/en/dev/video_editing/sequencer/strips/effects/transform.html

Or use the add-on which will allow to do the image animations directly in the preview: https://github.com/doakey3/VSE_Transform_Tools


Vscode debugger ignores breakpoints in imported modules

It was my fault.
The wrong module path in import function "pakage.module" instead of ".package.module" (the dot at the beginning) was the reason.
I didn't know that addon is copied into the blender scripts folder and then debugged.
My disorientation was caused by fact that the addon was fully functional with those mistakes.
I am still learning. Thanks, everyone.


Is it possible to bevel (or round) a bezier vector handle?

You cannot use Bevel on a curve. You can, however, bevel a mesh and convert it to a curve.

I used a cube to create this shape, deleted all but one edge loop, and used Alt+C in Object mode to convert to a curve.


How to pull all vertices from a specific Vertex

Edit Mode Proportional Editing (keyboard shortcut O). works well.


The question about blurry textures has been asked countless times before, it has to do with the used texture sampling.
See this answer for more details https://blender.stackexchange.com/a/47643/19307

As for distorted (as in stretched or compressed) textures it all as to do with the way you UVMap your textures.

Fix your UV's so as not to cause distortions, evenly scaled islands and proportionally unwrapped faces will help. If possible use the UV Map > Cube Projection which will cause minimal distortion, or UV Map > Project From view

Alternatively consider using generated texture coordinates where possible instead. This may not work in the viewport or exported models.


How to create a circle pie chart with separate (adjustable/variable) triangle "chunks"?

You can also do this with a curve by adding a bevel object and changing the Start/End values of the bevel:

Shift+A> Curve> Circle.
In edit mode of the new curve press Alt+C to 'Toggle Cyclic' so the curve doesn't join its ends together:

Select all the curve points and change their handle type to 'Free' in the side toolbar (T) under 'Handles' and move the curve points back into a circular shape (but the circle will now have a gap).
Extrude the last curve point with E and place it exactly on top of the other end of the curve (a bit more carefully than I have):

Now add a new curve in object mode and flatten it so it is a straight line:

In the curve properties for the curve that is a circle set the 'Bevel Object' to be the curve that is a straight line:

You can now adjust the 'Start' or 'End' values (shown in the first gif) to adjust the 'completeness' of the circle.
As one final step, you can give thickness to the curve by adding a 'Solidify' modifier and then an 'Edge split' modifier to correct the shading:

Duplicate this curve and adjust the 'Start' and 'End' values for each new segment of the pie.


How to make clouds using particles and smoke simulation (Cycles)

Your question and description is not clear.
So just a notes:

Doesn't matter how big a smoke domain object is, domain is defined by resolution in physics properties. Imagine that as a grid. Resolution means into many voxel pixels will be divide the longest edge of the domain.
Higher resolution = more details for this voxel texture. I hope you already checked Blender Reference Manual.
Second aspect is already explained in your link - play with size of procedural texture used for particles density to create general shape of clouds. And adjust brightness and contrast to tune the particle cloud shape. (I use rather coloramp for that.)

Don't expect precise numbers - nobody knows your planet size or what style of clouds you want to achieve.


I solved both issues:

1, Getting rid of the black "stripe": Setting the container (the concrete surrounding the water) in the fluid simulation under the "Volume Initialization" settings from "both" --> "shell".

2, Getting rid of the black surface of the water inflow:
Setting the amount of "max bounces" at least at 8.

It is still not perfect, but definately an improvement.


enable auto keying , and start , that small record type button next to play button on the left in the timeline


Rotating an object according to geometry

Kinda depends on what you mean.  A model is composed of a lot of geometry.  Is there a specific face you want facing front?
If so, try this:
Select a face.  Ctrl-alt-space to create a custom orientation on the basis of that face.
Object mode, snap cursor to selection.  Create an empty.  Duplicate that empty.  Move that duplicate 1 unit in the custom Z.  Give the original empty a locked track (lock Z, probably) targeting the duplicate.  Parent your mesh to your original empty (keep transform).  Delete or mute the empty's constraint.  Unparent the mesh (keep transform.)

That's assuming you're already oriented properly up/down (Z axis).  If you're not, you can use similar techniques, combining a damped track and a locked track.


Mask smaller in Video Sequence Editor than in Movie Clip Editor

I found the reason for the mismatch of the mask: the input video in the movie clip editor is in 4K with 4096x2160 px and the output video in the video preview window is downscaled to fullHD with 1920x1080 px. Therefore the aspect ratio of the input (1.89 : 1) is different to the output video (1.77 : 1) hence a mismatch of the mask in the output video


How to distribute without the occurart tool?

Create four objects. Enter the names of the objects at each end, A and D. Type B and C in the middle. Then spread the distance on the y-axis.
import bpy

#Compare y-axis distances

dif = bpy.data.objects["A"].location.y - bpy.data.objects["D"].location.y

#There are four objects, so do 4-1.

chunkglobal = dif / (4-1)

chunky = 0

#Sets the initial location value.

deltafst = bpy.data.objects["D"].location

OBJECT = bpy.data.objects["A"]

#In object, enter the location information for A.

OBJECT.location.y = deltafst.y + chunky

#Add the total length divided by the average length.

chunky += chunkglobal

#Repeat to the following object

OBJECT = bpy.data.objects["B"]

OBJECT.location.y = deltafst.y + chunky

chunky += chunkglobal

OBJECT = bpy.data.objects["C"]

OBJECT.location.y = deltafst.y + chunky

chunky += chunkglobal

OBJECT = bpy.data.objects["D"]

OBJECT.location.y = deltafst.y + chunky

chunky += chunkglobal


The formula for alpha stated is incorrect.
If you set it to (focal length)*(image width)/(sensor width)
it will work.

Note that focal length and sensor width are in mm, so they can't both be in the numerator, just due to units issues.


If the point you are tracking gets obscured, think of it in two sections, tracking before and tracking after.

Track the early footage until your marker is obscured
Jump forward until it is visible again
Move the marker back into place
Track forward through the later footage

If objects that you are adding should also be obscured, you will want to either track some points on the obstruction and make them the parent of a mask or keyframe the position of the mask to follow the obstruction through the shot. You then use the mask to cut out your objects in the render.

Instead of moving the marker into position after it reappears, you can also track the point with a new marker, these two markers can then be selected and merged into one using Join Tracks.


That is impossible. Blender does not store a record of the previous location of individual vertices. Once you have sculpted an area, it edits the original mesh.

There are many workarounds though.

The most effective (and in a way, easy) method would be to select the area you would like to undo (in edit mode) and delete it. You can then remake it, or go back to a previous save/version you have created, and copy back that section. For this method to be effective you need to save a version of your project before you begin sculpting.

However, if you are going to begin a new model from scratch, I would suggest one of these methods.

First, you could create a gray-scale texture, and paint on this, using it as a displacement for the original mesh. You then "sculpt" in texture paint mode.
The main downfall to this is that it cannot auto-update. You need to switch to edit mode and back to see the changes take effect.

The best method

You can model your object, then duplicate it (make sure it is unwrapped). Now sculpt on the duplicate. when you are done (or want to undo something), you can bake the normal map for the sculpt onto the original. (there are lots of tutorials on baking normal maps.) Now use this map in a displacement modifier (on the original mesh) with "direction" set to "RGB to XYZ".

With either of these methods, to remove a portion, use a vertex group to "mask out" the results.

(Using these methods you will need a subsurf modifier to enable the displacement, or to subdivide your original model for more control.)

Here are some more "corrective" options

Use the "smooth" tool.

You can also hold ctrl which generally does the "opposite" of whichever tool you are using.

Otherwise you can use undo.


How to animate a propeller on the axis of rotation?

Rotation at odd angle -

Whilst I concur with the comments above, I remember doing this at some previous time.

The cube, shaft and 'propeller' here were added at the default location 0,0,0 and at the default straight  x,y,z  angle.   I'm not sure this matters.

The shaft and 'prop' were parented to the cube.

To experiment, the cube was then rotated at around 45 degrees in all 3 axis'.

-=============-

WARNING - Do not use CTL-A (apply) on any of the 3 components.

And for info - Keyframing as mentioned below was always done by hovering the mouse in the locatio/rotation slots at right and pressing "i" .

-==============-

The "Orientation" menu at bottom of window was then switched to "Normal".

Fearing a manual entry in the prop's X axis would be applied globally, after keyframing a zero in it's X rotation slot at frame 1, I advanced the timeline cursor to frame 80 and rotated the prop several times with the keys RXX.  This was the (normals) axis that aligned with the shaft. The mouse was used to drag the actual rotate.  That was then keyframed and it worked fine.

I'm not sure if this rotation experiment was necessary but it did provide reassurance.

A more adventurous rotation was then manually entered into the prop's X rotation slot at right: -36000 at frame 80. (100 rotations over 80 frames)

When run the animation rotated correctly.

The cube's location and attitude were then changed and keyframed and everything still remained stable.  An animation speed of 120 fps was used to check this.

-==============-

To conclude and whilst not recommended, when necessary however it appears you can get away with perpendicular rotation at odd angles, in Vers 2.77a  at least.

The Blend file is available on request but the key to it's success is probably due more to the order and manner components are added, rotated, and keyframed.

There were no active modifiers or constraints used apart from parenting.

It shouldn't make any difference but the above was rendered with OpenGL.
Further, when CTL-A was used, everything went haywire.


You can use the OpenColorIO Python library to transform a Filmic log encoded image back to scene referred linear.

The base log is a simple normalized log base 2 format, with ten stops down from middle grey and six and a half stops up.


Deleted .dvd file, and "Could not open file for writing."

It could also be a permission problem and maybe the .dvd file has nothing to do with it... double check if blender can write to the output path set for your work (still or movie) in rendering settings...


I think blender kit objects will come in collections, try to select individual objects/single object from collection and then try for toggling edit mode - object mode


Found it, first select one face (of the pillar for exemple) then select -> select all by trait -> normal (now each pillar has one face selected) u -> reset

the faces are unwrapped on all the size of the image:

simply resize it (when reset the face got the ration of the uv/image, try to get the ratio of the face you have unwraped) and place it where you want:


The "script" property is a reference to a Text datablock.  You first need to create a Text datablock, and then set the "script" property to it.  Example:

import bpy
p = '/path/to/style_module.py'
t = bpy.data.texts.load(filepath=p)
m = bpy.context.scene.render.layers.active.freestyle_settings.modules.new()
m.script = t


This looks more like an artistic questions than technical problem with Blender, for this sort of thing Blenderartists.org or one of the communities like Google+ are probably the right place to ask, or perhaps some community for the game engine you are trying to use.
Also you don't seem to provide enough information for an accurate answers, what game engine will you be using, on what platform? What kind of hardware target are you aiming for, high end, low end?

I am guessing that the techniques used will depend largely on the game engine you are working with. In most cases, grass like the one illustrated involve some sort of 3d geometry, even if it is a simple plane with a texture.

Depending on the level of detail you want it may range from a basic 2d mesh to fully modeled particle of grass combined with diffuse and alpha textures. Most often some clever use of simple geometry to create the illusion of volume without using many polygons.

As for the distribution part, it will depend a lot on the tool available in the engine, placing by hand is likely not practical for very large surfaces, so some sort of particle system or automated distribution tool is used. In Blender you can use the built in particle system, and some texture or vertex group driven density distribution.

If you later plan to export to an external game engine you will have to investigate which method is best supported  for it. Most likely you will have to use blender to model a few different single strands of grass, export those and apply them in engine.

Edit: Also have in mind that many of those images are digital paintings or "offline" rendered scenes, not real time interactive ones. In game engines performance is to be considered and there often are limitations on the amount of geometry that can be on screen or in a scene at a certain time.


Drawing moving object coordinate in x-z direction

If all that's required is to trace its path in the viewport (rather than actually including it in the render) then just selecting the object and clicking the Calculate button in the Motion Paths object properties panel will calculate the path and display it in the viewport.

If, however, you want to include the path in your render then you'll need to create it as actual geometry (eg, a curve that you can add a bevel). This can be achieved using particles (similar to @thibsert's answer) as detailed in How to add trailing light effect to finger tips?.


You can access the color management panel in the render properties. Check "Use Curves" and then you can modify either the contrast or each color channel independently


Your primary camera wasn't your selected. And somehow, when you press 0, your wall become the camera, then you enter Camera Flying mode, it move the wall, not the camera. So, to fix it when you select your camera.
- Press CTRL + Numpad 0 instead press Numpad 0.


Test code out in the console.

Even if you are going to use a script from command line always (IMO) a good idea to test it out in the python console. (D = bpy.data, C = bpy.context)

When adding an object via operator, the new object added is the  context.object  Notice the name below is not "Area" as there are already other area lights in the scene.  Using light_ob = bpy.data.objects["Area"] will only work as expected if there are no other lights of that name in the blend file.

>>> bpy.ops.object.light_add(type='AREA')
{'FINISHED'}

>>> C.object #  the new object
bpy.data.objects['Area.002']

At any time can hit the autocomplete to see the available options.  The light is the data part of the light object.  (In the UI Properties panel it is under the Data tab.)

>>> light_ob = C.object
>>> light = light_ob.data
>>> light
bpy.data.lights['Area.002']

It's of type AreaLight which per documentation link posted in question is a subclass which inherits properties of bpy.types.Light

>> type(light)
<class 'bpy.types.AreaLight'>

>>> light.energy = 500

All objects have an rgba color property. For a lamp as commented above to set the lamp color set it on the data part.

>>> light.color = (1, 0, 0)
>>>

The script.

import bpy

bpy.ops.object.light_add(type='AREA')
light_ob = bpy.context.object
light = light_ob.data
light.energy = 500
light.color = (1, 0, 0)


Is it possible to dictate a UV map instead of pulling one?

In Edit mode, select the face you want to manually set the UV map for and select Mesh/UV Unwrap.../Reset from them menu (or press U and select Reset). This will reset that face to cover the whole UV space. Then in the UV Editor window (while the face is still selected in the 3D viee) you can manipulate the UV mapping as desired (select the vertices (or A for all) and use G, R, S for Grab, Rotate, Scale, etc


Beveling a plane that has been extrude 90 degrees

There's a rather simple reason:
Your object's scale is messed up.

Your object has uneven scale, so the bevel is applied 400x times more on one side, than on the other.
Fix it by going to Object->Apply->Scale.
Then the bevel tool will work as you need it.

Fix your scale

Then it works as it should


"Assign" one image to multiple faces no longer working

You have checked UV Local View which causes you always see only those faces that have assigned the image currently opened in the UV/Image editor. So when you try to replace the image, even if you press A (thinking you have all faces in the editor), you always replace only that one image.

Uncheck it and it will work :-)


First you need to adjust the rotation of the small object to be fitted on the surface with the correct angle as shown below:

After that, switch to edit mode of the big object and switch to Face selection and select the face as shown below:

Then hit Shift+S and select Cursor to Selected as shown below:

After that select the small object and hit again Shift+S and select Selected to Cursor this time and it will work as shown below:

Updated .blend file can be found here:


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


There is something wrong with how you weight painted the mesh. If I remember correctly, if you weight painted it at "the roots", the part of the mesh that is not weight painted should move. Or it could be the other way around. So just to be sure, here are some videos to help you out on the softbodies issue.

https://www.youtube.com/watch?v=j2tM_LS8jIA

https://www.youtube.com/watch?v=e1lHca7I3So

Hopefully, these videos can lead you into the right direction.


Message Sensor can't detect/receive message

In the first screen shoot, I have a Keyboard
sensor, on the object ground plane, send a message to all objects (the empty To field) with a Subject of somthing (with the misspelling).

Drag the images to a new tab to enlarge them.

In the second screen shoot, Now on the object human. There is a message sensor listening for a message with the subject somthing. When it receives a message (from any object) with the subject somthing the connected action actuator plays the animation.


Blender 2.81 - Copy cursor rotation to an object

Snap to cursor with code

Quick little script to copy either or both of cursor location, rotation to selected objects.

import bpy
from mathutils import Matrix

use_rotation = True # use cursor rot
use_location = True #  "    "    loc

context = bpy.context

cursor = context.scene.cursor

tc, qc, sc = cursor.matrix.decompose()

for ob in context.selected_objects:
    to, qo, so = ob.matrix_world.decompose()

    R = qc.to_matrix().to_4x4() if use_rotation else qo.to_matrix().to_4x4()

    T = Matrix.Translation(tc) if use_location else Matrix.Translation(to)

    S = Matrix.Diagonal(so).to_4x4()

    ob.matrix_world = T @ R @ S


Moving a vertex of a Bézier Curve moves the origin point of a mesh with array+curve modifier (why and how to stop)

Ok, so @HenrikD was right indeed; for some reason there was an empty that the whole mesh was parented to. CLearing the parent and setting up the curve modifier anew was enough to solve the problem.


Can't select vertices, edges or faces in box select mode

You've most likely changed the mode of Box Select. Make sure that either set or extend is chosen. The options can be found in the header, the Tool tab in the sidebar and the Active Tool and Workspace settings as shown in the screenshot below.


How to pin a distinct bone in a rig while animating

It all depends on how your rig is made. Here is one tip.

Add an empty to your scene.
Give it a name like ElbowRest-Empty.
Select your Elbow Bone in Pose Mode. Add a constraint "Track To"
Select "ElbowRest-Empty" as target.

Now in object mode, where ever you move your empty, your elbow bone will follow.
You may need to lower the influence of IK to keep the elbow bone pinned where ever you want too.


Modeling flat surface shapes on a cylinder

A possible solution is to use a boolean modifier

Starting with your round shape:

Create a cube and rotate it in the angle you need for the flat surface:

Then place the cube where you need the cut:

On the pelvis object add a boolean modifier, usnig difference mode ans selecting the cube as object:

To view the results just move the cube to a different layer or make it invisible (H) and unrenderable (CtrlH

The advantage of this method is that you can still adjust the angle and placement by moving the cube, and when you are done you can apply the modifier.

The disadvantage is that you'll end up with some n-gons

Other way to do this is with the knife tool, in wireframe mode choose a side view for the cut and press K along with the Zkey to greate a straight cut:

Then you'll have to do some cleanup to get rid of unwanted vertices.


How to recalculate automatic weights for single bones?

In Weight paint mode, select the pose bones you want to recompute the weight and press:
W > Assign automatic from bones


How can I properly orient custom leaves with a Particle System modifier?

You could use Duplifaces. When the sapling addon creates leaves, each rectangular leaf is a single face (hex leaves are two faced).

Create your custom leaf and then make the leaves object a parent of your leaf. In the object properties for leaves turn on Duplifaces.

Now your custom leaf will be duplicated at the location of each original leaf. The object centre of your leaf will be at the centre of the original face and will be rotated to match the rotation of the original single poly leaf. Modifying the original leaf will adjust every leaf to match. The original poly leaves won't render, just your custom leaf.

To speed up the viewport you can add a decimate modifier to the leaves object to reduce the amount of visible leaves.


Animate an object by moving it according to a list of coordinates

Assuming you have csv file with row like:

1.2,2.4,2.0
2.2,2.8,2.4

and assuming the requirement is to animate the ball with a constant frame interval between each of the coordinate set in csv, here is the code snippet:

import bpy
import csv
from mathutils import Vector

csvPath = '/path/to/the/csv'

#Not the most efficient way of creating a mesh , but should be fine for just one object
bpy.ops.mesh.primitive_uv_sphere_add(size=1)
ball = bpy.context.object

startFrame = 1
increment = 5 #This can also be in the csv
newFrame = startFrame

with open(csvPath) as csvFile:
    reader = csv.reader(csvFile, delimiter=',')
    for row in reader:
        #First set the location and then insert key frame
        ball.location = Vector([float(r) for r in row])
        ball.keyframe_insert(data_path='location', frame = newFrame)
        newFrame += increment

#Set the end of animation, if needed
bpy.context.scene.frame_end = newFrame


Why there is a layer of transparancy on my uv map?

First question around transparency: When Blender exports a UV map, faces are slightly opaque by default. This is so people can more clearly distinguish the difference between what IS a face, and what isn't. Ordinarily the UV map is taken into a graphic program like GIMP, Photoshop, illustrator, etc as a layer: the actual artwork is drawn on different layers, and that final result is exported as a Blender compatible file format, WITHOUT the original underlying (or overlying) UV map.

So... export your UV map, do your artwork, and remove the UV map layer before saving your finished art.

The amount that Blender will tint faces is configurable! When exporting, look in the left column for this palette:

...And adjust the Fill Opacity to zero.

Your second question needs more detail, such as which render engine you're using (Blender Internal or Cycles [or other]), what node you're adding to color it and how the nodes are connected. A screenshot would be necessary. Good luck :)


Can you turn a pose into the actual geometry of the mesh?

Yup.

Pose your armature.  Select your mesh.  Copy the armature modifier, then apply the first (topmost) copy.  Select your armature in pose mode and ctrl-a -> apply pose as resting pose.  Done.

There can be some issues if you have some constraints built around assumptions about the base pose.  It's not possible (to my knowledge) to apply a resting pose only to a single bone, so make sure your armature is in the pose you want before doing it.


Is it possible to animate a fire emitter/domain combo using armature and weightpaint - and if it is, how do I do that?

I see two ways to do that. You can either parent the domain directly to a single bone or use the "Child of" constraint.

Parent to a single bone
First select the Domain object object mode, then in pose mode select a parent bone of your character. Then press ctrl+p and select bone. Now the domain object moves with your parent bone.
Use a Child of constraint
In object mode select your domain object. Then in the properties panel go to the object constrains tab and add a new "Child of" constraint. Under "Target" select your armature and under "Bone" select the parent bone of your character. Click "set inverse" to reset the transformations. Now your domain object moves with your parent bone.

I'm not quite sure if this is recommended to do. As this will probably influence the simulation as the reference frame is moved. Not sure if this will cause problems.


Is there a way to locate where options are in the interface?

If it's a keyboard shortcut you are looking for, you can try searching for the tool in CtrlAltU> User preferences > Input:

As for external resources, you can try the wiki, but beware that some parts are incomplete/out of date.

Another external resource which works well is google, usually searching for something like "blender <function name>" will get you results.

However, if all else fails you can always ask here ;)


Set vertex normal in a stable manner with python

I found it by observing two mesh importing add-ons, but I didn't understand how exactly it worked.

What I know is that it can only affect loop normals, not face nor vertex normals (so that won't help you if you have faces with "front" and "back" part swapped)

mesh.create_normals_split()

for face in mesh.polygons:
    face.use_smooth = True  # loop normals have effect only if smooth shading ?

# <set normals (mesh.loops[ ? ].normal= ? )>

# create custom data to write normals correctly?
mesh.validate(clean_customdata=False)  # important to not remove loop normals here!
mesh.update()

clnors = array.array('f', [0.0] * (len(mesh.loops) * 3))
mesh.loops.foreach_get("normal", clnors)

mesh.polygons.foreach_set("use_smooth", [True] * len(mesh.polygons))

mesh.normals_split_custom_set(tuple(zip(*(iter(clnors),) * 3)))
mesh.use_auto_smooth = True
mesh.show_edge_sharp = True  # optionnal


How to exclude vertices from subdivison modifier?

Well, you can't exactly exclude the vertices rather you can tell the subdivision modifier to not affect some vertices. To do that follow the steps

Select the vertices you need to exclude
Press Shift + E
Drag your mouse up to set the crease to the value of 1


Smoke + fire simulation disappears after baking noise

You may need to check "Is Resumable" in the Cache section of the smoke domain physics properties.
For some background, I was having a similar issue. After doing some digging, I found this answer here: https://developer.blender.org/T80372
"This was a usability issue: Baking noise in the modular cache mode is only possible when also enabling the resumable option."
I wanted to make sure I knew what I was turning on by checking that option, so I will share this from the Blender manual as well: "Use Resumable Cache: Extra data will be saved so that you can resumed baking after pausing. Since more data will be written to drive it is recommended to avoid enabling this option when baking at high resolutions."


Using some kind of unit of measurement for scale?

In fact Blender could be switched to Metrics or Imperials using menu shown below...

...in my case, every single "rectangle" of the grey grid is one square metre. After switching to this You will be able to simply put the EXACT data in the "N" menu (right one) of your ViewPort where the Location or Size is (Location could be seen on the picture).

Hope it helps buddy, Jan.


Add a plane in Top Ortho view (numpad key 7 on Win), in Edit mode scale down Y axis, add some Bevel CTRL B (turn on Vertex only), select all and delete only faces.

Convert this mesh to Curve using ALT C and rotate 90 degrees on X axis in Object mode

Add another plane in Top Ortho view (now it will be an ocean). Create significant amount of loopcuts to get a better transition on curve's angles

Add Array and Curve modifiers to ocean plane. In Array settings select Fit to curve and don't forget to check First-Last and Merge options in Array to have nice loop.
Now you can animate X location to get loop moving

Additionally you can parent both Curve and Ocean plane to the same controlling Empty for easier manipulation in 3D space.


Understanding Proper Scaling for 3d Export dimensions

When you exported to .STL, did you check the box next to "Scene Unit"? (Find this on the lower left hand side when you attempt the export).

When a model is 3D printed, it has to be converted to GCode using some other software. Was this software configured correctly to handle inches?

My advice: save yourself the hassle and just work in millimeters and convert from inches.


Mirror viewmodel for Source engine, ends up horribly deformed?

It is really hard to keep with the expectations of the Source Engine while in Blender (I do Dota2 workshop stuff, I should know), so this is some stuff that you should check from my similar struggles:

Do the animations play right? Do they look right in blender?
What does the source model viewer show?
Is the scale, location, and rotation applied (correctly)?
Did you consider that Source is sensitive to bone labels?

Example:  If you simply mirrored the model and animations, Source will still attempt to align bone labeled "right" to the right hand side for IK purposes, and vice-versa for the left hand side.
If your model looks wrong in the Source Model Viewer, try creating a custom, unused animation.  If that imports correctly, your animations are mirrored incorrectly.

Are you able to export the model/animations and directly re-import them successfully without modifications?

Failure to do so suggests something wrong with your tooling or process.

Without more to go on, I can only provide these generic troubleshooting tips.


Enable "Lock camera to view". Then all navigation in the viewport will be done through the camera using the same commands as navigating on any other view in the viewport.

In 2.8+, you can access the checkbox in the right side panel in the 3D viewport with N :


Is it posible to hook the tilt of a curve's point?

A possible solution is using drivers to achieve this. It has a limitation though. Essentially, in Edit Mode I was adding a Driver to the Tilt value of the handle which receives a hook modifier currently:

Drivers allow you to control a property by another one, either with simple mathematical equations like in this example, or with complex formulas. The magenta background tells you that a driver has been added, but so far it's not doing anything. Now, go to the Graph Editor, and switch it from F-Curve to Drivers. Click the Drivers tab, and set the following values:

type: Sum Values (accidentally Maximum Values in my screenshot, apologies)
object: name of your empty which acts as the hook
type: X-Rotation
Space Transform Space

What this means is, when you rotate your empty around the X-axis, the Tilt value of the curve will be rotated by the same amount.

The limitation is the alignment of the handles. While it works perfectly fine in one case, it can behave strange in the other. The reason for this becomes more clear in this Top View:

While the X-Axis of my Start Empty is nicely aligned with the curve handle, the End one is off. If you align them neatly with your curve handles before using them as a hook, making sure the X-Axis always points along the handle, or if you set everything up with a totally straight curve, this should work just fine.
I did that in this Blend:

Edit
Something was going wrong when setting up the drivers in the last Blend, the Tilt values were screwed up. Might have been a little glitch of RC 2.78. Anyways, I re-created the setup in Blender 2.77a. Here is a corrected version:


You will need to manually select the edge loops around the boundary, still using the alt-click to select them in vertex select mode until they are all selected. Then you will need to change to face select mode, and delete the faces. Then you will need to select a face on the surface you want to delete  and press L to select all linked faces  and then delete them, leaving your original surface ready for editing.


If you need it to be totally exact you will need at least one addon (I suggest TinyCad, as it is one of the included addons) and it is a multiple step process.
First you need to construct an edge that has the appropriate angle.  This isn't too difficult - Starting from a right angled plane, select one corner vertex and place the 3d cursor at that vertex (most easily by using shift-S cursor to selected).

Change the transform pivot point to 3d cursor.  Extrude the other corner vertex (the top right one, in your examples) and cancel the modal move that happens after extrusion so that it returns to its original position.  Then rotate it and type the angle you want to rotate by - it will rotate around the cursor, creating the correct angle.  Remember that there's a 90 degree angle at the corresponding corner already, so you probably want to enter (162-90 = 72) as the numerical rotation.

Connect the extruded vertex and the unmoved vert at the cursor (hotkey 'F') - you will now have an edge that forms the proper angle.

The angle is now correct (here is an image showing that - but it is unnecessary to do this in practice, it's just to prove the angle is exact)

The edge is of course the wrong length and does not extend to the original top edge.  Select the new edge, and the original horizontal edge.

Perform an edge intersection calculation (context menu, then 'T', then 'V' if you're using TinyCad) and you should now have appropriate edges for the face you want.

Now select the vertices one at a time and use vertex slide (G, then G again by default) to slide the vertices onto each other to remove the additional unnecessary edge.  If you have auto-merge vertices turned on they will merge, or if not, you should merge by distance now to remove the excess verts and unify the face.

And you're done!  But you have a lot of these to do, and this took ages - so I recommend you take a duplicate of this finished one, make it bigger, and slice the appropriate angle out of a plane using a boolean difference.  You may have to thicken these template objects as the boolean engine does not like intersecting zero width objects.

This means you can now use the plane as a boolean cutter on each of your other objects in turn to far more quickly produce the correct angled cut, which is amusingly how I think it's typically done in woodworking as well - measure one, then use it as a template.


This is definetiley possible.

I can recommend to check out Curtis Holt's Video on Cloth Simulation in Blender 2.8 The effect you want to have is definetly doable.

https://www.youtube.com/watch?v=bAswwNpfe0U&t=0s&list=LL_vK2be21gQ3oN11drA3XBA&index=8

You would have to start by modelling your base structure and the plastic in the state of "not stretched out".


Some alternatives.
I am not sure what you ask is possible without some serious dicking around.
If these are bundled addons can simply enable and disable them as required in your code https://blender.stackexchange.com/a/58208/15543  In that you can enable an addon  when required  eg https://blender.stackexchange.com/a/189435/15543
Use a different Preferences if missing dependencies.

As it happens, am currently writing an addon prefs class to display any missing import dependencies.
Here is a "fudge-together" to show the warning message and suggest that the user investigate the addon on prefs.  The addon checks if the cell fracture addon is present and enabled, if present but not enabled puts a button in prefs to enable it.
Could add a big "Retry" button to check again.
bl_info = {
    "name": "Test Deps",
    "author": "Your Name Here",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "View3D > Add > Mesh > New Object",
    "description": "Adds a new Mesh Object",
    "warning": "",
    "doc_url": "",
    "category": "Add Mesh",
}

import bpy
import addon_utils
from bpy.types import AddonPreferences

deps = ["object_fracture_cell"]

class AddonDepsPrefs(AddonPreferences):
    bl_idname = __name__
    bl_label = "Missing Deps"
    def draw(self, context):
        layout = self.layout
        layout.label(text="Errors Registerning")
        fake_mods = addon_utils.addons_fake_modules
        for dep in deps:
            if dep in fake_mods:
                if not addon_utils.check(dep)[1]:
                    op = layout.operator("preferences.addon_enable")
                    op.module = dep

def register():

    fake_modules = addon_utils.fake_modules
    all_exist = all((dep in fake_modules) for dep in deps)
    all_enabled = all(addon_utils.check(dep)[1] for dep in deps)
    satisfied = all_exist and all_enabled
    if not satisfied:
        bpy.utils.register_class(AddonDepsPrefs)
        #unregister()
        def display_error(message):
            display_text = lambda self, context: self.layout.label(text = message)
            bpy.context.window_manager.popup_menu(display_text, title='Error', icon='ERROR')
        display_error("Expand Addon Prefs for Details")

def unregister():
    if AddonDepsPrefs.is_registered:
        bpy.utils.unregister_class(AddonDepsPrefs)

if __name__ == "__main__":
    register()


For a simple setup you can do something like this:


Background image is not displaying in rendered mode

In the Properties window on the Scene Tab under the Film section check the transparent box:

Otherwise your background will be the color set in the Properties->World->Surface settings.


How can I fix this distortion on this HDRi background?

HDRi's should just be plug and play, and your image seems to contain the very same spot on itself. Your settings also seem just fine, thus, it appears your image is not good.

To fix your problem, try using a true HDRi from a sight like https://hdrihaven.com/hdris/, and all should be dandy.


You can play videos (and images and render from other cameras) with the VideoTexture module.

You can test that with Dynamic Texture 1.0 - easy to use VideoTexture.

Edit: You can find the official documentation of the VideoTexture module (incl. example) in the BGE API.


Blender crashes when started from the command line

Well the solution for me was to unset my $PYTHONPATH, which was configured to create the output listed above by a line in my ~/.bash_profile file.

When started from the Terminal, Blender now still loads the bundled Python:

found bundled python: /Applications/Blender/blender.app/Contents/MacOS/../Resources/2.74/python

But Python is now able to load the modules it needs. I guess that having $PYTHONPATH set was preventing Blender's Python from being able to load required modules.


You might try this:

import bpy

obj = bpy.data.objects['Armature']

#get pose_bone
pb = obj.pose.bones['Bone']
#add drivers
driver_loc = pb.driver_add('location')
driver_rot = pb.driver_add('rotation_quaternion')

#search for a driver
for d in obj.animation_data.drivers:
    if d.data_path.startswith('pose.bones'):
        id = d.data_path.split('"')[1]
        prop = d.data_path.rsplit('.', 1)[1]
        if id == pb.name and prop == 'location':
            break
else:
   d = None

if d:
    #... settings
    d.driver.expression = your_expr


Why is my smoke only generated for the first frame?

Thank you to Eric Xue, answer was as commented: Type needed to be inflow, and not geometry!


How can I rotate object relative to it's local axis?

Applying the rotation will solve this issue.

Shortcut: CTRL + A

This will make the rotation to be equivalent to 0 degrees in each plane.
The selection will not be rotated, the current rotation will be considered to be the default rotation.


An empty

is_empty = obj.type == 'EMPTY'
#or
is_empty = obj.data is None

All objects have a field attribute, that is 'NONE' if there is no force field assigned to it.

is_effector = obj.field.type != 'NONE'


Calculating final Bone/PoseBone matrices

A straight-forward approach using convert_space() and a matrix to convert bone space:

import bpy

arma_ob = bpy.context.object
mesh_ob = bpy.data.objects['Suzanne']

pose_bone = bpy.context.active_pose_bone

bone_space = Matrix(((1,0,0,0),(0,0,1,0),(0,-1,0,0),(0,0,0,1)))
mat = arma_ob.convert_space(pose_bone, pose_bone.matrix, 'POSE', 'WORLD') * bone_space

mesh_ob.matrix_world = mat

Add a monkey and select a pose bone, then run the above script. Then Suzanne should look in pose bone direction. Note that bone direction is +Y, so it's (0,1,0) for a bone pointing upwards (Z).


Why does my environment texture show up in Eevee but not Cycles?

I found my own answer with endless setting-tweaking:  in the Render settings, the Film > Transparency checkbox was selected.  The tooltip says "World background is transparent, for compositing render over another background."

Serves me right for being a beginner.


Render with openGL from the command line?

It is possible, in a round-about way. Operator render.opengl() needs OpenGL display context, i.e. Blender's window, to be opened. Hence, we can't do UI-less rendering using -b command switch. We'll need to do it through a script:

import bpy
import sys                      # read argument from sys.argv
from bpy.app.handlers import persistent

@persistent
def do_render_opengl(dummy):
    bpy.ops.render.opengl(animation=True, view_context=False)
    bpy.ops.wm.quit_blender()

bpy.app.handlers.load_post.append(do_render_opengl)

It is to be executed like this:

blender -P render_opengl.py <file>.blend

Executing wm.quit_blender() is necessary, because otherwise Blender doesn't automatically close when render finishes. We also wrap the rendering code in load_post handler, to make sure the right context is loaded up before rendering. This is especially important if the scene's name is non-default. Otherwise Blender creates new scene Scene and renders it, instead of the scene we want.

The script above is to render preview animation. To render preview image and specify frame range, modify it to read argument from sys.argv (I've written code that does it before) and assigning appropriate values to bpy.context.scene.frame_*.


Blender has a variable you can check for that bpy.app.background

  Boolean, True when blender is running without a user interface (started with -b)


You could try uncommenting the is_on line and add something like

bpylamp.hide = not is_on
bpylamp.hide_render = not is_on

Another option could be

if is_on:
    bpylamp.energy = intensity
else:
    bpylamp.energy = 0

The X3D/VRML2 import script was written by Campbell and Bart so you might want to contact them and ask what they planned to do with the lights and whether they want some help. It's possible they left it like that because there is no on/off light switch in blender (maybe adding one is a TODO somewhere).


(Blender 2.9) Viewport Cycles render progress bar

Open the Viewport Overlays popover in the upper right of 3d viewport, to the left of the Viewport Shading Mode buttons, the downward arrow next to the two overlapping circles.
Check Statistics. If it doesn't appear, try going to a different display mode (Wireframe or Solid) then back to Rendered Mode.
You should then see render progress, as well as the number of objects, vertex, edges, faces and triangles in your seen in the upper left.


Mesh halves have different colors (normals recalculated and doubles removed)

if you'r referring to the different left/right shades your model shows above, imho @Duane Dibbley in a comment to your question has the cause and the solution. I'll try to show some details about how to "solve" this issue.

Your model in 3d view is lit by 3 opengl (invisible) lights, which - by default - are not "aligned" with your model, so they cast light and shadows on your model asymmetrically. This is why you get that impression in 3d view.

Your scene has a "real" lamp object, which will light the rendered view, but also is not "aligned" with your model: if you align it on X, and move a bit in front of your model, the rendered view will be perfectly lit in a uniform and symmetric way (even enabling the smooth shading):

To have the same lighting in the (opengl) 3d view, you have to make the (invisible) opengl lights "aligned" with your model, although it could be a bit difficult, but you can try, and you can also switch 2 of them off: open the user preferences panel, go to "system" tab, and try switching off two of them, and then try to make the remaining one "centered" (this is difficult because you can only operate on a small "disc" with the mouse cursor...). Here an example to give you the idea:


How to parent the end of a bone to the middle of another?

You can add a "stretch to" constraint to the bone:

Bone.002 has a constraint on the armature that makes it stretch to Bone.001.
The head/tail ratio is 0.5, so it is at the middle.
Original length is the length of Bone.002 when in rest position (edit mode length).
If you want Bone.002 point to without stretching, use a track to constraint instead (same principle):


Simple, use Project From View when Unwrapping.


What's the difference between turning up the resolution vs. using smoke high resolution in the Blender smoke simulator?

Turning up the base resolution increases the actual number of voxels used to calculate the sim. The high-res divisions  are a separate, secondary effect. They are applied after the sim itself calculates for that frame. High-res subdivides the voxel and adds additional noise based on the behavior of the low-resolution base plume. It's essentially a post-process displacement effect, just a more intelligent one than, say, globally mapped noise.

The advantage to this you can take a blocky, low-res sim that is fast to calculate, and smooth out or fluff it up as though it was higher-resolution. The strength value controls the shape, lower values smooth the plume, higher values fluff it up. This way, you only have to raise your base resolution enough to get the basic movement right, you don't have to keep cranking it to get the detail and smoothness you want. Since you apply that as a post-process when using the high-res function, which means faster bakes. And it's much easier to iterate the design of the base sim, because you don't need to sim at full resolution all the time.

It also helps out with an annoying behavior a lot of gas simulators have where increasing the base resolution can radically alter the behavior the plume. So you get a simulation at a lower, easily testable res, then you crank up base-res for the final bake....and 2 hours later, the result behaves nothing at all like your test bakes. High-res doesn't have this issue, because it doesn't affect the underlying motion, just smooths and adds detail.

If you want more information, you can read the paper that all these fluid-upres techniques are based on: https://www.cs.cornell.edu/~tedkim/wturb/wavelet_turbulence.pdf


How to make "Scorzo" perspective with Blender Camera?

The effect you are after is caused by the exaggerated foreshortening, or   relative size of the objects, caused an extreme wide angle lens. It's wide field of view will make the elements that are close to the lens look much larger than elements that are slightly farther away.

To recreate that in blender, use a lens with a very short focal length( A smaller value in the lens will result in a wider angle for the field of view).

Then set the camera low, close to the ground and in close proximity to the character, and tilt up the camera to include the whole character within the frame

Here's a link to an interesting article on wide angle lenses:

https://www.cambridgeincolour.com/tutorials/wide-angle-lenses.htm


Here is how I would do it.
I'll just show a workflow for doing it with constraints and blender operators.
I assume you will manage to code the same process in python?

I add an empty which is the point you want to track. I had a child cone for consistency with your image ;-).

I add another empty with a set of contraints :

And then I add a constraint to the plane's object :

It is over, the plane is like you want.
Now you can either leave it as is. You can move the first empty, and the plane will follow it.
Or, you can select your plane, and "Apply visual transform". And then you can delete everything you don't want anymore.

Now you can do these steps in python ! I guess it is slower than computing directly the good rotation with some trigonometry, but it has the avantage og being simple, plus you can still move your point at the end !


Why is mesh moving out of place while weight painting?

This is because your armature is not in its rest pose. As you add vertices to a bone, they will begin to be deformed by the bone you're adding them to. Since that bone is in a deformed position, the vertices have to move because they're beginning to be deformed by that bone (as you add weight to them).

To solve this problem, you want to set the rest position of your armature so that as you add weight to a vertex, it's not being deformed by the bone you're adding it to (because the bone hasn't yet moved from its default position).

The best way to do this is in edit mode for the armature. While in edit mode (the bones should be orange, not blue), you need to move all the bones in the positions they are in the picture you posted. Then, in pose mode (the bones should be blue), you need to clear all transforms. This makes it so that there's no deformation to be applied as you add vertices to a bone. The vertices will still be deformed when the bone does move... it just hasn't moved yet.


Trouble selecting and extruding specific polygons (python)

seems vert and edge selection was being extruded too, so they needed to be cleared with bpy.ops.mesh.select_all(action='DESELECT'), and mode_set flips to update mesh's selection, and then extrusion result:

def Extrude(box,S,c1,c2):
    epsilon = 1e-04
    mesh = box.data
    polygons = mesh.polygons
    for c in [c1,c2]:
        for i in [0,1,2]:
            sa=[]
            pci=None
            bpy.ops.object.mode_set(mode = 'EDIT')
            bpy.ops.mesh.select_mode( type  = 'FACE'   )
            bpy.ops.mesh.select_all(action='DESELECT')
            bpy.ops.object.mode_set(mode = 'OBJECT')
            for p in polygons:
                pci_=p.center[i]
                s = abs(pci_-c[i]) < epsilon
                if s: pci=pci_
                p.select = s
                sa.append(s)
            si = -1. if c[i]<0. else 1. if c[i]>0. else 0.
            d = [0,0,0]
            d[i] = ( (S/2-abs(c[i])) - abs(pci) ) * si
            bpy.ops.object.mode_set(mode = 'EDIT')
            bpy.ops.mesh.extrude_region_move(TRANSFORM_OT_translate={"value": d})
    #bpy.ops.object.mode_set(mode = 'OBJECT')
Extrude(box,S,c1,c2)```


Particles timestep not working in render (works in viewport)

To anyone else who might find themselves into the same situation, the solution is to turn of the khaos plugin before rendering..


I darkened the world color found the sun lamp strength slider hidden behind the "use nodes" option. Both of these combined made for a much better render! Thanks!


Try 2.80 version (or 2.79 daily build) there is no this behavior:

And by the way, try this setting in color ramp, in my opinion, it produce more cooler ink-drop look.

Maybe this is a bug, and it was fixed in new version...

in 2.79b adding a little bit tint of color also helps:


It turns out the answer is quite simple. All I needed to do is just go to the modifiers tab, scroll down to the 'Explode' section (I used a 'Quick Explode' animation, don't even ask me why it caused such a problem) and uncheck 'Cut Edges'. Thanks for the support and ideas, though, as this wouldn't be here for people who would need it in the future without all of your support.

Source:


Blender 2.79 How to Pin Down a Bone to a certain location?

Your best shot is using IK.

Give IK to the bone you'd like to stay fixed (make the chain as long as you
need).
Create a new bone close to the fixed one to become your
"ground". This new bone MUST be a child of some bone higher in rank than the leg. If you have to, create a new "master" bone to be the parent of all bones.
Go back to the fixed bone's IK assign the new "ground" bone as the
target.

When you move the parent of the leg bones, the feet stay stuck to the ground.

Only when the feet need to move should you keyframe the "ground bones".


How do I create this shape at the top of a violin (the scroll?)

You could begin with a Curve > Curve Spiral > Archemedian (with the addon Add Curve: Extra Objects). Reduce its Radius Growth:

Covert to mesh, extrude down:

Fill the faces along the spiral:

Flatten the top on the Z axis:

Continue to model:

Then at one point select all and Mesh > Symmetrize on the Z axis:


Is there any possible way to prevent the mirror to reflect some custom objects?

Can use this setting (Cycles only):

We want to keep what is diffuse and not singular (or glossy).


Enable clipping in the mirror modifier and then try again. If you now move your vertices to the left they should stop when they touch the other mirrored vertices.


Why does Blender think the bottom of my object is the Front?

In Edit mode, "Align View to Active" will align your view to the active selection's LOCAL axes.

https://docs.blender.org/manual/en/latest/editors/3dview/navigate/align.html


Mesh Array Modifier with Fit Curve modifier strings objects through center, not origin

OK, I was just being stupid...I'm answering the question in case someone else looks at this issue.

I had set the origin of the bezier to the endpoint of one of the handles...I thought it was on the actual endpoint of the curve.

As a result, even though the origins were lined up and scaled & rotated the same, the modifier was placing the objects with an offset.  It LOOKED like it was going right through the center of the mass of the created objects, but this was just a coincidence.

So...if you have this problem, check your origins again!  Make sure the endpoint of the spline is placed exactly where you want it and its origin is on the endpoint, not the handle.

thanks for the replies.


Can I use template_preview in operator dialog?

I asked re context.material and where you are running this from as the following works for me.

Well to some extent, in that the popup height is not taken up entirely by the preview at times.

Dragging the resize widget ("=" above the Ok) will crash if the check method returns True (enables popup redraw) & throws the error "context object has no attribute "material"" ... or crash blender.

Hence I went for context.object.active_material. (or somehow other than context.material)

If you find the height not right, can add the col.scale_y = 3 to give area to drag resize, then press again to see resize... trying to resize "live" in a popup appears very dodgy (speed wise) on my system.

import bpy
from bpy.types import Operator
class BigPreview(Operator):
    bl_idname = "myaddon.big_preview"
    bl_label = "Big Preview"

    def execute(self, context):
        print("Running big preview")
        return {'FINISHED'}

    def check(self, context):
        return False

    def invoke(self, context, event):
        wm = context.window_manager
        print("Invoke big preview")
        return wm.invoke_props_dialog(self, width=600, height=400)

    def draw(self, context):
        layout = self.layout
        mat = context.object.active_material
        col = layout.column()
        #col.scale_y = 2
        col.template_preview( mat, show_buttons=False, preview_id="corona.bigpreview")

def draw_button(self, context):
    self.layout.operator("myaddon.big_preview")

bpy.types.MATERIAL_PT_preview.append(draw_button)

bpy.utils.register_class(BigPreview)


Why is my model moving vertexes that aren't selected, when scaling

Check if proportional editing is on, press the shortcut key O will toggle the setting.

Click Here for more information on Proportional Editing.


Blender Python: Declare Property Group (on the stack?)

One simple way to accomplish this is to set up a PointerProperty on the scene to store these values:

def register():
    bpy.utils.register_class(MyClass)
    bpy.types.Scene.temp_props = PointerProperty(type=MyClass)

Now you can reference the properties in your draw_buttons call with bpy.context.scene.temp_props:

def draw_panel():

    if active_object:
        draw_buttons(active_object.MyProperties, disabled=False)
    else:
        temp_props = bpy.context.scene.temp_props
        draw_buttons(temp_props, disabled=True)

You can also store the PointerProperty to many other ID structs from bpy.types (e.g. Object, World, ViewLayer, etc.).

(related: How do I register 'Scene' properties with Python in 2.8?)


When you use Blender Internal (as your case), the "Texture" viewport mode shows the texture currently opened during UV Unwrap operations, even with no material assigned to the cube. To show the same texture in rendering you must create a material for the mesh and assign the texture to it, as shown in picture.


Vertex jumping when moving objects with the mirror modifier

It happens to me time to time as well, but only when I forget to uncheck 'x mirror'in the Tool Panel within the Options Tab.

If that is checked and you only have half a mesh in the case with a mirror modifier, Blender will try to calculate the missing halves verts by pulling them over to the missing side.

Either way, just uncheck it and things will be back to normal. :)


Why are my UV islands splitting apart when I move them?

It looks like this is a coincidence of a few things. When trying this on my machine, I can replicate the behavior if I do the following things at the same time:

I am in UV Sync Selection Mode
I have select UV islands enabled
I try to move the UVs not by using g, but by click-dragging with the mouse instead

check the five icons on the bottom right of this screenshot:

the one on the very right is the UV islands selection mode, it is enabled. You only see this if the fifth icon from the right, the one that looks like an arrow over a cube, is disabled. This icon toggles the UV sync option. If it is off like now, you only see UVs for vertices which are selected in the 3D viewport. So make sure that in 3D View, all vertices are selected.

Now the crucial part:

The click-dragging actually updates your selection before the moving starts in the UV editor, and selects (in this case) only the one island under the mouse cursor. This behavior is sometimes called 'tweak mode'. If you select first, and then hit g to go to translation mode, the whole stuff translates, no matter if it is connected or not.


I'd start with your user preferences. FBX import/export is an add-on there.


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

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

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

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


Animated CopyLocation bone constraint delay problem

The workaround for this problem is to bake animation of IK bone then move all baked keys 1 frame back and disable "copy Location" Constraint. Then the animation is perfectly smooth but it's very unpractical so when I change a little detail in animation, I have to rebake...


Figured it out. It was due to the Pole Target. Removing it resolved the issue.


Boolean modifier cannot be executed error

Your mesh is open, and that is when the Boolean modifier will start to complain. You have to close the mesh. When you mentioned that parts of the mesh are showing through, it proves that your mesh is open. To fix this, you should redo the whole process, perhaps with a less complex font to make sure weird things do not happen to your mesh (that is if you are using another font apart from the default). Hope this helped!


How to force a redraw of a panel in the 3D_View

I suggest start here: How to create a custom UI?

Blender will take care of (re-)drawing the layout properly without doing anything if you add a dedicated StringProperty for your filepath to the Scene, Object or whatever makes sense in your case eg. bpy.types.Scene.my_path = StringProperty(name="My Path") and assign self.filepath attribute from the ImportHelper class to your path property:

Code example based on the famous Operator File Import template that comes with Blender:
import bpy
import os

# ImportHelper is a helper class, defines filename and
# invoke() function which calls the file selector.
from bpy_extras.io_utils import ImportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.types import Operator, Panel

class ImportSomeData(Operator, ImportHelper):
    """This appears in the tooltip of the operator and in the generated docs"""
    bl_idname = "import_test.some_data"  # important since its how bpy.ops.import_test.some_data is constructed
    bl_label = "Import XML Data"

    # ImportHelper mixin class uses this
    filename_ext = ".xml"

    filter_glob: StringProperty(
        default="*.xml",
        options={'HIDDEN'},
        maxlen=255,  # Max internal buffer length, longer would be clamped.
    )

    # List of operator properties, the attributes will be assigned
    # to the class instance from the operator settings before calling.
    use_setting: BoolProperty(
        name="Example Boolean",
        description="Example Tooltip",
        default=True,
    )

    def execute(self, context):
        folder, file = os.path.split(self.filepath)
        context.scene.my_path = self.filepath
        print (folder, file)
        return {'FINISHED'}

class OBJECT_PT_CustomPanel(Panel):
    bl_label = "My Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "Tools"
    bl_context = "objectmode"
    '''
    @classmethod
    def poll(self,context):
        return context.object is not None
    '''
    def draw(self, context):
        layout = self.layout
        scene = context.scene
        layout.prop(scene, "my_path", text="File")
        layout.operator(ImportSomeData.bl_idname)
        layout.separator()

def register():
    bpy.utils.register_class(ImportSomeData)
    bpy.utils.register_class(OBJECT_PT_CustomPanel)
    bpy.types.Scene.my_path = StringProperty(name="My Path")

def unregister():
    bpy.utils.unregister_class(OBJECT_PT_CustomPanel)
    bpy.utils.unregister_class(ImportSomeData)
    del bpy.types.Scene.my_path

if __name__ == "__main__":
    register()

    # test call
    #bpy.ops.import_test.some_data('INVOKE_DEFAULT')


Is there a way to save strokes while painting/sculpting?

What you would be trying to record really would be the effect of the movements (sculpting) rather than the actions themselves. Because, the actions themselves have context. The movements of a pen or mouse device make sense only when in "Edit" or "Sculpt" mode.

Now, theoretically, you could respond to a set of events from the user interface and keyframe the effects of those actions to be able to "record" and "play back". But the amount of information and frequency required to do this probably would make the whole thing unusable but for small scale projects. (And in any case, you would still be key-framing the changes applied to the object by the actions, rather than the actions themselves).

But, if we are talking about keyframing mesh modifications, then Blender does already have something that could be of help in this case. It is called "Shape Keys".

Shape keys store intermediate states of a model's mesh and also allow for interpolation between these intermediate states.

The workflow to achieve this "recording" might seem a bit awkward but would consist of mainly two steps: 1) Add a shape key 2) Apply the sculpting "brush stroke".

In the end, you will have a set of shape keys that show the progressive deformation of the mesh, potentially, brush stroke by brush stroke.

You can now key frame the transitions between shape keys to affect the dynamics of the deformations and create an animation that is as fast or as slow as you like.

This would look more like morphing, of course, rather than sculpting, except in the case where you could subdivide one stroke to many different stages.

One thing that could be done to improve the presentation of the effect would be to have the mesh rotating in front of a static camera and apply the transitions when the affected side of the mesh goes off the view. It would give the apperance of more details added with each revolution without the viewer actually seeing the deformations take place.