List of things I shouldn't do because soft says so
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
List of things I shouldn't do because soft says so
[rimg=900]http://i.imgur.com/cg5kPYb.png[/rimg]
Is there a full list of things I can't do? Like passing Python dictionary as return object?
Is there a full list of things I can't do? Like passing Python dictionary as return object?
-
xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 09:02
- Location: Montreal Canada
Re: List of things I shouldn't do because soft says so
Commands have some private arguments. Name is apparently one of them.
In JScript, you get this error:
In JScript, you get this error:
Code: Select all
// ERROR : 2299 - This command argument already exist and cannot be used: Name-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: List of things I shouldn't do because soft says so
Yea, would be cool if I would know that before I spend half an hour to figure out what caused it (sometimes the error is not show up)xsisupport wrote:Commands have some private arguments. Name is apparently one of them.
Is there a full list of private arguments anywhere?
Btw, I thought name and Name are two different variables
Last edited by iamVFX on 22 Jan 2013, 13:45, edited 1 time in total.
-
xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 09:02
- Location: Montreal Canada
Re: List of things I shouldn't do because soft says so
No. But iirc, any other private arguments are those used by builtin commands that are implemented by scripts. Those command have private arguments to specify the script engine and the handler proc in the script file.iamVFX wrote:Yea, would be cool if I would know that before I spend half an hour to figure out what caused it (sometimes the error is not show up)xsisupport wrote:Commands have some private arguments. Name is apparently one of them.
Is there a full list of private arguments anywhere?
-
csaez
- Posts: 253
- Joined: 09 Jul 2012, 13:31
- Skype: csaezmargotta
- Location: Sydney, Australia
Re: List of things I shouldn't do because soft says so
Hi,
Maybe this is an obvious reply but I highly recommend work with a coding convention.
I usually add a prefix to my variables indicating the data type (i.e. sName, oObj, lItems) and a "p_" if it's a parameter (i.e. p_sName, p_oObj, p_lItems). The same is true for command names, a lot of people add a prefix indicating the author/company name.
A coding convention will make your tools a lot easier to debug/maintain and you probably won't have name collisions never again, just pick one and start using it
Cheers!
Maybe this is an obvious reply but I highly recommend work with a coding convention.
I usually add a prefix to my variables indicating the data type (i.e. sName, oObj, lItems) and a "p_" if it's a parameter (i.e. p_sName, p_oObj, p_lItems). The same is true for command names, a lot of people add a prefix indicating the author/company name.
A coding convention will make your tools a lot easier to debug/maintain and you probably won't have name collisions never again, just pick one and start using it
Cheers!
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: List of things I shouldn't do because soft says so
I use different naming convention which is called obvious naming. When your object is named obviously, like size, deformer or path, you know that size holds number, deformer is an object and path is a string. It doesn't matter if number is an integer or float or double in dynamically typed language. For scripting purposes in Softimage it's more than enough, most of the time you deal with objects and if you need their name you call its property.csaez wrote:Hi,
Maybe this is an obvious reply but I highly recommend work with a coding convention.
I usually add a prefix to my variables indicating the data type (i.e. sName, oObj, lItems) and a "p_" if it's a parameter (i.e. p_sName, p_oObj, p_lItems). The same is true for command names, a lot of people add a prefix indicating the author/company name.
A coding convention will make your tools a lot easier to debug/maintain and you probably won't have name collisions never again, just pick one and start using it
Cheers!
What bother me is that, as you mentioned, if you are a experienced C++ developer and you should care which type of the object you're holding, why the hell you call private class variable name? Good to read
-
csaez
- Posts: 253
- Joined: 09 Jul 2012, 13:31
- Skype: csaezmargotta
- Location: Sydney, Australia
Re: List of things I shouldn't do because soft says so
It's not always so obvious, depends a lot on context and your personal perception (path could be a curve and deformer an operator in a rigging context).
Coding conventions are all about readability
Coding conventions are all about readability
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: List of things I shouldn't do because soft says so
Context is given by a function or class you're dealing with.csaez wrote:It's not always so obvious, depends a lot on context and your personal perception (path could be a curve and deformer an operator in a rigging context).
Code: Select all
def ExportObj( object, path ):
...
If you want to hold operator in a path variable, for me, personally
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: List of things I shouldn't do because soft says so
But even I, not-that-great-"coder", know that private variable name should be prefixed with underscore. 

Those are just lame design decisions.

Those are just lame design decisions.
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
-
EricTRocks
- Moderator
- Posts: 754
- Joined: 25 Nov 2009, 00:41
Re: List of things I shouldn't do because soft says so
I'm really confused by this thread and don't really see the validity of it other than a place to post things that you run into that are frustrating (Something that may be better suited for a blog?). Is there any details you can provide to some of these posts such as repro steps so that the thread could take a productive turn into helping identify some issues within Soft?
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: List of things I shouldn't do because soft says so
SureEricTRocks wrote:Is there any details you can provide to some of these posts such as repro steps so that the thread could take a productive turn into helping identify some issues within Soft?

-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: List of things I shouldn't do because soft says so
I'm excited to see the ugliness of workarounds which can be suggested 
(actually, comparing nested curve objects before and after the command is not that ugly, but it is still a workaround and definitely not OO way of doing it)
(actually, comparing nested curve objects before and after the command is not that ugly, but it is still a workaround and definitely not OO way of doing it)
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: List of things I shouldn't do because soft says so
[rimg=900]http://i.imgur.com/SUkDEVB.png[/rimg]
-
EricTRocks
- Moderator
- Posts: 754
- Joined: 25 Nov 2009, 00:41
Re: List of things I shouldn't do because soft says so
I don't believe that XSI commands can return python objects such as lists. Could you create a collection and fill it with your items then return that instead?


