[Code] New Material methods
-
This update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701 has been out for a week or two with other SKMtools tweaks - it now only makes the method if it doesn't exist - e.g material.name='xxx' is now include in the latest v8...
-
Here's an update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701
Material.class extensions - aliases added for save_thumbnail()==.write_thumbnail() and .delete==.remove. The .name='' and .delete methods now match SUp >=v8 returned values. -
SU8M1 didn't add
Material.remove
, it added it toMaterials
. -
@thomthom said:
SU8M1 didn't add
Material.remove
, it added it toMaterials
.But v8 did... [quietly!]
-
Here's an update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701
Material.class extensions - aliases added for save_thumbnail()==.write_thumbnail() and .delete==.remove. The .name='' and .delete methods now match SUp >=v8 returned values.
'Aliases' slightly recast to leave original new methods unaffected if used... -
@tig said:
@thomthom said:
SU8M1 didn't add
Material.remove
, it added it toMaterials
.But v8 did... [quietly!]
? And it was removed? Because it does not exist at all in M1.
(Sketchup::Material.instance_methods-Object.methods).sort ["add_observer", "alpha", "alpha=", "attribute_dictionaries", "attribute_dictionary", "between?", "color", "color=", "delete_attribute", "deleted?", "display_name", "entityID", "get_attribute", "materialType", "model", "name=", "parent", "remove_observer", "set_attribute", "texture", "texture=", "typename", "use_alpha?", "valid?", "write_thumbnail"]
-
@thomthom said:
@tig said:
@thomthom said:
SU8M1 didn't add
Material.remove
, it added it toMaterials
.But v8 did... [quietly!]
? And it was removed? Because it does not exist at all in M1.
(Sketchup::Material.instance_methods-Object.methods).sort ["add_observer", "alpha", "alpha=", "attribute_dictionaries", "attribute_dictionary", "between?", "color", "color=", "delete_attribute", "deleted?", "display_name", "entityID", "get_attribute", "materialType", "model", "name=", "parent", "remove_observer", "set_attribute", "texture", "texture=", "typename", "use_alpha?", "valid?", "write_thumbnail"]
BUT it IS listed in the API docs http://code.google.com/apis/sketchup/docs/ourdoc/material.html#remove
ANYWAY... when they ever sort out their mess and if you have my SKMtools loading their '.remove' will get used in preference to mine! -
The release notes and the API docs are incorrect. It was added after this M1 release. I've notified them about the incorrect docs.
-
@thomthom said:
The release notes and the API docs are incorrect. It was added after this M1 release. I've notified them about the incorrect docs.
I also made note, in a post to your "New Material methods! Thank you!" beta forum topic.
Also I think the v7.0 M1 build numbers are actually the M0 numbers.
-
As we noted in the other topic Re: New Material Methods!, a method that acts immediately upon the receiver should (by Ruby convention,) use a
**!**
on the end of the method name.I would think in most cases such a method, if it's a dispose method, just calls the parent collection's element disposal method with
self
as the argument.It's is kind of weird for code that is executing within the scope of an instance, to be destroying that very instance at the same time. In other words, the disposal call is made within the block of an instance method; and after the call is made, Ruby needs to return to the next statement after the call (still within the instance method,) but if the instance no longer exists, where does Ruby return to?
It's kind of the old "chicken and egg" scenario. But apparently Ruby can handle this without choking.
There are cases, as ThomThom pointed out, that it's easier to call a disposal method on the instance, rather then have to get a handle on the instances' collection object to call for the disposal.
-
Here's an update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701
The MAC jar execution issues have been addressed.
Advertisement