[Bf-committers] Syntax Highlighting & Alternate Languages

Benjamin Tolputt btolputt at internode.on.net
Wed Jul 27 04:48:18 CEST 2011


tl;dr:
-------------
I would like to add alternate language syntax highlighting to Blender
(Lua for myself & GLSL for other Blender users at this time). My
examination of the code indicates no RNA extras are needed and minimal
code change, but if I make a patch to allow it - will it be accepted by
the core development team?

Full Detail:
-------------
I, and others I know & have worked with, use Blender as as part of a
pipeline for game development & prototyping. As I'm sure the core
development team is aware, Python is not the primary scripting language
of choice for professional (or even most indie) game development due to
a number of problems that are not worth discussing for this issue,being
irrelevant to the question I'm asking.

Of note is the MIT-licensed GameKit being developed by (among others)
Erwin Couman, a principle developer/maintainer of physics & related
functionality in Blender. It allows loading a .blend file straight out
of a Blender & "playing" the resulting game, with game logic being
embedded either in (a subset of) the game logic nodes, embedded scripts,
or a combination of both. In other words, for basic prototyping, it is
possible to simply use Blender & the GameKit engine to get something up
& running for testing/demonstration purposes. Well worth a look for
anyone who hasn't yet seen it.

As alluded to earlier, GameKit does not use Python for embedded scripts
but instead uses Lua. I'm not going to debate the subjective
benefits/drawbacks of Lua compared to Python as, regardless of that
debate, Lua is far more commonly used in games, game engines, and
GameKit in particular. The issue is simply that Blender, while allowing
entry of Lua scripts (being just text) is slightly less "pretty" about
it as syntax highlighting is for Python only in the current code.

To allow Lua syntax highlighting is relatively simple from my
examination of the code (a couple more functions to determine
Lua/GameKit built-in vars, functions, etc, a minor refactor of the
txt_format_line function, & a small UI alteration to handle showsyntax
as a number rather than a straight boolean - none of which even need an
RNA change). The reason I write an email first rather than just
providing a patch is that I am somewhat reluctant to write code that
will be ignored by the core development team. Like the missing modelling
tools, no-one really wants to write code that they get told will be
discarded in short order.

Question to the core developers then is are they willing to allow
alternate syntax highlighting in the text view? The default can (&
should) always remain Python as it is the language used internally by
Blender, but being able to include alternate syntax highlighting is not
only beneficial to artists/developers using Blender as a tool in our
pipeline, but makes creating/editing GLSL materials and the like
included in Blender already a slightly easier/nicer experience.

-- 
Regards,

Benjamin Tolputt



More information about the Bf-committers mailing list