try/throw/catch non existent operators
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/09/2007 at 06:33, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.6/10.1
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;---------
Hallo, I'm trying to use "try" and "catch" for checking non excisting operators but get syntax error.
What I do, and works fine, is when I add Userdata sliders, I use try and catch so I still can open older scenes where this sliders are not present by setting a default value in the "catch".Now I have some functions that uses operators from 3rd party plugins.
I know the operator (plugin#VALUE). And when the plugin is installed it works fine.If the plugin is -not- installed and I try the operator I get a syntax error.
So, in the same way I would misspell a operator, can I try and catch it?
If I mispell any valid operator I also get syntx error.In my work I get "try" and "catch" to work fine but I'm not confident how to implement "throw".
Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/09/2007 at 06:34, xxxxxxxx wrote:
It's both OSX and Windows, even if it says Windows only in the top here.
Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/09/2007 at 09:28, xxxxxxxx wrote:
some code? You could define the operator yourself to overcome the syntax error.
Did you try #define OPERATOR or using an enum? (not sure though if COFFEE supports the define preprocessor derivative).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/09/2007 at 12:37, xxxxxxxx wrote:
Hi, thanks.
The core of the code that works (if the 3rd party plugin is installed is as follows:> _
> GetFirstTag(obj,type)
> {
> var tag = obj- >GetFirstTag();
> while (tag){
> if (tag->GetType() == type) return tag;
> tag = tag->GetNext();
> }
> return NULL;
> }
>
> main(doc,op)
> {
> var thing;
> try
> {
> var PluginTag = GetFirstTag(op,1020898);
> thing = PluginTag#VRAYPHYSICALCAMERATAG_ZOOM;
> //if I mispell the operator or the plugin is not installed
> /// I get a syntax error
> }
>
> catch(ExLastException)
> {
> thing = 1;
> }
> }
> _Looking in the SDK for COFFEE (R9.5 still) enum is there but:
"Since C.O.F.F.E.E. has no preprocessor, only simple values like numbers or strings can be directly assigned to global variables."I've started to try using strings ("op#THAT_PARAMETER") and variations of tostring to "fool" the "try" function.
I'm basically pretty lost atm. As soon as I enter the operator "#" anywhere I get the syntax error.
Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/09/2007 at 02:09, xxxxxxxx wrote:
yep, that´s fine. Go to the vray camera tag resource folder and check out the ID of VRAYPHYSICALCAMERATAG_ZOOM (or just take the complete list of IDs) and put them into your code!
so like:
enum
{
[...]
VRAYPHYSICALCAMERATAG_ZOOM,
[...]
};main(doc,op)
{
[...]So you have the ID always defined. This SHOULD work, however that object#PARAMETER operations I never tried so I am not sure. If this won´t work I don´t know.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/09/2007 at 02:15, xxxxxxxx wrote:
ok, other way. I just tried it, and it doesn´t work here in a COFFEE expression.
Anyway, why don´t you simply get the basecontainer of the tag and directly get the values out of the container? Then you don´t have the # hassle.
var t = op->GetContainer();
var f = t->GetFloat(VRAYPHYSICALCAMERATAG_ZOOM);Then you also can use the enum workaround when the tag is not available.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/09/2007 at 11:39, xxxxxxxx wrote:
Katachi, thanks for your time.
I've sat today trying to get my head around using enum as well as using constant var (global before MyPluGin:: Execute(doc,op) ).It is a little bit of mysterious... as I wrote earlier , as soon as I type:
VRAYPHYSICALCAMERA_ZOOM, -anywhere-, I get a Syntax error.
(So it is not the "#" sign that is the culprit as I wrote earlier, now when I use the BaseContaner method in stead of #ID method)And even more strange, if I uninstall the Vray Plugin by taking it out of the Plugin Folder as well as moving out its dylib files in the Cinema Package Contents (RightClick the Cinema app) the VRAYPHYSICALCAMERA_ZOOM id is still "valid". (It gets orange if I type it in a regular COFFEE Tag).
There seems to be some differenses in R9 and R10 as well, so I'll have to concentrate on R10 first.
I use the BaseContainer method now but the same problem is there since I can't use the phrase VRAYPHYSICALCAMERA_ZOOM.
"Fooling" the system by using:var vzoom = "VRAYPHYSICALCAMERA_ZOOM" ;
as a global var and then use it by bc->GetFloat(tostring(vzoom));
is not that successfull either.I realize I haven't the chops using enum yet and maybe it can help.
I put:enum{VRAYPHYSICALCAMERA_ZOOM}
as a global but then got a value of "0", which must be natural I'd think since it is the first and only value there.
I'm pretty confused right now, but if anyone can shed some light or more pointers I'd be greatfull.
Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/09/2007 at 11:46, xxxxxxxx wrote:
You are using COFFEE? Try what happens if you delete the "coffeesymbolcache" file in Cinema's prefs folder.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/09/2007 at 12:05, xxxxxxxx wrote:
Yup, COFFEE, I tried that and yes now it is undefined!
Great, that's one down:)
Now I can at least make tryouts with the plugin "truly" un-installed.Any other ideas are more than welcome (well, needed actually )
Thanks.
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/09/2007 at 15:27, xxxxxxxx wrote:
My knowledge and brain capacity have reached their limits
I'm getting into a Catch22 trying with and without the plugin installed.
I'll have to cool down and use SetDriver->SetDriven Xpresso meanwhile to connect the functions between mine and the 3rd partyplugin.Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/09/2007 at 03:22, xxxxxxxx wrote:
I can only repeat to go into the vray camera tag resource file and get the ids! The IDs are numbers not Strings!
so it´s NOT
var vzoom = "VRAYPHYSICALCAMERA_ZOOM" ;But rather defined as:
enum
{
VRAYPHYSICALCAMERA_ZOOM = 1000,
[...]
}1000 is NOT the Id of it! You must look up the real ID in the tag .h resource file!
Hope it´s clear now.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/09/2007 at 06:48, xxxxxxxx wrote:
Thank you very much, yes it clear and is working fine.
I've also learned that its better to sleep now and then to clear the mind..Thing is , I did try that way yesterday, only to type the wrong ID and thus thought I was on the wrong track...
Thanks again.Cheers
Lennart