text:
How to precisely set orthographic scale
I am trying to get an orthographic render out of Blender with precise accuracy. The scale that I would like is 1"=1'. To prepare my scene, I have changed units to Imperial with separate values. I then changed the output dimensions to 7200x5400 - so that I can get an 24"x18" output at 300ppi. My problem now is setting the orthographic scale. I have tried 12 (for 12 inches in a foot), but the resulting render is too small. After fiddling with the scale manually, I figure that I'd need something less than 7.4, but I don't know how to get a precise scale for my use case.

https://blender.stackexchange.com/questions/64914/setting-camera-to-position-where-it-can-render-a-seamless-repetable-orthographic/64920#64920

Hi :). I made it work with scene units set to inches. The orthographic scale is then 0,6096. But it took me another hour to figure out why. Turns out 24 inches=609,6mm.

I'm voting to reopen this so Qwerty can post his solution as a full answer. Not everyone has @Duarte's big brain :).

reopened @qwerty you should post your edit as an actual answer below.

Summary

Pick the larger of your output width and height. E.g., my render is 4096 px wide by 1024 px tall, so I'd pick width, since 4096 > 1024.
Find the desired size of the output camera. E.g., my cliff is 1600 ft wide by 400 ft tall. Since width is higher, my camera size needs to be 1600 ft.
Convert from desired size in scene units to meters. E.g., 1600 ft is 487.68 m.
Plug the size, in meters, into the camera's scale. E.g., I would set my scale to 487.68.
Enjoy!

Explanation
This answer will focus on lining the camera up to a plane that's parallel to a major scene plane. Vertical, in the XZ or YZ planes, or horizontal in the XY plane. It will presume you have a rectangular object to line up to. In these cases, it's trivial to position and orient the camera so it's located at the center of the target plane, pointed straight at it.
If you're trying to line up with a non-standard angle, you'll need to do additional math. Duarte's answer to a similar question can give you some ideas about how to calculate the angles.
In my case, I have a flat, vertical plane that's 1600 feet wide by 400 feet tall. It will (hopefully) end up being a cliff face I plan to import into another scene as a bump-mapped diffuse texture. So I set up an orthographic camera that will render to a 4096 x 1024 image for the final material.

Since the plane is 1600 x 400, with the base centered on the world origin, that puts its center at [0 ft, 0 ft, 200 ft]. I simply put the camera at [0, 0, 200], then moved it along the -Y axis. Since cameras point down by default, I rotated it 90° on the X axis, then it was lined up. Again, for more complex angles you might need a bit more math.

As explained in Duarte's answer, the scale of the camera is such that the largest dimension of the output render will be mapped to scale units in the scene. In this case, the output is wider than it is tall, so our scale tells us the width, in Blender units, of the camera.
I initially tried using 4096, then noted that 409.6 was somewhat close. But it's not really close. AAARRGGG!!!! Why??!?!? Blender, whyyyyyy!?????????????

Manually playing with it, I can see that 483 is much closer, but still not quite right.

As noted in the comments and other answer on this page, it's because Blender is using the metric system behind the scenes. Even though Blender is set to Imperial with units of feet, the camera scale expects units of meters.
Now, we could create the entire scene in metric units to begin with, or convert the scene to metric now. But an easier way is just to calculate the factor between feet and meters. Unfortunately, you can't enter units into the camera scale to automatically convert. However, Google, WolframAlpha, etc. will do the math for us, or we can remember from grade school that 2.54 cm is 1 inch.
$1 \text{ ft} \cdot \frac{12 \text{ in}}{1 \text{ ft}} \cdot \frac{2.54 \text{ cm}}{1 \text{ in}} \cdot \frac{1 \text{ m}}{100 \text{ cm}}$ $= \frac{381}{1250} \text{ m}$ $= 0.3048 \text{ m}$ $\rightarrow 1 = \frac{0.3048 \text{ m}}{1 \text{ ft}}$
So we can multiply our values in feet by 0.3048 to get the value in meters.
$1600 \text{ ft} \cdot \frac{0.3048 \text{ m}}{1 \text{ ft}} = 487.68 \text{ m}$
$400 \text{ ft} \cdot \frac{0.3048 \text{ m}}{1 \text{ ft}} = 121.92 \text{ m}$
Since our output is wider than it is tall, we want to use our width value. Instead of plugging 1600 or 4096 or something into the scene, we just need to plug in 487.68. Flawless victory!

Addendum
This process can be used for any other units. You just need to find the scale from your units to meters.
Also, you can plug calculations right into the Blender interface. So if you want your scale to be 895 inches, you can just enter "895*0.0254" in the scale menu.
Imperial Units

$1 \text{ mile} $ $= \frac{201168}{125} \text{ m}$ $= 1609.344 \text{ m}$
$1 \text{ foot} $ $= \frac{381}{1250} \text{ m}$ $= 0.3048 \text{ m}$
$1 \text{ inch} $ $= \frac{127}{5000} \text{ m}$ $= 0.0254 \text{ m}$
$1 \text{ thou} $ $= \frac{127}{5000000} \text{ m}$ $= 0.0000254 \text{ m}$

Metric Units

$1 \text{ kilometer} $ $= 1000 \text{ m}$
$1 \text{ meter} $ $= 1 \text{ m}$ (*gasp*)
$1 \text{ centimeter} $ $= \frac{1}{100} \text{ m}$ $= 0.01 \text{ m}$
$1 \text{ millimeter} $ $= \frac{1}{1000} \text{ m}$ $= 0.001 \text{ m}$
$1 \text{ micrometer} $ $= \frac{1}{1000000} \text{ m}$ $= 0.000001 \text{ m}$

No Units

$1 \text{ internal Blender unit} $ $= 1 \text{ m}$

Post Script
I presume the camera's scale is actually just using internal Blender units, not metric. But because the units system maps 1 Blender unit to 1 meter, we can conveniently use real-world conversions instead of having to remember some arbitrary conversion from Blender units to one real unit, then convert real unit to real unit.
It's simpler to just pretend internal Blender units are meters.

Nice! Bookmarking this for future reference, thanks :)

Unfortunately the answer by Duarte Farrajota Ramos does not address the orthographic scaling in imperial units. However, after pulling my hair out for a few hours, I finally understood that the Blender cameras do not respect the scene units (is this a bug?). So what I did was to set the orthographic scaling to 0.9144 so that it would match a yard (it seems that a yard is a better target than a foot) and then adjust the unit scaling in the scene properties, and voila, it works!


text:
Viewport Render results from Python
I have a python script that receives data over a socket and uses that data to update a scene.  The resulting render of that scene then needs to be sent to an output socket.  This needs to occur in real-time (50-60fps)
The viewport render is very fast, and has a high enough quality to work for my needs.
How can I trigger a viewport render from a python script and then access those pixels?
Some things I've tried:

calling bpy.ops.render.opengl() from the script.  This is a lot slower than the live viewport render (which surprised me because I thought this was what the viewport was doing)
calling bpy.ops.render.render() - even slower
calling bpy.types.SpaceView3D.draw_handler_add() and from within the handler, calling offscreen.draw_view3d().  Same problem.
-- For this one, I would "think" that in the draw handler, the pixels already exist somewhere in the system (and there would be no need to call draw_view3d()).  But, glReadPixels() does not work.

Any other ideas?
I've looked at:
How to access Render Result pixels from python script?
(the solution for which is not fast enough)
and
Accessing Viewport Render Result pixels from script
(doesn't have a solution, but what it does have doesn't solve my issue)
and
https://docs.blender.org/api/current/gpu.html
and reviewed the docs here:
https://docs.blender.org/api/current/gpu.html
In none of these cases have I been able to both (a) render fast enough, and (b) retrieve the pixels
I am open to hacking the blender source code as well, but could use some guidance determining where to begin.

Have a look to: https://wiki.blender.org/wiki/Building_Blender/Other/BlenderAsPyModule

Very cool!  will definitely try that out, although I suspect/fear that the render time will be the same as when running python from blender.  Worth a shot though.

@lemon Do you have any results to share?

Just discovered this question. I am currently also dealing with this problem and I got at least something working. However, it's not satisfying though. Did you make any progress since you posted here, @EMon? https://blender.stackexchange.com/questions/190140/copy-framebuffer-of-3d-view-into-custom-frame-buffer

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
VSE Transform Position attribute integer value workaround (2.93)
I just realized that in Blender 2.93 VSE strip transform position attribute is an integer value (pixel value as the picture shows below).

Because of that animating the position results a stop/stepped motion as the animation curve shows:

Is there a setting or a workaround to solve that? Previous versions of Blender have float value for position. That meant the position animation was interpolated/filtered.

Could you please clarify re which property you are animating above, is it ranslate_start_x  or offset_x

I added a picture about the UI. These are the offset_x and y.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
EnumProperty fill dynamically using callback
Fellow pythons, greetings. I am trying to create a dynamic Enum property that lists all objects on the scene with a certain custom property. However, whenever a new object is created on the scene (and thus enum is changed automatically including the order of the items in it), it shuffles the values of already selected properties and breaks my whole script workflow. Is there a way to avoid that or use anything else to perform a similar task?
Here is my code:
###############################
## Portal plane
###############################

def GetGroupObjectsReferences(self, context):

    groups = []
    groups.append(('0', "None", "")) # setting a default entry as a first element of our enum

    for obj in bpy.context.scene.objects:
        if obj.WowWMOGroup.Enabled:
            groups.append((obj.name, obj.name, ""))

    return groups

'''
def UpdateFirstGroupObjectReference(self, context):

    if context.object.WowPortalPlane.First == context.object.WowPortalPlane.Second and context.object.WowPortalPlane.First != '0':
        context.object.WowPortalPlane.Second = '0'

def UpdateSecondGroupObjectReference(self, context):

    if context.object.WowPortalPlane.Second == context.object.WowPortalPlane.First and context.object.WowPortalPlane.Second != '0':
        context.object.WowPortalPlane.First = '0'
'''

class WowPortalPlanePanel(bpy.types.Panel):
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = "object"
    bl_label = "Wow Portal Plane"
    bl_options = {'DEFAULT_CLOSED'}

    def draw_header(self, context):
        layout = self.layout
        self.layout.prop(context.object.WowPortalPlane, "Enabled")

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        layout.enabled = context.object.WowPortalPlane.Enabled
        self.layout.prop(context.object.WowPortalPlane, "First")
        self.layout.prop(context.object.WowPortalPlane, "Second")

    @classmethod
    def poll(cls, context):
        return (context.object is not None and context.object.data is not None and isinstance(context.object.data,bpy.types.Mesh))

class WowPortalPlanePropertyGroup(bpy.types.PropertyGroup):
    Enabled = bpy.props.BoolProperty(name="", description="Enable wow WMO group properties")
    First = bpy.props.EnumProperty(items=GetGroupObjectsReferences, name="First group", description="First group")
    Second = bpy.props.EnumProperty(items=GetGroupObjectsReferences, name="Second group", description="Second group")
    PortalID = bpy.props.IntProperty(name="Portal's ID", description="Portal ID")

def RegisterWowPortalPlaneProperties():
    bpy.types.Object.WowPortalPlane = bpy.props.PointerProperty(type=WowPortalPlanePropertyGroup)

def UnregisterWowPortalPlaneProperties():
    bpy.types.Object.WowPortalPlane = None

Thank you in advance for help.

Since Blender 2.79 you can do the following.
###############################
## Portal plane
###############################

def is_wowgroup_enabled(self, obj):
    return obj.WowWMOGroup.Enabled

class WowPortalPlanePanel(bpy.types.Panel):
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = "object"
    bl_label = "Wow Portal Plane"
    bl_options = {'DEFAULT_CLOSED'}

    def draw_header(self, context):
        layout = self.layout
        self.layout.prop(context.object.WowPortalPlane, "Enabled")

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        layout.enabled = context.object.WowPortalPlane.Enabled
        self.layout.prop(context.object.WowPortalPlane, "First")
        self.layout.prop(context.object.WowPortalPlane, "Second")

    @classmethod
    def poll(cls, context):
        return (context.object is not None and context.object.data is not None and isinstance(context.object.data,bpy.types.Mesh))

class WowPortalPlanePropertyGroup(bpy.types.PropertyGroup):
    Enabled = bpy.props.BoolProperty(name="", description="Enable wow WMO group properties")
    First = bpy.props.PointerProperty(type=bpy.types.Object, poll=is_wowgroup_enabled, name="First group", description="First group")
    Second = bpy.props.PointerProperty(type=bpy.types.Object, poll=is_wowgroup_enabled, name="Second group", description="Second group")
    PortalID = bpy.props.IntProperty(name="Portal's ID", description="Portal ID")

def RegisterWowPortalPlaneProperties():
    bpy.types.Object.WowPortalPlane = bpy.props.PointerProperty(type=WowPortalPlanePropertyGroup)

def UnregisterWowPortalPlaneProperties():
    bpy.types.Object.WowPortalPlane = None

this is awesome - in the documentation of the "poll" attribute for PointerProperty (https://docs.blender.org/api/2.79/bpy.props.html) i cannot find what the first argument refers to. is that the propertygroup or the original object?

Got an explanation and fix :

Blender stores enum properties as an integer internally. If you
specify a list of items, the integer values will just be the location
of the item in the list, which can change if you change the number of
items. This is not considered a bug. Possible solutions are:

Explicitly specify an unique integer value for each item that you can
guarantee stays the same, for example: ('NAME', 'Name', 'A
description', 35)
Use a StringProperty instead, perhaps combined with
prop_search to show a list of items in the UI.
In the upcoming Blender
2.79, PointerProperty will support pointing to datablocks (D113).

(from https://developer.blender.org/T51452)

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Does Blender python run slower when strictly typing?
I have a code snippet without strict data-typing:
def get_color(bm, materials, i):
    m = materials[bm.faces[i].material_index]
    if m[2]:
        # either direct color
        return m[2]
    else:
        # or the color in the image texture
        uv = bm.faces[i].loops[0][bm.loops.layers.uv[0]].uv
        px = int((m[3][0]-1) * uv.x)
        py = int((m[3][1]-1) * uv.y)
        pixel = 4 * (m[3][0] * py + px)
        return Color((round(m[4][pixel]*255), round(m[4][pixel+1]*255), round(m[4][pixel+2]*255)))

And then transformed it to use strict data-typing which gives me the advantage to better understand and read the code. But I noticed (I could be wrong) that Blender python runs slightly slower (measured with time.time()) than regular python without the Blender UI. The code got longer as well which I thought might affect performance. Based on my research it should not really do any difference in performance. Is this even recommended?
def get_color(bm: BMesh, materials: List[Tuple], i: int) -> Color:
    faces: BMFaceSeq = bm.faces
    face: BMFace = faces[i]
    idx: int = face.material_index
    if idx < 0:
        return Color(0, 0, 0, 255)

    m: Tuple = materials[idx] # (1, <bpy_struct, Material("Material.008") at 0x0000025E3679BA08, evaluated>, Color((0.0, 204.0, 0.0)), None, None)
    color: Color = m[2]
    coords: bpy_types.bpy_prop_array = m[3]
    colors: Tuple[float, ...] = m[4]
    if coords:
        elem_seq: BMElemSeq = face.loops
        loop: BMLoop = elem_seq[0]
        loop_seq: BMLoopSeq = bm.loops
        layers: BMLayerAccessLoop = loop_seq.layers
        collection: BMLayerCollection = layers.uv
        item: BMLayerItem = collection[0]
        luv: BMLoopUV = loop[item]
        uv: Vector = luv.uv
        px: int = int((coords[0]-1) * uv.x)
        py: int = int((coords[1]-1) * uv.y)
        pixel = 4 * (coords[0] * py + px)
        return Color((round(colors[pixel]*255), round(colors[pixel+1]*255), round(colors[pixel+2]*255)))
    return color

You can test it it with timeit. See https://stackoverflow.com/questions/7370801/how-do-i-measure-elapsed-time-in-python. I suspect if there is a difference, it's probably not perceivable in your example. But testing it is a good idea, since you will know how it is with your specific code, hardware and setup. You probably want to repeat the stuff that executes really fast in loop a few thousand times for it to be more accurate and repeat the test itself a few times.

yeah i did the time.time() to measure and that's where i saw a slight difference that's why i wanted to get more input if it is even advisable to code like that. i noticed it makes the code longer as well which i thought may impact performance.

I am sure people would test it if you shared code that is possible to copy-paste and  run.  Having to write a lot of stuff around the snippet shared to be able to test it is probably an obstacle.

The gist of the discussion revolves around the usage of strictly-typed Python and its potential impact, rather than delving into specific code examples. The provided code was merely an illustration. If you're knowledgeable in this area, you should likely already have an answer without needing to test any specific script. No offense intended.

No, you are right - I am not knowledgeable in the area. I am just familiar with Blender's Python API and I only know it's not particularly common to code like this with Blender's Python API. It is a good question.

It shouldn't, no. Your snippets are different in ways other than typing though. You should compare the same code, just with types stripped out.

yes you're right i totally forgot i modified the code because i can't do the typing without breaking the lines apart. thank you guys for your inputs! :)


text:
Mesh To Volume node rounding concave corners causes unwanted excess blocks
Maybe I'm looking for a workaround if it cannot be solved. Here's the original mesh I want to remesh with my Geo nodes setup. PS: I cannot use the Remesh modifier because it does not support complex shaders and textures. Shaders/textures will be gone after remesh modifier use.

But the mesh to volume node causes problems at concave corners, creating some rounding/beveling. Notice there is some volume rounding at the encircle red corner.

which is evident at the volume to mesh. Notice that all other convex corners look fine and consistent

and this is the end result with excess blocks created at the concave corner. And even a few removed missing blocks makes it worst.

This is my Geo Nodes setup. I tried messing around with the Density, Interior band width, resolution (size or amount), resolution (grid, amount, size), threshold, adaptive but I can't find a solution to this. Even with the voxel size is very low it still has the "rounding" effect at concave corner.

Expected result. Is this possible? How can I fix my problem. What am I doing wrong. Is there a workaround to this?? :(

I have an update it's weird because when I extrude opposite direction it no problem. Is this a bug in Mesh to Volume?

The problem is the Mesh to Volume node. Definitely inconsistencies in the way concave corners are handled. Looks like a bug or perhaps a limitation? I have logged a bug report for this please see https://projects.blender.org/blender/blender/issues/127129

Unfortunately this cannot be fixed. It is a limitation.


text:
Why are rigid bodies not interacting?
First of all, here's the blend file:

I'm trying to recreate the "flip table" animation: I have two rigid bodies (three counting the floor), a table and a cube.
The table is resting on the floor, it is simply put a flat parallelepiped with four slim as the legs. I've set it as an 'active' object (50kg) and the shape is a 'mesh', since I want to interact with the zone between the legs.
Then there's the cube which it is the one interacting with the table. I want it to hit the border in order to give it a rotation, like somebody actually "flipping" it. It is an 'active animated' object (1kg), with shape 'convex hull'.
I set the cube as being under the edge of the table at t=0, and sometime later I shift it on the z-direction until it surpasses it. I insert both framekeys, start the simulation, and... nothing.
The two objects don't interact. The cube passes through the table and each goes its own way.
Does anybody have any idea about what's happening? What do I have to do in order for the two objects to interact? I will post further details if needed, on the file there is my simulation btw.
Bonus question: I tried to raise the table and rotate it to see how it would fall on the floor... and it kinda bounces off. What's causing it? How can I make it behave like a real heavy table?
For the rotated table, here's the blend:

I downloaded your file and tested couple things, and the problem seems to be the table having weird scale (5.483, 5.483, 0.369). By applying the scale (In object mode, select the table, hit Ctrl+A and select Scale) the physics start to work as expected in both files.
I also noticed your some other issues with your table which might cause problems later (the board has at four meshes overlapping and the legs have inverted normals), but those are not in scope of this question.

Well I'll be damned! It works! Thanks you so much :) by the way, do I have to apply the scale eveytime I S-deform something, in order to make it work? And G-shift, R-rotate and such?

You have to apply the scale every time you scale the object in Object mode. Changes in done in Edit mode do not need that.

Got it, I'll keep it in mind for the next times. Thanks again.

That was very interesting, thanks cegaton. In fact now it behaves normally :)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Headband not following rest of head
Sorry for the poor title as well as any issues with terminology as I am new to blender. Basically I have a character with a headband (which is separate from the rest of the body mesh but same object) and a head bone:

However when I rotate the bone, the headband is displaced on the character's head:

I have tried selecting the headband part of the mesh with L in edit mode, then using the vertex groups window to assign this to the head bone. Any help would be awesome!
Here is the file:

what do you mean by "However when I rotate the bone, the headband is displaced on the character's head"?

Upload your file.

@Leander my apologies, I have uploaded it.

@Tak I've uploaded a gif that hopefully illustrates. I've also added the blend file itself.

@AndyPerlitch There must be a vertex group on the headband which still influences it. Can you test if a) there is only one vertex group with the name of your head bone on the headband mesh, and b) if not, what the weights in the other groups are. If weights are very small, they still have an influence, but in the viewport they'd be drawn in red still

@AndyPerlitch Thanks for uploading the file, it was helpful to find out the cause of your problem, answer provided with screenshots and an updated blend file :)

The problem is that although the head and head bands are assigned to the same vertexgroup they are not connected together, which results in giving them different "visual" effect when rotating the parent bone even though they have the same weight.
To fix this you will connect them. To do so, go to the Head Vertex Group, then select it. Then switch to Vertex Selection instead of Face selection. Then go to Mesh menu -> Vertices -> Connect Vertices. And voila it's done.
Steps:

Result:

Updated Blend file:

@AndyPerlitch you are welcome! Well, I'll let you know when I visit the US and be near Silicone Valley to meet and play with the Frisbee and your dog :)

drop me a line, I'll show you around! :-D

@AndyPerlitch Awesome! I will :)


text:
Bone on one side distorts the other side of the mesh
I've been having some problems with deformities whilst posing the limbs on my T. rex model. The problem occurs on the thigh and all of the arm bones.
Not posed
Posed thigh
Whenever I rotate the left thigh bone it causes areas of the mesh on the right side of the model to distort and follow the bone.
Leg angled to side
Rotating left arm joint distorts right
This happens with the arms and clavicle bones. The bones are mirrored and both thigh bones are parented to the pelvis bone in between and slightly to the front.
Any help would be greatly appreciated as this problem has troubled us for weeks.

This is a common question here at Blender Stack Exchange (BSE).  Nothing New.  When you look at this web page on the right side is a [related] column which has similar questions.  Please search here at BSE to find a similar question to yours.  You should show images of weight painting in your image because they likely matter most.  You may need a video tutorial series.   The following is part of a series .... https://www.youtube.com/watch?v=GvG39bGEsKI&list=PLda3VoSoc_TR7X7wfblBGiRz-bvhKpGkS&index=35   .  um oh .. PS I forgot to say Bienvenidos at BSE.

Make sure you have named the left and right bones correctly. Have you applied mirror modifier? Often auto-weights don't get everything perfect, just tab into weight painting mode and fix them.

there is a mirror modifier in place and the model is weight painted. the problem is that the bones on the left affect both the vertz on the left and the right side of he mesh. I'll look into the  links you posted

ok the bones are named right however

http://i.imgur.com/aTLtA7E.png

This issue likely is occurring because vertices on one side have been assigned to bones on the opposite side.
When using a mirror modifier, this issue can be easily rectified by simply un-assigning all vertices from the right side—this can be done manually through the Vertex Groups area in the object data panel (just select all vertices in edit mode and click "remove" for all bone-related vertex groups whose name ends in ".r")
Another option (when using the mirror modifier) is to go through each of the right-side bones and subtract the weight from the left side. (However, when using a mirror modifier this will NOT work by selecting the left-side bones and removing weight from the right.)
If the mirror modifier is not in use, just do the second process on both sides—i.e. remove from the right bones vertices on the left, and remove from the left bones vertices on the right.

From your 3rd and 4th image I see some meshes come out with your thing bone.So You can easily do this with weight painting. just select Your Armature -> select your body with shift and then press Ctrl+Tab. In weight painting mode you can paint you modal mesh with respective bone. You can understand this with weighting tutorial. just search on google for wight painting blender 2.7.
And one more thing If you have not applied your mirror modifier to mesh then do this first. If mirror modifier not applied then when you move one side bone other side mesh will also move same.

there is a mirror modifier in place and the model is weight painted. the problem is that the bones on the left affect both the vertz on the left and the right side of he mesh

From your image I see that your right leg move with thing. bone so check that bone name is given perfect or not like thing.l and thing.r.

If this is perfect then From your image result I can say your modal is not properly weigh painted.  When your two legs or hand mesh near to body mesh or near to each other meshes and you apply automatic weight painting then it also affect near other hand or leg mesh. So go to weight painting and check that all leg parent bone weight painting and also child bone weight painting for this. I hope this solve your problem. And don`t forget to apply mirror modifier before start weight painting.

authors: Алексей Корякин


text:
Is it possible to create a custom object type with Python API?
I am writing an IO + editing tools addon for a very complicated model format (World of Warcraft WMO). Besides meshes, it is supposed to have a few specific object types. Is it somehow possible to add a new type of object to Blender with Python API and define custom rules of editing for it. I'd not mind using other solutions if possible.
Here is what I am trying to achieve:

Fog spheres. This object should basically represent a colored sphere with custom properties, that you can scale, move and rotate. Right now I am using a mesh sphere for that, but I do not need edit mode in it.
Water plane. Actually just a plane with static X and Y coords for vertices. Similar to what people often use for terrain in game engines. I need to be able to edit the Z coords of this plane, but block the editing of X and Y coords since you cannot change them. I also need to be able to mark specific faces with flags.
Doodad. Actually a reference to another object file. It should be a regular mesh object, however I need to block any changes that can be done to the mesh itself, since it is actually a different file. That includes blocking things like apply rotation, scale and other operators that can potentially change the mesh of the object.

Are these things anyhow possible to achieve with Blender Python?

No, object types are hard coded in Blender's C code.
Typically developers of add-ons use Empty types and attach custom properties to them.


text:
Separate mesh into separate batches with python
I am working on an export / import addon for a custom model file format which stores its geometry in the so-called "render batches", the structures aimed at optimizing geometry for effecient live OpenGL rendering. I am trying to convert "raw" geometry data from Blender to that system.
If you don't want to read the detailed explanation, skip to 'individual steps I need to do' part.
In short, each render batch is a sequence of faces (only vert and face index information is required) which are:
1) A loose separate part of geometry (island).
2) Share one material.
3) Represent the same batch type (3 batch types A, B and C are used for internal rendering purposes, I store them as vertex groups in Blender. C = no vertex group, B = vertex group Batch B (if not in A), A = vertex group Batch A.
UV map is handled per-vertex because there are essentially no loops.
My current workflow is using tons of operators and is roughly this:
1) Create a temporary object in python
2) Triangulate
3) Cut mesh by materials using an operator.
4) Cut mesh by UV islands (Seams From Islands (+ mark sharp) -> Edge Split)
5) Cut mesh by vertex groups.
There are two issues resulting from the fact that mesh is actually being cut:

Normals become sharp, where they are supposed to be smooth due to the cutting seam.
I am treating a piece of geometry with one material as one single batch. So, distant islands using the same material are becoming one batch, which kills the benefits of render batch optimization for rendering.

a) Is there a way to either separate the mesh correctly based on the rules I have specified above, and somehow preserve the original normals on export?
b) Or, alternatively, is there a way to non-intrusively create a list of these batches, again based on the said rules, without altering the mesh, and thus preserving the correct normals?
I know that the explanation may be ambiguous, so I created a visualization for the render batch system:

(1) Pieces of geometry are sharing the same material, but are not connected to each other. Should result into multiple batches for each island.
(2) Piece of geometry is sharing the same material (there is a little mistake on the picture. Mat2_Batch1 on the left instead), but is separated by different batch type vertex groups. Thus, 2 separate batches.
(3) Piece of geometry is sharing the same same material, geometry is connected, no batch vertex groups (assumed it is type C). Thus, 1 batch.
Individual steps I need to do
1) Get faces sharing same material (easy, done)
2) From the result of a previous step, find groups of faces separated by UV islands
3) Then same with different vertex group (we assume face is in vertex group if all 3 verts of it are in.)
4) Find individual (loose) groups of faces in the resulted sorted chunks of geometry.
Any help would be greatly appreciated, I am completely stuck on this.

Any links / examples  or information re the  "custom model file format"?

Sure.
https://wowdev.wiki/WMO#MOBA_chunk
This is the render batches chunks. It to points to corresponding vertex and face index arrays. Note, that array of face indices is flat and should be iterated by triplets to get faces (only triangles are possible). If something is still confusing, let me know. I know the way this format works very well.

Am I right to say that triangulate op does not change the vertices array? So same positions between the original mesh and the triangulated copy. If this is confirmed (I've rapidly looked at the source code and that seems to be the case, but..), you can retrieve the original normals from the original mesh, I think.

Also, you can have some ideas from this question. https://blender.stackexchange.com/questions/75332/how-to-find-the-number-of-loose-parts-with-python/75384#75384. Please in the provided answers, have a look at @batFINGER 's one (which is surely the fastest) and mine eventually in complement (other approach that can give you ideas too).

Yes, correct, triangulation does not change normals or vertices. And that is not the problem. The problem is actually splitting a mesh, because that changes normals, and transferring them is always a rough approximation based on vertex position (but we can't always guarantee that the correct loop will be chosen on transfer).

About normals, why splitting the original mesh is needed? Can't you identify/calculate subparts without actually separate them? About loose parts, the linked question above can help to do it. About materials, this can be easy (map by material without cutting anything). About UV islands, I don't know though.

Indeed, I want to avoid actual mesh splitting. It looks like I've just found a solution so far. Will need to implement it properly and run tests in the game engine. But by just selecting islands, it appears to be working. Have yet to do vertex groups too.
https://hastebin.com/gaguxufebi.py

Not sure you will get anywhere near the recursion limit. In this example for instance given a mesh  of 2 edge connected verts, (recursion => binary tree) there would need to be over pow(2, 700) vertices in the island.

A long strip of more than 900 faces connected to each other should be near the standard recursion limit of 1000 with my implementation, since it calls itself recursively for each connected face. In my case, splitting larger islands into smaller ones, not based on any rules is actually not bad. May even have a positive effect on FPS in the game. I will look at your implementation in detail too though.


text:
Objects appear deformed in Object mode but normal in Edit mode
At first I thought it was the mirror clipping causing it, but I deleted the modifier entirely and it wasn't fixed. Then i thought it might have been caused by "rogue" edges that were on the "empty" side of the objects, but deleting them didn't yield any result. Any ideas?
This is my very first time using Blender, or 3D modeling in general btw.

It looks like a shadow issue.

Please add a screenshot, it will greatly help you get an answer.

Check that you don't have any "shape key" active or configured.
check screenshot:


text:
Smoke Simulation does not appear in Eevee viewport
I was learning how to do smoke simulations today, but when I applied object -> quick smoke, and pressed play, no smoke could be seen coming out. I then tried baking the simulation, and it finally showed up, but only for a few frames. Now I want to remove the bake, and the manual tells me there is a button in the cache settings of the fluid simulation, called "free bake" which is not there.
If anyone could please tell me how I could:

Remove the bake of the smoke simulation and
see the smoke in the Eevee realtime viewport.

Update: I just deleted the fluid_cache folder and removed the bake, but when I try the smoke simulation, no smoke appears. Does this have something to do with my viewport settings?

Just found out through some extra searching that a new change was made in Blender 2.82 that removes the "live" smoke simulation in rendered view. We now have to bake the simulation everytime we want to see something different.
I found another thread about this problem:
Quick Liquid and Smoke doesn't work in viewport


text:
fabric textures messed up in Cycles even though preview seems fine
For some reason all my fabric textures come out messed up like this. I used textures from CC0textures.com and used the node wrangler add on to scale. I attached a picture of the final render. The wood floor, couch, pillows, and table are all messed up. The couch is also clipping the floor, even though I don't see that in lookdev mode. The left side seems perfectly fine, however. Does this have to do with the sun lamp that I used to light up the right? I lowered the max bounces on it from 1024 to 50. Do I need to scale the entire room up to fix the fabric problem? I also added a picture of my node setup for the glass.

I think I found the answer: I was using Lily's surface scraper and the displacement of the textures weren't scaled and were too large for the objects in my scene.


text:
What settings do I change to render an animation of 60 fps instead of 24 fps for video editing?
I rendered an animation at 24 fps, but I need it at 60 fps for rendering. At 60 fps, it's going to take around 6 hours, so I don't want to mess anything up. How do I change the fps without changing the video speed? Also, do I have to rebake my fluid sim? My current render is 240 frames with the step at 1 frame.

Time is a relative concept when it comes to video and framerates.
If you want a second of video you need as many frames as the framerate (time base) you are working on. For example: a single second at 24fps needs 24 frames.
If you generate 60, then you need to playback at 60fps to get that same second on the screen, or you need to play some frames and drop (ignore) others if playing back at 24fps.
If your goal is to have more frames to be able to stretch the playback and generate "slow motion" or speed ramps without having to interpolate frames, then render the animation at 60fps or higher and play back at 24 fps so that those 60 frames will play over two and a half seconds (roughly)
What is the difference between changing framerate and time remapping? you ask.
If you change the "framerate", you will generate more frames for every second of video. The playback speed will need to increase as well to keep a second still a second. Most video editing software (not blender's VSE) can deal with different timebase for elements on the timeline.
If you use the "time remapping" settings in blender you will be changing the global speed of the whole animation but keep the timebase (framerate). If you set Old to be 100 and and new to be 200 your animation will play back in more frames within the same framerate. A second of the original animation will occur over two seconds now, creating two seconds worth of frames. You will need to adjust the Frame Start and Frame End settings for the render to accommodate for this change.
The decision is yours on which one to use,but in either case you need to re-render and bake the simulations again.

For those who like videos instead of reading watch rendering your animatin in slow motion

Other related linds: https://blender.stackexchange.com/questions/86929/when-i-change-my-frame-rate-from-24-the-60-fps-the-particles-go-ultra-fast-and-a/86944#86944 and https://blender.stackexchange.com/questions/47427/how-can-i-modify-the-frame-rate-without-changing-overall-animation-speed/47429#47429

What you want to do is impossible.
If you render an animation at 24 fps, then the only way to make the video look natural (not sped up or slowed down), is to play them back at a rate of 24 images a second.
What you are trying to do is play them back at 60 fps, but you only generated enough images to play them back at 24 fps. This means speeding up is inevitable because you have to somehow be able to squeeze each image, which should last 1/24 of a second into lasting 1/60 of a second to achieve the higher framerate- and there is no setting in Blender (or anywhere else for that matter) that can magically generate more images.
So the ugly truth is if you really want a 60 fps animation, you will have to render everything again, and also stretch the animation timeline because if you don't, things will be sped up (because of the higher framerate, again). The fluid simulation will also need to be rebaked.
But then again, a 60 fps video is highly undesirable and you might want to rethink trying to make an animation that smooth. Social media platforms will limit the framerate to 30 fps, and most people can't even tell the difference between any good framerate unless they really try to look at it.
So the conclusion is that, if you really want a high framerate, then yes, you will have to change a lot of things. But other than that, everything is fine. Frame rate should not be of your priority, many more people care about how the video looks instead rather than how smooth it is.

Thanks for the help! I only want 60 fps because my friend will edit it, and he's going to slow some parts down. Do you think that I could increase the frame rate by time remapping it? I can make the animation slower, which will ultimately add more frames. At least I hope that's how it works

@Ryan Time remapping will not change the frame rate. However, it does speed up the animation without changing the frame rate. This could be useful because it can counteract the speedup when switching to 60 fps so you don't need to reposition graph editor control points. In time remapping, the ratio Old/New will be the amount it will speed up, so setting them to 100/50 will double the animation speed. If you want to switch from 24 to 60 fps, set the framerate to 60 fps and time remapping values to 24/60 to retain original animation speed.

Simple set frame rate to 60
Goto dopesheet goto first frame select everything in the dopesheet hit s to scale it all to a length of
n frames / 24 * 60
It's also possible to scale using graph editor like this. I use scaling often in those editors to make movement smoother etc.
This way you could do slomow as well

That works fine for keyframed animation, but for fluid and physics simulations there might not be any keyframes.

It should not matter in theory but you might check as wel de fluid settings to cope with it. They have some speed settings as well. More samples there woul likely create small differences. Personally mantaflow might be more difficult here as the old one

This is the correct answer. It's ridiculous that animation software is still based on frames, honestly. Time should be the only factor against which key frames are added. That way, the number of frames in a second is irrelevant and can be considered equivalent to the "resolution" of the animation.


text:
My grab tool (sculptor mode) won't move horizontally any more

My grab tool (sculptor mode) won't move horizontally any more, is there any settings that I accidentally changed?

Hello and welcome. Please provide some context and explanation about your issue, don't just post, images, videos or links to external sites. See What is the problem with posting an image or link and asking “How do I do this?”

Have you tried to press and release the Ctrl key? Looks like it's snapping to the axis. I had 2 or 3 times the situation that Blender thought for some reason I was pressing the Ctrl key - which I was not. That changed the mouse wheel function. After a hit on the key it worked again normally.

pressing Ctrl key and releasing did not work.


text:
NurbsPath and Beveling a BezierCircle
Good evening,
I am fairly new to Blender. I have been unsuccessfully attempting to create a curved cylinder (i.e. a pipe) to follow a curve path. When I go to Geometry > Bevel > Object > Bezier Circle (applying it, as all the videos and guides say to do) I end up with the image below. For some reason whenever I move the vertex point(?) it does not move the piping around like all the video guides do. Instead, it extrudes the object and creates the monstrosity you see in the image.
Far left object is the path with the Bezier Circle applied. (Path next to it is pre-bevel application).
As you can see in the path (far right) with the bezier circle applied, it works fine, so long as I do not attempt to move the pivot points [vertex point?].
Basically the goal is to create a path that I can then apply the object bevel (circle) to it. Creating what looks like a pipe.

Hey there and welcome, it helps if you use certain keywords, but maybe this does solve your problem why-cant-i-create-a-pipe-from-this-curve?

I tried that method, 1: the thread you provided uses the old blender. 2: my circle and path (NurbsPath) is flat on the Z axis. As you can see in picture two, when I move the bottom point to the left it extrudes the circle on the long end, rather than turning the circle along the path.

While i hoped it would have a solution for you, situations can be different. That said, would it be possible to share the file, you can use Blend Exchange. It may help to take a closer look. Also just in case, you can remove all that is not related to the problem to make the file smaller, please.

Absolutely, thank you for taking the time to help me. I went ahead and added the Blender file with the objects in my screenshots for your review at the end of my original post. Any help is appreciated.

Checked out the file and was first rather surprised by how fast any slight movement of a point from the curves made a mess. Then if you think about it, small movements resulting in a very big mess very fast ... there is something wrong with the translation of action and reaction  .. yes the scale.
I checked and pretty much all curves even the circle (responsible for the size of the pipe diameter) had it's scale not applied. Or shall i rather say it was scaled in object mode, which is something pretty much everyone does and regrets later, more so when working with curves.
This:

Shows that the circle was scaled and the new scale was not applied, which for a straight path does not result in anything other then a thinner pipe.
Fixing this:

Press Ctrl+A -> "Scale"
Go in edit mode
Afterwards open the Sidebar with N and find the Transform panel, usually the top one.
Under Mean Radius it should be standing "1", but due to the previous steps it got changed to "4.123", set that back to "1" like so:

Circle profile fixed.

Now to the curves/paths.
There are a few things that need adjustments:

First it looks like this

The scale needs to be corrected, BUT here you need to be careful, as to not change the scale with the bevel object included!
Thus in the options, remove the Bevel Object resulting in this:

Now there are 2 things marked, rotation and scale. While we could just apply those, it would nip us in the butt afterwards, so believe me and do the following.
We have to leave the rotation alone! Applying it would mess with the sizes of the path internally.
And regarding the scale we have to do it manually.
Go in the Transform panel and change the value of the X-scale to 1. Just keep in mind it was 25.
After adjusting the scale the path will become very short 1/25th to be precise, so go in edit mode and press A selecting all elements, followed by S and then type in 25 followed by Enter. Resulting in the old length, without all the trouble.

Here is what would have happened if we had applied the scale or rotation or both, changing the path dimensions, thus causing more things to fix:

I know all can be fixed somehow, but let's fix to not have to fix the results, if you know what i mean ;)

Here how it does look now:

Now there are some settings you need to deactivate that only show their effect in edit mode, assuming that you want to have the pipe start and end with the path/curve and not generate a circle (endpoint connects to the startpoint, responsible for some of the weird shapes).

Deactivate the Cyclic U and Bezier U to get something like this:

As you can see the path is having it's normals along it's entire length, means with the Bezier circle applied as Bevel Object you now get something like this:

With this all done you can now move the points and get the expected results like shown here:

Ok long story short, scale is very important to pay attention to, if you want to adjust the sizes, it's recommended to do so in edit mode. Rotations i would also consider to adjust edit mode, as it can also cause issues, especially with the profile curve.
The other curves may have one or more of the same issues, but i believe if you followed the steps you should be able to handle those yourself now. Just beware, there you need to scale only in one direction.
When done, it should look like this:

All the steps you could have saved yourself by starting over with scale in mind, but since we are supposed to learn from mistakes, i believe it's good to know how to fix things and understand what caused the problem along the way.
Happy Blending.

Amazing, thank you sir. I did not understand applying the scale. Thank you for this very detailed explanation. The shortcuts for Blender still allude me. I will have to find/create a cheatsheet.


text:
Fire with transparency shown in render but when saved as PNG or OpenEXR is different
I have tried this thread. I couldn't find any other threads on BSE about this problem. The fire with transparency doesn't work. I mean I can see it in the output:

But when saving (Image > Save As) as PNG or OpenEXR or TIFF or any other format it always gets clipped on areas where just the emissive flame is visible with no background:

When importing EXR into Blender I get:

The aforementioned thread claims to use EXR as solution but it still gets clipped when importing into Blender. The colors are even worse. What is the workaround to this? I don't want to save with black background.
UPDATE: The duplicated thread is not correct as it was not Blender specific solution. The correct answer is explained pixel perfect solution here: https://www.youtube.com/watch?v=tmb5HRU1cUo

The thread you linked is the correct answer, and saving as OpenEXR should work. When you say it doesn’t, what software are you viewing this EXR with and what are you trying to do with it? It’s possible the software you’re taking the EXR to is not handling the alpha channel properly

@JtheNinja I imported the EXR back into Blender 4.3 because I want to render the EXR image sequence on top of another video clip so it needs to be transparent but still same issue of clipping, and the colors are even worse.

Exr should work, so you could upload the file, to see what went wrong. Here is a possible workaround: https://blender.stackexchange.com/questions/328027/transparent-pngs-not-exporting-properly/328033#328033

@joshsanfelici no EXR will not work. The correct answer is explained here: :) https://www.youtube.com/watch?v=tmb5HRU1cUo He also experienced the same thing as me that EXR does not work.

@MeganLove I agree that simply drag and drop the Exr doesn't work, but exr contains all data needed to correctly compose the glare + transparency effect, and it's the standard professional, widely used, because it carries all data into a single file (even when using single layer format), and it stores scene color in a linear fashion, which is better for color grading, but it has to be correctly handled.

I know the topic is complex, and there are many misleading answers (like the one linked as duplicate), but if you see the link I proposed, you will notice that it's matematically identical to the YouTube video you linked. Going to exr is a step further because of single file and Linear Colors workflow.

@joshsanfelici Thank you for clarifying this I will dig deeper then :)

BTW, if you drag and drop an exr into Blender compositor and use alpha over node, it works right out of the box (not the case in VSE).


text:
How can I pass an object (like a bmesh) to an operator or should I not do that?
I have an operator that creates a certain mesh but I want to keep things modular so I separated each operation into its own operator. Like for example, I have an operator that removes vertices that don't have any edges linked to them, and I can reuse that in other operators. My main operator calls these 5 operators:
class MyTaskOperator(bpy.types.Operator):
    def execute(self, context):
        bpy.ops.mesh.do_something_1()
        bpy.ops.mesh.do_something_2()
        bpy.ops.mesh.do_something_3()
        bpy.ops.mesh.do_something_4()
        bpy.ops.mesh.do_something_5()

The thing is each operator instantiates a bmesh and then does a bm.free(). Is that okay? Or should I instantiate the bm beforehand and pass it as reference/pointer to each of these operators and then do the bm.free() at the end of the main operator? like this:
class MyTaskOperator(bpy.types.Operator):
    def execute(self, context):
        bm = bmesh()
        bpy.ops.mesh.do_something_1(bm)
        bpy.ops.mesh.do_something_2(bm)
        bpy.ops.mesh.do_something_3(bm)
        bpy.ops.mesh.do_something_4(bm)
        bpy.ops.mesh.do_something_5(bm)
        bm.free()

But to do this I would need a bpy.props.BMeshProperty? But that doesn't exist so it's not possible to pass a bmesh property. You can only pass StringProperty, FloatProperty, BoolProperty, and PointerProperty (which are just used to organize properties and minimize namespace pollution)
which brings me also to another point why I want to avoid instantiating the object in the execute function because for example I have
def execute(self, context: bpy_types.Context) -> set[str]:
        # function gets called every time I tweak something
        # in the Adjust Last Operation panel so it keeps
        # instantiating these objects multiple times.
        image = bpy.data.images.get(self.image_name)
        mesh = bpy.data.meshes.new(image.name)
        plane = bpy.data.objects.new(image.name, mesh)
        context.collection.objects.link(plane)
        mesh = plane.data
        bm = bmesh.new()

and whenever I change or tweak something in the Adjust Last Operation panel, doesn't this keep calling the execute function which keeps instantiating several new objects into memory every time I, for example, slide a FloatProperty scroller and it updates the mesh on the fly? Isn't that not memory friendly than if I first instantiated all these objects only once before calling the operator and passed these objects into the operator?

Blender operator designed for shortcuts, and not all variable types can be passed.
Avoid running bpy.ops inside bpy.ops.
Here's an example to reused the 3 operator:
import bpy, bmesh
from bpy.types import Operator

def poll_edit_mesh(context):
    if context.area.type != "VIEW_3D": return False
    ob = context.object
    if not hasattr(ob, "mode") or ob.mode != "EDIT": False
    if ob.type != "MESH": return False
    return True

def get_bm(ob): return bmesh.from_edit_mesh(ob.data)
def bm_free_and_update(bm, ob):
    bm.free()
    ob.data.update()

def ops_A(bm):
    ..
def ops_B(bm):
    ..
def ops_main(bm):
    ops_A(bm)
    ops_B(bm)
    ..

class OpsMain(Operator):
    bl_idname = "mesh.ops_main"
    bl_label = "Ops Main"

    @classmethod
    def poll(cls, context): return poll_edit_mesh(context)

    def execute(self, context):
        bm = get_bm(context.object)
        ops_main(bm)
        bm_free_and_update(bm, context.object)
        return {'FINISHED'}

class OpsA(Operator):
    bl_idname = "mesh.ops_A"
    bl_label = "Ops A"

    @classmethod
    def poll(cls, context): return poll_edit_mesh(context)

    def execute(self, context):
        bm = get_bm(context.object)
        ops_A(bm)
        bm_free_and_update(bm, context.object)
        return {'FINISHED'}

class OpsB(Operator):
    bl_idname = "mesh.ops_B"
    bl_label = "Ops B"

    @classmethod
    def poll(cls, context): return poll_edit_mesh(context)

    def execute(self, context):
        bm = get_bm(context.object)
        ops_B(bm)
        bm_free_and_update(bm, context.object)
        return {'FINISHED'}

def register():
    ..

def unregister():
    ..

if __name__ == "__main__":
    register()

    # test call
    with bpy.context.temp_override(active_object=bpy.data.objects["Cube"]):
        bpy.ops.mesh.ops_main()

Use inheritance
import bpy, bmesh
from bpy.types import Operator

def get_bm(ob): return bmesh.from_edit_mesh(ob.data)
def bm_free_and_update(bm, ob):
    bm.free()
    ob.data.update()

def ops_A(bm):
    ..
def ops_B(bm):
    ..
def ops_main(bm):
    ops_A(bm)
    ops_B(bm)
    ..

class PollEditMesh(Operator):
    __slots__ = ()

    func = None

    @classmethod
    def poll(cls, context):
        if context.area.type != "VIEW_3D": return False
        ob = context.object
        if not hasattr(ob, "mode") or ob.mode != "EDIT": False
        if ob.type != "MESH": return False
        return True

    def execute(self, context):
        bm = get_bm(context.object)
        self.__class__.func(bm)
        bm_free_and_update(bm, context.object)
        return {'FINISHED'}

class OpsMain(PollEditMesh):
    bl_idname = "mesh.ops_main"
    bl_label = "Ops Main"

    func = ops_main

class OpsA(PollEditMesh):
    bl_idname = "mesh.ops_A"
    bl_label = "Ops A"

    func = ops_A

class OpsB(PollEditMesh):
    bl_idname = "mesh.ops_B"
    bl_label = "Ops B"

    func = ops_B

def register():
    ..

def unregister():
    ..

if __name__ == "__main__":
    register()

    # test call
    with bpy.context.temp_override(active_object=bpy.data.objects["Cube"]):
        bpy.ops.mesh.ops_main()

Hi thank you for sharing your answer! I will check it out


text:
Set active UV layer in python?
I'd like to set which UV map is selected in Properties > Object Data > UV Maps. By "selected", I'm referring to the one highlighted, not the one with the camera icon enabled.
I tried
bpy.context.object.data.uv_layers.active = bpy.context.object.data.uv_layers['AO']

But uv_layers.active remained at the previous value and there was no error message.
How can I set the active UV map from python?

This technique also comes in handy when you are trying to prepare a mesh for texture baking, since the active UV layer seems to be important to the baking process.

blender 2.93:
bpy.context.object.data.uv_layers['AO'].active = True


text:
How to simulate cloth on a fast moving character?
I have a character which moves and jumps around rather quickly. I'd like to add a cloth simulate cape. However it stretches and snaps around into itself due to the character's fast movements, making a big mess.
What are some ways to get a more realistic behavior when adding cloth simulated clothes to fast moving characters?

I tried slowing the characters animation to half speed. The cape then works better, but I can't find a way to speed up the baked simulation..

"snaps around into itself"
is self-collision enabled?

@VinceScalia Yes.

rise the speed of simulation in scene->rigid body world->speed

@Chebhou anything there does not affect cloth..

Stretch the animation to use more frames, then speed up when editing the final video?

Fast dynamic movement is often a problem for Cloth Solvers/Simulators. Extremely fast dynamic movement such as this requires a much more precise simulation: this means that you have to increase the Simulation "Steps" Per Frame parameter to the extreme. This will slow down your simulation time significantly (hours instead of minutes). However, you will get a more precise/correct simulation as a result.
If you cannot wait the numerous hours it takes to simulate a cloth simulation with high steps per frame, then consider reducing the subdivision on your 2D mesh/plane. In this way, it will simulate faster due to less mass/particles to simulate. Note: this will help you gain simulation speed, as you also sacrifice realism.
Finally, If you've tried the highest "Steps" possible and it still isn't giving you sufficient correctness/stability for the simulation. Then you might consider using a Cloth Solver/Simulator that uses Implicit Solvers (Witkin, Baraff 1998) as opposed to Explicit Solver (I suspect that the Blender's cloth solver is using an Explicit Solver).
Reference for Witkin, Barraf 1998: http://www.cs.cmu.edu/~baraff/papers/sig98.pdf


text:
Is it possible to render AO with the OpenGL render?
Is it possible to render AO with the openGL render?
I know there is a technique called SSAO which is used in some video games, so it should be possible.
How can I achieve this?

That would be really cool. Why can't Blender look like Crysis?

This can be done in the game engine in realtime.

@iKlsR How? And can it be used for rendering an animation?

http://devlog-martinsh.blogspot.com/2011/10/nicer-ssao.html

@iKlsR That shader looks like this for some reason :/

I have come up with a hack to fake AO in the viewport using negative lamps.

The way this works is with a negative point lamp parented at the center of each cube, and an array of negative point lamps below the floor plane:

For the floor it would be more ideal to use an area lamp, however these are only supported in the BGE candy branch.
The world is set to Paper with a pure white Horizon Color. The Ambient color is also set to white.
GLSL shading and Only Render are also enabled.
Blendfile


text:
Is it possible to make a plane out of meta objects?
Yes, I know, Add > Metaball > Plane.
But how can I make a large plane?
Scaling it affects all meta objects in the scene.
I thought of connecting a bunch of meta planes together, however this isn't a perfect solution as it's a little bumpy (and if you need a really big plane it won't help your framerate)

How can I do this?

Plane meta-elements have an X and Y Size you can edit in the Properties editor > Object Data > Active Element:

it looks like this is what you are trying to achieve.

Where in the properties editor?

@MikePan Sorry, I meant where in the properties editor? I looked in the meta object panel, but there is nothing of the sort there.

Sorry I misread. You need to have the metaplane selected in edit mode.


text:
thickness dependent transparency
I am using a transparent material but it seems that I only have a transparent surface. How can I get the result that a thinner part of my object is more transparent than a thicker part. I now the answer may be simple but I tried a lot of options but there are simly too many for trial and error. Also I don't find anything like that in the questions. I am using eevee.
I tried the solution with the principal volume and I cranked up the volumetrics samples. The effect is weird. See the second picture.

This happens for all the volume shaders. The right object is a cylinder in reality, the left one is a sphere. In a third image I show the shader setting that I have used.

Hello :). Please add an image of your material nodes. This can depend on how you're achieving transparency.

Thanks for the suggestion. I have added the node picture. The volume settings do not seem to have any influence.

Did you try to add some volume shader?

Hi :). You connected surface shader (Principled BSDF) into volume input. That won't work well. Are you trying to achieve smoke?

I tried (Volume absorption). It gets me a weird effect. Although I have a cylinder I get a kind of square cushion with some wavyness. I have no idea where this is coming from.

I tried various connections. I don't want to achieve smoke. I need a coloured particle to pass through some semitransparent stuff. Depending on the depth the visibility should be better or worse. So i need some absorption in the volume which becomes large over distance.

@Bruno To tell exactly what I mean: I do not need something which becomes opaque when thick. I need something like tinted glass. Red glass will be darker (or seem darker) but still transparent when thick and lighter when thin. When it is very thin it will be almost invisible. That's what I need. Maybe I was not really clear about it before.

can you find any photo or illustration example?

Unfortunately I can't. What I am trying to model is a particle in a magnetic field of varying strength. To explain: I am a prof. for physics and due to Covid I now have to do my lecture online. So it is nothing real that I want to show. By the degree of transparency I want to indicate the strength of the magnetic field. But I often need this kind of effect and I guess it should be normal that a tick coloured pane lets less light through than a thin one. In reality cloured smoke would probably be the closest thing because in glass you always have the index of refraction coming into play.

You can use Principled Volume for that.

Use the Density value to adjust the strength
Larger volumes obscure objects more
For Eevee, crank up the samples in  Render Tab > Volumetrics.

Thanks for the reply. I tried the volume shaders (wanted to post this but the website just had an error. They give the strange result you can see in the image. The internal structure of the result even seems to change with time. Weird.

Just checked because you had set the material output to All and I had used Eevee. Doesn't make a difference.

@GeorgSchmidt Eevee doesn't support volumes with shapes other than a cuboid. It currently uses the bounding box of the objects, see: https://blender.stackexchange.com/questions/141443/why-doesnt-volumetric-follow-the-shape-of-mesh-in-eevee

Thanks, that seems to be the point. I switched to cycles and now it works. Thanks to all of you.


text:
Multiple small glitches when beveling complex meshes
I have a repeated problem with beveling complex meshes using the respective modifier, even if all what I do is to combine off-the-shelf geometric primitives with off-the-shelf modifiers, without any individual vertex-level manipulations. The effect looks often like that:

I tried to change the bevel modifier's many options, but the effect is that either the bevel is gone completely or the glitches become even larger.
Here is a link to the model

To work around this problem, I finally replaced the second bevel with a lattice and it even gave some more control on the shape.

You have four boolean modifiers before your last bevel modifier. Those are notorious for creating funky meshes afterward, which is what is making your last bevel modifier go nuts. It's not working on clean geometry which is causing those artifacts.
Before any bevel I would do the booleans and apply these modifiers and clean up the resulting mesh, then add bevel. Check here: Bevel unexpected result
You could removed the bevels and do that in Cycles with the Bevel Node as well, but this isn't always ideal for fine control. https://docs.blender.org/manual/en/latest/render/shader_nodes/input/bevel.html

@Leander beat me to it!

So if it is Blender which makes the meshes funky, why no "fix the mesh" modifier, even at the cost of completely redoing the mesh? It would substantially increase the functionality and there are many mesh construction algorithms. Applying modifiers is destructive and the mesh to fix manually is huge.

Every 3d program, not just Blender, will run into similar issues. There are always workarounds, each having its own pros and cons. There are many efforts to make a "fix the mesh" function and you're free to try a lot of them. Generally "fix the mesh" is referred to remesh/retopology and there are entire courses on the subject because of its importance in the 3d world. My suggestion is to fix the mesh by hand first, remove your bevel modifiers and apply the booleans. Then look at the resulting mesh, you'll notice your last boolean is not cutting correctly because of how you have it setup.

The glitches are caused by overlapping vertices. The only solution is proper topology, supporting the bevel.
If we examine the effect of the bevel modifier on your topology, we can see the vertices are badly positioned and the bevel quickly creates overlapping faces.

Position your edges parallel to each other and assert that the edges have a minimum length.
(In your file I had to apply previous modifiers.)

When you enable the Clamp option in the bevel modifier, the bevel modifier will determine how much it can bevel before vertices/edges overlap. However, if there are dense parts in your mesh this value will be very small and result in a tiny amount of bevel. This question shows that a solution would be to split the mesh into different parts, or use bevel weights in that case.

If you model geometry, especially using n-gons, be wary of the spacing of the edges and the topology. If you add a support loop (simply inset and scale), the first bevel modifier will work fine.

What I did was to combine off-the-shelf simple shapes with off-the-shelf modifiers. Why are the vertices badly positioned? Wasn't it Blender which dit it? Can it be corrected without applying the modifiers?

Sure, there are modifiers like Remesh or Decimate. You can take a look at my added example to see how you could change the topology for the first bevel modifier.

Why when I try make insets like you did, the new edges want to be perpendicular to the face border, and in effect cross one another?

Remesh goes via rasterization, produces huge meshes even at low quality, other apps cannot handle them. I do not know why but decimate introduced even more problems.

I have read elsewhere, that the fine inset from your example is called "non colliding" and can be installed with an unprecised plugin. Is it true?

So I applied the insets to an extend possible, and now a new problem has shown, the same as here https://www.reddit.com/r/blenderhelp/comments/c40js1/difference_modifier_makes_the_object_hollow_info/ the carving flickers solid/hollow when moved a bit, unfortunately where I want it it decides to be hollow. Moreover, the 1st bevel is ok now but the 2nd is even worse.

I'm not sure, if I can answer your questions. (1) In my topology example the "inset" (extruded & scaled) edges are planar and make no difference to the shape, but the new edges pointing to the center tell the bevel in which direction the new geometry should flow. (Don't know a name except planar, and I don't know automatic tools to generate them.) (2) I wouldn't recommend remesh/decimate for your problem, those were just the only reconstructive modifiers which I remembered.

(3) Flickering booleans are well known. If possible, move the geometry a tiny amount, or use a different topology, where no edges/vertices of the cutting and the target geometry overlap. (E.g. You could make a sphere with 37 rings instead of 36 and then there would be no vertices in the center.)


text:
Bevel modifier stops to work for diagonal faces
Here the bevel modifier works well:

But moving the selected edge, which would perfectly work for a non-beveled shape, makes the bevel progressively enlarge one of its curves, even if the mathematics say that the enlargement should be much smaller:

The object is symmetric towards a YZ plane. The bevel has options loop slide/angle/arc/shape/grid fill. With other options, as far as I tested, it works similarly or worse.
Is it possible to have the shape well-beveled in Blender 2.82?

Welcome to Blender Stack Exchange!
There are a couple of things to try here.
First, select everything in edit mode and press ShiftN to recalculate the normals. Sometimes Blender gets the direction the vertices are facing confused, and this causes issue with beveling.
Second, try and get rid of the 'ngons', aka faces with more than 4 vertices. Beveling ngons is always a bit risky, and when you start moving things around it's not uncommon to see issues pop up. Insetting the ngons with I is a possible way to get some nice quads along the edge of your bevel.

I have found that the bevel doesn't work just for any mesh complex enough which I have used. I recalculated normals, removed duplicate vertices. Applying I made either nothing or even more problems. Can it be, Blender's bevel algorithm is good only for simple meshes, otherwise it just fails?

Bevel usually works pretty well, aside form what I mentioned. Are you able to upload your file? Then I can take a look. You can upload files here: https://blend-exchange.giantcowfilms.com/ Then edit your question and add the link.

Yes thank you, but can I change the example? In the above, I have finally used a workaround by tapering the object with a lattice (which is better than the original method) but I have a misbehaving bevel in another place.

Absolutely. Just make sure the title of the question still fits the example, or update that too.

The title would need to change so I decided to create a new question https://blender.stackexchange.com/questions/172898/multiple-small-glitches-when-beveling-complex-meshes


text:
Fast way of creating a total union of two objects
I want to make a `clean' union of two objects, which loses all trace of these objects being previously separate and makes the bevel modifier work on the unified object.
In this specific case, the two objects are perfectly aligned to the grid. They touch but their intersection is only a single face. Previously, I tried a version where the two objects overlap a bit, but it did not work either.
I try the following in order:

Boolean union modifier.
Apply.
Ctrl+M remove overlapping vertices (there were four of them).
Dissolve redundant edges does not work, so I need to patiently select and disolve all faces divided by these remnant edges.

It looks like that now:

See that the bevel modifier at the right still does not work. But I am one step from this:

Dissolving one of the remnant edges, being white in the figure above gives nothing. So I delete it.

Now the bevel works, but unfortunately two of the faces disappear:

So it is a lengthy process of doing something which seems conceptually very simple, and it still does not work.
Question: A fast way of having a `total' union of two objects, which makes modifiers like bevel work.


text:
Render is incredibly Grainy!
I'm new to blender and I started last week. I'm now having trouble with the final results of my render, it looks incredibly grainy.

What I have tried so far is that I changed the resolution to 100% , samples to 500, tried using the 'area light' and i enabled 'multiple importance'.
Here's the link to my Blender file:
UPDATE
I can't find the AA settings:

Update:
When I try to render my animation it comes out as nothing.

It also says this:


text:
Why is area lighting creating a grainy render?
I started to use Blender last week, so I'm kinda new here. I was wondering if someone could check the lighting in my house model? I believe that is what is causing all of my grainy and low quality renders. I have tried many solutions such as increasing the resolution to 100%, enabling Multiple Importance Sampling, using regular Path Tracing with square samples instead of Branched Path Tracing, and messing around with the Render Tab settings. I'm still trying to figure out why my animation is taking more than 8 hours to render a simple three second video and why it is so blurry. My windows laptop has an NVIDIA GT 520M, 8GB of ram, and a 64-bit operating system. This is for an important school project and it weight 98% of my grade. I hope someone can help:)
My Blender file:

The final render is too grainy and poor quality.

Problem
In your scene, one of the first things I noticed was that it was inside an enclosed space. Bluriness in enclosed spaces can often be caused by unpowerful lighting.
Solution
I selected the area lamp near the top of the cabin and turned up the Emission Strength to 1000 from 300. I also turned the Max Bounces: to 1024.
I also optimized the .blend file.
I made some adjustments in the Render tab of the Properties panel, namely that I set the Max: and Min: Light Path Bounces to 0 (for faster rendering). I also turned the Filter Glossy: value to 0.7. Additionally, I changed the resolution to just 1920x1080 (1080p; you had it set to 4k which really won't make any difference except causing the rendering to take 4 times as long). Furthermore, I turned the Sampling > Settings: > Clamp Indirect: value to 3.00. I turned the AA render samples to 100. Lastly, I optimized the Tile Size for CPU rendering (Properties panel > Render Tab > Performance Drop Down Menu > Tiles:). If you want it to be optimized for GPU rendering, change each (x/y) from 16 to 256.
On my 8-year-old mac with CPU and not all the image textures, one frame (probably) took a bit under an hour (I didn't wait for it to finish). On my Nvidia 970 4GB STRIX, one frame took just 54 seconds and looked like this:

Final Notes
Here is the fixed up .blend file:

I don't generally offer this (haven't before), but if you can get me a .blend file with all the images included, I will render it for you. 90 frames x 1 min each = about 90 min. --A fellow Blender-using student.


text:
Rendering taking too long. Is there a way to improve it?
I recently tried to render in Blender, but, it is taking the a ridiculously long time to render a frame. I've tried rendering on my windows laptop which has a NVIDIA GT 520M, 8GB of ram, and a 64-bit operating system and people told me that using the GPU won't accelerate rendering much. Instead I decided to render on my school computer. The school computer has a:
NVIDIA GeForce GTX 760 GPU
Integrated with 2GB GDDR5 memory, 256-bit memory interface
This took 20 mins a frame, I then thought my animation is 2000 frames long. 1 frame takes 20 mins, 20*2000 is 40000 mins. 40000 mins equals to 667 hours which equal to 30 days. I would never be able to hand up my assignment on time. I watched many tutorials on rendering and trying the tips that people gave me but it didn't improve the rendering time.
Here's my blender file:
(note, it is in CPU render instead of GPU render because I am currently working on it on my macbook air)

First screenshot of the render settings.

Second screenshot of the render settings.

You might want to let a renderfarm render you project. Sheepit is a free renderfarm, you can render other projects and let others render your project. Its a give and take.

what is difference in your screenshots ? they are same

Why not use "openGL render animation" from the Render dropdown. It will render textures and it will be lightning fast compared to the 20 minutes per frame you'd expect in cycles. It won't look fantastic..but it will render the entire thing in about 20 minutes. -- if you are really stuck...

There are several ways to speed up render times.

Enable auto tile addon to set tile size correctly.

User preferences => Addons => Enable Render: Auto Tile Size => Save Settings

By utilizing denoising you should be able to decrease render samples.
Scene tab => Check denoising box
Bake your materials. Its too complex to explain here, so check out this tutorial.

I have render out a couple of animations and unless you have a beast of a computer it is going to take a while. If you aren't afraid to through some money around I would suggest you use a render farm. I mostly use blendergrid.


text:
Superimposing Objects & Video
I'm trying to add animated text banners (objects) onto an edited video via Video Sequence Editor. I've watched several tutorials on this subject, though every one I have followed has failed to work. Here is what I'm working with:

I've reduced the Opacity to make it clearer what I'd like to do. So far, adding the 'Scene' has been the closest to success. I've tried adding nodes, textured planes, etc. though none were successful. With nodes, I can for render only 'Scene' (Layer 4) or the edited video (Layers 1-3), but not both.
Blend. 2.78

I figured it out that in the render settings (with 'Scene' selected), I could set the Alpha to Transparent, then change the blend settings to Over Drop.


text:
Is there a way to lock rendered layers?
Is it possible to lock which layers get used in compositing?

It get annoying having to re enable all the layers you want to use in the compositor every time you disable a bunch of layers to check just one or two layers to see what is on them.
Is this possible? If not, is there an easier way to check the contents of layers?

No, you can't lock a scene's layer visibility. To check layer contents, what I usually do is to reserve a separate 3D View area with its own active camera and layer visibility.
You can have a 3D View area's camera and layer visibility settings detached from the scene's by toggling off its Lock Camera and Layers button, located to the right of layer buttons:


text:
Is there a way to make a shortcut comment the current line?
I'm used to CtrlD commenting the current line rather than duplicating it.
This is easy enough to change in the user preferences, however it only works when there is a highlighted selection.
Is it possible to make this work even when nothing is highlighted, so the line with the cursor is commented?

You could create a custom operator and map the following to a shortcut.
bpy.ops.text.move(type='LINE_BEGIN')
bpy.ops.text.insert(text="#")

or if selecting the line is tiresome you can just automate the selection step then comment
bpy.ops.text.select_line()
bpy.ops.text.comment_toggle()

Creating a custom operator would look something like this
import bpy

class CommentLineOperator(bpy.types.Operator):
    bl_idname = 'text.comment_line'
    bl_label = 'Comment a line'

    def execute(self, context):
        bpy.ops.text.select_line()
        bpy.ops.text.comment() >> bpy.ops.text.comment_toggle() since 2.8

        return {'FINISHED'}

bpy.utils.register_class(CommentLineOperator)
bpy.utils.unregister_class(CommentLineOperator)

After that, you should be able to map a shortcut easily to text.comment_line.
To have this load at startup, just save it with a .py extension and drop it into your scripts/startup/ folder. See How could a single Python script run when Blender is started?.


text:
How to set the socket type in python?
How can I set the output socket type of a nodegroup output socket from python?
I don't even know of any good way to do this in the UI.. The only way I know of in the UI is to connect a node output of the type I want (e.g. a yellow color output) to the Group Output node.
I tried setting socket.type, however there is no error message and the socket type does not change.
This is important because the default is a 'VALUE' socket, which converts colors into grayscale.
Here is the relevant part of my script:
main_group = bpy.data.node_groups.new(type="ShaderNodeTree", name="Object Color")
main_group.outputs.new("NodeSocketFloat", "Object Color")
output_node = main_group.nodes.new("NodeGroupOutput")
output_node.location = (600, 0)
output_node.inputs["Object Color"].type = 'RGBA'

You define the type when you create the socket with new() Looking at the list on the bpy.types page there are several starting with NodeSocket that can be used.
The variations of each type alter the visual display - eg. FloatPercent shows % with the value.
NodeSocketBool
NodeSocketColor
NodeSocketFloat
NodeSocketFloatAngle
NodeSocketFloatFactor
NodeSocketFloatPercentage
NodeSocketFloatTime
NodeSocketFloatUnsigned
NodeSocketInt
NodeSocketIntFactor
NodeSocketIntPercentage
NodeSocketIntUnsigned
NodeSocketShader
NodeSocketString
NodeSocketVector
NodeSocketVectorAcceleration
NodeSocketVectorDirection
NodeSocketVectorEuler
NodeSocketVectorTranslation
NodeSocketVectorVelocity
NodeSocketVectorXYZ

To update sambler's answer, here's the updated list of node socket types.
Here I did a little script that creates a node group with all sockets available (2.92)
import bpy

allSockets = bpy.data.node_groups.new("All Sockets Shader", "ShaderNodeTree")
#toggle comment the previous line and uncomment the next line to create a Geometry Node Group
#allSockets = bpy.data.node_groups.new("All Sockets Geometry", "GeometryNodeTree")

for nm in ["Bool",
            "Collection",
            "Color",
            "Float",
            "FloatAngle",
            "FloatFactor",
            "FloatPercentage",
            "FloatTime",
            "FloatUnsigned",
            "Geometry",
            "Image",
            "Int",
            "IntFactor",
            "IntPercentage",
            "IntUnsigned",
            "Object",
            "Shader",
            "String",
            "Vector",
            "VectorAcceleration",
            "VectorDirection",
            "VectorEuler",
            "VectorTranslation",
            "VectorVelocity",
            "VectorXYZ",
            "Virtual"]:
    type = "NodeSocket" + nm
    print(nm +" is a node socket of type "+ type)
    allSockets.inputs.new(type, nm)
    allSockets.outputs.new(type, nm)

EDIT: updated list for later versions
for nm in [
    "Bool",
    "Collection",
    "Color",
    "Float",
    "FloatAngle",
    "FloatDistance",        #2.93
    "FloatFactor",
    "FloatPercentage",
    "FloatTime",
    "FloatTimeAbsolute",    #3.0
    "FloatUnsigned",
    "Geometry",
    "Image",
    "Int",
    "IntFactor",
    "IntPercentage",
    "IntUnsigned",
    "Material",             #3.0
    "Menu",                 #4.1
    "Object",
    "Rotation",             #4.0
    "Shader",
    "String",
    "Texture",              #3.0
    "Vector",
    "VectorAcceleration",
    "VectorDirection",
    "VectorEuler",
    "VectorTranslation",
    "VectorVelocity",
    "VectorXYZ",
    "Virtual",
]:


text:
How to fix this spurious face (?)
It was a cube with an additional loop made by Ctrl+R. I wanted to move inwards one of the faces, but without pulling the edge of its neighbour. Thus I Ctrl+Shift+R the neighbour. Then I just moved one of the faces to the left, the dark one in front:

making a dent in the cube.
Some time later. I noticed a flickering dark triangle below. How to get rid of this?  I tried various cleanups of the mesh, they did nothing.
Undo is out of question, as I did many other changes in the meantime. Unless there is a local object undo, but I am not sure if there is one in Blender. I do not want to delete this object, as it is carefully measured. I tried to cut the problematic bottom with a cube, but most CSG operations work badly with this mesh - intersection produces a plane even if there is a substantial overlap, difference does nothing.
Here is the source of the mesh:
And here is the wireframe, as asked by batFINGER:
UPDATE: the face overlapping with the triangle had one of its edges along the full width of the mesh. I finally deleted the whole bottom (somehow) and created a new one with F.

Just select the bad face and delete it? If you're having difficulty making the selection. and are selecting good faces along the way, just H hide them and try again?

@RobinBetts This triangle forms a combo with the bottom face. I can only delete them together, and I do not know how to create a new face between selected points.

Delete the two long edges of triangle?

These edges cannot be selected. I guess that they do not exist, as the triangle is not a "proper" face.

F to make a face between two edges, ... hard to tell from your illustration, there may be some other problems with the topo, making some repairs necessary, share your file  at https://blend-exchange.giantcowfilms.com/, if you like.

I added the source.

A wireframe may help shed some light too.  Select non manifold?

I can delete the face and use F, but when I try, even if it looks good, the connections are bad - not really a manifold.

@batFINGER I added the wireframe. I do not understand what you mean by "select non manifold".

Removing 4 doubles and Selecting the two vertical edges of the "removed weird face" and fill worked for me. Strange.. hopefully RB is working up an answer right now.

I selected one of the vertices, which turned out to overlap with another, deleted it, it made the entire bottom disappear. Then I used F and it seems that I have a proper manifold now. By the way, if there are overlapping vertices, any way of toggling the selection between them?

Hide a face would be one way I suppose. If you don't want doubles would remove them. The remove (mesh > merge > distance) doubles reported that 4 were removed.  Would also look into making quads from ngon faces (> 4 verts)


text:
Blender 3: booleans have some hidden state that makes them unworkable
In Blender 3.0.0, the booleans became faster but unfortunately, they seems to have some internal state (cache?) which makes exactly the same model behave differently (as in, booleans work or not) depending on which object has been last modified.

In the attached model, there is Cyl1 in which Cyl2 makes a hole. The product is unioned with A. Which does not work if anything is modified in modifiers of Cyl1 (as simple as toggle modifier's visibility back and forth so nothing should change). But the booleans work again if the same thing is done in A. In particular, after opening the model, nothing is visible, but toggling twice the visibility icon in the Union modifier in A makes A visible. I restarted Blender several times, reopened the file and the problem repeats.
And these are only two cylinders. Am I doing something wrong or is there a workaround?

You have a dependency cycle.  Cyl 1 has a boolean difference with Cyl 2.  Cyl 2 has a boolean difference with Cyl 1.  Which should happen first?  Blender can't know, and it can't evaluate every object in an infinite loop.  Every time you change modifiers (or exit edit mode), Blender re-evaluates the affected object once, then the other object.  But the output depends on the evaluation order.


text:
Effect of "instancing on vertices" invisible to boolean modifiers, any other method instead?
I would like to have an equivalent of an array modifier, but with separate offsets. There are many answers but I found nothing which:

is non-destructive,
works with preceding boolean operators like "array" does,
works as an argument of another boolean operator, again, like "array" does.

An array has a fixed step, and thus I tried instancing on vertices. It seems, however, that the obtained instances do not exist for the boolean modifier (instancing details in the description attached below). Linked copy does not work either as I would like, because it re-applies the original "non-translated" modifiers to the copy after the copy is translated.
Here is an abstract example which shows the problem. Imagine that there is a cube and a torus has been carved in one of its sides with a boolean modifier "difference". Then, the carved cube is multiplied into 3 carved cubes with the array modifier. Finally, these three carved cubes are embossed into a large base, by using that base's boolean modifier "difference".
This all can be done in Blender in a non-destructive fashion, provided that the three carved cubes are equidistant. But I would like to vary the step between them:

The question: how to obtain such a result as in the image, without destructive copying/destructive boolean operators?
====================
This describes how I did the instancing to obtain a similar effect, and why it did not work:
I have a mesh P of few points, which is a parent of another mesh C. I set in P "instancing on vertices" and thus, when P made visible, see additional instances of C, one per point in P.
The problem is, I cannot use P or C as an argument of a boolean operator. So if I have another object B with a boolean modifier "union" and an argument of either P or C, B becomes a union with only C. The instances created by vertices of P are ignored in that case.

Since V2.93 you can indeed use boolean operations on instanced collections. That's a pretty big deal.
Say you have a collection containing some objects :

Now we want to instance this collection on the vertices of another mesh. In my case a cube.

Add a Geometry Nodes modifier, and simply plug a Point Instance node set to Collection and choose your starting collection.

Now you could add a Boolean geometry node inside your node tree, but I feel like the performance is severly lacking so we'll stick to a regular boolean modifier. Add your cutter object and set it as the target in your boolean modifier. Cut quality may vary depending on a lot of factors.


text:
How can I select all edges that form part of a square without a face via python?
I have empty squares (those with exactly 4 edges only) in my 2D mesh and I need to fill them with faces via python but I don't know how to automatically select these edges. Is it possible to select all of these regions marked in orange via python?

This is what I tried. I selected all edges that have linked exactly only 1 face. Unfortunately it selects the boundary edges as well so I tried doing an and not edge.is_boundary but then nothing gets selected since the small squares inside are apparently also boundary edges.
import bpy
import bmesh

obj = bpy.context.active_object
mesh = obj.data

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')

bm = bmesh.from_edit_mesh(mesh)

for edge in bm.edges:
    edge.select = False

edges_to_select = []

for edge in bm.edges:
    if len(edge.link_faces) == 1: #and not edge.is_boundary:
        edges_to_select.append(edge)

for edge in edges_to_select:
    edge.select = True

bmesh.update_edit_mesh(mesh)

Here's another try where I almost got the result:

import bpy
import bmesh

obj = bpy.context.active_object
mesh = obj.data

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')

bm = bmesh.from_edit_mesh(mesh)

for edge in bm.edges:
    edge.select = False

edges_to_select = []

for edge in bm.edges:
    if len(edge.link_faces) == 1:
        vertices_with_four_edges = all(len(v.link_edges) == 4 for v in edge.verts)
        if vertices_with_four_edges:
            edges_to_select.append(edge)

for edge in edges_to_select:
    edge.select = True

bmesh.update_edit_mesh(mesh)

I found a solution. First I select all the edges that have only 1 face linked to them and then check that all of the vertices have exactly 4 edges linked to them:
import bpy
import bmesh

obj = bpy.context.active_object
mesh = obj.data

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')

bm = bmesh.from_edit_mesh(mesh)

edge_selection = []

for edge in bm.edges:
    if len(edge.link_faces) != 1:
        continue
    vertices_with_four_edges = all(len(v.link_edges) == 4 for v in edge.verts)
    if vertices_with_four_edges:
        edge_selection.append(edge)
        edge.select = True

This will result in something like this:

And then I continue on to deselect the excess edges by checking if each edge has both of its vertices shared with a selected edge or else deselect it.
for edge in edge_selection:
    if not any(linked_edge in edge_selection and linked_edge.select for linked_edge in edge.verts[0].link_edges if linked_edge != edge) or \
       not any(linked_edge in edge_selection and linked_edge.select for linked_edge in edge.verts[1].link_edges if linked_edge != edge):
        edge.select = False

bmesh.update_edit_mesh(mesh)

In the process I found a bug where I had to check that linked_edge != edge. This is unexpected behavior that a linked edge as its own self edge is included in the list.

How to find a hold with only 4 edges
import bpy
import bmesh

def get_all_closed_path(bm, length=4):
    for vert0 in bm.verts:
        for edge0 in vert0.link_edges:
            v0, v1 = edge0.verts
            vert1 = v0  if vert0 is v1 else v1

            for edge1 in vert1.link_edges:
                if edge1 is edge0: continue
                v0, v1 = edge1.verts
                vert2 = v0  if v1 in {vert0, vert1} else v1
                if vert2 in {vert0, vert1}: continue

                for edge2 in vert2.link_edges:
                    if edge2 in {edge0, edge1}: continue
                    v0, v1 = edge2.verts
                    vert3 = v0  if v1 in {vert1, vert2} else v1
                    if vert3 in {vert0, vert1, vert2}: continue

                    for edge3 in vert3.link_edges:
                        if edge3 in {edge0, edge1, edge2}: continue
                        v0, v1 = edge3.verts
                        if v0 is vert0: yield vert0, vert1, vert2, vert3
                        if v1 is vert0: yield vert0, vert1, vert2, vert3

obj = bpy.context.active_object
mesh = obj.data

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')

bm = bmesh.from_edit_mesh(mesh)

def fill_one(bm):
    verts_group_of_faces = [set(face.verts)  for face in bm.faces]

    for verts in get_all_closed_path(bm):
        if set(verts) in verts_group_of_faces: continue

        bm.faces.new(verts)
        return True
    return False

while fill_one(bm):
    bmesh.update_edit_mesh(mesh)

bmesh.update_edit_mesh(mesh)
bm.free()
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.mode_set(mode='EDIT')

hey thank you very much for your answer i gave you +1 but it's very slow due to too many loops. check out my answer it's very fast :)

Select a hole (4 vertices)

import bpy
import bmesh

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_similar(type='VERT_EDGES', threshold=0.01)
bpy.ops.mesh.fill()
bpy.ops.mesh.tris_convert_to_quads()

# remove overlapping faces
obj = bpy.context.active_object
mesh = obj.data

def remove_overlap_face(faces):
    for face in faces:
        verts = set(face.verts)
        if any(verts == set(f.verts) for f in faces if f is not face):
            faces.remove(face)
            return True
    return False

bm = bmesh.from_edit_mesh(mesh)

while remove_overlap_face(bm.faces): pass

bmesh.update_edit_mesh(mesh)

Result:

hi thank you for your answer. unfortunately i need to be able to automate this, meaning i can't just select anything manually. also its very heavy processing the script. oh and it also didnt work https://snipboard.io/HBwEIR.jpg this is the mesh https://blend-exchange.com/b/rgaLzEJ0 tested script on 4.1 since it doesnt work on other versions.