text:
Why are my drivers not updating instantly?
So I have a bone driving the 'scale' property of another bone, along with the value of a shape key. If move the driver bone, it works fine, but right click to cancel, the scale of the driven bone doesn't update until a frame change or movement on the bone itself, but the shape key does. Here's what I'm talking about:

Notice how the teeth reset, but the mouth doesn't.

So I found out what it was. Odly enough, the driver bone has to be in a separate armature from the bone that you are driving. Annoyingly you can not use 'Whole Character' key framing properly anymore, but it works nonetheless.
Edit: Thanks to aliasguru, I found out to solve this you can:
1. Create a blender shortcut
2. Go to its properties
3. After the path in 'Target', paste in '--enable-new-depsgraph'
4. Click apply, and launch blender from there.
Done!
Edit by aliasguru: Why does this work?
The main question is: Why do 3D packages in general need something called 'Dependency Graph' at all (this is not Blender a specific thing, other apps like Maya, Alias, etc. have this as well!)? This can be re-phrased as 'how does a 3D app know what needs to be recalculated'? Each time you change something in your scene, some kind of update cycle needs to be triggered, forcing things to be updated.
Example: change the location of an object by setting the z-value. What sounds stupidly simple triggers a massive chain of possible updates: The object in question could:

have some dependency to a driver in the scene, forcing another property to update
have a constraint relationship to another object
be part of a group, and the instance needs to be updated too
could be a target for a modifier
could have a material node tree that reads the location
could be the parent of other objects
...

As you can see, there is a Ton (pun intended) of possible follow-up calculations that might need to happen. If Blender was forced to manually check EVERY possible effect, you'd propably need to go for a coffee on each screen refresh in a not even complex scene. Now, if there was a way to cleverly identify what needs to be updated, and what can be skipped, that would be awesome, right? Right? That awesomeness is called Dependency Graph.
The Depsgraph keeps track of the relations of properties in the scene to each other, and of their status. However, it does NOT run an update cycle on each property change! Instead, it runs in a scheduled or event-driven way, one could say 'from time to time'. Between these schedules, Blender does nothing else than tagging each property which needs updates, as well as tagging the depending propertiers as dirty as well. It does not change or recalculate values just yet. In Depsgraph terms, this is called mark as dirty.
When the scheduled update happens, it will only ever touch properties which have been marked as dirty, completely ignoring anything related. If an update by the scheduler triggers further updates, it will only mark the prop in question as dirty again (unless the coders decided to put hacks in the code, and there might be plenty) and update in the next cycle. And here is where the current problem of Blender starts, and Sergey came in.
When Blender received its first implementation of a Depsgraph, computer power was limited. I mean, really limited. So they had to make a compromise: They could not afford to trigger depsgraph updates on every nitty little property, they had to make the system less fine-granular. What they went for is a Depsgraph that does its work on an object level. What does this mean for your example case?
Your case
Your single armature contains bones, which trigger a Shapekey change as well as properties of other bones. So let's pull that handle like in your GIF. The rig scales the mesh up somehow first. I'm guessing there is a parent-child relationship somewhere, or an Armature modifier. Then the system detects that a shape key value has to be changed too. It marks the object containing the mesh as dirty. It checks if there are connections, and if they are found, marks them as dirty. Etc. Where's the catch?
So far, there were just things marked as dirty. Nothing has been recalculated just yet. The armature OBJECT has been marked as dirty, then the Mesh OBJECT containing the shape key. The mesh clearly is dependent on the Armature. But the armature might influence your mesh twice. First the parent/child (or Armature), secondly the shape key. It's not foreseeable any more which one should come into play first, scale or shape key. With the specific case you have (and I can only guess without having the rig in hand), The depsgraph needs to update the mesh object twice to calculate the final solution. Potentially first the result of scaling the bone on the mesh, and then - in a second cycle - the repositioning of vertices due to the shape key. On a Cancel event, only one update ever seems to run, leaving the Shape key in a dirty stage. It IS marked as dirty in the depsgraph, but it will only recalculate once the scheduler is run again. That's the case for instance if you change a frame, or if two armatures influence it (each one triggers one recalculation).
So why does the new depsgraph work?
Because the granularity has been reworked to a more fine level. In case of armatures, this means update scheduling per BONE, not per Armature as present. Note that this makes the depsgraph slower, but since Sergey is a goddamn genius, so far no one measured more than 20% slowdown.
See this link for further information: https://code.blender.org/2015/03/more-dependency-graph-tricks/ and this one: https://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
Final note: Blender 2.8 afaik will only have the new Depsgraph. The current one will be deprecated. Further info on 2.8 Depsgraph: https://code.blender.org/2016/12/dependency-graph-proposal/

very likely this is due to the granularity of the default blender dependency graph, which works on an object level. You could try running Blender with the new depsgraph enabled from a command line. The command on windows for example would be blender.exe --enable-new-depsgraph

@aliasguru This is interesting. Would you mind going into more detail about what is happening when you do this? I think many people don't understand the depsgraph well.

@Mentalist I tried pulling some more info together out of corners of my brain, and edited the answer. However, keep in mind I a) don't have this specific rig, and b) I don't know the code in Blender in&out. I'm basing my answer on what I know from Maya, and what I read here: https://code.blender.org/2015/03/more-dependency-graph-tricks/

could also add has_new_depsgraph = context.scene.depsgraph is not None as a test to see which depsgraph is currently in use.

@batFINGER I noticed there are debug_graphviz(filename), debug_rebuild() and debug_stats() methods on that depsgraph property. Do you know how to use those? I can see a file is created, and it is a textfile, but how would I make it human readable?


text:
Unparent object but keep animated properties
I have an object (with some keyframed animation) parented to an empty (also with some keyframed animation), basically a rotating object rotating around an empty.
Now I need to get rid of the parent but keep the same animation, with all properties keyframed in the child. How?
The reason for this is that the object is a control object in a fluid simulation, and it does not seem to work with an animated parent.
The file is here
The relevant object is the Torus parented by the Empty. There is no need to bake the fluid, because that is not pertinent to the question.
I tried the answer in Children of parent maintain current position after parent removed? but it didn't help, but then again, that question was a bit different.

You can do this by baking the keyframes. This will overwrite the current keyframes of the child object and replace them with keyframes of both its own animation and the parent animation combined, so it retains the same movement but without having to be parented.
Select the object and choose Object> Animation> Bake Action. Set the range of the animation to bake, the Frame Step (to insert a keyframe on every nth frame) and enable Clear Parents (for some reason, for your example you also have to enable Visual Keying to get it to work correctly). After that you can click 'OK' to bake.

The baking process will then begin (which could be time consuming depending on the range of the animation and the Frame Step value).

Thanks! But alas, it didn't work. The object ends up doing a much bigger loop than before (the child-object starts from the point where it was originally created). I tried applying location as well as rotation, but there was no difference. I must have missed something basic.

Are you able to upload your file? If you are, upload it to http://blend-exchange.giantcowfilms.com/b/1934/, add the embed link to your question and I'll take a look.

Thanks again! I have updated the question with the file.

@Jbergman I have updated the answer. Enable Visual Keying as well and the baking should work.

source: Stack Exchange

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

sort: votes


text:
How to Convert GPencil strokes to Bsurface Mesh without errors?
The idea was to use this script below from Convert Curves to Grease Pencil? to generate gpencil strokes from curves (poly spline type) and use them with a Bsurfaces addon (ver 1.5) to make a mesh in Blender 2.74.
import bpy
from mathutils import Vector
def convert_curve_to_gp(obj):
    #---- CHANGED ----
    scene = bpy.context.scene
    mesh = obj.data
    layer = scene.grease_pencil.layers.new("layer", set_active=True)
    frame = layer.frames.new(scene.frame_current)
    #---- /CHANGED ----
    mesh = obj.to_mesh(scene, apply_modifiers=False, settings='PREVIEW')
    for edge in mesh.edges:
        stroke = frame.strokes.new()
        stroke.draw_mode = '3DSPACE'
        stroke.points.add(2)
        stroke.points[0].co = obj.matrix_world * Vector(mesh.vertices[edge.vertices[0]].co)
        stroke.points[1].co = obj.matrix_world * Vector(mesh.vertices[edge.vertices[1]].co)
    bpy.data.meshes.remove(mesh)

obj = bpy.context.object
convert_curve_to_gp(obj)

When Bsurfaces is used by clicking on its Add surface button it generates an error:

AttributeError: 'GPENCIL_OT_SURFSK_add_surface' object has no attribute 'original_curve'

and it creates a new curve object.

See if my answer here helps. Different problem, but may help.

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


text:
Point Position texture is switched at Seams
I baked Position pass, that works without issues for Displacement modifier.

When I use this texture in Geometry Nodes for Set Position node the result is OK, only vertices marked as Seams are positioned wrong. Vertical loop is mirrored and rotated, horizontal inner loop follows outer loop (= positions of middle UV loop).

I tried to scale down UV a bit (0.99) ... to test if Margin make some difference, but it didn't.
GN node-tree issue ...? Thanks :)

File was big with texture ... so first press Bake for selected Torus object, than make visible "02..." object to see texture effect in  geometry node displacement ...

Similarly to a question I've answered yesterday, this seems to be a domain interpolation problem. You're using a UVMap, which is in Face Corner domain, to drive values in Point domain so you get double values where the two ends of the baked image meets (seams). Sticking an Interpolate Domain node in Face Corner mode (Face also works) between the image and the vector math solves the problem:

Great :) Thanks a lot ... Haven't seen it.

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


text:
Hotkey for selecting transform manipulator type
Is there a hotkey or shortcut to change the type of the active transform manipulator?

This site lists

CtrlAltG for translate
CtrlAltR for rotation
CtrlAltS for scale

none of which work for me. Are these the correct current shortcuts?

Ok, i swear there used to be a something+space hotkey that popped up a menu which you could then click or hit 1,2,3 to pick from, but all i can find about manipulators at all is the one to toggle it on and off.

First what you linked to is for blender version 2.37 not 2.73, so the shortcuts are wrong.
To add a shortcut to switch the manipulator type; open up the user preferences.
Under the Input tab add a new shortcut under 3D View > 3D View (Global). Type view3d.enable_manipulator in to the identifier field, then just check one of the grayed out boxes for Translate, Scale, and Rotate. The only hard part will be finding 3 unused shortcuts to use for the new transform manipulator shortcuts.

Other transform manipulator shortcuts:
Ctrlspace is the default shortcut to toggle on and of the transform manipulator.
Altspace open a menu to change the orientation type.
When using the buttons in the 3D view header, holding Shift allows for more then one  manipulator type to be active at a time.

Ha, that's a big difference isn't it :P (2.37!=2.73)

Seems a fair bit has changed since then! :D

I ended up using ALT+ Numpad 1 for Translate, ALT+ Numpad 2 for Rotate, ALT + Numpad 3 for Scale. Also, ALT+ Numpad 0 to toggle Manipulator (even though default is CTRL + Spacebar)

Thank you for telling me about the multiple manipulator option with Shift! I find that very useful!

How do we do this in 2.79?

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


text:
How would I make a door open when a key is pressed and a character is near?
I am trying to make a door open for a game i'm making using the blender game engine, i have the animations set up for the door, I have everything set up for the door to activate yet nothing happens. How would I get this to work.

I tested your .blend and as you said everything is set up correctly.
But the 'Near' sensor only gets activated by "Actors" (this is a physic 'property') so you need to go to the physic tap of your character (Cube) and actiate Actor.

That worked in the test file, but for some reason when i try it in game with all the same settings it does nothing

i've uploaded a better representation of the problem

I tried it again. The only problem is the distance in teh NEAR Sensor. it is set to a soo small value. I Changed it to two or three and it worked.

There we go, thanks. idk why the range is different between objects with static and dynamic physics but problem solved


text:
How would I apply a gloss or anisotropic shader to my model?

I'm using an older version of blender and i'm having trouble finding how to apply a gloss or anisotropic shader to the model in blender engine. I'm attempting to apply the shader to the grip and the slide (The gold and dark gray segments) any help would be appreciated.

enter image description here

The .blend you uploaded is missing its textures, so please pack them and re-upload the file.

sorry forgot that, should be good now

Were you able to get your materials working?

Your mesh objects are not rendering because many of them have Material issues. Either they do not have a material set up, OR they have the wrong material type for the render engine chosen. You have the Blender Internal engine selected, but your materials nodes seem to have been set up in Cycles originally.
Changing the engine to Cycles allows all the objects to render, so the solution depends on which engine you are intending to use.
If you do actually want to use the BI engine, then you need to replace your the nodes in your Materials to use BI type nodes with a proper BI output node.


text:
Why when importing an obj file nothing appears even when zooming?
I have opened a new blender file and deleted the default cube, then imported an obj file . I did not see any thing so i selected it and i zoomed ,nothing appears.In the outliner i saw the object name ,But in the info panel i see that there isn't any verts/faces/edges.
When i opened the obj file in a text editor i found Mesh data in it. I tired this in all blender versions (2.78c/2.78.5/7.9). Can any one help how to view the mesh?

this could simply be a matter of scale. Blender uses meters as default units, whereas other systems tend to use centimeters, millimeters or inches. Try selecting the object in the outliner, and in the transform panel of the 3D view, enter 0.001 for all three scales.

@aliasguru but he also says "there isn't any verts/faces/edges"... how could it be? my guess is that what is in the obj could be corrupted or not supported maybe.

so how can i supported in blender ?

I' m sure this obj file contains mesh data, but blender can't read it

How big is that OBJ? Can you provide it somehow? Also, let us know what the info panel and the system console outputs, maybe there's an error message there.

@m.ardito One possibility is that the OP is in local layers mode. The model is imported on an invisible layer accidentally. In that case, you would see a mesh in the outliner, but nothing in the viewport, and the header would report zero faces, verts and edges, even though everything's there.

Actually the file is very small (38.7 KB). But Contains many lines of data

The object was completely deleted in edit mode. Only the origin point is left.

@LeoNas So how can i import the file without deleting it ?

Try to share your object as a zip file using google drive link or so, to get the original, and check


text:
How to add a new UV map to all selected objects?
I would like to select multiple objects and add a custom UV set to all of them.
My version works for one selected object only but not for multiple selected objects.
import bpy

# Get all selected objects
selected_objects = bpy.context.selected_objects

for obj in selected_objects:
    # Add new UV set
    bpy.ops.mesh.uv_texture_add()
    # Set new UV set name for active UV set
    bpy.context.object.data.uv_layers.active.name = "UV_ao"

What's wrong with my code?

You need to set the active object during the for loop. bpy.context.view_layer.objects.active = obj

Thank you a lot for the fast answer. All works fine!
I've added the right code below to help others.

Related: How to add a UV Map to a Mesh Using Python

In order to make the operator work for multiple objects, the current object in the loop needs to be assigned to ViewLayer.active before calling uv_texture_add():
import bpy

# Do the following for all selected objects
for obj in bpy.context.selected_objects:
    # Set current object in the selection as active
    bpy.context.view_layer.objects.active = obj
    # Add new UV set to active object
    bpy.ops.mesh.uv_texture_add()
    # Set the name of the uv layer
    obj.data.uv_layers.active.name = "UV_ao"

Related: Blender 2.8 API, python, set active object

Another way is overriding the context of the operator by passing the object:
import bpy

# Do the following for all selected objects
for obj in bpy.context.selected_objects:
    # Override the context by passing the current object
    bpy.ops.mesh.uv_texture_add({'object': obj})
    # Set the name of the uv layer
    obj.data.uv_layers.active.name = "UV_ao"

Why are you assigning "UV_ao" string to the the active UV-layer of the object in context when looping through the objects anyway? Btw: you don't have to assign the object to the ViewLayer.active. You can override the context by passing the actual object {'object': obj} to uv_texture_add() operator, call is: bpy.ops.mesh.uv_texture_add({'object': obj}).

Sorry guys. I forgot to delete the last line, because of using it in my scene here. my objects have all a minimum of one UV set. But thank you a lot for the forther information, That helps!

No need to say sorry. Just read the comments again and try to understand them.

You can get rid of the uv_texture_add() operator by adding a new UVLoopLayer:
import bpy

for obj in bpy.context.selected_objects:
    # Make sure this is a mesh object and that it doesn't already use this UV Map
    if obj.type == 'MESH' and "UV_ao" not in obj.data.uv_layers:
        obj.data.uv_layers.new(name="UV_ao")

Thank you for this hint!

@brockmann Thanks for the edit, would you care to explain why the single quote around 'Mesh'but not around the other string ?

Readability. "Use single quotes for enums, and double quotes for strings.", quote from: https://docs.blender.org/api/current/info_best_practice.html

@brockmann Oh, right. Thanks !


text:
How do I get a popup UV Image Editor and force it to show the Active Paint Slot?
This is a question that is an aside from my previous question of How to get name of image corresponding to active paint slot?
And in that question, I was looking to ultimately arrive at an Image Editor as a popup to use quickly while painting in 3d view that would immediately show the active paint slot to take advantage of the way that the Editor only shows one image at a time.
My own code from the previous post only gets the active texture to coincide with the current active paint slot, but by myself I did not get the popup editor to show it.

Blender does not support creating a new window officially. However, there is an obscure workaround: You can open up a new user preferences window and change its type to IMAGE_EDITOR, read: How to open an image editor window and display an image file in it?
In order to display the active paint slot in that window, just get the active image slot reference and then assign it to SpaceImageEditor.image. Following code is a simple operator, you can either install it like an Add-on or paste and run it in blenders text editor per session.
Blender 2.8x

bl_info = {
    "name": "Display active Slot",
    "description": "",
    "author": "brockmann",
    "version": (0, 0, 1),
    "blender": (2, 80, 0),
    "location": "Texture Paint > Tools Panel > Slots",
    "category": "Paint"
}

import bpy

class DisplayActivePaintSlot(bpy.types.Operator):
    '''Display selected paint slot in new window'''
    bl_label = "Display Active Slot"
    bl_idname = "paint.display_active_slot"
    bl_options = {'REGISTER'}

    @classmethod
    def poll(self, context):
        return context.object.active_material.texture_paint_images

    def execute(self, context):
        if context.object.active_material.texture_paint_images:
            # Get the Image
            mat = bpy.context.object.active_material
            image = mat.texture_paint_images[mat.paint_active_slot]
            # Call user prefs window
            bpy.ops.screen.userpref_show('INVOKE_DEFAULT')
            # Change area type
            area = context.window_manager.windows[-1].screen.areas[0]
            area.type = 'IMAGE_EDITOR'
            # Assign the Image
            context.area.spaces.active.image = image
        else:
            self.report({'INFO'}, "No active Slot")
        return {'FINISHED'}

def draw_display_slot_operator(self, context):
    if context.object.active_material.texture_paint_images:
        layout = self.layout
        row = layout.row(align=True)
        row.operator(DisplayActivePaintSlot.bl_idname, icon='ZOOM_ALL')

def register():
    bpy.utils.register_class(DisplayActivePaintSlot)
    bpy.types.VIEW3D_PT_slots_projectpaint.prepend(draw_display_slot_operator)

def unregister():
    bpy.utils.unregister_class(DisplayActivePaintSlot)
    bpy.types.VIEW3D_PT_slots_projectpaint.remove(draw_display_slot_operator)

if __name__ == "__main__":
    register()

    # test call
    #bpy.ops.paint.display_active_slot()

Blender 2.7x

bl_info = {
    "name": "Display active Slot",
    "description": "",
    "author": "brockmann",
    "version": (0, 0, 1),
    "blender": (2, 70, 0),
    "location": "Texture Paint > Tools Panel > Slots",
    "category": "Paint"
}

import bpy

class DisplayActivePaintSlot(bpy.types.Operator):
    '''Display selected paint slot in new window'''
    bl_label = "Display active Slot"
    bl_idname = "paint.display_active_slot"
    bl_options = {'REGISTER'}

    @classmethod
    def poll(self, context):
        return context.object.active_material.texture_paint_images

    def execute(self, context):
        if context.object.active_material.texture_paint_images:
            # Get the Image
            mat = bpy.context.object.active_material
            image = mat.texture_paint_images[mat.paint_active_slot]
            # Call user prefs window
            bpy.ops.screen.userpref_show('INVOKE_DEFAULT')
            # Change area type
            area = context.window_manager.windows[-1].screen.areas[0]
            area.type = 'IMAGE_EDITOR'
            # Assign the Image
            context.area.spaces.active.image = image
        else:
            self.report({'INFO'}, "No active Slot")
        return {'FINISHED'}

def draw_display_slot_operator(self, context):
    if context.object.active_material.texture_paint_images:
        layout = self.layout
        row = layout.row(align=True)
        row.operator(DisplayActivePaintSlot.bl_idname, icon='IMAGE_COL')

def register():
    bpy.utils.register_class(DisplayActivePaintSlot)
    bpy.types.VIEW3D_PT_slots_projectpaint.prepend(draw_display_slot_operator)

def unregister():
    bpy.utils.unregister_class(DisplayActivePaintSlot)
    bpy.types.VIEW3D_PT_slots_projectpaint.remove(draw_display_slot_operator)

if __name__ == "__main__":
    register()

    # test call
    #bpy.ops.paint.display_active_slot()

Pulled this into my fork of Spirou4D's work on Texture Paint Plus, accessed with Shift-Alt-W  https://github.com/artistCDMJ/texture_paint_plus/archive/master.zip

Oh, man, I think I had that and then when I messed up the copy/paste I forgot to bring it. I will fix asap :D


text:
Why is the wood grain texture I applied to my model not showing?
I am trying to apply a wood grain type of effect to a model, I set up all the nodes and everything yet it won't show properly. How would I apply the texture?

Is your mesh UV unwrapped?

No it's not UV unwrapped, would i need to make the UV map and use an image as a base for the texture?

You need to unwrap the mesh to apply an image texture to it.

Is your wood grain procedural or an image?  If it is procedural just change the mapping coordinates to generated.

I UV Unwrapped it and tweaked some of the sizes of the textures and it now is very close to the desired effect

Is is a procedural texture?

yes it's a procedural texture

It would appear that the tex does show in the render veiw.

To get your procedural texture to show up in the material, go into the textures context tab, and in the mapping panel, change "co-ordinates" to generated, then, in the influence panel, under "diffuse", put a check beside color. Areas to be changed in orange boxes shown:
.


text:
How do I assign materials to vertex groups in Python
I have an object with vertex groups already set up and materials already added. I want to run through all of vertex groups in that object and randomly assign one of the materials to it. How do I do this? I can run through the vertex groups but I'm struggling to assign the material to it.
Thanks

You can't assign materials to vertex, materials go into faces only, and vertex groups don't unequivocally define mutually exclusive groups of faces. See https://blender.stackexchange.com/questions/51296/is-there-a-way-to-save-selection-by-faces/

Thank you! At least that explains why I couldn't work it out!! :)

You might be able to convert a vertex group into a selection of faces, but there will likely be some overlap

A vertex group, as the name says, is a group of vertices. A material is assigned to a face, not to a group. So how do you translate between the two? This will cause issues in a moment.
How to count the number of faces of each vertex group?
I think the most reasonable approach is the "select a face if all its vertices are selected" - it's also intuitive because that's how selection in Blender works. So I'm using the Bmesh - All Corners solution. First let's prepare Suzanne for make-up:

Whoops! You can't select lips without selecting the mouth as well. Again, this will cause a problem in a moment. Also, notice how the vertex groups and the material slots appear in the same order - this is needed, because the script will operate on indices rather than names - bmesh doesn't even store the names (neither does a mesh, only an object stores this information, to my knowledge).
import bpy, bmesh
from bpy import context as C, data as D
from collections import Counter

me = C.object.data
bm = bmesh.from_edit_mesh(me)

layer = bm.verts.layers.deform.active
for f in bm.faces:
    groups = (v[layer].keys() for v in f.verts)
    groups_set = set(next(groups))
    for g in groups:
        groups_set.intersection_update(g)
    if groups_set:
        f.material_index = groups_set.pop() + 1
    else:
        f.material_index = 0

Whoops! The entire mouth (the inside) has the lip color. Or at least for me this is the case, since I'm just popping from a set, I'm getting the first vertex group found for a given face - Lips is indexed before Mouth so it was found first, and is popped first. However, fixing this by swapping both vertex groups would be a mistake - while current CPython implementation is deterministic in this regard, there's no formal guarantee that this will always be so:

A set is an unordered collection

source
Instead, just explicitly prioritize the index of the Mouth vertex group:
import bpy, bmesh
from bpy import context as C, data as D
from collections import Counter

me = C.object.data
bm = bmesh.from_edit_mesh(me)

layer = bm.verts.layers.deform.active
for f in bm.faces:
    groups = (v[layer].keys() for v in f.verts)
    groups_set = set(next(groups))
    for g in groups:
        groups_set.intersection_update(g)
    if 3 in groups_set:  # prioritize Mouth
        f.material_index = 4
    elif groups_set:
        f.material_index = groups_set.pop() + 1
    else:
        f.material_index = 0


text:
How to remove imported blender keymap?

I imported keymap settings from 2.8 to 3.3 with filename blender.py (2nd preset) but it didn't work very well so I tried to remove it. However I couldn't delete the imported preset later on, Blender keep warning "unable to remove default presets". I have tried uninstall-install but it was still there. Is there a way to remove this duplicate?

Found it accidentally while looking up on resetting userpref.blend, the imported keymap file is located in here:
[drive]:\Users\[profile]\AppData\Roaming\[install directory]\[#version]\scipts\presets\keyconfig

in mine, it is something like:
C:\Users\LAPTOP\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\presets\keyconfig
so I deleted the imported keymap file (blender.py) and now the duplicate is removed.


text:
Blender cycles glow on transparent background
I am trying to make an image similar to this one: https://i.sstatic.net/CBxuE.gif
But with this model:
(removed link so I could post link to blend file)
However, I would like it to have a transparent background. I have found this question on here:

Glow effect invisible on transparent background

And I implemented the second answer with the blue glowing cube, but this isn't the effect I'm going for. What I want is just the glow on the outside of the sign, but the above method generates a glow that also affects the black letters and outline, and gives it an "out of focus" or "squinting" look.
To achieve the red and white animation I am using a background plane and moving it from right next to the sign to far away, so the glow gets bigger. What I would like is to somehow keep this glow in the render but loose the plane and have a transparent background instead.
I would like to use blender for this because it's what I'm sort of familiar with, but since this a 2D image and not a model maybe it would be easier to render without the back plane and use GIMP or add the glow through post processing? I'm a total noob when it comes to nodes so any help or pointers would be appreciated. Thanks!
Here is the blend file:

I think that problem in the question you linked (and in this one as well) is the same you're facing. It's just that you want the glow to affect certain parts of the image; and this is another problem. You could use some mask to plug it into the factor of the Alpha Over.

You should do this kind of things in the compositor node.
Replace the background plane's material with a holdout node.
Then, setup your compositing like this:

You can animate the size value to change the amount of glow in the rendering. Keep in mind that you will need to adjust the size of you image to not cut of the glow at the edges. Also try out different blur algorithms, the Gaussian doesn't work that well in this use case (personally, I liked Quadratic)
EDIT
If you want to hat the blur another color, put in the Alpha pass instead of the Image pass into the Blur node. Using a color node in between, you can have the glare every color:

EDIT 2
Sorry, I forgot the transparent background:

The input for the alpha needs to be a white blurred image, so iIf you are using a colored glare, put the color node behind the blue or duplicate the blur node and keep both synchronized. The max node is needed to make sure that the sign will always be fully opaque since the blurring is done into both directions: outside and inside of the image.
EDIT 3
If you want to restrict the effect to specific areas, create a black/white mask and color multiply if with the output of the blur node. In your case, the inside/outside is defined by the alpha pass of the rendering.

Now, the center of your image will be without glow effect. To have actual transparency in the image, you probably will need to add another mask to the alpha output but that shouldn't be a problem anymore.

One extra question, if i wanted for example to have this same image but haveeverything on the inside of the black border be transparent. Then this node setup gives me a glow effect both on the outside and on the inside of the mesh (because there's a hole). If I wanted to restrict the glow to the outside only, how would I go about doing that?


text:
How do I assign a color to a specific part of a 3d Model, rather than the whole thing?
To summarize, I am an absolute beginner in Blender, and I chose to download a pair of glasses as a 3D Model (from: https://sketchfab.com/3d-models/glasses-4b8a1e54f3084c63828fe8c324198aec), as can be seen in the image below.

However, what I wanted to for its aesthetics, was to color the Lens Frames white, while coloring the Temples black (They're both the color "#29282C" as of now), but whenever I tried changing the colors of either of them using the "Material Properties" tab, the entire model would change in color, rather than simply the part that I chose.
Could you please provide me with possible solutions to this dilemma?

If temples and frame are different objects that share the same material then you will find a number right next to the material's name, presumably 2 or 3 depending on how many objects use this. If you click on the number, it will create a duplicate of the material which you can now change while the other stays the same. I guess the best will be to do that on the frame since it's one I suppose, and the temples are two? So keep the material on the temples and change the frame. But this is just scratching on the surface of shading and texturing objects, I would strongly recommend doing tutorials.

Thank you, Mr. Gordon. I will try that.

Select the object, go into Edit Mode, and enter 'face select.' Then select one of the faces that you want to have a separate color for, then go to 'Select,' 'Select Similar,' then 'Material.' Then Go to the Material Properties panel, create a new material, and click 'Assign' to assign that material to the selected faces. Do this again for the lenses. When this is done, you should have 2 separate materials for the different parts of the mesh that are completely independent of each other.

Thank you SO MUCH!!! I am forever in your debt...

No problemo! :D

@RESHABAAROSHREDDY The description in your question made it seem like the parts you wanted to assign different materials to were already separate objects... so no need to go into Edit Mode and select faces...?

Oh. I'm sorry if I didn't explain that properly Mr. Gordon. Yeah, the parts of the glasses weren't considered as separate models, hence why I needed help coloring them individually. It's fine now though, as I figured out how to do it.

@RESHABAAROSHREDDY -- be sure to click on the "Accept Answer" button so that BlenderMaster15 get credit: points towards his reputation to be helpful to others!


text:
How can I add a curve to a pre-existing mesh?
I apologize if this is easily answered, or found in the forums.  If so, I have spent the last 2 days using incorrect search terms to find the answer, and I will gladly use existing resources.
I have a model of a grip for a handgun that needs to include a compound curve.  The actual grip has a convex curve on the Y-axis, and localized concave curves, or at least less pronounced convex curves, in a couple of spots on the X-axis.  However, the Blender model has a flat top that I need to find a way to modify to approximate the real thing.
I can subdivide the plane using Knife Project, so I have tried sculpting, and while that sort of works, I am TERRIBLE at it, and cannot build anything useful.  I've also tried deforming using proportional editing, but that has its own limitations, such as modifying the entire mesh.  I THINK, and I may be completely incorrect, that using a path curve may do what I need, but I cannot find anything that will tell me how to build the curve, then attach it to the plane so that the plane will match my curves.  Please help point me in the correct direction!

if you have different curves, you can join them all together with CTRL-J, then "convert to mesh", then TAB -> edit mode, A -> select all, and then Edge->Bridge edge loops is one way to achieve this.

I will take a crack at this.  Thank you!

This more or less worked.  It was a bit fiddly since the curved mesh needed to go with the base in the picture up top, but it got me 90% of the way there, and then it didn;t take much to fit the pieces together.  Since I am going to be modifying the piece further, this worked perfectly fine.  Thank you!

Glad it helped you


text:
How to make this button/toggle/switch?
I'm trying to make this toggle,

Any idea's how to go about this?
It looks like one shape, but with a cube and subdivision surface I'm not quite getting there.

Any idea's? :)

Hello and welcome. Like this? https://snipboard.io/WVa9ID.jpg

Hello and welcome. Like this? [1]: https://i.sstatic.net/Ex8iY.png

Hi, yes, kind off, how did you make that? But the first screenshot I added is what I'm trying to achieve.

This is the quickest way.

Create a Cylinder and shape it like a button.
Select two facing verts on the top edge ring and press J.
Repeat step 2 for the other edge.
Select the face representing the handle and press E.
Select the corner edges of the handle and press S to scale it down a bit.
Select all faces of the handle plus top and bottom edge rings of the 'button' and press Ctr B to bevel it. Done.

Amazing! Thanks a lot! I feel a bit stupid for not realizing this was the way. But thanks for taking the time to add the video/gif.

Here are some step by step pictures.
I used Cylinder,and box, Joined them, adjusted the box scale and tapering. Deleted the top cylinder polygon and the the bottom box polygon. Added a bevel for the box edges. Created a face from selected edges. Added some edges and scaled as needed for a bevel. Also added a few edges withthe Knife tool to help make the transition from box to cylinder smooth. Then added the Subdivision Surface Modifier.

Thanks for your extended reply. I feel like the way suggested by Hendrik feels a bit easier, but interesting to see this is an option too. Thanks for taking the time to answer this! :)


text:
Bevel issue: Beveling an object with both large and small elements
I'm trying to bevel an object. This object has mainly large surfaces, but also a few details. See image below. How should I go about bevelling this object?
Can I somehow exclude the details from being bevelled? Or should these details not be part of the main object to begin with?

Hello and welcome to BSE! You could use the Limit Method option and a vertex group on the bevel modifier.

Never worked with Vertex Groups before, seen it in action in some video's though, so I get what you're talking about. I'll give this a go! Thanks!


text:
How to avoid drawing an UIList item in draw_item?
I have an UIList drawing a collection of items.
When those items have a property (bool) draw_in_ui set to False, I would like to avoid it from drawing in draw_item() function:
I thought about returning the draw_item function:
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):

    if item.draw_in_ui == False:
        # I tried all that but dont work
        # layout.scale_y =0
        # layout.ui_units_y =0
        # layout = None
        return

But it still appears as a blank space:
https://i.imgur.com/c7UtvPe.png
I would like that item to be omited from drawing.
Is it possible? How can I do it?
Thank you so much for the help, much appreciated.

Code to test:
(Add some random materials to object to test. I would like to ignore drawing a material with the name "Material" (default name), but draw others).
import bpy

class MATERIAL_UL_matslots_example(bpy.types.UIList):
    # The draw_item function is called for each item of the collection that is visible in the list.
    #   data is the RNA object containing the collection,
    #   item is the current drawn item of the collection,
    #   icon is the "computed" icon for the item (as an integer, because some objects like materials or textures
    #   have custom icons ID, which are not available as enum items).
    #   active_data is the RNA object containing the active property for the collection (i.e. integer pointing to the
    #   active item of the collection).
    #   active_propname is the name of the active property (use 'getattr(active_data, active_propname)').
    #   index is index of the current item in the collection.
    #   flt_flag is the result of the filtering process for this item.
    #   Note: as index and flt_flag are optional arguments, you do not have to use/declare them here if you don't
    #         need them.
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
        ob = data
        slot = item
        ma = slot.material
        print(item.name)
        # HERE
        # HERE
        # HERE (If he name is "Material", dont draw that item)
        if item.name == "Material":
            return

        # draw_item must handle the three layout types... Usually 'DEFAULT' and 'COMPACT' can share the same code.
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            # You should always start your row layout by a label (icon + text), or a non-embossed text field,
            # this will also make the row easily selectable in the list! The later also enables ctrl-click rename.
            # We use icon_value of label, as our given icon is an integer value, not an enum ID.
            # Note "data" names should never be translated!
            if ma:
                layout.prop(ma, "name", text="", emboss=False, icon_value=icon)
            else:
                layout.label(text="", translate=False, icon_value=icon)
        # 'GRID' layout type should be as compact as possible (typically a single icon!).
        elif self.layout_type == 'GRID':
            layout.alignment = 'CENTER'
            layout.label(text="", icon_value=icon)

# And now we can use this list everywhere in Blender. Here is a small example panel.
class UIListPanelExample(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "UIList Panel"
    bl_idname = "OBJECT_PT_ui_list_example"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout

        obj = context.object

        # template_list now takes two new args.
        # The first one is the identifier of the registered UIList to use (if you want only the default list,
        # with no custom draw code, use "UI_UL_list").
        layout.template_list("MATERIAL_UL_matslots_example", "", obj, "material_slots", obj, "active_material_index")

        # The second one can usually be left as an empty string.
        # It's an additional ID used to distinguish lists in case you
        # use the same list several times in a given area.
        layout.template_list("MATERIAL_UL_matslots_example", "compact", obj, "material_slots",
                             obj, "active_material_index", type='COMPACT')

def register():
    bpy.utils.register_class(MATERIAL_UL_matslots_example)
    bpy.utils.register_class(UIListPanelExample)

def unregister():
    bpy.utils.unregister_class(MATERIAL_UL_matslots_example)
    bpy.utils.unregister_class(UIListPanelExample)

if __name__ == "__main__":
    register()

i would recommend posting all your code or at least a runnable code so that we can help you.

I tend to be concise just to not "bore" people reading, but maybe you are right.

i was assuming you have the uilist on a panel...and so if the list is empty, you just stop showing the uilist on the panel. that's why i asked for a runnable code snippet.

@Chris Yes, the list is on a panel, but I meant not to draw a single item. I edited the question with code to test what I meant

here is an example (i just adapted the one from the doc), essentially you have to work with filters to achieve what you want:
import bpy

class MATERIAL_UL_matslots_example(bpy.types.UIList):
    # The draw_item function is called for each item of the collection that is visible in the list.
    #   data is the RNA object containing the collection,
    #   item is the current drawn item of the collection,
    #   icon is the "computed" icon for the item (as an integer, because some objects like materials or textures
    #   have custom icons ID, which are not available as enum items).
    #   active_data is the RNA object containing the active property for the collection (i.e. integer pointing to the
    #   active item of the collection).
    #   active_propname is the name of the active property (use 'getattr(active_data, active_propname)').
    #   index is index of the current item in the collection.
    #   flt_flag is the result of the filtering process for this item.
    #   Note: as index and flt_flag are optional arguments, you do not have to use/declare them here if you don't
    #         need them.
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag):
        ob = data
        slot = item
        ma = slot.material
        print(item.name)
        # HERE
        # HERE
        # HERE (If he name is "Material", dont draw that item)

        # draw_item must handle the three layout types... Usually 'DEFAULT' and 'COMPACT' can share the same code.
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            # You should always start your row layout by a label (icon + text), or a non-embossed text field,
            # this will also make the row easily selectable in the list! The later also enables ctrl-click rename.
            # We use icon_value of label, as our given icon is an integer value, not an enum ID.
            # Note "data" names should never be translated!
            if ma:
                layout.prop(ma, "name", text="", emboss=False, icon_value=icon)
            else:
                layout.label(text="", translate=False, icon_value=icon)
        # 'GRID' layout type should be as compact as possible (typically a single icon!).
        elif self.layout_type == 'GRID':
            layout.alignment = 'CENTER'
            layout.label(text="", icon_value=icon)

    def filter_items(self, context, data, propname):

        helper_funcs = bpy.types.UI_UL_list

        mats = getattr(data, propname)

        # Default return values.
        flt_flags = []
        flt_neworder = []

        flt_flags = [self.bitflag_filter_item] * len(mats)

        for idx, mat in enumerate(mats):

            if mat.name == "Material" :#or mat.name == "Material.002":
                flt_flags[idx] &= True

        flt_neworder = helper_funcs.sort_items_by_name(mats, "name")

        return flt_flags, flt_neworder

# And now we can use this list everywhere in Blender. Here is a small example panel.
class UIListPanelExample(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "UIList Panel"
    bl_idname = "OBJECT_PT_ui_list_example"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout

        obj = context.object

        # template_list now takes two new args.
        # The first one is the identifier of the registered UIList to use (if you want only the default list,
        # with no custom draw code, use "UI_UL_list").
        layout.template_list("MATERIAL_UL_matslots_example", "", obj, "material_slots", obj, "active_material_index")

        # The second one can usually be left as an empty string.
        # It's an additional ID used to distinguish lists in case you
        # use the same list several times in a given area.
        layout.template_list("MATERIAL_UL_matslots_example", "compact", obj, "material_slots",
                             obj, "active_material_index", type='COMPACT')

def register():
    bpy.utils.register_class(MATERIAL_UL_matslots_example)
    bpy.utils.register_class(UIListPanelExample)

def unregister():
    bpy.utils.unregister_class(MATERIAL_UL_matslots_example)
    bpy.utils.unregister_class(UIListPanelExample)

if __name__ == "__main__":
    register()

explanation here:
https://docs.blender.org/api/current/bpy.types.UIList.html
you filter your list by
def filter_items(self, context, data, propname):

important in your case is the return list flt_flags, which decides which lines will be shown

Thank you so much! Didn't know about the filter function! Works as charm, much appreciated friend :)

you are welcome


text:
How to reload an Addon to see changes?
I'm developing an addon, and originally I made it as a single file.
When it was like that, I could simply execute "Reload scripts" in Blender to reload the changes I did to the script.
But after separating it into a package, I noticed the "reload scripts" dont work anymore, it doesn't show new changes. I need to close Blender and load the file again to see the changes. Is not that the script has a problem or anything. After re-executing blender again, the changes I made (like simple prints()) show.
But is a bit... clumsy, having to quit and reload over and over.
Do you know how can I reload my addon without quiting blender?
(I also tried disabling and enabling it from addons, but dont work)

Hello. I can't recommend enough this how to for developping using an external IDE https://b3d.interplanety.org/en/using-microsoft-visual-studio-code-as-external-ide-for-writing-blender-scripts-add-ons/ It automatically updates your addon when you save the text file (you do have to enable it in the plugin settings)

Ty so much, you are always helping friend. I followed it (specially the part about multifile addons (https://b3d.interplanety.org/en/debugging-multifile-blender-add-on-by-quick-reinstall/)), but sadly I wasn't able to make it work after battling for hours. Not sure if the article is outdated (it says is for 2.79). I tried changing missing parts (bpy.ops.wm.addon_install and enable dont exist in current Blender version).
I think the problem is that I have sub folders (with classes, icons) and such. Only root files are "reinstalled"/copied, but not sub folders, they are missing. Any idea?

If you have subfolders, you should add a file called __init__.py in every folder. The file contents can be empty (no text), but the file should be there. Last I checked it was still usable for newer version, autocomplete is not mandatory for it to work, but it's helpful. IIRC there are recent versions on the autocomplete github

Yes, I have init.py in the folders (if now they would not be recognized and the addon wont work). But their content is copied from temp to the root, is ignoring original subdirectories.
What you mean with autocomplete?
And you mean this repo https://github.com/JacquesLucke/code_autocomplete ? (it says it was updated 8 years ago). I wasnt able to find reload examples.

I'm using VS Code for an IDE. This is the easiest way I've found to install the autocomplete: you can get the most up to date autocomplete files at: https://github.com/nutti/fake-bpy-module On the right hand side of that page where it says Releases, click the Latest button. You can get a zip file for the Blender version you want. You don't have to use pip, or any of the other methods to install it. The "Korchy" Github files link from the ".b3d, etc." page @Gorgious mentioned come from the "nutti" page. Continued...

The files on the "nutti" page I refer to can be used by creating a folder, unzip the file in that folder and follow the instructions regarding setting up the settings JSON file on the "b3d" page Gorgious mentioned. It has been a long time, so I might be wrong, but I seem to remember that if the multi file addon you are working on is what you have installed in Blender, that what Gorgious says in the first comment works.

Thank you so much for the help @curious_1! I have to say that Im kinda lost; does the autocomplete help with reloading the addon? I mean, I was already using vscode (vscodium to be precise) and the autocomplete already works perfectly for me.
My problem is that after changing the addon into multiple files, the reload scripts operator inside blender doesn't update changes anymore (I read somwhere that it only reloads the init.py, so changes in other files are ignored)

My bad guys! I was using VSCodium instead of VSCode. Despite I thought I had everything setted correctly (and also having the Auto Reload on save that @Gorgious said, seems the extension wasn't working propperly). I installed VSCode and omg, works great. Im surprised the debug is working. But I still not sure what I have to do for my addon to be recognized for auto reload. I have this message: https://i.imgur.com/Ek873rC.png (I guess those two are being reloaded, but mine not). Any chance you know some manual or tutorial for this?

"does the autocomplete help with reloading the addon?" No. And, after a quick test with the multi file addon I was thinking of, which has all the files in one folder, nothing new appeared after making some changes and reloading it. I must have been remembering a single file addon when I said I thought that reload worked. Unfortunately, I don't know of any tutorial, etc., that mentions reload for a multi file addon, or one using multiple folders.

Thanks for the answer @curious_1 :) I finally managed to solve it (I edited the post, if you want to know how). Yeah, with single files works great. In case you dont have installed, I recommend you a lot the Blender Development extension for VSCode. Even though the documentation is very poor IMHO (it says that it handles automatically auto-loading existing addons, but it don't specify how).
Thanks again for the help guys, much appreciated :)

For auto-reloading go to the preferences in VScode, in the Extensions panel look for Blender, then look for Reload on Save https://i.sstatic.net/QqFXJ.png BTW on this site you should write your answer in a new post in the bottom of this page (Named "Your Answer") instead of updating the question, otherwise it won't be recognized as a solved topic. You can also check the green mark afterwards so it can be archived as solved and get referenced for future use. Cheers

sorry, my bad @Gorgious. And yes, I had that option on. I think I've done everything the addon says (basically start blender with the vscode command, doesn't say much more). And when saving it sends a message: https://i.imgur.com/Ek873rC.png (Im not sure if those are the only addons that were reloaded. TESTAUTOLOAD was an addon test I made with the extension commands in vscode. I saw it has an ´auto_reload.py´. I tried copying to mine and adjusting my __init__.py to look as the one from the script generated. But no luck. I dont know how to make it work

Solution I've found
It is a Python thing. Once a module is imported, the interpreter won't automatically reload the changes.
So, when we reload the scripts in Blender (using operator "Reload Scripts"), Blender is only "truly reloading" the init.py files of the addons. But not the rest of the modules. We have to handle by ourselves.
Here is how (original source):
# (In your __init__.py)
# When bpy is already in local, we know this is not the initial import...
if "bpy" in locals():
    # ...so we need to reload our submodule(s) using importlib
    import importlib
    if "my_submodule" in locals():
        importlib.reload(my_submodule)

# This is only relevant on first run, on later reloads those modules
# are already in locals() and those statements do not do anything.
import bpy
import my_submodule

This way, the "Reload Scripts" will work as normal with multiple-files addons.


text:
Reverse GreasePencil frames via python?
I'm trying to make a operator/script that reverses the selected
Here is the script with the basic code:
import bpy
from bpy.types import Operator, GreasePencil, Context, GPencilStroke, GPencilStrokePoint, GPencilLayer, GPencilFrame, GPencilFrames, GPencilStrokes, UILayout, Event, Object

def get_gpd(context:Context)->GreasePencil:
#    return context.gpencil_data
    return context.active_object.data

def get_selected_gpencil_frames_in_layer(grease_pencil:GreasePencil, layer:GPencilLayer)->GPencilFrames:
    selected_gpframes = []
    for frame in layer.frames:
        if frame.select:
            selected_gpframes.append(frame)
    return selected_gpframes

def reverse_selected_frames(context):
    # I tried setting off the Autokeying
#    bpy.data.scenes["Scene"].tool_settings.use_keyframe_insert_auto = False

    gpd:GreasePencil = get_gpd(context)
    selected_frames_in_active_layer = get_selected_gpencil_frames_in_layer(gpd, gpd.layers.active)
    _frame_numbers = [frame.frame_number for frame in selected_frames_in_active_layer]

    # Reverse
    _frame_numbers.reverse()

    print("_frame_numbers:" , _frame_numbers)

    # I tried offseting the frames in case it was some kind of overlaping-frames problem
    for frame in selected_frames_in_active_layer:
        frame.frame_number = frame.frame_number + 9000

    for i,frame in enumerate(selected_frames_in_active_layer):
        _debg_after_frame = frame.frame_number
#        frame.frame_number = _frame_numbers[i-1] # before reversing the _frame_numbers
        frame.frame_number = _frame_numbers[i]
        print(f"Before: {_debg_after_frame}    After: {frame.frame_number}")

reverse_selected_frames(bpy.context)

The script seems to work correctly, but is like the changes are not "consolidated".
Made a little gif to show it. The changes only have effect when I manually drag the keyframes a bit. And then the animation is reversed as expected.

Is there any thing Im missing?
PS: I know there is a Mirror operator in the Dope Sheet Context Menu -> Mirror even though, the reverse-frames-code is part of another operator and I can't call that Mirror OT since I get wrong context. Also, the reverse effect I want to achieve is different than any in the Mirror options.
Thank you so much for any help/idea, much appreciated.
PS2: I found this question with a similar issue. None of the workarounds work in my case (Blender 3.6 and Blender 4.0).

hi, just a suggestion but you could implement the same functionality in a totally different way, using scale -1. It would go something like this:
a) work out the length of the selected animation ,
b) move the playhead to the halfway point ,
c) scale -1 ,
d) put back the playhead where it used to be.
There a bunch of pitfalls you'd have to take into account, like if the length is an even number it might shift all frames by 1, which might accidentally overwrite the next frame along, so by the end it might be more complicated, i'm not sure, but worth a look

@pevinkinel thank you so much, I hadn't thought about that option! Sadly, despite technically works, has the same problem (the dopesheet dont updates if its called via script (not until you move a frame via the interface :( )). But much appreciated the idea mate!


text:
How do I deform an object smoothly?
I am very, very new to blender and just learning how to deform. However, I am unable to figure out how to deform a pre-existing obj.
To describe what I mean,
There is a deflated balloon/semi-circle hanging under a flat plane. In the original obj, the plane and the balloon/circle are considered separate parts. Now what I'm trying to do is to push the balloon so that it inverts/flips. So far, selecting vertices and pulling makes it look awful. I tried to hook as well, but it does not deform nicely.
Is there a way I can make the obj behave less 'rigid'? Maybe consider that the balloon is a cloth and deform as I pull it?

This is only a rough example, but what I aim to do is by pulling the top of the sphere down, the rest of the semi-circle will deform to follow it, instead of just the edges

An image or a file could help ;)

I've made a very rough model and I hope the point in conveyed. However, unlike the picture, they are both a single obj though they have been divided into different sections


text:
Why is it grainy in this part?
I have no idea why is it grainy on the left side. But on the right side it is ok. I added additional lights on the left side but the problem is still there. Any tips? I am struggling about lighting the rooms.

Artifatcs are caused by overlapping faces.
On the right side you have this situation (correct):

while on the left side (overlapped/dubled geometry):

You can clearly see the problem also in Solid view display mode.

As faces shares the same location, camera rays can't tell which one is visible from camera, so shows a bit of one and a bit of the other.
You have to create a gap between faces

i deleted the overlapping objects and it's ok already. Thank you. Sorry for this noob question

your green wall's face is overlaping the other wall (behind it). move it a tiny bit away.
(i also suggest you to make your roof a bit less shiny with a lower specular intensity and hardness)


text:
Extrude curve circularly
having consulted How can I extrude a dome from a circular face?, I realize I could probably use that method to achieve what I'm looking for (a stool cushion). However I already have a curve with the wanted form and was wondering if there's something like a circular extrusion.

is it symmetric? if so use the Screw modifier http://blender.stackexchange.com/questions/28976/how-to-model-the-rounded-outline-of-a-column

You can try to convert the curve to mesh and then just extruding to the shape you want converting the curve to mesh shortcut is alt+C i think  but maybe there is better way how to do it is long time i use blender


text:
Prevent that changing an Operator's property retriggers the operator?
I'm making an operator that has the bl_options = {'REGISTER','UNDO'} in order to call the undo menu.
Since my menu's draw() is getting cluttered with lots of properties, I thought about making an enum that served as some kind of tab-system so, depending on which option is selected, I draw X or Y:

My problem is that when I change that enum, the execute() in my operator is triggered. I don't want that (my operator is a bit heavy, and that enum has nothing to do with its calculations, so I would like the user to change """tabs""" without the lag of waiting the operator to finish.
Is it possible to achieve?
Thank you so much.

Code with Gorgious' idea:
import bpy

# def main(context):
    # for ob in context.scene.objects:
        # print(ob)

class TestOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.test"
    bl_label = "Simple Object Operator"
    bl_options = {"REGISTER", "UNDO"}

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        # main(context)
        # for i in range(1000):
        #     print(f"executed! ", i)
        print(f"operator finished!")
        # print(f"{context.scene.test_tab = }")
        return {'FINISHED'}

    def draw(self, context):
        layout = self.layout
        layout.label(text="Hello!")

        # # Scene
        # _selected_tab = context.scene.test_tab
        # layout.prop(context.scene, "test_tab")

        # # GreasPencil
        # _selected_tab = context.gpencil_data.test_tab
        # layout.prop(context.gpencil_data, "test_tab")

        # # Object
        _selected_tab = context.active_object.test_tab
        layout.prop(context.active_object, "test_tab")

        if _selected_tab == "GRAVITY":
            layout.label(text="     Gravity selected!")
        elif _selected_tab == "FX":
            layout.label(text="     FX selected!")

# def menu_func(self, context):
#     self.layout.operator(TestOperator.bl_idname, text=TestOperator.bl_label)

# Register and add to the "object" menu (required to also use F3 search "Simple Object Operator" for quick access).
def register():
    bpy.utils.register_class(TestOperator)
    # bpy.types.Scene.test_tab = bpy.props.EnumProperty(
    # bpy.types.GreasePencil.test_tab = bpy.props.EnumProperty(
    bpy.types.Object.test_tab = bpy.props.EnumProperty(
        name="Draw tab",
        items=(
            ('GRAVITY', "Gravity & Rotation", "", "GREASEPENCIL", 0),
            ('FX', "FX", "", "GREASEPENCIL", 1),
        ),
        default='GRAVITY',
        )
    # bpy.types.VIEW3D_MT_object.append(menu_func)

def unregister():
    bpy.utils.unregister_class(TestOperator)
    # del bpy.types.Scene.test_tab
    # del bpy.types.GreasePencil.test_tab
    del bpy.types.Object.test_tab
    # bpy.types.VIEW3D_MT_object.remove(menu_func)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.test()

Hello ! If this property doesn't affect the operator whatsoever, I think you should store it somewhere else and put it in a panel somewhere else in the interface so it doesn't interact with the redo system

Hello Gorgious! Thank you so much for the idea, much appreciated! To be honest I was hyped and thought it was going to work, but sadly no (damn haha). I registered the enum in the Scene rather than in the OT (also tried other types like Object and GreasePencil (just in case)), but seems that even if the enum is not part of the operator's properties, it stills get triggered when I change it (I edited the answer with the code).
Do you mean to place the property outside the Undo panel? (If so, I think that when we change it, it will close the OT's Undo panel)

Ah yes I think any property changing in the undo panel will triggeer a redo, and changing a property outisde of the undo panel will close the panel. Maybe you want to change the way you're going about it ? it's maybe an XY problem and it can be solved by other means ?

Maybe you want to check inside execute() if any property that actually matters has been changed (by storing the values of previous settings)? This would still pollute the undo history, but would at least save CPU cycles.

@Gorgious Yeah, probably there is a better way. I thought that maybe Blender had somekind of method for a folding panel in the UILayout or something similar to achieve what I want, but I wasn't able to find anything. I guess it would be easier to simply add the operator as a panel in the N menu.

@MarkusvonBroady Thank you so much, very good idea! It works, but the bad news is that since the undo is still called, I loss the visualization/thing that the operator is doing and is a bit uncomfortable and non trivial to see what is happening.
Thanks again for the help guys, very much appreciated. I guess I will leave the UI a bit cluttered since it seems there is no practical solution.


text:
Iterate over all panels in screen?
I have a timer that is running in the background.
I'm trying to identify the running operator by its panel, so when that operator's panel goes away, I execute some code.
I thought about iterating all the panels in the screen, and checking for the one with my operator, so I can check when its panel goes away.
Edit: I mean to check that kind of panels that appears when an operator is running:

Is that possible?
PS: I know there is bpy.context.active_operator, but this stores the last one until a new one is executed (so it is stills storing the operator even after its panel is hidden)
Thank you so much for the help.


text:
Altering transparency / thickness of rising smoke
How can I create a more transparent, thinner bottom area of smoke, then rising higher to be much thicker and opaque? It will not need to be animated.

Perhaps turn on flame and use its material properties to drive opacity?


text:
What are the parameters event and full_event of UILayout are for?
can someone help me to understand the function of the parameters event and full_event of UILayout, please? The only description i can find ist this from the documentation (https://www.blender.org/api/blender_python_api_2_77_release/bpy.types.UILayout.html#bpy.types.UILayout.prop):
event (boolean, (optional)) – Use button to input key events
full_event (boolean, (optional)) – Use button to input full events including modifiers

But what buttons can/should be used to input key events? I can't find an difference to the version without event=True. And i can't find an example, too.
Thanks

just guessing, but 'modifiers' in this case could be keys like Ctrl, Shift, Space

I think that could be right - this is my assumption, too. But that's not my main question.

'event' and 'full_event' parameters allow to get a keystroke value.

'event': a key with no modifier
'full_event': a key with modifiers

Here is a sample code:
import bpy

class HelloWorldPanel(bpy.types.Panel):
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    keymaps = []
    keymapitem = None

    def draw(self, context):
        layout = self.layout

        obj = context.object

        #Allow to get a key on a locally defined property
        layout.row().prop( obj, "myProperty", event = True )
        #Allow to get a key: no, does not work
        layout.row().prop( obj, "myProperty", full_event=True )

        #Allow to get a key on an existing property
        layout.row().prop( context.scene.game_settings, "exit_key", event=True )

        #Allow to get a full event key on a keymap item
        layout.row().prop( HelloWorldPanel.keymapitem, "type", full_event=True )

def register():
    #Enum property to define the allowed keys for this property
    bpy.types.Object.myProperty = bpy.props.EnumProperty( items=[('A','A',''),('LEFT_CTRL','LEFT_CTRL',''),('LEFT_ALT','LEFT_ALT','')] )
    bpy.utils.register_class(HelloWorldPanel)

    #Create a keymap and a key
    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name='Test', space_type='EMPTY')
    kmi = km.keymap_items.new(HelloWorldPanel.bl_idname, 'LEFT_SHIFT', 'PRESS')
    #Store them here
    HelloWorldPanel.keymaps.append(km)
    HelloWorldPanel.keymapitem = kmi

def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)
    del bpy.types.Object.myProperty
    wm = bpy.context.window_manager
    for km in HelloWorldPanel.keymaps:
        wm.keyconfigs.addon.keymaps.remove(km)
    del HelloWorldPanel.keymaps[:]

if __name__ == "__main__":
    register()

Some explanations and remarks:

For a locally defined property (myProperty in the code above): the property is an enum which defines the scope of the possible values. But it seems that the user will not be warned if she/he choose a not wanted value.
You can use it for built in properties, like 'context.scene.game_settings' above.

But in both previous cases, I've found no solution to use 'full_event'.

Last example using a keymap item. Here choosing its type as attribute allows the usage of 'full_event'.

I don't know why some are working with 'full_event' and not others, as the enum described in the documentation seems to be the same. See the documentation here.

i've tried out your example. But unfortunately your answer is/was too late for me because i've already finished my master thesis. So I'll not search for further information. Nevertheless thanks for your answer.


text:
Why meshes lose material when joined?
When separate, meshes keep their materials. When I join them, some of them seem to lose material. Correct material still displays in the material properties panel. Assigning it again doesn't change anything, neither does finding image texture again. What can be wrong? How to join meshes without losing texture? (The object starts to look black)

check this answer, it might  be what your looking https://blender.stackexchange.com/questions/93726/texture-disappear-on-joining

I found solution in this video :) https://www.youtube.com/watch?v=RaIxZT_gLw0
the problem was diferently named UVs

Thanks! :)  this helps, there is sililar video i found, and posted below. Thank you!!!


text:
Animated mix shader doesn´t work
I created a video in Blender 2.8 today.
Unfortunately, the text I blend in via an animated factor in a mix shader, does not show up in the render preview (shift+z).

Dies ist eine Englisch sprachige Seite. Mit Deutsch kommst Du hier nicht weit! There is no Blender 2.9 yet. Also you should provide some screenshots or the blend file if you can. You didnt even ask a proper question. One question mark is enough, we are not 4chan. Does it render properly when hitting F12?

yeah, I think we need more information.  Screenshots would be nice?


text:
Curve path on sphere
I have a sphere with mapped imaged of the earth.  I want to show a tiny sphere following the path along from one point to another like and airplane. I did this already representing a ship on a flat map.  I used a sphere on a bezier curve with an array modifier.
I used front view to ensure that the curve and the sphere were above the level of the plane/map.  However, with the sphere/globe, I cannot get the curve to the top.  It goes through the middle or behind the sphere.  I tried everything I could think of (I am very new to this so everything is not much) and I searched to see if someone else asked the same question but was unable to find what I needed.
Can anyone help straighten me out?  Thank you so much.
This is the file that I created using the map and bezier curve with modifiers

This is the globe that I want to add a similar path to

Could you show a screenshot of the scene showing the issue? Is the 3D cuve intersecting with the sphere?

Please share both of your blend files so that I can take a look at it? You can do this by uploading the blend file on this site - https://blend-exchange.giantcowfilms.com and copy + pasting the generated url here.

This is the file that I created using the map and bezier curve with modifiers.

This is the globe that I want to add a similar path to

Not sure how to add a screen shot here

The Great Circle.
The shortest path between two points on a sphere is on an arc of the great circle

Test result using method below. Fly from Oz to US change bearing, off to Brazil.  Have also scaled up the path while in flight
To emulate this in blender, for example sake, add a default sphere, and a default bezier circle. The circle sits like the equator on the surface. This will be our flight-path. Can scale it up to make it above surface.
Add two empties to Scene. Give each a follow path constraint, using the circle as target,  and set to type Fixed Position and Follow Curve. I've chosen -X as forward, and Z as up.
Please note, all objects have the default location (0, 0, 0)

Unselected empty at offset 0.  Next empty with some offset.
Positioning.
Adjust the rotation values of the bezier circle until it crosses source position  (Will mirror lat long to some extent.) Move one empty to this point by adjusting  offset.  With the empty selected, align view to it using ⇧ Shift NUMPAD 1  (since -X is forward) The view is now aligned such that the empty lies directly above the origin.
Select the circle, rotate using R in the ui until it crosses your destination point. Finally adjust the offset of empty 2 until it is above desired point.

_Rotating the circle in view aligned to destination empty.
Can now fly our plane from source to destination (empty one to empty two), by using a follow path constraint and animating its offset from that of  empty one to offset of empty two.

You can try doing this:

Add the curve
Switch to edit mode and  subdivide the curve 4-5 times (press w to subdivide)
Add shrinkwrap modifier to the curve. Accept the default setting and as target set the sphere. Apply the modifier.
Now add the small sphere, with the array modifier and then the curve modifier with the settings you want (as done in the other blend file).

I am attaching the example blend.

It's hard to keep a Bezier curve aligned with an arbitrary surface because its control handles won't play fair, so, despite having to take a destructive step, perhaps it's easier to start off with a mesh.

Set Snap to ON / Face / Active, with Align Rotation switched on
Create a single vertex. An easy way to do this is to create a plane, snap it to the surface of your sphere, and with 'Automatically Merge Vertices' switched on, Alt M merge its vertices at center.
Assign a Srinkwrap modifier to the vertex, with an offset to keep it above the surface of the sphere, and 'Keep Above Surface' checked. (Make sure the modifier is visible in Edit Mode)
Above the Srinkwrap, assign a Subdivision Surface modifier, with level, say, 3.

Now, by E extruding the vertex, you can draw a smooth curve around the sphere, much as you would if you were retopologising it.
When happy, you can duplicate the mesh curve for safety, and, in Object Mode, Apply the Subdiv., and AltC convert it into a true curve.
If you need to, there are still lots of things you can do to the curve after the conversion: for example, in the Tool shelf, you can convert the Spline Type to Bezier, to get your handles back, or NURBS, to keep all the control points on the surface, and reassign a Shrinkwrap...  but  editing the curve will put you into a similar position as you were in when you asked the question, (at least starting with an aligned curve, though).
For this job, though, you could probably use the curve as it is.

Thank you very much for the suggestions. Looks like this task was above my "pay grade" to begin with but I am always up for a challenge and new learning.  Naturally I will try what looks like the easiest one first and failing that, go on to the next. I will let you know how I make out.  Won't be for a day or two.


text:
Reliable way to find out the required context for an operator?
Seems that this question was asked before but was not answered.
I already found this answer, where it was suggested that if you send an empty dictionary as override, it's supposed to show you what context elements are required to run the operator.
But this didn't work for the operator I'm interested in:
bpy.ops.cycles.use_shading_nodes({})

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Blender Foundation\Blender\2.74\scripts\modules\bpy\ops.py", line 187, in __call__
    ret = op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Operator bpy.ops.mesh.select_all.poll() failed, context is incorrect

So my question is, is there a reliable way to find out what the required context is for an operator? (The docs are no help here. Source might be, but I'd rather avoid that search for a needle in a haystack unless I'm really desperate...)

Yeah the source is the definitive answer: I think you allude to this question ( http://blender.stackexchange.com/questions/30364/how-to-find-an-operators-source-code ) . But you probably don't want this in the first place. Is your real problem ' i want to create a material and set it to use shader nodes - via script '  ?

Thanks. Unfortunately I do indeed want to set the background material to use nodes via a script... I hope someone will have another idea that doesn't involved delving into the source, but if there's no choice, it won't stop me :)

It really comes down to people trying to use operators that aren't intended to be used anywhere other than as a response to a user clicking a menu item. During that menu interaction the operator has the correct context, but outside of it.. in a script for instance..which tends to have a sort of 'no-mans-land' (or very often the wrong ) context.. it will fail. Looking for a way to override the context, for every possible operator, is not necessary, as the context limitation is often mitigated by using more low level bpy calls. (In the end also this results in more manageable code.. )

This ties into my "bpy.ops has cooties" philosophy.  In an ideal world each function in bpy.ops would clearly document the context it requires, but it would be a major effort to update all the docs.  Even requiring that documentation for new operators would encounter resistance from the coders who are working full-tilt to keep the bugs under control while adding important new features.

Asking for a way to find the context for all possible operators that need such an override is at the same time ignoring all the responses to people looking for their specific override for their needs.
As is often the case with 'context is incorrect', there is a solution that's much simpler and (more) logical than the potential workaround using context overrides. While most operators can take an override context, you will invariably (if you dig deep enough) find several that can't. You will also find operators which are the only way to achieve some goal.
For all other cases where there's a better way to do it without the operator in question, you simply use the lower level bpy code. Ask, we will always give an answer, or dig using the Info console and track the changes in bpy.data to see what got added and which parameters are adjusted after a manual Operator invoke (ie you click a button, and that calls the operator in question).
(Sometimes a context override is the only way, but not this time)
Make a new world material.
>>> m = bpy.data.worlds.new('amazon')
>>> m.use_nodes = True
>>> m.node_tree
bpy.data.node_groups['Shader Nodetree']

>>> m.node_tree.nodes['Background'].color
Color((0.608, 0.608, 0.608))

# setting current scene world
>>> bpy.context.scene.world = bpy.data.worlds['amazon']

Thanks, this will probably solve my specific problem (will update). And I agree that overriding context isn't a solution for everything. But it would be nice to hear some additional thoughts about methods for finding the context  for an operator though :)

I don't know what to say.. To my mind the links you listed and the one I mention about the source code , cover this concept exhaustively. There's not a lot extra to add. But maybe we have failed to communicate some essence here..

They do, and it's much appreciated! I don't doubt that you can find an answer to most any question about operator context with them.
But if there's something I've learned, it's that sometimes there's a faster trick lying in hiding. Since there's a big bunch of smart experienced people writing here, I still have a sliver of hope that this kind of trick might be revealed. If there's nothing in a couple of days, I'll wave the white flag and mark this as question as closed :)

well, this question has plagued new Blender scripters since 2009 (Blender 2.5 onwards...) know that. ..and if you don' t get an answer that satisfies, it's not because we don't want to share some secret :)

Never crossed my mind :)

The only definitive way to find out why an operator fails is to read the source code indeed, which is said in the docs by the developer that knows the most about Blender Python API. A blank dict is a hack that works sometimes, but other than that, there's no way to tell from Python. Operators are like blackboxes.

Alrighty, I give up! :-D


text:
Mesh breaks after using Solidify Modifier
I'm working on a wave effect using the wave and solidify modifier. See screenshot 1.
This works kinda fine, but the final step is to fill the center hole. As soon as I do that, the center mesh breaks. See screenshot 2.
Any ideas why this might happen?
Mark

Try enabling the even thickness checkbox in the modifier

perhaps after filling it's no longer manifold, e.g. because you keep the internal faces.

Thanks for the comment. @Akshay2005 Unfortunately that did not work.

@MarkusvonBroady What do you mean? The second screenshot shows the pentagon filled, which results in breaking it. Do you mean the topology is lost/changed after filling? How can I keep it in tact?

@MarcusMaximus do you know what "manifold" means? https://www.sculpteo.com/en/3d-learning-hub/create-3d-file/fix-non-manifold-geometry/


text:
How can I view the whole model? There seems to be a "shadow" that shows only shows portion fo the model

I am trying to view a .stl model, but when I zoom out, there seems to be a some sort of a "shadow" that only goes about certain distance from the camera. Is there a way to remove this "shadow"?

this is your clipping distance, id imagine that when you imported it the scale has been multiplied by some factor. due to the fact clipping is set by default to 1000m, i doubt you need an .stl this big. fix by scaling down or navigate to the little left arrow next to your gizmo, go to view and increase the clipping end to what ever is needed.

Thank you! I didn't know that the concept is called the "clipping distance", so I will do better next time when doing some search on my own. I have scaled down the model and it worked! thank you :)


text:
How can I create my own Buttons on the Topbar and run my own script by clicking on them?
I've already added the buttons, but strangely they appear on the left and right.
Here is my python script:
import os
import bpy

bl_info = {
   "name": "Name",
   "author": "Name",
   "version": (1, 0, 0),
   "blender": (3, 3, 1),
   "location": "Outliner",
   "description": "Adds an example button to the outliner header.",
   "wiki_url": "",
   "category": "Outliner"}

class My_Button(bpy.types.Panel):
  bl_idname = "example.something"
  bl_label = "Test"
  bl_description = "This operator does something"
  bl_options = {"REGISTER"}

def draw(self, context):

   self.layout.operator(
       operator='import_scene.gltf',
       icon='MESH_CUBE',
       text='Import GLB'
 )
  self.layout.operator(
     operator='export_scene.gltf',
     icon='MESH_CUBE',
     text='Export GLB'
  )

classes = (
  My_Button,
  )

def register():
   bpy.types.TOPBAR_HT_upper_bar.append(draw)

def unregister():
   bpy.types.TOPBAR_HT_upper_bar.remove(draw)

if __name__ == "__main__":
   register()

Check context.region.alignment:
import os
import bpy

def draw(self, context):
   if context.region.alignment == 'LEFT':
       self.layout.operator(
           operator='import_scene.gltf',
           icon='MESH_CUBE',
           text='Import GLB'
       )
       self.layout.operator(
         operator='export_scene.gltf',
         icon='MESH_CUBE',
         text='Export GLB'
       )

def register():
   bpy.types.TOPBAR_HT_upper_bar.append(draw)

def unregister():
   bpy.types.TOPBAR_HT_upper_bar.remove(draw)

if __name__ == "__main__":
   register()

This can be easily found, if you enable developer extras and check source of the panel:

Ok, thanks, that works.

But what I don't understand is, how can you run a script with a click on the button?
For example: I want to export glb to a specific location with one click.
How do I find out what to write there?
Unfortunately I haven't programming knowledge, I'm just a 3D Artist

If you have another question, please post it as a separate question.


text:
Select only top outer wall
Beginner in Blender, Please pardon if it's a noob question, But I tried several methods to achieve this.
I have a 3d Case I want to increase the height of the walls, without changing anything (holes, etc.) However not able to find a suitable way to do it
Thanks in advance.

The faces are also on the same plane, so you could select one of them and use Select Similar menu (Shift+G) and choose Coplanar. You might need to adjust the Threshold in the Adjust Last Operation menu.

Although my design is a bit complex however your answers help, adding and removing a few vertexes manually, I wonder if we can reduce some vertex noise, without changing anything. It will help to better select what I want.

The selection functions work on models of any complexity. Maybe there are some issues with the model. Try recalculating normals(shift+n with all selected in edit mode) and merging vertices by distance to remove double vertices (m -> b with all selected in edit mode and adjust merge distance to very small).

With your object selected, go in Edit Mode with ↹ Tab
Set your view to the side using Numpad 1
Toggle ON the X-Ray using ⎇ AltZ or clicking this button:

Make sure you are in Face Selection mode:

Make sure you have nothing selected by pressing ⎇ AltA
Drag a rectangle selection over the top faces of your mesh, try to make the rectangle barely go over the top faces

Since your faces are all flat, you should be able to move them in one direction by pressing GZ Z, moving your cursor, and  LMB to validate the move.


text:
How to import obj file without material
I have a script that repeatedly imports and deletes different .obj files.

But since the files are imported with standard empty material, a lot of garbage accumulates.

Is there a way to import files without assigning empty material to them?
I did not find something like: create_a_standard_material: True/False
bpy.ops.import_scene.obj(filepath="", filter_glob="*.obj;*.mtl", use_edges=True, use_smooth_groups=True, use_split_objects=True, use_split_groups=False, use_groups_as_vgroups=False, use_image_search=True, split_mode='ON', global_clamp_size=0, axis_forward='-Z', axis_up='Y')

I don't think any of the default Blender importers have such an option. I wish they did, though. For armatures too.

Just delete the material after you import?

My script imports and deletes several dozen objects in one pass. Imagine if there are several tens or hundreds of such useless materials and they are mixed with other, useful materials. It just takes inhuman patience to dig through this pile of rubbish. So manual removal is not an option. Of course, in the process of working on a project, you can add the materials I need to some list, but this is extra labor costs, and besides, you can easily get confused. Therefore, if there was a way to simply turn off the automatic creation of material, then this would save a lot of time and nerves.

authors: Давид Сировский


text:
How to enable undo for operators in sculpt mode?
I wrote a operator like that, And when I run this from object mode, everything is fine but if I run from sculpt mode, it cleans all the undo history and I ain't able to undo anything I did before.
Why is that?
class MaskDecimate(bpy.types.Operator):
    bl_idname = "flow_tools.decimate"
    bl_label = "Mask Decimate"
    bl_description = ""
    bl_options = {"REGISTER", "UNDO"}

    invoked = False

    ratio = bpy.props.FloatProperty(
        name="Ratio",
        description="How much to recuce",
        default=0.5,
        min = 0.0000001,
        max = 1.0
    )

    @classmethod
    def poll(cls, context):
        if context.active_object:
            if not context.active_object.mode == "EDIT":
                return context.active_object.type == "MESH"

    def invoke(self, context, event):
        self.bm = bmesh.new()
        self.bm.from_mesh(context.active_object.data)
        wm = context.window_manager
        return wm.invoke_props_dialog(self)

    def execute(self, context):

        ob = context.active_object
        bm = self.bm
        bm.to_mesh(ob.data)

        layer = bm.verts.layers.paint_mask.verify()
        vg = ob.vertex_groups.new(name = "paint_vertex_group_mask")
        vg.add([v.index for v in bm.verts], 1.0, "REPLACE")

        for vert in bm.verts:
            mask_val = vert[layer]
            vg.add([vert.index], 1 - mask_val, "REPLACE")

        md = ob.modifiers.new(type="DECIMATE", name="Decmater")
        md.ratio = self.ratio
        md.vertex_group = vg.name
        bpy.ops.object.modifier_apply(modifier=md.name)

        bm = bmesh.new()
        bm.from_mesh(ob.data)
        layer = bm.verts.layers.paint_mask.verify()

        for vert in bm.verts:
            vert[layer] = 1 - vg.weight(vert.index)

        ob.vertex_groups.remove(vg)

        bm.to_mesh(ob.data)
        bm.free()
        return {"FINISHED"}

I've got the same issue with my addon for 2.92. Maybe this is a bug in sculpt mode.

As a variant of a solution. I could suggest adding history before all the code. But I'm pretty sure this is a bug in Blender's sculpt mode.
if context.mode != 'OBJECT':
    bpy.ops.ed.undo_push()

I've been struggling with this for a while and finally found a solution.
I created a custom operator that does the following:

change the mode to OBJECT
push an undo step
deselect all objects (might not need this step)

My implementation:
import bpy

class MPI_OT_ObjectMode(bpy.types.Operator):
    """Change to Object Mode and de-select all"""
    bl_idname = "object.mpi_object_mode"
    bl_label = "MPI Object Mode"
    bl_options = {'REGISTER', 'UNDO'}

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

    def execute(self, context):
        bpy.ops.ed.undo_push(message='Object Mode')
        if bpy.context.view_layer.objects.active == None:
            for o in bpy.context.scene.objects:
                bpy.context.view_layer.objects.active = o
                break
        bpy.ops.object.mode_set(mode='OBJECT')
        bpy.ops.object.select_all(action='DESELECT')

        return {'FINISHED'}

Then I just call this operator within the execute() function in other operators that I want to make accessible in SCULPT mode like so:
def execute(self, context):
    bpy.ops.object.mpi_object_mode()


text:
Custom Drag and Drop for importing .srt files
I made Subsimport that lets users import .srt files into the VSE. I'd like to improve it by allowing users to drag .srt files into the timeline instead of having to click the "Import" button.
Does anyone know how to connect a drag and drop event to an operator? I've read rumors that this ability was coming to Blender 2.8

Addon looks great.

Not sure if you already looked through some of the older(around 2013-15) posts about whether it's possible to handle from python(it wasn't). The last thread I saw about implementing some way for handling drag and drop imports from python ended with nothing in 2015 (link). That same thread had drag and drop import for .obj files from somebody, but iirc it was in C.
Rumor about it being in 2.8 is likely due to comment on similar post to yours here on stackexchange which didn't have any quotes/sources about it (link).
I think that rumor is based on the ability to drag and drop .blend files to open/link/append that's new to 2.8. I don't know if it will help, but there's a  developer thread about it, could be a starting point (link)

There is this ticket that is more recent and was clearly about providing custom DnD features through Python API: https://developer.blender.org/D4071


text:
FCurve Noise modifier: set "Offset" value using Python
First of all: excuse me for my terrible english.
Is there any way to set "Offset" value of "Noise" modifier in Graph Editor using Python?

Ok, I've found out this by myself.
bpy.data.actions['Compositing NodetreeAction'].fcurves[X].modifiers[Y].offset = Z


text:
Simplify grease pencil drawing in viewport for animating more easily?
I have a grease pencil object with a drawing/frame that I want to parent to an armature for animating it with bones.
My problem is that the drawing is a bit complex/has enough points to make my computer suffer when I move the bones and the mesh/grease pencil's points.
I tried adding a Simplify modifier after the armature modifier, but I didn't notice any improvement (maybe the opposite)
So I was wondering if Blender provides any solution for simplifying the drawing, at least in viewport simply for being able to move everything without lag.
(When animating a "normal mesh" in Blender, you can always duplicate it and remesh it to simplify its geometry, and move the armature without lag. Or even just hiding the mesh makes you able to move the armature normally. But with grease pencil, that doesn't happen. Not even hiding the grease pencil object, it seems like is being processed no matter it is visible or not)
Any idea?


text:
Blender Cycles Smoke not showing up
So, all I've done is quick smoke, then adjusted the temperature difference, and then adjusted the smoke domain. Now the smoke won't show up at all. What did I do wrong?

P.S. How do I add a blender file?

https://blend-exchange.giantcowfilms.com/

It works for me. Did you bake it?

Not yet. Oops. But now I have the issue that it is colliding like half a unit away from the wall, so it looks kinda dumb.

In one corner of the domain you can see a little cube, that shows the resolution. Probably it's pritty low, you have to increase it (cube will be smaller). Use as small domain as you can.

If you want to make mist, it's a built-in function in Blender. https://www.youtube.com/watch?v=CxNeMMZs_sM


text:
Rendered Video Causing Artifacts In Adobe Media Encoder
So, I've rendered this video (took about 25hrs(Mac book Pro 2015)), and now when I put try to encode it to .mxf it has lots of artifacts. I'll provide links and Blender file Below.
Here is a picture from Premiere Pro's timeline:
Here is the original video clip: https://drive.google.com/file/d/1F6AnVLV3z39P1WCsYUh8OVgpwxwUH4Qo/view?usp=sharing
Here is the .mxf file: https://drive.google.com/file/d/1YfI_ytThNXYAT-dZi5yT7TRH5-2qIjGC/view?usp=sharing
And the blender file (for the settings):

Well, I encoded it, but Davinci Resolve couldn't read it, so I encoded it in AME. But even in Premiere Pro it's really artifacted. How do you take the Image sequence of TIFF and make it a video easily? I'm not setting 720 images to 1 frame.