Quick follow-up: I just learned from Jarrett Johnson that it is possible to
add alpha to CGO objects on a per-shape basis.  Just prepend `[cgo.ALPHA,
0.5]` (substituting your desired alpha value, of course) before the CONE
(or other) shape.  This alpha value will be used for all subsequent shapes
until you set another `cgo.ALPHA` value by the same method.

Hope that helps.

Cheers,
Jared

On Mon, Feb 14, 2022 at 10:04 AM Jared Sampson <jared.samp...@columbia.edu>
wrote:

> Hi Marcelo -
>
> No I don't believe so.  In PyMOL, a CGO `CONE` is a fixed-length list of
> floats.  You can see in the cgo.py source
> <https://github.com/schrodinger/pymol-open-source/blob/master/modules/pymol/cgo.py#L65>
>  that
> `cgo.CONE` itself is actually a float, too (specifically, 27.0).  My
> understanding is that under-the-hood the parser is doing something like:
>
> 1. Look at the list of floats passed to `cmd.load_cgo()` and read the
> first one as an instruction;
> 2. Determine how many more values to expect from that instruction (e.g.
> for `CONE` it would expect 16 additional floats);
> 3. Read those values and use them to create the geometry;
> 4. If there are any values left in the list, treat the next float as a
> completely separate instruction, and repeat this process until there are no
> values left.
>
> In order to add alpha to a color channel (which I'm not even sure is
> compatible with the way PyMOL handles colors—though I'd leave that question
> to one of the developers), one would have to add an additional instruction
> keyword in cgo.py with a different expected set length of float arguments,
> then implement how to translate that instruction into geometry in the
> underlying C++.
>
> Of course if that's something you're really interested in doing, you could
> certainly take a crack at implementing it in Open Source PyMOL and submit a
> pull request.  :)
>
> Hope that helps.
>
> Cheers,
> Jared
>
> On Sun, Feb 13, 2022 at 9:49 PM Marcelo Depólo Polêto <
> marcelodep...@gmail.com> wrote:
>
>> Thank you Jared,
>>
>> Yes, I have been using *set cgo_transparency*, but is there a way of
>> embedding alpha in the CONE object definition? Since I have been using
>> color1='blue' and color2='red', can I just append an alpha float to the
>> color lists?
>>
>> Best regards,
>> --
>> Marcelo
>>
>> Em dom., 13 de fev. de 2022 às 21:42, Jared Sampson <
>> jared.samp...@columbia.edu> escreveu:
>>
>>> I forgot to add that the transparency can be handled by e.g.
>>>
>>>     set cgo_transparency, 0.5, my_cgo_object
>>>
>>> Cheers,
>>> Jared
>>>
>>> On Sun, Feb 13, 2022 at 9:38 PM Jared Sampson <
>>> jared.samp...@columbia.edu> wrote:
>>>
>>>> Hi Marcelo -
>>>>
>>>> Looks like you have the right format for `CONE`.  This should really be
>>>> in the Wiki...and apparently is not.  I've just made a couple of pages,
>>>> others can of course feel free to elaborate:
>>>>
>>>> https://pymolwiki.org/index.php/CGO_Shapes
>>>> https://pymolwiki.org/index.php/Load_CGO
>>>>
>>>> You may also find it useful to look at the Open Source PyMOL source
>>>> code, perhaps starting with:
>>>>
>>>> https://github.com/schrodinger/pymol-open-source/blob/master/modules/pymol/cgo.py
>>>>
>>>> Hope that helps.
>>>>
>>>> Cheers,
>>>> Jared
>>>>
>>>>
>>>> On Sat, Feb 12, 2022 at 10:51 PM Marcelo Depólo Polêto <
>>>> marcelodep...@gmail.com> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I am building a CGO object of a cone and I want to embed a
>>>>> transparency value to it. So far I managed to create the cone with the 
>>>>> line
>>>>> below:
>>>>>
>>>>> *obj = [cgo.CONE] + begin + end + [radius_begin, radius_end] + color1
>>>>> + color2 + [1.0, 1.0]*
>>>>>
>>>>> Could someone provide more information on how the CGO objects are
>>>>> structured (which values are expected and their formats)?
>>>>>
>>>>> Best regards,
>>>>> --
>>>>> *Marcelo Depólo Polêto, Ph.D.*
>>>>> Postdoctoral Associate
>>>>> Office: 106B Engel Hall
>>>>> Department of Biochemistry
>>>>> Virginia Tech
>>>>> 340 West Campus Dr.
>>>>> Blacksburg, VA 24061
>>>>> gender pronouns <https://ccc.vt.edu/resources/Gender_Pronouns.html>:
>>>>> he/him/his
>>>>> _______________________________________________
>>>>> PyMOL-users mailing list
>>>>> Archives:
>>>>> http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>>>>> Unsubscribe:
>>>>> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
>>>>
>>>>
>>
>> --
>> --
>> *Marcelo Depólo Polêto, Ph.D.*
>> Postdoctoral Associate
>> Office: 106B Engel Hall
>> Department of Biochemistry
>> Virginia Tech
>> 340 West Campus Dr.
>> Blacksburg, VA 24061
>> gender pronouns <https://ccc.vt.edu/resources/Gender_Pronouns.html>:
>> he/him/his
>>
>
_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to