Forum: Poser Python Scripting


Subject: Adv Object Import Utility (proposal)

Inception8 opened this issue on Jul 04, 2012 · 10 posts


Inception8 posted Wed, 04 July 2012 at 9:32 AM

 

I posted this in another forum but thought perhaps it could be better served if the idea was posted more openly.

Ahem:
Repetitive object importing into Poser.

I had an idea that I thought might be useful. As much for myself but probably for anyone that might be doing repetitive object importing into Poser like myself. The image diagram I've provided better represents the idea I had in mind.
Someone else also suggested a batch process addition.

Maybe some budding or experienced programmer might find it interesting to do if it hasn't already been done before.


PhilC posted Wed, 04 July 2012 at 11:51 AM

Does anyone know/understand the Matrix equations for rotation? The rest is pretty straightforward.


bagginsbill posted Wed, 04 July 2012 at 12:34 PM

Note: Thread editor trashes my indentation and formatting - you should be able to make sense of this even though the Python engine may not.

Note: My Vector/Vertex class (not shown here) has x, y, z, u, v, and uvd (uv direction used in various obscure transformations) arguments.

 

UP = Vector(0, 1, 0)

DOWN = Vector(0, -1, 0)

WEST = Vector(-1, 0, 0)

EAST = Vector(1, 0, 0)

NORTH = Vector(0, 0, -1)

SOUTH = Vector(0, 0, 1)

ZEROVEC = Vector(0, 0, 0)

 

class Transform(object):

  def init(self, x = EAST, y = UP, z = SOUTH, w = ZEROVEC):

   self.x = x

   self.y = y

   self.z = z

   self.w = w

  def applyTo(self, v):

   w = self.w

   return Vertex(v.dot(self.x) + w.x, v.dot(self.y) + w.y, v.dot(self.z) + w.z, v.u + w.u, v.v + w.v, v.uvd)

def dsc(angle):

  angle = radians(angle)

  return sin(angle), cos(angle)

def XRot(angle):  s, c = dsc(angle)  return Transform(EAST, Vector(0, c, -s), Vector(0, s, c))

def YRot(angle):  s, c = dsc(angle)  return Transform(Vector(c, 0, s), UP, Vector(-s, 0, c))

def ZRot(angle):  s, c = dsc(angle)  return Transform(Vector(c, -s, 0), Vector(s, c, 0), SOUTH)

 

In my vector/vertex class the method dot does dot product.

 

 def dot(self, that):   return self.x * that.x + self.y * that.y + self.z * that.z


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


Inception8 posted Wed, 04 July 2012 at 12:50 PM

  1. The idea is to take an object whose parameters you have already defined (written down) to be scaled, rotated and transitioned so it can be placed precisely into place upon import. This way after you import into Poser you don't have to input the same data (numbers) manually everytime.

  2. Then save that data for future use.

I understand most people would make everything properly to scale and in place in a modeling program but... ya know.

Know what I'm saying.


markschum posted Wed, 04 July 2012 at 1:53 PM

I had a script that just imported every obj file in a specified folder. It was toimport all the parts of a model before making it a figure.

 

@philc, do you really need the matrix calculation for the rotation part ?


Inception8 posted Mon, 16 July 2012 at 7:35 AM

Was it something I said?


3doutlaw posted Tue, 17 July 2012 at 10:22 AM

Quote - Note: Thread editor trashes my indentation and formatting - you should be able to make sense of this even though the Python engine may not.

BB, if you open the "HTML" editor via the button, add a

, and paste between that, I think it should preserve your formatting.

(sorry for the off topic, but maybe consider it a bump as well  :)  )


Inception8 posted Tue, 17 July 2012 at 12:02 PM

Quote - (sorry for the off topic, but maybe consider it a bump as well  :)  )

 

The only kind of bump that would save the topic of this thread would probably fall under 'divine intervention'. Which is probably how this halted.


Inception8 posted Thu, 26 July 2012 at 9:46 AM

semidieu took care of this and did an awesome job. ;o)


PhilC posted Fri, 27 July 2012 at 3:18 PM

He beat me to it :)