Is it possible to set some rotation values to Blender GUI corresponding object fields (or any other like location or scale) without actually applying them to the object itself, like some sort of "offset"?

I mean I have script that set some objects to scene, rotate them right but writes its values as (0,0,0) instead of their real rotation values (but I know those real values myself so I could set them BUT without changing object actual rotation)...like let's say object rotation value is 0 but I want to be represented and set visually in Blender rotation fields as 90 - is something like this possible, please?


  • 1
    $\begingroup$ You could try something like setting the rotation to -180 (and actually rotating the object), applying it (setting rotation to zero without affecting the object), then rotating by 90. $\endgroup$
    – gandalf3
    Jun 1 '14 at 20:00
  • $\begingroup$ actually that was exactly what I was intended to do right from the first time but the problem is that the code is really quite complicated dealing with mathutils Matrix so it cannot be done easily like that simply because it is really problem to understand the code in its complexity...so I really need to know if what I am asking is possible at all $\endgroup$
    – bublible
    Jun 1 '14 at 21:41
  • $\begingroup$ @gandalf3 actually as I play more with the code now I see what you meant by APPLY and it could work, that was part I was missing in my concept ;) gonna play more with ot and then let you know... $\endgroup$
    – bublible
    Jun 1 '14 at 22:42
  • $\begingroup$ @gandalf3 yea, your solution with APPLYING CHANGES making values offset-like finaly works after some time of tweaking and changing things around, thanx a lot for the suggestion my friend! ;) $\endgroup$
    – bublible
    Jun 2 '14 at 10:17
  • $\begingroup$ Could you post your answer in the Answers box so this question can be marked as "answered"? $\endgroup$
    – rioforce
    Jun 2 '14 at 14:32

Here's a script which does this, comments inline.

import bpy
import math

#target rotation:
target_rotation = [90, 90, 90]
#object to operate on (active object):
ob = bpy.context.active_object

#this assumes you are starting at 0 rotaton, so you pobably want to apply rotation before doing anything:
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False) #apply rotation
#get inverse of rotation we want:
t_rot = (math.radians(target_rotation[0]*-1),
#we need to apply the rotations in reverse order, so unsure that we are in zyx:
ob.rotation_mode = 'ZYX'
ob.rotation_euler = (t_rot) #set rotation to inverse
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False) #apply rotation

t_rot = (math.radians(target_rotation[0]),
ob.rotation_mode = 'XYZ' #set rotation mode back (was zyx, so we want xyz)
ob.rotation_euler = (t_rot) #set rotation

Pardon my probably poor python ;)


You could try something like setting the rotation to -180 (and actually rotating the object), applying it (setting rotation to zero without affecting the object), then rotating by 90. – correct answer provided by gandalf3


Just for completeness sake

So gandalf3 provided a beautiful answer applying the difference. If however, you want to actually change the values, and only fake differing values in the user interface, you can overwrite the interface instead. The idea is to display custom properties instead of the ones usually found. The custom properties can then in turn set, get and modify the true values according to your likings.

This here is a much simplified example overwriting the render-panel.

class Render_panel_override(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Render"
    bl_idname = "RENDER_PT_render" # <== we assume the same bl-id that the original panel has
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "render"

    def draw(self, context):
        layout = self.layout
        obj = context.scene.objects.active

        layout.row().label(text="Hello world!", icon='WORLD_DATA')
        layout.row().label(text="Active object is: " + obj.name)
        layout.row().prop(obj, "name")

def register():

def unregister():

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.