On 14/01/2015 at 11:27, xxxxxxxx wrote:
Hi CMPX,
Question 1:
I suppose, what I'm trying to ask is why the hair and joint objects set their expressions internally rather then just including Texpression (which then sets EXPRESSION_PRIORITY).
Answer:
On close inspection of ohair.res and texpression.res, the NOCAMERA sticks out as a difference. When I look at the code that loads HAIRSTYLE_PRIORITY, I see that the settings data {ANIM OFF; NOCAMERA;} is treated as one entity. So, it must be due to setting NOCAMERA that made including texpression.res not sufficient. As for the joint objects, it's either for the same reason or perhaps to leave out the INCLUDEs that come in with Texpression, which is Tbase directly, and Obaselist from Tbase list, indirectly. The only other explanation is that texpression.res could have been used for those only setting ANIM OFF but simply wasn't.
When I look at how code that uses texpression.res is written, there really isn't a difference with using any other priority resource label. The same kind of code that handles HAIRSTYLE_PRIORITY is written for EXPRESSION_PRIORITY, so it's not like the latter is special. I think it was to put some data and code in common to simplify reuse.
Question 2:
How do you override AddToExecution and say something like "set the priority to Expression groups, priority 250"?
Answer:
Some technical clarifications:
- When you call Add(), it adds to the end of a BaseArray, so it really is a list, not several.
- The execution flags indicate execution points in the pipeline. Those points appear to have an ordering relatively to each other, but not a way to order anything within them.
- The Execute() calls that have (..., Int32 priority, EXECUTIONFLAGS flags) as parameters receive the values set in the list. They use the values, especially of priority, as a conditional check to execute code. That's all, so it's not for a centralized 'priority execution' mechanism per se, so being as precise as specifying a priority like 'expression groups, 250' would not be relevant.
Considering the above, it's really a way to communicate to various Execute() calls made to objects based off of either the EffectorData, ObjectData, SceneHookData, or TagData classes a priority condition, with a rarely used flag for added precision. By using it as a conditional check, you'll get a general ordering by category, as the Execute() calls would have to be called multiple times for any of this to be relevant, once per category. In practice, I found despite a lot of Add() calls being used to set the various execution priority values, it is barely used in the actual Execute() calls. I'm sure it could still be useful to you, if the way it works allows you to solve your priority problem.
I hope the above helps. Let me know if you need the code that handles loading and using any of the *_PRIORITY data, as I see there isn't an example so such in the C4D SDK.
Joey Gaspe
SDK Support Engineer