text:
How to add BOID brain settings to a particle system via python script?
I am trying to use a script to  add some rules to the boid brain of a particle system and the operators on website here, https://docs.blender.org/api/current/bpy.ops.boid.html, don't seem to be doing anything.  Does anyone know a way to do add various rules to a boid brain system via script?
I am using the following code to add the particle system to an existing selected object in the scene. Everything works up until the last line where I try to add the Boid rule. That line doesn't seem to do anything to the particle system.
#adding particle system with custom particle system settings for smoke explosion below

    obj = bpy.context.active_object

    if len(obj.particle_systems) == 0:
        obj.modifiers.new("part", type='PARTICLE_SYSTEM')
        part = obj.particle_systems[0]

        settings = part.settings
        settings.name = 'Bug System'
        settings.count = 1000
        settings.frame_start = 1
        settings.frame_end = (250)
        settings.lifetime = 500
        settings.lifetime_random = 0
        settings.emit_from = 'FACE'
        settings.physics_type = 'BOIDS'
        bpy.context.object.show_instancer_for_render = False
        settings.show_unborn = True
        settings.use_dead = True
        settings.render_type = 'COLLECTION'
        settings.particle_size = 0.05
        settings.size_random = 0.3
        bpy.data.particles["Bug System"].instance_collection = bpy.data.collections[context.scene.spyderfy_tool.my_stringbugsystem]
        settings.show_unborn = False
        settings.use_dead = False
        settings.jitter_factor = 0
        settings.object_factor = 1
        settings.effector_weights.turbulence = 0
        #adding boid brain rules in correct order
        bpy.ops.boid.rule_add(type='FLOCK')

    return{'FINISHED'}

UPDATE EDIT and Follow Up Question: lemons answer worked for adding the boid rules. The last issue I am having now is adding a goal target via the script as well? Do I need to override something here as well. I've attached the code below. Only the last line is not working. For clarification the "Bug System Goal" object is an Empty that has already been added to the scene.
#adding BOID BRAIN RULES in correct order(help from stackexchange users lemon and batfinger)
        # Copy the current context
        context_override = bpy.context.copy()
        # Override the wanted property
        context_override["particle_settings"] = settings
        # Call the operators
        bpy.ops.boid.rule_add(context_override, type='FLOCK')
        bpy.ops.boid.rule_add(context_override, type='GOAL')
        #conditional to follow bug system goal if checkbox is selected by user
        if (context.scene.spyderfy_tool.my_goalobject == True):
            bpy.data.particles["Bug System"].rules["Goal"].object = bpy.data.objects["Bug System Goal"]

SECOND UPDATE and troubleshooting: Hi Lemon thanks for the response. Using the code you mentioned to add a goal object in my script I get the following error saying that the particle system object has no attribute "settings".

Tried to fill in the gaps in my code that would be specific to my script. I must be overlooking something? The goal assignment code where the error occurs is written last under the conditional statement.
 #Now we adjust our newly appended particle system with custom particle system settings for the boids system below(from article on stackexchange)

    obj = bpy.context.active_object

    if len(obj.particle_systems) == 0:
        obj.modifiers.new("part", type='PARTICLE_SYSTEM')
        part = obj.particle_systems[0]

        settings = part.settings
        settings.name = 'Bug System'
        settings.count = 1000
        settings.frame_start = 1
        settings.frame_end = (250)
        settings.lifetime = 500
        settings.lifetime_random = 0
        settings.emit_from = 'FACE'
        settings.physics_type = 'BOIDS'
        bpy.context.object.show_instancer_for_render = False
        settings.show_unborn = True
        settings.use_dead = True
        settings.render_type = 'COLLECTION'
        settings.particle_size = 0.05
        settings.size_random = 0.3
        bpy.data.particles["Bug System"].instance_collection = bpy.data.collections[context.scene.spyderfy_tool.my_stringbugsystem]
        settings.show_unborn = False
        settings.use_dead = False
        settings.jitter_factor = 0
        settings.object_factor = 1
        settings.effector_weights.turbulence = 0
        #adding BOID BRAIN RULES in correct order(help from stack exchange users lemon and batfinger)
        # Copy the current context
        context_override = bpy.context.copy()
        # Override the wanted property
        context_override["particle_settings"] = settings
        # Call the operators
        bpy.ops.boid.rule_del(context_override)
        bpy.ops.boid.rule_del(context_override)
        bpy.ops.boid.rule_add(context_override, type='GOAL')
        bpy.ops.boid.rule_add(context_override, type='SEPARATE')
        bpy.ops.boid.rule_add(context_override, type='FLOCK')

        if (context.scene.spyderfy_tool.my_goalobject == True):
            # Get the particle object
            obj = bpy.context.object
            # Get the goal
            empty = bpy.data.objects["Bug System Goal"]

            particle_system = bpy.data.particles["Bug System"]
            # You can also:
            #particle_system = obj.particle_systems["Bug System"]

            # Get the boid part
            boids_part = particle_system.settings.boids #WHERE THE ERROR OCCURS

            # Get the state (it seems there is one boid state)
            state = boids_part.states[0]

            # Get the 'Goal' rule from its index
            # You should know its index as you've set it up earlier
            rule = state.rules[1] # '1' is an example, so
            # Or:
            #rule = state.rules['Goal'] # But may be the same name several times

            # Assign the empty as goal
            rule.object = empty

Not sure where I am going wrong here.

You need to override the context. Context properties are described here. And more specifically, for particle settings, here.
To make it work, just add the following to your code:
# Copy the current context
context_override = bpy.context.copy()
# Override the wanted property
context_override["particle_settings"] = settings
# Call the operator
bpy.ops.boid.rule_add(context_override, type='FLOCK')

To assign an object as goal, you can:
import bpy

# Get the particle object
obj = bpy.context.object
# Get the goal
empty = bpy.data.objects["Empty"]

settings = bpy.data.particles["ParticleSettings"]
# You can also:
# settings = obj.particles_systems["ParticleSettings"].settings

# Get the boid part
boids_part = settings.boids

# Get the state (it seems there is one boid state)
state = boids_part.states[0]
# Or:
#state = boids_part.states['State']

# Get the 'Goal' rule from its index
# You should know its index as you've set it up earlier
rule = state.rules[2] # '2' is an example, so
# Or:
#rule = state.rules['Goal'] # But may be the same name several times

# Assign the empty as goal
rule.object = empty

Thank you lemon. Works great! Much appreciated!

Hi lemon, I just had a follow up question regarding adding a goal object to the goal brain settings. Attached the updated script above in my initial question.

Hi Lemon, Thanks for the update. Seem to still get an error on the line on "getting the boid part" Must be missing something? I attached a second update with code and details above.

My bad. The code is corrected above.

Hey Lemon, thanks for looking again! Somehow I just figured out a way to add the goal to the system but I'm not actually sure why what I did worked. I'll take a look at your update too. Been trying to get my head around Batfinger's answer all night. Still have lots of python to learn and really appreciate both you and Batfingers help! -Brad

Feel free to ask when needed. About batFINGER answer, it is maybe more complete than mine but a bit hard to understand for new users, imo. An advice: use the Python console to discover the data structure, using autocompletion (tab key): that will display all data members and help you to see what's in.

Some further notes on this.
AFAIC @lemon has provided the answer re which member  is required to override.  This is a little TL;DR ...looked at this prior to answer having tried "particle_system".,  didn't work, put in the look at later.
The properties panel has what is known as 'BUTTONS' context which contains particle_system, particle_system_editable and  particle_settings See https://docs.blender.org/api/current/bpy.context.html#bpy.context.particle_system
This is where  the particle settings are displayed. If we view source in the particle tab, opening UI file  bl_ui/poperties_particle.py  can see that a little helper function is included to get the particle settings from context.  Notice it uses either the context member available or those pinned to the panel.
def particle_get_settings(context):
    if context.particle_system:
        return context.particle_system.settings
    elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
        return context.space_data.pin_id
    return None

One wonders why it doesn't use context.particle_settings.  Since you are adding a new system, and quite likely not from the properties space will not use this.. moving on.
Other things to look for are the setting of a context pointer in a draw method, eg in this case something like
def draw(self, context):
    self.layout.context_pointer_set(
            "particle_settings",
            particle_get_settings(context)
            )
    self.layout.operator("boid.foo")

Not used here but another way to set a context member. THe operator "boid.foo" would use the context.particle_settings a returned from the method  Not used in this case moving on...
Using the reference
In as much as you have checked for no particle systems before adding one, and referencing it as the zeroth time of the objects particle systems... Can instead get the particle system from the new  modifiers reference.
>>> mod = C.object.modifiers.new("Foo", type='PARTICLE_SYSTEM')
>>> ps = mod.particle_system
>>> settings = ps.settings
>>> mod
bpy.data.objects['Cube'].modifiers["Foo"]

>>> ps
bpy.data.objects['Cube'].particle_systems["Foo"]

>>> settings
bpy.data.particles['Foo']

Setting to boids, adds two default rules separate and flock, in that order.
>>> settings.physics_type = 'BOIDS'
>>> settings.boids.states['State'].rules[:]
[bpy.data.particles['Foo'].rules["Separate"], bpy.data.particles['Foo'].rules["Flock"]]

Note that using settings.boids.active_boid_state.rule avoids the need for state name.
Finding the override.
A usual rule of thumb to find an override, armed with the big possibility that outside of properties area need to set one of the aforementioned particlish context members, can check using the operators poll method.
>>> override = {
...     "particle_system" : ps,
...     "particle_editable_system" : ps,
...     "particle_settings" : settings,
...     }

>>> bpy.ops.boid.rule_add.poll()
True

>>> bpy.ops.boid.rule_add()
{'CANCELLED'}

Which is a bummer, if there was a poll error could try polling against different context members... but alas in this instance the boid operators poll regardless.
>>> bpy.ops.boid.rule_add.poll(override)
True

>>> bpy.ops.boid.rule_add.poll({"snoo" : 'LUMP'})
True

Sheesh, not much luck, moving on
>>> bpy.ops.boid.rule_move_up(override)
{'FINISHED'}

At last, the Eureka moment of seeing 'FINISHED' indicating the operator has done its thing.
Cleaning the slate.
Ok, using the single context override as suggested by @lemon
May be simpler to remove the two default rules and rebuild rather than a list shuffle.
>>> while settings.boids.active_boid_state.rules:
...     bpy.ops.boid.rule_del({"particle_settings" : settings})
...
{'FINISHED'}
{'FINISHED'}

Note, am of the opinion since 2.8 can pass only the overridden props to the operator.
Add the new rules in order.
Example. Add the new rules based on some data. If the rule is a goal, set the goal object to some previously set target object.
>>> state = settings.boids.active_boid_state
>>> rules = ('FLOCK', 'GOAL', 'FIGHT', 'FLOCK')
>>> for rule in rules:
...     bpy.ops.boid.rule_add({"particle_settings" : settings}, type=rule)
...     if rule == 'GOAL':
...         state.active_boid_rule.object = target_object
...
{'FINISHED'}
{'FINISHED'}
{'FINISHED'}
{'FINISHED'}

Thanks for the clarification batFINGER! The last bit you added aboout adding the rules in order is really helpful. The other parts as well but still wrapping my head around the concepts.


text:
Simple Add-on Development error: Nonetype object has no attribute, "getdatapointer" (Blender 3.0)
I'm having an error with a simple script that I've created as operator for an add-on in Blender 3.0. The script essentially does three things in the following order.
1st: it imports a smoke domain from a Blendfile defined inside the add-on
2nd: it creates a smoke flow object with a slightly distinct shape.
3rd: it keyframes the fuel amount in the smoke flow object four different on the timeline and makes them cyclic via the graph editor.
I'm getting the error "Nonetype object has no attribute, "getdatapointer"" whenever the line of code in the script that sets the next frame runs.
Here's a screenshot of the traceback error:

I've run this question by our other devs and they can't seem to see an issue. Any thoughts on this?
I have a video explaining the issue in  detail here too: https://youtu.be/OUFRnB7tiPY
I've attached the simplified add-on file below if you want to run it.
https://drive.google.com/file/d/1kYlhVOOrhNSXiTxe-cT_qoVBmt2HibD9/view?usp=sharing
Below is the actual code for the operator in the script(note that this won't work without being installed through the add-on as it will import things within the zipped add-on folder...so this is just for reference)
#My Smoke Plume operator preset

class WM_OT_BasicSmokePlumeOperator (bpy.types.Operator):
bl_idname = 'my.basicsmokeplume'
bl_label = 'Smoke Plume!'
def execute(self, context):
    khaos_tool = bpy.context.scene.khaos_tool
    #First lets add smoke domain for the Plume simulation
    #ADD SMOKE CUBE DOMAIN COMMANDS BELOW.
    #We APPEND a cube from our SOURCE BLEND FILE for our smoke domain ONLY IF THERE ISN"T one already.
    #The conditional if statement below checks to see if there is an object named 'Smoke Plume Domain' already inside the scene
    if bpy.data.objects.get('Smoke Plume Domain') == None:

            section = "\\Collection\\"
            objects = ["Smoke Plume Domain"] #name of group inside of blendfile directory

            directory = blend_file + section

            for obj in objects:
                filename = obj
                bpy.ops.wm.append(filename=filename, directory=directory)

            #Now we use the command below to POSITION THE SMOKE DOMAIN TO THE 3D CURSER POSITION in the scene.
            bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)

    #Now lets add our Smoke Plume flow object
    bpy.ops.mesh.primitive_ico_sphere_add(radius=1, enter_editmode=False, align='WORLD', location=(bpy.context.scene.cursor.location))
    #Now we rename our flow object to be called Smoke Plume emitter
    for obj in bpy.context.selected_objects:
            obj.name = "Smoke Plume emitter"
    #enter edit mode to create more random shape for flow object
    bpy.ops.object.editmode_toggle()
    #in edit mode duplicate and move around new icosphere to more random shape
    bpy.ops.mesh.duplicate_move(MESH_OT_duplicate={"mode":1}, TRANSFORM_OT_translate={"value":(-0.0558451, -0.893362, 0.507589), "orient_type":'GLOBAL', "orient_matrix":((1, 0, 0), (0, 1, 0), (0, 0, 1)), "orient_matrix_type":'GLOBAL', "constraint_axis":(False, False, False), "mirror":False, "use_proportional_edit":False, "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "use_proportional_connected":False, "use_proportional_projected":False, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "cursor_transform":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False, "use_accurate":False})
    bpy.ops.transform.resize(value=(0.772502, 0.772502, 0.772502), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
    bpy.ops.mesh.duplicate_move(MESH_OT_duplicate={"mode":1}, TRANSFORM_OT_translate={"value":(0.353793, 0.540304, -1.02273), "orient_type":'GLOBAL', "orient_matrix":((1, 0, 0), (0, 1, 0), (0, 0, 1)), "orient_matrix_type":'GLOBAL', "constraint_axis":(False, False, False), "mirror":False, "use_proportional_edit":False, "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "use_proportional_connected":False, "use_proportional_projected":False, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "cursor_transform":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False, "use_accurate":False})
    bpy.ops.mesh.duplicate_move(MESH_OT_duplicate={"mode":1}, TRANSFORM_OT_translate={"value":(0.0903818, 1.05114, 0.297613), "orient_type":'GLOBAL', "orient_matrix":((1, 0, 0), (0, 1, 0), (0, 0, 1)), "orient_matrix_type":'GLOBAL', "constraint_axis":(False, False, False), "mirror":False, "use_proportional_edit":False, "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "use_proportional_connected":False, "use_proportional_projected":False, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "cursor_transform":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False, "use_accurate":False})
    bpy.ops.transform.resize(value=(1.42968, 1.42968, 1.42968), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
    bpy.ops.transform.translate(value=(-0.0277951, -0.0762881, 0.0596367), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
    #toggle back to object mode so that we can make it a flow object with desired fuel settings and then add a domain cube later
    bpy.ops.object.editmode_toggle()
    #And now we scale the object down by 0.65 so its slightly smaller
    bpy.ops.transform.resize(value=(0.5, 0.5, 0.35), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)

    #Now we continue below making the flow object we added above become a smoke/fire flow object with our desired flowsettings
    bpy.ops.object.modifier_add(type='FLUID')
    bpy.context.object.modifiers["Fluid"].fluid_type = 'FLOW'
    bpy.context.object.modifiers["Fluid"].flow_settings.flow_type = 'FIRE'
    bpy.context.object.modifiers["Fluid"].flow_settings.flow_behavior = 'INFLOW'
    bpy.context.object.modifiers["Fluid"].flow_settings.flow_source = 'MESH'
    bpy.context.object.modifiers["Fluid"].flow_settings.use_initial_velocity = True
    #And below we set a keyframe for the fuel amount depending on the float value in the user input
    bpy.context.object.modifiers["Fluid"].flow_settings.fuel_amount = khaos_tool.highest_fuel_rate
    obj.keyframe_insert(data_path='modifiers["Fluid"].flow_settings.fuel_amount')

    #Now we go forward in the timeline according to the Fuel Pulse timing frames the user has provided
    bpy.context.scene.frame_set(bpy.context.scene.frame_current + khaos_tool.fuelpulsetiming)
    #Now we set the lowest fuel rate according to the user input
    bpy.context.object.modifiers["Fluid"].flow_settings.fuel_amount = khaos_tool.lowest_fuel_rate
    #And add a keyframe for that value below
    obj.keyframe_insert(data_path='modifiers["Fluid"].flow_settings.fuel_amount')

    #Now we go forward in the timeline a SECOND TIME according to the Fuel Pulse timing frames the user has provided
    bpy.context.scene.frame_set(bpy.context.scene.frame_current + khaos_tool.fuelpulsetiming)
    #Now we set the highest fuel rate according to the user input
    # bpy.context.object.modifiers["Fluid"].flow_settings.fuel_amount = self.highest_fuel_rate
    bpy.context.object.modifiers["Fluid"].flow_settings.fuel_amount = khaos_tool.highest_fuel_rate
    #And add a keyframe for that value below
    obj.keyframe_insert(data_path='modifiers["Fluid"].flow_settings.fuel_amount')

    #Now we go forward in the timeline a THIRD time according to the Fuel Pulse timing frames the user has provided
    bpy.context.scene.frame_set(bpy.context.scene.frame_current + khaos_tool.fuelpulsetiming)
    #Now we set the lowest fuel rate * 1.25 for some variation according to the user input
    # bpy.context.object.modifiers["Fluid"].flow_settings.fuel_amount = self.lowest_fuel_rate * 1.25
    bpy.context.object.modifiers["Fluid"].flow_settings.fuel_amount = khaos_tool.lowest_fuel_rate * 1.25
    #And add a keyframe for that value below
    obj.keyframe_insert(data_path='modifiers["Fluid"].flow_settings.fuel_amount')

    #Now we go forward in the timeline a FOURTH TIME according to the Fuel Pulse timing frames the user has provided
    bpy.context.scene.frame_set(bpy.context.scene.frame_current + khaos_tool.fuelpulsetiming)

    #Now we set the highest fuel rate according to the user input
    # bpy.context.object.modifiers["Fluid"].flow_settings.fuel_amount = self.highest_fuel_rate
    bpy.context.object.modifiers["Fluid"].flow_settings.fuel_amount = khaos_tool.highest_fuel_rate
    #And add a keyframe for that value below
    obj.keyframe_insert(data_path='modifiers["Fluid"].flow_settings.fuel_amount')

    #Now Change too graph editor so that we can make the keyframes cyclical
    bpy.context.area.ui_type = 'FCURVES'
    #make the wind strenght keyframes cyclical
    bpy.ops.graph.extrapolation_type(type='MAKE_CYCLIC')
    #go back to standard 3d viewport mode
    bpy.context.area.ui_type = 'VIEW_3D'

    return {'FINISHED'}

Anyways thanks so much for the help!

it would help if you could cut and past the text of the error traceback.  Sometimes the useful information is in the middle of the traceback.  Also at this point it's useful to know which version of Blender you're trying.

@MartyFouts Thanks Marty. Absolutely. I've updated the question text above with that information. Blender 3.0.

I don't have a solution but here is what I've noticed. You mentioned other devs not having an issue. I was only able to reproduce the exact error after disabling other addons. What is odd is that when I have another addon enabled (FLIP Fluids addon), I get Returned a result with an error set with a traceback from the FLIP Fluids addon scripts. The traceback comes from frame_change_post handlers as well as frame_set operations within the addon. Since this script is causing side-effects in another addon, perhaps this may be a Python API bug or related to memory references in the script.

@RLGUY Thanks for looking at this.  That is really odd that using other add-ons created overlapping issues. You could be right about the API bug. I ended up fixing the bug simply by subtracting the "fuel Pulse timing variable" from frame 0 and setting the keyframes behind the timeline (Negative frames) rather than during the actual scene. Makes no sense to me but no bugs so far.
Thanks again for the help! Really love this community!

source: Stack Exchange

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

sort: votes


text:
How can I have the shadow catcher cast a shadow while still having a white background with filmic color management?

for my project I have an object on a shadow catcher ground-plane. Now I want to render my object only that casts a shadow onto the ground. The object shall be on a white background while still being in filmic color mode (for HDR reasons).
The reason that this does not work, is because there's no problem with the half-transparency caused by the shadow catcher.
Now my problem: If I composite my scene using the "Alpha over"-node, my background will never be completely white due to the filmic color management. However, if I lay the render over a very high intensity background, the shadow vanished because it's not dark enough to darken down the white.
That way I have the choice between a white background with a just barely visible shadow or a grey background with a visible shadow.
Does anyone have a solution for that problem or am I stuck using the default color management?
Thanks in advance.

Not entirely clear. Can you clarify? A shadow is a constricting of light. Light constriction is essentially exposure, which means it is a multiply. It doesn't matter how bright the object is, a shadow will multiply by a normalized amount. This is the same as an alpha channel when operating in a scene referred pipeline, hence why the alpha channel approach works.

Sorry, that is too much for me :) My problem is that I want a white background in my output png. However, when I crank up the first input in the alpha over node (to a way higher value than 1) to get that white background, the shadow gets less visible since it is being mixed with the over-the-top white, hence it gets brighter.
So I have the choice between a white background with a just barely visible shadow or a grey background with a visible shadow.

You are confusing two models: display referred vs scene referred. You need to revisit your notion of "white".

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


text:
Deformation after posing with armature

Whenever I try to pose this specific bone (the "Hips" bone) the two objects that are weight painted to it deform. I have parented the "Thigh" bones to the "Hip" bone and there is no deformation with those. Does anyone know what is happening, and how to fix it?
Here is the file: https://drive.google.com/open?id=1bKZgEpgq5TAVe7c8Y6dUe00hVLm5Xfax
Thanks, Felix

Please clarify your question or upload the .blend file: by now it's not clear what you want and what is not giving you the expected result.

Your hips are deforming because their vertices are weighted relatively to two bones: Hips and Spine. When you move the Hips bone the vertices receive two instructions: one (Hips) is telling to move, one (Spine) is telling to stay still: the result is the combination of theese two istances. If you remove from vertices the Spine asignement everything will be as desired. While you're editing your rig I suggest you to have Hips and Spine bones going from down to top (it's a good practice, when you will start animating you'll understand why).

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


text:
How to install matplotlib for use in Blender 2.79?

Mac OSX 10.11.6
Blender 2.79
CellBlender 1.1
MCell 3.4

I recently installed Blender, CellBlender and Mcell as described here:
http://mcell.org/tutorials/install_cellblender.html http://mcell.org/tutorials/install_mcell_linux_osx.html
I have been working my way through the tutorials (http://mcell.org/tutorials/) and had success with diffusion and unimolecular reaction simulations, but when I tried to plot the results of the unimolecular reaction simulation with the MatPlotLib Plotter (see http://mcell.org/tutorials/unimol_reactions.html), it does not produce a plot.
I suspect this may be an issue with the backend associated with whatever version of Python and Matplotlib that Blender/CellBlender is accessing.
Until now I have done all of my python/matplotlib work using a Macports installation of Python 2.7/matplotlib 2.1, but I don't think my Blender/CellBlender installation is touching the Macports installation since I did not install Blender through Macports.
So is Blender just using the system Python? How do I find out the version/location of Python and matplotlib that Blender/CellBlender is accessing?  If the backend is indeed the problem, perhaps I can fix the problem by switching the backend in the appropriate matplotlibrc file?
UPDATE
The python interactive console in Blender tells me I am using Python version 3.5.3.  It appears that there is no matplotlib available for Blender to use.  For example, in the python interactive console I can find the version of numpy by typing
import numpy as np
print (np.__version__)

and I get 1.11.2 as an output.  But if I try the same for matplotlib:
import matplotlib as mpl

I get the following output:
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
ImportError: No module named 'matplotlib'
So now my question is how to install matplotlib for use in Blender?  As I mentioned above, I already have Python 2.7/matplotlib 2.1 installed through Macports, but that is apparently a sandboxed version that is not touched by Blender.  Can I install a separate version of matplotlib that will only be used in Blender, and still use my Python 2.7/matplotlib 2.1 outside of Blender?

After a lot of digging and trial and error troubleshooting, I have resolved the issue myself.  This answer is specifically for the OS and software/package versions specified in the original question.
Blender 2.79 comes with Python 3.5.3 and Numpy 1.11.2 bundled with it.  Other Python packages (e.g. SciPy, matplotlib) are not bundled with Blender.
Install Python 3.5 using Macports, along with the appropriate matplotlib (and any other packages you want to add to Blender) then copy the desired packages from the Macports location to the Blender location.
You can keep python 2.7 as the default python for your system, and set python 3.5 as default for python3 commands:
sudo port select --set python python27
sudo port select --set python3 python35
For me the location of matplotlib in the Macports install is:
/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib
And the location that Blender accesses is:
/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/site-packages/
Note that the README file at this location states:

This directory exists so that 3rd party packages can be installed here. Read the source for site.py for more details.

(Confirming that we have the right location)
So, to copy Macports matplotlib package(s) to Blender:
cp -r /opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib /Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/site-packages/
You will probably want to copy numpy over as well (replace the existing one bundled with Blender), because the matplotlib you just installed with Macports was compiled with a newer version of numpy (1.13.3) rather than what is bundled with Blender (1.11.2). Matplotlib won't play well with the older version of numpy.
There are some additional packages that Blender needs in order to use matplotlib:
six.py
pyparsing.py
cycler.py
dateutil
These should be copied from and to the same locations specified above for matplotlib.
(See also this post by avocadohead:
http://eumenidae.blogspot.com/2015/09/adding-matplotlib-to-locally-installed.html)
(You can take my word for it, or avocadohead's, or you can find these dependencies yourself by trying to plot from the python console in Blender - you will get an import error telling you what it can't find. Then just keep copying over what Blender said it was looking for until the import errors stop).
Note: if you ever update Blender, the above process must be repeated (unless a new version of Blender fixes the issue by bundling these packages)
But there is also an issue with the backend.  Start Blender from the terminal so you can see what is going on behind the scenes (I recommend doing this from the beginning actually, because it provides answers a lot of the originally posted questions above regarding the versions and locations of python modules/packages used by Blender).  When you try to plot something using the 'Plot' button in 'Plot Output Settings' in CellBlender, you will see the following error in the terminal:

RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

We can fix this by changing the backend.  I recommend Qt4Agg.  But Qt4Agg requires an additional module, either PyQt4 or PySide.  Blender will only work with PySide.  So install py35-pyside using Macports, and copy it over to the Blender location as described above for matplotlib and the other packages.
Now we just need to make this the default backend for matplotlib in Blender.  This is done by editing the matplotlibrc file.  For me, the Blender matplotlibrc file is found here:
/Applications/Blender/blender.app/Contents/Resources/2.79/python/lib/python3.5/site-packages/matplotlib/mpl-data
Open it in your favorite editor and change backend from MacOSX to Qt4Agg
then uncomment the line backend.qt4 : PyQt4 and change PyQt4 in that line to PySide.
Now, (finally) when you try to plot something using the 'Plot' button in 'Plot Output Settings' in CellBlender, you will get a plot (and it is in a separate window)!
Other useful posts that helped me get to the bottom of this:
https://blenderartists.org/forum/showthread.php?304089-Install-Matplotlib-and-all-its-dependencies-to-use-within-Blender
Using 3rd party Python modules
Also, don't bother registering with mmbios.org with the intention of asking urgent questions on their forum - the  administrator will take days (still counting) to activate your account, if they activate it at all.

Instead of copying, symlinking also works. So something like ln -s /usr/local/lib/python3.6/site-packages/dateutil/ /path/toblender/modules/dateutil (the python location assumes you are using brew instead of macports)

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


text:
Blender search boxes -using multiple keywords
I like using the little search box available in the graph editor and dope sheet to filter the view.
Is it possible to use two keywords instead of one?
For example if I want to view both loc and rot values for my objects but nothing else, can I achieve that with the search box? In other words, what is the correct syntax for filtering with multiple keywords?


text:
What happens to linked objects when you choose to pack external data
I usually pack my textures into the .blend file via the "file"-->"external data"-->"pack all into .blend file" command.
This time my Blender project contains objects linked from other blender files and I'm uncertain of what happens if I choose to pack external data.
The question is basically this:
If I choose to pack external files, will changing the original Blender files any longer update the meshes in the blend file to which they have been brought to via linking? Or am I essentially severing the links if I pack the external data?

No, at least in my test, nothing bad happens to the linked files. Linking still works and the textures get packed nicely.
For this kind of stuff it's fast and useful to just make test blends with cubes and spheres to toy around with in order to find out what happens.

Thanks for your reply! Here's the part that confuses me: I packed the external data and moved only the main blender-file to another computer. The objects are still there. Obviously Blender can't magically update the main file if I change the linked files on another computer, which still leads me to believe that the links get severed.


text:
NLA animation changes on every render
This is the first time I'm utilizing the NLA-editor into my animation workflow and I'm having some trouble: it seems like my character is moving in a slightly different manner on every render. I have saved the exact same file on two computers and the other one rendered frames 1-99 and the other one 100-200. When I combine these two animations, there is a jump in the characters position. My feeling is that this is somehow related to playing back the animation first before rendering it, but I'm not sure if that makes sense. Or could this have something to do with "hold" vs. "hold forwards" settings? I have a messy NLA with lot's of different strips and I'm very new to it all.
What could be causing my two renders to behave differently?

I have the same problem right now,
Did you find a solution or the cause of this issue?

I belive it had something to do with the way I extended strips. Also sometimes I forgot to exit a strip before rendering. Not really sure though.


text:
Show animation speed in pixels per second
Is it possible to view the speed of a movement in Blender? In other animation software it is usually possible to see how many pixels per second an object is moving at. This is very useful when you need to achieve constant speed between different parts of an animation. Can Blender show the speed of an animation in either pixels or Blender units? I'm aware of the graph editor, but it's only showing me a value graph and I would like to see a speed graph.

While I can't think of a way for Blender to output a numerical value for speed in pixels, you can use the Vector render pass to see the speed of individual pixels.


text:
Rigid body constraints and animation
I have two rigid bodies linked together with a constraint. The problem is I need to animate the second rigid body at one point in the simulation. But as soon as I turn on "animate" in the rigid body settings, it seems like the object is no longer reacting to physics.
So my question is this:
Is there a way to drive rigid bodies that have constraints with animation keyframes, while they also participate in the physics simulation?
Here's an animated gif to illustrate:

The animate checkbox itself can have keyframes.  You can have it controlled by the animation system at the start, then turn off the Animated checkbox with a keyframe and physics will take over.  This is a common technique for launching projectiles.

authors: Антон Киселёв


text:
Creating a Liquid Bubble Effect
I saw some really cool 3d work here, and I want to know how to recreate this.

What I want in the answer:

How the particle system works (or model)
How to color the layers (the blue, red, and orange)
How to animate it (bubbling up and down)

It looks like the model is made using technique similar to metaballs in blender. To Create metaballs, in object mode Add > Metaball > Ball, and Add > Metaball > Plane for the surface
That kind of material can be achieved usin position from Geometry node, adding Separate XYZ, plugging z output to Math node set to "modulo" with unconnected socket at 1, and then plugging the output to color ramp. The color can then be plugged into whatever kind of shader you want to use (diffuse, glossy, emissive etc.)
In this i added the multiply node; by changing the value of it you can alter the band width. In color ramp, it is important to notice the interpolation set to constant.
If you create the metaballs used to make the scene in Object mode (not edit mode) they can be animated as any normal object (position/rotation/scale)

Here i animated two metaballs on a metaplane only in z position and two keyframes each.

Great answer! But where does the ColorRamp connect to? Can I connect it the material surface?

@AlexSafayan you can connect it to the color socket on any shader you want, the example looks like a diffuse shader.

I have just created aquick node setup for the animation with Animations Nodes Addon

Basically you put a MBall plane as suggested on the previous answer. Then you pick a MBall and duplicate it wit the instancer node. Then you create a loop with those instance to perform some procedural operations.
Balls are scattered on X and Y via the Randomize vector. To animate them on the Z axis we just use a sine function that is feeded with the frame number. To offset the animation I use the index factor of the loop.
A random number is used to give some sort of random scale to the metaballs.

Yes of course. Just updated.

I can at least answer point 2.: In the material node, take a color ramp with the height of the actual vertex as input. Set the color ramp's interpolation to "constant" and connect its output to a diffuse shader. You can now control which color you will get on which height.


text:
how can I use both Color and Alpha for the ColorRamp
How can I use both the Color and Alpha from the ColorRamp node so that the material output uses the color and becomes transparent?
I tried inserting a Mix Shader and connecting the ColorRamp alpha to that but it didn't work..
Thanks :)

To have the alpha properly control the transparency of the volume you need to multiply it into the density before plugging it into the strength of the emission shader.

Click to enlarge


text:
Not updating (loading) textures each frame in animation render
I am rendering animation in Cycles Renderer and I noticed that for each image render, renderer loads all textures.
Is there a way to tell renderer to use same textures for every frame (whole animation) and not to load them every time new image is being rendered?
Considering I am using over 100MB of textures it would make rendering notably faster.
(PS. I am rendering on GPU)
Edit:
Here is my simplified blend file https://www.dropbox.com/s/v5sbs56wd8pq3xh/textureLoading.blend?dl=0. It is on Dropbox because Blend-Exchange has 30MB limit. Dead link
Edit 2:
When rendering on CPU, loading is barely noticable but on GPU (I have GeForce GTX 760) it takes around one second and you can see rendering "pauses" between each frame.

I think your question will remain unclear without any insight to your texture settings...

I wish there would be a way to make cycles not reload the texture on every render/frame like the Blender internal does. Thought "Persistent Images" would do the trick, but no. All I can find are simular situations with workarounds like using low res images or bitmaps like here: http://blender.stackexchange.com/questions/27690/why-does-blender-use-so-much-memory-for-large-textures

Thank you for "Persistent Images" it actually took one second off each frame rendering time. Plus it led me to this site http://www.blenderguru.com/articles/4-easy-ways-to-speed-up-cycles/. Beside the article itself a lot of comments are helpful too.

Activating "Persistent Images" in Render -> Performance helped. Plus activating some other options in Performace section sped up rendering too. This article http://www.blenderguru.com/articles/4-easy-ways-to-speed-up-cycles could be useful for some. Beside the article itself a lot of comments are helpful too.

Enabling persistent images eliminated a 15 second lag between each frame - a big deal when it only took 8 seconds to actually render a frame. My image was a 54MB navigation chart which remained static anyway.

Enabling persistent images improved my render time from 40 to 4 seconds per frame. Was using a 900MB PNG as asteroid texture.

Still a perfect solution in current Blender version 2.91.2, this checkbox cut my animation render time in half. (GPU rendering on GeForce 1070 GTX)


text:
Background image not displaying
I set a background image (below) but it's not displaying while editing, and yes I'm not in ortho mode.  Any ideas?  Also attached a screenshot.
Update: this above part is now answered in comments—you must be in one of the preset ortho views or the camera view, and not the general ortho view or the perspective view.
I'm also interested in making this show up in my Cycles render, but it's not showing up despite having checked the Transparent checkbox under the Film panel.
Threads I've already read include:

How do I set a background image while I am editing?
Background image is not displaying in rendered mode
I can't see my background image in the 3D view

@cegaton Can you re-read my question / see the screenshot?  It was through these and other existing questions that I even got as far as I did.

I've answered one of my own questions—what the other threads/answers didn't specify was that you not only could not be in ortho mode, you can't be in perspective mode either, and you must instead be in camera view (or one of the top/left/front views).  However, still not seeing the image show up in the render, despite having checked the Transparent checkbox.

To clarify on @cegaton's comment which I found misleading—you can't just be in any ortho mode (and the other answers say as much as well), it must be one of these "preset" views.

Let us continue this discussion in chat.


text:
When to use Ambient occlusion in Blender Render?
Quote from this answer

So in cycles there often is no need for it.

So there must be a need for it in Blender Render
Can you think of a scenario where using ambient occlusion in Blender Render mode is the better choice over the other available option like spot lamps and nodes?

It can be used in a stylized render to increase the contrast in shadows; it's an effect that makes things look better.

@shady puck, but cant you do all of that with lamps alone?

AO is used to make things look more photorealsitic, it takes in account for  other objects in the scene making better shadows and lighting, reference video: https://www.youtube.com/watch?v=hbWV58AH9eg

@sammy but dont regular lamps do a better job at that? The manual says that "There is no such thing as AO in real life"

maybe only use it if you have a slow computer and cant afford to use a lamp?

Same question just minutes apart http://blender.stackexchange.com/questions/57878/ambient-occlusion-vs-environment-lighting

no, this question doesnt mention environmental lighting. It is different.

IMHO - it adds a sense of realistic dirtiness to things that get closer together. It is algorithmic, and not physically based (hence it is not something you can even do by lighting). This being said however, there is a flip side to this as well. You can also lift your lightness of values in cases where lights trying to do the work would either be very noisy or simply not bright enough (GPU/CPU BOUNCE INTENSIVE). So between not wanting to spend to much time on applying unnecessary dirt maps, or fighting with my lighting & render times, it's a pretty slick way to sell realism on the cheap.

so use it to simulate dirt in crevices?

It looks like the best place to use AO is in Blender Render to simulate it being in Cycles.

@eromod Maybe, but as I said, it can be used. It's just an effect. Just you might use post processing tools in the compositor to change the color channels or distort the lens. You don't need the compositor. It simply enhances your image.

I know that it can be used, im trying to figure out a good scenario to use it.

example of usage : your model is to be used with another rendering system (game or other) which does not handle AO/lights/shadows efficiently. It can also enforce the apparent geometry of a low poly model.


text:
Can an emitter receive shadows from another emitter in Blender Render?
Scenario:

Can I get blue shadows on the red plane?
And red shadows on the blue plane?
But, without using any external lamps...

Yes.  Go to World > Indirect Lighting, and check that.  Then go down a little to Gather, and click Approximate

authors: Владимир Ивачев


text:
Cloth simulated hair inside of an Armature?
Is it possible to have a cloth simulation inside of an armature?

The head on the left doesnt have an armature
The head on the right has an armature but now the hair wont simulate.
I think the vertex group that holds the hair to the bone is
messing with the simulation
any advice?

There should be no problem with such setup. Follow this to make sure everything is fine:

Mesh is bind to the armature with weight paint:

Here the whole plane is fully weighted to the bone.
Create a new vertex group for pinning. Here I pinned 2 corner vertices:

Use this pinning group for cloth simulation. Also make sure the cloth simulation is after armature deform in modifiers so it takes as input the posed mesh:

Now the simulation works on top of armature as expected:

As simple as moving the modifier up the stack, thxs

Things to start with :

Remove the armature modifier from the hair.
Control the hair using constraints ( copy rotation/location from the bone or the head ) you 'll have to change the origins to achieve good results.


text:
Direct Path for Desktop without Usernames for Blender 2.79
thanks for the help on my last question.
Now, i want to export to the desktop path of users, without knowing the username.
I try to explain
Export on Desktop
bpy.context.scene.render.filepath = "/users/luki-krew/desktop/"

Is working for me, the file get saved as 0001.svg on desktop.
But i want something like:
bpy.context.scene.render.filepath = "~/Desktop/0001.svg"

Perfect would be if the file name could be the same like the imported 3d Model. WOULD BE PERFECT !
Like the files named car.fbx - the export should be named car.svg
Than you so much for helping me!

The script below retrieves the home directory and generates the path to the desktop. If the project has been saved before, it adds the name as prefix.
import bpy
import os
from pathlib import Path
from sys import platform

home_dir = str(Path.home())

if platform == 'linux' or platform == 'win32' or platform == 'darwin':
    desktop_dir = os.path.join(home_dir, 'Desktop')
else:
    raise RuntimeError("OS not supported")

if bpy.data.is_saved:
    filename = os.path.splitext(bpy.path.basename(bpy.data.filepath))[0]
    output = os.path.join(desktop_dir, filename)
else:
    # Project file hasn't been saved before, therefore no filename is available
    output = desktop_dir

bpy.context.scene.render.filepath = output

If you want the prefix to be the same as the active object in the scene:
import bpy
import os
from pathlib import Path
from sys import platform

home_dir = str(Path.home())

if platform == 'linux' or platform == 'win32' or platform == 'darwin':
    desktop_dir = os.path.join(home_dir, 'Desktop')
else:
    raise RuntimeError("OS not supported")

if bpy.app.version < (2, 80, 0):
    filename_prefix = bpy.context.scene.objects.active.name
else:
    filename_prefix = bpy.context.view_layer.objects.active.name

output = os.path.join(desktop_dir, filename_prefix)
bpy.context.scene.render.filepath = output

Thank you! is it also possible to use the name of the object and not the name of the blend file for output name? :)

Sure. In Blender 2.79 the currently active object is bpy.context.scene.objects.active and in 2.80 bpy.context.view_layer.objects.active. Assign that to filename and it will use that as prefix. Although then you can also remove the whole bpy.data.is_saved check.

Where i have to insert that code in the code above :D?

I've updated the answer

WORKS like a charm but it sets at the end a 0001, dont know why :D Do you know this solution as well :)?

You need to specify the whole path including the file extension and uncheck File Extensions if you don't want the frame number added.


text:
Lighting changes during animation
I made an animation to test out a cell fracture add on but encountered the lighting was changing frame to frame. The lighting set up is three planes as shown in the photo:
Here is the animation: https://www.youtube.com/watch?v=HP3vA2Yp8Aw&feature=youtu.be
Here is the .blend file:
I'm not sure what is happening here?

If you post your.blend using Blend Exchange others will be able to examine your work, so you'll be more likely to receive help.

Possible duplicate of What is causing my frames to "flicker" after being rendered?

@cegaton I believe Youtube is currently experiencing issues, I am getting that on multiple videos

Sorry this is my first time asking a question. I have put the link in the question


text:
How can I fix brush lag in Texture Paint?
It seems to be lagging in the viewport, and I don't know why. I just downloaded 2.79, since 2.78 seemed to have the same issue. I do not believe earlier versions had this issue beyond that.
If I use the Paint mode in the UV Editor, it doesn't lag at all. How can I fix this?
EDIT: It's been a long time, but I had a PC with 16GB of RAM and a 970. (I now have a much better PC.)
For the record, I tried using low poly vs high poly, and the size of the texture didn't seem to matter. (I literally did the same for both versions and it was still nada.)
I haven't tried it on newer versions of Blender, or my new system, but I will be doing so soon. Since this is a high traffic question, I'll update if I have any issues/solutions.

Usually brush lag in the viewport is caused by too much pixel data being projected at once - at a rate that is unsustainable for viewport performance. It could be that your textures are too hi-res, that you are too far zoomed out (causing a single brush stroke to have influence over a vast texture area), or some combination of the two. I don't know anything about your hardware specs but of course insufficient RAM would also lead to viewport performance problems.

could be a number of reasons :

too much geometry in viewport

too high-res material texture

too high-res brush texture

too big brush size

too small spacing in the brush stroke properties

too many applications open at the same time

too low-end hardware

do you think some of these fit your conditions ?

Nope. I have 16GB RAM, and a 970. I have 8 cores, too. Also, it does it even was a basic cube and 256 texture. Ty, though!

I suffer from this as well (in Blender 2.83). There seems to be some weird threshold. When zoomed in, it's very snappy, no lag at all. But at some point when I am zooming out, each click takes about 20 seconds to go through.

I have the same problem (Blender 2.83, 32 gigs ram, RTX 2080 TI, ssd). My computer is beefy enough but when the brush size is too big, it gets very slow. Texture size is 4096x4096 px.

Changing the Window Draw Method to Full under User Preferences seemed to fix the lagging in my case, even though I'm not sure how this could impact other things. But after changing it once, I was able to set the draw method back to Automatic and still be able to paint without lag.
Hope it helps.

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review

@VRM Technically, this does attempt to answer the question. It is a short answer, and really more of a suggestion than a full answer - but it still is technically an answer.

@X-27 This is one of those edge cases where it is clearly better suited as a comment but does technically sort of answer the question. Take a look at the last part of the automated comment generated by the review.

Ok, sorry for my mistake, this is my first time answering to a question in Stack Overflow. I realized that my last answer about toggling Only Render didn't actually fix the problem op was talking about, so I changed it to a workaround I saw on the Blender Artists forum.

Closing all workspace areas which display the texture or the texture image and using only one area can help reduce texture paint lag.

Probably what you're perceiving as lag isn't actually lag, it's a property of the default "space" stroke of the brush.  Basically it's set to draw every so often you reach a spacing point. This is the default setup of Blender.
If you look under the "Stroke" option in the top bar, you'll see a setting "Stroke Method". If it's set to "Space" then try setting the "Spacing" below that to 1%. You should now find that the brush now seems to paint instantaneously. In reality, it's not any faster, it's just that the spacing of control points of the stroke is different.


text:
I can't get the soft body to follow the empties
I am basically working on a tetherball.
I have tried a lot of different methods and nothing really works.
Basically, I have a girl and she has the ball in her hands. I have already animated the ball. I am trying to animate the rope and make it collide around the pole.
I have tried using a cube, etc, but no matter the setting, hooks, armatures, etc...
I cannot get the bottom of the end of the rope to follow the empty. It just wiggles in place.
I tried opening a new file, and it did the same thing. The bottom of the rectangle won't move. It turns, slightly, no matter the vertex group/setting, etc.
I was thinking I could try anti gravity?
Regardless....why won't it follow the bottom? I don't comprehend.

EDIT:
https://youtu.be/_A43B_jAxd8
For a working example of what I mean.
I am trying to get said bottom to move...pick up...go against gravity...something of that nature.
I have tried so many settings I must be losing my mind. :P Not that I had much to begin with. XD

since you didn't show us any really useful information of your setup (like order of your modifier, goal, soft body settings) i explain how a general setup works:
from a default cube, select 4 vertices and extrude a few times:

select one vertex, CTRL-H -> to new object

then select that one vertex and create a vertex group for that (don't forget to press "assign".

now add softbody and choose your vertex group for goal:

now hit spacebar to "run animation", in object mode select your empty and move it around.

if you don't want it too crazy, just increase damping, and shade smooth does make your object look better, maybe even add a subdivision surface modifier after soft body
the order of the modifiers is crucial here.
First the hook, then soft body, then subdivision.
Changing the order will break the simulation and/or change the behaviour!

Sorry about that! Thanks for the throughout comment. Sorry for the confusion! Yes, I have done all this. Let me post some screenshots of my actual project to give some clarification.

Better would be providing your blend file so we can check it out

Added a YT vid and the blend file of the sample. And don't take any of my settings too seriously for the soft body. I've tried all kinds of vertex groups, all kinds of settings, I even made my own document so I can remember what each setting means because it's been way too long since I used soft bodies lol. The fact I can't pick up the other end is a mystery I just...cannot solve, apparently, haha! Thank you for your response.


text:
cant get the sub-surf right (Blender guru beginner modeling tutorial)
So I have been following the Blender Guru modeling tutorial with minor changes every thing looked OK till he added the sub-surf modifier and I have no idea how to fix  (followed tutorial https://www.youtube.com/watch?v=WxMwa0njGSM )
this is my edit view with and with out sub surf

and this is how it should look like

I guess your mesh has something different in the bottom: I think you have a single bottom face (N-gon), which is causing this issue...
if you have this (sorry for the horrible mesh, I'm before breakfast...)

subsurf behaves well

while if you have a single N-gon face

subsurf behaves like in your model

if unsure, share your model through
http://blend-exchange.giantcowfilms.com/
then edit your question and post the provided link...
edit:
after getting your file I found that this model has (still) several issues: at the base there are still n-gons, ruining the subsurf effect, but overall it has some other modeling issues... giving aso bad mirroring results.
About the ngons, this what you have one side

and the opposite is even worse

then below you have some faces with inverted normals

then again, its quite irregular on lines that are supposed to be quite linear instead: this ruins both mirror and subsurf
eg: here

Nothing terrible, and it can be corrected, but I suggest you to try to model keeping an eye on such things, because it helps you model better, and get better results. First, I recalculated normals (select  all in edit mode, then CTRLN)
Then I tried to remove those ngons, getting something like this

if you enable subsurf now, it looks better, but not at its best:

it lacks some subdivision at the base, eg:

with this further subdivision,

the base becomes more defined when you subsurf later

Here is the file a bit corrected (imho, it could still be improved)

Hth, Marco

To add to this, use the knife tool to get rid of the N-gon by adding the needed edges.

yeah I think that is the problem i will give it a shot and come back at ya

Ok so I did that and still came out weird i have no idea what to do

As said above, share your model.

I already did that.

@CatMann  I edited my answer to show you some issues and a possible way to fix...

just a little question  how do i hide the grid on the mesh ?

Look under object properties tab, uncheck "wire" and "draw all edges" (see bottom right in the last image)

You model has faces on the bottom but his doesn't, that is your main problem. Where you have the crease about halfway up is caused by faces inside your model. Go to face select mode, and in wireframe view you can easily select and delete the extra faces.

well it looks good when i remove the bottom face  but i don't remember him removing it so i don't really know what to do now since the anvil has no bottom


text:
Reducing fireflies from a cycles render
So I'm trying to use maps while applying textures to produce a more realistic scene. The issue is my scene is producing too many fireflies. I've tried adjusting clamp settings but the fireflies are still there. I've also tried adjusting values in the node editor but it's till not working.
This is how I have setup my lighting:

Here's my node editor screen:

The final image render:

I've tried adjusting the roughness values of the glossy shader and the diffuse shader but the fireflies are still there.

Possible duplicate of How to reduce fireflies in Cycles?

@cegaton Thank you for the advice. I've edited the question accordingly. I know didn't about https://blend-exchange.giantcowfilms.com/

@bertmoog I already checked that question. It didn't help

Cegaton advices are good to folow to help people to help you.
I've tried with my own textures and have the same fireflies.
In your specific case:

you've plug the normal in the Height slot, height is for bump map (grayscale images), with this I haven't got any fireflies at 32 samples.
it's better to have a mesh correctlly unwrap, apply the scale before unwraping and redo the unwrap.
too strong normal map or bump map can lead to fireflies
not really fireflies related but when trying to recreate realistic materials, never mix a diffuse and a glossy without a fresnel effect.
Node Input--> Fresnel and plug it in the mix factor

General advice regarding fireflies:

Personnally the most important feature when using HDRi is to set the map resolution to at least 2048, but I prefer 4096 for a good base, personnally I never go under but I'm not so limited by graphic card memory.
Go to properties tab--> world--> settings pannel--> map resolution.
An other fireflies killer and lighting killer if you don't set up corrctly, is the clamp direct in the properties tab--> sampling pannel.
To set up correctly you need to determine what is th most powerfull ray that land in your scene and adjust the value to clamp only what necessary. A bit tricky. In most case without too much risk a value between 100 to 80 make the job without altering the lighting (if you don't see light sources).

Perhapse I'll edit my answer to give my tech if someone is interest.


text:
Making a flexible parameterized horn
I'm trying to make a model of horn acoustic:

Actually, it should be a parameterized (for example, exponentally widening) tube, which can than be shaped/curved.
I've been trying Curve Modifier but it works OK only for one turn.

Final:

Overview:
You will need two objects.

Simple Bezier Circle which will Bevel your shape.
Bezier Curved shaped as needed with custom Radius values (per point) for Beveling.

You can change Radius values by selecting point and changing it's value in Transform tab or by hitting W > Set Curve Radius.

After that you can add Solidify Modifier and maybe Alt+C > Mesh from Curve.
Blend file:

Thanks a lot, Luke! Didn't know about Radius changing.


text:
Blender always crashing when applying hair particle system with a cylinder as the object
Blender crashes whenever i try to apply a cylinder to a hair system particle, i don't know what is going wrong but if i change the object to a lamp it works well. I've tried reducing the number of particles as low as possible but the problem still persists, even when i reduced it to 2.

If any application crashed and it is reproducible then it is a bug and should be reported to the developers.

@ Duarte Farrajota Ramos But if i reduce the number of particles to only 1 it doesn't crash.

I understand, but that makes no difference

@BluRe.CN otherwise, share the .blend through http://blend-exchange.giantcowfilms.com/ (upload the file, then edit the question and add the given link) so we can try the same on your exact setup. How much ram memory has your pc?

Thank you all for responding. However, it appears to be a bug as Duarte Farrajota Ramos suggested, so i downgraded blender to a previous version and everything works fine now.


text:
Character Mesh Distorts Upon Keyframing

Hello there. I've been following tutorials online to be able to model and rig a character to animate it. The essential animation has been done and my character actually looks like he walks normally. What I've been trying to do is make him move across the screen in the x axis; just a simple walk across the frame. So I go to frame one and put my mouse over the meshes object X location and press "I" to enter a key frame, and then I do the same at the end after moving the character across the screen, but as soon as I do that, my mesh distorts and "conbobulates" into a weird shape leaving the bones aside while barely moving across the screen. I can't seem to find any help for this specifically. Any help would be appreciated

Edit: true answer for your problem is point 2
1)
If you want to move your character along the X axis for example, you need to move the armature (in Object mode), not the object itself: The object is parented to the armature, so it will follow the armature. So delete the keyframes you've created for the object and create keyframes for the armature.
To see the keyframes of the selected object only, enable this button on the bottom of the Dopesheet window, otherwise you'll see all the keyframes of all the objects of your scene.
Now select the character object (not the armature) and delete the keyframes you've probably created.

2)
Now, my first answer didn't fix your problem but I've found the anomaly. I can't explain how it happened but this will fix the problem: Go into the Outliner, you'll see that the Animation is part of the object while it should not be the case, so ctrl right click over Animation and Clear Animation Data

But regardless if I click on the mesh alone, or the bones alone, or both the mesh and the bone with shift right click, the walking key frames are the same. If I just click the mesh (object) and I delete those keyframes, its basically erasing the ones from the armature. When I move the character around in x value, he doesn't distort. Its only when I insert the first keyframe that the entire distortion occurs.

I've edited my answer, does it answer your question?

I really appreciate you helping me out but I just followed what you said and the problem still persist. I recorded the issue from my phone to better explain and so that you can further see  my setup https://youtu.be/uhSo-Ovw7PA

could you please share your file (the bugged version)

Any help resolving this is greatly appreciated

Ok I've found out, I'm going to edit my post

Thank you so much. I can't express what a relief this is. I'm still very curious as to how that happened so I can avoid it in the future, but it very much did solve my problem. Thank you. :)


text:
VSE - Audio wave forms are tiny, audio channel is huge
I'd like to see more detail of my audio wave form:

As you can see I've zoomed the channels appropriately. All the places that have "no" wave form actually have audio. When I play the animation, it renders the audio fine. Increasing the Volume, Pitch or Pan has no effect.
Help?

Changing the volume should work:

If you need to have different volumes at different times, then change an area to graph editor, click the small circle next to the volume widget, so you can work on a curve controlling the volume in Graph editor.


text:
How to use mirror ball to light a scene?
I'm interested in inserting 3D rendered objects into a real scene in a photo (and eventually video) and using image-based lighting.  I took the following photo of a mirror ball (pretty low-res):

I then tried following this tutorial which was one of this only resources I could find giving step-by-step instructions for mirror balls:

switch to Cycles
go to the World tab
add a Background surface
specify Environment Texture
open the above sphere.jpg
select Mirror Ball
select Vector = Mapping
select  Vector = Texture Coordinate > Generated

This generates the attached garbage.  Why, and what should I do instead?  I'd like to stick with mirror balls since they're much faster/easier to capture than a 360-panorama.  Thanks!

Update: here are the results after following Spencer's answer, before (original) and after—still seems kinda fake (any tips?), but it was fun for a first stab.
Some details:

I just pointed the camera from the front view
I left the background transparent and gimped it in later
I clicked the Smooth button under Shading on the left toolbox or else the monkey looked extremely polygonal
I added Glossy BSDF material on the monkey
I added a Sun light - not sure that that helped actually

You need two images, one from each side of the ball. With only one image you only capture one side of the environment. Also note that to accurately reproduce the lighting conditions of the environment in which the image is taken, you'll need a larger dynamic range

@gandalf3 Thanks for commenting. (1) 2-sided sounds counter to what I've read from multiple sources, saying you only need what the camera can see. And all the mirror ball images I've found online have been one-sided, e.g. http://blenderartists.org/forum/showthread.php?363016-environmental-texture-mirror-ball. Can you cite sources, identify exactly how one would represent a two-sided ball + how to accomplish things in Blender? (2) The ball image in the OP was in fact captured using Google's HDR software. (3) Would really appreciate any answers you can give, esp. step-by-step instructions!

@Yang Nope, these are panoramas (360 degree hdri data aka lightprobe), which is required in order to match your footage. Is this question more about capturing a hdri or using it in blender?

First of all, you need to use the .hdr or .exr formats instead of .jpg. No matter what tool you used to capture the image, .jpg as a format can only hold red, green, and blue channels that go from zero to one. You can imitate some dynamic range with judicious use of RGB curves but for the best result you will need an image that has high dynamic range and was saved in .hdr or .exr format, since those are the only formats Blender reads that are meant to handle such data.
Second of all, besides that you are mostly setting up the environment correctly. The only additional step you need to take is to enable Multiple Importance Sampling for the world. This property is found in the Properties panel, under the World tab, under Settings, and it will make your render converge more quickly. You should always turn this on unless your environment is a constant color, in which case having it off will save a little bit of render time.

If you look at some balls from the Front view, you will see that the garbage portion of the image is clearly visible in the background, but everything that's in the image of the mirror ball is reflected correctly onto whatever geometry is facing the viewer. This situation is ideal because it puts all of the details from the mirror ball onto the geometry, where it can do its job by looking good.
If you want something else to show up in the background besides mirror ball trash, there are a few ways to do it. The first option is modeling most of an environment so that the background isn't visible. The second option is to set the background to Transparent in the Properties panel->Render settings->Film, which will make the background transparent so you can composite or paint one in later. And, finally, the third option is to use the Input->Light Path node to show a background image to the camera and the mirror ball environment to the objects in the world. Here's something like what you might get from such a setup:

You can use any sort of image, photo or matte painting you like here, as long as it looks good and makes sense in the context of your render.
The next problem you'll run into is that you might not want to render with the camera aligned to the Front view. So, you need to rotate the environment texture around until you get all of the mirror ball trash in the background of the camera's view. You can use the Vector->Mapping node for this. The Z rotation will rotate the environment around the Z axis, which will usually get you the result you want.
This all gets much more complicated for animation because you have to interpolate between a sequence of mirror balls to get a result that fits in with your real-world footage, and you would have to animate the Mapping node which might be possible with drivers but probably wouldn't give you the perfect result you might be looking for. For rendering animation that's going to be composited with real-world footage I therefore prefer equirectangular maps that were digitally stitched together from carefully bracketed, Macbeth-chart calibrated HDR photographs of the set, as the amount that you have to animate the Mapping node is minimal and you don't have to use an image sequence for the environment texture which Cycles doesn't support in a straightforward way.

Thanks so much!  This set me on the right track.  I wish I could upvote this multiple times.  Do you have the source files for your screenshots you can share as well?

I updated the question with my own results. Would love to hear any feedback you have as well!

You probably need to improve your photography technique next to get better results from here on out. Look into shooting multiple exposures and converting them from RAW to EXR with Lightroom or some other software (probably the Blender compositor can do it although I'm not sure how.) Some cameras can shoot multiple exposures automatically to accelerate this process. You might also want to try taking the mirror ball photographs zoomed in optically to capture more detail on the mirror ball. You may also want to purchase a Macbeth chart to help color-correct and correctly expose your photographs.

If you must use a mirror ball, carry on. However, I'd strongly encourage you to try the solution posted here http://blender.stackexchange.com/questions/412/how-to-capture-lighting-in-video-shots/453#453. Also note that to fully capture the sun, you will require a ten stop ND filter. Direct sun will land somewhere near sixteen stops over your perceptual middle grey exposure point.


text:
Problems with Cycles Baking!
I have a bit of a problem, I'm trying to bake out a normal and a AO Map from a hires model, And place it on a lowres model.
The problem I get is when i bake the normals, the whole thing is pixelated, And the AO just has Solid Black and white noise all over it, you can't even see the shadows.
Im guessing that noise is whats causing it on both maps, however I have no idea how to get around it.
Ive looked around for an answear, i found very little information on this issue, some said it may be due to overlapping UVS, but i have none overlapping. I even tried using smart UV, still looks the same.
Please someone help me, this is really annoying, Been running into this every time I'm trying to bake!
Im attaching a photo where I edited them together to show you the issue.

May you have hidden objects that could be overlayed to the object's faces? Could you show a picture of your baking setup&scene?

I am guessing here that you don't have smoothing on the face normal, and secondly you have the low res mesh on the high res mesh overlapped while baking the AO. ... AO baking does not work when you have the hi and low meshes overlapped. If your normals keeps giving you issue you may have to use the shrink wrap modifier. Try using the multires bake method instead it doesn't require you to overlap the mesh.

What do you mean by smoothing on the face normal? And about the low res and high res overlapping, i only have that because in the tutorial  I watched, that guy had them overlapping. And his result was perfect? Ive never tried the shrink wrap modifier, what exactly does it do? and is there anything i need to know, or do i just apply that?
And I've never heard of the multires bake method either, is that part of cycles or blender render?

I will edit my post and attach an image of how my scene look.

I usually use blender internal to do the baking as it has not much difference to how it works. Multires requires that you sculpt your object into the shape you want and bake directly off the multires modifier. Overlapping specifically is used to bake highres mesh's normal onto lowres mesh. If you view the video in detail again, I am sure he did not bake the AO of the highres mesh while the lowres mesh is also occluding it. If you have the meshes overlapped while baking AO you will expect the rays to bounce between the 2 surfaces of the meshs and create the noise you see.

https://www.youtube.com/watch?v=uTGTUd0pCaQ watch this video on youtube on how to use the shrink wrap modifier.

To apply smoothing to your highres model do this, 1. Go into edit mode 2. Select all the faces 3. Hit the "W" key on the keyboard 4. Select "shade smooth" .... Do not select "smooth" or "Laplacian smooth" they are different operation and they affect your vertices instead.

Oh, well, i guess I'm going to do that next time, but as i have already finished the sculpting, i just wanna be able to fix this one!
Well i just watched it, and as far as i can tell, he still has them overlapping, here is the link https://www.youtube.com/watch?v=wHmw783xreY . But the shrink wrap modifier, is that a possible solution for the normal map baking?

Let us continue this discussion in chat.

Ok here's what I found. Due to the way your hires model is made you do not have an initial starting point with a basic UV unwrap. So we have to go the cage projection route. Which is the same method you were trying to follow on the video tutorial you posted in the chat.
Attached is the file you sent me, I have manage to produce the normals and AO with no problems on my end. You can try out the blend file below. I have packed a copy of the bake I made. Also to the left of the baking models I have created a GLSL shading model using Blender Internal Materials.
You will need to create nodes holding the texture for Ambient Occlusion and Normals. On the file you will see a green frame and a red one on the node window. The Green one is the node you need to select and make active before baking the Ambient Occlusion. Likewise the Red on is the node which holds the normal texture you need to select before baking.

DOWNLOAD - Here is the file.


text:
how to show again the dot in the faces?
Basically this my problem, i dont even know how i disable the "dots" in the faces, and yes, the model is set to "face select".
Is there any way to restore the configuration without delete my model?
or any solution to my problem?
Here is blender showing the dots in the model

And here is Blender not showing the dots in edit mode

Sorry... can you clarify?

as you see in the image there are not "points" (idk how they are called) in the model, i will upload a screencap to show the "points" i am talking about

They are called "Face dots". Is "Textured solid" option enabled in the Shading panel of the 3D view Properies tab?

Yes it was selected, i have unchecked it now and it seems to work, ty Carlo :D

Disable Texture Solid option
When that option is enabled, it's supposed that the artist is more intrested in seeing textures than faces dots, so they are automatically hidden (as if you were in texture paint mode) to avoid confusion.
Imagine these dots upon a pois-pattern texture!

As stated by Sergey Sharybin in this task:

[...] it's currently intentional behavior. Textured shading wouldn't have dots, solid shading with textured solid enabled also wouldn't have dots. This makes sense since this dots wouldn't be much helpful -- they either could obscure texture or the wouldn't be well enough visible.


text:
Cutout of plane with rounded corners
I'm trying to cut a door out of plane, but I need the edges to be rounded. So sort of an inverted bevel. I'm a complete noob can't find the right way to do this. In the pic, the circle would be roughly the radius I need, but the interior of that rectangle would be removed.

Reference image: RV doorway

Related/duplicate maybe: https://blender.stackexchange.com/questions/78322/how-to-create-this-curved-90-degree-angle-quickly/78326#78326

some helpful ideas, but nothing immediately applied, at least not that I could figure out. That was beveling both inside and outside, I just need the inside cutout.

Do you want it to be quad based?

A lot easier way is to extrude faces which corners you want to bevel out of the surface and bevel corner edges of the extrusion. Then delete extrusion and you'll be left with only whole with beveled corners. Topology might be needed to be corrected, so no Ngons, no tris (preferably) if you plan to use Subsurf or stuff

@MrZak I think your suggestion was the fastest/simplest. I used that as the basis for my answer below.

I think I found the easiest way based on answers posted and Mr Zak's comment on the extrude. If you inset (press I), then extrude (press E), you can take the outer edges and bevel (ctrl-B), then delete all the extruded parts (use cursor select by pressing C to pick the faces quickly, then press x and select Faces). Takes about 20 seconds.

If i understood the question you need to curve the edges
Select the side verts and Press Ctrl+Shift+B to bevel
Select the edge and subdivide both edges
Select the face and press Shift+S and select cursor to selected
Select the single vert and press Shift+S selection to cursor
Repeat to other side also.
Select both the verts and Press Ctrl+Shift+B to bevel and with the scroll wheel increase the verts
Select the face and delete or extrude it.

I don't think that this can be done automatically.
Anyway you need 5 minutes:
Starting from one plane, select the two upper vertices, press CTRL+Shift+B, drag the mouse and use Scroll for more vertices. Now you just have to merge this plane in the rest of the model, select the vertices and press F to create the faces, it's important to get a pattern like the one on the image. Then delete the central face.


text:
Subdividing Causes Strange Edges / Issues on Shape
So I have this flat shape, and I'm trying to make it 3D. It's pretty round and has a ton of vertices. My end goal is to have the 3D shape with smooth edges.

I approached this by pressing ALT+F to fill the shape. It created a bunch of faces that don't look too clean.

Then I extruded the shape once forward, and once back (from the original shape) so that it was "3D". This is close to what I want, but I want it to have a subdivision modifier, so the edges look smooth.

I then applied a subdivision modifier, and the shape just looks awful. Bumpy and ugly.

If I do "F" instead of ALT +F, it still produces a poor result.

I've tried looking on this forum for solutions to similar issues, but so far not much has worked. I hope the images are enough to paint my issue, and give an idea of what I'm trying to achieve, any help would be appreciated.

This is topology issue. Subdivision Surface modifier do not work well with ngons and tris.

Related https://blender.stackexchange.com/questions/82392/object-deforms-strangely-when-using-the-subsurf-modifier and https://blender.stackexchange.com/questions/34518/subdivision-surface-problem or https://blender.stackexchange.com/questions/82392/object-deforms-strangely-when-using-the-subsurf-modifier Also see http://topologyguides.com/

@LukeD I'm not fully aware with how I would go about fixing that as I'm not necessarily familiar with ngons.

Please upload your file to: http://blend-exchange.giantcowfilms.com/ and maybe I could make something out of it. The main thing is that (as you should know from all the links that Duarte provided) you need quad based topology.

@LukeD
I appreciate your willingness to help. I added the link to the .blend file, if you figure it out, please share how you did so in detail so I can try it myself.

It's not the best topology but just quick example.
First thing I've done was to delete half of the mesh and add Mirror modifier to reduce work.
Next I've created Outer Edge Loop just by extruding vertices.
In the same manner I've filled rest of the mesh with faces with some Reduction Loops, this was needed for making all of the faces quads (more on this you can find on topologyguides.com).
I haven't used any "automatic" methods, it's just extruding E and filling F with a little help from F2 add-on. It's all manual work.

I personally feel like this answer is the way to go. Especially if the OP plans to rig this model in some way. The TRI topology would make rigging and deformation a nightmare.

Instead of adding a bulk of verts.
In the edit mode select the verts and make few edges
In the Transform panel. Select the outer edge and Make crease 1
Add subsurf modifier and extrude


text:
List vertex colors from a bmesh
I'm working on a custom exporter for an external software.
I need to get a list of the vertex colors from a triangulated mesh.
To get the triangulated mesh I use this code:
bm = bmesh.new()
bm.from_mesh(SceneObj.to_mesh())
bmesh.ops.triangulate(bm, faces=bm.faces, quad_method='BEAUTY', ngon_method='BEAUTY')

With normal meshes I use this code:
#Get vertex color list without duplicates
VertexColList = []
if len(MeshObject.vertex_colors):
    if hasattr(MeshObject.vertex_colors.active, 'data'):
        for layer in MeshObject.vertex_colors:
            for vertex in layer.data:
                VertexColList.append(
                    (vertex.color[0] * .5, vertex.color[1] * .5, vertex.color[2] * .5, vertex.color[3])
                )
        VertexColList = list(dict.fromkeys(VertexColList))

But that piece of code not works in a bmesh, what should I change to make it works?

Bmesh.from_object
Doh, @scurest Answered while I was putting the bins out, may as well post
import bpy
import bmesh

context = bpy.context
ob = context.object
dg = context.evaluated_depsgraph_get()

bm = bmesh.new()
bm.from_object(ob, dg)
print("Evaluated bmesh object", ob.name, "mesh:", ob.data.name)
tris = bm.calc_loop_triangles()
print(
    "faces", len(bm.faces),
    "edges", len(bm.edges),
    "verts", len(bm.verts),
    "tris", len(tris)
    )

for name, cl in bm.loops.layers.color.items():
    print("Colour Layer", name)

    for i, tri in enumerate(tris):
        print("Tri", i)
        for loop in tri:
            print(
                "loop", loop.index,
                "face", loop.face.index,
                "edge", loop.edge.index,
                "vert", loop.vert.index,
                "colour", loop[cl][:]
                )

Result on default plane, one vertex colour layer added, one subsurf modifier.
Evaluated bmesh object Plane mesh: Plane
faces 4 edges 12 verts 9 tris 8
Colour Layer Col
Tri 0
loop 0 face 0 edge 2 vert 0 colour (1.0, 1.0, 1.0, 1.0)
loop 1 face 0 edge 8 vert 5 colour (1.0, 1.0, 1.0, 1.0)
loop 2 face 0 edge 11 vert 8 colour (1.0, 1.0, 1.0, 1.0)
Tri 1
loop 0 face 0 edge 2 vert 0 colour (1.0, 1.0, 1.0, 1.0)
loop 2 face 0 edge 11 vert 8 colour (1.0, 1.0, 1.0, 1.0)
loop 3 face 0 edge 1 vert 4 colour (1.0, 1.0, 1.0, 1.0)
Tri 2
loop 4 face 1 edge 3 vert 5 colour (1.0, 1.0, 1.0, 1.0)
loop 5 face 1 edge 4 vert 1 colour (1.0, 1.0, 1.0, 1.0)
loop 6 face 1 edge 9 vert 6 colour (1.0, 1.0, 1.0, 1.0)
Tri 3
loop 4 face 1 edge 3 vert 5 colour (1.0, 1.0, 1.0, 1.0)
loop 6 face 1 edge 9 vert 6 colour (1.0, 1.0, 1.0, 1.0)
loop 7 face 1 edge 8 vert 8 colour (1.0, 1.0, 1.0, 1.0)
Tri 4
loop 8 face 2 edge 9 vert 8 colour (1.0, 1.0, 1.0, 1.0)
loop 9 face 2 edge 5 vert 6 colour (1.0, 1.0, 1.0, 1.0)
loop 10 face 2 edge 6 vert 3 colour (1.0, 1.0, 1.0, 1.0)
Tri 5
loop 8 face 2 edge 9 vert 8 colour (1.0, 1.0, 1.0, 1.0)
loop 10 face 2 edge 6 vert 3 colour (1.0, 1.0, 1.0, 1.0)
loop 11 face 2 edge 10 vert 7 colour (1.0, 1.0, 1.0, 1.0)
Tri 6
loop 12 face 3 edge 11 vert 4 colour (1.0, 1.0, 1.0, 1.0)
loop 13 face 3 edge 10 vert 8 colour (1.0, 1.0, 1.0, 1.0)
loop 14 face 3 edge 7 vert 7 colour (1.0, 1.0, 1.0, 1.0)
Tri 7
loop 12 face 3 edge 11 vert 4 colour (1.0, 1.0, 1.0, 1.0)
loop 14 face 3 edge 7 vert 7 colour (1.0, 1.0, 1.0, 1.0)
loop 15 face 3 edge 0 vert 2 colour (1.0, 1.0, 1.0, 1.0)

Applying per-vertex colors to new Bmesh
set a specified vertex color to black via python

Has this changed in 2024 for Blender 4.0? When I run the above code, I get the output from the initial two print statements, but nothing from the for loop. Even though I have vertex colors baked into a color attribute entry, bm.loops.layers.color.items has 0 entries.

Each loop (= corner of a poly) has its own vertex color. You can print the vertex color for each corner with
# Get the first Vertex Color layer; can also use its name (eg. "Col")
layer = bm.loops.layers.color[0]

for face in bm.faces:
    for loop in face.loops:
        color = loop[layer]  # gives a Vector((R, G, B, A))
        print(color)

Btw, if possible you should get the triangulation with calc_loop_triangles instead, since it gives you the triangulation that Blender actually draws.

About the calc_loop_triangles not sure what I should change, I'm very inexperienced in those script types.

For a bmesh, bm.calc_loop_triangles gives a list of tuples of loops, one tuple per tri. So you'd do for tri in bm.calc_loop_triangles(): for loop in tri:. A regular mesh has calc_loop_triangles too, but it's slightly different.

Yeah I see, thanks! Will get it in mind.

bm.loops.layers.color[0] no longer seems to exist in Blender 4.0

@eobet Yes it does, but there are other places it can be now, depending on the domain and type. See https://blender.stackexchange.com/a/280720/88681.


text:
Use location and rotation 0,0,0 for all exported meshes
I would like to know how can I modify the location of the 3d model that I'm exporting without modifying the original one, I'm using this code:
if SceneObj.type == 'MESH':
    if hasattr(SceneObj, 'data'):
        #Clone Object
        depsgraph = bpy.context.evaluated_depsgraph_get()
        ob_for_convert = SceneObj.evaluated_get(depsgraph)

        try:
            MeshObject = ob_for_convert.to_mesh()
        except RuntimeError:
            MeshObject = None
        if MeshObject is None:
            continue

        #Apply Rotation Matrix
        MeshObject.transform(EXPORT_GLOBAL_MATRIX @ SceneObj.matrix_world)
        if EXPORT_FLIP_POLYGONS:
            MeshObject.flip_normals()

The idea would be that independently of the location and rotation of the original object, the exported one has the location (0,0,0) and the rotation (0,0,0), but I don't know how to do it.
This exporter I'm working on is for an external program, so all of those things must be done in the exporter.

Im not entirely sure on what youre trying to do but I'm assuming you want to import a 3d file and move it to a specific location and rotate it?
I think your problem may be:
MeshObject = ob_for_convert.to_mesh()

What I usually use is:
block = bpy.context.selected_objects[0]

Then we can move the location and rotation:
block.location = (1,1,1)
block.rotation_euler = (0,45,0)

Some code I wrote that does what I think you want it to do (or similar):
import bpy

file_loc = 'file/dir/object.obj'
imported_object = bpy.ops.import_scene.obj(filepath=file_loc)

bpy.ops.object.duplicate()

block = bpy.context.selected_objects[0]

block.location = (1,1,1)
block.rotation_euler = (0,45,0)

Thanks, but the idea is to move the clone that will be exported, the exporter I'm working on is for an external software, the idea is to move the cloned object that I want to export to the center, but the problem is that I can't move that clone to the center because I use .to_mesh()

I've modified a bit the code and worked very well, thanks!

https://blender.stackexchange.com/questions/176104/is-the-active-object-and-zeroth-selected-object-always-the-same


text:
Object doesn't show vertices in edit mode - cant move faces either
Currently running into a very frustrating issue in 2.9.
I have an object which, if I go into edit mode, shows the wireframe and has selectable faces, BUT doesn't display any vertices. I've checked Shapekeys (don't have any), overlays, and I'm sure I'm selecting the right object.
Does anyone have any suggestions? The object on the right has the issue.
Thank you for the help
-> file: https://pasteall.org/blend/1da817aed69346ff92e10704e13c2eef

Could you add a blend file with just the problem object in it? https://pasteall.org/blend/ Use [edit] to put the link in your question.

@HISEROD - done :)

I have no idea what the cause is, but going into either sculpt, vertex paint, or weight paint mode fixed it on my end. I'd recommend reporting this as a bug. Include the steps to reproduce the error if you can reproduce it from factory settings.

For some reason, Blender is taking your object as a Hidden one, if you press Alt + H ,that solves the problem


text:
Can't bend svg image to a curve using simple deform
I imported a naruto cloud svg image and wanted it to curve around the bowl. I tried using the simple deform modifier to bend it however it doesnt work. Also despite selecting all the svg image to bend, only one is affected as shown in the picture. Does anyone know how to get it to curve around the bowl? Heres the link to my file, thank you! https://pasteall.org/blend/1e855fda1c984ba68096748d810d4209

Probably the object don´t have the proper geometry. Meaning it doesn't have enough faces. It needs to have square faces or triangles to bend properly. Normally some are comprised of just one big face.

so how do I do that? Do i just put ctr R?

You select the front faces and subdive them with the subdivide command


text:
Mesh deformed/not moving properly
I'm rather novice. I would like to animate this letter "T" as though it's a human whereby the horizontal line on the "T" acts like the arms. I want the "T" to have its arm down by its side but it's deformed when I tried. I have done the weight paint as well as through the edit Vertex Group but it still doesn't work. Here's my blend file. Can someone please help?

Try subdividing the mesh around 5 times. At the moment you don't have enogh geometry to create a smooth result. In Edit mode, select All then right-click > Subdivide and increase the subdivisions to 5 in the bottom-left panel ... and as @moonboots says recalculate the normals!

As you can see if you enable the Face Orientation display option, your face normals are flipped. So go in Edit mode, select all and press ShiftN to recalculate, then parent again and it should work correctly.

Hello, wow it worked way better. However there are some creases at the "under arm"  Do you know how to fix that?