text:
Define properties as annotations for dynamic property group
I'm trying to figure out how to generate a dynamic property group class, but I keep getting the annotations error: Warning: class PropBools contains a property which should be an annotation!. And following this error, I get the following printed line for each property: assign as a type annotation: PropBools.******.
Here is the code I have so far. I can show details about the list of data if it will help at all, but I don't think it will influence the error I'm getting.
PropBools = type(

        # typename
        'PropBools',

        # base class
        ( bpy.types.PropertyGroup , ),

        # dictionary of bool properties
        {
            ft.ID : bpy.props.BoolProperty(
                default         = False,
                name            = ft.Name,
                description     = ft.Desc,

                ) for ft in prop_list_data
        }
    )

Is it possible to do this without throwing the warning/error? Has anyone successfully generated a dynamic property group since the annotation requirement update?
Edit: I found Blender 2.8 - Field property declaration and dynamic class creation , which may be the only solution. Here is the same code, updated to define an annotations dictionary:
PropBools = type(

        # typename
        'PropBools',

        # base class
        ( bpy.types.PropertyGroup , ),

        # dictionary of bool properties
        {
            '__annotations__' :
            {
                ft.ID : ( BoolProperty,
                {
                    'default'       : False,
                    'name'          : ft.Name,
                    'description'   : ft.Desc

                } ) for ft in fuse.Type.Index
            }
        }
    )

You can even unpack dictionaries of extra parameters into it (this is a different dynamic class):
PropValues = type(

        # typename
        'PropValues',

        # base class
        ( bpy.types.PropertyGroup , ),

        # generate dictionary of override properties
        {
            '__annotations__' :
            {
                ft.ID : ( ft.Prop.Func,
                {
                    'default'       : ft.Default,
                    'name'          : ft.Name,
                    'description'   : ft.Desc,

                    # specify our property event function for updates
                    'update'        : ft.ValUpdate,

                    # unpack dictionary of keyword arguments to this property function
                    **ft.xop

                } ) for ft in fuse.Type.Index
            }
        }
    )

No warnings or errors using these yet, so seems promising.
Edit: This works great. The problems listed below were caused by an issue in the property list data, which was causing a silent error, which prevented ALL of the properties from registering, making the dynamic class appear empty. After finding and fixing the silent error, everything appears to be working.
However, the properties don't exist as they typically would in an instanced property group (of either dynamic class). Attempting to access a property using the syntax my_prop_group["id_name"] throws an error as if it doesn't exist. (A silent property error was causing this).
I'm not sure if I need to manually assign each one to default values (my_prop_group["id_name"] = DEFAULT).
Not sure if I need to include the entire dictionary of properties along with the __annotations__ dictionary of the same properties. Printing dir(*) of non-dynamic property groups seems to indicate that they should have both defined (silent error was causing properties to not register).

Using syntax my_prop_group.id_name gives me the error 'PropValues' object has no attribute 'id_name', even when I attempt to manually set its default value first (using my_prop_group.id_name = x). By comparing my dynamic class to non-dynamic classes (using dir()), it looks like there is still information missing. Non-dynamic classes have the properties listed in their primary members, where my dynamic class only has them listed inside of the annotations member. So it seems like something is still missing. I really appreciate the help, though. Please let me know if you have any ideas.

I may have made a mistake when I said non-dynamic classes look like they have more information. After setting up a simpler test, they actually look identical. In addition, I can access the prop of the simpler dynamic class. So there may be some other issue with my more complex version. I will try to figure this out when I get back from work. Thanks again.

It was actually being caused by a silent property error. I edited question to reflect. It appears to be working now. Is there any way to access or see these silent errors? There is nothing at all listed in the console.

What I am using for dynamic annotations is, define the class, eg class Foo: give it an empty dictionary as the __annotations__ member.  Then populate with  Foo.__annotations__[propname] = bpy.props.SomeProperty(**kwargs)

I didn't know that was possible. That would certainly make things simpler in many situations. Just out of curiosity, I wonder if this would work for classes that have at least one normal property defined? Assuming you would not have to manually define the annotations member, but it seems like everything else would work.

@batFINGER I'm wary about doing that as I'm not totally sure how the annotations are implemented and used as a Python-level language feature. Do you know for sure or is it explicitly guaranteed that populating __annotations__ will be equivalent for Blender's purposes to defining them as literals? If they're added after class creation, for example, then I wouldn't expect any __init_subclass__ or metaclass magic to work from bpy.types.operator.


text:
Dynamic, temporary variables with property groups
I don't know the correct terms for these types of variables, so dynamic/temporary may not be the best name for them. But while conducting tests with Blender class instances and comparing behavior to normal Python class instances, I've noticed that there is something different about the way Blender property group instances (variables) work.
Using normal Python variables/instances, I can do something crazy like this, where NotDefined is not defined in MYCLASS:
a = MYCLASS()
b = a
b.NotDefined = "stuff"
c = a

Now NotDefined == "stuff" in all variables (a, b, and c).
This next bit is using propgroup, which is a class instance derived from bpy.types.PropertyGroup and attached with bpy.props.PointerProperty:
a = scene_object.propgroup
b = a
c = scene_object.propgroup
b.NotDefined = "stuff"
d = scene_object.propgroup

In this situation, NotDefined will exist in both a and b, but not c or d. As someone new to Python/Blender, this situation has thrown me into a cycle of confusion more times than I can count. I just didn't realize it was happening until recent excessive testing.
It's almost as if the property group instance itself is not really an instance, but some kind of instance generator.
Is it at all possible to attach temporary dynamic variables to Blender class instances like property groups? This is more for knowledge, rather than any practical need for them. I know I can attach permanent dynamic properties using group["name"]=*. But I'm wondering why the above types of variables don't work in this situation like they do elsewhere, or if there is a way to make them work.
Edit: One other question I had is the impact of this type of problem when trying to define self-variables for instances like operators inside of their constructors? Are we limited to using properties? For example, would it be possible to define a link/ref to an arbitrary non-property class instance (self.SomeData = other_module.linked_list)?

Suggest that internally,  a property akin to the old fashioned Foo.bar = property(setter, getter) is how bpy.props sets things up, hence c in your second example is a different instance of the value returned from the property's get method and in no way related to a or b.  To avoid confusion class instancing is rarely used in blender eg ob = bpy.types.Object(...) is not used, rather ob = bpy.data.objects.new(...)    We don't instance a property-group, rather register it and assign to a pointer or collection prop.

Thanks for the info! I have a habit of using temporary references to work with scene data, so I've never directly dealt with property groups - just other variables linked to them. So it always looked like group.Prop = 10 worked. But then when I would send the property group to a function and have that function make changes, those changes would not be there when it came back. Took me a while to narrow it down to this problem.

source: Stack Exchange

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

sort: votes


text:
Difficult to click on bones?
I've looked over the net and found nothing about this, so it may be some setting I have wrong. I'm using the newest version of 2.8 and it may have some option settings that were carried over from a previous 2.8 version.
I have a hard time aiming the cursor at bones to select them. I can aim directly at  a bone and click it, but nothing happens. I usually have to aim at the edges of them to get a confirmed click, but even that doesn't always work.
Sometimes it seems like I have to aim at the very top or bottom of a bone's center area to get it to react. But these are just crazy theories. Obviously something is wrong. I haven't worked with bones in Blender before this version, so I have no idea if it is something that changed.
It only seems to happen with the octahedral shape. I can select other shapes fine, but I prefer to see the angles of bones more clearly, which only seems to be possible with that shape type (apart from making angles visible).
Is this something everyone deals with? Is there any way to make it better?
Thanks for any help!
EDIT: It is almost as if there is a clickable screen-space border surrounding the bones. If I click in their center, nothing happens. But if I then zoom the view out and click the exact same area, it works.
EDIT2: Apparently it doesn't seem to happen on my laptop, so it must be a specific situation with hardware or settings. Will add another edit if it starts happening on this computer.
EDIT3: Okay, not specific to any computer. It only happens when X-Ray is enabled. Which I usually always have it enabled so I can see the bones inside the skinmesh. Any ideas why this happens or how to improve it?

is your gizmo displayed? maybe it's because of it, I've also noticed that it prevents to easily select the bone, because Blender thinks you try to select the gizmo instead. Maybe it will be fixed...

No, I think I may have disabled gizmos early on. I only see a transform gizmo when I select a specific tool such as translate or rotate. Typically I just press G or R instead, so don't see the gizmos. My guess is that Blender is accidentally or intentionally converting bones into some type of edge-only mode during X-Ray mode, where only the outline shapes of bones are interactive for the mouse.

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


text:
Drivers & Relative Bone Rotations?
I've been trying to figure out how to create a driver that relies on relative bone rotations only. Is this possible?
The concept is very simple. A parent bone attempts to rotate itself based on its child's relative rotation. So imagine a hand twisting, and a forearm twisting along with it. The problem I'm running into is that the hand is a child of the forearm, so the forearm (while observing the hand rotation) ends up reading its own rotation changes, which causes feedback. But this doesn't make sense if the rotation I'm reading is relative.
I was under the impression that "local space" rotations would mean relative rotations? This means the parent rotations have no influence on the result, right? But if that was the case, why would the result become unstable when a parent bone attempts to rotate based on a child bone?
Am I misunderstanding the way local space works? If so, is there a simple way to obtain "relative rotations" of bones for drivers? A method to use that would allow a parent to change itself based on a child?
Edit: After some testing, I'm pretty sure the rotations are indeed relative. So I'm guessing there is just some type of glitch or error that occurs when trying to use child transforms in parent drivers when IK is involved. Can anyone confirm this? Any way around it?
Edit 2: Just to clear everything up, I have a hand (child most), a wrist (parent of the hand, and it only twists), an elbow (parent of the wrist), and an upper arm or shoulder (parent of the elbow). I want to make the wrist automatically twist when the hand is twisted (the axis that runs down the bone) so that the wrist twisting runs down the entire forearm.
When I attach a driver (to the wrist) to make this happen, the mesh warps at the wrist area and stretches all over, as if the bone transform is exploding, even while the hand twist value is at zero. If I temporarily disable the IK chain applied to the hand (the little eyeball toggle of the constraint), the problem looks the same. If I delete the IK chain applied to the hand, the problem goes away and looks perfect.
Does anyone know why or how to deal with this? I've tried tweaking the IK rotation limits of related bones, but nothing seems to help. My IK bones are separate from my real bones. The real bones simply follow the rotations of the IK bones. But I've tried applying the IK directly to them and it doesn't seem to change anything.
Thanks for any clues!

Do you use the IK chain to deform the mesh directly? The wrist bone should be parented to the elbow so that you can read the rotation from there and then use that to drive the individual deforming bones. You can also set this up using a bendy-bone which have this functionality built in.

Sort of, but not exactly. I have copies of the real bones that I use for IK, and the real bones follow the rotations of the copies when IK is enabled. But I don't think this influences the glitch I'm seeing. The elbow (forearm 1) is still the parent of the wrist (forearm 2). And the wrist can only rotate in one direction - twisting. I wanted to make the wrist automatically twist when the hand twists. That is my goal. But apparently, as long as an IK chain is involved, the skin-mesh warps all over the place when I try to use a driver to do this. If I delete the IK-chain, it works fine.

I don't get it... care to share?


text:
Assign keys (keymap) to Transformation Orientation?
I could not find anyone asking this question, which means there are probably already quick keyboard commands to do this.
What I want to do is assign keyboard shortcuts to transformation orientations. Especially Local, Global, and View. But preferably others as well. For example, I may set up something such as Shift + 1 for local, Shift + 2 for view, and Shift + 3 for global. However, when I try to assign shortcuts to these using the right click context menu, the commands just show up as "Context Enum Menu", with a command of wm.context_menu_enum and context attribute of scene.type. I'm pretty sure this is not correct (it throws an error when the command is pressed).
Does anyone know how to pull this off? All I can find is the pie menu shortcut (,). That's better than nothing, but I would like to have direct commands.
Thanks for any help!

I can only think of Quick Favorites, or a python script. I don't typically use scripts, so I don't have one. :|

It doesn't seem to let you add it to quick favorites either. Although the orientation menu (key = ,) is good enough for a two step command if I can't have a single step.


text:
Blender Dev: Global location to store project properties?
Is there anything more global than a scene that can contain project-related properties that should be saved to each *.blend file?
Since a single file/project can contain any number of scenes, where would an add-on typically store properties that should only exist in one place?
Looking for something like..
bpy.types.SingletonObject.my_properties = bpy.props.PointerProperty(type=MyProjectData)

Edit:
For anyone interested in doing this, here are some of the ideas I've found online so far. Except the last one - that one is from me.

Store properties in Window Manager - AFAIK, this only works if you don't want to save the data to the *.blend file.
Create an empty object and store properties in it. I'm no expert at this, but I believe the empty would need to exist somewhere (a scene). So what happens when the user deletes that scene?
Create a custom/dummy ID-block and attach properties to it. I don't completely understand this one yet, but looking into it.
This one is something I thought up and am considering using. It is not as simple as the others, but should allow storing global properties in a single location, as well as saving/loading those properties with the *.blend file:

Store all properties in a custom structure that is attached to BOTH the add-on preferences and the scene data. Will refer to this as global_props. So it would be located at bpy.context.preferences.addons["project"].preferences.global_props and bpy.data.scenes[0].global_props. You would only ever reference the one in the add-on preferences except in the steps below..
Setup a bpy.app.handlers.load_post handler. After a file is loaded, use the handler to copy global_props from the scene to preferences.
Setup a bpy.app.handlers.save_pre handler. Right before a file is saved, use the handler to copy global_props from preferences to scene.
Anywhere you deal with global_props, access and use the preferences version.
Some notes:

It may be possible to only attach global_props to the scene right before the file is saved, then delete it after, if you wanted to avoid wasting the memory it would take up. Not sure if this would cause issues or not.
Using this setup would allow you to give the user the option to save certain properties locally (*.blend) or globally. It would be very easy to simply avoid transferring some of the data based on certain options. This was a feature I really needed for my export add-on.
Let me know if you think of any issues that would stem from using this setup. I'm currently planning to make use of it.

Some of the add-ons that come with blender like rigify assigning some of the properties to the window manager: bpy.types.WindowManager... also you can print a complete list of all available types in the console by using pythons dir() on bpy.types.

Thanks! I'm surprised Blender doesn't provide a specific type for add-ons to attach global project properties to. There is also this list https://docs.blender.org/api/2.80/bpy.types.html - but wow there are a lot of them.

Here is a link to another question that is pretty much identical to mine. No real answers, but some helpful bits: https://www.blender.org/forum/viewtopic.php?t=27291 - they seem to suggest that properties attached to the window manager do not get saved to file. However, this was back in 2013, so I'm sure some things have changed. And here is one more: https://blenderartists.org/t/global-property/626010/6 (2014)

I think you can only assign custom properties to subclasses of ID (or Bone or PoseBone). BlendData inherits directly from bpy_struct, so I don't think it is allowed.

Yeah, tested. nope @Robert I'd use the prefs... that's easy to maintain.

Yeah, that's essentially how that setup works. Everything is dealt with from the prefs. But add-on prefs don't get saved with blend files. So I am copying parts of the prefs to/from the scene when files are saved/loaded. Whichever parts the user chooses to save locally versus globally. There are a lot of export options, so this is a really good side effect. For example, you might want the root directory settings to be specific to each project, but want the object name prefix/suffix settings to be global.


text:
Is there a way to change Grease Pencil brush settings with Python?
I'm trying to change a lot of a brush's properties with the click of one button, like the smoothing, simplify, etc.
A command like bpy.data.brushes["Ink Pen"].tool_settings.gpencil_paint.brush.gpencil_settings.pen_smooth_factor = 0.5  should work, but when I run it, I get the following error:
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
AttributeError: 'Brush' object has no attribute 'tool_settings'

It seems that every property I want to change on ANY gp brush that has the .tool_settings... in the property name simply does not work, and always returns this error. Pasting the exact lines that show up in the Info window into the console, still gets the error.

The python tooltip and the statement that's printed in the info console are misleading in this case. You should use directly :
bpy.data.brushes["Ink Pen"].gpencil_settings.pen_smooth_factor = 0.5
Let's reverse-enginner how to solve this. In the Python docs search for pen_smooth_factor.
The first result brings us to bpy.types.BrushGpencilSettings.pen_smooth_factor
If you scroll all the way down to the bottom of the page you'll see in References that this is implemented in bpy.types.Brush.gpencil_settings.
bpy.types.Brush is the type you get with bpy.data.brushes["Ink Pen"].
print(type(bpy.data.brushes["Ink Pen"]))

... truncated<class 'bpy.types.Brush'>


text:
Hair breaks when I apply 'Hair Dynamics'

So making my first model from scratch, I give my lil guy a mohawk, but when I go to apply Hair dynamics it breaks apart like this.
I have no clue how to fix/what I've done wrong. any help please?

maybe read this answer? https://blender.stackexchange.com/questions/265824/why-is-my-hair-dynamics-going-crazy


text:
How can I load OpenVDB files with correct scaling and translation
Dear Blender community,
I have been trying to use Blender to visualize molecules and volumetric data from molecular dynamics simulation. I managed to save my data in OpenVDB format using the pyopenvdb library as described in https://www.openvdb.org/documentation/doxygen/python.html, and I am very happy with the visualization.
However, I did not manage to load the object with the appropriate scaling and position. This is important because I want to exactly overlay the volume with other objects, such as molecules imported using Atomic Blender. So far, I tried setting the 'center' and 'scale' attributes in pyopenvdb as follows:
vdb_grid = vdb.FloatGrid()
vdb_grid.name = "density"
vdb_grid.copyFromArray(data, tolerance=0.1)
vdb_grid['center'] = [-20, -20, -20]
vdb_grid['scale'] = 0.5

vdb.write("out.vdb", grids=[vdb_grid])

However, it seems that the information is not used by Blender. The volume is still loaded at full size and at the cursor position. My current workaround is to add some density at the grid corners to give the volume object a well-defined size, and then manually set the translation and scaling properties in Blender. The extra density is needed because the density does not always fill the whole grid, and If the grid is trimmed, I don't know where exactly Blender puts the object's center relative to my grid coordinates.
Is there a more elegant way of doing that, or are there other OpenVDB attributes that I could use? I would like to position my volumes exactly, based on my original data, and I would prefer a method which requires as little manual copying of numbers as possible. I would also prefer not to use my current workaround, where I add fake density to fix the size of the object.


text:
Blender 2.8 closest_point_on_mesh returns incorrect face index
I have a mesh imported from MakeHuman with armature, subdivision and two mask modifiers. I need to find nearest vertex to some location.
If I use brute force cycle to iterate vertices and find vertex with min distance, it works fine, but is very slow and unusable.
Then I tried to use Object.closest_point_on_mesh, but the problem is, although it returns correct hit location, it seems to be that face index is incorrect -- that face is far away from hit point.
vec = (0.1614, 0.0243, 0.1870)

(hit, loc, norm, face_index) = dest_object.closest_point_on_mesh(vec)

if hit:
    print('vector', vec)
    print('hit location', loc)
    print('face index', face_index)
    print('face vertex 0', dest_object.data.vertices[dest_object.data.polygons[face_index].vertices[0]].co)
    print('face center', dest_object.data.polygons[face_index].center)

nearest_poly = None
nearest_d = 0

for p in dest_object.data.polygons:
    if nearest_poly == None or nearest_d > dist_squared_v(vec, p.center):
        nearest_poly = p
        nearest_d = dist_squared_v(vec, p.center)

print('brute force face index', nearest_poly.index)
print('brute force face center', nearest_poly.center)

The output is:
vector (0.1614, 0.0243, 0.187)
hit location <Vector (0.1614, 0.0243, 0.1870)>
face index 12141
face vertex 0 <Vector (0.1684, -0.1665, 0.0024)>
face center <Vector (0.1670, -0.1649, 0.0013)>
brute force face index 12165
brute force face center <Vector (0.1609, 0.0237, 0.1852)>

As you can see from the output, hit location is correctly equal to my vector, but face center and face vertices are off. Brute force solution works fine, as expected.
I tried to delete SubSurf modifier, but nothing changed.
Is this a Blender bug or am I doing something wrong? Also, is there alternatives to closest_point_on_mesh?

Edit: here is visualisation of original location (vec, non-selected cube) and location of the center of the face found by closest_point_on_mesh (selected cube).
Cubes were created using this code:
bpy.ops.mesh.primitive_cube_add(size=0.01, location=dest_object.matrix_world @ loc)
bpy.ops.mesh.primitive_cube_add(size=0.01, location=dest_object.matrix_world @ dest_object.data.polygons[face_index].center)

The center is not necessarily the point of the face that is the closest. I guess closest_point_on_mesh is doing an orthogonal projection on the face (this projection is not at the center). To tell it another way, your brute force loop search for the face for which the center is the closest (and that's different).

@lemon I've attached a visualisation. These two boxes are spawned on precise positions of initial vector and the center of the found face. I can't imagine any projection or algorithm that gives me this face as a result, even if it considers vertex locations of the face instead of face center...

The image is small... hard to see the context. But have you looked at kdtree or bvhtree here? https://docs.blender.org/api/current/mathutils.html (kdtree is probably hidden into closest point on mesh).

@lemon Thank you very much, I've used KDTree and it is as fast as closest_point_on_mesh. That solves my problem with finding nearest point, but I will not close or remove question because I want to know what's wrong with closest_point_on_mesh or my code that uses it.

For that, I've told you: closest point on mesh does not care about face center (you replied me but the image can't let me know where is what).

@lemon Here is upscaled and annotated image: https://imgur.com/a/4enJLiZ

Object.closest_point_on_mesh(...)  uses the evaluated mesh, whereas your "brute force" method doesn't.  Could that have something to do with it?

@batFINGER Can't find in Blender docs what evaluated mesh is, where I can read about it?

closest_point_on_mesh(...) uses a BVH tree.

Evaluated == with modifiers and shapes applied.


text:
Snap objects to floor
I'm a beginner in blender scripting, in How to place any object on the 'floor' of a scene?, @MACHIN3 wrote this simple but smart code. Can you explain me the meaning of every line?
import bpy
context = bpy.context

for obj in context.selected_objects:
    mx = obj.matrix_world
    minz = min((mx @ v.co)[2] for v in obj.data.vertices)
    mx.translation.z -= minz

In the same question the topic of how can integrate this code in Blender as a button is very interesting, can you help me with this? Actually I'm working with tutorials, Manuals, etc. but I'm afraid my knowledge is not enough.

Sorry, the format`s code is wrong

https://blender.stackexchange.com/questions/22888/how-to-place-any-object-on-the-floor-of-a-scene/117188#117188

Hi. If someone wrote the code in another question you should comment on the answer and ask them to explain it there. Also, please only ask one question at a time. Thanks.

Finds the minimum global coordinate of all vertices, translate the matrix such that this is on global z = 0.   Look at the simple operator template in Text Editor > Templates > Python  Replace the innards of main(context) with body of code above (ie the for loop)

@batFINGER thank you very much for your help

ok, finally create the operator an simple panel, as directed by blender's templates, tough i wish add it in 3D view>object>snap  How can do it?  Thanks in advance

My answer in
[1]How to place any object on the 'floor' of a scene?
My addon append one item in Object>Snap menu


text:
Using a baked position as new start position
My problem: I have a (probably insane) model with about 30000 shapes. I want to drop the entire thing using rigid body physics. I am not really interested in the animation as such, nor is it important that the simulation is 100% correct, I just want the final pile of shapes.
The problem is that I can't bake all of it in one go (blender crashes far before the bake is finished).
I am currently trying to bake some frames, then use the baked position as my new starting position, and bake again from there.
I use the following script, and it seemed to work when I tried it on just a few objects, but it does nothing as far as I can see when I run it on my big model.
Script:
import bpy

def usebake(frame = 20):
  bpy.context.scene.frame_set(frame)
  i = 0
  for obj in bpy.data.objects:
    i = i+1
    obj.location = obj.matrix_world.to_translation()
    obj.rotation_quaternion = obj.matrix_world.to_quaternion()
    #obj.rotation_euler = obj.matrix_world.to_euler()
  print(i)

The process I have used is as follows:
Bake -> run script -> free bake -> bake new
Am I doing something wrong?
Alternatively, is there another way to achieve what I'm trying to do?

It turned out all my objects had an animation linked to them for some reason (I'm guessing it is because I had been experimenting with keyframes as another way to solve my question, but I'm not sure). I reverted to a backup file without the linked animations, and it works just fine now.


text:
Cannot remap pan hotkey in UV editor
For the life of me I cannot figure this out. I am trying to get the view in the UV editor to pan when the MMB is clicked, like it normally does. But nothing I do works. I already made a post about this :
How do I remap pan hotkey in UV image editor?
But still I cannot find the right shortcut key. Here are my current settings:

I have been trying for so long to get this to work. If anyone can help I would be eternally grateful.

You are probably adding it in the wrong window context
For the UV Image Editor the  operator is image.view_pan and is supposed to be added in the Image category
There also seems to be an entry for view2d.pan in both the View 2D and View2D Buttons List category
All set to Mouse Middle Press events

Man, you're a real savior. Thank you so much!

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


text:
Bevel not working corectly
Ik I already asked a lot of questions today, but im trying to make a 3d model from scratch and running into a lot of problems, I'm trying to do this:

This is from a youtube tutorial but this happens when i try to use the bevel tool on mine

anyone know why? Please help if you could. I can't seem to find this anywhere else
here is my blender file:
and here is the YouTube tutorial I was following: https://www.youtube.com/watch?v=6BANJc53Eik

The bevel tool doesn't like corners where three or more edges connect.

Try using the Inset Faces tool instead. It looks like that's what was used in the first image.

oh~ he said in the video that he used the bevel tool but it never worked for me. I'll try that though. Although I never heard of it so it will probably take longer than it should for me to solve the problem. Thanks for the quick response though

Ifg you post your blend file I can help more.

Ik this sounds stupid but how do I do that? I'm new to blender >.<

Don't feel stupid for asking questions. That's the only way to learn anything is to ask questions! :-) Go to www.pasteall.org and upload there, then post the link here.

oh! thanks for the help. Here u go: http://www.pasteall.org/blend/42214

After looking at the file and trying a few things, I think you might have either missed a step in the tutorial, or the teacher missed telling you something he/she did. There are other ways to do things though. What is the result you're trying to achieve? Can you post an image? I'll continue to help you on this.

Let us continue this discussion in chat.

I'm not 100% sure but I think http://blend-exchange.giantcowfilms.com/ is the preferred method for uploading blend files.

@Dontwalk really? Anthony told me to upload it there so i did, I'll make one there to then

It's all good... BSE likes to keep them all in one place I think.

@Dontwalk here u go.

What you need to do, is remove doubles. You have 36 doubled vertices in your model, and that is what is giving you problems it seems. After doing this, bevel gives no issues. Tab into edit mode, then select all, and press W>remove doubles.
Then proceed to bevel, and you shouldn't have any problems.

Thanks!! I was finally able to continue with it. I am really new and no almost nothing about 3d modeling so I had no idea what doubles were. Thanks to your help I was able to finally delete it.

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


text:
Python rendering animation saves frame twice
So I have a fairly simple method in my blender python script that either renders and saves an individual frame or renders an animation given a frame range. Now the former option works perfectly, the frame lands where it should be in the newly created folder and everything is fine. The latter, not so much:
For some reason, Blender saves the animation frames twice, once in the newly created folder with the name specified by output_path as it should and once, for some damn reason, in the parent folder above WITHOUT the frame name (just the usual 000X.exr). I should mention that I have just one output node with multi-layered OpenEXR that has an Image channel and a depth channel. I've tried different combinations for the parameters of bpy.ops.render.render and also confirmed it is only this line causing this since it doesn't render or save anything if I comment it out. Obviously I call this method with animation=True when this problem occurs.
I'd appreciate it if you could explain to me why it does that or where the source code for this damn function is.
def render_frame_and_save(output_name, animation=False, start=0,end=240):
    #Determine incremental output path
    i = 0
    while os.path.exists(output_path + '{:03d}'.format(i)):
        i +=1
    path = output_path + '{:03d}'.format(i)
    os.makedirs(path )

    bpy.context.scene.render.filepath = path + "/" + output_name
    if animation:
        bpy.context.scene.frame_start = start
        bpy.context.scene.frame_end = end
        bpy.ops.render.render(animation=True)
    else:
        bpy.ops.render.render(write_still = True)

    #Dump config
    cfg_file = open(path + '/samples.cfg', 'w')
    cfg_file.write('time: ' + datetime_str) #TODO Add config
    cfg_file.close()

So if anyone stumbles over this: I did find out what caused it
A bit unintuitively, Blender automatically saves animation but not single frames. I assumed that after I removed the default composite node (after activation nodes) in the Composition View, Blender would not save anything out of my designated output nodes. But well, it still does (but again, only when you render animations).
Edit (27-03-2020): To make it a bit clearer, the problem is that while you can choose not to save the output when rendering frames, Blender WILL saved rendered animations regardless of your dedicated output nodes. The option not to save this animation output (in addition to your output nodes) seems to be missing.
There also doesn't seem an obvious way of preventing Blender from doing so which is quite annoying.

"Blender saves animation but not single frames?" It's the same operator, nothing annoying... You just have to set the frame Scene.frame_set(frame_number) before calling the operator, example: https://blender.stackexchange.com/a/27640/31447

Dude, you really missed the point. I have no trouble saving either animation or frames, the trouble is that when you choose animation=True, Blender will save the animation regardless of your output nodes whereas if you render frames, you can choose not to save it (since you save it with your output nodes anyway). Your link doesn't really seem to have to do anything with it.

Render to single frames dude, no need for "animation=True" - see my example...

Obviously I can render frame by frame, but since I then have to Python-loop over all frames I want, I suspect it'll slow down my code significantly as I aim to produce a very large dataset. Right now, I just use the "native output" from Blender and additionally other output nodes. I'd rather have all output streams in the Compositing view, but well. I still don't understand why the "native output" isn't just another node, especially considering the default nodes.

We can look into the c source or test whether this slows down the rendering. However, the frame needs to be set anyway (to update the scene) and my example shows the common way of rendering an animation via python so I'm sure there is absolutely no difference performance wise... but yeah can be tested. Re your other/actual question: I guess there is something wrong with your comp. Could you add an image or preferably  a simplified blend file of your comp using https://blend-exchange.giantcowfilms.com/ ?

If you render an animation, the scene is updated automatically, at least starting from your start frame, as far as I can see. Anyway, me noticing that it's impossible to use animation=True and NOT save the "native output" is the answer I was looking for. I find it a bit pointless Blender doesn't allow it, but I probably will have to render it in a loop then. If you're saying it is the standard way I hope it doesn't slow rendering down, I just imagined it could make quite a difference if Blender would use the previous frames to render the next in an internal loop.

frame_set() calls a C function which is most likely the same function that will be called internally when rendering as animation. Again, we can test it. However, the discussion is pointless IMHO, because the render engine can only render a single frame anyway...

I agree, I consider this discussion closed. I still wish the render function would have the option as it'd be a bit prettier but I'll have to work with what's there.


text:
Lookdev mode is showing objects as only black and white
as the title says not sure why its happening.
I'm very new so sorry i can't add much more info.
Any help would be appreciated.

image of whats happening.

How to upload an image to a post

Which version of blender? Also had the issue shown here https://blender.stackexchange.com/questions/131649/blender-shaded-mode-view-problem on locally built version  2.80 or 2.81 (can't remember)  Fixed by v2.82 (definitely for  2.83)  @DuarteFarrajotaRamos keep meaning to bookmark that one.  Hope all is well in P'gal.- These are interesting times we live in

2.82a. Could redownloading 2.82 help?

Since the reflection probe doesn't render properly it's probably either an issue with your graphics driver or a bug in Blender.

just fixed it. saw a comment @DuarteFarrajotaRamos made about opening a new file and switching to eevee and then switching back to the original file. Thank you :)


text:
How to get the camera pose(4x4) matrix in blender python?
I am rendering a multiple-views of an object in blender-python API. I am able to render multiple views by moving the camera in a circular path. I would like to know how to get the camera poses for the rendered multiple views. I would want to save the camera pose information for each rendered view.
I am new to blender and blender-python. Any quick help is appreciated?
Thank you!

There are literally hundreds of answers on here that answer your question

Sorry, I think I did not make it clear. Basically, I would like to know how to get the camera pose using script?  or for any arbitrary camera location and direction, what is the script to get the camera pose in  blender -python? I hope it is clear now :)

Global transform is camera_object.matrix_world  Somewhat related https://blender.stackexchange.com/a/176762/15543

what do you mean by global transform?Is this the projection matrix? Can this be taken as the pose of the camera?

The camera matrix and the camera objects world matrix ie  how it is aligned in global space are distinctly different . AFAICT from question you want the world matrix.  Where it is where its pointing.  Perhaps it may be an idea to post your code.

@akes I think trying to find the projection matrix is going deeper than necessary. The camera's global transform (or position and rotation) should be enough unless you're doing something really, really fancy.

Thank you all, I used cam.world_matrix


text:
Script calculated multiple times on frame
I have a simple script like this:
import bpy
frame = 0

def tester(scene):
    global frame
    frame = scene.frame_current
    print(frame)

bpy.app.handlers.frame_change_pre.append(tester)

It should print out the current frame. If I just play the animation, works as expected, but when I start rendering it gives back multiple numbers on each frame.
(I'm only using this script to demonstrate, the problem is occurring in a more complex script. But the anomaly is the same.)
I'm getting results during rendering like this:
1
0
1
1
Saved: 'C:\......'
2
1
2
2
Saved: 'C:\......'
3
2
3
3
Saved: 'C:\......'

and so on...
Any guess why and how can I prevent this from happening? (I'm trying to insert an if statement that is prevening the recalculation of an already calculated frame, but this solution is way more hacky than it should be...)

Clean the handlers.
with no handlers appended at all, running question script will print the frame once.
There is only one function assigned
>>> for f in bpy.app.handlers.frame_change_pre:
...     f.__name__, f.__module__
...
('tester', '__main__')

running question script three more times
>>> for f in bpy.app.handlers.frame_change_pre:
...     f.__name__, f.__module__
...
('tester', '__main__')
('tester', '__main__')
('tester', '__main__')
('tester', '__main__')

will see frame printed 4 times. (One assumes you made an edit to get the -1)
Clear the handler.
Can clear all the functions assigned to a hander via
bpy.app.handlers.frame_change_pre.clear()

to remove all the methods from each time you run script above.
Or iterate over appended funcions and remove those where f.__name__ == "tester" or by module if testing in text editor (__name__ == "__main__")
When a handler is assigned a method via an addon, it can be appended in the register and removed in the unregister.  The namespace of the addon ensures its the same method both times  my_addon.foo_function  whereas when run from main thread "__main__.foo_function" is not seen as the same.
Example in console of removing any frame change pre handler function added via main thread.
>>> fs2remove = [f for f in bpy.app.handlers.frame_change_pre
...     if f.__module__ == "__main__"]

>>> fs2remove
[<function tester at 0x7ffac5165ca0>, <function tester at 0x7ffac51659d0>, <function tester at 0x7ffac5165d30>, <function tester at 0x7ffac5165550>, <function tester at 0x7ffac5165700>]
>>> while fs2remove:
...     bpy.app.handlers.frame_change_pre.remove(fs2remove.pop())
...
>>> bpy.app.handlers.frame_change_pre[:]
[]

At firts, thanks for the detailed answer, but the problem wasn't there. The scipt I've provided only creates 1 handler and it's fine. In my original script I've created a reset function too, that clears the app handlers if it's restarted or if it's already added. But I found the problem!
--->IT WAS THE MOTION BLUR. The script was called multiple times as the motion blur needed the frame to be calculated multiple times. If I turn off motion blur, everyting calculates only once. Can we think of it as a bug? As I discovered, it also messes up other scripts that should run once on every frame

Motion blur is achieved by rendering intermediary frames and merging them together, so if you need to apply some script to e.g. update a position of something, if the script wouldn't run, the position wouldn't be updated and so the motion blur wouldn't work.


text:
Texture on Each Side
I placed a simple bump wave texture on my model but on the side faces it stretch:

this is the node setup:

Someone know how may i fix this problem an make the texture uniform all around the model?
Thanks a lot in advance.

Did you try playing with an Object Texture Coordinates Node?

I found a similar question here: https://blender.stackexchange.com/questions/44295/material-skews-and-stretches-when-placed-on-a-new-object/44301#44301

The Wave texture is 3D, and you've chosen the Bands option.
If no Texture Coordinate is supplied, the texture will default to using the Generated texture space, which is (0,0,0) at the minimum XYZ of the shaded object's bounding box, and (1,1,1) at the maximum. The bands are parallel. Wood doesn't grow like that, so the bands need to be messed with quite a lot.
Another common approach to wood is:
First find your log

The log is mapped in its object space. The log's origin is at its center, with Z running along its length. The Rings version of the Wave texture is used, oriented and scaled so the growth rings are around the center, and stretched the other way, in Z.

In the bottom branch of the node tree on the left, a Voronoi texture muddles the texture space in a vaguely 'knotty' kind of way. There are probably better ways to do this, but the point is the main geometry, starting with the Texture Coordinate node.
Then cut your planks
Here are some planks using the log's object texture-space, and the same material as the log.

Of course, the log and its object space are only here to illustrate. In practice, you could use the plank's own object space, but shifted and rotated to offset the space in the same way as the planks are offset from the log. If you want the offset to be different for each plank, you can include some kind of random-per-object factor in the offset:

This is by no means exemplary wood: there are plenty of better (and more complex) examples out there, but I hope this is enough to show the principle. All these billets share the same material:

One fault with this is that Blender's Wave > Rings are actually spherical like an onion, not cylindrical: just stretching along Z is not great. To get cylindrically concentric rings with varying seasonal growth and wobble all the way down the imaginary log, I think you would have to make your own cylindrical-bands node group, but that's another question.

Thanks a lot to everyone!

Robin Bestt at it again :).

@JachymMichal I actually thought I might not have answered the question.. 'wood' isn't mentioned. In which case your answer is more appropriate..:)

Who cares about appropriate answers when I can learn so much from yours :).

To avoid distorted textures and have better control you can use a UV map.
Then you can rotate different parts depending on your needs.

Create a UV map for your mesh
Connect it using the Texture Coordinate node
Manipulate it either directly or using the Mapping Node.

Unwrap your Mesh. You can also move individual parts of your UV map.

Connect your UV map and use Mapping node to manipulate it


text:
Can't bevel to a smooth edge
I'm frustrated that I can't bevel an edge. The change is in a larger area than I would like and I can't get a smooth edge. I'm trying to learn Blender having used 3dsmax and maya before, but something doesn't seem to make sense. I can't get the same level of border control as I did in other programs. Does anyone have any idea what I'm doing wrong?

This is happening as a result of non-uniform scale. What this means is that you have scaled your object in object mode, and not "told" blender to adjust proportions accordingly. To fix this problem, enter Object Mode, select your object, press Ctrl+A and select "scale".

Got it, thanks for the help. Worked like a charm! So whenever I make a change of scale do I have to "confirm" doing this?
Is there any way to avoid this confirmation? There is some option that confirm the action to avoid this step?

Yeah, it depends on the workflow, but generally it's best to make all (permanent) scale (and other transform) changes in edit mode. This way, you don't have to "reset" each time.

Make sure to apply the scale before you do the bevel.
Navigate to Object > Apply - Scale or CTRL+A > Apply scale


text:
How to get lamp object?
How to get lamp object?
def test():
    Lights = bpy.data.lamps
    for light in Lights:
        light.use_nodes = True;
        light.type="POINT";
        AdddLightIes(light)

#how to get light.object? and set position?

Blender object basics.
The lamp objects in bpy.data.lamps is the data part of a lamp object o. A lamp object has o.type == "LAMP" and o.data is a lamp object from bpy.data.lamps.
To get all lamp objects in file
lamp_objects = [o for o in bpy.data.objects
                if o.type == 'LAMP']

all in file that use a lamp named "Lamp"
lamp = bpy.data.lamps.get("Lamp")
lamp_objects = [o for o in bpy.data.objects
                if o.type == 'LAMP' # need this since
                and o.data is lamp] # o.data is None for empties

for all in context scene
scene = bpy.context.scene
lamp_objects = [o for o in scene.objects
                if o.type == 'LAMP']

for all in context selected objects
lamp_objects = [o for o in bpy.context.selected_objects
                if o.type == 'LAMP']

To move all lamps to local position (0, 0, 0)
for o in lamp_objects:
    o.location = (0, 0, 0)

To move all lamps to global origin
for o in lamp_objects:
    o.matrix_world.translation = (0, 0, 0)


text:
Placing cameras on the scene
I am trying to place my cameras generated, on the scene. Instead it is being placed on the origin. I am stuck here and need guidance as to how to place on the scene in 4 different locations on the scene.
for i in range(4):

    name = "Camera"

    # create camera data
    cam_data = bpy.data.cameras.new("{}.{:03d}".format(name, i))

    # create object camera data and insert the camera data
    cam_ob = bpy.data.objects.new("{}{:03d}".format(name, i), cam_data)

    # link into scene
    bpy.context.scene.objects.link(cam_ob)

bpy.context.scene.update()

Set cam_ob.location.

Thank you! :) @batFINGER. Is it possible to integrate that in the for loop?


text:
Trouble using Sprytile
After creating a flat 'landscape' surface using textures in Sprytile I find that, after selecting some of the surfaces and pushing and pulling them, when they move some are not connected to neighbouring tiles.
Why is this?


text:
MakeHuman Character bends over after retargeting w MoCap
I'm trying to animate a MakeHuman character with self captured motion from Perception Neuron. The motion looks good in Axis Neuron but when exported and retargeted in Blender, the upper body bends forward 90° and the arms hang down, while the rest stays in shape. Can anyone help me with this problem?

Thank you in advance,
Max

Is that the rest pose?

no, the rest pose is a t pose


text:
Blender Python: setter not working
Can anyone help me understand why my setter works sometimes, then it will stop working, then start again? For example, I can referesh my add-on, the setter will not do anything, but throws no error, then I will comment out a line of code, test, still not working, uncomment the same code so its exactly like before, and it will work.

Edit 6-30-2020
I posted the answer to this problem once I figured it out, but apparently didn't add a note to this question to direct everyone to it (making them read the whole question).
The reason this situation usually occurs is because most types of Blender properties won't exist at all in objects until they are modified from their default values for the first time. And if your code attempts to modify a property before it exists, Blender will sometimes just give up and exit the setter function without reporting a problem. In addition, if you have multiple objects, any object properties will only exist for the objects where the property was changed - it will still not exist for the other objects.
Make sure you only attempt to use or modify properties after they have been assigned by your code to something other than the default value.
Here are some notes I wrote for myself in OneNote back when I was trying to understand the chaos of this property system. These notes relate to normal properties in Blender/Python. I also have notes about "Dynamic Key" and "Dynamic Variable" properties if anyone wants to see them (both are assigned AFTER class definition). I may be able to post this in text form if anyone needs it. Just let me know.

End of edit

blocker spread
def FBXG_BlockerSpread( prev_val, new_val ):

    # prepare
    prefs = FBXG_Prefs()

    # map to all selected?
    if prefs.MapAllSelected:

        # detect added and removed flags
        turn_on = new_val & ~prev_val # new flags minus old flags
        turn_off = prev_val & ~new_val # old flags minus new flags

        # iterate all selected objects
        for obj in bpy.context.selected_objects:
            #if obj is not bpy.context.active_object:
            obj.fbxg["Blocker"] = obj.fbxg.get("Blocker") | turn_on
            obj.fbxg["Blocker"] = obj.fbxg.get("Blocker") & ~turn_off

blocker set function
def FBXG_BlockerSet(self, value):

    # spread to others?
    FBXG_BlockerSpread( self.get("Blocker"), value )

    # set new value
    self["Blocker"] = value

blocker get function
def FBXG_BlockerGet(self):

    # simply return it
    return self.get("Blocker")

class inclusion
# object blockers
Blocker = EnumProperty(
    name="Object Blockers",
    options={'ENUM_FLAG'},
    items=FBXG_Mode,
    description="***",
    get=FBXG_BlockerGet,
    set=FBXG_BlockerSet
    )

Can you guys see anything wrong here?
Also, does anyone know how the getters and setters work internally? If there is an error, do we actually see it, or does it just halt execution of that task? If I comment out FBXG_BlockerSpread(...), it works. But then it still works if I remove the comment marker. So its very difficult to narrow down without an error.
One of the things I'm concerned with is that I might be calling the setter every time I spread to another variable. If that is happening, is there a way to bypass it?
Edit/Update 1:
It is not any specific code in FBXG_BlockerSpread. I can completely remove that and add other routines and it still doesn't work.
I just tested by adding a function to print a message when the setter is called. I print hello at the start of my setter, and goodbye at the end of it, with some simple conditional branching and string formatting in the middle, the message shows only "hello". It's like the function terminates prematurely.
Is it possible there is a very limited memory footprint allowed for setters? Because that would explain why I keep getting random behavior (memory overshoot). Or maybe we are not allowed to assign other properties inside of setters (even if they are entirely different types)?
Edit/Update 2:
I tried changing my setter/getter into a simple update function, but I'm having the same exact problem with the update code. There is something very strange happening with the code inside of these functions. For example, I can write code such as "DO_NOTHING( NOTHING, DOESNTEXIST )" and get no error or message about doing something wrong. So I'm assuming I have errors in some of this code and the environment is just not telling me anything about it - it is just halting the execution of it.
Can anyone explain how these callbacks work? Is the function code copied and executed somewhere else? Is that why I don't get any errors about missing functions and such? Is there any way to get the environment to send me such feedback?
If anyone can figure this out, I will owe you one.

Couple of things, post text as text, not an image of text editor.  IMO at issue here is not that an ID prop isn't created until a non-default value is set, rather the use of ob.get("prop") which will return None if not set over ob.get("prop", default)  where default matches an enum item value or index, None won't match an enum.

The reason my setters would not work depended on several circumstances, but here are the primary reasons:

The environment will not always throw errors when a setter has invalid code, so it helps to call the setter from standard code to work out any possible errors.
Custom properties added to objects don't actually exist until the system generates them, which it does not do until the UI changes them from their default value. So if code tries to modify such an attribute in a setter before it exists, Blender will just give up. This one was my biggest problem. This made me think it was random, but it was actually because I used the same mechanism twice and the attribute existed the second time.


text:
Calling variable functions based on name
I would like to be able to iterate through a loop and call two sets of functions based on ..something - something that I can iterate through, such as a string list. Here is an example of my situation:
def Check(name):
    return not_important

def DrawA():
    draw_a_stuff
def DrawB():
    draw_b_stuff
def DrawC():
    draw_c_stuff

list = [ "A","B","C" ]
for type in list:
    if Check(type):
        continue

    func = get_function_in_this_module( "Draw" + type )
    func() # call drawing function

What would be the simplest way to do something like this? It will be used to draw UI sections of a panel based on which sections are visible/available.

Just use func = eval( "Draw" + type ).

I'm voting to close this question as off-topic because this is not a python question specific to blender and will be more on-topic on one of programming-specific stackexchange sites.

I guess you're right. Sorry about that. Should have posted there. Thanks lemon!

Just wanted to make sure it was clear that I did not know about eval(*). Extremely useful function, thank you again.

Put references to the functions in a dictionary, using the names you want to invoke them by as keys, and the references as value.
functions={"A":DrawA, # The function name *must not* be followed by parentheses
"B":DrawB,
"C":DrawC
}

Then, you only have to check if type is in the dictionary, and call the function using functions[type](...).
(Edited for clarity in regard to the lack of parentheses)

This is a great way to organize it. I haven't started using dictionaries for data, apart from Blender values, but I can see how this would be better. You specifically note the lack of parentheses - what does that accomplish here? Wouldn't that cause all entries to go into a single dimensional list? I'm also not sure what operator : is doing. Apparently I need to read up on using these. Thanks for showing me this.

Ah, I just looked it up. It creates key : value pairs. And after trying to set this up, I realized you meant there were no parentheses on the function names, rather than not using nested tuples. Just wanted to point that out to anyone new to this stuff.

Nice catch! I edited the code to remark on that.


text:
Blender Python: Convert Enum Flags into String?
It seems difficult to find any information about enum-flag usage and workflow. I'm familiar with bitflags and related operations, but the blender/python specifics are fun to figure out.
Is there any clever (or possibly obvious in my case) mechanism to convert enum flags into a string? It is primarily for debugging, but user friendly would be a plus.
The way enum properties are defined in Blender makes me wonder if the flags are not already defined as a string in some way.
Edit:
For example, my flags are defined like this:
FBXG_Mode=[
            # mode flags
            ('GA', "Asset", "...", 1),
            ('LP', "Low", "...", 2),
            ('HP', "High", "...", 4),

            # system flags
            ('EXCLUDE',"","",8),
            ('RENAMED',"","",16),
            ('DELETE',"","",32),
            ]

And it seems we can check for flags using strings like this..
if 'GA' in MyFlags:

By the way, how exactly does this work? Does the environment process this correctly because it associates the MyFlags variable with the FBXG_Mode list?
I'm very new to Python, so I have a couple questions if anyone knows the answers:

What tells the environment the attribute order of my FBXG_Mode list? Eg, how does it know that I placed the flag names into the second column/entry? Is this just hard-coded somewhere in the Blender or Python environment? Where would I find documentation about this? I'm not sure what this is called.
How do I access an element of FBXG_Mode in a way that allows me to access the name, description, value, etc? Would it be FBXG_Mode[0][1]? I'm looking for something more like FBXG_Mode['GA'].Description, or at least FBXG_Mode['GA'][2]. I would like to avoid the hard-coded indices if possible.
Is it possible to access the strings and/or properties of the FBXG_Mode list using only the MyFlagsvariable after it is assigned or associated with it? Does a flags variable have any type of association after it is assigned, or is the association only available during the assignment?
Is there any quick/automatic way to extract the toggled flags of a variable in string form, such as for printing text? This seems like something a generic function could be written to do, so I'm wondering if one already exists? Especially since Blender can generate UI controls basically the same way.

Thanks for any help!

It is sometime later after posting this question, and I have learned a lot about how Blender properties work. Here are the nuts and bolts that should answer my older question. Below, instance represents a scene element or property group, and Prop represents any property defined for the instance.

All Blender properties are stored in memory as two different value types - complex and basic. Some properties (like int) are the same type, but are still stored in two locations. Some others (like enum flags) are stored as very different types in each location.
Using syntax instance.Prop (same as getattr(instance,"Prop") or setattr(instance,"Prop",*)) reads and/or writes the property using the complex value types.
Using syntax instance["Prop"] reads and/or writes the property using basic value types.
Assigning either version of the two property value types will instantly and automatically update the other version to the same value of its respective type. You can literally assign a set of strings to the complex version of an enum flags property and, on the very next line, read the basic version of it to convert complex -> basic. Or do the opposite to convert the other way.
Be careful when reading the basic version of any property (syntax instance["Prop"]). It will not be generated for a specific instance (eg, property group) until the property is assigned for the first time (either type version). You can check to see if the basic version of a property has been generated by using if "Prop" in instance: or if "Prop" in instance.keys():. You can also use instance.get("Prop",DEFAULT_BASIC_VALUE) to safely request the basic version without knowing if it has been assigned yet.
The basic version of an enum flags property (instance["MyFlags"]) is stored as an int, which represents all of the binary flag values ORed together. The complex version of an enum flags property (instance.MyFlags) is represented as a set of strings, where each string represents the bit or mask you assigned to it.
To convert an enum flags property into a string, you can literally just convert the complex value into a string: str( instance.MyFlags )


text:
Weird flickering from video source as texture
My rendered animation has a weird flickering in it specifically from a video source used as texture and emission. It kind of looks like the first frame of the video is being rendered every few hundred frames and I have no idea why or even how this could happen. It seems to run just fine in the viewport.
The scene is a television with a video as the texture and emission reflected in a mirror.
Rendered in cycles at 30fps.
Video showing flickering
https://youtu.be/Y748GOFkEqw
Pictures show node tree

Does anyone know why this is happening or how I might correct this?

Share your file using https://blend-exchange.com/ so we can help you

First Aid is - try to export video as image sequence and try to use it as source ... if it will solves the issue it is probably some codec issue.

I tired an image sequence and it rendered correctly, ty!


text:
Blender 3.3 Materials Misaligned
I'm trying to map out the texture for this stage, but for some reason the material is not aligning properly at all. When I attempt to move the UV islands the texture doesn't change on the live preview at all, its as if the models are using a separate map than what's presented. I'm more of a Blender 2.79 user on the whole, and I haven't come across an issue like this before. Is there something I'm missing? Thanks!

Check the Properties panel >Object Data > UV Maps, have you created a second UV Map?

OK I had no idea that was even a thing! You are a lifesaver

In the Properties panel >Object Data > UV Maps, you have created a second UV map, remove it


text:
Adding 2 masks with (math Add) node gives strange result
I can't find a way to explain this problem. I'm trying to add two masks with the math node in the material editor. The picture should explain very well. As you can see the addition of the two masks makes a completely unreasonable result. I appreciate any help I can get.

https://i.sstatic.net/hSO7p.jpg

Are you able to upload a packed blend file? There's not enough info to go on here.

I’d guess that the first mask output is producing a negative result - which is why it’s not visible in the first render but is subtracting from the combined result. Not enough information to give a more detailed answer.

Did you check the result in rendered mode? Sometimes the material view is a bit off, depending on the complexity of your nodetree.

@OroNZ http://pasteall.org/blend/index.php?id=49227 Thanks for all help, I would really appreciate it if anyone look through the file. Feel free to take the textures and use it for whatever you want, it's made by me.

@RichSedman That's a great idea, I tried multiplying first mask with -1, but it didn't help.

@yann It's the same in rendered mode, but thanks.


text:
Why are my Verticies/Edges/Faces locked from moving up and down?
I'm trying to simply move any vertex/edge/face up or down but visually it does not move. I see values changing when i'm moving them but ultimately nothing occurs visually. Additionally, if I try rotating a face so that one edge goes up and the other goes down they just pinch together instead (Imgur link shows what happens when the red rotate ring is moved). I can move the entire object normally up and down outside object mode. Using Blender with Maya config (I used Maya years ago for about 3 years.)
https://i.sstatic.net/VlYh4.jpg

Any help appreciated, thanks.

could you share your blendfile at https://blend-exchange.giantcowfilms.com/?

The scale of the object in "object mode" is set to 0. While scaling the z-axis with 0 in edit mode is great to get a flat surface, in object mode, this leads to this expected but explainable behavior.

Set the scale in z-direction to 1 while in object mode and it will work again.
On another note I would be VERY CAREFUL to have an object SCALED IN OBJECT MODE, if you are trying to model a real world floor plan with REAL WORLD UNITS.
I never use scale/rotation in object mode unless I'm compositing multiple objects together.
In this case I would suggest to apply apply scale in object mode and then select all and scale in edit mode.

Ah I see, the plane as a whole outside object mode need to have a scale of 1 on the Z Axis. I can now move my said items of concern up and down. Thanks much!

Please accept and or upvote the question if it helped you. It will make it easier for other users to see what the problem was.


text:
Can a ouliner operator be placed in an custom Panel
bpy.ops.outliner.orphans_purge()

to put it onto a button into a custom panel-
but that button is grayed out...
this is how it looks like:
import bpy

#--------------------------------------------------------------------

class CleanUnusedMaterials(bpy.types.Panel):
    """Creates a Panel in the TOOLS window"""
    bl_label = "CleanUnusedMaterials"
    bl_idname = "OBJECT_CLEANUNUSEDMATERIALS"
    bl_space_type = "VIEW_3D"
    bl_region_type = 'TOOLS'

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

        obj = context.object

        row = layout.row()
        row.operator("view3d.clean_material_slots")
        row.operator("outliner.orphans_purge")

#--------------------------------------------------------------------

def register():

    bpy.utils.register_class(CleanUnusedMaterials)

def unregister():

    bpy.utils.unregister_class(CleanUnusedMaterials)

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

is it because its an outliner operator?
or am i missing something?

batFINGER- did you change anything in the code?


text:
How to call rigify operators?
I'd like to run some rigify operators. As you might know, the operators are "unique" for each armature because of their rig_id. If I have the rig_id = "i8fj1rbnfbd76bf5" then it takes the following syntax to call the operators:
bpy.ops.pose.rigify_limb_ik2fk_i8fj1rbnfbd76bf5(prop_bone='thigh_parent.L',
                                                  pole_prop="pole_vector",
                                                  fk_bones='["thigh_fk.L", "shin_fk.L", "foot_fk.L", "toe.L"]',
                                                  ik_bones='["thigh_ik.L", "MCH-shin_ik.L", "MCH-thigh_ik_target.L"]',
                                                  ctrl_bones='["thigh_ik.L", "foot_ik.L", "thigh_ik_target.L"]',
                                                  extra_ctrls='["foot_heel_ik.L", "foot_spin_ik.L"]')

bpy.ops.pose.rigify_limb_ik2fk_i8fj1rbnfbd76bf5(prop_bone='upper_arm_parent.L',
                                                  pole_prop="pole_vector",
                                                  fk_bones='["upper_arm_fk.L", "forearm_fk.L", "hand_fk.L"]',
                                                  ik_bones='["upper_arm_ik.L", "MCH-forearm_ik.L", "MCH-upper_arm_ik_target.L"]',
                                                  ctrl_bones= '["upper_arm_ik.L", "hand_ik.L", "upper_arm_ik_target.L"]',
                                                  extra_ctrls='[]')

I was thinking of concatenating the id with the rest of the syntax and converting that into an operator call that I can execute. Is that possible or what alternatives do I have?

Can you explain how you identified the list of arguments needed between the end Brackets ? My rig is different than yours and I'm not sure how to get the list of needed args. Also how did you find out the rigify operators ?

I think you can use Python's exec() or eval() to do this, if the operator is already registered
import bpy
rig_id = "i8fj1rbnfbd76bf5"
op = eval("bpy.ops.pose.rigify_limb_ik2fk_" + rig_id)
# or with exec
# exec("op = bpy.ops.pose.rigify_limb_ik2fk_" + rig_id)

# now you can call op
op(prop_bone='upper_arm_parent.L') # and rest of arguments


text:
Object Physics Don't Work for Rotation
Alright: I'm new to blender and for the last several days I've been struggling with a problem with the rigid body physics. Here's how it goes:

Open new blender project
Change to cycles render
Import 3D model (swivel chair)
Add active physics to swivel chair (rigid body)
Add passive physics to plane
Click play (animation plays)
Chair falls... then stays 100% upright, not rotationally affected by impact

https://i.sstatic.net/zQQ4Z.png

Under the Rigid body settings check its Shape settings. Also make sure you have no damping on rotation

@DuarteFarrajotaRamos Shape is set to Convex Hull, Rotational Damping set to 0

For non-convex shapes you really want to select Mesh. It requires more CPU power but will result in much better simulations.

Under the physics tab of the property panel set the Shape to Mesh. The convex hull is like a shape drawn around the mesh with no concave angles, so the feet of the chair might behave unexpectedly, as if there's just a flat plane or a few flat triangles on the bottom. It also has some degree of approximation, it doesn't create a new point for every point on your mesh.
I don't think there's a way to visualize the convex hull that Blender generates for an object. It probably looks a bit like this but with more triangles and different triangulation pattern.

Your chair mesh might not be entirely suitable for collisions if it is non-manifold, particularly if it has open backfaces. If this is the case you can create a separate mesh just for collisions that represents the shape of the object but not it's appearance. You would then parent the chair mesh to the collision mesh so it moves exactly with it, and then hide the collision mesh from rendering so it doesn't cover the chair.
Finally, change the Bounciness under Surface Response of the chair and the surface your chair is landing on. When Bounciness is set to 0 the surface stays impossibly still and doesn't apply any force to the object landing on it regardless of how bouncy the falling object is. Likewise a falling object with Bounciness zero appears to receive no force when it's Bounciness is 0. Most objects should have at least some amount of bounciness in order to behave as expected.

Do you know is there any simple way to set friction and bounciness to match real world objects? Real world objects have different Friction Coefficients for static (non-sliding) and kinetic (sliding) connections which Blender doesn't seem to support. Blender Rigid Body simulation is about rigid bodies only so even though you can simulate a bouncing tennis ball by setting suitable bounciness, it's not physically correct simulation.

This is probably worth it's own question. Blender implements the Bullet Physics Engine. It produces a coefficient of friction by multiplying the values of the two interacting objects. You can get realistic results for two specific materials, but additional objects might not scale well. In reality the coefficient of friction can only be given for two specific materials. This implementation is convenient when you're dealing with lots of materials at the cost of some accuracy. I'm not sure if there's one place this is all documented, most of the info I've found is the Bullet Physics forum.


text:
Blender Python executable unable to find 3rd party packages
I have installed the 3rd party packages at the required location as shown below--

And using pip list you can see the packages are indeed installed

It works okay when I try to import then in terminal

But inside Blender, it can't see the package

NOTE: the site package is already in the PATH, and restarted Blender many times, still does not work.

It seems odd but, those packages that I installed were in the site-packages of my local python installation not in the blender python. So to solve it I just added the site package path in sys.path
import sys
sys.path.append("C:\\Users\\***\\AppData\\Roaming\\Python\\Python39\\site-packages")


text:
How to copy multiple Actions to multiple objects?
Iam trying to assign "ACTION1" and "ACTION2" to several objects.
This is my current code:
def copyAnim(animObj):
    context = bpy.context
    obj = bpy.data.objects[animObj]
    obs = [o for o in bpy.data.objects if o.name.startswith("object")]
    action = obj.animation_data.action
    print(obs)

    for ob in obs:
        if ob.animation_data:
            ob.animation_data.action = action.copy()
        else:
            ob.animation_data_create()
            ob.animation_data.action = action.copy()

copyAnim('Object_Holding_ACTION1')

But here is the Problem: if i want to add another action (with
copyAnim('Object_Holding_ACTION2')
)
"ACTION1" gets overwritten.

Overwritten? each object with name starting with "object" will be assigned a copy of the action on the object named "Object_Holding_ACTION2"

Yea, thats my problem. I want "ACTION1" and "ACTION2" both to affect the objects.

Have a look at the NLA

I played around a bit with the NLA. It got almost all functionality i want, but i couldn't get overlapping animations to work. @batFINGER


text:
Keying Set Failed To Insert Any Keyframes error message?
So I'm working on an animating project and I think I clicked some hidden hotkey because I'm suddenly getting the error message "Keying set failed to insert any keyframes". For some reason none of the solutions online seem to work/I can't find where people are talking about. I have deleted the keying groups among other things but nothing seems to work. Thanks!

Hello and welcome to bse. Could you please add some detail. For instance what keying set is failing, what properties it keys.  How you are using etc.

@batFINGER I'm so new to animation that I honestly have no clue what you're talking about

You've set your Keying Set (1) to Button Keying Set, but you didn't add any properties for keyframes to be added to (2). That's why when you press I no keyframes are being added. To change that, you need to get rid of the Keying Set by clicking on x sign or setting something meaningful, like LokRotScale for example.

After pressing x the I menu now comes up but still gives me the error message when I try to add a keyframe. Changing to LocRotScale also gives me the same error message.

You forgot to mention, that you locked all channels. You need to go to the Dope Sheet or Graph Editor and unlock them (click on the padlock icon).

omg thanks so much I'm not sure how I was dumb enough to lock them -.-

I encountered the same problem, and the solution is simple.
Delete any value here

Hi, thanks for the post. This site is not a regular forum, answers should be substantial and thoroughly explain the solution and required workflow. One liners and short tips rarely make for a good answer. Could you elaborate on what that does exactly and how it helps solve the issue?


text:
simple add-on not working
this is a simple add on just to select a loop so i can make the mean crease value 1
I do this alot and the constant moving mouse right is starting to hurt my had for models then will be subdivided.
I just want to press on a edge, (use the assigned shortcut key to active the add on) it will then select the loop and set the value of mean crease to 1.
This only works with the scripting editor, I can't get the add on to work after saving as test.py any help please.
I get the following errors :
addon_utils.disable: edge crease not disabled
Modules Installed (edge crease) from 'C:\\Users\\RTJ\\Documents\\edge crease.py' into 'C:\\Users\\RTJ\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\scripts\\addons'
Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\modules\addon_utils.py", line 351, in enable
    mod = __import__(module_name)
  File "C:\Users\RTJ\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\edge crease.py", line 35, in <module>
    class EdgeCrease(bpy.types.Operator):
  File "C:\Users\RTJ\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\edge crease.py", line 42, in EdgeCrease
    bpy.ops.mesh.loop_multi_select(ring=False)
  File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\modules\bpy\ops.py", line 195, in __call__
    BPyOpsSubModOp._view_layer_update(context)
  File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\modules\bpy\ops.py", line 157, in _view_layer_update
    view_layer = context.view_layer
AttributeError: '_RestrictContext' object has no attribute 'view_layer' "

the script:
bl_info = {
    "name": "Edge Crease  ",
    "author": "RTJ3DCosplay",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "",
    "description": "delete in context",
    "warning": "experimental, not stable, at your own risk",
    "wiki_url": "https://your web or web of the maintainer",
    "category": "category where the addon is located"
}

import bpy
import bmesh
import mathutils
import collections
import math

from bpy_extras import view3d_utils
from bpy.types import (
        Operator,
        Menu,
        Panel,
        PropertyGroup,
        AddonPreferences,
        )
from bpy.props import (
        BoolProperty,
        EnumProperty,
        FloatProperty,
        IntProperty,
        PointerProperty,
        StringProperty,
        )

class EdgeCrease(bpy.types.Operator):
    """Edge Crease"""
    bl_idname = "object.edge_crease"
    bl_label = "Edge Crease"
    bl_options = {'REGISTER', 'UNDO'}

 # this is all i'm trying to do,
 # i select on edge then active this to loop select and set value to 1
 # id be happy just to set to 1 each time

    bpy.ops.mesh.loop_multi_select(ring=False)
    bpy.ops.transform.edge_crease(value=1)

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

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

if __name__ == "__main__":
    register()

You need to put your functionality of the operator in the execute function. Otherwise the issue described in this answer will occur.
def execute(self, context):
    bpy.ops.mesh.loop_multi_select(ring=False)
    bpy.ops.transform.edge_crease(value=1)

    return {'FINISHED'}

unfortunitly this did not solve it but did reduce the number of faults so thank u for that

@RTJ3DCosplay You may want to add a poll function that checks if you're in edit mode.


text:
How to create data URI that contains raw animation data to be inserted in a buffer of a JSON of a glTF file exported from Blender?
I'm working on a glTF; precisely I'm trying to animate a "static" mesh that I've created in Blender and exported in the glTF format in order to open it with a text editor and manipulate the JSON code obtained to animate the mesh.
In doing so, I'm following the logic used in this tutorial , where a triangle is animated by adding a new buffer, containing only data regarding time and rotation coordinates. Along with the new buffer, also the animations array, the bufferviews related to the new buffer, and the new accessors are added to animate the initial static triangle .
Right now, I'm trying to animate a static plane created in Blender and exported in the glTF format, and here  there is its JSON. When I use the same data URI seen in the previously mentioned tutorial regarding the rotating triangle:
{
"byteLength": 100,
"uri": "data:application/octet-stream;base64,AAAAAAAAgD4AAAA/AABAPwAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAD0/TQ/9P00PwAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAPT9ND/0/TS/AAAAAAAAAAAAAAAAAACAPw=="
}
I've been able to apply successfully that rotation to the plane. Here it can be seen the JSON manipulated with the addition of this new buffer and the related bufferviews, accesors, and animations array.
The problem is that, always following the same logic, I'm having hard times in creating animations different from the one that is used in the tutorial so, basically I think that the problem is how I write the raw animation data that I use to obtain a data URIs.
The procedure I'm using in creating those data URIs, consists of writing times and coordinates in a file saved with no extension (to have a generic binary data application/octet-stream) , and then converting this file in a data URI with an online converter .
Here you can see how I write the file to be converted in data URI that contains coordinates and time to be inserted in a buffer, and here you can see how the translation written in the previous link doesn't work in the initial glTF of the plane.   How should I write those coordinates and time to be converted in data URI to be properly read and executed by the glTF?
I've even tried to separate time and coordinates by creating two different buffers, one referring to time and one referring to animation, to avoid the problem of making mistakes in setting the byteOffset property in the two accessors referring to animation and time.
Here you can see the code of a translation applied to the same plane using the two new buffers referring to time and translation instead of just one buffer.
The structure of the starting file, later converted in data URI, containing information regarding time follows:
(0.0),
(0.25),
(0.5),
(0.75),
(1.0)
The structure of the starting file, later converted in data URI, containing the translation coordinates follows:
{ 0.0, 0.0, 0.0 },
{ 2.0, 0.0, 0.0 },
{ 6.0, 0.0, 0.0 },
{ 6.0, 2.0, 0.0 },
{ 8.0, 4.0, 0.0 }
Thanks in advance for your help :)

Your data URI contains incorrect binary-encoded values, and your byteLengths are wrong.
This will produce the correct uri and byteLength
import base64, struct

times = [
    0.00,
    0.25,
    0.50,
    0.75,
    1.00,
]

locs = [
    0.0, 0.0, 0.0,
    2.0, 0.0, 0.0,
    6.0, 0.0, 0.0,
    6.0, 2.0, 0.0,
    8.0, 4.0, 0.0,
]

# pack binary values
data = b""
for t in times:
    data += struct.pack("<f", t)
for x in locs:
    data += struct.pack("<f", x)

# convert to data URI
encoded = base64.b64encode(data).decode("ascii")
uri = f"data:application/octet-stream;base64,{encoded}"

print(uri)
print(len(data))

If the result is inserted into your .gltf, it animates correctly.


text:
How to create a property, in owner, from python level
Hello there.
I am creating a game in UpBGE, and I am often use python to it.
A moment ago I encountered a problem:
I do not really know, how to create a property, in owner, from python level.

Thank you for any helpful comments.

What do you mean with 'from Python level'? A global property? If so, how could it be attached to owner? Object properties (owner) can be set like owner["prop"] = value, global properties can be set using bge.logic.globalDict["prop"] = value, but the last aren't attached to any object. If it's not what you mean, explain a little better your question.


text:
How could I create a sand dune animation?
I've been working on creating a whole bunch of nature animations and one that I've been trying to create is the "windy desert". Is there any way that I could simulate this in blender.
To be more clear, what I'm trying to create is something like the very start of this film on a sand dune
https://www.youtube.com/watch?v=vYRu6MwmFYE
I don't care about my render times, I have plenty, I just want to know your ideas on how I could go about doing this.
Thanks :D
More Ref:
https://www.youtube.com/watch?v=OKkRF2sdXb8

https://1.bp.blogspot.com/-3wZZlRC5-1c/WCWs1H0EC9I/AAAAAAAAA5c/yTiXhJmQu4IF6F5-I7MpgMGy-j823mnqgCLcB/s1600/sand-dunes-in-windy-weather-loveoboi.jpg

https://theimaginativeconservative.org/wp-content/uploads/2017/08/desert-wind.jpg

https://i.ytimg.com/vi/RqrTvs9pmWk/maxresdefault.jpg

are you talking about the sand blown by the wind or the dunes that dissolve? For the sand blown maybe particles following paths? There are some tutorials on this topic

Proportional editing maybe?

I just realized how horrible my description was, I am talking about the particle effect, of the sand blowing around

Does this answer your question? how to create realistic/physically accurate sand blowing over dunes animation?


text:
Applying a Simple Cylindrical Projection onto a Object
Question: I have a wavefront object that I have imported into blender, and a simple cylindrical projection that I am trying to apply to it. The cylindrical projection is mapped around the prime meridian with longitude 0 on the left & right edges.
How do I apply this mapping to the 3D model in Blender?
My Attempted Solution: I tried 2 approaches: UV mapping and texture nodes. Both of them have run into problems so far.
(1) I unwrapped the model onto my texture with the following settings, but I wasn't able to get the model to map "properly" onto the texture. Here is an example of what I ended up with:  - this is with the settings:

Directions: View on Equator
Align: ZX
Radius: 1.000
Correct Aspect: Check
Clip to Bounds: Unchecked
Scale to Bounds: Checked

(2) I also tried adding an image texture node to my model (with the texture coordinate node). However, all the settings I chose have given me stretched lines. Here is an album of my "best" attempts:
Background: I am attempting to create a textured model of an asteroid in Blender using data from NASA's PDS SBN. Specifically, I am looking to replicate the version of Eros from the 3D Asteroid Catalogue (click "Grayscale" on the website to see the texture), but with Blender instead of ThreeJS.
For reference, the wavefront file I'm using is located here, and the simple cylindrical projection I'm using is located here (warning, large image file).

Have you tried to texture it directly with an environment texture? Depending on the axis conventions, you may have to rotate the texture or/and the mesh model.

You can use an environment texture in order to project on the mesh surface.

The environment texture is generally used for scene environment lightning, but it performs an equirectangular projection that seems to meet our need here.
Take the object output from the texture coordinates node.
Plug it into a vector mapping.
And plug its result into the env texture node.
Now we just have to handle what needs to be rotated in the mapping (it's a guess): here a rotation of 180 around X and a -1 scale for Z seem to correspond perfectly to the mesh.
They are little distortions on the left part, but all craters have found the good place, it seems.
The texture from the link in the question is not included as too large to be uploaded with the blend file:

Note: 'equirectangular projection' is also called 'equidistant cylindrical projection'

And I was wondering why my texture is still stretched. Now I see :) Thanks for lesson :)

Thank you, that is perfect! I believe the stretching on the left is a result of the texture map itself, as it is present in the 3D asteroid catalogue as well.

Perhaps the 180 degree rotation is explained here https://sbnarchive.psi.edu/pds3/multi_mission/MULTI_SA_MULTI_6_STOOKEMAPS_V3_0/document/00_map_guide.html#eros

@batFINGER, yes 0 on left and right, not at Greenwich.

Last paragraph here is interesting re the 1, 0.4 0.4 ellipsoid.  https://sbnarchive.psi.edu/pds3/multi_mission/MULTI_SA_MULTI_6_STOOKEMAPS_V3_0/document/projections.asc  Perhaps in @vklidu answer using an ellipsoid rather than sphere to shrink-wrap to.

@batFINGER, remember this from Cegaton? https://blender.stackexchange.com/questions/52904/wrap-curve-around-sphere/52930#52930 but the asteroid is not spherical or cylindrical... or from Leon https://blender.stackexchange.com/questions/24043/how-to-animate-morphing-a-rectangular-plane-into-a-sphere

The idea is to map on sphere first, than stretch to Asteroid shape.
Quite helpful is "grid" seen on source site you provided. So you can try apply some "grid" texture to check if you are applying it correctly.

Original topology is Cube so I recreated it for nicer topo in Blender

Add Cube / Subdivide (W) / To Sphere (Shift+Alt+S) 1
Unwrapp > Cylinder Projection
Add shape key (Basic and Key1)
For Shapekey Key1 set value 1 (in Object Data Properties > Shape Keys)
Add Shrinkwrapp modifier > Target Asteroid (Positive and Negative)

For more details add SubdivisionSurface modifier before Shrinkwrapp.


text:
Transparent water shader for EEVEE?
I followed a simple "how to make water in EEVEE" tutorial on youtube, but I don't know how to make it transparent. My current node setup:

Q: How to get the water transparent?

You can turn down the waters alpha or mix it with a transparency shader

Hi and welcome! Just to let you know (since part of your question): This is no regular forum rather a Q&A site. Suggest take the [tour] to learn about how this site works, also I recommend read about How do I ask a good question? Cheers

For EEVEE:

Turn “Transmission” all the way up.
Turn alpha down to about 0.5
Set blend method to either hashed or blend.

Today, I might plug a Frensel node into the alpha socket instead of just setting it static.


text:
How to move or modify the position of the redo panel?
The panel is always minimized, I have to enlarge it and move my head to bottom left each time:

Does anyone know of any modifications or plugins that will allow me to move this window? Or even dock it to the right panel (N)?

sorry, don't think such a thing exists.  Unless you are willing to code something that will move it yourself.

just close it and use F9  to have the same information on  a floating window.

Also, once you open it once, it defaults to open for all future actions (until you minimize it again).

If you want to increase the size of the UI elements (to make things more accessible on a 4K display, perhaps), you can do so by going under User Preferences > Interface  and increasing the Resolution Scale. However, this changes the size of far more than just the Operator Panel, I'm afraid.


text:
How to create a bumpy rubber material?
I am trying to create a decent approximation of the bumpy rubber material depicted in the reference image below. I'm not intimately familiar with nodes, but I figure this is the best route? Ultimately I would like for this to work in both Eevee and Cycles, but if we can only figure out Cycles, I can live with that.
I tried metaballs at first, but it seemed unnecessarily time intensive and wasn't yielding the results I was looking for, granted that could just be my ignorance.

I remember there was a tutorial for polka dots, if you used those and added them to the bump as the tiny dots that might work

https://blender.stackexchange.com/questions/84745/create-irregularly-shaped-gaps-in-cube/84845#84845

You could try something like this. I used a Voronoi texture clamped with a Color Ramp, similar to what you did to make the main dots. I then used another Voronoi Texture, scaled up slightly, and clamped differently with another Color Ramp to get the smaller dots. I also mixed the input vectors of both the large and the small dots with  a Noise Texture to make them less perfectly round.
Lastly, I mixed the whole thing with another (largely scaled up) Noise Texture to give the fine "grain". I also gave a very small subsurface value to emulate that semi-translucent rubber look.

Thanks for the graph breakdown. I was able to achieve fairly good results with it, though rather than shearing off the tips, I dialed back the color ramps to give them a little more roundness.

Create a basic shape ...

Add Remesh modifier to get even grid, than add Displace modifier with Voronoi texture to get bubble structure... and Apply modifiers

Switch to Sculpt mode > Filtr brush > Inflate that is essential for final shape.

Than use Scrape brush to flatten highest vertices as much as you want ...

As final touch for the "melty/glued" look, use Remesh modifier > Voxel > 0.2 again.

If you want to make mesh lighter, you can bake a Normal map of this mesh to base (original lowpoly) mesh and use Subdivision modifier with Adaptive enabled.

Even though this project ended over a year ago, it's great to see a few additional methods I had never considered. Thanks for sharing!

Just for fun ... I wanted to try more physically based technique, but cloth sim is quite calculation intensive, means also time consuming ... and result needs sculpt polishing as well.

Cloth Simulation
Add particle system to base object Emission > Volume > Grid with some Randomness

Use Icosphere to be Rendered as particles with some Scale randomness
Make Instances Real Ctrl+A and Join Ctrl+J them into one object.
enable Cloth simulation > Pressure > 0.5 and Self Collision
for original base object enable Collision in Physics Properties and invert Normals Shift+N Inside
add two scale keyframes to animate downscale

Animated result already use Solidify modifier to fill spaces produced Collision Distance value, Smooth modifier because smashed lowpoly Icospheres were quite collapsed ... and Remesh modifier.
Also here seems like a bit of Sculpt > Filter > Inflation helped looks better ... so at the end method with Displace seems to be faster with almost the same result.

so maybe you should answer this similar question? https://blender.stackexchange.com/questions/219183/expanding-baloon-like-softbody-object-how-to-do-in-blender-easy-in-cinema4d

You could create a plane, switch to Sculpt mode, enable the Dyntopo option (with a low enough Detail Size), and paint with the Blob brush. Then if you want you can bake the normals and use the result as a Normal Map for a low-poly surface:

I haven't really explored sculpting in Blender yet, though it seems this particular mesh would benefit from doing so. Thanks for suggesting it!


text:
Curved grid - Cycles vs. Eevee
I'm trying to create a simple animation moving the camera through a curved tube, which has a .png image (just a grid) mapped on it.
My problem is that I see some differences in the lines when I export on Eevee and Cycles. The lines on Cycles seems to be much smoother.
Here you can see what I mean:

Eevee

Cycles
I've tried using the Smooth modifier but that changes nothing. Both images are rendered using the same sampling values.

Shader
Q: Do you know how I can get smother lines for that curve (tunnel) when using Eevee?

Welcome to blender.se. The images seems to be differently mapped, why? Can you show your scene an modifier list?

also maybe share your object: https://blend-exchange.giantcowfilms.com/

I've uploaded the file here
https://blend-exchange.giantcowfilms.com/b/XeKgg6Z6/

@vklidu packed :)

Add a Subsurf Modifier, then the curvature will be the same for Eevee and Cycles, but in Cycles less visible because of different texture mapping.

Mapping differs because Eevee doesn't support the Panoramic camera type (set for Cycles). Eevee is using Perspective instead. Should be probably reported as a UI inconsistency.

thanks a lot!! I've tested what you mean and it seems to work like a charm :)

If you have a time please post it as a bug. Panoramic set in Cycles appears when switched to Eevee. Title stay Panoramic, but setup is Perspective. My screen it doesn't illustrate (I just switched type in cycles).

@brockmann Thanks for polishing :)

You're welcome! @vklidu