Skip to main content
added 158 characters in body; edited tags
Source Link
Chebhou
  • 19.7k
  • 54
  • 100

I am sending object lorloc rot and scale every keyframe to http address using urllib but the frame rate drops significantly. 
Thats the code I am using:

import bpy import urllib import mathutils from bpy import context from urllib import request, parse from math import sin, cos, radians from mathutils import Matrix def RunPerFrame(scene): for obj in bpy.data.objects: mat = bpy.context.object.matrix_world loc = mat.to_translation() rot = mat.to_3x3().to_quaternion() scale = obj.dimensions qtX = round(rot.x,3) qtY = round(rot.y,3) qtZ = round(rot.z,3) qtW = round(rot.w,3) loX = round(loc.x,3) loY = round(loc.y,3) loZ = round(loc.z,3) scX = round(scale.x,3) scY = round(scale.y,3) scZ = round(scale.z,3)
url = '' values = { 'msgInstruction=' : 'MOVE_OBJ', 'rotQuat=' : str(qtX) + ',' + str(qtY) + ',' + str(qtZ) + ',' + str(qtW), 'objLoc=' : str(loX) + ',' + str(loY) + ',' + str(loZ), 'objScale=' : str(scX) + ',' + str(scY) + ',' + str(scZ) } data = urllib.parse.urlencode(values) encoded_data = data.encode('ascii') req = urllib.request.Request(url, encoded_data) response = urllib.request.urlopen(req) the_page = response.read() bpy.app.handlers.frame_change_pre.append(RunPerFrame)

import bpy
import urllib
import mathutils 
from bpy import context
from urllib import request, parse
from math import sin, cos, radians
from mathutils import Matrix


def RunPerFrame(scene):
    for obj in bpy.data.objects:
        mat = bpy.context.object.matrix_world
        loc = mat.to_translation()
        rot = mat.to_3x3().to_quaternion()
        scale = obj.dimensions
        qtX = round(rot.x,3)
        qtY = round(rot.y,3)
        qtZ = round(rot.z,3)
        qtW = round(rot.w,3)
        loX = round(loc.x,3)
        loY = round(loc.y,3)
        loZ = round(loc.z,3)
        scX = round(scale.x,3)
        scY = round(scale.y,3)
        scZ = round(scale.z,3)
        
    url = ''
    values = { 'msgInstruction=' : 'MOVE_OBJ',
        'rotQuat=' : str(qtX) + ',' + str(qtY) + ',' + str(qtZ) + ',' + str(qtW),
        'objLoc=' : str(loX) + ',' + str(loY) + ',' + str(loZ),
        'objScale=' : str(scX) + ',' + str(scY) + ',' + str(scZ) }


    data = urllib.parse.urlencode(values)
    encoded_data = data.encode('ascii')
    req = urllib.request.Request(url, encoded_data)
    response = urllib.request.urlopen(req)
    the_page = response.read()


bpy.app.handlers.frame_change_pre.append(RunPerFrame)

I am sending object lor rot and scale every keyframe to http address using urllib but the frame rate drops significantly. Thats the code I am using:

import bpy import urllib import mathutils from bpy import context from urllib import request, parse from math import sin, cos, radians from mathutils import Matrix def RunPerFrame(scene): for obj in bpy.data.objects: mat = bpy.context.object.matrix_world loc = mat.to_translation() rot = mat.to_3x3().to_quaternion() scale = obj.dimensions qtX = round(rot.x,3) qtY = round(rot.y,3) qtZ = round(rot.z,3) qtW = round(rot.w,3) loX = round(loc.x,3) loY = round(loc.y,3) loZ = round(loc.z,3) scX = round(scale.x,3) scY = round(scale.y,3) scZ = round(scale.z,3)
url = '' values = { 'msgInstruction=' : 'MOVE_OBJ', 'rotQuat=' : str(qtX) + ',' + str(qtY) + ',' + str(qtZ) + ',' + str(qtW), 'objLoc=' : str(loX) + ',' + str(loY) + ',' + str(loZ), 'objScale=' : str(scX) + ',' + str(scY) + ',' + str(scZ) } data = urllib.parse.urlencode(values) encoded_data = data.encode('ascii') req = urllib.request.Request(url, encoded_data) response = urllib.request.urlopen(req) the_page = response.read() bpy.app.handlers.frame_change_pre.append(RunPerFrame)

I am sending object loc rot and scale every keyframe to http address using urllib but the frame rate drops significantly. 
Thats the code I am using:

import bpy
import urllib
import mathutils 
from bpy import context
from urllib import request, parse
from math import sin, cos, radians
from mathutils import Matrix


def RunPerFrame(scene):
    for obj in bpy.data.objects:
        mat = bpy.context.object.matrix_world
        loc = mat.to_translation()
        rot = mat.to_3x3().to_quaternion()
        scale = obj.dimensions
        qtX = round(rot.x,3)
        qtY = round(rot.y,3)
        qtZ = round(rot.z,3)
        qtW = round(rot.w,3)
        loX = round(loc.x,3)
        loY = round(loc.y,3)
        loZ = round(loc.z,3)
        scX = round(scale.x,3)
        scY = round(scale.y,3)
        scZ = round(scale.z,3)
        
    url = ''
    values = { 'msgInstruction=' : 'MOVE_OBJ',
        'rotQuat=' : str(qtX) + ',' + str(qtY) + ',' + str(qtZ) + ',' + str(qtW),
        'objLoc=' : str(loX) + ',' + str(loY) + ',' + str(loZ),
        'objScale=' : str(scX) + ',' + str(scY) + ',' + str(scZ) }


    data = urllib.parse.urlencode(values)
    encoded_data = data.encode('ascii')
    req = urllib.request.Request(url, encoded_data)
    response = urllib.request.urlopen(req)
    the_page = response.read()


bpy.app.handlers.frame_change_pre.append(RunPerFrame)
added 1033 characters in body
Source Link
Denis
  • 13.3k
  • 7
  • 60
  • 83

I am sending object lor rot and scale every keyframe to http address using urllib but the frame rate drops significantly. Thats the code I am using:

url = ''
values = { }

data = urllib.parse.urlencode(values)
encoded_data = data.encode('ascii')
req = urllib.request.Request(url, encoded_data)
response = urllib.request.urlopen(req)
the_page = response.read()

import bpy import urllib import mathutils from bpy import context from urllib import request, parse from math import sin, cos, radians from mathutils import Matrix def RunPerFrame(scene): for obj in bpy.data.objects: mat = bpy.context.object.matrix_world loc = mat.to_translation() rot = mat.to_3x3().to_quaternion() scale = obj.dimensions qtX = round(rot.x,3) qtY = round(rot.y,3) qtZ = round(rot.z,3) qtW = round(rot.w,3) loX = round(loc.x,3) loY = round(loc.y,3) loZ = round(loc.z,3) scX = round(scale.x,3) scY = round(scale.y,3) scZ = round(scale.z,3)
url = '' values = { 'msgInstruction=' : 'MOVE_OBJ', 'rotQuat=' : str(qtX) + ',' + str(qtY) + ',' + str(qtZ) + ',' + str(qtW), 'objLoc=' : str(loX) + ',' + str(loY) + ',' + str(loZ), 'objScale=' : str(scX) + ',' + str(scY) + ',' + str(scZ) } data = urllib.parse.urlencode(values) encoded_data = data.encode('ascii') req = urllib.request.Request(url, encoded_data) response = urllib.request.urlopen(req) the_page = response.read() bpy.app.handlers.frame_change_pre.append(RunPerFrame)

Currently testing with one object and the frame rate drops below 2 fps Is there a way to make this faster with this code?

I am sending object lor rot and scale every keyframe to http address using urllib but the frame rate drops significantly. Thats the code I am using:

url = ''
values = { }

data = urllib.parse.urlencode(values)
encoded_data = data.encode('ascii')
req = urllib.request.Request(url, encoded_data)
response = urllib.request.urlopen(req)
the_page = response.read()

Currently testing with one object and the frame rate drops below 2 fps Is there a way to make this faster with this code?

I am sending object lor rot and scale every keyframe to http address using urllib but the frame rate drops significantly. Thats the code I am using:

import bpy import urllib import mathutils from bpy import context from urllib import request, parse from math import sin, cos, radians from mathutils import Matrix def RunPerFrame(scene): for obj in bpy.data.objects: mat = bpy.context.object.matrix_world loc = mat.to_translation() rot = mat.to_3x3().to_quaternion() scale = obj.dimensions qtX = round(rot.x,3) qtY = round(rot.y,3) qtZ = round(rot.z,3) qtW = round(rot.w,3) loX = round(loc.x,3) loY = round(loc.y,3) loZ = round(loc.z,3) scX = round(scale.x,3) scY = round(scale.y,3) scZ = round(scale.z,3)
url = '' values = { 'msgInstruction=' : 'MOVE_OBJ', 'rotQuat=' : str(qtX) + ',' + str(qtY) + ',' + str(qtZ) + ',' + str(qtW), 'objLoc=' : str(loX) + ',' + str(loY) + ',' + str(loZ), 'objScale=' : str(scX) + ',' + str(scY) + ',' + str(scZ) } data = urllib.parse.urlencode(values) encoded_data = data.encode('ascii') req = urllib.request.Request(url, encoded_data) response = urllib.request.urlopen(req) the_page = response.read() bpy.app.handlers.frame_change_pre.append(RunPerFrame)

Currently testing with one object and the frame rate drops below 2 fps Is there a way to make this faster with this code?

Source Link
Denis
  • 13.3k
  • 7
  • 60
  • 83

Sending object data from blender with urllib very slow

I am sending object lor rot and scale every keyframe to http address using urllib but the frame rate drops significantly. Thats the code I am using:

url = ''
values = { }

data = urllib.parse.urlencode(values)
encoded_data = data.encode('ascii')
req = urllib.request.Request(url, encoded_data)
response = urllib.request.urlopen(req)
the_page = response.read()

Currently testing with one object and the frame rate drops below 2 fps Is there a way to make this faster with this code?