text:
How to get all hidden objects by script?
I selected some objects in outliner, all of them are hidden. Now I want to know how to get these objects?
I tried using bpy.context.selected_objects , but it prints an empty array [].
I know I can use bpy.context.object to get one object, but I don’t know if there is a way to get all hidden objects？

You can use https://docs.blender.org/api/current/bpy.context.html#bpy.context.selected_ids but it's only available in the context of the outliner. (your button must be clicked in the outliner)

@Gorgious thanks!

context.selected_objects and context.selectable_objects return only objects that are visible in viewport because an invisible object is no longer valid as selected in the data, even if it´s marked darker in the Outliner.
When a selected object is made invisible (hidden or disabled) and switched visible again, it seems to be selected in Outliner but the yellow (selection) border in the 3DView is missing. The object can´t be modified (e.g. hold, rotate, scale) until it has been reselected.
In Outliner there are two ways to make an object invisible:
Hide in Viewport (Symbol Eye) and
Disable in Viewports (Symbol Monitor - filter disabled by default)
Note that 'Hide in Viewport' (Eye) is an attribute of LayerCollection and 'Disable in Viewports' (Monitor) an attribute of (Data)Collection.
See the first two entries here: link
There are different ways to get invisible, hidden or disabled objects, depending on what is desired:
import bpy

# get invisible objs (hidden or disabled) by different of context.visible_objects
invisible_objs = [o for o in bpy.data.objects if not o in bpy.context.visible_objects]
print("invisible (eye or monitor):", invisible_objs)

# get hidden objs by viewlayer.objects
hidden_objs = [o for o in bpy.context.view_layer.objects if o.hide_get() is True]
print("hidden (eye):", hidden_objs)

# get disabled objs by data.objects
disabled_objs = [o for o in bpy.data.objects if o.hide_viewport == True]
print("disabled (monitor):", disabled_objs)

I haven't tested this one out, but how about selecting all objects in the scene, and then only keep objects with state set to hidden?
import bpy
# get all objects
all_objects = bpy.data.objects[:]

# keep only objects that are hidden
hidden_objects = [obj for obj in all_objects if obj.hide_viewport == True]

In case anyone is still struggling with this, this is the solution I got in Blender 4.0.
It is used for hidden objects, collections and any other object selected in the context of the outliner.
import bpy

def getSelectedObjects():
    '''Returns all the selected objects, included the hidden ones'''

    selectedObjects = []

    screen = bpy.context.screen
    areas = [area for area in screen.areas if area.type == 'OUTLINER']
    regions = [region for region in areas[0].regions if region.type == 'WINDOW']

    with bpy.context.temp_override(area=areas[0], region=regions[0], screen=screen):
        for obj in bpy.context.selected_ids:
            selectedObjects.append(obj.name)

    return selectedObjects

print(getSelectedObjects())

I figured out how to get all selected objects, whether they are hidden or not.
def GetAllSelectedObjects():
    visibles = bpy.context.visible_objects
    bpy.ops.object.hide_view_clear()
    selecteds = bpy.context.selected_objects
    for o in bpy.data.objects:
        if not o in visibles:
            o.hide_set(True)
    return selecteds


text:
How to tear a cloth with an object?
How do I tear this cloth with an object like suzanne the monkey? I tried using a boolean but it did not work. Any suggestions?
Blender file

Cloth modifier should have options for tearing

This is typically a cloth simulation, but with a trick:

Create the cloth with some subdivision. For the extremities create a vertex group and call it "pin".

Add a cloth simulation to it.
Change few parameters, like quality steps, tension, bending, and set the pin vertex group as pin group (in the "shape" part):

Create a second vertex group for the tearing part and move the vertices around for a better effect:

Create a geometry node modifier, that will remove the tearing part when its position is above X > 1.

Duplicate the cloth modifier so that the modifier stack looks like this (cloth modifier repeated after the gn modifier):

Animate Suzan (which is a collision object).

OK but he's talking about tearing

ok... google translate...google translate... ; )

source: Stack Exchange

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

sort: votes


text:
Why doesn't this Blender addon show the desired panel?
this is the code:
class psg_Panel(bpy.types.Panel):
    bl_label = "Product scene panel"
    bl_idname = "OBJECT_PT_PSG"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "Product scene generator"

    b_color: bpy.props.FloatVectorProperty(
        name="Ball element Color",
        subtype="COLOR",
        default=(1.0, 1.0, 1.0),
        min=0.0,
        max=1.0
    )

    c_color: bpy.props.FloatVectorProperty(
        name="Platform Color",
        subtype="COLOR_GAMMA",
        size=4,
        default=(1.0, 1.0, 1.0,1.0),
        min=0.0,
        max=1.0
    )

    bg_color: bpy.props.FloatVectorProperty(
        name="Background Color",
        subtype="COLOR_GAMMA",
        size=4,
        default=(1.0, 1.0, 1.0,1.0),
        min=0.0,
        max=1.0
    )

    b_rad: bpy.props.FloatProperty(
        name="ball radius",
    )

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.label(text="Product scene generator", icon='WORLD_DATA')
        row = layout.row()
        row.prop(self, "b_rad")
        row = layout.row()
        row.operator("object.pro_scene_gen")

I tried it for b_rad and each colour but nothing except the button appear rest the whole addon is working properly with no error.

Hello. Panels can't hold custom properties. They're purely UI things. You may want to add a custom property to the current scene for example

import bpy
from bpy.types import Panel, PropertyGroup
from bpy.props import *

class OBJECT_PG_PSG(PropertyGroup):

    b_color: FloatVectorProperty(
        name="Ball element Color",
        subtype="COLOR",
        default=(1.0, 1.0, 1.0),
        min=0.0,
        max=1.0
    )

    c_color: FloatVectorProperty(
        name="Platform Color",
        subtype="COLOR_GAMMA",
        size=4,
        default=(1.0, 1.0, 1.0,1.0),
        min=0.0,
        max=1.0
    )

    bg_color: FloatVectorProperty(
        name="Background Color",
        subtype="COLOR_GAMMA",
        size=4,
        default=(1.0, 1.0, 1.0,1.0),
        min=0.0,
        max=1.0
    )

    b_rad: FloatProperty(
        name="ball radius",
    )

class OBJECT_PT_PSG(Panel):
    bl_label = "Product scene panel"
    bl_idname = "OBJECT_PT_PSG"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "Product scene generator"

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

        psg = context.scene.psg

        row = layout.row()
        row.label(text="Product scene generator", icon='WORLD_DATA')

        col = layout.column()
        col.use_property_split = True
        col.use_property_decorate = False
        col.prop(psg, "b_color")
        col.prop(psg, "c_color")
        col.prop(psg, "bg_color")
        col.prop(psg, "b_rad")

        row = layout.row()
        row.operator("object.pro_scene_gen")

classes = (
    OBJECT_PG_PSG,
    OBJECT_PT_PSG,
)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)

    bpy.types.Scene.psg = PointerProperty(type=OBJECT_PG_PSG)

def unregister():
    del bpy.types.Scene.psg

    for cls in reversed(classes):
        bpy.utils.unregister_class(cls)

if __name__ == '__main__':
    register()

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


text:
Duplicated object not showing in render
My issue is that my duplicated objects are not showing.
I've tried everything, visibility options are on, turning all restriction toggles on and off, one by one, everything but I just couldn't make them show in render.
If I hold Z and choose the Rendered, the objects are showing, but when I hit F12 , only the original model that I made shows.

Did you find the solution I have the same problem

Try checking Visibility in the Object Properties

Yea, I said all visible options are enabled

is duplicate of other object also not showing in render?

only duplicated of the model made by me


text:
Compositor ID Mask not working?
I want to give my model a glare effect at robots eye,

so I gave the material assigned to the eye Pass Index of 1

then when I went to compositor and made this node set up,

in the viewer I could not see anything like that, (BW Image)

could you upload the blendfile?

This is pretty weird. I can think of three possible workarouds:

Render the eye as a separate object, then use Object Index.
Render the eye on a separate RenderLayer.
As the eye seems to be pretty much an emission material, you could separate the emission pass.

Try to reconnect the Image ID slot to the ID Mask. You connected from the all first node to the Id Mask node. Try pulling of this connection and then putting it in again. Just unconnect and then connecting the Id slot of the Render Layers node (IndexMA) anew to the ID Mask (ID value).
I think this solved this issue for me. I reconnected after I had changed the index number inside the mask or the index number of the material itself.

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


text:
Problem: Character with backpack (physics)
I have a rigged character, for which I am trying to design a backpack, which should bounce around a little when running.
But I am lost with the “physics”, as I am new to blender. I tried to design the backpack as rigid body. Even when I add rigid body constrains to my rigged character, I cannot get it working.
Is there any other way to solve it.
Even if I could not get it bouncing, if it follows the body propery without merging/overlapping with the character, it would be fine for now.
Can somebody help me out. Even a reference to a tutorial video would be welcome. I was not able to find any for this topic.
Thanks in advance

I saw in the past a video about a handbag doing exacltly what you want, but i cant find it now, i think it is the same in this other video series where daniel kreuter uses rigid bodies and bones for the hair, hope it helps: https://www.youtube.com/watch?v=10hgRL6D1qU

Thanks, I will look into it


text:
How to prevent blender 2.8 from deforming objects when rotating a bone in pose mode
I am new to blender.
I started by creating a simple match stick, which I want to animate.
Unfortunately I get unwanted deformations when rotating a bone in pose mode.
I used 2 separate Objects. A cube as Stick and a conical sphere as head.
I added an armature with 5 bones (automatic weight) and made it parent to the stick and head.
Example 1: In default pose, the head is conical (as intended). In modified pose, it is almost round.
Then I made a new setup. Here I connected the armature only to the stick for testing. As you can see, in default pose, it is as wide as high.
When I change the pose, all parts above the used bone get much much thicker.
I have no idea, how to stop this behavier and google was also no help.
Does anybody have an idea?

Probably other bones (which not in the moving section) also has influence for that part. You have to remove their influences in Weigthpaint Mode.

Unfornately not. Only the small bend part is effected (red/orange in weight paint mode)


text:
Understanding scenes in blender. (linked objects)
I have a problem understanding the scene setup in Blender 2.8.
I created a scene with animations (keyframes, follow path contstraints, nla tracks, etc).
Now I wanted to create a new scene, in which I want to reuse my main character.
But when I link it into the new scene, it comes with all the animations of the previous scene.
I tried already several Objects->Relations settings, but with no success.
I saw a tutorial (for an older version) with Link Object Data, which did the trick - if I understood the video correctly.
But unfortunately, this option is missing in 2.8
Is there a proper way to link only the object without its animations, so I can start the scene from scratch?
Thanks in advance

The way linked option is intended is to have a base file in which you perform modeling, rigging, skinning, texturing and everything referred to the "building" of characters, props, environments and so on.
Then instances of all theese objects can be linked into a new file in which you will perfom the scenes, animations, lighting, camera movements and so.
The idea is that if you decide later to modify something in one character, the edit will be reflected into all the scenes in which that character has been used.
So, for a "correct" workflow you can simply save a new version of your file, delete all the animations, and link from this new file.
I've read that the link function will be changed in future, to let edits also over linked objects (by now you can also use the simpler "append" function, which will not automatically reflect any new change in the base file).

This same problem had me stumped the whole evening, but I found a working solution. (in Blender 2.93.5)
I'm not sure about animations as I only tested with a static scene.
For me it works like this:

Create the object
Create a new scene
In the original scene select: Object -> Link/transfer Data -> Link object to scene -> and select the second scene

Now in the second scene select the object(s)
Select: Object -> Relations -> Make Single User -> Object
Now you can change the position (and location and scale) in the second scene without it moving in the first scene. But still retain the linked geometry, materials etc.

If you duplicate the project and go into the duplicated one, then delete all objects in the scene other then the character and export it as whatever format you want (obj preferred). Then just import that obj back into the original project and it should have no animations.

I found the issue
I linked the individual objects.
Now I added all to a collection and linked that. That did the trick. Everything is fine now.

Thanks a lot. I modified my setup accordingly. Unfortunately I am facing major issues with it. For example, I changed the pivot poit (origin) for armature and mesh of the original object.
As a result the Mesh and armature of the linked objrct in my scene gets disconnected. I tried already to make a new proxy and other things without success.
The original and the linked one, if no proxy is added, are fine, but once I add a proxy. I get the issue.
What am I doing wrong?
Is there a good tutorial for linking available?


text:
How to get rid of "keying set failed to insert any keyframes" error
I am struggeling with the NLA Editor.
It seems that I am  triggering a (for me) strange Hotkey, which keeps me from adding new keyframes.
The last times I noticed it before saving, unfortunaltely, this time, it   was already saved closed.
Whenever I  try to add a new keyframe I get error messages.
When I try to add a loc rot scale keyframe I get  "keying set failed to insert any keyframes"
When I try to add a constrains keyframe I get "could not insert keyframe due to zero NLA influence or base value"
I tried all tipps, I found in the net, but nothing helps.
I checked the Scene Properties, but there is no keying set defined.
I checked also the Active Keying Set properties in the Timeline. There was also nothing specified.
I tried there other settings like LocRotScale and others. but no result.
What did I do, to get to this state and how do I get rid of it.

Got rid of it. I did not see that little pin symbol on the track


text:
Why are this seams there?
I have been modeling and then I've noticed that I had a strange seam going at a certain part of my mesh, quite weird, can't figure out what is causing this to happend.

Looks like you have N-gon face that cause this error

Extend those vertical edge-loops all the way through those three bottom horizontally-aligned faces (the top of those three clearly being an n-gon, not sure of the two below it). This should go a long way toward fixing your problem.

Is there a way I can extend the loopcuts without using the knife tool?? as it is going to take ages with it.

You could use Ctrl+R on the bottom two faces, then roll the mouse wheel until you get the 9 or more cuts you need, then use Ctrl+E -> 'Edge Slide' on the edges to align them to existing edge loops above.

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


text:
How do I parent another object only to a specific bone?
I have hands model which I rigged, now I want the gun to be parented to the left hand, where the problem occurs as left hand is the same object with the right hand, so by parenting the gun to the bone, in the end the gun is parented to both bones, the right hand and the left hand.
In my head I have 2 Options, either:

Find a way to parent the gun only to the left hand bone
Separate the right hand from the left hand as well as the right hand bone from left hand bone, but if so then another question arises how do I separate bones from each other?

Here are some screenshots to make it easier

I have answered your first question, the second has been answered here: http://blender.stackexchange.com/questions/28456/separate-convert-bones-into-their-own-armature

You can parent an object to a specific bone using a 'Child Of' constraint:

Here, the object I want to parent to an individual bone has a 'Child Of' constraint added, with the armature and bone I want it to follow selected from the 'Target' and 'Bone' search boxes.
Pressing the 'Set Inverse' button may be required to return the object to it's original position as after choosing the target object it may jump to that bone's position.

Thanks a lot, you answered both questions, both work. Appreciate that !

Old thread but additional information is always nice - not enough rep to comment but this is in response to Ray's answer: Make sure you select all of your objects and do Object -> Apply -> Position, Rotation, and Scale if you're having any issues with the "set inverse" button sending your object elsewhere!

You can do this by parenting the object using "bone" option. Select the object, than select the specific bone in pose mode, press "ctrl+p" and click "Bone".

Thanks, that helped me :) The point is to select the object and bone in Object Mode, then switch to Pose Mode and select the relevant bone then press Ctrl + P then select Bone


text:
How much should I bevel?
I want to know how the shape, size and material of an object would affect its bevel?
(for it to have closer to realistic bevel, for photo-realism)
For example in the real world how would the bevel on the edges of a wooden door be different from the bevel on the edges of a concrete beam or the bevel on the edges of a small cardboard box?

The major thing to take into consideration is the materials hardness. A harder material will not wear as much on the edges, while a softer one will have much more wear resulting in larger bevels. You also need to take manufacturing into account. Glass and porcelain for example are usually manufactured in such a way to result in very rounded edges.

It might not be a sexy answer, but I'd say: measure. If you want to simulate the real world, know your world.
What do you do if you want to model a realistic excavator? You either get a good model or you use reference picture. You imitate the real thing which has the knowledge of engineers. You use their knowledge. Getting bevel sizes is doing the same thing in detail.
It's mostly not shape or size, it's the manufacturing process or the intended use that decide on the roundness of anygiven edge.
So, get into the real world and measure bevels. And make a reference chart.
When I wanted to model a typewriter, I decided to measure all the bevels to get the proportions right.
The beauty of 3D is that you learn much more than to simply use the software.

Just out of curiosity, how did you measure the bevel?

I'd use calipers.


text:
How to animate Constraints?
I am making a Reloading animation and I want at first to Parent the mag to the gun when it moves, then Parent the mag to the hand.
So to do that I though of creating 2 Child of Constraints and then somehow animate the disabling and enabling of the two Constraints.
So, how do I do that, if there is any way?
or maybe it would better be to do so somehow else.
& please no python

Did you tried to animate the influence sliders?

No sure, what you mean... Oh now I got it, but I want to change the parent of the mag Completely, from the bone of the gun to the bone of the hand

Maybe the best thing for me to do is to create a bone for the gun and then just with One Constraint, just animate the Bone that the mag is parented to by changing from gun bone to hand bone

Well, if you put two "child of" constraints to the mag, one linked to the gun, and another linked to the hand, you can animate their influences so that when the first is at 1, the other is at 0, and vice-versa. Is that what you mean?

I totaly got you now, yes thats what I mean,but will that mean that I will have to create a separate bone for the gun, as I need the mag to be parented to it at first

I don't know, haven't seen you setup, but if your gun has an armature, then I guess yes, you should parent the mag to the gun's bone. If not, you can "child of" anything to an object, or a bone (if the object is an armature). There is no rule about how to do that...

Let us continue this discussion in chat.

There must be a better way to do what you want, but to answer your particular question about animating child of constraint, you can use the influence slider of each constraint.
Constraint the mag with two "child of" constraints, one linked to the gun, and another linked to the hand. Then you can animate their influences so that when the first is at 1, the other is at 0, and vice-versa.

Yeah, I was thinking of something like this, but with a twist - using two empties that are parented to the gun and hand each, so that one can readjust the positioning later without hassle just by nudging the empties. Also I was thinking of using Copy Transforms, but is there some benefit of using Child Of instead?

@Polosson  I didn't know this was even an option, and have needed this exact thing for sooooo long. Thanks for posting this answer. It will help simplify some of the work I do.


text:
How to make an object go around another circular objects?
I am making a sort of steampunk element and I want to have small bolts go around a cylinder. I'm not sure what would be the most precise and quick method to achieve something like that:

My current model:

p.s. Also preferably with out using a curve modifier)

You may use an Array Modifier with the constant offset enabled.
Add an Empty (it'll be your pivot point). Next select the object, enter Edit Mode and place it as fas from Empty as you like. Being in Object Mode apply transformations (Ctrl+A) and add an Array Modifier to the object. Check the Constant Offset and Object Offset checkboxes. Select Empty below the second one.

Now just rotate the Empty (in your case by 60 degrees).

I've found the related answer, which explains more precisely how to use this method. Please check it out: http://blender.stackexchange.com/questions/6023/how-to-make-a-circular-array-using-offset-object-as-center

Imho there are a couple of ways. One very basic way is using a circle with less vertices (one per object to place around the cylinder), parenting your little object to it (only one needed, clear all origins before), and enabling vertex duplication- with rotation, like

then you can scale in edit mode the circle enough to match the cylinder surface, at your taste.

which gets you

I made an addon that do just want you want by pressing a button,It is not stable though.
Here is the Addon.
Suppose I want to make this sphere go around this object.

Before you run the addon,you should align the view with your axis of rotation I do this by selecting the face that its normal facing the axis and pressing Shift + Numpad 7 and the cursor should be in the middle so by pressing Shift + S I set the cursor to the center of the face.I select the sphere and go to Edit mode.I then run the addon from the Tool panel and set the number of duplicates (It is better to set it 2 times because blender didn't get it the first time).


text:
How can I keep quads flat when fitting a mesh to a curve?
I'm making a race track using a bezier curve and a simple mesh with an array and curve modifier to fit the curves. This is for a racing game in Unity.
When moving the model from Blender to Unity, I noticed the faces of the track get triangulated, and that the tris also fit the curve. The result of this is that the quads are no longer flat where the track tilts left or right; instead there are  now 2 tris at slightly different angles causing a very bumpy and uncomfortable ride for the car that's driving on them.
In the top screenshot is what the quads look like in Blender. As you can see, they are perfectly flat and the shading changes with each quad. The bottom screenshot is after applying all modifiers and then triangulating the faces. Here you can see that the areas that were quads are no longer flat. The way the shading changes from one tri to the next shows the "bumpiness" I'm talking about.
Is there a way to apply these curves to my mesh without messing up the quads? I understand triangulation is necessary but I don't understand why each quad ends up with 2 tris that each have different normals than the original quad.

I'm not expert of Unity, but I think that you should simply add some more subdivisions to the base mesh, so that the bumpiness will be more subtle and even.

...also, it doesn't look as if the rectangular array elements are merged along the curve.. adjacent vertices will have slightly different normals... possibly check 'merge' in the array modifier, increase the merge distance, slightly?

@joshsanfelici Subdivisions will only make it bumpier. The problem isn't the lack of smoothness overall, it's the lack of smoothness within each quad; the resulting tris cause the curve to be a series of very slight inclines and declines instead of each face being a greater angle than the last.

@RobinBetts They are merged, and the distance was increased. It may look like they aren't because I'm using flat shading. Thanks but this is a different issue!


text:
Keep Scale While Animating
I am quite sure I've seen someone to disable scale change when animating, for an instance if I enable FK / IK and drag my hand to change position it will stretch like so:

I would like to know how can I fix that. (no scripting)

This isn't the scale, but the IK stretch feature, which you can control from the properties panel (N shortcut key). The following video explains how to use this property to control stretching:
http://youtu.be/AII-n2GHbG4


text:
problem animating appearing text
Making a logo - very simple - 5 words all set on a black background that appear independently in sequence.  I used the Outliner editor to set keyframes for the text to appear.  It works as designed in the render view but when I animate the logo all of the words are visible at frame 1.  What am I doing wrong?

Need more details. What property are you applying the keyframes to? What do you mean by "the render view" and "when I animate"? There are known issues with keyframing OpenGL opacity due to shader caching and that may be what you're encountering.

In Blender, there are always two Settings for Viewport and Rendering. For Viewport visibility use  and for Rendering


text:
Multiple hotkeys for the same function
I'm trying to get a single function mapped to multiple hotkeys.
Specifically, I want to rotate the 3d view by holding shift+middle mouse button or the * key on the num key. (Pan has been moved to middle mouse)
Either solution works independently, but I have a problem that if I use the knife tool with * (my preferred solution because I cannot make a macro to press shift+middle mouse on my mouse) it will not rotate, so I would like in that instance to be able to press shift plus middle mouse even though normally I would like ot press *.
I see multiple "View3D.rotate" I can change the hotkey of, but only the first actually works.
Any advice? (Even telling me how to Macro my Naga mouse would be helpful ahah)

At the bottom of the 3D View input list, click on the "Add New" Button. A new command will then appear at the bottom of the listed named "None".
Click on the triangle to the left of the word "None" to expand the options for the command. Enter this text: view3d.rotate (as shown in the image below) and press Enter. At this point the name of the command will change from "None" to "Rotate View" and you can choose you input command.

You may also want to double check that the command is not already in use by searching for it in the "Key Bindings" search box at the top of the list. If it is in use you can just disable it by clicking on the checkmark next to its name. That way you won't have any conflicts... hopefully.

Thanks, it's worth noting though that I had to type view3d.rotate and not view.3d.rotate.

My apologies for the typo. I'm glad I added the image as a backup. Thanks for letting me know so I can fix that.

I want to assign the Shift+3 for the visibility of the cutter folder on Blender 2.90 but it's not working for me! Can anybody tell me how to assign that?

Is it possible to map 1 hotkey to do 2 things?    https://blender.stackexchange.com/questions/215761/ctrls-doesnt-save-modified-textures-lost-hours-of-work


text:
Attempting to unwrap model for UV, results horrible

Hello, folks. I'm relatively new to blender and modelling in general. Everything has been going pretty good until my attempts at UV mapping has given me the result you can see above. I can clearly recognize the two faces of the object and even the edge, although it looks rather absurd. I don't know why it shows up like that, it's as if every single edge is shown three or more times on the UV.
My issue is with the infinite hexagons and rectangles behind them. Attempts to pull the items in the UV window apart resulted in nothing. According to Blender, the infinite rectangles and hexagons are actually what build up the object and not the clearly defined faces and edges. It makes no sense to me as there are no rectangles and hexagons on the actual model. I made two large seams around the edges of the faces of the object and connected them four times - twice at the bottom and twice at the top. I have marked on the image where the two large seams are connected by small seams.
How could I make this work without the unwrapped UV turning out in such a mess? According to Blender there are no loose vertices nor unconnected faces and edges, no doubles, etc.

Try to reset the UVs and unwrap again.

Resetting the UV has made the clearly defined shapes disappear, but the hexagons and rectangles remain regardless. Unwrapping again made the defined shapes appear again, hexagons and rectangles still present.

Try to remove doubles, it looks like you have some overlapping geometry that is hidden.

This is odd. I tried removing doubles earlier and it returned no results. However, I have tried it now and the console tells me Blender has removed 666 vertices. Clearly, this is the blasphemous work of Satan! Jokes aside, it appears to work fine now. Thanks, Denis.

The problem Usually when you have hidden geometry that was not marked with seams.
In your case the UVs are showing that you have additional edges that overlapping on your mesh.
The solution is to remove that geometry by removing doubles using Ctrl+V and select Remove Doubles. Then check your seams again and unwrap the mesh.


text:
Simple rigid body physics (Sphere - Box) depends on substep
I am trying to use Bullet to get physically accurate simulations by setting up the simulations through Blender (2.73a or 2.75a).
It seems to be very unreliable with respect to the physics_step_sub property.
Most annoyingly, a collision is often missed, and the object gets stuck. I hope someone spots an obvious mistake.
I set up a minimal working example:

a sphere (rigid body, collision_bound_type: SPHERE) that's given an initial velocity, and
a wall (actor, static, BOX), that it bounces back from.
no gravity
elasticity 1 for both objects.

The outcome changes based on the substeps parameter.
Which would be ok, but which is closest to actual physics?
I read, that it's not good to have small objects, so I enlarged the scene, the outcome is similar: tests.zip
The minimal blend file can be found here: scene.blend
I tried adjusting the magic "game.radius" parameter, but it only changes anything, if it's too large and the objects immediately start to distance themselves.
Collision margins don't seem influence this behaviour.
Thanks!

see the comments on this http://blender.stackexchange.com/questions/28876/different-frames-make-rigid-bodies-act-differently/

Sounds like you are using the game engine. Have you tried using the rigid body sim outside of the BGE?


text:
Principled shader transmission parameter outer objects ignored and background images appears

When material's transmission is edited I get a strange result like the outer white sphere is ignored and sky environment is see through from inside sphere.
Do you have any insight about this?

Probably duplication of https://blender.stackexchange.com/a/228844/2214

Thank you very much for advices,I will see the link.


text:
How do I make it so when I rotate my model using the numpad it stays in orthographic instead of perspective by default?
I'd like for my numpad rotations to be in orthographic instead of perspective.

See what you have set in Edit > Preferences > Navigation tab, Orbit & Pan > Auto Perspective. Default is checked.

use numpad 5 while being in perspective, it should stay ortho after that.


text:
Posing the rig pulls other parts of the mesh?
I'm rather new to Blender, and I'm attempting to rig my first character. However, when I go to pose her, I end up pulling separate parts of the model with other parts.

Here's the .blend, for reference:
Wave2.blend

You made the mesh the parent of the rig. That's the wrong relationship.
Steps to fix it:

switch to Object mode, select the metarig armature and clear its parent with Alt+P > Clear Parent.
apply the Scale to the armature with Ctrl+A > Scale. (This resets the scale transformation of the object to 1.0 and it is important for the calculation of the weights. You can check the Scale in the N-panel.)
select the mesh (Wave) and remove the Armature modifier (The mesh should be now in A-pose)
keep the mesh selected and select additionally the armature. The armature must be the active object. This is usually the object that you selected last and it's highlighted in orange. It will be the parent. The mesh object should be highlighted in red and it will become the child.
bind the mesh to the armature with Ctrl+P > With Automatic Weights

Good to know: The metarig is just a template to define the position of the bones. You can bind the mesh to it and use it as an armature. But the actual rig is created with the "Generate Rig" button. It's much more powerful and offers controllers & inverse kinematics (IK) for easier animation.

Thank you so much! This fixed the issue immediately!


text:
Can I give drivers to objects in batches?
Can I give drivers to objects in batches, just like link materials or copy modifiers?

Ctrl-L > Link Animation Data maybe? Or you can right-click on the field with the driver > Copy driver, then select your other object and Right-click > Paste Driver into the same field.

@John Eason Thanks, it is feasible to link animation data, but it seems that the paste drive can't be copied in batches. Is to hold down the Alt to operate? But it's enough for me to continue my work. Thank you again!

I'm not sure if the Alt key would work in that case because I've never tried it to be honest, but it's worth trying with a test setup. Just make sure that all the objects you want to receive the copied driver are selected before pasting the driver.

Select all objects with your object having driver as your active selection. Then go to object drop down menu-constraints-copy to selected.


text:
Is there a convenient way to display values in a node graph?
This is probably a long shot.
Is there any Add-On or common method people use to display values within the node graph?
It would make understanding what I'm doing easier if I had a simple way of displaying said info.
If there was a way to "Promote" the value to being a variable I can see in a list.
(I vaguely remember "promoting" values from using Houdini like 5 years ago)

You can see the values of the Viewer Node in the Spreadsheet.
Just connect the output of the node to the Viewer Node.


text:
Weight painting cannot be painted
I am currently trying to make my model dance, but the eyes aren't following the body.
I tried to paint the eyes red on weight painting thought I can't seem to paint anything at all.

When I turn to edit mode the body sinks.

Blend File

you can use any cloud service you like e.g. dropbox and copy the link into your question

Is it still heavy if you only keep the character + armature and remove all the rest? Maybe the eyes are not part of the body and you need to join them to the body, or keep them separate and parent to the bone you want

could you please check here?
https://www.dropbox.com/s/q1lun9fyt4vdya2/neko.20230526%20-%20%E3%82%B3%E3%83%94%E3%83%BC.blend?dl=0

For the moment your eyes are not assigned to any vertex group, so they can't be controlled by any bone:

First thing, bring back your armature to its rest pose:

Select your object, switch to Edit mode and move the eyes where they are supposed to be:

Check the bone that is supposed to control the eyes, it's probably the one on the second layer called mixamorig:Head:

Assign the eyes to the vertex group called mixamorig:Head. At the end don't forget to bring your armature back to Pose mode.

thank you it worked!


text:
Link a rig have an issue with character IK FK setting v3.5

The character link is: https://studio.blender.org/characters/sprite/v1/
I followed the instructions to link the character to my scene.
1: Put your 3D cursor in the Origin of your scene. Choose File > Link and browse the character file
2: Go to the Collections and select CH-sprite. Make sure "Instance Collections" is enabled. Press Enter.
3: The Collection should appear instanced in the Viewport. Select it.
4: Choose Object > Library Override > Make.
Q1:
on the Sidebar (press N), there have no Setting bar for the rig; I can't change the switch Ik or FK; how can I load the rig bar here so I can switch the IK or FK
Q2:
on the Scene Collection, there are icons(link icon with a right down arrow) that I don't understand. Is this a problem I need to fix?
I searched a lot of videos, on old Blender using a proxy; once they link and proxy a rig, they have a rig setting on the Sidebar, and they can change the setting of the rig; also, on their Scene Collection, they don't have the icons which I have.
I am new to Blender and used Maya for character animation.
If I open the rig blend file, I can see a rig setting Sidebar.

The proxy system was replaced by the new Library override system in Blender 3. The icons in the outliner indicate that the collections are linked from another file.
To see the rig's custom switches and buttons, there is still one step missing. You need to run some scripts.
CloudRig is a feature-set (extension) of the Rigify add-on that is included to Blender. The custom controls in the side panel of 3D viewport (N) are created by a script called "cloudrig.py". (For Rigify rigs it's called "rig_ui.py".)
This script is usually executed automatically when you open the Blend file and you have to confirm a security warning, as you can see here. The warning is shown once after Blender is started.

(taken from the question Rig_ui.py script file disabled for SECURITY reasons. Should I worry about this?)
Long story short: Save the blend file and open it again. Then allow the script to run.
There is another custom script by Blender Studio included ("sprite_rename_curves.py") that will executed, too.
You can check the scripts in the Scripting workspace. Just select the script from the dropdown list that is located at the top of the text editor, right next to the menu.

Thank you sooooo Much,save my life!


text:
Blender to Unity. Particle Settings
I modeled a realistic flower in Blender. The flower itself isn't very complicated but the middle is very hairy with hundreds of stamens. I modeled one stamen and multiplied it using Particle Settings with render as object. The question is how to bring it to Unity properly?
If I convert it into mesh the model weighs 35 MB which is not good I guess.

Hi this platform is for Blender related questions and issues. Your question is how to bring it to Unity. Maybe try posting on https://answers.unity.com/ :)

1000 Stamen is quite a lot, are you sure you need that many in Unity to make it look good?
There are some solutions:
Ignore the 35MB, let Unity optimize it. That would be np if there are no other objects in the scene
make sure the stems have as few vertices as possible and reduce their number.
If the stem source object(s) have modifiers on them either remove or apply them, that way Blender should create instanced meshes, which Unity understands
If you are fine with coding, export one stamen and replicate it in Unity. FBX is usually the best format to exchange 3D models, it can handle instances, carefully check the export settings (choose export and where you are supposed to state the file location, press n). You don't need any import settings to support instances, but also go through the options of the fbx import in Unity, there's often stuff you can customize to fit your specific situation.

Thank you for your answer! You mentioned 'instanced meshes'. Which way of import should I use to make it work?

I'd recommend 2 things:

Bring your particle count to around 200-500. 1000 is quite a bit for this sort of thing!

In the mesh's modifier properties panel, click Make Instances Real. Then, click on one of the instances, then right-click, and click Join. Now the instances are all one mesh.


text:
Hot Key responsible for changing manipulator doesn't work
As I was reading through Blender Documentation 2.4, looking for hot keys. And suddenly found an interesting one. So I went to Blender to test it myself. Though it didn't work for me. The Hot key I am talking about, is CtrlAltR, which is used to change the manipulator to either Translate, Rotate or Scale. I am wondering why is the hot key not working for me,
Did it get disabled in the newer versions of blender(btw i'm using blender v2.76), is the hot key conflicting with a new feature added, or is it just me?

Related - http://blender.stackexchange.com/questions/19352/hotkey-for-selecting-transform-manipulator-type

I just tried it, it's not working for me either, I'm using B 2.76.


text:
FIX(connect/merge) loose vertices after an edge split modifier
I'm modeling a very high poly complex weapon, and I've applied an edge split modifier on it, so now most of my vertices are loose and I can't manually add bevel. I'm sure there should be another way apart from manually merging every. single. vertex.
Perhaps I can reverse the effect of the modifier somehow or at least there should be a way of merging edges.

go into edit mode
select everything by pressing A
press W
select remove doubles

Also, don't use the edge split modifier. If you want to smooth your mesh, i suggest using "auto smooth".


text:
Does Sculpting create any new Geometry?
I am going to use some sculpting to give a better shape to a Game Character, so I would like to know if Sculpting may add more geometry, for an instance the F layer brush or the F blob brush.

Not unless you are using dynamic topology when sculpting: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Dynamic_Topology_Sculpting

Sorry, but Sculpting only moves existing vertices and faces around, but does not create new geometry. Hope this helps!

Normally sculpting does not add any vertices or edges, it just moves them around. But when you enable the dynamic topology option in the left toolbar T of your 3d view it adds vertices depending on the given value and your zoom level.
You wrote that you want to create a game character? I recommend that you copy your existing object and add more and more details. Then you can bake the normals and save a lot of memory and rendering time.

Where is this option in the left toolbar now?
Edit: It's on the upper-right of the view port now. A Checkbox for Dyntopo


text:
Mesh does not move along with bones in pose mode (uses rigify armature) Ver 2.75
As the title says, my mesh does not deform along with the rigify bones in pose mode, even though the bones are in pose, and not rest position. I have already adjusted the weighting, and I know that in the past, it's worked completely fine. I have no idea as to what caused it, though I believe it has something to do with changing the weights on some of my objects.
In the past versions of Blender, selecting multiple vertices in edit mode during this stage would have crashed the program, though that seems to be fixed in the latest version, giving me some hope that this is a mistake on my part, or a fixable bug.
Below is a screenshot of what the problem is like. I've also attached the .blend file in the link for anyone willing to lend a hand.

https://www.dropbox.com/s/hnb7p4zo83a9evw/Natlie_rig.blend?dl=0

I played around with your .blend a little (good you uploaded it...). I realized that the Armature modifire got removed. I dont know how this happend.

Just add the modifire again and you will be fine.
In the picture you can see the needed settings.
I also realized that your armature is scaled extremely big. preess alt + s to reset the scale if this size wasn't intended.
By the way you can delete all the annoying meshes in the last layer. they arn't needed anymore.

I didn't realize there was anything on the last layer until you mentioned it. Thanks for your answer man, really helped. :D

Where do you check this setting in Blender 2.8?

It seems that your rig can be saved. In the outliner select the objects within the red box one after another and (re)add an armature modifier to each as shown below.

In case you aren't awere of make sure that that you configure IK or FK correctly here is an example for FK.

Where do you re-add the armature modifier in Blender 2.8?


text:
Bad behaving particles
I found great tutorial from Tutor4u:
Blender Beyond Basics #4: Fun with Transformations - Blender Tutorial
But somehow I end to odd results with that. Here I have five different frames:

As you can see, the particles become already visible on the frames 48 and 49, but then suddenly the original torus is seen on frames 50, 51 and 52, until on frame 53 it is again as expected. These are just few examples. The issue continues during the animation.
If I do the manual rendering on those frames, they are seen as expected. So this problem appears only during the rendering the animation.

File format: FFMpeg
Video Container: MPEG-4
Video codec: H.264
Rendering engine: Cycles
Rendering sampling: 24

Is this a bug which should be reported into somewhere or what do you think, and have you seen similar issues?

can you please provide blend file?

@chris here:
https://drive.google.com/drive/folders/1jZub0FdNrHffNZSfA2_Oe88qau2mnkqs?usp=sharing

And I need to say also, I'm using Blender 2.92 version. I do AMD GPU.


text:
How to change extrude direction for bezier?
I have a model ready which I draw at first in 2D. But when I tried to extrude the line, it extrudes that in flat and not up. What is the mistake I have made and can it be fixed still?
Here I have example which shows how it is working at the moment and which I would like to see happening.

Or would it be easier to just re-draw it?

If you want to extrude up, you can just use E and the Z to lock axis (or X, Y)

Thanks @Vagabonk, but that is still bezier curve which I would like to extrude. Of course I could convert that to mesh, but I would like to understand why it works like that and how to fix it, and perhaps preventing that in future.

Sorry, then. Could you please explain the process a little more? How did the top mesh come into being?

@Vagabonk sorry to say, but I'm not actually sure how I originally end to that issue. But I believe it could be because of rotate at the begin. So if you create new bezier curve, rotate it in 90 degrees on x-axle, and then start drawing from top perspective (on XY coordinator).
Except above simple option I was able to get fixed with tilt (alt - t). Looks like I need to practicing more what the tilt means in practical level.

While you are in Edit Mode you can go to Overlays, in the top right, and turn on Normals (the last check box). Maybe that will help you understand a little bit more?

Maybe you've rotated it and you need to apply the rotation? If you want to keep it rotated for some reason, tilt the vertices in Edit mode (Ctrl T 90)

I could not found the way to fix it. So I redraw it.
Thank you for your help.


text:
BGE everything white in playmode
When I press P to play everything shows up white in the BGE. Shading is set to GLSL, and the objects are UV mapped and textured. It seems that vertex paint is overriding the material for the object even though it is unchecked in the material options.

Shading is set to GLSL

Objects have a texture applied

I was having the same problem and it did fix but it made half of the place empty or something in a game I was working on. This is how it looks when it's not rendered. This is how it looks when it is rendered . This is how the lamp settings look like. This is how the shading settings look like

Your problem is Very simple to fix. Currently, your shading is set to solid. Change it to textured view, and your textures will display.

Set the Shading to "Texture" then start the engine

You beat me to it by exactly one minute! I was making the .gif for a better reference, so It is possible (but un-likely) that I could have started writing my answer before you.......


text:
Set physics type in bge using python?
I'm trying to set up a scene using a script that places a bunch of cubes in random locations throughout the screen and sets their physics type to rigid body. Ideally, I'd like to have one cube be an agent whose actions can be controlled via a different script. How do I set objects' physics type en masse using python in the game engine?
I've tried
ActiveObj.game.physics_type = 'RIGID_BODY'
ActiveObj.game.use_collision_bounds = 1

as well as
for obj in bpy.data.objects:
     bpy.ops.rigidbody.object_add(type='ACTIVE')

but, obviously, neither works in the game engine. How do I get around this?

As I was told, bpy won't work when you run the game as standalone so don't use it unless you are about to take it out in the end.That was just a notice.

So how can I add objects via script in the game engine and set their physics type? Every method I've found uses bpy :/

It's easy to turn a rigid body static and back again. Start with a rigid body, and then you can suspend/restore the dynamics:
import bge

cont = bge.logic.getCurrentController()
own = cont.owner
own.suspendDynamics()
#OR
own.restoreDynamics()

A slightly more hacky way to turn a rigid body static is to set it's mass to infinite (ie no force will have an effect).
import bge

cont = bge.logic.getCurrentController()
own = cont.owner
own.mass = float('inf')

To make it rigid body again, set it's mass back to a proper number

To make an object dynamic is hard as BGE doesn't have access to the inertia tensor/radius of gyration. Even setting the angular velocity cap to 0.0 doesn't work. I guess you'd have to, every frame, set it's angular velocity to zero and restore it's orientation.
(untested code):
import bge

own = bge.logic.getCurrentController().owner
if 'ori' not in own:
    own['ori'] = own.worldOrientation.copy()
own.worldOrientation = own['ori']
own.worldAngularVelocity = [0.0, 0.0, 0.0]

Create a cube in a different layer and tick rigid in his physics property.
Then go in your active layer and place an empty where you want your cubes to spawn.
Add an "Edit Object" actuator to the empty.
Choose when to activate it and set the Cube in the different layer as the object to be added.
Then the newly added object will have rigid physics.

Any way to do that without the gui? The project I'm working on relies on me being able to not use the gui whenever possible

I don't think so, but I haven't tried this to know. I just searched the API and did not find a command that would change rigid to static and so on. You can decide when to add the objects via python but you must have the actuator connected. Wait to read some other solutions too. I could have missed something.

It's possible, though I don't recommend it this way...  Spawn a headless blender, create the new object, save to a temp file, libload.  Horrible, I know.


text:
Help with moving an object in bge randomly via script?
I'm pretty new to blender and I'm trying to move an agent (in this case, a cube) randomly in bge. This is what my code looks like at this point:
import bge
import random
from mathutils import Vector

def main():
    cont = bge.logic.getCurrentController()
    owner = cont.owner
    function = cont.sensors["Always"]

    width = bge.render.getWindowWidth()
    height = bge.render.getWindowHeight()

    def set_object_pos(width, height):
        owner.localPosition.x = random.randint(-1*width, width)*0.007
        owner.localPosition.y = random.randint(-1*height, height)*0.007

    current_frame = 0

    loopnumber = range(100)
    loopnumberlist = []
    for number in loopnumber:
        loopnumberlist.append(number)

    for number in loopnumberlist:
        set_object_pos(width, height)
        print (owner.localPosition.x, owner.localPosition.y)
        current_frame += 1
        number += 1
main()

I just randomly created a loop because it would only print out 1 location no matter for how long the simulation ran. The problem I'm running into at this point is that the script will print out random locations but only moves the agent the first time the loop is run....any way to get the cube to move every time the loop is run? Or, better, is there any way to just call this function every frame? I thought using the Always controller would help but it hasn't worked that well...
Thanks!

Cause
I think you do not understand the concept of the BGE logic. In your Python code you describe the behavior within a single frame. This means it runs exactly once per game loop iteration.
Your loop will not executed "over time". It will run within one frame resulting in overriding the object location and printing to console 100 times. The effect is: 100 messages per frame and a waste of processing time (as only the last location change will be visible).
Solution
Design the code in a way that it describes ONE iteration rather than 100. Run the code when you want to change the location. This might be

constantly (Always with true level triggering),
at key press (keyboard sensor)
random interval (timer property + property sensor + random actuator)
...

here is a sample code - demo.py
import bge
import random

def setAtRandomPosition():
    if not allSensorsArePositive():
        return
    owner = bge.logic.getCurrentController().owner

    owner.localPosition.x = random.randint(-10, 10)
    owner.localPosition.y = random.randint(-10, 10)

def allSensorsArePositive():
    for sensor in bge.logic.getCurrentController().sensors:
        if not sensor.positive:
            return False
    return True

call it with Module mode: demo.setAtRandomPosition
I hard-coded the limits from -10 to +10. You see this code is very simple as you only care one frame. How you keep the object within the camera frustum is up to you.
Try this with an Always Sensor [True Level Triggering] Frequency: 20

or use the keyboard sensor to set a new position at each  press

I hope it helps you

In the Always sensor, activate true level triggering.
It is the most left button. Hover above it and you ll see.It will work afterwards.

oh wow, thank you so much! It works now :)
Is there any way to change the speed at which it functions/slow down the framerate?

Add "bge.logic.setLogicTicRate(1.0)" below "current_frame = 0".
Be careful it affects all the logic bricks. I guess there are tons of ways to do this.

instead you can change the frequency of the always brick

How do you do that?


text:
Write out animations to separate files?
Is there any way I can, after rendering an animation/physics simulation, write out said animation to an external file? Needs to be a file format compatible with Linux (I'm new to Linux so unfortunately I don't know what sort of file would work for this). I also need to be able to, ideally, do this within the script controlling the animation/simulation.
Thanks so much!

I think you mean saving the animation data or sim data to an external file(s) correct?

Your simulation data should be baked, and you can specify the bake save location in the sim settings. As for animation you usually want to save as a PNG image sequence - see Knuckles' answer. If you need to render each frame at varied stages, like a composite image and also a mask, you can use output nodes in the compositor for saving variants.

Do you render (create a video with Blender) or do you want to capture the game output (create a video with the BGE) or do you want to record the motions done by an object while running the game (recording actions in the BGE)?

You can render your file and save its output with blender's default terminal options, or you can process data in the scene with a python script called from the terminal. For a general idea of how to use the terminal flags, see the wiki manual here:
https://www.blender.org/manual/render/workflows/command_line.html
For a full list of terminal flags, run ./blender --help from a terminal. Also see this answer for using a python script from the terminal:
How to enable an addon on startup via script?
What I am understanding is you want to render out image data, not animation data. If you are rendering out into a video file, I would recommend instead to render into an image sequence, which you can then compile into a video. You can easily do this through FFMPEG or the VSE. This is because if blender crashes during render, you don't need to splice together a number of video files; you can simply continue where you left off without worry.
If you want to export animation data for use in another program, you will have to export the animation through one of the exporters, not through rendering. If you're using the BGE, you don't need to export your animation data, as the BGE is integrated and has direct access to your scene. If you're using external software, like Maya or Unity, you will need to use the FBX or Collada exporters, which are included with blender.
If you could clarify what you're asking for, we can be more specific in our answers. As it is, it's somewhat ambiguous what you're asking for.

Yes, Go to rendering panel and change the format [ GREEN ] to AVI JPEG or AVI RAW For more high quality without using a sequence of images. Select image files [ GREEN ] Such as PNG or JPEG for image sequences which you can put together manually but are usually more high quality. Click the folder [ YELLOW ] To select where to save the file.

Does this work in the game engine? /any way to do this without using the gui? Ideally I'd like to append some sort of code that does this to a script that produces some sort of animation so it's automatically written out as soon as the animation is complete.


text:
Control logic editor using scripts?
I'm trying to bypass the GUI and just use the logic editor via scripts, e.g. I want an object to move +1 blender unit in the x direction each frame for a physics simulation but don't want to have to use the GUI to implement this. Is there any way to work around this?
Thanks!

Do you want to use the logic bricks only to run the script or you don't want to use the logic bricks at all?

So I don't know how to use the script to control the objects without using logic bricks of some form (if there's an alternative method, that would be awesome) but just don't want to have to use the gui to set them up

I do not know the background of your requirement. It seams a bit strange.  If that is really an issue, you can - use another game engine or build your very own BGE from the sources that allows to skip the GUI.

So this is all background work to set up an interface between a neural network and a blender game environment in which the net controls an agent in said environment-so the network will output something like "move 3 units in the x direction" which should then be fed in as an input to a script that would then move the agent accordingly

So avoiding the GUI is no requirement at all. What you need is a way to detect incoming data (from your network) and act accordingly. As there is no sensor detecting your custom network you need to implement that by yourself. I recommend the the solution below - you can measure the communication via an always sensor connected with a Python controller. The Python controller can look for new information from your network (act like a sensor).

Ok so based on your comment, I can tell you that you will need at least an always brick or sensor to activate the scripts. So you can't dodge that one.
Afterwards you can put them all in the same script, but it is not recommended cause of possible delays and cause you miss some of the good stuff blender has.

so I'd be forced to use the gui for at least some part of this?
:/

Yes. At least to make the script run you 'll be forced.


text:
collision bounds with python?
I have a plane and I want to set its collision bounds programmatically (I have some other objects in my scene and I want it to act as a floor). How do I do this? Couldn't really find anything conclusive online...
Thanks!

Please indicate which fields/values specifically you want to update via python. Screenshots, etc.

Do you mean the collision shape of a rigidbody?


text:
Program keyboard input?
I need to run some basic physics simulations on a headless machine and I'd like to program agent movements based on function outputs (e.g. "move left")-I have some code that programs WASD to move a cube that I'd like to modify such that it doesn't actually require me to press any keys but rather, if the program receives "Wkey" as an input (from another function) it's able to move the agent in the desired direction. Is this possible? (I also want to try to avoid using the logic editor to run the script if possible, any help on that would also be appreciated)
Current code below:
import bge

def main():

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

    keyboard = bge.logic.keyboard

    wKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.WKEY]
    sKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SKEY]
    aKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.AKEY]
    dKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.DKEY]

    if wKey:
        own.applyMovement([0,0.2,0],True)

    if sKey:
        own.applyMovement([0,-0.2,0],True)

    if aKey:
        own.applyMovement([-0.2,0,0],True)

    if dKey:
        own.applyMovement([0.2,0,0],True)

main()

I don't know about sending keystrokes but here's a suggestion : make dummy object ( the keyboard ) with bool properties ( keys ) and the functions set the props and others read them , how is that ?

Generating keyboard events is outside the scope of the BGE. I suggest to look for external tools (e.g. tools for GUI testing). Your "main()" problem is that you rely on the keyboard events. I suggest to remove that dependency and control the objects behavior via other events (e.g. messages, property values).

Here is a simple script that will create a keyboard object ( an empty )that have properties act as keys, this objects read the keys states from a file (inside blender or on the system ) and set them according to it.
the script will also create a player object (a cube) which will read the keys properties of the keyboard object and use it as real keyboard input. ( I added the keyboard object to keep the players scripts simple and they will be easy to convert to use a real keyboard )

this script will automate the whole process : create objects, set the logic bricks, load the scripts' files and start the game engine.
To test the script start blender and paste the script and hit Run Script you'll see the game engine start and the cube start moving. or you can start blender from the command line with this script to avoid using the GUI
#key strokes for each logic tic

keys_str="""w,w,w,w d,w d,w,w,w,w,w,w,a,a,
a,a w,a w,a w,w,w,w,w d,w d,w,w,w,w,w,
w,a,a,a,a w,a w,a w,w,w,w,w d,w d,w,w,
w,w,w,w,a,a,a,a w,a w,a w,w,w,w,w d,w
d,w,w,w,w,w,w,a,a,a,a w,a w,a w,w,w,w,
w d,w d,w,w,w,w,w,w,a,a,a,a w,a w,a w,
w,w,w,w d,w d,w,w,w,w,w,w,a,a,a,a w,a
w,a w,w,w,w,w d,w d,w,w,w,w,w,w,a,a,a,
a w,a w,a w,w,w,w,w d,w d,w,w,w,w,w,w,
a,a,a,a w,a w,a w,w,w,w,w d,w d,w,w,w,
w,w,w,a,a,a,a w,a w,a w,""".replace('\n','')

#### script for the player object
ob_txt="""
import bge, bge.logic

scene = bge.logic.getCurrentScene()

kb = scene.objects["keyboard"]
keys = ["shift", "ctrl", "space", "w", "s", "a", "d"]

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

if kb["w"] :
        own.applyMovement([0,0.2,0],True)
if kb["s"] :
        own.applyMovement([0,-0.2,0],True)
if kb["d"] :
        own.applyRotation([0,0,10],True)
if kb["a"] :
        own.applyRotation([0,0,-10],True)
"""

### script for the keyboard object
kb_txt="""

import bge, bge.logic
import bpy

keys = ["shift", "ctrl", "space", "w", "s", "a", "d"]
scene = bge.logic.getCurrentScene()
cont = bge.logic.getCurrentController()
own = cont.owner

def reset_keys():
        for key in keys:
            if own[key]:
                own[key] = False

def read_keys():
      i = own['line']
      # with open(r'C:\path\to\myfile', 'r') as file:
      #       line = file.read().split(',')[i]
      line = bpy.data.texts['keys'].as_string().split(',')[i]
      cmds = line.split(' ')
      for key in cmds :
            if key in keys:
                  own[key] =True
      own['line'] += 1

reset_keys()
read_keys()
"""

### setup script

import bpy

context = bpy.context
data = bpy.data
scene = context.scene

##### scripts' texts ####
kb_script_txt = bpy.data.texts.new('kb_script')
kb_script_txt.write(kb_txt)

ob_script_txt = bpy.data.texts.new('ob_script')
ob_script_txt.write(ob_txt)

keys_txt = bpy.data.texts.new('keys')
keys_txt.write(keys_str)

##### keyboard object #######
bpy.ops.object.empty_add()
bpy.context.object.name="keyboard"

####### properties  ########
keys = ["shift", "ctrl", "space", "w", "s", "a", "d"]
for key in keys:
    bpy.ops.object.game_property_new(type='BOOL', name=key)
bpy.ops.object.game_property_new(type='INT', name='line')

######## logicBricks ######
actuators = bpy.context.object.game.actuators
controllers = bpy.context.object.game.controllers
sensors = bpy.context.object.game.sensors
#always sensor
bpy.ops.logic.sensor_add(type='ALWAYS')
always = sensors['Always']
always.use_pulse_true_level = True
always.frequency = 24
#script controller
bpy.ops.logic.controller_add(type='PYTHON', name="script_cont")
script_cont = controllers["script_cont"]
script_cont.text = kb_script_txt
#link them
always.link(script_cont)

##### player object #######
bpy.ops.mesh.primitive_cube_add()
bpy.context.object.name="player"

######## logicBricks ######
actuators = bpy.context.object.game.actuators
controllers = bpy.context.object.game.controllers
sensors = bpy.context.object.game.sensors
#always sensor
bpy.ops.logic.sensor_add(type='ALWAYS')
always = sensors['Always']
always.use_pulse_true_level = True
always.frequency = 24
#script controller
bpy.ops.logic.controller_add(type='PYTHON', name="script_cont")
script_cont = controllers["script_cont"]
script_cont.text = ob_script_txt
#link them
always.link(script_cont)

##### start game engine ######

bpy.context.scene.render.engine = 'BLENDER_GAME'
for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        override = bpy.context.copy()
        override['area'] = area
        bpy.ops.view3d.game_start()
        break

oh wow, thank you so much-quick question, once i've loaded up blender from the command line, how do i run this script within it?

@ArchanaRam blender  --python myscript.py  this how you run it from the start

you have to save it in .py file, and put the cmd can find it ( where you started the cmd )

Sorry-quick question: how do I end the game engine? Would it be bpy.ops.view3d.game_end() ?

Working on getting this to run-do I save the file in the same directory as the one from which I'd open blender?

I'm working on running blender headlessly and I keep on running into "--bash: blender: command not found..." not sure what to do, trying to troubleshoot. Do you happen to know why that's happening?

the system needs to know what is "blender", you either add blender.exe to the PATH variable of your system OR  put the script in the same folder as blender.exe

the script is in the same folder as blender, not sure why it's still not working

@ArchanaRam the batch file needs to be there too , or lunch the CMD in that folder ( i have just tried and it did works except launching the BGE, maybe it should wait for the gui to load or something else )

so you have the blender.exe , script.py in one folder and you launch the CMD in that folder with the command blender --python script.py

yeah, that's the same error i'm getting...everything loads but the game engine can't start...not sure how to fix


text:
Run blender without GUI?
I'd like to use Blender's physics engine/rendering capabilities headlessly (so it would have to be via command line). I'd like to run a lot of little physics experiments (thousands) on a server. Python scripting will be involved in this, naturally-not sure how to do this without using the logic editor, though...I need some way to be able to run these scripts and have Blender output some sort of physics "movie" without having to deal with the GUI. Is this possible?

Yes, this is quite possible. Some related questions: http://blender.stackexchange.com/q/3061/599 and http://blender.stackexchange.com/q/724/599

I'm not sure about running the game engine without a gui, but you could use the built in rigid body sim. See http://blender.stackexchange.com/q/34400/599

Just a note, the physics engine in Blender is not physically-acurate nor energy conserving. I would evaluate the simulation results carefully.

The physics engine used by the BGE is the Bullet engine. I suggest to check if you can find an application that uses Bullet too but provides you with a gui-less processing. The BGE is designed to serve games. Typically they need video output. An application focusing on physics simulation might fit your needs better.

I'd like video output (hence the use of blender), I just want to run it without the GUI

Headless means you do not have a video output device. Typically the results are written to persistent storage (e.g. files). The BGE does not support such feature. With Blender I do no know .. see the comments above. I'm still not sure if you talk Blender or the BGE. Blender does not need any input from the logic editor.

Oh ok-I've been using bge up to this point but if I can achieve the same results just with blender that would be great

Have you tried blender --background -P your_script.py -- py_argv1 py_argvN?
% blender --help|grep background
-b or --background
    Run in background (often used for UI-less rendering).
    Enable time profiling for background jobs.
    Playback <file(s)>, only operates this way when not running in background.
    # blender --background test.blend --render-frame 1 --render-output '/tmp'
    # blender --background --render-output /tmp test.blend --render-frame 1
    # blender --background test.blend --render-output /tmp --render-frame 1

how do you enable time profiling for background jobs in 2.83 from the command line?


text:
Get agent to move using commands stored in separate file?
I have a script that allows a cube to be moved using WASD. I'd like to avoid having to use actual keyboard input for that and thought about creating a separate file with commands like "Wkey" and such. I'd then have a function read through the file and have the agent respond to the commands in the file accordingly.
Is this possible/if so, how would I go about doing it? (New to blender/still relatively new to python honestly)
Script below:
import bge

def main():

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

    keyboard = bge.logic.keyboard

    wKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.WKEY]
    sKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SKEY]
    aKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.AKEY]
    dKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.DKEY]

    if wKey:
        own.applyMovement([0,0.2,0],True)

    if sKey:
        own.applyMovement([0,-0.2,0],True)

    if aKey:
        own.applyMovement([-0.2,0,0],True)

    if dKey:
        own.applyMovement([0.2,0,0],True)

main()

I've been thinking about this-since wKey, sKey, aKey and dKey are all bools, can I just start off (in the same file) setting them to true?
I tried wKey = 1 and stuff and vaguely remember a .ispressed() function but can't remember the proper syntax...

yeah, sorry-i should delete that one...this is more in line with what i want to do

I'm not sure, but you might edit the first question to fit your needs.


text:
Move object closer to another object using python?
I'm setting up a simple game loop in which the agent tries to collide with "enemies" (so they'll have the game property "enemy") and tries to steer clear of other objects (let's call them friends). I want to write a script that makes use of the near sensor to do this-so if an enemy is detected nearby, the agent moves towards it and, if they collide, the enemy is destroyed. Similarly, if the near sensor detects a friend, the agent moves away from it (to make things more interesting, maybe I can apply endobject() or something to the agent if it accidentally collides with a friend). Is there any way to programmatically get the agent to move towards/away from other objects with these specified properties?
And, for that matter, is it possible to specify these game properties programmatically? I want to avoid using the gui as much as possible.
Thanks so much!

The near sensor has an attribute "Property". The sensor will filter the sensed objects by to have a property of the same name.
So you are able to sense friends by giving them a property called "friend" and let the near sensor filter for "friend" too.
Do the same thing just with "enemy" to sense enemies.
To get the appropriate operation after detecting the near event you can use either the steering actuator (Flee, Seek, Path following), or you activate an TrackTo + Move forwards/backward. I'm sure there are more options.
Detecting a collision can be done via collision sensor. An object can end itself via Edit Actuator in End Object mode.


text:
How do I change the linear stiffness of an object programmatically?
I want to programmatically change the linear stiffness of some soft body objects I'm working with. How do I do this?
Thanks!


text:
bge keeps on crashing when I try to do soft-body simulations?
I've written a script that creates an environment with various physics types-it generates a fair number of soft body objects (>100) and, unfortunately, when I try to run the sim, blender crashes. Any way to fix this?

My guess is that BGE runs out of ram. Does the thing dramatically slow down before crashing or go go poof right when the simulation starts?

yeah, it slows down dramatically, i'm going to try it on a computer with more ram so we'll see

A slightly more practical test would be to set the draw type to Bounding Box and see what happens. Also in my experience softbodies and meshes with bounds set to Convex Huull or Triangle Mesh are quite memory-expensive.

Also, does the simulation need to be different every time? You could try to bake part of the objects (if they are there at the start of the simulation) to keyframes and have them be on rails. To bake the frames, you can go to game > record animation and hit P.


text:
set mass of objects via python?
I'm scripting this file that generates an environment containing objects of different masses, shapes, sizes and physics types. I'm having trouble setting the mass, though...
e.g.
bpy.ops.mesh.primitive_plane_add(location=(0,0,-20))
plane = bpy.data.objects["Plane"]
plane.scale=((200,200,200))
plane.game.physics_type = 'STATIC'
plane.static.mass = 20

^^^plane.static.mass doesn't work and neither does plane.mass. How do I do this/get it to also work for rigid body and soft body objects?

You need to find the right path to the data you are looking for, using the python tooltips in blender can help here, they are enabled by default but if they have been turned off you can enable them in preferences. Searching through blenders python api online can also help.
First let's clarify your use case, you are setting plane.game.physics_type so you may want to set the matching plane.game.mass both of which are only relevant for the game engine physics.

If you are using the interactive physics available in the 3Dviewport then you will want to use plane.rigid_body.type and plane.rigid_body.mass


text:
Run bge for a certain number of frames?
Is there any way to programmatically specify the number of frames for which you want bge to run? Let's say I want bge to run for 5 frames after which I want to modify some game parameters via some script I have. I'm running everything via command line so accessing any sort of control features via the gui isn't an options. Is this possible?
Thanks!

You can measure the frames with a delay sensor:

How do I do this with python, though?

Setting up this logic bricks in Blender or running the BGE?

setting up the logic bricks above

It should be possible there is something like bpy.ops.logic.sensor_add(). But I can't help with Blender scripting.


text:
programmatically start the game engine?
I have this piece of code that's meant to start the game engine (and it does so if I just run this on the default screen)...I have a script that generates an environment with planes, spheres, etc. and appended this piece of code on the bottom but I'm getting a poll() context error...I'm in 3d view by default and the below thing should make it run in the game engine...any way to fix this so it actually works?
bpy.context.scene.render.engine = 'BLENDER_GAME'
    for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        override = bpy.context.copy()
        override['area'] = area
        bpy.ops.view3d.game_start()
        break

can you post the error message that is in the console?

My guess is that you are in edit mode. The bge will only start in object mode.
Adding this line bpy.ops.object.mode_set(mode='OBJECT') to your script will alleviate that issue.
Your edited code:
import bpy

bpy.context.scene.render.engine = 'BLENDER_GAME'

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        bpy.ops.object.mode_set(mode='OBJECT')
        override = bpy.context.copy()
        override['area'] = area
        bpy.ops.view3d.game_start()
        break

hm, I'm still getting a poll() context error...
full error message: RuntimeError: Operator bpy.ops.view3d.game_start.poll() failed, context is incorrect


text:
Some objects don't deform with the others while in pose mode
This is mainly what happens when I try to pose the rig.
https://i.sstatic.net/bgIdf.jpg  (GIF)
Almost all the rig works fine except for these few, even though these few should be in the same group:

All of the rig is colored blue in weight paint, no color difference.
As for for the snag in the dress in the gif, I can fix that.

Please post the animated gif here as well, we try to avoid too many external links if we can.

You have to manually fix the weights that generated automatically.


text:
Fur not moving with rigged main mesh
So i created this bear model with fur and rigged it but when i pose it only the bear´s base mesh moves and not the fur. i can´t find what to do anywhere. Need help please!
This is what it looks like:

You have to move the particles modifier to the bottom of the modifiers stack, this way the particle system will use the modified mesh from the previous modifiers:

Note:
also there is an option on the particle system tab to use the modifiers stack ( but I don't think it does anything ? )

Thanks a lot man!!! It worked. didn´t think i would get an answer.


text:
How do I make hair particles color independent from emitter?
I'm quite a newbie to Blender and I'm making my first face modeling. I'm having a real hard time on the eyebrows.
I'm using a particle system to make them, but my problem is that to change the color of the particle, I have to assign a material but it looks awkward.

As you can see in the image, to make the hair brownish, the only solution I found is applying it to a material. But it does not look great.
So my question is, is there a way to change hair particle color without being obliged to assign a material?

(this tricked also me) you need to add at leat two materials to the emitter mesh and then under the emitter setting you'll find both the materials (just select the one for the hairs)


text:
Blender Denoise and Glare nodes
I want to add a glare node to my render result but when I do that I can't use the denoise node, I tried to combine them with mix node but then it's only allowing to 50% of each node to take effect on the render.
I tried to save the render after denoise is applied and then open it in a new image node in blender and the connect it to glare node but it doesn't look good, looks a lot darker and I tried all the color spaces on the node and none of them gives the result that I want.

So it was a simple fix, just had to connect the denoise node to glare and then the glare to composite and now the image have a full denoise applied to it and also the glare effect that I wanted.


text:
How to ease out the retopology works on Blender, like in Zbrush with groups and remesh, for a character you need to animate?
I've been using Blender to sculpt recently, and I'm sculpting a character that I want to animate.
I'd like to make groups to remesh separately from the rest of the mesh, and ease out the retopology work to then project it on the hi-res mesh, then make a displacement map out of the hi-res mesh to apply on my low res retopology.
A bit like what you can do in zbrush.
Is there a similar way to do that in blender ?

I found the answer with Blender version 2.83. There's a new feature called Face Sets, when remeshing you can tick the box to preserve the face sets in tool layer > Remesh.
But you have to make sure you ticked off "Dyntopo" before, or you won't be able to remesh.


text:
Rigify new face rig blender 3.0
There's a new version of rigify, that's awesome, problem being it fails at generating the rig with this error:
RIGIFY ERROR: Bone 'jaw_master': Mouth corner counts differ: ['lip_end.B.L.001'] vs [] Incorrect armature for type 'skin_jaw'

After meddling a bit with it I figured the problem was about the placement of the jaw_master, but I don't understand how it has to be placed in order to avoid this.
Anyone have an idea ?

First solution I found:
upgrade the face rig BEFORE setting your rig, I wouldn't recommend you to delete one side of the meta-rig to symetrize it later, just use the mirror and place the bones...


text:
Bone Heat Weighting Failed, no solution works
I've been trying to get the headband connected to the bone. The selected piece
I used Vertex Cleanup but it did nothing and deformed my mesh so I'm trying to find some solutions

It's probably failing due to too much small topology. Try to reduce the number of vertices again. Or scale everything up so that more space exists between headband vertices.


text:
I Made My Model Backwards Anyway To Fix?
So realizing after some time I didn't know it was facing the wrong or made it on the opposite side
Also a way to fix it without deforming it

I'm hoping I can fix it, if not I have to make a new model.

Maybe try pressing CTRL+M and then Y (will mirror-flip the object on the y axis)

Tried It Almost Worked But The Feet Are Deformed


text:
Using Cycles renderer the reflections look good in viewport but not in in the render, why is this happening?
Im using Cycles renderer and there is no reflection when I render the image
I ve been searching for solutions but I couldnt find any,
Im using Blender 2.83
This is how it looks in the viewport

This is how it looks when I render it

This is the material

And these are the render settings

Please edit your question and add an image that shows the issue, plus an image of the materials, plus an image of the render settings. With no information is hard to help

Does this answer your question? Why does my object not show up? # cause number 12

The issue is not the reflections, but the fact that they are blocked by something else. It looks like you have another object on top that is not visible in the 3d viewport but is renderable.
Those three big squares that are overlaid on the ground most likely belong to such object.
In the outliner search for objects that have been disabled for view (eye icon) but have the camera icon enabled. The camera icon determines if the object renders or not.

Okay, Its true, there were some planes on top,I removed them but the problem was still there. For the past 2 hours I ve been changing and moving everything  to find where the origin of the problem was. I finally tried to use the material in another plane, and it worked! So I realized that the problem was just that for some reason the ground plane I was using wasnt rendering correctly, I ve put a new plane and now I works correctly. However, thank you very much for the help!

"For some reason" is not a good reason. There has got to be a more reasonable explanation without having to put a new plane. More information is needed to get to the bottom of this.

Then don't mark the question as solved if it didn't solve anything, We all can learn a lot more by getting to the bottom of this. I'm sure it is a simple fix as well. Try this: make a copy of the original file that has the problem. Remove objects that are not relevant to the issue until you are left with the problem only. Then share the file for others to inspect.

Okay, where can I share the file?

https://blend-exchange.giantcowfilms.com/ paste the link in the text of the question.

Remember to "pack" the textures you are using, Otherwise they are not saved as part of the file.

Okay, you where right, there was a hidden plane that I didnt see (different from the ones I was talking about before), I was preparing the file to share it and I found it, I erased it and now it works correctly. Im sorry for the inconvenience, and thanks for the solution

Gad to help. Now the answer makes sense. Cool image, by the way!


text:
New Blender Artist Requires Tips in Regards to Modeling
I applied a subdivision surface modifier to the main part of the weapon, and I’d just like some suggestions for how to make the part that is circled which is part of the main part of the weapon.

I thought about creating a whole new object, but I’m not sure if that’s a quality thing to do. Some edge loops might do the trick too. What would you guys do?

Hi Please use a title that reflects the content of the question. It should be descriptive but succinct, unique and identifying, summarizing the issue so that users can at a glance understand what your post is about. Use the [edit] link below your post and avoid anything not strictly essential to the post. Remember, your title is the first thing potential visitors will see, and makes your question findable for future users. See "What is the problem with posting an image or link and asking “How do I do this?""


text:
The tab where tools show up are all gray and I cant select the mode I want
I'm trying to color a model but the proper coloring tool is not showing up

punziletrix found the reason for the problem (not sure why the answer was deleted): "it turns out I wrote something in the search box  and didnt notice. it went away when I deleted what I wrote"

Maybe @DuarteFarrajotaRamos deleted the answer because he deemed it too poor in quality? Can't see any other reason since it seems to be the correct answer to the question.

Apologies, when I first read it I didn't realize it was an answer, looked like a comment about this site search feature, rather than Blender UI properties search feature. Could you elaborate a bit on your answer to improve it? Maybe provide some more details about the procedure and how it works, perhaps add a few images illustrating some steps and final result. See How to write a good answer?.

It turns out I wrote something in the Properties Window search box which highlights matching properties. Greyed out elements went away when I deleted what I wrote.


text:
AttributeError when adding keyframes in draw function
I am trying to add add keyframes to an object from values in a csv file using python. It successfully reads the file and puts it into a list. However, it just gives me this error when adding the keyframes.
AttributeError: Writing to ID classes in this context is not allowed: Camera, Object datablock, error setting Object.<UNKNOWN>

This is the code that i have so far:
def draw(self, context):
    results = []
    layout = self.layout

    obj = context.object

    with open('record.txt', newline='') as inputfile:
        for row in csv.reader(inputfile):
            results.append(row)
    line = 0
    for x in results:
        line += 1
        if line > 2:
            currentFrame = str(x)
            xRot, yRot, zRot,_,_ = currentFrame.split(';')
            xRot = xRot.replace("['", "")
            print(xRot + " " + yRot + " " + zRot)
            obj.rotation_euler[0] += float(xRot)
            obj.keyframe_insert(data_path="rotation_euler", frame= float(line), index=0)
            obj.rotation_euler[1] += float(yRot)
            obj.keyframe_insert(data_path="rotation_euler", frame= float(line), index=1)
            obj.rotation_euler[2] += float(zRot)
            obj.keyframe_insert(data_path="rotation_euler", frame= float(line), index=2)

I would appreciate suggestions in how to solve this issue.

Can you post a sample line from the csv file?

Also see : http://blender.stackexchange.com/questions/17919/importing-trajectories-to-create-an-animation?rq=1 it's related

@geooot i'm pretty sure the code as you wrote it - for adding keyframes - doesn't work as intended, a sample line (or several lines) of the record.txt file would let us give working solutions.

@zeffii Here is a line of the csv file http://pastebin.com/pygPSnRA

@geooot I've adjusted my answer. care to share a file I could test it on - seems like fun.

those gyro components might be outputting on a range of 0..360, but blender rotation_euler expects the range of 0..2*PI

@zeffii i converted the gyro variables using the standard math.radians() function. However the gyro data is sensitive and the camera still spins out of control. It was stabilized once i scaled the f-curves down. but it still works. :)

I just noticed, it's degrees per second,  given in ms - meaning you might be getting many more updates than your frame-rate (24 hz?) ..so yeah, some smoothing and quantization may be in order.

The draw function is for UI only (defining layout and visibility of properties, sliders etc). It's called multiple times per second, sometimes 20 or more times, as you move your mouse around
You can't change bpy.data (including keyframes) from inside draw, it is blocked by design. You probably don't want to repeatedly execute that code anyway. A standard approach is to Run it from Text Editor with or without an enclosing function.
If this represents the first and second line of the the dataset, and the next lines are all formatted like line 2.
dataset.txt
GYROSCOPE X (°/s);GYROSCOPE Y (°/s);GYROSCOPE Z (°/s);Time since start in ms ;YYYY-MO-DD HH-MI-SS_SSS
9.08;-1.04;-9.51;20;2015-07-03 14:17:34:206

code
import csv
import bpy

def some_function(fp):

    obj = bpy.data.objects['Camera']

    results = []
    with open(fp, newline='') as inputfile:
        row_gen = csv.reader(inputfile)
        next(row_gen) # skip first line.

        for row in row_gen:
            results.append(row[0].split(';'))

    # start making frames at frame 1
    for idx, frame_data in enumerate(results, 1):
        xRot, yRot, zRot = frame_data[:3]
        print(xRot, yRot, zRot)
        obj.rotation_euler[0] += float(xRot)
        obj.rotation_euler[1] += float(yRot)
        obj.rotation_euler[2] += float(zRot)
        obj.keyframe_insert(data_path="rotation_euler", frame=idx, index=-1)

some_function(fp='/home/zeffii/Desktop/zen/dataset.txt')

The -1 at the end indicates that the keyframe is to be added after the other existing keyframes.

For info about paths; whether to use back or forward slashes, see:

https://blender.stackexchange.com/tags/path/info

Adding this for completeness, because it differs across Operating Systems.


text:
Is Blender compatible with Windows 10?
Will Blender still work on Windows 10, and if so, will the full screen functionality still work? Are there any issues with Blender and Windows 10 I should be aware of before upgrading?

I don't see a reason why Blender wouldn't work on Windows 10. You can use old versions of Blender that where designed for older versions of Windows just fine on newer versions of Windows.

I feel like you have a fundamental misconception of how Blender interacts with Windows...

I think something important to grasp, is that if Windows 10 completely changed the program API from what if used to be, a lot of software companies would probably get a bit angry, and it would be bad for business.

I had issue with Windows 10 and Blender 2.76. Apparently, I have a Microsoft Mouse and when Windows 10 was installed the default behavior of  mouse wheel button became to invoke so-called "Instant Viewer". Because of that I could not pan with pressing mouse wheel in Blender. Changed it to "Middle click" in Windows settings and not it works fine.

I am running Blender 2.75 on Windows 10 now, the 10240 RTM release, and it is working without any issues compared to my previous run on Windows 8.1.1.

As far as we know right now, no, there won't be any issues.
Windows probably couldn't afford a major change in their programming API that effect Blender.
It would probably make a few large software companies a bit angry.
As far as the fullscreen functionality, this is something that shouldn't really be effected much by the platform. If it wasn't working on a specific platform (that Blender can run on), it would be a major bug. Lot's of people (including myself) use this all the time to help focus on our work a bit more, and loosing the functionality would probably make half the community extremely angry.
Just a disclaimer, I haven't tried Windows 10, so I can't say for sure that Blender won't work on it, but I am extremely confident that it will.

I've just installed windows 10 and blender crashes instantly at start up. To make it run I've discovered that one must start the application directly from the directory and specify the graphic acceleration available by clicking the right button of the mouse.

I have W10 Pro (build 10240)  Blender 2.76 (2015-10-11)
Running multiple instance of Blender 24 hours a day for 1 month. Blender hasn't crashed
Full screen functionality.. not sure what that is. If it is where you CTRL right arrow to change the screen windows, yes can see the 3D view full screen and also drag new windows into it to see multiple views)
(Can pan with middle wheel click.)


text:
Bones Not Connected?
I've made this model with bones but when i try to animate the model by moving or rotating a bone it disconnects from another. How do i get a bone so when i rotate it its still connected to another bone?
Bone before rotation:

Bone after rotation:

I have no idea why this is happening i thought bones were supposed to be connected. I have been researching this problem for hours but this nothing about this, it doesn't look like anyone else has this problem.

You have to go to edit mode, select the two bones, Ctrl+P> Connected.
Also when you have added a bone, and then you go to edit mode. Select the tip of the bones and extrude it with E, then the bones are automatically parented to each other.

Thanks this worked but why weren't they connected properly, i extruded the bones out of the others so they should of been connected right?

@Awesome Name, if you extruded it out of the bones it should have been connected.

I must of accidentally disconnected it somehow


text:
Troubles with "Stretch To" constraint
Still feels a newbie with blender, so I have also dummy question. But while looking for the solutions, it looks that I'm not the only one. I'm trying to follow Ray Mairlot's You tube: Blender Tutorial: Laser Cutting Text Effect.
At 4:30 he adds the "Stretch to" constraint, and hit the same problem than many others. The object turn to away from the source object. See my simplified example:

Like on the other solutions, he rotate the object to -90 and bang! it is in correct position.
The answer I'm looking for is, what is actually causing this? Why rotation of the object should fix a problem? I mean, what is the error in a first place we all made to cause this?
And yes, I did not manage to get this fixed :D No matter how much I rotate it, it never follow the object. Some proposed to use "Copy rotation" constraint as well, but that was not helpful.
regards
Pepi

It looks like the Stretch constraint uses the object's Y axis as the one that points to the Target (and deforms the object). So if your object's Y axis already points towards the target it won't rotate, but if the Y axis is 90°, the object will rotate 90°. So, depending on how your object is oriented, you may need to correct its orientation.

big thanks for this. Strange limitation, but need to learn to rotate the object before start stretching.