Xref objects transformations (completely crazy)

Xref objects transformations (completely crazy)

Anonymous
Not applicable
576 Views
5 Replies
Message 1 of 6

Xref objects transformations (completely crazy)

Anonymous
Not applicable

Hello everyone

 

I use some Xref objects in my scene and do some transformations.
The result obtained is sometimes very unexpected.

 

STEP 1 - I take a first Xref object, do some transformations (scale for example).
STEP 2 - Then I duplicate it.
STEP 3 - Then I take the duplicate object and do some transformations also.

 

It should be easy. Absolutely not !!!

 

If I use in STEP 1 :
          scale originalObject [2, 2, 2]
          >>> in STEP 2, the duplicate object lose all transformations from the original object
So I try after that to transfer original object transformations to duplicate object :
          duplicateObject.scale = originalObject.scale
          >>> nothing !!! the scale transformation is not stored in originalObject.scale (idem if I scale manually)
          (however if I use originalObject.scale = [2, 2, 2], the transformation is stored)

So if I use in STEP 1 :
          originalObject.scale = [2, 2, 2]
          >>> in STEP 2, the duplicate object is OK (same transformations).......YESSSSSS !
BUT then, in STEP 3, if I use also:
          duplicateObject.scale = [1, 1, 4]
          >>> all Xref objects (duplicate AND original) are transformed !!!


...I tell myself :
1 - the developers of max have fallen on their heads?
2 - I did not understand what an Xref is, and what is it for?
3 - I am very tired, I do not understand anything, go to bed

What do you think ? 1, 2 or 3
(or 4 ?)

 

otherwise what solutions

Thanks

0 Likes
577 Views
5 Replies
Replies (5)
Message 2 of 6

leeminardi
Mentor
Mentor

Perhaps this reference on this will help you.

"...the scale transformation is different from the scale object property. Setting the object’s scale property (name_obj.scale= …) repeatedly with the same values will only scale the object the first time, but applying the scale transformation repeatedly will continue to scale the object relatively to the previous scale."

 

After scaling take a look at the object's transformation matrix.  The magnitude of the first three vectors indicates the applied scale.

For example, 

$.transformation may show  

(matrix3 [2,0,0] [0,2,0] [0,0,2] [37.6461,-37.0965,0])

whereas

$.scale may show

[1,1,1]

 

lee.minardi
0 Likes
Message 3 of 6

Anonymous
Not applicable

I knew $.scale, $.rotation but not $.transformation

I don't need to extract the scale values from $.transformation.
But just do: duplicateObject.transformation = originalObject.transformation and it works as I want.

 

While waiting for solutions, I found another very different solution (but I'm not going to use it I prefer yours):
I put a controller on the object: originalObject.Transform.controller = prs ()
so when I duplicate the original (STEP 2), the copy does not lose the transformations of the original
(I found it by chance while searching everywhere)

 

Thank you very much leeminardi

0 Likes
Message 4 of 6

Anonymous
Not applicable
I cannot approve the solution, the button does not work. If a moderator comes by ...
0 Likes
Message 5 of 6

denisT.MaxDoctor
Advisor
Advisor

@Anonymous wrote:

I use some Xref objects in my scene and do some transformations.
The result obtained is sometimes very unexpected.

 

...I tell myself :
1 - the developers of max have fallen on their heads?
2 - I did not understand what an Xref is, and what is it for?
3 - I am very tired, I do not understand anything, go to bed

What do you think ? 1, 2 or 3
(or 4 ?)

 


the developers of max have fallen on their heads?

No. They are absolutely correct (at least in this case)

 

I did not understand what an Xref is, and what is it for?

That's true. You look lost.  

 

I am very tired, I do not understand anything, go to bed

It's up to you, but you can try to understand how Xref system works...

 

The xref system is an important thing in many editors. This helps you manage the same objects in many files by referencing it to the original location. If you modify this object in its original location, this automatically updates all instances of this object in different files.

You have a choice of what to reference with the object: geometry, materials, modifiers, tracks (controllers), etc.

 

In your case, these are controllers ... namely the transform controller.

 

If you look at your XRef object controller type:

$.controller -- this means transform controller

you should see 

Controller:XRef

which means that the controller is referenced to the original file. You can't(!) change it in the file you are. You have to do it in the original place.

But... if you need to have access to transformation of the Xref object, you can do Xref process without referencing the transformation controller, or change it after referencing: 

$.controller = prs()
--Controller:Position_Rotation_Scale

after this the transform controller is not referenced anymore. And you can change any transform property: position, scale, rotation...

 

The same principles and rules work for any other controllers.

 

In a situation where an xref controller is applied, you can temporarily change the scale (since the scale controller is not referenced), but it will be updated the next time this file is loaded, being a subcontroller of the xref transformation controller.

 

 

 

 

 

Message 6 of 6

Anonymous
Not applicable

@ denisT.MaxDoctor

I can hardly find what I'm looking for in the online MaxScript Help. Often times I find it easier by searching directly on Google.
In addition, English is not my language and I am not a computer scientist (I make images for architecture, and I am developing a practical tool to add Xref plants ... to the scene)
So to understand all this by myself is for me an obstacle course! I hope English speakers are aware of their luck.

 

When I type Xref Objects in the help, I only read new and complex concepts. I could have found the notion of Xref controller, but it would have taken me a week to find and understand.

So I found the solution myself by chance, and you confirmed it to me.

 

Thanks a lot for your explanations.

0 Likes