Renaming bug in COFFEE

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 20/01/2005 at 04:27, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   9 
Platform:      
Language(s) :   C.O.F.F.E.E  ;

---------
Hi all, I´m experincing strange behaviour trying to renamin an object in cinema

  
var obj;  
var objCont = obj->GetContainer();  
var objName = obj->GetName();  
var newName = "test_name";  
obj->SetName(newname + objName);  

this renames the object using the new Name as a prefix, but creates NEW!?? objects in the scene.

Am I doing something wrong or is this a bug?

thanks

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 20/01/2005 at 08:05, xxxxxxxx wrote:

Hi, was willst du? Neue Namen oder neue Objekte mit neuem Namen?
Gruß Tim

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 20/01/2005 at 08:51, xxxxxxxx wrote:

Just new names, I know how to create new objects:

  
var newObj = new(objType);  
  
// insert into document  
doc->InsertObject(newObj, NULL, NULL);  

I´m just wondering why the code in my previous post creates new objects in the active doc.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/01/2005 at 00:49, xxxxxxxx wrote:

try this:
var obj;
var objCont = obj->GetContainer();
var objName = obj->GetName();
var newName = "test_name";
obj->SetName(newname + objName);
newObj->Remove();
doc->InsertObject(newObj, NULL, NULL);

Grüße aus Freiburg

Tim

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/01/2005 at 11:38, xxxxxxxx wrote:

Thanks wegfressen, but you dont seem to understand what I´m getting at. I am not creating any new objects, I am renaming objects that are alreading in the scene.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/01/2005 at 14:15, xxxxxxxx wrote:

Anybody? Could someone at least confirm this, then I know I can give up.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/01/2005 at 14:27, xxxxxxxx wrote:

Have you tried changing 'newName' to something else? This might be slipping past the interpreter as 'new Name' or something. The actual code would be useful as well (iow, I suppose that 'var obj' has been set to an object in the Document's Object Manager or one that's about to be placed there).

Robert

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 23/01/2005 at 04:49, xxxxxxxx wrote:

kuroyume0161, newname is a user set variable, it is retrieved from an edittext box in the GUI, var obj is dynamically set when the code climbs down a hierachy in the present document.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/01/2005 at 05:49, xxxxxxxx wrote:

Well if Maxon would admit its a bug I would be happy, just plain not saying anything is a drag.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/01/2005 at 23:57, xxxxxxxx wrote:

I can't confirm this bug. I used the following code in a menu plugin: (In the example you have written newname instead of newName. I also had to fill in obj myself.)

    
    
    MyMenuPlugin::Execute(doc)  
    {  
      var obj = doc->FindObject("Cube");   
      var objName = obj->GetName();   
      var newName = "test_name";   
      obj->SetName(newName + objName);  
      GeEventAdd(ACTIVE_OBJECT_CHANGED);  
    }

There are no new objects created afaics. Where is the code run in your plugin? Could you post a little more code? (Preferably to the point where its a complete but scaled down plugin still showing the error.)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/01/2005 at 08:22, xxxxxxxx wrote:

Thanks Michael for your reply, is it okay if I post you the code? If yes, where to?

> Quote: Originally posted by Mikael Sterner on 26 January 2005
>
> * * *
>
> I can't confirm this bug. I used the following code in a menu plugin: (In the example you have written newname instead of newName. I also had to fill in obj myself.)
>
>

MyMenuPlugin::Execute(doc)  
\>  {  
\>  var obj = doc->FindObject("Cube");   
\>  var objName = obj->GetName();   
\>  var newName = "test_name";   
\>  obj->SetName(newName + objName);  
\>  GeEventAdd(ACTIVE_OBJECT_CHANGED);  
\>  }

>
> There are no new objects created afaics. Where is the code run in your plugin? Could you post a little more code? (Preferably to the point where its a complete but scaled down plugin still showing the error.)
>
>
>
>
> * * *

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/01/2005 at 12:37, xxxxxxxx wrote:

If you don't want to post the code here you can send it to [email protected].

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/02/2005 at 13:39, xxxxxxxx wrote:

Hi Mikael, could you confirm the bug? I sent you a code snippet last week.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/02/2005 at 03:59, xxxxxxxx wrote:

Sorry, I will have a look at it as soon as possible.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 16/02/2005 at 14:38, xxxxxxxx wrote:

Hi Mike, have you checked up on my problem?

Sharriff

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 20/02/2005 at 15:03, xxxxxxxx wrote:

Hmm, I did run the code now by adding the missing parts to make it a complete function:

    
    
      
    ...  
      
    GetGlobalRotation(obj);  
    SetGlobalRotation(obj, rot);  
    GetGlobalPosition(obj);  
    SetGlobalPosition(obj, pos);
    
    
    
    
    ...
    
    
    
    
    // register plugin in menu  
    class MyMenuPlugin : MenuPlugin  
    {  
     public:  
      MyMenuPlugin();
    
    
    
    
      GetID();  
      GetName();  
      GetHelp();  
      Execute(doc);  
    }
    
    
    
    
    MyMenuPlugin::MyMenuPlugin() { super(); }  
    MyMenuPlugin::GetID()        { return 13215235; }  
    MyMenuPlugin::GetName()      { return "Hello World"; }  
    MyMenuPlugin::GetHelp()      { return "Demonstrates a simple modal dialog";  
    }
    
    
    
    
    MyMenuPlugin::Execute(doc)  
    {  
     mirrorEditOrigBone(doc->GetFirstObject());  
    }
    
    
    
    
      
    main()  
    {  
    prefixOrigBone = "bar";  
    prefixMirrorBone = "foo";  
     Register(MyMenuPlugin);  
    }

Then I added a bone to the scene and ran the plugin. As expected I get two new bones, one named "fooBone" and one named "barBone". Do you get more than two bones if you do that? That sounds really weird. I tried both in 9.013 and 9.101, but unless I can duplicate the bug there's not much I can do. Does the bug show up if you do a small expression that renames stuff as well?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/02/2005 at 12:31, xxxxxxxx wrote:

Thanks for looking into my problem Mike, yes, the problem arises only when I rename the bones, this happens in 8.2, 9.0 and 9.1. I use a recursive function to traverse the hierachy, in the loop, I create and name bones, this works well if i dont rename the bones. I I do, I get the renamed bones, the clones and the original bones in addition.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/02/2005 at 12:48, xxxxxxxx wrote:

Have you checked up on the bug Mikael?

Thanks.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 28/02/2005 at 13:43, xxxxxxxx wrote:

I still haven't been able to reproduce it. My bones rename just fine with the code you sent. Sorry that this has taken so long, but unless I can duplicate the behaviour I can't find out what's wrong.
Just to be absolutely eliminate all sources of confusion, could you send a specific scene and the whole plugin to the support account? (Please remove as much code as possible, while making sure that the error still occurs on your side.)