text:
How to make an int array/list property?
Maybe the question is dumb, but (appart of IntVectorProperty) I didn't found anything in the API, so I was wondering about the best way to make a simple list/array.
I tried:
my_list_of_ints:CollectionProperty(type=IntProperty)

But says it cannot be registered.
IntVectorProperty is not useful in my case since I need the list to be dynamic (API says that the vector must be of a predefined size).
So I was wondering about the best approach of making that list of ints.
Edit: the context is to have that array/list of ints inside a class that inherits PropertyGroup.
class ObjectA(PropertyGroup):
    int_list:list[int] # This gives error (says property dont exist when I access it)
    int_list:list[int] = [] # This dont give an error, but the data is not saved
    int_list:IntVectorProperty() # I cant use that since the vector is not dynamic

Thank you so much for the help.

What's the context? What is the property for? Operator? Data-block?

@MartynasŽiemys a data block (I want the list to be saved with the file (like others bpy.props))

Just assign it a value: bpy.context.scene["someProperty"] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

@MartynasŽiemys thank you so much! I didn't know that was possible. In my case (sorry for not explaining it properly, I'm a bit of a newbie with add-ons) I want that every instance in a Collection Property (from a Property Group) have it's own array. Do you know if that would be possible? (I think I may could do something similar; my_object["my_array"] = [1,2,3,4...], but in that case would it be saved with the blend file?

They are supposed to be saved as custom properties, so yes, any data block properties should be saved with the file. It should be easy to test as well, just save, reopen and check.

@MartynasŽiemys really? :o I don't know why, bu I thought that only properties from bpy.props were serialized in the file. Thank you so much for the help friend, much appreciated!

@MartynasŽiemys Just tried it and it doesn't work. If you add a property to to the class, like "an_int_list:list[int]", Blender complaints that it doesnt exist. If you initialize it "an_int_list:list[int]=[]", it doesnt complaints anymore, but dont save its value when saving the blend file (or maybe it saves it, but then when is executes, calls [] and is empty again).
Do you know if I am doing something wrong?

What class are you talking about? I add a custom property to the active scene in the example. It does get saved with the file. You can add it to your collection instance object as well, or any other data block in a .blend file.  If you define a Python class in a script, that class exists only when the script is run. If you want to save data to your file, you need to attach it to some data block and data blocks do get saved in the file.

@MartynasŽiemys Excuse me for the cunfusion,. I meant that the int_list property must be inside a class that derives from PropertyGroup, not on the scene (the 4th comment)
I added some context in the question.

It's not clear what you are attempting to do and how you are trying to that. You should either post the code in full and describe your situation and its context in full if you want to get help, or follow the documentation on your own.  If you define a property group, assign a value to some properties, that code defining the group needs to run when you reopen the file, then you can retrieve the values saved. This is supposed to be in enabled addon. Or you could just store data without property groups in custom properties.

Sorry, but without full code and context it's really impossible to guess how to help you.

was added to the original question, but is ok. I appreciated mate :) I think is simply not possible

Just to be clear, you have not provided full code or context. It's just a definition of a class there. There is no way to know what code you actually run. If you form questions with this little information, you will never get meaningful help.

The question is likely not dumb and there is probably an answer to it, it's just that you have never actually communicated the question. :/

._. Okay mate. But, there is literally nothing more that I could add about the context, since I'm not doing, literally, anything more related the question, since I'm stuck in that thing I'm asking; just adding/defining a list of ints as a property that could be modified and saved.
The only thing I could add is how I did things before asking the question (I had a StringProperty were I added the ints as strings separated by an special character. But I thought "this is totally ugly, there must be a better way XD"
I mean, the problem is right in the definition of the property.

PS: I hope I didnt say anything that offended you or anything mate (to be honest, It got me thinking ._. (I TRULY value everyone that makes effort (as you did!) to help others and I dont take that for granted (never!))
PS2: I guess the only thing to solve the problem is simply using a CollectionProperty with a PropertyGroup that has just and IntProperty. Is not a list, and working with them is not as handy, but solves the problem, I guess

And again, just to be clear, I appreciate/appreciated your will to help mate!

CollectionProperty is what you need. First define your integer property class like so:
class MyIntProp(bpy.types.PropertyGroup):
    name: bpy.props.StringProperty(default="")
    value: bpy.props.IntProperty(default=0)

and register it:
bpy.utils.register_class(MyIntProp)

then define you collection:
my_array: CollectionProperty(type=MyIntProp)

now you can add elements to it:
first = self.my_array.add()
first.name = "first"
first.value = 1

Thank you so much!


text:
Get (and set) vertex/point weight from/to a GreasePencilPoint? (Python)
Im a bit confused.
I'm trying to get the weight from every vertex/point in a GreasePencil Stroke, to later assign them to another stroke in a different frame.
I can access the (active) GreasePencil by gpd = bpy.context.active_object, and its vertex groups by vg=gpd.vertex_groups.active
According the API, I should get the weight by:
vg.weight(vertex_item)

(I guess that the vertices are numerated from 0 to inf)
But when I call, lets say, vg.weight(0), I got:
RuntimeError: Error: Vertex not in group

NOTE: I'm calling that on a vertex group that has ALL its vertices/GreasePencilPoints fully painted red (weight=1.0), so as far as I know, every vertex should be in that vertex group.
I also tried:
for i in range(10000):
   try:
       print(i, vg.weight(i))
   except:
       pass

Just in case I was referencing an index that was not in the group, but I got nothing printed. But my vertex group is fully painted. So I'm lost.
Any idea how to access the weight?
Thank you so much.
Edit: I've found this answer but it doesn't seem to work (it creates a new vertex group, but the weights of each vertex/point are not modified), so I'm not sure if its buggy or how it is supposed to work.
Edit 2: Well, seems like adding vertex weight is not supported for GreasePencil
Any idea about getting the weight of a vertex/point?

Ok, so the methods for getting and setting the weight were actually in the GPencilStrokePoints collection:
import bpy
C = bpy.context

o=C.active_object
gpd = o.data

active_vertex_group =  o.vertex_groups.active
print("active Vertex group: ", active_vertex_group.name)
active_layer = gpd.layers.active
for frame in active_layer.frames:
    for stroke in frame.strokes:
        for i, p in enumerate(stroke.points):
            # Get
            point_weight = stroke.points.weight_get(vertex_group_index=active_vertex_group.index, point_index=i)
            print(i, point_weight)
            # Set
            stroke.points.weight_set(vertex_group_index=active_vertex_group.index, point_index=i, weight=.33)

source: Stack Exchange

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

sort: votes


text:
Access the original object data path where a property/object is stored in?
I have a kind of theoric question.
I've registered a PropertyGroup Class to the GreasePencil class/type, lets call it Property_A.
At the same time, this Property_A has Collection Property with different elements.
(So, I have an structure like):
a_grease_pencil_object.property_a.collection

My question is:
Having an element/instance of that collection, is it possible to know/get the original Grease Pencil where it is stored?
Some kind of tracing back where it belongs?
I'm new and Im not sure how bl_rna works, but maybe some kind of just getting the name of the Grease Pencil where the property is stored, so I can get it via bpy.data.grease_pencils[name]?
(I need this since for some methods, I accesed the Grease Pencil by the active Grease Pencil. But now I have to loop over all the grease pencils (using bpy.data.grease_pencils  to change different things, and since those methods use the active GP, they dont work. So Im looking to replace that code for the thing Im asking).
Edit:
Reformulating my question (maybe in a simpler way), I want to kind of get the data path of a property
So if I have element_zero = a_grease_pencil_object.property_a.collection[0]
somekind of method that could make something like:
element_zero.get_data_path()

And I get kind of:
bpy.data.grease_pencils["GPencil.011"].property_a.collection

So I know that I could get the name of the Grease Pencil object where it is from.
Thank you so much for the help, much appreciated!

You can very simply use repr(prop), or in your case repr(element_zero). This will return a string with the full data path from bpy.
From the repr documentation :

Return a string containing a printable representation of an object.
For many types, this function makes an attempt to return a string that
would yield an object with the same value when passed to eval();
otherwise, the representation is a string enclosed in angle brackets
that contains the name of the type of the object together with
additional information often including the name and address of the
object. A class can control what this function returns for its
instances by defining a repr() method. If sys.displayhook() is not
accessible, this function will raise RuntimeError.

If you want access to the base ID object (ie the grease pencil object) holding the property, you can use prop.id_data. See the docs for bpy.types.Struct.id_data.

Both options does exactly what I wanted! And I can't believe I wasn't aware of id_data until you pointed it. Thank you so much for the help friend, much appreciated!

@Ommadawn hehe always a pleasure to answer well documented and thought out questions. I still discover new things and tricks every day ! Cheers

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


text:
Particle Instance modifier : Keeping dead particles more than one frame
I'm trying to figure out a way to have a nice liquid splatter effect with a particle system. I avoid fluid simulation cause It can get to very time consuming.
I want to have a pound of liquid + motion blur on the drops.
I'm using a particle instance to separate the dead particles from the particle system. The point is to use a geometry node modifier to create the pound.
It works perfectly on the viewport. But only when I hit play from the 1st frame.
It seems that the dead particles only last for one frame otherwise. Plus it doesn't work when rendered.
Viewport result :

Rendered image :

Is there anyway to accumulate the dead particles ?
My setup :

The particle system is baked.
Thank you !!


text:
How to increase camera view size

How do i change the camera view to fill up the whole screen in the render, i cant move the camera back anymore since it just goes through the wall and into the other room

just change the focal length of the camera:

Thanks, i was looking for this


text:
Blender 3.2 Volume Data in RGBA Color Space
Rendering objects with volume data in RGBA color space causes it to go invisible if there is nothing behind it. The object shows up in the final render window, but only disappears once saved as RGBA.

Blender stores png's transparency in the alpha channel, but the PNG in your post have a full white channel. It could be due to the website's uplodad system, but normally there should be no issue having a volumetric shader's transparency stored correctly. Have you generated this png in any other way than straight from Blender ? Do you use Blender v3.3 ?

The white background is due to the website's upload system, and no, I generated it straight from blender. I am currently using Blender v3.2. Would updating fix the issue?

AFAIK there wasn't such a bugfix on v3.3's release and I can render volume shaders with alpha on 3.2 correctly. Can you try doing a render from your scene (low samples to not waste time) and show us how the alpha channel looks from Blender ? https://i.imgur.com/lwkXJVu.jpeg

or alternatively, upload your file on blend-exchange.com with textures packed into the file so that we can check ourselves what's going on.

Here's the alpha channel for the render. i.imgur.com/L4xqkFN.png

I also uploaded the .blend file to the website. blend-exchange.com/b/nYYeKxs4

I think it's your point lights that are too bright (200MW). Try disabling them from render and see how it comes out. For me, the flame is visible, despite placing a background behind it (with the lights disabled).

Disabling the lights doesn't make a difference. The issue only occurs once the image is saved onto my computer, not after it is rendered.

The issue is that you are not using a volume shader, you plugged an emission shader into your material's volume output. It's a dirty way to fake volumetric at a low render time cost. But physically speaking, an emission shader can't be a volume. It can only work on a surface shader. If any volume emits light, it's because it is composed of tiny particles that emit light or gas. Which is exactly what volume shaders are for.
So the first logical solution would be to turn your shader into a genuine volume shader using the Principled Volume BSDF:

Edit: Leave the Density at 1, Anisotropy at -1, and crank up the emission strenght to like 30. IDK why I said to put the density to zero, it'd be the same as using just an emission shader in the volume output.
Though, the issue is that it won't look the same.

It took me only about 3 seconds to render it, against 1.24 with the fake emission volume.
Then comes the different issue of "Blender doesn't display things as they are". Once you saved it and try to use the file elsewhere, the parts of volume with nothing behind will look considerably faded out compared to what it looked like in Blender. You can try two solutions specific to volumes here: rendering - render on a transparent background (volume is almost invisible) - Blender Stack Exchange.

The second solution is keeping your shader as is and use some compositing to "bring it back" in the opaque world using the Cryptomatte.

 Note: Because Cryptomatte is currently broken on v3.3.0, hence it doesn't look the same. Also, you will probably need to wait for a bugfix before using this solution. See the bug ticket here:
 ⚓ T101601 Cryptomatte doesn't show all objects available

First, enable the Cryptomatte pass, either object or material will do in your case:

Then you need to render the image.
Once done, you will be able to add a Cryptomatte node in your compositing. Plug the Picker output to a viewer node to be able to see each material/object as a different color, and click the node's + icon to colorpick the colors you want to add to the Matte ID:

Then you should be able to mix the Cryptomatte's mask output to your liking, I.E. to combine it back to the original image's alpha or do any kind of compositing you need in the first place:

This seems to have worked to fix the alpha, however there's no color in the saved image. For some reason, copying your steps leads to it still being transparent. It only shows up when I turn up the density, and then it doesn't show the emission outside of the area where it did before. i.imgur.com/5vAVxiH.png

Check with a dark background, it worked correctly: https://i.imgur.com/VKjn27t.jpeg

I'm really confused about this. The emission color doesn't show up when there's nothing behind it, only the volume density. However, even without emission, this issue still persists. Once again, the issue is only present after saving the image to my computer, not while in the render window. I think it may have something to do with the saving process, as all transparent elements are lost, however I'm not sure how to fix this, as this still happens with other file formats  and saving methods. i.imgur.com/Wo1QMqv.mp4

Yes, that's a different issue of "Blender doesn't display things as they are". You can try two solutions specific to volumes here: rendering - render on a transparent background (volume is almost invisible) - Blender Stack Exchange. I also planned on showing a different solution using Cryptomatte but it seems broken for now.

I added the cryptomatte solution though it's broken for now. I also corrected my first solution.

Thank you so much for the help!


text:
Shader using DotProduct is creating stranger shadows
I am attempting to create a stylized moss shader. My strategy is to use a dotproduct as shown below to drive an alpha mask.

In this example the mask material is applied to a sphere which is slightly offset from a blue spere. This is the result in cycles:

The shadow on the right side of the sphere is unexpected. I thought that I'd get a result like this:

How do I eliminate this shadow bug? (The shadow does not appear in Eevee)
Thanks in advance!

What is the idea of the shader? What is it supposed to do?

I see your clamping your values at the map range node but does clamping at the greater than do anything? I don't see why it would but it looks like a clamping issue. If that doesn't work try using the mask as the factor between mixing a Transparent BSDF and a Principled BSDF rather than plugging it straight into the alpha of the Principled.

This is just a guess, but by mapping the -1 to 1 values to 0 to 1, the negative normals get positive values as well and somehow they are now transparent from the outside, but not from the inside and that's why they are throwing shadows (completely technically uneducated guess). If you instead use Generated or Object coordinates and plug them into the Normal node, this doesn't happen (and in this case you maybe don't need the Map Range node).


text:
When click my LMB, it keeps split areas
When I click the LMB, it keeps split new areas that I can't select an object now. (As status bar shown in the left-bottom.)

I solved it by changing the Edit-Preferences-screen.
Seems I accidentally clicked on something for adding LMB setting into the preferences.


text:
Square shadows in rendering
I'm making a cushion and when I render it, there are square shadows. Is this because I didn't subdivide surface enough? Or did I touch something wrong? In Edit mode, it looks already to have a lot of faces. Is there way to smooth the shadow?
I'm not using lamp object but world with Pro lighting Skies add-on.

I'd guess you don't have it subdivided enough. Is there anyway you can upload your blend file?

hmmmm.... that is weird not sure why it would be doing that.  Maybe try turning off Pro lighting skies and use an HDRI https://hdrihaven.com/  and see if Pro Lighting is causing the problem. Also maybe select all and recalculate normals (just in case).

@haruka.k Maybe try it in Cycles render...

I tried to turn off Pro lighting Skies now the shadow looks ok. So probably it was that. Perhaps because I'm using uni machine... so they don't allow to put add-on? I'm using Cycles render, thanks for the help :)

Afaik Pro Lighting skies work only with Cycles.. but your question is tagged as "blender-render". It would be good to edit it to make it clear as to what engine is used.

Oh I didn't know there was the cycle tag! I thought that was the only tag I could use regarding to Blender since I search Blender and it is only choice. Thank you for teaching me, now I changed the tag.

I turned off the Pro Lighting add-on. I suppose because the uni machine I'm using doesn't allow to use or something... though it looked installed. Thank you for the help!

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


text:
Rendering fading in text object problem
I'm trying to make an intro video and stumbled upon the following problem.
Ì have 4 text objects parented to a box.
The box provides the moving animation and this works without fail.
The text objects all use the same material.
On frame 1 and 100 I set a keyframe on the materials transparency (alpha0)
On frame 115 I set another keyframe for the materials transparency (alpha100)
However, this only works when I have the text opbjects selected, And only in the 3d view.
Instead when the fade in starts, the text objects turn black and fade to their materials color.
Any help on this?

The problem can have mutliple sources, if you could upload your blend file to http://blend-exchange.giantcowfilms.com/, it would be much easier to find the problem

Added the blend file. Thanks for the comment, didn't know I could do that. In the blend file all the text objects have their own material, failed attempt at a fix.

As long as the background is black it works as intended

Turned ON xray under ObjectProperties.
Problem Solved

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


text:
Creating volumetricaly layered materials in Cycles
Recently, I've been wanting to create a model with a particular artstyle. It involves the model having glowing parts basically identical to the buttons from this question. However, the particular style I want to go for involves the parts being scattered about, irregular and generally a massive pain in the behind if I have to manually go in and add a separate emitter mesh to each one of them (which is what was used in order to create that effect in the original question).
Therefore, my question: is it possible to create a purely material-based setup where the object to which the material is given appears to have one material layered on top of another (e.g. translucent with emission behind it or glossy coated in a layer of glass)? I would imagine it MIGHT be possible using something like the Ray Length component of the Light Path input, but my attempts at it weren't super successful due to my general lack of experience with complex material node setups.
Any help would be appreciated.

If you mean what I think you mean, then yes it is possible.

Is this what you mean? It is one object, but there are different materials in different places.
This is the node setup:

The way this works is I separate the object into its X, Y, and Z coordinates. I then select how much of these coordinates I would like to be one material (In this case emission, shown by the white in the colour ramp nodes. This allows layers of different materials within the volume.
If you require these layers of materials to be place at random points, you can just plug in the red component from a noise node into the factor for the mix node as shown below:

I have also passed it through a brightness and contrast node to emphasize the border between the two materials.
Here is the result:

You can achieve really interesting results if you use different types of textures:

Node setup:

Another interesting result I came up with:

Hope this helps you :)
EDIT:
Here is the technique applied for a layered material:

Here is the node setup:

To achieve this layered effect simply change the color ramp. the black bars on each side of the color ramps indicate the thickness of the outer layer. However, this only works with volumetric materials like emission, volume scatter and volume absorption. To layer multiple surface materials they can simply be mixed/added. This will however not work with visible thickness as they are surface shaders and as such only appear on the surface and not in the volume.
That being said, the glass, refraction and transparent shaders can yield some interesting results with the fresnel node.
E.g: Layered glass:

Node setup:

The color ramp may look completely white but it is actually 1.1 and 1.45, set to constant.
However, a see through surface shader may be used together with a volumetric to achieve a different type of layered effect.
Volume scatter in glass:

Emission in translucent:

Generic node setup for volumetric within surface:

The volumetric can be replaced with any of the volumetric shaders shown above.
Hope all this additional info helps :D
EDIT 2:
Just ended up making the 'button' with this technique, thought I'd put it here:

Hmm...while this is certainly interesting, it unfortunately isn't quite what I had in mind. The effect I need is that you have one material coated like a skin over another (that is, with visible thickness), but without having to create additional geometry for it (due to the irregular placement of the effect).

This is possible with the method shown here. Just got into bed, if ypu dont get any other answers by tomorrow I'll edit the answer to include something like that.

@SchoolBoy what do you mean by
The color ramp may look completely white but it is actually 1.1 and 1.45, set to constant.

@Monkok the colour ramp in the screen shot looks completely white but the two values are set to 1.1 and 1.45, which are more than 1 so appear white but actually aren't just the same colour. Of you go into the colour picker and go to HSV, you can manually type in a value. Then just above the ramp you will see the mode is set to constant.

@SchoolBoy thanks for the reply, but I don't understand how do you know the overall value of the colour and how you set any of the HSV parameters higher than 1?

@Monkok the overall value is just the V in HSV. When you open the colour picker, you should be able to select HSV, and then from there just click on the value slider and you should be able to manually type in the value that you want.

@SchoolBoy but they are locked to 0-1 range, so I can't set them any higher than 1

@Monkok Yes but if you manually type in a value, you should be able to set it to any value.

@SchoolBoy Let us continue this discussion in chat.


text:
How to accurately recreate a circular design for 3D print?
I know there is an easy way to build this but I can not figure out how. Can anyone walk me through the steps to build the following figure easily? I need to basically have a 1/8" circle with 1/8" straight pieces extruding out every 45 degrees.

I think you should rewite the question trying to focus more on what your difficulties are in the modeling (exact measures? topology? extruding?...) or specific workflow doubts. Try too keep the question "wide", so it can be useful for other simiar issue too. The risk is that the question will not be well received and abandoned.

Blender was never meant for precision work.
One way to get similar results is to use arrays.
Start with proper sized small segments. Add curve + array modifier arround its circle part,
For circumference extrusions it's similar. Use 'object offset' setting in an array modifier.
blend file

I'm having a hard time following this. Are there any easier ways to make this item?

Believe me, I made already several models for print's with this method. It's the best way. Here a more detailed tutorial: https://www.youtube.com/watch?v=BVGW3fyOkEc
Trust me, I'm an Engineer ;-)
For 3D Print Models, use as much modifiers as possible!

I always do it this way:

create the circle
create the rectangle
move the origin of the rectangle to the origin of the circle (other wise the rotate will later not rotate around the correct centre)
duplicate the rectangle and rotate the desired angle
hit shift-r to repeat (this automatically duplicates and rotates the rectangle)

The problem of your way is, that it cannot be adjustet after it is done. With an Array and an empty with roation, like in the other awnser it is afterwards readustable.


text:
How to get XYZ euler rotation of 3DView?
I'd like to extract the user view orientation of the current 3DView. Since I didn't find a direct command to get it, my approach would be to take its matrix using bpy.context.region_data.view_matrix.transposed() and somehow convert it to a Euler rotation (ignoring its location), but I don't know how to do it.
Note that I'm not talking about a camera object but the user view.

Converting a matrix to euler is as simple as mat.to_euler(). Assuming your matrix is in the space you want, that should do the trick.

Wow that was so much simpler than I expected. Tank you

bpy.context.region_data.view_matrix.transposed().to_euler()
Tanks HENDRIX, that was pretty simple

Just pasting a line, is not really helpful.

@brockmann If more information is needed, then tell them what kind of additional information you expect.


text:
How to have an object's scale be affected by proximity to empty?
I have a collection of cubes that are parented to a spinning circle. I would like the cubes to increase in scale as they pass through an empty and then shrink again so that the cubes at the front are bigger and highlighted more.

Q: How can I do this with animation nodes?

You can either use Object controller falloff or Point Distance falloff to get proximity effect.
In your case you have animated cubes outside Animation Nodes. So we only care about scales of cube inside Animation nodes. Then here is how to do:

Or we can also build entire setup inside Animation nodes:

Amazing, Thank you!


text:
Drawing a circle that faces towards the view with GPU/BGL?
Im trying to draw a circle using the GPU/BGL module that appears on a given certain 3D position (in my example, the cursor's location) and, when drawing, it points towards the current view.
I'm using:
import bpy, gpu, bgl, blf, bpy_extras
from gpu_extras.presets import draw_circle_2d

class circle_outline(bpy.types.Operator):
    bl_idname = "object.circle_cursor"
    bl_label = "GPU Circle Draw in cursor"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        def draw_circle():
            cursor_pos = bpy.context.scene.cursor.location
            pos = cursor_pos

            draw_circle_2d(pos, [1,0.3,0.3,0.4], 3.0, segments=100)

        h = bpy.types.SpaceView3D.draw_handler_add(draw_circle, (),'WINDOW', 'POST_VIEW')
        context.area.tag_redraw()
        return {'FINISHED'}

if __name__ == "__main__":
    bpy.utils.register_class(circle_outline)

Note: I know I can draw directly in the screen like 2D using "POST_PIXEL" in the bpy.types.SpaceView3D.draw_handler_add(), but I need the circle to be in 3D.
At the moment, the circle is being drawn, but everything is drawn in the XY plane:

My goal is to have it looking towards the view, like:

I think I may be missing some matrix transformation or rotation, but I'm kinda lost.
Any idea?
Thank you so much.

Use gpu.matrix.multiply_matrix to multiply the matrix before drawing
Press F7 in the viewport to run the modal
import bpy, gpu, blf, bpy_extras
from gpu_extras.presets import draw_circle_2d

class circle_outline(bpy.types.Operator):
    bl_idname = "object.circle_cursor"
    bl_label = "GPU Circle Draw in cursor"
    bl_options = {"REGISTER", "UNDO"}

    def invoke(self, context, event):
        r3d = context.space_data.region_3d

        def draw_circle():
            cursor_pos = bpy.context.scene.cursor.location
            pos = cursor_pos

            # gpu.matrix.load_projection_matrix(..) # set it directly
            gpu.matrix.multiply_matrix(r3d.view_rotation.to_matrix().to_4x4())
            gpu.matrix.scale([2, 2, 2]) # double size
            draw_circle_2d(pos, [1,0.3,0.3,0.4], 3.0, segments=100)
            gpu.matrix.load_identity() # reset
            # draw other things...

        self.h = bpy.types.SpaceView3D.draw_handler_add(draw_circle, (),'WINDOW', 'POST_VIEW')
        context.area.tag_redraw()
        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def modal(self, context, event):
        if event.type == 'ESC':
            bpy.types.SpaceView3D.draw_handler_remove(self.h, 'WINDOW')
            return {'CANCELLED'}
        return {'RUNNING_MODAL'}

if __name__ == "__main__":
    cls = circle_outline
    bpy.utils.register_class(cls)

    # add a keymap to test. If there is a conflict with F7, choose other
    key_map_type = "F7"

    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km_name = "Window"
        km = kc.keymaps[km_name] if km_name in kc.keymaps else kc.keymaps.new(name=km_name)

        if not any(e.idname == cls.bl_idname  for e in km.keymap_items):
            kmi = km.keymap_items.new(cls.bl_idname, type=key_map_type, value='PRESS')

Works as a charm. Very much appreciated friend, thank you so much :)


text:
Overriding a default keymap?
I'm trying to add a keymap that overrides an actual shortcut in Blender (M key in Grease Pencil's Draw Mode).
By default, M triggers:

I would like to add my own action (opening a panel) in that same key. The code I have:
addon_keymaps = []

def _register_hotkey():
    # Add the hotkey
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        name = 'Grease Pencil Draw'
        space_view = 'VIEW_3D'
        km = wm.keyconfigs.addon.keymaps.new(name=name, space_type=space_view)
        kmi = km.keymap_items.new("wm.call_panel", type='M', value='PRESS')
        kmi.properties.name = "TEST_PT_my_panel"
        addon_keymaps.append((km, kmi))

But I had no luck, M triggers that gpencil.draw.
Also, I'm not sure if I'm doing it propperly. I'm not sure if that name I'm entering is the correct and I dont know what it refers to (to be honest, the API says nothing about it). So I don't know if it can be any name, if it must match the name of the keymap I want to override (if so, which is its name? 'Grease Pencil Draw'? 'Grease Pencil Stroke Paint (Draw brush)'?).
Also, Im not fully sure if is possible.
I'm calling _register_hotkey() in:
bpy.app.handlers.load_post

(Since I read here that when loading the keymaps are not accesible, just to be sure. But I got the same result like when Im calling _register_hotkey() in register())
Thank you so much for the help.

If this addon is meant to be shared and used by other people, I would advise against replacing keymap entries. Though obviously if it's only for you, it's fair game :) In any case, I think this might help

@L0Lock Thank you so much for the help friend, worked perfectly! Also, I think you are totally right, but at the same time, the original operator (gpencil.draw) seems weird (at least for me). Is like it stops the input until you click/draw again. I really don't know which uses could it have, to be honest (seems like a good thing to call from code, but not from the UI).
Again, thank you so much for the help, much appreciated :)

My pleasure. I posted an answer with just a quote from my link for good form, feel free to edit it to make it better if you want or post your own answer.

Quoting the solution from the blenderartists forum:

The default keymap often isn’t accessible during addon registration, so you probably need to add a timer.
Note: This example only checks for kmi entries that matches the kmi.idname, so if you used something like wm.call_pie_menu it would disable every entry, unless you added a conditional based off from the kmi operator property.
def disable_default_kmi(km=None, idname=None, retries=10):
    wm = bpy.context.window_manager

    if not (km and idname) or retries < 1:
        return

    # the default keyconfig
    kc = wm.keyconfigs['blender']
    for kmi in kc.keymaps[km].keymap_items:
        if kmi.idname == idname:
            kmi.active = False
            print("Disabled", kmi.name)
            return

    print("Retrying..")
    # add some delay
    bpy.app.timers.register(
        lambda: disable_default_kmi(km, idname, retries - 1),
        first_interval=0.1)

Then during register() you can run something like this.
def register():
    ...
    disable_default_kmi('Screen Editing', 'screen.area_options')

Source: Removing a specific default hotkey / shortcut via a script? - Coding / Python Support - Blender Artists Community

Visit the source for more.


text:
Cyclic wave displacement modifier on a plane produces wave profiles as seen in blue, I wish to achieve red (proper sine waves):
In black you see the displacement produced by the wave modifier. This is quite confusing as it is not a proper sine wave, which I am attempting to produce. Is there a setting I am missing which would result in the sine wave so beautifully indicated by the red markings?

I'm not sure what's the algorithm behind the wave modifier, but you can use Math Function addon, or do an equivalent in Geometry Nodes - below I calculate $y = \sin(xπ)$:

(the original line length is 6 units)


text:
Blender / Python convert form radians to degrees;
I'd like to create a text object that displays the rotation angle, in degrees, of an object.
I found this code snippet which does almost exactly what I want, except gives units in radians.
I'm a noob when it comes to Python & Blender. Can someone show me how to make this read in degrees? I assume there is a convert function, but i have no idea how to integrate one.
Thanks in advance.
import bpy

scene = bpy.context.scene
obj = scene.objects['Text']

def recalculate_text(scene):
    obj.data.body = f'{bpy.data.objects["Cylinder.003"].rotation_euler[0]}'

bpy.app.handlers.frame_change_pre.append(recalculate_text)
```

degree = radian*(180/pi)

from math import degrees

def recalculate_text(scene): # fail when rotation_mode in {QUATERNION, AXIS_ANGLE}
    obj.data.body = f'{degrees(bpy.data.objects["Cylinder.003"].rotation_euler[0])}'

or
def recalculate_text(scene): # fail when rotation_mode in {QUATERNION, AXIS_ANGLE}
    obj.data.body = f'{bpy.data.objects["Cylinder.003"].rotation_euler[0] * 57.29577951308232}'

That's great, thanks alot. FYI for anyone reading this in the future, the first snippet has "degrees" spleed as "degress". Otherwise perfect.


text:
Python draw with different Y axis
I have an addon with that you can define widgets (like panels) that are drawn into the 3d view. The are defined using gpu module, that has this coordinate system:

So the widget would be at about (800, 100), but of course the user would rather define the panel like this (upper left hand corner is origin):

I already keep the x and y in a separate Python class and I paint the panel with the gpu module like this:
def update(self, x, y):

    self.x_screen = x
    self.y_screen = y

    indices = ((0, 1, 2), (0, 2, 3))

    # bottom left, top left, top right, bottom right
    vertices = (
                (self.x_screen, self.y_screen),
                (self.x_screen, self.y_screen - self.height),
                (self.x_screen + self.width, self.y_screen - self.height),
                (self.x_screen + self.width, self.y_screen))

    self.shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
    self.batch_panel = batch_for_shader(self.shader, 'TRIS', {"pos" : vertices}, indices=indices)

Is there a nice way to convert the Y-axis so that I dont have to recalculate the Y-axis manually to define the vertices of the batch?

Ok guys, it wasnt that hard, just had to change about 4 parts in the code where I get the height of the area and do a simple height - y to get the y position (same for the mouse cursor)

Please post your code in order to help future visitors, thanks.


text:
Black line appears when rendering in cycles

When rendering using cycles the hair mesh overlaps with the face mesh and a black line appears.
How do I get rid of the black line?
Updated: Wire frame view

looks like that is a single hair . Go to particle edit and cut that single hair

I'd say that character mesh shouldn't consist of several disconnected parts like hairs, ears, head, neck and stuff. It's usually done as one mesh (which is more complex but will let you avoid problems down the road like this in the question)

Your hair mesh is going inside the face and due to that line is showing while render.
you may edit the hair mesh and pull outside few vertices to remove this line.
So while you are in edit mode Edges should look like this:

Updated:
Problem area is seems to be here:

These 2 vertices are going under the face mesh.
I cant reproduce the black line though, but here is how it might be issue and fix
Problem:

Grab these vertices :

Move vertices out of the face like this:

when apply physics to hair and move slightly.
sometimes the hair mesh is going insde the face.
How do I make the black line disappear when the meshes intersect?

Please upload a wire frame view. You may hit Z key to get this view

wire frame view uploaded.

Please have a kind look to updated answer

Welcome, I am glad it worked for you. Thank you very much for accepting answer :)


text:
Flattening the intersection of overlapping spheres
as everybody know, when you put two spheres close to each other  they intersect other like this :

How do I flatten the spheres at the region where they intersect each, I tried to illustrate this with a quickdraw :
I don't know if it's possible with physics like soft body or collision.
does anyone know how to get this result,  i need this for a still image not for animation.
I'm more looking for something like this:

This works but i want the effect even when i'm note playing the animation, i need this for a fix image not for animation, is there a way to get the physics result in one frame ?

This is for a personal project and i have absolutely no dead line, so do it only if you got the time, thank you very much

Bmesh script
Script to flatten spheres on their intersection plane. See intersection of two spheres on Paul Bourke's magnificent geometry site The code runs through each selected sphere, checks if they intersect, if they do clalculates the location of the circle of hit.
If there's a collision, for both spheres, selects all vertices that are within the conic angle of the collision and moves them to the point of intersection with the collision disc.  NOTE: script relies on the origin of the spheres being the (default) centre of geometry.

Test run on UV Spheres.
The script
Select all the spheres you want to modify and run script. Alter the scale to change the angle of effect of flattening vertices.
import bpy
import bmesh
from math import acos, degrees, radians
from mathutils import Vector
from mathutils.geometry import intersect_line_plane
context = bpy.context
scene = context.scene
spheres = [(o, max(axis for axis in o.dimensions) / 2) for o in context.selected_objects]
bmeshes = {}

scale = 1.0 # alter to widen bump angle.
def new_bmesh(me):
    bm = bmesh.new()
    bm.from_mesh(me)
    return bm

def squish(sphere, angle, global_plane_co, global_plane_no):
    mw = sphere.matrix_world
    mwi = mw.inverted()

    bm = bmeshes.setdefault(sphere.name, new_bmesh(sphere.data))
    local_p = mwi * global_plane_co
    local_norm = mwi * (global_plane_co + global_plane_no) - local_p
    # select all verts via angle
    proj = angle > radians(90)
    if proj:
        angle = radians(180) - angle
        verts = [v for v in bm.verts if v.co.angle(local_p) > angle]
    else:
        verts = [v for v in bm.verts if v.co.angle(local_p) < angle]
    for v in verts:
        v.select = True
        d = local_norm if proj else v.co
        o = v.co if proj else Vector()
        hit = intersect_line_plane(o, d, local_p, local_norm)
        if hit and hit.length < v.co.length:
            v.co = hit

while spheres:
    sphere, R = spheres.pop()
    P = sphere.matrix_world.translation
    for s, r in spheres:
        p = s.matrix_world.translation
        v = (p - P)
        d = v.length
        v.normalize()
        if d >= r + R:
            continue
        elif abs(r - R) > d:
            continue
        elif d < 0.0001:
            continue

        x = (d * d - r * r + R * R) / (2 * d)
        # define plane
        pt = P + x * v
        norm = v
        angle1 = acos(x / R)
        angle2 = acos((d - x) / r)
        #print(R, r, x, degrees(angle1), degrees(angle2))
        squish(sphere, scale * angle1, pt, norm)
        squish(s, scale * angle2, pt, norm)

for name, bm in bmeshes.items():
    me = scene.objects[name].data
    bm.to_mesh(me)
    me.update()

scene.update()

Sample run on icosphere cluster on left, result on right
EDIT: fix for inside cases, now projects back onto plane if hit is inside (angle is greater than 90 degrees.

that's exactly what i was looking for, i try it as soon as possible, thank you for your answer batFINGER

@amby given this comment, I've edited your question.  Re-edit it if it's not your intention.

it was my intention, i just have some trouble to explain my idea in english (i'm french), so i make lots of mistakes in english..

@amby edited script to handle inside cases better.

If i understood the question maybe your looking for this
I have added 2 sphere and to 1 i have added the cast modifier
With the reference of pencil drawing sphere to deform when they touch each other.
In the cast modifier you can play with the settings and get the effect.


text:
How do I make it disappear from the font screen?
# import stand alone modules
import blf
import bpy

font_info = {
    "font_id": 0,
    "handler": None,
}

def init():
    """init function - runs once"""
    import os
    # Create a new font object, use external ttf file.
    font_path = bpy.path.abspath('//Zeyada.ttf')
    # Store the font indice - to use later.
    if os.path.exists(font_path):
        font_info["font_id"] = blf.load(font_path)
    else:
        # Default font.
        font_info["font_id"] = 0

    # set the font drawing routine to run every frame
    font_info["handler"] = bpy.types.SpaceView3D.draw_handler_add(
        draw_callback_px, (None, None), 'WINDOW', 'POST_PIXEL')

def draw_callback_px(self, context):
    """Draw on the viewports"""
    # BLF drawing routine
    font_id = font_info["font_id"]
    blf.position(font_id, 2, 80, 0)
    blf.size(font_id, 50, 72)
    blf.draw(font_id, "Hello World")

if __name__ == '__main__':
    init()

I made a script that displays "Hello World" using this guideline (https://docs.blender.org/api/blender2.8/blf.html)
I want to make "Hello World" disappear on the screen when I press ctrl+x. Can you give me some help on how I can code that?

See the text editor > templates > python > operator modal draw>  template.  Draws on screen, cancels for left mouse, right mouse or escape key.


text:
Object not rendering correctly from a distance
I am trying to render an image of a solar panel in the final render there will be multiple solar panels, some in the forground and others in the background.
I have noticed that as soon as I zoom out I get black lines/triangles going through the image. These lines appear on the 3D view as well as the blender rendered image.
I have tried loading in OBJ and FBX versions of the model, I have tried turning off the "use shader node to render the material" option in the material properties and I have also tried messing around with different lighting conditions. None of the options have worked.
The texture applied for the solar panels is a simple jpeg file.
I have included 2 screen shots of the rendered image of the solar panel, one from close by and another form a distance.
Any information in this subject would be greatly appreciated,
Kind regards,
Thomas

You probably have faces that are very close together (or on top of each other).
Check your mesh for mistakes (e.g. select all in edit mode, then press W -> remove doubles).
Another thing to check is the scale of your model. If it is excessively large or small, this can cause numerical precision problems.
In such a case, scale your model, then apply the scale with Ctrl+A -> Scale.
If the problem still persists, try to adjust the start and end clipping in the camera settings. The end clipping should be just behind the object (e.g. if the object is 10 Blender units away, you could set the end clipping value to 15 or so).
Note that this tip only applies to OpenGL and Blender Internal renders, not Cycles or other engines that don't use a Z-Buffer to calculate occlusion.

Hello B.Y.O.B, Thanks for your reply. Great problem solving, it does indeed have to do with the scaling. I down scaled the model and the problem was solved. One more question, if I down scale the model I wouldn't lose any resolution correct? I am working with high face count meshes constructed with photogrametry.  Greetings, Thomas

Since floating point numbers are discrete, most operations on them might "lose resolution". But I doubt that the precision loss is noticeable.


text:
How to iterate through a PropertyGroup?
I'm fairly new to using Blender's API, and Python for that matter, and just can't find the answer to my question elsewhere so here it goes:
I have a PropertryGroup and I want to write the names and the values of the contained properties into a file. They are mostly floats and 2 booleans.
My PropertyGroup ist for example looking like this:
class ExampleFloatPropertyGroup(bpy.types.PropertyGroup):
   float_a = bpy.props.FloatProperty \
   (
        name = "Float A",
        description = "Contains the value of Float A",
        default = 1.0
   )
   float_b = bpy.props.FloatProperty \
   (
        name = "Float B",
        description = "Contains the value of Float B",
        default = 2.0
   )

Within my operator I'm using it like this:
example_floats = bpy.props.PointerProperty(type = ExampleFloatPropertyGroup)

And so far everything works fine. I can work with it, pass it on to other classes, they can work with it and so on.
Now I tried to access the information that I need by using .items() or .keys(). For example like this example_floats.items().But as long as the values in my PropertyGroup are set to default, I'm only getting a completly empty return looking like this []
As soon as I change one of the values from default to something else, the returns are no longer empty but I only get the values that I did change, but still not the ones that are still set to default.
Also I'm only getting the key and the current value. I would also like to Access the property's attribute name. In this case "Float A" or "Float B".
So as the titles states, how can I iterate the single properties contained in a PropertyGroup, while retrieving the value and the name of the propertie?
I'm sure there is a relatively easy solution, but I was not able to work around that problem after hitting google for quite some time today.
Any help is greatly appreciated!

Are you not adding the pointer property to something, like a scene, object?   How are there different instances of the group?

I did have the pointer attached to the scene. The problem is I was using it inside an operator which creates some kind of mesh. I wanted the propertys inside the group to be displayed in the operator panel, so that I can directly manipulate the created mesh. This did not work since Blender always just goes back to the state of the moment that I invoked the operator, before redrawing the mesh. This "going back" did include the group's values. So I make an instance of the group in my operator and just delete the one attached to the scene and reattach the  up-to-date one from my operator.

I am wondering the same thing too, but I found a solution in this discussion: here
After using help() or dir() in that PropertyGroup, you can find out some attributes inside this object as follow:
['__annotations__', '__dict__', '__doc__', '__module__', '__weakref__', 'bl_rna', 'name', 'rna_type' , "SOMETHING", "YOU", "DEFINED"]

Depend on what version of blender you are using, you can iterate these attributes to get what you defined.
For Blender 2.8, since the APIs forced developer to use annotation instead, you can find all attributes(as a dict) you defined in bpy.some.where.thePropertiesGroup.__annotations__ without those inherited attribute from PropertyGroup.
If you want to get those attribute, you should use built-in getattr() method as following:
for key in propsgroup.__annotations__.keys():
    the_value = getattr(propsgroup, key)

i believe as of Blender 4.2 the correct way is to use .bl_rna.properties (bl_rna is not well documented) to get a bpy_collection of properties and filter it with .is_runtime
the example below shows how to iterate through a type, but it's the same for instances
import bpy

class ExampleFloatPropertyGroup(bpy.types.PropertyGroup):
   float_property: bpy.props.FloatProperty(name = "Float Property", default = 1.0)
   string_property: bpy.props.StringProperty()

bpy.utils.register_class(ExampleFloatPropertyGroup)

print(ExampleFloatPropertyGroup.bl_rna.properties)

for property in ExampleFloatPropertyGroup.bl_rna.properties:
    if property.is_runtime:
        print(property)

as shown before, you can achieve what you want with __annotations__ method, but if you want to annotate something else on your class (like a plain Python attribute to use during runtime) then it will be in the dict too

Interesting. Thank you for sharing.


text:
In need of help concerning making a knot animation (paths etc.)
I'm in need of help to get the same result as the one shown in this video: https://www.youtube.com/watch?v=Gk5tOOD_ArY&t=39s . I'm wondering if there's a guide how to make something like this. Please help.
My main problem is parenting the rope to a path so that the whole rope follows/curves along the path.

I find the sliding rope-texture in your reference really distracting. It severely impairs communication of the central point of the graphic: how the knots are formed.

You don't have to move the rope, Depending on how you construct the rope you could animate either the Bevel Factor or the Dupliframes end frame, and have the rope 'grow' along the path.  It seems that this is what they've done in the linked video.  Albeit with some rotation to make it appear to be moving.

Is there maybe a more in depth guide to something like this? I'm not good at all in blender at least right now. The creator in the comments said he did it like this: " Basically, I made a 3 leaf clover shape in 2D. Then used a Screw modifier. Then added a curve deform by parenting it to a path.". Thank you.


text:
How to Pinch/Scale uniformly with an edge constraint (Blender 2.8)
I'm wondering if it's possible to scale or 'pinch' 2 parallel vertices uniformly with an 'edge' constraint.
It seems I can select 2 vertices, and use the 'Edge Slide' tool which definitely keeps them constrained along an edge. However, this only allows movement along a single axis, whereas I'd like to be able to use the Scale tool to pinch them towards, or away from each other.
I would do this in 3DSMax quite often as I could come back to my support edge loops at any time of the modeling process, and then quickly adjust them uniformly.
Here's a quick picture to help illustrate (I hope!)

Any help would be appreciated. Thanks!


text:
Can we add dynamic hair particles to a softbody simulation?
I am modeling a winter Cap, The model looks like this

I am trying to apply softbody physics to the fur ball on the top of the cap. The physics act properly on the ball but the hair particles don't animate. I had the hair dynamics enabled.
Video Link is down below which will help you guys understand What I am speaking about :
https://drive.google.com/file/d/1UPyN2jaw88UCiHXp6p47w4Tku5rzhFrr/view?usp=sharing
My question is can we have dynamic hair particles on the soft body physics object? if yes, how do we do it?
by the way, I am using blender 2.8 for this.
thanks

just checked it in 2.76. it works there.

ensure your particles modifier are next to the softbody (below) in the modifiers stack.

Thanks for the reply, I think its a bug with blender 2.8 then, because it also works with 2.79 too.


text:
Select pass mode via python script
I want to change the value of "Pass" type inside the "UV/Image Editor" area as shown on image.

 The default "Pass" value is "Combined" and I want to change the value to other available types with python script.
I was able to manipulate "Layer" type using
bpy.context.scene.render.layers[0]
but i'm not able to find mentioned "Pass" value in the python API.
Thank you for your answers and time!

I cannot get anything even from --debug-all

Seems like this is not exposed to Python API. What are you trying to do? Maybe there are workarounds or other methods to do it.

First of all, thank you for your reply! I am trying to run blender from a terminal in background mode (.blend file is not specified in advance or stored on disk - i create it on the fly), and than I change render to LuxCore in that script. I want to also be able to automatically change the "Pass" value, since I only need to render one AOV that is offered by BlendLuxCore API. Do you maybe have an idea, how to resolve that?

Appears to be multilayer_pass as index but read only.

hi Ratt - is it possible to modify the code and recompile somehow to be able to modify the value? otherwise i am generally speaking not sure if it makes sense to be read only if the value is accessible via GUI?

With the help of @B.Y.O.B. I realized that it's not possible to change "pass" setting, because LuxCore (and also Cycles) processes all selected passess (AOVs) while rendering, so there is no point in changing that variable with python (therefore it's not exposed to the API).
Anyway, my final goal was to output only certain pass (in my case "Irradiance"), which I achieved with standard way for manipulating render output - Compositor Node Editor. I used File Output node as shown on my code example:
import bpy

bpy.context.area.type = 'NODE_EDITOR'

bpy.context.space_data.tree_type = 'CompositorNodeTree'
bpy.context.scene.use_nodes = True

C = bpy.context
node_tree = C.scene.node_tree

render_layers = node_tree.nodes.get(Render Layers)

# This command creates File Output node
node_tree.nodes.new(type=CompositorNodeOutputFile)
output_file_node = node_tree.nodes.get(File Output)
output_file_node.base_path = "save path"

# Link Render Layers to File Output node.
irradiance_output = render_layers.outputs.get(IRRADIANCE)
link = node_tree.links.new(irradiance_output, output_file_node.inputs[0])


text:
Check if the whole plane is being on a orthographic camera render (or get a proportion of the rendered plane)
Situation: On my scene, planes can be positioned anywhere and I should not move them - I move around only camera. After positioning a orthographic camera with a script, I am not sure if the whole plane is being rendered - I want to render one whole plane at a time (also areas that don't belong to a plane are not desired on a render).
My questions:

Given a camera position and the plane in 3D space (where camera is orthogonally positioned to plane), how can I check if the whole surface of a plane is being rendered using orthographic camera?
Is it possible to calculate the proportion of a plane's surface that's going go be visible on a render?

The reason I need this is because I cant figure out proper camera positioning function. What I did until now is I: find a center of mesh and calculate the plane's normal out of it, I position the orthographic camera on plane's normal some distance away. Now I don't know how to set the orthographic camera's rotation and scale to render only the plane.
Not finished camera positioning code:
import bpy
import bpy_extras
import mathutils
from mathutils import Vector

def get_global_plane_normal(plane):
    normal_local = plane.data.vertices[0].normal.to_4d()
    normal_local.w = 0
    normal_global = (plane.matrix_world * normal_local).to_3d()
    normal_global.normalize()
    return normal_global

def main():
    scene = bpy.context.scene
    plane = scene.objects.active

    coords = [(plane.matrix_world * v.co) for v in plane.data.vertices]

    # Calculate the center of the mesh
    local_bbox_center = 0.125 * sum((Vector(b) for b in plane.bound_box), Vector())
    global_bbox_center = plane.matrix_world * local_bbox_center

    plane_normal = get_global_plane_normal(plane)

    # Set camera to distance from a plane
    distance = 1
    camera_position_vtx = global_bbox_center + distance * plane_normal

    camera = bpy.context.scene.objects["Camera"]
    camera.location = camera_position_vtx
    bpy.context.scene.objects.active = camera
    # TODO: Rotate and set orthographic scale to the right values,
    # only the plane is visible.
main()

Thank you for your time!

camera_fit_coords
The method camera_fit_coords does most of what you need, it returns a location and zoom factor for an ortho camera such that it fits all given coordinates.  It does not however rotate the camera, so that will have to be calculated.
Test script, make a plane active, run script and the camera will move to fit the entirety of the plane into the scene camera.

Calculate the centre of geometry of plane using bound box ( local plane coords)
Grab the local normal of the first face of plane, I've used bmesh here, could use mesh API instead.  Have to use a face normal, a vert normal on a 1 face square plane will be at 45 degrees to x, y axes.

Find the longest boundary edge to align to the x axis of the camera.  At this step could compare the render dimensions of camera and choose to align x or y, if y swap x and y x_axis, y_axis = y_axis, x_axis
The rotation part of the new global camera matrix is created from the three orthogonal unit vectors, the plane global normal being the -z axis, the x axis aligning with global vector created from longest boundary edge. The other being z_axis.cross(x_axis) Rotation difference could have also been used here.
Call the camera_fit_coords method with a flat list of all the global coordinates of the planes bounding box, use the return values for location and orthogonal zoom.

import bpy
from mathutils import Vector, Matrix
import bmesh

context = bpy.context
scene = context.scene

cam_ob = scene.camera
plane = context.object
pmw = plane.matrix_world
plane_co = sum((Vector(b) for b in plane.bound_box), Vector()) / 8
me = plane.data
bm = bmesh.new()
bm.from_mesh(me)
bm.normal_update()
bm.faces.ensure_lookup_table()
# first face, could sum them I suppose
bm.faces[0].normal_update()
plane_no = bm.faces[0].normal
# longest edge

axis = sorted(
    (e for e in bm.edges if e.is_boundary), key=lambda e: e.calc_length(), reverse=True
)[0]

# global coords
z_axis = pmw @ (plane_no) - pmw @ Vector()

x_axis = pmw @ axis.verts[1].co - pmw @ axis.verts[0].co

y_axis = z_axis.cross(x_axis)
'''
#  would need to also check scale, hmm bmesh.from_object.. doh.
render = scene.render
if render.resolution_y < render.resolution_x:
    x_axis, y_axis = y_axis, x_axis
'''
R = Matrix([v.normalized() for v in (x_axis, y_axis, z_axis)]).transposed()
cam_ob.matrix_world = R.to_4x4()
cam_ob.matrix_world.translation = pmw @ plane_co

scene.update()
coords = [t for b in plane.bound_box for t in pmw @ Vector(b)]

v, scale = cam_ob.camera_fit_coords(context.depsgraph, coords)

cam_ob.data.ortho_scale = scale
cam_ob.matrix_world.translation = v
scene.update()

There are other questions on here regarding aligning objects with a face normal, or another vector.

Thank you very much for this code! The only thing that is still bothering me is if I split Cube to 6 planes, and I run this code with vertical "plane" selected, it aligns camera's view with the plane itself, so no surface is in the view. Do you maybe know how to resolve it?

I have "assumed" a regular plane with z normal by using the matrix world of the plane to set the rotation of the camera. Will need to go back to my original idea and use bbox edges and plane normal to make a rotation matrix to get  alignment of camera.  It's late.. might get around to fix tomorrow.

I create a Cube, select each face -> shortcut P -> Separate selection to its own object. This code works only for 2 faces that are aligned with x,y plane, and for 4 others it's not working properly. I also tried to set origin to gemetry but doesn't seem to help. Also btw how could I look to the other side of the plane?

Yes as I said was assuming it was a default plane where  Z local axis is the plane normal.  For arbitrary plane will need to calculate the normal (from a face) and use the longest edge or whatever to align with as well. Not difficult.. not doing it now.

Thanks for the suggestions - today I tried to implement this approach. I updated the question with the code I currently have. The things I still haven't figure out is the way to set the orientation and scale of orth camera.

Believe above works as desired with the exception of only aligning camera x with longest edge.  Other checks may be required for what is considered an upside down render, but it's hard to know when planes are arbitrarily oriented locally and globally.

Thank you very much for this solution - it helps a lot! I think I will be able to handle other exeptions, since the pattern of local & global orientation changes is quite predictable in my case.

Fixed the normal calculation.  Only thing now is scale can make the longest edge different.

I think it's much more reliable to calculate the exact camera location and rotation instead of that magic trickery with aligning to active. The hardest thing to avoid is the planes that could appear between the plane and the camera. Of course this will imply some 3d math, but it will work in any condition. Like this: find a plane center; detect its normal vector, orientation (where is the width, and where is the height), its maximum (bounding) size. According to camera settings (orthographic scale, resolution) calculate the distance from the plane to cower it entirely; set the camera location and rotatin, using calculated plane center, normal vector.

Thank you for your answer - it was also my first idea to do that but I got stuck setting cam parameters and than I used those functions. I hide all other planes, so there is no fear of getting other planes in the middle of cam and the plane. I'm able to calculate center of the plane, normal vec, and its orientation, but I have problem with calculating the parameters of the camera and the right distance - is it possible to provide me with some code to calculate these?

it seems that the distance can be anything above zero, only the orthographic  scale matters. I'd try to find a coefficient for this scale function from the frame area. First it could be measured for given frame resolution, using a plane. This will give the value to do this cam.ortho_scale = plane_bounding_size * THIS_MAGIC_NUMBER_FOUND_BEFOREHAND; That's all I could invent so far. :-/

in my case for 640x480 pixels of resolution, and the ortho scale = 1, the plane size is 0.981334 x 0.731689 blender units. And the the relation is linear. So, if I want to cover the plane with width = 3 BU, I have to set ortho scale = 3 / 0.981334 = 3.05706314058211. And it works. And the view doesn't change when I move the camera along its local Z axis. Easy peasy :-)


text:
Rename "Group Input" socket in geometry nodes in Blender 3.3.1
When editing geometry nodes for an object I can request new values by adding sockets to the Group Input node. However, I can't work out how to rename those sockets. For instance, in this geometry nodes setup, I'd like to rename the indicated "Value" to something a bit more useful, such as "Start Frame". How do I do that? I'm using Blender 3.3.1.

Press N to open sidebar, and select group tab. Here you can see the list of inputs and outputs that you can edit:

Aha! The Group tab! I didn't even notice that there were tabs there. Thank you!


text:
shadows visible in viewport but fade away in render
I have a problem with shadows (still new to blender).
While playback, shadows appear in the viewport but when i render out (single) images there is no shadow visible in the rendered product. It seems like they "fade away". Maybe it has something to do with the intensity of the shadow - like it is not dark enough for the final render?
Does anyone know how to fix this? Thanks very much!

soft shadows is on?

@crantisz I'm actually rendering in cycles. It seems like you can not choose soft shadows in cycles?
the shadows are not rendering too bad in eevee but in cycles they all vanish in the render.
thanks for the quick answer btw :)

I thought you are using EEVEE. But I see images only from viewport. Is use lights in viewport settings is checked?

yes, scene lights is checked in viewport.

Hm. Maybe share blend file then?

you can download it here:
https://www.swisstransfer.com/d/4fe4cbdf-c34c-4bbd-b774-477ecb3a3ea8
thank you so much for looking into it

So, I see this light called "Point" produce shadows. You can see them in EEVEE preview, but not in Cycles.

To make it clear, I increase power 10 times:

Now, lets' switch to Cycles. I can see that light itself doesn't work. Not only shadows:

EEVEE doesn't use shader nodes in light, but Cycles does. So that this node setup disables the light because no node is connected to light output:

So let's switch off the nodes:

Now light is coming, but still no shadows. It is because they are so soft, so you can't see them.
This circle indicates the size of the light. The more size compared to objects, the softer the shadows.

So let's decrease the radius. With radius 0, you can see sharp shadows:

To summarize two things here:

Light is disabled because of wrong node setup.
Shadows are soft because of huge light size.

ooh i see now what happened. at one point i edited the light nodes for the point light trying to solve the problem, then undid it and forgot to take out the nodes again.
thank you so so much for your help and saving me!


text:
Can't properly select multiple objects in Object Mode
Beginner to Blender here, I'm trying to make a sofa, I finished it and I'd like to parent all my objects but I have a weird dark orange that doesn't work as a selection and I don't know how to rid off.

Also, when I set parent to Object (Keep Transform), it don't work as 1 object, I can still move alone my cushions.

The dark orange means that the objects are all selected, however if you look carefully at the lower image you'll see that the right-hand backrest cushion is hilighted in a lighter orange. That means that it is the active object and is the object that the other ones will follow. I'd suggest holding down Shift and clicking the sofa base to make that be the the active object then CTRL-P to parent the rest to that. You'll still be able to move the other cushions independently as that's by design, but moving the sofa base will move the rest with it.

If an object has a [parent] it may still be grabbed moved through the user interface. You may lock the position of an object from manual grab.  You may also set the object to by not selectable. You may also [join] meshes.  Its your choice. You may wish to see a tutorial that covers these features or someone here at BSE may have answers fully discussing these features.

By the way, when you are parenting the cushions, simply use Object, you don't have to use Object (Keep Transform) - this only has an effect if the cushions are already parented to a different object and you want to switch the parent from one object to another.

The Parent operation does not group objects. Instead, it makes the last selected object (the active one) act as "Parent", and the other selected objects act as "Children" of the parent. The child objects can move independently, but they always follow the parent object. So, if you move the parent object - all objects will move and you can still move the child objects.


text:
How can I place my object onto a UV sphere to give it a rounded appearance?
Blender newbie here, I'm trying to make a character for the first time, for the head I used a UV Sphere and I'm making all the stuff on its head, but I made it flat.

As the title says, is there a way to overlay my object onto the UV Sphere to make it rounded ?

Create a new plane behind Plane.001, subdivide it, give it a Shrinkwrap modifier with Sphere.001 as Target, disable it for the moment:

Give a Surface Deform modifier to Plane.001 with the new plane as Target, click on the Bind button:

Enable the visibility of the Shrinkwrap modifier of the new plane, it will wrap on the sphere and your other object will deform as well. If it doesn't deform enough, add topology:

Sorry for the late answer, I tried it and it works but it's kinda glitchy : https://imgur.com/a/FopWTv1 and https://imgur.com/a/X50Zw8n
Maybe I did something wrong or it's because the shape of my object is bad : https://imgur.com/a/tCOGKkJ

are you using my method?Maybe share your file:https://blend-exchange.com/

Yeah but I probably made a mistake I guess, sorry, here's the link : https://blend-exchange.com/b/dZJlZbDG

I've edited my answer, if your french you can join our Discord here: https://discord.gg/E6wXbR7A5S

Thanks it works fine ! I made a mistake the first time, I use a subdivision modifier instead of a simple subdivision with right click.
Also yes I'm french I'll join it, appreciate it :)

To do what you are wanting you'd have to change your approach a little bit, currently it looks like you have made a faceplate and an eye brow, but you made them with thickness, so if you project them onto the sphere it would flatten and you'd have both sides overlapping.
So instead you can make your shapes as flat planes (no thickness, you can just delete the back and sides of your current objects). Then add a Shrinkwrap modifier, and set the target as your sphere, and wrap method as "target normals", then add a Solidify modifier after the shrink wrap to add the thickness to your objects.
Alternatively If you are wanting to interactively move your points and have them stick to the sphere, you can turn on Snap, and set Snap to to Face Project, and now while in edit mode you can have your vertices snap to other shapes when ever you move them over it.


text:
Copying animation using copy transform on IK pole/target bones
I have a very specific question. I am trying to compare a human MOCAP animation to the same animation, but where the interlying bones are controlled by IK. So I would use the same end-effector and start-of-chain locations, but let the IK determine the positions of the interlying bones: knees (upper leg bone), elbows (upper arm/lower arm) and middle spine bones. To start I tested it out on only the leg movement.
For this, I have two of the same character in the field. One with the original animation and one with the animations of the aforementioned bones removed. I then added the leg pole/target bones to both characters as normal, but kept them parented on only the first character (MOCAP character) so they would move with the animation. I then applied copy transform (local with parent) on the target/pole bone and applied IK on the lower leg bone of the IK character, so that when I play the animation on the MOCAP character, the leg of the IK character moves with it, see figure.

Now my goal is to capture this new movement of the IK character in an animation. However, recording a pose within a frame only works if you move the bones in pose-mode by hand, but not when I play the animation on the MOCAP char and therefore make the IK character move. Does anyone here have an idea how I can record the movement of those target/pole bones?
I also tried to record the movement of the pole/target bones on the MOCAP character, but there I have the same issue. And even if I can get that to record, there is the problem that the pole/target bones do not move or rotate with respect to the surrounding bones/ in local space, but only in global space. So there wouldn't really be anything to record.
I hope whoever is reading this is still with me at this point. Does anyone have a clever idea how I can make an existing animation IK-based and record the new animation?
P.S. The end goal is to quantify the angle differences between the MOCAP character and the IK character. That is why I need to record that. (Finding the positions of the bones or the angle values is the next problem I'm facing lol)

You can use a "bake action" operation with visual keying to write the effects of constraints onto keyframes for those bones; usually, you'll also want to enable "clear constraints."  If you would like the transform of a bone in a different space than it exists, you can make another bone in the desired space and copy transforms, world->world, then bake that bone.

Thank you so much! I just looked up some videos and I'm gonna try it out. Looks like it is what I was looking for ;)


text:
Brush Texture, Texture Panel preview blank?
I am following Blender Guru's Anvil tutorial on youtube however when I try to create a texture for a brush, the preview for the texture in the properties editor does not display the selected texture (clouds), see the image. Instead, the preview remains grey. The brush does paint with the selected texture.
Why isn't the preview showing correctly?
Thanks
Blender 2.79, Cycles Renderer.

Check your gpu drivers for an update maybe...

I was stuck with this issue for a while. For me it was because I had my render engine set as Workbench, instead of Cycles or Eevee. Setting the render engine to something other than Workbench fixed the issue and the texture preview started showing again.
Hope this helps some people.

I just read this post which is almost 4 years old and it's still the same problem !! And yes, you must not have the 'Workbench' activated, either eevee or cycles!!!
Thanks again.


text:
How to turn the background solid gray?
I attempted to use Blender again today on my Linux machine and see that it's now up to version 3.5.1 and it looks very nice compared to the 2.90 I last used.  However, one interface change I don't care for is that the main window background now appears to be semi-transparent with the default settings (Load Factory Preferences was used).  In some circumstances this might be useful and it may even be that I did this the last time I used Blender, but I can't figure out how to change the background to what I remember (and prefer) which is a solid gray background.
I did search in Edit->Preferences->Themes where there are a large number of colors, but nothing that seemed to affect this.  I also did internet searches including here, but if one searches for "Blender transparent background" it yields a great deal of information, but none is relevant to this particular question.
Since a picture is worth a thousand words, here's a picture of Blender running on my machine.  In the background is a browser window rendering the main screen of a popular search engine, but in this screen shot, Blender currently has focus and I would prefer not to see what's "behind" it.

Machine and Environment Details:
The machine is a 64-bit i9 box running Fedora 38 (Linux kernel 6.3.12) and Blender 3.5.1 with the Wayland compositor and nouveau video driver driving a NVIDIA Corporation GP104 [GeForce GTX 1060 6GB] graphics card with dual monitors.

That looks like a graphics driver problem (or possibly a Linux setting?).

Similar question here: https://blender.stackexchange.com/questions/297394/how-to-disable-the-transparent-viewport

Both of these were useful comments that helped guide me to a solution.  Thank you.

The problem
This is apparently a video driver problem.  The person who asked the question linked in the comment submitted a bug report:  https://projects.blender.org/blender/blender/issues/110327
However, that bug was closed with a somewhat confusing response:

Listed this report from #76428 however nouveau drivers are known to have many limitations compared with NVidia's drivers.
Closing this report as NVidia's drivers having poor (even broken) Wayland support is also out of our control.

So apparently neither the nouveau driver nor the proprietary alternative driver work.  The reporter of this problem provided a useful summary of the current state of affairs:

After trying out the proprietary driver, the issue does not occur!
However; pretty much everything else surrounding blender breaks. Most
wayland compositors straight up refuse to boot off of nvidia instead
of nouveau. I got Plasma to work with nvidia and tested it that way;
but everything was so slow that it was basically unusable. (There were
3 seconds between me moving my mouse and it updating on screen).
So while Blender might work better with proprietary drivers, wayland
seems to very much not; or so says my experience.

So users of NVidia cards under Linux seem to have a problem until either the open source nouveau driver or the proprietary NVidia are improved.
Solution
One way to get it to work is suggested in the troubleshooting section of the Blender documentation website.  This is what worked for me to start Blender from the command line:
WAYLAND_DISPLAY="" blender

That has the effect of disabling Wayland (and some associated features such as smooth scrolling for trackpad input) but allows Blender to run without the distracting backgrounds of other running applications.
Updated solution
As of 19 June 2024, with Fedora 40, the most recent NVidia driver and Wayland, Blender 4.1 appears to work perfectly!


text:
Tree Sapling Generator - How to change default insert location from world origin to 3D cursor
I'm trying to change to insertion or spawn location for the tree (or curve) from the default world origin to a new desired 3D cursor location.  I can't find where to make this change.
Thanks,
Darren

Just move the 3D cursor with Shift Right-click to where you want to create the tree, create it, and Shift-C to move the cursor back to the world origin. You can use the normal transform keys to move the tree where you want it later.

Thanks for your response. The Sapling Tree Generator will not work with the typical 3D-Cursor behavior you are suggesting. I can create any other geo and locate it to a custom 3D-Cursor location. Just not working the same with this add-on. The other problem is you can't go back and modify the tree with the native Sapling tree generator tools after placement. I can move the tree after creation, but then I can't modify it with the native tools.

Thanks for your response. The Sapling Tree Generator will not work with the typical 3D-Cursor behavior you are suggesting. I can create any other geo and locate it to a custom 3D-Cursor location. Just not working the same with this add-on. The other problem is you can't go back and modify the tree with the native Sapling tree generator tools after placement. I can move the tree after creation, but then I can't modify it with the native tools.  Thx again

Hmm... That I didn't realise! It's a very long time since I used that addon. If it hadn't been available for such a long time I'd have considered that to be a bug! I did realise that it couldn't be modified after being moved though which is why I was so surprised to hear that it wasn't created wherever you placed the cursor.


text:
multiple sides of object selected
I've been following blenderguru's tutorial on Blender 3.0, and I've gotten to part 4 (video link https://www.youtube.com/watch?v=R1isb0x4zYw&list=PLjEaoINr3zgFX8ZsChQVQsuDSjEqdWMAD&index=4). At around 10:00, he is talking about using the 'g' key to stretch the mesh (I've tried following every exact movement he makes), but when I use the 'g' key, it selects multiple sides of the icing.  How can this problem be avoided?

You have X-Ray mode toggled on.
You can simply fix this by pressing "Alt + z" or just click the icon shown in the Image below.

Thank you so much! I was stuck on this for so long


text:
How to animate a weight painting change
I am trying to achieve this effect in Blender. I have the shape property as a pin group which is the only thing keeping the cloth from falling. I saw somewhere that you can't animate weight painting but it doesn't seem like dynamic painting is helping much either, unless I am doing it wrong.
This is the effect I am trying to achieve.
https://i.sstatic.net/bmmKW.jpg
Any ideas?

Does this answer your question? Vertex Weight modifiers to adjust softbody/cloth simulation?

That comment's auto-generated.  Link should give you a start to figuring out how to animate your pinning group.  Note that you may want to combine this with other vertex weight modifiers (proximity, mix) in order to get the precise effect you want.

Hello and welcome. Instead of having users go through links and external sites please use the builtin tools to embed images in your post. See How to upload an image to a post? or GIF

Here is my try.

You need the following:

one plane cut into 4 parts
two vertex groups (Pin and Mask)
one Empty object to control the weights
one Vertex Weight Proximity modifier

The plane was created with two Array modifiers. For a better overview, the four parts are separated (that's the shape key). If you have the four parts aligned to each other use X-ray mode to select all vertices that you want because of the "duplicated vertices".
The Pin Group is your pin group for the Cloth modifier. The Edit Group (Mask) contains the vertices that should be affected by the Vertex Weight Proximity modifier. In my example, all vertices are in the Pin Group to make the plane stiff.

Make sure the origin of the plane is in the center (3D Cursor) because when you use the Vertex Weight Proximity modifier with the Proximity Mode Object then the distance of the origins (Empty <-> Plane) will be used to calculate the weights.

I have my scene setup the way that you do but my cloth sim won't stay together at the start before the empty is lowered. I am unsure what I am missing settings wise.

Have you assigned all vertices to the pin group and have you specified the pin group in the cloth settings?

The principle is pretty simple:
Create 4 planes, subdivide them "enough" so that the cloth simulation can work.

Give each plane a vertex group like this for pinning:

Add cloth to all planes and give them the vertex group as pin group.

Create two cylinders (or whatever you like) and use them to influence your weight of your pin vertex group. So what we actually do is converting the 1 to 0 values from the pin group and by this the cloth can "fall down" or release.
So you can use a vertex weight proximity modifier for this:

Important: move this modifier before (!) the cloth modifier.
Use geometry as proximity mode.
then you will get:


text:
Access current frame number during animation via Python API
I'm setting a Noise Texture node with W value to be linked to frame number (see picture). The idea is that generating noise as the result of the frame number * a coefficient (0.005).
I can make it via the Shaded Editor.

However, due to scalability I have to find a way to code it via the Python API.
My script is the following
NoiseTextureStar = starMaterialNodeTree.nodes.new("ShaderNodeTexNoise")
NoiseTextureStar.noise_dimensions = '4D'
NoiseTextureStar.inputs[2].default_value = 102.800
NoiseTextureStar.inputs[3].default_value = 2.200
NoiseTextureStar.inputs[5].default_value = 0.261
NoiseTextureStar.inputs[5].default_value = 4

My first attempt was to include the following line:
NoiseTextureStar.inputs[1].default_value = #frame*0.0005

but:

"#" is escaped as a comment character in Python, and
you can't multiply a string by a float.

Therefore, I'm looking for a way to read the current frame number while animating and use it a variable in Python.
My first attempt:
currentFrame = bpy.data.scenes['Scene'].frame_current

was unsuccessful because my Python script only read the first frame when executed.
Any suggestion is appreciated. Thanks in advance.

fcurve = NoiseTextureStar.inputs[1].driver_add('default_value')
fcurve.driver.expression = 'frame * 0.0005'

Search for "add driver python"


text:
After Rigging weird model deformation
This is my first time making a model so I probably made a ton of mistakes while building it but I've moved on to try to pose it for my class. At this point I've applied all modifiers and joined everything but the eyes, mouth, and, eye lattices together. I am still working on weight painting so that could be a problem. When I move the rig though those pieces that are stationary don't move at all. Before I joined everything there were a lot of pieces to the model itself. I used rigify.
I can post more screenshots later to clarify things too.
Thank you!

The problem is most likely the weights. Have you weight painted it manually or did you use automatic weights? For the latter check the normals of your mesh. If they are flipped the calculation of the weights does not work properly.

@Blunder Thank you! I've been weight painting and you're right it does seem to be the problem! I used auto weights so I'll have to comb through to check my normals. Also while painting, my Vertex Groups seem to have a few copies like I have "DEF-upper_arm.R" and "DEF-upper_arm.R.001"... should I delete those copies or leave them?

You can check the normals with the Face Orientation overlay: https://blender.stackexchange.com/a/273345/107598. The red color means the normals are wrong. -- No, don't delete these vertex groups. They are needed. The generated rig has 2 bones for each limb. They are so-called "twist bones" and are needed to rotate the hands and the thighs mainly. Because of this, there are these "copies" of the vertex group. But it's not a copy. Have a look at bone layer 30 (the 3rd layer from the right in the 2nd row). All deformation bones have the DEF- prefix and only these bones move the mesh.

The bone layers are in the Object Data Properties panel ("green running man" icon) of the armature (rig), in case you don't know.

Try parenting with Envelope Weights if you used Automatic Weights;  I solved a similar problem recently with that.  First be sure to unparent, and delete all Vertex Groups, before re-parenting.  Also be sure that any pole or IK bones have *Deform" unchecked (disabled).

Thanks guys, I'll be trying out your suggestions!


text:
How to smooth out curved loop cuts of a knife tool?
I am trying to get smooth, EVENLY curved lines for the dark grey and blue stripe materials on the fuselage. I only used shade smooth and auto smooth, and saw the damage/distortion that the subdivision modifier causes. Spent hours on this, and simply don't know what else to do. I used the knife tool to make a straight line/cut for the dark grey end section, then manually made the second cut using the nodes to create a curve for the blue stripe. For what I am trying to do, I need some way to get a smooth, accurate curve for Both cuts, and I can see that I will NEVER get what I want doing this manually. Is there a way to create a curve exactly how I want it and apply to the knife tool? Can't stand that boxy look....
Any advice for a beginner would be greatly appreciated.....

I'd use a Bezier Curve with the Knife Project tool for that. Set up the curve shape that you need using a Bezier Curve. Select your fuselage. Go into Edit mode and Ctrl-click the Bezier curve. Then use Mesh > Knife Project and check 'Cut Through' in the bottom-left corner of the viewport.

Thank you Sir!!! Will try it….

If you have problems comment here and I'll post a full answer.

Mr. Eason, I tried what you suggested….created the Bézier curve that I wanted then added subdivide to make it even more smooth but after I followed your steps, the curve on the fuselage STILL looks blocky and hand drawn. The orange curve next to the fuselage is perfect…exactly how I want it. sending a photo of this....

You'll need to edit your question and add the image into that with an explanation. You can't add it to a comment. I'd suggest sharing your Blend file too so that we can see what's going on. https://blend-exchange.com/

Do you have an Instagram account? It’s easier for me to send multiple photos to that as opposed to this site, and I need to send several to respond…

Or Facebook? Either would be fine…

No. I don't use Facebook or Instagram.


text:
Disable TimeOffset modifiers in Draw Mode
I've made a walk cycle with grease pencil and looped it with a TimeOffset modifier.
After the walk cycle is looped a couple of times, I animated the character jumping within the same grease pencil object, and then used a second TimeOffset modifier to display this animation. I used keyframes to display and hide the TimeOffset modifiers, so I can switch between the walk cycle and the jump animation.
Now I want to add a third animation to the grease pencil object, but when I go into draw mode I cannot easily disable the TimeOffset modifiers.
When I go to edit mode the modifiers are not visible, but this mode doesn't allow me to draw with grease pencil.
I have tried to enable the Modifier Tools add-on, but it doesn't show up in my interface.
I would like to know how to temporarily disable all modifiers in Draw Mode. Thanks in advance for any help!


text:
Importing PNG images into the Grease Pencil timeline
I am trying to import PNG images into the grease pencil.
I want the images to remain in PNG format and not convert them to vector.
I figured out I can do it like this: draw a box shape in grease pencil
And then in Material Properties I select Fill -> Style -> Texture -> Open image.
Then the image appears on the box shape, but it is seemingly randomly deformed, and I have to adjust the scale and location to have the image properly displayed. After that I go back into Edit Mode and adjust the size of the box shape so it will fit the image.
I was wondering if there is a more efficient way to do this.
Or if there no other way, can I automate this process this with a script?

Some more details for if you are wondering why I want to do this:
I have a drawn characters on paper. The characters all have multiple parts (head, body, arms, legs etc.) I've rigged these characters in blender. The reason why I want the images in grease pencil format is because with grease pencil I can use a TimeOffset modifier to use replacement parts. For example in this way I can replace a stretched arm with a bend arm, or replace a happy facial expression with an angry expression.

I don't know of a faster way to do this. However, if what you are interested is being able to swap between images, you can do this using a regular textured mesh. Which can be done easily using the addon Import Images as Planes:
First enable the addon:

Then go to the Import menu:

Select your target file(s) and set your preferences before importing:

You should enable Animate Image Sequence to force making an image sequence node, and maybe also Shadeless material setting to have the image displayed as is without reflections and other shading effects.
You will end up with a mesh plane with this node inside its material:

This is what reads your pictures as sequence. To be able to manually choose which frame of the sequence to display, set the Frames and Start Frame to 1, and use the Offset as your frame selector. You can also key the Offset by hovering it with your mouse cursor and pressing I.
If you need to animate this, make sure the keyframes' interpolation is set to Constant by going in any animation editor, selecting the Offset's keys, pressing T and choosing Constant:

This way, there will be no value change between each key.
Do keep in mind that, by default, animation editors only show the keys of selected elements. So you need to select that node to see its keys. Or, you can disable the selection display filter by unchecking this button in the Graph or Dopesheet editors' headers:

Aah, this is a much better solution.
I tried importing the images as planes before, but I didn't realise there was a way to control which frame is displayed in the image sequence.
I really appreciate you taking the time to reply so extensively! Thank you, L0Lock! :)

My pleasure, glad it could help. Though I'd love if this was possible in GP with simpler tools, so that we can profit of the GP modifiers with transparency awareness.