text:
rotation copied every second circle
My question is pretty simple.
How to make an object copy rotation of another object with same speed but only every second circle. I know I can animate that using keyframes, but I need to have in constraint.

Do you mean rotate half as fast, or stop completely every other rotation?

Stop completely every other rotation.

You could add a scripted driver to the desired rotation axis of the object with the intermittent rotation, using the following expresion:
var*(int((var/(2.0*pi))%2))

where the variable var, (or whatever you want to call it) refers to the relevant rotation (X,Y,or Z) of the driving object.

Here, the Z rotation of the triangle is  being driven by the expression, in which var refers to the the Z rotation of the square.
EDIT in response to your comment:
We can make the expression a little more general by implicitly casting True and False to 1 and 0:
var*(int((var/(2.0*pi))%3)==1)

In this version, the number where the 3 is determines the number of turns in the cycle, and the number where the 1 is says which of the turns to follow, with 0 as the last, counting back. So this example would make the driven object follow the driver on the second of every three turns.
So, in order to have alternating rotations, in the example below, the green triangle uses:
var*(int((var/(2.0*pi))%2)==1)

..and the yellow triangle uses:
var*(int((var/(2.0*pi))%2)==0)

Any more than this - say, "the second and fifth out of every seven".. and it would probably be tidier to write a little function, and add it to the driver_namespace.

That's what I was looking for. Thank you very much!

I also tried making third object that rotates when the second object doesn't I tried this
var*(int((var/(4.0*pi))%2))
Bu it hasn't worked out.

@Michal.. I've made an edit to cover this..

Consider div instead of mod in this case.  var * (var // twopi)Mod is handy for mapping  [eg  mapping  on 0, 1 for offset on an orbit](https://blender.stackexchange.com/a/118300/15543)   div//` wil give you the whole number that you are calculating with int-divide-modulus combo

Thanks, @batFINGER, I'm stumped. I can see how to get rid of the int, (e.g. var* (((var//(2.0*pi)%5))in[1,2])) but  I can't figure out how to have an infinite cyclic function without a % somewhere. Please go ahead and fix the answer, if you like.

Sorry re confusion, was pointing out that revs or laps can be calculated using div not that mod and int were always avoidable.   The ternary operator is another (often more) readable way eg var if 1.0 <= (var // twopi) % 5 <= 2.0 else 0 Ternary op can be nested.

As  pointed out often its easier to make a method in the driver namespace to avoid the single line madness. Akin to print pages '[1, 3, 4-6]` Would like to see a subexpression in drivers akin to math surface to cut down long expressions.. . Mapping equation to 0 or 1 and driving a copy rotation constraint influence is another way that can be less complex equation wise.     Is the square above slightly leading the triangle? 8UV's too man.. envious lol.

@batFINGER I agree. The little expression window has the effect of turning everything into code golf.  I was once a bit of a Perl camel, but I'm way off even apprentice Pythonista, so your crit is always more than welcome. I don't think the square is leading.. the skew dotted line is to the manual rotation cursor, out of shot. I seem to have kicked off at about -93. Envious? I don't get the impression your rep. needs a voting system.

@RobinBetts Thank you very much! I tried it and both objects skip every third circle, so object A rotates all the time then object B does 360 and stops then object C stops and does 360. After this I want the B to come again, but they both stop for one circle.

@Michal.. see extension to edit.. hope I've got what you mean, this time :)

Yes, it works perfectly! Thank you! But, could you also add offset to this?

@Michal    Just bracket the whole expression up and add the offset at the end.. (or the beginning)... e.g. (expression)+(pi/2) would shift the rotation of the driven object by 90 degrees anticlockwise..(all angles are expressed in radians to try and keep everything short) :D..


text:
complete existing mesh by "rounding it off"?
I have this Spark AR face mesh and I want to simply finish it off to create the rest of a human head. It doesn't need to look very good. I'd like to hear how you would approach this. I started by doing some edge loops and extruding, then scaling, and I got a decent shape but at the end I was left with a loop that I wanted to collapse into a single vertex and couldn't figure that out. Anyway, suggestions welcome!

do you mean that you want to fill the hole that is behind, with a flat surface?

I would like to fill it with a rounded shape

you can try Bridge Edge Loops... make 2 simetrical selections of edges on that border, maybe 12 on the left and 12 on the right, then Edge > Bridge Edge Loops and use Interpolation > Blend Surface and something like 10 cuts... then use same tool or Grid Fill to fill top and bottom holes... try a few times and other edges till you get some good settings, then drag with Proportional Editing to give it a better shape

source: Stack Exchange

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

sort: votes


text:
How to scale a group of different sized UV faces to all be the same size as each other?
What is the quickest way to scale a group of UV faces of various sizes, so that they all become the same size/aspect ratio as each other? Please see the image below for an example of what I want to achieve in as few steps as possible.
On the left of the image is a group of different sized UV faces (the result of a Smart UV Project) and on the right is what I want; the same UV faces but all the same scale as each other.

I scaled and aligned the faces on the right manually, but I was wondering if there was some sort of shortcut or tool which automates this process, instead of having to resize each UV face one-by-one? I've tried the addons UV Align/Distribute and Magic UV, but I couldn't find any options to achieve this effect.
Thanks in advance

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


text:
My UV don't match the object's shape

I have marked the seams on appropriate edges and have unwrapped my object yet i get this on my UV panel. I have tried using the 'Correct aspect' feature however, it comes up with:

Anyone here who knows how to fix this?

You can scale to uniform scale by pressing ctrl + A in Object mode. Select apply scale and unwrap again.

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


text:
Render taking ages, just CPU or i did something wrong?
I'm an absolute beginner, i've installed blender just some days ago, but i got some basics from other software and my background.
So, my GPU seems too old, it's not that fast and sometimes crashes so i'm rendering on CPU got an i7 put to 6 thread so i can use the PC while it render (i mostly write code, so nothing intensive)... But the render is taking ages

So i've read some articles on how to tweak to render faster, but the results aren't that good, the scene seems waaay darker and i loose lot of color from the environment, the scene is an interior, geometrically speaking easy.
But a nightmare in terms of lighting and textures, all the materials use the new shader and procedural textures...
Can i have some advice ? should i just turn down some settings?
How do i balance what i turn down ?
And at least...
Why so noisy ? after 3 hours, more than 200 samples i was expecting something more... clear... at the original resolution is way more noisy


text:
Can we simulate with mathematical calculation using blender and python?
I am learning to work with 3D objects using Python and Blender. I want to simulate gravitational two body problem for Sun and earth and I know it is possible in Python but I want to make it attractive using blender using materials and texture. Is it possible to run all the mathematical calculations in Python and inject in blender to make it in an attractive way?

I won't pretend to know all required physics and the good initial conditions, but that can be done using the Python script.
The idea is to setup a function (a handler) which is fired by Blender each time frame (current time) is changing. This is done by "bpy.app.handlers.frame_change_pre.append( theFunction )" which mean "theFunction" is called before the change of the frame.
The result is the following:

The code:
import bpy
from mathutils import Vector

#get first object and arbitrary location
o1 = bpy.data.objects['o1']
o1.location = Vector( (-5,0,0 ) )

#same for second one
o2 = bpy.data.objects['o2']
o2.location = Vector( (5,0,0 ) )

#define constants: G and masses
G = 6.6740831e-11
m1 = 1e+11
m2 = 1e+05

#initial speeds
v1 = Vector( ( 0, 0.01, 0 ) )
v2 = Vector( ( 0, -0.5, 0 ) )

#frame rate for calculation
frame_rate = 1 #24 (normally 24 but 1 is faster)
seconds_per_frame = 1 / frame_rate

def two_bodies(scene):
    #import globals in the function scope
    global o1, o2, G, m1, m2, v1, v2
    global seconds_per_frame

    #calc current direction between the objects
    direction = o1.location - o2.location

    #calc the squared distance
    d_squared = direction.length_squared
    #keep the direction of the strength
    direction.normalize()

    #calc new speed vectors
    v1 = v1 - (direction * (G * m2 / d_squared) * seconds_per_frame)
    v2 = v2 + (direction * (G * m1 / d_squared) * seconds_per_frame)

    #calc new locations
    o1.location += v1 * seconds_per_frame
    o2.location += v2 * seconds_per_frame

#get rid of previously set frame_change_pre handlers (if not the same handler may be fired n times)
bpy.app.handlers.frame_change_pre.clear()
#install "two_bodies" as current handler
bpy.app.handlers.frame_change_pre.append(two_bodies)

The blend file is below. To use it:

In the text part, use the "run script" button in order to setup initial conditions and the handler itself
In the 3D view part, use AltA to run the animation

I really appreciate your help. Thank you. Btw, are there any manuals on the code writing part?I am not quite familiar with the Python programming. I tried searching for youtube videos and there are only few videos which is about animation with python and blender. Besides, I tried doing one watching the video and it didn't work. Need to learn from the basics.

Surely you've seen this https://docs.blender.org/api/current/. About Python in general, I can only tell about my little experience. I knew other languages before, but the main point was to understand what is often called as "pythonic", so lists, lists comprehension, dictionaries, set, but I'm still a beginner or occasional user of Python... so I'm not a reference, sorry

I am not sure why it doesn't run in mine. The error is 'Python script fail,look in console for now.' The error is in line 8 for first object. In console,it shows built modules and I think bpy.data.objects[] is not built in module. I cannot think of any other reason.

Have you previously created the 2 spheres with the right names? In my file they are called o1 and o2.

I don't understand what you mean by right names. Sorry i am very new to blender.

o1 = bpy.data.objects['o1'] refers to a mesh object called 'o1' (same for 'o2'). Are they previously created in your file?

No I haven't created any sphere using that name before.

You need to create them (as it is done in the file provided in the answer).

You mean I need to create two sphere with name 'o1' and 'o2' and save before running the script file?

Let us continue this discussion in chat.

Rima, you can click the link of the previous comment so that I give you more information


text:
How to subdivide and smooth top surface of wing but keep hard edges
I am trying to create a smooth top surface on a wing profile.  As it is it is currently too faceted.
I want to produce a mesh for export to print and as it is the section has 'ribs' rather that being smooth.  I wish to retain the straight leading edges and trailing edges as well as the flat ends.
Can you assist?

You tried adding a crease to the edges you want to keep sharp?

It tended to distort other bits.  Have done it the long way and subdivided lines and added new edges... Tedious but worked.

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


text:
Black faces in edit mode and object mode
This is not a flipped normal issue.  I imported an SVG was working on it to created a shape.  I used 'Bridge edge loops' to create some of my surfaces.  A couple I have had to add manually but a few are jet black.  I cannot see how to change this.  All the other faces are fine.  I'm sure this must be a simple thing I'm doing wrong.

Any suggestions?

Did you actually try to flip normals for this face? Not Ctrl+N but Tooslhelf > Shading > Flip Normals. There doesn't appear to be any other reason. If it doesn't work share the file via https://blend-exchange.giantcowfilms.com/

It could be that the faces are connected to some random vertex in the mesh you forgot to deselect.

I think, you have faces with black material applied on this faces:

Check materials tab and remove black material.

Thank you it was the material...  Not sure how three faces had black material but sorted now. Thanks for your help,


text:
Cannot set "is_overridable_library" option via python ["_RNA_UI"]
I'd like to control these bools there via Python but I can't quite figure out how.

If I try something like this code, "min", "max", "soft_min" and "soft_max" work fine and update their values but "is_overridable_library" and "use_soft_limits" do not.
import bpy
obj = bpy.context.object
obj["_RNA_UI"] = {"prop":{"min":0,"max":1,"soft_min":0,"soft_max":1,"is_overridable_library":1,"use_soft_limits":1}}

Thank you very much!

I'm trying to create overridable custom properties in a script. I'm able to set name, description, values, min and max but I cannot figure out how to make those properties overridable so that once linked the object's collection in another file I can play with those custom properties. I tried both 0/1 and False/True but it's not working anyway. Thanks!

Alright, now I understand what you're trying to do.

While it may be possible to edit this through _RNA_UI, I'd avoid using a private variable from an undocumented part of the API and instead update it through bpy.ops.wm.properties_edit().

I tried that but it gives me a RuntimeError. Specifically: RuntimeError: Error: Direct execution not supported. I found another thread regarding this issue, the same that gave me the idea of using "_RNA_UI". https://blender.stackexchange.com/questions/143975/how-to-edit-a-custom-property-in-a-python-script?rq=1

You're right. However setting is_overridable_library through _RNA_UI doesn't seem to work either, when modifying an existing property. I'll have to look at the source code as see what's going on. Sorry for causing any confusion.

Don't you worry. Appreciate that! Have a nice one!

The value behind is_overridable_library can be set through the method property_overridable_library_set() of an object. The following example demonstrates how to set a custom property named "prop" to be overridable.
import bpy

obj = bpy.context.object
obj.property_overridable_library_set('["prop"]', True)

The use_soft_limits is dynamically evaluated and it's not necessary to set it when using the Python API. If the soft_max or soft_min are different than the max or min, it will automatically show as enabled.
Calling bpy.ops.wm.properties_edit() results in an error message, because it expects that self._last_prop is set. This only happens in the invoke() function, not when calling execute() directly. Therefore the execution context has to be set by passing INVOKE_DEFAULT.
bpy.ops.wm.properties_edit("INVOKE_DEFAULT", data_path="object", property="prop", value="1.0", default="1.0", min=0, max=1, use_soft_limits=False, is_overridable_library=True, soft_min=0, soft_max=1, description="", subtype="NONE")

The downside of this is that the UI popup appears and has to be confirmed. Therefore the operator cannot be used without user interaction.

Thank you very much!

To add to this, getting whether a property is library overridable or not is also not obvious:
bpy.context.object.is_property_overridable_library('["prop"]')


text:
Adjust symmetry on Retopoflow
I'm trying to do some retopology to a simple model with Retopoflow but the symmetry is being miscalculated. I don't see any option to adjust this and the center of the object is already at the center of the mesh and the origin of the scene. How could I repair this? Thanks in advance!

Nevermind, I just found the solution. To adjust this just exit Retopoflow, pick the Retopoflow object and you will see it's using a mirror modifier. Align the origin of the mesh with the one of the object you're retopologizing and go back to Retopoflow, the mirror will be fine now.


text:
Animated Property Ignores Keyframes
I am animating a character walking down a path for a short project, using the fixed position and animating the offset. However, the animation is ignored. I can still manually move the slider, and the background works, but the offset doesn't change. What can cause this behavior? Similar to Keyframes not animating object, but that doesn't help.


text:
Drawing precision, straight lines on animated surface
so the problem is that I have a with bones animated plane that moves and bends and so on. Now I need a completely straight, clear and thin line at the exact middle of the surface, what also moves along with the plane. This line also has to be hideable through parts of the animation.
I tried to use lines but I couldn't find out how to make them following the movements of the surface, and I also tried to fix this problem with UV-Mapping, but I can't find out how to make precision lines and how I could hide them in parts of my animation.
I'm very thankful for any help!

How about rendering it with Freestyle?

Perhaps you need the shrinkwrap modifier:

This will work dynamically with a mesh or a curve. If you need to animate the curve handles, use the hook modifier to parent them to armature bones.


text:
Compositor : export output node when we want ?
is there a way to save output file , after the "F12" render is done
for example , i created an output node for my passes ,and the way it work is that the passes are automatically saved when the "F12" directly after render is done , no way for me to control when it happend , the only way ai can export thoses files to my desktop is by doing the render ...
what if ive done a 5hours render and forgot to plug in the compositor "use nodes" , the only way to get my passes back is to redo an entire render ? really ? can we choose to export when we want our output ? how ?
thanks

Not after you have rendered, but then you have the output files, recomposite from the files.

Yes, if it was just a still render image, you can save each passes as a single image:

Just select the render pass, then go to Image > Save Image as
But if you want to render an entire animation without having to "Use Nodes" or even if you want to save the still render image passes as a single image file, you can save the render as an OpenEXR Multilayer file, but consider that the image file size could increase a lot.


text:
After converting a mesh to a curve , how to have a smooth curve?
i have converted a square mesh to a curve , so i have a really narrow agle i didnt find any way in the curve editor to modify that , and i cannot change the handle of this cuvre ..i just want to transform this thoses line into real curve but they stay straight ...
is there a way with a converted mesh; to modify the lines into a real curve ?

In the left menu (displayed with T) > Tool > Set Spline Type > Bezier


text:
Particle system adapting to adaptive displacement?
is there a way the particle system can adapt its height to the correct height of the adaptive displacement height map?
Currently my grass is rather beneath or below my ground because they still follow the flat non adaptive ground... How to remedy this? How the particles can follow each bump and variation in height of the terrain without losing its adaptive faculty?
Its quite problematic for nature scene...
Thanks

Simple answer is no. There is no way (that I know about) to make particles work with adaptive subdivision. This is still experimental feature and it is working only in render mode. Also I'm not sure but for a long time I didn't read a thing about further development of it.

See https://blender.stackexchange.com/questions/95183/make-particles-follow-true-material-displacement and https://blender.stackexchange.com/questions/69661/are-there-any-viable-ways-of-using-the-particle-system-with-micro-displacement

Thanks, quite sad... What about fixing the particle to a height map with no adaptive subdivision but juste subdiv , make it so that it stay  that way when removing subdiv and switching it to adaptive? Can we do this?


text:
Beveling with a bad topology of an imported model ?
in my model i have awful triangulation that is making my bevel not working at all. ( i just want a bevel to this front face right here , the downside L)
normally what i do is just dissolving the unwanted edge and voila i have a polygon an my bevel work again
this time it doesnt work and i cant get rid of this , i dont understand why ,
decimating with the planar option at 5 degree also dont work.
here is the file
https://we.tl/t-Vow8tge8En

You don't only have edges crossing your external faces, you also have several inner faces that should not be here, so maybe if you delete them it will fix your problem.


text:
Realistic rug with blender?
Can I have some guidance or tutorials how to make phototrealistic rug like this with the particle system?
Here's the kind of result I want to achieve, really realistic, long hair, and a sort of different reaction to light like fresnel when the particle is oriented to différents faces

dont hesitate to put the image in full screen , in mini you may think that the level of detail is not important but when you see it at 1500x2000 its totally different
Thanks

I guess it really depends on the goal, is it for pictures, or video, will it be for close-up shots or will you stay far from the carpet, etc... because you could simply give a texture to your plane with some effects like normals and fresnel and it could work perfectly

like those image for example , with a simple textureat this distance  it will look totally horrible

Hi. Please only ask one, specific question at a time.


text:
Select the active object ? with python

i just want to select this object, the suzanne with the active origin in red,'is is she active or just the last selected?
i dont know the code, and i dont know also how to find this kind of code, ive been searching for two hours... any tips how to find the desired action within blender in this kind of cases?
thanks

bpy.context.active_object related

https://blender.stackexchange.com/questions/38618/selecting-an-object-via-scripting/38626?s=16|10.1725#38626

Please show the entire screen with footers so we all the information needed

bpy.context.active_object dont work for me on 2.8

i also tried
bpy.context.active_object.select = True
bpy.context.scene.objects.active = bpy.context.active_object
i got error
and i dont know what im doing im just trying to copy code that work on the proposed lonk, but it doesnt result in anything

i also tried this, not working either "ob = bpy.context.active_object
ob.select = True"

You can usually retrieve the active object with: bpy.context.active_object or bpy.context.object
If you need to take the view layer into account: bpy.context.view_layer.objects.active
Chances are your view layer is already set, but if the view layer needs to be set, you can first do: bpy.context.window.view_layer = view_layer
[source]
To make sure the active object is also a selected object, you can do this:
import bpy
my_object = bpy.context.view_layer.objects.active # assign variable
my_object.select_set(True) # select the object

Setting an object as active is a similar process. See this answer to learn about that.
Many operations require both an active object and at least one additional selected object.


text:
Change units , and respect the scale of the scene?
i got this bad idea to set up my blender in meters
and when i draw architectural plan , everyone use cm
so then i tried to change my units
right now its like that :

my guy is 1.7meters tall , so its 170cm when you convert .
if i want to move an object 30cm to the left i must type 0.3
and i really dont like that , no architects does that, its just not how you draw arch.
so here the changed version

now when i want to move something 30cm to the left i need to type 30 , thats exactly what i want , but now my object is 1.7 cm , all my scene is screwed
wait i know , i know, i can scale it afterward...
but then what about my 130+ assets and +300 materials that are made in meters? are they all to rework one by one ?? i think its a huge fail blender think that 1.7 in meters is 1.7 is centimeters ...
can someone resolve my problem ?
thanks

When you change the unit preset to centimetres you are changing the unit scale. The unit scale determines how big a unit is, a scale of 1.0 means one unit is one metre, and a scale of 0.01 means the same one unit is 0.01 metre or one centimetre.

You don't need to change the unit scale to be able to enter centimetre measurements, you just need the object size to be the correct scale compared to other object in your scene, this would mean scaling down small objects that import too large or adding .0 before any measurements you want to be in centimetres.
To move an item using unit measurements, press = to start advanced entry mode before you enter the amount. That is GX=30CM will move the object 30 centimetres on the x axis.

So it's normal if blender convert 1,7meters to 1,7 centimeters? When I change units?

The other thing I don't like is that all units are automatically converted with the metric units that are the nearest,  I don't want to have 1.7cm for a parameter, and for the next parameter working in kilometers, how awful is that? Can I just have centimeters work for Everything? I feel like metric units are a big fail  in blender

It does the same for metric and imperial, the closest sub-unit to the number is used, so you will see 1.7Km not 1700M and 1cm not 0.01M. Note that the value is maintained, it is just the display that is abreviated. You can turn off units and have it display 0.017 if you want.


text:
Impossible to do a simple zoom?
i just want to do a zoom ,a real zoom , not a FOV adjustement
similar like using your scrollwheel when your are inside of a camera , but with the whole camera , so the border would just adjust depending of the zoom
is it possible to do so inside of blender ?

By default, the scrollwheel tracks the viewpoint, moving it towards or away from the target. If you are in the Camera view, you can either 'Lock Camera to View' in the Properties region > View panel of the 3D view and use the scrollwheel, or select the camera by right-clicking the camera border, and move it with GZZ in any of the secondary Transformation Orientations except 'Gimbal'.
If you want to zoom the camera, you must change the focal length in its Lens panel, found in its Properties > Data tab.

There are three things people may call "zoom" for a CGI camera :

Focal length
Sensor size
Camera position (dolly zoom)

You will find the first two here :

thanks what is the difference between sensor size and a focal length adjustment ?

https://blender.stackexchange.com/questions/26256/relationship-between-the-sensor-size-and-focal-length


text:
How to change the resolution on a X or Y axis witouth having a scaling issue?
How to change the resolution on a X or Y axis witouth having this weird scaling issue ?
for example, when searching a good ratio for a shot, you want to play and start changing the ratio of the rectangle of the shot as you wish , but blender after a certain point, (after hitting a 1:1 ratio ?), completely change the XY relations, i really dont understadn why, he start cropping the image on the other axis for some reasons... is this a bug ? i find this really annoying ... if anyone know a way to stop this behavior, either by tweaking a setting that i dont know (i tried tweaking aspect XY but same problem)with a add on, or a custom script somewhere ? please tell me

in this gif i only tweak the x resolution but somehow, blender re-crop on the Y axis
thanks

I think it also adapts to preserve the focal length.

If you want to render a region, you could try using Render Border (Ctrl B) instead.

i know but isnt the render border only used for testing ? in final you will need to recrop the image in another software anyway because when exporting the image blender will still export those non rendered pixels...

I don't use it but there is a Crop checkbox in the Render tab, so the output should be already cropped...?

You can also use Render Border addon that allows you to set it precisely: https://blender.stackexchange.com/questions/44504/possible-to-set-render-border-exactly/45837#45837

The apparent inconsistency is due to the camera Sensor Size being set to 'Auto'.
When set as 'Auto', Blender will use the specified sensor Size as the size of the longest edge of the sensor - and in your example this will correspond to the largest of the X and Y resolution. This means that whichever dimension is the largest will dictate the effective size of the sensor and this (in conjunction with the Focal Length) determines the view from the camera - hence the change in behaviour when the X dimension crosses the threshold of the Y dimension in your example.
The solution is to change the Sensor settings to Horizontal or Vertical. This locks the 'Size' to correspond to that specific axis.

Oops.. I missed the point entirely... deleted.

thanks for the clarification, so blender dont offer more flexibility ? we are stuck choosing one or another? because the problem is still here, you are not really free to recrop the view as you want, like cropping in photoshop for examples, witouth the need to move your camera ?

okay so i just realised that this principle of cropping freely like photoshop will enter in conflict with having a more dense resolution... so my "free cropping" dream can't be done by tweaking the resolution. i want to do something similar as a border render, but with having the possibility to go ou of the shot ... i think the best way for me to do that is to shift the camera, and work my way with a bordered render with blank pixels deleted in photoshop.. but we need a more flexible croping solution in blender

@DorianBorremans The Camera Lens 'Shift' settings might help with you lining up the shot outside the normal frame - this allows you to shift the centre of the lens without moving the camera.


text:
remove middle mouse axis lock ?
i find it very annoying that you cant move and rotate the view while doing a rotation/scale/translation
i just want to uncheck the "axis lock = middle mouse button" option but i cant find that in the input propreties ... can someone help me ?
thanks a lot !
im kind of struggling here
i already tried to find it but i think theres no option at all inside of this shortcut pref menu ...

Unfortunately I don't think this is configurable, grab/rotate/scale and similar operations are so called "modal operators", which define a new input "mode"/button scheme which is not exposed to the user preferences.


text:
How to find the correct information for creating shortcut ?
i really want to create shortcut by myself and im struling to find the correct code for what i want to create
this kind of code
"screen.trigger_shadeless"
how do you find such information with anything inside of blender to create a shortcut ?
thanks

Possible duplicate of What identifier of operator must be entered for assign shortcuts

right click ony (almost) any option and click edit source.
the name of the operator is what you need. (n.b. I am no python expert so I may not have the right terminology or way of doing it).

but it takes a bit of experience knowing what to search. depending on what are your needs, you can always right click and assign them on the fly. personally I never had a reason not do so.

thanks but it dont work anymore on 2.8 ?

as far as I can tell they do have it. not everyone though but not everyone has it also in blender 2.7x, it depends on the type of operations is doing. it may be easier if you could tell what exactly you need.

yes im trying to create shortcut with the new workspace in 2.8 , and i cant find the code anywhere , its workspace , the code fromt the old layout will not work

if there is something specific you need sorry I didn't understand.. you need a shortcut to create a new workspace? or you just want info on how you should do it in case you need it.. nothing specific just curiosity? if is the latter, well not everything is available or at least not so easy for the end user. if it is available in blender 2.79 but not 2.80 keep in mind that blender 2.80 is still in alpha stage so something may still be missing

I may have found out why you don't see edit source in blender 2.80. in the user preferences under the interface tab, you need to activate the option Developer Extras.

no still no python code for thoses new "workspaces" but i think the best way to find out is to ask there https://devtalk.blender.org/c/python which i did

ok so maybe I finally understood what you need! you need a shortcut to scroll the new workspace like LAYOUT MODELING SCULPTING etc etc. if is that you can just press CTRL PAGE UP / PAGE DOWN. the operator name for that is screen.workspace_cycle

yes but this is cycling trough the modes , i want a shortcut to set the active workspace to a specific designed workspace
which is "bpy.context.window.workspace = bpy.data.workspaces["MyWorkspace"]"
thanks for your dedication by the way :)

theres few possibilities :
1) right click "copy python command" but you need to have in the user pref / interface : python tooltips / devs extra , otherwise you will no see it
2) right click "see online python reference" but you need to have in the user pref / interface : python tooltips / devs extra , otherwise you will no see it
3) see in the info editor what python code you just did

Not the data path, In this case it is the operator name   Use
"Copy Python Command".  See comment on question re duplicate.


text:
I'm trying to recreate the camera as a mesh in python
i'd like to recreate the active camera as a geometry (it's for optimizing particles in the viewport with a dynamic paint modifier)
i'm almost there, the last part is just finding the correct hypotenuse value.
half of the camera and half of my created geometry are right triangle.
so the FOV value of the active camera is half of the value of one of the angle (non right)
i created my geometry to have an hypotenuse value of 1 and a opposite edge value of one too. But im stuck at the angle calculation. it's not so fresh anymore.
here is the code
import bpy, bmesh, math

CAM = bpy.context.scene.camera
bpy.context.view_layer.objects.active = CAM
FOV = bpy.context.object.data.angle
#bpy.context.object.scale.xyz = 2.00
bpy.context.scene.cursor.location = CAM.location
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
bpy.ops.mesh.primitive_cube_add(size=2)
BOOL = bpy.context.object
BOOL.rotation_euler=CAM.rotation_euler
BOOL.name = "SCATTER:[Active Cam Boolean]"
BOOL.display_type = 'WIRE'
BOOL.hide_render = True

bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='DESELECT')
mesh = bmesh.from_edit_mesh(BOOL.data)
for f in mesh.faces:
    if f.index ==5:
        f.select = True

bpy.ops.mesh.select_mode(type='EDGE') #update
bpy.ops.mesh.select_mode(type='FACE') #update
bpy.ops.mesh.merge(type='CURSOR') #now we have camera shape
bpy.ops.object.editmode_toggle()

dimension_x=bpy.context.scene.render.resolution_x /1000
dimension_y=bpy.context.scene.render.resolution_y /1000
BOOL.dimensions.xy = (dimension_x,dimension_y) #to get correct ratio

add_to_200 = 1 - bpy.context.object.scale[0] #to have 100cm value
BOOL.scale.x += add_to_200
BOOL.scale.y += add_to_200

bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
bpy.context.object.scale[2] = 1/math.sin(FOV/2) #This is not working ? i tried SOH CAH TOA, not working idk why.

NEVER MIND, i needed tan(), i got a bit messed up when choosing the hypothenuses. my bad my bad so the correct answer is replacing sin by tan in the last line.

this script work pefectly
import bpy, bmesh, math
deleted = [ob for ob in bpy.context.scene.objects if ob.name =='SCATTER:[Active Cam Boolean]'];bpy.ops.object.delete({"selected_objects": deleted})

if bpy.context.scene.camera == None:
    bpy.ops.object.camera_add(align='VIEW',location=(0,0,0),rotation=(1.5708,0,0))
    bpy.context.scene.camera = bpy.context.view_layer.objects.active

CAM = bpy.context.scene.camera
bpy.context.view_layer.objects.active = CAM
FOV = bpy.context.object.data.angle
bpy.context.scene.cursor.location = CAM.location #

bpy.ops.mesh.primitive_cube_add(size=2)
BOOL = bpy.context.object
BOOL.rotation_euler=CAM.rotation_euler
BOOL.name = BOOL.data.name = "SCATTER:[Active Cam Boolean]"
BOOL.display_type = 'WIRE'
BOOL.hide_render = True
cy=BOOL.cycles_visibility ;cy.camera=cy.transmission=cy.diffuse=cy.scatter=cy.glossy=cy.shadow= False

bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='DESELECT')
mesh = bmesh.from_edit_mesh(BOOL.data)
for f in mesh.faces:
    if f.index ==5:
        f.select = True
bpy.ops.mesh.select_mode(type='EDGE') ; bpy.ops.mesh.select_mode(type='FACE')
bpy.ops.mesh.merge(type='CURSOR')
bpy.ops.object.editmode_toggle()

bpy.ops.object.transform_apply(location=0,rotation=0,scale=1)#=FFT
bpy.context.object.scale[2] = 1/math.tan(FOV/2)

CAM.select_set(state=True)
bpy.context.view_layer.objects.active = CAM
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)
for i in range(0,3): BOOL.lock_rotation[i] = BOOL.lock_location[i] = True

dimension_x = bpy.context.scene.render.resolution_x /1000
dimension_y = bpy.context.scene.render.resolution_y /1000
BOOL.dimensions.xy = (dimension_x,dimension_y) #to get correct ratio

if dimension_x>dimension_y:
    divider = 2/dimension_x
else:
    divider = 2/dimension_y
BOOL.scale.xy = (BOOL.scale.x*divider,BOOL.scale.y*divider)


text:
Array along a 3d curve with rotation lock on certain axis
i want to do an array of my instance , its a steet lamp that need to follow a road that go up and down ...
so i need an array of my instances and a curve modifier? but the problem is that my Z rotation value keep changing , according to the normal of the curve , and i dont want this because street lamp stay straight even if the road is inclined ... i tried to lock the rotation of my instance and tried to do an Z axis constraint but it dont work , i failed ? , i dont know what to do ...
im also quite confuse about every different way to do an array following a curve , i know we can use a curve modifier , a constraint , modify bezier option in propreties, and even particles ?? im lost here , dont know which technique is best for what ..
thanks

Related https://blender.stackexchange.com/questions/68039/how-to-scale-objects-along-the-length-of-a-curve-and-keep-them-all-facing-the-sa and https://blender.stackexchange.com/questions/68923/torus-object-stretched-in-array-curve-modifier  As far as I know ou will have to make duplicates real to keep verticality

To duplicate an object without deformation and with a constraint on its Z axis, use Dupliframe:

Build your bezier curve, and, in Edit mode, make sure that it goes in the right direction, if not: select all and W > Switch Direction
Put the origin of your bezier curve at it starting point
Put your object at the same point
In the Data menu of your bezier curve, click Path Animation, then in Frames choose the amount of duplications that will happen. Enable Follow.
In the Object menu of the object you want to duplicate, in Duplication, enable Frames and unclick Speed.
Parent your object to your curve with ctrl P > Object.
Keep your object selected and go to Constraints, choose Limit Rotation, and click X and Y, unclick Z.

It should work

woaw what a story , thanks a lot , it was so hidden ...

@DorianBorremans Don't just thank in the comments, if an answer helped you upvote it, if it solved your problem consider marking it as accepted

As the duplication feature has been removed in Blender 2.8, could you suggest another way to do this?

Yes use this method: https://blender.stackexchange.com/questions/165628/cant-get-my-instanced-objects-dupliverts-to-work


text:
Why "Save as" and "Export" is not working in my menu?
In this small menu example below, I'd like to know why "Save as" and "Export" are not working on my menu?
How am I supposed to save as inside of a menu?
What am I doing wrong ?
bl_info = {
    "name" : "Back Me Up [BD3D]",
    "author" : "BD3D",
    "description" : "Save like you never did before.",
    "blender" : (2, 80, 0),
    "location" : "Ctrl S, Operator",
    "warning" : "",
    "category" : "Generic"
}

import bpy
from bpy.types import Menu
import bpy
context = bpy.context

class VIEW3D_PIE_backmeuptradnormal(Menu): #problem first save and save as ? what ???????????????????????
    bl_label = ""
    bl_idname = "view3d.menu_normal_backmeup" #other id if two pies

    def draw(self, context):
        layout = self.layout
        pie = layout
        pie.operator("wm.collada_export",text="export not working",  icon='BLENDER')
        pie.operator("wm.save_as_mainfile",text="save as not working",  icon='BLENDER')

def register():
    bpy.utils.register_class(VIEW3D_PIE_backmeuptradnormal)
def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_backmeuptradnormal)

if __name__ == "__main__":
    register()
    bpy.ops.wm.call_menu(name="view3d.menu_normal_backmeup")

-

pie.operator_context = 'INVOKE_DEFAULT'

this line before the operator
pie.operator_context = 'EXEC_REGION_WIN'

and this line after will do it


text:
How do I loop location values?
I made this wallpaper type animation and I used Noise and Bump nodes to make the floor look like flowing water. I added a mapping node to move around the detail and make it look like its flowing.
Its supposed to be a wallpaper but the problem is I cant make a loop.
I cant find a value I can add at the end of the animation to make it look like its going on forever. Anyone got any ideas how to make it into a loop?

Related: https://blender.stackexchange.com/questions/135437/how-to-make-tileable-procedural-noise-texture

https://blender.stackexchange.com/questions/111066/how-to-loop-material-node-animation

23.040-4.190 tge result number is the starting looping point that you can loop using location


text:
When moving a selected vertx the whole cube moves
I'm trying to model a dino, but when I try to move a selected vertex the whole cube moves.

You've probably enabled the Proportional Editing option:

no its turned off

so please share your file: https://pasteall.org/blend/

https://pasteall.org/blend/7b5a514fac114681ad6f30f099f31b36

mmh that's weird because everything works fine here. Of course when you move a vertex, its mirrored version also moves but it's because you have a Mirror modifier...

I want to make it like when you move a vretx the cube doesn't change.

I'm not sure what you mean, could you be more precise please?

Like when a vertx moves the other faces don't flop around.Only one face.

sorry I don't really know how to explain.

maybe edit your question in order to give more explanations, show pictures etc

https://ibb.co/S3NthjC

not like in the pic

like not moving a whole face

it's still not clear I'm sorry  ;)  I hope someone will understand... if you move an empty the face will be deformed of course

is tere a way to make the vertx behind the selected vertx movewhen you move the selected vertx?

what vertex? move how? You should follow some basic tutorials because it's a bit hard to answer    ;)


text:
Emit random objects inside array-ed object
I have this collections of shape that i want to array and emit

I want all the objects to appear randomly inside this box, this box is just s box that I used array modifier so all is identical

I want to put one random shapes on the holes of the boxes, randomly.
here is what i meant by that, and what i want to achieve
VISUALIZATION

What i have tried:

I put small plane in the middle of the box and set that plane as a vertex group, so i have some surface to emit to.
I use emitter particle system and emit exactly the amount of boxes i have (which is 9), and selecting the shapes collections

It didnt go as planned

any solution would be amazing, because i have a ton of holes i need to fill

update:
after i clicked "Use modifier stack" it works as intended, but now there's new problem
some objects overlap on each other

can you provide your blend file?

it is a pretty basic setup, i just show a basic solution - it is not modeled with a shelf, i just took a grid because you didn't provide your blend file and I don't want to waste time.
So here we go:

add a grid

add a torus, a sphere and a cylinder (or whatever objects you wanna have)

add a collection and move all objects from 2) in it

add a particle system to your grid

set these settings to your particle system:

and you will get:

if you need detailed explanation, let me know, then i will improve the answer.
blend file:

That's the solution I usually would have suggested as ell. But you don't need a Grid object for that, a simple Plane works, too. The only problem with this solution: in the settings of the Particle System, when you have set it to Grid, there is a Resolution value to set - by default it's 10, like in your example. This is why a simple plane works, but this is also where the problem is: a resolution of 10 will place 100 objects on this plane in a 10 x 10 grid. That's okay for a shelf with a quadratic area, but let's say you have a shelf with 4 columns in 10 rows...? You can't set 4 x 10.

I guess this might be a good task for Geometry nodes...

That’s right

@GordonBrinkmann: yes, it works with plane too (which is at least a grid too ;) ), but why shouldn't it work? i just tried: result: [1]: https://i.sstatic.net/d4wne.png -> works

Oh damn, I forgot to apply the scale on the plane. How stupid. Well, I just used a plane because it is less geometry - less resources needed (which in this case wouldn't be very relevant), and the grid object doesn't really contribute to the distribution of the particles, they are dependent on the resolution settings.

Its a success guys, I'll share the result here

I put a small plane in the middle of the box as an emitter like this

Here's the settings I used, its kinda similar to Chris' settings
since I'm gonna move the "wall" and animate it, the bottles/particles will be left behind. So the trick to make it still follow the emitter is by turning off the physics on the particle settings.

Okay, here is another solution using Geometry Nodes. You can always adjust the number of columns and rows and distances between the objects and of course add and delete objects from the instancing group:

I have a shelf with, let's say 4 columns by 6 rows. I know from how I created it (or maybe because I'm recreating some real-world example) that the center of each single field is 0.4 m horizontally and vertically apart from the next.

I have a bunch of objects I want to place in the shelf randomly in a collection called "objects".

I place a new object with a single vertex at the center of the first shelf field. Then I use two Array modifiers, one to duplicate the vertex 4 times horizontally with a constant offset of 0.4 m, the other for 10 duplicates with a vertical constant offset of 0.4 m.

Now I add Geometry Nodes. I use a Point Instance node set to Collection, disable Whole Collection and choose the collection "objects".

My objects are much too large for the shelf of course, so I plug a Point Scale inbetween. You could leave the Type at Vector, but I use Float since I scale the objects evenly on all axes. If you don't like the distribution, you can change the Seed value in the Point Instance node to change it.

thankyou ! i'll need to learn geometry nodes


text:
Why don't I have Blend Surfaces node in Sverchok?
Why don't I have Blend Surfaces node in Sverchok with the lastest version installed ?

Hello, you will have more chance to get an answer on the addon's github https://github.com/nortikin/sverchok/issues

Please, install dependences


text:
Change resolution of the rendered view ?
how the rendered view work ? we can change the preview sample , the preview bounce , the preview subdivision , the preview texture size , but can we change the render view resolution?
i have this feeling its stuck on the native resolution of the display which is really bad if you want to have a quick real timme preview (5k screen here)
if its not possible ill do a topic on right click select

What are you talking about with the "render view resolution" ? In Properties > Render > Sampling > Samples you can choose the Preview quality (Preview factor) and also the definitive Render quality (Render factor). Maybe you're talking about the latter?

Itds "pixel size" option in propreties render tab , and its coming to 2.8

It’s also in 2.79.5


text:
How to make the UI interractive to it's size?
in this little addon i try to make an asset management system.
I'd like that the number of assets per row are adapting in real time to the size.x of the window or maybe the other way around: the size of the icon are adapting. how is it possible to do that with python ?
any solution that's keeping the preview ratio 1:1 is really good.
but it may be trivial to do a more elaborated system.

import os
import bpy

bl_info = {
    "name" : "Test [BD3D]",
    "author" : "BD3D",
    "description" : "Wow such manager",
    "blender" : (2, 80, 0),
    "location" : "Operator",
    "warning" : "",
    "category" : "Generic"
}

class SCATTER_TestAddonPref(bpy.types.AddonPreferences):
    bl_idname = __name__

    item_per_row : bpy.props.IntProperty(name="Items per rows",subtype='NONE',default=6,min=2,max=30)
    item_size    : bpy.props.FloatProperty(name="Items sizes",subtype='NONE',default=7,min=0,max=20)

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

        winx = bpy.context.window.x #could start doing something if window x was reactive. but it stay static.
        item_per_row = round((winx-170)/150)

        row = layout.row()
        row.label(text=str(winx))
        row.prop(self,"item_per_row")
        row.prop(self,"item_size")

        row = layout.row()
        row.alignment = 'LEFT'
        i=0
        for z in custom_icons:
            i+=1
            #row.separator(factor=1.0)
            row.box().template_icon(icon_value=custom_icons[z].icon_id,scale=self.item_size)
            row.separator(factor=1.0)
            if i == self.item_per_row:
                row = layout.row()
                row.alignment = 'LEFT'
                i=0
            #layout.label(text=str(i))

class Panel(bpy.types.Panel):
    bl_idname      = "TEST_PT_Panel"
    bl_label       = "Scatter Icon test"
    bl_category    = "Scatter BETA"
    bl_space_type  = "VIEW_3D"
    bl_region_type = "UI"
    bl_context     = "objectmode"

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

        global custom_icons

        layout.operator(SCATTER_OT_refresh_asset_manager.bl_idname, text="refresh", icon="FILE_REFRESH")

        # for z in custom_icons:
        #     layout.template_icon(icon_value=custom_icons[z].icon_id,scale=7)

#############################################################

class SCATTER_OT_size(bpy.types.Operator):
    bl_idname      = "scatter.size"
    bl_label       = ""
    bl_description = "refresh the asset manager"

    def execute(self, context):
        print()
        return {'FINISHED'}

class SCATTER_OT_refresh_asset_manager(bpy.types.Operator):
    bl_idname      = "scatter.refresh_asset_manager"
    bl_label       = ""
    bl_description = "refresh the asset manager"

    def execute(self, context):

        global custom_icons
        bpy.utils.previews.remove(custom_icons)
        custom_icons.clear()
        icon_set_up()

        return {'FINISHED'}

#############################################################

def icon_set_up():

    global custom_icons
    from os import listdir
    from os.path import isfile, join

    onlyfiles = [f for f in listdir(preset_directory) if isfile(join(preset_directory, f))]
    custom_icons = bpy.utils.previews.new()

    for f in onlyfiles:
        if f[-4:] == ".jpg":
            custom_icons.load(f, os.path.join(preset_directory, f), 'IMAGE')

#################### INSERT BELOW r'folder_path'
#preset_directory = r'C:\Myfolder\myset_of_images\'
preset_directory = os.path.join(bpy.utils.user_resource('SCRIPTS'), "presets", "scatter_presets_custom\\")
custom_icons     = None

#############################################################

def register():

    icon_set_up()

    bpy.utils.register_class(Panel)
    bpy.utils.register_class(SCATTER_OT_refresh_asset_manager)
    bpy.utils.register_class(SCATTER_TestAddonPref)

def unregister():

    global custom_icons                      #current removal method
    bpy.utils.previews.remove(custom_icons)  #corrent removal method
    custom_icons.clear()                     #corrent removal method

    bpy.utils.unregister_class(Panel)
    bpy.utils.unregister_class(SCATTER_OT_refresh_asset_manager)
    bpy.utils.unregister_class(SCATTER_TestAddonPref)

if __name__ == "__main__":
    register()

Think you should be using grid_flow

This should work:
def draw(self, context):
    grid = self.layout.grid_flow()

    for icon in custom_icons:
        grid.template_icon(icon_value=icons.icon_id,scale=self.item_size)

i just search in the api and it seems that there is multiples solution possible.
in this case the best code i found is grid_flow (thanks merlin for confirming)
https://docs.blender.org/api/current/bpy.types.UILayout.html?highlight=grid_flow#bpy.types.UILayout.grid_flow
it also seems that ui_units_x and y are good contestors but i didn't try them yet.
class SCATTER_TestAddonPref(bpy.types.AddonPreferences):
    bl_idname = __name__

    item_size    : bpy.props.FloatProperty(name="Items sizes",subtype='NONE',default=7,min=0,max=20)
    def draw(self, context):
        layout = self.layout

        row = layout.row()
        row.prop(self,"item_size")

        row = layout.box().grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=False)
        row.alignment = 'LEFT'
        i=0
        for z in custom_icons:
            i+=1
            #row.separator(factor=1.0)
            prevbox= row.column(align=True)
            prevBOX=prevbox.box()
            prevBOX.template_icon(icon_value=custom_icons[z].icon_id,scale=self.item_size)
            prevBOX.label(text=z[:-4].replace("_"," ").title())
            prevbox.separator(factor=4)

There is no way to make these icons clickable?


text:
Splitting an addon in modules vs having everything in one file?
Im wondering the pros vs cons of having an blender addon in a large python script (let say 7 thousands lines) vs splitting everything in different thematic modules ?
I think that In the end having everything in one file is much less prone to error for users (both installation and uninstall) and also less an headache of juggling with multiples files.
Is it all about personal preferences ?

It's better to split it into separate files. The reasons for this are:

Separation of concerns: It's easier to separate UI from state and logic when they are in separate files. Keeping everything in one file also results in low cohesion which is not desirable.
Maintainability: Keeping everything in a single file will likely result in tight coupling, which makes refactoring a lot harder.
Understandability The interaction between classes is difficult to grasp when everything is in a single file. Finding a function or class is challenging when you don't know exactly what it's named and with only a vague idea what it does. This is especially a concern if other developers try to contribute to your project or if you take a break then continue the development in couple a days/weeks/months/years. If for instance the functions for scatter distribution are in a separate file called scatter_distribution.py, then it's easy to find because you already know what's in the file based on its name.
Extensibility: Given that your add-on already reached approx. 7000 LoC, it's clear that new versions with additional features will increase the complexity further. This will impact the previous points negatively. If your code uses separate files you can easily extend it with another file for a specific set of features.
Reusability: Having separate files or modules allows to reuse code more easily in the development of future add-ons that require some of the features you've already implemented in the current add-on.

The add-on can be distributed as .zip which is the standard way of installing it through the preferences, therefore users don't have to deal with the individual files.
In conclusion there are plenty benefits of writing modular code. It may take more work at the beginning, however it can significantly reduce the effort of maintaining the software.
This answer is not a complete and definitive list of reasons, however it should highlight some of the most serious issues that occur when keeping the entire code in one file.

Thanks a lot for this answer @rjg very useful


text:
How to connect, by closest distance, vertices together in geometry node?
I have a bunch of points (vertices),

they may, or may not be aligned to form a path
they may, or may not be at regular interval distance from each other
they have a completely random index value

How can i connect these points together in geometry node? either as a mesh type with edges or a curve, it does not matter

So are these vertices separate objects or one whole object?

Hi Yousuf, all verts are merged

The logic on how to proceed:

get a urchin-like mesh, either create your own in geometry node with an icosphere or via edit mode

instance this urchin on every points and realize the instances, the scale factor of the instancing is very important, you'll use this to change the distance threshold
from here you can either do a merge by distance OR use the proximity node and set the position of your urchins vertices to closest position of the point cloud.

This is what such recipe looks like with the closest position method

or with the merge method

Blend file:

wow, nice, realy cool effect, looks like an object wrapped with wires (if you will convert it to curves and add some thickness)
thanx for sharing!


text:
How to procedurally generate new properties in PropertyGroup?
I need a LOT of properties in my plugin,
and a lot of them are very redundant, they are using a naming system.
I'd like to generate them more easily via a function, the only problem is that since 2.8 the properties are done via type declaration, this make code generation much more trickier.
i have an example below, if anyone have another solution i'd gladly hear them out.
Cheers

import bpy

#I have a series of very redundand properties to define in my propgroup
#i'd like to procedurally generate the properties before registration

print("\n\nScript is running...")

def generate_props(name):
    """will add the properties to annotation"""
    d = {}
    d[f"{name}_str"] = bpy.props.StringProperty(name=f"{name} MyString")
    d[f"{name}_bool"] = bpy.props.BoolProperty(name=f"{name} MyBool")
    d[f"{name}_int"] = bpy.props.IntProperty(name=f"{name} MyInt")
    d[f"{name}_float"] = bpy.props.IntProperty(name=f"{name} Myloat")
    return d

class TEST_PROP_propgroup(bpy.types.PropertyGroup):

    realprop : bpy.props.StringProperty(name="i'm working, others will not")

    __annotations__.update(generate_props("hello"))
    __annotations__.update(generate_props("world"))
    __annotations__.update(generate_props("foo"))

    #as we can see, all are evenly considered in this class variables,
    #from the surface, new element to annotation dict or doing a new
    #type declaration is the same right?

    print("\n CLASS LOCALS: \n", locals())

try:
    bpy.utils.unregister_class(TEST_PROP_propgroup)
except:
    pass

#we can see here that before the registration, nothing changed. our declarations are still here
print("\n BEFORE REGISTRATION: \n", TEST_PROP_propgroup.__annotations__)

bpy.utils.register_class(TEST_PROP_propgroup)

bpy.types.Scene.testing = bpy.props.PointerProperty(type=TEST_PROP_propgroup)

print("\n FINAL PROPERTY: \n", bpy.context.scene.testing.bl_rna.properties.keys())


text:
msgbus.subscribe_rna() to an operator?
I'm trying to find a way to get notified by the operator bpy.ops.object.transform_apply() so every time my users are applying an object scale I can re-calculate it's square_area property.
But I have a hard time figuring out how I can get notified when the user is using such native operator?
So I did try to play with msgbus, but it seem that msgbus cannot subscribes to any Operators, am I wrong?
is there a way I can get notified when my user is using a (native) operator?
# Here's the msgbus snippets I tried (failed at first glance):

def fct():
    print("I'm subscribing to an operator")

bpy.msgbus.clear_by_owner('transform_apply') #only one subs per owner allowed
bpy.msgbus.subscribe_rna(key= bpy.types.OBJECT_OT_transform_apply , owner='transform_apply', args=(), notify=fct, options={'PERSISTENT'} )
                             #or bpy.ops.object.transform_apply.get_rna_type() to get type? not working too

Following this Question


text:
Object Picker Modal Operator?
I saw this question this morning and i'm also quite interested in a Picker modal operator, so I did tinker a bit and achieve a somewhat beginning of a working code but I encountered some problems along the way.
The code is functional in 3Dview, as you can see it will print objects detected under the cursor, the problem is that it needs to work from any areas! so we need some context override action here
(Note that, as final touch, we could draw a little icon on screen with the name of the object picked at cursor location. Not sure if this is possible cross area ? i believe custom drawing are only allowed within the 3D view correct?)
import bpy
from bpy_extras import view3d_utils

# rework of this
# https://devtalk.blender.org/t/pick-material-under-mouse-cursor/6978/4

#We need the picker to work cross area, unfortunately blender don't like that very much
#So we need to override the context,
#the function below will try to find 3D view and update the given context.copy()

def find_3d_context(context_copy):
    for area in bpy.context.window.screen.areas:
        if area.type == 'VIEW_3D':
            for region in area.regions:
                if region.type == 'WINDOW':
                    break
            for space in area.spaces:
                if space.type == 'VIEW_3D':
                    region_data = space.region_3d
                    break
    print(area, region, region_data)
    context_copy.update(
        area=area,
        region=region,
        region_data=region_data,
        )
    return

def find_object(context, event):

    # get the context arguments
    scene     = bpy.context.scene
    region    = bpy.context.region
    rv3d      = bpy.context.region_data
    coord     = event.mouse_region_x, event.mouse_region_y
    scene     = bpy.context.scene
    viewlayer = bpy.context.view_layer

    #this is the tricky part, region will not be found if we are not running this operator from a 3DVIEW
    if rv3d is None: print("region_data not found") ; return

    # get the ray from the viewport and mouse
    view_vector = view3d_utils.region_2d_to_vector_3d(region, rv3d, coord)
    ray_origin  = view3d_utils.region_2d_to_origin_3d(region, rv3d, coord)
    ray_target  = ray_origin + (view_vector *-10)
    ray_goal    = ray_origin + (view_vector *1000)

    Rresult, Rlocation, Rnormal, Rindex, Robject, Rmatrix = scene.ray_cast(viewlayer.depsgraph, ray_target, ray_goal)

    if Robject is not None:
        print("Found an object ! : ",Robject)
    return Robject

class ObjectPicker(bpy.types.Operator):
    bl_idname = "view3d.test"
    bl_label = "Picker test"

    def modal(self, context, event):

        #should work from any area, so we need to find correct context
        context = context.copy()
        find_3d_context(context)

        object = find_object(context, event)

        if (event.type == 'LEFTMOUSE'):
            print("Execute Something With Object")
            print("Done")
            return {'CANCELLED'}

        elif event.type in {'RIGHTMOUSE', 'ESC','RET'}:
            print("Done")
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

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

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

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

if __name__ == "__main__":
    register()


text:
Python: doing an action depending of the type of object
hello i have a really simple problem
if my active object is an mesh i want to do an action, if its an empty another one, ... ect
so i want for example in this case, move the location of the active object only if it's an empty
so i tried
if bpy.context.object.type = 'EMPTY'
    bpy.context.object.location[0] = 8.46184

i really dont understand why it doesnt work, when i type
bpy.context.object.type

in blender python console, i have 'EMPTY' as an response...
what is wrong ?

You are trying to assign 'EMPTY' to "bpy.context.object.type" within an if clause.
For checking the value of something, you need to use "==", not "=".
if bpy.context.object.type == 'EMPTY':
    bpy.context.object.location[0] = 8.46184

These are basic syntax errors.
The same errors will be produced by code completely void of any blender API reference,
if x = 3
    x = 4

and whether in blenders python console, or a python shell or any other python console, you can crunch it in and receive feedback on the errors, as well as variable values etc.
Here is the output of if statement in py console. The writing in red indicates an error.  If you are using the text editor, the error statement will be written in the error pop-up on run, and to the system console.

At this point, rather than writing a question:
Copy the error type and paste into google, or another search engine of your choosing

Similarly the first match for python if statement syntax error
After checking out some answers you still don't understand, then write a question.  Post the error messages and other details.


text:
What is a shading unit and a texture mapping unit in a GPU ? and how does it affect blender?
in a graphic card spec like here for example

The GeForce GTX 970 was a performance graphics card by NVIDIA,
  launched in September 2014. Built on the 28 nm process, and based on
  the GM204 graphics processor, in its GM204-200-A1 variant, the card
  supports DirectX 12.0. The GM204 graphics processor is a large chip
  with a die area of 398 mm² and 5,200 million transistors. Unlike the
  fully unlocked GeForce GTX 980, which uses the same GPU but has all
  2048 shaders enabled, NVIDIA has disabled some shading units on the
  GeForce GTX 970 to reach the product's target shader count. It
  features 1664 shading units, 104 texture mapping units and 56 ROPs.
  NVIDIA has placed 4,096 MB GDDR5 memory on the card, which are
  connected using a 256-bit memory interface. The GPU is operating at a
  frequency of 1050 MHz, which can be boosted up to 1178 MHz, memory is
  running at 1753 MHz.  Being a dual-slot card, the NVIDIA GeForce GTX
  970 draws power from 2x 6-pin power connectors, with power draw rated
  at 148 W maximum. Display outputs include: 1x DVI, 1x HDMI, 3x
  DisplayPort. GeForce GTX 970 is connected to the rest of the system
  using a PCI-Express 3.0 x16 interface. The card measures 267 mm in
  length, and features a dual-slot cooling solution. Its price at launch
  was 329 US Dollars.

we have some vocabulary:
-shading unit
-shaders
-texture mapping units
does thoses caracteristics have any impact inside of blender ?
like the limit of material slot we can have?
the limit the number of image texture slot we can have?
the limit the nodes we can have?
for exemple, a scene with 500 material; 3000 image textures, and a material with a node tree of thousands of nodes, is possible with a gpu, or there's some limit?

I'm voting to close this question as off-topic because it is about hardware

These statistics do not impact blender directly. You can have thousands of nodes and shaders and terrabytes of textures if you want and if your PC can handle it.
This is where these components come back into play. The better a GPU is the better it can handle those things. Your GPU can't hold terrabytes of textures, and you're probably going to kill your rendertimes with a nodes setup thousands of nodes deep.
The units mentioned here are directly related to the architecture of the card. A texture mapping unit for example is what's actually doing the caculations for UV unwrapping. Having less of them doesn't change the size of your possible UV map, it just means it takes longer to calculate the unwrapping.

thansk for the answer!why are old cuda card limited to 88slot of texture then ?

At some point a card simply can't handle what you're throwing at it any more. 88 textures is incredibly limiting and I can assure you that most video games use more than 88 textures at once. Limits stem from multiple things and can be caused by VRAM or other factors. I can't tell you the specific reason here, sorry for that!


text:
Align Object A to Object B to their respective active faces with python
i want to Align two objects depending on their active faces like in this gif below

didn't find any answers but only this clue below from this question:
Align to face normal vector
but it only align the selected object to the active object active face, and not align both active faces together.
any good tutorials, documentations on working with matrix in blender ?
import bpy
from mathutils import Matrix, Vector
import bmesh

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

context = bpy.context
scene = context.scene
A = context.object

A.select_set(state=False)
B = bpy.context.selected_objects[0]
A.select_set(state=True)

obj = context.edit_object
mw = obj.matrix_world.copy()
bm = bmesh.from_edit_mesh(obj.data)
face = bm.select_history.active
o = face.calc_center_median()

axis_src = face.normal
axis_src2 = face.calc_tangent_edge()
axis_dst = Vector((0, 0, 1))
axis_dst2 = Vector((0, 1, 0))

vec2 = axis_src @ obj.matrix_world.inverted()
matrix_rotate =     axis_dst.rotation_difference(vec2).to_matrix().to_4x4()

vec1 = axis_src2 @ obj.matrix_world.inverted()
axis_dst2 = axis_dst2 @ matrix_rotate.inverted()
mat_tmp = axis_dst2.rotation_difference(vec1).to_matrix().to_4x4()
matrix_rotate = mat_tmp @ matrix_rotate
matrix_translation = Matrix.Translation(mw @ o)

B.matrix_world = matrix_translation @ matrix_rotate.to_4x4()

It seem like the script only apply a transform matrix to object origin, which doesn't consider the local location of the face center.
You will need to calculate the difference vector between that face center and the origin of the same object, and move that object by the vector.
Here is the script I modified (with mess, Blender 2.8 API):
import bpy
from mathutils import Matrix, Vector
import bmesh

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

context = bpy.context
scene = context.scene
A = context.object

A.select_set(state=False)
B = bpy.context.selected_objects[0]
A.select_set(state=True)

#obj = context.edit_object (!) equal to A
src_mw = A.matrix_world.copy()
src_bm = bmesh.from_edit_mesh(A.data)
src_face = src_bm.select_history.active
src_o = src_face.calc_center_median()
src_normal = src_face.normal
src_tan = src_face.calc_tangent_edge()

# This is the target, we change the sign of normal to stick face to face
dst_mw = B.matrix_world.copy()
dst_bm = bmesh.from_edit_mesh(B.data)
dst_face = dst_bm.select_history.active
dst_o = dst_face.calc_center_median()
dst_normal = -(dst_face.normal)
dst_tan = (dst_face.calc_tangent_edge())

vec2 = src_normal @ src_mw.inverted()
matrix_rotate = dst_normal.rotation_difference(vec2).to_matrix().to_4x4()

vec1 = src_tan @ src_mw.inverted()
dst_tan = dst_tan @ matrix_rotate.inverted()
mat_tmp = dst_tan.rotation_difference(vec1).to_matrix().to_4x4()
matrix_rotate = mat_tmp @ matrix_rotate
matrix_translation = Matrix.Translation(src_mw @ src_o)

# This line applied the matrix_translation and matrix_rotate
B.matrix_world = matrix_translation @ matrix_rotate.to_4x4()

# We need to recalculate these value since we change the matrix_world
dst_mw = B.matrix_world.copy()
dst_bm = bmesh.from_edit_mesh(B.data)
dst_face = dst_bm.select_history.active
dst_o = dst_face.calc_center_median()

# The following is telling blender to find a translation from face center to origin,
# And than apply it on world matrix
# Be Careful, the order of the matrix multiplication change the result,
# We always put the transform matrix on "Left Hand Side" to perform the task
dif_mat = Matrix.Translation(B.location - dst_mw @ dst_o)
B.matrix_world = dif_mat @ B.matrix_world

And since the face in quad is actually not flat in most of the case, you may find out the script is not always stick the face beautifully because it is impossible to bend that face with fixed vertices position.
You may want to split the polygon in to triangle to make the face flat.
And for the matrix tutorials, it's just math problem in 3-dimension space. You may want to check out some guide of how these surface model work in most of the 3D application.
Matrix Transformation: 3D Transformation - tutorialspoint

work like a charm ! and thanks for this amazing link ! it can really help me understand vector better


text:
Linking value to another anywhere in blender 2.8
i want to link value from one value to another. sort of instancing but for values.
for example in this case below:

monkey red and monkey green have a mix color node that both drive them to white if the mix factor is = to 1.
i want to link thoses two value so that if i change one, the other will change too and have the exact same value constantly.
i want to do this also with values in the proprety editor, N panel.. anywhere in blender really.
i heard about drivers, but every tutorials i found is to animate values depending on locations and distances, not linking one value to another.
could someone show me what is the technique ?
i also heard about custom propreties, maybe this could also help ?
thanks

Try connecting a Value input node to the Fac of both Mix nodes. That's how you link one value to the other

cant do that its two separate materials

but htis could work with a value node inside of a nodegroup, but i want to do this anywhere anyways

1) add driver (ctrl d) to first value
2) copy driver (sorry im wrong do this at the end !!!!!)
3) paste driver to other value (sorry do this at the end !!!!!))
4) open a driver panel editor type, select the correct object otherwise the driver will not apear, also select the last step in the T panel on the left
5) go to n tab then driver tab
6) set a to scripted expression
7) the expression need to have the same name as the tab below "add input variable", so by default, "var"
8) next to "var" is a little symbol, click on it, set it to single proprety
9) create a custom proprety, in the propreties tab, you can create one in the scene tab, material tab, and object tab, and this custom proprety will appear on the N panel in the 3d viewport when the concerned object is selected, if you want the custom proprety to be not selection depentend then i advise you to create the proprety in the scene tab, or even world tab
10) we go back in the driver editor,in the n panel, and in our variable "prop" we choose the correct cathegory of where the custom proprety is
11) we need a path to the correct custom proprety we just created, so find him, right click on him, and "copy data path", then paste it in the "path" on the driver editor
12) we are done, tweak the custom proprety and the calue will change according to it, you may need to change the calue of the custom proprety in "edit" for it to correspond of the max and min value you want to tweak

JUST COPY AND PASTE DRIVER AT THE END ! i did it at the beginning this may be wrong

------------------------------------

in the case above its linking value for every single value possible in blender (from 0 to 1 at least)
but if you want to link value only trough the node, just use a nodegroup with an input value in it and paste it trough the materials.
in the future with everything node this will be really handy

------------------------------------

oh man, this is so complex for a simple linking data process...

Or you can do it the simple way. you put your objects as index object 1 and 2 and that's it

yes, if its only trough the shader editor this also work

Custom properties allow a value to be shared and manipulated for values such as location, rotation scale.  You can create a custom value in 66 seconds.
An example appears at the bottom of this link
How to create drivers but maintain the ability to modify the property?
In some of the node settings you can create a function which may be called a [group].  Then reuse the group. The important point is the node system will remember the group and allow the reuse.


text:
How to animate a curve graph?
how can we animate a falloff graph (called map curve in bpy) , similar to the one in the vertex-group edit modifier?
Blender don't let me add any keyframe.. it seem to be impossible, please prove me wrong.


text:
Instert an icon inside of an EnumProperty ? is it possible? (addon UI)
i tried to insert some icon in an enumproperty
test_context: bpy.props.EnumProperty(
    name = 'Context',
    description = '',
    items = [
        ('GENERAL', 'General', '', icon='BLENDER'),
        ('FILEPATHS', 'File Paths', '', icon='KEYINGSET')],
    default = 'GENERAL')

this is obviously not working and i didnt saw any example out there, nothing in the documentation either.
i saw this question but it didnt help
How to add custom icon to EnumProperty in add-on
does someone here know how to do this ? is this even possible ?
original
test_context: bpy.props.EnumProperty(
    name = 'Context',
    description = '',
    items = [
        ('GENERAL', 'General', '', icon='BLENDER'),
        ('FILEPATHS', 'File Paths', '', icon='KEYINGSET')],
    default = 'GENERAL')

test_context: bpy.props.EnumProperty(
    name = 'Context',
    description = '',
    items = [
        ('GENERAL', 'General', '', 'BLENDER',1),
        ('FILEPATHS', 'File Paths', '', 'KEYINGSET',2)],
    default = 'GENERAL')


text:
How to know if the toolshelf/properties/header is ON/OFF with python?
i'd like to have a boolean return value with thoses three toggle operator
bpy.ops.view3d.toolshelf()
bpy.ops.view3d.properties()
bpy.ops.screen.header()

id like to toggle them only if they are 'ON', but i don't see any way i can do that

there's no official way to know, you can just know, i just found a trick with the interface region width
import bpy

bpy.context.area.ui_type = 'VIEW_3D'
area = bpy.context.area

for region in area.regions:
    if region.type == 'TOOLS':
        if region.width == 1:
            print("toolshelf closed")
        else:
            print("toolshelf open")
    elif region.type =='UI':
        if region.width == 1:
            print("properties closed")
        else:
            print("properties open")
    elif region.type =='HEADER':
        if region.width == 1:
            print("header closed")
        else:
            print("header open")


text:
How to access the context of a future created screen?
In this simple script below, i created a duplicata of the context editor into a new screen. all i want is to know the context.screen.name of both editors.
import bpy
print(bpy.context.screen.name)
bpy.ops.screen.area_dupli('INVOKE_DEFAULT')
print(bpy.context.screen.name) #still the context of the old screen

when trying this script, all it print is the same context.screen.name twice.
How can i access future event like this?

bpy.context.window_manager.windows[-1].screen.name

will be the name of the last created screen.


text:
How to prevent a newly create window to change its content when switching between workspaces?

hello, how do i prevent this behavior of any newly created window /window dupplication ? i want the content of the window to stay the same when switching from workspaces to workspaces.
can it be done within blender ? can it be done with python?

No, you can't use edit mode and object mode in the same time in different windows.

that's not what im asking

The only solution I found is to create an extra camera and lock it to the view. Then you'll have to make the camera active in each workspace to be able to switch between the workspaces, preserving the angle of view. A bit annoying workflow, but it helps to solve the problem


text:
Changing the name/icon/function of menu/pie menu/panel with a condition?
for example in this pie menu below
import bpy
from bpy.types import Menu

class Pie_menu(Menu):
    bl_label = "Some Pie Menu"
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        pie.operator("wm.call_menu_pie", text = "Some Other Pie", icon = "RIGHTARROW_THIN").name="Pie_menu"
        pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
        pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
        pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
        pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
        pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
        pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
        pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
        pie.separator()
        pie.separator()
        other = pie.column()
        gap = other.column()
        gap.separator()
        gap.scale_y = 7
        other_menu = other.box().column()
        other_menu.scale_y=1.3

        if len(bpy.context.selected_objects) == 0:
            option = "option if nothing is selected"
        else:
            option="defaultoption"

        other_menu.operator("mesh.primitive_cube_add", text = option ,icon = "BLENDER")

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

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

#if __name__ == "__main__":
    #register()

    #bpy.ops.wm.call_menu_pie(name="Pie_menu")

there is a button with different functionalities, name, icon, (here its just the name) depending on a condition.
it work fine if i register this addon from the script, by removing the three # at the end and Running the script, but as soon as i register this as an addon, its not working anymore. Why ?
also in this same idea, how can i put a vaiable like that not in a form of a button but a simple text ?

it seems that we cannot put condition themself within the menu class SO if i wrote a custom proprety   bpy.context.scene["Test"]="Adaptive Name" and them reffer this new name by bpy.context.scene["Test"]it can work !

HI. If you have an answer, please place it in the answer box below, not in the comments.

yes i needed to wait a bit

So i cannot write a condition directly on the pie menu
BUT i can reffer the name,function and icon to an actual name inside of blender.
so i could create a custom properties just for the occasion
for example i can first add two custom properties with thoses codes:
bpy.context.scene["Name of my menu"]="Adaptive Name"
bpy.context.scene["Icon of my menu"]="BLENDER"

the only problem is that it need to be done BEFORE opening this pie menu.
and you can do this with the followed technique:
class BackMeUpPie_OT_Operator(bpy.types.Operator):
    bl_idname = "view3d.pie"
    bl_label = "Back Me Up Pie Menu"
    bl_description = " OPERATOR DESCRIPTION HEYYYY"
    def execute(self, context):
        try:
            bpy.context.window_manager["Auto-Copy Icon?"]+=1 #if i can do this its not the first time i launche the pie
        except:
            bpy.context.window_manager["Auto-Copy Icon?"] =1 #if i can't it is, so the timer cannot be
            bpy.context.scene["Auto-Copy"] = "OFF"
            bpy.context.scene["Auto-Copy Ic"] = "FAKE_USER_OFF"

        bpy.ops.wm.call_menu_pie(name="view3d.pie_backmeup")
        return {'FINISHED'}

creating an operator, that determine the icon, name..Ect.. of your cutom assets with the condition of your choice, like in this exemple above, and then just after opening your pie/menu


text:
Execute a specific action on the first run of the script?
Id like to execute different action on the first run of the script
for example the first try i want to execute:
Print("First Hello")

and on the second run.
Print("Hello World")

i don't understant how to do this, because if i store a variable within the script itself every run the variable will be redefined.
i tried something like this, playing with a new stored variable within blender,
    try:
        bpy.context.scene["Auto-Copy Start"] += 1

    except:
        bpy.context.scene["Auto-Copy Start"] = 1

and it can totally work. for example
try:
    bpy.context.scene["Auto-Copy Start"] += 1
    Print("Hello World")

except:
    bpy.context.scene["Auto-Copy Start"] = 1 #that mean its the first run
    Print("First Hello")

But if i save the file and re-run my script it will not work anymore with the saved file, this technique work only for the first run once per file only.
Or i want the first run to execute the first code per blender session. Is this possible ?

Use the window manager
Window manager properties only exist for a session, whereas scene properties are stored in the file.
It's good practice to avoid try except clauses. If a custom property "xxx" on object ob is defined, it will be a member of ob.keys() and can be tested for with "xxx" in ob.keys()
import bpy
context = bpy.context
wm = context.window_manager

if "new" in wm.keys():
    print("Not New")
    wm["new"] += 1
else:
    wm["new"] = 1
    print("New")

May also be an idea to investigate using a non persistent  on-load handler. (Remove the decorator from the example)


text:
How to add bevel to circular-transform node group?
I want to add Bevel to the Circular-Transform node group.
related https://blender.stackexchange.com/a/309345?noredirect=1

The result should be this with Width = 10

I don't think the "circular-transform" has any relevance here. The bevel seems to be multiplying the color by the distance to the nearest edge (potentially scaled=multiplied) and clamped to $[0, 1]$ range. And therefore the heart of the question is how to get calculate that distance.

what do you mean?

Your "bevel" is simply a gradient, where you take the original color you would have if not for the "bevel", and then darken it based on the distance to the edge.

May I ask what is the unit of "Width" ? It looks like 10% of the external radius. And also related to Markus von Broady comment, how to you define the "edges" to smooth ? Are these defined as separation lines between two repetitions, as well as the external radius (i.e. 4 radius and 1 circle in your demo) ? If so, the "Bevel" NodeGroup in your graph should be after the "Circular-Transform" one.

yes, I think it is 10% of the external radius

How to do that?

As mentioned in the comments, the problem comes down to calculating the distance to the nearest edge. In a shader, or otherwise in a mathematically defined object that you can't just test using a BVHtree, it is a hard problem. I think basically if hard mathematical transformation problems like this didn't exist then we wouldn't have cryptography.
The example given in the screenshot makes it easy to define the distance to the edge:

Notice how just the 3 last nodes added by me: Map Range → Power → Multiply, is what controls the bevel and the rest is what calculates the distance to the edge: a minimum of the horizontal distance to the center, vertical distance to the center, and distance to the circumference.
This would also work, if that situation was the basis of the original effect, that is only then transformed by vector manipulations - in such case you only would need to pass the custom group output to be used instead of the 2nd (added by me) "Texture Coordinate" node. But unfortunately the base coordinate system is different, and you didn't put any effort to explain it in your question.

Can you share the blend file? I copied the node setup but it's not working.

@Karan show your setup


text:
How to make sharp curvature mask?
I made a curvature mask (smooth curvature).

Now how to get this result (I think it is called sharp curvature)?

Related to this question


text:
How to add gradient and rotate each cell of the grid?
I am trying to add a gradient to each cell and rotate each grid cell.
The grid is currently separated into Less Than and Greater Than nodes.
Since the grid is separated there is input Gradient Less Than to control the gradient amount for cells which is less than 0.5 and input Gradient Greater Than to control the gradient amount for cells that is greater than 0.5.
In the same way the input Angle Less Then should control the rotation for cells which is less than 0.5 and input Angle Greater Then should control the rotation for cells that are greater than 0.5
Note: The rotation of gradients should be random for each cell.

A bit similar to the Wizard's answer, but this time using the random-per-cell value that Voronoi gives us in 'Color':

Ooops.. The Multiply is by 2*pi (or tau)
The cluster on the left, above, gives rotated UV's per-cell, as illustrated on the left, below:

The center example shows a square image rotated by the cluster and shifted appropriately.. the right example shows an X gradient in the same frame, again shifted in the (rotated) coordinates, to put black at X = -0.5

At first I wanted to use the Color, but I was worried the distribution will be gaussian like with Noise Texture: https://i.imgur.com/hYQsSFi.png - but I just checked, and for voronoi the distribution is even: https://i.imgur.com/NY1EnX6.png - testing with this setup: https://i.imgur.com/gcRO933.png

@MarkusvonBroady  I was trepidatious posting under you..  I  knew  there must be a reason the Mage hadn't gone for it.. and he's  tested! I'm so lazy.. I've just used it so often, and seen others do the same, I never questioned that. Great work to settle it for sure.. and a Happy Xmas, MVB!

I only tested after your answer, and your approach is the better (simpler) one, Merry xmas!

Awesome node compositing.

You can use Voronoi texture for that:

If you don't want any flat color, as explained by Gordon Brinkmann in your other question, you need to normalize the range

Great work of node tree


text:
Is it possible to make Simplex, Perlin and Worley noise using shader nodes?
I want to create classic Simplex, Perlin, and Worley noise using shader nodes.
The Noise Texture says it is a fractal Perlin noise but I want the classic Perlin noise.
The Voronoi Texture says it evaluates a Worley Noise but I want the classic Worley noise.
I did not get any node equivalent to Simplex noise.
Is it possible to create these noises procedurally?

Blender's Shader Graph has a Script Node which supports a broad spectrum of the Open Shading Language.  The Open Shading Language enables loops, for example, which are a powerful tool in shader programming. With this (I claim), it should be possible to generate your desired noise types (without knowing the formulas in detail now).


text:
How to render camera backgound image into a texture?
I can render the camera view into a texture but when the camera has a background image it doesn't show it.
Is there any solution to it?
example code: https://docs.blender.org/api/current/gpu.html#rendering-the-3d-view-into-a-texture
import bpy
import gpu
from gpu_extras.presets import draw_texture_2d

WIDTH = 512
HEIGHT = 256

offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)

def draw():
    context = bpy.context
    scene = context.scene

    view_matrix = scene.camera.matrix_world.inverted()

    projection_matrix = scene.camera.calc_matrix_camera(
        context.evaluated_depsgraph_get(), x=WIDTH, y=HEIGHT)

    offscreen.draw_view3d(
        scene,
        context.view_layer,
        context.space_data,
        context.region,
        view_matrix,
        projection_matrix,)

    gpu.state.depth_mask_set(False)
    draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT)

bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

I think it's because the camera background image is an underlay and not actually seen by the camera projection

Any workaround?

You should be able to access the background image pixels from the image datablock, maybe you can as a first pass draw the pixels to the gpu texture, and as a second pass draw the view 3D ?

How to do that?

Good question. Maybe you can also use the Image as Planes addon to create actual geometry then it will appear in the render view. Cheers