# Set rotation values without applying them

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?

P.S.: I NEED SCRIPT BASED ANSWERS ONLY

• 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. – gandalf3 Jun 1 '14 at 20:00
• 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 – bublible Jun 1 '14 at 21:41
• @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... – bublible Jun 1 '14 at 22:42
• @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! ;) – bublible Jun 2 '14 at 10:17
• Could you post your answer in the Answers box so this question can be marked as "answered"? – 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:
#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