Skip to main content
added 46 characters in body
Source Link

First see this and compare it with your code:

import bpy
from mathutils import Vector

# call this only once
# it adds vector attribute to all Object entities
bpy.types.Object.vector = bpy.props.FloatVectorProperty()

# design your callback function like this
def test(scenes):
    # select the group
    bpy.ops.object.select_all(action='DESELECT')
    for obj in bpy.data.groups['Würfel'].objects:
        obj.select = True

    # apply rotation
    bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
    
    # store the locations
    for obj in bpy.data.groups['Würfel'].objects:
        loc = obj.location
        obj.vector = Vector((round(loc[0], 0), round(loc[1], 0), round(loc[2], 0)))

If you do a test call with test(bpy.context.scene) everything will be fineit should execute without errors.

If you do bpy.app.handlers.frame_change_pre.append(test) it will also work fine on every frame change.

When the objects go into render pipeline the transformations are already 'set/converted' so there is really no data to transform in the pre_render handler.

First see this and compare it with your code:

import bpy
from mathutils import Vector

# call this only once
# it adds vector attribute to all Object entities
bpy.types.Object.vector = bpy.props.FloatVectorProperty()

# design your callback function like this
def test(scenes):
    # select the group
    bpy.ops.object.select_all(action='DESELECT')
    for obj in bpy.data.groups['Würfel'].objects:
        obj.select = True

    # apply rotation
    bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
    
    # store the locations
    for obj in bpy.data.groups['Würfel'].objects:
        loc = obj.location
        obj.vector = Vector((round(loc[0], 0), round(loc[1], 0), round(loc[2], 0)))

If you call test(bpy.context.scene) everything will be fine.

If you do bpy.app.handlers.frame_change_pre.append(test) it will also work fine on every frame change

When the objects go into render pipeline the transformations are already 'set/converted' so there is really no data to transform.

First see this and compare it with your code:

import bpy
from mathutils import Vector

# call this only once
# it adds vector attribute to all Object entities
bpy.types.Object.vector = bpy.props.FloatVectorProperty()

# design your callback function like this
def test(scenes):
    # select the group
    bpy.ops.object.select_all(action='DESELECT')
    for obj in bpy.data.groups['Würfel'].objects:
        obj.select = True

    # apply rotation
    bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
    
    # store the locations
    for obj in bpy.data.groups['Würfel'].objects:
        loc = obj.location
        obj.vector = Vector((round(loc[0], 0), round(loc[1], 0), round(loc[2], 0)))

If you do a test call with test(bpy.context.scene) it should execute without errors.

If you do bpy.app.handlers.frame_change_pre.append(test) it will work fine on every frame change.

When the objects go into render pipeline the transformations are already 'set/converted' so there is really no data to transform in the pre_render handler.

Source Link

First see this and compare it with your code:

import bpy
from mathutils import Vector

# call this only once
# it adds vector attribute to all Object entities
bpy.types.Object.vector = bpy.props.FloatVectorProperty()

# design your callback function like this
def test(scenes):
    # select the group
    bpy.ops.object.select_all(action='DESELECT')
    for obj in bpy.data.groups['Würfel'].objects:
        obj.select = True

    # apply rotation
    bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
    
    # store the locations
    for obj in bpy.data.groups['Würfel'].objects:
        loc = obj.location
        obj.vector = Vector((round(loc[0], 0), round(loc[1], 0), round(loc[2], 0)))

If you call test(bpy.context.scene) everything will be fine.

If you do bpy.app.handlers.frame_change_pre.append(test) it will also work fine on every frame change

When the objects go into render pipeline the transformations are already 'set/converted' so there is really no data to transform.