THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/02/2005 at 20:47, xxxxxxxx wrote:
Cinema 4D Version: 8.012
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
Is there any way to clone objects into another document without the editor camera changing to frame them?
On 05/02/2005 at 08:22, xxxxxxxx wrote:
? I don´t really understand the question. Could you elaborate?
On 05/02/2005 at 09:29, xxxxxxxx wrote:
Let's say that there is already a document opened with objects in it. The user imports a file (which loads into a new document) and sets it to merge with the current document. So, I do an AliasTrans and clone the materials and objects into the current document and kill the newly loaded document.
The problem is that the editor view of the current document updates the editor camera during the process to frame all of the objects. I didn't tell it to do that and some users don't like that it does that.
Is there any way for it to NOT do that?!
On 05/02/2005 at 09:36, xxxxxxxx wrote:
Hmm, I cannot confirm that this happens. My plugin Crowdimporter does merge hundreds of objects into the currently active doc and I haven´t encountered the behavior you are describing.
Are you really just doing sth like this:
BaseObject* obj = op->GetClone(NULL,alias);
Can you post some code snippets?
P.s.: If this really happens, why don´t you get the camera beforehand, clone it and copy it back to the docs cam after the whole procedure?
On 05/02/2005 at 10:39, xxxxxxxx wrote:
Here's the code snippet:
// - Merge loaded Scene with Active Document
if (merge && mergeDocument)
if (!trans) throw ErrorException(ERROR_MEMORY, "iPDialog.LoadScene.trans");
if (!trans->Init(baseDocument)) throw ErrorException(ERROR_GENERAL, GeLoadString(ERROR_ALIASTRANS_TEXT));
BaseMaterial *material, *cmat;
for (material = baseDocument->GetFirstMaterial(); material; material = material->GetNext())
cmat = (BaseMaterial* )material->GetClone(0, trans);
mergeDocument->InsertMaterial(cmat, NULL, TRUE);
group = (BaseObject * )(baseDocument->GetFirstObject()->GetClone(0, trans));
mergeDocument->InsertObject(group, NULL, NULL, TRUE);
I have realized that it could be that last statement (EventAdd()) which is causing this, but have not checked yet.
Where would I find the Editor camera?
On 05/02/2005 at 10:52, xxxxxxxx wrote:
Hmm, seems to be nothing that could cause this.
The editor cam can be gotten through the active BaseDraw, with GetEditorCamera().
But what do you need a forceredraw for? Simply call EventAdd(), it should do it easily.
Furthermore, to maybe save performance (or at least to reduce unnecessary code :), only call StartUndo and EndUndo once (at the beginning and in the end).
Really strange the editor cam is anyhow modified. Are you sure this happens? Did you encounter it on your machine? Or is it maybe only a drawing error when you force the redraw?
On 05/02/2005 at 11:17, xxxxxxxx wrote:
I forget at this stage, but it was need for something - maybe to get materials updated properly either in the display or material manager.
Oh no, I want the added object to be an undo step and the changed materials to be another. One thing that I learned about C4D undo is that one undo step is encapsulated between StartUndo() and EndUndo(). So, in effect, the user can remove the material changes and then the added objects separately.
Yes, this happens and I've seen it happen. I have a user who doesn't like that it happens, so it definitely happens.
I'll try the FORCEREDRAW first and then backing/restoring the Editor Camera if that does not work.
On 05/02/2005 at 11:22, xxxxxxxx wrote:
Ah I see. ok, let us know when you find the solution.
On 05/02/2005 at 11:35, xxxxxxxx wrote:
Well, removing the EVENT_FORCEREDRAW had no effect.
It also affects the active camera. Does GetSceneCamera() return the active camera? Otherwise I have no idea which one is.
On 05/02/2005 at 11:42, xxxxxxxx wrote:
yes it will return the active camera IF there is a scene camera. Otherwise you´ll need to use the editor camera.
On 05/02/2005 at 11:45, xxxxxxxx wrote:
Right, that's what I figured.
Still changing the camera though. Maybe I need to Set...() the camera values after calling EventAdd()?
On 09/02/2005 at 13:41, xxxxxxxx wrote:
Sorry that I forgot to get back here.
Found the problem: LoadFile() and LoadDocument(). LoadFile() automatically adds the document into the list. This, for some reason, causes the camera change when 'merging' (i.e.: using AliasTrans to clone the objects and materials into the host document). LoadDocument(), since it doesn't insert the document, doesn't cause the camera change. Very odd, but, hey, it works.
On 10/02/2005 at 09:49, xxxxxxxx wrote:
Ah, ok. Thanks for letting us know.