text:
Initializing Scene Parameters in Addons
I'm working on an addon that reads stored scene data, but am having a bit if difficulty initializing them. The value on the sliders can only be read when you manually nudge them a value or two, or else the "default" values always return an error that says that the values can't be read. Here's the code:
bl_info = {
    "name": "Material ID Utilities",
    "author": "Ajlan (Jacobo) Altug",
    "version": (0, 1, 1),
    "blender": (2, 70, 0),
    "location": "N Panel",
    "description": "Offers a nifty way to visualize and arrange Material Pass ID's.",
    "category": "Material"}

import bpy
from bpy.props import *

### UI MENU ###
class AjMatidUIPanel(bpy.types.Panel):
    bl_label = "AJ_MATERIAL_ID_MANAGER"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

    def draw(self, context):
        layout = self.layout
        scn = context.scene
        row = layout.row()
        row.prop(scn, 'MatInd', icon='BLENDER', toggle=True)
        row.operator("select.obj")
        row = layout.row()
        row.prop(scn, 'StrtInd', icon='BLENDER', toggle=True)
        row.operator("assign.matid")
        box = layout.box()
        scnMat = bpy.data.materials
        box.label("MATERIAL ID LISTING: " + str(len(scnMat)) + " MATS IN THE SCENE.")
        for mat in scnMat:
            matPassIndex = getattr(mat, 'pass_index')
            row = box.row()
            buf = mat.name
            buf = buf + " with ID: " + str(matPassIndex)
            row.label(buf, icon='MATERIAL_DATA')

### CLASS ###
class OBJECT_OT_SelectObjButton(bpy.types.Operator):
    bl_idname = "select.obj"
    bl_label = "Select Objects with ID"

    def execute(self, context):
        scn = context.scene
        scnMat = bpy.data.materials
        objList = []
        for obj in bpy.data.objects:
            if obj.type == "MESH":
                for slot in obj.material_slots:
                    mslot = slot.material
                    if mslot != None:
                        if mslot.pass_index == scn['MatInd']:
                            objList.append(obj)
                        else:
                            pass
                    else:
                        pass
            else:
                pass
        for ob in objList:
            ob.select = True
        return{'FINISHED'}

class OBJECT_OT_AssignMatIDButton(bpy.types.Operator):
    bl_idname = "assign.matid"
    bl_label = "ID to Mats"

    def execute(self, context):
        scn = context.scene
        scnMat = bpy.data.materials
        MatIndex = scn['MatInd']
        StrtIndex = scn['StrtInd']
        if len(scnMat) != 0:
            AssignMatID(scnMat, MatIndex, StrtIndex)
        else:
            pass
        return{'FINISHED'}

### FUNCTIONS ###
def AssignMatID(scnMat, MatIndex, StrtIndex):
    i = StrtIndex
    for j in range(len(scnMat)):
        scnMat[j].pass_index = i
        i += 1

###  Registration  ###
def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.MatInd = IntProperty(
    name = "Material ID",
    description = "Material Pass Index ID")
    default = 0

    bpy.types.Scene.StrtInd = IntProperty(
    name = "Start",
    description = "Start Value")
    default = 0

def unregister():
    bpy.utils.unregister_module(__name__)
    del bpy.types.Scene.MatInd
    del bpy.types.Scene.StrtInd

if __name__ == "__main__":
    register()

I referred to the Code Cookbook, and there the scene data is initialized in a format that seems unsuitable for a runtime addon, but it works. The scene data is initialized as such:
import bpy
from bpy.props import *

#
#    Store properties in the active scene
#
def initSceneProperties(scn):
    bpy.types.Scene.MyInt = IntProperty(
        name = "Integer",
        description = "Enter an integer")
    scn['MyInt'] = 17

    bpy.types.Scene.MyFloat = FloatProperty(
        name = "Float",
        description = "Enter a float",
        default = 33.33,
        min = -100,
        max = 100)

    bpy.types.Scene.MyBool = BoolProperty(
        name = "Boolean",
        description = "True or False?")
    scn['MyBool'] = True

    bpy.types.Scene.MyEnum = EnumProperty(
        items = [('Eine', 'Un', 'One'),
                 ('Zwei', 'Deux', 'Two'),
                 ('Drei', 'Trois', 'Three')],
        name = "Ziffer")
    scn['MyEnum'] = 2

    bpy.types.Scene.MyString = StringProperty(
        name = "String")
    scn['MyString'] = "Lorem ipsum dolor sit amet"
    return

initSceneProperties(bpy.context.scene)

How can I go about successfully initializing stored data in an addon?

The cookbook example doesn't work with recent Blender versions:
bpy.types.Scene.MyBool = BoolProperty(
    name = "Boolean",
    description = "True or False?")
scn['MyBool'] = True

It will try to access bpy.context during initialization, which is now prohibited.
Your is syntactically correct, but you don't give any property a default value:
bpy.types.Scene.MatInd = IntProperty(
name = "Material ID",
description = "Material Pass Index ID")
default = 0

default is supposed to be a parameter of the property initialization, but you place a random variable in the global scope.
It should be like this:
bpy.types.Scene.MatInd = IntProperty(
    name="Material ID",
    description="Material Pass Index ID",
    default=0
)

Note that you can only supply static values, you can't do something like default=len(bpy.context.selected_objects) - no access to bpy.data and bpy.context is allowed, and therefore no dynamic default value (you could use random.random(), but that's not the point).


text:
Copying and Pasting Fcurve modifiers Through Python
I posted this on blenderartist.org, but to no avail.
I want to be able copy the Fcurve modifiers applied to ShapeKey drivers and paste them onto their counterparts on other objects, the other object's ShapeKey drivers.
This is manually quite simple to do; as in, you just copy the all the fcurve modifiers on a Driver from the graph editor, select the other object and again in the graph editor paste them whichever fcurve you want, in this case, its drivers... But with scripting in Blender, it turns out to be an enigma, whereas there is only the ability to add and remove an fmodifier to an fcurve, example:
bpy.data.shape_keys['Key'].animation_data.drivers[0].modifiers.new()
bpy.data.shape_keys['Key'].animation_data.drivers[0].modifiers.remove()

But bpy.ops.graph.fmodifier_copy() seems unbelievably tricky and seems not to play well within a script, like I think you need the area type to graph editor and invoke the command, which sounds pretty redundant.
And since the Blender API is almost totally devoid of real-world examples explaining the application of its commands and procedures, I'm totally stuck. I searched far and wide, even tried digging through other scripts.
How can I accomplish this task?

I don't think it is possible to get/set the active fcurve / driver. So you can not override the context for bpy.ops.graph.fmodifier_copy
You might use from_existing and adjust the data_path attribute from the returned driver accordingly if you want to copy the driver or try out this script:
import bpy

sk = bpy.data.shape_keys['Key']

source = sk.animation_data.drivers[0]
target = sk.animation_data.drivers[1]

for mod in source.modifiers:
    copy = target.modifiers.new(mod.type)
    for prop in mod.bl_rna.properties:
        if not prop.is_readonly:
            setattr(copy, prop.identifier, getattr(mod, prop.identifier))

My God Pink Vertex, you nailed it just right on the head... This is sublime... Very simple and to the point. The principle of this, I've been trying to do for the last 2 days but just couldn't come up with a viable solution. Very elegant solution and you just saved my day sir :) Thank you so very much for helping me out and hopefully others who will be seeking a solution to the very same problem in the future...

Ok, I've figured it out. Getting to the f-curve properties is a whole different kind of a method than getting to those of its f-modifier(s). Here's a sample of my code:
import bpy

aj = bpy.context.scene.objects.active
shape_key = aj.data.shape_keys
kbloks = shape_key.key_blocks.keys()
bpy.ops.object.duplicate()
ajDup = bpy.context.scene.objects.active

animParamList = [getattr(aj.data, 'shape_keys', None)] #form a list comprised of ShapeKeys on the active object
for anim in animParamList:
    if not anim or not anim.animation_data:
        continue
    action = anim.animation_data.action #If there are shapeKeys with f-curves, detect them
    if action:
        #for each f-curve, get the data path, isolate the name, append it to an empty list, enumerate the entire list and isolate only the animated ones' names
        m = 0
        for fc in action.fcurves:
            AnimShps = []
            animfcrvDP = fc.data_path
            animfcrvChName=animfcrvDP.split('"')[1]
            AnimShps.append(animfcrvChName)
            AnimShpIndL = [i for i, j in enumerate(kbloks) if j == animfcrvChName]
            AnimShpInd = AnimShpIndL[0]
            bpy.context.object.active_shape_key_index = AnimShpInd

            ajDup.data.shape_keys.key_blocks[AnimShpInd].keyframe_insert("value")
            AjDuplFcrv = ajDup.data.shape_keys.animation_data.action.fcurves
            AjDuplFcrv[m].keyframe_points.add(count=len(fc.keyframe_points)-1)

            k=0
            for key in AjDuplFcrv[m].keyframe_points: #get all the pertinent properties from the fcurves on the master object, iterate through and pass them onto their counterparts on the other object
                key.co = fc.keyframe_points[k].co
                key.interpolation = fc.keyframe_points[k].interpolation
                key.handle_left = fc.keyframe_points[k].handle_left
                key.handle_left_type = fc.keyframe_points[k].handle_left_type
                key.handle_right = fc.keyframe_points[k].handle_right
                key.handle_right_type = fc.keyframe_points[k].handle_right_type
                k+=1
        m+=1

source: Stack Exchange

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

sort: votes


text:
Can I group items only in the Outliner
I would like to hide many items in the Outliner by grouping them and then collapsing the group.
I realize the Outliner can display only Groups, but those groups are functional groups that affect the way, for example, animations work.
The kind of groups I'm wanting to create are solely for the purpose of reducing visual clutter in the Outliner and won't effect anything else.
I saw this question was asked before, but none of the answers solved my problem. (How can I organize the outliner with groups?)
Does anyone know of any solution?

Is this the kind of thing I should suggest to the User Interface developers or is this a well-known issue that they are purposefully not adding right now?

I had a need for something like this sometime back and as far as I know there is no way of doing this in Blender yet.
What I did was create and name some empties and then just parented the objects to it. To reduce clutter, you can keep the empties on a garbage layer and also reduce their size or disable relationship lines. Empties and their relationships to the child objects won't affect anything and you get to toggle the different 'groups' as needed.

You could organize your scene by placing the objects on seperate layers and switch the Outliner to Visible Layers

The highlighted area shows that there are objects on layer 1 and layer 2, but only layer 1 is currently visible.

An ok solution but not really ideal for especially if you have an existing scene with render layers and is also not very descriptive or flexible in terms of naming.

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


text:
Obtaining opposing direction rotation
I have an object that has been rotated. How can I get its rotation, but in the opposite direction (as a matrix that I can use to multiply some coordinates by)?
bpy.types.Object has an attribute called matrix_world which represents the object's current transformation, including its rotation. I have tried using mathutils.Matrix.invert() and mathutils.Matrix.decompose() to obtain the rotation component of the active object in what I hoped was the opposite direction, and some other methods, none of which worked.
I am currently reading up on linear algebra to discover a solution here (so that I can discover the meaning of matrix inversion, transpose, etc.), but in the mean time any advice is appreciated.

A matrix has no direction, so what do you mean by "opposing"? The same matrix, but with e.g. Z vector flipped?

If you rotate an object around an axis 45 degrees, I mean rotating around the same axis minus 45 degrees. And I know that you can represent a rotation transformation using a matrix, so what I want is a rotation matrix representing that transformation.

Multiply .matrix_world by the inverted rotation matrix (mat.inverted()), that should do the trick.

First some information: (skip if tl;dr)
For matrices in general the inverse should actually be what you are looking for, since the inverse of a matrix exactly undoes the transformation of the matrix. And (at least in 3D) for orthonormal matrices (1) like the rotation matrix the inverse is equal to the transposed matrix. Since transposing a matrix is much faster than inverting it, I would use the transposed matrix in this case.
However matrix_world is the so-called World-Matrix, which does not only contain the object's rotation but also its translation and scale. Furthermore it is a matrix that works in 4D homogenuous coordinates, which are often used in computer graphics because they allow you to perform translations and perspective transformations with matrices. You can usualy not work with this matrix directly.
(1) matrices whose column vectors are normalized and orthogonal to each other
The solution:
You were on the right track with decompose. However decompose gives you the rotation as a Quaternion, not as a rotation matrix. But you can invert quaternions as well and use them for your calculation.
If you really need a matrix you can convert the quaternion to a matrix by calling mathutils.Quaternion.to_matrix(). This will give you a 3D matrix which you can invert or transpose to get what you want.
And this is how you can get all that stuff:
o = bpy.context.scene.objects['Cube']  # use your object name here
# calculate the translation, rotation and scale
t, r, s = o.matrix_world.decompose()
# calculate the inverse quaternion
r_inv = r.inverted()
# calculate the rotation matrix from the quaternion
r_mat = r.to_matrix()
# calculate the inverse rotation matrix
r_mat_inv = r_mat.inverted()
# calculate the transposed rotation matrix which is the same as the inverted
r_mat_transposed = t_mat.transposed()

Now take what you need ;)


text:
How do I join two UV islands into one making it better for unwrapping?
How do I join two parts into one making it better for unwrapping? One part was mirrored and joined in the middle, doubles removed.

Hi. Please use the built-in uploader for images. See: https://meta.stackexchange.com/questions/75491/how-to-upload-an-image-to-a-post

Ok, just found out why it did not unwrap into 1 piece.
The ends had ngons so when I joined the 2 pieces in the middle they were still there when I joined the vertices in the centre. Now removed the 2 un-needed faces and unwraps nicely.

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


text:
Blacks are grey?
I'm not sure if I can explain this properly, but things that should be black are grey in cycles?

https://blender.stackexchange.com/questions/66662/objects-can-be-seen-after-turning-off-all-lights-how-to-turn-off-ambient-light/66684#66684

Please use the built-in uploader for images: https://meta.stackexchange.com/questions/75491/how-to-upload-an-image-to-a-post

I'm guessing your world background color is gray (the default) just make it black.

No. You are seeing grey color in that image is just because the default ambient color in the blender (cycles) is #404040. If you want to change the ambient color to black. Then assign this hex #000000 color value in the World Tab under Properties panel.
Hope this clarifies your doubt.

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


text:
How to animate after simple deform?
I want to animate a folding sheet:

I locked the locrotscale without any bend that is at deform bend angle =0°.
But when I change this angle to 90° for the next key frame the object seems to capture the angle and apply to the intial key frame, which I have animated with 0°.

Are you dead set on a bend modifier? I would definitely suggest armatures instead.

I am actually working with an empty set of arrows and using them as a bend entity !

You've got to key frame the angle within the modifier itself ... right-click the' Angle' field >insert key frame..  say, a key frame for 0 degrees at frame 1, and  another for 90 degrees at frame 100 ..

You can deform the object to it's final shape first, and then you select APPLY AS SHAPE KEY.
Then, go to the vertex group menu, and select SIMPLE DEFORM under SHAPE KEYS
Finally, you will see a slider named VALUE. turn automatic keyframe on, and then start deforming the object through time.
In that way you don't even need armatures


text:
How to stop objects sticking out from the sides
Is there anyway to clean up the edges so it's just one smooth face instead of these things poking out without having to resize everything?

So you want to delete these parts?

Yes the parts sticking out from the sides

Did you solve this problem?

One way to fix this:

Select your mesh
Switch to Edit Mode
Select all
Press P then choose 'By loose parts'. This will divide the mesh by loose parts.
Switch to Object mode.
Select the objects (parts of mesh) which you want then delete them.
Select all remaining mesh parts using A
Join them to be one mesh using Ctrl+J


text:
How do I make my model move with an armature's bones?
I'm making an animation and I need to use armatures, but I don't know how to make the model move with the bones. I know there is a certain command, but I can't recall it.

you should parent the model to the armature, set weights, and then pose the armature's bones.

Please mention the steps you did and provide screenshots of your problem and Upload your .blend file to be able to help you


text:
Workspace - Filter Add-ons Question (2.80 and 2.81)
If I enable the new workspace filter add-ons feature, some add-ons that I have enabled in Blender preferences window do not show up in the filter panel. For example, I have the import AutoCAD DXF add-on enabled in the Blender preferences window but it doesn't show up in the workspace filter add-ons panel.

The result is that it isn't available in the file import formats list. Does this feature have to be supported in each add-on or am I missing something? Are there any workarounds other than creating another workspace just for importing various file types? Thanks.

The issue is that in WORKSPACE_PT_addons(properties_workspace.py) the listed add-ons are checked for use_owner key in their bl_info. The import and export add-on don't have this set, which is why they get excluded when use_filter_by_owner is set to true (the checkbox next to "Filter Add-ons"). I'm not familiar with this part of the code, therefore I'm not sure why the import export add-ons don't have an owner.

Thanks. I created a separate workspace just for imports and exports. Maybe it will get sorted out in a future release.

As a quick workaround, you could change the "category" in the bl_info section to one of the supported ones. Though "Import-Export" is listed as supported for filtering, it currently is not.
You should be able to filter them after changing, good for maintain addons via workspace.


text:
Is there a way to make an emission shader effect in blender engine?
I'm trying to remake these materials in the blender engine, I can do the grey one of course, but I have no idea how to make the emission ones, is there a way?

possible duplicate http://blender.stackexchange.com/questions/34466/blender-game-how-you-can-make-an-object-to-emit-light

Possible duplicate of Blender game: How you can make an object to emit light?

The best option is to switch to cycles and use the cycles emission shader. I am guessing you have never heard of it... you can do that by moving your cursor to the top and changing your render to cycles render. next go to your materials panel and click on the box that says diffuse and change it to an emission. If you need clarification on any of these steps just ask.

no, i actually made this on cycles but i need to remake it in blender engine, i guess i should've been more specific


text:
File browser sorting
Is there a setting to make the file browser sort by date everytime. I want to see my most recent blend files each time but I always have tell the browser to sort by date


text:
How to make game, made with the BGE, without having to provide source code of the game?
The blender FAQ says that if I combine my blend files with blender's game player, my license becomes GPL automatically?

Combine? can you explain it more, what combine is talked about here?
Is there a way to avoid that without making my own blender player nor using BPPlayer?
I also researched something about making a .bat file to launch my game, is that a way to avoid it? How can I protect my .blend files from being read plainly in notepad like apps?

In simple words, I want to make a commercial game in blender and avoid providing the source code (my .blend files).

Stand Alone:
The Blender Game Engine is GPLed.  There is not a way to release a game made in the Blender Game Engine without including the Blender Game Engine.  Including the Blender Game Engine makes your game GPLed.
Stand Alone, load external .blend:
You can compile the BGE into a standalone player that loads the .blend of your game, and have the .blend be under a different license.  This would make it illegal for someone else to use your work, but it would trivial for people to break the law and poke at the blend file.
Encrypt:
You could obfuscate the blend file using encryption libraries in python.  The executable which is GPLed would contain the key, and a smart enough dedicated enough person could get at your blend file. It would prevent the average Blender user from being able to steal your assets though.  See: https://pypi.python.org/pypi/pycrypto for a crypto library.
Practicality (opinions included, sorry):
There is nothing on your computer that you can't "steal" assets of if you are dedicated enough.  There is no way for someone to both have something and not have it at the same time. Stop worrying so much about "theft", and generate a game good enough that people people are willing to pay. If you get big enough where you see large scale copyright infringement, use the DMCA and other copy right laws if you feel the need; but I think you'll find that over enforcing copyright and preventing modding will hurt you in the market place more than a few free loaders abusing your game assets.

I see, but what I want is that people can only modify the game with a modding application which also I made, I do not want them to modify my game using my game's source code, that GPL wants to publicize

@nightrobin If you are serious about your game go for Unity or Unreal4, its not that expensive. No pain no gain. I dont think bge is good for serious game development, go for another engine.

Indeed, there's so real reason to over-think obfuscation.  Just need enough so people know they're not supposed to see it.  And don't even think about relying on obfuscation to protect a flawed multiplayer system.  It will be broken and the game filled with cheats, as always.

I have found that if you select user preferences (if it crashes when you go into the one on the toolbar on the top, go into one of your panes and change it to user preferences) select addons and  activate the addon "Export Game Engine Runtime", then from the file menu in the toolbar at the top, select export and select game engine runtime. I did this on 2.72 but it should still work on other versions. But the textures are in Gnu Publsic License, so don't publish it.


text:
Keying set failed to insert any keyframes
When pressing I, I now receive:

keying set failed to insert any keyframes.

No idea why pressing I doesn't work anymore. What did I do wrong?
(I've upgraded from 2.71 to 2.72 and it stops working).

It sounds like you have a keying set active. What happens if you delete it or disable it in the header of the timeline?

still the same. I've seen that the Scene property has a Keying Sets active when I select my camera.
As a beginner I have actually no clue how this is enabled after upgrading to 2.72 and what it actually does. héh.

You may consider to upload a simple problematic file somewhere like pasteall.org then paste the link here.

I received instructions to not share the work. Can't reproduce it in a simple file.

See screenshot: The solution was to remove the keying set at the bottom and when selecting the camera, to remove the 2 keying sets that were there.
I however have no idea how this was enabled, and at this point of time I also don't know the goal of this keying.
After removal, the I key worked again.

Glad you got it working :) In case you are wondering, here's some more info about keying sets: https://docs.blender.org/manual/en/dev/animation/keyframes/keying_sets.html

You may have locked the editablity of the keyframes for the channel. This means that the little lock icon next to LocRot in the graph editor was pressed. Atleast this is how I've resolved the issue on my laptop :)

could you please post a screenshot, indicating the area where to look for the properties mentioned? It will be hard for new or transition users to find it, as not all terms like 'LocRot' or 'graph editor' are known to everybody

I found myself in this thread in 2018 so I felt it was worth mentioning. Above, User44922 describes the solution being in the, "graph editor". When I think he meant the Dope Sheet.

In Blender 2.7.9, I selected (in Pose Mode) Pose -> Animation -> Change Keying Set [Shift+Ctrl+Alt+I] - setting this to loc-rot-scale (which is what I needed).  You should set the keying set to whatever your require (there are multiple choices).

If it's not the keying set, then it's likely in the prefs > Animation > Keyframes > Only Insert Needed, that should be OFF to force-keyframe all channels:


text:
Archiving blender files (long term) for later reuse
I've made a few basic blender animations.
Now I want to store these animations in an archive in case I would need them again in 3 years or so (on maybe a different pc).
Which settings should I apply? What should I look for when archiving? etc...
I'm aware that File > External Data -> Automatically pack into blend exists but it doesn't seem to work with video.
In photoshop (back in the days, I guess it is still that way) if you hide the layers before saving your file. The resulting output file on disk is a lot smaller, which is better for archiving/backups. Such tips are also welcome.
All tips and suggestions are welcome.

"it doesn't seem to work with video" -> video textures? video strips in vse? video from animation output?

Possible duplicate of Moving all files to a new computer. My concern is Links

video that I use in animations to render (e.g. explosions are made from a video file)

Blender files can be used as they are for archiving.  Simply append them into later projects and extract the items you need with CTL-C/CTL-V.
Video file extensions can be renamed to non video extensions
(e.g.) .4pm for mp4, avk for avi, etc. They will then be accepted as image files with which you can texture a plane and pack it's 'image'.


text:
How can I preserve both materials from two meshes that undergo boolean union?
I want to Boolean union a cube (“A”) and a sphere (“B”) to created unified object (“U”). “U” should be a single mesh object with the faces of the new object inheriting the material properties of the corresponding faces from both "A" and "B" as explained in the documentation:

When I try to recreate this my unified object "U" ends up with either just the material from "A" or "B" but not both. I.e I want it to end up still yellow and red rather than totally red or totally yellow.

My process is simply create new mesh objects, assign separate materials, change the Diffuse property of each material, then go to add modifier > boolean > union > apply. Am I doing it wrong?

I've posted this question elsewhere and got this answer "The object with the boolean modifier needs to have both materials in its material list"
I tried exactly that, first when I make my two objects with separate materials, I make sure the second mesh also lists the material of the other object, even though it is not in use:

then when I request that second mesh to be boolean unified to the other mesh, the result is multicolor:

That object in the screenshot is definitely a single mesh with two materials. So that seems the way to do it.

Well I just learned something new.

Life saver before paper deadline! THank you !!!

nice. but should probably be logged as a blender bug or feature request that it should automatically also merge the materials.

@HarryMcKenzie second this

I just tested this and I did it with textures mapped onto each object.  At first, I though it did not work. One texture was now mapped onto both parts. I clicked to wire frame to see if all internal elements of the ball and cube were removed as they should be in the union-ed object. When I clicked on textured view i got the correct texture on each part as is should be.  After applying the modifier, it looked right in texture view, but had only texture in material view.  My experience is if you want to export the item for something like 3d printing, you need it to look right in material view. The only way I found so far to get this is to be sure one object is fully selected in edit mode and one is not selected. After you apply the modifier, the selected vertex groups are still in that state. That makes it easy to create 2 proper textures in the union-ed product.  If you find an easier way, please share :)


text:
How can I edit a imported animation?
I'm using Blender to create custom TF2 taunts. Basically it is just an animation. I imported the animation and I wanted to change something. I selected pose editing, then copied and pasted the pose, and after about 8 frames changed the animation. The thing is, that I got the change only on one frame. How can I fix that?

Press I to insert/update a keyframe, do this before moving to another position on the timeline. Once pressed, it will give you a choice of what to record. If you have no scaling, use LocRot.

There are different ways to edit, one way is to override the key frame with "I" or right click on a parameter and add/replace key, best way is go to graph-editor (click on down-left side of every view and choose) and select the curve of that animation of object, you can select any key and move to see the effect.


text:
How do you apply a gloss and spec map on one cycles material?
I have never seen anyone apply a gloss and a spec. map in cycles and I would be very interested to see how this is done so I can start using the gloss textures I have from gametextures.com. Some also have a height map which I assume I am supposed to just use on a displacement modifier.

You can use the gloss or spec map as factor when mixing between diffuse and glossy shaders.

I used the 4 images on their pricing page in my demo.
Click for full size

The Albedo Map goes in to the Diffuse node as the base color.
The Specular Map goes in to the Glossy node as the specular color. (metals are one of the few materials that have a colored specular highlight.)
The Gloss Map is used as the mix factor in the Mix Shader node between the diffuse and the glossy.
The Normal Map get plugged in to a Normal Map node then connected to both the diffuse and the glossy nodes.

gloss maps should be inverted and plugged into the roughness input

@SebastiánMestre not necessarily. Granted changing the roughness is a way to make a material less glossy in parts, it is not the only way, nor even the "correct" way. I would suggest you try to make a glossy material, with parts of it not glossy and having a color by just changing the roughness. You will see that you need to "mix" the glossy on top of the diffuse base color.

Gloss maps should be inverted and plugged into the roughness input of glossy shaders.
Specular maps should be plugged into either a mix node factor input or into a glossy shader's color input (if the material is a metal do the later and do the former if it isn't).
Height maps can be plugged into the displacement input of your material output, fed through a bump node or used in a displacement modifier.


text:
I have two edges that intersect, how do I get a vertex at the intersection point?

I tried adding this edge with the knife tool to no avail, it won't add in the desired vertices. Is there any other way to add these vertices and have them connected to both edges like the ones above?
blend file

The knife tool works for me.. Is it possible you could upload your .blend? Also try selecting the end vertices and pressing J.

J didn't work, it had the same affects as F [Here is the .blend file.] (https://dl.dropboxusercontent.com/u/105695273/%25%20Block.blend)

That's very odd. J crashes blender for me, I've reported this as a bug here: https://developer.blender.org/T42513

This is fixed by https://developer.blender.org/rBb7174c9320c5e3446d8237059841d982279e32e9

@ideasman42 That'll teach me to test latest master before reporting.. BTW, IMO the question shouldn't be closed. The crashing was not part of the question, that was just a side effect discovered while attempting an answer. It seems the real problem is that the vertical edges in the OP's file are not connected to the face. Jack Brand: Probably best to delete the edges and then cut with J or knife, or delete the face and the edges and use grid fill.

@gandalf3, your right, too hasty response on my part.

knife tool works for me fine

Currently knife would be good to use. For this particular case, there are some tricks to do it even faster:
Trick 1:

Select all intersected edges, then P > Selection;
Press Space to quickly search for Knife Project tool.
Switch to Object Mode, delete the separated object (edges).

Trick 2:

Select the n-gon face while using Face Select mode, then switch to Vertex Select mode to quickly select related elements (or simply press A to select all elements in this case);
Hit Space to search for Split by Edge tool;
Select the two vertices on that horizontal edge, then press J.

P.S.:
There are some addons that are aimed to split intersecting edges, such as zeffii's X ALL, nixy's Boolean 2D Union, even the powerful Sverchok can handle some situations. they all got pros and cons, however. IMHO, We really need an internal tool to perfectly handle it (something like an enhanced version of the current Split by Edge tool).

Trick 2 works like a charm. X All is also Very very nice. I recommend it in everyones default addons. Thanks a lot Leon, dont know what I would have done without you.

You are welcome. all great tools mentioned above are @ideasman42 (Campbell) 's babies. Let's thank him. :)


text:
How to batch import images as brush textures?
I have a folder with some b&w images that I want to use as brushes textures while sculpting.
Is there a way to automatically load these images as brush textures, or do I have to do it one by one?

There is an addon just for this, Import BrushSet. You can download the addon from here.
After you have it installed, simply click on File > Import > Brush Set.

You have to choose a folder (don't pick any images, just the folder) and the addon will import all the images in that folder and set them up as brush textures. (It would be a good idea to make a separate folder with only the images you want to import)
It's as simple as that.

Also another addon that is similar but supplies a way to determine the fiel location and also enables deleting any brush images not currently in use, clearing the cache is load_alphas at https://github.com/amb/blender-scripts/blob/master/load_alphas.py


text:
3D Sound - no rolloff?
I'm trying to use the rolloff effect in 3D sound, but am having trouble. I have a near sensor which is triggering properly, but no matter where the character stands in my scene, there is no rolloff to the sound -- it's either on or off. Here's the settings. I can't find any decent documentation on this, and the properties don't seem particularly intuitive.
These are my settings:

A more detailed documentation on the 3D sound options you find in the Wiki on Sound Actuator it illustrates the meaning of the cone and all the options.
A older post mentions that 3D sound only works with mono (WAV) files. if this still applies you could convert your sound with a tool like Audacity.
I edited the file from the post mentioned above and needed to adjust some values in order to hear anything and uploaded it here.


text:
Why are objects rendering black even with texture (both cycles and BI)?
I created several objects, applied its material with a texture. When I render the scene it all render nicely except one. It renders black both in cycles and BI. I have tried everything. I don't know whether I have missed something or not But I'm not getting the result properly. What is the solution to this 'rendering black' problem?

Could you add your .blend by using a service like http://www.pasteall.org/blend/

@stacker :Here it is http://www.pasteall.org/blend/29373

What do you think @stacker ? Do you have any idea on this?

@Flare'D you didn't include the textures in the blend file. DO this and Upload again. File -> External Data -> Pack into .blend

The object you uploaded renders fine for me. But you have to make sure that 'Use Nodes' is checked when rendering in Cycles and nodes are unchecked when you switch to Blender Internal renderer. Otherwise you will get a black material in Cycles and nothing in Blender Internal.

@Vader Sorry forgot the textures here you go      http://www.pasteall.org/blend/29374

@maddin45 -Yes , I did those things correctly but still its not working for me

For me I had accidentally set the output to Evee only and that had messed up. The second I set it to all it was working fine for me.

Your UV coordinates are set to the wrong set of coordinates for rendering. Click on the camea icon right of 'UVMap_final' to activate it as the UV map for rendering.

The Viewport and the UV Editor always show the set of UV coordinates selected (the one highlighted blue), but this has not to be the set used for rendering.

What if you don't have a UVMap Final, just a UV Tex, and its camera is on?

That UV map should be the active one. 'UVMap' is the default name of the first UV map. When adding additional UV maps they will be called 'UVMap.001' and so on. You can name the UV maps as you wish. You can change the name of a UV map by [Ctrl]+[LMB] clicking on the name.

Here what I found for my ´black render´ issue: disable Áuto Smooth´

Actually this is another probable cause for a black render. I do not know why someone downvoted it. On a very simple material, even without a texture, it can render black. But probably this issue needs to be looked in deep. It also can be because fliped normals.

That worked for me still in 2019 and Blender 2.80. Needed to import a very complex and unoptimized model from vector works as obj and re-texture it incl. new uv. But certain areas always rendered black although correctly textured. After tunring off autosmooth they rendered correctly.

You can fix it by adding an attribute node to assign the UV map you intent to use:
I made minor changes in the node editor:

I had the same issue, thought the normals were pointing the wrong way. Ended up being silly and forgetting the normal map node. Also dont forget to change color space to non color. ;)


text:
the stuffs i edit disappear in blender
i download a model online, and when i try to edit, i can see the edit that i made but when i change to object view, all of the edit disappear and i have to make another vertices so i can see the edit again (it's not hidden)

as you can see, part of the hair, and the skirt

Are there any mask modifiers?

how can i know?

Looks like you added an edge without a face, that won't show up in object mode.
Other than that, sounds like shape keys.You find them under the green triangle, Object Data Properties

thanks, it was the key


text:
Select edge loop of mesh using python
I would like to select an edge loop on the beginning or end of a bmesh
The selection could be based on height (z axis) and width / depth (X / Y axis)
I made the outer and the inner square with bmesh.ops.create_grid.
I found this article but it does not solve my question
Python select specific edge loop based on diameter and height
I also tried to select vertices using this code
my_verts = [v for v in bm.verts if (50 / 1000) <= v.co.z <= (101 / 1000)]
my_verts1 = [v for v in my_verts if (-5.01 / 1000) <= v.co.x <= (5.01 / 1000)]
my_verts1 = [v for v in my_verts if (-5.01/ 1000) <= v.co.y <= (5.01  / 1000)]

but this method is not really precise and when using vert.link_edges from the selected verts I also get edges that I don't need.
See screenshot
I would like to be able to select the inner edge loop or the outer (Not combined)

After the bevel is done the original edges are dead so i need to make a new selection
The return data of the bevel command contains the edges at the bottom as well as the top and in between.
So to make 1 long question short.
How can I get the edge loops (top or bottom) of the inner grid as well as the edges of the outer grid?
As extra it would be nice to have the edges between the bottom and the top

Please don't delete and re-ask the same question to bump it.  "Anyone who wants to help me with this question?"  Definitely not me. i) I believe my  answer to the linked question goes a long way to answering this.  Add the grid, bevel it,  (as opposed to add circle or cylinder) then extrude.  Seems to be an agenda to posting it.

@batFINGER I would not ask this if your answer would help me. It does not solve my question

ii) glib comments iii) failure to post minimal working code, as you been requested to do by others too,  which without  can lead to this bs.

I already posted minimal working code @batFINGER
Please read the post before commenting failure before posting
And why don't you want to help? Your member here to help others right

I am, but at my choosing.  I enjoy answering questions.  I believe I have helped a lot of people with my answers. There is no script in question that can be  run that adds the model as demonstrated in question. (aka minimal working code)  Read your comments here  re reading post first and commenting failure,  ... what is more important, seems telling me I'm wrong, over an answer.  Anyhoo takes the fun out of it.

Got it  :-)
I will make a new post and post a general template (something every coder should have). this template can be used to quickly reproduce questions asked and at least generate an answer. Why when asking a question does the source code needs to be given away? that's really weird and sometimes due to CR or other stuff not even possible.
Anyway Thanks for your time so far


text:
Liquid / glass interface IOR and normals in Cycles
When modelling / rendering a glass with liquid inside (in Cycles), which direction do the normals for the glass only surfaces, shared glass-liquid surfaces, and liquid only surfaces point? I have looked into this myself but seem to get conflicting answers from different sources. See here for an example.
Also, should each of the surface types mentioned above need a separate material / IOR?

Autodesk has information about these here, but I'm not sure it applies for Cycles / path tracing:
Autodesk, normals and IOR for glass-liquid interfaces
Note that Blender SE has some related questions:
How to illuminate the darkness inside glass objects in Cycles?

The answer seems to be yes. This is a fairly commonly used technique, it works with LuxRender and Yafaray as well.
Here is an example rendered in cycles with the normals and materials setup like the autodesk example:

Air-Glass interface (IOR = $\frac{1.5}{1} = 1.5$)
Air-Liquid interface (IOR = $\frac{1.33}{1} = 1.33$)
Glass-Liquid interface (IOR= $\frac{1.33}{1.5} = 0.8$)

It is evident that in the most common case of an interface with air, the IOR to use is the IOR of the media (since the IOR of air is 1.0), whereas in an interface between two different media, the situation is different.

It seems that the basic thing to keep in mind is that the interface IOR should be equal to:
$$
\frac
{\textrm{IOR of medium with normals facing }\textbf{away}}
{\textrm{IOR of medium with normals facing }\textbf{towards}}
$$
If you set up the normals the other way around, (e.g. here) it is the opposite:
$$
\frac
{\text{IOR of medium with normals facing }\textbf{towards}}
{\text{IOR of medium with normals facing }\textbf{away}}
$$
In the autodesk example, Liquid (with an IOR of 1.33) is divided by Glass (IOR of 1.5), because the normals are facing the Glass medium.

Yes, you do need to use separate materials and IOR values for each surface type.
Assign the materials to the appropriate faces:
The Air to Glass material, the Air to Liquid material, and the Glass to Liquid material:

Pretty cool. How do you handle dynamic interfaces, e.g. sloshing water?

@z0r You could try dynamic paint (see http://blender.stackexchange.com/questions/1837/is-it-possible-to-dynamically-change-object-materals)


text:
How to save the default mode of a custom workspace?
When designing new workspaces, there doesn't seem to be a way to save or define the default mode of that workspace.  You can duplicate one of the presets and go from there, which would work fine... but there isn't a preset for painting Vertices, even though this is one of the selectable modes.
Currently it would seem to be impossible to create a vertex painting workspace.
Is there a way to do this?

Sounds like you want an application template https://docs.blender.org/manual/en/latest/advanced/app_templates.html https://blender.stackexchange.com/questions/152673/new-default-file-template

There is no need for a new template, you can easily set it from the UI

Either from the 3D View Sidebar > Tools tab or from the Properties Window > Active Tool tab there is a workspace panel.
The dropdown menu allows you to define a default workspace mode. After that save the startup file from the File > Defaults > Save Startup File menu entry so it is available next time you start a new session.


text:
Why doesn't my Custom Pie Menu work after restarting Blender?
So I would like to create custom pie menus. I have followed the tutorial by Sebastian Kónig that seems quite popular... but it's as if he leaves out the portion that tells you how to save it and have it work when you restart Blender.
Being an artist and total non-coder I'm not even sure where to start figuring out why it's not working after a restart.
Could someone please explain to me what I need to do to make this work? or perhaps point me to the section of the manual that covers this?
here is the tutorial I followed...   https://vimeo.com/103321600
do I need to check Register? this seems to be greyed out sometimes.. but not others.
Do I need to save the script in a specific location?
Any help would be greatly appreciated :)
cheers
import bpy
from bpy.types import Menu

# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)

class VIEW3D_PIE_template(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Beddalls Pie Menu"
    bl_idname = "mesh.beddallpie"

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

        pie = layout.menu_pie()
        # operator_enum will just spread all available options
        # for the type enum of the operator on the pie
        pie.operator_enum("mesh.select_mode", "type")
        pie.operator("mesh.noise")
        pie.operator("mesh.vertices_smooth")
        pie.operator("transform.vertex_random")

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

    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name="Mesh")
    kmi = km.keymap_items.new("wm.call_menu_pie", "E", "PRESS", shift=True, ctrl=True).properties.name="mesh.beddallpie"

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

if __name__ == "__main__":
    register()

    bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")

I originally didn't include the code as the code works... what doesn't work is having it available once i restart Blender. Everything works fine until i restart... then it's like the script never existed. I'm missing the knowledge that will make the script still work when I restart Blender, and for a non-coder this info seems rather elusive.

If you're asking about code then, ideally, you need to show that code. Use the [edit] link below your question to update your question with your code.

Done. Sorry if it's not in the right format... non-coder here :(

You haven't told Blender yet how to load this code on Startup. Two methods are available:

using the register checkbox you mentioned
turning your code into an Add-on

While the second method might seem more daunting in the beginning, it is the way more flexible way. The first method requires you to rename the Text data block (the tooltip of the register checkbox tells you this) to have a .py extension:

Only when the extension is .py as in the screenshot, registering is available. It then doesn't matter if the Text datablock is a part of the Blend file, or if it is an external text. You can use register and it should load and register when you open a file that contains it. However, that means every time to add that Text datablock to your file, check register, save and reload. It's not exactly nice to work like this.
The Add-on workflow is much more flexible: All you need to do with your code itself is to add an information dictionary that tells Blender hey, I'm an Add-on, offer to load me. It looks like this:
import bpy
from bpy.types import Menu

#    add relevant code to tell Blender that this is an addon
bl_info = {
    "name": "Name of your Addon",
    "author": "Your Name here",
    "version": (1, 0, 0),
    "blender": (2, 75, 0),
    "description": "a more descriptive text of what your addon does",
    "category": "User Interface"
}

This tells Blender what name the Add-on has, who wrote it, where to show it in the Add-on manager, the version of the Add-on and most important the minimum Blender version needed to run it. The rest of your code is identical to what you already had:
#    spawn an edit mode selection pie (run while object is in edit mode to get a valid output)
class VIEW3D_PIE_template(Menu):
    #    label is displayed at the center of the pie menu.
    bl_label = "Beddalls Pie Menu"
    bl_idname = "mesh.beddallpie"

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

        pie = layout.menu_pie()
        #    operator_enum will just spread all available options
        #    for the type enum of the operator on the pie
        pie.operator_enum("mesh.select_mode", "type")
        pie.operator("mesh.noise")
        pie.operator("mesh.vertices_smooth")
        pie.operator("transform.vertex_random")

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

    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name = "Mesh")
    kmi = km.keymap_items.new("wm.call_menu_pie", "E", "PRESS", shift = True, ctrl = True).properties.name = "mesh.beddallpie"

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

if __name__ == "__main__":
    register()

    bpy.ops.wm.call_menu_pie(name = "VIEW3D_PIE_template")

When you save this file (again using a .py extension) into your Add-on folder (see the file path locations here: https://docs.blender.org/manual/en/dev/getting_started/installing/configuration/directories.html), you can - after restarting Blender - enable it in the Add-on manager:

after enabling the checkbox, make sure to also click Save User Settings to always have it enabled on startup. Now, when you continue to work on the Add-on, you can edit this .py file directly. After saving, you can hit F8 to ask Blender to reload all Add-ons, or restart Blender.


text:
animation linked to different skeleton
None of the animations of my goku model in the dota 2 model editor work. In the model editor I can see that there are 2 skeletons. The animations work on one of the skeletons, but that skeleton has no effect on the mesh, so it doesn't do anything.

When I first open the model in blender and then import the animation, the animation works and I have this setup:

But, when I do it the other way around, first import the animation and then the model I get this:

EDIT: attached blender files as mentioned in the comments.
http://pasteall.org/blend/index.php?id=52341
http://pasteall.org/blend/index.php?id=52342

Hard to tell, I think you should upload your file

Hi. Please upload any images using the built-in image uploader as a) this prevents the answer being less clear should external links break and b) this shows the images inline. See: https://meta.stackexchange.com/questions/75491/how-to-upload-an-image-to-a-post

The images were more than 2MB


text:
How can I enable the Laplacian Lightning Generator?
The Laplacian Lightning Generator addon broke with some recent API changes, as reported in this bug.
Attempting to enable it results in this:
Traceback (most recent call last):
  File "/usr/share/blender/2.68/scripts/modules/addon_utils.py", line 294, in enable
    mod = __import__(module_name)
  File "/usr/share/blender/2.68/scripts/addons_contrib/object_laplace_lightning.py", line 117, in <module>
    scn = bpy.context.scene
AttributeError: '_RestrictContext' object has no attribute 'scene'

As it was only some API changes that broke this, I assume (also from looking at the error) that this might be a fairly trivial problem (I'm inexperienced with python, so that might be a false assumption)
Are there a few simple changes I can make to get this addon working?
I know it works to run it in the text editor, however I would like to be able to use it as an addon without having to re run it every time I start blender.

Did you tried to run the script from text-editor, as specified on the website of the link you posted ? --> "UPDATE – 02.14.13 (...) An API change has made the addon not load. It has something to do bpy.scene.context. I’ll look into it when I have a chance. Fortunately the script will still run as a regular script. If you want to use it, just use the .blend file below or just load it in the text editor and hit run"

@Polosson I did try that, and it works :). However I would like to be able to enable it once without having to restart it each time I restart blender. (I forgot to add this to the question originally..)

Read about the API change:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Addons#Restricted_Context
And here I posted an example script to show a possible solution:
http://wiki.blender.org/index.php/Extensions:2.6/Py/API_Changes#Restricted_Context
There's also a hack to circumvent the context restriction:
Add an app handler for the scene_update_post event, let it remove itself and run the initialization code in the body.


text:
Is there a way to remove hair particles in particle edit mode?
Is there some way to fully remove hair particles (e.g. with a brush) while in particle edit mode?
Ideally this would actually remove the particle, instead of e.g. making it tiny with the cut brush. The problem with cutting particles until they are invisible is that they will still affect child particles:

The above example uses interpolated child particles.
Blendfile

Yes, you can select the hair particles and press X or Delete.

To give credit where credit is due, thanks to Dan Eicher for pointing this out on the developer mailing list.

There does not seem to be a brush for doing this, but you can use circle select (C) to select hair particles with a brush.

in particle edit on the side there is comb smooth add length puff cut weight at the top of that list there is none this works like edit mode you can gather vertices and stuff and even delete stuff just click on one and click delete also on the bottom of the screen a little past the global thing there is a particle display mode click on either three and you will have more options to play with in none mode (= hope this helps


text:
What would be the easiest way to do or simulate color cycling for a face?
Is there an easy way to create an color cycle effect like in the image?
I know that this was usually done manipulating index based colors from a palette. Perhaps a texture can be animated, if so how?

Image source http://commons.wikimedia.org/wiki/File:Color_cycling.gif

Is this in Cycles or BI?

@gandalf3 I currently render with BI but an answer that also includes cycles would be nice.

One way would be to animate the texture mapping.

Create an image with the colour gradient you want to use.
UV unwrap your object
Apply the image in the texture panel
Add keyframes for the mapping offset (RMB / insert keyframe).

For cycles the same thing applies - the keyframes can be added in the Mapping node.


text:
Splitting pieces of a mesh into a new object
I've just made a set of armor by using a male body mesh model I downloaded and selecting certain faces from the model and duplicating them to create viable armor pieces.
Since the pieces are just duplicated from the same mesh male model, then it's still part of the same object.
How do I separate the armor piece from the model to make the pieces separate?

Select the object.
Enter edit mode (press ↹ Tab)
Press P> Selection to separate the selection into a new object:

From the manual:

Options

Selected
This option separates the selection to a new object.

By Loose Parts
Separates the mesh in its unconnected parts.
By Material
Creates separate mesh objects for each material.

Note that if there are no disconnected parts of the mesh besides the armor, using the By Loose Parts option might be faster.
Also note that you can select linked geometry by:

Pressing L with your mouse over geometry will select all geometry connected to the element below your cursor.

Pressing CtrlL will select all geometry connected to any selected element(s).

To access the option from a menu use Mesh > Separate

Confusingly, it only exists in: Mesh > Vertices ... even if you're not working with vertices.


text:
How to get the vertices from an edge
I make a selection of specific edges
indices = [442, 443, 444, 445]
edges = [e for e in bm.edges]
ee0 = []
for vert in edges:
    if vert.index in indices:
        ee0 = ee0 + [vert]

No I would like to get the vertices connected to these edges
So I tried
verts = [v for e in ee0 if e.select for v in e.verts]

the result of verts is empty
How can I get the vertices connected to an edge?

The reason why your result is empty is because (and im assuming) your not selecting the vertices
Remove the if e.select
verts = [v for e in ee0 for v in e.verts]

Code edit
To the questioner,  Please ignore this answer.: it is for others who may come across this question / answer after code to get bmesh elements from their indices, or for those like me who cannot see "not nice" code with out suggesting alteration.  Rather than long-commenting added here as an alternate answer.
If we have the indices of vertices  can look them up via bm.verts[index], after calling bm.verts.ensure_lookup_table()  to ensure the indexing.  Similarly for edges and faces.  Need only loop over indices.
[bm.edges[i] for i in edge_indices]

Looping over every vertex and checking if v.index == index or worse if v.index in indices, then appending with verts = verts + [v] (suggest verts.append(v)) is both grossly inefficient and s shown, not required.
Use a set for verts in edges to have only one occurrence of each vert.  There will be same vert added to list for each connected edge in the list comprehension. Cast it back to a list if need be.  list(set(verts))
import bpy
import bmesh

context = bpy.context
ob = context.object
me = ob.data
bm = bmesh.new()
bm.from_mesh(me)

edge_indices = [0, 2, 4]
bm.edges.ensure_lookup_table()

edges = [bm.edges[i] for i in edge_indices]

all_verts_in_edges = set(v for e in edges for v in e.verts)

print(edges)
print(all_verts_in_edges)


text:
New fill - two different meshes
I have removed a face inside one of my meshes, and now I'm trying to create a new one but based on 2 vertices from another mesh. In my tutorial it fills if with "F" key and creates new "quad", but at me it fills whole all area, not just 4 vertices.
May be the reason is that I have a newer Blender version 2.81 while tut version is 2.79(smth). So I can't get a new fill with quad (pictures added). What am I doing wrong or not getting here? Thank you in advance.

Fc.jpg

It looks to me like you are trying to create a face from verts in two separate meshes which won't work. You need to join "inside" and "metal" into a single object, then you should be able to create the face.

That was so obvious )) Thank you.

You can't have vertices, edges or faces across different objects. Different objects need to be joined first. Select both objects and press Ctrl+J
In case you forgot to "join" mashes here is a useful link on how to do it Thanks!

How do you do this if you don't want the meshes joined permanently? Do you have to join the meshes, make the polygon, then reselect the vertices and separate them again?


text:
Why are the light not rendering
The lights are the same on both models but it's not rendering the other one. Im trying to render in eevee.
Here's the blend file https://drive.google.com/file/d/1hn9aGMnDRiOCK2LCi9MmTNJLzxkpdzAh/view?usp=sharing

Any help would be nice

You've hit the maximum lighting limit for Eevee.
The Blender manual here states that

Only 128 active lights can be supported by Eevee in a scene.
Only 8 Shadowed sun lights can be supported at the same time.
As of now, lights can only have one colour and do not support light node trees.

I would suggest moving the duplicate ship over to a separate view layer, then combining the two using the compositor.


text:
2D animation on chrome OS
How do you create a 2D animation using blender on Chrome OS? The tutorials I saw all didn't work, where you go to new file and select 2D animation.

Could you elaborate a little on what step of the tutorial "didn't work" for you? Did you not see the menu item, or was there some other issue?

I can click on new file, but it does not give me an option to create a 2d file. It just gives me another file that is exactly the same.

Try using the File menu in the top left corner. Go to File > New > 2D Animation


text:
Splitting a Character's Body
I've gone crazy to find the solution to my problem, but I can't get anything clear. I want to separate my character's body into parts so I can hide them in the Unity project I work on. But some lines appear in the cuts that I have made in the character that are also seen in Unity. I asked Unity about the subject, and one answered me, saying something about what I have to preserve the normal ones before cutting, this way the cuts will not be noticed. Is there this function or similar in blender2.8? Is there any other method?

When you split a smooth shaded object, the normals are recalculated. Their direction is depending on the vertex before and the one after each vertex. If you take the vertex "after" out of the equasion, the normals at the very edge will be modified. Hence the lighting will be treated differently exactly where the split has occured (which is what you are seeing).
The ppl. in the Unity forums were correct, however I am unaware of a method of splitting an object directly and keeping the normals at the split.
Using multiple materials (can be the same material in multiple slots) does pretty much that, but internally, not visibly.
So a crude approach could be to hide submeshes in Unity.
Have not tried this, since most ppl. don't split naked characters, but rather hide the seams, but:
Split your object by material slots (assigning them to the faces in edit mode).
In Unity use:
myMesh.GetTriangles(mySubmeshIndex);
to show only the triangles that belong to the body part.
There might be a better solution, but not one I can think of right now.

Just to add to this answer, there is a way for this to be done in Blender. I know that the Data Transfer modifier in Blender can be used to smooth out the joining between distinct objects, but unfortunately, I am not familiar enough with it to provide you with a full walkthrough of how to use it.

I have tried to use the Data Transfer modifier, and it worked totally and absolutely perfectly, I attached a video of a boy who explains quite well all the modifiers of Blender and precisely talks about this.
https://youtu.be/z-SG_DcJF5I?t=160


text:
How to change texture setting of displacement?
I've upgraded to 2.82 and found that something in the shading tab has changed. I can't find the displacement settings.

so that all my displacement becomes 'bump only', how can I fix this?
I don't quite know if this is caused by a plugin.
here's all plugin I have:

You have to switch your render engine to "Cycles" in the render properties. True displacement is not available with Eeevee (yet?).


text:
Baking Textures as Image Sequence by Script in Cycles
Related to this: Baking textures on headless machine (batch baking)
Is there a way to batch the baking of textures over all frames? I have an animation and since the light is changing at each frame, would like to bake out the texture of each frame into an image sequence.

I've set my render mode to cycles
I've added a Image Texture Node and have it set to image sequence
My UV is unwrapped to the image sequence

If I put this in console, I can bake one frame to the sequence:
bpy.data.objects["Cube"].select = True
bpy.context.scene.frame_current = 1
bpy.ops.object.bake(type='COMBINED')

Similarly, I can bake another frame:
bpy.data.objects["Cube"].select = True
bpy.context.scene.frame_current = 2
bpy.ops.object.bake(type='COMBINED')

However, when I try to put this in a for loop to bake multiple frames like this:
for i in range(1,30):
     bpy.context.scene.frame_current = i
     bpy.data.objects["Cube"].select = True
     bpy.ops.object.bake(type='COMBINED')

It will only bake the texture of the first frame in the loop. It appears like it is looping through all the frames and it is baking them, but the images in those frames do not get updated once the script is finished. Any ideas on what is happening?

Try to call Scene.frame_set() instead of  Scene.frame_current, same here: http://blender.stackexchange.com/questions/27579/render-specific-frames-with-opengl-via-python/27640#27640

Since 'Animation Baking' is now officially supported by this Add-on (shipped with Blender by default), you can simply call bpy.ops.object.anim_bake_image() for a sequence:
import bpy

scn = bpy.context.scene
scn.animrenderbake_start = 3
scn.animrenderbake_end = 30
bpy.ops.object.anim_bake_image('INVOKE_DEFAULT')

The following script is a slightly modified version of the Add-on in order to bake specific frames (for demonstration purposes). To bake all frames (or a custom range) use the range() function.
import bpy
import os
import shutil

# set the frames to bake
bake_frames = [0, 230, 99]

# format frame number
def framefile(filepath, frame):
    fn, ext = os.path.splitext(filepath)
    return "%s_%04d%s" % (fn, frame, ext)

# scene attributes
context = bpy.context
is_cycles = (context.scene.render.engine == 'CYCLES')
selected = context.selected_objects
img = None

# inspect the materials
if is_cycles:
    inactive = None
    selected = None
    for mat_slot in context.active_object.material_slots:
        mat = mat_slot.material
        if not mat or not mat.node_tree:
            continue
        trees = [mat.node_tree]
        while trees and not img:
            tree = trees.pop()
            node = tree.nodes.active
            if node.type in {'TEX_IMAGE', 'TEX_ENVIRONMENT'}:
                img = node.image
                break
            for node in tree.nodes:
                if node.type in {'TEX_IMAGE', 'TEX_ENVIRONMENT'} and node.image:
                    if node.select:
                        if not selected:
                            selected = node
                    else:
                        if not inactive:
                            inactive = node
                elif node.type == 'GROUP':
                    trees.add(node.node_tree)
        if img:
            break
    if not img:
        if selected:
            img = selected.image
        elif inactive:
            img = inactive.image
else:
    for uvtex in context.active_object.data.uv_textures:
        if uvtex.active_render == True:
            for uvdata in uvtex.data:
                if uvdata.image is not None:
                    img = uvdata.image
                    break

# convert the path to absolute path
img_filepath_abs = bpy.path.abspath(img.filepath, library=img.library)

# iterate through the frame list
for f in bake_frames:
    print("Baking frame %d" % f)

    # set the frame
    context.scene.frame_set(f)

    # cycles bake
    if is_cycles:
        bpy.ops.object.bake()

    # internal bake
    else:
        bpy.ops.object.bake_image()

    # save the image
    img.save()
    img_filepath_new = framefile(img_filepath_abs, f)

    # copy the image
    shutil.copyfile(img_filepath_abs, img_filepath_new)
    print("Saved %r" % img_filepath_new)

How to make it work with image selection? If I use images without sequence it just bakes the first frame.

Don't get it, sorry @Denis. The addon basically bakes an image for every frame in the timeline (per object), so what do you mean by images without a sequence? Can you elaborate on what are you trying to do?

I have images that are named differently without suffixes 001 002 etc.., so if I load them as a sequence only the first image is baked since the next image has a different name.

And those images you'd like to plug into a shader via Image Texture node to get another image every frame, right? If yes, I think that's not supported, the node only accepts a sequence. Why you can't just rename the images into a real sequence with any batch-rename tool like MuCommander or even TotalCommander? Otherwise you need to tell blender which image to load at frame X or frame Y into the node via scripting and some handler or something. I think that isn't really worth it @Denis

I have a lot of images and many of them look very similar and I need the names so they dont get confused, ideally I would need the image file name to be added as a suffix or prefix of baked texture file name, but at least I need the baked textures to have the same order as the images.

With the tools I've mentioned, you can sort by date, name or whatever and just append the digits at the end of the filename, see: https://i.sstatic.net/SbN25.jpg (TotalCommander, sorted by date, 4 digits). Does this help @Denis?

I have tried it, adding a suffix to the names doesnt make the images recognizable as a sequence.

Appears to be not supported as well. Here you can find a quick'n dirty frame handler, which allows to exchange the filepath of an image texture node based on a given folder per frame. For now, you need to set the name of your material, the name of your Image texture node and the path to your image folder to make it work. I can't test the baking, since I've got no bake setup at the moment. However it's working fine for me in cycles preview so  can you test it in combination with the Anim-Bake-Addon? @Denis

I've tested the script in combination with the Addon and it works as expected. Make sure you've got the second (empty) Image Texture node selected before running "Animated Bake" otherwise it's gonna overwrite the image (sure you know that already) @Denis

Had a bit time today and converted that into a real addon, which you can find here. Once it's enabled, you'll find a new panel in the misc area of the node editor's tool shelf, if you select any Image Texture node: https://i.sstatic.net/QiuDN.jpg In case you want to get the same output file names after baking, we need to modify the other addon. Hope that helps, any feedback is appreciated @Denis

I think I'm done, updated the addon here. It's a full replacement of Animated Render Baker now. Just disable the old one and install our new 'Sequence Bakery' addon. The addon now allows to bake a sequence like before as well as overriding the filepath of any Image Texture node. If "Override Image Path" is enabled when baking, the filename will be assembled by the original path and the current frame number. You can also find some instructions at the top of the py file to set it up properly. Anyway, does that help @Denis ?

Used it for a project today and I think it works quite ok. I'd still appreciate any feedback...? @Denis

Sorry for the late reply, I to cancel this job because I couldn't make it on time, the problem is that with cycles the baking is too slow, I couldn't bake just the textures and it didn't work with internal render engine.

No problem, just curious @Denis

how did this project go? I want to do something similar but basicly batch process the baked images for a specific style.

Apparently the animation baking add-on is no longer in blender (at least in version 3.5).
Is there a third party add-on that does this?

Have you already tried: https://gist.github.com/p2or/43194fcab3f42bab9b70ff1cc2b7637a ? @AlexandreMarcati

No, but I actually resolved my issue with a different workflow: I use geometry nodes to unwrap and flatten the actual geometry of the object according to the UV map, then I just render it out from a perpendicular camera. It doesn't solve for every situation but for what I needed it did the trick.

Didn't embark on using solution above so if someone might find use in this, for me at least simpler approach, tho above one seems detailed and generalized I assume but I don't know, so here you go
As I would standardly do, after selecting object and Image Texture in material (not connected texture or it really doesn't matter) instead of clicking Bake in Cycles option
I run script now for EMIT option, you can switch to COMBINED or whichever one you'd want I assume ("Untitled.004" is image I created before that is in Image Texture) and ofc u can switch the path from the mentioned one:
import bpy

for i in range(1, 151):
    for object in bpy.context.selected_objects:
        bpy.context.scene.frame_set(i)
        bpy.ops.object.bake(type='EMIT')
        name='C:\\path'+'textureemission'+str(i)+'.png'
        bpy.data.images["Untitled.004"].save(filepath=name)


text:
preview image sequence composite
I'm compositing an image sequence in blender, and would like to preview it while working.
image editor shows only a still image, and I don't want to export every time I wish to preview.
Is it possible to preview an image sequence while working (like after effect's ram preview?)

I'm not sure what you mean.. Do you want the image sequence to update the displayed frame on frame changes?

@gandalf3 I think he wants to playback the image sequence he is compositing without having to render to disk everytime he wants a preview. See http://blender.stackexchange.com/a/3385/12.

Possible duplicate of While compositing, RenderLayer doesn't move with time. For a somewhat faster alternative than your current workflow, see Can the compositor be used to batch process images?.

You can buffer in RAM by adding the scene strip (that contains the comp) to a VSE timeline, Then in Timeline (not VSE) turn Playback button to No Sync. After a play through Blender has buffered and will continue to play at full frame rate. If it continues to stutter along reduce the VSE scene resolution or increase your VSE memory buffer in User Prefs.

In the VSE preview window that the cube appears in press N for Properties and deselect the OpenGL Render. You should see the compositor output. If not, go back to the VSE window and press the Refresh Sequencer Button.

you're awesome! thank you so much! just made my life a whole lot easier :)

Set up the VSE and add the compositor scene as a trip. This will buffer if you play back with AV sync set to off in the timeline. After playing once the rendered RAM buffered animation will playback at full speed. You can run out of memory this way, increase the Sequencer memory in User Prefs. And you can reduce the VSE scene scale to render smaller frames.

how do I add the compositor scene as a strip, I can only choose the scene from the viewport or import footage. (the scene was rendered in maya, so only the image sequence is present on my blend file.

Open the VSE, you can use the same scene as the the compositor if you wish. Make sure that the scene properties allow Compositing and the VSE for Post Processing.Place your timeline indicator (the play bar) at the start and press Shift A to add media. Select Scene > Scene (name of comp scene). Blender will drop the scene as a strip on your VSE timeline.

thanks for the elaborate explanation.
I'm probably doing something wrong though.
when I add a new strip-> scene all I'm seeing is the default cube from my 3d view and not the compositor
(image for example) http://i265.photobucket.com/albums/ii201/cymps/CompositorPreview.png


text:
Uniform wall thickness for a 3D print
I have high quality scans of my leg, I am trying to print a 1/4" thick shell for it.  I assumed it would be something with the extrude function, but I cannot figure it out.  Anyone have a little walk through or willing to explain the steps to a complete newb?
Basically, I want the outside of my scan mesh to become the inside of my print model, with uniform thickness all around my calf and under my foot.
Many thanks for any help you can offer.

Instead of using the extrude function, try using the Solidify modifier on the object and play with the settings.


text:
Historical city reconstruction workflow
I'm doing some historical research and I would like to visualize a situation from the past.
I have several questions, I would like to make this topic a source for tips & hints when recreating e.g. cities.

I've seen that it is possible to create a surface from Google Earth with Sketchup. Is something similar possible with Blender? I need correct geo. reference and heights.
Via Solid Edge ST6 I can easily use a measurement tool when creating my model. (e.g. https://www.youtube.com/watch?v=GI8QE5A2fWY ) Is something similar available for Blender?
Some models I need on my map need to have correct sizes.
In general, how do you best organize a large scene?
at the beginning I just want to add basic shapes (e.g. cubes) to show the buildings. If I later want to update these buildings or add more detail to an existing building. What is the best way to work?

You have asked three different question here, stack exchange's format is 1 question per question. You can find information about your organization question here.

sometimes it is better to combine them, like on stackoverflow

You could try to export from OpenStreetMap
How to model effectively using exact measurements?
It depends on what you want to achieve (should be another question) you could use layers and groups.
For buildings in the background adding textures should be sufficient for close up I would refine the geometry and add more materials. Related: Trying to create a script that makes roofs on selected boxes

Imported .osm after extrusion (Note that exporting a whole city leads to 2GB files which can't be loaded in Blender)

For some cities 360° images are available from Google street view / maps view which help to elaborate on building details and estimate their age.

Check this awesome tutorial Blender tutorial: How to Create a City

Does OSM export terrain height?  BTW, I was about to link the exact same tutorial! :)

@PGmath OSM has no height information one must extrude the mesh manually.

I really would need the terrain height, any other idea?

@juFo You could add the topography layer to google maps e.g. https://www.google.com/maps/@34.0637852,-118.8153084,16z/data=!5m1!1e4

@stacker 360cities.net is another good spot for city panoramas.

@stacker hmm how exactly can I combine that? (tutorial?) :s

@juFo You can't combine that, just ideas on where you could get additional information about building heights, age, facade design, architecturally patterns, materials etc.

I wonder if this still works: https://www.youtube.com/watch?v=A-OfeO7H0Mk hmmm

@juFo great idea, check it out and report here

@stacker i'm looking at this tutorial now: https://www.youtube.com/watch?v=k2mCCZvlLjs I now have GeoTiff format but not sure if blender can import this. (really new to this)


text:
how to set musgrave to get something periodic?
I would like to know if it's possible to get something periodic only through the parameters of the musgrave node with cycles.
sorry if my question isn't clear, here is an example of what I'm doing:

the brick texture node is periodic, I mean f(0)=f(2*pi) while the Musgrave texture gives something with a discontinuity. Honestly I don't think it's possible to solve this problem trough musgrave node in general case, because I guess it uses a pseudo random generator and when you code a such thing you search to avoid periodicity.

Images as to what you mean by periodic in this context would help.

What are you meaning by periodic?

musgrave at x must be equal at x+L for any x value and for one L given.

What part of the musgrave? If it is the output then you should be able to use a math node set to add. Then add musgrave and L.

@bob-Masterofblackmagic Add some more specifics to the question, an image of what you want or whatever you have tried would also be useful.

Actually the brick isn't periodic, you can simply test more to prove that. It's true that precedural textures can be seamless. However, "seamless" doesn't 100% mean "tileable", or f(0)=f(2*pi) as you described. Besides, you were using Radical gradient. For a tileable image texture, fine, feel free to use it. But obviously it will not work for prcedurals in most case.

@LeonCheung (sorry for the deal I was busy all the last days...) I said the brick are periodics  because I consider the result not the settings, the reason is quite obvious, f(0) and f(2pi) fall in the mortar.

The reason for the 'join' in the resultant texture is due to the discontinuities (edges) in the mapping into texture space and the solution is to change your mapping to join the edges to make the musgrave continuous. In order to visualise this, consider how the polar coordinates are currently being mapped into texture space.
The polar mapping can be considered as having the following marked boundaries (ABCD) :

In 'texture space' the marked boundaries map to the edges of a square (or rectangular) region as follows :

Note how the point A in the radial texture maps to the edge A in texture space - effectively compressing the texture down to a point in the centre. Edge B is stretched around the circumference while C and D are at the discontinuity of the texture and correspond to opposite edges of the plane in texture space.
The discontinuity is caused by edges C and D not corresponding to the same region in texture space. Therefore, the solution is to change the mapping to wrap those edges around so that they do coincide - ie, change the mapping in texture space to a cylinder rather than a plane :

Now, crosing the C-D boundary in polar coordinates does not produce a discontinuity since the C-D boundary in texture space correspond to the same region.
To achieve this was can use the following nodes :

This takes the output from the Radial texture (which varies from 0.0 to 1.0 as the coordinate moves around the centre) and converts it to Y/Z coordinates around the circumference of the cylinder in texture space shown in the above diagram. Note that since 0.0 and 1.0 map to the same location the mapping becomes cyclic, thereby hiding the join.
To make this more versatile we can add in two offsets - one to offset along the axis of the cylinder (to allow the texture to be animated into/out-of the centre) and one to offset the 'rotation' - and one to adjust the radius of the cylinder, controlling the density of the texure around the centre point to produce the following material :

One limitation of using a Gradient texture is that the output is always between the range 0.0 and 1.0 - beyond a certain distance the output does not change. To address this we can simply replace the Gradient with maths nodes to calculate the distance directly (ie, sqrt(x^2 + y^2)).

This can produce the following result :

Blend file included

Your explanation about the texture space is very interesting. Thank you!

Ah coool! Scrapbook worthy!


text:
Why are my videos rendering in black and white?
I am making an animation and when I render the animation, it turns out black and white.
I have no idea why this is happening.

Is the output set to BW in render settings > output? Do you have any composite nodes?

I do not have any composite nodes @gandalf3  I will see about the render settings.  Thanks for the quick response

Yes it seems that it is set to BW @gandalf3

Sounds like the output might be set to BW in Render settings > Output. Make sure it is set to RGB instead (or RGBA if you need the alpha channel):

Thanks for the answer.  It worked!  I wasn't expecting such a quick response.  Thanks


text:
How to model an irregular object made of tubes?
How can I model this irregular curved torus shape that is in the back of this dolly? I know how to cut apart a torus but I think what I need is for a torus to be extruded along a curve line.

Hi, this site works best when you ask one question at a time. I would say "How to connect a cylinder to a plane" and "How to model complex curved objects" are two separate questions.

Objects that are made out of tubes can be modelled with curve objects.

Shift+A> Curve> Bezier
On the curve properties make the curve fill type 'full' and set the Bevel depth and resolution to increase the diameter of the tube and the smoothness of it:

The curve on the left is what it looks like after adding it and editing it's shape in edit mode. The curve on the right is after the above settings have been applied.

You can extrude this curve and edit it similarly to how you would edit a mesh, using scaling, rotating and moving to manipulate the curve handles.
If at some point you want it to be a mesh you can select the curve and choose Alt+C> Mesh from Curve

+1 The moment I saw the question, bezier curve tubing was my immediate thought. Great minds think alike.


text:
Baking normal map from a cycles shader with normals
I have a cycles material (diffuse shader) with a procedural normal map on it, which renders as expected in Cycles. But if I bake the normal map it outputs a flat image (0.5, 0.5, 1.0).
I've tried Bake from Selected with a normal mapped material and that doesn't work either.
How do I bake a normal mapped material into a normal map?

http://www.blenderartists.org/forum/showthread.php?348799-Baking-Cycles-Procedural-Normals-to-Texture Here's the node setup, BTW. And it works very well for me.

Use the displacement input of the material output node...

An obvious hack which, however, does seem to work well:

Connect the color output of your procedural normal map, that you would normally feed into Normal Map node to Emission node which has Strength set to 1
Connect Emission output of the node to Surface of Material Output
Bake Emit

This bakes the normal map in Object Space, but most normal maps are in tangent space.

This is currently not possible. But:
You can use your procedural texture (as long as the output is only black and white values) and plug it in the displacement slot of the shader output. You need to twig the values to your desired height for example with a color ramp. The cycles baking is able to render this to the normal map.

I do not think this answers the question.

Blender internal can use GLSL for baking so you can bake normal as well as black and white bump maps from one object to another. As long as the bump map texture is attached to the material of the source object it will work. As yet cycles can't so you can only bake actual geometry with cycles. If you want to use normal or bumps as a source for baking you need to use BI.


text:
How do I change the track object of an Edit Object actuator?
I wrote a script to change an Edit Object actuator track object based on which object it is near.
Here is the script, pretty much straight off the template:
import bge

def main():

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

    sens = cont.sensors['NearBad']
    actu = cont.actuators['Attack']

    if sens.positive:
        actu.track_object = sens.hitObject
        cont.activate(actu)

    else:
        cont.deactivate(actu)

main()

The actu.track_object = sens.hitObject is the line in question.
I wrote that based on what I think it should be, but what is the right syntax? How do I really do that?
Disclaimer: Although I work with BGE all the time, I have no coding experience at all.

Edit Object Actuator
The way you change an Edit Object actuator's object to track is with object.
Here is what the if statement section of your code looks like.
if sens.positive:
    actu.object = sens.hitObject
    cont.activate(actu)

Steering Actuator
The way you change the Steering Actuator's object to track is with target.
Here is what the if statement section of your code looks like.
if sens.positive:
    actu.target = sens.hitObject
    cont.activate(actu)

I initially thought you were using a different actuator (Steering) that is why both methods are listed.


text:
Create Randomized levels in BGE
Right now I'm working on a random dungeon generator. In the game so far, I can  randomize the placement of a ton of cubes. how can is get them to respond to each-other so they know if there are other cubes in a certain direction?
That doesn't make sense, so lets say it like this. A cube has four sides, and four diagonals, so essentially, there are up to 8 spaces around that cube. How can I sense when there are neighboring cubes and if so, which spot(s) they occupy? Here's my BA thread http://blenderartists.org/forum/showthread.php?381600-Randomized-dungeon
I pulled this snippet from nines, who's helped me a ton, but I don't understand it. if this could be explained and it works for my situation I will accept that as an answer also.
def check_neighbors(self, x,y):
        num = 0
        #check cardinal neighbors
        if self.isValid(x,y+1):
            if self.map[x][y+1].block:
                num += 1

        if self.isValid(x,y-1):
            if self.map[x][y-1].block:
                num += 1

        if self.isValid(x-1,y):
            if self.map[x-1][y].block:
                num += 1

        if self.isValid(x+1,y):
            if self.map[x+1][y].block:
                num += 1

        #check diagonals too! Diagonal neighbors = instant fail
        '''
        if self.isValid(x+1,y+1):
            if self.map[x+1][y+1].block:
                num = 0

        if self.isValid(x-1,y+1):
            if self.map[x-1][y+1].block:
                num = 0

        if self.isValid(x+1,y-1):
            if self.map[x+1][y-1].block:
                num = 0

        if self.isValid(x-1,y-1):
            if self.map[x-1][y-1].block:
                num = 0
        '''
        return num

NOTE: that code says diagonals are not accepted I want to be able to sense and exploit diagonals also!!!

What he descripes is basically a bit mask for each tile. For n,e,s,w you assign 4 bits. If you need more directions - ne,nw,se,sw you need 4 more bits and so on. E.g. 10100001 means neighbors in n,s and sw. In this example n is represented by the highest bit (128), south (32) and sw(1). Of course you could do even easier and represent the map by an 2 dimensional array and just check the indices around the location you are interested in (like image processing).

Yes, but my question is how to do that. how can cubes sense their neighbors?

Cubes do not sense other objects. Sensors can do that. The above example assumes your game model is Python data structure (list of lists). The processing runs on that model rather than in 3D space. If you want it in 3D space you can for example check with a ray is there is an detectable object or not.


text:
Why can I not save any files with Blender 2.8
When I try to save files I just get message
Can not open file C:...\testi.blend@ for writing. No such file or directory.
What went wrong?

Seems like a rights issue. Try opening blender as admin.

No such file usually means that some directory along the path either doesn't exist, or is write protected against you. To check this, in the file manager, right click on the  directory and select properties. If the read-only flag is checked, or the 'security' tab shows you don't have read permission you will get this error.

I have seen similar problems (with other software) if the path contains odd characters or even spaces. IF this is the case this should be considered to be a bug and therefore be reported.

Opening any non system level software as admin or root should never be the solution.


text:
wrap STL around a cyclinder
Is it possible to wrap an STL around a cylinder in Blender using one of the deforms?
E.g. is it possible to wrap this STL
https://www.thingiverse.com/thing:651829
around a cylinder to create a face mug?
(I was thinking of using a wave deform one wavelength long and then splitting the STL, inverting one half of the wave and rejoining it with the other half of the wave deformed STL, but that would not result in a circular shape.)
Thanks

https://blender.stackexchange.com/questions/6226/whats-the-simplest-way-to-wrap-extruded-text-around-a-cylinder and https://blender.stackexchange.com/questions/44758/emboss-text-onto-curved-surface/ and https://blender.stackexchange.com/questions/42131/modelling-a-spiral-around-a-sphere and https://blender.stackexchange.com/questions/52904/wrap-curve-around-sphere

Consider a

Curve modifier with a NURBS Circle.
Simple Deform modifier with Bend Selected

After importing the .STL into Blender...
Create a lattice scaled and positioned to contain the object to be deformed, and adjust the lattice UVW values to give it enough control density. (UVW is under object properties specific to a lattice.) Then give the object to be deformed a lattice modifier. Now go back to the lattice, and give it a simple-deform bend modifier. You may also want to use an empty as the reference point for the bend, as that can provide more control.
The intermediate lattice gives more control at preserving volume than the simple deform modifier alone. You can move lattice cage points in edit mode, and it'll affect deformation prior to the simple deform modifier which is applied to the lattice. That in turn should help with controlling how the deformation is applied.
Thus you should be able to adjust your object with those things in reference to a cylinder mesh.
Now you should be able to export that back out, and toggle the check in export settings for modifiers to be applied before export.
If for some reason the lattice doesn't deform strongly enough or has some issue of the object falling out of the lattice bounds, then it may also be worth looking into the mesh-deform modifier as an alternate. It works in a similar way to the lattice modifier but with a bind system, so shifting the control mesh after binding doesn't present some issues of boundaries that the lattice will.


text:
How should I update a script to 2.8 that uses the removed 'scene_update_pre' handler?
so I'm having trouble with this script:
import bpy
import mathutils

cam = bpy.context.scene.objects['Camera']
obj = bpy.context.scene.objects['Cube']

def drive_shapekey(scene):
    obj_mat = cam.matrix_world.inverted() * obj.matrix_world

    obj_eul = obj_mat.to_euler('XYZ')
    cam_vec = obj_mat.to_translation().normalized()
    obj_vec = mathutils.Vector((0.0, 1.0, 0.0))
    obj_vec.rotate(obj_eul)
    difference = cam_vec.dot(obj_vec)

    key1 = obj.data.shape_keys.key_blocks["Key 1"]
    key1.value = difference

pre_handlers = bpy.app.handlers.scene_update_pre
[pre_handlers.remove(h) for h in pre_handlers if h.__name__ == "drive_shapekey"]
pre_handlers.append(drive_shapekey)

It's supposed to change a shapekey ("Key 1") value, based on the angle and position of a Camera relative to the position and angle of the Object possessing this shapekey.
Of course I have named all objects and shapekeys accordingly (at least I'm pretty darn sure).
It does not run in 2.8 Eevee (didn't test cycles). The error I get is:

'bpy.app.handlers' object has no attribute 'scene_update_pre'

Which I looked up on google ofc, and apparently a number of commands from 2.79 don't work in 2.8 anymore, including some in this script.
So this thread talks about using the new commands instead. Apparently I am supposed to use the dependency graph instead of this bpy...sceneupdate-thingy.
I've never written anything in Python before and I have no clue about most of the code (apart from obvious stuff like the matrices and that def probably stands for definition or define.).
If someone could fix this script for me, I would be very happy. An explanation would be great, too, but don't waste your breath if you have better things to do. I just need it to work. Thanks in advance. :)

There are two thing that need to be updated:

Matrix multiplication is now written using @
bpy.app.handlers.depsgraph_update_pre should be used as handler

Unless I've missed something, this should be all the changes that are necessary.

import bpy
import mathutils

cam = bpy.context.scene.objects['Camera']
obj = bpy.context.scene.objects['Cube']

def drive_shapekey(scene):
    obj_mat = cam.matrix_world.inverted() @ obj.matrix_world

    obj_eul = obj_mat.to_euler('XYZ')
    cam_vec = obj_mat.to_translation().normalized()
    obj_vec = mathutils.Vector((0.0, 1.0, 0.0))
    obj_vec.rotate(obj_eul)
    difference = cam_vec.dot(obj_vec)

    key1 = obj.data.shape_keys.key_blocks["Key 1"]
    key1.value = difference

pre_handlers = bpy.app.handlers.depsgraph_update_pre
[pre_handlers.remove(h) for h in pre_handlers if h.__name__ == "drive_shapekey"]
pre_handlers.append(drive_shapekey)