Page 1 of 1

resizing background with script

PostPosted: Thu Sep 27, 2018 7:24 am
by Shreyansh_Dubey
How can I edit 0_modelling_background.py so that I am able to resize the background image with respect to the height of my humanoid object.
Or my work can also be done if I am able to set a maximum background image size, actually when I grab the model I want to convert the screenshot in a perfect binary image of the humanoid model so i was setting a white background to it. I am able to resize the backgroud manually by holding shift+rightclick+mouse but all the work of designing the model I am doing with script so I can't do it manually for every model that I make before taking the screenshot I just want a way through which I can either set a maximum sized background image possible for all models(such that all my models fit into that white background), or my background should adjust its size automatically with the height of model. In all I just want a perfect white background for every model that I take before I take a screenshot, and this should happen through script only.

Please anyone help me. :geek:

Re: resizing background with script

PostPosted: Thu Sep 27, 2018 9:44 am
by Shreyansh_Dubey
I found that thing we will have to edit 0_modelling_background.py in line 425(in my sys), actually it is in this
[ def setBackgroundScale(self, scale):
if not self.isBackgroundShowing():
return
side = self.getCurrentSide()
scale = abs(float(scale))
(_, aspect) = self.getCurrentBackground()
self.backgroundImage.mesh.resize(scale * 50.0 * aspect, scale * 50.0) ## changed here both places from 20 to 50 to apply maximum background size
self.transformations[side][1] = scale
]

And now the background will appear to remain unchanged even after increasing height as we have increased the aspect and scaling.

Re: resizing background with script

PostPosted: Thu Sep 27, 2018 7:53 pm
by Aranuvir
Code: Select all
from core import G

sides = { 'front': [0,0,0],
             'back': [0,180,0],
             'left': [0,-90,0],
             'right': [0,90,0],
             'top': [90,0,0],
             'bottom': [-90,0,0]}

category = G.app.getCategory('Settings')
task = category.getTaskByName('Background')
G.app.axisView(sides.get(<MySideName>, [0,0,0]))
task.setBackgroundScale(<MyFloatVal>)


I don't thinks there is another way to access background data...