text:
Image as plane or hdri?
Ok so how do i go from this.

To something like this.

Are they using a HDRI or an image as a plane or doing that in Photoshop?

The short answer is both.
A HDRI (High Dynamic Range Image) is an image used to represent the environment in your scene. It is used to provide lighting and background imagery in all directions. HDRI images are provided in .exr format.
A HDRI is used in the World settings in the Shader editor. It is not used as part of the material for an object in your scene (such as a plane).
In your sample image above, the foliage, sky, ground etc. in the background is likely a HDRI image.
The motorbike could be a plane with an image of a motorbike, placed in a scene with the HDRI. The grass in the foreground would also be a 'real' object (not part of the HDRI).
Let's try to make something similar.
Note, this example will by for Cycles rendering engine. To get this working with Eevee will require a few additional steps.
We'll start with the HDRI.
I've downloaded a free HDRI from PolyHaven: https://polyhaven.com/a/clarens_night_02
We'll use this HDRI to light our scene, and provide a background:

Starting with a new project, let's make sure Cycles is selected

Select the 'Shading' workspace tab

Hover your mouse in the 3D Viewport and press 'Z' to change to Rendered View

In the Shader editor (bottom window), set the Shader type to World

This will allow use to make changes to the environment lighting.
By default, there is a Background node set to a grey color. This is what gives us the grey environment lighting in Rendered View. You can experiment by changing the color of the Background node.
In order to use our HDRI, we need to add some nodes.

In the Shader editor workspace, press Shift+A and add a Texture > Environment Texture node

Use this node to open the HDRI downloaded from PolyHaven

Connect the Environment Texture node to the Color input of the Background node

You should now be able to see the HDRI in the Rendered View above. You can rotate your view around the screen and note that the HDRI is present on all sides.
It's important to note that the HDRI is not just a background image. It is also providing light in your scene. So the sky is providing some bluish light, the sun some orangish light, etc.
In order to adjust the position of our HDRI, we need two more nodes.

In the Shader workspace, use Shift+A to add an Input > Texture Co-ordinate node, and a Vector > Mapping node.

Connect the Generated output from the Texture Co-ordinate node into the Vector input of the Mapping node.

Connect the Vector output from the Mapping node to the Vector input of the
Environment Texture node.

You should end up with something like this:

You can now adjust the position, scale and rotation of your HDRI using the Mapping node. I would recommend only changing the Z rotation to begin with.
Now that we have our HDRI, we can move on to the Go-kart.

Select the 'Modelling' workspace Tab.

Press Shift+A > Image > Images as Planes and open the Go-kart image.

Press 3 to go to side-view, and Zoom in to get a good look at the new plane object.

Press Z to go to Rendered View

Note: the HDRI will not show correctly while in an Orthographic view (such as side view). If you rotate your view slightly you will be able to see the HDRI
Now we need to get rid of the white background on the Go-kart.

Go back to the Shader workspace Tab, and adjust your view so you can see the Go-kart.

Note: before working on materials, I strongly recommend enabling the Node Wrangler add-on. You can search online how to do this, it's very simple.
The Node Wrangler add-on gives us access to some very useful shortcuts when working on materials.

Change the Shader type from World back to Object

The image you provided does not have any transparency (alpha channel). It would be much better if it did have a transparent background, as we could use the Alpha output from the Texture node to add transparency to our material.
Instead, we will have to try to isolate the white areas of the image, and make them transparent.

Start by removing the connection from the Texure node Alpha output to the Principled BSDF Alpha input. As our image does not contain an alpha channel, this connection is not doing anything.

Next, add a Converter > Color Ramp. Connect the Color output from the Texture node to the Fac input of the Color Ramp. Leave the connection between the Texture node and the Principled BSDF connected

Node Wrangler required Hold CTRL+Shift and left-click on the Color Ramp. This will allow us to preview the output from the Color Ramp.

As you can see, the Color Ramp convert the image to black & white:

We can move the two 'flags' on the color ramp to try to isolate the white areas. In the image below I have set the black flag to a position of .405 and the white flag to a position of .450:

We can now use this black and white image from the Color Ramp to determine which parts of our plane should be transparent.

Use Shift+A to add a Mix Shader and a Transparent Shader, and add them to your node tree as follows:

Plug the output from the Color Ramp into the Fac input of the Mix Shader:

You will notice that part of our image is transparent, but it's the wrong way around. To fix this, simply swap the inputs on the Mix Shader:

As a final step, reduce the Roughness on the Principled BSDF to a low value (i.e. 0.05). You should end up with something like this:

Some final notes:
You will likely notice some spots under the tyres and front wing that do not look great. This is due to the shadows cast on the floor of the original image. Again, I would recommend using a better source image for a project like this, preferably one with a transparent background and no floor (shadows).
The material in it's current form could be dramatically improved by adding bump, applying different roughness to different parts of the material, defining which areas are/are not metallic, etc. This was just a quick demo to get you started.
I would not recommend this approach for major elements in a scene. I tend to use this approach to quickly add small details to my scene (for example, birds flying in the background).
You will always have limited results using this approach for large-scale objects in your scene. Because the plane image does not have any depth, it will not play correctly with lighting and shadows cast by other objects in your scene. This becomes quite obvious when looking at larger objects, but goes largely unnoticed for smaller, background objects.

Wow thank you so much. Yes i would like an update, this is something i want to be able to do. Amazing community.

Thank you so much, i am worrking on it now.

No problem. If this helped to answer your question would you mind accepting my answer? Thanks!


text:
Adding Materials using Image Texture
What am i doing wrong here.
I select the faces that i require

I assign them to a new material

Unwrap the UV

Save as an SVG

Make a template, obviously i dont want square corners so some parts of my template go inside the UV SVG

Save as a PNG, Use an image texture to add the graphic, but the square parts that i rounded off and were not part of the PNG are now actually transparent not just black. If i remove the Alpha then the unused pixels are black.

Perhaps a silly question, but what would you like to have in the square parts ? As these are not in the imported PNG (i.e. these are empty), what default value/colour/texture are you expecting from Blender ?

Each face can only have a single material assigned. When you assign the material with the blue stripe, then there is no other material on this face - therefore it has nothing to show "underneath" where the transparent parts are. What you have to do instead is create a material which has the blue and green mixed by using the alpha channel as mix factor (in this case inverted). When you only want a color there, you actually just need a black & white image of the mask and a Mix Color node where one color is blue and the other green.

I dont want anything in the square parts, i just have to select these and then round off the edges when making the template from the UV map because when we make the stickers the corners are not square, If you see the 3rd picture from the top the bike has graphics on, somebody else made the template, i am just trying to figure out how to do it.

I have an image of exactly what i am trying to achieve but how do i upload another image?

source: Stack Exchange

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

sort: votes


text:
Why are the 'Sun' shadows different to other light sources? Blender 2.8.1 Eevee
As you can see in the images below, the shadows cast from Sun are more accurate than ones cast from any other light type in Eevee. Why is this? Is there any way I can make a Point light cast shadows the same way as the sun, without enabling 'contact shadows'?
Here is the sun:

Here is the point:

Hello :). By default both lights cast shadows correctly in Evee. Just tested it. Would you mind sharing your .blend file?

Hey there, the other comment by Richard Rude points out what I was after - The missing shadow on the base plate / narrow part of the doorknob.
Blend file is here, thanks.
Also, I'm aware contact shadows aren't turned on for the point, but I'd really like to know if the default accuracy of the sun light without 'contact shadows' on can be copied for a point, area, or spot light.

It turns out that the 'Bias' option for the non-sun light sources needed to be set to the absolute minimum. Everything looks great now.

Thanks for letting us know :). Don't forget to mark your answer as accepted later, so it's easier for others to find.

I'm not sure but I imagine it could have something to do with the way the point lamp works.
I don't think that one is more accurate than the other but that the point lamp produces these perfectly harsh shadows because the light source, as the name suggests, comes from one single point and doesn't have any dimensions. If you think about it soft shadows can only occur when the edge receives more light than the center of the shadow. In case of the point lamp that isn't possible since all the light comes from the same point and thus casts exactly the same shadow.
I hope this makes sense. In my mind it does, at least
Edit: I just realized that you are talking about the missing shadow on the base plate of the door knob  In that case, I have absolutely no idea, sorry.
Edit 2: Do you have contact shadows turned on? Without contact shadows there tends to be a gap between the object and its shadow.

Your first edit points out what I was after!
I'm aware contact shadows aren't on, but I'm trying to find out if it's possible to get the sun's accuracy with any other light type, as it's the only light source that casts shadows correctly without needing to turn contact shadows on.Contact shadows 'work' for other light sources, but at a small price of inaccuracy.

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


text:
Can not read "image texture" permission denied in windows 10 pro
I have installed Blender in Windows 10 pro and everything works fine until I try to load an image texture in Cycles.
I get the message can not read image texture denied permission
I have two hard drives, one SSD and one normal. I install Blender on the SSD and the textures in one folder on the other disk.
I have tried to run Blender as administrator, to download it in .zip on the normal disk and open it without installing it, to load the texture saving it in "my images" but the failure continues.
I have loaded a .blend file with the packed textures and renders perfect. If I unpack the textures and load them, Blender reads them but in some objects it does not show them (the purple color of warning comes out).
The problem happens when I try to load from any other location. Textures do not have restriction permissions.

Related https://blender.stackexchange.com/questions/84602/cannot-save-blend-files-permission-denied also see other instances https://blender.stackexchange.com/search?q=denied+permission

can you create a new image put in various locations and just test that it can be read into Blender in the default scene? Then can you use those working images on the materials in your problematic .blend. Break the problem down to the smallest components and work up.

I have already tried to do and doesn´t work.I have see now that i have the same problem when i try to put a background image.
Cannot read 'D:\TEXTURASEscritorio\DIELECTRICOS\DesertSand\TexturesCom_DesertSand1_1024_albedo.tif': Permission denied

Finally I found how to solve the problem.
I have downloaded blender in the C drive, in which I have windows instaled.
I have downloaded in the folder Users / user (me).
I installed it and click right mouse button, repair option.
Then I restarted the computer and solved problem.

I was having the same issue and found out that my anti-virus program (IOBit Advanced SystemCare Ultimate 11) was denying Blender access to my photos. I had to "ALLOW' access and check the remember box.

Experimental versions of Blender are especially prone to blocking by ransomware protection services and antivirus programs.


text:
Procedural Candlelight
I am budding my head trying to find a good way to create a realistic candle flame. I have tried making a candle procedural texture using gradients and fresnel, from the right angle it looks promising, but it is way to hard to control.
What would you guys do? Is it the smoke way, or is there a better/simpler way?

Final:

Node overview:
This is method is quite simple, it's basically make gradient as mask add facing mix and repeat. You can use this approach to extend this material even further and add some more colours, rims, and maybe more.
So here it is:

Mesh:
Flame is modeled from Cylinder, but you can make it as you like. Even from beveled Bezier Curve (easy animation).

Compositing:
As a final touch you can add some Compositing. I've done very simple colour correction, added Glow and Lens Distortion.

Everything should be pretty clear, but if you have any question don't hesitate to ask in comments.

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


text:
weird artifacts in the viewport!
im just getting those artifacts in the viewport ,they just showed up .whats the problem here?

Probably either an issue with your graphics driver or the GPU.

it appears only in these project and disappears in sculpt mode

Given the artifacts I think it's unlikely that it's a bug in Blender but if you want us to check if we can reproduce this, you would have to share your .blend file (https://blend-exchange.giantcowfilms.com/)

This case looks a little different but usually when this happens the solution is to go to the Blender viewport's 'View' menu and gradually increase the value of 'Clip Start' until the artefacts disappear.
Also (the following is for beginners who may not yet have noticed the following similar phenomenon), artefacts similar to these will also appear on a specific face (or plane) when 2 (or more) objects are trying to occupy the same plane in space (something obviously impossible in reality). For example, if you select an object and press 'copy' and 'paste', the copy is pasted in exactly the same position as the original, trying to occupy the same space, and these flickering artefacts will then be noticeable if you move your viewing angle.


text:
Where can I find a complete list of the industry standard keymap?
Where can I find a complete list of the industry standard keymap? Ideally with a comparison of what the blender standard keymap for that function would be.
I have found https://docs.blender.org/manual/en/latest/interface/keymap/industry_compatible.html#viewport and https://developer.blender.org/T54963 but they don't seem to be complete. For example I can't figure out what the industry standard to open the 'Add' menu (Shift + A in blender keymap)

Edit > User Preferences > Keymap

I tried looking there, but it doesn't help, as I can't find the commands I want. Ideally I would like to be able to search (Shift + A) then look in the columns next to it to know what the command is called and what the industry standard shortcut is.

There is a search box at the top, you can even search by operator or keys. Where does it fail for you?

@DuarteFarrajotaRamos Thanks, I didn't see the key binding search, so When I search Blender for 'Shift + A' it shows as 'Object mode -> Add' but if I search industry standard for 'Add' it is not there for Objet mode, is it possible that the key-map does not exist in industry standard?

The only official keymap document can be found here.
The shortcuts you specifically mention, do not exist in the default keymap, though they can be added through python or by editing the keymap. There are some other addons or config files that might be more beneficial for you.
The closest thing to a full list can be found here, but this has been edited a bit, so it's not 1 to 1.
There is also Maya Config, which turns Blender into a very similar Maya configuration.
I'm working on listing out all of the shortcuts and adding the ones I miss from the regular Blender shortcuts myself, I am going to try and keep it close to the industry compatible keymap as possible, I will post here again if I get an update for you.


text:
How do I move the pivot point of an object?
I know there are other questions and answers that cover how to set the origin to the center or to the 3D cursor, but let's say I have the pivot point almost where I want it and I just want to move it a little forward or back.
I can do it by creating a new object moving it to the position, setting the cursor to the object position then setting the origin to the cursor position then deleting that object, but that is really convoluted there must be a better way right?

Looks like this is available in 2.81: https://www.youtube.com/watch?v=fCxnrwbsdlw&feature=youtu.be&t=193

For people who don't want to watch a 5-minute YouTube video for a question that should take five seconds to answer:

Go to the Options dropdown in the upper right
Select the "Origin" checkbox
Use the move tool to move the crosshair that appears at the pivot

As far as I know there is not a way to move the pivot point like you want in Blender 2.8. It will be a feature in Blender 2.81 though. I usually use Shift+S (cursor to selected) to snap the cursor to multiple or one vertex, edge or face and then snap pivot point to cursor.
If you want the pivot point outside the object you can always move the cursor to that place and snap pivot point. You don't need a new object now the cursor exist in 3D-space.
Never the less, ability to move pivot point without help of the cursor is much welcome.
Edit:
Now blender 2.81 is here and you can control the pivot point separately. Here's how. How to move pivot point separately in blender 2.81

Now blender 2.81 is here and you can control the pivot point separatley. Here's how.
https://www.youtube.com/watch?v=-CiWNcPB1CY

Finally, this is such an overdue feature Haiku please post this as the answer so it can be up-voted and come up as google's result.

Just enter Edit mode and move the object.
You can use the Top, Front, and Left views to align it better.
See the image below.

Are you moving the pivot to the object, or the object to the pivot?

I'm moving the object.


text:
How are you meant to use the middle mouse button?
I am switching to Blender from Maya, I was really happy when I heard about the 'industry standard' keymap, but there are many tools missing in there so I thought I would try out the blender keymap, but it feels quite uncomfortable panning around with the middle mouse button, how are you meant to do it? Do you have three fingers on the mouse and use the middle one for the middle mouse button? or just two fingers and the index finger switches between the left and middle buttons?

I have voted to close this question as primarily-opinion based, because it is not about the usage of Blender, but about operating 3 buttons on a computer mouse. You can reconfigure Blenders Keymap to set up viewport tracking, panning and thumbling like Maya. Please take advise about which finger to use lighty as this should vary for every individual. A good hand for one person position may not be ergonomic or healthy for another.

I use my index finger and switch between the left and middle buttons. You won't need to use both buttons at the same time. If you want you can use three fingers on the mouse, but it's not necessary.

By default, Blender 2.8 is configured so that pressing the middle mouse button while dragging the axis around activates the Axis Snap which is used for looking around the view-port.
A way to browse around a scene if you will; seems to be the default most requested operation on new installs.


text:
i'm having a trouble bridging my object
i am having a trouble bridging the edges, the one i know was to selecting the edge i want to merge and then press W as the hotkeys for "bridge edge loops" but somehow the hotkeys doesn't work on me it changing something else instead. ps: i'm using 2.82a version of blender.

The W menu depends on which selection mode is active. Switch to edge selection mode, then it will appear in the W menu.

In Blender 2.8 the W key to open the Context menu has been replaced by the Right Mouse Button. As it is a Context menu you have to be in Edge select mode to have the Bridge Edge Loops option available.

Edge select mode.
Select the two edges.
RMB to open the Context menu.
Choose the Bridge Edge Loop.

Another way which works in both vertex or edge select mode is to open the Edge menu and select the Bridge Edge Loop option from there.

you have resolved my problem, thank you so much for helping me!


text:
cloth and collision problem
problem:
I want to make it looks like the cup is passing through the curtain but it seems like the curtain are attached to the cup??
I am using cloth modifier for my curtain and collision modifier for my cup.
question:
How can I prevent the cloth from the collision?

update: turns out i just have to scale all of my objects, i don't really know the reasons behind of it but it works after i scale it up

It is important to use realistic scale and properties for the simulations - otherwise the phsyics can produce expected results. Always make sure you're working to correct scale and units, always 'apply scale' to all your meshes, check your collision settings (and reduce the thresholds if things are behaving oddly) and consider increasing the simulation step size and quality.


text:
problem in welding vertices, a beginner
I try to weld my vertices so its connected one by one but you can see here on the image I specified it doesn't turns out to what I wanted it to be, is there any solution for this type of problem?

could you be more specific in what you are trying to achieve (e.g. sample images)? Do you want all the point to be merged into one?

It looks like you are trying to join two UV islands together? If that is the case use the Stitch option instead of Weld.   ( RMB > Stitch )

Maybe you've chosen the wrong option from the Merge menu?
Make sure, of the selected vertices, the ones you want to be merged are closer to one another than to any others, and Merge > By Distance

Or, if that's too fiddly, (and you want the merged loop to be centered to the ones above and below) select the edge-loops you want to be merged, and Ctrl E Edge Menu > Bridge Edge Loops, with 'Merge' checked in its options.

thank you for helping me out, it worked!


text:
how do you subdivision surface, or shade smooth without ruining the object?
I want to make a table and a place for its cable management on it. Can you tell me why there's some edge loop or whatever it's called in between the hole once i shade smooth the table? I think it's the reasons why the table can't be that smooth?
I am also do beveling for the edge and I use bool tool for the hole

These hole cutting tools give an uneven mesh. What i would do is delete those surfaces and make the hole by insetting the surfaces and moving the inset up and down to the holes position. Another options is to loop cut around the hole and face them through to each other. PS to get that square to a circle subdivide it and press shift-ctrl-s and scale it to s sphere

You should avoid using n-gons and triangles as they are not rendered very well especially when using subdivide modifier, it cud result in strange mesh formation, but anyway you can use the auto smooth tool and control the smoothing angle:


text:
Making a particle smoke simulation into an action
Question. I’m working on rigging an internal combustion engine and need to create a burning gas.
I can do it once with a partial simulator and a smoke domain, but only once. In a perfect world I would like to apply the Same simulation several times so it can be used on different cylinders.
Similar to creating an action that can then be used with the action constraint.
Problem is there is no key frame option on starting and stopping the emitter, so can’t make it an action.
Any help is appreciated even if it’s a different direction.
Thanks


text:
How to properly smooth edge?
I am a complete newbee in blender. I created this object

and want to smooth the inner edge using bevel tool so I have something like that:

But some artifacts in "Smooth shading" occured. What sould I do and how can I remesh my object to delete this strange artifacts?

Those artefacts come from the Smooth Shading option.
Each 3D object surface is made of triangles. Even when you work with quads or ngons, Blender will translate this into tris (for example each quad will be made of two tris). If you enable Smooth Shading, Blender will smooth every transition between 2 tris. It will give something good on round or flat topologies but it will give something bad on angular ones because Blender will also try to round the angle between hight-angled tris, which doesn't seem natural.
You can fix this with the Auto-Smooth option. It allows you to limit the smooth effect on tris that are only under a certain angle value. For example in your case if you set to a value under 90° it will smooth the round corner, because the tris angles are much under 90°, but it won’t try to smooth the 90° angle between the top and the side surfaces.

Apart from that, try to work with triangles and quads rather than ngons. Example:


text:
Setting up user preferences
I love the look of Blender after after many years of not paying it any attention - the features look great si I would like to start learning and using it.
However, I'm stuck at the beginning of just setting it up.
I'm coming from Modo, Lightwave and Maya and this is how I want to control it. The Maya preset is not enough, and I don't want to adapt to the Blender right click.
When I set it up to mouse Left click and combination of Alt, Shift or Alt+Shift for screen navigation, I then cannot select between verts, edges and polys.
Is there a way to set this up or do I have to accept the Blender way of doing things?
Also, the axis are changed from 'normal' - is thera way to change the Y axis to up and down and have Z for depth?
Thanks in advance!

That does it mean "cannot select between verts, edges and polys" Ctrl+tab doesn't works?

Sorry, user error! Ctrl+tab does now work - even though i think it wasn't before it is now - I'm sure I was doing something wrong as I have had to reset to factory many times as I have been messing about in the preferences.

I Can give you some tips, you can change all inputs you need in Blender, in the Blender User Preferences Panel:

As you can see, I highlight a input I mapped to  my own workflow, the Edge Loop Selection to the input Alt+Select Mouse. Each input have advanced properties you can set, as well a combination of inputs to execute it.

Here I show you a default shortcut for a great deal of tools for Blender 2.73, although mostly of the shortcuts stay the same.

So, while yes, you can change and map each input to your liking, it's not advised to do so, Blender it's a different software than Modo, Maya, 3DsMax, so I recommend you to use Blender the way it is, you will get used to it just like you are confortable working in your favorite softwares.
For your to change Y axis to Z, here's a relatable question: Is it possible to make Blender a Y-up world?

Thankyou, this is very helpful. I will try your setup, but if it's best to just adapt to the Blender way then I'll keep that in mind. That image you posted is a great resource!


text:
Align view to axis hotkey
Is there a way to change MMB+Alt (align view to axis - front, top, left) to another key? Can't find it in preferences. Thanks!


text:
How to copy child object in array
I have parent object and some array modifiers on it. Also my parent object has some childs, but they are not copied by array modifier, despite they have a parent-child relationship. I need child objects to be copied like parent objects, maintaining their position relative to the parent.  How can I do this?
(Window frame as a child object and walls as a parent)

Modifiers alter the vertices of the modified mesh. AFAIK they are not inherited by children.  Will need to re-think this. Can join hierarchy into one mesh, or choose a method other than array (directly)  to distribute.

But boolean modifiers that modifies mesh ARE inherited. I want the childrens objects to be copied as well as parent object on the same positions

do you have any reason not to join the 2 objects? You could also keep them separated and array the frame as well...

Joining 2 objects will cause destructive workflow because after joining  window frame with the walls it immediately dissappears because of difference boolean modifier, so I have to apply them before joining two objects, so I fall into destructive workflow

To clarify. If a child object is used in  a boolean modifier  to cut a window (or whatever) into mesh that is then arrayed, that there are windows on each array instance is not due to inheritance.  Agree with moonboots, can also array frame.  Consider distributing collection instances.  A single vertex mesh can be arrayed  dupliverts

or use a boolean union modifier to add frame child. This will alter the mesh of the original making the frame arrayed.

Boolean Union Modifier
Modifiers alter the vertices of the modified mesh.

Hide the child frame object and "join" it to the wall mesh using a boolean union operator before the array modifier(s).
Example image small cube "Cube.001" child of arrayed big cube "Cube".
Re materials
Join objects (boolean) with different materials
Note: this is not inheritance, (the object need not be a child) the modifier alters the mesh of the original.

Note : If your window frame has a different material than your walls, the boolean modifier will overwrite it unless you add the window frame material to the list of materials of your parent object (no need to actually apply it to a face though)

For sure.  Will need to make sure the "unit" renders as desired.  A QA re that came up recently will look for link.  Personally would still lean to making a collection instance and "arraying it" with duplis. Could contain armatures et al and would preserve per object materials.

@Gorgious I have noticed a point cloud object type is available (non save-able demo last I looked)  in later versions of blender.

It seems part of the basic structure of Blender atm that you can't modify Collection Instances, which is maybe reasonable? - but a pity.

Hopefully the new depsgraph will help bring the possibility forward. Have noticed using self in drivers and printing confirms self is the evaluated object.


text:
How to cut a hole in a mesh like this without using boolean
I have this mesh
I need 3 identical holes in front face. How to do this keeping good topology?
I tried to use boolean modifier, but there is terrible topology at the end and I need to apply subsurf modifier before applying boolean
P.S. I'm also used subsurf modifier

If you want big holes it can be something like that (needs one more edge though). Delete the face, create 8 vertex circle, duplicate 2 times, fill the gaps with some F:

Should I do it with the knife tool or what? Thanks for the answer tho

create one circle with 8 vertices, duplicate, fill the gaps with some F

One idea:

Try to get three even square faces.

Subdivide one face 2-3 times.

Select the inner faces.

Activate the LoopTools Addon. Right click your selection and choose circle.

Delete faces. I hope that helps!


text:
Vertex groups unwrapped properly in UV editing, but don't display the color properly
I have a very simply UV unwrap of my character, with only two colors: Red and Black. I put one vertex group (the tie) into the red pixel of my texture, all the other vertices into the black pixel. First of all as can be seen in the picture below, no colors are showing up in the right window at all.
Secondly, when I go back to the Modeling tab, the tie is indeed somewhat red and the rest black, but the colors are not "sharp" (as in simply red or black like in the texture) but very soft and blended. Bigger faces, for example on the head, have a tint of red to them, kind of like the UV is not properly unwrapped.
Can anyone help me with these problems? It should be very simply to paint a model with only two colors, but I am unfortunately not getting the proper result. If there are any other good ways to paint simple low poly meshes, I am all ears. Thanks in advance.

Hello! First of all you're in Solid mode, so are you sure you've enabled the Texture option in the Viewport shading options? Also, hard to understand the rest, maybe pack your images and share your file: https://blend-exchange.giantcowfilms.com/

Are all your faces assigned to a material that has redBlack.jpg as an image texture driving the color? Because even though you have your UV's unwrapped over the image in the UV Editor, it's ultimately the material that drives the color of the model's faces.


text:
Wrinkled model (normals?)
Learning to model with Blender. Trying to modify an existing model, at some point I "wrinkled" it. I'm suspicious about some custom code (I'm developing a Blender plugin to export/import models from a game) to save and reload normals, but the case is I have this model now and I want to know what's going on so I can fix it.
With autosmooth turned off:

With autosmooth on:

What causes this? How can I fix it so when autosmooth is enabled, it looks like the figure on top?

Well, I found out that Reset Vectors in the Normals menu (Alt-N) seems to be the answer (you need to select all your vertices):

The result:

I don't know what I'm doing in my export/import code (that I mentioned above) but that's another story.

"Reset Vectors" puts normals back the to default calculation of the normals, which is the same as turning Auto Smooth off. Auto Smooth rarely makes sense on organic models. It's more of a feature for hard surface modelling,where you have rounded edges and plain faceted areas together in one mesh.

I think the culprit in this case is that normals are messed up when the model is imported by my custom code, because this model (in its original state) works fine with Auto Smooth enabled.


text:
How can I see which edge connects to which when UV mapping?
In Maya, when UV mapping it will show the selected edge and the edge it connects to on the 3d model in the same colour so you know which edges can be welded together. How can I see this in blender?

You have 2 options in the UV editor, I guess you're looking for one of those:

Keep UV and object mesh in sync.
Automatically select the shared vertices.

You need to deactivate the first option to have access to the second. The first option keep a link between selected vertices in the 3D view mesh and the UV map selected vertices, second one only concerns the UV maps, but I maybe both will give what you want.

Not sure where Automatically select shared verticies is. Posted my answer as I do not have that option (could have been put elsewhere). Thanks

Where is that second icon? I can't see it there in 2.8

Make sure you have UV Sync selection

Thanks, this is correct, but moonboots replied first so will select his/her answer as correct.

moonboots is smarter than me so I completely agree :)


text:
How can I use Cylinder Mapping on a complicated object?
I have an object which is made up of cylinders, but all at different angles. I thought I could just do a cylinder map on each different section and set the angle of the cylinder map (Like in Maya), but it doesn't seem to have that option. I can choose 'align to object' which works as expected for the vertical cylinder section, but it won't work for the other two sections.
How can I easily map the other sections?

yes it doesn't seem to be possible unless you rotate the cylinder 90°. You could get around with another mode like Follow Active Quads: Select the whole cylinder, then select whatever face of this cylinder (make it the active face), then unwrap with this option, you'll get the same result as the Cylinder Projection

The Cylindrical, Spherical and Cubic texture projections in Blender are oriented by aligning an orthographic view before executing the U unwrap command with one of the options in the window with that view.
You can have other 3D views open to keep an eye on things.
On a roughly cylindrical selection of your model you can:

Look directly across its equator, with its poles up and down.
That's ShiftNumpad 7 with a latitude loop of edges (temporarily created and?) selected
You may have to revive the keyboard shortcut for rolling the viewport
Use options something like these:

Or you can:

Look directly down one of its poles
That's ShiftNumpad 7 with a polar face (temporarily created and?) selected
Don't forget you can H hide parts of your mesh to make these operations easier
And use options something like these:

Thanks! that is exactly what I was looking for!


text:
alt-p doesn't seem to be doing anything in 2.8
I'm trying to unparent an object from an armature, but alt-p does nothing. I looked online to see if there is a new shortcut for this function, but cannot find anything.
Any help would be appreciated :)

Alt+P should work. There may be something wrong in your settings.

Other programs also can block a key combination. For example if I install the AMD Radeon ReLieve, I can't use alt+r till I reconfig it in the ReLive settings.

hmm can't think of what it could be. In Blender 2.7 I was getting this strange proxy warning whenever I pressed alt-p, so I installed 2.8. I don't get the proxy warning anymore, but alt-p does nothing. I can still work though as I can just unparent the object in the armature modifier

Maybe this helps: https://blender.stackexchange.com/questions/35084/how-to-unparent-a-deleted-armature

Try the other Alt key. In my case only the left Alt key (next to the windows key) works.


text:
Carpet coloration specific parts

Hi!
I made a carpet and I am looking to add a color on specific part.
I tried brush but it is not satisfaying.
Looking for something like this: https://youtu.be/kv0q6EPJHKk?t=242
Thanks

have you considered similar

Thanks very Much. I did not created a new mesh because I wantted to keep this. So I just made a simple texture and add it to the mesh.

Doesn't the video you linked teach that?

Check the video the quality is too bad it is impossible to read how he did it. He made something with the Node Shader Graph. Ratt's answer was what I needed.

Answer to Ratt :have you considered Creating a patterned carpet
Thanks very Much. I did not created a new mesh because I wantted to keep this. So I just made a simple texture and add it to the mesh:


text:
Keying two armatures at the same time
I'd like to select and put keyframes on two armatures at the same time.
In maya I'd drag select,  and hit S to keyframe on both rigs.
In blender I'm currently having to exit one armature, enter the other, switch to pose mode and set a key.
Any animators out there that have solved this one?
Tried google searches but no luck so far

In the top header menu > Edit > You need to disable the Lock Object Modes option and you'll be able to work on the 2 armatures, both in Pose mode.

Just to confirm, this works!
Thank you moonboots that was awesome.


text:
Blender on Surface Pro X
Blender will not work on the Surface Pro X. It runs, but it doesn't recognize the GPU in the machine and shuts itself down. All my drivers and firmware are up to date.
The GPU should be more than capable since it's quite powerful and has dedicated memory. The CPU is questionable, but that's beside the point. Is there a work around or another build of Blender I could use? If not, would it be possible to get this compatibility in a future update?

You can test if it works properly with the 2.82 alpha. If it doesn't, this question is best asked on https://blender.chat/ and if one of our GPU experts confirms that the hardware should be supported, then you could file a bug report.


text:
Problem mixing image with shaders
I'm trying to mix a material with a color ramp with an image texture and I can't find a way to make it work.
This is my node set up for the material. Any help would be greatly appreciated.

I can't exactly tell what you are trying to do. Are you trying to make the texture gradient? Or are you trying to apply the image over the gradient.

The gradient is being used as shading. I want the texture to darken and lighten with the rest of the model.

Assuming that you don't want to apply the shader to the actual face of the texture, all you need to do is plug the alpha of the image texture into the mix shader socket. This should make the faintly discoloured box disappear, as it will only apply the ColorRamp to anything that isn't the face.
Shader setup:

Result:

If this doesn't work, then check:

The face has an alpha of 1, and everything else has an alpha of 0.
The shaders on the "Mix Shader" node are in the correct order.


text:
Why does my sculpting not working like how it does on this video
Ok, i am watching this video by blender guru https://www.youtube.com/watch?v=6OTX3ZdYvEA&t=430s and when he starts sculpting at 5:58 his brush seems to have a  "plus" sign for a cursor, "+". mine doesnt. i dont know what this is called or how to fix it but i think it is messing with my sculpting because mine is not doing what his is doing. help would be appreciated. i have been searching for help for hours.
ps here is what is happening to mine: https://1drv.ms/u/s!AkjW5v_qJtM7j2v6-AJhqNbGJH0D?e=Jh4WlO

Maybe you need to subdivide the mesh further to increase detail.
Try subdividing once more to increase the number of faces for the brush to work on.


text:
Make an object move in a circle
I have written up some pieces of code and put them together. I wanted to know where I am going wrong and if there are other ways I can make an object move in a circle (orbit). Here is a piece of code that I attempted to do using key frames.
EARTH = bpy.ops.mesh.primitive_ico_sphere_add(location=(10.0, 0.0, 0.0))
# first and last frame index
nfirst = bpy.context.scene.frame_start
nlast = bpy.context.scene.frame_end

for i in range(nfirst,nlast,10):
    period = (2 * math.pi * math.pow(1.5 * math.pow(10, 11), 3 / 2)) / math.pow(GRAVITATIONAL_CONSTANT * MASS_OF_THE_SUN, 1 / 2)
    total_frames = period * FRAMES_PER_SECOND
    # Multiply by minus one so we orbit counter-clockwise
    radians_per_frame = -1 * (2 * math.pi) / FRAMES_PER_SECOND

    # Set frame like this
    bpy.context.scene.frame_set(i)

    # Set current location like this
    #EARTH.set.location.x = 0
    #EARTH.set.location.y = 0
    #EARTH.set.location.z = 0

    EARTH.keyframe_insert(data_path="location")

Thank you for your help, I hope I was more specific in my question this time!

Related https://blender.stackexchange.com/a/91511/15543  An operator returns a status, eg print(EARTH) above will yield {"FINISHED"} the status set of the operator.  Instead after the op use EARTH = context.object.  This is how operators work, they set the context.  Also using ob.keyframe_insert(datapath, frame=i) removes the need to set the frame on the scene.

I see that you haven't used key frames. Can you tell me how you made the objects orbit?

Explained in answer. Uses drivers.  Updated  code to  2.8x

I figured it out thank you so much!


text:
Moon To Move With Earth
I have created the code for each planet seperately as it works better that way but I don't seem to know how I can make it orbit together.
Everything seems to be working fine but the Moon doesn't orbit the Earth
Here is Earth's code:
#earth

import bpy
import math

running = True
earth_orbit_time = 150 # full orbit frames
earth_orbit_size = (15, 15) # elipse if not same

context = bpy.context
scene = context.scene
# cursor to zero
context.scene.cursor.location = (0.0, 0.0, 0.0)

# creation of earth
EARTH = bpy.ops.mesh.primitive_ico_sphere_add(location=(0.0, 0.0, 0.0))

planet = context.object
EARTH_ORBITAL_RADIUS = bpy.ops.curve.primitive_nurbs_circle_add(radius=2)
earth_orbit = context.object
earth_x, earth_y = earth_orbit_size
earth_orbit.scale.x, earth_orbit.scale.y = earth_x, earth_y
bpy.ops.object.transform_apply(scale=running)

if earth_x != earth_y: # get focus of eliptical path
    direction_of_x_y_axis = 0 if earth_x > earth_y else 1
    scene.cursor_location[direction_of_x_y_axis] = math.sqrt(abs(earth_x * earth_x - earth_y * earth_y))
    bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
    orbit.location = (0, 0, 0)

# follow path
follow_path = planet.constraints.new('FOLLOW_PATH')
follow_path.target = earth_orbit
follow_path.use_fixed_location = running
follow_path.use_curve_follow = running
# drive the offset
fcurve = follow_path.driver_add("offset_factor")
fcurve.driver.expression = "(frame / %d) %% 1" % earth_orbit_time

Here is the Moon's code
#earth's moon

import bpy
import math

running = True
moon_orbit_time = 20 # full orbit frames
moon_orbit_size = (15,15) # elipse if not same

context = bpy.context
scene = context.scene
# cursor to zero
context.scene.cursor.location = (20.0, 20.0, 0.0)

# creation of moon
MOON = bpy.ops.mesh.primitive_ico_sphere_add(location=(0.0, 0.0, 0.0))

moon = context.object
MOON_ORBITAL_RADIUS = bpy.ops.curve.primitive_nurbs_circle_add(radius=0.25)
moon_orbit = context.object
moon_x, moon_y = moon_orbit_size
moon_orbit.scale.x, moon_orbit.scale.y = moon_x, moon_y
bpy.ops.object.transform_apply(scale=running)

if moon_x != moon_y: # get focus of eliptical path
    direction_of_x_y_axis = 0 if moon_x > moon_y else 1
    scene.cursor_location[direction_of_x_y_axis] = math.sqrt(abs(moon_x * moon_x - moon_y * moon_y))
    bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
    orbit.location = (20.0, 20.0, 0)

# follow path
follow_path = moon.constraints.new('FOLLOW_PATH')
follow_path.target = moon_orbit
follow_path.use_fixed_location = running
follow_path.use_curve_follow = running
# drive the offset
fcurve = follow_path.driver_add("offset_factor")
fcurve.driver.expression = "(frame / %d) %% 1" % moon_orbit_time

The idea here https://blender.stackexchange.com/a/91511/15543 was to match two planets barycentric orbits, then collection instance them for the next time.  eg make the earth moon system, make a collection instance then orbit that around the  sun.  The simple solution for what you have would be parent the moon orbit to the earth.  May also be of interest. https://blender.stackexchange.com/a/132928/15543

Not sure I agree with "I have created the code for each planet seperately as it works better that way"  tho


text:
Is it possible to create a function that is performed on the render engine change?
I would need to perform a function on the render engine change, for example:
def function_on_engine_change(self,context):

   if context.engine =='CYCLES':
       print('Cycles')
   else:
       print('Is not Cycles')

The call of this function should obviously take place automatically if the engine is changed
I was looking on the blender handles but found nothing, I wonder if there is any trick that does this

msgbus might be an option: https://blender.stackexchange.com/a/150881/31447

@brockmann lol, even used same link

Use the msgbus
There is a relatively new and mostly undocumented feature of blender that fires a callback when a property is changed.  Check if your version has this feature in python console.
>>> bpy.msgbus
<module 'msgbus'>

Related
https://developer.blender.org/P563
Origins to the down of the object by default
How to get an event when an object is selected?
For this case (IMO) can substitute context.scene.render.engine for context.engine
>>> C.engine
'BLENDER_EEVEE'

>>> C.scene.render.engine
'BLENDER_EEVEE'

>>> C.scene.render
bpy.data.scenes['Scene'].render

>>> type(C.scene.render)
<class 'bpy.types.RenderSettings'>

Use msgbus to invoke a callback whenever the "engine" property of bpy.types.RenderSettings is altered.
import bpy

handle = object()

subscribe_to = bpy.types.RenderSettings, "engine"

def notify_test(context):
    print("Notify changed!", context.scene.render.engine)

bpy.msgbus.subscribe_rna(
    key=subscribe_to,
    owner=handle,
    args=(bpy.context,),
    notify=notify_test,
)

bpy.msgbus.publish_rna(key=subscribe_to)

Note using bpy.types.Context, "engine"  does not work.
For versions without msgbus
Can use a depsgraph_update_post (or prior scene_update_post) handler.
import bpy

engine = bpy.context.scene.render.engine

def engine_change(scene):
    global engine
    if scene.render.engine != engine:
        engine = scene.render.engine
        print("changed", engine)

if hasattr(bpy.app.handlers, "scene_update_post"):
    handler = bpy.app.handlers.scene_update_post
else:
    handler = bpy.app.handlers.depsgraph_update_post

handler.append(engine_change)

It sounds great, I was also thinking of a function called by bpy.app.handlers.depsgraph_update_post, here it would check a variable if the engine really changed, what do you think of this?
Too much cpu work? blender 2.79 not support bpy.msgbus

Yes that would work too.  I would use msgbus

Edited answer to include. Getting hard to keep track of changes.  Do you have depsgraph_update_post in 2.79, if not use scene_update_post   (it fires at a huge rate)


text:
How to set bpy.context.window.scene in the right context?
I would like to set the active scene with bpy.context.window.scene = my_scene
Now the problem is that normally this works if you are in the right context, the problem (in my specific case) is inside a function that is executed immediately after bpy.ops.render.render ('INVOKE_DEFAULT')
immediately after the end of the render I get:
for s in bpy.data.scenes:
     if s == my_scene:
         context.window.scene = s

AttributeError: 'NoneType' object has no attribute 'scene'
so I guess currently the context has changed to that of rendering, am I wrong?
How can I solve this?

The issue here is context.window is None  Similar to issue the other day in my deleted answer re closing render preview window. It seems somewhere the context gets "lost".  Try windows = set(context.window_manager.windows[:]) before and after opening the render window. The difference will be the new window if one was opened.

@batFINGER I'd like to review your canceled answer, to better understand what you tried to do. I am doing an internet search and some tests with blender to see if I can find a solution. I no longer have that code because I haven't saved it

I think the answer to my question is a simple copy of context. So:
ctx = bpy.context.copy()

bpy.ops.render.render('INVOKE_DEFAULT')

###This is handled with some handlers, but essentially seems to work with a simple context copy

for s in bpy.data.scenes:
     if s == my_scene:
         ctx['window'].scene = s

I think this is the answer to my question, but I won't vote for it right now as I could probably cheat in future problems.
For now everything seems to work ok.


text:
How to compile template_list with some object in scene 2.8
I was looking at this uilist, but I understand very little about how to replace materials with objects:
class MATERIAL_UL_Example(bpy.types.UIList):

    def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
        ob = data
        slot = item
        ma = slot.material

        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            if ma:
                layout.prop(ma, "name", text= "", emboss=False, icon_value=icon)

and in the panel class:
row.template_list("MATERIAL_UL_Example", "", ob, "material_slots", ob, "active_material_index",rows = 3)

I was wondering how to compile a list for some objects in the scene, I would need to compile objects based on a string property or by name, something like:
for o in scene.object:
    if "My ob name" in o.name:
        #put this object into the list

Related https://blender.stackexchange.com/a/141207/15543

Edit of previous.

From the related answer to one of your previous question, edited to display all objects in the scene collection.  (Class names still reflect material based nature of original)
Compare to original, and you'll see it's minimal change to display one collection or another.
import bpy

from bpy.types import PropertyGroup

from bpy.props import (
    CollectionProperty,
    IntProperty,
    BoolProperty,
    StringProperty,
    PointerProperty,
)

class MATERIAL_UL_extreme_matslot(bpy.types.UIList):

    def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
        scene = data
        ob = item
        #print(data, item, active_data, active_propname)

        if self.layout_type in {'DEFAULT', 'COMPACT'}:

            layout.prop(ob, "name", text="", emboss=False, icon_value=layout.icon(ob))

class SCENE_PT_materials(bpy.types.Panel):

    bl_label = "My label"
    bl_idname = "SCENE_PT_materials"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "My Category"

    def draw(self, context):

        scn = context.scene
        layout = self.layout
        col = layout.column()
        col.template_list(
            "MATERIAL_UL_extreme_matslot",
            "",
            scn,
            "objects",
            scn,
            "active_object_index")

classes = (,
           MATERIAL_UL_extreme_matslot,
           SCENE_PT_materials)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)

    bpy.types.Scene.active_object_index = IntProperty()

def unregister():
    # fill this in.
    pass

if __name__ == "__main__":
    register()

To sum up the changes, The object that owns the collection is scene the collection "objects" -> scene.objects its item will be an object.
The active index is scene.active_object_index which I haven't set to anything.  Something like
scene.objects[:].index(context.object)

will set it to the active object.

Is it possible to remove text message on hover in list element? (it show popover with something like "active_object_index", "Double click to rename"). First line can be removed with simple IntProperty(text=""), but "Double click to rename" cant find how to remove.


text:
How to use template_any_ID() into Ui Layout?
I found this in the Blender API, and I'm curious to try it out:
template_any_ID(data, property, type_property, text='', text_ctxt='', translate=True)

I am intrigued by this Template, but I don't really understand what it is for and how it works.
Can anyone explain?
I was trying something like this:
mat = C.object.active_material
layout.template_any_ID(mat.preview, 'icon_id', 'id_type', text='', text_ctxt='', translate=True)

But I get error:
uiTemplateAnyID: pointer property not found: ImagePreview.icon_id

I also tried with the 'name' property but not even this function.
Another question I don't really understand, what is required to actually use in type_property?
What's going on here? What is missing? Where am I wrong?
The documentation is partially cofused for me, and I can't find any examples on google.

Look at the code
With any blender layout, try grepping the bl_ui code to see if it has been used
and will see this has been used in the scene properties panel.
 bl_ui/properties_scene.py
class SCENE_PT_keying_set_paths(SceneButtonsPanel, SceneKeyingSetsPanel, Panel):
    bl_label = "Active Keying Set"
    bl_parent_id = "SCENE_PT_keying_sets"
    ...

    scene = context.scene
    ks = scene.keying_sets.active

    ...

    ksp = ks.paths.active
    if ksp:
        col = flow.column(align=True)
        col.alignment = 'RIGHT'

        col.template_any_ID(ksp, "id", "id_type", text="Target ID-Block")

Target ID Block: where I've selected camera
and will see that this is not unlike a driver variable target, in that it lets us set the ID type of object, before selecting an object of that id_type
>>> ks = C.scene.keying_sets.active
>>> ksp = ks.paths.active
>>> ksp.id
bpy.data.objects['Camera']

>>> ksp.id_type
'OBJECT'

or alternatively to the camera data part
>>> ksp.id
bpy.data.cameras['Camera']

>>> ksp.id_type
'CAMERA'

ie we are setting a pointer to object  ksp.id to "any type" based on the id_type.

Ah Ok, so I was completely off track. That's basically what that template is for

Yes I believe so. Leads to another question an can we set up our own  "anytype" pointer?  PointerProperty(type=bpy.types.ID)


text:
Is it possible to edit the selected text via Python in the text editor?
I would like to create some tools for the text editor, for example, I would like to create at this moment a small operator that taking the selected text, transforms it into all lowercase or all uppercase text, in short, a simple thing like
txt = txt.upper()
txt = txt.lower()

I would have many tools to create for convenience, but I am not familiar with how to interact with this workspace

Here is an example of a script that makes the currently selected piece of text uppercase. So the main thing here is the Text object of the space data which also has some other attributes you can use. The SpaceTextEditor might also have some usefull functions.
import bpy
text = bpy.context.space_data.text
fschar = text.current_character
fsline = text.current_line_index
fechar = text.select_end_character
feline = text.select_end_line_index

# The end and start lines and characters can be switched
# depending on the direction in which the text was selected
schar = min(fschar,fechar)
echar = max(fschar,fechar)
sline = min(fsline,feline)
eline = max(fsline,feline)

original_text = text.as_string()
lines = original_text.split("\n")

for line in range(sline, eline + 1):
    cur_line = lines[line]

    start_char = 0
    end_char = len(cur_line)

    if line == sline:
        start_char = schar

    if line == eline:
        end_char = echar

    # Uppercase the selected part of this line
    new_line = "".join((cur_line[:start_char], cur_line[start_char:end_char].upper(), cur_line[end_char:]))
    lines[line] = new_line

new_text = "\n".join(lines)

text.from_string(new_text)


text:
Scale object in place keeping its origin
New to blender, working on some plugin for 2.8.
I need to scale an object, but keep it in place. These objects come from a file and I cannot mess with their origin nor position.
My original thinking was to set the object origin to geometry center, apply the scale, then restore the origin. But I haven't found a reliably way to do this.
Is there a way to scale an object in place without changing its origin?

You can scale the objects in Edit Mode.

Scaling an object relative to it's origin should never move said origin. Your question is unclear to me.

Matrix equivalent of global scale bounding box center.
Note both of these examples use the bounding box center as pivot point.
Could as suggested scale the mesh, akin to edit mode scale.  If scaling the mesh  use local coordinates. Note this alters the mesh coordinates, but keeps the origin and object global translation same.
To scale about a non origin point, first translate such that pivot point is origin, then scale, then move back.
import bpy
from mathutils import Matrix, Vector

context = bpy.context

scale = (2, 2, 1)

ob = context.object

bbox = [Vector(b) for b in ob.bound_box]
o = sum(bbox, Vector()) / 8

T = Matrix.Translation(o)
S = Matrix.Diagonal(scale).to_4x4()
T2 = Matrix.Translation(-o)

M = T @ S @ T2

ob.data.transform(M)
ob.data.update()

And a global version.
Make a scale matrix and two translation matrices, one to make scale origin bounding box global center, the other to move it back.
Note this will not alter the mesh or its origin, but will translate the object to match the scale, to give object appearance of scaling in place.
import bpy
from mathutils import Matrix, Vector

context = bpy.context

scale = (2, 2, 1)

ob = context.object
mw = ob.matrix_world
bbox = [Vector(b) for b in ob.bound_box]
go = mw @ sum(bbox, Vector()) / 8

T = Matrix.Translation(go)
S = Matrix.Diagonal(scale).to_4x4()
T2 = Matrix.Translation(-go)

M = T @ S @ T2

ob.matrix_world = M @ ob.matrix_world


text:
How can i slow down the Animation Speed of ALL Animations in a Project?
Hey i made a Animation and everything is going way to fast, is there an option to slow down ALL Animations in a project and render it again but slower?

It depends on if you want to slow down the animations or the render:

To slow down the animations themselves, go into the Dopesheet, put your blue cursor at frame 0 (the cursor position will determine the operation center), select all and scale up with S + drag.

To slow down the render itself, i.e. increase the amount of frames as if you were shooting in slow motion, go into the Properties panel > Output > Dimensions and play with the Time Remapping values. The Old and New values allows you to set the ratio between the current speed and the one you want, for example to double the time you need to choose a ratio of 1(Old)/2(New), to add 20% choose 10/12 or 5/6, etc. If you’ve slowed down by a half you’ll need to double the Frame End value, otherwise you’ll only render half of the whole animation.

You can simply scale all f-curves.

Turn off Only Selected (red)
Set pivot to 2D Cursor (blue)
Go to frame 1, hit s -> x and move your mouse or type in 2 for twice as slow.

Note that this won't effect drivers (unless they are simply bound to an animated property) or animation nodes.
The time remap suggested by @moonboots should work as well, but tweaking your animations with those settings may be rather tedious.

Where can one find the f-curves?

they are called graph editor (top left symbol in any header)

Ah I see, thanks!


text:
I'm having trouble trying to understand the topology & model this shape
I'm trying to model the HK G11 but this part just confuses me.

I tried to model it and it looked alright but the "flow" was still not close to the real thing. I don't know where the poles should be and if my way of doing it was bad or not.  If you want to give me some general ideas on how to do it or recommend me a related tutorial that would really help me.

Another picture of the object in Edit Mode would be quite helpful.

For tutorials, Grant Abbitt has some really sweat beginner tutorials about topology in his "Get good at Blender 2.8" series on youtube. Another one about rerouting edge loops (and why it's important to learn) would be this one by Josh Gambrell.

To me it looks like something like that:


text:
How do you add beveled circled to flat planes?
I have a flat plane that I added some width to, and it's going on a machine. The plane will need four screws in all four corners.
What's the best way to do that in 2.82a?
I thought about just making one screw top, and duplicating it three times, inserting into each of the four corners on the plane and grouping/parenting.
Is there an easier way?

Hi, welcome! I can't understand what "and it's going on a machine" means, can you add more details and/or some image to clarify what you mean? I'm sure it will help others to understand and help you better...

plate_with_beveled_holes
Welcome!  I believe I understand your question.  Please see above link.
The idea here is to think about the mirror modifier.  As such, I started with a plane situated in the upper right quadrant (in Top View).
Then, add some extra geometry to your plane (it helps with the hole that's coming).
Pick a vertex and snap your 3D cursor there, so you can add a Circle.
Select the circle, then the plane, then go into Edit Mode.  Pick Knife Project to cut a hole on the plane.  The Circle can now be deleted.
Deleting the faces inside the circle leaves you with a hole!  Extrude the plane a bit, then select the edges of the hole and Ctrl-B to bevel it.
Now for the Mirror Modifier.  The key to understanding this modifier is that it mirrors around the Origin.  That's why you see me placing the 3D cursor and changing the object's Origin- I'm controlling where the mirroring happens.
Good luck!


text:
Are they any good tutorials on how to make animated mud/dirt?
This is a project I'm working on that features an industrial factory machine (already modeled out), but inside the machine a mud-like substance is poured in, and subsequently slowly pushed through the cylinder shape inside of the machine.
Are they any tutorials out there showing how to make a mud substance that animates/moves?

There are a ton of fluid simulation tutorials that can get you started. You're going to want a high viscosity fluid to emulate mud. You could then set up your machine to be a collider in the simulation.
Here is a tutorial that covers the basics of fluid simulation.
You could also augment your simulation with creative use of metaballs and particles.
Here is a simple tutorial that covers the very basics of metaballs
Here is a more advanced tutorial that covers metaballs and particles
Finally, here are a couple more fluid simulation tutorials:
Create Splashes in Blender
Realistic Fluid Simulation

this is great - thanks. I will report back on my developments

It has been almost a year. Did you have any progress? Did this all work out for you?


text:
Is there a way for particles on a curve guide to collide?

I have a Icosphere linked to a Metaball, which is following a curve guide, and I would like for the particles to fill up the box in the image you're seeing, instead of vanishing.
Is there a way to do this?

To keep particles at the end of Curve Guide you can change Settings > Free to 0.300. But since particles Life Time is given to use this number of frames to get from start to end of curve (and has influence to its speed) it was quite confusing what is going on there.
Blender Manual says:

Free – Fraction of particle life time, that is not used for the curve.

You can also try Curve object and under Physics enable Force Field > type Curve

One of many tutorials.
Use Particles System > Physics > Fluid type to get volume in a pool.

Ok thank you - what if I create the particles on the curve guide "filling up" a box, and simultaneously have another sphere emit particles to create a mud-like substance just sitting there? That way the when the lifespan of the curve-guided particles end, the other blob of particles formed will already be there. However I will have to find a way so that the blob particles sitting/forming in the box aren't influenced by the curve guide. Would I just add another force field to stop that from happening?

Once (and if) that part is completed, I then have to create animation/illusion of the particles being sucked through hole in the box, so collision will have to be added, or maybe rigid body? That may have to be a separate post.

Force Field as effector limited to just some objects, sure use Collections. Here is answer https://blender.stackexchange.com/a/50820/2214

Sorry for mistification, you can get what you need with particles when you switch physicss from Newtonian to Fluid. https://www.youtube.com/watch?v=IOaQ9MPkdYg

Ok thanks - the files are no longer available, and when I switched from Newtonian to Fluid the particles went haywire on me.

Im not experienced with particle fluid setup, check some tutorials


text:
How do you rig and orbit an object while it follows a path simultaneously?

What's the best way to have the flat cylinder plate follow along the path(s) drawn, and then have those two vertical cylinders above simultaneously orbit around the empty?

You could set the 2 cylinders to orbit around an empty, and then parent the empty to the flat cylinder.

What about the start of the path? Can you start the object(s) moving on a path at a certain time in the timeline? Whenever I hit play there are no key frames, the flat cylinder just follows the path.

I'm not sure exactly what you're looking to do, or what your setup is (in full) but yes, keyframes should be able to be used to start the objects moving.

It’s an animation that will be sent to a client. Camera will zoom in on these items I’ve discussed and at a certain point everything will need to start moving together. As of now, at frame 0 the flat cylinders start moving along that wiggly path, and I need the cylinders to move on a certain start point, and the two vertical cylinders atop connected to the empty to spin in circles

There are no key frames currently for the object constraint path animation. Like I said they start moving on the path on frame 0, but when clicking on the path and the cylinder there are no key frames in the timeline to edit. So at the end of the day I’ll need to flat cylinder to move along the path - on top of that the two vertical cylinders to move with it and spin in circles - and all of this simultaneous- I haven’t been able to figure out how.

Give me a few mins, I'm working on it. Which part did you want to start moving a ways in? Also, are you averse to using keyframes? You can add them to the timeline with "I" if you want to.

I use key frames, but there are none for the path and flat cylinder (added object constraint) for it to follow.

Yeah, I think i'm experiencing the same difficulty now. I can get the cylinders to spin around the disc by using a path follow on circle curve parented to the disc. And I can get the disc to follow the main path by using a path follow on the disk, pointed at the main curve. So both objects both move and they move together, but I am also having no success delaying the start of the "two cylinder" path follow. I'll keep working on it and post if I find a solution.

Wow ok that’s awesome. When you’re done do you mind explaining more in depth on how you were able to get as far as you have?

Ok, here's what I have so far. I'm still trying to work on the keyframed rotation start, but the object keeps staying in the same place when everything else keeps moving.

Here is the base setup. I used a simple flattened cylinder as a disc, two bezier circles, one of them scaled by 10 in edit mode, and another cylinder I made skinny and transformed/duplicated in edit mode so it becomes one object comprised of 2 cylinders sitting on either side of the disc. I made them all in the center because that way I could be assured they all have the same origin.

I parented the small bezier circle to the flattened disc, and applied a Path Follow Constraint to the two-cylinder object, pointed at the small circle. I set it to follow curve, and noticed that this changes the transform for some reason. I simply went to edit mode, selected everything, and moved it back over the flattened disc (for me it was simply a 1 unit transform on the Y, I think). Anyway, once it was back over, I Animated the path.

Then I selected the flattened disc and added a Path Follow pointed at the larger curve (which represents your main path). I checked Follow Curve, Animated the path, and presto - two cylinders rotating around the center of a disc that is moving around the scene.
I know this isn't the final result you're looking for, but you requested my steps up to this point, so there they are.
I'll upload the blend, in case you want to have a look. It's nothing special. I'll also keep working on how to keyframe the cylinder rotation start delay (assuming that's the part you want delayed). I'll post an edit to this answer if/when I find it.
File is here -

Oh my gosh wow thank you so much

@artmajor1, if it answers, please validate his answer with the check button

I'm going to test it out here shortly.


text:
How do you extend the life of a collision motor?
The object rotates with the string wrapping around it - but it ends at frame 250?
How do you extend the collision time to end at say, frame 350? So the string wraps around more?

If you use a simulation, i'd suggest to look in the Cache settings of the Rigid Body World (found under the Scene Properties panel) and adjust the End(the default value is 250).

I did that for the string and it worked fine - however there's no option for this with the cylinder. It only ends at frame 250 and I cannot extend it.

cylinder has a rigid body and collision

There seems to be an issue with the updating of the Rigid Body World, see Rigid Body World cache broken, i guess you are victim to the same. Sadly i do not know the solution other then changing settings to force the update.


text:
Bake without using bpy.ops.object.bake()?
I would like to try to understand if it is possible to bake without the use of the operator, using only Python without operators.
If anyone has been able to do such a thing, I'd like to figure out how.
This would be really interesting, although I'm afraid the answer is that it can't

Don't think it can be done.  Can't find any low level operators that do the various pieces of a bake.

See source/blender/editors/object/object_bake_api.c starting at line 1168.  Bake uses internal C code that implements operators that are not exported to Python.
So no, you can't bake without using bpy.ops.object.bake.


text:
How can I avoid Undo/Redo on StringPropery or bpy.props in general?
As per the question, is it possible to avoid the effect of Undo / Redo on a StringProperty? I've run into a situation where I have to avoid this, but I'm not sure if it can be done, and how.
At this moment in particular I am focused on a StringPropery, but I think it may be useful to know also for other types of bpy.props

You want to remove changes to a particular property from the Undo / Redo stack ?

Setter and getter saving data outside blend file data.
Suggest this could be done with a setter / getter. For example could append string property to a text file, which would be outside the influence of the blend file data (undo stack.)
Here is a test example, using a hardcoded filepath to a text file.  The property is prepended to the text editor footer to test.

import bpy
from bpy.props import StringProperty

from pathlib import Path
filepath = "/tmp/test.txt"

def get_foo(self):
    f = Path(filepath)
    if f.exists():
        return f.read_text()
    else:
        return "Default"

def set_foo(self, value):
    f = Path(filepath)
    f.write_text(value)

bpy.types.Scene.foo = StringProperty(
        get=get_foo,
        set=set_foo,
        )

def draw(self, context):
    scene = context.scene
    self.layout.prop(scene, "foo")

bpy.types.TEXT_HT_footer.prepend(draw)

Note: This is solely a proof of concept. Would require a blend file name based filepath, or in file data for different values on a per blend basis.

It could be a solution. I am surprised that there are no APIs in Blender to avoid this, such as operators that can avoid undo and redo. I wonder if I am making "absurd" claims, or is it simply an API missing in Blender. You who are an expert in Python / Blender, what do you think about this?

No expert in the ins and outs of how the undo stack works. But imagine it would be difficult to maintain state.

I think maybe it could also be interesting to use bpy.app.handlers undo_pre, undo_post, redo_pre, redo_post.


text:
Is it possible to call a function contained in an addon (__init__.py) already installed in blender
Is it possible to call a function contained in an addon (__init__.py) already installed in blender, through a script of another addon always installed?
The function in question is a simple (self, context) with no input

Yes.  Actually the next version of the glTF export addon (for upcoming Blender 2.82) will contain a new ability for 3rd-party addons to place glTF extensions into the exported file.  The code for this feature looks something like this:
    if bpy.app.version < (2, 80, 0):
        preferences = bpy.context.user_preferences
    else:
        preferences = bpy.context.preferences

    for addon_name in preferences.addons.keys():
        try:
            if hasattr(sys.modules[addon_name], 'glTF2ExportUserExtension') or hasattr(sys.modules[addon_name], 'glTF2ExportUserExtensions'):
                extension_panel_unregister_functors.append(sys.modules[addon_name].register_panel())
        except Exception:
            pass

In the code above, all addons are searched (via preferences.addons.keys()), but of course you could limit your search to a specifically-named addon, if desired.
Once an addon is found, hasattr is used to look for a specific class name within that addon.  It will call a register_panel function within that class, to register the custom extension's options into the glTF file export UI.

Very helpful! At the moment this function is not contained in a class, can it be accessed anyway?


text:
Is it possible to avoid finding my operator via the search menu?
I was wondering if it was possible to avoid making bpy.ops.myscript.doesomething()available in the search menu of blender?
I think it is not possible, but I would like to have some information about it

the manual : https://docs.blender.org/api/blender2.8/bpy.types.Operator.html?highlight=operators#bpy.types.Operator.bl_options
setting
bl_options = {'INTERNAL'}

should remove the operator from search results.

This is exactly what I was looking for, It completely eliminates my operators from the search, very useful if they are built to be hidden from the interface in certain situations, thanks for the help


text:
Problem with "procedural" Blur Background, with Cycles engine, how to solve?
With this configuration of nodes, I can get a Blur effect in the Background, but this works poorly in Cycles, while in Eevee everything seems to be ok.
I cannot understand what causes this problem and how to fix it to eliminate those horrible "Squares" that are seen in the attached image.
Anyone have any idea how to remove these squares in Cycles? Any configuration nodes?

I don't know what exactly is the problem in Cycles, but for blurring in general I would suggest you rather use a White Noise texture node instead of a Noise texture and set the Mix RGB to Add instead of Multiply. The advantage is that you don't have to adjust the texture scale, the disadvantage is, that's always a smooth blur. If you're going for a grainy blur you might need a more advanced setup which I haven't got right now. Other mixing methods like Multiply, Linear Light or Overlay instead of Add also work but give a kind of stretched blur.
Anyway, with this setup the result looks the same in Cycles and Eevee. If you just add the White Noise directly, even a very small mix factor will already blur it very extreme. To get a wider range of mixing you can decrease the White Noise output by scaling it with a Vector Math node. Another important thing is that you have to plug the Texture Coordinate > Generated into the White Noise Texture as well, otherwise it will not work.
//EDIT: I added some optional setups - for one, there is a subtle shifting of the background if you don't "center" the noise texture, because with values from 0 to 1 it averages to 0.5, therefore you can subtract 0.5 from it before scaling it. The other optional is just to show you don't have to do this with Vector Math nodes, you can use Mix RGB nodes as well.

I confirm this solves the problem 100% just as I was testing it. This is a working solution!

@NoobCat I actually got this in a slightly different version from tutorials for blurring textures in materials... it seems it is a bit more tricky for the background, but with a little tweaking it works. I guess the complicated thing is the equirectangular projection of the background, maybe that's somehow the reason for your initial problem as well.

Here is another solution of procedural blur as described here by Decoded (except I've used the Noise Texture color output):

I cannot test it right now, does it look the same in Eevee and Cycles? When I experimented with the Noise texture I had the same problem as in the question, it looked good and as expected in Eevee but different / not so good in Cycles. These setups work on textures in materials quite well, but not so much for the world background.

Yes it looks perfect for both world and object, and both Eevee and Cycles   ;)   Blender Secrets also recommends it: https://www.youtube.com/watch?v=Ci2FDxsUjyQ

Well, of course, it's almost the same as mine  Only that it's a Noise texture with a very high Scale value which results in something almost like White Noise, and instead of multiplying it to reduce its effect there you subtract white. I think the problem with the original setup in the question was that there is no generated coordinate plugged into the Noise - what we both did.

I couldn't make yours work correctly, to begin with, where did you get this Scale node, is this a Mapping node?

No, it's the Vector Math node set to Scale. It also works without scaling, but then even with a very low Mix factor like, don't know, 0.03 everything is completely blurred. So to have a wider range of blur effect I scale it down. I guess for a similar reason you have to subtract white in your setup.

Ok thanks, but your setup seems to make the image move, probably because it scales it? Or I do something wrong...

Let us continue this discussion in chat.


text:
How to draw a Panel only in the Shader editor node editor (object type based)?
Like the question in the title, I would like to understand how to place a UI Panel only in the Editing of the Material nodes
So it would be "Shader Editor" in Object mode.
At this moment the panel is drawn in each node_tree.
This is causing me a problem.
THe code:
class ADDON_PT_Panel(bpy.types.Panel):

    bl_label = "Test"
    bl_idname = "ADDON_PT_Panel"
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'UI'
    bl_category = "Test"
    bl_context = "scene"

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

Poll the ui_type
With the advent of more than one UI in a particular area type, when this is the case look at the Area.ui_type
Unaware of, but there may be a bl_context (or similar) class property to do this.  As with 99% of blender the UI code is there to peruse.
Look up the docs for options, put a print in draw method, or find quickly via blender's python console
>>> C.area.ui_type = 'XXXX'
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
TypeError: bpy_struct: item.attr = val: enum "XXXX"
not found in (, 'VIEW_3D', 'VIEW', 'UV',
'CompositorNodeTree',
'TextureNodeTree',
'ShaderNodeTree', 'SEQUENCE_EDITOR', 'CLIP_EDITOR', 'DOPESHEET', 'TIMELINE', 'FCURVES', 'DRIVERS', 'NLA_EDITOR', 'TEXT_EDITOR', 'CONSOLE', 'INFO', 'OUTLINER', 'PROPERTIES', 'FILE_BROWSER', 'PREFERENCES')

Notice there are three obvious candidates for nodetrees.
Test script.  Polls if the context area  ui_type is 'ShaderNodeTree'
import bpy

class ADDON_PT_Panel(bpy.types.Panel):

    bl_label = "Test"
    bl_idname = "ADDON_PT_Panel"
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'UI'
    bl_category = "Test"
    #bl_context = "scene"

    @classmethod
    def poll(self, context):
        return context.area.ui_type == "ShaderNodeTree"

    def draw(self,context):
        layout = self.layout
        #print(context.space_data.ui_type)
        layout.label(text="Hello World")

bpy.utils.register_class(ADDON_PT_Panel)


text:
Using a 360 rotation to drive another object so that it rotates 0-180 and then again 0-180
I've got a bit of a remapping problem with my driver setup.
Driver disk rotates 360 degrees (or more)
Driven disk should match the driver for 0-180 degrees.
Driven disk should then rotate again from 0-180 degrees for the 180-360 degrees of the driver object.
Its basicly a question of mapping the rotation from one object to another
with the rule that the driven object is always rotating 0-180 degrees, never 180-360.
It would be especially great if this works for driver values beyond 360 as well.
Could this be done?
Im guessing it would need a scripted expression, but perhhaps there is a simpler way.

Sounds like modulus. (remainder)  Blender uses radians as unit of angle   (have wrapped in degrees to demonstrate)  degrees(radians(359) % pi) returns 179 degrees, 360 ( a multiple of pi) flips it back to zero.

Hi batFINGER, thanks for taking the time to reply.
Ive used "degrees(radians(var) % pi)" with var being the input variable.
It seems to have a 1:1 connection with the driver. But sometimes It does jump to a different degree. Quite strange. It my setup it doesnt flip back to zero. Autorun python scripts is enable. Could I be overlooking something?
modulo seems fine to me

NP.  Is modulo a good fit?  ... requires  input rotation  is a single property, since rotation channels often do a mapping for us.

only used degrees to  output in degrees, would use angle % pi in driver expression, where angle is some rotation, natively in radians.

Perhaps the expression you're looking for is (r%pi)+(pi*(r<0)), ? ..  which is the same as @batFINGER 's , but keeps the rotations in phase immediately around 0.

Angle % pi works perfectly.
Thank you batFINGER and Robin Betts!


text:
Duplicate a mesh via python
I'd like to improve my duplicator script.
bpy.ops.object.duplicate() seems to require me to select the object first.
I'd like to just feed the object straight to it instead.
Is there a smarter way to handle it than I did so far?
def duplicator(name):
    # select the object
    obj = bpy.data.objects.get(name)
    obj.select_set(True)

    # Loop 3 times, duplicate it, name it
    for i in range(1,4):
        # duplicate selected object
        bpy.ops.object.duplicate()

        # name new object with a string and number
        newObj = bpy.context.selected_objects[0]
        newName = 'Plane_' + str ( i )
        newObj.name = newName

duplicator('Plane_0')

new_obj = obj.copy()

Another take
Before closing as dupe, thought I would put together another take on this for example sake.
Added a method that simply yields n copies of the given object with a new name and suffix.  If linked is False the object copies all share the same mesh.
import bpy
from bpy import context

def object_duper(ob, name, n=1, linked=False):
    assert(ob)
    for i in range(n):
        copy = ob.copy()
        if ob.data and linked:
            copy.data = copy.data.copy()
        copy.name = f"{name}_{i + 1}"
        yield copy

# testing

ob = context.object

for o in object_duper(ob, ob.name, 5):
    context.scene.collection.objects.link(o)

This method simply dupes the objects which will naturally be added to bpy.data.objects collection. I have not put in the link to collection.  Could emulate your answer method with, and pass the collection
def dupe_n_link(collection, ob, name, n=1, linked=False):
    for o in object_duper(ob, name, n=n, linked=linked):
        collection.objects.link(o)

Can think of many reasons to create multiple duplicates, may not always wish  to add all dupes to same collection, may wish to add one to each collection
ob = context.object

colls = bpy.data.collections

for c, o in zip(colls, object_duper(ob, "Basis", n=len(colls))):
    c.objects.link(o)

is it possible to unlink the material as well as you do with the mesh in the duplicate object by using the linked=True flag. I want my material in the duplicate object to have the same properties as the material in the original object but at the same time once the duplicate object is created any changes in one of the two materials later on not to affect the other one.

Ok I think I found the solution copy.active_material = copy.active_material.copy() seems to do the trick.

Thanks @batFINGER and brockmann.
To duplicate an object and add it to a collection, you could use the following code
import bpy

def duplicator(
        ob_name, new_ob_name,
        col_name, amount):

    new_obs = []

    for i in range(1, amount):

        # get the object
        ob = bpy.context.scene.objects.get(ob_name)

        # copy, name and store new_name
        new_ob = ob.copy()
        new_name = new_ob_name + str ( i )
        new_ob.name = new_name
        new_obs.append(new_name)

        # place it in the collection
        col = bpy.context.scene.collection.children.get(col_name)
        #bpy.context.scene.collection.children.link(newCol) <-- in case you need to add the collection to the scene
        col.objects.link(new_ob)
        print ( col.name )

    return new_obs

duplicator('Cube', 'Cube_', 'coverage', 5)

```

Depending on what you do, there is still a lot which can be optimized like getting the object as well as the collection per scene C.scene.objects.get(ob_name) instead of the data block, python comes with enumerate() and I would not recommend to hard code the collection name: https://blender.stackexchange.com/a/167440/31447

Hi brockmann,
wow, thank you, this is nice. I've updated the script a bit to reflect the changes.
Any reason why you prefer using C.scene.objects instead of bpy.data.objects ?

That's close but won't work unfortunately. C is a convenience variable in the console to get the context so either create the variable before C = bpy.context or use bpy.context.scene.objects.get(ob_name). Why? It's safer, you can limit the scope to the scene in context rather than iterating through all objects in the entire blend file. Also consider renaming your arguments to something like ob_name, new_ob_name, coll_name and amount -> according to pep: https://www.python.org/dev/peps/pep-0008/

I was struggling a bit with the names, but your suggestion & pep-0008 are quite helpful. Updated code once again. Cheers dude!

... and the collection using get() as well like: col = C.scene.collection.children.get("Collection"). Once you have it, use it to link the objects col.objects.link(new_obj)...


text:
No suitably rooted paths error when trying to set action on object
I'm trying to place a copy of an action onto another object.
My code seems to work, except when I try to set the action on the new object.
(I'm copying the animated viewport display rgb values, from the material of source_cube to the viewport display colors of target_cube)
The error that eludes me is:
Error: Could not set action 'the_new_action.002' onto ID 'OBtarget', as it does not have suitably rooted paths for this purpose
Any clues what I'm missing here?
import bpy

# Gets the action from material of object
def get_material_action(object):
    # current_object, material, action
    current_material = object.material_slots[0].material
    action = current_material.animation_data.action
    print ('getter: found:', action.name)
    return action

    #print ('current object', current_object.name)
    #print ('current material', current_material.name)
    #print ('current material action', current_material_action.name)

# Copies the action
def copy_action(action):
    current_action = bpy.data.actions.get(action)

    ### Create a copy of that action
    new_action = current_action.copy()
    new_action.name = 'the_new_action'
    print ('copier made: ', new_action.name)
    return new_action

# Sets the action on material of object
def set_action(object, new_action):
    current_material = object.material_slots[0].material
    # create empty action
    object.animation_data_create()
    object.animation_data.action = bpy.data.actions.get(new_action.name)

# Define source and target objects
source_object = bpy.data.objects['source']
target_object = bpy.data.objects['target']

# get current action from source
# Then copy and name it
# Then set action on target
source_action = get_material_action(source_object)
new_action = copy_action(source_action.name)
set_action(target_object, new_action)

print ('done')

Action ID root
The error is informing of attempting  to link an action which expects to be for a material onto an object.
The created action from keyframing property of  a material has 'MATERIAL' set as its ID root.

ID root
Type of ID block that action can  be used on - DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING

Py console example
>>> source = C.object
>>> mat = source.active_material
>>> mat
bpy.data.materials['Material']

>>> action = mat.animation_data.action
>>> action
bpy.data.actions['MaterialAction']

>>> action.id_root
'MATERIAL'

An object's action  would expect this value to be 'OBJECT'.
Material action -> Object action
Example, material action with only keyframes for  diffuse_color of material
>>> for f in action.fcurves:
...     f.data_path, f.array_index
...
('diffuse_color', 0)
('diffuse_color', 1)
('diffuse_color', 2)
('diffuse_color', 3)

the data path from an object to "viewport color" is  color
At the very simplest, could as above copy the action, iterate over the fcurves, make our necessary datapath change, set object id root  and assign to the object.
action = action.copy()
for fc in action.fcurves:
    fc.data_path.replace("diffuse_color", "color")
action.id_root = 'OBJECT'

Context
Customary in blender is to use the active object as a source and other selected objects as the destination.
source = context.object
targets = context.selected_objects
targets.remove(source)

for operators, having a poll method removes the need to test for  context.object being None


text:
How to acces to EnumProperty value outside of "class SearchEnumOperator"?
I can't understand how to get the value of an EnumProperty outside this operator.
This is an example with the panel where I would like to show the current value of this EnumProperty:
class SearchEnumOperator(bpy.types.Operator):
    bl_idname = "object.search_enum_operator"
    bl_label = "Search Enum Operator"
    bl_property = "my_search"

    my_search: EnumProperty(
        name="My Search",
        items=(
            ('FOO', "Foo", ""),
            ('BAR', "Bar", ""),
            ('BAZ', "Baz", ""),
        ),
    )

    def execute(self, context):
        self.report({'INFO'}, "Selected:" + self.my_search)
        return {'FINISHED'}

    def invoke(self, context, event):
        context.window_manager.invoke_search_popup(self)
        return {'RUNNING_MODAL'}

class CustomMenu(bpy.types.Menu):
    bl_label = "Custom Menu"
    bl_idname = "OBJECT_MT_custom_menu"

    def draw(self, context):

        layout = self.layout
        ###Noob example:
        #layout.label(text = SearchEnumOperator.my_search)<---------?

https://blender.stackexchange.com/questions/163129/how-can-i-access-view3d-select-circle-radius-value/163130#163130

Ty for this tips, So actually, it seems like a bad practice, I think I'll have to change my approach to that enumproperty.

Not sure what you mean re bad practice. If you want to expand the enum in a menu can use layout.operator_menu_enum  (or whatever it's called consult docs) as shown somewhat in https://blender.stackexchange.com/a/102157/15543   Might also need to have REGISTER in operator bl_options for it to show up in last operator used.


text:
How to understand why I get EXCEPTION_ACCESS_VIOLATION with bpy.data.scenes.remove (myscene)?
I'm trying to delete a scene in which a rendering is performed and finished, I also tried to further put a time.sleep() of several seconds to delay the deletion of the scene with bpy.data.scenes.remove(my_scene)
This creates a complete crash of blender, I managed through a small video to grab this image with the error:

My code is quite complex and is also based on this answered question:
I'd like to understand the possible cause so I can fix this problem and never have to deal with it in the future

Using any reference to, or within,  an object that has been removed from blender will cause the above error. Eg loc = ob.location; bpy.data.objects.remove(ob); print(loc) equals goodnight nurse.

@batFINGER I have several problems with this type of error.
How would you bypass this problem loc = ob.location bpy.data.objects.remove (ob) print (loc) taking into account that I need to have the value loc even after removing the object?

loc = ob.location.copy()  is described as an "unbound copy" ie it is an instance of the value and  no longer bound to the location of the object

Fantastic I hadn't thought of that. Too many times I run into this problem. By the way, I think your answer from some time ago is worth to be voted as the correct answer, as it was really useful for me to find my bugs in the code, This question is not very popular, but I think your answer may be useful to some people


text:
How to examine a collada file loaded in blender ? (Python)
By doing various tests and using bpy.ops.wm.collada_import(), there are compatibility problems between some software with the '.dae' format, so I was wondering, is there any way to interact with objects inside a '.dae' file , before uploading it? Is there a way that allows me to examine the objects present in a dae? with their names and data?
When the object is imported into bpy.data.objects, does any trace of property dae remain?
Basically some software create instances that enclose other instances, this does not allow blender to maintain the correct hierarchy, so I was wondering if you could analyze a .dae file and possibly act directly on it.
I still don't know how a dae works. so please be patient, i am trying to get a direction for my research to the solution.

I'm not a coder so just mentioning this just in case it may help.... You can edit .dae files with Notepad or have more control with Notepad++.

PyCollada might help: https://github.com/pycollada/pycollada

@brockmann This is a good start, i think, do you know a practical example of blender use with pycollada? Basically, I should correct the relationships in the .dae file, but I don't know how to interact with this module

Pure python. If you want to embed it inside blender for whatever reason, read Using 3rd party Python modules. How to use the module: https://pycollada.readthedocs.io/en/latest/

@brockmann It sounds very interesting, but I was wondering, is there a way to put that module into an addon and call it with the use like: from . import Collada ? I don't want to install it

Why not? Just make sure the license type match with yours or ask in their mailing list if that's ok or not.

@brockmann I'm trying to approach this pycollada module, have you ever had anything to do with pycollada on blender? How can I find examples on blender ? Is it appropriate that I ask a new question?

@brockmann I think your comment about pycollada is my answer, so I invite you to use that comment as an answer so that I can rate it as an answer to my question.

Glad that my comment was useful @Pastrokkio. Problem is: I have no idea about pycollada itself so I don't want to give any unproven answer. Also I don't want to spend any time on that because I personally don't use it and never will. Thanks though.