text:
Rendering video sequence editor by scripting
I'm trying to render all individual strips that I have in the video sequence editor in separate files automatically.
I started this script:
import bpy

scene = bpy.context.scene
all_strips = list(sorted(scene.sequence_editor.sequences, key = lambda x: x.frame_final_start))

bpy.data.scenes["Scene"].render.filepath = "/Users/***/Blender/mkv/"
bpy.data.scenes["Scene"].render.image_settings.file_format = "FFMPEG"

for strip in all_strips:
    if strip.type == "MOVIE":
        start = strip.frame_final_start
        end = strip.frame_final_end
        bpy.context.scene.frame_start = start
        bpy.context.scene.frame_end = end
        bpy.ops.render.render(animation=True, use_viewport=True)

but I always get this error:
Traceback (most recent call last):
  File "<blender_console>", line 7, in <module>
  File "/Applications/Blender.app/Contents/Resources/2.79/scripts/modules/bpy/ops.py", line 189, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Could not open file for writing

Is there something wrong with bpy.ops.render.render(animation=True, use_viewport=True), with some context maybe?

Check your permissions to write to that filepath, or if it even exists.  The error is telling you it cannot open the file for writing.

I feel so stupid. I had checked that the directory indeed existed and that I had the right to write in it, but it seems that by specifying bpy.data.scenes["Scene"].render.filepath = "/Users/***/Blender/mkv/" Blender tries to create the file with the directory name (I thought Blender added automatically the filename with the start and end frames but whatever...). I changed it to: bpy.data.scenes["Scene"].render.filepath = "/Users/***/Blender/mkv/" + str(n_strip) + ".mkv" inside the loop and it now works perfectly. Many thanks for the hint!

Hi. If you have an answer, please post it in the answer box below.

It seems that by specifying:
bpy.data.scenes["Scene"].render.filepath = "/Users/***/Blender/mkv/"
Blender tries to create the file with the directory name (I actually thought that Blender added automatically the filename with the start and end frames...). I changed it to:
bpy.data.scenes["Scene"].render.filepath = "/Users/***/Blender/mkv/" + str(n_strip) + ".mkv"

inside the loop and it now works perfectly.
Kudos to batFINGER for the hint.


text:
Editing the ends of an extruded section
First visit to the forums so hope I am in the right place to ask this question.
I have created a few projects as I get more familiar with some of what Blender has to offer.
I am seeking the best way to tidy up the ends of extruded lines when they intersect.
I have added an image to help show what I mean.
Basically to have the ends terminate within the enclosing  boundary rather than poking through as they are.
The extruded shapes are bezier curves if that helps?

Do you want to finish up with a contiguous (manifold) surface? or just  hide the open ends?

Hello Robin, Many thanks for taking the time to respond. I am looking for the ends to be not protruding through the supporting curve. As each of the struts are meeting the curve at different points in the curve then each of them requires a different cropping so that they don't protrude through the outer surface of the supporting curve. Hope that this makes sense?

What about a big Cylinder (diameter equal to that ring we see) and using boolean operation on the extruded ends?

AFAIK, there's no way of trimming Curves natively in Blender, (cutting a spline, and recalculating the parameters to approximate the intact spline.) It can be done outside, at least in Adobe Illustrator, I don't know about others.
Inside Blender, I think you have to go via a mesh representation... something like this...

In Object Mode, AltC, convert the stock curves to a mesh, and CtrlE > 'Bridge Edge Loops'

Raise the trimming curve above the mesh in, say, Z..
In Object mode, select the cutter, then the stock, making it active, put it into Edit Mode.
Looking down Z, Knife Project the cutter onto the stock, with 'Cut Through' checked.
In face mode CtrlI invert the selection of faces, and X delete.
In edge mode, CtrlAlt select a vertical ring of edges, and in the Select header menu , Select Loops > Edge Loops.. check for edges not caught by the loop selection..

P part a duplicate of the edge selection to a new object, and AltC convert back to a curve.

I may have missed a trick or two.. and would expect your situation to be slightly different anyway...

Oops.. if your question was just about trimming the ends of curves which already fit, then converting to mesh and Knife Project may be enough.

Well after a bit of hacking and tweaking I think I have learned a lot through this exercise.
So basically I converted the curve to a mesh then used the knife tool as suggested and then had to delete the extraneous material. It was I guess more obvious now than it was at the start of the process.
It was a bit footer due to the location of the parts and the shapes involved but a lesson learned.
many thanks for those that offered other solutions. Its good to know there is support out there as one wades through the endless possibilities of blender.
Best wishes.

You can create a weight paint at the ends, and assing that vertex group to a skinwrap modifier.

Sounds intriguing! Unintelligible to an amateur like me but intriguing none the less. Thanks for your input!

It is a good idea using shrinkwrap on the end edge loop to project onto the target tube.  Can you please elaborate on the answer.  As commented above if you are unfamiliar with the concepts its "unintelligible"

Hello, Thanks  for your response. I am afraid I am unfamiliar with the terminology which is why it was a bit unintelligible to me. I am a newbie with Blender. I have been trying a few ways to achieve what I want and am learning a lot about blender through the process but this particular issue is one which I am not yet finding a resolution to which is why I was seeking to consult with those who know so much more.

I should add for clarity that the straight sections are bezier curves straightened out and extruded with a radius and depth applied. I have tried converting it to a mesh and then modifying it from there but its not a very tidy method of working using the knife tool. I am still trying things so am not just sitting hoping someone may come along with a solution. However if anyone has any relevant video clips or support documents that may help in enlightening me then that would be great.

Can I also say that if I am missing a really obvious solution to this then forgive me. I am here to learn!

@Tonzodehoo https://blender.stackexchange.com/questions/101310/is-there-a-way-to-shrink-wrap-only-a-section-of-a-mesh

source: Stack Exchange

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

sort: votes


text:
Why are the object proportions from Blender to Unity not being respected?
There is an object in Blender which, when transferred to Unity, does not match one part.
In Blender:

In Unity:

Please replace the file link to an upload on blend-exchange, which is a permanent hosting service.

@Leander Now it's ok?

Well first of all, you need to apply scale to all your models (which are all different by the way). In object mode select each part individually and press "Ctrl+A" and apply scale. See if that works first.

@MarkJackson It's works. Can you make answer?

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


text:
How to make "Idle" animation like in "Overcooked"?
I am new here and I wanna try to make Idle animation for my character like in game "Overcooked".
Example:

I try to make skeleton animation like here.
But my Blender give me error.

(I think it's because of my shoulders).
Anyway, give me, please, some advice and tips, how to make animation correctly for my character? Bone structure? Weights? (I think error not main qestion?)
Thanks for attention and help!
P.S. English is not my first language.
P.S.S. Files? Here and here?

If you want to make it bounces a bit like in your animated gif, you can select your top bone and altP > Disconnect Bone. The bone remains the child of the bottom bone but it can move independently. Now you can move it up and down. About the rest of your question, in my opinion it's much too broad for a forum.


text:
Cartoon series - Resources all in one
I was working to achieve a cartoon series using Blender, where as I am still struggling with many things and each problem arises after one another.
Is it possible for us (All the respected members) to make a list of the skills and resources required to complete the life cycle of a cartoon series? Something like this
Like what basic skills required for it (Modeling, rigging, animation) dependency of the textures and story etc.
So it will be help full for a bigger to use blender from start to end and execute the life cycle.

Try fixing the words in your question. Who is "us" and what is a "list down" check your grammar and spelling.

Are you saying something like an animator's tool box and essential guide to make animations with Blender?

The complete set of skills are those necessary to make a movie plus those necessary to model 3D objects plus those necessary to rig and animate characters. Borrowing from Sidney Lumet's "Making Movies" the movie making skills include

writing the story. This is the most important.
directing
set design
lighting
cinematography
art direction
foley (sound effects)
scoring (writing the music)
editing
The skills related to 3d animation include
creating materials and textures
creating the 3d objects
rigging, with face rigging being a whole category
character animation, with face animation being a whole category

There are many good books and online tutorials on movie making, 3d modeling, and animation.

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


text:
Why does copy rotation constraint invert after 180 degrees
I'm try to rig a low poly clock for blender, so I added a copy rotation constraint so the minute hand would automatically spin with the second hand, but when I rotate the second hand 180 degrees, the minute hand reverses its rotation.

I think it has to do with how Blender handles rotations internally concerning positive and negative values, but I don't know hot to actually solve it. It also only seems to happen when the Influence parameter is set to lower than 1 unit

Maybe you can alternatively do it with drivers instead.

Rather than add constrains use a driver on the rotation properties of the hour hand by right clicking them and choosing Add Driver > Manually Create Later

Then proceed to the Graph Editor, change to Drivers from the header, and choose the desired channel (Z in this case).
From there open the Properties Panel (N Key), Drivers tab choose the option Scripted Expression and add a new variable.
Use the Transform Chanel option, pick the other hand and choose its $Z$ Rotation. The scripted expression should read something along the lines of $var/12$ so it rotates at one twelfth of the angular speed.

Thanks, I didn't know how to multiply scripted expressions. This fixed the problem.

There really seems to be a limitation with rotational constraints. You run into a similar problem if you are using Transformation Constraints instead of Rotation Constraints, where after a full revolution the hour hand would jump back to the 12 position and start again from there. But: Using Transform Constraints you can rig that situation the other way around. In other words, animate the hour hand, and have the minute hand follow accordingly.
Here is a blend file that shows this idea:

And a quick screenshot of the constraint setup:

As you can see, I have extrapolate checked, and map from a source rotation to a target rotation in local space. The values I set are simply the time values: If the hour hand moves by one hour, the minute hand shall rotate for 12 hours, or a full revolution of 360 degrees in other words.

The other answers are good solutions, but nobody (so far) has answered your explicit question, which is why this happens.
Here's what Blender does when it figures out a copy rotation constraint:

It reads the f-curves.  It runs any f-curve modifiers.  It applies any drivers to these values.
It turns these values into a 4x4 transform matrix.
In order to evaluate the constraint, it decomposes the matrices of both the constraining and constrained objects into location, scale, and XYZ Euler rotation triplets.
It adds a multiple (from constraint influence mostly, usually) of the rotation channel of the constraining object's transform to the constrained object's rotation channel.
It converts the new loc/rot/scale triplets of the constrained object back into a 4x4 matrix for rendering or further constraints.

The important thing to realize here is that an orientation, as a set of rotation triplets back on step 1, is aliased-- there are multiple sets of numbers that can give you a particular rotation.  For example, 360 degrees rotation is the same as 0 degrees of rotation, right?  In a way, the f-curves contain not just the orientation information, but a little bit extra information-- how many times they've made full rotations already, maybe.
But when we get to step 2, 4x4 matrices are not aliased.  There is only a single 4x4 matrix to represent any particular orientation.  That extra information about how many times it's already rotated is lost, and is unavailable to any constraints.
(Why do this?  Mostly, because of space switching.  You can convert orientations to different transformation spaces, but you can't convert "how many times it rotated."  That just isn't something that makes the same kind of sense when evaluated in arbitrary spaces.)
So when Blender takes your 190 degree rotation, turns it into a matrix, and then turns it back into triplets, what does it get?  It's designed to output results from -180 to 180.  So 190 degrees is equal to -170 degrees, and that's what it returns, and that's what gets used by your constraints.  If you're using some fraction of this as a multiple, you'll see your constraints jump.  Like if you were copying rotation at 0.5 influence, you'd all of a sudden go from 90 degrees rotation to -90 degrees rotation.

Interesting read. Did you gather this information from the manual or the source code of blender?

No, it's mostly from understanding math from editing shaders and reading a lot of people writing about engine creation, and then observing Blender's behavior with constraints.

Although this question was essentially answered a long time ago. There are few things I want to add.
I encountered the same issue creating what is essentially Ramyans Haircopter.
What I found out is that both the Transform and the Rotation Constraints work just fine (tested in 3.0) when the Influence is 1.
However when the Influence is less than 1 (or the transform constraint maps a 180 to a smaller degree) the mentioned issue appears. So if you instead use a Transformation constrain to map from the lower value to the higher value the Issue can be worked around (as showcased in aliasgurus File).
So these mappings are fine:

while these are not:

So essentially what I do for my Usecase is rotating the topmost bone 4 times as much and the last bone 1 times as much, instead of rotating the first bone 1 times as much and the last bone 0,25 times as much.
Hope my findings are helpful for someone.

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


text:
blender openexr produces low pixel values
I am rendering few scenes in blender and saving them in openexr image format. I read the exr images using python opencv2, and print out the minimum and maximum pixel values. It is a bit strange that the maximum pixel value of the images are extremely low, some of them are even less than 10.0.
Is it really poossible or am I doing something wrong while rendering? Any help would be really appreciated.
My code is pretty straight forward:
import cv2
image1 = cv2.imread("path to my exr file/hdr_image.exr", cv2.IMREAD_ANYCOLOR | cv2.IMREAD_ANYDEPTH)
print (image1.max())
print (image1.min())

kangkan

Check that you are reading rgb values and not z-depth. A good hdri will have values around the sun of several thousand, the other 95% of the image will be in the 0.0 to 1.0 range. A default blender scene render will have most rgb values in the 0-1 range. With the image in blenders uv editor, right click on the image to see rgb values.

I am aware that I am reading RGB values but if I want to know about the dynamic range of a particular .exr file then am I suppose to read the z depth? Can you please tell me when you mentioned "valuesaround the sun of several thousand", how can I see these values? Are these RGB values or you are talking about the z depth?

If you look at the rgb values of a hdri that has a sun in it, around the sun they will be very high, most other areas will be in the 0-1 range. Here is an example showing the rgb values around the sun. I mentioned z-depth as a rendered z-depth pass in the exr file will definitely have values larger than 1, the z-depth pass contains the distance from the camera. If you aren't getting values under 1.0 then I would expect you to be looking at the z-depth. Open the image in blender's image editor and click to see the rgb values.

"most other areas will be in the 0-1 range." Absolutely false. 1.0 means nothing in a scene referred image, and instead are a series of values along a spectrum that depends on scene contexts. Determining dynamic range is more or less simple math based on minimum and maximum values, the formula for which is elsewhere on this site.


text:
Can Rigid body follow a path
I want to make an asteroid falling on earth.... something like that so I want to know how this is possible, because rigid body falls straight to earth, and asteroid falls diagonally.

Rigid Body can fall diagonally too if you set an initial velocity in shear direction.

Can you explian it? Plz

Initial velocity
An object's location and rotation can either be animated by hand or by rigid body simulation. Both things are not possible at the same time for logical reasons. Rigid bodies have the Animated option to switch which animation mechanism is used at any point in the timeline. We can use this to control the initial velocity.
Rigid Body Settings
Set the planet to passive type, the asteroid to active and give it an initial velocity using keyframes and the Animated option, as explained in the link.
Gravity
Depending on how big your scene is compared to the planet, the direction and strength of the gravity force can be regarded constant or not. If the asteroid is only seen from the ground's perspective, it is usually sufficient to use a constant field.

Constant field
Using the default settings for gravity in Scene panel is sufficient for this approach.
Variable field
Deactivate the gravity in Scene panel and add a force field of Point shape on the planet, or in a seperate force field object. Check the Gravitation setting for more realistic force magnitudes.


text:
Rig moves when switching action in action editor
I can't seem to get around this problem.
I have multiple animations in the same file and when I switch actions in the action editor the rig moves, but gets back into place as soon as I edit anything.
I wouldn't think to much of it, but when i export the animation in Unreal my frame 0 doesn't represent the actual frame 0 I have in blender for that animation and seems affected by that same weird bug.
Frame 0 in blender:

Frame 0 after switching action:

frame 0 in Unreal 4

Also if it can help with finding what's the problem, heres frame 0 in Unreal 4: https://imgur.com/a/ZireV

The little bones on floor in image 2, are they IK target bones for the feet?

Yes, the bones that goes to the heel in both feet are Ik bones.

Alright so I tried fixing this issue by myself and found a work around, I had to delete all other actions from the file and now on export there was not this weird influence on the first frame. Not the most convenient fix, but a fix nonetheless :P.

I wouldn't consider this question answered though. I have the exact same problem as I'm trying to piece together a couple of actions into a larger sequence including moving the character's root half way in, when the walk cycle action starts. It seems Combine blending will destructively mess up some actions forever as far as NLA playback goes. I can play specific actions fine in the Action Editor, but they seem to behave completely irratinal when playing all in sequence. (I've keyed ALL bones in LocRot at the start and end of all actions. Currently using Blender 3.5.1/Win 11.)


text:
Robot Rigging: Join + Parent Bone or Parent to Empty Group
For robot/mecha rigging, is it better to rig by:

Join objects, and parent bone to the armature?
OR
Parent with Empty group, and assign each bone to armature?

If both methods are viable, then what is the major difference between these two methods?
Thanks

i personally would use objects and parent to bone. I have no idea why you want to join first, because this would make things complicated, wouldn't it?

Depends on what kind of tweaks you might want to do down the road, but I would join first.

imho it's more convenient to have one unique object so I would lean towards solution #2

For complex mech designs, will people join object? or do parent with empty groups? When I was looking through tutorials - there was mix between two methods, so I wasn't sure which methods to follow;

There isn't a single right answer to which is better.
Usually, visually, the two models are going to be identical, whether they're armature deformed from single assigned groups or bone parented.  (Depending on whether you're doing anything weird.)
In Blender, the bone parented parts are going to be more performant than the armature deformed parts-- potentially much, much more performant, if there are a lot of vertices, a lot of bones, or live modifiers.  For example, a subdivision doesn't need to be recalculated on an object transformation, but it does get recalculated on armature deformation, even if it ends up being the same in both cases; and when a subdivision is recalculated, it gets recalculated on the whole object, so there's a big difference between that object being one piston and that object being a whole robot with fifty pistons.
In other animation engines, this is not necessarily the case.  Game engines use more highly tuned armature deformation algorithms, and might even use a specific single-bone algorithm for when that's appropriate, leading to performance about equal to object transformation (but perhaps done on CPU rather than GPU, so it's kind of apples-to-oranges); meanwhile, each object requires its own draw call, enough of which can bottleneck performance.  In a game engine, I would generally expect the single armature-deformed object to be more performant, but it can depend on a lot of variables.
Beyond performance, there are usage issues.  There is something nice about creating objects such that a single, discrete, conceptual thing is also a single, discrete object in the interface.  While multiple objects can be organized together via collections or parenting, it is easier to animate a shapekey on a single object than on a collection of objects, it is easier to adjust UV or vertex groups (which may be used for more than just deformation) on a single object, it is easier to change modifier parameters, and armature-deformed objects can be separated and rejoined without losing important parenting information (because they're all parented to the same armature, rather than to individual bones in that armature.)
There are also potential issues related to object space.  Armature deformation does not change the space of an object; the object space typically aligns with world space.  Bone parenting does.  This primarily affects materials that use object coordinates, but it can also affect modifiers (displace in local +Z, for example), and especially, can affect geometry nodes, where object space is very convenient and other spaces are very inconvenient.  This is a situation where, again, there is no right answer-- sometimes you want your GN acting in the space of the world and sometimes you want them acting in the space of the bone-- but bone parenting tends to win out here for how people like to work.  For example, object coordinates can be convenient to use for an eyeball, and those would have to baked to UV textures if you wanted to armature deform, but not if you wanted to bone parent.

I think this answer is a good quick overview without getting too much into detail - usually I would have said the question is asking for opinion-based answers. But at least this hints at what one has to think about when creating these rigs.


text:
From Nodes to Python. Getting the code from a complex shader node tree
I've created a complex shader node tree for the world material and I want to pack it into an addon. Do I really have to recreate all of it in Python or is there a way to just copy and paste the information of this setup into a python script?

Simplest solution, add a blend file with your addon, and in the addon, 'import' the node_group datablock. Making a node from a node_group with python is also not very difficult. You just need to replicate the .nodes, .inputs, .outputs and .links collections.. and set all non-default attributes from each node.

For complex node groups I would concurr with Secrop, you're better off shipping a blend file with your addon and append from it dynamically. Otherwise you can read https://blender.stackexchange.com/q/214911/86891


text:
How can I add color to just the wave texture of my tree?
I have a model tree with snow on top, and I would like to be able to color the rest of the tree without affecting the snow. I am using the "Z" axis from the normals coordinate to add the snow effect and a wave length texture for the bark. What I am hoping to be able to do is affect the colors of these two textures separately but cannot come up with a way. Thank you in advance for the help.

Just use the "snow" ColorRamp as a factor to mix the snow and bark. The bark is the Wave Texture colorized by a ColorRamp node. The snow is just a white color in this example.

thank you so much. I knew it'd be something simple.


text:
Switching from eevee to cycles causes objects to "melt"
creating a small bedroom scene and changed from eevee to cycles to see how it look from there, when my objects started to "melt" (see image)
notes: using Poliigon, and version 3.3

hello could you please share your object? https://blend-exchange.com/

https://blend-exchange.com/b/RlW60Ygw is the object, and it also happens with other models in the scene

Unplug the Displacement node:

Or choose the Bump Only option in the Material panel > Settings > Surface > Displacement. I can't test as you didn't pack the images but the Displacement node displaces the topology if you set it to Displacement, and it only works in Cycles.

It seems to work for the model uploaded, however i encountered the same issue with a seperate model linked here: https://blend-exchange.com/b/614EgjPy and the fix doesnt seem to work

Exact same problem, just make sure that you select the good material in the Material panel (the one that is used for these faces of the object), then unplug

also don't forget to tab into Edit Mode and press a then m > Merge By Distance which will eliminate 1486 duplicate overlapping vertices.


text:
"basic_string: construction from null is not valid" when running blender binary from newly built project
I'm trying to compile the latest [upstream master branch], after the end(exit 0) of make install, running the blender binary (in <build_dir>/blender or in /usr/bin) results in this error
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string: construction from null is not valid
Aborted (core dumped)

after a few searches, I found that there might be literal zeros assigned to basic_string as nullptr, so I added the -Wzero-as-null-pointer-constant flag to the CXX flags, the compiler outputs a lot of warnings throughout the entire build.
I don't seem to know where to go from this.

This is most likely not the first error that happened. I would suggest you do a clean build with e.g. make full debug. Take a look whether the build throws warnings or errors. If it doesn't, check if you're able to run the binary. If it doesn't work you might be able to see what goes wrong with a debugger. Likeliest case is that you skipped some step from the build instructions or there is a bug in the specific commit you're trying to build. In the latter case, run make update and try again.

Since this Q&A site is dedicated to the use of Blender, but your question refers to an error that occurs when compiling the software, I'm afraid that this question is off-topic. Please be so kind and try the official website: https://wiki.blender.org/wiki/Building_Blender


text:
How do I split up geometry without any gaps?
I'm trying to better organize my scene and I'd like to split up my geometry into some parts. However, there always remains a gap in between the parts and I don't get why. Of course, I can easily join the separate objects together into a single object and render the object as a whole:

Can it be that it is simply not possible to keep components of meshes separate? I can not find a way to do that properly but I'm sure there is a way. What am I do wrong?

Comments are not for extended discussion; this conversation has been moved to chat.

Make sure you disable any Smooth modifier on your objects. It will effectively "shrink" the borders of the mesh, creating gaps in disconnected islands.

I just wanted to say thank you to everyone that responded >>> Removing the 'smooth' modifier, solved everything... I would have never solved this on my own... Thanks again :) --> huge thank you to @Gorgious for the fix

@Laz007 Note you can use vertex groups in the smooth modifier if you really want to smooth the rest of the mesh, you can work out a gradient with 0 weight on the border to keep it in place, and a gradual increase in weight over a few edge loops. Cheers

I have used the 'face smooth' with the 'Face select' tab on.... I didn't know there was a gradient weight smoothing available >>> I'll definitely try this out... it's nice to have some more defined edges... I was using the pinch and crease tool to get some edging back again... thanks again


text:
fSpy starting problems 2.8+?
I have downloaded and installed fSpy for linux and installed the add-on but there is very little detail on how to run and use fspy as an app to import to linux as there is no proper tutorial or support data on this issue.
Does anyone have help for running this app for blender 2.8 onwards as I have 2.82?  Trying to do a tutorial and without it I can't do it.

Right-click the Binary (AppImage) > Permissions > Allow executing file... should work on all distros.

@brockmann this does not work as the only file with app is called app.tsx and this does nothing. This is in one of the gui folders.

Don't download the entire repository. You have download the latest binary from here: https://github.com/stuffmatic/fSpy/releases -> fspy-1.0.3-x86_64.AppImage (AppImage file) and the latest add-on for blender from here: https://github.com/stuffmatic/fSpy-Blender/releases fSpy-Blender-1.0.3.zip

I have done so, it works.

Does this answer your question? How to download and install an add-on hosted on github properly?

the documentation is clear: https://github.com/stuffmatic/fSpy-Blender. Additionally read How can I recreate geometry using a photograph?

Don't... download the entire repository.

Download the latest fspy binary from here: github.com/stuffmatic/fSpy/releases
And the latest add-on for blender from here: github.com/stuffmatic/fSpy-Blender/releases.

For Linux (AppImage): Right-click (RMB) the Binary > Permissions > Allow executing file, which should work for all distros.
Further reading: How to download and install an add-on hosted on github properly?


text:
Apply subdivision surface modifier to one axis only (round edges)
I have a mesh in Blender cut such that when I apply subdivision surface modifier, it will become round in the places I want it to. Here's the mesh created by using loop cuts on a basic cube:

Here's what it looks like when I do apply the subdivision surface modifier:

Predictably, the subdivision is applied in all "axes" (for a lack of a better term, this is not exactly about axes). I want to ideally see the subdivision to happen only around the loop of faces which make up the "walls" of the mesh - those intersected by the X and Y axes in the picture. Top top and bottom faces should stay flat except for their corners which should become round copying the roundness that has come about from subdividing the faces.
In a picture, I want this:

I achieved this by loop cutting the mesh along the band of faces which constitute the "walls" of it and setting the factor to .99 and -.99 on the two loop cuts. The subdivision surface modifier still introduces new geometry but it is so close together it visually looks like the top and bottom faces remained completely flat, with just a very slightly round corner where they meet the perpendicular faces to them.
This is a fine result, but I wonder if there is a tool / a way to do this which avoid introducing the unneeded geometry that I have here. I tried using the bevel tool and applying it to the 4 edges of the mesh, but when using that tool the roundness of the edge is not applied to the full extent of the faces to the sides of the edge, just half-way to each:

Am I missing some better technique / tool or is this the best way to go about this?
I am using Blender 2.83.

I'd use the bevel modifier instead. You can target specific mesh parts using bevel weights on edges or vertex groups.
Subdivision modifier doesn't support any form of targeting per say, you can add support loops or use creased to control the deformation on the mesh, but you can't prevent the modifier to operate on mesh parts.

A Bevel mod.  by weight for the rounded corners. followed by a Bevel mod. by angle for the sharper edges would work quite nicely.


text:
How is a texture map (based on a UV-Map) made
I would like to know how the texture is mapped onto a UV-Map. What calculations do a program like substance painter (in my example)? I am asking because I got some problems with the texture and want to understand the underlying workflow of UV-Mapping and texture-mapping.
My Problem:

Eventhough the UV-Map looks fine, the texture is not correctly applied onto the mesh.
EDIT: After I found out that he UV-Map is the problem I tried to figure out where to set the seams. The Smart-UV project helped but of course the result is not that well. In order to understand the UV-Mapping I made another project with the same mesh. Now the Smart-UV project throws an error and I still won't get it unwrapped. It's just impossible.

Is this the view from SP? Did you unwrap it in SP or Blender? Did you get a correct result while painting in SP, and a bad result in Blender, or both were bad result?

It's the view of SP, I don't know how to paint in Blender, will try later.

Might be off-topic if there isn't anything we can help with that is Blender-specific. Not enough of us are using SP to be much assistance here. Only thing I can suggest is to work out the UV projection from top on that road section, needs to be as straight on as possible, same for when it is painted, has to be done from top view I think.

Ok, it is definitely a blender issue. The problem is that the scale of the small faces between each big one are not propotional on the UV-map. Eventhough the scale is 1.0. Do you have a tip, how to scale each face in propotion to all other (on the UV-Map).

No, but you can make a copy of the file and test on that one by unwrapping it using Smart UV Project and then test if that has fixed your issue taking that one into SP to paint it. Your UV unwrapping needs to be redone, but I'd use a copy so that you can try different UV unwrapping schemes until you find you can paint it correctly.

Ok, so the smart UV unwrapping helped. I will have a lool if I can find a doc which describes how Blender does smart unwrapping


text:
Python for Custom Compositor Nodes...not working
I'm trying to create and register a new Compositor Node. The python code runs fine in the Blender console (no errors), but after I run it, nothing happens.
what I expect to happen: When I'm in the Compositor node editor, after I run my code I should be able to find my new compsitor node underneath Add>Input.
However, I can't find it.
import bpy

class InvertColorsNode(bpy.types.CompositorNode):
    # Define the node identifier, name, and input/output sockets
    bl_idname = "InvertColorsNode"
    bl_label = "Invert Colors"
    bl_socket_idname = "InvertColorsNode"
    input_image = bpy.props.StringProperty(name="Image", default="")
    output_image = bpy.props.StringProperty(name="Image", default="")

def init(self, context):
    self.inputs.new("NodeSocketColor", "Image")
    self.outputs.new("NodeSocketColor", "Image")

def update(self):
    # Get the input and output images
    input_image = self.inputs.get("Image").default_value
    output_image = self.outputs.get("Image").default_value

    # Invert the colors of the input image and store the result in the output image
#output_image=(1.0 - input_image[0], 1.0 - input_image[1], 1.0 - input_image[2])

def draw_buttons(self, context, layout):
    # Add a button to the compositor node that allows the user to invert the colors of the input image
    layout.operator("invert_colors.operator", text="Invert Colors")

class InvertColorsOperator(bpy.types.Operator):
    # Define the operator identifier, name, and options
    bl_idname = "invert_colors.operator"
    bl_label = "Invert Colors"
    bl_options = {"REGISTER", "UNDO"}

def execute(self, context):
    # Invert the colors of the input image
    input_image = context.node.inputs["Image"].default_value
    context.node.outputs["Image"].default_value = (1.0 - input_image[0], 1.0 - input_image[1], 1.0 - input_image[2])
    return {"FINISHED"}

def register():
    # Register the custom compositor node class
    bpy.utils.register_class(InvertColorsNode)
    bpy.utils.register_class(InvertColorsOperator)

def unregister():
    # Unregister the custom compositor node class
    bpy.utils.unregister_class(InvertColorsNode)
    bpy.utils.unregister_class(InvertColorsOperator)

# Register the add-on when it is imported
register()
```

The CompositorNode class is not intended for custom nodes, and the execute method won't be used by the compositor.. If you want to create custom nodes for builtin NodeSystems, you need to use the CompositorNodeCustomGroup and build an internal nodetree with the functionality you want.

As I commented above, to create a python custom node for builtin systems (Shader_Nodes, Compositor_Nodes, Geometric_Nodes), you need to use the *NodeCustomGroup classes.
Also, builtin system nodes don't have any functionality inside. That means nodes don't have an execute method. They are a representation of a builtin function that will be added to the execution stack when the engine needs to execute the Nodetree. This is why you cannot create new functionality in Blender without coding it directly into the source.
However, it is possible to reuse the functionality that already is included in Blender, and compose new 'functions' (as in NodeGroups).
The nodes produced with the classes mentioned above will have a similar structure as a NodeGroup but they can have internal functionality (in terms of UI, and reconstruction/edition of its own node_tree).
And after the node creation you'll still need to add the node to the AddMenu. At the moment this can be done with the nodeitems_utils and nodeitems_builtins modules.. In the future this may change, in order to be kept in the same system as the AddMenu from GeometryNodes.
In your example (an invertColor node), the correct python code would then be something like this:
# Node Authors: Secrop
# Node Description: Compositor node for inverting colors
# version: (0,0,1)

import bpy

class CompositorNodeInvertColor(bpy.types.CompositorNodeCustomGroup):

    bl_name='CompositorNodeInvertColor'
    bl_label='Color Invert'

    def init(self, context):
        treename = '.' + self.bl_name
        ng = bpy.data.node_groups
        self.node_tree= ng[treename] if treename in ng else ng.new(treename, 'CompositorNodeTree')
        NgIn = self.node_tree.nodes.new('NodeGroupInput')
        NgOut = self.node_tree.nodes.new('NodeGroupOutput')
        NgMix = self.node_tree.nodes.new('CompositorNodeMixRGB')
        NgMix.blend_type = ('SUBTRACT')
        NgMix.inputs[1].default_value = (1.0,1.0,1.0,1.0)
        SkIn = NgIn.outputs.new('NodeSocketColor', "Image")
        SkOut = NgOut.inputs.new('NodeSocketColor', "Image")
        self.node_tree.links.new(SkIn, NgMix.inputs[2])
        self.node_tree.links.new(NgMix.outputs[0], SkOut)

    def copy(self, node):
        self.node_tree=node.node_tree

    def free(self):
        if self.node_tree.users == 1:
            bpy.data.node_groups.remove(self.node_tree, do_unlink=True)

from nodeitems_utils import NodeItem, register_node_categories, unregister_node_categories
from nodeitems_builtins import CompositorNodeCategory

newcatlist = [CompositorNodeCategory("CMP_MyNodes", "My Custom Nodes", items=[NodeItem("CompositorNodeInvertColor"),]),]

def register():
    bpy.utils.register_class(CompositorNodeInvertColor)
    register_node_categories("MY_CUSTOM_NODES", newcatlist)

def unregister():
    unregister_node_categories("MY_CUSTOM_NODES")
    bpy.utils.unregister_class(CompositorNodeInvertColor)

if __name__ == "__main__":
    register()

Whoah, what an amazing answer! Thank you @Secrop!! I didn't even expect anyone to respond, let alone get such a detailed, thoughtful and helpful answer! You are a lifesaver!


text:
Subsurface Scattering coloration problems
I feel like this is probably a pretty elementary problem, but I haven't been able to find a solution yet. Basically, if I have an object with subsurface scattering on the material node using Principled BSDF, and another object intersects/occludes it, it causes strong discoloration around that object in the opposite color that the SSS color is supposed to be, even with a small subsurface radius. I recreated this issue using simple shapes below, but in practice, this is causing problems for a character bust I'm working on, where the character's skin has SSS and this discoloration issue is occurring heavily where the eyeball intersects the eyelid, and where the hair intersects/clips through the face, so half of the character's forehead looks blue.

This is a known limitation of SSS, basically dued to the BVH handling of the SSS closure. If there are two (or more) objects intersecting, it will fail. If both geometries belong to the same object then Random-Walk will fail, but Christensen-Burley will work ok. The solution is to Boolean-Union all meshes into one closed surface.

@Secrop Thanks for the info! If I merge the two objects (i.e. the 'head' sculpt, which has SSS on to emulate skin, and the hair object which doesn't have SSS) can I then only apply SSS to part of the now-single object or will it all have to have SSS applied?

You may use material slots.. On the object that will get the boolean modifier, add an empty material slot. The modifier will then apply the material from the other object to that slot on the first one.


text:
lights are not showing in blender render mode
hey I just started a couple days ago with blender and I don't know why in rendered mode lights are not showing? scene lights and scene world are on. thank you

Hello, make sure that the Scene lights option is enabled in the Viewport Shading panel (down arrow on the right of the Rendered preview icon on the top right of your 3D view

hey thanks a lot I figured it out just had to put the area lights the other way around:)


text:
Why my render gets overexposed and blurred after the actual calculation?
While rendering everything is fine, but when 100% rendered the objects become blurry and there is some kind of intense light added to the image:

While rendering everything is fine (image while rendering):

Q: Why my render gets overexposed and blurred after the actual calculation?

This looks like an effect done in the compositor, make sure you don't have any effect nodes in the compositor editor

Hi Jameela. Please take your time when asking a question, makes it way easier for us to understand your question and to provide a solution as well... Please read: https://blender.stackexchange.com/help/how-to-ask

thank you and sorry, I dont know good english

@Gorgious I got rid of the filters (glare and bokeh blur) thank you for pointing that out. I just downloaded this file and im pretty new to this. Once ive done that the lighting didnt work at all, whether I use the mesh or the sun

Make sure there is still a link between the render layer and the output node

Hi Jameela, maybe you should provide your blend file so we can check it out and help you?


text:
Donut tutorial level 3 part 3: Why the half of my cup disappears when rendering the scene?
I following the donut tutorial level 3 part 3 where I am asked do a rendering image of the cup.
From the camera perspective it looks like this

But when I render it half of the cup has disappeared in the plate

How do I solve this? You can find my file here: https://blend-exchange.com/b/86QL38Kz

Hello and welcome. Please use a title that reflects the content of the question. It should be succinct, unique and identifying, and summarize what the issue is so that users can at a glance broadly understand what your post is about before opening it. Use the [edit] link below your post and avoid any emojis salutations or extraneous text not essential to the question. Remember, your title is the first thing potential visitors will see, and will weight heavily on their decision to open your question, which will directly affect the number of answers you might get.

Your first screenshot of the 3D Viewport is not the scene you have rendered. It's not the plate hiding the cup, the render doesn't even show the plate - it's below the plane. In your file you have moved the plane upwards so it's halfway in the cup - that's why everything is hidden below.
EDIT: If you only move the plate with the cup (parented to the plate) upwards instead of the plane downwards, they will be back under the plane as soon as you render or play an animation, because the plate has keyframes on location, rotation and scale which place it below the plane.
Your 3D Viewport when I open your file:

Side view in Wireframe mode:

Hi Gordon :)
It still happens when I adjust the cup. I just did it with the same result.

That's weird, I tried it as well and it works fine for me if I place cup higher or plane lower

@Maaske Have you tried adjusting the plane? Because your plate has got a keyframe for location, rotation and scale, so whereever you move it, it will jump right back for the render or if you start the animation. And since the cup is parented to the plate, it will move with it. There's also a keyframe on the plane material and the light... is that on purpose or by accident?

@MikoCG Placing the cup higher will not get the plate above the plane... and if you move the plate up, it will jump back below the plane because of the location keyframe.

@GordonBrinkmann Thanks that sounds like it could be the case. Do you know how to adjust the keyframe?

Do you need the keyframes? If not, just delete them all... select the plate, in the Timeline window make sure all keyframes are selected by hitting A, then X > Delete Keyframes. Stupid question on my behalf: even if you keep the keyframes, would it be so terrible to just move the plane down?

@GordonBrinkmann Thank for the help. I did move the plane down but everytime I did the rendering it would go back up. But now it is fixed


text:
Ocean scene - Why my rendered image is not similar to the viewport preview?
I am trying to make an ocean scene but when I render it, it is not similar that preview in camera view mode and I do not know what to do in order to fix this.
Blender file link for your reference:
https://pasteall.org/media/a/3/a311d8909182a823b1bfafa3cba73f3b.blend
Does anybody know why my rendered image is not even similar to the preview?

In the Ocean modifier, you need to put the same value for Render Resolution and Viewport Resolution:

thank you so much @moonboots that was really helpful


text:
How to project an image through the lens?

I have an image (on the top in printscreen 1), the lens, and the white plane (screen) under the lens. I expect to see projection of the image, I change position of the lens - nothing matters, the screen is black.

I also have a small cub and you can see that refraction does work (you can see refracted cub).
Is there any way to manage that? Eevee (2.8+) or blender internal (2.79-), no Cycles.
This is 2.8 file

EEVEE is not supporting indirect lighting right now. You still can use Irradiance Volume and indirect light projection to Bake those effect into your scene.
If you set a proper light map, it might work
Refraction won't provide any light into the scene maybe. And it use some algorithm to achieve it in EEVEE, which is not focus on project light. In these kind of problem, we usually adopt ray tracing to mock the effect, which EEVEE is not good at it. EEVEE is rasterization rendering engine.

Wow, I've never dealt with Irradiance Volume and indirect light projection. I'll try. What about 2.79 blender internal render? Can it be solved there?

Same as EEVEE. Both are rasterization, not ray tracing. It'll be very difficult to solve the problem unless rewriting the shader program like all 3A games did.

Got it.
I tried Irradiance Volume and indirect light projection and it didn't work. Maybe I did something wrong but I only get shadows of the lens on the screen but not the image. I turned off the lights, made the image just a small plane with emission shader (10 units emit), and yes, I see the indirect lighting from the image on the screen and the shadow under the lens. I tried to change lens position, something changes, but I can not see plane as an image under the lens anyway.


text:
OSL Volume in 2.79
I'm learning to work with OSL but it seems something has changed between Blender 2.79 and previous versions regarding OSL Volumes...
shader node_volume(output closure color Volume = 0) {   Volume = henyey_greenstein(0.0); }

This very simple osl volume shader does not work in blender 2.79 but it's working perfectly in 2.78.
Is there something I'm missing ?
Thanks in advance,
Max

Seems that was a bug. Reported and corrected. https://developer.blender.org/T53048

As mentioned above it is a bug. it will be part of blender 2.79a. Hopeful it will be released the upcoming weeks. Today we expect that the official test releases will be build.


text:
How to add a fourth vert to a triangle
As you can see in the picture below by extruding sides that were next to each other I have made weird crossing lines and shapes that messed the entire object up. Is there a way to add a 4th vert (corner) to the 3 already selected verts in order to fill the rectangular hole that I have.
I know I can subdivide the top edge and then move the vert on the edge but it will never be 100% in position and I can't align it to any vert or 3d cursor as you can see on the global orientation there, this is an angular side of a larger object.

It's hard to tell from screenshot where edges should be crossing and where not, but there's likely non-manifold geometry which will be tedious to handle. It's easier to remodel that part. As to triangle for now no way to make it quad without deleting anything. Remove the edge going to the top, delete triangle and use F2 addon. But note that this won't be all problems solution

What's the F2 addon?

https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Modeling/F2


text:
Addon scripts overriding each other

I am having some trouble with my add ons. basically i have two add ons that append . blends. but they are both using the same script. so whenever i run the second add on it replaces the other one. I am assuming it is because it is a copy of the same script. so what do i need to alter on the second script to get both to work. i know next to nothing about scripting so any help is appreciated
Script
# Addon Info
bl_info = {
    "name": "The Coral And Creatures Collection",
    "description": "Coral And Creature Models",
    "author": "TRBRenders",
    "version": (1, 0),
    "blender": (2, 92, 0),
    "location": "View 3D > Properties Panel",
    "wiki_url": "",
    "tracker_url": "",
    "support": "COMMUNITY",
    "category": "Add Mesh"
    }

# Libraries
import bpy
import os
from bpy.props import *
from bpy.types import Panel, Operator, PropertyGroup
from bpy.utils import previews
from bpy.types import WindowManager

# Panel
class REAL_PT_trees(Panel):
    bl_space_type = "VIEW_3D"
    bl_context = "objectmode"
    bl_region_type = "UI"
    bl_label = "Coral And Creatures"
    bl_category = "The Coral And Creatures Collection"

    def draw(self, context):
        scn = bpy.context.scene
        layout = self.layout
        settings = scn.trees
        wm = context.window_manager

        # Categories
        col = layout.column(align=True)
        row = col.row(align=True)
        row.prop(settings, "category", expand=True)

        # Previews
        row = col.row()
        row.template_icon_view(wm, "tree_previews", show_labels=True)

        # Furniture name
        name = bpy.data.window_managers["WinMan"].tree_previews
        row = col.row(align=True)
        row.alignment = 'CENTER'
        row.label(text=name)

        # Add Button
        row = col.row(align=True)
        row.scale_y = 1.5
        row.operator("trees.add", icon="ADD", text="Add")

# Append
class TREES_OT_Add(Operator):
    bl_idname = "trees.add"
    bl_label = "Add Tree"
    bl_description = "Add the selected Models"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        category = context.scene.trees.category
        selected = bpy.data.window_managers["WinMan"].tree_previews

        # Append tree
        filepath = os.path.join(os.path.dirname(__file__), "Blends/" + category + os.sep + selected + ".blend")
        with bpy.data.libraries.load(filepath) as (data_from, data_to):
            data_to.objects = [name for name in data_from.objects]
        for obj in data_to.objects:
                context.collection.objects.link(obj)

        return{'FINISHED'}

# Previews
def generate_previews(self, context):
    category = context.scene.trees.category
    directory = os.path.join(os.path.dirname(__file__), "Icons")
    pcoll = trees_collection["main"]
    if directory == pcoll.images_location:
        return pcoll.tree_previews
    # Generate the thumbnails
    enum_items = []
    for i, image in enumerate(sorted(os.listdir(directory))):
        icon = pcoll.get(image)
        if not icon:
            filepath = os.path.join(directory, image)
            thumb = pcoll.load(image, filepath, 'IMAGE')
        else:
            thumb = pcoll[image]
        enum_items.append((image[:-4], image[:-4], "", thumb.icon_id, i))
    pcoll.tree_previews = enum_items
    pcoll.images_location = directory
    bpy.context.window_manager['tree_previews'] = 0
    return enum_items

# Properties
class TreeSettings(PropertyGroup):
    category : bpy.props.EnumProperty(
        name="Category",
        items= [

            ],
        description="Select a category"
        )

#############################################################################################
trees_collection = {}

classes = (
    REAL_PT_trees,
    TREES_OT_Add,
    TreeSettings
    )

register, unregister = bpy.utils.register_classes_factory(classes)

# Register
def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.trees = bpy.props.PointerProperty(type=TreeSettings)

    # Icons
    WindowManager.tree_previews = EnumProperty(
        name="Icons",
        items=generate_previews,
        description="Select Desired Models"
        )
    pcoll = bpy.utils.previews.new()
    pcoll.images_location = ""
    pcoll.tree_previews = ()
    trees_collection["main"] = pcoll

# Unregister
def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    del bpy.types.Scene.trees
    del WindowManager.tree_previews

    for preview in trees_collection.values():
        bpy.utils.previews.remove(preview)
    trees_collection.clear()

if __name__ == "__main__":
    register()

Just rename all the classes and give the add-on a new name. Also please always post code as text.

https://blender.meta.stackexchange.com/questions/2788/policy-on-posting-code-error-message-etc-as-images  Suggest using operator properties to use same operator, eg bpy.ops.tree.add(lib="some.blend", tree="SomeTree")   Also would take advantage of bpy.data.libraries and even using a pointer property.


text:
add on is appending from same file
I have two add ons that append .blend files. they use almost the same code however I changed the name of the class's and file names. but both add ons are appending from the same file. I'm new to this so I am probable missing something
add on 1 -
# Addon Info
bl_info = {
    "name": "The Coral And Creatures Collection",
    "description": "Coral And Creature Models",
    "author": "TRBRenders",
    "version": (1, 0),
    "blender": (2, 92, 0),
    "location": "View 3D > Properties Panel",
    "wiki_url": "",
    "tracker_url": "",
    "support": "COMMUNITY",
    "category": "Add Mesh"
    }

# Libraries
import bpy
import os
from bpy.props import *
from bpy.types import Panel, Operator, PropertyGroup
from bpy.utils import previews
from bpy.types import WindowManager

# Panel
class REAL_CT_trees(Panel):
    bl_space_type = "VIEW_3D"
    bl_context = "objectmode"
    bl_region_type = "UI"
    bl_label = "Coral And Creatures"
    bl_category = "The Coral And Creatures Collection"

    def draw(self, context):
        scn = bpy.context.scene
        layout = self.layout
        settings = scn.trees
        wm = context.window_manager

        # Categories
        col = layout.column(align=True)
        row = col.row(align=True)
        row.prop(settings, "category", expand=True)

        # Previews
        row = col.row()
        row.template_icon_view(wm, "tree_previews", show_labels=True)

        # Furniture name
        name = bpy.data.window_managers["WinMan"].tree_previews
        row = col.row(align=True)
        row.alignment = 'CENTER'
        row.label(text=name)

        # Add Button
        row = col.row(align=True)
        row.scale_y = 1.5
        row.operator("trees.add", icon="ADD", text="Add")

# Append
class TREES_CT_Add(Operator):
    bl_idname = "trees.add"
    bl_label = "Add Tree"
    bl_description = "Add the selected Models"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        category = context.scene.trees.category
        selected = bpy.data.window_managers["WinMan"].tree_previews

        # Append tree
        filepath = os.path.join(os.path.dirname(__file__), "Blendss/" + category + os.sep + selected + ".blend")
        with bpy.data.libraries.load(filepath) as (data_from, data_to):
            data_to.objects = [name for name in data_from.objects]
        for obj in data_to.objects:
                context.collection.objects.link(obj)

        return{'FINISHED'}

# Previews
def generate_previews(self, context):
    category = context.scene.trees.category
    directory = os.path.join(os.path.dirname(__file__), "Iconss")
    pcoll = trees_collection["main"]
    if directory == pcoll.images_location:
        return pcoll.tree_previews
    # Generate the thumbnails
    enum_items = []
    for i, image in enumerate(sorted(os.listdir(directory))):
        icon = pcoll.get(image)
        if not icon:
            filepath = os.path.join(directory, image)
            thumb = pcoll.load(image, filepath, 'IMAGE')
        else:
            thumb = pcoll[image]
        enum_items.append((image[:-4], image[:-4], "", thumb.icon_id, i))
    pcoll.tree_previews = enum_items
    pcoll.images_location = directory
    bpy.context.window_manager['tree_previews'] = 0
    return enum_items

# Properties
class TreeSettingss(PropertyGroup):
    category : bpy.props.EnumProperty(
        name="Category",
        items= [

            ],
        description="Select a category"
        )

#############################################################################################
trees_collection = {}

classes = (
    REAL_CT_trees,
    TREES_CT_Add,
    TreeSettingss
    )

register, unregister = bpy.utils.register_classes_factory(classes)

# Register
def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.trees = bpy.props.PointerProperty(type=TreeSettingss)

    # Icons
    WindowManager.tree_previews = EnumProperty(
        name="Icons",
        items=generate_previews,
        description="Select Desired Models"
        )
    pcoll = bpy.utils.previews.new()
    pcoll.images_location = ""
    pcoll.tree_previews = ()
    trees_collection["main"] = pcoll

# Unregister
def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    del bpy.types.Scene.trees
    del WindowManager.tree_previews

    for preview in trees_collection.values():
        bpy.utils.previews.remove(preview)
    trees_collection.clear()

if __name__ == "__main__":
    register()

add on 2-
# Addon Info
bl_info = {
    "name": "The Countryside Nature Collection",
    "description": "Nature models",
    "author": "TRBRenders",
    "version": (1, 0),
    "blender": (2, 83, 0),
    "location": "View 3D > Properties Panel",
    "wiki_url": "",
    "tracker_url": "",
    "support": "COMMUNITY",
    "category": "Add Mesh"
    }

# Libraries
import bpy
import os
from bpy.props import *
from bpy.types import Panel, Operator, PropertyGroup
from bpy.utils import previews
from bpy.types import WindowManager

# Panel
class REAL_PT_trees(Panel):
    bl_space_type = "VIEW_3D"
    bl_context = "objectmode"
    bl_region_type = "UI"
    bl_label = "Nature"
    bl_category = "The Countryside Nature Collection"

    def draw(self, context):
        scn = bpy.context.scene
        layout = self.layout
        settings = scn.trees
        wm = context.window_manager

        # Categories
        col = layout.column(align=True)
        row = col.row(align=True)
        row.prop(settings, "category", expand=True)

        # Previews
        row = col.row()
        row.template_icon_view(wm, "tree_previews", show_labels=True)

        # Furniture name
        name = bpy.data.window_managers["WinMan"].tree_previews
        row = col.row(align=True)
        row.alignment = 'CENTER'
        row.label(text=name)

        # Add Button
        row = col.row(align=True)
        row.scale_y = 1.5
        row.operator("trees.add", icon="ADD", text="Add")

# Append
class TREES_OT_Add(Operator):
    bl_idname = "trees.add"
    bl_label = "Add Tree"
    bl_description = "Add the selected Models"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        category = context.scene.trees.category
        selected = bpy.data.window_managers["WinMan"].tree_previews

        # Append tree
        filepath = os.path.join(os.path.dirname(__file__), "Blends/" + category + os.sep + selected + ".blend")
        with bpy.data.libraries.load(filepath) as (data_from, data_to):
            data_to.objects = [name for name in data_from.objects]
        for obj in data_to.objects:
                context.collection.objects.link(obj)

        return{'FINISHED'}

# Previews
def generate_previews(self, context):
    category = context.scene.trees.category
    directory = os.path.join(os.path.dirname(__file__), "Icons")
    pcoll = trees_collection["main"]
    if directory == pcoll.images_location:
        return pcoll.tree_previews
    # Generate the thumbnails
    enum_items = []
    for i, image in enumerate(sorted(os.listdir(directory))):
        icon = pcoll.get(image)
        if not icon:
            filepath = os.path.join(directory, image)
            thumb = pcoll.load(image, filepath, 'IMAGE')
        else:
            thumb = pcoll[image]
        enum_items.append((image[:-4], image[:-4], "", thumb.icon_id, i))
    pcoll.tree_previews = enum_items
    pcoll.images_location = directory
    bpy.context.window_manager['tree_previews'] = 0
    return enum_items

# Properties
class TreeSettings(PropertyGroup):
    category : bpy.props.EnumProperty(
        name="Category",
        items= [

            ],
        description="Select a category"
        )

#############################################################################################
trees_collection = {}

classes = (
    REAL_PT_trees,
    TREES_OT_Add,
    TreeSettings
    )

register, unregister = bpy.utils.register_classes_factory(classes)

# Register
def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.trees = bpy.props.PointerProperty(type=TreeSettings)

    # Icons
    WindowManager.tree_previews = EnumProperty(
        name="Icons",
        items=generate_previews,
        description="Select Desired Models"
        )
    pcoll = bpy.utils.previews.new()
    pcoll.images_location = ""
    pcoll.tree_previews = ()
    trees_collection["main"] = pcoll

# Unregister
def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    del bpy.types.Scene.trees
    del WindowManager.tree_previews

    for preview in trees_collection.values():
        bpy.utils.previews.remove(preview)
    trees_collection.clear()

if __name__ == "__main__":
    register()

Please use proper code formatting in your post, otherwise your script is unreadable

Same issue as  https://blender.stackexchange.com/questions/221441/addon-scripts-overriding-each-other  & possibly does not need to be a new question. . If two operators have the same bl_idname eg bl_idname = "foo.bar" the last one registered will be bpy.ops.foo.bar().   As commented on prior question there are also most likely far better ways to design this as one addon  rather than as N near identical addons.

i' m sure there's many ways but since i know nothing about scripting, i am just trying to work with what i got haha


text:
Smoke Simulation Dissolve does not work
I have another problem with smoke! I thought during rendering that the simulation just stops working but after a few tests, with an easier set up in another scene, it looks like dissolve of the smoke domain is not working right. In one frame all the smoke is there, in the next it is completely away.
This "Away" Frame moves when I change the dissolve parameter.
Please help me, I'm completely lost.
Thank you
Laura
Blend file: https://drive.google.com/file/d/1rRE-W2XO8i1YlcYtsUnCfLGOQTDS4ws6/view?usp=sharing

The Problem was the adaptive domain. It stops simulating with a small amount of smoke. Without it, it works

under "Cache" you can change the end Frame - it will stop the animation at that frame, that was my solution for your poblem


text:
Set Rotation of Multiple Objects to 0 Degrees
I want to set the rotation on the x- and y-axis to 0° to multiple objects.
So if object a has x:10°,y:20°,z:30°, and object b has x:40°,y:50°,z:60° they should all have x:0°,y:0°;z:...° after the transformation.
How can I do that?
I already selected all of my objects at a time (pivot point set to individual origins), pressed r for rotation and x to rotate around the x-axis, but then all of my objects rotated for example 10 degrees around the x-axis. But that is not the result that I want. I want every single object to have their rotation set to x:0°, y:0°; z:...°
I am currently working with a particle system, which emits cubes along a path.
When converting the particle system I am left with tons of cubes, which should all have the following rotation properties: x=0, y=0, z=(stays like it is).
If I click on one single cube, I can adjust the rotation value for x, y, (and z) which gives me what I want. But I really do not want to do this for every single object this way. Is there a faster way to change the rotation of multiple objects simultaneously?
I already tried to work with ctrl-c, copy rotation. But as I said, I want the z-axis to be unchanged! This should only affect the x- and y-axis.
(To better understand why I want to do this: You have to look at this like it would be an architecture. You don't want to walk on a tilted floor. It should be even.)

Thank you for your support!

Please include a screen capture of your Blender work for this question and all future questions. I do not fully understand what you want to do or why that would be useful.  What is the larger goal for you?  If you explain your larger goal then there may be more answers.  I have made some guesses in the candidate answer below.

Select via name, zero x and y euler rotations.
Test script. Finds all objects in scene with name starting with "Cube Emitter" and sets the x and y components of Euler rotation to zero.
import bpy

pattern = "Cube Emitter"
#pattern = "Cube"
scene = bpy.context.scene

cubes = [o for o in scene.objects
        if o.name.startswith(pattern)]

for cube in cubes:
    cube.rotation_euler.x = 0
    cube.rotation_euler.y = 0

Select all the items you want to set the rotation to 0 on, and select an object that has a rotation of 0 (or make the change then).
Next open the N menu and Right Click  on the parameter you want to change under the Item Transfer tab and select Copy Single to Selected.

The best scriptless way I've found is:

Create an empty (with 0 rotation)
Add a 'Copy Rotation' constraint to one of the tiles, empty as target, in X & Y only.
With all tiles selected, constrained tile active: Header > 'Object' menu > 'Constraints' > 'Copy Constraints to Selected'
All selected, CtrlA > 'Apply visual Transforms'
All selected, CtrlAltC - Clear Constraints
X Delete empty.

... but there must be a better one?

You can [apply] rotation to the object from the menu
You can manually type in the rotation values for XYZ to be zero
A Script can do the two actions above


text:
Model faces the wrong way. Any way to fix it?
I'm modeling a face in Blender and I realized that it was facing the wrong way. When I had started it was facing the right way. Can anyone help me with this? Thanks!
LEFT IMAGE

You can just select the mesh in Edit mode by pressing A on the keyboard and rotate it on Z axis by pressing R (Rotate) and then Z (to rotate only on Z axis). Change angle as you want and you are set.
Press Z only while you are rotating it, or it will switch to Wireframe mode.

I can't get mirror working the right direction now?

Can you attach your blend file herewith.


text:
Row Summing When Moving an Object
I am trying to move an object using coordinates from a CSV file. The file is written by one python script and then read by a script in blender. Below is the script written to read the file in blender and move the object.
import csv
import bpy

shufflecsv_path = '/Users/Josh/Documents/shuffle.csv'

with open(shufflecsv_path) as file:
    shufflecsv = csv.reader(file, delimiter=",", quoting =
    csv.QUOTE_NONNUMERIC)

    for row in shufflecsv:

        bpy.data.objects['Object'].select = True
        bpy.data.objects['Plane'].select = False
        # row is a list with strings elements so must be converted in float

        x, y, z = -float(row[0]), -float(row[1]), -float(row[2])
        bpy.ops.transform.translate(value=(x, y, z))
        print(x, y, z)

Below is the output of blender when I run the script.
bpy.ops.transform.translate(value=(0.15565, 13.5708, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0.18565, 14.1581, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0.15565, 14.1581, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0.15565, 13.5708, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0.18565, 14.1581, -1.47311), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)

You can see that the output window shows the location of the object should be each of the coordinates, but the object is not at the expected final point.
I have found that when I run the script, the object is moved to a final point that turns out to be the sum of the first three x, y, and z coordinates of the csv file. Any insight, help, or code snippets to fix this problem would be greatly appreciated.

If the csv file has n lines and each rows x, y, z is (1, 1, 1)  would expect the object bpy.data.objects['Object'] to be moved globally by  (n, n, n) from its original global location.  Is this not the case?

can you post the csv, or a portion of it?


text:
Why is my subdivision applying to other mesh?
I applied the subdivision to the toilet and i'm trying to add a cube but it comes already with the subdivsion, what is it?

My guess is that you added the cube while in edit mode, thus making blender count it as a part of the same object as opposed to a separate object. Always add new objects in Object Mode. If you want the existing cube to be its own object, select it all in edit mode and press P (separate) and pick "By Selection". You will have to remove the subdiv modifier from the new object if you do it this way, though.

Yes! that was it, i knew it had to be something little, but it had me struggling 30 mins. thank you!!

https://blender.stackexchange.com/questions/56153/why-cant-objects-in-edit-mode-have-their-own-name


text:
What is the correct way to retopologize?
I made my first full sculpture, but when i start manually retopologizing as shown in tutorials my plane doesnt seem to snap on the surface of the sculpture but inside it, does this matter? can i get some advice?. i dont want to waste hours to see it wasnt meant to be done this way :/

You could give a Shrinkwrap modifier to your object with an offset that will make it shift a bit from the surface

I believe the vertices snap to the surface so the faces will always be slightly inside.  I would take moon's advice.

Yes! You were right, the vertices will always be a little inside the mesh, and yes I applied shrinkwrap at the end and in took the shape very well, thanks


text:
Why do i keep seeing this green/blue light in my viewport?
I just downloaded the latest blender in another PC and imported an image, the green/blue lights appear as soon as i open a new file, need help

Definitely a GPU/OpenGL error. Check and make sure your graphics drivers are up to date, and if that doesn't work, check your blender installation (reinstalling if necessary).

Yes! it was the reinstalling after updating the drivers that solved the issue! thank you so much!!


text:
I’m getting artifacts when setting up a cavity node shader
There are white lines and dots I cannot explain where they come from. The mesh in the areas is flat, there is no non-manifold or loose geometry. The normal maps appear fine.
The normals are fine - all blue when I make face orientation visible. In fact, I can bake out a normal map and there is nothing abnormal visible in the affected areas.
Some areas are higher poly than others, because of dyntopo sculpting in some areas. If I bake it into a diffuse (cavity) map, it carries over to the low poly.
It’s in cycles and the effect works as expected and is visible. The problem is it creates also these artifacts which look like someone drew with a white Sharpie over the mesh. It is directly related to the color ramp node - I can change the color and intensity of the artifacts when changing the values of that node.
It affects several meshes and moving them to a new file with the default blender template doesn't fix the problem.
In the screenshots you can see one of the meshes in object mode, then edit mode (2 million verts), then a close up of the topology where a white line is drawn. Nothing unusual, no 2 overlapping faces or similar. In the mesh options, there is also no custom normals or anything as far as I can see.

The white artifacts are caused because the scale of your mesh is either too small or too big.
Scale the high poly (and the lowpoly if you wanna bake) up/down and apply the scale each time. If you hit the right scale the white lines should disappear.


text:
possibly an edge/vertex crease error causing crash?
good afternoon! this is the first time i'm asking for error help and i think i'm including everything but please let me know if i'm missing something!
i keep getting random crashes, but i think they're mostly happening around crease operations-- i've included the blend file and the error log below, and would really appreciate any help or a nudge in the right direction to solve this error.
thank you!
https://www.dropbox.com/s/avnc0kqmyse0qmg/untitled1.blend?dl=0
https://pastebin.com/edHyu7Nr

Just found the vertex crease feature today, and I've also found that Blender crashes when you right click to cancel the vertex crease. No problems for edge creases though


text:
Rotating individual bones in Python not working
At the end of a script, I need to disconnect all the bones in my armature and rotate them 90 degrees to match what Unreal expects for the joints. I can't seem to get this to work in Python, though.
Here's what I have:
#disconnect the bones so the joints can be rotated to match ue
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.armature.select_all(action='SELECT')
bpy.ops.armature.parent_clear(type='DISCONNECT')

#this isn't working, it still pivots on the median
bpy.ops.armature.select_all(action='SELECT')
bpy.context.scene.tool_settings.transform_pivot_point = 'INDIVIDUAL_ORIGINS'
bpy.ops.transform.rotate(value=1.5708, orient_axis='Z', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=False, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)

It does disconnect the bones, but it does not rotate them around their individual origins. It rotates them around the median like normal.
What am I doing wrong?

yes I can confirm the INDIVIDUAL_ORIGINS is not working in this case... I wonder why.


text:
Animate Real Snow Add-on
I'm fairly new in Blender and I'm trying to animate the coverage/height of the Real Snow Add-On. It worked the first time I added the snow, but sadly it doesn't
anymore ever since. Is anyone having an idea what I'm doing wrong?
Thanks for your help! Much appreciated.

Hello, Denise, and welcome. We've got very little / nothing to go on, here.. Did you save a version that worked?  Can you clue us in to your settings? Maybe share a version, stripped down as far as possible. on https://blend-exchange.com/ ?

No, I couldn't save anything, as I wanted to redo it and then found out, it only worked the first time. Maybe it was also some kind of malfunction/glitch.


text:
shade smooth, shade flat
in older blender you pressed T and a menu on the left popped out with a lot of options, there was also
-shade smooth/flat in the list
where did that menu go? by looing at the blender manual it simply tells me
''object mode > object > shade smooth''
and then shows examples of how it works but gives no instructions on where to actually find this option, pretty much the entire blender manual looks like that with most things to be honest (is there any other version of a manual for blender, with more visual aid?)

There's no other manual I'm aware of. It's talking about the menus at the top, on the editor header:

You can also simply right click on the object:


text:
UV Mapping Mirrored Vertices
I'm not sure what is going on here, but it looks like the UV Smart Project assigned two islands to the same faces. This might be because I mirrored the vertices while modelling. How do I fix this? You can see in the UV Mapping, there are two islands with the same stroke that I applied from the 3D Workspace... I cannot draw on the other half of the tail feather, which is the part where I mirrored the vertices while modelling. How do I fix this so the second island is on the mirrored vertices half?

In that case you need to unwrap again, at least move the face where you don't want the painting to happen?

Select All in Edit mode, M > Merge by distance, then unwrap again?


text:
How to display the motion path of bones in pose mode?
I'm making animation with a single bone for UE4. The motion path is showing when I animate an object in Object Mode but not in pose mode. Is there any way to display the motion path of a bone in Pose Mode?

You have to enable the motion path under the armature properties (green pictogram), not the object properties (orange square).

Thank you very much

Use the Calculate available in Pose Menu.

With a pose bone or bones selected in pose mode, go to Pose > Motion Paths > Calculate
Or as mentioned by @FFeller in the Armature (DATA) Motion Paths panel.

Still not wednesday 7am.


text:
How to access the list of volume grids using python?
I wanted to access the attributes imported with a vdb file but I have no idea how to do that.
Actually what I was trying to do is - In the attribute node in material for the vdb file I wanted to get it from the attributes loaded with the file, and for that suppose I would like to check if the temperature attribute is present or not if it is present fill that in attribute node and if not check for heat attribute and do the same for this also and if this is also not found a check for flames attribute.

Please can anyone tell me how to do this?

Hi. Please try to use existing tags when asking a question. I'm not completely against a vdb tag, but I don't think we have enough questions, asked frequently enough, to warrant this new tag yet. Thanks.

Thank you for the solution, now I do not have any confusion

Recommend use the python console to figure out the path, especially for new and undocumented properties. ObjectData.grids collection holds all the data (fields) you're searching for:
>>> C.object.data.grids.items()
[(0, bpy.data.volumes['Object_Name']...VolumeGrid),
 (1, bpy.data.volumes['Object_Name']...VolumeGrid),
 (2, bpy.data.volumes['Object_Name']...VolumeGrid),
 ...

To get the name for each field, use a for-loop:
>>> for field in C.object.data.grids:
...    print (field.name)
...
density
fuel
heat
temperature
vel.x
vel.y
vel.z

Or a list comprehension to collect the names for your shader setup:
>>> [field.name for field in C.object.data.grids]
['density', 'fuel', 'heat', 'temperature', 'vel.x', 'vel.y', 'vel_z']

Example script on how to check whether there is a certain field (density, fuel, heat etc.):
import bpy

C = bpy.context

for field in C.object.data.grids:
    if field.name == "density":
        print ("Got density")
    else:
        print ("No density field")


text:
Why my geometry disappears when switching to sculpt mode?
When I go into the sculpting tab the meshes are not visible. The only things I see is camera and light.
Layout tab:

Sculpting tab:

Q: How to get the cube back?

What is the version of blender in your case? I check on mine version - it is ok, no such bug, default cube is visible. I have 2.81a

Try "alt + h" or press "/" on keyboard


text:
How to create a button on the n-panel?
I would like to make a custom button on the N-panel.
I already went through blender's templates and amended the ui button script to 2.8 but I don't understand where and how I should implement my code into the template.
Also I would love to be able to remove doubles and display the current vertex count next to it before and after the operation:
import bpy
context = bpy.context
scene = context.scene

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

for ob in scene.objects[:]:
    bpy.ops.object.editmode_toggle()
    bpy.ops.mesh.select_all(action='SELECT')
    bpy.ops.mesh.remove_doubles(threshold=0.02)
    bpy.ops.object.editmode_toggle()

Q: How can I add a custom button with that functionality on the N-panel?

Related re remove doubles multiple mesh objects. https://blender.stackexchange.com/a/68133/15543

Still having issues with showing the vert count

@brockmann THANKS A LOT! works like a charm

@brockmann, i think so.. it does what i want it to do
what's wrong with it?

Added a "final version". I guess your version is even 2 or 3 times slower than my optimized version of your code. Just ask if there is something you do not understand. ...And please don't use this code in your question...

Editted your question according to: https://blender.stackexchange.com/help/how-to-ask

I suggest start here: How to create a custom UI?
To extend the Properties Area of the 3D View you can either register a custom panel to add UI elements onto or you can append elements to existing panels.

1. Panel
Blender comes with a few UI templates (Text Editor > Templates > UI ...) . I'd suggest start with UI Panel Simple ui_panel_simple.py and use it as base to work on. You just have to edit its default variables in order to display the HelloWorldPanel as part of the properties panel:

Set bl_space_type to 'VIEW_3D' to make it part of the 3D View
Set bl_context to eg. 'mesh_edit' or 'objectmode' to either match Edit or Object Mode

class HelloWorldPanel(bpy.types.Panel):
    """Creates a Sub-Panel in the Property Area of the 3D View"""
    bl_label = "My Tool"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "My Tools"
    bl_context = "mesh_edit" # "objectmode"

The HelloWorldPanel comes with a predefined draw method where you can edit the layout as well as adding UI elements to the panel. More interestingly: You can easily add existing operators like bpy.ops.mesh.primitive_cube_add() to the panel by calling the operator() method on the layout element like row.operator("mesh.primitive_cube_add") without the namespace (bpy.ops*).
row = layout.row()
# bpy.ops.mesh.primitive_cube_add()
row.operator("mesh.primitive_cube_add")

row = layout.row()
# bpy.ops.object.origin_set()
row.operator("object.origin_set").type="GEOMETRY_ORIGIN"

To pass multiple arguments read: How to pass multiple operator properties via UI layout?

2. Operator
If you want a custom function assigned to a button, you'll have to create a new operator. Blender comes with operator_simple.py template which is easy to understand. In most cases it's enough adding your code to the execute method, which will be called when the button is pressed.
def execute(self, context):
    my_variable = "Hello World"
    print (my_variable) # Prints 'Hello World' to the Console
    self.report({'INFO'}, my_variable) # Reports 'Hello World' to the Info Area
    return {'FINISHED'} # Return the execution is finished

If you want to call another operator as part of the operation like bpy.ops.mesh.remove_doubles() which only works on meshes, it's a good idea to limit the scope to mesh objects using the provided poll method, even if the operator is only accessible in Edit Mode because otherwise the operator is still callable using the Search Menu (F3):
@classmethod
def poll(cls, context):
    obj = context.active_object
    return (obj is not None and obj.type == 'MESH')

def execute(self, context):
    # Your code here
    bpy.ops.mesh.remove_doubles(threshold=0.02)
    # ...
    return {'FINISHED'}

Also read: What do operator methods do? (poll, invoke, execute, draw & modal)
If you want to display the vertex count after mesh.remove_doubles, you can store the vertex count before calling the operator and then report the actual result:
def execute(self, context):
    obj = context.object
    verts_before = len(obj.data.vertices)
    bpy.ops.mesh.remove_doubles(threshold=0.02)
    verts_after = len(obj.data.vertices)
    result = verts_before - verts_after
    self.report({'INFO'}, "Verts removed: {}".format(result))
    return {'FINISHED'}

3. Registration
Register your classes properly, add your operator(s), labels, and properties to the panel:
import bpy

class MY_OT_custom(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    @classmethod
    def poll(cls, context):
        obj = context.active_object
        return (obj is not None and obj.type == 'MESH')

    def execute(self, context):
        # Your code here
        # ...
        bpy.ops.mesh.remove_doubles(threshold=0.02)
        return {'FINISHED'}

class MY_PT_custom(bpy.types.Panel):
    """Creates a Sub-Panel in the Property Area of the 3D View"""
    bl_label = "My Tool"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "My Tools"
    bl_context = "mesh_edit"

    def draw(self, context):
        obj = context.object

        layout = self.layout

        row = layout.row()
        row.label(text="Active object is: {}".format(obj.name))

        row = layout.row()
        row.prop(obj, "name")

        row = layout.row()
        row.label(text="Vertex Count: {}".format(len(obj.data.vertices)))

        row = layout.row()
        row.operator(MY_OT_custom.bl_idname)

def register():
    bpy.utils.register_class(MY_PT_custom)
    bpy.utils.register_class(MY_OT_custom)

def unregister():
    bpy.utils.unregister_class(MY_OT_custom)
    bpy.utils.unregister_class(MY_PT_custom)

if __name__ == "__main__":
    register()

Appendix
TLDR; If you want to 'remove doubles' (merge by distance) for multiple meshes in Object Mode for whatever reason, use the bmesh.ops.remove_doubles() operator as suggested by @batFINGER, it's 3 times faster.
bpy.ops.mesh.remove_doubles()
As of 2.8x we can enter Edit Mode for all selected objects simultaneously, which avoids looping over all the objects as well as switching to Edit Mode and Object Mode each iteration so your code can be simplified as follows:
def execute(self, context):
    # get all mesh objects in selection
    meshes = set(o for o in context.selected_objects if o.type == 'MESH')
    # store the vert count on all objects
    verts_before = sum([len(o.data.vertices) for o in meshes])

    # switch to edit mode
    bpy.ops.object.mode_set(mode='EDIT')
    # select all vertices
    bpy.ops.mesh.select_all(action='SELECT')
    # remove the doubles
    bpy.ops.mesh.remove_doubles(threshold=0.01)
    # switch to object mode
    bpy.ops.object.mode_set(mode='OBJECT')

    # store the vert count again
    verts_after = sum([len(o.data.vertices) for o in meshes])
    self.report({'INFO'}, "Verts removed: {}".format(verts_before-verts_after))

    return {'FINISHED'}

Although this saves a lot of time, it still takes 0.0814 seconds for 100 cubes with a vertex count of 8080.
bmesh.ops.remove_doubles()
    def execute(self, context):
        # get all mesh objects in selection
        meshes = set(o.data for o in context.selected_objects if o.type == 'MESH')
        # store the vert count on all objects
        verts_before = sum([len(o.vertices) for o in meshes])

        # Remove doubles using bmesh based on:
        # https://blender.stackexchange.com/a/68133/31447
        bm = bmesh.new()
        for m in meshes:
            bm.from_mesh(m)
            bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=self.merge_dist)
            bm.to_mesh(m)
            m.update()
            bm.clear()
        bm.free()

        # store the vert count again
        verts_after = sum([len(o.vertices) for o in meshes])
        self.report({'INFO'}, "Verts removed: {}".format(verts_before-verts_after))
        return {'FINISHED'}

Bmesh method takes 0.0290 seconds for 100 cubes with a vertex count of 8080.

Final Panel & Operator
Panel in Object Mode and a proper implementation of the operator (Undo, Merge Distance etc.) in order to remove possible doubles for all objects in selection:
import bpy
import bmesh

class MY_OT_rem_doubles_bmesh(bpy.types.Operator):
    """Remove Doubles on Objects in Selection"""
    bl_idname = "object.remove_doubles_bmesh"
    bl_label = "Remove Doubles (bmesh)"
    bl_options = {'REGISTER', 'UNDO'}

    merge_dist: bpy.props.FloatProperty(
        name="Merge Distance",
        description="Merge Distance",
        min=0.0,
        step=0.1,
        default=0.02
    )

    @classmethod
    def poll(cls, context):
        obj = context.active_object
        return (obj is not None and obj.type == 'MESH')

    def execute(self, context):
        meshes = set(o.data for o in context.selected_objects if o.type == 'MESH')
        verts_before = sum(len(o.vertices) for o in meshes)

        # Remove doubles based on:
        # https://blender.stackexchange.com/a/68133/31447
        bm = bmesh.new()
        for m in meshes:
            bm.from_mesh(m)
            bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=self.merge_dist)
            bm.to_mesh(m)
            m.update()
            bm.clear()
        bm.free()

        verts_after = sum([len(o.vertices) for o in meshes])
        self.report({'INFO'}, "Verts removed: {}".format(verts_before-verts_after))

        return {'FINISHED'}

class MY_PT_custom(bpy.types.Panel):
    """Creates a Sub-Panel in the Property Area of the 3D View"""
    bl_label = "My Tools"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "Tool"
    bl_context = "objectmode"

    def draw(self, context):
        sel_objs = context.selected_objects
        sel_vert_count = sum(len(o.data.vertices) for o in sel_objs if o.type == 'MESH')

        layout = self.layout

        row = layout.row()
        row.operator(MY_OT_rem_doubles_bmesh.bl_idname)
        layout.separator()

        row = layout.row()
        row.label(text="{} Objects in Selection".format(len(sel_objs)))

        row = layout.row()
        row.label(text="Vertex Count: {}".format(sel_vert_count))

def register():
    bpy.utils.register_class(MY_OT_rem_doubles_bmesh)
    bpy.utils.register_class(MY_PT_custom)

def unregister():
    bpy.utils.unregister_class(MY_OT_rem_doubles_bmesh)
    bpy.utils.unregister_class(MY_PT_custom)

if __name__ == "__main__":
    register()

I see what you did there... thanks a lot for the detailed appendix :) I have one question:
merge_dist: bpy.props.FloatProperty..  how come it moved into the class and why you need the name, description, min, step ? @brockmann

The reason is simple: Adding a property to the operator makes it accessible in the UI  (Operator Panel or F6), see: https://i.sstatic.net/VYr8C.png Adding min, max, step etc. to the FloatProperty just avoids the user is doing any mistakes, it's an intentional limit. Imagine a script adding subsurf modifiers to each object and the user accidentally sets the subsurf value to 100 ...  @fourtwo

I understand, but there is no input from the user in this script @brockmann

That's just the way blender works and I added that for completeness because usually you want interaction. Also it's nice to have it there in case... if you don't like it for whatever reason just throw it away and replace self.merge_dist with a float value like 0.01: bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.01), easy but not that user friendly IMHO @fourtwo

no it's good to know, thanks again ;)

No need for list. sum(len(m.vertices) for m in meshes)

Cool, changed to generator expression as suggested @batFINGER


text:
Why my rendering slows down and stops at an arbitrary frame?
When I’ve tried to render an animation, the first frame seems to take way longer than it usually does. Then, I return a few hours later, and it seems to have stopped at frame 26 or 31, when usually the render would’ve been finished under normal circumstances.
I’m using the EEVEE engine with all of the render settings how I usually have them, outputting to ffmpeg mp4, perceptually lossless, with the default sampling settings. The animation is 400 frames long and all the physics have been baked.
One thing to note, before rendering in EEVEE, I tried to render the animation in cycles before realizing it was taking too long, so I canceled the render and tried to render it again in EEVEE, changing all the appropriate output settings accordingly. In the past I’ve rendered a few animations in EEVEE without ever having this issue.

Perhaps your renders are getting more CPU/GPU/RAM demanding.   This may be difficult to predict.   Long ago I noticed with more RAM I got less crashes.  I sometime shut down all other applications.  I cannot not, no I cannot ask what are your machine specifications.

I recommend always render to image files (preferably OpenEXR). Once the rendering is done, you can easily encode the resulting sequence into a movie clip like .mp4 or .mov using ffmpeg, Davinci Resolve or even Blender's VSE.

Blender has SE Sequence Editor for making movies.  What would be the advantage of using ffmpeg?

It's for getting easily movie file. If the output stops in the middle, I first need to get all frames data.

Because it's way faster, up to date (latest codecs) and not that error-prone like the VSE is @atomicbezierslinger

I would check the capabilities of the CPU/GPU which is being tasked with rendering the animation. First, check it's capabilities and see if it can render the image at all. When you feel like the rendering is slowing down or so, try to check the RAM Usage or the CPU/GPU Workload of the machine. If Ur Processor isn't capable enough, try,

Any render farm where you can outsource the rendering work, either to  a paid service (maybe even free service, it will have constraints, careful there) or maybe from a friend who has a powerful machine.
As kouchi_777 and brockmann has said above, render these frames one by one (But you have just said tyou have 400 frames, this is tedious work)

I would recommend option one if your system isn't capable enough however