Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

Getting dynamically added LONG CYCLE String value

Author
Message
  Topic Search Topic Search
ingvarai View Drop Down
Member
Member
Avatar

Joined: 2012 Jun 19
Location: Norway
Online Status: Offline
Posts: 336
Direct Link To This Post Topic: Getting dynamically added LONG CYCLE String value
    Posted: 2013 Aug 11 at 10:30am

User Information:

Cinema 4D Version:    
Platform:      
Language(s):       

---------

I used the good solution by Remo, found here, on how to dynamically add items to a dropdown list:

But how do I read them? I can easily get the index, no problem. And of course I can store an array with the item text strings elsewhere. But is there a way to read out the text directly?
I want to do this in the message method.
Bool MyTag::Message (GeListNode* node, LONG type, void* data)
{
   LONG selectedItemIndex = bc->GetLong(MY_DROPDOWNLIST);
}
The code is simplified.





Edited by ingvarai - 2013 Aug 11 at 10:31am
Ingvar
Delphi and C# pro, and now C++ amateur
Back to Top
Remotion4D View Drop Down
Member
Member
Avatar

Joined: 2010 Oct 20
Online Status: Offline
Posts: 172
Direct Link To This Post Posted: 2013 Aug 11 at 1:08pm
You can read them only if you have access to.
Description *description

Remo
developer of SuperVoxels, SuperTracer, UniFlex, GeoTools, DiTools and more
www.remotion4d.net
www.c4dpp.org
Back to Top
kuroyume0161 View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 29
Location: United States
Online Status: Offline
Posts: 3665
Direct Link To This Post Posted: 2013 Aug 11 at 6:48pm
GetParameter()

See sticky topic at top of this forum:

http://www.plugincafe.com/forum/forum_posts.asp?TID=5286

You can't read the text directly - you get the enumerated LONG value associated with whatever text you assigned to it.


Edited by kuroyume0161 - 2013 Aug 11 at 6:52pm
Back to Top
ingvarai View Drop Down
Member
Member
Avatar

Joined: 2012 Jun 19
Location: Norway
Online Status: Offline
Posts: 336
Direct Link To This Post Posted: 2013 Aug 12 at 2:46am
Yup, you are right. I have to store the values in a basearray, and use the enumerated LONG to retrieve it. By the way, I still use the "old" method it seems, too much.

Another question:
How can I force an update of the dropdown list? (The enumerated list)?
I have a button in the description GUI, when pressing that, a new disc file is created. The enumerated list contains these disc files, and needs to be updated immediately. I haven't found a way to do this, because it seems it only can be done in the implementation of: 
Bool MyTag::GetDDescription (GeListNode* node, Description* description, DESCFLAGS_DESC &flags)
And I do not know what to do to make C4D call this.

Ingvar
Delphi and C# pro, and now C++ amateur
Back to Top
kuroyume0161 View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 29
Location: United States
Online Status: Offline
Posts: 3665
Direct Link To This Post Posted: 2013 Aug 12 at 4:34am
BaseContainer    listBC;
// This is where you'll loop through your enumerated list
for (LONG i = 0L; i <= lastIndex; ++i)
{
    // Add item name to drop-down list (name is a String of the file name, for instance)
    listBC.SetString(i,        name);
}
BaseContainer    comboBC =            GetCustomDataTypeDefault(DTYPE_LONG);
// - This is the text to the left of the drop down
comboBC.SetString(DESC_SHORT_NAME,        "List:");
comboBC.SetLong(DESC_ANIMATE,            DESC_ANIMATE_OFF);
comboBC.SetBool(DESC_REMOVEABLE,        FALSE);
// - Add your dropdown items
comboBC.SetContainer(DESC_CYCLE,        listBC);
// - LIST_COMBO must be defined in your tag's .h file
// - This sets the currently selected item in the list (the first item, by default)
tagbasecontainer->SetLong(LIST_COMBO,            0L);
// Add your dropdown description to your tag
if (!description->SetParameter(DescLevel(LIST_COMBO,    DTYPE_LONG,0L),     comboBC,    DescLevel()))   return FALSE;





Edited by kuroyume0161 - 2013 Aug 12 at 4:44am
Back to Top
ingvarai View Drop Down
Member
Member
Avatar

Joined: 2012 Jun 19
Location: Norway
Online Status: Offline
Posts: 336
Direct Link To This Post Posted: 2013 Aug 12 at 6:39am
Robert, thanks!
But I do not know how to make this in a free standing function..?
I have no problems filling up the combo with disc file names, as long as it happens inside this, which is totally under C4D's command:
Bool FootFollower::GetDDescription (GeListNode* node, Description* description, DESCFLAGS_DESC &flags)
It is filling up the list when I want, that is the problem.
And in your code, I do not know how to get hold of "description" and "DescLevel". 
How do I do this in a free standing function (not called by C4D)?
Ingvar
Delphi and C# pro, and now C++ amateur
Back to Top
kuroyume0161 View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 29
Location: United States
Online Status: Offline
Posts: 3665
Direct Link To This Post Posted: 2013 Aug 12 at 8:17am
Well, GetDDescscription is called quite often.  I think there is a way to 'trigger' it to be called but I'll have to sift through my code to find out.  It might be as simple as calling a tag->Message(MSG_CHANGE); when you want to update the descriptions.
Back to Top
ingvarai View Drop Down
Member
Member
Avatar

Joined: 2012 Jun 19
Location: Norway
Online Status: Offline
Posts: 336
Direct Link To This Post Posted: 2013 Aug 12 at 10:07am
Originally posted by kuroyume0161

Well, GetDDescscription is called quite often.  I think there is a way to 'trigger' it to be called but I'll have to sift through my code to find out.  It might be as simple as calling a tag->Message(MSG_CHANGE); when you want to update the descriptions.

The combo box contains a list of template files.
I have a button, when the user click this, a new template files is created. The list is not updated. The funny thing is, I have another button, which applies the current selected template in the combo to an object. When this button is clicked, the list is sometime (but not always) updated. It is obvious that I want the list to always be updated according to the current situation, and furthermore, I need the selected item in the list to be the recent, the newly created template file. "is called quite often" is just not good enough.
For my private use, it is ok, I can live with it. But the day it is published, it has to function in a professional way. If you come across code which does what I am after, I certainly would be interested!


Ingvar
Delphi and C# pro, and now C++ amateur
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1143
Direct Link To This Post Posted: 2013 Aug 12 at 11:56pm
Hi,

If you are in a TagData plugin you have to call
tag->SetDirty(DIRTY_DATA);
to force the tag to update and its GetDDescription() method to be called.

(See this old thread)


MAXON
Developer Support
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2013 Aug 13 at 1:06am
I used DIRTYFLAGS_DESCRIPTION instead of DIRTYFLAGS_DATA one of my effector plugins and it
worked out fine so far.

They're called DIRTYFLAGS_ instead of DIRTY_ since a few Cinema releases but I don't know since
which exactly.


Edited by NiklasR - 2013 Aug 13 at 1:06am
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1143
Direct Link To This Post Posted: 2013 Aug 13 at 1:28am
Originally posted by NiklasR

I used DIRTYFLAGS_DESCRIPTION instead of DIRTYFLAGS_DATA one of my effector plugins and it
worked out fine so far.

They're called DIRTYFLAGS_ instead of DIRTY_ since a few Cinema releases but I don't know since
which exactly.
You're right; with R12 renaming changes the DIRTY enum had been changed to DIRTYFLAGS.
And DIRTYFLAGS_DESCRIPTION was added to the API in R13.




Edited by Yannick Puech - 2013 Aug 13 at 1:31am
MAXON
Developer Support
Back to Top
ingvarai View Drop Down
Member
Member
Avatar

Joined: 2012 Jun 19
Location: Norway
Online Status: Offline
Posts: 336
Direct Link To This Post Posted: 2013 Aug 13 at 3:00am
Works!! Thanks!!
Ingvar
Delphi and C# pro, and now C++ amateur
Back to Top
kuroyume0161 View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 29
Location: United States
Online Status: Offline
Posts: 3665
Direct Link To This Post Posted: 2013 Aug 13 at 3:33am
There you go.  :)
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.109 seconds.