Blender python script sets correct camera, but defaults to chosen animation frames camera on render

@batFINGER got me on the right path. I was cycling through renders using different cameras to create different views of a product so hopefully this will be of use to somebody.
Firstly and importantly, you have to prepare the file manually. Click on the animation tab, go to the Dope sheet, delete all the markers you had previously and just add one marker on the first frame (0). Rename that marker "F_00".
Back to the scripting tab. In the code, create a list of the camera object names, assign a starting and ending frame number, in this case "0". Select the timeline marker and assign a camera to the marker using the code below. Rendering code followed and as @SergeL said in  batFINGER's comment above, the new camera just replaced the previous one and the scene rendered perfectly from all angles.
import bpy
import mathutils
import sys

# Store the current scene inside a variable, that way we can access it later on

scene = bpy.context.scene

# store collection strings

x = bpy.data.collections
y = bpy.data.scenes["CONFIGURATOR 800 x 600"].view_layers["ALL"]
z = bpy.context.view_layer

###############################################################
########## CYCLE THROUGH THE CAMERAS AND RENDER ###############
###############################################################

camviews = [
            "FMR ISO",
            "FMR PAN DOWN",
            "FMR FULL FRONT"
           ]

for camname in camviews:

    bpy.data.scenes["CONFIGURATOR 800 x 600"].frame_start = 0
    bpy.data.scenes["CONFIGURATOR 800 x 600"].frame_end = 0

    #################################################
    ##### I PUT MY SCENE RESET CODE HERE ############
    #################################################

    # change camera

    bpy.context.scene.timeline_markers["F_00"].select = True
    bpy.context.scene.timeline_markers["F_00"].camera = bpy.context.scene.objects[camname]

    ###############################################################
    ############ CODE TO SELECT WHAT OBJECTS TO RENDER ############
    ###############################################################

    # Make the plates visible and render

    sideplates = bpy.data.collections["RACK 1 - 1 RACK FRAME"].children

    for s in sideplates:
        s.hide_render=False
        n = s.name

        # render 800 x 600 and save camera name and part name to a folder on the pc

        bpy.context.scene.cycles.samples = 1
        scene.render.resolution_x = 800
        scene.render.resolution_y = 600
        scene.render.resolution_percentage = 100
        scene.render.use_border = False
        scene.render.image_settings.file_format = 'PNG'
        bpy.data.scenes["CONFIGURATOR 800 x 600"].render.filepath = '/BlenderPythonTest/Single Rack/Configurator/Rack Frame/%(2)s/800x600/%(1)s 800x600.png' % {"1" : n, "2" : camname}
        bpy.ops.render.render(write_still = 1)

        s.hide_render=True


For your ground you've chosen Collisions but Collisions is for Cloth or Soft Body, you need to choose Rigid Body, Type > Passive and Shape > Mesh.
Also, apply the ground scale and apply the chain modifiers (I'm not sure why it messes up the simulation though)


How to match camera perspective after modelling?

I am new to blender but I was deep in photography. My suggestion is to set camera lens in blender to match it with the one which was used to take the real photo(check photo exif data). Also choose the same camera sensor size (!)as it will infulence lens angle of view (either 35 full frame or crop).   Blind guess for 35 full frame as standard. Then I would try to position camera and angle in blender so it will match the photo. Hope that it will help you.  Of course there could be some manipulation done with photo in post production (like perspectice correction done in software not with tilt shift lens). I may only guess that the room is not big enough so the lens are rather wide angle, on the other hand there is no barell distortion so there was some perspective corretion done with software.
So you can export a table render as well and correct its perpective a bit. I know this is not a perfect solution but it may work in this case if you fail matching it. Photo exif data would be a nice start point for me.
Also, remember that the photo might be cropped, so photo border don't have to match if your goal is perspective


To elaborate on @Hikariztw 's answer

Using the code from https://blender.stackexchange.com/a/141207/15543 as an example.

Update to the property group def.

class MaterialSlot(PropertyGroup):
    def get_name(self):
        return self.get("name", "Foo")

    def set_name(self, value):
        oldname = self.get("name", "Foo")
        self["name"] = value
        print(oldname, value)

    material : PointerProperty(type=bpy.types.Material)
    name : StringProperty(
            default="Foo",
            get=get_name,
            set=set_name)

Note the example code uses the material name in list UI class. Change to show item in draw method to show collection item name instead.

layout.prop(item, "name", text= "", emboss=False, icon_value=layout.icon(ma))

Python console code, added a new scene material slot.  It is given the default name "Foo".  Updating the name to "Bar", in this case via console, same if done via UI, and the setter is called.  Which prints old name "Foo" and new name "Bar"

>>> s = C.scene.material_slots.add()
>>> s.name
'Foo'

>>> s.name = "Bar"
Foo Bar

and again from "Bar" to "Choo"

>>> s.name = "Choo"
Bar Choo

But here is the "rub" re the property default value.  The  PropertyGroup class  already has a name attribute.  When a new item is first added, it doesn't use the name property default of "Foo", but rather defaults to "".

>>> C.scene.material_slots.clear()
>>> s = C.scene.material_slots.add()
>>> s.name
'Foo'

>>> C.scene.material_slots.keys()
['']

ie collection has a material_slots[""] member rather than material_slots["Foo"]  However if we set it implicitly, it picks up as expected... which is usual practice I suppose.

>>> s.name = "Foo"
Foo Foo

>>> C.scene.material_slots.keys()
['Foo']

EDIT re comment

  so when I update the list element's name I need to find all objects
  with the original element name and then change it to the new name

For example above, to set all items with old name to new name, do this on a custom property level too. Add something like below to set_name method above.

if oldname != value:
    same = [s for s in self.id_data.material_slots
            if oldname == s.get("name", "Foo")]
    for s in same:
        s["name"] = value


Object is mirrored at incorrect location

The object that you have set as the Mirror Object ('Cylinder') on the object you want to mirror ('Cylinder.010') is not at the centre of your tank, therefore, neither is the mirroring.

If you still want to use a Mirror Object then choose a different object to use as your Mirror Object (one that has it's origin at the centre of the tank).

For example, here I change the Mirror Object to be 'Cube.004' and the mirroring is correct:


Efficient video workflow without multiple renders?

You can do most color correction with Strip modifiers. And if you don't need 3D effects for your text, you can use Text Strips in the VSE.

There are also addons to send strips to the compositor, but it should be better to avoid them if possible.

Finally you can import your video a second time and just delete the image part of it only keeping the audio strips to solve your last problem.

You should watch the YouTube videos from Mikeycal Meyers to get a better understanding of editing videos with the VSE.


How to apply image texture and material color together?

In this example the color of the cilinder is set to green, the applied devil texture has an influence below 1.0 (i.e. 0.793). The geometry normal slider controls the 3D bump effect of the texture.
In the bottom part of the influence tab you can choose the blend mode of the texture (i.e. I leaved it on the default value: "mix").


How do I save my rendered animation as a video/gif?

If a series of images has been rendered, you will find them in the folder where Blender saves its renders, which is C:\tmp by default (check the path under 'Output' in the Output Properties tab, shown below, to check what your current output folder is).
It could be you only rendered frame 120, as that's the current frame showing in your Render Result: maybe you hit 'Play' to check your animation, and started rendering using F12 (Render Image) once the animation got to frame 120.
If you go the Output Properties window in Blender, you'll find options, under 'Output', to save as file formats other than .PNG, such as .JPEG, .BMP, or video formats such as .AVI and .MPEG:

Be sure to set the 'Frame Start' and 'End' to the sequence of frames that contain your animation.
Use Ctrl+F12 to render an animation.
Just like you can convert the series of images it might have created into a video file, you can convert it to a .GIF file afterwards.


Super long "Loading render kernels" using macbook pro 2018 GPU rendering

I also use macbook pro 2018.

I recognized that we have two opencl GPU (Intel and Radeon)

If we check both and Start rendering, Blender is stop and CVMCompiler process will have crazy amount of memory.

If we turn off the intel (use only Radeon), It works well.

I think Blender supports only Radeon not Intel.

But Radeon gpu rendering is slower than just CPU rendering.

How to make cycle rendering faster

Thank you.


I think most of your blurring is coming from the denoising post-process.

firstly, make sure motion blur is not turned on.

To avoid blurriness from the denoising, you have to increase your sampling.

256 or 512 should do it,. but will take a lot longer to render.

Alternatively, try using Blender 2.8 and use the EEVEE renderer. It is so much faster - and your scene doesnt require any complex light paths, so it should work really well.

Good luck!


Compositor : export output node when we want ?

Yes, if it was just a still render image, you can save each passes as a single image:

Just select the render pass, then go to Image > Save Image as

But if you want to render an entire animation without having to "Use Nodes" or even if you want to save the still render image passes as a single image file, you can save the render as an OpenEXR Multilayer file, but consider that the image file size could increase a lot.


I assume what you meant for bake lighting was like a common bake procedure which being used in game. As far as I know, currently there is no option to bake lighting to textures in Eevee, the options just exists in Cycles.


I've managed to solve the issue over at the Unreal forum.

I did add a simple Armature and did not change the default name. That was the problem.

Change that name to anything but "Armature" and everything works fine.


Move selected mesh items to cursor in defined axis

I seem to have figured it out by cobbling together a bunch of solutions.

import bpy
from mathutils import Vector

ob = bpy.context.object
ob.update_from_editmode()
me = ob.data
verts_sel = [v.co for v in me.vertices if v.select]
pivot = sum(verts_sel, Vector()) / len(verts_sel)
c_location = bpy.context.scene.cursor.location
m_location = ob.matrix_world @ pivot

#get get the offset
l = c_location - m_location

#split the tuple
xdir = l[0]
ydir = l[1]
zdir = l[2]

#move the mesh in x to cursor
bpy.ops.transform.translate(value=(xdir, 0, 0), constraint_axis=(False, False, True), orient_matrix_type='GLOBAL')


You can use the Dope Sheet editor to shift or delete the keyframes for the grease pencil:


How to create individual Objects out of Object with applied Array Modifier?

Just click on the Apply button in the Array Modifier panel. If that gives you all the meshes as a single object, which it seems to, then go into edit mode, Select All, then press P to separate all loose parts into separate objects.


Go in Pose mode, click on the head bone, and find out its name.
Go to Edit mode (on the mesh) and select the eyelashes.
select the vertex group with the same name as the head bone in the properties tab, and click on assign.


How to create a translucent image-as-plane

You can add a Converter/math node between the alpha and the mix shader of the node tree.

Changing the values between 0 to 1, you can determine how the alpha affects the transparency. 0 will be fully transparent, 1 will be opaque.


how to selectively show indices as developer

This is not directly, what you asked for, but it may help anyway:
Only the indices of selected vertices are displayed. You may write an add-on, that selects only the vertices with certain indices to achieve what you want to.


For directories or file paths on any panel it's key using a StringProperty. In order to get a File Dialog instead of a Folder Dialog, set its subtype from DIR_PATH to FILE_PATH.

path = StringProperty(
        name = "",
        description="Choose a directory:",
        default="",
        maxlen=1024,
        subtype='DIR_PATH')

As of Blender 2.8x properties should be assigned using a single colon :

path : StringProperty(
        name = "",
        description="Choose a directory:",
        ...
        subtype='DIR_PATH')

Following example adds a Folder Dialog to the Tool Shelf and prints the path to the console.

Blender 2.8x Update

import bpy

from bpy.props import (StringProperty,
                       PointerProperty,
                       )

from bpy.types import (Panel,
                       Operator,
                       AddonPreferences,
                       PropertyGroup,
                       )

# ------------------------------------------------------------------------
#    Scene Properties
# ------------------------------------------------------------------------

class MyProperties(PropertyGroup):

    path : StringProperty(
        name="",
        description="Path to Directory",
        default="",
        maxlen=1024,
        subtype='DIR_PATH')

# ------------------------------------------------------------------------
#    Panel in Object Mode
# ------------------------------------------------------------------------

class OBJECT_PT_CustomPanel(Panel):
    bl_idname = "OBJECT_PT_my_panel"
    bl_label = "My Panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "Tools"
    bl_context = "objectmode"

    def draw(self, context):
        layout = self.layout
        scn = context.scene
        col = layout.column(align=True)
        col.prop(scn.my_tool, "path", text="")

        # print the path to the console
        print (scn.my_tool.path)

# ------------------------------------------------------------------------
#    Registration
# ------------------------------------------------------------------------

classes = (
    MyProperties,
    OBJECT_PT_CustomPanel
)

def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)

    bpy.types.Scene.my_tool = PointerProperty(type=MyProperties)

def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):
        unregister_class(cls)
    del bpy.types.Scene.my_tool

if __name__ == "__main__":
    register()

Blender 2.7x

import bpy

from bpy.props import (StringProperty,
                       PointerProperty,
                       )

from bpy.types import (Panel,
                       Operator,
                       AddonPreferences,
                       PropertyGroup,
                       )

# ------------------------------------------------------------------------
#    UI (settings Class, Panel in Object Mode)
# ------------------------------------------------------------------------

class MySettings(PropertyGroup):

    path = StringProperty(
        name="",
        description="Path to Directory",
        default="",
        maxlen=1024,
        subtype='DIR_PATH')

class OBJECT_PT_my_panel(Panel):
    bl_idname = "OBJECT_PT_my_panel"
    bl_label = "My Tool"
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_category = "Tools"
    bl_context = "objectmode"

    def draw(self, context):
        layout = self.layout
        scn = context.scene
        col = layout.column(align=True)
        col.prop(scn.my_tool, "path", text="")

        # print the path to the console
        print (scn.my_tool.path)

# ------------------------------------------------------------------------
#    Registration
# ------------------------------------------------------------------------

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.my_tool = PointerProperty(type=MySettings)

def unregister():
    bpy.utils.unregister_module(__name__)
    del bpy.types.Scene.my_tool

if __name__ == "__main__":
    register()

To collect all images in a folder use os.listdir() to return a list containing the files in the folder and make sure that the file type is correct. Simplest way is using a list comprehension:

import os

# path to the folder
path = '/home/user/Desktop/'

# collect all OpenExr files
exr_list = [f for f in os.listdir(path) if f.endswith('.exr')]

# iterate through the list
for i in exr_list:
    print(os.path.join(path,i))

For more details about Property Appearance as well as on how to create Custom Interfaces, have a look into: How to create a custom UI?


Use the view from other cameras in the scene as VideoTexture in Cycles

Can do it in compositor, using an UV pass to distort the images and some ID masks to mix the render layers from different scenes... you can lower the samples for the scenes that will be seen in monitors, and will have faster renders.

Here's a simple test I just did, never tried something like this before so there may be some mistakes and things to improve. I unwrapped the tv screens and assigned materials with different IDs to use as masks.

https://www.dropbox.com/s/nepv0ukolw9r0od/MONITORS.blend?dl=1

edit: had to use the unwrapping to correct aspect ratio of images a bit

and more info:

you use different scenes for each camera
in main scene you activate UV pass and Material Index pass

UV pass allow you to distort an image to match the geometry
ID material pass allows to isolate different monitor screens
but you need to unwrap the tv screens and use different materials for each

in compositor you have a render layer for each scene
use UV pass from main scene to distort the other render layers
and use ID materials to set the alpha for the other render layers
then mix the layers, could even use compositor blur or depth of field

but easier is to just look at the blend... I guess it can be done in other ways, ID masks for alpha is not that good; also multiview was meant to support multiple custom cameras at some point -I think- that would allow to have just one scene to feed the compositor

And a more conventional setup works too... you can use the File Output node in compositor to export the other scenes, and load those Image Sequences as textures in cycles, all you need to do is set offset to -1 in texture nodes... there's a 1 frame lag though, and the first frame won't have any textures -and I had a couple of crashes-

https://www.dropbox.com/s/j83imtyszl6xvik/MONITORS_SEC.blend?dl=1


Use Boolean Modifier (instead Bool Tool) with Exact solver, plus enable Self - intersection, because those "red" teeth are overlapping.

... or in edit mode select all and with pivot point set to Individual Origins scale all teeth a bit so they don't overlap.

... and enable under Data Properties > Normals > Auto Smooth if you want to fix shading around edges.
Also I would highly suggest to use Un-Subdivide operator in edit mode, your topology is too dense. You can use Iterations up to 4 for shark and 4-6 for teeth. Result is pretty much the same with much lighter file and faster calculation. To make it smooth add Subdivision Modifier only for Shark before Boolean.


Is there a way to increase visibility of the "Edge lines" in blender 2.8

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

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


Set the Edges Invisible [Feature-not-yet-supported]

You need to apply the Mirror modifier, with merge and clip enabled, then in Edit mode Alt + Right mouse button click on one of the edges to select loop, then  X and select Dissolve Edges from the pop up menu.


X Mirror only works when manipulating vertexes, edges and faces in position scale and rotation.

For any work such as extruding etc, it breaks out of the mirroring tool and will no longer be symetrically affected.

To continue working with a mirrored object, you will have to delete all of the vertexes on one side of the model and add a mirror modifier.

Select the view all vertexes without clipping button:

Select all the vertexes on either the left or right of an object, but avoid selecting the vertexes down the centre of the object, (you'll need these for flipping it)

Delete these vertexes and add a mirror modifier:

You'll now have an object that is perfectly mirrored. If it doesn't look right, make sure you've got the right axis selected in the mirror modifier.


I want a procedural texture on a PNG "Decal". How do I set up the nodes?

The Principled Shader is configured with 100% roughness for pure black diffuse with no specular. This will basically produce black regardless of the angle of the incoming light - the 100% roughness on the black surface will basically kill all bumps and textures and simply render as black.

To address this reduce the Roughness and add some Specular to provide some shine to the bumps.

In addition, the Noise fed directly into the Normal Map will be producing incorrect normals (the output of the noise is not a proper basis for a normal map - it will be in a random direction (so may point ‘inwards’) and it’s length will not be 1). Better to feed the Fac of the Noise into a Bump node instead, to generate the surface normal.


Nothing is unwraping in the UV window. As you can see below, i have everything selected and when i then select "unwrap" nothing happens


keep modal timer operator running at same time of other

Not sure what your issue was, so I added some edits to turn operator on / off using a window manager boolproperty update. Will also turn off if object is not in 'SCULPT' mode.

Moved the sculpt brush resize into the timer loop.

Unless you are going to set some operator properties in invoke there is no need for invoke and execute both adding handlers / timers.

import bpy
from bpy.props import BoolProperty, IntProperty

class WM_OT_pressure_simulate(bpy.types.Operator):

    bl_description = "simulate pressure"
    bl_idname = "wm.pressure_simulate"
    bl_label = "pressure"
    numerator : IntProperty(default=156)
    def modal (self, context, event):

        scene = context.scene
        obj = context.object
        wm = context.window_manager

        if not wm.modal_pressure or obj.mode != 'SCULPT':
            return self.cancel(context)

        if event.type == 'TIMER':
            ps = scene.tool_settings.unified_paint_settings
            ps.size = event.mouse_x / self.numerator
            #print(event.mouse_x / 156)

        return {"PASS_THROUGH"}

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

    def cancel (self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)
        wm.modal_pressure = False
        return {'CANCELLED'}

def toggle_pressure(self, context):
    print("Pressure Sim Mode ", self.modal_pressure)
    if self.modal_pressure:
        bpy.ops.wm.pressure_simulate()
        #bpy.ops.wm.pressure_simulate(numerator=20)

def add_button(self, context):
    layout = self.layout
    wm = context.window_manager
    if context.object.mode == 'SCULPT':
        layout.prop(wm, "modal_pressure", toggle=True)

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

    bpy.types.WindowManager.modal_pressure = BoolProperty(
                                        name="Pressure",
                                        description="Toggle Pressure",
                                        default=False,
                                        update=toggle_pressure)

    bpy.types.VIEW3D_HT_header.prepend(add_button)

if __name__ == "__main__":
    register()


.blend object appears black on Web4Web Fast Preview

You need a source of light. You can add a simple point light : Shift+A / Lamp / Point


crazy spikes when adding wireframe modifier

As said in the Blender Manual:

  Wireframe thickness is an approximation. While Even Thickness should
  yield good results in many cases, skinny faces can cause ugly spikes.
  In this case you can either reduce the extreme angles in the geometry
  or disable the Even Thickness option.

In this case you have to uncheck the "even thickness" option:


I've done something like this before...

What you do is in editing mode, subdivide a bone so that one of its ends is the same as another. The ends that don't have adjacent bones will be used to control the eyes.
Make sure you keep the eye-controlling bones as children to the parent bone, which is linked to what controls the body. You only need the controlling bones to have any weight painted to them.


Is it possible to begin/end parent relationship with animation or keyframe?

This is one of the main purposes of the "child of" constraint. It's a constraint the transforms an object as though it was parented to the specified target. Like all constraints, you can keyframe the influence:

By default it will move the object to the target's location as well. Clicking "set inverse" will add an offset so the constrained object will "start" from its existing location.

Note that you can also select which transform channels the "parent" applies to, which is also not possible with true parenting. You can also have several child of constraints on the same object with different targets, and just animate which is active at a particular time. This is useful for an object that needs to be handed off from one character to another, or picked up off a conveyor belt or something like that.


Rigging 2D elephant trunk corrupts the mesh

A tube with an armature as its spine which used Bind with automatic weights.  Image above.

Back up your current work with file save
Create a new quick cylinder with loopcuts say 20. Scale to your tastes and elephant trunk shape.  Keep the cylinder in straight line.
Create a new armature with 20 bones. Keep the original straight shape.
The more loop cuts in the cylinder mesh, with more bones in the armature, will allow a smoother movement.
Move the armature to be located in the cylinder. Make sure trunk is reasonable tight fit to armature. A tube with no fancy shape is fine because the tube can be changed later after binding to armature.  The learning experience will be better.
The above steps will take 8 minutes with practice
Ensure the placement by examining from different angles
Bind Trunk to Armature with automatic weights
You may choose reserve frame 1 for the straight armature shape and insert keyframes for all bones.
Move to some other frame say frame 8
Test the binding by rotating bones of the armature in pose mode. Insert keyframes.
You can create a shape key for the cylinder mesh if you like
You can shape the trunk with more lifelike shape
These above steps are an improvement. If you wind the bones in too tight of a spiral you might not like the results. Bad results such as this can be true of any simple model for Blender Beginners.
Delete all previous work when satisfied.  Your previous work has some new user problems which can be discarded.  A fresh start can be good.
Be aware of the Spline IK constraint which allows a smooth curve to control the armature and may save time once its mastered


How to generate a 3D binary matrix after applying a remesh modifier

Alright, if I understood your question correctly, you want a lot of ones and     zeros from a 3D mesh. Here's a script:

import bpy

object = bpy.data.objects['Suzanne']
radius = 2.0
resolution = 20
file = open("C:\\tmp\\out.txt", 'w')

import mathutils
from mathutils import Vector
def pointInsideMesh(point,ob):
 axes = [ mathutils.Vector((1,0,0)) ]
 outside = False
 for axis in axes:
    mat = ob.matrix_world
    mat.invert()
    orig = mat*point
    count = 0
    while True:
        location,normal,index = ob.ray_cast(orig,orig+axis*10000.0)
        if index == -1: break
        count += 1
        orig = location + axis*0.00001
    if count%2 == 0:
    outside = True
    break
return not outside

bla = radius/resolution

out = ""

for z in range(-resolution, resolution):
    for y in range(-resolution, resolution):
        for x in range(-resolution, resolution):
            loc = Vector((x*bla, y*bla, z*bla))
            print(loc)
            if(pointInsideMesh(loc, object) == True):
                out += '1'
            else:
                out += '0'
        out += '\n'
    out += '\n'
file.write(out)
file.close()

Again, I'm not fully sure this will answer your question, but I had fun making this script.


You can use vertex snapping.

Enable Vertex Snapping > Active
Select both vertices of the edge, the last selected will be active
Move it left and hover your cursor over the target vertex


Those icons show the different textures that have been created for your materials. In this example all of them are empty, meaning that no textures have been created yet.

There is no way or need to delete them.

Once you add some textures, the window will show a list of all the available textures.

To know which ones are enabled for a particular material check the boxes on the right.


Animation Nodes : How to add/replace "Get list element" output into a new collection?

You need to use a loop.

What you are doing is calling the same method x number of times, x being the number of frames. But in your method, although you do instantiate 4 objects you are only affecting your geometry to one of them. As far as I know the objects created in the object instancer node are put in a pool to be reused when needed, they are not destroyed and recreated every time. That would make sense in order to increase performance.

To the point.

Create a "Loop" with Add > Subprograms > Loop
Add a "Parameter" of type "Object List"
Create an invoke node on this loop with Add > Subprograms > "My Loop" (you can rename it)
Set the iterations to 4
Add a "Collection info" node, set it to your wall blueprints collections and plug the "objects" into your loop invoke input "Object List" input (you can rename it).
Use a "Get Random List Element" Node and set it to "Single", plug the frame info added to the index into the seed, that way every wall will be randomised, and every frame the setup will change. Add a big number to the frame so that the two seeds are independant.
Add an object instancer and set it to mesh, instances to 4.
Add a new parameter of type "Object List", rename it "Mesh objects". Plug the instancer into the input of the invoke node.
In the loop, Plug the wall blueprints into the "Get Random List Element" node.
Add a "Get List Element" node and plug the mesh objects into it, and the index of the loop into its index.
Add a "Mesh Object Output" node, plug both "Element" outputs into it (the random one into the mesh input). Ths swill automatically create a "Mesh object output" node, you can check "Use modifiers" if your walls have some. Click the button on the right of the "Mesh" line
Now to translate the meshes to the origin : Get the opposite of the blueprint position, and translate the mesh using a compose matrix.
Finally plug the index into a math node to multiply by 90, into a combine euler set to degrees and into an "Object Transforms Output" set to rotate around Z.

The final node tree:

Bonus :

If you want to get ALL possible combinations. We have to use a little script and mathematics.

Go to the scripting workspace, add a script, name it as you wish. Write this :

import bpy
import itertools
combinations = [range(len(blueprints.objects))]*4
linear_combinations = []
for combination in itertools.product(*combinations):
    linear_combinations.extend(combination)

The result will be a very long list of integers, corresponding to each different possible combination. For 4 wall and 4 differents walls, I got 4*4*4*4*4 = 1024 different combinations. The integer being the index of the child object in the collection. for example the first few are :

We need to rework slightly our node tree.
I won't go into detail in the loop so you can just follow the screenshot :

Add a "Script" node. Select your newly created script and set the input and output names exactly like in the code else it won't work. Place an invoke node to your script, and plug it like so :

Result :

Beware, it kind of crashed when I tried to add another wall blueprint element.


Looking at the gif, at least two other bones are moving when you move that shin bone. The most likely explanation for your issue is that you have parts of the other leg weighted to one of these bones.

Edit:
Another thing you could try is to set the armature modifier to deform the edit mode mesh, pose it so you get the deformed mesh and enter edit mode.
From there, select one or the deformed verts and open the right hand panel in the 3d view ('N' panel). One of the sections there lists all the vertex groups and their weights that apply to that vertex. This should help you track down where the problematic weighting is coming from.


What is it?

This is based on this paper.

  Modeling multiple scattering in microfacet theory is considered an
  important open problem because a non-negligible portion of the energy
  leaving rough surfaces is due to paths that bounce multiple times.

This effect can be clearly seen in high roughness glass, where a lot of light rays were killed because they happened to reflect on the glass itself rather than reflecting or refracting away, which you can see it the images provided by them:

Their model enable the sample (light) to bounce multiple times before being killed, Which result a more relastic and lighter result. It is also worth mentioning that this model enable more efficient energy conservation because the light will bounce till it loose all its energy.

This can be seen here, where the alpha represent the roughness of the diffuse and the glass shader:

However it doesn't really matter when the shader has low roughness since it is nearly imposible for the light to bounce on itself again, this can be seen in this shader with varity in roughness, you can see that the rough parts have a greater impact while smooth ones have almost no impact.

As for the speed of the rendering, using the multiscatter model will result only 2.5% slowdown which is pretty acceptable if you asked me.

When to use it?

Well it is pretty obvious that you should use it when you have shaders that have high roughness to avoid the dark areas. notice that the amount of darknening is directly proportional to the roughness of the shader, so if you have a semi low roughness you don't have to use multiscatter.


How to cut a hole in a mesh like this without using boolean

If you want big holes it can be something like that (needs one more edge though). Delete the face, create 8 vertex circle, duplicate 2 times, fill the gaps with some F:


Exporting procedurally textured models for game engine

Blender's node system cannot be exported since the 3D formats aren't able to store them and the game engines do not have nodes that are equivalent to the ones found in Blender.

What you need to do is bake your textures. Generally for game models you start with a high poly, detailed model from which you create the low poly version that can be used by the game engine (or several for different level of details - LODs). Part of the process is baking the normal map and PBR textures in order to get as close as possible to the look of the high poly model while keeping the polycount low. This is to ensure good performance of the game and keeping vertex budget for hero props (a building in the distant background doesn't need as many polygons as the model of your main character).


You can use multiple UV maps. Add new UV map:
then select your new UV map and go to UV editing layout. Unwrap your mesh and then scale all faces except those you want to have more textures down to zero and place them on the side of the UV map: in this case they are those points on the sides, I gave them a little offset, so that the would be more visible. You need to make those parts, you don't want to have any further texture on some place, where the second texture is transparent. In this picture the only the not black parts are visible, so could I put them anywhere near the edge (I then used the same texture for mix shader factor with black parts for the first texture and white parts for the second texture. That's why I have there the hue/saturation and the brightness/contrast nodes. This is what my second texture looks like (maybe it's bit different, I didn't save the .blend file and I have quite a few of these pictures):) When making the material, in the texture vector input plug UV coordinate your first UV map for the general texture and for each other you have to have another UV map node (please see the picture with the node tree, that should make it a bit clearer). Add new shader for each detail you want to add and mix them using mix shader and a black and white texture for factor (I generated mine right in the node tree from the texture I use for detail, just by decreasing saturation down to zero and enhancing the contrast - white parts will have the second texture added).   the white spot is, where the detail is (tho bottom texture is just basic wave texture and the second one is picture of a solar eclipse (above), it was first I found that could be used)
I hope this is clear enough, if not, ask in the comment.
And I almost forgot to say I am using cycles.

node tree : diffuse shader with texture as color; mixed with another diffuse shader with texture as color using the secnod texture as factor for the mix node (I'm not sure what would happen if you used colored texture, I use black and white (hue/saturation node + brightness/contrast node to decolor it). black and white defines here, where the first texture is visible and where the second (grey wold mix them together)
this is what you should see, when you open node editor with a basic textured mterial:

use wheel to zoom in, shift a to add node and use mouse to connect those together.


How can I rig an extension arm using only constraints?

It is possible (by parenting anyway).

Have a look for now, I will write up the text soon.

Your Modified Blend File:


Is there a way to create a Color ID map in Blender?

It's possible to export the ID color map straight from UV/Image editor without baking it by using this addon. It's fast and writes the UV layout into a png file, filling the polys with the color assigned in the viewport color slot:

Set the viewport colors for all materials:

Go to UV/Image Editor > UVs > Export Colour Layout:

Result:

Original thread (www.polycount.com):

  Blender Export Colour Layout Addon -
  This is an addon for Blender that enables the exporting to png the unmodified diffuse colors of applied materials using the meshes uv map as a layout. In essence it generates a colour ID map for use in applications such as Quixel Suite DDO. As it does not use baking it is easier and quicker to generate colour ID map, it also (appears) to work the same regardless of whether you are using Blender Renderer or Blender Cycles. It is heavily based on the original UV Layout addon and is still a work in progress, but it exports the colour map just fine. In the future I'd love to work out a method of assigning DDO colour link id's to Blender materials and export those, instead of having to set the materials diffuse colour. The download has a brief read me with more details in it. If you have any problems with the addon feel free to post them in this thread and I'll see if there is anything I can do to help. I'm unsure if not going the baked approached means that something important is missing. As far as I can tell uv islands are not anti-aliased, but materials that share the same edges are and that appears to work fine within DDO.


How to make a through hole using inward extrusion in Blender 2.8?

You can use the faces of a mesh to dig a hole in the same mesh, using the ctrlF > Intersect (Boolean) tool. Just push the face a bit further down. Then in the Operator box choose Difference and Solver > Fast.

Or use a second mesh:


Use the ColorRamp node which maps greyscale values to colored values.


Is it possible to create an array with angle changed like this?

I couldn't figure out a way to do it with the array modifier but,
you can start with one, them ShiftD and move it over a bit.
Then hold ShiftR to repeat the last step a couple times.
Then turn on proportional editing and rotate the last one.
Scroll the mouse wheel to increase the effected range and you can change the falloff type of the proportional editing.


How can I add/subtract/multiply/divide properties in the Game Engine?

Adding, Subtracting, Multiplying, or Dividing properties can be done very easily - you simply need a third property, which you can assign the result to.

You can use logic like this to perform mathematical operations on any type of object. If you want to display the result as a text object, the easiest way is like this:

In this case, the result is stored as a "Text Game Property" - This is a special type of property for text objects, which will display the value as text in game.


What methods are there to level your particle hair?

Mainly, you have a non default parameter here : the brownian (agitation) field set to a value. Set it back to 0 to have a regular aspect.

After that, as you want to have a short hair (like brush), you may lower the segments (as their are used for the hair movement, mainly for long hair).

And to have more density, simply grow the amount of emitted particles.

As some faces are not visible, you should also use a vertex group to locate the hair where you want on the visible faces : in consequence, the visible faces will have more hair on them with the same or lower overall hair amount.


z coordinate of empty object won't export when exporting the object to directx

You may simply need to apply your transformations.  You can look at your viewport shelf by hitting your N key to see if this needs to be done. See below for images regarding both.

To check and see if you need to apply any transformations, you can select the object in blender and then hit the N key to open/close the shelf.  It should look like this across the board:

If any of the numbers in these fields are different from the numbers in the image above, transformations have not been applied.

You can apply all of your transformations (Scale changes, rotation changes, etc) by having the object selected in Blender and hitting CTRL+A to open the Apply menu and clicking "All Transformations".

Alternatively, if it is simply a translation problem between Blender and DirectX, this may fix the problem.  During your export process

If these simple solutions aren't the answer for you, it may be something you need to adjust for when you export, but the options you have in the export process differ depending on the file type and I'm not familiar with the .X format or what sort of options you have for it specifically.


How can a normal map be masked through a stenci?

I had to use the node system to use my normal maps in HD, instead of stenci I set up a series of color mix nodes. I needed to substract a geometry normal node via a vector math...don't ask me why.


How to use Texture Coordinates, Mapping and Gradient Texture nodes to generate a black and white mask?

If I understand correctly, you could use Gradient Texture for that.

Add Gradient Texture set to Linear (default)
Use ColorRamp to control it.
Done


How to make a material not reflect light?

Try using a Toon Shader instead of Glossy one. It's not the proper, accurate way of doing this IMO, but the final result is close to what you're looking for I guess.

Use a Lamp instead of emission plane.

Set the Toon Shader to Glossy and decrease the Size to 0.001 and Smooth to 0.000.


Attempting to stretch texture towards edges

Set up the nodes as pictured below. In Texture Coordinate node choose the Normal output. Select the Normal option in a Mapping node and experiment with its Scale settings.

Change the Z Scale to increase the stretch of a noise.

I used this technique to procedurally create the iris. Hope this is the effect you're looking for.

UPDATE: After playing with the nodes I found out a new solution, though I am not sure it's the proper way of doing it.


Riggin - BlenRig - Is it possible to swap out similar characters?

It is possible. Copy your rig and move the new one into the new mesh. Select the mesh first then the armature and hit CTRL+P and select "Armature Deform". After this deselect the armature, select the original mesh and copy the vertex groups from it.


Handler-script updates in viewport but not in render

Don't use operators in handlers

For the most part don't use operators in handlers. When rendering for example, the context needed will not be there.  I imagine edit mode toggle means nada to the renderer.
Use API methods and the passed argument scene
In example below, displays a line of bpy.data.texts["Text"] as the body of text object scene.objects["Text"]
import bpy

# pass arguments to build a handler
def text_body_handler(obname, textname):
    # the handler method
    def text_body(scene):
        text = bpy.data.texts.get(textname)
        text_ob = scene.objects.get(obname)
        if not text and text_ob:
            print("Error: check names")
            return
        f = scene.frame_current
        lines = len(text.lines)
        if text_ob and f <= lines:
            text_ob.data.body = text.lines[f-1].body

    return text_body

bpy.app.handlers.frame_change_post.clear()
bpy.app.handlers.frame_change_post.append(text_body_handler("Text", "Text"))

Textblock bpy.data.texts["Text"]
I had written him a letter
which I had,
for want of better Knowledge,
sent to where I met him
down the Lachlan, years ago,
He was shearing when I knew him,
so I sent the letter to him,
Just ‘on spec’, addressed as follows,
‘Clancy, of The Overflow’.


Script behaves differently when executed inside blender console vs python interpreter

running blender -b -P script.py will start blender in background mode, notice the -b option.
For that reason all Viewer nodes will be deactivated and set to default size 256*256.

Try removing the -b option.


How to activate an action with a button using python?

With this code you can trigger an action (adding a plane into Scene) with a Button in 'UI Panel' using Python.

import bpy
from random import randint

class UIPanel(bpy.types.Panel):
    bl_label = "This is UI panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

    def draw(self, context):
        self.layout.operator("object.plane", text='click to add', icon="BLENDER")

class OBJECT_OT_AddButton(bpy.types.Operator):
    bl_idname = "object.plane"
    bl_label = "Add a plane to the scene"

    def execute(self, context):
        print ("This is a test print statement")
        x = randint(0,10)
        y = randint(0,10)
        bpy.ops.mesh.primitive_plane_add(location=(x,y,0))
        return {'FINISHED'}

bpy.utils.register_module(__name__)


Ubuntu launch blender instances with a different configuration

This should work: You can change the Exec line in the .desktop file like this:
Exec=env YOUR_VAR1=value1 YOUR_VAR2=value2 /opt/blender-2.90/blender %f

(Duplicated my answer from blender.community :) )


Use a Fluid (Liquid Domain) with

a relatively small Inflow Sphere (location: tip of tonge),
high Viscosity Strength (docs) (try Strength=5),
small Liquid FLIP Particle Radius
and can slow down the Time Scale (try=0.5 or less)

"When it rains I always think of you: drip":
Note that I only simulate up to frame 50, and the lighting makes the single drip column look like there's a break when there isn't.


How to select and separate same vertices as current selection on copied, very similar geometry

Perfect candidate for bmesh

Script to run in edit or object mode with "basis" mesh selected.

For each mesh object having same amount of vertices add a split by selection object.  Selection: Default 'SELECT' uses selected vertices in basis. 'LOC' tags all verts within a tolerance of basis.

Set this up as a class such that it can be instanced with the basis object, and called with another.

import bpy
import bmesh

class diff:
    def split(self, scene, ob, select='SELECT'):
        me = ob.data
        bm = bmesh.new()
        bm.from_mesh(me)
        if select == 'SELECT':
            select = self.tag_select(bm)
        elif select == 'LOCATION':
            select = self.tag_same_loc(bm)
        else:
            print("Error.. not in SELECT, LOCATION")
            select = False

        if select:
            obcopy = ob.copy()
            me = me.copy()
            # remove selected from one
            bmesh.ops.delete(bm, geom=[v for v in bm.verts if not v.tag], context=1)
            bm.to_mesh(me)
            obcopy.data = me
            scene.objects.link(obcopy)

    def tag_select(self, bm):
        for v0, v in zip(self.bm.verts, bm.verts):
            v.tag = v0.select
        return any(v.tag for v in bm.verts)

    def tag_same_loc(self, bm, TOL=1.0e-3):
        for v0, v in zip(self.bm.verts, bm.verts):
            v.tag = (v.co - v0.co).length < TOL
        return any(v.tag for v in bm.verts)

    def __init__(self, scene, ob):
        me = ob.data
        if ob.mode == 'EDIT':
            bm = bmesh.from_edit_mesh(me)
        else:
            bm = bmesh.new()
            bm.from_mesh(me)
        self.bm = bm

if __name__ == "__main__":
    context = bpy.context
    scene = context.scene
    ob = context.object
    d = diff(scene, ob)
    shapes = [o for o in scene.objects
                if o.type == 'MESH'
                and len(o.data.vertices) == len(o.data.vertices)]
    shapes.remove(ob)

    for s in shapes:
        d.split(scene, s)


Unable to select vertices after entering anything besides object mode and edit mode

It appears that something was settin the vertices to auto hide. In another comment, I saw to go into one of the other modes, and then hit Alt+H, and that resolved my issue.


If I select the shoulder bone (the one that affects the mesh and that is on the first armature layer, not the one on the third armature layer), you can see that it influences the neck area (and also the head) when it should not.
Other bones affect the head as well. You need to correct this, for example with the weight paint brush in Subtract mode.
Also maybe simplify your mesh, it will make things easier, unless you have some good reason not to use a Subdivision Surface modifier. And why not simplify the armature as well?


Can blend files be queued for animation rendering?

Sounds like a job for Command Line Rendering. Sounds intimidating if you've never done it, but it's a simple matter of stealing someone's template and adjusting the parameters:

Windows: blender -b "C:\path\to\file.blend" -x 1 -a

Linux/Mac: blender -b "/path/to/file.blend" -x 1 -a

That's the simplest form of it which will use all the settings in the blend itself.
To make a cue of it, simply put '&&' between the commands:

blender -b "C:\path\to\file.blend" -x 1 -a && blender -b "C:\some\other\project.blend" -x 1 -a && blender -b "C:\yes\another\one.blend" -x 1 -a

To adjust settings like start and end frames, path of the outputed images/video, whether to render the animation or a single frame, check out the wiki page on Command Line Rendering.

It's also useful to tell it to shutdown your computer when it's finished simply by adding this at the end:

Windows: && shutdown /s /t 0

Linux/Mac: && sudo shutdown -h now

And here's one with start/end frame set, output path and format and shutdown when done:

blender -b "C:\En Passant\08-08\shots\s1\awake\awake.blend" -x 1 -o "C:\En Passant\bear_render\awake\img_#" -F PNG -s 119 -e 150 -a && shutdown /s /t 0

Note that if it doesn't recognize the 'blender' command, you just need to cd into the directory of the blender executable before it'll understand you. E.g:

Windows: cd "C:\Program Files\Blender Foundation\Blender"

Linux/Mac: cd "/home/user/Downloads/Blender"


Make sure you are in Blender keyboard preset, not in Maya or 3DS Max keyboard shortcuts, then you will be able to do that by pressing Ctrl+J.


How in the script to apply an image on the image texture node

The solution was quite simple, though not found answer on the Internet.

import bpy
bpy.data.images.load("D:/badge/temp/1.png", check_existing=True)
mat = bpy.context.view_layer.objects.active.active_material
tex = bpy.data.images.get('1.png')
image_node = mat.node_tree.nodes["Image Texture"]
image_node.image = tex

At the same time, the desired node must be selected previously in the material so that everything works out.


duplicating an object and keyframing without affecting the original object

No worries I managed to find a solution with trial and error. within relations, picking object and animation. This singles the object and allows you to animate the duplicate object with out affecting the original object. Sorry all ^^


To deal with curves like that you need to use the Bridge Edge Loops tool.

If you use the fill tool (F) blender creates a very ugly Ngon on connecting all of the vertices like this:

Using bridge edge loop tool will give you the proper curve:


How do I change the interpolation of Nurbs curve so its Bezier?

To change a Nurb to Bezier:

Select your curve, go in Edit mode, and in the T panel (on the left of your 3D view) > Tools > press the Set Spline Type button and choose Bezier.

It looks like it doesn't work everytime so here is a way: Select your nurb in Object mode and convert it into a mesh with alt C > Mesh From Curve. Then convert this mesh again alt C Curve from Mesh. Now it's a Bezier. As you can see in Edit mode it has a lot of vertices. To simplify, activate the Simplify Curves addon, then select your curve in Object mode and Spacebar > Simplify Curves. Now in the bottom of the left panel (T) play with the Distance Error factor to reduce the amount of vertices. Once it looks good, come back in Edit mode to check out.

To make an object follow a path:

In Edit mode make sure that your Bezier curve goes in the right direction, if not W > Switch Direction.
Put your object at the center of the scene (alt G).
Give it a Follow Path constraint. Choose the curve as Target. Click on the Animate Path button of the modifier. Now the object follows the path.
As the speed is not the one you want you need to delete the curve's self-generated animation: Select the curve, open the Graph Editor, on the left menu unfold the menu until you see Evaluation Time, select it.
Click N to display the right menu, select the Modifiers tab, click X to close the Modifiers > Generator. Now your object isn't animated anymore, but you're going to fix it manually.
Keep the curve selected. In the Properties panel > Data > Path Animation, keep the option enabled. With Frames choose the number of segments that will divide the curve. With Evaluation Time you will decide at what segment of the curve the object will be at the moment you want on the Timeline.
Now open your Timeline, put your cursor at frame 1, play with the Evaluation Time until the object is at the position you want, then insert a Keyframe on the Evaluation Time. Change the position of your cursor along the Timeline and repeat the operation. As you see you can move the object along the curve at the speed you want, you can even make it go backward. In the Graph Editor you can also change the Interpolation type (press T) so that the movements are more or less flexible.


Artifacts on cube after modulo on coordinates

The Modulo node, when used with vector input repeats the output values at regular intervals, in this case $1$ unit.

You are using Generated texture coordinates as input which uses the objects size for coordinates, meaning it that maximum X,Y or Z are always considered at coordinate $1$ regardless off absolute dimensions.

Since in this case geometry is a cube, there is a planar face at precisely the coordinate X=$1$ which is the boundary point exactly where the Modulo pattern repeats itself and goes from black to white.

And that is what you are seeing, it is not Z-Fighting per-se but it is exactly the same kind of mathematical imprecision computers can't really solve well.


How to output ID masks as seperate files for compositing?

Object ID passes

Assign a unique 'Pass Index' value to each object
Enable Object Index pass (Properties > Render Layers > Passes > Object Index)
Create a 'File Output' node in the compositor via Add > Output > File Output
Create 'ID Mask' nodes via Add > Converter > ID Mask per object
Create the desired output sockets to connect the 'ID Masks' and the 'Beauty Pass'
Make sure your File Path of the 'File Output' node is correct

Click to enlarge

Result:

Material ID passes

It's basically the same for 'Material ID passes'. Assign a unique 'Pass Index' value to each material and enable Material Index pass (Properties > Render Layers > Passes > Material Index):

Click to enlarge

Related Questions

How to use index passes in other compositing packages?
Accurate IndexOB and IndexMA passes


How can i edit a follow path constraint with the graph editor?

When you use a follow path constraint the movement and select Animate Path, there are no keyframes, the movement is determined by a couple of parameters:

1-The number of Frames on the path animation and Evaluation Time of the curve the object is parented to. The default is to move the object through the complete length of the path in 100 frames.

2- A Generator Modifier in in the evaluation time that can be displayed the Graph Editor. The movement starting at 0 and increasing linerarly one unit in X (time) and one unit in (Evaluation time value)

So to determine the speed at which the object will travel through the path there are two options:

A.- Change the number of frames on the curves path animation parameter. Less frames will make the object travel faster across the path. More frames will make it go slower.

B.- Altering the slope of the curve on the generator. A steeper line will make the movement faster, a flatter will slow it down.


Transforming armature bone by matrix of another bone in pose mode

The solution to this was to transform bone2 by the inverse of bone1's pose mode matrix, then transform bone2 again by bone1's matrix in edit mode:
for b in bpy.context.selected_bones:
    b.transform(hand_pose_mat.inverted())
    b.transform(hand_edit_mat)


Do the same thing as real world factory/builder creating the object, if doing this help you to keep clean topologies

Saying that you have to add a button on a plane panel, and you don't care about the gap that between the button and panel. Then you should consider direct add a new separated button mesh.

Since as moonboots said, if the thing is created that way in real world, it should modeling in that way. The crafting pipeline in real world factory already test the SOP. Unless you have a good reason, just create a new mesh.

You can also create a Suzanne monkey in your Blender, and see the mesh of it. The eyes are actually separated from the face.

There are some exceptions, like when you are creating game asset. The number of vertices inside the object matters the performance. And by merging the button vertices and the panel vertices will give a less vertices object. Then you should consider merging those geometry for game.

Also, when you are modeling living creatures, and you need to control them by non-rigid deformation(bent). You should probably use an intact mesh for a good behavior in deformation algorithm.


The problem of the "No active image found in material" error message was simply because the "Use Nodes" was unchecked in this material.

Checking it, solved the problem.


Unlink image from the Image Editor using Python

Check if it is a render image then switch to another one (in here no image is chosen )

for area in bpy.context.screen.areas :
    if area.type == 'IMAGE_EDITOR' :
        if area.spaces.active.image.type == 'RENDER_RESULT' :
            area.spaces.active.image = None


I do believe pressing O used to run this tool in the Dope Sheet, but for consistency with the other editors O now seems to enable proportional editing. Now the 'Clean Keyframes' option resides in the Key> Clean Keyframes menu.

WARNING This will reset ALL interpolation back to the F-Curve default Interpolation.


Is it possible to twist bones while posing on Weight Painting mode?

Of course you can. Just hit R Y Y.

The Transform values in Properties panel refer to the mesh as it is the active object from those 2 selected while Weight Painting.


How to create a controllable moss material for a photoscanned object?

realistic is relative and increadibly difficult to achive when compared to photoscanned

you can use particles and get very realistic result, but a heavy performance hit

or you use vertex paint, or mask paint to mask out the areas where you want the moss to then procedually add the moss in the material editor with nodes. not very realistic, but still quick and easy

but the best would be to paint the textures, this will take the lowest ammount of performace but the highest ammount of work


Is this a boolean, and if so how would I do this exactly?

Boolean modifiers have three modes:

Intersect
Union
Difference

Which are pretty self-explanatory. Intersect only leaves the part of the mesh which is intersecting with the other, Union unites the two meshes and Difference only leaves the difference between them.

We're looking at using the "Difference" option here. The issue with this is that it subtracts volumes - this means that if you subtract a cube from another cube, you get something like this:

However if I use the "difference" option with a plane instead of a second cube I get this:

But that's still a cube! So what happened here? Well, let's take a look at it in edit mode, shall we?

There is our answer. It did subtract the plane! However a plane doesn't have any thickness to it, so it just cut our cube in half!

This is the issue you're facing at the moment with your walls. The inner and the outer wall both get subtracted, however they are both planes. This means that you get your floor cut properly, but it doesn't actually subtract the part you don't want to have. So to fix this you have to apply the modifier (I had to apply it as well, to show you what it did). Once you have done that you can go into edit mode and hover over the part you don't want. Blender has a nifty feature that allows you to select loose parts of a mesh, so hit "L" to select them. If you, in doing this, also select the part you want then that means that you haven't completely seperated them and they're still connected somehow.

This has one disadvantage tho. Booleans in general are great for non-destructive modeling, meaning that you can add them and never apply them. This allows you to keep your original mesh intact. You just hide all the things you subtract to get them out of the view.

This technique doesn't allow you to do that, unfortunately.

If you want to do it without booleans, here's an idea I have: Go into edit mode on one of the walls. Select only the lowest vertecies. Hit Shift + D to duplicated them, then hit P to put them into a new mesh (Press P -> "From Selection"). Enter edit mode on the new mesh, select all vertecies, and scale them down or up intul you meet the other wall.


How to center a cylinder on an existing hole in a mesh?

In Edit Mode select the hole's rim with Alt+RMB and press Shift+S-->Cursor to Selected. Then in Object Mode select the cylinder and press Shift+S-->Selection to Cursor (Offset).


It's not a dialog box, but anytime you are modifying something through mouse movement while using a tool, you can directly type in the measurement you want. Eg if you want to bevel an edge by an offset of 1 unit, click bevel, then type 1, then press enter (or left click) to complete the action.

You can view your input value in the box at the bottom of the viewport (in the red box), along with some other information/options/values for whatever tool you are using.

Once you have completed the action, you can also fine tune with the menu that pops up at the bottom of the toolbar. This will appear after you complete any action.

I assume this menu is the dialog box you are referring to when you wrote "Select edge - click bevel - move mouse around to have dialog box appear", but I figured I should mention it just in case, because it seems to be what you are looking for. If the problem is that you don't want to move the mouse around before having the menu appear, you can select the tool (eg bevel), then, without moving the mouse, press enter or right click to have the menu pop up.

You might also want to look at some of the options in the properties panel (you can turn it on or off by pressing 'n' on the keyboard):

The options change depending on the mode you are in/what type of object you have selected, but for example when you are in object mode, you can modify the selected objects transform. (in the picture it's right at the top of the properties panel). It's not as relevant as the first two solutions I mentioned, but I'm not sure how famiar you are with Blender so again, I figured I should include it. (sorry if this is all stuff you already know).

Hope some of this helps.


There is an addon for BGE made by agoose that has a multiplayer setup. I suggest you have a look at that and see if it provides an easy solution for you.

This is similar to the question "how do I carve a statue in wood - without using my hands". Multiplayer is not something you can implement in a few hours, or even a few days. A good multiplayer setup requires an understanding of a range of topics from advanced programming concepts through to the network stack and even some physics (and AI for more advanced lag compensation techniques).

So that this answer isn't completely useless as an answer, I will continue.

Networking in python is done typically through the socket module, though other frameworks such as twisted are available. Because blender python scripts have to run inside a frame, typically ports have to be used in non-blocking mode, or a multithreaded system set up.

You also have to design the architecture of the system. Do you have a game instance that is the "true" state of the game and all the clients are just interfaces to it? Do you have purely client-side calculations and only send updates to what a player does? There are many more architectures around, have a read and take a pick.


Qubicle to blender for import to Unity - don't know if texture is actually applied?

The 3DView has several different shading modes ranging from bounding box to render preview. By default, in solid shading the objects are drawn in a plain colour and any textures are not visible, while they aren't displayed in the 3DView they are used when rendering and exporting. When you change to texture painting, the textures are displayed as that is the data you are working with.

Something that can catch you out is that you need to save the image files after painting as they are not saved when you save the blend file. The answer to this question has a script that will save the images when you save the blend file.

If you search for "blender texture painting" you can find many tutorials to get you started.


I presume that this feature did not exist at the moment when this question was asked, but you can now go to Tools Menu -> Stroke -> Stroke Method and choose Line, and draw strokes as lines.


Curve modifier -applying Nurbspath displaces the object

The curve modifier is complex and it takes some playing with it to get used to how it works.  Start by looking at how your objects are orientated in space.

In object mode, the curve is orientated with its X-axis along the global negative Y-axis and the Y-axis along the global X-axis.

Examine the curve in edit mode.  Your curve is oriented along the Y-axis with the curve normals along the X-axis.

In object mode, apply (Ctrl + A) the curve rotation.  Now the object's Y axis points along the curve and the object's X-axis points along the curve's normals.

The tunnel object is also rotated.  Apply the rotation so the tunnel points along the positive global Y-axis.

Now add the NurbsPath to the Curve modifier and set the deformation axis to Y.  The tunnel is deformed along the curve, but the roof is lying on the X-axis.  The curve thinks the X-axis is 'up' because its normals point in this direction.

Select the curve and tab into edit mode.  Select all of the control points and adjust their Tilt by 90 degrees (Ctrl + T, 9, 0).

Now you can adjust your curve's control points to make a nice, smooth tunnel.  Hint: turn on the Merge option on your array modifier.


This is likely happening because the light is not able to bounce back trough the glass.

If you increase the number of transmission light bounces in your render you should solve the problem, also make sure Caustics are turned on.

They probably dont need to be as high as shown below so experiment a bit.


Procedural texture is not visible in render

The problem is with the 'Add Shader' node before the color ramp node. This is because the 'fac' input to the color ramp node should be a value. Instead the 'Add Shader' node gives a shader which the colorramp node can't understand properly.Also, ideally the 'Add Shader' node should take shaders as inputs instead of color or values.

In the place of the 'Add Shader' node, use 'Math' node and change it to add.Math node can be accessed by Converter>Math

The node setup will look something like this.


How to put a unique material on duplicated objects separately?

By default, when you duplicate an object in Blender, the copy is a new object but will still share some data with the original (by default this includes materials and textures) and will copy other data, like the mesh (which allows you edit each independently). Because of this, all these objects will share the material the original object has.

To get each object to have its own unique material, you can select them all, go the 3d view header and use Object > Make Single User > Object & Data & Materials + Tex. Or, you can select each sphere, go the material panel and click the number  beside it to make it unique to that sphere.


How do you mathematically reverse a perspective transformation?

Blender has build in camera tracker. Load the images as a video sequence and mark trackers in each by hand (spots and freckles work well). Then solve the images to get your trackers perfectly positioned in 3d space. Now you know exactly where things should be in 3d space.

You can deform your current geometry to conform to the trackers with big sculpt brushes.

It's hard to say if there is mathematical solution, because it is unclear how you modeled the mesh. You had multiple reference sources and you introduced error from each view, each error in different direction. Manual correction is the fastest way for now and using actual photogrammetry is the way for future, you don't need to waste time with this script (unless you want to develop your own photogrammetry tool:).


How to use russian letters in object names and filenames in Blender?

Blender does not currently support unicode in the file browser. Sorry to disappoint.
~Dan


Accessing volume checkbox of a camera in the Stereoscopy section

You can cycle through the areas of the bpy.context.screen untill you find an area with the type VIEW_3D.

import bpy

areas = bpy.context.screen.areas

for area in areas:
    if area.type == "VIEW_3D":
        area.spaces[0].show_stereo_3d_cameras           = False
        area.spaces[0].show_stereo_3d_convergence_plane = False
        area.spaces[0].show_stereo_3d_volume            = True
        area.spaces[0].stereo_3d_volume_alpha           = 0.5


Comment echo: This is because of alpha blend in EEVEE materials. Because EEVEE uses rasterizing (fakes physical effects like transparency using formulas), it can be suspect to flaw in odd situations. Alpha blend  tries to implement full transparency function, but mainly experiences problems where it is trying to sort faces within the same object. Which one is in front? Treating something as partially transparent when you’re faking is very tricky to do.
Cycles does not have this problem because it uses ray tracing. It simulates the behavior of real light, and traces out every single pixel in the image. This is why cycles takes more computing power, but produces more realistic results.
If you have to use EEVEE, one good halfway solution is alpha hashed. Alpha hast is basically alpha clip, but with random threshold for each pixel, each sample. Alpha clip means a pixel is either fully transparent or fully opaque, depending on the threshold level. What then happens in alpha hashed with partially transparent materials is kind of a fuzzy mixture that looks better with each successive EEVEE sample.


Ended up with animating the curve using empty but in a reverse way. This mean I pose the curve in zigzag shape first then animate it to straighten shape.


Why isn't my animation moving when played?

Insert more key frames.
For example:

at frame 0 :   0 degrees rotation

at frame 2 : 144 degrees rotation

at frame 4 : 288 degrees rotation

at frame 5 :   0 degrees (360 degrees) rotation

Be aware also that 5 frames is just 1/5th (0.2) of a second at normal animation rates, so your prop is going fully rotate 5 times a second.


Beginner Help on Materials, Shading, and Textures

A Shader, or BSDF (Bidirectional Scattering Distribution Function), is the math definition for calculating light bounce. Different shaders such as Diffuse and Glossy have different definitions.

Materials are datablocks that can be applied to meshes. Think of it as a real material in the world (like wood).

Textures are images that mostly add photorealism to your mesh. The most common texture maps are

Color or Albedo: The color of the material.
Reflection or Specular: How much light the material reflects.
Glossy or Roughness: How concentrated or diffuse the reflection is (like a mirror vs brick).
Bump or Displacement: A grayscale map used to make the material go up and down with lighter pixels representing higher areas and darker pixels representing lower areas.
Normal: A purple-blue map that defines the direction of displacement.
Ambient Occlusion: This makes lower areas darker.

There are a lot more maps, and you can find definitions about them by googling.


2 questions: 1 - what is wrong with the tip of my mesh? 2 - Why does the bevel modifier have 2 different effects?

Problem 1.

Sometimes a Mirror modifier enforces triangles in a mesh which can be removed after the modifier is applied. In this particular case, when the triangles are eventually removed, the pinch will go, too. (The surface isn't illustrated here, just the topology)

Problem 2.

The width of the bevel created by the Bevel modifier is not being defined by the modifier's 'Width' setting, but being limited in both meshes by the 'Clamp Overlap' constraint. That constraint is different in the two meshes. If you set the 'Width' of the Bevel to a much smaller number, say about 0.01, then you can achieve the same actual bevel width in each mesh, as on the left, below.

If that width is not acceptable throughout your meshes, then you could, for example, make more selective Vertex Groups, and bevel to different degrees for each Group.


You don't have the correct material for the domain. You used a diffuse material for the domain, so it's definitely going to be just another box. The cube on the viewport is just in wireframe draw type, which you can find and change in the object settings.

In Blender Render people used Voxel Data for Smoke Simulations to make the domain transparent and to only show the fire or smoke that you're rendering. But in Cycles there's this Attribute node. Now I have no idea why or how it works, but it works so I'm using it. Here's the node setup I'm using.

You can change the color of the fire with the color ramp, and you can change the density of the smoke and the amount of light the fire emits by changing the value on the multiply node.

About the Attribute node, you can find more about it here if you wanna see what else you can do with the smoke simulation: https://docs.blender.org/manual/en/dev/render/cycles/nodes/types/input/attribute.html


Adding 'stretch to' constraint on spring with target will change direction of spring

To fix this you have to Select your Spring and press CtrlShiftC to add Constraints (with Targets) and choose "Copy Transforms" Constraint, this will add an empty were your mesh is and copy its Transforms this way giving your mesh the default: location / scale / rotation and for you to be able to change it, by moving / scaling / rotating your empty


Go into top view (Numpad 7), enter edit mode, press B, and box select half the vertices. Then press X > Vertices. You may need to rotate so that the edges align to the grid properly. Once youhave done that, select the four inner vertices and press F. Alt right-click on the end edges and press F to make faces for them as well.


How to fold a disk into a cylinder while the edge are touching

Let's try this:

Create a cylinder (Fill Type > Ngon), rotate it so it faces the view, apply the rotation with a ctrl A.
In Edit mode, inset with i.
Inset again and alt M > Merge at Center.
Create some edge loops with ctrl R to add some topology.
Give your object a Simple Deform modifier, Bend mode, with a 360° Deform Angle.
Give it a Subdivision Surface modifier, press the Smooth Shading button on the Tools panel.
To give your object some thickness you can add a Solidify modifier, put it above your Subdivision Surface modifier, and choose the Thickness value that suits you.
To have a sharp edge make sure to have an edge loop close to the edge.


Adding already animated armature to a model

In principle you have to bring your mesh into the position that it matches the given armature. One way would be to create your own armature, position your mesh so it alligns with the downloaded armature and press "Apply" in the Modifier tab.

But probably the Sculpt Brush would be a better solution for you: https://developer.blender.org/D5647

Remember to make a backup of your file before you start modifying the mesh.


Python: How to select one 'BoolVectorProperty' value at a time unless 'shift' key is held

Use the event from invoking the operator

Using the method from the related answer here, since we can address the event in the invoke,  can it be passed to the execute method of the popup as a class property.  On very limited testing it appears so..

Added some more class properties to keep tabs of selection.  Also copied the selected objects since if a non layer with non matching scene layer is selected context.selected_objects will vary those when op was invoked.  (Btw obj.layers is gone in 2.8)

The big issue is the popup not redrawing correctly. I thought the operator check(..)
method returning True would work, but not the case on my blender.  Perhaps using the layers collection of the context object. when invoked,  would be one way to solve this.

import bpy
from bpy.types import Operator
from bpy.props import BoolVectorProperty

class OBJECT_OT_move_to_layer2(Operator):
    """Move to Layer 2"""
    # class properties
    bl_idname = "object.move_to_layer2"
    bl_label = "Move to Layer [TESTING]"
    bl_options = {'REGISTER', 'UNDO'}

    event = None
    objects = []
    prev_sel = []

    # poll is a class method
    @classmethod
    def poll(self, context):
        return True

    def execute(self, context):
        ev = []
        event = self.event
        if event.ctrl:
            ev.append("Ctrl")
        if event.shift:
            ev.append("Shift")
        if event.alt:
            ev.append("Alt")
        if event.oskey:
            ev.append("OS")
        changed = [i for i, (l, s) in
                enumerate(zip(self.layers, self.prev_sel))
                if l != s]

        print("+".join(ev), event.type, event.value, changed)
        # pick only the changed one
        if not (event.ctrl or event.shift) and changed:
            self.layers = [i in changed for i in range(20)]
        self.prev_sel = self.layers[:]

        self.runMove(context)
        return {'FINISHED'}

    def check(self, context):
        return True # thought True updated.. not working

    def invoke(self, context, event):
        self.layers = [any(o.layers[i] for o in context.selected_objects)
                      for i in range(20)]
        self.event = event
        self.objects = [o.name for o in context.selected_objects]
        self.prev_sel = self.layers[:]
        return context.window_manager.invoke_props_popup(self, event)

    # properties

    layers = BoolVectorProperty(
        name="Layers",
        subtype="LAYER",
        description="Object Layers",
        size=20,
        )

    def runMove(self, context):
        for name in self.objects:
            obj = context.scene.objects.get(name)
            obj.layers = self.layers

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

def unregister():
    bpy.utils.unregister_class(OBJECT_OT_move_to_layer2_name)

if __name__ == "__main__":
    register()
    bpy.ops.object.move_to_layer2('INVOKE_DEFAULT')

Test print to console

 LEFTMOUSE PRESS [0]
Ctrl LEFTMOUSE PRESS [11]
Ctrl+Shift LEFTMOUSE PRESS [12]
Shift LEFTMOUSE PRESS [1]

Note if you want to call from a shortcut, and have the hacky event handling,  need to invoke from another operator. Edit made to simple operator to call op above (just like calling it from space menu)

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    def invoke(self, context, event):
        return bpy.ops.object.move_to_layer2('INVOKE_DEFAULT')


I found that using "Image Sequence" format for the canvas instead of vertex was a far simpler solution that solved this problem (or at least made it easier to work on).
I'll leave this question unanswered as there may be a better solution that someone may find.


Active element is set as pivot point:

Set it back to "median point".


How to prevent hidden shapes from being exported to .stl file?

Before exporting, press A in object mode to select everything, this won't select any hidden object.
Then while exporting, check "Selection Only" on the right to export only the selected objects.


There's no single workaround for this sort of problem.  A lot depends on the parentage arrangement and complexity or otherwise of the reload animation.
If the hand is parented to the weapon (Child = hand) then there'd be little reason not to just animate the hand and clip, particularly if it's only a straight case of shoving it up into the housing.  You'd need to use at least a master parent to ensure the animations are local with respect to the character, weapon and other components.

If the reload animation is complex however you can still do this without removing the original parentage.
and that's what you're looking at in the video clip below...

A second and concurrent 'Virtual parent' is used here which forces the hand to follow the clip up into the holder.  Whilst unnecessary for a straight out 'shove', it was done this way for a demo.
Note - this would only be valid when the gun isn't bouncing around during the reload.  If it is, the primary parentage would certainly have to go and there are at least 4 ways you can do that.
Firstly to explain why the parent structure is important...
In both video clips the lower arm bones (wrists) are targeting empties that are acting as their respective handles with which to move them.  The handles are in fact Inverse Kinematics (rigging) targets for the hands.
Those two empties are in turn parented to the weapon, so it's the latter that drags the hands and arms about, not the other way round.
The weapon and character have their own master handles (parents) and these two again are parented to a common overall Master handle, the cube empty.
This keeps the whole thing together and importantly, all components will be locally related to each other.
-=============-
Method 1 - Concurrent Virtual parent -
For a simple shove as we have above, you wouldn't bother.  You'd simply animate the right hand to stay with the clip but if the clip's actions were more complex, some form of secondary parenting would make things easier.
The right hand's handle (empty) is parented outright to the gun.  When the reload is required the clip is animated on it's own and shoved up into the holder.  The clip becomes a virtual parent for the hand by simply copying it's keyframes axis for axis into the hand's handle. (it's empty)
The hand won't be relocated properly but those keyframes can be dragged
an --> axis at a time<-- up and down in the Graph editor to align the hand to the base of the clip.  (Select all in the editor and press G Y)
Once done the editor's handles can then be used to compensate for any drift (if any) between keyframes.
With the clip in place the hand can be returned to where it was before the load.
After that it's business as usual.
-=================-
Method 2 -  A 'Child of' Constraint -
This can indeed remove it's influence but there's a catch -
Some extra trickery is required to circumvent the hand's jump back to where it came from when the constraint's influence slider is wound back to zero.  Worse, the whole thing can come undone when further physics or a constraint is used on the weapon later.
Experience has taught me to stick to the straight out parentage function (CTL-P) unless specifically needing the advantages of the Child-of constraint.
-=============-
Method 3 -
This one is a little cumbersome but clean and dead stable. It would normally be considered when involved in a very large project.

Split the action between two or more Blend files.

The frames up to the reload would be handled in the first file, the reload itself in the 2nd which will have the right hand unparented, then with the reload complete, a third to continue on with the right hand parented as before.
Each file only renders out the frames necessary and all should be LOSSLESS video using the SAME CODEC.
All three videos can be joined up in the VSE.  The switch-overs are undetectable in vers 2.77

A little more detail -
At the frame where the load is to commence, Save the Blend file as it stands and also "save as" a new filename.
In the 2nd file, remove ALL of the hand's animations and constraints so you end up with a 'frozen' hand as it was in the first file at the exit frame.  This is less troublesome when using a straight out parentage. (CTL-P & ALT-P)
From there, animate the hand and clip as required for the load.  The hand can be directly parented to the clip if desired.
With the clip in place, and at the last frame plus a few, save that and a copy to a 3rd filename.
In the 3rd file restore the original hand parentage and continue on.
Obviously the frame where each file is to hand over to the next should be noted down.  You don't want any twitch or jump.
-==============-
Method 4, Baking -
Baking the hand's action will certainly remove the parentage including a 'Child-of' constraint, and without fuss. Be sure to tick all the bake panel's boxes and enter the correct frame range. (Open the "Object" menu in the window's header and select "Animation --> Bake")
All previous keyframes that are in that range will be replaced along with any constraints placed on the object.  Physics will have to be switched off manually, and it's two redundant strips left behind in the Dopesheet deleted.  If things go awry when played, save the file, exit Blender and reload to reset the physics cache.


How to fade / scatter sand on the floor around?

You could use the image you show as a stencil to create a black and white image texture:

Then use this image texture as a mask in a material that mixes your background with a noisy material:


Can I combine channels or edit them at the same time?

You can select the audio and video strips and then press CTRL+  G to group them together (essentially combining the channels).

Now you can make your cuts and reorganize them.

This combined strip is called a Meta Strip, and by pressing the TAB key you can dive into the Meta Strip to edit the contents inside of it.


These are so called "bones" they make up the "armature"
They are commonly used to control the mesh when animating.
Example: the bending of the fingers when doing a first is controlled by bones in real life, so is it in blender, but simpler.

In your case they control the animation of the pistol. Be it the magazine snapping out. The recoil. Or just the whole model when moving.

It's a large subject and you can watch many tutorials on youtube.


How do I convert materials from Blender Internal to Cycles?

The Python script at https://blenderartists.org/forum/showthread.php?394600-Materials-Specials-amp-conversion will automatically convert all of your materials and textures over so that they are compatible with Cycles.

The script tries to make the Cycles materials look as much like the Blender-Internal materials as possible, but I imagine you'll still need some tweaking, because of the inherent differences between the two render engines.


bright squares showing up when rendering

Light clamping when done incorrectly can be problem sometimes, I have tested different values, and 500 for both Direct Light and Indirect Light worked best.


How to make rounded faces to model a human face?

Edges are by definition straight, and faces by definition planar. A strip of edges or faces can be curved by offsetting the direction of each a tiny bit to the former.

Luckily, you don't (in most cases) have to do this by hand. For examples of how it works and looks, try out the sculpting tools sometime!

EDIT as Duane Dibbley points out below, it IS in fact possible to curve faces that have more than 3 vertices but it may cause some rendering oddities. The reason I did not consider it is because most applications I import models into accept tris (tri-verticed faces) only. Check your target application (if any) before attempting this.


How to control complete model with single empty

do you mean like this?
https://youtu.be/k_ks-DzSBV0
if yes:
Parenting the empty works exactly as you described.
But...
you have to change your limit rotation settings.
I just had a look at your fold constraint.
The correct setup looks like this:

You have to restrict all axis except the one you want to move (in your special case here) so just the x-Axis got some values, all others with 0 but checked.
I am not sure why it does not work if you check the lock on the axis values, but with my settings it works.


Converting metaball object to mesh in python returns empty mesh

Thanks to this answer on blenerartists I now know what my error was.

In order to properly convert a metaball into a mesh you have to look at the evaluated metaball. The correct code looks like this:

# Create metaball object
mball = bpy.data.metaballs.new("TempMBall")
mball_obj = bpy.data.objects.new("TempMBallObj", mball)
context.view_layer.active_layer_collection.collection.objects.link(mball_obj)

# Add one element to it
ele = mball.elements.new()
ele.co = (0.0,0.0,0.0)
ele.use_negative = False
ele.radius = td.sk_base_radius / td.sk_min_radius

print([ele for ele in mball.elements])  # Make sure there is data in mball (there is)

# Convert it to a mesh
depsgraph = context.evaluated_depsgraph_get()
mball_mesh = mball_obj.evaluated_get(depsgraph).to_mesh()

# Store copy of the mesh in a bmesh for further manipulation
bm = bmesh.new()
bm.from_mesh(mball_mesh)

# Delete metaball object
bpy.data.objects.remove(mball_obj)
bpy.data.metaballs.remove(mball)

# My custom mesh manipulation and writing the bmesh into a different object

bm.free()


I found the line in add_curve_sapling.py:

--- bRotate = oldRotate + uniform(-rotateV[n], rotateV[n])
+++ bRotate = oldRotate + uniform(-rotateV[n], rotateV[n]) + pi / 2

Should make the suggestion to add the angle as a third parameter.


The render visibility of an object or object hierarchy can be animated.  Thus the viewer will perceive the object to appear.  The object can be off camera or in a different layer.
Python is available to you.
One or more Particle systems is available and these particle systems can be coordinated by Python
Particle Instance is available


How do I export an object from blender and import in Maya?

The easiest way would be to select the object (desk) you want to export in Blender and export it as .obj file one of these ways:

click File -> Export -> Wavefront (.obj) OR
press space and type "export" -> click Export Scene: Export OBJ

Make sure to check Selection Only in the Export OBJ section, otherwise you would export the whole scene.

In Maya simply click

File -> Import...

and select the exported file.


You can do this on an object by object basis quite easily, there is a built in feature specifically for Level Of Detail configuration. Under the Object tab in the Properties panel, you will see a Level of Detail menu. Click Add, then select the mesh you want from the dropdown and set the distance you want it to become visible at.


Eevee Shader not showing in final render

In the particle system that is applied to the plane you need to check "Show Emitter" in the render tab.


how to? pivot editor camera around object

Numpad-. makes the selected objects the center of rotation.

If this is not a duplicate question, I will be surprised.


Create a 3d model with python API using Postgis Polygon

With help of @TLousky's answer and @batFINGER's comment, finally this worked for me.

import bpy, json, bmesh
from math import *
from mathutils import Vector

data_string = '{"type":"Polygon","coordinates":[[[-121.332737,38.722023],[-121.332895,38.722023],[-121.332895,38.721977],[-121.332946,38.721977],[-121.332946,38.721881],[-121.332737,38.721881],[-121.332737,38.722023]]]}'

dataDict = json.loads( data_string )

coordinates = dataDict['coordinates'][0]

x_factor = coordinates[0][0]
y_factor = coordinates[0][1]

verts = tuple([((x[0] - x_factor)*10000, (x[1] - y_factor)*10000) for x in coordinates])

bm = bmesh.new()

bm = bmesh.new()
for v in verts:
    bm.verts.new((v[0], v[1], 0))

# Generate one ngon face
bottom = bm.faces.new(bm.verts)

top = bmesh.ops.extrude_face_region(bm, geom=[bottom])

bmesh.ops.translate(bm, vec=Vector((0,0,1)), verts=[v for v in top["geom"] if isinstance(v,bmesh.types.BMVert)])

bm.normal_update()

# Generate a mesh and transfer data from bmesh object
m = bpy.data.meshes.new('GIS')

bm.to_mesh(m)

# Create a new mesh object and link to scene
o = bpy.data.objects.new('GIS', m)

bpy.context.scene.objects.link(o)


I think you have some double vertices over there.
shortcut W > remove doubles might solve your problem. Also try to keep faces as quads. Subdivision surface with triangles doesn't give optimal result.


How to make vertices child to empties/objects

Found it:

select the empty
shift-select the object that contains the vertices
tab to edit mode
select the vertex that you want to link the the empty
on the vertex menu, hook to object
repeat for the other vertices


Let's you have this setup here, similar to yours:

Cylinder fits 2 cubes, but it's orientation is broken. And you want to fix it.
Create a Custom Transform Orientation. For this simple example: select the edge you want to align, press CtrlAltSpace or find it at bottom of the N-Panel.

You will have a new transform orientation that fits to geometry:

Now you can use this transform orientation for scale your object. But If you want to align object itself, move next.
In object Mode select cylinder, and press ShiftS -> Cursor to Selected
Create empty then press Object -> Transform -> Align to transform Orientation.
Parent cylinder to the empty  CtrlP.
Clear empty's orientation AltR. Cylinder will follow empty and will rotate with it like this:

Unparent cylinder AltP -> Clear and keep transform.
Apply rotation to cylinder  AltA -> Rotation
Rotate cylinder back ( Object -> Transform -> Align to transform Orientation. )


Major visual issue with cycles rendering

I have fixed the issue,

most of the objects had suddenly had invisibility checked, uncheck these and it will appear fine


How to import a SVG file and scale it using latest version of Blender

To scale you need to select the object and press S. Then you can move the mouse to size the object.
Some useful shortcut are:

S, then a number (for example: 3) --> you increase the object * 3 (you can also use non integer number, like 0.5)
S, Z (or X or Y) --> you increase the object only in Z (or X or Y) axis
S, SHIFT+Z (or SHIFT+X, SHIFT+Y) --> you increase the object in all directions but Z


IES Lighting on Transparent Alpha Background

Yes, you can do this with a holdout shader on the diffuse plane:

Note that the world background must be completely black/zero strength so that there are no other sources of light in the scene, and Transparent should be enabled in Render settings > Film.


Black artifacts on plane with procedural displacement

Sorry for the late answer, but those are not artifacts. The person in the tutorial used procedural displacement to create "waves" in the water by adding a noise texture to displace the water surface, then stretching it in one direction. If you look closely, the black marks are actually parts of the waves.

Take a look at the noise texture you used to create this effect and make sure it is scaled properly. This also makes sense because displacing a more high-res geometry just results in more intricate details like you have noticed.

A little advice for later on: when following a tutorial, don't just try to copy everything. That will get you a result, but in the end, you have learned nothing. Try to understand what the person is doing. This will teach you a lot, and will also make it easier to find and solve mistakes.


I would animate a simple UVWarp with a texture with transparency.

I would model the foam as a single object, not detailed at all. Look for a texture with transparent parts, apply it to the foam object. Apply a UVWarp modifier to the object (this modifier moves the texture), and animate the modifier using an armature and two bones.

The texture should have a big transparent part, so when it is animated it looks like if its going down from nothing. Pretty sure it could do the trick for a couple of seconds.