Author: Nako

What is “Color” in Object Properties in Blender

GOAL

To understand how to use object color.

Environment

Blender 2.83
Windows 10

What is Object Properties?

The Properties shows and allows editing of many active data, including the active scene and object.

from Properties page in Blender2.91 Manual

You can change the attributes of the object from “Object Properties” tab. The color can be set in the “Visibility” menu.

How to display the object color

1. Change the object color

2. Change the renderer into “Workbench”

The Workbench Engine is a render engine optimized for fast rendering during modeling and animation preview.

from Introduction of workbench in Blender2.91 Manual

3. Set the color “Object”

You can select colors that the Workbench uses to render objects from single, Object, Material, Random, Vertex and Texture. See “Color” page of workbench in Blender2.91 Manual for details.

4. Rendering

Change the viewport shading “rendered”.

Rendered result

“python script failed check the message in the system console” in Blender

This is for beginners.

Error Detail

When I ran python script below in blender, the error message “python script failed check the message in the system console” is displayed.

import bpy.data
print(bpy.data.objects)
from Blender

Solution

Open the system console and check the message but where is the system console?

How to open the system console

Click Window > Toggle System Console

You can see the message on the generated window.

How to set keymap in Blender

GOAL

To add some functions into keymap in Blender. I added “Toggle Quad View” into the “Industry Compatible” keymap.

There is no shortcut key of “Toggle Quad View” in Industry Compatible keymap in contrast to Blender keymap.

Environment

Blender 2.83
Windows 10

Method

Open and right-click the menu to which you’d like to add shortcut key.

Click “Assign Shortcut” and press the key to assign.

Press the key and the shortcut key is registered.

What is “ActionZone” in Blender keymap

GOAL

To understand Blender keymap related to “ActionZone”.

Environment

Blender2.83
Windows10

How to see the current keymap settings

Edit > Preferences > Keymap

You can see actions and assigned keymaps. There are “ActionZone” in short cut keys.

What is ActionZone?

I couldn’t find any official documentation, but I think ActionZone means the each windows of editor.

Move the cursor to the upper right corner then the cross cursor will appear. When the cross cursor is displayed, you can handle “ActionZone”.

Example of usages

ActionZone (dragging cross cursor): split and join the area
Shift + ActionZone (dragging cross cursor) : Duplicate area into new window
Ctrl + ActionZone (dragging cross cursor) : Swap area

[Tips]How to get capture including mouse cursor

GOAL

To take screenshot with mouse cursor in Windows10 as below.

Environment

Windows10

Method1  Steps Recorder

1. Search the application “Steps Recorder” and start it.

2. Start Record

3. Move cursor to the position to capture and click

4. Stop Record

5. Save the result

Right-click on the result image, and click “Save picture as…”

Method2 Magnifier

1. Search the application “Magnifier” and start it.

2. Set the view “Docked” and resize the window

Resize the Magnifier window by dragging the corner of a window.

You can’t see the cursor in the magnifier window.

3. Press “PrintScreen” key or capture by Snipping Tool

Press “PtintScreen” key and capture the display.

Paste the copied image and trim the target area in the Magnifier window.

How To Push To The Remote Repository From Local One

This is just a memo. I often forget how to create and connect local repository and remote repository on GitHub.

GOAL

Today’s goal is to summarize how to create remote repository and local repository, and push the committed change from local repository.

Environmet

Windows10
Git 2.19.0
GitHub

Method

1. Create remote repository

Access GitHub and create new repository.

2. Create local repository

Access local directory and create local repository by using command “git init”.

> cd path\wordpressTheme
> git init

.git will be generated.

3. Commit the changes

Add files

> git add *

Commit them

> git commit -m "First commit, The simplest template."

4. Add remote repository

Add the created remote repository by using the command “git remote add <repository_name> URL”. You can copy the URL from the repository page in GitHub.

I named it “origin” conventionally.

> git remote add origin https://github.com/s-nako/wordpressTheme.git

5. Push the changes

Push the local repository to the remote repository. I push the main branch to the remote repository named origin by using “git push” command.

> git push origin main

* The name of the branch “main” is the default name of branch in remote repository in GitHub. The default name was “master” until 2020.10.1.
* You can check the current branch name by using the command “git branch”
* You can change the name of the branch by using the command “git branch -m <before_name> <new_name>” ([Tips]Change the branch name in Git)

Postscript

Generate access token and use it instead of GitHub password. (Token Authentication For GitHub)

[Tips]Change the branch name in Git

GOAL

To change the name of the branch

Method

Change the existing branch to the new name with “git branch -m” or “git branch –move”.

> git branch -m <current_name> <new_name>

If you would like to change the name of the branch currently checked out, the first argument <current_name> doesn’t need.

How to hide your email from users on GitHub

Committer’s emails can be seen in git log. How can I solve this problem?

GOAL

To hide the committer’s email in GitHub.

Method

Use the noreply email address that is assigned to hide the committer email address. The GitHub-provided noreply email address is defined as ID+username@users.noreply.github.com.

Reference: Setting your commit email address

1. Check “Keep my email addresses private”

Open “Settings” and open Emails tab.

Check “Keep my email addresses private”. Then you can use the noreply email address that is displayed. This address can be used for web-based Git operations (e.g., edits and merges).

2. Check “Block command line pushes that expose my email”

If you check this check box, commits that use a private email address will be blocked.

3. Change the local git user.email to the commit email address

If you want command line Git operations to use the noreply email address, you must set your email in Git.

> git config --global user.email "ID+username@users.noreply.github.com"

Create Original Theme in WordPress 3

At the last time, in “Create Original Theme in WordPress 2“, I designed pages of my original theme “techblog”. Today, I start implementing them.

GOAL

To study the name of PHP file for each page and create PHP files.

Environment

WordPress 5.5.1
XAMPP 7.4.10

The corresponding PHP files to items

I created these files.

The all files are in https://github.com/s-nako/wordpressTheme/tree/main/techblog.

This is one of the simplest WordPress themes. I’ll customize it in the future.

Create search.php for original theme

This is one of the articles about project “Create Original Theme in WordPress”.

GOAL

To create search.php and searchform.php

Environment

WordPress 5.5.1
XAMPP 7.4.10

search.php

It is easy to create search.php by copying and changing from archive.php.

<?php
/**
* The template to display search results
*@package WordPress
*@subpackage Techblog
*@since Techblog 1.0
*/
get_header(); ?>
<div class="container">
<main id="main" class="site-main">
	<div class= "main-content">
		<?php if ( have_posts() ) :?>
			<h1><?php echo esc_html__( 'Search Results for: ', 'techblog' ).'<span>'.esc_html(get_search_query()).'</span>'; ?></h1>
		<?php
			while ( have_posts() ) :
				the_post();
				get_template_part( 'content/content', 'search');
			endwhile;
				the_posts_pagination(
					array('prev_text' => '<u>Back<<</u>  ',
						'next_text' => '  <u>>>Next</u>', )
				);
		endif; ?>
	</div>
</main>
	<?php get_sidebar(); ?>
</div>
<?php
	get_footer(); ?>

Functions

get_search_query()

This function is used to get the posted search query from the search form. The definition is in wp-includes/general-template.php.

 function get_search_query( $escaped = true ) {
    $query = apply_filters( 'get_search_query', get_query_var( 's' ) );
    if ( $escaped ) {
        $query = esc_attr( $query );
    }
    return $query;
}

get_query_var( ‘s’ ) is the function to get the value of a query variable from the key ‘s’. So the input form should be named ‘s’.

get_template_part( $slug, $name = null, $args = array() )

This function is used to get template from {}-{}.php.

In my case, get the template from content/content-search.php by using get_template_part( ‘content/content’, ‘search’). But I don’t need content-search.php because the template content/content-search.php is the same as content.php.

Result

searchform.php

searchform is used as one of the widgets.

<?php
/**
* The search form template
*@package WordPress
*@subpackage Techblog
*@since Techblog 1.0
*/
?>

<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
	<div class="search-group">
  		<label class="screen-label" for="s"><?php esc_html_e( 'Search:', 'techblog' ); ?></label><br/>
  		<span>
		<input type="text"  class="search-query" placeholder="<?php esc_attr_e('word', 'techblog;' ); ?>" value="<?php echo get_search_query(); ?>" name="s" title="<?php esc_attr_e( 'Search for:', 'techblog' ); ?>"/>
		<button type="submit" class="search-submit" name="submit" value="<?php esc_attr_e( 'Search', 'techblog' ); ?>"><span class="material-icons">search</span></button>
		</span>
	</div>
</form>

Result

Change the style