Page 1 of 1

weird instance transformation

Posted: Fri May 23, 2014 7:22 am
by d76
Hello
can anybody explain this behavior please? what i intend is to make mirrored instance, but result is not as expected. when i clone object, everything works well..

edit: Forgot to mention that the base cube is not transformed. Directly taken from library as it is.
Code: Select all
#!/Library/Frameworks/Python.framework/Versions/3.2/bin/python3
# -*- coding: utf-8 -*-

from pymaxwell import *

scene = Cmaxwell(mwcallback)
scene.readMXS("Cube.mxs")
c = scene.getObject("Cube")

o = scene.createInstancement("Cube2", c)
b, p = c.getBaseAndPivot()
b.xAxis = Cvector(b.xAxis.x() * -1.0, b.xAxis.y(), b.xAxis.z())
o.setBaseAndPivot(b, p)

scene.writeMXS("Cube2.mxs")
Image

Re: weird instance transformation

Posted: Wed May 28, 2014 1:42 pm
by Brany
Maybe the problem here is get/setBaseAndPivot are ignored when scene is opened in Studio. Rendering the scene in maxwell directly must work. I tried to make a mirrored cube and it worked for me:
Code: Select all
from pymaxwell import *

scene = Cmaxwell(mwcallback)
scene.readMXS("d:/Cube.mxs")
c = scene.getObject("Cube")

o = scene.createInstancement("Cube2", c)
b, p, ok = c.getBaseAndPivot()
print b
print p
b.xAxis = Cvector(b.xAxis.x() * -1.0, b.xAxis.y(), b.xAxis.z())
b.origin = Cvector(b.origin.x() , b.origin.y() + 2, b.origin.z())
print b
print p
o.setBaseAndPivot(b, p)

scene.writeMXS("d:/Cube2.mxs")

parameters = [];
parameters.append('-mxs:d:/Cube2.mxs');
parameters.append('-sl:3');
runMaxwell(parameters);
And the result is:

Image

bottom cube is the original one, top cube is the mirrored one (translated up 2 meters too)

Re: weird instance transformation

Posted: Wed May 28, 2014 8:58 pm
by d76
Thanks for reply, you were right, render is ok but in Studio it is rotated. The same if i render it directly from Studio or saved as new mxs from Studio..
Will test in 3.0 tomorrow, maybe it is time to upgrade also my scripts.. or fill bug report..

Re: weird instance transformation

Posted: Thu May 29, 2014 10:42 am
by Brany
Anyway, we have to improve our API to handle object transformations properly, so Studio and Maxwell can handle the Maxwell API transformations in a straight way.

Maxwell Render is not an "animation" platform, thats why object transformations are not well supported by now. But with the python API users started to "animate" things by code, so I hope we can offer a good API for this, please be patience!