﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ADoc%2FCode_Style%2FConfiguration</id>
	<title>Dev:Doc/Code Style/Configuration - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ADoc%2FCode_Style%2FConfiguration"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Code_Style/Configuration&amp;action=history"/>
	<updated>2026-07-05T02:56:10Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Doc/Code_Style/Configuration&amp;diff=135855&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Code_Style/Configuration&amp;diff=135855&amp;oldid=prev"/>
		<updated>2018-06-28T20:48:34Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 20:48時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Doc/Code_Style/Configuration&amp;diff=135854&amp;oldid=prev</id>
		<title>wiki&gt;Mont29: /* QtCreator */</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Code_Style/Configuration&amp;diff=135854&amp;oldid=prev"/>
		<updated>2018-04-10T08:16:02Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;QtCreator&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Configuring Software to use Blenders Code Style =&lt;br /&gt;
&lt;br /&gt;
This page is to help you quickly setup your development environment to edit Blender's source, this is more important for some environments then others.&lt;br /&gt;
&lt;br /&gt;
{{Note|Warning|{{Warning/Important}}&lt;br /&gt;
General warning about formatting tools since some of them can be used to automate formatting source code into Blender style ''(or at least a close approximation).''&lt;br /&gt;
&lt;br /&gt;
Tools like this should '''not''' be applied globally to Blender's source-code.&lt;br /&gt;
&lt;br /&gt;
Typically the best way to use them is to select smaller blocks of code and format them - making sure they don't cause any problems.&lt;br /&gt;
&lt;br /&gt;
For 'whole-file' formatting utilities - apply to a copy of the source and then manually copy useful changes across with a differencing tool (Meld for example).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== IDE ==&lt;br /&gt;
&lt;br /&gt;
=== Eclipse ===&lt;br /&gt;
&lt;br /&gt;
Tested with 4.3&lt;br /&gt;
&lt;br /&gt;
Eclipse can format code in the menu: Source -&amp;gt; Format (Shift+Ctrl+F)&lt;br /&gt;
&lt;br /&gt;
; Configure C/C++ Code Style&lt;br /&gt;
&lt;br /&gt;
This isn't essential for developing with eclipse but it can be handy to use sometimes to auto-format.&lt;br /&gt;
&lt;br /&gt;
All options here are available as an XML below.&lt;br /&gt;
&lt;br /&gt;
Open preferences: (Menu) Window -&amp;gt; Preferences&lt;br /&gt;
&lt;br /&gt;
Go to C/C++ -&amp;gt; Code Style, Press New (create based on K&amp;amp;R)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tableNormal&amp;quot;&amp;gt;&lt;br /&gt;
* Indentation&lt;br /&gt;
** Enable &amp;quot;Statements within 'switch body'&amp;quot;&lt;br /&gt;
* Braces (everything should be set to 'Same Line')&lt;br /&gt;
** Set 'Function declarations to' to 'New Line'&lt;br /&gt;
** Set 'Block in Case Statements' to 'New Line'&lt;br /&gt;
* White Space&lt;br /&gt;
** Expressions&lt;br /&gt;
*** Initializer list&lt;br /&gt;
**** Disable 'After Opening Brace'&lt;br /&gt;
**** Disable 'Before Closing Brace'&lt;br /&gt;
*** Type casts&lt;br /&gt;
**** Disable 'After Closing perebrgesis'&lt;br /&gt;
* Control Statements&lt;br /&gt;
** Enable &amp;quot;Insert new line before 'else' statement&amp;quot;&lt;br /&gt;
** Disable &amp;quot;Keep 'then' statements on same line&amp;quot;&lt;br /&gt;
** Disable &amp;quot;Keep 'else' statements on same line&amp;quot;&lt;br /&gt;
* Line Wrapping&lt;br /&gt;
** Set 'Max line width' to 120&lt;br /&gt;
** Expressions&lt;br /&gt;
*** Initializer list&lt;br /&gt;
**** Set 'Line Wrap Policy' to 'Wrap all elements, every Element on new line'&lt;br /&gt;
**** Set 'Indentation Policy' to Indent by 1.&lt;br /&gt;
* Comments&lt;br /&gt;
** Enable 'Preserve white space between code and line comments if possible'&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or you can load this into eclipse direct.&lt;br /&gt;
&lt;br /&gt;
[http://wiki.blender.org/uploads/3/35/Blender_Eclipse_4_3_C_CPP_code_style.xml Blender_Eclipse_4_3_C_CPP_code_style.xml]&lt;br /&gt;
&lt;br /&gt;
=== KDevelop ===&lt;br /&gt;
''Tested with version 4.6''&lt;br /&gt;
&lt;br /&gt;
In the following menus...&lt;br /&gt;
&lt;br /&gt;
'''Settings -&amp;gt; Configure Editor''' &lt;br /&gt;
&amp;lt;div class=&amp;quot;tableNormal&amp;quot;&amp;gt;&lt;br /&gt;
* ''Appearance''&lt;br /&gt;
** ''Borders''&lt;br /&gt;
*** Enable 'Show Line Numbers'&lt;br /&gt;
* ''Editing''&lt;br /&gt;
** ''General''&lt;br /&gt;
*** Enable 'Show static word wrap marker'&lt;br /&gt;
*** Set 'Wrap words at' to 120&lt;br /&gt;
** Indentation&lt;br /&gt;
*** Set Indent Using to 'Tabulators'&lt;br /&gt;
*** Set 'Tab width' to 4&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MSVC ===&lt;br /&gt;
''Tested with Microsoft VisualStudio 2008''&lt;br /&gt;
&lt;br /&gt;
====Basic Setup====&lt;br /&gt;
&lt;br /&gt;
Go to: Tools --&amp;gt; Options&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tableNormal&amp;quot;&amp;gt;&lt;br /&gt;
* ''Text Editor -&amp;gt; C/C++ -&amp;gt; General''&lt;br /&gt;
** Activate 'Line Numbers' (On by Default)&lt;br /&gt;
* ''Text Editor -&amp;gt; C/C++ -&amp;gt; Tabs''&lt;br /&gt;
** 'Tab Size' Set to 4&lt;br /&gt;
** Activate 'Keep Tabs'&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Show Guideline as 120 Chars====&lt;br /&gt;
&lt;br /&gt;
This one is a bit hacky in MSVC, since it is NOT supported by default, but can be reached&lt;br /&gt;
easily over the Registry:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tableNormal&amp;quot;&amp;gt;&lt;br /&gt;
* Close MSVC if opened&lt;br /&gt;
* Open your Registry&lt;br /&gt;
* Navigate to the following key:&lt;br /&gt;
** MSVC 2008: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor&lt;br /&gt;
** MSVC 2008 Express: HKEY_CURRENT_USER\Software\Microsoft\VCExpress\9.0\Text Editor&lt;br /&gt;
* Add a String Value called &amp;quot;Guides&amp;quot;&lt;br /&gt;
* Set the Value to: RGB(128,0,0) 120&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now your MSVC shows at 120 chars a red line.&lt;br /&gt;
&lt;br /&gt;
=== Xcode ===&lt;br /&gt;
&amp;quot;Tested with Xcode 4.6.2 (4H1003)&lt;br /&gt;
&lt;br /&gt;
Go to: Xcode --&amp;gt; Preferences&lt;br /&gt;
&lt;br /&gt;
Unfortunately Xcode doesn't have any &amp;quot;auto code formatting&amp;quot; tool, so it needs to be very carefully in using of code-style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tableNormal&amp;quot;&amp;gt;&lt;br /&gt;
* ''Text Editing -&amp;gt; Editing''&lt;br /&gt;
** 'Page guide at column' set to 120&lt;br /&gt;
** ''Automatically trim trailing whitespace'' set checked&lt;br /&gt;
** ''Including whitespace-only lines'' set checked (this prevent &amp;quot;lines with spaces&amp;quot; in code)&lt;br /&gt;
&lt;br /&gt;
* ''Text Editing -&amp;gt; Indentation''&lt;br /&gt;
** 'Prefer indent using' set to Tabs&lt;br /&gt;
** 'Tab width' set to 4 spaces&lt;br /&gt;
** 'Indent width' set to 4 spaces&lt;br /&gt;
** 'Tab key' set to 'Inserts tab character' &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== NetBeans ===&lt;br /&gt;
''Tested with Netbeans 8.0''&lt;br /&gt;
&lt;br /&gt;
Netbeans can format selected code in the menu: Source -&amp;gt; Format (Alt+Shift+F)&lt;br /&gt;
&lt;br /&gt;
Go to: Tools --&amp;gt; Options&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tableNormal&amp;quot;&amp;gt;&lt;br /&gt;
* ''Editor -&amp;gt; General...''&lt;br /&gt;
** Disable 'Enable Camel Case Navigation' (my personal preference)&lt;br /&gt;
* ''Editor -&amp;gt; Folding...''&lt;br /&gt;
** Disable 'Code Folding' (my personal preference)&lt;br /&gt;
* ''Editor -&amp;gt; Formatting...''&lt;br /&gt;
** Disable 'Extend Tabs to Spaces&lt;br /&gt;
** 'Tab Size' Set to 4&lt;br /&gt;
** 'Right Margin' Set to 120&lt;br /&gt;
* ''Editor -&amp;gt; Formatting -&amp;gt; C Language...''&lt;br /&gt;
** Enable 'Keep Extra Spaces'&lt;br /&gt;
** Brace Placement, Function Declaration, Set to 'New Line'&lt;br /&gt;
** Enable 'New Line, &amp;quot;else&amp;quot;'&lt;br /&gt;
** Disable Other Spaces, After Type Cast&lt;br /&gt;
* ''Editor -&amp;gt; Code Completion...''&lt;br /&gt;
** Enable 'Case Sensitive Code Completion'&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== QtCreator ===&lt;br /&gt;
&lt;br /&gt;
Tested with QtCreator 2.5.81&lt;br /&gt;
&lt;br /&gt;
''Note: QtCreator has no way to format existing source.''&lt;br /&gt;
&lt;br /&gt;
Open the Options dialog '''Tools -&amp;gt; Options'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tableNormal&amp;quot;&amp;gt;&lt;br /&gt;
; '''Text Editor...''' (main section)&lt;br /&gt;
*''Behavior...''&lt;br /&gt;
** Tab Policy (set to 'Tabs Only')&lt;br /&gt;
** Tab size (set to 4)&lt;br /&gt;
** Align continuation lines: (Set to 'With Spaces')&lt;br /&gt;
** Clean whitespace (enable)&lt;br /&gt;
*** 'In entire document' (disable) &lt;br /&gt;
*** 'Clean indentation' (disable)&lt;br /&gt;
* ''Display&lt;br /&gt;
** Display Right margin at column (Enable and set to 120)&lt;br /&gt;
** Highlight current line (Enable - personal preference)&lt;br /&gt;
** Visualize whitespace (Enable - personal preference)&lt;br /&gt;
&lt;br /&gt;
; '''C++''' (main section)&lt;br /&gt;
''Note this duplicates some options above...''&lt;br /&gt;
* Code Style&lt;br /&gt;
** ''General...''&lt;br /&gt;
*** Tab Policy (set to 'Tabs Only')&lt;br /&gt;
*** Tab size (set to 4)&lt;br /&gt;
*** Align continuation lines: (Set to 'With Spaces')&lt;br /&gt;
** ''&amp;quot;switch&amp;quot;, indent within switch -...''&lt;br /&gt;
*** &amp;quot;case&amp;quot; or &amp;quot;default&amp;quot; (enable)&lt;br /&gt;
** ''Alignment...''&lt;br /&gt;
*** &amp;quot;Align after assignment&amp;quot; (enable)&lt;br /&gt;
*** &amp;quot;Add extra padding to conditions if they would align to next line&amp;quot; (disable)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note, since there are not that many settings - saving an XML to load into QtCtreator isn't so useful.''&lt;br /&gt;
&lt;br /&gt;
== Editors ==&lt;br /&gt;
&lt;br /&gt;
=== Emacs ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=== VIM ===&lt;br /&gt;
&lt;br /&gt;
Example ~/.vimrc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=vim&amp;gt;&lt;br /&gt;
&amp;quot; --- Extra Visual Info ---&lt;br /&gt;
:syn on                      &amp;quot; Syntax highlighting&lt;br /&gt;
:set spell                   &amp;quot; spell checking (if you like)&lt;br /&gt;
set showmatch                &amp;quot; When a bracket is inserted, briefly jump to a matching one&lt;br /&gt;
set incsearch                &amp;quot; Incremental search&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;quot; --- Tab settings ---&lt;br /&gt;
set tabstop=4&lt;br /&gt;
set shiftwidth=4&lt;br /&gt;
&amp;quot; Expand tabs for Python coding only (C/C++ in blender uses tabs)&lt;br /&gt;
&amp;quot; set expandtab&lt;br /&gt;
set smarttab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;quot; ---- indenting ----&lt;br /&gt;
set autoindent &amp;quot; auto indent&lt;br /&gt;
set smartindent &amp;quot; smart indent&lt;br /&gt;
set ci &amp;quot; C/C++ indents&lt;br /&gt;
set cin &amp;quot; -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;quot; --- Column/Row Stuff ---&lt;br /&gt;
set cul                      &amp;quot; Highlight the current line&lt;br /&gt;
:set number                  &amp;quot; Show Line Numbers&lt;br /&gt;
:set lines=40 columns=120    &amp;quot; Window Size&lt;br /&gt;
:set colorcolumn=120         &amp;quot; Right Margin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
set scrolloff=3              &amp;quot; Scroll when cursor gets within 3 characters of top/bottom edge&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;quot; --- Extra Functionality Helpers ---&lt;br /&gt;
set autochdir                &amp;quot; cd into buffer editing&lt;br /&gt;
&lt;br /&gt;
filetype plugin on&lt;br /&gt;
filetype indent on           &amp;quot; Indent&lt;br /&gt;
&lt;br /&gt;
&amp;quot; auto-complete&lt;br /&gt;
set ofu=syntaxcomplete#Complete&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Formatting Tools ==&lt;br /&gt;
&lt;br /&gt;
=== AStyle ===&lt;br /&gt;
Command line formatter, http://astyle.sourceforge.net/astyle.html&lt;br /&gt;
&lt;br /&gt;
This command is not exact but a close approximation of blenders style guide.&lt;br /&gt;
noticeably, multi-line-if statements are formatted differently.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
astyle --style=stroustrup \&lt;br /&gt;
       --pad-oper \&lt;br /&gt;
       --indent=tab \&lt;br /&gt;
       --indent-switches \&lt;br /&gt;
       --align-pointer=name \&lt;br /&gt;
       --break-closing-brackets \&lt;br /&gt;
       --unpad-paren \&lt;br /&gt;
       --pad-header \&lt;br /&gt;
        --recursive &amp;quot;*.c&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uncrustify ===&lt;br /&gt;
&lt;br /&gt;
The uncrustify configuration file us now included in [[Dev:Doc/Tools/Blender_Tools_Repo|Blender's tools repo]]:&lt;br /&gt;
&lt;br /&gt;
Example use:&lt;br /&gt;
&lt;br /&gt;
 uncrustify -c ./source/tools/utils/uncrustify.cfg --no-backup --replace source/blender/blenlib/intern/path_util.c&lt;br /&gt;
&lt;br /&gt;
This shell script runs uncrustify but removes minor whitespace cleanups which significantly reduces noise in the diffs.&lt;br /&gt;
&lt;br /&gt;
'''uncrustify_clean.sh'''&lt;br /&gt;
&lt;br /&gt;
 ./source/tools/utils/uncrustify_clean.sh source/blender/blenlib/intern/path_util.c&lt;/div&gt;</summary>
		<author><name>wiki&gt;Mont29</name></author>
		
	</entry>
</feed>