Adding priority to object's AM
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/10/2008 at 09:26, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9+
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;---------
Howdy,I'm trying to add a priority attribute to an object, so that the user can change the priority of the object's execution. I've got the priority data showing up in the object's AM with this in the .res file:
>
\> INCLUDE Obase; \> \> GROUP Obaselist \> { \> PRIORITY MY_OBJECT_PRIORITY { ANIM OFF; } \> } \>
Then in the ObjectData::Init() function, I added these lines just like it is in an expression tag:
>
\> GeData d; \> if (node->GetParameter(DescLevel(MY_OBJECT_PRIORITY),d,0)) \> { \> PriorityData \*pd = (PriorityData\* )d.GetCustomDataType(CUSTOMGUI_PRIORITY_DATA); \> if (pd) \> { \> pd->SetPriorityValue(PRIORITYVALUE_MODE,CYCLE_EXPRESSION); \> pd->SetPriorityValue(PRIORITYVALUE_PRIORITY,0); \> pd->SetPriorityValue(PRIORITYVALUE_CAMERADEPENDENT,FALSE); \> } \> else GePrint("no priority data"); \> node->SetParameter(DescLevel(MY_OBJECT_PRIORITY),d,0); \> } \> else GePrint("MY_OBJECT_PRIORITY not found"); \>
But when the object is created, the priority in the AM defaults to "Initial" and the console prints "no priority data". It doesn't print "MY_OBJECT_PRIORITY not found" so it's getting the GeData from the parameter.
Is there a different way you have to it with an object?
Also, I'm not sure how you'd get the value of the priority attribute to use in the ObjectData::AddToExecution() function to set the priority the user selected.
Can you give me an example of how to set this up on an object?
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2008 at 23:52, xxxxxxxx wrote:
Your .res file looks ok. This is how the Init() should look like:
>
\> Bool AtomObject::Init(GeListNode \*node) \> { \> BaseObject \*op = (BaseObject\* )node; \> BaseContainer \*data = op->GetDataInstance(); \> \> GeData d(CUSTOMGUI_PRIORITY_DATA, DEFAULTVALUE); \> PriorityData \*pd = (PriorityData\* )d.GetCustomDataType(CUSTOMGUI_PRIORITY_DATA); \> if(!pd) return FALSE; \> \> pd->SetPriorityValue(PRIORITYVALUE_MODE, GeData(CYCLE_EXPRESSION)); \> pd->SetPriorityValue(PRIORITYVALUE_PRIORITY, GeData(0)); \> pd->SetPriorityValue(PRIORITYVALUE_CAMERADEPENDENT,GeData(TRUE)); \> \> data->SetData(ATOMOBJECT_PRIORITY, d); \> \> return TRUE; \> } \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/10/2008 at 10:24, xxxxxxxx wrote:
Howdy,
Ah, that works. Thank you!
Just a couple of more questions now:
1. Is there anything I need to do differently in the code if the user turns on the "Camera Dependent" option?
2. Also, I notice that the priorities go from 501 to 5499, which is the upper and lower limit that the user can set, but can an internal priority be set to 5500? For example, if I wanted it to call the execute function one more time after all other priorities have been called to double check and reset a value and update the object if necessary, would it be safe to use 5500 as an internal priority for a second call to execute? As it is now I have a second call at an internal priority of 5499, but what if the user sets that as the priority of the object? I would want the second internal priority to come after that. So, is it safe to use 5500 for that second call?
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/10/2008 at 03:19, xxxxxxxx wrote:
Hi Dan,
1. Afaik you only have to worry about this if your expressions are camera dependent. It seems that switching this off will disable camera depent expressions like the LookAtCamera expression.
2. Where do you get the 501 to 5499 values from?
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/10/2008 at 06:26, xxxxxxxx wrote:
Howdy,
The priority values are from the operatingsystem.h file:
>
\> // predefined calling points for tags and scenehooks \> #define EXECUTION_INITIAL 1000 \> #define EXECUTION_ANIMATION 2000 \> #define EXECUTION_EXPRESSION 3000 \> #define EXECUTION_DYNAMICS 4000 \> #define EXECUTION_GENERATOR 5000 \>
Since the user can enter values from -499 to +499, the priorities can be set to these values by the user:
EXECUTION_INITIAL : 501 to 1499
EXECUTION_ANIMATION : 1501 to 2499
EXECUTION_EXPRESSION : 2501 to 3499
EXECUTION_DYNAMICS : 3501 to 4499
EXECUTION_GENERATOR : 4501 to 5499These numbers are included in the afore mentioned priority min/max limit:
1500
2500
3500
4500
... but can actually never be set by the user given the -499/+499 limits of the AM parameter.So, I reckon my original question should be: Is it safe to set the internal priority to 5500 or any of the other x500 values, and will it still be added to the priority list properly and still call the Execute() function without causing any problems?
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/11/2008 at 05:09, xxxxxxxx wrote:
Hallo Dan,
It is not allowed to set the values outside of the defined range.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/11/2008 at 05:18, xxxxxxxx wrote:
Howdy,
OK, thanks. ;o)
Adios,
Cactus Dan