How to scale/rotate small trackers with mouse? I'm working on a motion tracked animation, but I'm running into trouble trying to rotate and move small trackers independently of the search area. Usually, I would do this by clicking on the square on the far right, but this doesn't work so well for very small trackers, because when I try to click on it, instead it selects one of the corners of the tracker itself, so I can't rotate/scale it. I understand that I can move the whole tracker using the S, R and G hotkeys, but I want to be able to adjust the tracking area independently of the search area. How can I do this?

You can zoom in using the scroll wheel on the mouse until the tracker becomes large enough to manipulate.

The track area and the search area can be manipulated separately. Enable "Search" on the Marker Display section to make the search area visible. Then you'll be able to manipulate them to your needs.


What is the best or fast way to add a star on top of a helmet? To make it simpler, think helmet is a sphere.

Now I need to place a star or any other complex object you can think of - on it. It's a big star, and it looks like taking the half of the helmet - so it should be spherically bent too. It can be separate object.

(P.S. I watched another tutorial where the guy used boolean modifier in order to intersect two objects. The booleans seem to work on simple object. It didn't work in my case.)

I would suggest you use a shinkwrap modifier, as well as a solidify modifier to give it some thickness, and possibly a bevel:

This applies to any shape you'd like to project onto any surface.

Just keep in mind that you need to have enough geometry to allow it to deform smoothly, and preferably a quad loop around the border to avoid shading (or bevel) artefacts:


Blocky Reflections on Glass I am working with a car model and getting all of the materials ready for use in my project. The side windows have a noticeable reflection issue where the reflection appears blocky. The headlight cover also has some strange artifacts. I have provided the blend file so you may be able to help me solve this issue.

Blender file download (google drive): http://bit.ly/2SFRp8n

Some of your faces don't have smooth shading.
They are shaded flat, creating those ugly triangular artifacts.

Just right click you model and select smooth shading.


Quicker way of adding faces? I am trying to face these into wedges. Is there a faster way of doing it?

Select the prism and press P to separate it. Being in Edit Mode add an Array Modifier to the prism and set up the proper relative offset values. Check the Wire and Draw All checkboxes in Display panel of the Object Data header to help you match the prisms with a grid segments properly. Increase the modifier's count number and apply it. Join meshes with Ctrl+J. In Edit Mode select one of the edges as pictured below, go to Select-->Checker Deselect, increase the offset if needed and delete selected edges to cut the holes for prisms. In the end select the whole object with A, then press W-->Remove Doubles. You may also recalculate normals with Ctrl+N.


How to snap and align 2 objects Hi!
I'm a beginner learner and I'd like to know how to snap these three objects. I'd like to snap the two cylinders with the different faces of the cube. The short one on the left and the highest cylinder on the top of the cube. I'd like to have the center of the cylinder aligned with the center of the cube (the base of the cylinder inscribed into the face of the cube)
I'm sorry for bad explanation
I hope someone can help me
Thanks!

I add a screenshoot in which you can see what I have to do

Thanks again if someone can help me with this!

I don't know if there's a faster way:

Put the origin of the object you want to snap on its bottom face (first in Edit mode select the face, put the 3D cursor on the face with a Shift S > Cursor to Selected, then in Object mode set the origin to the 3D cursor (header menu bar > Object > Set Origin).

Enable the Snap with these options: Face mode / Align Rotation to Target / Project Individual Elements.

Snap the cylinder to the face you want.

To align the cylinder with the cube, select the cylinder, then the cube. The cube being the last selected, it is said "active", it has a yellow line all around.

Go in the header menu bar > Object > Transform > Align Objects.

In the Operator box (bottom left) choose Relative To > Active and the axis you want your want your object to be aligned with (press Shift to select 2 objects.


Align an object to a specific face I usually face this problem when I cut objects to make them printable in my 3D printer. As you may know, you need your object to have a nice base to be printed.

So I usually use bisect to cut an object to different pieces. As in this example:

and I need to rotate the top part to have a face as bottom:

I'll share my workflow in an answer, but I'm asking for a simpler solution, if there were any.

So this is my workflow:

First select the face you want to be the ground of the object, and create a custom Transform Orientation from the N panel:

Then select the new orientation and place 3D Cursor at the face center with ShiftS, Cursor to Selected. You could also move object center to the same place with  ShiftCtrlAltC>Object to 3D Cursor.

Now add an emtpy and align it to my custom orientation.

Now parent the object to the empty (CtrlP), clear the empty rotation (AltR), and clear the object's parent keeping transformation (AltP>...).

Finally rotate the piece 180º, and you have the face as the ground.


Is there a way to control limited disolve? I have a very high poly set of meshes, (due to my flagrant use of dynotopo while sculpting,) which I would like to decrease the poly count of. Limited dissolve took the poly count of one of the meshes from 130,000 to about 7000. However the mesh fell apart in some areas and I was not even vaguely happy with the result. Is there a way to control the level of limited dissolve or should I be looking at a decimate modifier?

Yes you can control limited dissolve

In Edit Mode with all the mesh selected

Press Delete and you get option limited dissolve

As soon as you click limited dissolve press F6 to open operator panel and adjust the angel and it will lower the verts (See the verts in the top info bar).


Weighting separated objects as one I have a set of armors that are made of separated pieces like belts. All the pieces are joined as one object, but topologically they are separated (because they were made in Zbrush with mask+extract technique). When i parent an armor to armature with automatic weights, here is what happens:

http://gifyu.com/images/weightSeparateObj.gif (Update: gif needs to load there, it may take some time)

http://www74.zippyshare.com/v/ocwFam30/file.html
(Fixed: I don't know why the gif can't upload here, but it works after downloading)

As you can see, belts are moving different and each part has different weighting which causes intersecting and other bad looking things. I've tried manually painting/fixing weights, but it is almost impossible to do it correctly on separate objects like these. How to handle this problem?

This problem is nicely solvable with voxel binding that unfortunately blender doesn't have yet.

The problem would be less visible if the polygons would be segmented the same on the torso and the belts, increasing the polycount will help against the artifacts.

A blender solution is to join everything into 1 piece mesh:

with boolean union and clean up the mesh after it
with knife tool to cut slots for the belts in torso and to cut out excess belts inside the torso. Then joining it together.


How to copy paste positions of multiple vertexes (UV Mapping) I have a mesh, and when I join it with another mesh with the same material, the first mesh loses its uv vertex mapping, so I have to make a copy of the first mesh then copy paste the vertex positions from the original uv map to the uv map of the joined mesh. Is there a way I can do this faster?

Blender shouldn't delete UV maps when joining materials.  There are a few caveats:

1) If there are more UV maps than Blender allows between the two objects, UV maps will be dropped.  I believe Blender will preserve first all UV maps of the active selection.

2) If a mesh loses its faces, it loses its UV, as Blender stores UV separate from vertices (not the only way to do it, btw), so there's no such thing as a string of edges with any UV.

When you join two objects, any UV maps with the same name will be merged.  So if you want one UV map to join with a particular other UV map, just make sure they have the same name.

Finally, there are a few tools that you can use to copy UV maps.  Assuming identical topology, ctrl-l Copy UV works.  The data transfer modifier also permits the copying of UV via Face Corner Data.  Data transfer modifier can be vertex group limited, and behaves perfectly on seamless, identical meshes, although in my experience it doesn't do a great job with seams/islands (maybe I just don't know all the tricks yet.)


Front Flip Animation Messed Up Due To Quaternion I made a front flip animation for my character however when I play the animation, the character goes to the keyframes, but once it gets past the second to last keyframe and goes to the final pose, it rotates all the way back around the opposite way.
Now I was told that its due to the bones on the rig being set to quaternion and I needed to set them to euler, however, I have found when I did that it messed up the animation.
What could I do?
https://streamable.com/kphuab

Switch to pose mode and find and select the bone that rotates backwards. Go to the last keyframe in your animation (frame 80 it looks like), and negate the W, X, Y, Z of the rotation in the Bone Properties panel, ie. replace 0.1 with -0.1. Insert a keyframe to save the values. Your rotation should now work.
(I think there's an op that will do this automatically but I can't remember what it is...)


What is multiple importance sample option What is multiple importance sample option.
And the main question is Can It be simulated via OSL shader or in particular glossy shader?

Multiple importance sample (MIS) basically helps guide rays towards light sources, reducing noise
MIS only applies if the material has an emission node. (world materials and lamps behave a little differently).
From the wiki:
Material

By default objects with emitting materials use both direct and indirect light sampling methods, but in some cases it may lead to less noise overall to disable direct light sampling for some materials. This can be done by disabling the Multiple Importance Sample option. This is especially useful on large objects that emit little light compared to other light sources.
This option will only have an influence if the material contains an emission node; it will be automatically disabled otherwise.

Here's an example with a bright light source (a sphere) and a weak light source (a plane above the scene, you can see it reflected in the seconds sphere)
Without MIS on the low strength plane:

With MIS on the low strength plane:

The bright sphere has MIS enabled in both examples. The second example seems to have slightly more noise (look at the shadow of the second sphere and the reflection of the floor plane)
World

By default lighting from the world is computed solely with indirect light sampling. However for more complex environment maps this can be too noisy, as sampling the BSDF may not easily find the highlights in the environment map image. By enabling this option, the world background will be sampled as a lamp, with lighter parts automatically given more samples.

Without MIS:

With MIS:

The wiki really says it all here.
Lamp

By default lamps use only direct light sampling. For area lights and sharp glossy reflections, however, this can be noisy, and enabling this option will enable indirect light sampling to be used in addition to reduce noise.

Without MIS only rays that bounce directly to the lamp are sampled (camera > surface > lamp):

With MIS rays that bounce indirectly are sampled too (e.g. camera > surface > surface > lamp):


Constraints to two different objects I try to place a prisma in the scene, where the vertex ID 1 is moveable on a surface(plane) and also the vertex IDs 2 & 0 are moveable on the bezier.

I tried the "shrinkwrap"-constraint for the surfacecontact and also the "clamp to"-constraint for the beziercontact, but these constraints unfortunately just work with the origin of the prisma and not with specific vertices.

Is there a possibility to edit these constraints to the specific vertices and not the origin of the prisma?

You can use intermediate empties to do that. Here is a UI version (not Python).

For ID1:

Hook ID1 to an empty placed at its location. Then after that shrinkwrap the empty to the plane.

For ID0 and ID2:

Hook them the same way: place 1 empty at the location of the wanted vertex, hook the vertex. But here after that, add a "clamp to" constraint to the empties.

How to hook:

Note: for ID0 and 2, you can also use 1 empty for both if you want to keep a constant distance between them:

Select them both
Place the cursor at the middle
Move the empty to the cursor
Do the hook on both

The file here contains this last version:

Following the question in the comments: keeping the shape "rigid", here is another setting.

The prism is constrained by a bone
The bone follow an empty which is clamped to the curve
The bone also tracks to a second empty
This second empty: shrinks to the plane, is limited in distance from the first empty and shrinked again to the plane

The new file:


Is it possible to make a single-faced cylinder in Blender? In unreal engine 4 they give us some basic static mesh to work with and well the cylinder has only one face so that when i apply a material to it it renders well. Now here is my problem.

I am trying to make a prison door with metal bars in it. When i make a cylinder in blender it renders with so many faces. When i bring to ue4 I cant apply any materials to it because it really doesn't come out good. Any thoughts on how to fix that would so much appreciated!

thank you.

Cylinders have as many faces as you accept when you create them.  Reduce the number of faces when you create a cylinder.  Have the information panels open when you create the cylinder so you can see the information. Press T to show and hide the panel.

You can render a 3D view as a png with a transparent background.  So you could apply the texture to a single plane with little geometry if that suits your situation.


Reflections on glass over transparent background disappear in the final render Ok, so I have this problem, in the first image you have the "final" render, here the glass from the windows doesn´t reflect the light that comes from behind the camera, something that you can see appearing in the "preview" one (which is the one on the right side). If I adjust the gamma in color management, reflections start to appear, but colors start to change too!. Any idea of what could be happening? thanks

There is nothing wrong with your image, so don't try to fix it.

The issue is that the render viewer in blender is broken: the viewer won't show the pixels that are both luminous and fully transparent (alpha zero, RGB not zero) from an image with associated alpha (like the reflection on a window that have no occlusion but are only luminous).

Read: How do I get the Glare node to output transparent instead of Black background and: Render Halo material with tranparent background

View your render As RGB (without alpha channel) and you will see that your information is there.

Or just composite an image over a background using alpha over.

If you are planing to do the final composite in an app that is not blender, make sure that you save as OpenEXR, to keep the integrity of your image.


Memory increasing but not adding any new geometry So I have a model and in the top right where it says the memory usage it changes even when I dont add any type of new geometry. I can just say move a vert and let go of the mouse so it doesnt actually go anywhere or even just moving the object in object move basically almost everything I can adds more memory usage but I am not adding or changing anything on my model.

I can take the start up box and just go into edit model and just click on a vert and the memory goes up. I am not moving the vert just clicking on it.

Can someone tell me why this does this? Is it suppose to be like that? Does that actually reflect on the real memory use?

Whenever you execute an operator, even if that just means to select something, or deselect it, Blender needs to keep track of what you were doing by recording those actions to what is called the Undo Stack. You can think of it as a pile of commands which were run. If you press Ctrl + Z Blender will travel backwards in time along this stack so to speak. So you might be thinking you're not doing anything, but for Blender you do something  :)

Think about it: How else would any application know what state you were in before, what the document or model had looked like before you performed a specific action? How would the app be able to go back to previous states, unless recording and keeping those states around?

After performing a few actions, you can see the whole stack by pressing Ctrl + Alt + Z. This will show a menu with the latest commands you executed, and allow you to choose a specific state of the model. The one with the eye icon is the state you're looking at in the 3D View currently:

To verify this, you can simply disable the Undo Stack alltogether by going to the User Preferences, Section Editing and set the number of Undos to Zero (section marked in red):

When you now perform a few actions like select and deselect, you'll see that the memory consumption will jump slightly, but it won't just increase like a one way street any longer. There will be occasions where the memory consumption actually will be reduced, depending on what you do. However, this is strongly discouraged, as you really lose the Undo functionality. You can't even undo selections any more.

The settings in the prefs allow you to set certain boundary conditions on when Blender should forget about what you did. One is the number of steps, the other is the memory limit. Both help you to tailor your personal Blender prefs towards your machine specs. The memory limit is a limit for the Undo Stack itself. So in my case, Blender is allowed to allocate 2 GB of RAM for just the Undo functionality. If I perform a lot of memory intense actions in sequence, this limit could be exceeded, and Blender would start to delete the first element in the stack, then the second, until the stack fits the limit again. Sounds complicated, but bottom line is: Blender will never use more than that, so the constant increasing of RAM consumtion stops at that point.


Apply Rotation & Scale problem When applying Rotation & Scale to an object the mesh seems to invert. What is happening here and how can I prevent / correct it?

After applying the scale, try going into edit mode, selecting all faces and pressing Ctrl+N to recalculate the normals.

If that doesn't help, it would be nice if you could upload a .blend file.


Ridge on mesh after curve modifier I have modeling a mesh and then I want to curve it to fit another mesh.
But when I am using the curve modifier, some ridges appears on the mesh :

What can I do to avoid this ? I tried to multiply the number of faces using subdivision surface, but there is 6M faces on the mesh from the photo and so don't working.

More vertices are most definitely not "better" topology. I'd recommend this blog about the topology topic.

In your case it would be best to start from scratch. If you want to use what you have got, you only need to keep the outline.

Select the outer edge loop with Alt rightclick and ShiftAlt right click.
Invert the selection. CtrlI
Delete all selected vertices. X > Vertices

Then, convert your mesh to a curve with AltC > Mesh to Curve.
Set the curve to 2D and use its extrude features to give the flat surface depth.


Default render output folder I rendered an intro template and I don't want to have to render it again. If I didn't select an output folder, where would the file end up?

If I remember correctly the default output is C:\tmp folder.

The files save to the path set in the Preferences window

For 2.8 check here:


The color of my video is wrong when I input it into "Composition" So, I'm tracking a video, then applying a vide on top using "Motion Tracking" and "Compositing" in Blender. My video's colors always came out a bit "whiter" and "higher contrast" than the original, so I fiddled around with the color values and found out that setting the source video's settings to "Raw" (In "Footage Settings" -> "Color Space") fixed it!
However, now, when I try the same thing, it won't work anymore.
In the "Tracking" panel, changing the settings to "Raw" fixes the colors, but if I go into "Compositing" and do the input color (in the "image" node) to "Raw", the video turns much whiter and brighter than it should be. (Changing it to sRGB turns it darker, but still too white compared to the original footage.)
I currently have this node setup (see below), but the video footage is the same color even if I connect the "Image" node to "Composite" and "Viewer" directly.

And THIS is how the image looks in the "Tracking" panel, and how it originally looks:

How can I fix this? What causes the video to get whiter than it should be?
Thanks for the help!

Don't use Raw as the color space for video.
The issue is that by default blender is set to use Filmic as the color space. It is meant to render images using a wide dynamic range, not for dealing with video.
Your video is in a Rec709 or sRGB color space, so it should be displayed in sRGB color space.
Images viewed or processed in the wrong color space will always look wrong.
In the color management section, set the display to sRGB and the view transform  to standard (which is the dumbed down name the developers set for sRGB).

And set your footage to use sRGB.


Blender Game Engine Python Flipper Animation Okay. I've been working on this 2D Platform game in the Blender Game Engine lately. I've added some basic motion functions (in Python code), and now I'm getting to animation. I'm using the Blender playAnimation() function, and it works. But, I've found with logic bricks that the animation type that works best in my game is the flipper type. playAnimation() has no flipper mode.

Here's my script so far: (without playAnimation() function in it)

import bge
import math

def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner

    keyboard = bge.logic.keyboard

    xyz = own.localOrientation.to_euler()
    xyz[2] = math.radians(180)

    if bge.logic.KX_INPUT_ACTIVE == keyboard.events
       [bge.events.RIGHTARROWKEY]:
       own.applyMovement((0, 0.08, 0), True)
       own.worldOrientation = (0, 0, 0)

    if bge.logic.KX_INPUT_ACTIVE == keyboard.events
       [bge.events.LEFTARROWKEY]:
       own.applyMovement((0, 0.08, 0), True)
       own.localOrientation = xyz.to_matrix()

    if bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SPACEKEY]:
        own.applyMovement = ((0, 0, 0.08), True)

main()

So, how could I allow flipper animations in this script? Thanks!!

P.S. This code is for a public game project (or several). While I'll really appreciate any code or tips offered, I may or may not be able to give credit for it.

The flipper mode belongs to the action armature. This makes the actuator play the animation forward on activation and backward on deactivation.

The actuator uses the internal animation system to play the action in response the the current status (activated or deactivated) and the animation status (playing, reaching end).

The internal animation system can only act according to the animation status.

The simplest solution is to activate/deactivate the action actuator in flipper mode.

E.g.:

import bge
import math

controller = bge.logic.getCurrentController()
owner = controller.owner

keyboard = bge.logic.keyboard

xyz = owner.localOrientation.to_euler()
xyz[2] = math.radians(180)

if bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.RIGHTARROWKEY]:
    owner.applyMovement((0, 0.08, 0), True)
    owner.worldOrientation = (0, 0, 0)
    controller.activate("turn right")
    controller.deactivate("turn left")
    controller.deactivate("jump")

if bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.LEFTARROWKEY]:
    owner.applyMovement((0, 0.08, 0), True)
    owner.localOrientation = xyz.to_matrix()
    controller.activate("turn left")
    controller.deactivate("turn right")
    controller.deactivate("jump")

if bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SPACEKEY]:
    owner.applyMovement = ((0, 0, 0.08), True)
    controller.activate("jump")
    controller.deactivate("turn right")
    controller.deactivate("turn left")


Particle System not utilizing UV mapped texture The texture is UV unwrapped properly, and displays properly in the material. However when I try and use it as a density texture for the particle system, it is very messed up. It is rotated off center and the top and bottom are mirrored. Any idea what's going on?

The UVs seem to just get ignored completely as far as I can tell. If I change it to object, and generated etc it changes but if I change it to UVs it stays the same as whatever it was last.

I've attached an isolated version of the file below. The particle number is set to 128 instead of 128,000 to bring the size down, make sure to change that to see the issue properly.

You need to be emitting the particles from the Faces not the Vertices.
Think about it, you are trying to control the distribution of the particles with a texture, textures are mapped to the faces.

In the particle settings under the Emission section change the "Emit From:" value to Faces.

Now if you edit the UV map, you may need to refresh the particle system. You can do that by toggling it to emit from Verts then back to Faces.

That right there takes care of 95% of your problem.

(I changed the color of the spheres to be red just to show up better)

To fix those last few stragglers, just bump the contrast of the texture up a bit. There are a few pesky gray values in the texture (probably from some island), that is what is making the icospheres appear in the ocean.

Make sure you are changing the particle's texture, not the material's texture.
Open up the Color section and increase the contrast (I found that 1.1 worked fine here.)


How can I rig a cube in Blender so that it bends and twists? How to rig a cube so that the corners of the cube can twist and bend?

It will hopefully have a face too.

Ok, Here are the simple steps.

Create a Simple Cube and Subdivide it twice. (A> Select all, W> Subdivide)

Scale it 2 times (S2)
and Add a Single Bone (ShiftA> Armature > Single Bone).
Rename it to Root in (3D view > Properties region (N)> Item).

In edit Mode add 8 child bones (ShiftA) to root with tips facing the corners of the cube.
Turn on snapping (hold Ctrl) to precisely move them to corners. Create one bone first, snap and place at a corner, then simply duplicate (ShiftD) and rotate (R). Don't forget to select rootbone as parent before duplicating.

In object mode, parent your cube object to the armature (CtrlP). You are ready to animate. All corners work. Add more subdivisions for fine movement.


A problem while rendering wineglass in Cycles I have been trying to make a wineglass with filling using curves. In Eevee everything displays correctly, but I cannot say the same thing about Cycles. How can I fix this strange effect? I have tried turning curves into meshes, tried using Subdivision Surface, did not help. Any help appreciated.

It's a problem of normals, you need to flip the normals in the Screw modifier:


Learning Complex Addon Development I am a Blender user with some programming experience wanting to get into Blender addon development. I have looked at some tutorials for developing Blender addons, but they often seem to only teach how to create re-usable buttons for single use scripts (https://www.youtube.com/watch?v=uahfuypQQ04, as an example). Many addons that I’ve seen, however, have functionality that extends far beyond those of simple scripts. Addons like Gaffer, Hard Ops, and Box Cutter all seem to have persistent, modifiable
elements and, sometimes, custom user interfaces, which seem much more interesting to me than a press a button, do an operation, type of script.

If I did want to learn how to create complex, persistent addons (like Gaffer, Hard Ops, Box Cutter, etc.) are there any resources for learning development of such addons?

(On the experience side of things, I have enough general programming experience [Python and Java, specifically] to understand language fundamentals [functions, classes, etc.] but anything beyond that [like understanding the Blender source code, for example] is beyond my current skill set, but I'd be happy to learn)

Any help would be greatly appreciated

(P.S. If this isn't the place to ask this question, please feel free to tell me. Still learning which Blender forum would be best for these types of questions)

This isn't really the sort of question that is readily answerable on this forum.

If you have a problem with a specific script that you are working on then we can help but the subject you refer to is overly broad.

In an attempt to provide you with a useful answer, the best way to learn is to look at the source cod eof the add-ons to which you refer.  You will learn far more from that than anybody will be able to provide you with here.

The beauty of open-source is that you are able to both learn from and adpt existing code for your own purpose.  I hope this helps.


BGE: Which script names produce a "module has no attribute" error? When I name a module script wave.py it breaks and I get this in the console:

Python controller found the module but could not access the function - object 'Cube', controller 'Python':
AttributeError: module 'wave' has no attribute 'main'

Any other (valid) name seems to work as expected.

Is "wave" a reserved name in Blender's API? If so, are there other such reserved names specific to Blender? Or have I overlooked something else?

Broken example (wave.py):

Working example (script.py):

Update:

I found that there is a module called "wave.py" included in Lib...

I also found this list of built-in Python functions, but it appears not to be exhaustive since wave.py is not included.

If someone can verify that this is the problem, and link to a complete list of built-in functions, I would consider it a satisfactory answer.

Update 2:

A complete list of built-in Python functions has been asked for on Stack Overflow. But the answers listed do not include wave.py, so is it not considered built-in? I'll rephrase the question: What are all the names I cannot use for Python scripts in the BGE?

wave is indeed a module from Python's standard library, as you can see in the link below. As it deals with heavy data processing (wave sound files manipulation), it is probably a compiled C extension, and you may find it as a .pyd file extension (which is equivalent to a Windows DLL). Refer to Python standard library to avoid using already taken module names and be a bit more specific about your own module names (like game_wave, and so on).

wave module on Python standard library documentation: https://docs.python.org/3/library/wave.html


Is it possible to hide the wire in the edit mode? I am working on models made by photogrametry so I had really dense mesh. I wanted to know if it is possible to hide (or make it transparent) the wire of the mesh when I m in the edit mode?
I m using blender 2.79. And I already try to make it less thick and to change the color in the user preference menu, but I can't hide it.
Thank you if you can help me.

There is the option which was formerly dubbed, Only Render.
The icon to the left of the red-arrow is the toggle button, the icon to the right has a bunch of other viewport toggle draw options.


extruding circular shape How do you extrude a circular plane in two dimensions (e.g. z and y)?

I have a wheel with a tire. I have the rough animation of the wheel, but I cannot figure out how to extrude the tire in two dimensions. I've tried with extrude and scale combined but gives me the result seen in the picture.

To scale in one plane, use Shift+ the axis you don't want to scale in.

For example, if you want to extrude and scale in the YZ plane, you would do E→S→Shift+X.

If you use the 3D Manipulator, Shift+clicking the handle of the axis you don't want to scale (e.g. Shift+click the X-axis handle for the YZ plane).


Animation Key Frame Summary - Change editor text color The screen capture shows the area I am trying to change.
Currently the text color is light grey, which I can barely see.
I am using Auto Rig Pro which looks to be changing the background colors, though I do not see where to change the text color. Not sure if that part helps.

I looked at Preferences > Themes
I was not able to find anything that would change the above IK title color.

If anyone can point out where it is I would be grateful.

It's a long time since I changed mine but I think you'll find that setting in Preferences > Themes > Dope Sheet. Scroll down to 'Theme Space List', click the down arrow, and the setting should be under 'Source List Text'. If not, it's in 'Theme Space' settings above that section. Have a play with the colors (making a note of the current setting) and see what's changing in the interface.


How do to use just edges as Compound Parent? 2.91 introduced a new collider shape called 'Compound Parent'. If I'm not mistaken the main idea is to have a low poly parent which acts as collider instead of the high poly child while calculating rigid body physics.(as seen in this video https://www.youtube.com/watch?v=M5zBqQELdVU)
but the chain example seen on https://wiki.blender.org/wiki/Reference/Release_Notes/2.91/Physics uses just edges as collider.I would like to know how it was done.
and i would also like to know if there is difference between using a 'copy transforms' or 'child of' constraint instead of compound parent.
I tried having multiple edges as child objects with mesh collider but the mesh just passes through each other instead of colliding.

Compound Shapes can be used for more than just attaching a low poly mesh as collider to another object.
Actually, if all you need is to combine a high poly object with a low poly collision shape object, just parent them or use constraints.
To give you more of an idea how and when to use compound shapes, i'll explain what problem they try to solve:
Collisions of concave objects are always a bit problematic.
Before Blender got the Compound Parent shape, the only way to have concave collision shapes was to use the Mesh shape.
While it works in most cases it produces bad results in some corner cases, some of which are:

When the objects intersect too much, the algorithm can't determine contacts reliable anymore. Objects will get unstable, get stuck in each other or pass each other.
If the collision margin is too small, the simulation will get inaccurate or even unstable.

And even when it works, you need to increase the simulation steps per frame to get decent results.
The basic idea behind compound shapes is that you can combine primitive and convex shapes like

Spheres
Capsules
Boxes
Cylinders
Cones
Convex hulls (Basically capsules and spheres are special cases of this)

to more complex but concave shapes.
The advantage about the above mentioned primitive shapes is that collision between them can be calculated much easier and more reliable, therefore they are faster and more stable (Especially convex hulls, spheres and capsules).
Now to the chain example from above.
It is using several Convex Hull shapes which are parented to a Compound Parent object to create a single concave shape out of the several convex hulls.
Basically the shape of the chain element is approximated by capsules that are overlapping, which would look like this if you could see the collision shapes:

Each convex hull is defined by 2 vertices that create a capsule like shape. And the margin of each convex hull object determines the radius of the capsule. The connection between vertices (the edge) doesn't matter, it's just there for visualisation purposes.
Now, you could use the built in Capsule shape instead of the convex hull, and the simulation result would be really close if not the same. But in the example you linked it was made just with vertices, because it's easier to place a few vertices than to align boxes for the capsule shapes.
To better show you how two vertices form a capsule, i made an example of two rigid body objects with the same resulting collision shape.
The left object is using the built in Capsule shape with a diameter of 2m (1m radius), the size of the capsule is determined by the box mesh of the object. The right object is using a Convex Hull shape consisting of two vertices with a margin of 1m. Beside that they look different in the viewport, they react and collide the same way:

There is a lot more stuff you can do with compound shapes and margins.
There is a video somewhere showing you how to create complex parts with rounded edges and other things.
Even though the examples in the video were made with the blender game engine (which had compound shapes), it shows the basics which are still applicable to the compound shapes in Blender 2.91.


Having trouble building a navigation mesh getting an empty navmesh I am trying to build a navmesh based on this object and it always returns me an empty navmesh. I alredy tryed to change the collision type to navmesh but it doesn't seem to work, the object that I set to follow path is not doing it right. It was supposed to do what is on the second image.
Any advice?

Guess I needed to scale a bit more the object I was using to generate the navegation mesh, everything is working now.


Save the bounding box position of an object in a text file I have a .blend file found here and I'm asking if anyone could assist me to save the positions (x, y, width and height) of the bounding box of the moving object for every frame in the file attached, and save them in a text file. Each line will have the x y width height of the bounding box in each frame.

So if anyone could please advise me as its kind of urgent for me.

This is an interactive tool, a modal operator that draws the x, y, width and height of the bounding box corners viewed from front (use ortho to check):

import bpy
import bgl
import blf
from mathutils import Vector
from bpy_extras.view3d_utils import location_3d_to_region_2d

class G:
    top_left = Vector()
    bottom_right = Vector()

def draw_poll(ob):
    if ob is not None and ob.type in ('MESH', 'CURVE', 'SURFACE', 'META', 'FONT'):
        return True
    return False

def draw_callback_view(self, context):

    ob = context.object
    if not draw_poll(ob):
        return

    mat = ob.matrix_world

    # 50% alpha, 2 pixel width line
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(1.0, 0.0, 0.0, 0.5)
    bgl.glLineWidth(2)

    bbox = [mat * Vector(b) for b in ob.bound_box]

    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glVertex3f(*bbox[0])
    bgl.glVertex3f(*bbox[1])
    bgl.glVertex3f(*bbox[2])
    bgl.glVertex3f(*bbox[3])
    bgl.glVertex3f(*bbox[0])
    bgl.glVertex3f(*bbox[4])
    bgl.glVertex3f(*bbox[5])
    bgl.glVertex3f(*bbox[6])
    bgl.glVertex3f(*bbox[7])
    bgl.glVertex3f(*bbox[4])
    bgl.glEnd()

    bgl.glBegin(bgl.GL_LINES)
    bgl.glVertex3f(*bbox[1])
    bgl.glVertex3f(*bbox[5])
    bgl.glVertex3f(*bbox[2])
    bgl.glVertex3f(*bbox[6])
    bgl.glVertex3f(*bbox[3])
    bgl.glVertex3f(*bbox[7])
    bgl.glEnd()

    min_x = min(b.x for b in bbox)
    max_x = max(b.x for b in bbox)
    min_y = min(b.y for b in bbox)
    max_y = max(b.y for b in bbox)
    min_z = min(b.z for b in bbox)
    max_z = max(b.z for b in bbox)

    bgl.glColor4f(0.0, 1.0, 0.0, 0.5)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glVertex3f(min_x, min_y, min_z)
    bgl.glVertex3f(min_x, max_y, min_z)
    bgl.glVertex3f(max_x, max_y, min_z)
    bgl.glVertex3f(max_x, min_y, min_z)
    bgl.glVertex3f(min_x, min_y, min_z)
    bgl.glVertex3f(min_x, min_y, max_z)
    bgl.glVertex3f(min_x, max_y, max_z)
    bgl.glVertex3f(max_x, max_y, max_z)
    bgl.glVertex3f(max_x, min_y, max_z)
    bgl.glVertex3f(min_x, min_y, max_z)
    bgl.glEnd()

    bgl.glBegin(bgl.GL_LINES)
    bgl.glVertex3f(max_x, min_y, min_z)
    bgl.glVertex3f(max_x, min_y, max_z)
    bgl.glVertex3f(min_x, max_y, min_z)
    bgl.glVertex3f(min_x, max_y, max_z)
    bgl.glVertex3f(max_x, max_y, min_z)
    bgl.glVertex3f(max_x, max_y, max_z)
    bgl.glEnd()

    G.top_left = Vector((min_x, min_y, max_z))
    G.bottom_right = Vector((max_x, min_y, min_z))

    bgl.glColor4f(1.0, 0.9, 0.0, 1.0)
    bgl.glPointSize(5)
    bgl.glBegin(bgl.GL_POINTS)
    bgl.glVertex3f(*G.top_left)
    bgl.glVertex3f(*G.bottom_right)
    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0)

def draw_callback_px(self, context):

    ob = context.object
    if not draw_poll(ob):
        return

    font_id = 0
    blf.size(font_id, 20, 72)

    region = context.region
    rv3d = context.space_data.region_3d

    text = "%.2f / %.2f" % G.top_left.xz[:]
    dim = blf.dimensions(font_id, text)
    loc = location_3d_to_region_2d(region, rv3d, G.top_left)
    loc.x -= dim[0]
    blf.position(font_id, *loc.to_3d())
    blf.draw(font_id, text)

    text = "%.2f / %.2f" % tuple(map(abs, (G.top_left - G.bottom_right).xz))
    dim = blf.dimensions(font_id, text)
    loc = location_3d_to_region_2d(region, rv3d, G.bottom_right)
    loc.y -= dim[1]
    blf.position(font_id, *loc.to_3d())
    blf.draw(font_id, text)

class ModalDrawOperator(bpy.types.Operator):
    """Draw a line with the mouse"""
    bl_idname = "view3d.modal_operator"
    bl_label = "Simple Modal View3D Operator"

    def modal(self, context, event):
        context.area.tag_redraw()

        if event.type in {'ESC'}:
            bpy.types.SpaceView3D.draw_handler_remove(self._handle_view, 'WINDOW')
            bpy.types.SpaceView3D.draw_handler_remove(self._handle_px, 'WINDOW')
            return {'CANCELLED'}

        return {'PASS_THROUGH'}

    def invoke(self, context, event):
        if context.area.type == 'VIEW_3D':
            # the arguments we pass the the callback
            args = (self, context)
            # Add the region OpenGL drawing callback
            # draw in view space with 'POST_VIEW' and 'PRE_VIEW'
            self._handle_view = bpy.types.SpaceView3D.draw_handler_add(draw_callback_view, args, 'WINDOW', 'POST_VIEW')
            self._handle_px = bpy.types.SpaceView3D.draw_handler_add(draw_callback_px, args, 'WINDOW', 'POST_PIXEL')

            context.window_manager.modal_handler_add(self)
            return {'RUNNING_MODAL'}
        else:
            self.report({'WARNING'}, "View3D not found, cannot run operator")
            return {'CANCELLED'}

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

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

if __name__ == "__main__":
    register()

    for area in bpy.context.screen.areas:
        if area.type == 'VIEW_3D':
            context = bpy.context.copy()
            context['area'] = area
            bpy.ops.view3d.modal_operator(context, 'INVOKE_DEFAULT')
            break

The relevant part for you (front view only):

import bpy
from mathutils import Vector

ob = bpy.context.object
mat = ob.matrix_world
bbox = [mat * Vector(b) for b in ob.bound_box]

min_x = min(b.x for b in bbox)
max_x = max(b.x for b in bbox)
min_z = min(b.z for b in bbox)
max_z = max(b.z for b in bbox)

top_left = Vector((min_x, max_z))
bottom_right = Vector((max_x, min_z))

# x and y
#top_left

# width and height
#tuple(map(abs, (top_left - bottom_right))

And here's some code to write out what you asked for (front view):

import bpy
from mathutils import Vector

def main():

    # specify the object
    ob = bpy.context.object

    # change to your desired output location and file name
    filepath = r"D:\temp\bounds_2d.txt"

    scene = bpy.context.scene
    frame_current = scene.frame_current
    frame_start = scene.frame_start
    frame_end = scene.frame_end

    write_bounds_3d(filepath, ob, frame_start, frame_end)

    scene.frame_set(frame_current)

def write_bounds_3d(filepath, ob, frame_start, frame_end):

    with open(filepath, "w") as file:
        for frame in range(frame_start, frame_end + 1):
            bpy.context.scene.frame_set(frame)
            file.write("%f %f %f %f\n" % get_bounds(ob))

def get_bounds(ob):
    mat = ob.matrix_world
    bbox = [mat * Vector(b) for b in ob.bound_box]

    min_x = min(b.x for b in bbox)
    max_x = max(b.x for b in bbox)
    min_y = min(b.y for b in bbox)
    max_y = max(b.y for b in bbox)

    top_left = Vector((min_x, max_y))
    bottom_right = Vector((max_x, min_y))

    # make flat tuple, x y width height
    return top_left.to_tuple() + tuple(map(abs, (top_left - bottom_right)))

if __name__ == '__main__':
    main()


How to reset the axis of mesh rotated in edit mode? I did a lot of looking around and I cannot seem to find a simple method to reset to default rotation the axis of a mesh that got rotated while in edit mode. Clearing rotation in object mode no problem with Alt+R. But how to do that in edit mode? I want the cube to stay as it is in object mode where it's location and rotation is kind of randomized, just so it's perhaps not as easy to align anything to global orientation. So with the cube remaining in it's object mode location and rotation, how can I reset it's local axis back to it's default rotation as in picture 1 below? Picture 2 below is the cube having been rotated in edit mode. Is there a simple method I'm overlooking, or does it involve a bit of a step by step longer process to "reset" the mesh axis in edit mode? I would like to to know how to realign the axis back to it's "default" state in this cube mesh. Thanks for any ideas.
Blender 2.80
Windows 10

Blender_2.80_edit_mode_before_changing_default_rotation_of_cube

Blender_2.80_edit_mode_after_changing_default_rotation_of_cube

You may Snap Faces in object mode which can cause a rotation.

You may create an Orientation. And Transform the orientation.

https://www.youtube.com/watch?v=Gc8BekthXAQ

There are also add-ons. You will still have to do some work. Probably scripts exist as well.  I can make no statements about 2.8.

Once the axis is reset, you need to select two faces source and destination.  Then you have the freedom to select location in the orientation and rotation along z-axis of local transform orientation.  The requirement of artistic/technical freedom requires some small amount of work from the Blender User.

You can make changes in edit mode, then go to object mode, then enter edit mode and undo those changes with the typical keystrokes of Control-Z.  I suggest you test it because I would use that feature rarely.  I would not perform hundreds of useful things and then undo in edit mode.


how to get the archieved version of 2.79b which WON'T install? I want to run 2.79 and 2.8 on the same machine, but 2.8 destroyed my 2.79. I need a link to the UNINSTALLABLE v 2.79b.

I think what you are looking for is the portable version.

You don't say which operating system you are using so here are all versions.

https://download.blender.org/release/Blender2.79/

I am guessing you are asking about windows, you want the ZIP version, just choose between 32 or 64 bit versions


How to control one object with two pivot points I am trying to parent two empties to control the extremity of the object as pivot point

as you can see it works fine for the first one
(the object and the other pivot point are affected, which is what I want)

But I can't parent back the right empty to the left empty (error message "parent loop")

Any idea how to achieve this kind of empty controller?
(left empty control relatively to it's position, the rotation of the part and the position/rotation of the right empty. Right empty control, relatively to it's position, the rotation of the part and the position/rotation of the left empty)?

One way is to use Active element as pivot point.

Parent both empties to your object
Set Pivot point > Active element
Select your object and then the empty you want to pivot around


How to get driver for z location by name (without looping) I wish to be able to reference the driver for Location Z by name. Whenever I try using somethings like

object.animation_data.drivers[object.location.z]

or

object.animation_data.drivers[object.location[2]]

I get

TypeError:bpy_prop_collection[key]: invalid key, must be a string or an int, not Float

Any object I will call this function on will have a driver for Z location. Instead of iterating through the collection I was hoping I can call it by name (like properties).

I was able to find in the API documentation that there is a built in function for this collection.

Calling

object.animation_data.drivers.find('location',2)

did the trick.


How can I create a script that can turn pictures into 2D low poly images? Before:

http://cdn1.digitalartsonline.co.uk/cmsdata/slideshow/3513552/DAT_004.jpg

After:

https://m1.behance.net/rendition/modules/113025095/disp/9db2282a74ec5c6e7f48aeb0f9421e3f.jpg

Does anyone have ideas on how I would do this?

You'll still have to place the geometry by hand, but I've put together a simple material that will automatically set the colors for you.  For this example I've used a triangulated, subdivided plane.  Its not a bad result, but it does look a bit dry and grid like.

In order for this to work each triangle should be its own object with its its origin at its center.  To do this quickly you could create your triangles as a single mesh object and then in edit mode press crtl+e and choose "edge split".  You would then need to press p -> "separate by loose parts", after which you would exit edit mode and do a ctrlaltshiftc -> "set origin to geometry".

Input image:

Output:

Update: Here's what my sample looks like after applying @3pointedit's suggestion


Why does my particle hair look so patchy? Particle hair seem to have a weird behavior. Following image shows my guides:

And here is the render:

What am I doing wrong?

That is a https://en.wikipedia.org/wiki/Moir%C3%A9_pattern
Add a small amount of randomness to the vertices to avoid that.


Simulation of objects falling one after another I would like to animate a great number of Cubes, falling from a plane located in a determined height, one after another. Each cube should be placed close to the cube placed before.

What I've want to do is deploying a sort kind of barrier (in several horizontal layers). To simulate the real life implementation I simply moved one element higher than the other, but in this way (obviously) the simulation gets affected by the gravity. I know how to through the element at steady speed, but it could be more realistic if each element appears after that the previous one has already reached the ground (it should be simulate a "crane" that places these elements on the building site).

Has somebody advices how to do it?

Thanks.

So if you want to test physics, here what you could try:

Create 3 objects, a cube, a funnel, a plane.

Make your funnel and plane Rigid Bodies, Type > Passive (they are obstacles), Shape > Mesh (the topology will be taken into account).

Make the cube a Rigid Body, Type > Active (it will fall), Shape > Mesh (not necessary in that case I guess). Duplicate the cube. If all your cubes are ready and different, just give the Rigid Body to one of them, select all, then the one with Rigid Body and in 2.8, Object > Rigid Body > Copy From Active (in 2.7, T panel > Physics > Copy From Active).

Start the animation, the cubes fall.

If you want to keep them close to each others, create a Force Field > Force with a negative Strength.


Collision groups and mask? I have 2 objects that collide, how do I have one of them not collide with anything and still be dynamic? My two objects are a body and a controller, I want the controller to be dynamic so it can fall, but not interfere with bullets; moreover, I want my character to be static so it can collide with bullets.

For the controller, check the Ghost option under the physics tab. This will cause the object to still fall, but there won't be any collisions. You can also parent the character to the controller without having do a major freak-out.


Cloth colliding through mesh? Sorry for asking so many questions about this one project, I'm sure many of you have seen it a lot already. This should be the last one for this :P Thank you all for helping so much already !

Anyways, I'm almost done my little project, here it is in it's current state:

Everything goes pretty well-- except the pants, as is evident.

Here is the blend:

The pants have a cloth modifier on them with the Quality slider turned up to max (as that helped with this issue previously when the pants were at rest. Not the case right now). I've tried playing with the presets to no avail. The pants are pinned at the waist and ankle through pinning via a vertex group. The pants are also parented to the character to keep their offsets to it.

How can I fix the melding issues with the pants?

Edit: Tried removing the cloth modifier, but the leg still doesnt seem to collide with the body despite both having collision physics... Hrm.

Edit: Tried turning up quality on collision, no improvement :(

Ok, I just did a simpler rig now the answer is which is not very certain that I could only figure out there must be something wrong with how you adjusted the armature and the pinned vertices most probably won't move so the leg that's kicking is something you need to unpin like:

make sure you enable the cloth simulation on the physics tab ONLY FOR THE CLOTH(PANTS) and the collision set only for the mesh. and hence the result:

(this is a simpler rig though.)


Creating many primitive objects quickly with Python I'd like to be able to generate a bunch of primitive objects. All of them will be different sizes and have a material out of a random set.

What I'm having trouble with is the following:

Creating 20,000 primitive objects quickly
Creating a set of different materials where I can assign the primitive objects to

Here is my code so far:

import bpy, random
from random import randint

#Short hands for common calls
scene = bpy.context.scene
selected = bpy.context.selected_objects
mesh = bpy.ops.mesh
context = bpy.context
object = bpy.ops.object
selected_object = bpy.context.active_object

clouds = 500

def baseObject(x,y,z):
    #Creates base cylinder
    mesh.primitive_cylinder_add(location=(x,y,z))
    return

def clearScene():
    #Clears the current scene
    for selectedObj in bpy.context.scene.objects:
        selectedObj.select= True
        object.delete()
    return

def ObjectCreation(clouds):
    for attempts in range(clouds):
        x = round(random.uniform(-4.0, 4.0), 10)
        y = round(random.uniform(-4.0, 4.0), 10)
        z = round(random.uniform(-4.0, 4.0), 10)
        baseObject(x,y,z)
        context.object.scale[0] = x/10   #X Scale
        context.object.scale[1] = y/10   #Y Scale
        context.object.scale[2] = z/10   #Z Scale

        materialCreation()
    return

def materialCreation():
    #for attempts in range(scale):
    randomRed = random.uniform(0.0, 1.0)    #Used for random color scale, need to adjust later for color mapping
    randomGreen = random.uniform(0.0, 1.0)
    randomBlue = random.uniform(0.0, 1.0)

    material = bpy.data.materials.new("Material")    #Material properties
    material.alpha = round(random.uniform(0.1, 1.0), 10)    #Opacity
    material.use_transparency = True
    context.object.show_transparent = True
    context.object.data.materials.append(material)  #Applies material properties
    context.object.color = (randomRed, randomGreen, randomBlue, 1)  #Changes objects color(RGB Opacity)
    context.object.active_material.use_object_color = True
    return

clearScene()
ObjectCreation(clouds)

Instead of using the operator to create the mesh each time you can use a copy and link it to the scene. Try and avoid high amounts of operator calls Python performance with Blender operators .  They have the tendency to bloat out because of the undo stack, for one thing.

The operator is called once to create the primitive, then a copy is used for each iteration.

Created a list of 10 random materials.  Each object mesh will have one randomly selected material from the list.

import bpy, random
from random import randint

context = bpy.context
scene = context.scene

def base_object():
    #Creates base cylinder
    bpy.ops.mesh.primitive_cylinder_add()
    return

def clear_scene(scene):
    #Clears the current scene
    for obj in scene.objects:
        scene.objects.unlink(obj)
        bpy.data.objects.remove(obj)
    return

def object_creation(scene, clouds):
    base_object()
    obj = scene.objects.active
    mesh = obj.data
    nummats = 10
    random_mats = create_material_list(nummats) # create 10 random materials
    for attempts in range(clouds):
        x = round(random.uniform(-4.0, 4.0), 10)
        y = round(random.uniform(-4.0, 4.0), 10)
        z = round(random.uniform(-4.0, 4.0), 10)
        obj.location = (x, y, z)
        obj.scale = 0.1 * obj.location

        red = random.uniform(0.0, 1.0)    #Used for random color scale, need to adjust later for color mapping
        green = random.uniform(0.0, 1.0)
        blue = random.uniform(0.0, 1.0)
        obj.show_transparent = True
        obj.active_material = random_mats[random.randint(0, nummats-1)] # random pick of random mats

        obj.color = (red, green, blue, 1)  #Changes objects color(RGB Opacity)

        # copy the next one
        obj = obj.copy()
        obj.data = mesh.copy() # a new mesh for each object.
        scene.objects.link(obj) # link it to the scene
    return

def create_material_list(len):
    #for attempts in range(scale):
    mats = []
    for i in range(len):
        material = bpy.data.materials.new("Material")    #Material properties
        material.alpha = round(random.uniform(0.1, 1.0), 10)    #Opacity
        material.use_transparency = True
        material.use_object_color = True
        mats.append(material)

    return mats

clear_scene(scene)
object_creation(scene, 1000)

A similar question answer How can I create many objects quickly?

Might also want to check this out https://blender.stackexchange.com/a/42232/15543

If you stick with CamelCase for class names you will get better formatting.


Video editing/face replace I'm new to Blender but want to edit video,I need to replace faces. I will cut face from picture and put there. Found this Overlaying an image to cover a face in a video? but don't get it. Can't found  2D Stabilization
I need to replace and track faces in video.I'm beginner and need explanation step by step.I will cut face from picture and put on actor face in video. It's not that easy,video is long 4min It's fight scene from movie,they jumping ,spinning and I need to track all that.Don't even know how to add image :) I'm new to this and is all complicated :) If somebody can help me step by step I will really appreciate that.  And I hope that is clear now what I want to say.

Open the "Motion Tracking" layout.
Load your video

Track high contrast points (ctrl+LMB to create a tracking point, then press the track forward/backward buttons)

Change the layout to "Video Editing"
Drag in your tracked footage
Drag in your image file
Use the VSE_Transform_Tools addon to position and size your image over the face

Alt+S will rescale an image to it's original aspect ratio FYI

Use the "Transform from 2D Track" function (also part of the VSE_Transform_Tools addon) to pin the image to the face.


Create game map with Blender I'm developing an web-based 3d RPG game using HTML5 technology stack.
I'm trying to use Blender as much as it possible in my project. I'm using it to create models, landscape meshes, to draw blend maps for landscape textures and so on. Now I'm thinking about how can I use blender to make maps. I can't just put objects and export whole scene. I will have some objects repeated many times over level so I just need information about objects coordinates, rotation, scaling and some custom properties  (like class name from my framework).

So my question is - what options do I have to make this with Blender?
Currently all I can think of is to write a custom plugin for blender to export map in wanted format.

In the obj exporter there is the option

  Objects as OBJ groups

If this is checked it will maintain separate objects in the scene as well as their transforms in world space.


Pixel to voxel in Blender 2.92 I'd like to use knowuh's script on converting an image to voxels.
there's the script: https://gist.github.com/knowuh/48136d7a17387e7cf6c3
I have tried to run it, but the file I loaded into the UV editor and saved on my desktop cannot be found. I'll always get this error:
File "\Text", line 46, in <module>
File "\Text", line 43, in cubify
File "\Text", line 23, in draw_pix
File "\Text", line 17, in make_material KeyError:
'bpy_prop_collection[key]: key "Diffuse BSDF" not found'

So, is this a problem by blender 2.92 handling things differently then 7 years ago when the script is written or? what does the key error mean, blenders api descriptions is too cryptic for me to understand properly

What does it do?
In 2.92 If you add a new material and select "use nodes" you are presented with two nodes, neither of which has name "Diffuse BSDF"  ... so one imagines that this was the case back when the script was written.
The Python console.
The expectation isn't that you will be a python wizard overnight. The beauty of python is it doesn't need to be compiled, hence can take lines of code and run them in the console and see what happens.
When assigning a variable like, below, no feedback is good news, it worked.
>>> color = D.materials.new("Color")
>>> color.use_nodes = True

Can test in UI to see that there is a new material named "Color" or "Color.001" if run again.. etc etc and it is to use nodes...
Next line, uh oh have seen this before.

blenders api descriptions is too cryptic for me to understand properly

>>> Diffuse_BSDF = color.node_tree.nodes['Diffuse BSDF']
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
KeyError: 'bpy_prop_collection[key]: key "Diffuse BSDF" not found'

Or in lay-mans terms there is no node named "Diffuse BSDF", if only cryptic crosswords were as simple.
Let's see what nodes this newly created material does have, hmmm they look familiar.
>>> color.node_tree.nodes.keys()
['Principled BSDF', 'Material Output']

Can be sure that if a new material is added, use nodes it has these two nodes, in same order.
Ok then lets have a go at making the make_material function work, paste this in text editor and run script..
import bpy

def make_material(color):
    alpha = 1.0
    red, green, blue, alpha = color
    color_name = '%(red)03d_%(green)03d_%(blue)03d' % {"red": red, "green": green, "blue": blue}
    color = bpy.data.materials.new(color_name)
    color.use_nodes = True
    bsdf, output = color.node_tree.nodes
    bsdf.inputs[0].default_value = [red, green, blue, alpha]
    return color

make_material((1, 0, 0, 1))

And there it is

IMO a little confusing passing a color list, then making a material with same variable name, so let's refine this further, by instead calling the new material mat
import bpy

def make_material(color):
    red, green, blue, alpha = color
    color_name = '%(red)03d_%(green)03d_%(blue)03d' % {"red": red, "green": green, "blue": blue}
    mat = bpy.data.materials.new(color_name)
    mat.use_nodes = True
    bsdf, output = mat.node_tree.nodes
    bsdf.inputs[0].default_value = color
    return mat

make_material((1, 0, 0, 1))

_Note: haven't tested to see if any other changes are needed, or amended to instead use a "Diffuse BSDF" node.+
Optimizing.
The script is going to be sloooooooooooooooooooow.
Object creation slows over time
Python performance with Blender operators
As it is to create each cube for an image on M x N pixels the script is calling 2 x M x N operators.
Instead Create one object and duplicate it.  Even if this lone object is created with operator, it will be one call.  Can be done with none. Consider even using the array mnodifier to very quickly make N x M grid of cubes then separate
How can I create many objects quickly?
Copying an object with python without actually creating a new object
Use numpy to read the image pixels. See Read pixel color with foreach_get() on image data  (looping is one almost always a rate determining step.)
Make one material.  Randomly coloring with script doesn't work correctly  which if used in conjunction with this would mean making one material, and assigning pixel color to material color of the voxel.
Vertex colors. Another option is to have no materials and set  vertex colors to pixel color.

You can export it from blender as an FBX and then import to Unity.
Unity will create a materials file from the vertex colors you don't
need to do anything special.

How to get random color variation on a single mesh?
(Suggest array method here to create object NxM array of cubes, apply array, use the order to set the vertex colors en masse with numpy, separate into multiple objects.)
Making these changes will see huge improvement in speed gain.


Mesh Array Modifier with Fit Curve modifier strings objects through center, not origin I am using Array modified and Fit Curve modifier to place multiple meshes on a bezier curve.  Unfortunately, blender is passing the curve through the centers of the generated objects, and I need the objects to be placed so that the curve passes through the origin, not center.

Is there a way to do this?

thanks in advance.

OK, I was just being stupid...I'm answering the question in case someone else looks at this issue.

I had set the origin of the bezier to the endpoint of one of the handles...I thought it was on the actual endpoint of the curve.

As a result, even though the origins were lined up and scaled & rotated the same, the modifier was placing the objects with an offset.  It LOOKED like it was going right through the center of the mass of the created objects, but this was just a coincidence.

So...if you have this problem, check your origins again!  Make sure the endpoint of the spline is placed exactly where you want it and its origin is on the endpoint, not the handle.

thanks for the replies.


What is this black line in my rendered donut? What is this black line in my rendered view?
Also, I think there's a problem in my 3d view.
There are also some lines in my object I can't explain.  I have tried to change the scale and modifiers, but nothing works.

It looks like You are following the tutorial for beginners made by BlenderGuru aka Andrew Price, Hassan, right? If I remember it right he duplicates the top half of the donut and make it bigger and then use proportional falloff to make that random chocolate edge.

Because of duplication of a top half part of a donut there is a big chance of overlapping vertices so to solve this, please select the donut (complete one) and go to EditMode and DEACTIVATE the "Limit selection to visible" (bottom green circle on the image) to make the hidden vertices visible. Once done please select the top vertices with the B key (WITHOUT the middle ones - marked RED) and delete them with the X key choosing VERTICES as shown on the picture - done!

The vertices which needs to be deleted are selected below ... You dont need that top part of a donut anymore cause You have the chocolate object instead now ;). Hope it helps buddy.


Can I move (the view) on a 2-D scale (Only up and down)? I want to move my camera (not the Blender camera) only up and down. If I zoom in on a section, the other section of the project disappears (I am terrible at explaining)

I also can't just move the entire picture because I'm using a background image as reference.

Press ⇧ Shift while pressing the middle mouse button (or scroll wheel) and move the mouse to re-position the window.

Press ⇧ Shift and roll the scroll wheel to move the view up and down.

Press ⎈ Ctrl and roll the scroll wheel to move the view left or right

Press Home to re-center the camera view window.


Apply force along normals of cloth mesh I'm trying to simulate an inflatable mesh by applying a force field to a cloth. As air pressure always acts perpendicular to a surface it might be a close enough approximation when pushing all vertices along their normal vector with equal force.

Blender's shrink/fatten-tool (Alt-S) won't do the trick as it doesn't create the neccessary creases in the mesh when there is excessive material available. Think of a cloth laying on a sphere, where the excessive material gets pushed out and creates these folds and wrinkles. It's kind of similar to the case I'm trying to simulate, but instead of gravity pulling the cloth down on the sphere, thus having little force acting on the horizontal parts of the sphere, the air pressure pushes equally on every surface.

Is there a way to simulate a force field this? I think the weight of the mesh and the air are negligible in my case.

Edit: Example image added.

You could try the modeling cloth addon. It has an inflate option and I've seen a lot of images of people making inflated objects with creases like that.
https://www.youtube.com/watch?v=yHGz7nEI23E
https://github.com/the3dadvantage/Modeling-Cloth


Subdivision surface causes problems on connected edges (bridged edge loops) I'm pretty new to Blender and trying to model various things, but I faced a problem which I can't properly describe to find an answer, so sorry for silly question if it is.

I tried to model several edge bridges like second bottom in a barrel (second bottom edges connect directly to an edge loop on outside wall) and regular edge bridge that connects inside edges to outside wall with a bridge and got strange behavior along connection lines.

I want to 3d print this model thus I'm trying to solidify it and subdivision surface gives these artifacts. I tried to add supporting geometry, the distortion can be reduced but remains there.

I also tried to flip normals, but that has more cosmetic effect to the bottom case bec. it is still smth. wrong with edges but in this case inside.

In case of bridge it makes both edge loops sharp and ugly and I can't apply any bevel etc. to it. In case of second bottom it distorts outer wall. Without all this the model is smooth as expected without any issues.

Any help is much appreciated!

Model overview (symmetrical along X axis)

Inner edge bridge

Second bottom

From what i know about 3D printing, you design the object without the support and filling, no connecting of inner and outer edge-loops either, the result you got there is to be expected, subdivision does not work without artifacts if you do that.

Rather you build and design the object first as it is supposed to look, export it to the slicer software and in there you should be able to set up filling and support.

Also, thickness in the bottom should be achieved by giving the object thickness, like we usually model a vase or glass, inner and outer wall connected through the lip at the opening and the inner bottom more distant from the outer bottom, thus giving it volume.

But regarding modelling with subdivision surface modifiers, i can tell you that the problems you got there, are normal considering what you connected, as you are not supposed to use it that way.

Solution: Model normal without anything other then the model in mind, then export and add those support or filled areas in the software to prepare for the 3D print.

Regarding the infill, as i checked up now and even downloaded a slicer software just to be sure, the 3D object from Blender or any other 3D software does not need to concern itself with that. That does not mean that thin parts of the object can be filled, so giving the object a certain "hollow" thickness for the slicer software to fill is still recommended.

Here a picture of the infill options of "Slic3r" a free software:

So i would believe that most slicer software offers this as well.

I'd like to add this link as well 3D Slicer Settings, as it explains under "4. Fill Density" what i mentioned.


Removing automaticly generated (automatic weights) weight paint I'm very new to the topic of weight painting, and have just parented several meshes to a rig.

It all works well, except for one issue at the shoes (the bone of one leg not only drags that leg, but also the other one).

I selected the bone, and then the object that I was having trouble with (opposite shoe), and, sure enough, there was some weight painting on the shoe. I changed the brush to subtract, and dragged all of the levels (weight, radius and strength) up to their maximum. I then tried to remove the weight paint, but it was not subtracted.

Strangely, adding my own weight paint and then trying to remove it works; it is only the auto-generated weight paint that will not go away.

Here's my file:
http://www.mediafire.com/?s30kckfkhqx8ga4

What causes the problem is the Mirror modifier in the shoes. The Vertex Groups option of Mirror modifier is on by default, and it's unchanged here. That option mirrors weight in vertex groups with symmetrical names. That is, for every pair of vertex groups suffixed with .L and .R, Blender will just match vertex weights in both, even if you only assign weights to one of them.

The problem is, Blender assumes the object's symmetry coincides with armature name symmetry, while your objects are not. Instead of mirroring the left shoe for the right shoe, thereby matches the armature's shoe.L and shoe.R and works as expected, you're mirroring each half of each shoe.

The solution is easy: For each foot, either delete the (unused) vertex group for the other foot, uncheck Vertex Groups in the Mirror modifier's setting, or apply the Mirror modifier.


Mesh Has Different Shape in Object and Edit Modes I made a mesh and applied a material (skin colour) to it. But now when I try to edit the mesh, the changes are not being reflected in object mode.

As you can see in this clip, the neck seems thicker in object mode when it should look like that in edit mode

What can be done to make the neck thinner in object mode? I've even tried removing the materials but to no avail.

Your mesh might have a shape key. If you have shape keys all of the edits you make in edit mode could be stored in the shape key. Removing the shape key if you don't need it would be the easiest solution.


UV mapped texture is distorted on flat faces I'm trying to model a hand grenade with my later added hand painted texture. Right now, I'm at the UV Mapping process and I have a problem with stretches appearing on my UV Map.

How can I solve this problem? Is it common? :(

This happens due to the triangulation of the quads:

You can see how the blue lines "break" (and so the lines in the texture) right where the dotted red lines marking the triangulation are.
The problem is that the UV of these faces is made of squares and rectangles, but the faces in the mesh don't have those shapes anymore.
The solution should be to unwrap the mesh again.


Sculpting grab tool causing pointy mesh? I'm trying to learn some sculpting techniques in Blender and at first I thought that I'm doing something wrong (and probably still am) concerning the grab sculpting brush, because I just couldn't get it to pull in the natural ways. So I watched some online tutorials and without them mentioning any change than what I was doing I saw that my brush was indeed acting strange.

For example this is one of the videos I followed.
The sculpting starts at around 4:00 minutes in. When he uses the grab tool you can see that the mesh is pulled in the direction he drags and deforms quite nicely, also even the middle parts of the mesh are pulled.

However when I follow his exact same steps (I even made sure of the view settings) grab brush pulls it diagonally in the direction I am pulling, but also pulls it towards the viewer (screen). It is also very pointy.

Note: I used the grab tool here just to illustrate my problem and didn't try to emulate the tutorial again.

Right ortho view of sculpt (same one as tutorial):

Front view of sculpt:

As you can see it does not pull the middle part (X mirroring is active), also it seems to pull more on corners than edges, which makes it very pointy. I tried playing around with most of the brush settings, but couldn't find anything that seemed to be improving it.

Try using a bigger brush radius (F + drag to change).

Small radius:

Large radius:

Also try to drag close to the edge of the object.
When you grab closer to the center (thinking in 2D), you are really grabbing the side of the object, affecting geometry "closer" to the screen more than geometry near the actual center, which is at the edge of the visible portion of the object when in side ortho view.


Use Latex in Blender I want to use math text in Blender.

For example, I would like to have fractions (A/B) where the letter A is on top of letter B and the division line is horizontal. I also would like to move this fraction around by animations just as I can do it with any other object.

I found here that writing mathematical formulas using latex syntax should be no problem. But I dont really understand how to use it. If I simply write this in text mode, then it doesn't work:

So how does it work?

Here is how I would do it

Wrap your expression inside a LaTeX document

\documentclass{standalone}
\usepackage{lmodern} %or whatever you like
\usepackage[intlimits]{amsmath}
\usepackage{amsthm, amssymb, amsfonts} %Useful stuff
\begin{document}
$ <your expression> $
\end{document}

Pipe that to pdflatex, or save it to expression.tex
If you used a pipe:

pdftocairo -svg texput.pdf expression.svg

If you used a temporary file:

pdftocairo -svg expression.pdf expression.svg

Import expression.svg into blender
Remove temporary files created by pdflatex.

This procedure can be converted into an addon. The dirty way of doing it is to modify the svg importer to run steps 1-3. The correct way is to use Python bidings for Poppler to load the pdf directly.

Test case:

\documentclass{standalone}
\usepackage{lmodern} %or whatever you like
\usepackage[intlimits]{amsmath}
\usepackage{amsthm, amssymb, amsfonts} %Useful stuff
\begin{document}
$\displaystyle\mathcal{F}\left[f\right](\xi)=\int_{-\infty}^\infty   f(x)\exp(\mathrm{i\xi x})\,\mathrm{d}x$
\end{document}

Result (after some tweeks [curve to mesh, remesh, smooth]:


Why do shaders have a normal input? It is probably a very stupid question but why do have many shaders (diffuse, glossy, ...) a normal input ? What happens with that normal input ?

Maybe it helps when I clarify the background of my question...I am trying to understand the concepts of Physically-Based Shading and the implementation of these concepts in Blender. See also my questions here and here.

After some discussion with @piegames I noticed that I do not really understand why the normal input is used in shaders. I think I understand what a normal is but with the concept illustrated below I have difficulty to understand what Cycles does with this normal input when calculating the behavior of a shader

A face normal is the angle perpendicular to the face, it is used to determine reflections and lighting on the face.

A normal map is used to visually deform the surface of an object. It does this by altering the face normal for every position on the face. This fakes extra detail by altering the rendering calculation without using extra geometry.

This is where the normal input comes in, by feeding a normal map into the node you allow blender to calculate the surface colour at a given point using the modified normals and not just the one face normal.

You may find Blender Gurus recent tutorial on photorealistic wood of interest.


Lining edges up: Make features collinear, preserving surrounding geometry How can I make the leading edge of the left wedge collinear with (so that the edges lie within the same line) the leading edge of the right wedge (pictured below, edges highlighted)?

The objects and their origins need to stay the same.
If all of the pictured geometry were part of one object, and #1 was not a requirement, how could this be achieved? (If this were a mesh level transformation instead of an object level transformation)

Multiple objects

There are a couple ways I can think of. One way is to use custom transform orientations.

In edit mode (↹ Tab), select the edge that you want to align the object to and press ⎈ Ctrl⎇ AltSpace to create a new transform orientation.

The manipulator widget should align to the edge and you should see the selected transform orientation switch to the new custom one in 3D view > header:

In object mode, select the object you wish to align and press Align to transform orientation in 3D view > Header > Object > Transform:

Your object's local X Y and Z axes will be aligned to the active transform orientation. This is probably not exactly what you want. In your case, since you just want to adjust the rotation of the first object around the Z, set the rotation along the other two axes to 0:

Now we are closer, but still off by 90° around the Z. To fix this, just add 90:

Single mesh

You might be able to use custom transform orientations here too, but here's a different way just to mix it up:

What I did in the gif:

Snap one vertex on the transforming edge to a vertex on the target edge.
Snap the 3D cursor to the vertex which was just snapped to (⇧ ShiftS> cursor to selection)
Set the pivot to the 3D cursor (.)
Set the snapping target to edge and rotate the mesh (R) until it snaps into place.

You should be able to apply this approach to multiple objects too.


Wierd faces after I moved one vertex of quads I am new to blender. I searched the forums for an answer to my question. I couldnt find any.

I loop cut a cube (vertical center)
I Pushed the loopcut on the Y Axis so the whole shape became like >>.
I pushed down the upper vertice of the head on Z axis.

This means I should get a VALLEY shape.

Problem : The side left tf the screen divides into 1 raised half and one proper half. This means i get a ^ shape bend instead of a / shape bend which joins in at the vertice. Please tell me how it can be resolved.
[

Result comes from fact that by draging only one vertex of a quad face makes face non-planar, in viewport hardly seen as two triangles (there is not any other mathematical way to result). In real life if you take plate of glass and you would take one corner lower you would have to split plate by diagonal cut between any two corners.

In your case is one face triangulated in shorter (red) direction and second in longer (green).

Yet not sure how final surface should looks like for you, but you can create like negative shape from two triangles and "cut" it out by Boolean modifier > Difference from your base mesh.

Create a new object with two triangle faces. Like that you keep faces planar.

For Boolean modifier you will need a non-manifold mesh. So extrude it by Solidify modifier to create one close mesh. It is non destructive way. So you can go to edit mode and adjust the "cut" shape anytime.

Now use Boolean modifier for your base object to Difference it.
Also I changed the viewport display mode for this object to "Wire" so you can see how Boolean modifer perform on base mesh.

Note: Blender has also an operator, you can search Make Planar Faces, that can recalculate them into flat faces, but in cost of distortions of all selected vertices.


Reducing viewport slowness while working on a .blend with lots of particles? I wonder to know if there is a way to dramatically reduce blender slowliness while working on a .blend with lot of objects/particles on a slow PC.

I'm using BI.

I'm looking for more tricks than the usual ones like disabling object visibility, turn them shadeless, send them to other layers/renderlayers, remove shadow casting, you know, all those tricks.

I have 6 to 9 subsurf levels aplied to planes with RGBA video texture, I need to dissolve in particles some dudes for my shortfilm, obviously my PC is so much dying right now. Even reducing the subsurf view level is no good because of the amount of planes being dissolved in particles at the same time.

To buy a new CPU or GPU is not good for me right now.

Ideas? Suggestions?
Custom builds for this kind of task? Ubuntu/win8?
Dramatic object disabling without deleting them?
Other ways to particleize planes with video textures?
*Python magic code to disable stuff?

Expanding on stacker's answer, in case you are not using child particles, you can also reduce the percentage of real particles displayed in the viewport in Particle settings > Display:

Note that you should bake your simulation with this set to 100%, and any simulations with it at less than 100% will not be the same a simulations with it at 100%.

You can also set the particles to draw in the viewport as something other than what they will appear as in the render.

This will probably increase viewport performance a lot


Cloth texture not rendering properly when animating I have created a character, rigged it and added clothes. These clothes are rigged to the armature and the skirt has a cloth modifier added at the end so it moves properly.

The problem is that in the viewport the texture looks fine but when I render the texture is all messed up. This only happens in the frames where the cloth and the rig starts to move. All the textures are mapped form the UV of the skirt. I don´t really know why this only happens on the final render but not in the preview.

It looks like your "Viewport" and "Render" subdivisions are set differently. Depending on how you're rendering, that can make a huge difference at values that low (0-3 really). It may also be affecting baked cloth simulations.

I recommend setting them to the same value. Possibly also bumping it up to 3.


Fluid, type liquid ignores domain when inflow Just to start off and explain things, I have two objects one is a ico-sphere which is the fluid emitter and the domain is a skull which I baked both setting and mesh. when I hit play it works fine, the skull disappears and the fluid emitter emits fine with the exception that it ignores the domain. Because domains disappear, I had duplicated the skull (see image). The skull normals are looking outward, and I notice that the small cube that appears when ever an object becomes a domain appears outside, instead of inside, is that the issue?. Thank you

I learned that the fluid simulator domain is always square. I am treating the skull as an effector now but the liquid is falling through ignoring the obstacle completely. I've checked the normals of the skull and they are all outward. My scale is set in all objects.


Show all Collections with one button in 2.8 In 2.7, we had a button to show all the layers. In 2.8, this button is for the Pie menu. Do we still have this functionality for Collections?

In Blender 2.8 you can isolate and iterate on each one by pressing the numbers on your keyboard, this will show only the collection that you want and hide the others, if you press Ctrl + H it will give you the same result. To show all the collection again press Alt + H.


Pick random option in particle settings? It is under "Render" when you select the "Group" option. How does this work? I cannot see any meaningful difference when I turn it on. It looks like it only randomizes the particles a bit differently, like a different seed.

Basically it picks a random object from the group for each particle, instead of selecting them in order.

With an already randomized particle distribution this doesn't make much of a difference, but when particles are consecutively organized the effect is more obvious:


Mantaflow not going hires I'm using the blender 2.81 mantaflow beta build and, I've set up a smoke scene and, as I understand it, the "Noise" setting is the equivalent of the "High Resolution" setting before so, when I check noise and bake the sim, the fire and smoke disappears and then when I uncheck it, it reappears. Why is it doing this?

Sorry guys, I figured out the answer but wanted to post this to help others. You need to bake the noise as well before you can see the result.


How to create normal (direction) widget? I'm looking a way of creating widget like normal node has in Cycles.

I have examined names of all method in UILayout but it looks neither of them are related with Normal widget.

Actually it is not a separate widget as I thought but argument for float vector property (subtype='DIRECTION'). In general it can be done in next way:

    vector: bpy.props.FloatVectorProperty(default=(0.0, 0.0, 1.0), subtype='DIRECTION')

    def draw_buttons(self, context, layout):
        layout.prop(self, 'vector')

Test script.

import bpy
from bpy.props import FloatVectorProperty

context = bpy.context

bpy.types.Scene.normal = FloatVectorProperty(subtype='DIRECTION')

def draw(self, context):
    scene = context.scene
    self.layout.prop(scene, "normal")

bpy.types.SCENE_PT_scene.prepend(draw)

context.window_manager.popover(draw)


Camera shows gray screen Recently I was working on creating an animation in Cycles Render, and my camera started showing only gray when I switched from the Camera View (by toggling 0) to the User Perspective. Similarly, if I try to move orthographically within the Camera View it shows only gray; here the location numbers become enormous (again, not sure why) but this doesn't occur in the User Perspective and it remains gray.  I tried to find a solution to this on the site, but the common problem and solution seems to be with clipping distance, and mine seems to be large enough. I think I toggled something by accident, but I can't determine what. The screenshots are of the different views.
Sorry if this question is simple, or redundant but I tried to figure it out and am at my wit's end!

From your snapshots it looks like your camera shifted a very long distance, try to adjust the camera location or the camera clipping.


Duplicating in for loop causes weird multiplication I am trying to generate roads from curves that i have placed in the scene. I have three curves and a road mesh that I apply a curve and array modifier to through python. I also set the values of the modifiers through python.

In python I loop through all objects in the scene, and for each curve I duplicate the main road mesh and apply modifiers with the new curve as the target.

My problem is that for each road it duplicates the road by an amount of 2 * the previously duplicated amount. So for the first curve it makes one road, for the second curve 2 roads, and 4 roads for the 3rd curve so on so forth.

I am fairly new to blender programming, so I am certain i'm missing something logical, but I can't figure out what.

Finally here's the code for the operator:

def execute(self, context):
    objects = bpy.context.scene.objects
    road = bpy.data.objects["Road"]

    for obj in objects:
        if obj.type == "CURVE":
            road = bpy.data.objects["Road"]
            bpy.data.objects['Road'].select_set(True)

            newroad = road.copy()
            bpy.context.collection.objects.link(newroad)

            bpy.ops.object.modifier_add(type='ARRAY')
            bpy.ops.object.modifier_add(type='CURVE')

            arrmod = bpy.context.object.modifiers["Array"]
            curvemod = bpy.context.object.modifiers["Curve"]

            arrmod.fit_type = 'FIT_CURVE'
            arrmod.curve = bpy.data.objects[obj.name]
            curvemod.object = bpy.data.objects[obj.name]

    return{'FINISHED'}

Thanks!

You don't need to select the object before copying it, so bpy.data.objects['Road'].select_set(True) is redundant.

Instead of that you need to make the newly created object active before calling any bpy.ops to make the op function operate on the new object. But I guess, you can avoid call to ops altogether and simply call newroad.modifiers.new to create the modifier.

So that the modified code will look like this (this is not tested)...

def execute(self, context):
    objects = bpy.context.scene.objects
    road = bpy.data.objects["Road"]

    for obj in objects:
        if obj.type == "CURVE":
            # road = bpy.data.objects["Road"] # Already set above so not needed
            # bpy.data.objects['Road'].select_set(True) # Not needed

            newroad = road.copy()
            newroad.data = road.data.copy() # You might also want to copy the data block
            bpy.context.collection.objects.link(newroad)

            # bpy.ops.object.modifier_add(type='ARRAY')
            # bpy.ops.object.modifier_add(type='CURVE')

            # arrmod = bpy.context.object.modifiers["Array"]
            # curvemod = bpy.context.object.modifiers["Curve"]

            arrayModName = 'array'
            arrmod = newroad.modifiers.new(arrayModName, 'ARRAY')

            curveModName = 'curve'
            curvemod = newroad.modifiers.new(curveModName, 'CURVE')

            arrmod.fit_type = 'FIT_CURVE'

            # arrmod.curve = bpy.data.objects[obj.name]
            # curvemod.object = bpy.data.objects[obj.name]

            # obj is the same as bpy.data.objects[obj.name]
            arrmod.curve = obj
            curvemod.object = obj

    return{'FINISHED'}


See UVs for beveled curve in UV/Image Editor So I'm making character hair and I have plane beveled on to a curve like this

Now I'm able to see the texture I apply on it, but I want to edit the UVs for it. I usually select the faces in edit mode in order to see them in the UV editor, but I'll have to convert the curve to a mesh for that.

Is there a way to do it without converting it into a mesh? I'll be duplicating this curve a lot and editing each one.

I'm using Cycles, if that makes a difference

Try this:
https://www.deviantart.com/vickym72/art/Blender-Empty-Decal-Tutorial-207942535

It's essentially a tutorial for manipulating decals using an empty, but you can use it for the curve as well. (Credits to: VickyM72)

Hope this helps :)

EDIT: Here's how to do it in cycles --> https://www.youtube.com/watch?v=dnmovLzKU44&ab_channel=KarstenH%C3%B6hne (Credits to: Karsten Höhne
)

EDIT 2: try this:

1> go to the curve tab and open Texture space

2> click Use UV for mapping

3> Click match texture space

4> Go to material node editor

5> Add your image texture

6> Add Texture coordinate node and hookup the vector of the image texture to generated

7> use the Location and Size values to manually manipulate your texture

EDIT 3: I made a video: https://youtu.be/bx1FdoG2xo8

Hope that works :)


Transform a Location “Constrained” Object? What I’m overall attempting to do here is be able to move an arrayed object with an empty which will always rest at the center of the array of objects. If the count in that object’s array is raised or lowered the empty would adjust to remain in the center of the objects in the updated count.

In the image below I’ve visually annotated how the scene would look with this concept.

^ (The Main CTRL empty would be aligned on the same Z axis as other empty’s I have in the scene, as apposed to what I have annotated here with the Z location for the empty also shown as being centered.)

The image above shows the basic concept. The cube empty would be the main control point, located in the middle (referenced with the large plain axis empty) of the start and end of the theoretical arrayed object, of which both ends are represented by the two arrow empty’s.

To summarize on the key functions of this concept:

The main control empty must remain in the center of the two points
If the array count changes the empty must adjust to remain centered
When moved the empty will also move the theoretical arrayed object

I’ve linked a detailed video below that demonstrates the basic functionality I’m aiming for, though it has issues that I'm unsure of how to get around, hence my call for assistance.

Goodle Drive - Video Link

Youtube - Video Link

For those with potential ideas for a solution to this challenge, I thank you for your efforts in advance.

I've created a work around for my problem by removing the main control empty (along with my ability to move everything from a dynamic center) and replace its functionality with a driver that outputs half of the array's distance.

This will allow me to use that drivers value to offset the start empty manually (though for my use case, I can still semi automate this if the desired location for the center of the array is located in the center of two points which have location values I can reference for use with the start empty).

While this does not achieve the functionality I had laid out, this will do as a passable workaround for now.


I am trying to create 2 cubes, with one mirroring the other. Instead it appears to create one cube that is always connected to the center! This is my first attempt at creating a character using blender. I am finished with the body, and now I am trying to add hands. I put my cursor where I want the origin to be and then pressing Shift+A to create a cube, which I would hope would also create an identical cube mirrored across the center. Instead, it seems as though these two cubes always have to be connected in the center. Any suggestions? This is my first day using blender so forgive me for not knowing the terminology.

Shift A amd create a cube. move it to right along x axis beyond the center line. Make sure 3d cursor is at world origin by pressing shift + s and select cursor to world origin. With your cube still selected in object mode press F3 and search for set origin and select origin to 3d cursor. Select mirror modifier and make sure your axis is x going by your picture


Strange artifacts on Blender painted texture after re-opening With some reason I've got strange lines on my finished texture. When I made it I didn't see it. When I re-opened the projects I saw the strange black/white lines on my object.

This is a mipmapping issue.

When painting the texture, Blender disables mipmapping (so everything looks shaper) so you don't notice the problem.

When you view the object from a distance, it's actually using a scaled down version of the texture, which shows the black background bleeding through, hence the wires. The solution is to increase Bleed.

You can also fix it in a 2D software using the 'maximum' filter.