text:
How to set rotation of an object on a specific axis?
I am currently using the following to rotate my object:
eul = mathutils.Euler((math.radians(10), math.radians(10), math.radians(10)), "XYZ")
own.localOrientation = eul.to_matrix()

This seems to work just fine; it rotates the object by 10 on x, y, and z. However, I am only looking to set rotation on y and z. I have tried eul.order and other various ideas, but none have come upon success. How can I rotate an object with a specific set of axis?

Do you mean 10° around Y and 10° around Z?
mathutils.Euler((0, math.radians(10), math.radians(10)), "XYZ")

or do you mean 10° around X?
mathutils.Euler((math.radians(10), 0, 0), "XYZ")

Doesn't this mean that the rotation for y and z (second one) will change to 0? I am trying to leave those as they are. In other words, only set for the specified axis.

Each coordinate describes the angle around the according axis. That is why I asked what you want to get (some people say rotation in YZ plane which is rotation around Y-axis). So I'm not sure what you ask for. It seems that your answer is already there: mathutils.Euler((angleAroundX, angleAroundY, angleAroundZ), "XYZ")

I was trying to only do y and z, not x. I thought that, with that code, it would change x too?

The code "sets" the polar coordinates. As it expresses the difference to (0,0,0) you can interpret it as "change" from there. If you do not want a change you keep the coordinate at 0. - I have the impression you need something different.


text:
Why can't I have two animations in one objects when using property play mode?
I have an object with two animations. I have two properties. Each property controls an animation (prop1 controls anim1, prop2 controls anim2). In the logic, I have Always (Frequency) > And Action twice: one for each animation. I've tried using 1 animation with the property, and it worked. I tried the second alone and it also worked. When I have both, it doesn't work. I've changed the layers for each animation and it still didn't work. I've changed the priorities of each one. I've played with everything I could in hopes that they can work together. I then moved on to seek a different approach. Using playAction() responds horribly slow. I've tried changing each animation's sensor from Always into Property, so that a given animation will play only when property (string property) play is set to the animations name. I've continued to a numerous amount of approaches, but nothing worked. The animations simply don't work with each other. Why is this happening and how can I have the animations both be able to play blazingly fast (plays at the exact tick)?

Have you tried creating a seperate action that has the two actions combined, and then just running that instead of trying to trigger both?

How exactly would I have them both in one action? Do you mean having a separate animation with the keyframes for animation one and animation two?

May I ask what you are using the always input to detect? It may be helpful to know this.

It might be helpful to mix Always with a "NOT" Signal/Message with your String Property again via an AND to perform a single action. Then do the same thing for the other action in question via a separate AND Controller, using the "NOT" of the other String Property Message.

@Rock Riggs I see your approach, but it isn't ideal as: it responds with a delay, and it won't work with more than three animations. In my actual file, I have multiple animations, but I had just put two for the question. I should of written three, my bad. Thanks though.

Working just as fast as needed, using one actuator but changing its property name and animation name when needed solves the problem. You can define the animation with the following:
animation = armature.actuators["animation"]
When you need to play animation one, do the following:
animation.action = "anim1"
animation.propName = "anim1"

The same follows for animation two.
This is ideal as it is just as fast as using one animation, and it works with more than two animations.

The attached BLEND file shows how this is accomplished.
The trick is to use three different actions added each to their own "NLA" tracks.
It's set up to use the GE, so use keys A, S, & D to control animation #1, #2, & #3 (#3 = #1 & #2 together).

The Blend File:

Thank you for the answer. Can you clarify on exactly what are "NLA tracks" and how to use them? Also, I'm not sure if you've understood exactly what I mean. I am not looking for both to play at once. They are all running at once, for they go with a property (every tick, the action is played depending on the property). In my scene, if one is equal to any number higher than 0, the other will usually be 0. They will never play over each other in terms of the frame being greater than 0. I am just wondering why having both actions run every tick makes them not work. It sets a priority?

As far as NLA tracks, I'm not exactly sure how to explain them, other than they provide a place holder like a track would in the VSE (Video Sequence Editor). As for the property controlling the "tick(s)" that was what I was hoping to resolve by showing you how to control multiple at once, but it sounds as if maybe it doesn't quite fit your exact circumstance.

source: Stack Exchange

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

sort: votes


text:
Shortened properties in GE?
For some of my properties, the numbers would sometimes read something like 0.1231231230938..., which basically is absurd. Is there a way to duplicate this property and have it only read x numbers after the decimal? Thanks!

if this is for printing only you should be good with print("%.2f" %myProp)

@Chebhou is there a way to have that in a property? Something like own['smallprop'] = ".2f" %largeprop? (Assuming we already defined the props.)

AFAIK you can't control the precision of the property , and this solution is for printing/displaying only , where exactly this is bothering you ?

I am just trying to make a smaller property and I dont want to write an interval from (e.g.) 0 - 0.499999999999999..., It would be much simpler to have 0 - 0.4.

sorry but i don't get exactly your last comment ( give me another example )

Well, I have events that work when a property is at a certain interval. If one interval is 0 - 0.4, the next one is 0.5 - 1. I do not want to have 0.499999999999999999... Do you understand now?

so you are doing a comparison, you can round the number before comparing like this round(myProp, 1) < 0.4 or simply myProp <0.5 istead

Well, I'm using logic bricks, and if I round, lets say, 0 - 0.4 & and 0.5 - 1, there will be no outcome for 0.4000001, 0.400001, etc.

to me it seems that both case can be done like  this (  prop  Greater_than 0.0  and prop Less_than 0.5  the second prop  Greater_than 0.5  and prop Less_than 1.0 )

It seems to me that you are using the property sensor to check if a certain property is equal to an exact value, am I correct?

I got it to work though, I've used your approach. Thanks!

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


text:
Printing items too many times?
I am starting to have a lot of scripts going on at the same time, most of which go on every tick and print on every tick. When I go to the console to see what is going on, I see a ton of items repeating the same thing line after line. Is there a way to keep this under control? Perhaps it will only print if something changed? If I do that then stuff that is always supposed to be changing will keep printing. How can I keep this under control? Thanks.

This is really a Python question and not Blender specific. But have you tried the 'logging' module to log program states, and only print to the console properties you care about?

You can also use the sys module for output and '\r' to rewrite the same line. This way you could output only a list of variables on every line that changes value. See http://blender.stackexchange.com/questions/3219/how-to-show-to-the-user-a-progression-in-a-script/30739#30739


text:
I can't move my character in pose mode
I made my first low poly model and I want to put this character into Unreal and animate it in Blender first, so I rig it with Rigify the Blender plugin.
I add bones and I generate it and it's all working so far, but here is the problem.
After I generated it and I went in pose mode when I click on a line to drag and move the body it starts a box select instead of moving that part of the body. One other thing I have noticed is when I am in object mode and move around the character the bones nor the armature follow it, is that supposed to happen.
Sorry if this is a common problem, I am new and have no clue what is going on, I have searched this up and I can't find any solutions.
In this image I have selected a line and tried to drag it but it uses box select

This does not sound like correct blender usage. With a basic armature, one must select the bone, then somehow rotate it. One option is to enable the rotation gizmo via the left sidebar, another is to press R, and a third is to edit the properties directly in the right sidebar or in the Properties editor. I don’t think one can ever flat out drag a bone.

Have you used the "parent with automatic weights" operation for the rig and the mesh? In the screenshot, it looks like you have box select enabled. If you want to move a bone you have to grab it first (key G) or use the gismo, as TheLabCat suggested. The red and yellow bones are IK control bones. You can move and rotate them. The green ones are FK control bones. They cannot be moved but only rotated. The root (the large circle with the 4 arrows at his head) doesn't look right. It should be down on his feet. Have you applied the Location for the rig and the mesh before you parented them?

Ok thanks for your answers I think the red arrow is at its head becuse thats where the cubes original location was and I extened down and did not move the mesh up

As for thelabcat when I press R or use the rotate gizmo, it move the lines and dose not move the bones or the actual character object. I am assuming that is not supposed to happen. And for when I said just drag the bone I saw it in a video about rigging with rigify link:https://www.youtube.com/watch?v=DS885Sk1gSs I did not see he pressed G to move

and btw I think I used  "parent with automatic weights" already because I can no longer do that when I select the bone and the character

sorry I keep adding comments but now I think that the problem is that the lines are not linked to the bones or the character object , if there is a way to link them back up then that would be great if you could tell me. Also I have a back up where there is no bones or any type of rig if I will need to start again with the rigging

You can parent the mesh to the rig with automatic weights as many times as you want. It's not a one-time operation. But the order of selection is important. The rig must be selected last in the viewport to make it the active object. Then you will have the option "With Automatic Weights". https://youtu.be/DS885Sk1gSs?t=758 -- Please watch the video closely. Around timestamp 14:00 (https://youtu.be/DS885Sk1gSs?t=860) you see in the screencast keys that he presses 'G' to grab the bones and 'R' to rotate.

ok thanks I will try this

Here is the issue when I press g or R to move or rotate, the lines move but the bones and the character do not move? here is an image https://imgur.com/bhAWUuH and I just did the auto weights btw so idk why it dose not work?

When you do the "parent with auto...." is there a message in the status bar that reads "bone heat failed to find solution for one or more bones"? If yes, then it didn't work properly. IF you like you can upload your blend file here https://pasteall.org/blend/ After the upload the URL (web address) will change. Post it here, it's the key to access the file.

It gives me no error message I will upload the file https://pasteall.org/blend/06ad7bfc37774f41a263d880fcc515d7

That's not true! ;-) Have a close look at the bottom of the status bar. There is the message! https://i.sstatic.net/UWIKa.jpg The automatic weight paint didn't work. I'll have a closer look later. If you like have a look yourself. There is probably something wrong with the mesh: https://blender.stackexchange.com/questions/15964/heat-weighting-failed-to-find-solution-for-one-or-more-bones

ok thanks I did not see the error but thanks ok

It's the mesh. There are some issues and the overall topology is not ideal for animation.
Issues that prevent the Parent To > With Automatic Weights operation are:

duplicated vertices. In Edit mode, use M > Merge By Distance to get rid of them
overlaying/intersecting faces in the head. Select a face at the ear and hide it with H (Use Alt+H to unhide). Peek in the head and you will see there are faces inside. Delete them all (X)

Topology
The arms and legs have too few edge loops. Add more so they can bend properly. At the sides, there are too many edges. Use X > Dissolve Edge to remove them.
Have a look at this related question: My Model's Forearm Twists Too Much

This worked for me! Thanks a lot!

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


text:
How to make a knot animation
I'm doing knot animations in Blender using "Spline"
This works well if a knot is tied when you need to pull on its edges, but some knots are tied when you need to pull on the middle of the rope. Can you please tell me,
with which I can animate such a knot on image

The knot that I want to make in the first picture, the knot that I know how to make in the second picture

The knot that I want to make in the first picture, the knot that I know how to make in the second picture

How did you make the knot in the second picture? And why does it not work for the first image?

I'm doing knot animations in Blender using "Spline", but at first image, I need to pull on the middle of the rope, and I don't known how it make using "Spline" - sorry my English is bad :)

authors: Артик Казорио

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


text:
"Hair" as cloth, cant move how I want it to. How to handle?
So I want to animate my character, and I'm having trouble figuring out how to handle the hair. At the moment, it looks like this in T-pose:

But when I rotate the head, for example, this happens:

Even worse when rotating in the other direction:

The hair should be glued to the body and not move into the body.
My idea was, that the hair, which is not glued to the body, for example the part between head and breast, could be stretched. So the hair is kind of a stretchy string.
I tried the boolean modifier to glue the hair to the body, but the hair still behaves differently.
If I understood the boolean modifier with union correctly, the part where the hair and body overlap should be deleted and the hair and body are combined to one surface.
So the hair wouldn't be able to lift up from the chest, theoretically.
But it has its own surface and the breast below has its on surface underneath the hair, otherwise the part where the hair lifts up would have to be a hole.
I tried splitting to loose parts and then remerge it with the boolean modifier, and it also didn't work.
What can I do, and how should I handle the hair?

The boolean will not make your hair "lift up from the chest" nor glue it to the body, it will just make a simple X + Y operation from your intersecting meshes volumes. Also, using boolean operations in a rig sounds like a recipe for performance hell.
What is your end goal? Probably just get a good deformation of your hair, not make geometry. But what kind of deformations would look good here when your head is fully up? If it was me, I would NOT stretch, or at least keep that as a last option: hairs do not stretch in reality, seeing hairs stretch as soon as your character looks up will scream off weirdness.
The way I see it, you could use two approaches. I will only explain why and how to use them but I will not give the technical details of how to set them up, as it would be very long and all the things in mention can be easily found well detailed and explained online already.
Tweak the neck ⬌ head deformation
At the end of the day, what we see in your second and third screenshots is that your head bone controls mesh parts of the hair that are way below the head bone's rotation point.

You could switch to weight paint mode and modify the weights of the hair so that they deform about at the same place as the body parts do:

You could add some shapekeys driven by the head bone's relative rotation to fine tune how the hair deforms in different situations.
Rig the hair
Eventually you will reach a limit to what you can do with deforming the hair from the body's bones. Having the hair handled by individual bones can give better results, and there are many ways to do it.
The simplest would be to have a simple chain like such, and why not with an IK constrain, with its target bones parented to the torso. which makes the ends of the strands stay in place while the rest of the bone chain adapts to the distance between the head and the targets:

Now depending on the pose, it might look weird, but since your hair strands are rigged: you are in control, you can pose them as any other bone if you want :

You could also make use of a spline IK setup.
Probably both
Looking at your model, different strands are laid out differently on the character, so they could be handled differently depending on that and what you want to be able to do. At a glance, I would say most of it could theoretically be just deformed with the body's bones and still look good, so I would start by working on the weights as a "by default" situation. And for the hair strands that have some wiggle room and can visually untangle without stretching (I.E. the curly ones from the forehead), I would consider adding specific bones for these.

That's exactly what I was looking for. Big thanks for the effort and visualisation!!
I'll try the combination of both and look up in detail how to do it properly.


text:
Blender texture looks more white
I downloaded this model from the site Sketchfab, this is how the model supposed to look like:

And here's how it looks like on my side:

The shader nodes:

Any solutions?

Can you show us that material in the shader editor? Maybe there is just something wrong with your material, it pretty much looks like if emission was enabled slightly or there is something else that bleaches it

sure but how i can send pics on comments

https://imgur.com/DsiPMUn

instead of sending pics in comments it's better to [edit] the question to add more details.

Looking at the image you sent again the issue should be here:

This second image texture should act as the indicator to which part should be light up by emission and which shouldn't... in that manner, you have to input that image texture with the name ColorsomethingEmission into Emission Value of your principled BSDF, not into Emission Strenght,... in emission strength try some value like 5 and tell me if it works now
The way you set it up is that you are giving your whole object white emission with some slight low value of strenght

thx for the advite but nope that didn't  help it
it actually was on sRGB but someone said put it on linear
by the way the first time i got this model .. the texutres was all black i looked on yt and some guy said change the " Alpha "  to 1.0 i did that and the black texture fixed but the textures became whiters

wait wait, i got it... i didnt notice it because I saw linear at the top first... your problem is that you have enabled emission for the whole object and not for only parts that are supposed to emit light... I will edit my answer but I thing that you have to put that second texture from emission strength to emission... please post that texture into your question so I can see if I am right

answer is edited, try second solution

oh thank u so much that worked

so it was as I said, that texture is showing that only eyes and those scars on the body should emit light, other those part have emission color and other parts have black color so that emission strength value will only affect places that should be lit up


text:
How to write EXIF data in rendered images?
I'm trying to render an image in cycles. version 2.83.5. trying to write metadata or Exif data into the image. In the output channel, I ticked every box on metadata. But I didn't find the EXIF data included in the image, especially focal length and focal length equiv 35mm. I am using exiftool and exiv2 to check the EXIF data, the tools tell me there is no EXIF data. Any help would be appreciated.

As the fine manual says only png, jpg, and openEXR file formats support writing EXIF metadata. So you'll have to write to one of those. openEXR is only supported in 2.93.
Focal length equivalent isn't available, and nor is sensor size.
That said, when I output png and openEXR with 2.93 it works, so if it's not working in 2.83, you may have encountered a bug.


text:
Only Selected Curves Keyframes option gone in 3.6?
There used to be an option in Blender 3.3 and under to make it, so only the selected curves have selectable keyframes. But this options seems to be gone now from the graph editor. Does anyone know where it went?
3.3:

3.6:

It was moved to the user preferences:

The project Animation 2025 is currently active, so expect many changes related to animation and rigging until it is done.

Thank you so much!!!!

The answer above is correct but not working in Blender 3.6.5
This option does not appear even after selecting in preferences and saving.

It is on my v3.6.5.

I had a hotkey to toggle this setting cause I use it a lot, but in Blender 4 you have to manually re-add it through the keymap in preferences.
Under Window, add a new Context Toggle hotkey. In the Context Attribute box, select preferences.edit.show_only_selected_curve_keyframes.


text:
Out of memory only on Render
I just upgraded from a 1060-3gb to a 3070 TI, so I'm not sure if I haven't set it up properly, but everything runs perfect and smooth in the viewport without nearly maxing out my card, however, as soon as I render, it runs out of memory every time. It's not maxing my RAM either as it only reached 89%. I am not sure what is happening here and if it's because of bad render setting or if I improperly set up my GPU to run with Blender.

Optix rendering (RTX) doesn't handle the shared memory pool well and is causing some issue.  On very complex scenes it will be necessary to step down to rendering with CUDA on the GPU.
Hybrid rendering should work, but even if you choose only the GPU the CPU will still show some utilization.  Some tasks are offloaded to the CPU in all rendering scenarios.

If you are having issue while rendering but not in the viewport, my first suspicion would be towards your scene setup.
There are many things that are by default set up to be more intensive when rendering than in the viewport, a good example of that is the subsurf modifiers: by default it uses level 2 subdivision in the viewport and level 3 on render.
I'd suggest playing with the Simplify panel in the Properties Editor > Render tab. That might be one of the first things that might help.

Try to change settings in Preferences-System. Example below is with different CPU, but shows options for changes


text:
design a mathematical knot in blender
i'm a complete beginner to blender, i wanted to design various mathematical knots (e.g trefoil knot). What would be the best way of going about this, I've seen people design them freehand, but also saw much more precise results using formulae, any help/tips much appreciated.

One starting point might be
"Open Blender and go to Preferences then the Add-ons tab.
Click Add Curve then Extra Objects to enable the script."
Although there are many options.  You could start a new curve object and choose knots, and torus knot plus to experiment with:

Although not as quick a method, but producing results you can customize, the formula for the trefoil object can be plugged into animation and geometry nodes, taking the set up mentioned in this tutorial,  just adapted for Geometry Nodes:
https://www.blenderdiplom.com/en/tutorials/simulation/671-trefoil-knot-animation-nodes-math-fun-pt-1.html

As others have mentioned, this is probably best addressed with the Extra Objects addon.
Since you specified you want to "design" these knots, however, there are ways to have more control. For instance, you can use the more general Shift + A Mesh → Math Function → X, Y, Z Function Surface strategy. An example for a trefoil know could look like this:

Define a trefoil knot surface using its implicit equations over a range of u values.

Delete all duplicate vertices with M → by distance

Give it some thickness using a skin + subsurf modifier, e.g.

There's a bunch of mathematical knot presets in the Torus Knot Plus object


text:
Animation stacking on top of eachother
Making some animations lately, having some problems that I never experienced before.
Somehow, all animations stack on top. For example my running and walking animations try to play at the same time, while editing either of them in the action editor.
It basically behaves as if I was working on one animation and not on seperate ones.
Can someone help me out?
Thanks a lot!

Did you perhaps push the animations onto the NLA?  That would cause that.  Open the NLA and it should show you a track with the animation you're not working on if that is the case.  If you mute it you should be OK.

That was indeed the problem. I thought it had to be normal to have multiple tracks, because I couldn't delete tracks by pressing delete. Had some random tracks linked to objects in the scene that I first had to unlink, that way I could delete the tracks because then they were empty.
Thank you!

Your welcome.  You can stash actions instead of pushing them if you mean to save them and do more actions or you can mute the action if you want it in the NLA but don't want it interacting.


text:
Objects colors and line art disappear in 2D Animation wokspace
I was trying to do a 2d animation in loop with a tutorial last night, it's my very first time in blender.
I drew some grease pencil objects, colored them and they also have lineart. But in some point, when I was at object mode, colors suddenly disappeared and I just see the lineart. I guess I clicked something wrong but I don't know what I did.
When I try make another object and color it, the same happens. And if I change modes from the panel next to the overlays.

I see only colors and not the lineart.

Your 3D view is set to Wireframe mode. You can change it to any other mode (Solid, Material Preview, and Rendered) in the topright of the editor. You can also use the shortcut SHIFT + Z to toggle between Solid / Wireframe mode.

Thank you for the answer but i've tried that and this time i see only colors without the lineart. Lines are only visible in Wireframe mode... Any more ideas? :/

Go to the material properties (red icon on the bottom right), and see if your material has "Lines" checked


text:
Smoke effects to Unity or Unreal
Blender smoke effect to Unity or Unreal
I’ve seen a few demos where people create some great smoke simulation in Houdini and then are able to bring this exact sim into a game engine.  I’ve also seen pipelines where they use Houdini for all their game effects.
I created a smoke effect I like in Blender.
Would anyone have any direction or helpful links that demo how to export this to a flip book or maybe a point cache or something that’s useable in a game engine?  Thank you for any feedback.

If you want to export VDB files from Blender to a game engine that supports VDBs, it's actually quite simple.
Assuming you have a working smoke simulation, all you have to do is bake it into OpenVDB format, which happens to be the default format to begin with:

You will find your VDB sequence files in the baking folder, data subfolder. You can import them as sequence in your preferred game engine.
If you want to export a flip book, the manual way is essentially to just render images of your smoke simulation with either alpha, or as a black and white, and assemble them into a sprite sheet.
There are some addons to automate parts of this process, one of which is explained on this very website here:
fluid simulation - Rendering smoke to texture sheet - Blender Stack Exchange

Thank you so much for your response.  Just so I can understand better, if I have an animated smoke trail that I export as a vdb, and the engine supports it, does that just open up as an animated smoke trail?  Or is there more set up that needs to be done once in engine?

That depends on the game engine and isn't in the scope of this website.

You are right.  Thank you for your previous response.  That gets me going in the right direction!


text:
Imported video mp4 does not render
A video in MP4 imported in Blender doesn't work. I can see the video in the preview, but when I render it, it is transformed in a single image.
I created a new project, selected the camera, and then drag'n'dropped an MP4 video in the viewport.
I created a new 3D object that rotates in front of the video.
The 3D object renders correctly, but the video doesn't play.
The video plays correctly only in preview mode.

Can you add details to your question? Like how did you import the mp4, as a plane or a sequence in the VSE or in the compositor or what?

@wilks I update question

After editing the question to make it more readable, I believe the issue is actually that the user used a background video, which isn't renderable. See https://blender.stackexchange.com/a/38464/53447 So I must close this question as duplicate, Though I doubt the author would come back 4 years later to check if it is indeed the right answer or ask for reopening x)

I'm guessing your output information is set to an image output.  You need to change it to a video output in the properties panel (see image below).  Then hit Render > Render Animation.

You also may need to change some audio settings, which I would need to research to remember how.


text:
Anyone know how detect what vertex are in the edges of a mesh?
Anyone know how detect what vertex are in the edges of a mesh?
I want math code, not a user interface procedure.
Really, I want the same function that Blender has when you select an object and you can see a small "focus" color around all the silhouette of the mesh.
Any idea, or advice (including where is defined the focus in C code) will be welcome.

It is unclear to me what vertex in edges means. The selection code should be in
EDBM_select_pick, view3d.select Operator

Do you want the projected 2d silhouette?   http://blenderartists.org/forum/showthread.php?283721-Mesh-Silhouette-My-first-Bmesh-Operator&p=2529842&viewfull=1#post2529842  http://stackoverflow.com/questions/1014293/2d-outline-algorithm-for-projected-3d-mesh

@batFINGER Yes, I want  project a silhoutte..I'm going to look at you suggestion.

Freestyle has a silhouette option for outlining, in source/blender/freestyle/intern/view_map you will find Silhouette.cpp and SilhouetteGeomEngine.cpp which might help. I expect draw_mesh_object_outline() in drawobject.c would be the place that draws the outline but you will need to trace it back to find how it generates the derived mesh sent to it.

The Blender Compositor can

Identify, Blur or Dilate, a Pixel Selection to produce a silhouette.
The Pixel Selection can be a Rendered Object

Freestyle can outline objects as well

The above was done with Freestyle


text:
Vertex position for linked object with armature
I want to get the final position of a vertice with an armature. I know how to do it in a local object, but the problem is how get the final position if the mesh is linked in the scene( the typical character linked with proxy in a scene)
I can get the initial position with this code, but whithout the armature modifier.
import bpy

a = bpy.context.object
if a.type == 'ARMATURE':
    grpname = a.proxy_group.name

    grp = bpy.data.groups[grpname]
    for o in grp.objects:
        if o.type == 'MESH':
            print(o.name)
            data = o.data
            for v in data.vertices:
                print(v.co)
        print("===================\n")
else:
    print("No armature selected")

To get the final in local I have used:
  apply_modifiers = ['ARMATURE', 'LATTICE']
    for m in myobj.modifiers:
        if m.type not in apply_modifiers and m.show_viewport is True:
            m.show_viewport = False

    # Apply modifiers
    me = myobj.to_mesh(scene=context.scene, apply_modifiers=True, settings='PREVIEW')
    myvertices = me.vertices

After ask the question, I had an idea:
import bpy

a = bpy.context.object
if a.type == 'ARMATURE':
    grpname = a.proxy_group.name

    grp = bpy.data.groups[grpname]
    for o in grp.objects:
        if o.type == 'MESH':
            print(o.name)
            for m in o.modifiers:
                print(m.name)

            # Apply modifiers
            me = o.to_mesh(scene=bpy.context.scene, apply_modifiers=True, settings='PREVIEW')
            myvertices = me.vertices
            for v in myvertices:
                print(v.co)

            if me is not None:
                bpy.data.meshes.remove(me)

        print("===================\n")
else:
    print("No armature selected")

You can use the same code that I used in local mode.


text:
Is possible to generate a preview material from python?
I would like to generate the preview of a list of materials. I could create a sphere and apply the material, render and save it in a loop, but what I would like is to use the internal functionality of template preview.
My idea is to get the image object of the template preview, and then save it as any image.
I have seen something about using a custom render, but I don't know where find more information.
I will appreciate any idea.

BlenderKit has a built in thumbnail renderer that does a pretty decent job, and the operator can be used quite easily in your custom script. The disadvantage of it might be the speed, since it renders a full cycles scene, unlike the preview that has obviously many optimisations and renders instantly.


text:
Does anyone have an example of template_curve_mapping?
I'm doing some test with template_curve_mapping.
I have write this code:
import bpy

class HelloWorldPanel(bpy.types.Panel):
    bl_space_type = "VIEW_3D"
    bl_label = "TEST"
    bl_region_type = 'UI'
    tag = bpy.props.FloatProperty()

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

        row = layout.row()
        row.label(text="Hello world!", icon='WORLD_DATA')
        row = layout.row()
        layout.template_curve_mapping(self.tag, "curve", brush=True)

def register():
    bpy.utils.register_class(HelloWorldPanel)

def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)

if __name__ == "__main__":
    register()

But it does not work.
I want to be able to define the change of one value from 0 to 1 in time, so the height of the curve would be from 0.0 to 1.0 and the width would be the frame number.
Where can I find an example or more information about the use of this control? I  have found only the use of this control in the sclupt mode, but no moree info.

Not sure if I missed this or ignored it but you would be interested in this answer.


text:
Plane is pink in shading mode
I was making a donut and went to the Shading workspace to apply random colors to the sprinkles. I did not do any work and went off after saving the blend file. Now when I reopen the blend file, I see my plane texture is gone and turned pink and there is somewhat a 3D world in the background.
How do I make it look like before, like in the video?

That colour means that the texture file is missing so presumably you've moved it since saving the blend file. the '3D world' in the background is the built-in HDRI which lights the scene in Material Preview mode .


text:
Baking a Mixamo animation
I'm trying to bake an animation that was created with Mixamo, but it doesn't seem to work. I'm getting no errors, and this is my workflow:

I select the armature and switch to Pose Mode.
I select all the bones to bake.
I go to Object menu, then Animation, and choose Bake Action.
In the Bake Action panel, I checked Visual Keying and Clear Parents. I select Pose for Bake Data.
I click OK to bake. No error.
I go back to Object mode, select the mesh, go to the Modifiers tab and remove the Armature modifier.

The pose is lost, and there is no animation. If I apply the modifier instead of removing it, it keeps one pose, but loses the animation as well.
What am I doing wrong?

Hello could you please share your file? https://blend-exchange.com/

Sure! Here it is: https://blend-exchange.com/b/wm4VJzBm/

weird, it works fine for me

Can you tell me if you follow every step I outlined above, or did I miss a small detail or do something different? Are the settings the same? Thanks!

yes, I follow the same steps: https://zupimages.net/up/24/39/byop.gif

Okay, but do you also remove the Armature? Because that's when it starts to mess up for me.

Remove the armature? Why do you want to remove the armature? Baking the animation of the armature just creates a keyframe per frame and allows to get rid of the constraints but you still need the armature

I want to remove the armature, the skeleton, because the model's purpose is to be a game asset in an RTS game where hundreds of these will walk around at the same time. Losing the skeleton is an optimization effort.

if you move the armature the object won't move anymore, unless you move it with shapekeys for example but I doubt you can export shapekeys

When you export as FBX an animated character, the Armature modifier has to be present. If you want to export pure animation data you have to choose Alembic format (.abc), but it's not an optimization, as every frame is stored as an unique mesh, and it's useful only for exporting difficult scenes (simulations, particles, hair, ...)


text:
How to generate procedural textures for pebbles/round stones?
How to generate textures like the pebbles shown below procedurally in Blender?

To be clear, you mean the textures of the individual rocks and not a texture of rocks, yeah?

Yes....textures of individual rocks please.

Hi. Please use a title that matches the content of the question. It should be descriptive but succinct, unique and identifying, summarizing the issue so that anyone searching for a similar problem is likely to find it. Remove anything superfluous, avoid using words like "this", "help with", "issue" or "question about", instead describe what "it" is. Remember, your title is the first thing potential visitors see, answers you get depend heavily on how insightful it is. See What is the problem of asking “How do I do this?"

I found this jpeg file on my old computer that I had not used for a long time. This is a render of a POVRay scene file authored  by Jonathan Hunt (2008). Have any of our Blender experts experimented with POVRay in the past?


text:
Unable to make stairs larger in width while keeping the same pattern
I have downloaded some stairs block and for my project I need to modify them. I need to make them wider, but keep the shape of the steps. When I try that, it makes my stair steps larger in width but it completely destroys the shape.
Does anyone know how to fix it?
File of Stairs
Here you can see the left and right posts of the stair block used to attach the steps. The bottom step is the original size. The step selected I've tried to scale.

It seems you can't scale the block in X direction without scaling also the grid (the pattern ?). To make it larger, you probably have to cut it in 3 parts (left, middle, right). Then you translate the right part and you duplicate the middle part as many time as required to fill the gap.

@StefLAncien you're right. The unselected stair step is the original and the selected stair step is a try to resize it in X direction. It gets stretched because it's one mesh part. (The blend file is accessible now.)

From the Blender file, it appears that instead of scaling, in Edit Mode, you can select all the faces of the right hand side of the stair step, then move these in X direction until the right post. The "bars" will be elongated. After that, you have to duplicate the small cylinders. Using an Array modifier might greatly simplify the task. Just ask if you need a step by step answer with pictures.


text:
Bulk Texture Baking of multiple models in Blender
Is there any way to bake the textures of the 1000s of buildings using any plugins or python scripts in Blender?
Each building has two models:

High poly model and
Low poly Model

I want the textures to be baked in bulk instead of selecting the 1st building - baking the textures of both high and low model and then repeating the same for the rest of the 1000 models. This gets tedious for manual work due to the quantity of models.
All bake setting are set for high and low poly models. I am looking for a solution that:

Selects the first building of both models(high and low) and bake the texture
Saves the textures on the hard disk and starts baking the next building models - both high and low.

-----_420 represent high poly model
-----_420.001 represent low poly model

Yes, you can write a Python script that loops through all objects in the collection, then selects the high-poly and low-poly, and bake an image texture. But you also need to make sure there is a bake target in the material for each object. Or you need to script that, too.

What do you mean by "baking" - exporting. Is this a simulation?
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.

@RumenBelev this question is about automated texture baking. It's described in the last paragraph. The screenshot shows the settings for baking the Diffuse color of the selected objects (high-poly to low-poly). But the question lacks a bit of info about the prepared(?) materials and what to do with the images. Is it enough to save only the images or should they be used in (new?) materials after baking?


text:
Problem with Boolean Mod
I used the Boolean Mod to create precise shapes, but for some reason one side does not work while the other one does.

 here is the File

Hello, have you tried the 2 modes (Fast and Exact)? Maybe share your file? https://pasteall.org/blend/

I added the file

Choose Solver > Fast, sometimes it works better than the Exact mode. Also maybe recalculate the normals of your boolean object (there are flipped normals).


text:
Create an Array of Mesh Conforming Curve that has a Start and End Point using Vertex Groups via GeoNodes
I want to create a curve that shrinkwraps to the mesh but the curve has a start and endpoint defined using vertex groups. The curve has to also
be able to array in the mesh but it will not spill out of the boundary.
Green boxed vertices is StartPoint.
Blue boxed vertices is EndPoint.
Image 1: The Yellow is the Curve and the starting point of the Curve.

Image 2: The curve is arrayed but is limited by the mesh. Higher numbers will work but the curves will be squeezed in order to fit the mesh.

I have tried what I know and failed to create this in geonodes.

Edit 1: It seems there are some misunderstanding due to my bad explanation. I will provide further explanation
Let's say there is this plane. In the plane, I will select a row of vertices and mark it as a vertex group named Start, and select another row of vertices then mark it as a vertex group named End. This vertex group will determine the starting and ending point of the "Yellow" curve.
Now, I have to make the vertex group "Start" as a curve so it can be divided procedurally using [subdiv node]. So, I used a [mesh to curve] node, plugged the geometry in, plug the vertex selection in to the "selection" socket on the node, and expected it to turn the row of vertices in to a curve. It didn't because it also included the the neighboring vertices which isn't even marked as a vertex group. I'm stuck with that problem since it's the same as the "End" group.
Here is an image of the problem:

Edit 2: I'm now able to connect the curve on the start and end point but I need to make it the same with the other points. Doing it manually wont work since new points will be added procedurally using subdivision.

Blend file: https://filebin.net/pb8q7sjrb9nk55qo/kami.blend

i dont know how this is even going to work with out snapping the ends

Could you please clarify why you show a uniform mesh here, and then suddenly want to connect vertices that do not have a uniform structure? It is hard to answer your question until it is clearly stated. Please share your blend file with us.

@quellenform I put the file in the edit. It's pretty much what I had in mind but the only problem with it is conforming it. The solution I used is glitchy.

Please be more specific about your problem or provide additional details to show exactly what you need. The way it's written now, it's hard to see exactly what you're asking for. Thank you!

After working through your question, the following question emerges:

How can I convert the vertex group "Start/End" into a curve?

The answer is easily given:
You would just have to filter out the geometry to be converted into curves before applying Mesh to Curve:

Mesh to Curve interprets the selection not in terms of Points, but in terms of Faces. But if you separate the points beforehand, you will get the result you are looking for.
There is another possibility, where you first apply the node Capture Attribute to the domain points: Scaling only the selected vertex group in geometry nodes
...whatever you mean by "array" is not clear to me, however, because according to your image, the individual parts are not identical. But that is another unsolved question.

But since I already gave this answer before you specified your question, and I think this answer is just nice, I'll leave it anyway:

Here is a 100% procedural solution to your issue:

The issue with "Vertex Groups" is honestly not clear to me though.
I think you should be able to get along here also completely without Vertex Groups.
Here I create the mesh with two curves.
I create the two crossbars from the profile curve by resampling them to two points, extruding their vertices and extruding a square profile along those new curves.
I create the individual struts by resampling the curve along which the objects are to be instantiated.

the curve does seems to fit(squeeze) when array. but making the plane procedural isn't my intention. the plane is to act like some sort of lattice since the curves is going to stick in it. My skills in explanation is bad, sorry.

I made an edit of the post

I forgot the named attribute node existed...

im trying to figure out how to get the position of the vertex or points

@SaiKei Just subdivide these curves with Resample Curve and then get the positions with the node Position.

I was able to subdivide it using mesh to curve > subdivide curve. I'm not stuck with a new problem I just wrote on the edit.

connecting to points works using this
I now need to make sure it shrinkwraps/conform


text:
Any ideas on how to recreate this part of the electric fan?
I'm trying to make an electric fan (learning on blender) but I have no idea or whatsoever on how to recreate it. Here's the image below (the red outlined parts are the ones I wanted to recreate):

To make it easier here is a file with the original reference image attached to it (don't know how to paste blender files here):

A solution I once tried was to select 2 faces from the 4 locations i.e. North, South, East, and West. But the alignment of the vertices does not match one another and even if I align it the mesh itself would look weird and I wouldn't want that.
Anything is helpful, thanks!

use this to share blend-file https://blend-exchange.com/

You need to run File > External Data > Pack Resources in Blender before uploading the file otherwise the reference image won't be included.

You can begin with a circle with a number of vertices that is multiple of 3 (here 18 vertex circle), keep only 1/6 of this circle, mirror it:

Array it with an object offset that is rotated 120° on Z:

Cut a hole and work its shape, change the topology:

Extrude up, make sure that there is no inner faces:

Hide the bottom faces and round the top with the Proportional Editing on:

Unhide the bottom, create some bevels:

I'm confused on how to keep only 1/6 of the circle and I'm also wondering how did you do the loop cuts on the 1/6 circle, can you explain it to to me much more clearer?

I create the circle and create some loopcuts, then cut off the 5/6 with the lasso tool for example

That worked, but did you use knife cut to create new vertices on 1/6 circle? I'm just wondering since that worked.

sure, in order to change the topology, I've used the knife  ;)

start with a cube, delete parts of the cub so you end up with one quarter of the cube (we will use the mirror modifier to get the deleted part back). Inset the top and bottom part, delete the face of the inset. fill the hole you have in the cube. Add two loop cut so you have more geometry to work with. Add a circle, use the circle as a guide to move the geometry in order to get a quarter of a circle. move some vertices to have an equal thickness along the rim. add some loop cut to help define the edges (for the subdivision modifier). You can use the vertices on the straight parts of the hole to add some curvature by moving them (see picture 2)
Here is the step by step:

Cool, except... OP's shape has 3 holes, not 4. So it needs to be a third of a shape, not a quarter.


text:
High Poly modeling pinching in corner
I'm working on a high poly Lancia Fulvia but struggling with some pinching in certain places of the model and I'm not sure how I'm able to get rid of this.
I'm guessing there's a better way for me to support the corner but I'm not sure how.
Any ideas?
Edit: Added part of the mesh + one of the better real life references I have of this part of the car.
Link to the blend file of the mesh:
https://drive.google.com/open?id=1R--psoI6_bRXm2XUXirzrJIQ-EjBV3dI

maybe share this part of your mesh and also a picture of this part of the real object

@moonboots edited the original post, added one of my better references of the top of the hood and added a blend file with the part of the mesh where the pinching is occuring

I need an authorization to download, could you use https://blend-exchange.giantcowfilms.com/ ?

I've realized that since the inner corner is very slightly lower (in my mesh) than the edges on the outside pinching is inevitable in this corner.

Actually this part seems rather flat if we judge from your picture, so I guess it would give something like this:


text:
How to build a scene with Curved World effect
Is there a way to have a curved world like Death Spank or Animal Crossing?
This effect used to be called Rolling Log Effect (by Nintendo) also World Bending Effect is another name.
This effect is a world shader feature, not a modifier or mesh-base effect.
The whole idea is like a curved sight of camera instead of having straight one, the world elements are going behind the horizon like it rolls.
There are some tutorials for Unity, they do somethings with Graph shader there, semi-equal to World Shader of blender. But even any kind of script is appreciated too! XD
Examples: [left is Death Spank and Subway surfer (this features a vertical bending effect), right is Animal Crossing]

I've found an article for this in Blender Artist forums and a user suggested a script, it is for version 2.1 of Blender I guess, and for the period software had Game engine feature, while it doesn't anymore.

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

I guess this could be done with a displacement shader.. Do you want the rotation in World Space (Fixed rolling log) or Camera Space (View-dependent) ?

Camera space (I guess), there is no mesh tessellation or deformation needed, mostly in video games I mentioned, where poly count matters, but here I want same result in Blender, which is a 3D design software.
If there be a solution, scene can be rendered fast in EEVEE, with an optimize low poly scene.


text:
Crashing after couple of hundred frames rendered
Blender crashing after some hundred or lesser frames gets rendered.
I have to re-open file, re-touch frames range and keep on rendering!
Fixes I experienced before and did on this file and failed:

Checked subdivision levels and lowered them all. (did well on render time but still crashin!)
Checked camera clip range, which I faced in other projects, when it's clip end is too large, it makes a lot of ram to use and causes crashes. (not worked)
*Checked if there is very large textures exists (almost all are procedural), no!

specs: intel-corei7-7700, 16gb ram, GTX1060 6gb, SSD, Window 10, everything is updated
Here is the Log file

Hard to tell remotely, but are you rendering into a shared directory, like Dropbox?
Also: untick overwrite, you don't have to adjust the framerange everytime

No, the folder is a separate one, not shared anywhere, and hey, thanks for the hint on Overwrite thing, really appreciate!

I don't see a way to PM you. Can you find me on BlenderDiplom.com? I am working on a render helper that restarts Blender on crash and tries to finish the animation. I could give you the beta version, so you could help me test it. So far it's windows only, but I am porting it to linux and mac as well.

The problem is gone by updating to 3.4.1!
I had problem in all kind of rendering workflows: crash to desktop in Compositor, Sequencer and Scene itself!
Now it all gone... seems like the stability is raised a lot in this version, also rendering time increased (I use EEVEE in this project).


text:
Cannot enter edit mode after moving item to another layer?
I just duplicated my model and moved it to a new layer to sort of 'save' a copy of it and now I can't enter edit mode?
You can reproduce this by opening a new project and duplicating the cube via Shift+D and then move that cube to a new layer. Once that happens you're no longer able to enter edit mode. Why? How can I maintain a copy of my model on another layer and edit the current layer?

To enter Edit mode the active Object ( not an : Empty, Camera, Lamp ) should be on a visible layer.

I just tried to reproduce the steps you took and had no problem. I duplicated the object (shift + d), moved the coppied cube to the 2nd layer (m then 2, not plus), then clicked on the original cube (on the 1st layer), and hit tab. Not a single problem along the way. What version of Blender are you using? I was actually having some issues with the latest version and had to roll back to 2.73 (alpha build). You may want to try that and see if that fixes it. If you're on an older version, try upgrading to a newer one, but simply coppying an object and moving it to another layer should have no impact on your ability to edit the first object in any version. Could be a bug or something else going on on your PC too.


text:
How to make a fluid animation cycle?
I have made a cog wheel and am trying to animate it into a full 360 degree spin. Since I am only spinning the wheel across the Y axis I didn't feel that any armature or bones were necessary.
I'm having issues, though, with getting the animation cycle to be fluid. The keyframes and rotations are as follows:
1: 0 degrees
1/4: 90 degrees
1/2: 180 degrees
3/4: 270 degrees
last: 0 degrees
This has the unwanted result of ending on the same rotation that the animation starts, which as you can guess causes a 1 frame glitch in the animation where the frames are the same. I don't know exactly what the rotation should be 1 frame from being back to the start.
This seems like a very common problem, and I would presume occurs in walk cycles or any other animation sequence. What is the fix for this?
Can you ignore the last frame in the animation cycle, but use it to set the values (IE: define the last frame to be 0 degrees, causing the animation to animate to that end, but never reach it, as the last frame would become the first frame of the next iteration)?

I'm a little curious as to why you didn't try what you mention at the end of your post as you seem to have answered your own question.

@RayMairlot didn't try what? Hiding the last frame from the animation? I'm not really sure how that would work. Is that a setting somewhere?

@RayMairlot This does look like a duplicate. It sure is challenging to find what you want googling stuff in Blender. There are so many different ways of expressing the same problem.


text:
How do I make two objects pull toward each other in a zero-gravity scene?
I have two spheres in a zero-gravity scene. I'd like for them to gradually float toward each other until they collide. This makes sense, since in real life everything has its own gravity.
I have removed the gravity from the scene and created two rigid body objects, with a very high mass, but they just remain static and never float toward each other.
I can add a Force Field to one with a negative value which pulls the non-force fielded sphere toward it, but if I add a force field to both spheres, they again remain motionless.
How do I set up a scene so that both spheres react to each other's gravity?

Related: Magnetic Spheres and How to simulate magnetism In Blender?. You don't have to worry about disabling the gravity, it is considered just as a global force field on the 3D space. It wouldn't bring in the Newton's law of universal gravitation behaviour anyway.

Also see: http://blender.stackexchange.com/questions/42109/electromagnetism-simulation/42180#42180 , this shows how to make bodies attract and repel each other.

To make the your rigid bodies attract in your scene (assuming you already added your rigid bodies), you need to do this for each object:
1- Add a Force Field: In the 3d view, press ShiftA > Force Field > Force
2- Make your object the parent of the Force Field: Shift + Right click on the Force Field, followed by your object (The order is important) > Ctrl+P > Parent
3- Make sure your origin is on the center of mass of your object:
Select your object, then in the tools panel, select Set origin > Center of mass
4- Align the Force Field to your object: Click on your object > Shift+S > cursor to selected, Click on the Force Field > Shift+S > Selected to Cursor
5- Modify the settings of the Force Field: In the properties panel physics tab, you can find the settings for the force field. By deafult, the strength is set to a positive value, which will push objects apart. To make them attract, input a negative value. Note that massive/distant objects will require a lot more strength to be effective.
Repeat this process for every object in your scene, and you will have your magnetic attraction the next time you click play.


text:
Can I lock the viewport to always jump to what is currently selected?
I have a set up with a number of orthogonal viewports, and I would like them to jump to whatever is currently selected. I know I can press 'View lock to selected', which moves the viewport along when I move an object, but if I start to work on another object, I have to issue the command again for every viewport.
So far the closest I've come is to go to the properties of each viewport N and under View, select 'Lock to cursor' (which locks the view to the 3d cursor) then ShiftS and 'Cursor to selected', which is reasonably easy. But can I just make it lock to (and zoom to extents of) whichever object I have selected?

Note that there is a keyboard shortcut for locking the view to the selected object, ShiftNumpad . (Not sure if you knew already or not, but It might make your workflow faster)
Python:
You could use the python api to create a simple script to lock the view to the selected object for all 3D views:
import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for space in area.spaces:
            if space.type == 'VIEW_3D':
                if space.region_3d.view_perspective == 'ORTHO': # if view is orthographic, do the following:
                    space.lock_object = bpy.context.object # Set the view lock object to the active object

Here is the above code made into an addon based on the addon tutorial in the Blender API reference:
bl_info = {
    "name": "Lock all views to active",
    "category": "3D View",
    "description": "Sets all the 3D views to be locked to the active object",
    "location": "Ctrl+Shift+Space",
}

import bpy

class ViewLockAll(bpy.types.Operator):
    """Lock all views to selected objects"""
    bl_idname = "view3d.lock_all_to_active"
    bl_label = "Lock all views to active object"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):

        for area in bpy.context.screen.areas:
            if area.type == 'VIEW_3D':
                for space in area.spaces:
                    if space.type == 'VIEW_3D':
                        if space.region_3d.view_perspective == 'ORTHO':
                            space.lock_object = bpy.context.object

        return {'FINISHED'}

addon_keymaps = []

def register():
    bpy.utils.register_class(ViewLockAll)

    # handle the keymap
    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
    kmi = km.keymap_items.new(ViewLockAll.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True)
    addon_keymaps.append((km, kmi))

def unregister():
    bpy.utils.unregister_class(ViewLockAll)

    # handle the keymap
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

if __name__ == "__main__":
    register()

You can install this like any other addon. It will create an operator called ViewLockAll and a keyboard shortcut CtrlShiftSpace for calling it.

Very nice! Is there a way to call it automatically when you select another object? And also to not lock the main view, just the orthogonal ones?

@DavidS. I'm not sure about automatically running it, I thought maybe you cold replace the select operator with an operator which would select then lock the views, but there doesn't seem to be a select operator? Anyway you can make it lock only the orthographic viewports by checking view_perspective first. See my edit.

You could probably experiment using this with what you have tried so far but if I am reading your question correctly, instead of your current workflow you could achieve something similar sans the single step a script would solve by just zooming to the object once you are in that viewport.
Just select the object and press Numpad. (period).

As far as I'm aware there is no way to do this currently without using some custom Python code.
As I'm not a Python programmer the most I can do for you is tell you the basic logic for that, but that's about it.
You would need to write a script that is called upon object selection, and changes the view lock to the selected object.

Interesting to know that it can at least be done. I am a programmer but I have very limited experience with Python and no experience with Blender's API.


text:
How to exclude objects from cloth's collision?
I have a bed in a room with lots of objects. I'd like to put a sheet over the bed by simulating the sheet as cloth falling over the bed (which has collision enabled).
Problem is, I have many other objects around the bed which has collision enabled.
I tried to hide everything except the bed and the sheet, but the sheet is still affected by the collision of the other objects.
I would prefer not to move the bed out of the way, nor disable collision on the other objects because I need it for other simulations.
Is there a way to specify or exclude objects that the sheet can collide with?

Yes. This is possible with Collision groups.

Make a Group of the objects you want the sheet to collide with. (select objects and press CtrlG)

Set that group in the cloth collision settings for the sheet under Cloth Collision > Collision Group:

Now the sheet object will only collide with the objects in the group Bed.


text:
Stacked objects fading but shadow stays
I want to make a stack of objects fade away but in my stack of five rectangles fading goes well but after the third fade, the shadow of the faded objects doesn't go away. How can I make the shadows fade too?
Here's visualisation of my problem ->

I was animating the alpha channel in the materials property but the shadow doesn't fade. To fix that I had to animate the visibility properties on each element in -> Object Properties > Visibility.

The solution is to check Transparent Shadows, at least in Blender 4.1 (Cycles). You can find it under Properties > Material > Settings > Surface. The shadow fades as the object becomes more transparent or as the alpha value changes."


text:
Polygon shape with smooth curved face
I am trying to make a polygon shape (hexagon) with a curved face, but I can't smooth out the actual edges of the mesh. . On the left is the mesh before (Shade smooth). On the right is the result I am trying to achieve (shade smooth applied) but as you know shade smooth is not changing the mesh. I want to get a smooth result similar to shade smooth but to be applied on the mesh. I have tried subdivision surface modifier with different options like simple and Catmull-Clark with keeping corners ( because I want the shape to be a hexagon, but unfortunately, it gets distorted. I have tried to subdivide, bevel, edges, and vertices in edit mode, but I couldn't get results similar to the shade smooth (right hex). The desired outcome is hexagon shape with concave surface like this

Would you mind sketching what you want the shape to be and adding this as image to the question? Do you just want the edges to be rounded off a bit, like beveled? I mean, what exactly am I looking at, is that a cone viewed from its top? And you want to smooth the top?

It's distorted because you're using triangle topology which is not suited for the subdiv algorithm

@GordonBrinkmann does that bring more clarity?

@Gorgious Well I want a hexagon shape with concaved surface. How can I achieve it in Blender?

Create a cylinder with 6 sides:

Crease its edges - Shift + E -> 1 in edit mode

Add Subdivision Surface modifier with a few subdivisions, extrude a face and un-crease it with Shift+E -> -1. Extruding out is easier to see:

Use bevel operation Ctrl + B, then adjust it to be 100% and have a few segments:

Scale it to some negative value like -0.4 by hitting S -> Z -> -0.4:

Using snap functionality snap it to place:

You can also dissolve some edge loops with Ctrl+X to make the transition smoother:

You could do it with boolean modifier and a scaled sphere to match your drawing exactly, but then it's like this:

I am not sure this is what you expect, but you could do it this way. It would be better if the sphere used for boolean had number of segments that would be a multiple of 6, so the edges match nicely.

Martynas you are great! Edge creasing and subdivision surface got me the desired result, and great knowledge about edge control when using subdivision surface!


text:
Blender 3.0 Missing "Translate" Options
In older versions of blender, there were more options for translating (using the default "G" hotkey) than there appears to be in the current version.

How do I get these back?  Particularly the axis constraint checkboxes.  I use those very often to quickly check how subtle movements affect things on certain axis and how they compare to other axis to simply entering '0.0' as a value after the fact isn't acceptable.
Edit: To Clarify, I know how to constrain the axis being affected during movement, I need to be able to do this after the fact, like you could in older versions of Blender.

you can constraint axis by pressing "g", then pressing x or y or z. if you want to constrain on two axes, such as the x and y axes, you can do Shift + Z. What do you mean by "how they compare to other axis to simply entering '0.0' as a value after the fact isn't acceptable."

I know how to do that, I need to be able to change the locked axis after the fact, and be able to switch between them (which is why entering 0 for axis I want to be temporarily unaffected wouldn't work)

The "additional options" for the move (G) shortcut are in the Operator Panel (bottom left) after you perform the operation. There are also transform/translation statistics and options in the Item Tool Panel (N), and the Object Data Properties (right side tab). As for the constraints, as Gunt.r mentioned in the comments, axis are restricted by pressing the letter key of the axis after G (move) - you can exclude an axis by holding shift before pressing its letter. Axis constrained movement can also be aided by holding in the middle mouse button (click the wheel) as you move:

I know how to use the hotkey.  I am asking how to get the apparently removed options back.  I need to be able to constrain the axis AFTER the initial move, not during.  I would just use the hotkeys in those cases


text:
Can i bake textures when there isn't a principled BSDF?
I have a material, where there isn't a principled BSDF, Can it be baked? If so, then how?

what the material looks like when it is applied to a plane

Yes, like any material. What are you trying to bake exactly?

I'm trying to bake the material in the pic I attached. Its a transparent material with black lines, but I don't know how to bake it because the only way I do know is when there is a principled BSDF . I'll edit my post and attach a picture of what it looks when it's applied to a plane, in case you're curious.

You can bake the output of the brick texture which is a mask for transparency.
Just plug it into an Emission node (or directly into the Material Output node. Blender will use an Emission node internally to convert it.) Then add an Image Texture node for the image to bake and select it. Choose bake type Emit and bake the mask. Don't forget to save the image.
The baked mask can be used for the Mix Shader node that you have as a replacement for the Brick Texture node.
Or create a new node setup with just a Principled BSDF node and the baked image texture. Use the image for the Alpha input and set Base Color to black (=the diffuse color).

I tried it and it works perfectly, Thanks a lot Blunder :))


text:
Making a custom node for geometry node in Blender 4.1
I want to make a custom node in Blender 4.1
This is what I have so far but it doesn't seen to work as I can't find it.
import bpy

# Custom node type
class MyCustomNode(bpy.types.Node):
    bl_idname = "MyCustomNodeType"
    bl_label = "My Custom Node"
    bl_icon = "NODE"

    def init(self, context):
        self.inputs.new("NodeSocketFloat", "Input")
        self.outputs.new("NodeSocketFloat", "Output")

# Register and unregister functions
def register():
    bpy.utils.register_class(MyCustomNode)

def unregister():
    bpy.utils.unregister_class(MyCustomNodeTree)

if __name__ == "__main__":
    register()

Eventually I want this node to do something but I want to get this right for now.
also I could prefer the node to appear in input/constant.
If someone could help me with that. I will appreciate it.

Geometry nodes are written in C++ not python so unless you're prepared to recompile Blender I think you're out of luck. There's a fairly old basic tutorial here.

Yeah I saw that but I was hoping that they would have a python version like for the shader nodes.
Thanks

I'm no expert but I don't beleive there's even a way of creating a shader node from scratch with python. The only comment I've seen about shader nodes is this one from Brecht who is a Blender developer.

Is there a way to create custom Node types or Nodes Categories using Python?

You can write OSL shader nodes, but this will limit you to using CPU. You can write custom nodes, but these will have to be used in the context of a new node editor, not an existing one.

In response to one of the comments: I’m not sure how much you can do, but I created a simple node that returns the square of the input, and it works in the shader editor.
import bpy

# Custom node type
class CustomSquareNode(bpy.types.Node):
    bl_idname = "CustomNodeType_Square"  # Unique identifier for the node
    bl_label = "Square Node"  # Name that will appear on the node in the editor
    bl_icon = 'EXPERIMENTAL'

    def init(self, context):
        self.inputs.new("NodeSocketFloat", "Input")
        self.outputs.new("NodeSocketFloat", "Output")

    def update(self):

        # Check if the input socket has a value
        if self.inputs["Input"].is_linked:
            # If there's a connection, use the connected value
            input_value = self.inputs["Input"].links[0].from_socket.default_value
        else:
            # If there's no connection, use the value in the input socket
            input_value = self.inputs["Input"].default_value

        # Perform the square calculation
        result = input_value ** 2

        # Set the output socket to the result
        self.outputs["Output"].default_value = result

def add_custom_node_to_menu(self, context):
        self.layout.operator("node.add_node", text="Square Node").type = CustomSquareNode.bl_idname

bpy.types.NODE_MT_add.append(add_custom_node_to_menu)

# Register and unregister functions
def register():
    bpy.utils.register_class(CustomSquareNode)

def unregister():
    bpy.utils.unregister_class(CustomSquareNode)

if __name__ == "__main__":
    register()

However, I was after something more than just the square of the input; that was only a test. My goal is to make a node that can read values from a CSV file, similar to how you can use an image. In geometry nodes, not the shader editor.

here's the problem: https://i.imgur.com/VoLlM7k.gif

I think making nodes in python is limited. (I don't know) anyway I wanted to do it in geometry nodes but in there the node doesn't do anything. At least in the shader do something sometimes, maybe with some tweaks can work properly all the time.
Anyway I trying to do something different about reading CVS files and get the values to be able to use them in blender


text:
Different lighting on duplicate projects...weird
This project is duplicated, but it doesn't have the same lightning. I have tried everything almost…I am going crazy :( Please help!
Project files: https://easyupload.io/m/53jzah
Here is a render between the projects.
https://imgur.com/a/DFMPh1v
it is quite hard to see if you don’t save the images and then go back and forth between them.
Another one, images of rendered asteroids
: https://imgur.com/a/DQG6tBL
And one more , images of Ceres: https://imgur.com/a/EG1OrEb
What I have checked:

Light paths

world shader

compositor

subdivisions

motion blur

color management

camera, clip start - end

sizes of light

noise treshold

samples

material

textures

Hello, you haven't shared the images (the HDRI for example), also you link to images but you don't show any comparison

Hi :). The particle system seems to have a bit different distribution in each file. That could cause these changes.

The sun's Emission Strength in the first file changes from 8 at frame 249 to 2 at frame 287, while in the second it goes from 0 at frame 274 to 8 at frame 781, so at least the files are not exactly lit the same. In the first file the start/end are 0 to 2555, so the sun is a while at 8 but most the time at 2. In the second the range is 2360 to 4190, which means in that animation the strength is 8 all the time.

@moonboots, I have shared the images with comparison in opening post.

@jachym michal How can the particle system be different, when they are exactly the same?

@Gordon Brinkmann - However they are exactly the same from 0 and the other project from frame 838. Nothing else matters. Only frame 0 and frame 838.

@robeloto Yeah sorry, but which frames matter is not stated in the question and it is not obvious from the files. If I would hit Ctrl+F12 on both files to render the animations in the given frame ranges, they would have changing lights over the rendered frame ranges.

Its an animation and the seam stops at 838 and starts from frame 1 in other project and I cannot connect the 2 projects because blender sucks ass. No one can fix this. I knew it already so.

Check your Sun material Emission strength - the animation value is altered. Key frames are different. What you could do is pick your favorite version and import and assign  the desired animations from the other version.  Or simply start over with your animation.

@Rumenbelev , I know it is altered. However on frame 838 and on frame 0 in the other project they are exactly the same. Emission strength 8. We are talking about 2 single images here with same values, but still differs somehow. I say it is a blender bug. It is frustrating when people doesnt seem to understand my problem.


text:
How do I fix materials on sculpts?
I am making a sculpt and I want to add a material to it. But when I do the material doesn't show up right. I have no clue what to do and can't find out what to do anywhere

Have you UV unwrapped the model? Please note that high-poly sculpts are not suitable for assigning materials to them because the UV map will be huge and performance will be bad. Better create a low-poly version of it, then UV unwrap it, and bake a Normal map. The baked Normal map can be mixed with the material's Normal map. -- The Displacement map only works in Cycles. If you want to use it add a Subdivision Surface modifier on the low-poly version model. This increases the poly count again considerably, but only at render time.


text:
How to make a UV map for a Guilty Gear Style character? (Square UV Mapping)
Does anyone know how to make a map like this for my character? It's similar to the game Guilty Gear, which was developed by Arc System Works.

I tried to search but I didn't find anything I needed.
I tried to use Smart UV Project but it turns out it's wrong:

Can you share your Blender project file? Instructions for sharing.

The UV unwrap for the texture map that you show is very very unusual and simply not possible to do unless you have some experience with UV unwrapping. The UV seams on the model are determined by where you want inner painted lines to appear on the character. After UV unwrapping the outer edges of each of the UV islands are aligned to either the X or Y axis in the UV space, pinned in place then UV unwrapped a second time. This is done so that inner lines that will appear on the textured character will be clean, sharp  and with no jagged edges due to aliasing.

This form of UV unwrapping and texturing was used in Guilty Gear Xrd and a basic explanation of the technique can be found in this video at 24:16 and 38.47 https://www.youtube.com/watch?v=yhGjCzxJV3E  A little more about this method can be found here https://www.youtube.com/watch?v=RkHe29O6aOU This Video may be more interesting for you https://www.youtube.com/watch?v=okB8EUxPTKs

Another video by Royal Skies on Youtube https://www.youtube.com/watch?v=CEH51tkAle4

I’m voting to close this question because this is a basic Blender function rather than a unique problem, and is discussed directly in the Blender manual.

This is a very particular form of UV unwrapping which by definition makes it a unique problem.  :)  Yes the OP needs to first understand basic UV unwrapping before they can tackle such a project but I don't think that is a reason to make it an invalid question.

https://blender.stackexchange.com/questions/78358/how-to-straighten-curved-uvs-into-straight-belt/ https://blender.stackexchange.com/questions/74041/how-to-perfectly-align-uv-coordinates-automatically/


text:
How to have PointerProperty pointing at simple Integer Property in Python/Blender?
I'm trying to add a Pointer Property in my code that would be able to reference an Integer Property that exists on some data block of some object.
What is the proper way of doing it? I thought it should be as simple as the code below, but it doesn't work.
I do use PointerProperties a lot to reference specific object types etc., but I'm not sure how to point to a simple Int Property. How should I do it?
Thank you so much and I apologize if this is a trivial question.

import bpy

class Example_Class(bpy.types.PropertyGroup):

    int_pointer: bpy.props.PointerProperty(
        type=bpy.types.IntProperty,
        name="Int Property Pointer",
        description = "This is the pointer to Int Property that exists somewhere else",
    )

def register():
    bpy.utils.register_class(Example_Class)

def unregister():
    bpy.utils.unregister_class(Example_Class)

if __name__ == "__main__":
    register()

The error message is:
TypeError: PointerProperty(...) expected an RNA type derived from ID or ID Property Group
Error: Python: Traceback (most recent call last):
  File "\Text", line 20, in <module>
  File "\Text", line 12, in register
ValueError: bpy_struct "Example_Class" registration error: 'int_pointer' PointerProperty could not register (see previous error)

The Blender 3.x documentation is confusing and very vage about this because it tells you nothing about the type. If you check the old 2.79 documentation or enter bpy.props.PointerProperty( in the Python console and hit the Tab key then you will see ":arg type: A subclass of :class:bpy.types.PropertyGroup or :class:bpy.types.ID." - Basically the same as what the error message tells you.

IntProperty(Property) has the base classes "bpy_struct" and "Property". That's the reason why it does not work. So you probably need to encapsulate it in another PropertyGroup. -- Related question and an answer: https://blender.stackexchange.com/a/6977/107598

Ahh!!! Got it! Thank you so much!!!


text:
Why some objects won't show and selectable in Cryptomatte?
I have created some metalballs and animated them, and I need them to get excluded and masked in Composition, but I can't select them in any kind of matte: asset, material or object
The problem gets solved if I delete them and create new one; but I can't, because they got lots of animations and other things connected to them in main scene.
Is there anything maybe I've forgot or accidentally unchecked about them?!
[Picture below shows the picker in window that selects Plane behind the Meta!]

.
Blender File:
Download file with problem here in Google Drive

I doubt this will get solved unless you share a file with the problem. https://blend-exchange.com/

Link to download the file added below the image. thx

I don't know what I may changed in my material for that Meta object (Cloud object), but seems like the problem solved by copying all texture nodes into a new Material, re-setting up the Principal shader node and re-connetting all texture nodes there.
Now my cloud objects shows up in all three Cryptomatte options, Asset, Object and Material.


text:
Z fighting and mesh incorrect rendering in Eevee
I have a scene with these objects look alright in perspective view, but messed up in camera and rendering output! It's in Eevee.
Everything fighting and not rendering correctly! Seems like everything is mixed together! XD
non is Grease pencil, all is standard materials!
Any option or optimization may I forgot? Any fixes?

Could you please provide some screenshots so we can see the problem?

sorry, refresh the page and see the GIF!

Thanks, the problem is clearly obvious now :) I'm sorry I don't have any immediate thoughts on what might be causing this.

Have you duplicated any of the objects and left both visible?

Hey ppl, watch the answer, @Markus von Broady posted here! ❤

If your problem appears when you switch from Material Preview to Rendered view:  then it's most likely either a problem with your lightning setup (which by default is not used in the former and is replaced by 'default' lightning), or an Eevee vs Cycles problem. In your case it doesn't look like either of those.

If your problem appears when switching from 3D viewport to a rendered image, then it's likely a problem either with compositing or different settings for viewport and render, like subdivision levels or some objects hidden in viewport but not in render - especially the latter is known to cause z-fighting issues.

Finally if the problem appears when switching between a normal 3D Viewport view, and a camera view (Numpad 0), the problem is likely related to camera clipping settings. The larger is the camera clipping range, the further the middle of this range is from zero, and therefore its significant digits have larger magnitude. Basically, decrease the clipping range / make sure it's roughly the same as the viewport's clipping range:

Thanks a lot, the problem was last issue you mentioned here... Camera Clip Start, camera clip start was 0.001! I changed it to 1 and prob solved!
I wanted my camera to show very close objects, but solved the prob by apart it from close objects.


text:
How to create a particle with animation on birth and death of particles
I want to create an emitter that emits particles that they have animation on birth, and they die when animation ends, or their life ends after their death animation or smth like that!
Is there a way to make such thing, any way rather than animation node which I started to work recently?

animation nodes work in all versions. I don't know where you got your wrong info from. And if it doesn't work for you, i would suggest asking on github and open an issue for that. I got it installed even on 4.2 alpha....

so i would suggest you improve your question instead of writing wrong facts.

..or to put it more gently.. perhaps tell us what leads you to the conclusion AN is not working in recent versions, since at least one person can't reproduce the failure :)

I installed 4.0 clean, attempted to install AN, and blender prompted that uses old python version, so I gave up, but you answer light it up that works, so I change the qustion and follow the AN as well.
Thanks Chris

you can download animation nodes here: https://animation-nodes.com/#download of course - you have to choose the right version for your case (python version/computer etc). If this still doesn't work, you can compile AN yourself which is explained in the animation github infos.

also keep in mind, Blender python version is another (!) python version than you have on your computer. Blender has its own python version "inside". So just typing python -v won't help.

ok, here a very (!) simple example (unfortunately you didn't specify in any way how your animation should look like):

first i got all dead particles data via "particles data" node. Thankfully AN provides the locations for that. Then i save the die date (frame) for each object in custom attributes (frame start) in the subprogram "set die date".
Finally in subprogram "calc new loc" i calculate the new locations for the instanced particles (object instancer) via a very primitive formula: just adding some z-values to the die-locations.
The result:
The particles "lift up" after dying.

Update:
i just found out, that particles info has (!) already the die dates...so here is a much simpler way:


text:
How to hide backfaces trough transparent material?
First of thanks for taking a look at my question.
The problem
Please take a look at the following gif:

Instead of using a grass texture I made the grass transparent since the background video already had grass in it. This way the whole thing would match nicely in the final composite.
In the cliff on the left you can see the shadow of the backfaces moving through the transparent grass.
To counter this I made the backfaces transparent with the following node setup:

However, now you can see the frontface of the object trough the transparent backface.
Question
How can I hide/not render the parts of the mesh that are behind the transparent material/grass?
EDIT (further explanation)
Gif:

2 is the top of the cliff you can see in the first gif. '2' is partially transparent so it matches nicely with the plate (vid).
1 is the backface of the rock that you can see moving in the first gif. I want this to not be visible trough '2'. Making '1' transparent doesn't work, neither does changeing the transparency passes. Since 1 transparency pass will just show the back face again..

Hey @cegaton thanks for your interest. I added onto my question. I hope it's enough for you to understand what I'm dealing with. If not, please let me know.

I would try to prevent the awkward transparency from occurring there to begin with, not try to patch it afterward. I have a feeling that means modeling some grass. If you use colors/textures from the grass in the source video it should match nicely.

I did try that, it looks a lot better with the grass from the video poking trough (this ofcourse is entirely dependent on my skills on modeling the grass). If I can't find a way of hiding the backface of the rock I'll resort to adding some extra rocks on top to hide the clipping. But i'd prefer a solution ofcourse.


text:
Problems animating clothes
So I'm trying to animate a sort of cloth fan but I can´t don´t really know how to do it.

I've created an armature for the object and asigned it to the sticks. The problem is that I don´t know how to pin the cloth to each bone of the armature so that it animates properly. If I weight paint has I would do for a character, in the cloth simulation panel I can only pin it to 1 bone and if I create a vertex group with te vertex over the sticks the cloth simulation doesn´t animate properly, it becomes kind of rigid.
Any help?
Thanks.
Update: So I asigned a part of the cloth to each bone like that:

And created a vertex group where I pinned my clothing:

The problem now is that when I animate, the cloth moves "slower" than the sticks, it doesn´t move like bone is moving:

Edit: These are my cloth settings. The pinning group "cloth" is the one mentioned before.

I activated Dynamic mesh thinking that it would solve it (you know, it's a mesh that's moving, silly me), bu it didn´t.

What it looks like to me, here, is conflicting bone weights. Just a guess, but are you sure no other bone is influencing the same area? Are you sure that the ones that should be, are? The second "patch" of your fan should also be sensitive to the far bone to the right, not only the immediately adjacent one.


text:
Using 'Float Property Layers' value in Node Editor (similar to Vertex Color)
I have an object called origin with 272 meshes/faces and Float Property Layers (called random_layer), i.e. every mesh has a its own attribute. You can see random values in the Data -> Outliner -> Data API (see screenshot).
Goal: I want to use the values of the random_layer to manipulate shaders/nodes.
Already tried: To get the values, I tried to use the Attribute Node calling it with the name random_layer, or ["random_layer"], but with no luck. I tried to wire the the three output nodes, but all seem to output 0.0. Setting the name to Col (for Vertex Colors) works fine.
The object has a material ('TheOne') using a Vertex Color node, this is working.
I have searched and found this: Use custom properties (variable values) in the node editor
However, this is not actually using the values of the Float Property Layers, but rather the graph editor. Also, my values are static and not dynamic.

Any help or pointers are much appreciated.
Setup

Win10 Pro
Blender 2.81a
Engine: Cycles (also tried Eevee)
Add-ons: 'Node Wrangler' and 'Sun Position'

Update
just to clarify how the float layer is created. mesh_object is an intermediate object for one mesh/cell/face that you see in the screenshot.
random_layer = mesh_object.data.polygon_layers_float.new(name="random_layer")
random_layer.data[mesh_object.data.polygons.active].value = random.uniform(0.0, 1.0)

bpy.ops.object.mode_set(mode='EDIT')

random_layer = bm.faces.layers.float.get(random_layer.name)

Also I am using the experimental 2.82a

Using UV Layer

Example showing UVMap
Then use the UV Map node as input.

UV layers and vertex color layers are available to the attribute node by name. Not custom polygon float layers.  Be careful not to  name two layers of different type the same, (which you can) if you are going to use either or both as  node input.
Script that sets a float layer to randoms, then for each face sets the uv of each loop vert; u to the face layer value, and v to another random (or ...).
Can only have 8 UV Maps.
import bpy
from random import random
context = bpy.context

def get_mesh_layer(me, type, name="Float Layer"):
    layer = getattr(me, type)
    return layer.get(name) or layer.new(name=name)

#bpy.ops.object.mode_set()
ob = context.object
me = ob.data

rflayer = get_mesh_layer(me, "polygon_layers_float")
for f in me.polygons:
    rflayer.data[f.index].value = random()

uv_layer = get_mesh_layer(me, "uv_layers", "Random")

for f in me.polygons:
    u, v = rflayer.data[f.index].value, random()
    for l in f.loop_indices:
        uv_layer.data[l].uv = u, v
#bpy.ops.object.mode_set(mode='EDIT')

Note: needs to be run in object mode. Can be emulated in edit mode using bmesh. Simply wrapped it in change mode ops for screen shot above

please do not delete answer, yet

I had named both "Random"... it was always using the uv layer.. double stumped myself.  Looks like the UV could be the way to go.

Thanks @batFINGER. Couldn't I skip the float layer all together and assign my values to the uv_layer directly?

Definitely.  Added float layer only re q.

for example V in the UV Map has been set directly.  Give the UV Layer it's own name, not the name of the floatlayer (which was the cause of all my confusion lol) in code above and can ditch the float layer.