text:
Can't get armatures to work with loop cuts on mesh

I want to make the armatures on my mesh to bend the arms at their loop cuts, but when I do, even though the bone joints are in exact same place as the loop cuts, it moves the arms as so:
Here's the file.
Please help. Thanks in advance.

can you give the blend file ... from the look of it, upper arm bone is not attached to arm and arm bone is totally controlling the whole arm  mesh.

No, the upper arm bone works, it's just that when one arm bone moves, it takes control of the whole arm. But how do I give you the blend file?

look at https://blender.meta.stackexchange.com/questions/344/where-to-upload-blend-files-non-expiring-links for upload

If you add a loop cut or edit the armature after you parent the armature to the mesh you will need to adjust the weight painting, or re-do the parent to armature.

Thanks, sambler. That helped me out a lot, and it should go down to be an answer.


text:
Volumetric cloud not responding to emissive body

Hi I am trying to make an effect of the cloud being lit up by the emissive object, but it doesn't seem to be responding to the light whatsoever. If there anything that i need to toggle on or sth? Thanks a lot for help!]

Seems to me like it's interacting, where else is the glow effect coming from? If you want the cloud to respond more to light, use an absorbtion color that is not as dark.

the glow is coming from bloom. I want the cloud to be interacting with the light as i move the light around, like in a thunderstorm. Now the cloud is the same as before and after I hide the emissive rod. Thanks for your help!

Bloom? Your question is tagge cycles. This can't be done in Eevee

Its working now! For some reasons i accidentally turned the engine to eevee. Thanks a lot for your help!!

source: Stack Exchange

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

sort: votes


text:
Vertex snapping issue
Blender 4
Trying to slide an edge and have the vertex snap to nearest but the sliding vertex just slows down as it gets near the target vertex. I can do it the slow way and not slide the whole edge but this would be so much faster. What am I missing?

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?"

By default, the sliding is based on a percentage of the edge length for each vertex independently. The value goes from -1.0 (towards the vertex on one side of the edge) to 1.0 (towards the vertex on the other side), and 0.0 represents the original location.
Since the vertex on the right has a shorter edge compared to the other vertices, its movement will seem slower than the rest, but all of the vertices will reach the end of the edge at the same time.
Edge Slide has an alternative mode, Even, that will cause the sliding edge to take the shape of the edge loop before or after it. To enable Even mode, press E while the Edge Slide operator is active. To switch between the edge loops to match, press F (short for Flipped).
In summary, after triggering the Edge Slide operator, press E. If the edge is not shaped the way you want, press F.

Ahh, fantastic! Thanks so much, that solves it. Appreciate your taking the time.

You're welcome!

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


text:
Applying all transform to a scaled rig
Hi I’m new to blender and I had scaled a rigged character using the armature but when I try to apply all transforms to the rig, the character deforms to something weird. How do i fix this without having to redo the rig and weight paints?

If your rig uses no constraints or drivers, unparent mesh with keep transform, then apply scale on both armature and mesh, then reparent mesh to armature.  Not guaranteed in presence of constraints/drivers; depends on specifics of those.

The rig doesn’t use any constraints or drivers. So that means i will have to redo the weight paints?

No, you won't have to redo any weighting.

I’ve tried, i hit Alt+P > unparent and keep transformation. Then applied scale of mesh and later applied scale of Rig but it still deforms

I would have to see a file to tell you anything more.

The thing is that i have a rigged character that doesn’t have a face rig and so i made a face rig and i want to join the two but the problem is that I already scaled the rig to a smaller size because it was too big, so when i try to join the two rigs together the deformation bones of the face rig are deforming but when i tried to join the two rigs before i scaled the body rig, the deformation bones don’t deform. I don’t know if that makes sense. How do i share the file?

It sounds to me like you need to edit the question (and title) to provide all of that detail-- and even more.  It would be nice if you could separate the scaling issues, because then you could ask a clean "Why do my bones no longer deform the mesh after joining these two armatures?"  A good place to host files for Blender SE is at https://blend-exchange.com/ .


text:
How to access Shape Key Editor in Python?
I'm trying to access the Shape Key Editor via Python in Blender, but so far it doesn't work for me. I already know how to access the Action Editor via Python:
bpy.data.objects['rig'].animation_data_create()
bpy.data.objects['rig'].animation_data.action = bpy.data.actions["action_number"]

And I thought the Shape Key Editor might work the same, but it doesn't. Or at least I can't find the right code to do so.
I'm also aware that I can just use the direct way and set Keyframes like this:
bpy.data.shape_keys["Key"].key_blocks["shape_key_name"].value = 0
object_name.data.shape_keys.key_blocks["shape_key_name"].keyframe_insert("value",frame=0)

But this inserts "fixed" Keyframes that I have to delete every time I want to insert a new Shape Key-Keyframe at the same frame. So I thought the Shape Key Editor might be the solution, since it stores Keyframes like the Action Editor.
Does anyone know how to call upon a Shape Key Editor Action via Python in Blender API?

Current shape key action is in object_name.data.shape_keys.animation_data.action, which points to a normal Action object, same as for action editor. Only here the animation data is stored in fcurves with data_path values such as 'key_blocks["shape_key_name"].value'.


text:
Geometry Nodes. Find the center of a rectangle whether or not there are multiple vertices on one side

I'm doing some buildings and, as  some dimension varies, I found a way to center the doors and windows on specific faces selected via different materials.
However the door is "lifted" up. More verticies on the upper edge more the door is shifted on +Z Axis.
There is a way to stay at the center, the REAL center of that rectangle?

Mesh to Points—Faces node generates the points at the average of all of each face’s vertices, so when you add more vertices at the top edge of a face by dividing the neighboring face, you're adding more Z value to that position, thus moving it up. I'm not aware of a native, simpler method, so to get the real (mass) center of the face you need to do some math. Here's a setup that would calculate the center of mass for each face:

That setup's from user LordoftheFleas on BlenderArtists. Here's a slightly simplified, updated version courtesy of @Robin-Betts:

Here's the result:

I'm attaching the blend file so instead of re-creating the setup from scratch you can just append the node group "FaceCenterOfMass" and link it to your Mesh to Points node as you see in the screenshot.
Original version:
⚠ Updated version (Blender 3.3):
⚠ 2024-11-25 update
The .blend above assumes "Triangulate" node gives index of each face being triangulated to the first resulting triangle within that face. This assumption holds true for all Blender versions so far, but since version 4.0 official documentation explicitly states it is not guaranteed:
Blender 4.0 Manual: Geometry Nodes: Inspection: Geometry Randomization

The easy fix is to use the new "Sort" node in Blender 4.0, to sort triangles by captured face index. However this would make it impossible to create a tool working both in Blender 3.3 and the potential future versions changing indices. Therefore I [MvB here] decided to reimplement the setup in Blender 3.3 LTE.
2nd problem: the setup was assuming the original face area and sum of resulting tris areas are equal, but apparently it wasn't the case. Perhaps simply "Fixed" triangulation method should be used, but what I did is just accumulate the face areas the same way positions are accumulated.

Brilliant. When you've got a moment. can you give a brief description of the math you're doing?  Having trouble reverse-engineering.

@RobinBetts Found it: https://blenderartists.org/t/find-the-surface-center-of-each-face-geometry-nodes/1404276/2 If you can put it into words, I'm all ears. I can kinda sorta follow it, but get lost at the Accumulate Field node.

Okydoky.. Rebuilt for 3.3  with a slightly different transfer method (I prefer by index, if possible, so as to avoid a search though geometry for 'closest') . The group finds the center of mass of a face by finding the mean location of the centers of mass of its constituent triangles, weighted by triangle-area. I /you can pop in an edit, if you like. Just IMO, but I think it might be diplomatic to credit the original author of this one. There's no shame in that :) Well found, and nicely presented!

⚠ Robin's solution can start failing eventually: https://i.imgur.com/ilbCv6H.gif ⚠ This solution assumes first triangle of each triangulated n-gon keeps the face index of this n-gon. However this is not guaranteed to be true in future.

This also fails for distorted faces, e.g. Suzanne's face #162 has mesh distortion ≈ 150°: https://i.imgur.com/nxmpB88.png red is Robin, green is Don Hatch pure field solution

@MarkusvonBroady regarding your "2024-11-25 update" (edit #4)... it looks like your pic has a Transfer Attribute node, which is deprecated... but it looks like your blend file uses something else instead.  Either way, it looks like you switched back to some kind of "nearest" based transfer which I haven't learned yet (like LordoftheFleas's original solution?) which RobinBetts was trying to avoid (see above comment). Is there really no safe index-based way to aggregate a vector-valued face-domain attribute on a triangulation geometry back into a face-domain attribute on the original geomety?

(Heads up to to @RobinBetts who is probably not being notified of the recent findings in comments in this answer and mine due to inability to cc more than one person)

@DonHatch "Therefore I [MvB here] decided to reimplement the setup in Blender 3.3 LTE." - yes, the node is deprecated, fortunately it's automatically converted upon loading in Blender newer than 3.3 (even 4.1, so you don't need to save/load across 3.6 → 4.0 which is the general conversion procedure). Using the "nearest" for reverse mapping was pretty standard approach at the time. Nowadays you would use "sort" for that.

@MarkusvonBroady ah I see, thanks for explaining.  Ok, I think I'm starting to see how this "nearest" mechanism is being used... I didn't realize the thing it's selecting nearest of is an integer index (rather than a vector position, which would seem unprincipled and unreliable).  So, yeah, it's inverting the tri-index-to-original-face-index mapping, to get the face-index-to-tri-index mapping (and, since the mapping being inverted is many-to-one, it just chooses an arbitrary one of the possible choices as the inverse, which is fine).  Ok then I think I finally see how to fix my first solution.

@MarkusvonBroady you say 'Nowadays you would use "sort" for that, and in your edit you say "The easy fix is to use the new "Sort" node in Blender 4.0, to sort triangles by captured face index.".  How would such a sort help?  Maybe I'm slow today, but I don't quite see it.

@DonHatch old way And geometry randomization test (colors change, but mapping stay correct, notice I don't care which triangle of the pair I get, because in R.Betts' setup both have the same accumulated data). Using sorting: new way and test

⚠ The "Sample Nearest" node (what this solution's "Transfer Attribute [mode = Nearest Surface Point]" node gets converted to in > 3.3) takes time O(N² log(N)), i.e. worse than quadratic, i.e. really bad.  See my recent edit to appendix of my first answer for more details.

@MarkusvonBroady it looks like they have indeed changed the triangulation order in a way that breaks the old bad revisions of both this answer and my first one, in blender 4.4.alpha, in this change.   On a cube, old order: https://i.sstatic.net/nSkiySAP.png new order: https://i.sstatic.net/kZeyFGFb.png

@MarkusvonBroady the (formerly) quadratic behavior of Sample Nearest has been fixed!  So your solution here is now competitive (in 4.4.alpha).

Here is a second solution, that resolves pretty much all the things I was trying to do in my first solution.

All the "Capture Attribute" nodes are gone.
The "Triangulate" node is gone (that must be a relatively heavyweight operation when the number of vertices on a face is large, and it's not necessary).
The Geometry input is gone (and the Geometry output was already gone)-- so this is now a "pure field" node group (not sure whether I'm using the right word for that).
This also turned out to be a nice exercise and example of of walking around faces and doing computations on them in geometry nodes, using the "Face of Corner", "Corners of Face", and "Vertex of Corner" nodes.  I'll be using this for reference in the future.  [Edit: also incorporated suggestions from Markus von Broady in comments, pointing out how to use these nodes more concisely.]

Rough details of the algorithm
Like the previous solution, this solution's overall strategy is to accumulate the moment (centroid times area) and area, and to take their quotient at the end.  But this solution uses a different formula for the incremental moments and areas.  It does still triangulate in a sense; however it's a cheap O(n) trivial triangulation into a triangle fan from the polygon's first vertex.  (Mathematically, any point in space can be used as the hub of this triangulation; if the origin is used, then the calculations amount to using the shoelace formula projected to each of the three coordinate planes.  But using one of the polygon's vertices instead helps reduce numerical error in the case that the polygon is far from the origin.)  The weight for each triangle's centroid is the signed area of the triangle (more precisely, the signed area of the triangle's projection onto the polygon's best-fit plane, in a sense; that is, the plane perpendicular to the polygon's area-weighted normal vector, which is a well-defined thing for any polygon, even if skew).
This formula has the following properties for various kinds of polygons.

In the case of a non-skew non-self-intersecting polygon, the answer is the usual one, mathematically agreeing with that given by the more expensive positive-triangulation-based solutions.

For a self-intersecting non-skew polygon, this definition of center-of-mass is still mathematically well-defined and triangulation independent (unlike the previous method).  On the other hand, it doesn't have the nice boundedness guarantee of the previous method, and in fact it goes to infinity (in a well-defined way) as the polygon's signed area goes to zero.  In the case the polygon's signed area is exactly zero (e.g. a perfect bowtie quad), the formula will yield zero divided by zero, which blender will probably turn into the zero vector (I haven't checked).

For a skew (non-coplanar) polygon, like the previous algorithm, the answer is triangulation-dependent (in this case that just means it's dependent on the choice of "first vertex" of the polygon).
More precisely: if we decompose the answer into two components, by projecting it parallel and perpendicular to the polygon's normal, then the component perpendicular to the normal is well-defined and triangulation-independent (it is, precisely, the centroid of the planar projection of the polygon) but the component parallel to the normal is triangulation-dependent, which is unfortunate.  (Research problem: it would be nice to get some kind of best-fit formula for the parallel-to-normal component that is triangulation-independent even for skew polygons; I have some ideas for this.)

Here is the geometry node graph.  (Thanks to Markus von Broady for simplifications.)  I have added annotations wherever there is a graph edge corresponding to a concept with a clear name, so hopefully this is mostly self-documenting for anyone wanting to inspect it in detail.

The fact that this node group is now a pure field makes it extremely easy to use.  For example, it can be used as drop-in replacement for a "Position" node as the Position input to a "Mesh to Points" node, without any need to thread a Geometry through it:

(Blender 4.2)

OK, I analyzed this with exception of one thing: why the dot product part of the setup? Is it supposed to minimize the effect of triangulation on the result? I've done a naive/simplest approach of just finding a centroid for each triangle and doing a weighted average, see: https://i.imgur.com/6b91NQv.png your nodes purposefully left in your style so it's more visible what is changed. The maximum distance between my and your calculations is exactly 0 for Suzanne.

BIG PLUS for "pure field" (I also don't know if there's a better name), it's 10× faster, but keep in mind "Capture Attribute" isn't always slower, in fact I think the main reason it supports multiple  inputs is for optimization; Blender often isn't as smart as you'd assume based on experience in programming: my tests (29 Aug '24) show "Set Position" node will evaluate raycast twice unnecessarily and you can optimize it with combining "Capture Attribute" node: 1, 2, 3

The answer could benefit from explaining in context the shoelace, maybe even with an animation as it iterates over virtual triangles in winding order (CCW), with 2 tris having 0 area. Also consider how some people could get confused and think doubling area comes from quads having 2 tris. In general, people tend to prefer watching cat videos instead of reading, so walls of texts don't earn rep, shorter answers get much more rep, except if you add step by step explanations with visuals. And I know, not everyone wants to prostitute self for rep, but it communicates what people find helpful.

Some nitpicks: 1) you can read position of a face corner, no need to change context to vertex of the corner; 2) "Corner Index" by default uses "Index" field; 3) "Offset Corner in Face" node; 4) you used "Face of Corner: Face Index" in one place, but "Evaluate on Domain: Face" in another.

Whoops! I'm sorry, I'm actually getting a small difference between your and my methods, my comparison method had a bug.

"why the dot product part of the setup?"  That's crucially important; it's what effectively projects the whole picture to the best-fit plane of the polygon, so that we have a meaningful 2d problem where some of the tri areas can be negative.  If you just naively take all-positive tri areas in 3d instead, it clearly can't work:  the most obvious thing that goes wrong is that you'll never get a negative tri area and so answers for non-convex polygons will be dramatically wrong.  Probably worth making some test cases with non-convex polygons to show this.

"The answer could benefit from explaining in context the shoelace"  Blech.  Yeah, this wasn't supposed to be about explaining the shoelace formula (it's arguably closer to what they call the triangle formula here, all these non-triangulating methods are equivalent at a level I didn't mean to dive into here), I tried to add a brief explanation about it and its natural advantages but the clearer I tried to make it the more it turned into a wall of text instead.  Not sure what do do about this; I could just remove the explanation.

@MarkusvonBroady to demonstrate the bad effect of using the naive 3d triangle areas, scrub the "sort index" on your "corners of face" node.  Using naive tri areas, it jumps around and is clearly wrong (off-center) for centrally-symmetric letters like 'H', 'N', 'S', 'X', 'Z'.  Using dot product, it's rock solid and centered as it should be, as long as everyihing's planar, as it is in this picture.  (It's not completely rock solid on Suzanne, though, because she has skew polygons; this is noted in the answer)

Oh right, I reasoned about this on convex polygons and forgot about the requirement of subtracting negative area of the triangles outside, and then some triangles will be partially outside partially inside, it's a mess... The "Triangulate" node takes care of that. In fact I think I'm going to fix Robin's solution, as it is "perfect" in a sense that it is consistent with whatever triangulation Blender decides. Still a big fan of your solution due to how it's arguably also correct and much faster and more convenient as a field.

@MarkusvonBroady regarding your "Some nitpicks:", thanks, these are great!   I finally got around to editing my answer and making those improvements.   And thanks for the bonus, wow, I'm suddenly rich!

EDIT 2024/11/26: The problem pointed out by Markus von Broady in comments (bad assumption about order of tris in Triangulation node result) has been fixed.  The fix uses a safe efficient method of transfer from the triangulated geometry back to the original geometry, involving no "Nearest" transfer (bvh trees) and no "Sort Elements".
Note that this is my first answer; see my second answer for a leaner solution, which I prefer.

I started with Robin Betts' solution (given in Kuboå's answer before Markus von Broady's fix), and was able to simplify and
tune it some more.

(See Appendix at the bottom of this answer for expansion of the "Sample Inverse Index" node.)
The two "Accumulate Field" nodes
are essentially the two summations in the following formula for polygon centroid (center-of-area),
where the summation is over the triangles in the chosen triangulation of the polygon:
$$
\mathrm{\frac{\sum{Centroid(tri_i) Area(tri_i)}}{\sum{Area(tri_i)}}}
$$
The simplifications and improvements are:

It uses only two "Capture Attribute" nodes instead of four
(I'd like to use no "Capture Attribute" nodes, but I don't see how)  (UPDATE:  I figured it out; see my second solution)

It doesn't have a Geometry output (it seemed to be unnecessary,
since it ended up being the same as the Geometry input).
(I'd like to get rid of the Geometry input and all mention of Geometries, too, making this node group
a "pure field", but I don't see how.)  (UPDATE: I figured it out; see my second solution)

Instead of using the blender-calculated "Face Area" per-face attribute
on the original faces, it calculates its own, as the sum of the triangle
areas in the chosen triangulation.
I think this is a good idea because it guarantees the effective per-triangle
weights sum to 1, even if the polygon is slightly skew or self-intersecting
(in which case this computed area will be triangulation-dependent, and in fact the thing called "Face Area" is probably computed by a different method such as the shoelace formula which will likely disagree with the sum of tri areas no matter what triangulation is chosen).
That in turn guarantees the nice sanity property that the computed answer
will lie within the convex hull of the input vertices,
no matter how skew and snarled up the polygon is.

The screencast below demonstrates the stability improvement:

First using TestFCM_centroid_of_vertices: the centroid is stable (stays within convex hull of verts) but of course it's not the centroid of area.
Switch to TestFCM_robin_betts: properly computes centroid of area, but goes unstable, as expected, when the polygon is self-intersecting
Switch to TestFCM_donhatch: properly computes centroid of area, and stable even when polygon is self-intersecting.

Another example of the stability improvement: when we run the improved solution on Suzanne, we can see that some of the wild answer points have been brought under control (so they are inside the convex hulls of the respective faces):

(Blender 4.2)
This blend file has a menu that allows you to switch among various methods described in three answers and comments, including this one:

Appendix: Expansion of the "Sample Inverse Index" node
The transfer of the answer positions from the triangles back to the original faces is encapsulated in this "Sample Inverse Index" node, shown below.  This is the part that both Robin Betts's solution and my solution got wrong initially.
Some notes about this part:

This method used here is safe and fast (linear-ish): its time grows proportionately to mesh size, as expected, when it is run on suzanne with catmull-clark subdivision surface with increasing subdivision levels, each of which increases the mesh size by approximately 4x.  I got times L3:36ms, L4:142ms, L5:533ms, L6:2021ms.

It does not use "Nearest" sampling (referred to as the "old way" in Markus von Broady's comments, and used in the latest revision of Kuboå's answer).  "Old way" seems to be shockingly slow as mesh size increases; running it (specifically MvB's latest revision of Kuboå's answer) on suzanne with subdiv surface, I got times L3:43ms, L4:371ms, L5:5131ms, L6:199343ms (more than 3 minutes, so 98.6x slower than my way at this level).

Further details on the surprising worse-than-quadratic asymptotic behavior of "Sample Nearest" node: I looked into this, and found that if you have a "Sample Nearest" node that makes A nearest-point queries on an attribute of size B, then for some reason Blender repeatedly creates a bvhtree on B, ⌈A/8192⌉ times, which takes takes time ⌈A/8192⌉ B log2(B).  So in this application where A=B=N=(number of faces), the timing behavior is hockey-stick-shaped, starting out looking linear-ish O(N log(N)) and switching to asymptotically quadratic-ish O(N² log(N)) at around N=8192.  [UPDATE 2024/12/27: this is now fixed in 4.4.alpha]

It does not use the "new way" ("Sort Elements" node, introduced fairly recently) either.  I have not done any timing of "new way" yet, but my initial impression is that it's an unnecessarily heavy tool for this basic O(n) problem of inverting a lookup table.

Usage of this "Sample Inverse Index" node is analogous to the "Sample Index" node, except that type=Vector and domain=Face are hard-coded (I don't see a way to make those parameters/properties/options of a custom node), so if you want it on some other type and domain, you have to copy the node group and change these hard-codings inside it.

The next lower-level helper node is "Invert Mapping on Faces".  Note that the domain=Faces is still hard-coded here, but the type=Vector is not.  Expanded:

The next lower-level helper node after that is "Invert Mapping on Points".  At this level, it works on a point cloud geometry, so this helper is fully reusable (no hard-coding of mesh element domain nor data type).  Expanded:

Finally, the lowest-level helper is "Invert Permutation on Points", which is the core of the inverse-index-sampling problem: inverting a permutation.  It works by first using a "Join Geometry" node to concatenate the input permutation with the identity permutation of the same length (using the ID attribute instead of anonymous attributes for simplicity), then applies an "Accumulate Field" node on the joined list with GroupID=Value and Value=Index (i.e. swapping the order of these two inputs, from how this node is usually used); then the second half of the "Trailing" output is the desired inverse permutation.  See the annotations in the picture for more details of what's going on here.

⚠ This solution assumes first triangle of each triangulated n-gon keeps the face index of this n-gon. However this is not guaranteed to be true in future: https://docs.blender.org/manual/en/4.0/modeling/geometry_nodes/inspection.html#geometry-randomization

@MarkusvonBroady  Oh, my.  Yes, this solution is bogus. I'm surprised the assumption holds at all.  In fact, staring at this node graph now, it doesn't even look meaningful to me at all; I'm shocked that it works.  Do you see a fix?  I imagine it might involve putting back one or both of the "Capture Attributes" nodes that I removed from Robin Betts's solution since it seemed to work without them, but without really understanding what I was doing (and I still don't, unfortunately).

I'm thinking it would be a good idea to make and use a "triangulate and scramble" node, to make sure I'm not depending on any bogus assumptions like this.

Yes, there the original face index is stored and used for grouping in accumulate field. I still haven't had time to analyze your 2nd answer, don't be discouraged by no upvotes yet, though in general answers to old questions get next to no rep...

@MarkusvonBroady Heh, yeah I was wondering why this answer keeps getting upvotes despite it being questionable and, it turns out, bogus, while my second answer, which I think is solid (and I think I actually understand it completely, unlike this one) has gotten zero.   I have added a WARNING to this one, pending fixing or discarding it.

@MarkusvonBroady Can you give me a sanity check?  Suppose I insert, immediately after any Triangulate node, a "Sort Elements (domain=Face)" node with its "Sort Weights" input fed by a "Random Value" node.  Then the output of that can be dropped in to replace any legitimate use of the Triangulate node, and it will still work... except that it will break any usage of it that makes bogus assumptions about the order of the triangles.... right?    I am trying that, and I find that breaks my solution (as expected)... but it also breaks Robin Betts's solution.  Is that expected?

Oh right, good catch! I did read the node tree before to see if there isn't a problem like this, but in this case I missed it by misreading. Testing is trivial: https://i.imgur.com/ilbCv6H.gif the reason it fails is it's original faces sampling from the triangles, which can have non-meaningful indices, and I thought it's the other way around. Calculation works, but sampling calculated value fails. So either a reverse mapping needs to be done, or sorting. I think I'll make a write-up on this as an answer.

BTW, you can't rely solely on what is written in Blender docs, because it doesn't explicitly specify a lot of things (e.g. "Grid" index ordering or just UV sphere orientation with axis connecting poles being parallel to z axis). Before Blender 4.0 it was therefore normal to assume indexing is stable, and the linked docs section is so concealed, awareness about it still is little, which I'm trying to change. My point is, there's a lot of work to be done to hunt down these assumptions especially in old answers including mine.

@MarkusvonBroady My latest edit (#9) fixes the problem, I believe.  It transfers the attribute from the triangulated mesh to the original mesh using what you call the "old way" in your fix of Robin Betts's solution.  I tried to encapsulate this part in two helper nodes (because the details really hurt my brain a lot).

@MarkusvonBroady Actually scratch that, in edit #10 I came up with a better (I think) method of transfer-- safe, faster, simpler, involving no "Nearest" transfer (kd trees, I assume) nor "Sort Elements". The trick is: do a "Join Geometry" of the original mesh A with the triangulated mesh B (putting zeros in the A part of the joined mesh), and then do the Accumulations on this joined mesh. The A part stays in the original order even when "Set Geometry Randomization" is checked (unlike the B part). So you can transfer the result back reliably by "Sample Index"ing into the A part of the result.

That's an interesting approach! Though I wouldn't be so sure it's faster or more readable.

@MarkusvonBroady well... assuming my edit #9 is a decent interpretation of "old way" of inverting a mapping, and if my timings are right... "old way" is really, really bad. On suzanne with  subdiv surface, where each subdiv level multiplies number of faces by 4 or so... my way: L3:38ms, L4:160ms, L5:639ms, L6:2512ms;  old way: L3:47ms, L4:371ms, L5:5223ms, L6:248341ms (4 minutes). So my way seems to be linear-ish (as expected), "old way" is... exponential !? I mean yeah I expected it to be bad since it's obviously a cannon, but wow. I haven't tried timing the "new way" (Sort Elements node).

I expected it could go either way, good to know you get good results.

@MarkusvonBroady In latest edit, I encapsulated the reverse transfer in a fast simple-to-use "Sample Inverse Index" node, which I think I'm pretty happy with.  Internal details of that, and summary of the above findings (timings etc), are now in an Appendix.  Of particular note: it seems to me that the apparently superpolynomial growth of "old way" timings should be cause for surprise and alarm.  I'm inclined to profile Blender to try to find out why that's happening.

@MarkusvonBroady Ok, I looked into it, and I see what's going on. "Old way" is not superpolynomial after all (thank goodness); that was an illusion due to a hockey-stick-shaped change from linear-ish O(N log(N)) to asymptotically quadratic-ish O(N² log(N)) at around N=8192 faces. This is still really bad though. I put some more details on this in the answer.


text:
3D Printing Model Correction
Here's a relatively simple model that I want to print (for bathtub drain). It is made by only creating cylinders and cubes and applying Array and Boolean modifiers.

When I import it as .stl and load it to Slic3r (for correct result, scaling by 100000% should be used since .stl doesn't contain the scale), it shows this in 3D:

which is ok, but there's warning which sais "Auto-repaired (18 errors)" and tooltip sais that "5 degenerate facets, 5 facets removed, 4 facets added, 4 facets reversed" and Preview shows this:

and Layers shows this for the first layer:

I wonder what I'm doing wrong and how to fix this. I haven't tried to print this yet, but the preview suggests that it will be no good. Here's the .blender file: .

This is likely due to non-manifold geometry. See also http://www.shapeways.com/tutorials/fixing-non-manifold-models

You seem to have three different blender object pieces. Visually overlapping but not connected by vertices.  Is that your intention?  Is that acceptable to your 3D printer?

@atomicbezierslinger well my idea was to add the rim around the grid, but may be I should use the inner diameter for the grid, not outer; as for the central cylinder, it shoudn't be overlapping as I've substracted it from the "grid" part first and then "added" it and the hole inside it. I'm not sure about what's acceptable to the printer as I don't quite understand how the mesh and facets are converted to the "solid" detail..

Consider what I have submitted as beginning to your solution.  Others can step in and help who have this expertise.  At the moment my time here has expired.  Can your printer understand n-gons or only triangles and rectangular faces?  Keep practicing and testing your improvements.   Keep searching here at BSE and youtube 3d printing with some of the new ideas from BSE.  Consider seeing multiple video tutorials.

Ok, thanks everybody for trying to clarify the misterious behaviour of Blender, but the solution was found using atomicbezierslinger's hint: just avoiding overlapping (man, I have no idea how this can be connected with those missing facets!).
My model (more precisely, the part I'd like to print) consists of 3 parts: the high hollow cylinder (C), the disk with holes (B) and the rim (A). In my first attempt, I've made the diameter of the disk with holes the same as the outer diameter of the rim. Second time, I've made it equal to the inner diameter of the rim. May be I've also changed the order of applying the modifiers, but second time it was: subtract the disk B (will be the grid) from the disk A (which becomes the rim), subtract the array of cubes from disk B (which becomes the grid), subtract cylinder C from the former disk B and hence this part is also read, add a cylinder smaller then C and subtract it to make C hollow. This way, A, B and C don't overlap and Slic3r shows a perfect result, too.

Boolean won't work with that amount of Ngons, doubles, intersections etc. See question with similar situation. It seemes it's a lot esier to recreate the mesh than trying to repair original one.

Start with a plane and subdivide it so each subdivided cell is roughly the same size as cell of your original mesh.

Delete faces only (X > Only Faces). Add Skin modifier. Set Mean Radius for both axes as desired (0.05 used in this case). Set Branch SMoothing  to something so there's no smoothing between shapes (0.66 used).

After applying modifier you have clean topology which can be used by Boolean in particular. Place other meshes appropriately, add modifier and cut out what's needed (or not needed).

Two Boolean modifiers were added at the same time; cylinder in the middle was hidden.

Perhaps Multiple Problems.
Edit Mode.  Select Non-Manifold identifies some problems.
See Arrow in image above.
Add faces to holes you see.

Strange face. Edit Mode Face Selection. See arrow. Remove doubles can correct partially. Image above.
Look for more problems.  This does not strive to be a tutorial.
Consider using Blender Mesh [Join]. Inspect each time with the menu choices of the first image.
Consider converting all n-gons to quadrangles or triangles. Quads and Tris.
Consider the Remesh Modifier. There is an Apply button.
Consider duplicating the mesh and making corrections to improve to the point when your 3D printer software has zero warnings.  I do not have your 3D printing software.

Wow. I've got the idea of how to find these, but didn't get how to fix these and why they appeared (like I said, I only created a cube and several cylinders and applied Array and Boolean modifiers).

Thanks, I'll try this stuff, too (I have the bad version of the model saved) but you suggestion in the comments got me a much more straightforward solution (see the answer).

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

authors: Андрей Костров


text:
How do I make a hole and resize it later?
When designing physical objects (mostly for 3D-printing), it is a usual scenario that I create an object with a hole and try it and then resize the hole if it doesn't fit.
I use boolean modifier for hole making, but it is very inconvenient to resize holes made this way since I have to undo the boolean modifier and removing of the cutter mesh (usually a cube or a cylinder), resize it and make the hole again. At times I just don't want to keep hole cutting as the latest action.
What can you suggest a better approach so that I can easily apply trial-and-error method for doing holes (or, in other words, resize them)?
Edit: For example, in the following file there's a piece with 3 holes, the big one is supposed to get an aluminum tube of 8 mm diameter inside it so I've made a 8.1 mm hole (ok, 8.1 cm in the default scale) but it may happen that it's not large enough and I will need, say, a 8.2 mm hole. I kept the hole-cutting cylinder and the painful part is: I applied the boolean (difference) modifier thrice (to the big cylinder and to 2 smaller parts) so changing the hole diameter will be long and annoying. Increasing the diameter is easier: actually, I don't have to undo hole cutting, but to reduce hole diameter, it is required.

Could you post some example in edit?

Well, there are many kinds of holes, I suppose. And then the Boolean Modifier tends to create ngons, which aren't good for printing. How about some screenies?

Right, I've added the latest example as both .blend file and a screenshot. I surely would like to hear suggestions about better ways for printing, although I'm not sure why ngons aren't good for it.

Constraint Axis Scale
If your holes shapes are made by subtraction of extruded profiles along a single axis, you may consider the option to simply scale the faces in the 2D space of the plane perpendicular to that axis.

This can be done by pressing Shift just after the Scale shortcut (S) and before picking the normal axis (Z in the shown example), or by using the operator panel options.
If you need to use a different orientation than Global (e.g., local, custom, etc.), you'll have to press the keyboard combination (S -> Shift+Z) twice.
The animation above has Edge Length checkbox enabled in order to make the diameter length visible during the transformation.

Could you clarify how do you select all the inner faces of the hole at once?

Also, could you point how can I apply that to my detail from the example (try it, the big hole is cut in 3 parts, not one, and scaling the hole for the 2 others seems problematic). Should I group them or smth else?

If the internal faces are defining a Face Loop you can select them by pressing the "Alt" key while right-clicking the edge between two faces. (See for example http://blender.stackexchange.com/questions/22916/how-to-control-which-edge-loop-is-selected?noredirect=1&lq=1)

About the big hole, you must join the three object in one in order to edit them simultaneously (just select the interested faces from all objects and perform the scaling) https://i.sstatic.net/lficm.gif. The two tiny holes are correctly scaling https://i.sstatic.net/dsnhz.gif, they just don't have flatten ends. Btw, I would not easily abandon the Boolean workflow...it allow a more flexible workflow in my opinion. Also beware that if you would like to print the objects in single piece, you should model that way, without intersections.

Make Cylinder with Cap Fill Type > Nothing.
Go to Edit mode Tab.
Select all faces A.
E + S then Shift + Z resize it and apply.

Now you can select inner or outer faces and with the same key combination make hole bigger/smaller.

In my opinion, while boolean operations have great utility in some cases, this is not one of them. I'd approach this issue by using a different workflow, creating the three interior  holes in the piece first,  and then extruding from the inner holes to make the outer shape.

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


text:
What can I do about these discolored artifacts in viewport?
The issue only started yesterday when I started a new project file, and the it doesn't seem to appear on my previous files. It doesn't appear on anything outside of Blender, just the new Blender files I make now. When I inserted an image as a background it resulted in the viewport having a bunch of weird colors:

Eventually, I found out that the smooth wiring in preferences was enabled so I turned that off and fixed that, but the issue still persists when I add new meshes.
I am personally unsure if it's anything to worry about yet, nor do I understand what may be causing the issue.
For some specs I can provide: AMD Ryzen 5 5625U with Radeon Graphics, 8 GB RAM, and the entire thing itself is a Dell Inspiron 14 2-in-1 7425 Laptop. I haven't tested if it shows up in renders yet. I have updated, uninstalled and reinstalled Blender; as well as run diagnostics for the laptop, but I can't check the data either. I'm partially worried that if it is something wrong with the GPU, I currently don't have the opportunity to really fix it.

Looks like GPU issue

Yeah that’s a problem with your GPU 100%

Thank you for both of your answers! It turned out the GPU was outdated as a new update released today, so the update fixed the issue @Emir

and @Roger as well!


text:
EXCEPTION_ACCESS_VIOLATION on bpy.ops.mesh.decimate()
Hey I'm running blender 3.3.1 and I am having an issue in my script where I am getting the error EXCEPTION_ACCESS_VIOLATION, the second time that I select a group of polygons. I believe it may be causes by me not selecting or deselecting my polygons correctly from bmesh to bpy, but I am not entirely sure. I have tried stopping my script and looking at where my selection occurs, but it all looks correct from what I can see.
Here is some of the associated code selecting the area to decimate, 'bush.polygons' is a list holding the bmesh faces that I select.
selected_polys = []
invalid_polys = []

self.bm.faces.ensure_lookup_table()

for p in bush.polygons:
    if p.is_valid:
        p.select = True
        for loop in p.loops:
            loop.edge.select = True
            loop.vert.select = True
        selected_polys.append(p)
    else:
        invalid_polys.append(p)

if len(invalid_polys) > 0:
    for p in invalid_polys:
        bush.removePoly(p)

print("Bush %s, Length: %s, Invalid Polys: %s" % (bush_count, len(bush.polygons), len(invalid_polys)))

self.bm.select_flush_mode()
bmesh.update_edit_mesh(self.mesh)

Here is also the code I use to deselect the area. The "selected_polys" is passed in from my selection.
for poly in selected_polys:
    if poly.is_valid:
        poly.select = False

        for loop in poly.loops:
            loop.edge.select = False
            loop.vert.select = False
bmesh.update_edit_mesh(self.mesh)
self.bm.faces.ensure_lookup_table()

Let me know if you need any more information/code posted.

Update, I found if i add bpy.ops.mesh.select_more() right before bpy.ops.mesh.decimate() it works correctly

I found the solution I needed to use object.update_from_editmode() for the bmesh to update and see the changes. It was crashing because I was selecting bmesh polygons that didn't exist on the bpy mesh.


text:
How to have round edges when I subdivide with a subsurface modifier?

In the image you can see sharp edges, this problem was originated because I subdivided (Key "W" then Subdivide) the selected faces with a subsurface modifier of 4 subdivisions.
How do I make these sharp edges convert into round edges like a "Normal" subsurface modifier? Or like the edges of a cylynder/sphere.
NOTE: I need a lot of polygons-vertices because I have a "displace modifier", maybe you can help me find a way for displace modifier (With not a lot of polygons) instead of resolving this one.
I have tried with:

Smooth modifier, result is good on another mesh but with an error too, but in this one isn't working as I expect.
Smooth tools. It's quite good for my displacement modifier but it doesn't resolve the sharp edges.

EDIT:

Doesn't work with Subdivide Smooth too.

EDIT2:

What I want is everything marked with the red circle (The sharp/hard edges) turn into soft edges like the surface of a cylinder.
The problem is that I requires subdivide and the subsurface modifier because of the displace modifier (I need a lot of polygons).
Thanks for the answer.

Can you add your ref image of what you are expecting?

If Subdivide Smooth doesn't work, that suggests that there is varying density in the longitudinal edges, or they have a Crease value. Perhaps we can see your topology?

Thanks for the comment, just added an image in the post.

Anyone please??

Simplify the base mesh
You can start with a very simple object and give it one Subdivision Surface modifier to smooth the shape.

Build the extra geometry with modifiers
Below the first modifier, you can add a second set to Simple to generate more geometry without affecting the overall shape.

Displacement works as usual.

Remove unnecessary edges(follow this instruction) after that you could add your modifier

Everything is necessary... for my displace modifier. I also followed the instruction, removing some edges but it seems that it doesn't work well if I don't remove more vertices, but that is the problem, I need the polygons for the displace modifier.

Instead, use simplified geometry and one subdivision modifier set to catmull-clark, and then another subdivision modifier set to simple for the additional geometry.


text:
What is the best way to model the interior of a vehicle as accurate as possible and what source should I use?
so I want to model a bus a bus in blender and I already know how to model the exterior with blueprints however with the interior I'm not sure where to start since it is so complex and I want to model things such as the dashboard, steering wheel, seats, door, engine etc. There is no blueprint available for interior modelling so therefore Iam wondering what is the solution to model the interior of a real life vehicle with accuracy. Also I don't have photographs because they may have distortion and change the way how the object looks.
here is what the bus looks like

The best way to model the inside accurately is to find a reference image of each individual part of that particular bus or any other bus. This way you will have a good reference that isn't warped in any way. You would then model that part and can use it for your bus. The advantage of modeling the part as a separate object means that you can then use that part in other scenes as well.
For example here is a steering wheel reference from a VW Bus:


text:
Camera Doesn't Follow Character
So I'm working on a blender game and when I play the game it works but when I play it in camera mode it doesn't show anything. The camera is parented to the character but it doesn't work please tell me a way to fix this.
oops and please ignore the edits ive done i was keep posting the wrong .blend file

this one is the right one i promise

Put your camera in the same layer as your character (the hidden one), so it will be added when your character spawns.
In the camera, add an Always > AND > Scene (Set Camera), so the character camera will be set when it's added to the scene. The object field in the actuator should be kept empty to refer to self.

Fixed file:

Thank you so much. But I am already over with that problem. But if it happens again then I'll do that.

Wait... I thought that would really work but for some reason it didn't. Can you test that in my project and see why it didn't work?

Just added your file fixed in the bottom of my answer. Read the text on the blend to understand what I did.

Thank you so much! But why is there no shadows in the game? It's set to GLSL.

I have a different project and I'm having trouble again I did everything you said but I just can't figure it out can you please make a  Youtube tutorial on how to do this?


text:
How to limit textures size in eevee?
I'm using 2.8 beta. The option in the settings / general does not seem to work.

Hi, maybe try adding some more details, what you tried, what happened (or not), even better a visual example (screenshot) to let others know what you mean exactly

Just changed options. Nothing, same high res textures. Added screenshot.


text:
Baking textures on headless machine (batch baking)
Is it possible to bake textures from the command line?
This is useful for setting up batch jobs, baking an entire level for example.

Yes, the bake operator can run in background mode, for both Blender-Internal and Cycles Baking.
A very simple script could look like this:
Bake Once
bake.py:
 import bpy

 # Like pressing the 'Bake' button in Blender
 # this will remain locked until the bake is complete.
 bpy.ops.object.bake(type='COMBINED')

 # You might want to inspect the materials and extract images
 # but for this example, simply select by name
 image = bpy.data.images["Untitled"]

 # save-as by setting the target path and saving
 image.file_format = 'PNG'
 image.filepath_raw = "//my_new_bake.png"
 image.save()

Execute the bake with:
 blender --background bake_test.blend --python bake.py

For batch jobs you would have to change the selection before calling bpy.ops.object.bake each time.

Bake Everything
This next example is more comprehensive, and uses the is_dirty image flag to detect which images to save, giving each image a _bake suffix.
bake_all.py:
# Blender v2.8x +
import bpy
import os

scene = bpy.context.scene
for obj in scene.objects:
    obj.select_set(False)

for obj in scene.objects:
    if obj.type != 'MESH':
        continue

    bpy.context.view_layer.objects.active = obj
    obj.select_set(True)

    bpy.ops.object.bake(type='COMBINED')
    obj.select_set(False)

# save all baked images
for image in bpy.data.images:
    if image.is_dirty:
        # foo.png -> foo_bake.png
        filepath, filepath_ext = os.path.splitext(image.filepath_raw)
        image.filepath_raw = filepath + "_bake" + filepath_ext
        image.save()

Execute the bake with:
 blender --background bake_test.blend --python bake_all.py

Further ideas for batch baking which might be useful.

Automate baking an entire game-level:
loop over each group and bake its objects (or each group matching a naming convention, ending with .bake for example)

Automate baking existing models:
A utility script which loads in models from an external format (OBJ, FBX, 3DS... etc), unwrap, assign images, bake and exports.

Automate low-poly mesh creation with the decimate modifier, and bake normal maps (high->low poly meshes).

Bake textures over time (create a baked image sequence).

Create a utility which runs back in a background process so you can keep on using Blender.

I think need to register this, I got errors:     bpy.utils.unregister_class(cls)
RuntimeError: unregister_class(...):, missing bl_rna attribute from 'RNAMeta' instance (may not be registered)
Blender quit
C:\3D>C:\blender-3.4.0-alpha+master.d4d40f3b69d8-windows.amd64-release\blender.exe --version
Blender 3.4.0 Alpha
build date: 2022-10-03

I tested with blend file and need active image ...Info: No active image found in material "Procedual..." (0) for object "Sphere" Info: No active image found in material "Procedual ..." (0) for object "Cylinder"

authors: Тимофей Черников


text:
How to execute blender from python?
I am using anaconda 3 and I want to know how to execute blender from python.
Since python can be called from inside blender so it has to be possible vice versa. Does anyone know how to do this? Please help me by providing the procedure for setting up the environment for this.

The easiest way would be to use the subprocess module to start Blender.
import subprocess

subprocess.run(["/path/to/blender", "somefile.blend"])

Since python can be called from inside blender so it has to be possible vice versa.

This is not a very logical statement. Just because Blender embeds Python doesn't mean anything when it comes to starting Blender from Python.


text:
collision sensor only detect collision first time only
I have a cube and a plane (cube is rigid body and plane is static).
Add collision sensor to plane and attach python script [print ("positive")].
So it print positive when pluse is positive.
Now I found that it send positive pluse only onces after game start. (it even did not detect collision with other object)
So.
How to use collision sensor to detect collision with all object.

A collision sensor sends only one positive pulse, as soon as its owner object collides with another object. To make it send pulses as long as this happens, you can use another script to reset the sensor as soon as it fires.
Here is the script I wrote:
import bge

cont = bge.logic.getCurrentController()

sns = cont.sensors['Collision'] # Whatever your sensor is called, not necessarily 'Collision'

sns.reset()

This script should be placed in a Python controller linked to the collision sensor in question (in the Plane object's logic). It will cause the other script to print "Hello" continuously until either 1) the game engine stops or 2) the object no longer collides with anything at all.
I hope this answer helps...


text:
How to correct invisible geometry
I've some invisible edges on my model which generates bad textures as you can see below.
How can I correct this ?
It is from boolean operations.
Thanks ;)

The wall's geometry is really bad for the engine. Try to cut across the whole object everytime like on the picture. If the edges aren't align to any of the axes it's not a problem, but don't cut a hole to the middle of a simple face, because it will cause similar artifacts.


text:
xml rpc server on blender
We need to run an xml rpc server on each blender session started.
Blender communicates with our python 2.7 based pipeline through xml rpc.
The xml rpc server will receive python 3.0 commands as strings set to the xml rpc server.
the wall we've been hitting are:
-We need the script to be started from the same location on each blender workstation.
-When we load the script as an addon, it attemps to spawn several servers on each session when we just need a single one.
Any help would be very welcome on:
-How we can load a startup script for blender from a shared location for all users.
-How we can make sure one single server is started within each session.
Please bellow the snippet code of what we are trying to get up and running on each blender session:
A Python 3.7 XMLRPC Server program in Blender
bl_info = {
    "name": "XMLRPC Server",
    "author": "KristenH",
    "version": (0, 5, 0, 1),
    "blender": (2, 79, 0),
    "category": "System"
}

from xmlrpc.server import SimpleXMLRPCServer
import threading, time
from socketserver import ThreadingMixIn
import bpy
import sys
import socket
print()
from queue import Queue

# Simple server class
class SimpleServer(ThreadingMixIn, SimpleXMLRPCServer):
    pass  # The same statement as Null in C++, Java, C# etc.

# The command function
def command(com):
    com='import bpy\n'+com
    exec(com)  # Trigger command to server
    return com

# The server data
def server_data():
    return bpy.app.version_string, bpy.context.blend_data.filepath, socket.gethostname()

def pscan(host='localhost', port=8000):
    # Setting up a socket
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    proxy = (host, port)
    try:
        con = sock.connect(proxy)
        return True
    except:
        pass

class ServerThread(threading.Thread):
    def __init__(self, host='localhost', port=8000):
        self.proxy = (host, port)
        self.server = SimpleServer(self.proxy)
        self.port = port
        self.host = host
        threading.Thread.__init__(self)
        # self.server_thread.setDaemon(True)
        self.server.register_introspection_functions()
        self.server.register_function(command, "command")
        self.server.register_function(server_data, "server_data")
        self.version_string = bpy.app.version_string
        self., bpy.context.blend_data.filepath, socket.gethostname()

# A class shows a server panel in Blender
class ServerPanel(bpy.types.Panel):
    bl_label = "Server Panel"
    bl_idname = "Object_PT_server"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_category = "Shortcuts"

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

        row = layout.row()

        server = None
        x = 8000
        attempts = 0
        while(server is None):
            con = pscan(port=x)
            if con is not None:
                print(con, 'found server on', 'localhost:',x)
                row.label(text="Server found on: localhost:" + str(x) + "\n")
                x+=1
            else:
                # time.sleep(5.0)
                server = ServerThread(port=x)
                # Make sure the first port is the start up port.
                # row.label(text="Started the server with:" + str(server.host) + ":" + str(server.port) + "\n")
                print(attempts, "Started the server with:", server.host, ":", server.port)
                server.start()
                # row.label(text="... Press Ctrl+C to exit\n")
                #print("... Press Ctrl+C to exit")
                attempts+=1
                break

# Blender code below
def register():
    bpy.utils.register_class(ServerPanel)
    #bpy.utils.register_class(SimpleServer)
    #bpy.utils.register_class(ServerThread)

def unregister():
    bpy.utils.unregister_class(ServerPanel)
    #bpy.utils.unregister_class(SimpleServer)
    #bpy.utils.unregister_class(ServerThread)

if __name__ == "__main__":
    register()

Many Thanks,
-H.

Sorry but I couldn't get a right way to display our code, please find it in the next comment, sorry about that.

Perhaps before starting the server, start a client. In a try..except statement, use the client to test if the server is already running. If it succeeds, (obviously) don't start another server. If you reach the except clause, start the server.

We already have a function that tests if the server has started.
The thing we are after is to have the service starting one single time.
The way it's written, it keeps starting over and over and keeps spawning servers on available ports.
Thank you,
-H.

To make it simple, we are after a python formulation that would trigger a function one time upon startup and that doesn't keep looping afterwards.
Thank you.

Spawn the server from the register function, not inside ServerPanel.draw:
import multiprocessing as mp
import socket
import sys
import bpy
import time
import threading
from xmlrpc.server import SimpleXMLRPCServer
import xmlrpc.client
bl_info = {
    "name": "XMLRPC Server",
    "author": "KristenH",
    "version": (0, 5, 0, 1),
    "blender": (2, 79, 0),
    "category": "System"
}

HOST = 'localhost'
PORT = 8000

def command(com):
    com = 'import bpy\n'+com
    exec(com)
    return com

def server_data():
    return bpy.app.version_string, bpy.context.blend_data.filepath, socket.gethostname()

class ServerPanel(bpy.types.Panel):
    bl_label = "Server Panel"
    bl_idname = "Object_PT_server"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_category = "Shortcuts"
    proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")

    def draw(self, context):
        layout = self.layout
        version_string, filepath, hostname = self.proxy.server_data()
        print('found server on', 'localhost:', hostname)
        layout.row().label(text="Server found on: {}:{}".format(hostname,PORT))
        layout.row().label(text="Press Ctrl-C in terminal to exit".format(hostname,PORT))

def register():
    global thread
    proc = mp.Process(target=maybe_launch_server)
    proc.daemon = True
    proc.start()
    bpy.utils.register_class(ServerPanel)

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

def maybe_launch_server():
    proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")
    try:
        result = proxy.server_data()
    except ConnectionRefusedError:
        server = SimpleXMLRPCServer((HOST, PORT))
        server.register_introspection_functions()
        server.register_function(command, "command")
        server.register_function(server_data, "server_data")
        version_string = bpy.app.version_string
        print("Started the server with:", HOST, ":", PORT)
        server.serve_forever()

if __name__ == "__main__":
    register()

This spawns the server as a separate process. proc.daemon = True causes the process to terminate when the calling process terminates. On the plus side, this means that the server will terminate when you quit blender. On the negative side, it also means you have to pay attention to which blender started the server (in case you launch multiple blenders).


text:
How to extrude edges outward based on multiple axes?
I want to extrude these edges outward so that they are all the same length from their origin edge. Does anyone know how I could do this without doing each edge individually?

https://blender.stackexchange.com/questions/1088/is-there-a-way-to-offset-an-edge-extrude-edge-loop-perpendicular-to-each-edge/

Once you've extrude, press enter, then try altS (Shrink/Flatten). You can play with some parameters on the bottom of the Tools panel (on the left of your 3D View, displayed with T).


text:
How to get part of a mesh with Python API, which requires breaking down some faces?
Suppose I have an object, for simplicity, created as a grid and two circles. How can I extract a mesh, which satisfies a condition: x>=0 and y>=0. This implies that the faces associated with the circles have to be bisected.
I am wondering if there is a relatively easy solution to this. May be,  bmesh.ops.bisect_plane can be of any help in this situation, but I do not know how to apply it.
import bpy

import bmesh

bpy.ops.object.select_all(action='SELECT')

bpy.ops.object.delete()

bpy.ops.mesh.primitive_circle_add(vertices=32, radius=2,
                                  location=(0.5, 0.5, 0.0), fill_type='NGON')

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

bpy.ops.mesh.select_all(action="DESELECT")

bpy.ops.mesh.primitive_circle_add(vertices=32, radius=3,
                                  location=(0.5, 0.5, 0.0), fill_type='NGON')

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

bpy.ops.mesh.select_all(action="DESELECT")

bpy.ops.mesh.primitive_grid_add(x_subdivisions=3, y_subdivisions=3,
                                radius=4.0, location=(0.0,0.0,0.0))

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

bpy.ops.mesh.select_all(action="DESELECT")

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

obj = bpy.context.selected_objects[0]

All with bmesh in object mode.

With appropriate bmesh operators

add the primitive circles
translate them to desired location
add the grid
bisect with YZ plane at origin and clear the inner.  Note the plane coordinate is at (0, 0, 0) by default.
repeat with XZ plane.

Test script, run in object mode.  Adds a plane and replaces its mesh.
import bpy
import bmesh
context = bpy.context

bm = bmesh.new()

bmesh.ops.create_circle(bm,
        cap_ends=True,
        radius=2,
        segments=32)

bmesh.ops.create_circle(bm,
        cap_ends=True,
        radius=3,
        segments=32)
bmesh.ops.translate(bm, verts=bm.verts, vec=(0.5, 0.5, 0))
bmesh.ops.create_grid(bm,
        x_segments=3,
        y_segments=3,
        size=4)

# run two bisect planes
def geom(bm):
    return bm.faces[:] + bm.edges[:] + bm.verts[:]

bmesh.ops.bisect_plane(bm,
        plane_no=(1, 0, 0), # x > 0
        geom=geom(bm),
        clear_inner=True)
bmesh.ops.bisect_plane(bm,
        plane_no=(0, 1, 0), # y > 0
        geom=geom(bm),
        clear_inner=True)

# quick hack to add object
bpy.ops.mesh.primitive_plane_add()
ob = context.object
bm.to_mesh(ob.data)
ob.data.update()

To pick up from where your script above left off, with a minor change in that the object added in object mode will be the context object (don't rely on it being first in selected objects list), and no need to switch into edit mode from edit mode, can remove a couple of redundant operators.
# create the meshes as in question
ob = context.object
bm = bmesh.new()
bm.from_mesh(obj.data)

# and then pick up script above
    # run two bisect planes
def geom(bm):
    return bm.faces[:] + bm.edges[:] + bm.verts[:]

bmesh.ops.bisect_plane(bm,
        plane_no=(1, 0, 0), # x > 0
        geom=geom(bm),
        clear_inner=True)
bmesh.ops.bisect_plane(bm,
        plane_no=(0, 1, 0), # y > 0
        geom=geom(bm),
        clear_inner=True)

bm.to_mesh(ob.data)
ob.data.update()

Thank you @batFINGER. That was really helpful.
The only thing is that when I added your code to mine, the bisection planes were shifted - not going through (0,0,0). I think it has something to do with the local and global coordinates. So, I added :
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
before applying bisect_plane, and it worked well.

Similarly the local  coordinate of global origin  plane_co = matrix_world.inverted() * Vector()  Please consider accepting and upvoting if answer worked for you.


text:
Render region and render with 1 keystroke?
I was looking into this:
https://github.com/CenekStrichel/CendaTools/wiki/Render-Tools
And there´s 1 key assignment to do the render region.
Basically you have:
step 1: If user presses "(key)", invoke view3d.render_border command
step 2: view3d.toggle_renderer
step 3: Render area gets represented.
step 4: IF a render area exist, and user presses "(key)" THEN view3d.clear_render_border
How could an .addon be created bindig all those commands and IF statement to a single keystroke?
Please help.
Thanks.
Could this code get us started?
import bpy

class QuickRenderRegion(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "view3d.toggle_render"
    bl_label = "QuickRenderRegion"
    bl_options = {'REGISTER', 'UNDO'}

    @classmethod
    def execute(self, context):
        bpy.ops.view3d.render_border()
        bpy.ops.view3d.toggle_render
        #return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()

Modal operator. Have a look into Templates > Python > Operator Modal. However that's cumbersome in this case. Out of curiosity: why you can't just use Ctrl+B?

ctrl+b, shift+z, wait for render, shift+z, ctrl+alt+b <---- Outrageous combo! Ultra finish. (I think you get me). Keybinding it to 1 key: genius.

Simple example on how to bind an operaor to any shortcut. I think you get the idea, copy the operator and just replace the name of the class when calling keymap_items.new() and you are literally done. But notice that the operator you've linked to, actually needs a cleanup before using it in a production: there are bad references, bpy is imported multiple times etc...

Actually it would be necessary to anchor 3 commands to the same keybind: 1-that starts the drawing rectangle area, 2 shifts to render, 3 if the same key is pressed again and there is a render preview area, then clear the area first and go into rectangle draw area again unless "ESC" is pressed and session will cancel (toggle back to regular selection mode).

@PierreSchiller you should make your solution into an answer to close this question. I don't think there is any better solution.

If I did, I will not get the bounty. The points have been already assigned. And the script doesn´t work. It´s just an idea so someone interested will come and fix the code and complete it.

I took p2or link and modified a little. After running the script, shortcut key is Shift + Q.
def register() part has type = "Q" and shift = True alt = False and ctrl = False.
bl_info = {
    "name": "Toggle Simplify",
    "description": "Toggle Simplify",
    "author": "poor",
    "version": (0, 0, 2),
    "blender": (2, 79, 6),
    "location": "3D View",
    "category": "3D View"
}

import bpy

# operator
class ToggleSimplify(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "view3d.toggle_simplify"
    bl_label = "Toggle Simplify"
    bl_options = {'REGISTER'}

    border = bpy.props.BoolProperty(default=False)

    def execute(self, context):

        if bpy.context.area.spaces.active.use_render_border:
            bpy.context.area.spaces.active.use_render_border = False
            self.border = False
            bpy.ops.view3d.toggle_render()
        else:
            bpy.ops.view3d.render_border("INVOKE_DEFAULT")

        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def modal(self, context, event):

        if not self.border and context.area.spaces.active.use_render_border:
            bpy.ops.view3d.toggle_render()
            self.border = True
            return {'FINISHED'}
        return {'PASS_THROUGH'}

addon_keymaps = []

# register
def register():
    bpy.utils.register_class(ToggleSimplify)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(ToggleSimplify.bl_idname, type='Q', value='PRESS', shift=True, alt=False, ctrl=False)
        addon_keymaps.append((km, kmi))

# unregister
def unregister():
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(ToggleSimplify)

if __name__ == "__main__":
    register()

Hi. I´ll test this code. Question: What if I do SHIFT+Q for the shortcut instead of "Q" on edit mode, or object mode? Is the interaction mode going to affect the script? Say I am in wireframe mode, will it toggle to full render and back to wireframe?
Also: How do I clear the region using the same Shotcut key but just "tap" to clear render region?
Could this line change to:
"ToggleSimplify.bl_idname, type='SHIFT Q', value='PRESS', shift=True" ?

I installed your .py addon, but when I press "Q", nothing happens.

Shift+Q is already the shortcut key combination for that script.

Right now it´s triggering the render toggle first, then it launches area select mode. It should be area select mode first, end selecting area and when defined, then it should launch the toggle render function.
Otherwise it beats the purpose of having a render preview. Could that be adjusted?

I updated the script.

I saw the toggle simplify addon. Assigned it shift+alt+q. When I press it, the render area triggers and is drawn, but then the toggle render is not triggered.

Hi JuhaW, wanted to let you know the script only triggers the draw area for render, but doesn´t immediately toggles the render mode to final. So the script doesn´t complete what's been described on the original post. I would award you the points, but it´s not completing the functions at the moment.


text:
how do I add a image on top of another image?
I am editing images with video editor and I have just gotten a image cropped and sized when it crashes. I thought it was my ram so I lowered it down to 4500. my actual ram is 7.9GB. I add a image then I put a color behind it (while the image in from has image offset on and overdrop) then I expand the color and it crashes. every time no matter what image. I will be happy to explain further if you might have a clue but I have not included the information. I am using this for a school project so I really need to get bender to work. is there anything I can do?
summery:
I am putting a over-dropped, cropped, image offset image on top of another non-over-dropped, cropped, image offset background image and it keeps crashing.

could you submit a blend file to better understand the issue?

how can I do that?

You can add your .blend file here http://blend-exchange.giantcowfilms.com/

The images weren't packed in the blend so I couldn't replicate your problem, but one possible solution is to close out all the VSE windows you have open. For some reason you have like 10 VSE windows open and that might be contributing to the problem.


text:
Stuck in fullscreen?
Ok, so I wanted to show my friend my video I was working on in blender. I go to the preview window and hit "fullscreen" (or something like that). So now I am stuck in this full screen mode. I have tried:

Shift+Space
Ctrl+Down arrow
Ctrl+Up arrow
Shift+Z
F11

Nothing has worked. Here is my file.

how do i do the window thing?

Can you describe what you did to "Go to the preview window?"

The only keystroke you haven't listed in your question is altF11 which will fullscreen a panel (more than just maximizing with ShiftSpace). Press altF11 again to toggle fullscreen.
Be sure to try both. It might be possible to fullscreen and maximize at the same time, which would make it so that undoing one doesn't change much unless you also undo the other. I'm not sure how that works (and I don't have Blender in front of me), but it's worth keeping in mind.

its not in full screen mode its just that int he blender window it is the only thing you can see.

I am supposed to hit Alt+F10

If you are using Linux, Alt-F10 is a system hotkey.  I disabled it as described here: https://askubuntu.com/questions/131359/how-do-i-enable-the-alt-f10-f9-shortcuts.   I don't think that worked, but hitting it several times rapidly did work.


text:
Node.js spawn for command-line?
I need blender command-line access though spawn but keep running into an ENOENT error and it is hard to pinpoint what is missing.  The command-line being passed in the sample application works in terminal.
Below are some details about the environment and the sample script I am using.

Environment (OSX El Capitan)

Installed Blender 2.76b with:
brew install Caskroom/cask/blender

Then add alias to bash_profile for terminal access:
alias blender="/Applications/blender/Blender.app/Contents/MacOS/blender"

Test Code
#!/usr/bin/env node
var child_process = require('child_process');
var arguments = [
        '-b',
        'recipe.blend',
        '-o', 'test-#',
        '-f', 0
];
console.log("values: ", arguments);
var child = child_process.spawn('blender', arguments);

child.stdout.on('data', function(data) {
    console.log('data out: ', data.toString());
});
child.stderr.on('data', function(data) {
    console.error('error out: ',data);
});
child.on('close', function(code) {
    console.log('closing code: ' + code);
});

// Raw command-line for terminal. (PASS)
// blender -b recipe.blend -o test-# -f 0

Try changing the child_process.spawn('blender', arguments); line to child_process.spawn('/Applications/blender/Blender.app/Contents/MacOS/blender', arguments);.  NodeJS won't be using your bash aliases, so unless the blender executable is in its PATH it won't be able to find the executable and will throw an ENOENT.
The other option is adjusting Node's PATH to include the path to the blender executable.  You could also pass the fullpath to the blender executable in as an environment variable.
Cheers!


text:
Add ONE constraint to several bones?
So, I want to add a Limit Rotation constraint with "Limit Z" option checked for many bones at once. Now, I know about the "Copy Constraints" function, BUT in this case, the bones already have other constraints on them (with different targets) which I want to keep, and just Copying all constraints would overwrite these.
How can I add only one constraint to other bones without overwriting existing ones?

Alright, I managed to solve it myself now with a Python script, it goes like this:
import bpy

for b in bpy.context.selected_pose_bones[:]:
     rot = b.constraints.new(type='LIMIT_ROTATION')
     rot.use_limit_z = True

You need to have your bones selected (in pose mode).


text:
What kind of texture map is this?
I recently downloaded a xnalara model and imported it into blender and between the diffuse and normal maps i found these kind of maps.
 the file name says hair_atos.tex and I can't find any info about them. Can someone please tell me what their full name is and what they are supposed to do?

alb>Albedo? Looks like it used different color channels for separate info

I suspect that's an albedo mask, used for letting the hair be tinted. The different color channels are used as separate masks for different tints. Total guess though.

Sorry I meant hair_atos.tex not albm

@Vanishs its seems to be what the guys said above dude

The green channel looks like an Alpha map. The blue channel looks like a Lightpack or something similar.

looks like a diffuse map of a Neptune grass


text:
Delayed copy rotation...?
I'm trying to make a constraint or some kind of system in 2.80, where i have a vehicle, driving on a path (follow path constraint, also rotating, but only on z axis) and a third person camera, attached to an empty following the vehicle. by using copy rotation, i can make the camera follow the vehicle without rotating and can then manually animate rotation. i just wonder if its possible to automate this, so that the camera will rotate on the z axis just like the vehicle on the path, only slightly delayed, but without delaying the location (preferably in real time). I know that the slow parent feature got removed :(

You can bake the motion to an empty and then edit the keyframes.

Add an empty.
Parent the empty to the vehicle and the camera to the empty.
Go to Object > Animation > Bake and simply check all the boxes, then press bake.
Now that the motion has been transfered onto the empty, open the graph editor and select the empty. You can edit the keyframes by selecting them and pressing ⎇ AltO to smooth them or move them to a later frame with GX >  LMB confirm

That seems to work. pity it can't run in real time, but workable


text:
Freely move and rotate tip of bendy bone?
I have an object that i'd like to be able to translate and rotate freely, while the  bendy bone below stays attached and curves and stretches accordingly. This works in edit mode but not when i switch to pose mode, it only rotates.
see gif:

how do i rig this up?
it has to be a single bendy bone because of the weight painting

Did you perhaps lock it?

I'm pretty sure that's normal behaviour for bones. the bendy bone would have to stretch too

Solved: https://youtu.be/BsJ3Grq_3GM
stretch to constraint and also start and end handle in bendy bones menu


text:
recreate basic specular highlight with shader
I'm trying to create a non photorealistic rendering shader in eevee and i want to add a specular highlight.
i don't want to use the specular shader or a black principled shader because they also reflect the sky and all the lights i have. i only want one specified sun lamp to create this specular highlight.
so basically i think i have to recreate a simple formula like cook torr for specular highlights in blender nodes. anyone have an idea how to do that? any help would be appreciated :)
someone has already done this for point lights but i cant figure out how to do this for directional lights.
https://blender.stackexchange.com/a/107390/67665

If you are open to do OSL shaders (scripts), you could check this. If you are ok with nodes spaghetti, I'd look at this. I don't think I have seen a shader that can take a specific lamp object as sole input (not without OSL or compiling your own Blender with a fully custom node). Maybe you can do that with layer though/

the thing you mentioned with node spaghetti is great, but it seems to only work for point lights with a specified position. i'm trying to do this with a sun light, using its direction as a vector somehow


text:
Missing link_faces on mesh
I have a script that iterates through the polygons and link_faces of a mesh, and it has worked great. I am trying to make a conversion to .usd instead of .fbx in my mesh pipeline for a couple unrelated reasons, but I am having issues with getting bad results with meshes imported as .usd compared to identical .fbx meshes. (Some of the functions involve flattening areas of the mesh, and it leaves holes in the place instead).
I have tracked the issue down to some polys returning poly.link_faces as (0, 1 or 2) when the .fbx returns all 3's with the occasional 2. So I believe I have a disconnect somewhere, is there a way to repair those missing relationships? Or is .usd not going to be a viable solution?
Thanks for your help

I ended up using remove doubles and it solved the linked polygon issue with my mesh, and also didn't destroy my UV's.


text:
Why are my vertices not following the bone? Weight Paint
I am new to blender. In the Weight Paint Mode, When I am assigning weight to vertices they are changing and becoming stringy when I move rotate the shoulder bone. I'm not quite sure what is going on. How can I solve this problem? Video to show what is going onLink to download blend file

With the pose bone selected in Weight Paint mode, go to Weights > Clean and set the threshold to something low like .01 or .05. That will remove all vertices assigned to this bone that have a weight less than that amount. I think this will solve your issue here.

I figured out why it wasn't working, another bone (foot) had weight paint on the the forearm. Thank you to those who responded to my question.


text:
Does separating mesh remove texture?
I'm working on cleaning up some scans of artifacts and right now am working on a pair of shoes. The issue with the shoes is that when the scans were taken, some of the table they were sitting on was picked up, so I'm trying to remove it so it's just the shoes.
The steps I've taken so far are separating the two shoes, removing the vertices, and then filling any gaps, however when I try to go back to seeing the texture over the mesh, it's gone. Is this because I'm separating the mesh and somehow erasing the texture? Or is there something else I'm missing?
I'm new to this kind of stuff and working on trial and error, so if someone can explain what is happening and a possible solution that would be great.
Cheers!

We'll need to see some images to see exactly what you mean. https://meta.stackexchange.com/questions/75491/how-to-upload-an-image-to-a-post

No, a texture is something independent of a mesh.  I think the right way to think about a texture (generally speaking, at least) is as a parameter for one or more materials.  If you look at the texture image in an image editor, you'll see that it's still there, and that nothing you do to the mesh is going to change that.
What might be happening here is that UV mapping is being destroyed.  Generally, textures use UV mapping to create correspondences between the 3D mesh and and the 2D image, so that the image can be mapped onto the mesh.  But if you're deleting and creating geometry, new geometry isn't going to have any UV coordinates specified.  And if you create a face between two old faces, that were parts of different islands, that new face may default to very weird UV.
But there is another possibility, which is that you're losing proper material assignments.  If a mesh object is using multiple materials, and you create a new face, Blender cannot know what material you want the new face to have.  It uses some reasonable guesses, but those can be wrong.  If Blender guesses wrong, then your new faces may be assigned a material that doesn't reference the material using the texture image, or perhaps one that uses the texture image in a different way.


text:
Is it possible to hide parts of a mesh where it intersects with another?
First off I am incredibly new to blender and have been working through my project by searching for tutorials online. However I have an issue I can't find a solution to.
I am working on a Fashion based project. I have an Avatar posed and in the position I would like to keep it, so no need to rig it. on that avatar I would like to layer up a t-shirt with a jacket. Both the jacket and the t-shirt are imported OBJ files from another programme. They were created separately and so when I import them both in place, large parts of the T-shirt mesh poke through the Jacket mesh. Screen shot attached.

Is it possible to Hide parts of the t-shirt mesh that poke out through the jacket, without hiding the whole thing. Essentially I want to be able to use the t-shirt alone as well as layered with the jacket  (and do this lots of times with other garments) so I don't want to edit the mesh.
I want it to be able to be an automated NFT so the jackets and tees (and other garments) will work when randomised regardless of what they're layered with.
Any help would be much appreciated.
Thanks

You can use the Mask modifier to hide some parts of your mesh

Thanks Moonboots. Will I need to select the parts of the mesh I want to mask first in editor mode. is there a way I can select the mesh in object mode and basically tell it - When this mesh intersects with another, hide wherever it pokes out beneath it. - I realise thats not an easy task but I want to try to get it so when it is automated and an instance doesn't have the jacket, the t-shirt looks fine.

maybe give a try with the VertexWeightProximity modifier, the jacket will determine what is supposed to be hidden, I'm not sure it will be perfect though

I'm not sure it will work but you could try a Mask modifier with a Vertex Weight Proximity modifier:
Select the body (the t-shirt in your case), select all in Edit mode and assign to a new group. Give a Cloth simulation to the jacket, a Collisions simulation to the body. Give a Vertex Weight Proximity modifier to the body and a Mask modifier. In the Vertex Weight Proximity choose the vertex group you've created and select the jacket as Object. Also choose Proximity Mode > Geometry and click on Vertex. Set the Lowest and Highest values. In the Mask modifier choose the vertex group and click on the Invert button:

Now the body should be invisible where the jacket touches it:

Thanks @moonboots. I think im just struggling to implement what you've suggested as im such a novice to the programme. I'll keep on playing with the settings of what you've said and see if I can make it work, but so far ive had no results. really appreciate the help

OK but I need more informations to guess where you've made a mistake  ;)


text:
Fill doesnt seem to work properly? Or im doing something wrong?
I'm new to the blender, and I don't understand how "Fill" works. Almost every single time I try to use it, it doesn't fill everything and leave a lot of missing spots.
Example: I have this torus which I'm trying to make a little less round

I select and then delete the first outer loop of vertices to make it look like this:

After that, I select last 2 loops and try using "Fill", which does this:

It's only poorly filling one side, leaving everything else empty, and the only other option that I can think of is slowly and manually make all faces, which I did with the inner side of torus. Am I missing something? Is there's any other way to do that I'm not aware of?
Blender version: 3.3.1

Ctrl E > Bridge Edge Loops or right click > LoopTools > Bridge (if you've enabled the addon) are the way to do it, in my case if I try to fill it will fill the selected circle, it won't try to bridge

Try "Bridge Edge Loops" instead, it will work:


text:
How can I render albedo pass (color without shadow)?
I have tried to follow these instructions but I am not able to recreate the steps in blender 2.8. I have asked this question before and one of the steps was to set the "diffuse" setting to "color":

But I cannot find this on Blender 2.8:

So how can I render an albedo using blender 2.8?

The diffuse color render pass is not available in Eevee.
Diffuse color render pass (AOV) is available for Cycles as well as for Eevee. Go to Properties > View Layer > Passes > Light and enable Diffuse (Color):

Also see the manual: https://docs.blender.org/manual/en/latest/render/layers/passes.html#light

I have done this, but when I go to render (render > render image) the render is still affected by the world brightness, which changes the colors of the texture. Am I missing something?

Yes, you have to go to the compositor and save the render pass as a separate image using a file output node or connect the render pass socket to the composite node, if you don't need the "normal" render.

Thanks! I still have a problem though. The diffuse color render pass still looks washed out compared to the original texture even though I have "look" set to "none" and color space set to linear AND "diffuse" light set to "color". If it helps, here is the blend file.

oops! Here is the texture I'm using

@brockmann Thanks for the update.


text:
How can I add vertices from a given csv-list with x-, y- and z-coordinates?
I have the following situation:
I have a stl-file, I write every vertices-coordinates into a csv-file.
Then I kind of "arrange" all the values, do some other math-stuff and as a result I get another csv-list with (x,y,z)-co-ordinates for every vertex.
My problem is now:
When I try to import and plot the vertex-co-ordinates I'll get a bunch of lines, all connected to with the origin, instead of a clean line along the, as I thought, single vertices(red line). See the picture.

Now, can anyone tell me if and how it is possible to create single vertices with 3D-co-ordinates? If you need some of my code feel free to ask.
Thanks to everyone.
EDIT:
Here is the script:
import numpy as np
import csv
import os
import bpy
import math

filename = 'list_of_Vertices.csv'
directory = r'full path to file'  # <-- if windows, the r is important

fullpath = os.path.join(directory, filename)

with open(fullpath, 'r', newline='') as csvfile:
    ofile = csv.reader(csvfile, delimiter=',')

    # this makes a generator of the remaining non-empty lines
    rows = (r for r in ofile if r)
    print(rows)
    # this converts the string representation of each line
    # to an x,y,z list, and stores it in the verts list.
    verts = [[float(i) for i in r] for r in rows]

if verts:
    # curve coordinates require a 4th 'W'(weight) component,
    # the +[0.0] adds that for us
    out2 = []
    [out2.extend(list(i)+[0.0]) for i in verts]
    # has one coordinate by default, we add one fewer than we need
    num_points_to_add = len(verts) - 1
    curve = bpy.data.curves.new("path_name", type='CURVE')
    polyline = curve.splines.new(type='POLY')
    polyline.points.add(num_points_to_add)
    polyline.points.foreach_set('co', out2)

    obj = bpy.data.objects.new("obj_name", curve)
    scene = bpy.context.scene
    scene.objects.link(obj)

    # Verts in einzelne Spalten x,y, und z übergeben
    def column(matrix, i):
        return [row[i] for row in matrix]
    x=column(verts,0)
    y=column(verts,1)
    z=column(verts,2)
    #Kopie der Daten anlegen
    x2=x
    y2=y
    z2=z

    #y auf eine ganze Zahl runden
    y=np.round(y,0)

    #Maximum und Minimum herausfinden, daraus die Differenz berechnen
    Max=max(y)
    Min=min(y)
    Diff=math.floor(Max-Min+1)
    print(Min)
    print(Max)
    print(Diff)

    #Alle werte des Zahnfleisches auf Null setzen
    for i in range (1,len(y)):
        if z[i]<= -1:
            x[i]=0
            z[i]=0
    #Werte für x und z in Matrizen schreiben
    Posx=np.zeros(shape=(len(y),Diff))
    Posz=np.zeros(shape=(len(y),Diff))
    h=0
    k=0
    for i in range (0,Diff):
        h=i+Min
        k=0
        F=np.where(y==h)
        F2=np.transpose(F)
        L=len(np.transpose(F))
        for j in range (0,len(y)):  #Diff durch ley(y) tauschen!!
            if F2[k,0] ==j:
                Posx[j][i]=x[j]
                Posz[j][i]=z[j]
                if k<L-1:
                    k=k+1
            else:
                Posx[j][i]=0
                Posz[j][i]=0
            if Posz[j][i]<=0:
                Posx[j][i]=0
                Posz[j][i]=0
    main_path = os.getcwd()
    print("writing to: " + main_path + "\n\n")

    outputfile = 'full path to new file'
    with open(outputfile, 'w') as w_file:
        for i in range (0,Diff):
            coords1 = Posx[i,:]
            w_file.write(str(coords1)+" \n")
    #Minimum und Maximum suchen
    Minimum=np.arange(Diff)
    Maximum=np.arange(Diff)
    Maxz=np.linspace(0,1,Diff)
    Minz=np.linspace(0,1,Diff)
    Posmin=np.arange(Diff)
    Posmax=np.arange(Diff)
    mini=np.min(Posx,0)
    maxi=np.max(Posx,0)
    Minimum=mini
    Maximum=maxi
    for i in range(0, Diff):
        if Minimum[i]==0 and Maximum[i] !=0:
            Minimum[i]= min(i for i in Posx[:,i] if i > 0)
        if Maximum[i]==0 and Minimum[i] !=0:
            Maximum[i]= max(i for i in Posx[:,i] if i < 0)
        for j in range (0, len(y)):
            if Posx[j][i]==Minimum[i]:
                Posmin[i]=j
                Minz[i]=Posz[j,i]

            if Posx[j][i]==Maximum[i]:
                Posmax[i]=j
                Maxz[i]=Posz[j,i]

    yAchse=np.arange(Diff)
    n=0;
    for i in range(0, Diff):
        n=Min+i
        yAchse[i]=n
        coords = (Minimum[i], yAchse[i], Minz[i])
        curveData = bpy.data.curves.new('myCurve', type= 'CURVE')
        curveData.dimensions = '3D'
        polyline = curveData.splines.new(type='POLY')
        polyline.points.add(Diff)
        polyline.points[i].co = (Minimum[i], yAchse[i], Minz[i],1)

        curveOB = bpy.data.objects.new('myCurve', curveData)

        scn = bpy.context.scene
        scn.objects.link(curveOB)
        scn.objects.active = curveOB
        curveOB.select = True

### für die Kurve auf der anderen Seite der Zähne ###

for i in range(0, Diff):
        n=Min+i
        yAchse[i]=n
        coords = (Maximum[i], yAchse[i], Maxz[i])
        curveData = bpy.data.curves.new('myCurve2', type= 'CURVE')
        curveData.dimensions = '3D'
        polyline = curveData.splines.new(type='POLY')
        polyline.points.add(Diff)
        polyline.points[i].co = (Maximum[i], yAchse[i], Maxz[i],1)

        curveOB = bpy.data.objects.new('myCurve2', curveData)

        scn = bpy.context.scene
        scn.objects.link(curveOB)
        scn.objects.active = curveOB
        curveOB.select = True

are you looking for a way to do it through python, or just clean up and use that mesh?

Share your script. I expect when you specify the two verts that make the edge, you are always using the first vert with the new vert. You probably want the new vert with the previous vert.