text:
Would like to modify an object from a button in a panel
I have created a panel in the Properties area in which the user can specify various parameters and then press a button to create the object.  I am trying to write a Python code to allow the user to modify an object that was previously created using either the same panel or a new modify object panel.  Two parts of this task are giving me trouble:

Identifying the object that has been selected.  The problem is that if I click on the screen so that no object is selected, when I do bpy.context.active_object, I still get the most recent object selected.  Also, if I deselect all the objects using bpy.context.active_object.select_set(False), I still get the last object selected as the active object.  If I can determine whether or not an object is selected, I can determine whether or not to edit an object or create a new object.
If an object has been selected and is going to be modified, I would like the geometric properties of that object to appear in the panel.  I can't retrieve the properties of a selected object in a draw method, so I am thinking that a modal operator may be the answer.  I am including my code with a simple operator and a panel.  After I create the operator, the modal operator will respond the next time I click on the object, but the code returns 'FINISHED', so it only detects selecting the object once and then, even if I modify the scene properties, they are displayed in the panel.

Here is my code:
import bpy
from bpy.props import FloatProperty

bpy.types.Scene.length = bpy.props.FloatProperty(name = "length",default = 2)
bpy.types.Scene.height = bpy.props.FloatProperty(name = "height",default = 1)
bpy.types.Scene.width = bpy.props.FloatProperty(name = "width",default = 1)

class DrawBlock(bpy.types.Operator):
    """A rectangular prism"""
    bl_idname = "myops.draw_block"
    bl_label = "Edit Block"
    bl_description = "Draw a rectangular prism"
    bl_options = {'REGISTER', 'UNDO'}

    height: FloatProperty (name="height")
    length: FloatProperty (name="length")
    width: FloatProperty (name="width")

    def new_block(self,context):
        width = bpy.context.scene.width
        height = bpy.context.scene.height
        length = bpy.context.scene.length

        bpy.ops.mesh.primitive_cube_add()
        obj=bpy.context.active_object
        obj.dimensions=(width,length,height)
        obj.location.z=obj.location.z+height/2
        obj.name="Block"

    def execute(self,context):
        obj = bpy.context.active_object
        if obj:
            w = bpy.context.scene.width
            h = bpy.context.scene.height
            length = bpy.context.scene.length
            obj.dimensions=(w,length,h)
        else:
            self.new_block(context)
        return {'FINISHED'}

    def modal(self, context, event):

        obj=bpy.context.active_object
        if obj:
            print("object selected: ",obj)
            bpy.context.scene.width=obj.dimensions.x
            bpy.context.scene.length=obj.dimensions.y
            bpy.context.scene.height=obj.dimensions.z
            return {'FINISHED'}

        elif event.type in {'RIGHTMOUSE', 'ESC'}:
            print("cancelled operation")
            return {'CANCELLED'}

        else:
            return {'PASS_THROUGH'}

        return {'RUNNING_MODAL'}

    def invoke(self,context,event):
        print("inboke block")
        self.new_block(context)
        context.window_manager.modal_handler_add(self)
        return{'RUNNING_MODAL'}

class SCENE_PT_Build(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "Build Menu"
    bl_idname = "SCENE_PT_build"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        obj = context.active_object
        row=layout.row()
        row.label(text="block geometry:")
        row=layout.row()
        row.prop(scene, "length")
        row=layout.row()
        row.prop(scene, "width")
        row = layout.row()
        row.prop(scene, "height")
        row=layout.row()
        button_text="New Block"
        if obj:
            buttom_text="Edit Block"
        row.operator("myops.draw_block",text=button_text)

def register():
   bpy.utils.register_class(SCENE_PT_Build)
   bpy.utils.register_class(DrawBlock)

def unregister():
   bpy.utils.unregister_class(DrawBlock)
   bpy.utils.unregister_class(SCENE_PT_Build)

if __name__ == "__main__":
    register()

I am not sure why the line obj=context.object does not seem to get any objects.  I think that a similar line in my real code does.
I am happy to learn about more effective ways of accomplishing this.  I have tried using the adjust last operation menu, but I think I have too many parameters for that to be worthwhile.

I can try to look more later, but there is definitely a difference between "active" and "selected"...you want to get the selected objects, which is bpy.context.selected_objects.  There are times when you don't want the active item to be selected...for instance if you want to subtract a vertex group from another, you set the 1st active, then select it, then set the 2nd active,  and deselect it. If active was the same as selected, that would be impossible. Or if you wanted to select a collection and then deselect one object in the collection.

Cool!  That works.  Thanks for the explanation.  I would like to be able to put the parameters of the selected object in the properties listed in the panel.  I possibly could use an enum property to select the object and use an update function, but selecting the object in the 3d view seems preferable.

if you want it to auto-update on selection, that's harder.  Here's an answer that describes how to overload the built in selection function: https://blender.stackexchange.com/questions/31351/update-stringproperty-on-object-selection-change

This will also depend on the mesh of the object. eg there is no way to give the plane a z dimension.

Can anyone tell me why the SelectionOperator in the answer below does not run when the code is an addon?  From what I can tell, neither the invoke nor the execute methods are executed when I click in the 3d view.  Probably there is simple solution, but so far I I have not found it.

Ok, I confirmed what I commented above.  You need to get the selected object(s), not the active objects.
So context.selected_objects is a list - you either need to always operate on just the first selected object, or all of them.  If you just want to assume the first selected one, just replace this:
obj = context.active_object

with:
obj = None
if len(context.selected_objects) > 0:
    obj = context.selected_objects[0]

in every function where you're trying to get the active object.  Otherwise run a loop over the context.selected_objects to affect all of them.
Also there's a bug here:
if obj:
    buttom_text="Edit Block"

should be button_text instead of buttom_text.
Also your invoke function is what gets called when you push the button, so that's ALWAYS creating a new block.  If you want your Edit Block to work you need to change the invoke function.
Hope this is helpful!

Yes, yout answer is helpful.

I hope it is OK if I post a complete code that answers the question.  I could not have figured it out without the previous answer and comments, but having a working code to experiment with is very helpful when trying to learn something new.
import bpy
from bpy.props import FloatProperty,BoolProperty, IntVectorProperty

last_selection = []

bpy.types.Scene.length = bpy.props.FloatProperty(name = "length",default = 2)
bpy.types.Scene.height = bpy.props.FloatProperty(name = "height",default = 1)
bpy.types.Scene.width = bpy.props.FloatProperty(name = "width",default = 1)

class DrawBlock(bpy.types.Operator):
    """A rectangular prism"""
    bl_idname = "myops.draw_block"
    bl_label = "Edit Block"
    bl_description = "Draw a rectangular prism"
    bl_options = {'REGISTER', 'UNDO'}

    def new_block(self,context):
        width = bpy.context.scene.width
        height = bpy.context.scene.height
        length = bpy.context.scene.length

        bpy.ops.mesh.primitive_cube_add()
        obj=bpy.context.active_object
        obj.dimensions=(length,width,height)
        obj.location.z=obj.location.z+height/2

    def execute(self,context):
        obj = bpy.context.active_object
        if obj:
            w = bpy.context.scene.width
            h = bpy.context.scene.height
            length = bpy.context.scene.length
            obj.dimensions=(length,w,h)
        else:
            self.new_block(context)
        return {'FINISHED'}

class SCENE_PT_Build(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "Build Menu"
    bl_idname = "SCENE_PT_build"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        objlist=bpy.context.selected_objects
        obj=[]
        for obj in objlist:
           if "Cube" in obj.name:
               break
        row=layout.row()
        row.label(text="block geometry:")
        row=layout.row()
        row.prop(scene, "length")
        row=layout.row()
        row.prop(scene, "width")
        row = layout.row()
        row.prop(scene, "height")
        row=layout.row()
        button_text="New Block"
        if obj:
            button_text="Edit Block"
        row.operator("myops.draw_block",text=button_text)

# This section is mostly copied from #https://blender.stackexchange.com/questions/31351/update-stringproperty-on-object-selection-change

class SelectionOperator(bpy.types.Operator):
    """ Costum selection
    """
    bl_idname = "view3d.select_costum"
    bl_label = "costum selection"

    extend : BoolProperty(default = False)
    deselect : BoolProperty(default = False)
    toggle : BoolProperty(default = True)
    center : BoolProperty(default = False)
    enumerate : BoolProperty(default = False)
    object : BoolProperty(default = False)
    location : IntVectorProperty(default = (0,0),subtype ='XYZ', size = 2)

    def execute(self, context):
        #select the object
        bpy.ops.view3d.select(extend=self.extend, deselect=self.deselect, deselect_all=True, toggle=self.toggle, center=self.center, enumerate=self.enumerate, object=self.object, location=(self.location[0] , self.location[1] ))
        #change the property
        global last_selection
        obj=bpy.context.active_object
        if obj != last_selection:
               last_selection = obj
               bpy.ops.object.select_all(action='DESELECT')
               obj.select_set(True)
               bpy.context.scene.length = obj.dimensions.x
               bpy.context.scene.width = obj.dimensions.y
               bpy.context.scene.height = obj.dimensions.z

        return {'FINISHED'}

    def invoke(self, context, event):
        if context.space_data.type == 'VIEW_3D':
            self.location[0] = event.mouse_region_x
            self.location[1]  = event.mouse_region_y
            return self.execute(context)
        else:
                self.report({'WARNING'}, "Active space must be a View3d")
                return {'CANCELLED'}

def replace_shortkey( old_op_name, new_op_name) :

        wm = bpy.context.window_manager
        keyconfig = wm.keyconfigs.active
        keymap = keyconfig.keymaps['3D View']
        items = keymap.keymap_items

        item = items.get(old_op_name, None)
        while item :

                props = item.properties

                extend    = props.extend.real
                deselect  = props.deselect.real
                toggle    = props.toggle.real
                center    = props.center.real
                enumerate = props.enumerate.real
                object    = props.object.real

                item.idname = new_op_name

                props.extend    = extend
                props.deselect  = deselect
                props.toggle    = toggle
                props.center    = center
                props.enumerate = enumerate
                props.object    = object

                item = items.get( old_op_name, None)

def register():
   bpy.utils.register_class(SelectionOperator)
   bpy.utils.register_class(SCENE_PT_Build)
   bpy.utils.register_class(DrawBlock)
   replace_shortkey( 'view3d.select', SelectionOperator.bl_idname )

def unregister():
   replace_shortkey(SelectionOperator.bl_idname, 'view3d.select')
   bpy.utils.unregister_class(DrawBlock)
   bpy.utils.unregister_class(SCENE_PT_Build)
   bpy.utils.unregister_class(SelectionOperator)

if __name__ == "__main__":
    register()
    bpy.ops.mesh.primitive_cube_add()
    obj=bpy.context.active_object
    obj.dimensions=[2,4,6]
    obj.location=[4,2,0]
    bpy.ops.mesh.primitive_cube_add()

IF the user clicks on one of the cubes, the dimensions of the cube show up in the panel and the object can be modified.


text:
Can I set a bookmark in the File Browser from Python
In my Blender add-on in Python, I would like to be able to create a directory and then add it to the bookmark list in the File Browser.  The code I wrote almost works.  It creates a new directory and adds a bookmark of the current directory in the File Browser if it is visible in the GUI.
Here is my code:
import bpy
import os
project_path=os.path.join(r"C:\Users\Shari\Documents","New_Project")
if not os.path.exists(project_path):
    os.mkdir(project_path)
    os.chdir(project_path)
# add new project folder to bookmarks, but need context override
# got context_override code from:https://b3d.interplanety.org/en/context-override/
    override_context = bpy.context.copy()
    area = [area for area in bpy.context.screen.areas if area.type == "FILE_BROWSER"][0]
    override_context['window'] = bpy.context.window
    override_context['screen'] = bpy.context.screen
    override_context['area'] = area
    override_context['region'] = area.regions[-1]
    override_context['scene'] = bpy.context.scene
    override_context['space_data'] = area.spaces.active
    bpy.ops.file.select(override_context)
    bpy.ops.file.bookmark_add(override_context)
# change project_path so we don't get weird folder hierarchy
os.chdir(project_path)

I would like the 'New_Project' folder to appear in the bookmark list instead of whatever folder happens to be open in the File Browser.

It seems it's only possible using an open area since it relies on the currently selected file in the file browser, which is AFAIK not overridable. I think you can circumvent that by temporarily switching the area type to the file browser, navigate to the desired file, selecting it, then running the bookmark operator and switching the area back. Cumbersome. BTW if you're using 3.2 the new override syntax is with bpy.context.temp_override https://docs.blender.org/api/current/bpy.types.Context.html?highlight=temp_override#bpy.types.Context.temp_override

Thanks.  In my code, I found which area is the File Browser, but I don't know how to make it active or select a folder in Python.

source: Stack Exchange

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

sort: votes


text:
How do I pass a CollectionProperty from a Panel to an Operator sto create general classes for UIList
I want to put multiple UILists in my addon.  I started off with the example discussed here:
https://sinestesia.co/blog/tutorials/using-uilists-in-blender/
I am storing each list in a scene custom property as a CollectionProperty, but I would like to have only one set of operators (LIST_OT_NewItem, for example) for all of my lists.  To do this, I would need to pass the list and other parameters from the panel to the operator.
The code I am working on can pass one parameter, such at the index or the item to add to the list, but I am having trouble passing the list itself.  Here is my code:
import bpy
from bpy.props import StringProperty, BoolProperty, PointerProperty, IntProperty, CollectionProperty, EnumProperty, FloatProperty, FloatVectorProperty
from bpy.types import Operator,PropertyGroup

class CustomListItem(bpy.types.PropertyGroup):
    name: bpy.props.StringProperty()

class LIST_OT_NewItem(Operator):
    """Add a new item to the list."""
    bl_idname = "my_list.new_item"
    bl_label = "Add a new item"

    item_list_name: StringProperty(name="item_list_name")
    item_list: CollectionProperty(type= CustomListItem)
    item_val: StringProperty(name="item_val",default="")

    def execute(self, context):
#        item-self.item_list.add()
        item=eval(self.item_list_name+".add()")
#        item=context.scene.theList.add()
#        item.name = str(context.scene.list_item)
        item.name = str(self.item_val)
        return{'FINISHED'}

class LIST_OT_DeleteListItem(Operator):
    """Delete the selected item from the list."""
    bl_idname = "my_list.delete_list_item"
    bl_label = "Deletes an item"

    @classmethod
    def poll(cls, context):
        return context.scene.theList

    item_index: IntProperty(name="item_index")

    def execute(self, context):
        the_list = context.scene.theList
        index = self.item_index
        the_list.remove(index)
        self.item_index = min(max(0, index - 1), len(the_list) - 1)
        print('delete: ',index,self.item_index)
        return{'FINISHED'}

class OBJECT_UL_List(bpy.types.UIList):

    def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
        scene = data
        ob = item
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            layout.prop(ob, "name", text="", emboss=False, icon_value=layout.icon(ob))

class SCENE_PT_TestPanel(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "UIList Test"
    bl_idname = "SCENE_PT_test_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        obj=context.active_object
        split=layout.split()
        col = split.column()
        col.label(text="List 1")
        col.template_list("OBJECT_UL_List", "",scene,"theList",scene,"list_index")
        col.operator('my_list.delete_list_item', text='Remove').item_index=scene.list_index
        row=col.row()
        op=row.operator('my_list.new_item', text='Add').item_val=scene.list_item
        op.item_list_name="context.scene.theList"
        row.prop(scene, "list_item")

        col = split.column()
        col.label(text="place holder")
        row=col.row()
        col.label(text="for second list")

classes = (CustomListItem,OBJECT_UL_List,LIST_OT_NewItem,SCENE_PT_TestPanel,LIST_OT_DeleteListItem)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.theList = CollectionProperty(type = CustomListItem)
    bpy.types.Scene.list_index = IntProperty(name = "List index", default = 0)
    bpy.types.Scene.list_item = StringProperty(name="list_item",default="1.0")

def unregister():
    for cls in reversed(classes):
        bpy.utils.unregister_class(cls)
    del bpy.types.Scene.theList
    del bpy.types.Scene.list_index
    del bpy.types.Scene.list_item

if __name__ == "__main__":
    register()

In this code, I am trying to send the LIST_OT_NewItem operator the list and the item that will be added to it.  I was having trouble passing the list to the operator, so I decided to try passing the name of the list, as shown in the code above.  This code give me the follow error:
AttributeError: 'str' object has no attribute 'item_list_name' when I press the add button for the line related to that variable in the TestPanel class.
It is possible to write one general operator to add an item to any list instead of writing a separate operator for each UIList?

You can make a function to create classes.

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


text:
Can I get unsheared dimensions on an object?
I would like to be able to get the original dimensions of an object after shear has been applied.
The dimensions of the new object are now different from the original cube.  Can I determine what the original dimensions are from Python?  I've read in other stack exchange questions that I can find the object's original size from the object's mesh (such as from this question:
How to get the base dimensions of an object (ignoring all of it's modifiers)?)  But when I look at the vertices of the mesh as explained in the answer, the vertices refer to the sheared object and not the original object.

How did you apply the shear? If you applied it with A > Visual Geometry to Mesh, there's no way to get the original dimensions unless you assume that the original shape was a cuboid with all angles equal to 90 degrees. Is that the assumption you are making? Then it should be solvable.

What will you do with the original dimensions once you shear the cube?

I am using bpy.ops.transform.shear to apply the shear.  I was thinking that I could possibly use the transform matrix to find the original dimensions of the cube.  Or, perhaps I could use a modifier to apply shear and then just temporarily remove the modifier.  I am using Blender to visualize geometry for a scientific simulation, which needs the original dimensions of the object (not necessarily a cube).

Would it be possible to use the inverse of the transformation matrix to get the original dimensions of the object and then reapply the transformation matrix?  I am not sure how to apply the steps to try this.  Or, I'll try to remove the shear, get the object dimensions, and then reapply it.


text:
Can I load a picture into the image editor without saving it first
I am generating images using matplotlib and opencv.  I would like to put the edges image directly in Blender's image editor instead of having to save it to a file.  I am planning to add a slider input for the threshold parameters, to allow me to see how the image changes with different values.  If is saves a new image and loads it into the image editor every time I change a parameter, I would create a large number of images in the image editor very quickly.  Is it possible to load the image directly into the Image Editor without saving it to a file?
Here is my current code:
import cv2
filename = r"C:\Users\xxx\Documents\IMG_3293.jpg"
outfile = r"C:\Users\xxx\Documents\edges.png"
img = cv2.imread(filename)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img_blur = cv2.GaussianBlur(img_gray, (3,3), 0)
edges = cv2.Canny(image=img_blur, threshold1 = 50, threshold2 = 150)
result_img = bpy.data.images.get("edges.png")
cv2.imwrite(outfile,edges)
bpy.data.images.load(outfile)```


text:
Boolean modifier hides linked object mesh
I'm facing the following display "issue".
I'm on Blender 3.2, and I wanted to cut a hole trough a cube, so I created a cylinder, selected it, then selected the cube and created the boolean modifier.

The boolean modifier works, as I correctly see the hole, however the cylinder has now got a rectangular outline

And even after deleting the boolean operator, I'm unable to see the original cylinder mesh (outline and material missing).

On a tutorial I actually see the real cylindrical shape is maintained when creating the boolean operation, so I'm wondering what I'm missing? It looks like a display property, but can't really understand which one is giving me this issue!

Ha finaly, i was waiting for such feature , but right - it could be switched back when not used by any boolean  ... What you see Is Bonding box display type ... Go to Object Properties > Viewport Display and switch Textured.

Tutorial screen was probably switched into Wireframe display type manually.

@vklidu omg thanks! That was it! During boolean operations "Display As > Wire" is what I was looking for, and "Textured" for when I remove the modifier. Thank you!

@vklidu just for completeness, the Bool Tool addon has a "Display as wireframe" checkbox that automatically uses Wireframe display instead of bounding box for all boolean modifiers!

Hm ... I checked it and I see there is not a new feature in my 3.2 or 3.3 version. Manually added modifier keeps Textured display as before. And just when BoolTool addon is activated and I search for Boolean than btool Brush is only found. So switch to Bounding Box display is act of addon, not modifier's feature. BTW I also do not see option for btool to switch into wireframe.

@vklidu The option for the bool tool to switch into wireframe is in the addon's preferences. It's either On or Off so you can't select which modifier uses the option.


text:
Clumping hair particles when there's no clumping active?
I'm new to Blender and have been watching some tutorials on how to make a felt surface that looks good using the hair particles. There weren't many helpful videos that explained what each setting did but I got it to a good spot after a lot of fiddling and experimenting.
My issue now is that I don't want to change much about it because it looks just right but I am getting weird clumps of particles clashing and forming upright groups around the edges. It's emitting from a solidified plane so there's no reason for the geometry to affect it I don't think. They're not sprouting from along the edge either but in spots along the edge.
Scaling up to frame the edges out doesn't help either as the hair textures then look too large and it doesn't look right anymore.
You can see it on the bottom left of the image and top left, along the edges of the plane.

That's definitely no clumping from the clumping options I'd say from the way it looks. Although there might be no reason for the geometry to cause this, it appears as if there were issues with the geometry. Would you mind adding a screenshot in Solid View with the hair disabled and maybe Face Orientation enabled in the Overlays? And perhaps also a Wireframe View or the mesh in Edit Mode?

It could be that there's something weird going on between your normals and how the solidified plain has... well, solidified.
One way to check is to hide the particles and then enable your face normal visualisation in the following menu:

It may help display the problem.
You could use the tools in Particle Edit mode to flatten your felt fibres:

Here, I've combed some of my hair flat:

There also exists the possibility to shrink or even entirely trim off the offending hairs.
However, as it looks like you're making a poker/gaming table, you could also simply hide the edges with a frame at the table edge potentially.


text:
Join parent objects in a collection with their children
The thing is that I have a collection with multiple parent objects and I need to join these parents with their children. I have tried to iterate over each object in the collection with a For Loop, but I cannot get the result that I am looking for.

Here I attach an image to explain my point more clearly. I am iterating over the 'Openings' collection, and I want to join every single door and window with its own children.
I have tried many things, but I am new to Python and I cannot find a way.
My code so far is this:
import bpy

for obj in bpy.data.collections['Openings'].all_objects:
    parent_obj = bpy.context.active_object
    parent_obj.select_set(True)
    bpy.ops.object.select_grouped(type='CHILDREN_RECURSIVE')
    bpy.ops.object.join()

I am pretty sure this code is wrong, but the others options I have tried do not work either.
I am using Blender 3.1 version.
I hope someone could help me with this and thanks in advance.

Does this answer your question? How to select a parented hierachy from the 3d viewport using the right click menu?

Thanks for your answer, but this is not exactly what I am looking for. I need to join by scripting all parent objects in the mentioned collection with their own children, so that instead of having an object called 'Door' with a set of children (door panel, handle, etc.), I can get a single joined object with no hierarchy. And I need to do this with all the parent objects in the collection.


text:
Import data from multiple CSV files
I am trying to draw meshes in Blender by importing data from several CSV files at the same time. I could import the files one by one, but it would be quite a slow process, since there are so many files. So far, with the code I’ve written, I’ve managed to select all the CSV files I need to extract the information from at once. The problem is that Blender draws the first mesh correctly, but the remaining ones, although they appear in the program tree, are not displayed. That is, I understand that it is iterating all the files, but it is only extracting the information from the first one.
I show you here the code that I have written so far:
import bpy, os, csv

from bpy_extras.io_utils import ImportHelper
from bpy.types import Operator, OperatorFileListElement
from bpy.props import (BoolProperty,
                        FloatProperty,
                        StringProperty,
                        EnumProperty,
                        CollectionProperty
                        )

# Lists to store the reading file data
verts = []
edges = []
faces = []

def createPilesAxis(context, filepath):
    """Reads the file and extracts the vertices"""
    with open(filepath, 'r', encoding='utf-8-sig') as csvfile:
        reader = csv.reader(csvfile, delimiter=',')
        for row in reader:
            vert = (float(row[0]), float(row[2]), float(row[1]))
            verts.append(vert)
        # Joins the vertices
        for i, vert in enumerate(verts):
            startpoint = i
            if i < len(verts)-1:
                endpoint = i+1
            edge = startpoint, endpoint
            edges.append(edge)
    """Creates pile axis"""
    global pile_curve
    # Creates the arch axis mesh
    new_mesh = bpy.data.meshes.new(name='axis_mesh')
    new_mesh.from_pydata(verts, edges, faces)
    ## Creates the object mesh
    new_object = bpy.data.objects.new('pile_axis_curve', new_mesh)

    ...

    return {'FINISHED'}

class OT_ImportFilebrowser(Operator, ImportHelper):

    bl_idname = "test.import_filebrowser"
    bl_label = "Import file"
    bl_description = "Allows importing an arch axis coordinate dataset"

    filter_glob: StringProperty(
        default='*.txt;*.csv',
        options={'HIDDEN'}
    )

    files: CollectionProperty(type=bpy.types.PropertyGroup)

    def execute(self, context):
        folder = (os.path.dirname(self.filepath))

        for j, i in enumerate(self.files):
            path_to_file = (os.path.join(folder, i.name))
            createPilesAxis(context, self.filepath)
        return {'FINISHED'}

classes = [
    OT_ImportFilebrowser,
]

...

The image shows what is described above. In the 3D view a single mesh is drawn, but in the collections tree of the scene there are seven meshes, corresponding to the seven CSV files that I “have imported” into the program.

I am using Blender 3.1 version.
I hope someone can help me, because I have given it a lot of thought and I can’t solve it.
Thanks in advance.

Pretty sure you need to add context.collection.objects.link(new_object) to the end of your createPilesAxis function. Right now all you're doing is adding the objects to the database, but you still have to (with Python) essentially "drag and drop" it from the outliner into the active collection.

Thank you very much for your reply. However, I don't think that is the problem. The code I have shown is clipped. Just below the line new_object = bpy.data.objects.new('pile_axis_curve', new_mesh) I have written what you comment. That is the reason why in the image all the axes appear inside the "axes_collection".

Then can you possibly make like a zip folder with the blend file with your script and a sample CSV so we can debug it on our own computers?

Yes, sure. How can I share the folder with you? I'm new here and I don't know how.

I would just use google drive or dropbox or something, since you have to include more that just the blend file.

Perfect. Here it is the link: https://bit.ly/3Acbtn6


text:
My UIList does not scroll down in version 3.3.6
I wrote an addon with several UI Lists.  In Blender 3.2, I had no trouble scrolling down the list if it became longer than the box on the screen.  However, I recently switched to Blender 3.3.6 and I realized that I can't scroll down if my UI List is long enough.  The scroll bar appears on the right side, but if I try to move it, the list does not scroll.  Here is an excerpt from my code:
bl_info = {
    "name": "UI LIST Test_Addon",
    "blender": (3, 3, 6),
    "description": "UI List does not scroll",
    "warning": "",
}

import bpy
from bpy.props import StringProperty, BoolProperty, FloatProperty, IntProperty, CollectionProperty
from bpy.types import UIList, Operator, Panel

class CustomListItem(bpy.types.PropertyGroup):
    objectName: StringProperty()

class LIST_OT_NewItem(Operator):
    """Add a new item to the list."""
    bl_idname = "my_list.new_item"
    bl_label = "Add a new item"

    list_name: StringProperty(name="list_name")

    def execute(self, context):
        item_list=eval("context.scene."+self.list_name+"_list")
        item_value=eval("context.scene."+self.list_name+"_item")
        item=item_list.add()
        item.name = str(item_value)
        return{'FINISHED'}

class LIST_OT_DeleteListItem(Operator):
    """Delete the selected item from the list."""
    bl_idname = "my_list.delete_list_item"
    bl_label = "Deletes an item"

    @classmethod
    def poll(cls, context):
#        item_list=eval("context.scene."+self.list_name+"_list")
#        print(bool(item_list))
        return True

    list_name: StringProperty(name="list_name")

    def execute(self, context):
        item_list=eval("context.scene."+self.list_name+"_list")
        index=eval("context.scene."+self.list_name+"_index")
        item_list.remove(index)
        index = min(max(0, index - 1), len(item_list) - 1)
        return{'FINISHED'}

class OBJECT_UL_List(bpy.types.UIList):

    def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
        scene = data
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            layout.label(text=item.name)

class SCENE_PT_Params(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "Define Properties"
    bl_idname = "SCENE_PT_def_props"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        layout.label(text="Parameters:")
        split=layout.split()
        col = split.column()
        col.label(text="Parameter 1")
        col.template_list("OBJECT_UL_List", "",scene,"param1_list",scene,"param1_index")
        row=col.row()
        row.operator('my_list.delete_list_item', text='',icon='REMOVE').list_name="param1"
        row.operator('my_list.new_item', text='',icon='ADD').list_name="param1"
        row.prop(scene, "param1_item",text="units")

        col = split.column()
        col.label(text="Parameter 2")
        col.template_list("OBJECT_UL_List", "",scene,"param2_list",scene,"param2_index")
        row=col.row()
        row.operator('my_list.delete_list_item', text='', icon = 'REMOVE').list_name="param2"
        row.operator('my_list.new_item', text='', icon = 'ADD').list_name="param2"
        row.prop(scene, "param2_item",text="units")

classes = (OBJECT_UL_List,
        LIST_OT_NewItem,
        CustomListItem,
        LIST_OT_DeleteListItem,
        SCENE_PT_Params)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.param1_list = CollectionProperty(type = CustomListItem)
    bpy.types.Scene.param1_index = IntProperty(name = "param1_index", default = 0)
    bpy.types.Scene.param1_item = FloatProperty(name = "param1_item", default = 500)
    bpy.types.Scene.param2_list = CollectionProperty(type = CustomListItem)
    bpy.types.Scene.param2_index = IntProperty(name = "param2_index", default = 0)
    bpy.types.Scene.param2_item = FloatProperty(name = "param2_item", default = 0.5)

def unregister():
    del bpy.types.Scene.param1_list
    del bpy.types.Scene.param1_index
    del bpy.types.Scene.param1_item
    del bpy.types.Scene.param2_item
    del bpy.types.Scene.param2_list
    del bpy.types.Scene.param2_index
    for cls in reversed(classes):
        bpy.utils.unregister_class(cls)

if __name__ == "__main__":
    register()

I wrote my code starting with the example here:
https://sinestesia.co/blog/tutorials/using-uilists-in-blender/, and the example scrolls properly.  I've compared the two codes and I do not understand why the example in the tutorial scrolls properly and mine does not.  I would appreciate any suggestions.

In the col.template_list, I set the list_id parameter to "".  In order for the scrollbar to work correctly, I needed to assign name to the list.


text:
Why is my FBX export translucent?
All my FBX exports are coming out translucent, it adds normal and alpha maps where there isn't supposed to. Here's what I do:

Add a cube, give it a material with a “base color” texture:

Export as FBX. All my settings are default, except for the Path Mode, which is set to “Copy” and Embed Textures is turned on.

Create a new Blender file and import the FBX. Switch to Cycles, the model is translucent. You can see in the image that the imported model has an empty normal map, and the color texture is now also added as an alpha texture, which I did not do.

Why is this happening? How do I make it work correctly? I never had problems before with FBX but now every model I make is coming out like this.
Here are my test files: https://drive.google.com/drive/folders/15dB-iESKis41PlqnJgupWVG9ShtxEqIp?usp=sharing

I don't think the model is translucent, you just need to light the scene.

@EricXue It is translucent. Here is a comparison between the normal model (on the left) and the imported FBX (on the right): https://i.imgur.com/UK05T5k.png


text:
Render different from viewport preview
So I'm just starting with Blender, using a model found here:
https://drive.google.com/drive/folders/0BzIQm-eK85EQeTJDOGVTVXhuUDA
In the viewport, I get something like this, which its OK for my needs:

However, when I render using Cycles, the result looks like this:

Which is clearly not of the same quality, even if it takes several seconds per frame on GPU. I tried checking every option under Layer properties -> Passes and Filter, but other than that I don't know what else to try.

Is the first image material or render mode? At least form the reflections it doesn't look like the same hdri is used (or any hdri at all) in the cycles render

@uvnoob The first image is in the 'layout' mode. I don't know how to activate HDRI in the cycles engine, sorry; but it that case it would mean that HRDI would be active for the 'preview' in the viewport and not for rendering?

I meant shading mode. "Layout" is a workspace. Shading mode is independent from workspace. If you want to preview your render, switch to 'render' shading mode. In any case, try setting up a HDRI and let us know if it helped. Here's a quick tutorial showing how to do it (https://www.youtube.com/watch?v=6VBkj_I-ONk). You can use HDRIs from hdrihaven.com, or locate the default ones used by blender in your filesystem

OK, Ill try that, thanks. I am just learning blender fundamentals and I don't get why a quick preview seems of a better quality than the final render...

Again, I can't tell for sure but I think the first image is from material shading view, which would mean that it was rendered using eevee. If it's okay for your purposes you could switch your renderer to eevee - it is MUCH faster, although not as realistic and has it's own issues.
If you wish to render with cycles though, don't forget to enable denoising - this will eliminate the grainy texture on your renders. You can find numerous tutorials on how to get started with cycles on youtube.


text:
'Extended' Tracking?
I seem to have 2D tracking and camera tracking in After Effects licked. Blender tracking, however - is foxing me.
I prepared my shot - putting mini beanbag tracking points down. The shot involved my walking in a 'shallow semi-circle' - I will later add a parked spacecraft to the scene. Despite the excellent contrast my ground tracking points gave, the tracking markers just would not stick to them for the duration. Naturally, I made sure all the markers remained in the shot the whole time. I had wall tracking points too.
I feel Blender as a 3D prog would have coped better with the changing perspective. I tried Location, Perspective, Affine etc - but the only thing that seemed to help was increasing the tracking marker margin area - but still my track was lost. I'm using the correct sensor size and all that stuff.
I'll appreciate any suggestions. It's going to be really frustrating having to limit camera movement because I have trouble tracking anything too adventurous.
Many thanks.

this is kind of a workaround but i use it sometimes i will track a scene in other software like after effects in your case and export a video of black with the tracked points as white dots that are easy to track in blender because blender tomato tracker isn't very reliable

Read the following link: https://blender.stackexchange.com/questions/42329/how-can-i-get-better-results-when-doing-camera-motion-tracking/42332#42332 If that doesn't help add more information as part of the question. 3D tracking is not that hard, but it needs to be done carefully, most problems are due to inaccurate tracking. Check that the trackers are not slipping and do whatever you can to fix that. You don't need to have all the trackers visible for the whole shot, but in a segment that is long enough for blender to solve the motion. Consider sharing the video and the blender file.

Thank you @J Block & @susu. Appreciate your feedback. I tried again and again - but was finding it just too frustrating. I looked for a way to transfer camera data from After Effects to Blender and found a script at Blender Market. It certainly had mixed reviews and there was no mention of it working in 2.91 - but it's working for me. It feels incomplete - but the tutorial guy included a workaround for its limitations. This is a great development and I'm very happy to have a found a solution. Thanks again.

Please post your video track and blender file. The tracker is quite robust, so far it has not failed to solve anything I've thrown at it. However, if you found a solution post it as an answer in the answers section, so that others can learn from your experience.


text:
Emission Peculiarity
I have a Sci-Fi city model. It's entirely square and therefore very modular.
It has been multiplied many times to give me enough background for a fast dogfight between two craft. To try to disguise the obvious repetition I want to make the lights of each city section a different colour from each other. The emission node of the copied first section is controlling the colour of every duplicated section, however. Adding an emission to each individual section isn't working - the node setup of the original section overrides all the others.
This is where my inexperience is being exposed - but hey, it's why we have help forums!
Naturally, a fix for this one will be splendid!
Many thanks.

There are two nodes that can be used to generate a random number within your node group.

Object Info -> Random generates a random number between 0 and 1 for each individual object.
Geometry -> Random Per Island does the same for each disjointed piece of mesh within an object.  So this one can be used with Array modifier, for example.

You can use these random values for many purposes.  You can basically seed your textures by changing the position of the texture in coordinate space, or drive the W value of a 4d texture.  You can also use a color ramp to define a range of colors to choose from.

The Math -> Multiply node can be used to effectively modify the range of the output.  E.g. multiplying by 20 gives you a random number between 0 and 20.

Thank you so much for that @Allen. I've just hit a busy patch with life and work - but I'm definitely trying that solution as soon as I can. Thanks again.


text:
Cables Interaction Required
I have watched various tutorials on making cables react with the movement of the objects they're connected to. But said tuts are starting from scratch. See the image. The cables are already in situ.
I've added a circle to the model enabling 'head' rotation. So now I need to have the cables move accordingly when I rotate said head - just the section of the cables between the two arrows. I'm assigning to a group, adding a Cloth effect and hooking the cables to the model etc - but I just can't get the right reaction, it just doesn't work or I explode the rig.
Some pointers would be great. I guess I can add the .Blend file in the next message if required. I'm no model maker as you can tell.
Many thanks.

Hi @Chris. Many thanks for that. Excuse my inexperience. Will it work if I parent a bezier to the cables?

you are welcome


text:
When I go to the Shading tab it's empty but shows in Layout?
I'm trying to do texturing for my objects but when I go to the Shading tab it's just completely empty but in the Layout tab everything shows just fine. Already tried restarting Blender multiple times.
Video showing the error

Hello and welcome. While files, images, and external videos or links may be helpful additions they should not be the only way to obtain information about your issue. Don't make understanding your question rely on downloading a file, watching a video or visiting an external site. Use the builtin tools to upload images or gifs, along with thoroughly explaining the problem in written form so it can be indexed and searched for thus helping future visitors with similar issues.

Try selecting your model and then going to View>Frame Selected
My first guess is that maybe you're zoomed out/panned away from the model in that view?

Thanks a lot that worked, I was puzzled for a while!


text:
Objects Randomly Flickering
I'm making a room with a table in Blender 2.90.1. It was working fine, until suddenly almost every object started randomly flickering in the viewport. If I don't move at all, somethings are visible and somethings aren't, and when I move or rotate in the viewport, things start turning visible or invisible. It looks fine when I render, but I can't really work on it when I can't see anything useful. Is there a way to fix this or do I have to start over?

that sounds like it might be your graphics card or driver and not your blend file...

I've never had this problem before, and I didn't make any change to the scene. This just happed on its own while I was tabbing through some Gmail pages.
Edit: There's also two object that aren't affected, the wall and the L shaped thing in the corner.

it might be a long shot but try to turn off viewport anti aliasing.
Blender preferences > viewport > quality
Also in your graphic driver, be it nvidia or amd. never never never change stuff on global settings. most of graphical issues come to games and programs because users change stuff on global settings tab. For example some games and programs might hate any change on Anisotropic filtering because of how their code work and might cause flickering on some of them.

Haven't changed any global driver settings. It wasn't anti aliasing, but your comment did lead me to the solution. Apparently if you set the clip distance low enough, it starts breaking things.


text:
mtree as a particle effect
I've been using Mtree, and I would like to use my output tree as an instance in a particle effect.  Normally I would take the leaf particles on the tree, convert them, apply them to the trunk and then use that, but for whatever reason that isn't working.
What I end up with is a forest with no leaves (depressing)
Any advice is greatly appreciated - I've been through a lot of tutorials and haven;t found more information than how to make a single tree.

I got this to work with GNs.  I simply plugged my Collection Info into the Instance on Points, which means that I was able to create a particle system for my leaves using Mtree and then use the tree/leaves collection (containing a trunk and a particle system) in the GN.  I had to adjust scale WAY down (from 1 to .01) in the GN probably because I had not applied scale to my plane .. although adjustments did cause blender to become crashy.

So, I am back with another Mtree answer, I guess.
I will tell you my way of doing it, may not be the best one.
What I do, is I first join the leaves with the trunk.
How?
Well, First, I take the leaves and in edit mode, I assign all their vertices to a single Vertex group. Why I do this? I will answer in a moment.
Then, I join the leaves object to the trunk (Ctrl + J). You will see that the leaves are gone. But why? Well, the leaves object is just vertices, emitting hair. So, by joining them in the trunk, they lose their modifiers. And particle systems are modifiers, so now the particle system is gone. That's why, I go to the particle system settings, add a new particle system, from the drop down menu I choose "leaf"(that's the one that was on the leaves object) and then, down there, at Vertex group section, I set the density to be that one group I created before.
Now, I can add the hair system on the terrain object. If a hair instance object has his own hair, it will  be displayed, but only is its from type "Path"(default streams of hair), it will not if its an object. So, that's why, now I convert the trees into meshes(before that I hide the Leaf particle system so my pc doesn't crash). So, now its working! But, there is one thing you will notice- if the hair system on the terrain had the trees smaller, than their original size, they will look like bushes- because the leaves didn't change in size. So, now we have to it. We go to the particle system of the plane and we see what is the scale of the instance object- if it was 1:1, it will be exactly 0.25. So, if yours is smaller/bigger, we need to find how much. If we divide the 1:1 scale(.25) by the current scale(lets say its .05), we get 5. So, this means that the trees are 5 times smaller. If you get a value of, say .5, that means that you actually scaled them up(in the case of .5 its twice bigger). So, now we have to change the scale of the leaves with that ratio. So, if we get that the trees are 5 times smaller, then we also scale the leaves down 5 times. We do this from the hair particle system settings, same as from where we got the tree scale.
And now, you should be set.

Thanks for your (super quick) response! And sorry for my (super delayed) response back!  I tried this and it worked (along with bushy leaves and all).  This actually might help me with a different issue, too - I really appreciate it!

Coincidentally, I have very recently run into the exact same problem, and It took me a while to figure out, but there is a solution that's relatively easy and worked quite well for me.
So first, you need a tree with leaves (obviously)

next, what you need to do is select your tree, and then in the scene outliner (that's the box in the top right corner that contains all the object in your scene) click the little dropdown arrow to the left of your tree object, to show everything contained inside of the tree object.   And then make sure your leaves are selected as well.

(This step isn't necessary, but it makes it a lot easier to see what's going on)
Now, you need to make a new collection and name it something like "Trees" (If you don't know how to do that it's a very easy thing to google) and then you are going to move your tree object into that collection.  MAKE SURE that you move the leaves into the same collection as well, trust me, I made the mistake of not doing that and it was not fun.

For the next step, with your leaves selected, click on the modifiers tab.  There should be a particle modifier in the tab with a big button on it that says "Convert".  Click this button, and it will convert each leaf on your tree into its own individual mesh.

(tips:  If your computer is not very good at handling a lot of objects at once, I would first recommend changing your number of leaves on your tree to a smaller number. (Tip inside a tip: if you change the split probability in your m-tree node editor, you can get away with having a lot less leaves and still get a good looking tree)  And one more tip:  If you use your mouse to look away from the tree in your scene, it actually makes it easier for the computer to calculate it.)
Now, you will have a couple thousand of individual leaf objects in your scene.  don't worry about them for now, the first thing we need to do is delete our initial leaves object that used to contain all the leaf particles.  So, in the scene outliner, right under your tree object, click on your "Leaf" object, and press "X" on your keyboard to delete it.

Alright, just a few more things to take care of.  Next, you will need to select all of your leaves and your tree at the same time. to do this you can right click on the "trees" collection that you made, and click on "Select Objects".  This will select everything in your collection that is an object.  WARNING:  you need to make sure that your tree object is the last thing that you have selected. You can do this by holding down The control key on your keyboard (or command key if you're on mac) and clicking on your tree object with everything else still selected.  you will know that your tree is the last thing selected if it turns a different shade of orange then everything else.

Ok, now if you've done everything correctly the last thing you need to do, is to right click over the tree, and click on "Join"  and after your computer is done calculating that, you will have one tree object with leaves and all.  (Tip: if you right click on the tree and the "Join button does not show up, you will first have to click on "Convert to mesh" and then the join button should show up)
And that's that.  you should be able to turn it into a particle system now and build entire forests.  Have fun!
(sorry if there are any spelling errors in here)

This was a brilliantly detailed response, and it worked fantastically - thank you so much.
For another person reading this (who I like to think of as 'future me') - follow the instructions carefully and fully and right to the end.  I was hasting so quickly that I missed the 'convert to mesh' part, which held me up for a full ten minutes before I was wise enough to read all the information.
Absolutely gleaming response, Ethan, thanks again!

No problem!  I'm happy to help, and I'm glad it worked!   : )

While your procedure worked for me, it resulted in very high poly counts which were not going to work.  Initially I had Verts: 54,457 for 3 trees, after converting 1 tree I had Verts: 4,598,521, Decimation did not really get me low enough, even at .1

The issue must be that we cannot render a particle system (leaves) on a particle system.  I'll try GNs and see what happens


text:
Face Mesh Disappears when I bind it to a Facial Rig
I am trying to create a facial rig with the FaceIt Plugin from Blender Market.
I'm trying to bind the facial mesh to the rig it created. I'm finding that the face mesh disappears whenever I try and bind it.
Before binding the mesh

After Binding the Mesh

Any help would be appreciated

The disappearing of your mesh is actually most probably just a huge difference in scale.
Faceit scales the mesh and armature during binding. Older versions of Faceit applied the scale after binding. This is not happening anymore. By upgrading the Faceit add-on to a more recent version, you should be able to bind again.
By the way: What you are trying to do is binding a mesh that is already bound to an armature to a new armature (the Faceit armature). Faceit will overwrite the weights. You should work on a duplicate, as described here: https://faceit-doc.readthedocs.io/en/latest/workaround/


text:
Tracking an imported video without a visible floor- Can it be done?
Title says it all, really.
When tracking a shot, it asks you to pick 3 points to make a floor plane and it bases everything off that. Can you track a shot without a visible floor? I have a very tight close-up shot that spins even closer.

You can track whatever you want, but keep in mind that what makes successful 3D reconstruction is having enough trackers that show parallax, and that there is enough information on the frame to track, and still determine depth.   And yes, you can orient the 3D reconstruction in any axis. It would help if you show images of the shots you are dealing with and be specific on what is the specific issue you are struggling with.

Read the following  post: how an I get better results when doing camera motion tracking


text:
How to have retractable limbs
I'm sure there are obvious tutorials for this but I didn't know how or what to google exactly so I'm asking here. How would I create and rig an object that has a limb or another piece of geometry that is normally hidden but that can extend from the object? I'd eventually like to have a perfect sphere most of the time but have the ability for the sphere to extrude hands and legs and have them function as a normal rig. I've attached a before and after cube, the after representing the arms and hands.

Related https://blender.stackexchange.com/questions/89251/how-can-i-rig-telescopic-parts-to-move-one-at-a-time

You could create your robot's basic armature, with all its limbs out. Parent the limbs bones to the body bone. When you'll parent the object to the armature, use the With Empty Groups mode then in Object Data > Vertex Groups assign each part of the mesh to the group it is supposed to be part of.

Then in the Pose Library save the basic pose and save a second pose that will be the contracted pose, here I've scaled my bones on the X axis. Click on the "+" button to save a pose:

Now whenever you want you can recall the contracted pose (select it and click on the magnifying glass icon of the Pose Library) and keyframe it in the Dope Sheet:


text:
How to fix warped faces when using boolean modifier on curved objects?
I'm trying to merge 2 like obects (1 rotated at a degree to make an "X" shape) and I can't seem to do it without warping the faces at the seams where the objects merge. Is there a way to fix this? Or do I have to manually fix the points? I've tried using "smooth vertices" but that just made it worse. I even tried this tutorial ( How can I merge these two spherical objects into a single smooth mesh? ) but no luck.

hello, I guess you need to correct by hand, but maybe share your file? https://blend-exchange.giantcowfilms.com/

@moonboots here
EDIT: the reason I want to merge these with perfect seams is because I need to use a glass texture and render in high resolutions; where a warped seam will surely show up and ruin the flow.

Avoid so many subdivisions until you have the overall shapes worked out. Use subsurf modifiers instead. It is  a lot easier to combine different meshes that way.

First, unless you have good reason to keep it high-poly, I would simplify with a CtrlE > Un-Subdivide:

Then boolean it, give it some corrections like dissolve or merge some vertices, when you're good on a side or on the front, use Symmetrize:

Create a bevel on the joint:

It looks good. If you want a higher poly, subdivide.


text:
subdivision surface modifier wrinkles mesh
I'm using quads for an object, but when I use the subdivision surface modifier or even select "shade smooth" it gives these weird stripes. I have no clue how to make my object smooth now. I've checked all my normals, I've tried converting to tris and back, no luck there either.

Will upload blend file for inspection.

It may not be apparent in some views, but if you check face orientation your normals are inverted on half the mesh in a striped pattern.

A recalculate outside with everything selected should fix this.


text:
Evee Not Working

My specs-
Blender 2.91
intel i5-9400f
AMD Radeon RX 570
driver version - 20.11.2
RAM - 16 GB
Windows 10 64 bit

It's probably a problem with the latest AMD driver, switch back to a previous one, or try Properties panel > Render > Performance > High Quality Normals

Better thank  moonboots... he  may be onto something there. Here is a similar question  AMD GPU Material in "material preview mode" and "rendered mode", is entirely gray as background. Only outline is displayed  which may answer your question. . It has been marked  as a dupe of around 20 or more very similar questions in the last week or two.  I have voted to close this question on grounds that it too is a duplicate


text:
Changing Specific Cylinder Radius or Diameter in Blender 2.9
I'm just getting started using Blender and have found tutorials on changing the radius or diameter by mouse, but I want my work to be precise so I much rather prefer putting in the actual numbers. Again, I'm looking for a way to change the radius or diameter of a cylinder using the 2.91 version of Blender.

Use the tools parameters that appear at the bottom left of the viewport (or press F9 to have them appear on a floating window).

I've been trying to access that menu by hitting F9 but all it shows is the words "Toggle Editmode"? Think there's a setting or something someplace that doesn't allow me to get to that.

That window (and the one I the bottom left corner) is only available during the creation of the object. Once you've created the object and done any kind of transformation (move, rotate or scale, or selected any other object) the creation parameters will not be available anymore

After the mesh is created, you can use the sidebar to change its dimensions.
Display the sidebar via the menu view -> check Sidebar. Then in the sidebar change the relevant Dimensions.


text:
Distributed interaction visualization
I'm just getting started with blender and have been playing around with it for a few weeks. I have a pretty particular use case and wanted to see if blender could assist me in that.
I have written a program that is focused on distributed computing/interactions. Best way to describe it is through an example. Let's take 100 drones and I wanted to set them up in a specific formation. I could have one program that coordinates each drone, but instead, I'm working on a distributed model where each drone makes its own decision based on the information it sources locally. The end result should be the same, conforming to the target shape but in my case only using local information rather than global information.
How does this tie into Blender? Ideally, I am looking for a way to simulate this scenario, basically create 100 drones and load them with my software click run and I can visually see the movement to understand if the target shape was achieved.
Is this possible with Blender, if not I'm open to hearing any other tools.

Not drones but Suzannes, only 8 of them, only moving in 2D, very unimaginative formation, but the key principles are here. Run the script, move mouse over 3D viewport, press Space.

import bpy, copy
from bpy import context as C, data as D
from mathutils import Vector

sim_start_frame = 1  # when to start the simulation
sim_end_frame = 2000  # save CPU cycles if you go get a coffee after starting the sim
substeps = 5  # it's common in simulations to allow more than one step per frame
seconds_per_frame = 1 / C.scene.render.fps
drones = [d for d in D.collections['drones'].objects]
mem = {d.name: {"a": Vector(), "v": Vector()} for d in drones}
frame_data = {"mem": mem, "loc": {d.name: d.location.copy() for d in drones}}
cache = {sim_start_frame-1: frame_data}

def brain(dt, memory, gps):
    """
    This is drone logic. Notice how I didn't properly encapsulate it, and so
    for example you can set memory["v"] to a huge number. Normally, you want
    to only be able to send signals to engines here, and have the outside
    of this function take care of simulating engines accelerating etc.
    """
    gps[0].z, gps[1].z, gps[2].z  = 0, 0, 0  # 2D
    ideal_dist_from_center = 3
    goal1 = gps[0].normalized() * (ideal_dist_from_center - gps[0].length)

    to_d1 = gps[0] - gps[1]
    dist_d1 = to_d1.length
    goal2 = to_d1.normalized()*2.5 / dist_d1

    to_d2 = gps[0] - gps[1]
    dist_d2 = to_d2.length
    goal3 = to_d2.normalized()*2.5 / dist_d2

    jerk = (goal1 + goal2 + goal3) / 3000
    new_a = memory["a"]*.9 + jerk
    max_a = new_a.normalized() / 1000
    memory["a"] = new_a if new_a < max_a else max_a
    memory["v"] *= .95  # damping, air resistance etc.
    memory["v"] += memory["a"]

def frame_change_pre(scene, depsgraph=None):
    frame = C.scene.frame_current
    if frame in cache:
        # restore positions from cache
        for name, loc in cache[frame]["loc"].items():
            D.objects[name].location = loc.copy()
        return
    if frame < sim_start_frame or frame > sim_end_frame:
        return
    if frame-1 not in cache:
        return  # don't compute if a frame was skipped
    frame_data = copy.deepcopy(cache[frame-1])
    cache[frame] = frame_data

    dt = seconds_per_frame / substeps
    for _ in range(substeps):
        for d in drones:
            distance = lambda x: (x-d.location).length
            # get this and 2 nearest drones locations:
            gps = sorted([l for l in frame_data["loc"].values()], key=distance)[:3]
            brain(dt, mem[d.name], gps)
            d.location += mem[d.name]["v"]
            frame_data["loc"][d.name] = d.location.copy()

listeners = bpy.app.handlers.frame_change_post
listeners.clear()  # remove old handlers before adding updated versions
listeners.append(frame_change_pre)
C.scene.frame_current = sim_start_frame

In the end I didn't use dt delta time in the brain, but because of that changing the number of substeps changes the speed of the simulation, instead of just quality.


text:
3D city build in Blender
I would like to print my city with a 3D printer, but for this I need a model. I found a lot of information via YouTube (and other sources), but I don't think Belgium puts good 3D data online (BTW we do not have the 3D function on Google Maps in Belgium, that's quite strange). I don't get decent houses through all the techniques, the houses are all the same size and have no roofs. Are there techniques that can help me get perfect houses?
But the LIDAR data is online (that's very cool), so I can make houses with the correct height and roofs. But when I process this data I do not get nice houses, as you can see in the attachment, the corners are completely round, so it doesn't seem realistic at all. This is probably because the LIDAR data was taken with an airplane (so only the roofs and streets were photographed, not the walls), but is there a way to make this more realistic?
Thanks for the responses.

MeshLab may be a more adequate tool for what you are looking to achieve

I feel like this is just barely relevant to blender, and more about how to get an accurate 3-D model of your city.

The process described in this video is a bit complicated, but I think the results are worth it.It uses an addon called Blender-OSM, which automates a lot of the buildings for you, but you do have to sign up for a free account with Mapbox. (to get access the map data)


text:
I need help with specific measurement
there!
I'm struggling with the measurement right now. I'm new at this and I'm trying to create a business card mockup. I have a specific size, 3.5x2 inches. But I can't get the size right. Can anyone guide me, please?

hello could you please show a screenshot? Why can't you have it right?

Go to scene properties, set Unit System to Imperial and lenght to Inches.
Add a plane, set the desired measures in the dimensions tab, then press Ctrl A to Apply the scale.


text:
How do I distribute more points at the end of a curve?
I am using the curve to points node.

Is there a way to distribute the points along the curve so that there are more of them towards the end of the curve? Perhaps using a gradient or curve length node?

I know the search isn't that great when looking for duplicates, but this might qualify: https://blender.stackexchange.com/a/276888/35559

one way to do this is this:

so just resample the curve by sample curve and gradient.
of course instead of gradient you can also use a float curve.
Here the node tree with float curve, which is easier adjustable, if you want to:


text:
How do I 'inflate' the radius of the curve instead of trimming?

This is my curve. I'm trying to achieve a snake like object moving along it. I'm currently using the trim curve along with a float curve as a factor for the radius.
However I want to put distribute instances on the inflated parts that appear and disappear with the size of the radius. As I currently have it set up they follow along with the object. I want them to be static and only enlarge with the enlarged part of the curve.
Is there a way of animating which part of the curve the float curve factor is effecting?
Ultimately I wanted to make a disney style sparkle path (like someone's waving a magic wand).
Here's my node set up:

It takes next to no effort to convert your setup the way you want: in your case trimming the curve offsets the length - reduces it by the trimmed Start value. So do the same without trimming and you don't have to worry about points moving, because the curve isn't changed at all:

Imgur mirror (SE image hosting has problems)

Imgur mirror
I deliberately positioned the icospheres very densely to show the shapes match, but you probably want to set the resampling Length to $0.135 × 2 = 0.27$ based on the maximum radius specified in the Float Curve:

Imgur mirror


text:
How to 'spread jam' effect using geometry nodes?
I am trying to simulate jam being spread across a burger bun. I want to use geometry nodes to do this. The end result will look like this:

And I want to appear on the bun like it's being spread (I will animate a knife later). I have tried to use a curve to do this, along with the trim curve node. But it was a headache getting the result I wanted. Then I tried to use a proximity node to delete geometry, but the result came out all jagged. My thought is that I should somehow scale the geometry from one end to another. Is there a simple way to do this?
Here's an annotated picture to illustrate the movement of the animation:

The relevant part is the framed one below, as the other aspects can be linked to your actual jam model.

The idea is to delete geometry where for all that is in front of the knife with a little random variation around it.
For the upper part of the node tree (a subdivided plane) I think that could be you model instead, if subdivided a bit.


text:
low fps when moving camera or objects and slow loading times
i have an RTX 3070 but even though, i put more than 3 objects blender starts lowering in fps and when switching between viewports it freezes for more than 30 seconds,i tried changing max fps in nvidia control panel and it didn't change anything.

The viewport is not really a realtime rendering engine and your GPU won't help much about it, because animations / movements are calculated with the CPU. I cannot stress it often enough on this site that the Frame Rate settings you choose in the Output Properties (output!) are mostly necessary for creating video files to set the fps, and also for playback of rendered videos and image sequences. Another important use for the frame rate is calculating simulations. To know how quick simulations are happening Blender needs to know in which speed you intend to play them afterwards.

Of course, the better the hardware and the simpler the scene, the higher the probability that you can watch animations almost in the correct speed. But nevertheless, if you for example want to check if movements look correct or fluent, many tutorials on Youtube highly recommend that you render the animations to really judge the movements. And to not have to wait for ages for a rendered animation, it's best to use View > Viewport Render Animation from the menu.

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.


text:
Why is Blender not applying all samples to my image?
I'm using Blender 3.3.0 and I'm trying to render a simple image.
My problem is that it seems that Blender is not applying the number of samples I set in the "Max samples" box.  If I set the image to render at 200 samples, it starts rendering normal, but at about 80 samples, the sample counter starts going very fast.  It seems as if blender stops rendering at 80 samples and the samples counter just keeps going without the image being rendered or without more samples being applied to the image.
I've tried rendering the same image at 2000 samples, but I get the same result.  The only difference is that the sample counter starts going fast at about 1500 samples. The rendered image looks grainy and it looks like it was rendered with very low samples.
I wonder if I accidentally pressed a key, because this is the first time I've encountered this problem.  I rendered another image with the same version of Blender and it came out normal.  I don't know if moved something in settings in the first blender file.
Thank you in advance.
This is a screenshot of the image rendered at 2000 samples and my settings:
[

Blender is doing exactly what you tell it to. You say (render) wait until there is less that 1% noise (noise threshold) or stop at 2000 samples. The lighting makes it  hard for Blender to get below that goal (I'm sure you can optimize that) so it stops at 2000 samples.
Consider using denoise, since your setup is prone to noise and should benefit greatly from it.


text:
Is there a way to export the Cryptomatte "pick" image entirely?
I'm using the cryptomatte node to export individual mattes for various items in my renders, but I'd like to also export the entire "pick" image to a new file just as it's visible in the node graph interface with random colors and all:

When I connect the "pick" image itself to a "file output" node I get an empty PNG saved to the drive, and I can't figure out a stack of nodes that will save it as an image.
My workaround would be to write a python script that runs through all of the objects in the scene, creates a cryptomatte node with a path export for each object, saves the file for each object to a folder, and then I merge all these files with opencv... but that's a little intense to recreate an image that's right there in Blender. I'm sure there's a better way! Any suggestions would be greatly appreciated.
Thanks :)

Ok so after playing with this for a couple of days, the issue is related to this:
https://developer.blender.org/T101601
It seems to be specific to blender > 3.0 at the moment, and the behaviour varies depending on system architecture. On M1 Apple systems the results are also different depending on whether you use Cycles in GPU or CPU mode.
If I stick to Blender 3.3 using Cycles in GPU compute on Nvidia / Linux the issue doesn't appear for my scene, but it looks like there will be an update to the blender codebase in the near future to fix this.

export as multilayer .exr
names have to be identical in the nodes


text:
Instances growing along and with the growth on the curve?
I am hoping to achieve an effect that looks like thorns growing from vines. I am able to trim the vines and animate them growing, however I would like to add 'thorns' that grow from the trunk along with the growth of the vines.
Currently I have the vines:

Here is my node set up:

I have tried capturing the spline parameter factor and using it as an input in scale instances. But even with a float curve, math nodes or color mix nodes I can't quite get the effect I'm going for. Are there any solutions to this?

I did something like that (growing veins with branch, sub-branch, ...) using a Simulation Zone. Basically, at each frame extruding all branches end, using Attributes to keep track of deepness of branches, extrusion speed, stop extruding, etc ... I'll try simplify it and write an answer. Simulation Zones are really powerful but harder to grasp.

If this is the effect you're trying to make, here is how it can be done :

Here, I instanced cones along the base curve which I converted to points to get the rotation value that I used to correctly align the cones
In order to get the scaling effect, make sure to capture the factor after you trim the curve. You can then reverse the factor with a map range node, so that the tip instances are shorter than the base ones

Hope that helps


text:
How to make a circle mesh with smooth coronas at different heights?
I am trying to make this effect with a mesh and geometry nodes.

As outlined in the picture, I would like:

The points of the circle to be at varying heights.
There to be a smooth curve between them.
To be able to animate the coronas heights.
For there to a similar effect in the centre.

I wonder if a torus might be the best primitive to start with here, and have played around with using a set position node, but can't achieve the detail I'd like.

Would love to hear any ways of achieving my goal.

(Using Blender 3.6.8)
Using Bezier curves with free handles to make sharp spikes connected by smooth curves, randomizing points around a circle.

Input parameters are:
Resolution: Number of spikes.
Radius: Circle mean radius.
Scale: Factor controlling the spikes length.
Angle: Angle controlling the spikes sharpness. Positive values make outwards spikes; negative values make inward spikes.
Noise: Largest random displacement of spike heads.

That's a great setup. I would make just a few things different... first I used only one Curve Handle Positions node but okay, for readability you could use two. Then the Multiply with -1 before the Vector Rotate is not necessary, therefore you can simply check Invert. And I made the Noise a bit different. But anyway, great. Just for comparison my changes: slightly adjusted nodetree

@GordonBrinkmann: Thank you for the tip about the Invert check-box. I never paid attention to this property ! About the animation, if I get it right, you use the Random Value node Seed to set the "mean" pattern, then the Noise Texture node is providing a "Candle light" effect by modulating this pattern, instead of the brutal effect induced by animating the seed.

Yeah, I just thought the animated seed per frame was a bit too extremely flickering and since the seed only takes integers which give totally different results per step without any chance to slow it down, I took a different approach to get a more slowly wobbling effect. Another change I could have made would have been to add another input value as a factor for multiplying the Seconds to change the speed of the wobble. And of course I could have used the Frame output instead of Seconds.

Try this geo nodes setup - rather simple really - 2 curve circles with their points set to fluctuate on the Z axis based on the W value of the 4D Noise textures. The Set Spline Type and Set handle type make sure the curves are smooth:

The Scene time connected to the W of the Noise Textures animates it.

NOTE - Sorry, I just saw you want the circle to deform in the X and Y axis as well - no bother, just connect the X and Y of the CombineXYZ nodes to the noise textures as well.


text:
How do I animate the radius filling up along curve?
This is a burger with mayo on it.

I want to simulate someone squeezing out this mayo onto the bread. I already achieved the finished result using a spline parameter and float curve.

However now I want it to animate. The desired result would be starting with nothing on the bread and it being squeezed out. I can animate a something travelling along the curve. I'm just not sure how to get the mayo to fill up along it's own curve. Is this easily achievable in geo nodes?

just use trim curve and animate the values. If you cannot do that, pls provide blend file so we don't have to rebuild it manually. thx.

you are welcome

@yojimboyd you can answer your own question now you have a solution, it may help others otherwise your question is likely to be closed

Just use trim curve and animate the values


text:
How can I animate these instances falling into position in a random order using geometry nodes?
Here are a bunch of instanced cubes.

I am trying to get them to 'fall' above into this position using geo nodes. But I want them to fall in a random order.
My theory was to first have some way of randomly selecting the instances with a set position node. Then somehow giving each instance different information when to begin moving. Along the way, I hoped to find some way of driving the whole animation as well. Any good solutions to this?
Here is my current node tree:

Does this answer your question: https://blender.stackexchange.com/questions/260744/

This is the simplest solution I found:

With this, all I have to do is key frame the black position in the color ramp connected to the noise node. The math (multiply) node after wards simply raises the height to the position I want. It will always end in the same position (as long as the value in the math node is +). I also experimented with using different outputs from the Spline Parameter node as a factor for the noise. This falls short of having more detailed control of each instance, but serves my purpose.


text:
Why in this Blender file cant I add a texture?
Relative noob here.
Having trouble adding texture to an object. Added material, then set colour field to Image Texture and selected the texture to us, but nothing appears on the object. it works fine in other files Ihave, but I created this from fresh recently and don't understand what is different and why it's not working. Have tried different textures that work elsewhere but nothing seems to work for me.
Using Blender 2.78 with cycles render.
My Blender file is here
Will be grateful for help. TIA.

You should unwrap your mesh, unless texture will not be applied.

OK I was completely ignorant of UV mapping but following your hint I watched link and can now map texture to my object. But still not clear why I was having a problem with the file referenced but not with another I'm using. Nonetheless; many thanks.

Probably the other files had already unwrapped meshes.

Not convinced, as I created those myself also. I dont recall doing any UV stuff as I didnt know anything about it.

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


text:
Model won't move right with the rig
I made an account just to make this post because I've googled it 50000 thousand times and nothing. Please keep in mind I'm new to blender, I've only been using it a few times and this is my first time rigging.
Okay so I'm trying to rig my character to move but it keeps doing this-

It looks fine at first and it does move, but its also moving things that it shouldn't. As soon As I move that left arm bone, the right one has a seizure. I have no idea what the problem could be. Any help would be appreciated :(

Related: https://blender.stackexchange.com/questions/76715/while-moving-arm-leg-mesh-messes-up

related: https://blender.stackexchange.com/questions/91792/belly-deforming-when-moving-hand

I suppose you used a mirror modifier for your mesh. Apply it before connecting it to your armature.

Oh my god I can't believe that fixed it...I spent like two hours online and looking at my mesh over and over...thank you kind sir

It sounds like the some vertex groups have been connected to the wrong bone in the armature.  Click on the bone that is causing problems then go into weight paint mode and look at what parts of the mesh are being influenced by that bone.

it could also be more complicated than this, if some bones depends on others... you have to check all involved bones...

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


text:
Is it possible to export a sequence .abc (Alembic) files and then reimport it with the Mesh Sequence Cache modifier?
I have a object that changes geometry each frame.
Now I want to cache the mesh because the framecalculations are quite slow.
My idea was to export the frames to separate Alembic files so that I can reimport them using the Mesh Sequence Cache modifier with "Is Sequence" enabled.
But when I do this only the first frame of the sequence is showing.
This tutorial on importing Realflow Simulations suggests that the import of .abc files works in Blender 2.79. So my guess is that I do something wrong while exporting the mesh.
Are there special export settings for exporting individual frames of a sequence or is it currently not possible to export Alembic sequences with Blender?

related: https://blender.stackexchange.com/questions/91948/how-can-i-change-the-frame-range-in-an-alembic-file

"Is Sequence" is used when you have multiple Alembic files that are numbered in sequence. To export & import an animated mesh you don't need to use that. Just make sure your frame range for the export is set correctly.

Thank you for the answer but i think that is not what i was looking for. The reason why i think that i need a numbered sequence of files is that the vertexcount changes in each frame. I tried to export some files like 001.abc - 099.abc where the mesh is different in each file but the mesh sequence cache modifier displays only the fist file of the sequence.

You don't need to do that, Alembic supports changes in vertex count within a single file.

Oh I didn't know Alembic can do this. Is it possible to use different mesh datablocks for each frame? I have written a script that feeds the results of all modifiers into the next frame as basemesh to be modified again and so on. This creates a sequence of new meshdatablock which i would like to save on disc like a cache and to play them back with the Mesh Sequence Cache modifier.

I doubt that'll work, since the mesh datablock name is used in the Alembic file. They'll be exported as different meshes, rather than a single animated one.

Thatswhy i tried exporting a sequence of Alembic files as this seems to be the only format that can be read as filesequence by modifiers and supports changing vertcount opposed to .mdd or .pc2 (Mesh Cache Modifier). Sadly this method does not work as expected with the Alembic files i made with blender.

It may work if you ensure the mesh datablock names are identical in each sequence.

Use name conversion like "filename_00000.abc", where "filename" is name of your cache, 00000 - frame number with 5 or 4 digits exactly. Frame number with 3 digits can't be recognized in sequence by Mesh Sequence Cache modifier.


text:
Volume from Image Sequence
Is there a way to create Volumes (Volume Object Type in blender 2.83+) from Image Sequences?
And/Or can the Volumedata be accessed/modified with python?
This would be very nice for scientific visualizations and for creating 3D-Objects from medical scans with the new Volume to Mesh Modifier in 2.91.

https://blender.stackexchange.com/search?q=medical+scans

Related : https://blender.stackexchange.com/a/149696/29586

I am aware of these methods to get voxeldata into blender. But these methods are quite hacky or are better suited for the old BI renderer.
So my question specifically asks for a way to get Image Seqences to work with the new Volume Object Type.

There is an addon that is related to that BVTKNodes. https://bvtknodes.readthedocs.io/en/latest/index.html . Though I've never used it.


text:
Blender objects locked to view when being added
Whenever I add new objects, it adds the in a way that the rotation is locked to the view and I have to manually set it to (0, 0, 0). Is there any way to change this?

On the Edit > Preferences > Editing tab make sure that you have World set against AlignTo under New Objects. It sounds as if you have it set to View.

Don't forget to save the preferences (bottom left icon).


text:
How can I make a cube with mountain surface only on top of the face in geometry node?
it's my first post in this community. English is not my mother language, so if there's any inappropriate word, let me know and I would fix it. Thanks!
Here's my question, I am making a cube with mountain landscape in geometry node with some limitations.

The landscape or the mountain surface only reveal on one face (personally set on top face)
The cube size can be adjusted (total height, length, width)

The main problem I am facing is that I don't know how to use the edge of the landscape I already created, and extend on one certain face and close it. So I can control the height of the object.
Here's some screenshots show my current geometry node.

Here's the completion that I expect.

Wish someone can help me answer this question!

You could start with a Mesh Primitive > Grid, then Mesh > Extrude it, and  displace only the provided 'Top' selection.

Of course, the parameters exposed to the modifier are up to you.

To guarantee square subdivisions, the interface to grid construction is arranged as follows:

... which snaps the size to a whole number of squares, and subdivides accordingly. 'Resolution' is then measured in squares per Blender Unit. (1/Res is a Divide node, Sx*R+1 and  Sy*R+1are Multiply Add nodes)

Thanks! That looks much easier and adjustable! I will try later!

Hi, @Hao-Wei.H ! See Edit, for one way of modifying the interface.

Perhaps worth to note, this produces non-manifold geometry because there's no enclosing bottom floor - producing one is easy, just duplicate the top grid, don't displace it, join with the rest and Merge by Distance.

Thanks a lot! I will try later! Wish u have a nice day!

@MarkusvonBroady Thanks! Have corrected, and updated download.

if you start with a default cube and you add this geometry node setup:

you will get this:

First i split the edges so i can separate the top face, subdivide that top face for the "mountain building" and give a noise modifier for z-randomness (creates the mountains). With the multiply add vector node i mask only the x and y values and set the z values to 1 so that the cube will be closed, but only for x and y values which are either 1 or -1.

Thanks! I will try my best to understand ur method! If there's any question, let me asks you more!

I was wondering how to produce n-gons on sides...

The Clamp Index node:

Basically if a side has 4 vertices, at first consider their indices to be:
    0, 1, 2, 3
Now spawn an n-gon with two more vertices, and consider their indices to be:
-1, 0, 1, 2, 3, 4
Now clamp the additional vertices to the former range:
 0, 0, 1, 2, 3, 3
If you clamp, output a 1; 1; 0 vector, which, multiplied by coordinates, will set Z to 0. If you don't clamp, output a 1; 1; 1 vector, which, multiplied by coordinates, will not change them.
Finally sample the positions taking advantage of deterministic vertex indexing in the Grid node: One side has the first indices, the opposite has the last indices, and perpendicular edges go in stride increments of a row length. Sometimes you need to reverse the order of indices to get the correct normal (aim for counter-clockwise winding).

BTW, you probably don't want the n-gons. If you want to save on geometry, remember you're only saving half-1 faces internally/on export, due to triangulation. You may want to resign from Merge By Distance...

Wow! that's a clean method! Thanks a lot for sharing your knowledge! Wish u have a nice day! @MarkusvonBroady

@Hao-Wei.H just keep in mind usually you actually want the topology generated by Robin Betts' or Chris' answer.


text:
How to make shadows invisble for one object to another object?
How to make shadows invisble for one object to another object ? I want ONLY make this two object have shadow-hide relationships, all of the other object ever can shadow be or be shadow on this two. I can't find solution, please any master help, thanks!

Hello, have you tried with the compositor? Also maybe show a drawing that explains what you want

Like @moonboots said the compositor is probably one of the easiest ways to do this.
Add the object you want to control the shadow cast of to it's own collection.
The scene in question:

The outliner setup:

Then go above the outliner change the current name to "All objects" or something, add a new ViewLayer, and then change that name to "Masked object" or something.

Then on the "MaskedObject" layer, click the check box on the object collection that you want to remove from the scene.

While this viewlayer is still active, go to the View Layer Properties panel and activate Object Cryptomatte.

Then render. It will render both versions of your scene.
In the compositor use a setup like this:

The cryptomatte mask looks something like this, only masking out the one object we want to "miss" the shadow from the monkey.

Use that as the alpha to blend the two renders and you will get a result like this:


text:
Is there a way to remove lighting and make everything have the same light?

It looks like there is no lighting and the only source is my camera? How can I make everything white in the sphere without shading/lighting?

You can use an emision shader, set the color and plug it into the material output directly

Your Viewport Shading (Z) is set to Solid mode. In this mode you get a quick render of the model with the Workbench render engine.
Check the settings in the drop-down menu. There you will see the studio light (the grey sphere) that controls the lighting. You can click the sphere to choose another light setup.
The color can be changed here, too. If the color mode is set to Material then it uses the colors defined in the Material Properties tab > Viewport Display. That's the Workbench settings, while the material colors above are used by the Eevee and Cycles render engines.

To see what the actual render will look like set Viewport Shading to Rendered. This mode also offers options. Make sure you have ticked the Scene Lights and Scene World options.
To see the lights in the final render (F12) they must be enabled for render. It's the "camera" icon in the outliner.
The Scene World settings you can change in the World Properties tab or in the Shader Editor when you select World from the drop-down box.

(The node set up here is used to use the HDRI for lighting only and to hide it when the MixShader node is enabled. Nodes can be muted (disabled) by key M or use the context menu.
Side note: If you want to use Cycles and have a supported graphics card, set Device to GPU for faster rendering.)


text:
Help me make a dense moving floor fog loop
I am fairly new to blender and am animating a looped scene of a dark grimy room. I’ve tried making a still room fog just by changing some textures to a cube but I thought I could do better. I don’t really know much about smoke simulation but I would like to make a loop of slow moving dense fog/mist that sort of sticks to the floor. I also wanted the smoke to be emitted and around the room before the start of the animation if that makes sense.
I will also have various lights on it, If that matters to know.
I saw a post on stack exchange and someone used this image and I think its just about what I am looking to create. There will be no object moving on the floor so I am not really worried about it colliding with stuff.


text:
Rigify error spine.004 after connecting two separate armatures into one metarig
When creating a metarig, the face on the original became displaced past the point of fixing, so I decided to delete the face bones, take the face of another rig, and join it to the body. In order to connect it to the spine, I used cursor to selected and selection to cursor. When I tried to generate rig though, I run into this error message. Any suggestions to fix this would be appreciated

Generally, the spine.004 error happens when the spine.003 (chest bone) is not aligned with the spine.004 (first bone of the neck).
If they're not perfectly aligned (the top of spine.003 with the base of spine.004), you will get an error. Open another Blender project with a fresh rigify rig and use it as a reference.
To perfectly align the two, select the top of spine.003, press ⇧ Shift + S and select Cursor to Selected. Then select the base of spine.004, press ⇧ Shift and select Selected to Cursor. And that will align them perfectly.


text:
clear parent and keep transform not working
I'm trying to separate a mesh from its armature after transforming it. I use Clear Parent and Keep Transform, but when I delete the armature, the mesh reverts back to its original state. Any suggestions for this problem?

Hello and welcome. First apply the armature modifier of the mesh object before the armature is deleted.


text:
where is stored the data of the projects?
good evening. I am developing a little program with Python, and I need the coordinates of every vertex in a project written somewhere, since making it manual would take a lot of time. Since blender (as far as I know) it was written in Python, I suppose that this information must be stored in some place. However, I was unable to find it. i tried looking in the code but is impossible to understand.someone knows where this information might be?

Blender is written in C/C++/Python, and as a user you can access a lot of the engine with Python, a.k.a. import bpy. That aside, what you mean with "every vertex in a project written somewhere" and how would you actually do that manually (this would give hints what you are trying to achieve). Maybe this direction is helpful https://blender.stackexchange.com/questions/1311/how-can-i-get-vertex-positions-from-a-mesh

Maybe have a look to Blender Python documentation? Or please provide a more accurate question.

The "data" of an object can be accessed from Python in several ways, but the most direct way to access the vertices coordinates of the active object is with:
bpy.context.active_object.data.vertices[0].co[0]
This gives you the X coordinate of the first vertex
To print all the coordinates of every vertex the active object:
for v in bpy.context.active_object.data.vertices:
   print(v.co[:])

To print every coordinate of every vertex in all meshes in your scene:
 for obj in bpy.context.scene.objects:
    if obj.type == 'MESH':
       for v in obj.data.vertices:
          print(v.co[:])

To read the output from the print statement you will need to either run this line by line in Blenders console, or start Blender from a terminal and run it from the text editor... Of course if you run it from the text editor you'll need import bpy at the top