[Bf-committers] Syntax Highlighting for OSL - Question

Campbell Barton ideasman42 at gmail.com
Sun Dec 30 02:45:05 CET 2012


On Wed, Dec 19, 2012 at 7:45 PM, Campbell Barton <ideasman42 at gmail.com> wrote:
> On Wed, Dec 19, 2012 at 5:50 PM, Brecht Van Lommel
> <brechtvanlommel at pandora.be> wrote:
>> Hi,
>>
>> I think turning the current syntax highlight into an option with
>> settings "Off", "Automatic", "Python", "Open Shading Language", ..
>> would be ok. Then Automatic would be the default, and it would work
>> based on file extension. The setting could be removed from the header
>> and moved into a menu. I don't think making it work based on text
>> contents is a good idea, it's quick tricky to make that reliable,
>> especially distinguishing between code and non-code.
>>
>> I don't have a particular objection to GLSL or Lua support, if we can
>> keep the code simple and modular. Adding Renderman Shading Language
>> syntax may be useful too. C/C++ seems a step too far though.
>>
>> Thanks,
>> Brecht.
>
> Looking at the original patch and mixing in different languages in
> text_draw.c was a bit messy (infact it would be _very_ messy for 3+
> languages),
> I've since split out the highlighting code so we can more easily have
> multiple highlighters without clogging up the code.
>
> Commit:
> http://markmail.org/message/cgart3rdemsrdwfr
>
> Its quite simple but later we can extend out so each language has its
> own delimiters, different behavior for indentation (pythons ': ->
> Enter' convention wont work nice for others).
>
> Agree with Brecht for selecting language - most editors work this way
> (have the syntax highlighting in a menu and auto-select based on file
> extension).
>
> As for languages to support - I think its reasonable to limit this to
> languages that blender uses directly (GLSL, OSL, Py).
>
> If its just syntax highlighting I guess theres no problem with adding
> others - Lua, Povray, RSL.... etc but Im not really keen on having
> this at the moment.
>
> --
> - Campbell

Committed the patch to trunk, also added template menu which may help
new devs learn OSL (but currently don't have any templates).

At the moment theres no way to select language, I'll check on that next.

-- 
- Campbell


More information about the Bf-committers mailing list