forked from bartvdbraak/blender
Merged 39338-39558
This commit is contained in:
commit
c58fb76f1a
79
GNUmakefile
79
GNUmakefile
@ -35,17 +35,33 @@ OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]')
|
||||
# Source and Build DIR's
|
||||
BLENDER_DIR:=$(shell pwd -P)
|
||||
BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)
|
||||
BUILD_TYPE:=Release
|
||||
BUILD_CMAKE_ARGS:=""
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# additional targets for the build configuration
|
||||
|
||||
# support 'make debug'
|
||||
ifneq "$(findstring debug, $(MAKECMDGOALS))" ""
|
||||
BUILD_DIR:=$(BUILD_DIR)_debug
|
||||
BUILD_TYPE:=Debug
|
||||
else
|
||||
BUILD_TYPE:=Release
|
||||
endif
|
||||
ifneq "$(findstring lite, $(MAKECMDGOALS))" ""
|
||||
BUILD_DIR:=$(BUILD_DIR)_lite
|
||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C$(BLENDER_DIR)/build_files/cmake/config/blender_lite.cmake
|
||||
endif
|
||||
ifneq "$(findstring headless, $(MAKECMDGOALS))" ""
|
||||
BUILD_DIR:=$(BUILD_DIR)_bpy
|
||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake
|
||||
endif
|
||||
ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
|
||||
BUILD_DIR:=$(BUILD_DIR)_bpy
|
||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C$(BLENDER_DIR)/build_files/cmake/config/bpy_module.cmake
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Get the number of cores for threaded build
|
||||
NPROCS:=1
|
||||
ifeq ($(OS), Linux)
|
||||
@ -61,14 +77,14 @@ ifeq ($(OS), NetBSD)
|
||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build Blender
|
||||
all:
|
||||
@echo
|
||||
@echo Configuring Blender ...
|
||||
|
||||
if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
||||
cmake -H$(BLENDER_DIR) -B$(BUILD_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE) ; \
|
||||
cmake $(BUILD_CMAKE_ARGS) -H$(BLENDER_DIR) -B$(BUILD_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE); \
|
||||
fi
|
||||
|
||||
@echo
|
||||
@ -80,9 +96,40 @@ all:
|
||||
@echo
|
||||
|
||||
debug: all
|
||||
# pass
|
||||
lite: all
|
||||
headless: all
|
||||
bpy: all
|
||||
|
||||
# package types
|
||||
# -----------------------------------------------------------------------------
|
||||
# Helo for build targets
|
||||
help:
|
||||
@echo ""
|
||||
@echo "Convenience targets provided for building blender, (multiple at once can be used)"
|
||||
@echo " * debug - build a debug binary"
|
||||
@echo " * lite - disable non essential features for a smaller binary and faster build"
|
||||
@echo " * headless - build without an interface (renderfarm or server automation)"
|
||||
@echo " * bpy - build as a python module which can be loaded from python directly"
|
||||
@echo ""
|
||||
@echo "Project Files for IDE's"
|
||||
@echo " * project_qtcreator - QtCreator Project Files"
|
||||
@echo " * project_netbeans - NetBeans Project Files"
|
||||
@echo " * project_eclipse - Eclipse CDT4 Project Files"
|
||||
@echo ""
|
||||
@echo "Package Targets"
|
||||
@echo " * package_debian - build a debian package"
|
||||
@echo " * package_pacman - build an arch linux pacmanpackage"
|
||||
@echo " * package_archive - build an archive package"
|
||||
@echo ""
|
||||
@echo "Testing Targets (not assosiated with building blender)"
|
||||
@echo " * test - run ctest, currently tests import/export, operator execution and that python modules load"
|
||||
@echo " * test_cmake - runs our own cmake file checker which detects errors in the cmake file list definitions"
|
||||
@echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting"
|
||||
@echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed"
|
||||
@echo ""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Packages
|
||||
#
|
||||
package_debian:
|
||||
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
|
||||
|
||||
@ -93,7 +140,10 @@ package_archive:
|
||||
make -C $(BUILD_DIR) -s package_archive
|
||||
@echo archive in "$(BUILD_DIR)/release"
|
||||
|
||||
# forward build targets
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Tests
|
||||
#
|
||||
test:
|
||||
cd $(BUILD_DIR) ; ctest . --output-on-failure
|
||||
|
||||
@ -111,6 +161,21 @@ test_cmake:
|
||||
test_deprecated:
|
||||
python3 source/tests/check_deprecated.py
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Project Files
|
||||
#
|
||||
|
||||
project_qtcreator:
|
||||
python3 build_files/cmake/cmake_qtcreator_project.py $(BUILD_DIR)
|
||||
|
||||
project_netbeans:
|
||||
python3 build_files/cmake/cmake_netbeans_project.py $(BUILD_DIR)
|
||||
|
||||
project_eclipse:
|
||||
cmake -G"Eclipse CDT4 - Unix Makefiles" -H$(BLENDER_DIR) -B$(BUILD_DIR)
|
||||
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(BUILD_DIR) clean
|
||||
|
||||
|
24
build_files/cmake/config/blender_headless.cmake
Normal file
24
build_files/cmake/config/blender_headless.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
# headless configuration, useful in for servers or renderfarms
|
||||
# builds without a windowing system (X11/Windows/Cocoa).
|
||||
#
|
||||
# Example usage:
|
||||
# cmake -C../blender/build_files/cmake/config/blender_headless.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_HEADLESS ON CACHE FORCE BOOL)
|
||||
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
|
||||
|
||||
# disable audio, its possible some devs may want this but for now disable
|
||||
# so the python module doesnt hold the audio device and loads quickly.
|
||||
set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
|
||||
set(WITH_SAMPLERATE OFF CACHE FORCE BOOL)
|
||||
set(WITH_FFTW3 OFF CACHE FORCE BOOL)
|
||||
set(WITH_JACK OFF CACHE FORCE BOOL)
|
||||
set(WITH_SDL OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
|
||||
|
||||
# other features which are not especially useful as a python module
|
||||
set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
|
||||
set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
|
43
build_files/cmake/config/blender_lite.cmake
Normal file
43
build_files/cmake/config/blender_lite.cmake
Normal file
@ -0,0 +1,43 @@
|
||||
# turn everything OFF CACHE FORCE BOOL) except for python which defaults to ON
|
||||
# and is needed for the UI
|
||||
#
|
||||
# Example usage:
|
||||
# cmake -C../blender/build_files/cmake/config/blender_lite.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_INSTALL_PORTABLE ON CACHE FORCE BOOL)
|
||||
|
||||
set(WITH_BUILDINFO OFF CACHE FORCE BOOL)
|
||||
set(WITH_BUILTIN_GLEW OFF CACHE FORCE BOOL)
|
||||
set(WITH_BULLET OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
|
||||
set(WITH_FFTW3 OFF CACHE FORCE BOOL)
|
||||
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
|
||||
set(WITH_IK_ITASC OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_CINEON OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_DDS OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_FRAMESERVER OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_HDR OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_OPENEXR OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_OPENJPEG OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_REDCODE OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_TIFF OFF CACHE FORCE BOOL)
|
||||
set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
|
||||
set(WITH_INTERNATIONAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_JACK OFF CACHE FORCE BOOL)
|
||||
set(WITH_LZMA OFF CACHE FORCE BOOL)
|
||||
set(WITH_LZO OFF CACHE FORCE BOOL)
|
||||
set(WITH_MOD_BOOLEAN OFF CACHE FORCE BOOL)
|
||||
set(WITH_MOD_DECIMATE OFF CACHE FORCE BOOL)
|
||||
set(WITH_MOD_FLUID OFF CACHE FORCE BOOL)
|
||||
set(WITH_MOD_SMOKE OFF CACHE FORCE BOOL)
|
||||
set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENCOLLADA OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENMP OFF CACHE FORCE BOOL)
|
||||
set(WITH_PYTHON_INSTALL OFF CACHE FORCE BOOL)
|
||||
set(WITH_RAYOPTIMIZATION OFF CACHE FORCE BOOL)
|
||||
set(WITH_SAMPLERATE OFF CACHE FORCE BOOL)
|
||||
set(WITH_SDL OFF CACHE FORCE BOOL)
|
||||
set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
|
34
build_files/cmake/config/bpy_module.cmake
Normal file
34
build_files/cmake/config/bpy_module.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
# defaults for building blender as a python module 'bpy'
|
||||
#
|
||||
# Example usage:
|
||||
# cmake -C../blender/build_files/cmake/config/bpy_module.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_PYTHON_MODULE ON CACHE FORCE BOOL)
|
||||
|
||||
# install into the systems python dir
|
||||
set(WITH_INSTALL_PORTABLE OFF CACHE FORCE BOOL)
|
||||
|
||||
# no point int copying python into python
|
||||
set(WITH_PYTHON_INSTALL OFF CACHE FORCE BOOL)
|
||||
|
||||
# dont build the game engine
|
||||
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
|
||||
|
||||
# disable audio, its possible some devs may want this but for now disable
|
||||
# so the python module doesnt hold the audio device and loads quickly.
|
||||
set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
|
||||
set(WITH_SAMPLERATE OFF CACHE FORCE BOOL)
|
||||
set(WITH_FFTW3 OFF CACHE FORCE BOOL)
|
||||
set(WITH_JACK OFF CACHE FORCE BOOL)
|
||||
set(WITH_SDL OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
|
||||
|
||||
# other features which are not especially useful as a python module
|
||||
set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
|
||||
set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENCOLLADA OFF CACHE FORCE BOOL)
|
||||
set(WITH_INTERNATIONAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_BULLET OFF CACHE FORCE BOOL)
|
@ -43,6 +43,7 @@ public:
|
||||
// whether multi-axis functionality is available (via the OS or driver)
|
||||
// does not imply that a device is plugged in or being used
|
||||
bool available();
|
||||
bool oldDRV();
|
||||
|
||||
private:
|
||||
unsigned short m_clientID;
|
||||
|
@ -143,7 +143,7 @@ GHOST_NDOFManagerCocoa::GHOST_NDOFManagerCocoa(GHOST_System& sys)
|
||||
|
||||
// printf("ndof: client id = %d\n", m_clientID);
|
||||
|
||||
if (SetConnexionClientButtonMask != NULL) {
|
||||
if (oldDRV()) {
|
||||
has_old_driver = false;
|
||||
SetConnexionClientButtonMask(m_clientID, kConnexionMaskAllButtons);
|
||||
}
|
||||
@ -176,5 +176,14 @@ extern "C" {
|
||||
return InstallConnexionHandlers != NULL;
|
||||
// this means that the driver is installed and dynamically linked to blender
|
||||
}
|
||||
|
||||
bool GHOST_NDOFManagerCocoa::oldDRV()
|
||||
{
|
||||
extern OSErr SetConnexionClientButtonMask() __attribute__((weak_import));
|
||||
// Make the linker happy for the framework check (see link below for more info)
|
||||
// http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html
|
||||
return SetConnexionClientButtonMask != NULL;
|
||||
// this means that the driver has this symbol
|
||||
}
|
||||
}
|
||||
#endif // WITH_INPUT_NDOF
|
||||
|
@ -385,8 +385,26 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
||||
|
||||
GHOST_TKey gkey= convertSDLKey(sdl_sub_evt.keysym.scancode);
|
||||
/* note, the sdl_sub_evt.keysym.sym is truncated, for unicode support ghost has to be modified */
|
||||
/* printf("%d\n", sym); */
|
||||
if(sym > 127) {
|
||||
sym= 0;
|
||||
switch(sym) {
|
||||
case SDLK_KP_DIVIDE: sym= '/'; break;
|
||||
case SDLK_KP_MULTIPLY: sym= '*'; break;
|
||||
case SDLK_KP_MINUS: sym= '-'; break;
|
||||
case SDLK_KP_PLUS: sym= '+'; break;
|
||||
case SDLK_KP_1: sym= '1'; break;
|
||||
case SDLK_KP_2: sym= '2'; break;
|
||||
case SDLK_KP_3: sym= '3'; break;
|
||||
case SDLK_KP_4: sym= '4'; break;
|
||||
case SDLK_KP_5: sym= '5'; break;
|
||||
case SDLK_KP_6: sym= '6'; break;
|
||||
case SDLK_KP_7: sym= '7'; break;
|
||||
case SDLK_KP_8: sym= '8'; break;
|
||||
case SDLK_KP_9: sym= '9'; break;
|
||||
case SDLK_KP_0: sym= '0'; break;
|
||||
case SDLK_KP_PERIOD: sym= '.'; break;
|
||||
default: sym= 0; break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(sdl_sub_evt.keysym.mod & (KMOD_LSHIFT|KMOD_RSHIFT)) {
|
||||
|
@ -612,7 +612,6 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
|
||||
wp.showCmd = SW_SHOWMINIMIZED;
|
||||
break;
|
||||
case GHOST_kWindowStateMaximized:
|
||||
ShowWindow(m_hWnd, SW_HIDE);
|
||||
wp.showCmd = SW_SHOWMAXIMIZED;
|
||||
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
|
||||
break;
|
||||
@ -629,12 +628,12 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
|
||||
break;
|
||||
case GHOST_kWindowStateNormal:
|
||||
default:
|
||||
ShowWindow(m_hWnd, SW_HIDE);
|
||||
wp.showCmd = SW_SHOWNORMAL;
|
||||
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
|
||||
break;
|
||||
}
|
||||
return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
||||
SetWindowPos(m_hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); /*Clears window cache for SetWindowLongPtr */
|
||||
return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,7 +439,7 @@ def path_reference_copy(copy_set, report=print):
|
||||
shutil.copy(file_src, file_dst)
|
||||
|
||||
|
||||
def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."):
|
||||
"""
|
||||
Helper function for storing unique names which may have special characters
|
||||
stripped and restricted to a maximum length.
|
||||
@ -456,6 +456,9 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
:type name_dict: dict
|
||||
:arg clean_func: Function to call on *name* before creating a unique value.
|
||||
:type clean_func: function
|
||||
:arg sep: Separator to use when between the name and a number when a
|
||||
duplicate name is found.
|
||||
:type sep: string
|
||||
"""
|
||||
name_new = name_dict.get(key)
|
||||
if name_new is None:
|
||||
@ -466,14 +469,15 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
|
||||
if name_max == -1:
|
||||
while name_new in name_dict_values:
|
||||
name_new = "%s.%03d" % (name_new_orig, count)
|
||||
name_new = "%s%s%03d" % (name_new_orig, sep, count)
|
||||
count += 1
|
||||
else:
|
||||
name_new = name_new[:name_max]
|
||||
while name_new in name_dict_values:
|
||||
count_str = "%03d" % count
|
||||
name_new = "%.*s.%s" % (name_max - (len(count_str) + 1),
|
||||
name_new = "%.*s%s%s" % (name_max - (len(count_str) + 1),
|
||||
name_new_orig,
|
||||
sep,
|
||||
count_str,
|
||||
)
|
||||
count += 1
|
||||
|
@ -813,39 +813,26 @@ def main(context,
|
||||
global RotMatStepRotation
|
||||
main_consts()
|
||||
|
||||
# TODO, all selected meshes
|
||||
'''
|
||||
# objects = context.selected_editable_objects
|
||||
objects = []
|
||||
|
||||
# we can will tag them later.
|
||||
obList = [ob for ob in objects if ob.type == 'MESH']
|
||||
|
||||
# Face select object may not be selected.
|
||||
ob = context.active_object
|
||||
|
||||
if ob and (not ob.select) and ob.type == 'MESH':
|
||||
# Add to the list
|
||||
obList =[ob]
|
||||
del objects
|
||||
'''
|
||||
# Create the variables.
|
||||
USER_PROJECTION_LIMIT = projection_limit
|
||||
USER_ONLY_SELECTED_FACES = True
|
||||
USER_SHARE_SPACE = 1 # Only for hole filling.
|
||||
USER_STRETCH_ASPECT = 1 # Only for hole filling.
|
||||
USER_ISLAND_MARGIN = island_margin # Only for hole filling.
|
||||
USER_FILL_HOLES = 0
|
||||
USER_FILL_HOLES_QUALITY = 50 # Only for hole filling.
|
||||
USER_VIEW_INIT = 0 # Only for hole filling.
|
||||
|
||||
# quick workaround
|
||||
obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH']
|
||||
is_editmode = (context.active_object.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH']
|
||||
else:
|
||||
obList = [ob for ob in context.selected_editable_objects if ob and ob.type == 'MESH']
|
||||
USER_ONLY_SELECTED_FACES = False
|
||||
|
||||
if not obList:
|
||||
raise('error, no selected mesh objects')
|
||||
|
||||
# Create the variables.
|
||||
USER_PROJECTION_LIMIT = projection_limit
|
||||
USER_ONLY_SELECTED_FACES = (1)
|
||||
USER_SHARE_SPACE = (1) # Only for hole filling.
|
||||
USER_STRETCH_ASPECT = (1) # Only for hole filling.
|
||||
USER_ISLAND_MARGIN = island_margin # Only for hole filling.
|
||||
USER_FILL_HOLES = (0)
|
||||
USER_FILL_HOLES_QUALITY = (50) # Only for hole filling.
|
||||
USER_VIEW_INIT = (0) # Only for hole filling.
|
||||
|
||||
# Reuse variable
|
||||
if len(obList) == 1:
|
||||
ob = "Unwrap %i Selected Mesh"
|
||||
@ -906,8 +893,8 @@ def main(context,
|
||||
|
||||
if USER_ONLY_SELECTED_FACES:
|
||||
meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.select]
|
||||
#else:
|
||||
# meshFaces = map(thickface, me.faces)
|
||||
else:
|
||||
meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces)]
|
||||
|
||||
if not meshFaces:
|
||||
continue
|
||||
@ -922,7 +909,7 @@ def main(context,
|
||||
# meshFaces = []
|
||||
|
||||
# meshFaces.sort( lambda a, b: cmp(b.area , a.area) ) # Biggest first.
|
||||
meshFaces.sort( key = lambda a: -a.area )
|
||||
meshFaces.sort(key=lambda a: -a.area)
|
||||
|
||||
# remove all zero area faces
|
||||
while meshFaces and meshFaces[-1].area <= SMALL_NUM:
|
||||
|
@ -20,8 +20,12 @@
|
||||
|
||||
import bpy
|
||||
from bpy.types import Menu, Operator
|
||||
from bpy.props import StringProperty, BoolProperty, IntProperty, \
|
||||
FloatProperty, EnumProperty
|
||||
from bpy.props import (StringProperty,
|
||||
BoolProperty,
|
||||
IntProperty,
|
||||
FloatProperty,
|
||||
EnumProperty,
|
||||
)
|
||||
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
|
||||
|
||||
@ -39,23 +43,30 @@ class MESH_OT_delete_edgeloop(Operator):
|
||||
|
||||
return {'CANCELLED'}
|
||||
|
||||
rna_path_prop = StringProperty(name="Context Attributes",
|
||||
description="rna context string", maxlen=1024, default="")
|
||||
rna_path_prop = StringProperty(
|
||||
name="Context Attributes",
|
||||
description="rna context string",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_reverse_prop = BoolProperty(name="Reverse",
|
||||
description="Cycle backwards", default=False)
|
||||
rna_reverse_prop = BoolProperty(
|
||||
name="Reverse",
|
||||
description="Cycle backwards",
|
||||
default=False,
|
||||
)
|
||||
|
||||
rna_relative_prop = BoolProperty(name="Relative",
|
||||
rna_relative_prop = BoolProperty(
|
||||
name="Relative",
|
||||
description="Apply relative to the current value (delta)",
|
||||
default=False)
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
def context_path_validate(context, data_path):
|
||||
import sys
|
||||
try:
|
||||
value = eval("context.%s" % data_path) if data_path else Ellipsis
|
||||
except AttributeError:
|
||||
if "'NoneType'" in str(sys.exc_info()[1]):
|
||||
except AttributeError as e:
|
||||
if str(e).startswith("'NoneType'"):
|
||||
# One of the items in the rna path is None, just ignore this
|
||||
value = Ellipsis
|
||||
else:
|
||||
@ -65,16 +76,65 @@ def context_path_validate(context, data_path):
|
||||
return value
|
||||
|
||||
|
||||
def operator_value_is_undo(value):
|
||||
if value in {None, Ellipsis}:
|
||||
return False
|
||||
|
||||
# typical properties or objects
|
||||
id_data = getattr(value, "id_data", Ellipsis)
|
||||
|
||||
if id_data is None:
|
||||
return False
|
||||
elif id_data is Ellipsis:
|
||||
# handle mathutils types
|
||||
id_data = getattr(getattr(value, "owner", None), "id_data", None)
|
||||
|
||||
if id_data is None:
|
||||
return False
|
||||
|
||||
# return True if its a non window ID type
|
||||
return (isinstance(id_data, bpy.types.ID) and
|
||||
(not isinstance(id_data, (bpy.types.WindowManager,
|
||||
bpy.types.Screen,
|
||||
bpy.types.Scene,
|
||||
bpy.types.Brush,
|
||||
))))
|
||||
|
||||
|
||||
def operator_path_is_undo(context, data_path):
|
||||
# note that if we have data paths that use strings this could fail
|
||||
# luckily we dont do this!
|
||||
#
|
||||
# When we cant find the data owner assume no undo is needed.
|
||||
data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".")
|
||||
|
||||
if not data_path_head:
|
||||
return False
|
||||
|
||||
value = context_path_validate(context, data_path_head)
|
||||
|
||||
return operator_value_is_undo(value)
|
||||
|
||||
|
||||
def operator_path_undo_return(context, data_path):
|
||||
return {'FINISHED'} if operator_path_is_undo(context, data_path) else {'CANCELLED'}
|
||||
|
||||
|
||||
def operator_value_undo_return(value):
|
||||
return {'FINISHED'} if operator_value_is_undo(value) else {'CANCELLED'}
|
||||
|
||||
|
||||
def execute_context_assign(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
data_path = self.data_path
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
if getattr(self, "relative", False):
|
||||
exec("context.%s+=self.value" % self.data_path)
|
||||
exec("context.%s += self.value" % data_path)
|
||||
else:
|
||||
exec("context.%s=self.value" % self.data_path)
|
||||
exec("context.%s = self.value" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class BRUSH_OT_active_index_set(Operator):
|
||||
@ -82,15 +142,21 @@ class BRUSH_OT_active_index_set(Operator):
|
||||
bl_idname = "brush.active_index_set"
|
||||
bl_label = "Set Brush Number"
|
||||
|
||||
mode = StringProperty(name="mode",
|
||||
description="Paint mode to set brush for", maxlen=1024)
|
||||
index = IntProperty(name="number",
|
||||
description="Brush number")
|
||||
mode = StringProperty(
|
||||
name="mode",
|
||||
description="Paint mode to set brush for",
|
||||
maxlen=1024,
|
||||
)
|
||||
index = IntProperty(
|
||||
name="number",
|
||||
description="Brush number",
|
||||
)
|
||||
|
||||
_attr_dict = {"sculpt": "use_paint_sculpt",
|
||||
"vertex_paint": "use_paint_vertex",
|
||||
"weight_paint": "use_paint_weight",
|
||||
"image_paint": "use_paint_image"}
|
||||
"image_paint": "use_paint_image",
|
||||
}
|
||||
|
||||
def execute(self, context):
|
||||
attr = self._attr_dict.get(self.mode)
|
||||
@ -112,8 +178,11 @@ class WM_OT_context_set_boolean(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = BoolProperty(name="Value",
|
||||
description="Assignment value", default=True)
|
||||
value = BoolProperty(
|
||||
name="Value",
|
||||
description="Assignment value",
|
||||
default=True,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@ -125,7 +194,11 @@ class WM_OT_context_set_int(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = IntProperty(name="Value", description="Assign value", default=0)
|
||||
value = IntProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
default=0,
|
||||
)
|
||||
relative = rna_relative_prop
|
||||
|
||||
execute = execute_context_assign
|
||||
@ -138,17 +211,23 @@ class WM_OT_context_scale_int(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = FloatProperty(name="Value", description="Assign value", default=1.0)
|
||||
always_step = BoolProperty(name="Always Step",
|
||||
description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
|
||||
default=True)
|
||||
value = FloatProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
default=1.0,
|
||||
)
|
||||
always_step = BoolProperty(
|
||||
name="Always Step",
|
||||
description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
|
||||
default=True,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
data_path = self.data_path
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
value = self.value
|
||||
data_path = self.data_path
|
||||
|
||||
if value == 1.0: # nothing to do
|
||||
return {'CANCELLED'}
|
||||
@ -160,11 +239,12 @@ class WM_OT_context_scale_int(Operator):
|
||||
else:
|
||||
add = "-1"
|
||||
func = "min"
|
||||
exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add))
|
||||
exec("context.%s = %s(round(context.%s * value), context.%s + %s)" %
|
||||
(data_path, func, data_path, data_path, add))
|
||||
else:
|
||||
exec("context.%s *= value" % self.data_path)
|
||||
exec("context.%s *= value" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_set_float(Operator): # same as enum
|
||||
@ -174,8 +254,11 @@ class WM_OT_context_set_float(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = FloatProperty(name="Value",
|
||||
description="Assignment value", default=0.0)
|
||||
value = FloatProperty(
|
||||
name="Value",
|
||||
description="Assignment value",
|
||||
default=0.0,
|
||||
)
|
||||
relative = rna_relative_prop
|
||||
|
||||
execute = execute_context_assign
|
||||
@ -188,8 +271,11 @@ class WM_OT_context_set_string(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@ -201,9 +287,11 @@ class WM_OT_context_set_enum(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assignment value (as a string)",
|
||||
maxlen=1024, default="")
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@ -215,15 +303,18 @@ class WM_OT_context_set_value(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assignment value (as a string)",
|
||||
maxlen=1024, default="")
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
data_path = self.data_path
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
exec("context.%s=%s" % (self.data_path, self.value))
|
||||
return {'FINISHED'}
|
||||
exec("context.%s = %s" % (data_path, self.value))
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_toggle(Operator):
|
||||
@ -235,14 +326,14 @@ class WM_OT_context_toggle(Operator):
|
||||
data_path = rna_path_prop
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
exec("context.%s=not (context.%s)" %
|
||||
(self.data_path, self.data_path))
|
||||
exec("context.%s = not (context.%s)" % (data_path, data_path))
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_toggle_enum(Operator):
|
||||
@ -252,23 +343,30 @@ class WM_OT_context_toggle_enum(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value_1 = StringProperty(name="Value", \
|
||||
description="Toggle enum", maxlen=1024, default="")
|
||||
|
||||
value_2 = StringProperty(name="Value", \
|
||||
description="Toggle enum", maxlen=1024, default="")
|
||||
value_1 = StringProperty(
|
||||
name="Value",
|
||||
description="Toggle enum",
|
||||
maxlen=1024,
|
||||
)
|
||||
value_2 = StringProperty(
|
||||
name="Value",
|
||||
description="Toggle enum",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
|
||||
(self.data_path, self.value_1,\
|
||||
self.value_2, self.data_path,
|
||||
self.value_2))
|
||||
exec("context.%s = ('%s', '%s')[context.%s != '%s']" %
|
||||
(data_path, self.value_1,
|
||||
self.value_2, data_path,
|
||||
self.value_2,
|
||||
))
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_cycle_int(Operator):
|
||||
@ -292,7 +390,7 @@ class WM_OT_context_cycle_int(Operator):
|
||||
else:
|
||||
value += 1
|
||||
|
||||
exec("context.%s=value" % data_path)
|
||||
exec("context.%s = value" % data_path)
|
||||
|
||||
if value != eval("context.%s" % data_path):
|
||||
# relies on rna clamping int's out of the range
|
||||
@ -301,9 +399,9 @@ class WM_OT_context_cycle_int(Operator):
|
||||
else:
|
||||
value = -1 << 31
|
||||
|
||||
exec("context.%s=value" % data_path)
|
||||
exec("context.%s = value" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_cycle_enum(Operator):
|
||||
@ -316,15 +414,15 @@ class WM_OT_context_cycle_enum(Operator):
|
||||
reverse = rna_reverse_prop
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
value = context_path_validate(context, self.data_path)
|
||||
data_path = self.data_path
|
||||
value = context_path_validate(context, data_path)
|
||||
if value is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
orig_value = value
|
||||
|
||||
# Have to get rna enum values
|
||||
rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1)
|
||||
rna_struct_str, rna_prop_str = data_path.rsplit('.', 1)
|
||||
i = rna_prop_str.find('[')
|
||||
|
||||
# just incse we get "context.foo.bar[0]"
|
||||
@ -354,8 +452,8 @@ class WM_OT_context_cycle_enum(Operator):
|
||||
advance_enum = enums[orig_index + 1]
|
||||
|
||||
# set the new value
|
||||
exec("context.%s=advance_enum" % self.data_path)
|
||||
return {'FINISHED'}
|
||||
exec("context.%s = advance_enum" % data_path)
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_cycle_array(Operator):
|
||||
@ -381,9 +479,9 @@ class WM_OT_context_cycle_array(Operator):
|
||||
array.append(array.pop(0))
|
||||
return array
|
||||
|
||||
exec("context.%s=cycle(context.%s[:])" % (data_path, data_path))
|
||||
exec("context.%s = cycle(context.%s[:])" % (data_path, data_path))
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_MT_context_menu_enum(Menu):
|
||||
@ -426,8 +524,11 @@ class WM_OT_context_set_id(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
value = self.value
|
||||
@ -449,16 +550,23 @@ class WM_OT_context_set_id(Operator):
|
||||
|
||||
if id_iter:
|
||||
value_id = getattr(bpy.data, id_iter).get(value)
|
||||
exec("context.%s=value_id" % data_path)
|
||||
exec("context.%s = value_id" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
doc_id = StringProperty(name="Doc ID",
|
||||
description="", maxlen=1024, default="", options={'HIDDEN'})
|
||||
doc_id = StringProperty(
|
||||
name="Doc ID",
|
||||
description="",
|
||||
maxlen=1024,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
doc_new = StringProperty(name="Edit Description",
|
||||
description="", maxlen=1024, default="")
|
||||
doc_new = StringProperty(
|
||||
name="Edit Description",
|
||||
description="",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
data_path_iter = StringProperty(
|
||||
description="The data path relative to the context, must point to an iterable.")
|
||||
@ -476,12 +584,13 @@ class WM_OT_context_collection_boolean_set(Operator):
|
||||
data_path_iter = data_path_iter
|
||||
data_path_item = data_path_item
|
||||
|
||||
type = EnumProperty(items=(
|
||||
('TOGGLE', "Toggle", ""),
|
||||
('ENABLE', "Enable", ""),
|
||||
('DISABLE', "Disable", ""),
|
||||
),
|
||||
name="Type")
|
||||
type = EnumProperty(
|
||||
name="Type",
|
||||
items=(('TOGGLE', "Toggle", ""),
|
||||
('ENABLE', "Enable", ""),
|
||||
('DISABLE', "Disable", ""),
|
||||
),
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
data_path_iter = self.data_path_iter
|
||||
@ -507,6 +616,10 @@ class WM_OT_context_collection_boolean_set(Operator):
|
||||
|
||||
items_ok.append(item)
|
||||
|
||||
# avoid undo push when nothing to do
|
||||
if not items_ok:
|
||||
return {'CANCELLED'}
|
||||
|
||||
if self.type == 'ENABLE':
|
||||
is_set = True
|
||||
elif self.type == 'DISABLE':
|
||||
@ -518,20 +631,26 @@ class WM_OT_context_collection_boolean_set(Operator):
|
||||
for item in items_ok:
|
||||
exec(exec_str)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_value_undo_return(item)
|
||||
|
||||
|
||||
class WM_OT_context_modal_mouse(Operator):
|
||||
'''Adjust arbitrary values with mouse input'''
|
||||
bl_idname = "wm.context_modal_mouse"
|
||||
bl_label = "Context Modal Mouse"
|
||||
bl_options = {'GRAB_POINTER', 'BLOCKING', 'INTERNAL'}
|
||||
bl_options = {'GRAB_POINTER', 'BLOCKING', 'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path_iter = data_path_iter
|
||||
data_path_item = data_path_item
|
||||
|
||||
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
|
||||
invert = BoolProperty(default=False, description="Invert the mouse input")
|
||||
input_scale = FloatProperty(
|
||||
description="Scale the mouse movement by this value before applying the delta",
|
||||
default=0.01,
|
||||
)
|
||||
invert = BoolProperty(
|
||||
description="Invert the mouse input",
|
||||
default=False,
|
||||
)
|
||||
initial_x = IntProperty(options={'HIDDEN'})
|
||||
|
||||
def _values_store(self, context):
|
||||
@ -584,12 +703,13 @@ class WM_OT_context_modal_mouse(Operator):
|
||||
self._values_delta(delta)
|
||||
|
||||
elif 'LEFTMOUSE' == event_type:
|
||||
item = next(iter(self._values.keys()))
|
||||
self._values_clear()
|
||||
return {'FINISHED'}
|
||||
return operator_value_undo_return(item)
|
||||
|
||||
elif event_type in {'RIGHTMOUSE', 'ESC'}:
|
||||
self._values_restore()
|
||||
return {'FINISHED'}
|
||||
return {'CANCELLED'}
|
||||
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
@ -613,7 +733,10 @@ class WM_OT_url_open(Operator):
|
||||
bl_idname = "wm.url_open"
|
||||
bl_label = ""
|
||||
|
||||
url = StringProperty(name="URL", description="URL to open")
|
||||
url = StringProperty(
|
||||
name="URL",
|
||||
description="URL to open",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import webbrowser
|
||||
@ -627,7 +750,11 @@ class WM_OT_path_open(Operator):
|
||||
bl_idname = "wm.path_open"
|
||||
bl_label = ""
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024, subtype='FILE_PATH')
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import sys
|
||||
@ -662,9 +789,11 @@ class WM_OT_doc_view(Operator):
|
||||
|
||||
doc_id = doc_id
|
||||
if bpy.app.version_cycle == "release":
|
||||
_prefix = "http://www.blender.org/documentation/blender_python_api_%s%s_release" % ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char)
|
||||
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s%s_release" %
|
||||
("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char))
|
||||
else:
|
||||
_prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version)
|
||||
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s" %
|
||||
"_".join(str(v) for v in bpy.app.version))
|
||||
|
||||
def _nested_class_string(self, class_string):
|
||||
ls = []
|
||||
@ -682,8 +811,8 @@ class WM_OT_doc_view(Operator):
|
||||
class_name, class_prop = id_split
|
||||
|
||||
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
|
||||
url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \
|
||||
(self._prefix, class_name, class_name, class_prop)
|
||||
url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
else:
|
||||
|
||||
# detect if this is a inherited member and use that name instead
|
||||
@ -696,8 +825,8 @@ class WM_OT_doc_view(Operator):
|
||||
|
||||
# It so happens that epydoc nests these, not sphinx
|
||||
# class_name_full = self._nested_class_string(class_name)
|
||||
url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \
|
||||
(self._prefix, class_name, class_name, class_prop)
|
||||
url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
|
||||
else:
|
||||
return {'PASS_THROUGH'}
|
||||
@ -780,17 +909,36 @@ class WM_OT_doc_edit(Operator):
|
||||
return wm.invoke_props_dialog(self, width=600)
|
||||
|
||||
|
||||
rna_path = StringProperty(name="Property Edit",
|
||||
description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
|
||||
rna_path = StringProperty(
|
||||
name="Property Edit",
|
||||
description="Property data_path edit",
|
||||
maxlen=1024,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
rna_value = StringProperty(name="Property Value",
|
||||
description="Property value edit", maxlen=1024, default="")
|
||||
rna_value = StringProperty(
|
||||
name="Property Value",
|
||||
description="Property value edit",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_property = StringProperty(name="Property Name",
|
||||
description="Property name edit", maxlen=1024, default="")
|
||||
rna_property = StringProperty(
|
||||
name="Property Name",
|
||||
description="Property name edit",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_min = FloatProperty(name="Min", default=0.0, precision=3)
|
||||
rna_max = FloatProperty(name="Max", default=1.0, precision=3)
|
||||
rna_min = FloatProperty(
|
||||
name="Min",
|
||||
default=0.0,
|
||||
precision=3,
|
||||
)
|
||||
|
||||
rna_max = FloatProperty(
|
||||
name="Max",
|
||||
default=1.0,
|
||||
precision=3,
|
||||
)
|
||||
|
||||
|
||||
class WM_OT_properties_edit(Operator):
|
||||
@ -804,7 +952,9 @@ class WM_OT_properties_edit(Operator):
|
||||
value = rna_value
|
||||
min = rna_min
|
||||
max = rna_max
|
||||
description = StringProperty(name="Tip", default="")
|
||||
description = StringProperty(
|
||||
name="Tip",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
@ -857,14 +1007,15 @@ class WM_OT_properties_edit(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
data_path = self.data_path
|
||||
|
||||
if not self.data_path:
|
||||
if not data_path:
|
||||
self.report({'ERROR'}, "Data path not set")
|
||||
return {'CANCELLED'}
|
||||
|
||||
self._last_prop = [self.property]
|
||||
|
||||
item = eval("context.%s" % self.data_path)
|
||||
item = eval("context.%s" % data_path)
|
||||
|
||||
# setup defaults
|
||||
prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create
|
||||
@ -885,7 +1036,8 @@ class WM_OT_properties_add(Operator):
|
||||
data_path = rna_path
|
||||
|
||||
def execute(self, context):
|
||||
item = eval("context.%s" % self.data_path)
|
||||
data_path = self.data_path
|
||||
item = eval("context.%s" % data_path)
|
||||
|
||||
def unique_name(names):
|
||||
prop = 'prop'
|
||||
@ -908,10 +1060,13 @@ class WM_OT_properties_context_change(Operator):
|
||||
bl_idname = "wm.properties_context_change"
|
||||
bl_label = ""
|
||||
|
||||
context = StringProperty(name="Context", maxlen=32)
|
||||
context = StringProperty(
|
||||
name="Context",
|
||||
maxlen=32,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
context.space_data.context = (self.context)
|
||||
context.space_data.context = self.context
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@ -924,7 +1079,8 @@ class WM_OT_properties_remove(Operator):
|
||||
property = rna_property
|
||||
|
||||
def execute(self, context):
|
||||
item = eval("context.%s" % self.data_path)
|
||||
data_path = self.data_path
|
||||
item = eval("context.%s" % data_path)
|
||||
del item[self.property]
|
||||
return {'FINISHED'}
|
||||
|
||||
@ -933,7 +1089,10 @@ class WM_OT_keyconfig_activate(Operator):
|
||||
bl_idname = "wm.keyconfig_activate"
|
||||
bl_label = "Activate Keyconfig"
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024)
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
bpy.utils.keyconfig_set(self.filepath)
|
||||
@ -961,7 +1120,10 @@ class WM_OT_appconfig_activate(Operator):
|
||||
bl_idname = "wm.appconfig_activate"
|
||||
bl_label = "Activate Application Configuration"
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024)
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import os
|
||||
|
@ -109,7 +109,7 @@ class DATA_PT_shape_curve(CurveButtonsPanel, Panel):
|
||||
if (is_curve or is_text):
|
||||
col.label(text="Fill:")
|
||||
sub = col.column()
|
||||
sub.active = (curve.bevel_object is None)
|
||||
sub.active = (curve.dimensions == '2D' or (curve.bevel_object is None and curve.dimensions == '3D'))
|
||||
sub.prop(curve, "use_fill_front")
|
||||
sub.prop(curve, "use_fill_back")
|
||||
col.prop(curve, "use_fill_deform", text="Fill Deformed")
|
||||
|
@ -73,7 +73,7 @@ class DATA_PT_context_mesh(MeshButtonsPanel, Panel):
|
||||
ob = context.object
|
||||
mesh = context.mesh
|
||||
space = context.space_data
|
||||
|
||||
layout.prop(context.scene.tool_settings, "mesh_select_mode", index=0, text="Vertex")
|
||||
if ob:
|
||||
layout.template_ID(ob, "data")
|
||||
elif mesh:
|
||||
|
@ -577,13 +577,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
sub = col.column()
|
||||
sub.active = bool(md.vertex_group)
|
||||
sub.prop(md, "invert_vertex_group", text="Invert")
|
||||
sub.prop(md, "thickness_vertex_group", text="Factor")
|
||||
|
||||
col.prop(md, "use_even_offset")
|
||||
col.prop(md, "use_quality_normals")
|
||||
col.prop(md, "use_rim")
|
||||
|
||||
sub = col.column()
|
||||
sub.label()
|
||||
row = sub.split(align=True, percentage=0.4)
|
||||
row.prop(md, "material_offset", text="")
|
||||
row = row.row()
|
||||
|
@ -26,17 +26,14 @@ class CONSOLE_HT_header(Header):
|
||||
bl_space_type = 'CONSOLE'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout = self.layout.row(align=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.template_header()
|
||||
layout.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
sub.menu("CONSOLE_MT_console")
|
||||
layout.menu("CONSOLE_MT_console")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("console.autocomplete", text="Autocomplete")
|
||||
layout.operator("console.autocomplete", text="Autocomplete")
|
||||
|
||||
|
||||
class CONSOLE_MT_console(Menu):
|
||||
@ -44,7 +41,7 @@ class CONSOLE_MT_console(Menu):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.column()
|
||||
|
||||
layout.operator("console.clear")
|
||||
layout.operator("console.copy")
|
||||
layout.operator("console.paste")
|
||||
|
@ -97,21 +97,19 @@ class DOPESHEET_HT_header(Header):
|
||||
row.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
|
||||
sub.menu("DOPESHEET_MT_view")
|
||||
sub.menu("DOPESHEET_MT_select")
|
||||
sub.menu("DOPESHEET_MT_marker")
|
||||
row.menu("DOPESHEET_MT_view")
|
||||
row.menu("DOPESHEET_MT_select")
|
||||
row.menu("DOPESHEET_MT_marker")
|
||||
|
||||
if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action != None):
|
||||
sub.menu("DOPESHEET_MT_channel")
|
||||
row.menu("DOPESHEET_MT_channel")
|
||||
elif st.mode == 'GPENCIL':
|
||||
sub.menu("DOPESHEET_MT_gpencil_channel")
|
||||
row.menu("DOPESHEET_MT_gpencil_channel")
|
||||
|
||||
if st.mode != 'GPENCIL':
|
||||
sub.menu("DOPESHEET_MT_key")
|
||||
row.menu("DOPESHEET_MT_key")
|
||||
else:
|
||||
sub.menu("DOPESHEET_MT_gpencil_frame")
|
||||
row.menu("DOPESHEET_MT_gpencil_frame")
|
||||
|
||||
layout.prop(st, "mode", text="")
|
||||
layout.prop(st.dopesheet, "show_summary", text="Summary")
|
||||
@ -143,8 +141,6 @@ class DOPESHEET_MT_view(Menu):
|
||||
|
||||
st = context.space_data
|
||||
|
||||
layout.column()
|
||||
|
||||
layout.prop(st, "use_realtime_update")
|
||||
layout.prop(st, "show_frame_indicator")
|
||||
layout.prop(st, "show_sliders")
|
||||
@ -177,7 +173,6 @@ class DOPESHEET_MT_select(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
# This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
|
||||
layout.operator("action.select_all_toggle")
|
||||
layout.operator("action.select_all_toggle", text="Invert Selection").invert = True
|
||||
@ -217,7 +212,6 @@ class DOPESHEET_MT_marker(Menu):
|
||||
|
||||
#layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
layout.column()
|
||||
layout.operator("marker.add", "Add Marker")
|
||||
layout.operator("marker.duplicate", text="Duplicate Marker")
|
||||
layout.operator("marker.delete", text="Delete Marker")
|
||||
@ -246,7 +240,6 @@ class DOPESHEET_MT_channel(Menu):
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_CHANNELS'
|
||||
|
||||
layout.column()
|
||||
layout.operator("anim.channels_delete")
|
||||
|
||||
layout.separator()
|
||||
@ -275,7 +268,6 @@ class DOPESHEET_MT_key(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.menu("DOPESHEET_MT_key_transform", text="Transform")
|
||||
|
||||
layout.operator_menu_enum("action.snap", "type", text="Snap")
|
||||
@ -308,7 +300,6 @@ class DOPESHEET_MT_key_transform(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.operator("transform.transform", text="Grab/Move").mode = 'TIME_TRANSLATE'
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.transform", text="Slide").mode = 'TIME_SLIDE'
|
||||
@ -326,7 +317,6 @@ class DOPESHEET_MT_gpencil_channel(Menu):
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_CHANNELS'
|
||||
|
||||
layout.column()
|
||||
layout.operator("anim.channels_delete")
|
||||
|
||||
layout.separator()
|
||||
@ -352,7 +342,6 @@ class DOPESHEET_MT_gpencil_frame(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.menu("DOPESHEET_MT_key_transform", text="Transform")
|
||||
|
||||
#layout.operator_menu_enum("action.snap", "type", text="Snap")
|
||||
|
@ -36,13 +36,11 @@ class GRAPH_HT_header(Header):
|
||||
row.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
|
||||
sub.menu("GRAPH_MT_view")
|
||||
sub.menu("GRAPH_MT_select")
|
||||
sub.menu("GRAPH_MT_marker")
|
||||
sub.menu("GRAPH_MT_channel")
|
||||
sub.menu("GRAPH_MT_key")
|
||||
row.menu("GRAPH_MT_view")
|
||||
row.menu("GRAPH_MT_select")
|
||||
row.menu("GRAPH_MT_marker")
|
||||
row.menu("GRAPH_MT_channel")
|
||||
row.menu("GRAPH_MT_key")
|
||||
|
||||
layout.prop(st, "mode", text="")
|
||||
|
||||
@ -70,8 +68,6 @@ class GRAPH_MT_view(Menu):
|
||||
|
||||
st = context.space_data
|
||||
|
||||
layout.column()
|
||||
|
||||
layout.operator("graph.properties", icon='MENU_PANEL')
|
||||
layout.separator()
|
||||
|
||||
@ -114,7 +110,6 @@ class GRAPH_MT_select(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
# This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
|
||||
layout.operator("graph.select_all_toggle")
|
||||
layout.operator("graph.select_all_toggle", text="Invert Selection").invert = True
|
||||
@ -151,7 +146,6 @@ class GRAPH_MT_marker(Menu):
|
||||
|
||||
#layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
layout.column()
|
||||
layout.operator("marker.add", "Add Marker")
|
||||
layout.operator("marker.duplicate", text="Duplicate Marker")
|
||||
layout.operator("marker.delete", text="Delete Marker")
|
||||
@ -172,7 +166,6 @@ class GRAPH_MT_channel(Menu):
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_CHANNELS'
|
||||
|
||||
layout.column()
|
||||
layout.operator("anim.channels_delete")
|
||||
|
||||
layout.separator()
|
||||
@ -202,7 +195,6 @@ class GRAPH_MT_key(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.menu("GRAPH_MT_key_transform", text="Transform")
|
||||
|
||||
layout.operator_menu_enum("graph.snap", "type", text="Snap")
|
||||
@ -241,7 +233,6 @@ class GRAPH_MT_key_transform(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.operator("transform.translate", text="Grab/Move")
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.rotate", text="Rotate")
|
||||
|
@ -387,7 +387,7 @@ class IMAGE_HT_header(Header):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(toolsettings, "use_snap", text="")
|
||||
row.prop(toolsettings, "snap_element", text="", icon_only=True)
|
||||
row.prop(toolsettings, "snap_target", text="")
|
||||
|
||||
mesh = context.edit_object.data
|
||||
layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="")
|
||||
@ -452,15 +452,13 @@ class IMAGE_PT_game_properties(Panel):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
|
||||
|
||||
col.prop(ima, "use_animation")
|
||||
sub = col.column(align=True)
|
||||
sub.prop(ima, "use_animation")
|
||||
|
||||
subsub = sub.column()
|
||||
subsub.active = ima.use_animation
|
||||
subsub.prop(ima, "frame_start", text="Start")
|
||||
subsub.prop(ima, "frame_end", text="End")
|
||||
subsub.prop(ima, "fps", text="Speed")
|
||||
sub.active = ima.use_animation
|
||||
sub.prop(ima, "frame_start", text="Start")
|
||||
sub.prop(ima, "frame_end", text="End")
|
||||
sub.prop(ima, "fps", text="Speed")
|
||||
|
||||
col.prop(ima, "use_tiles")
|
||||
sub = col.column(align=True)
|
||||
@ -509,10 +507,11 @@ class IMAGE_PT_view_waveform(Panel):
|
||||
layout = self.layout
|
||||
|
||||
sima = context.space_data
|
||||
|
||||
layout.template_waveform(sima, "scopes")
|
||||
sub = layout.row().split(percentage=0.75)
|
||||
sub.prop(sima.scopes, "waveform_alpha")
|
||||
sub.prop(sima.scopes, "waveform_mode", text="", icon_only=True)
|
||||
row = layout.split(percentage=0.75)
|
||||
row.prop(sima.scopes, "waveform_alpha")
|
||||
row.prop(sima.scopes, "waveform_mode", text="", icon_only=True)
|
||||
|
||||
|
||||
class IMAGE_PT_view_vectorscope(Panel):
|
||||
@ -545,8 +544,10 @@ class IMAGE_PT_sample_line(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator("image.sample_line")
|
||||
|
||||
sima = context.space_data
|
||||
|
||||
layout.operator("image.sample_line")
|
||||
layout.template_histogram(sima, "sample_histogram")
|
||||
layout.prop(sima.sample_histogram, "mode")
|
||||
|
||||
@ -563,13 +564,14 @@ class IMAGE_PT_scope_sample(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
sima = context.space_data
|
||||
split = layout.split()
|
||||
row = split.row()
|
||||
|
||||
row = layout.row()
|
||||
row.prop(sima.scopes, "use_full_resolution")
|
||||
row = split.row()
|
||||
row.active = not sima.scopes.use_full_resolution
|
||||
row.prop(sima.scopes, "accuracy")
|
||||
sub = row.row()
|
||||
sub.active = not sima.scopes.use_full_resolution
|
||||
sub.prop(sima.scopes, "accuracy")
|
||||
|
||||
|
||||
class IMAGE_PT_view_properties(Panel):
|
||||
@ -609,16 +611,16 @@ class IMAGE_PT_view_properties(Panel):
|
||||
if show_uvedit:
|
||||
|
||||
col = layout.column()
|
||||
col.label("Cursor Location")
|
||||
row = col.row()
|
||||
row.prop(uvedit, "cursor_location", text="")
|
||||
|
||||
col = layout.column()
|
||||
col.label("Cursor Location:")
|
||||
col.row().prop(uvedit, "cursor_location", text="")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.label(text="UVs:")
|
||||
row = col.row()
|
||||
row.prop(uvedit, "edge_draw_type", expand=True)
|
||||
col.row().prop(uvedit, "edge_draw_type", expand=True)
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.prop(uvedit, "show_faces")
|
||||
col.prop(uvedit, "show_smooth_edges", text="Smooth")
|
||||
@ -647,9 +649,8 @@ class IMAGE_PT_paint(Panel):
|
||||
toolsettings = context.tool_settings.image_paint
|
||||
brush = toolsettings.brush
|
||||
|
||||
col = layout.split().column()
|
||||
row = col.row()
|
||||
col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=3, cols=8)
|
||||
col = layout.column()
|
||||
col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=2, cols=6)
|
||||
|
||||
if brush:
|
||||
col = layout.column()
|
||||
@ -700,9 +701,7 @@ class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel):
|
||||
settings = context.tool_settings.image_paint
|
||||
brush = settings.brush
|
||||
|
||||
col = layout.column(align=True)
|
||||
|
||||
col.prop(brush, "image_tool", expand=False, text="")
|
||||
layout.prop(brush, "image_tool", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
|
||||
@ -722,9 +721,9 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
|
||||
brush = toolsettings.brush
|
||||
|
||||
layout.prop(brush, "use_airbrush")
|
||||
col = layout.column()
|
||||
col.active = brush.use_airbrush
|
||||
col.prop(brush, "rate", slider=True)
|
||||
row = layout.row()
|
||||
row.active = brush.use_airbrush
|
||||
row.prop(brush, "rate", slider=True)
|
||||
|
||||
layout.prop(brush, "use_space")
|
||||
row = layout.row(align=True)
|
||||
|
@ -92,7 +92,7 @@ class INFO_MT_report(Menu):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.column()
|
||||
|
||||
layout.operator("console.select_all_toggle")
|
||||
layout.operator("console.select_border")
|
||||
layout.operator("console.report_delete")
|
||||
@ -194,6 +194,7 @@ class INFO_MT_mesh_add(Menu):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
|
||||
layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
|
||||
@ -214,6 +215,7 @@ class INFO_MT_curve_add(Menu):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
|
||||
layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
|
||||
@ -244,6 +246,7 @@ class INFO_MT_surface_add(Menu):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
|
||||
layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
|
||||
@ -259,6 +262,7 @@ class INFO_MT_armature_add(Menu):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
|
||||
|
||||
|
@ -65,16 +65,12 @@ class LOGIC_HT_header(Header):
|
||||
bl_space_type = 'LOGIC_EDITOR'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout = self.layout.row(align=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.template_header()
|
||||
layout.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
sub.menu("LOGIC_MT_view")
|
||||
#sub.menu("LOGIC_MT_select")
|
||||
#sub.menu("LOGIC_MT_add")
|
||||
layout.menu("LOGIC_MT_view")
|
||||
|
||||
|
||||
class LOGIC_MT_view(Menu):
|
||||
@ -83,8 +79,6 @@ class LOGIC_MT_view(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
|
||||
layout.operator("logic.properties", icon='MENU_PANEL')
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
@ -36,13 +36,11 @@ class NLA_HT_header(Header):
|
||||
row.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
|
||||
sub.menu("NLA_MT_view")
|
||||
sub.menu("NLA_MT_select")
|
||||
sub.menu("NLA_MT_marker")
|
||||
sub.menu("NLA_MT_edit")
|
||||
sub.menu("NLA_MT_add")
|
||||
row.menu("NLA_MT_view")
|
||||
row.menu("NLA_MT_select")
|
||||
row.menu("NLA_MT_marker")
|
||||
row.menu("NLA_MT_edit")
|
||||
row.menu("NLA_MT_add")
|
||||
|
||||
dopesheet_filter(layout, context)
|
||||
|
||||
@ -57,8 +55,6 @@ class NLA_MT_view(Menu):
|
||||
|
||||
st = context.space_data
|
||||
|
||||
layout.column()
|
||||
|
||||
layout.operator("nla.properties", icon='MENU_PANEL')
|
||||
|
||||
layout.separator()
|
||||
@ -85,7 +81,6 @@ class NLA_MT_select(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
# This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
|
||||
layout.operator("nla.select_all_toggle")
|
||||
layout.operator("nla.select_all_toggle", text="Invert Selection").invert = True
|
||||
@ -107,7 +102,6 @@ class NLA_MT_marker(Menu):
|
||||
|
||||
#layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
layout.column()
|
||||
layout.operator("marker.add", "Add Marker")
|
||||
layout.operator("marker.duplicate", text="Duplicate Marker")
|
||||
layout.operator("marker.delete", text="Delete Marker")
|
||||
@ -126,7 +120,6 @@ class NLA_MT_edit(Menu):
|
||||
|
||||
scene = context.scene
|
||||
|
||||
layout.column()
|
||||
layout.menu("NLA_MT_edit_transform", text="Transform")
|
||||
|
||||
layout.operator_menu_enum("nla.snap", "type", text="Snap")
|
||||
@ -167,7 +160,6 @@ class NLA_MT_add(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.operator("nla.actionclip_add")
|
||||
layout.operator("nla.transition_add")
|
||||
|
||||
@ -186,7 +178,6 @@ class NLA_MT_edit_transform(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.operator("transform.translate", text="Grab/Move")
|
||||
layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
|
||||
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
|
||||
|
@ -28,33 +28,29 @@ class NODE_HT_header(Header):
|
||||
layout = self.layout
|
||||
|
||||
snode = context.space_data
|
||||
snode_id = snode.id
|
||||
id_from = snode.id_from
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
sub.menu("NODE_MT_view")
|
||||
sub.menu("NODE_MT_select")
|
||||
sub.menu("NODE_MT_add")
|
||||
sub.menu("NODE_MT_node")
|
||||
row.menu("NODE_MT_view")
|
||||
row.menu("NODE_MT_select")
|
||||
row.menu("NODE_MT_add")
|
||||
row.menu("NODE_MT_node")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(snode, "tree_type", text="", expand=True)
|
||||
layout.prop(snode, "tree_type", text="", expand=True)
|
||||
|
||||
if snode.tree_type == 'MATERIAL':
|
||||
ob = snode.id_from
|
||||
snode_id = snode.id
|
||||
if ob:
|
||||
layout.template_ID(ob, "active_material", new="material.new")
|
||||
if id_from:
|
||||
layout.template_ID(id_from, "active_material", new="material.new")
|
||||
if snode_id:
|
||||
layout.prop(snode_id, "use_nodes")
|
||||
|
||||
elif snode.tree_type == 'TEXTURE':
|
||||
row.prop(snode, "texture_type", text="", expand=True)
|
||||
layout.prop(snode, "texture_type", text="", expand=True)
|
||||
|
||||
snode_id = snode.id
|
||||
id_from = snode.id_from
|
||||
if id_from:
|
||||
if snode.texture_type == 'BRUSH':
|
||||
layout.template_ID(id_from, "texture", new="texture.new")
|
||||
@ -64,10 +60,8 @@ class NODE_HT_header(Header):
|
||||
layout.prop(snode_id, "use_nodes")
|
||||
|
||||
elif snode.tree_type == 'COMPOSITING':
|
||||
scene = snode.id
|
||||
|
||||
layout.prop(scene, "use_nodes")
|
||||
layout.prop(scene.render, "use_free_unused_nodes", text="Free Unused")
|
||||
layout.prop(snode_id, "use_nodes")
|
||||
layout.prop(snode_id.render, "use_free_unused_nodes", text="Free Unused")
|
||||
layout.prop(snode, "show_backdrop")
|
||||
if snode.show_backdrop:
|
||||
row = layout.row(align=True)
|
||||
|
@ -72,14 +72,13 @@ class OUTLINER_MT_view(Menu):
|
||||
|
||||
space = context.space_data
|
||||
|
||||
col = layout.column()
|
||||
if space.display_mode not in {'DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'}:
|
||||
col.prop(space, "show_restrict_columns")
|
||||
col.separator()
|
||||
col.operator("outliner.show_active")
|
||||
layout.prop(space, "show_restrict_columns")
|
||||
layout.separator()
|
||||
layout.operator("outliner.show_active")
|
||||
|
||||
col.operator("outliner.show_one_level")
|
||||
col.operator("outliner.show_hierarchy")
|
||||
layout.operator("outliner.show_one_level")
|
||||
layout.operator("outliner.show_hierarchy")
|
||||
|
||||
layout.separator()
|
||||
|
||||
@ -95,10 +94,8 @@ class OUTLINER_MT_search(Menu):
|
||||
|
||||
space = context.space_data
|
||||
|
||||
col = layout.column()
|
||||
|
||||
col.prop(space, "use_filter_case_sensitive")
|
||||
col.prop(space, "use_filter_complete")
|
||||
layout.prop(space, "use_filter_case_sensitive")
|
||||
layout.prop(space, "use_filter_complete")
|
||||
|
||||
|
||||
class OUTLINER_MT_edit_datablocks(Menu):
|
||||
@ -107,15 +104,13 @@ class OUTLINER_MT_edit_datablocks(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
col = layout.column()
|
||||
layout.operator("outliner.keyingset_add_selected")
|
||||
layout.operator("outliner.keyingset_remove_selected")
|
||||
|
||||
col.operator("outliner.keyingset_add_selected")
|
||||
col.operator("outliner.keyingset_remove_selected")
|
||||
layout.separator()
|
||||
|
||||
col.separator()
|
||||
|
||||
col.operator("outliner.drivers_add_selected")
|
||||
col.operator("outliner.drivers_delete_selected")
|
||||
layout.operator("outliner.drivers_add_selected")
|
||||
layout.operator("outliner.drivers_delete_selected")
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
bpy.utils.register_module(__name__)
|
||||
|
@ -40,14 +40,13 @@ class SEQUENCER_HT_header(Header):
|
||||
row.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
sub.menu("SEQUENCER_MT_view")
|
||||
row.menu("SEQUENCER_MT_view")
|
||||
|
||||
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
|
||||
sub.menu("SEQUENCER_MT_select")
|
||||
sub.menu("SEQUENCER_MT_marker")
|
||||
sub.menu("SEQUENCER_MT_add")
|
||||
sub.menu("SEQUENCER_MT_strip")
|
||||
row.menu("SEQUENCER_MT_select")
|
||||
row.menu("SEQUENCER_MT_marker")
|
||||
row.menu("SEQUENCER_MT_add")
|
||||
row.menu("SEQUENCER_MT_strip")
|
||||
|
||||
layout.prop(st, "view_type", expand=True, text="")
|
||||
|
||||
@ -96,8 +95,6 @@ class SEQUENCER_MT_view(Menu):
|
||||
|
||||
st = context.space_data
|
||||
|
||||
layout.column()
|
||||
|
||||
layout.operator("sequencer.properties", icon='MENU_PANEL')
|
||||
|
||||
layout.separator()
|
||||
@ -136,7 +133,6 @@ class SEQUENCER_MT_select(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.column()
|
||||
layout.operator("sequencer.select_active_side", text="Strips to the Left").side = 'LEFT'
|
||||
layout.operator("sequencer.select_active_side", text="Strips to the Right").side = 'RIGHT'
|
||||
layout.separator()
|
||||
@ -157,7 +153,6 @@ class SEQUENCER_MT_marker(Menu):
|
||||
|
||||
#layout.operator_context = 'EXEC_REGION_WIN'
|
||||
|
||||
layout.column()
|
||||
layout.operator("marker.add", "Add Marker")
|
||||
layout.operator("marker.duplicate", text="Duplicate Marker")
|
||||
layout.operator("marker.delete", text="Delete Marker")
|
||||
@ -190,7 +185,6 @@ class SEQUENCER_MT_add(Menu):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.column()
|
||||
if len(bpy.data.scenes) > 10:
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
layout.operator("sequencer.scene_strip_add", text="Scene...")
|
||||
@ -211,7 +205,6 @@ class SEQUENCER_MT_add_effect(Menu):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.column()
|
||||
layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
|
||||
layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
|
||||
layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
|
||||
@ -238,7 +231,6 @@ class SEQUENCER_MT_strip(Menu):
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.column()
|
||||
layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
|
||||
layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
|
||||
# uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
|
||||
@ -247,6 +239,7 @@ class SEQUENCER_MT_strip(Menu):
|
||||
layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
|
||||
layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
|
||||
layout.operator("sequencer.images_separate")
|
||||
layout.operator("sequencer.offset_clear")
|
||||
layout.operator("sequencer.deinterlace_selected_movies")
|
||||
layout.separator()
|
||||
|
||||
@ -389,6 +382,8 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
|
||||
|
||||
if elem and elem.orig_width > 0 and elem.orig_height > 0:
|
||||
col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height))
|
||||
else:
|
||||
col.label(text="Orig Dim: None")
|
||||
|
||||
|
||||
class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
|
||||
@ -573,6 +568,9 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
|
||||
col = split.column()
|
||||
col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
|
||||
|
||||
# also accessible from the menu
|
||||
layout.operator("sequencer.change_path")
|
||||
|
||||
elif seq_type == 'MOVIE':
|
||||
split = layout.split(percentage=0.2)
|
||||
col = split.column()
|
||||
|
@ -172,7 +172,6 @@ class TEXT_MT_text(Menu):
|
||||
st = context.space_data
|
||||
text = st.text
|
||||
|
||||
layout.column()
|
||||
layout.operator("text.new")
|
||||
layout.operator("text.open")
|
||||
|
||||
@ -189,11 +188,6 @@ class TEXT_MT_text(Menu):
|
||||
layout.column()
|
||||
layout.operator("text.run_script")
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
# XXX if(BPY_is_pyconstraint(text))
|
||||
# XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints");
|
||||
#endif
|
||||
|
||||
|
||||
class TEXT_MT_templates(Menu):
|
||||
bl_label = "Templates"
|
||||
|
@ -35,10 +35,9 @@ class TIME_HT_header(Header):
|
||||
row.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
sub = row.row(align=True)
|
||||
sub.menu("TIME_MT_view")
|
||||
sub.menu("TIME_MT_frame")
|
||||
sub.menu("TIME_MT_playback")
|
||||
row.menu("TIME_MT_view")
|
||||
row.menu("TIME_MT_frame")
|
||||
row.menu("TIME_MT_playback")
|
||||
|
||||
layout.prop(scene, "use_preview_range", text="", toggle=True)
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
# <pep8 compliant>
|
||||
import bpy
|
||||
from bpy.types import Menu, Operator
|
||||
from bpy.types import Menu, Operator, OperatorProperties
|
||||
import os
|
||||
|
||||
|
||||
|
@ -529,7 +529,7 @@ void weight_to_rgb(float input, float *fr, float *fg, float *fb);
|
||||
typedef struct DMVertexAttribs {
|
||||
struct {
|
||||
struct MTFace *array;
|
||||
int emOffset, glIndex;
|
||||
int emOffset, glIndex, glTexco;
|
||||
} tface[MAX_MTFACE];
|
||||
|
||||
struct {
|
||||
@ -544,7 +544,7 @@ typedef struct DMVertexAttribs {
|
||||
|
||||
struct {
|
||||
float (*array)[3];
|
||||
int emOffset, glIndex;
|
||||
int emOffset, glIndex, glTexco;
|
||||
} orco;
|
||||
|
||||
int tottface, totmcol, tottang, totorco;
|
||||
|
@ -53,7 +53,7 @@ extern "C" {
|
||||
/* can be left blank, otherwise a,b,c... etc with no quotes */
|
||||
#define BLENDER_VERSION_CHAR
|
||||
/* alpha/beta/rc/release, docs use this */
|
||||
#define BLENDER_VERSION_CYCLE release
|
||||
#define BLENDER_VERSION_CYCLE alpha
|
||||
|
||||
struct ListBase;
|
||||
struct MemFile;
|
||||
|
@ -101,6 +101,7 @@ typedef enum {
|
||||
|
||||
typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin);
|
||||
typedef void (*IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin);
|
||||
typedef void (*TexWalkFunc)(void *userData, struct Object *ob, struct ModifierData *md, const char *propname);
|
||||
|
||||
typedef struct ModifierTypeInfo {
|
||||
/* The user visible name for this modifier */
|
||||
@ -284,6 +285,16 @@ typedef struct ModifierTypeInfo {
|
||||
*/
|
||||
void (*foreachIDLink)(struct ModifierData *md, struct Object *ob,
|
||||
IDWalkFunc walk, void *userData);
|
||||
|
||||
/* Should call the given walk function for each texture that the
|
||||
* modifier data stores. This is used for finding all textures in
|
||||
* the context for the UI.
|
||||
*
|
||||
* This function is optional. If it is not present, it will be
|
||||
* assumed the modifier has no textures.
|
||||
*/
|
||||
void (*foreachTexLink)(struct ModifierData *md, struct Object *ob,
|
||||
TexWalkFunc walk, void *userData);
|
||||
} ModifierTypeInfo;
|
||||
|
||||
ModifierTypeInfo *modifierType_getInfo (ModifierType type);
|
||||
@ -315,6 +326,10 @@ void modifiers_foreachObjectLink(struct Object *ob,
|
||||
void modifiers_foreachIDLink(struct Object *ob,
|
||||
IDWalkFunc walk,
|
||||
void *userData);
|
||||
void modifiers_foreachTexLink(struct Object *ob,
|
||||
TexWalkFunc walk,
|
||||
void *userData);
|
||||
|
||||
struct ModifierData *modifiers_findByType(struct Object *ob, ModifierType type);
|
||||
struct ModifierData *modifiers_findByName(struct Object *ob, const char *name);
|
||||
void modifiers_clearErrors(struct Object *ob);
|
||||
|
@ -1055,6 +1055,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
#undef PASSATTRIB
|
||||
}
|
||||
|
||||
static void emDM_drawFacesGLSL(DerivedMesh *dm,
|
||||
@ -2846,6 +2847,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
|
||||
attribs->tface[a].array = tfdata->layers[layer].data;
|
||||
attribs->tface[a].emOffset = tfdata->layers[layer].offset;
|
||||
attribs->tface[a].glIndex = gattribs->layer[b].glindex;
|
||||
attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
|
||||
}
|
||||
}
|
||||
else if(gattribs->layer[b].type == CD_MCOL) {
|
||||
@ -2886,6 +2888,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
|
||||
attribs->orco.array = vdata->layers[layer].data;
|
||||
attribs->orco.emOffset = vdata->layers[layer].offset;
|
||||
attribs->orco.glIndex = gattribs->layer[b].glindex;
|
||||
attribs->orco.glTexco = gattribs->layer[b].gltexco;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1245,6 +1245,8 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
|
||||
sim.ob= par;
|
||||
sim.psys= psys;
|
||||
sim.psmd= psys_get_modifier(par, psys);
|
||||
/* make sure emitter imat is in global coordinates instead of render view coordinates */
|
||||
invert_m4_m4(par->imat, par->obmat);
|
||||
|
||||
/* first check for loops (particle system object used as dupli object) */
|
||||
if(part->ren_as == PART_DRAW_OB) {
|
||||
|
@ -1031,6 +1031,50 @@ static void cdDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void
|
||||
cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, userData);
|
||||
}
|
||||
|
||||
static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int a, int index, int vert, int smoothnormal)
|
||||
{
|
||||
int b;
|
||||
|
||||
/* orco texture coordinates */
|
||||
if(attribs->totorco) {
|
||||
if(attribs->orco.glTexco)
|
||||
glTexCoord3fv(attribs->orco.array[index]);
|
||||
else
|
||||
glVertexAttrib3fvARB(attribs->orco.glIndex, attribs->orco.array[index]);
|
||||
}
|
||||
|
||||
/* uv texture coordinates */
|
||||
for(b = 0; b < attribs->tottface; b++) {
|
||||
MTFace *tf = &attribs->tface[b].array[a];
|
||||
|
||||
if(attribs->tface[b].glTexco)
|
||||
glTexCoord2fv(tf->uv[vert]);
|
||||
else
|
||||
glVertexAttrib2fvARB(attribs->tface[b].glIndex, tf->uv[vert]);
|
||||
}
|
||||
|
||||
/* vertex colors */
|
||||
for(b = 0; b < attribs->totmcol; b++) {
|
||||
MCol *cp = &attribs->mcol[b].array[a*4 + vert];
|
||||
GLubyte col[4];
|
||||
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
|
||||
glVertexAttrib4ubvARB(attribs->mcol[b].glIndex, col);
|
||||
}
|
||||
|
||||
/* tangent for normal mapping */
|
||||
if(attribs->tottang) {
|
||||
float *tang = attribs->tang.array[a*4 + vert];
|
||||
glVertexAttrib4fvARB(attribs->tang.glIndex, tang);
|
||||
}
|
||||
|
||||
/* vertex normal */
|
||||
if(smoothnormal)
|
||||
glNormal3sv(mvert[index].no);
|
||||
|
||||
/* vertex coordinate */
|
||||
glVertex3fv(mvert[index].co);
|
||||
}
|
||||
|
||||
static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData)
|
||||
{
|
||||
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
|
||||
@ -1121,37 +1165,14 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
|
||||
}
|
||||
}
|
||||
|
||||
#define PASSVERT(index, vert) { \
|
||||
if(attribs.totorco) \
|
||||
glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \
|
||||
for(b = 0; b < attribs.tottface; b++) { \
|
||||
MTFace *tf = &attribs.tface[b].array[a]; \
|
||||
glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
|
||||
} \
|
||||
for(b = 0; b < attribs.totmcol; b++) { \
|
||||
MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \
|
||||
GLubyte col[4]; \
|
||||
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
|
||||
glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
|
||||
} \
|
||||
if(attribs.tottang) { \
|
||||
float *tang = attribs.tang.array[a*4 + vert]; \
|
||||
glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \
|
||||
} \
|
||||
if(smoothnormal) \
|
||||
glNormal3sv(mvert[index].no); \
|
||||
glVertex3fv(mvert[index].co); \
|
||||
}
|
||||
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v1, 0, smoothnormal);
|
||||
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v2, 1, smoothnormal);
|
||||
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal);
|
||||
|
||||
PASSVERT(mface->v1, 0);
|
||||
PASSVERT(mface->v2, 1);
|
||||
PASSVERT(mface->v3, 2);
|
||||
if(mface->v4)
|
||||
PASSVERT(mface->v4, 3)
|
||||
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v4, 3, smoothnormal);
|
||||
else
|
||||
PASSVERT(mface->v3, 2)
|
||||
|
||||
#undef PASSVERT
|
||||
cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
|
||||
|
||||
for(i = 0; i < dm->getNumVerts(dm); i++)
|
||||
{
|
||||
maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0));
|
||||
maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f));
|
||||
}
|
||||
|
||||
clmd->clothObject->bvhselftree = bvhselftree_build_from_cloth ( clmd, maxdist );
|
||||
|
@ -301,6 +301,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
|
||||
for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
|
||||
ChannelDriver *driver= fcu->driver;
|
||||
DriverVar *dvar;
|
||||
int isdata_fcu = isdata || (fcu->rna_path && strstr(fcu->rna_path, "modifiers["));
|
||||
|
||||
/* loop over variables to get the target relationships */
|
||||
for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
|
||||
@ -320,14 +321,14 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
|
||||
( ((dtar->rna_path) && strstr(dtar->rna_path, "pose.bones[")) ||
|
||||
((dtar->flag & DTAR_FLAG_STRUCT_REF) && (dtar->pchan_name[0])) ))
|
||||
{
|
||||
dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
|
||||
dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
|
||||
}
|
||||
/* check if ob data */
|
||||
else if (dtar->rna_path && strstr(dtar->rna_path, "data."))
|
||||
dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
|
||||
dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
|
||||
/* normal */
|
||||
else
|
||||
dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver");
|
||||
dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1369,6 +1369,11 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco)
|
||||
Curve *cu= ob->data;
|
||||
ListBase *dispbase;
|
||||
|
||||
/* The same check for duplis as in do_makeDispListCurveTypes.
|
||||
Happens when curve used for constraint/bevel was converted to mesh.
|
||||
check there is still needed for render displist and orco displists. */
|
||||
if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
|
||||
|
||||
freedisplist(&(ob->disp));
|
||||
dispbase= &(ob->disp);
|
||||
freedisplist(dispbase);
|
||||
|
@ -1002,7 +1002,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
|
||||
|
||||
/* get property to read from, and get value as appropriate */
|
||||
if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
|
||||
if(RNA_property_array_check(&ptr, prop)) {
|
||||
if(RNA_property_array_check(prop)) {
|
||||
/* array */
|
||||
if (index < RNA_property_array_length(&ptr, prop)) {
|
||||
switch (RNA_property_type(prop)) {
|
||||
|
@ -195,6 +195,18 @@ void modifiers_foreachIDLink(Object *ob, IDWalkFunc walk, void *userData)
|
||||
}
|
||||
}
|
||||
|
||||
void modifiers_foreachTexLink(Object *ob, TexWalkFunc walk, void *userData)
|
||||
{
|
||||
ModifierData *md = ob->modifiers.first;
|
||||
|
||||
for (; md; md=md->next) {
|
||||
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if(mti->foreachTexLink)
|
||||
mti->foreachTexLink(md, ob, walk, userData);
|
||||
}
|
||||
}
|
||||
|
||||
void modifier_copyData(ModifierData *md, ModifierData *target)
|
||||
{
|
||||
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
@ -1582,7 +1582,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt)
|
||||
|
||||
/* Baking Tools ------------------------------------------- */
|
||||
|
||||
static void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
|
||||
static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
|
||||
{
|
||||
|
||||
/* verify that data is valid
|
||||
|
@ -3243,7 +3243,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
|
||||
int driven, len=1, index;
|
||||
prop = (PropertyRNA *)link;
|
||||
|
||||
if (RNA_property_array_check(&ptr, prop))
|
||||
if (RNA_property_array_check(prop))
|
||||
len = RNA_property_array_length(&ptr, prop);
|
||||
|
||||
for (index=0; index<len; index++) {
|
||||
@ -3261,7 +3261,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
|
||||
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
|
||||
prop = RNA_struct_find_property(&ptr, "default_value");
|
||||
|
||||
if (RNA_property_array_check(&ptr, prop))
|
||||
if (RNA_property_array_check(prop))
|
||||
len = RNA_property_array_length(&ptr, prop);
|
||||
|
||||
for (index=0; index<len; index++) {
|
||||
|
@ -699,6 +699,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
|
||||
seq->len = 0;
|
||||
}
|
||||
seq->strip->len = seq->len;
|
||||
break;
|
||||
case SEQ_SOUND:
|
||||
#ifdef WITH_AUDASPACE
|
||||
if(!seq->sound)
|
||||
|
@ -1005,7 +1005,7 @@ void autotexname(Tex *tex)
|
||||
|
||||
Tex *give_current_object_texture(Object *ob)
|
||||
{
|
||||
Material *ma;
|
||||
Material *ma, *node_ma;
|
||||
Tex *tex= NULL;
|
||||
|
||||
if(ob==NULL) return NULL;
|
||||
@ -1015,6 +1015,10 @@ Tex *give_current_object_texture(Object *ob)
|
||||
tex= give_current_lamp_texture(ob->data);
|
||||
} else {
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
|
||||
if((node_ma=give_node_material(ma)))
|
||||
ma= node_ma;
|
||||
|
||||
tex= give_current_material_texture(ma);
|
||||
}
|
||||
|
||||
@ -1080,17 +1084,6 @@ Tex *give_current_material_texture(Material *ma)
|
||||
tex= (Tex *)node->id;
|
||||
ma= NULL;
|
||||
}
|
||||
else {
|
||||
node= nodeGetActiveID(ma->nodetree, ID_MA);
|
||||
if(node) {
|
||||
ma= (Material*)node->id;
|
||||
if(ma) {
|
||||
mtex= ma->mtex[(int)(ma->texact)];
|
||||
if(mtex) tex= mtex->tex;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
||||
if(ma) {
|
||||
@ -1165,11 +1158,6 @@ void set_current_material_texture(Material *ma, Tex *newtex)
|
||||
id_us_plus(&newtex->id);
|
||||
ma= NULL;
|
||||
}
|
||||
else {
|
||||
node= nodeGetActiveID(ma->nodetree, ID_MA);
|
||||
if(node)
|
||||
ma= (Material*)node->id;
|
||||
}
|
||||
}
|
||||
if(ma) {
|
||||
int act= (int)ma->texact;
|
||||
@ -1198,16 +1186,8 @@ int has_current_material_texture(Material *ma)
|
||||
if(ma && ma->use_nodes && ma->nodetree) {
|
||||
node= nodeGetActiveID(ma->nodetree, ID_TE);
|
||||
|
||||
if(node) {
|
||||
if(node)
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
node= nodeGetActiveID(ma->nodetree, ID_MA);
|
||||
if(node)
|
||||
ma= (Material*)node->id;
|
||||
else
|
||||
ma= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return (ma != NULL);
|
||||
|
@ -183,6 +183,12 @@
|
||||
# define UNUSED(x) UNUSED_ ## x
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x
|
||||
#else
|
||||
# define UNUSED_FUNCTION(x) UNUSED_ ## x
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define WARN_UNUSED __attribute__((warn_unused_result))
|
||||
#else
|
||||
|
@ -128,8 +128,8 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
|
||||
if (valfreefp) valfreefp(e->val);
|
||||
BLI_mempool_free(gh->entrypool, e);
|
||||
|
||||
|
||||
e= n;
|
||||
/* correct but 'e' isnt used before return */
|
||||
/* e= n; */ /*UNUSED*/
|
||||
if (p)
|
||||
p->next = n;
|
||||
else
|
||||
|
@ -53,10 +53,10 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
|
||||
y = jit1[i+1];
|
||||
for (j = 2*num-2; j>=0 ; j-=2) {
|
||||
if (i != j){
|
||||
vecx = jit1[j] - x - 1.0;
|
||||
vecy = jit1[j+1] - y - 1.0;
|
||||
vecx = jit1[j] - x - 1.0f;
|
||||
vecy = jit1[j+1] - y - 1.0f;
|
||||
for (k = 3; k>0 ; k--){
|
||||
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
|
||||
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
|
||||
len= sqrt(vecx*vecx + vecy*vecy);
|
||||
if(len>0 && len<rad1) {
|
||||
len= len/rad1;
|
||||
@ -64,9 +64,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
|
||||
dvecy += vecy/len;
|
||||
}
|
||||
}
|
||||
vecx += 1.0;
|
||||
vecx += 1.0f;
|
||||
|
||||
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
|
||||
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
|
||||
len= sqrt(vecx*vecx + vecy*vecy);
|
||||
if(len>0 && len<rad1) {
|
||||
len= len/rad1;
|
||||
@ -74,9 +74,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
|
||||
dvecy += vecy/len;
|
||||
}
|
||||
}
|
||||
vecx += 1.0;
|
||||
vecx += 1.0f;
|
||||
|
||||
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
|
||||
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
|
||||
len= sqrt(vecx*vecx + vecy*vecy);
|
||||
if(len>0 && len<rad1) {
|
||||
len= len/rad1;
|
||||
@ -84,16 +84,16 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
|
||||
dvecy += vecy/len;
|
||||
}
|
||||
}
|
||||
vecx -= 2.0;
|
||||
vecy += 1.0;
|
||||
vecx -= 2.0f;
|
||||
vecy += 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x -= dvecx/18.0 ;
|
||||
y -= dvecy/18.0;
|
||||
x -= floor(x) ;
|
||||
y -= floor(y);
|
||||
x -= dvecx/18.0f;
|
||||
y -= dvecy/18.0f;
|
||||
x -= floorf(x) ;
|
||||
y -= floorf(y);
|
||||
jit2[i] = x;
|
||||
jit2[i+1] = y;
|
||||
}
|
||||
@ -111,28 +111,28 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2)
|
||||
y = jit1[i+1];
|
||||
for (j =2*num -2; j>= 0 ; j-=2){
|
||||
if (i != j){
|
||||
vecx = jit1[j] - x - 1.0;
|
||||
vecy = jit1[j+1] - y - 1.0;
|
||||
vecx = jit1[j] - x - 1.0f;
|
||||
vecy = jit1[j+1] - y - 1.0f;
|
||||
|
||||
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
vecx += 1.0;
|
||||
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
vecx += 1.0;
|
||||
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
vecx += 1.0f;
|
||||
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
vecx += 1.0f;
|
||||
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
|
||||
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
vecy += 1.0;
|
||||
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
vecy += 1.0;
|
||||
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
vecy += 1.0f;
|
||||
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
vecy += 1.0f;
|
||||
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
x -= dvecx/2 ;
|
||||
y -= dvecy/2;
|
||||
x -= floor(x) ;
|
||||
y -= floor(y);
|
||||
x -= dvecx/2.0f;
|
||||
y -= dvecy/2.0f;
|
||||
x -= floorf(x) ;
|
||||
y -= floorf(y);
|
||||
jit2[i] = x;
|
||||
jit2[i+1] = y;
|
||||
}
|
||||
@ -148,17 +148,17 @@ void BLI_initjit(float *jitarr, int num)
|
||||
if(num==0) return;
|
||||
|
||||
jit2= MEM_mallocN(12 + 2*sizeof(float)*num, "initjit");
|
||||
rad1= 1.0/sqrt((float)num);
|
||||
rad2= 1.0/((float)num);
|
||||
rad3= sqrt((float)num)/((float)num);
|
||||
rad1= 1.0f/sqrtf((float)num);
|
||||
rad2= 1.0f/((float)num);
|
||||
rad3= sqrtf((float)num)/((float)num);
|
||||
|
||||
BLI_srand(31415926 + num);
|
||||
x= 0;
|
||||
for(i=0; i<2*num; i+=2) {
|
||||
jitarr[i]= x+ rad1*(0.5-BLI_drand());
|
||||
jitarr[i+1]= ((float)i/2)/num +rad1*(0.5-BLI_drand());
|
||||
jitarr[i]= x+ rad1*(float)(0.5-BLI_drand());
|
||||
jitarr[i+1]= ((float)i/2)/num +rad1*(float)(0.5-BLI_drand());
|
||||
x+= rad3;
|
||||
x -= floor(x);
|
||||
x -= floorf(x);
|
||||
}
|
||||
|
||||
for (i=0 ; i<24 ; i++) {
|
||||
@ -171,8 +171,8 @@ void BLI_initjit(float *jitarr, int num)
|
||||
|
||||
/* finally, move jittertab to be centered around (0,0) */
|
||||
for(i=0; i<2*num; i+=2) {
|
||||
jitarr[i] -= 0.5;
|
||||
jitarr[i+1] -= 0.5;
|
||||
jitarr[i] -= 0.5f;
|
||||
jitarr[i+1] -= 0.5f;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ int isect_line_sphere_v3(const float l1[3], const float l2[3],
|
||||
madd_v3_v3v3fl(r_p1, l1, ldir, mu);
|
||||
return 1;
|
||||
}
|
||||
else if (i > 0.0) {
|
||||
else if (i > 0.0f) {
|
||||
const float i_sqrt= sqrt(i); /* avoid calc twice */
|
||||
|
||||
/* first intersection */
|
||||
@ -456,7 +456,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
|
||||
madd_v2_v2v2fl(r_p1, l1, ldir, mu);
|
||||
return 1;
|
||||
}
|
||||
else if (i > 0.0) {
|
||||
else if (i > 0.0f) {
|
||||
const float i_sqrt= sqrt(i); /* avoid calc twice */
|
||||
|
||||
/* first intersection */
|
||||
@ -2010,7 +2010,7 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f
|
||||
}
|
||||
|
||||
if(IS_ZERO(denom)==0)
|
||||
uv[1]= (float) (( (1-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom);
|
||||
uv[1]= (float) (( (1.0f-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ void quat_to_mat4(float m[][4], const float q[4])
|
||||
double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc;
|
||||
|
||||
#ifdef DEBUG
|
||||
if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0f) < (float)QUAT_EPSILON))) {
|
||||
if(!((q0=dot_qtqt(q, q))==0.0f || (fabs(q0-1.0) < QUAT_EPSILON))) {
|
||||
fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
|
||||
}
|
||||
#endif
|
||||
@ -492,8 +492,8 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
|
||||
else angle= (float)(-0.5*atan2(-fp[0], -fp[1]));
|
||||
}
|
||||
|
||||
co= (float)cos(angle);
|
||||
si= (float)(sin(angle)/len1);
|
||||
co= cosf(angle);
|
||||
si= sinf(angle)/len1;
|
||||
q2[0]= co;
|
||||
q2[1]= x2*si;
|
||||
q2[2]= y2*si;
|
||||
|
@ -233,10 +233,10 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
|
||||
|
||||
void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
|
||||
{
|
||||
tar->xmin= floor(src->xmin + 0.5);
|
||||
tar->xmax= floor((src->xmax - src->xmin) + 0.5);
|
||||
tar->ymin= floor(src->ymin + 0.5);
|
||||
tar->ymax= floor((src->ymax - src->ymin) + 0.5);
|
||||
tar->xmin= floor(src->xmin + 0.5f);
|
||||
tar->xmax= floor((src->xmax - src->xmin) + 0.5f);
|
||||
tar->ymin= floor(src->ymin + 0.5f);
|
||||
tar->ymax= floor((src->ymax - src->ymin) + 0.5f);
|
||||
}
|
||||
|
||||
void print_rctf(const char *str, rctf *rect)
|
||||
|
@ -288,7 +288,7 @@ static short testedgeside(float *v1, float *v2, float *v3)
|
||||
inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy])
|
||||
+(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
|
||||
|
||||
if(inp<0.0) return 0;
|
||||
if(inp < 0.0f) return 0;
|
||||
else if(inp==0) {
|
||||
if(v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0;
|
||||
if(v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0;
|
||||
@ -312,8 +312,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
|
||||
y= eed->v1->co[coy];
|
||||
|
||||
fac1= eed->v2->co[coy]-y;
|
||||
if(fac1==0.0) {
|
||||
fac1= 1.0e10*(eed->v2->co[cox]-x);
|
||||
if(fac1==0.0f) {
|
||||
fac1= 1.0e10f*(eed->v2->co[cox]-x);
|
||||
|
||||
}
|
||||
else fac1= (x-eed->v2->co[cox])/fac1;
|
||||
@ -324,8 +324,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
|
||||
if(ed->v2==eed->v2) return 0;
|
||||
|
||||
fac= ed->v2->co[coy]-y;
|
||||
if(fac==0.0) {
|
||||
fac= 1.0e10*(ed->v2->co[cox]-x);
|
||||
if(fac==0.0f) {
|
||||
fac= 1.0e10f*(ed->v2->co[cox]-x);
|
||||
|
||||
}
|
||||
else fac= (x-ed->v2->co[cox])/fac;
|
||||
@ -443,7 +443,7 @@ static void testvertexnearedge(void)
|
||||
vec2[1]= eed->v2->co[coy];
|
||||
if(boundinsideEV(eed,eve)) {
|
||||
dist= dist_to_line_v2(vec1,vec2,vec3);
|
||||
if(dist<COMPLIMIT) {
|
||||
if(dist<(float)COMPLIMIT) {
|
||||
/* new edge */
|
||||
ed1= BLI_addfilledge(eed->v1, eve);
|
||||
|
||||
@ -816,7 +816,7 @@ int BLI_edgefill(short mat_nr)
|
||||
if(v2) {
|
||||
if( compare_v3v3(v2, eve->co, COMPLIMIT)==0) {
|
||||
len= normal_tri_v3( norm,v1, v2, eve->co);
|
||||
if(len != 0.0) break;
|
||||
if(len != 0.0f) break;
|
||||
}
|
||||
}
|
||||
else if(compare_v3v3(v1, eve->co, COMPLIMIT)==0) {
|
||||
@ -825,7 +825,7 @@ int BLI_edgefill(short mat_nr)
|
||||
eve= eve->next;
|
||||
}
|
||||
|
||||
if(len==0.0) return 0; /* no fill possible */
|
||||
if(len==0.0f) return 0; /* no fill possible */
|
||||
|
||||
norm[0]= fabs(norm[0]);
|
||||
norm[1]= fabs(norm[1]);
|
||||
|
@ -1000,7 +1000,7 @@ static short pose_propagate_get_refVal (Object *ob, FCurve *fcu, float *value)
|
||||
|
||||
/* resolve the property... */
|
||||
if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) {
|
||||
if (RNA_property_array_check(&ptr, prop)) {
|
||||
if (RNA_property_array_check(prop)) {
|
||||
/* array */
|
||||
if (fcu->array_index < RNA_property_array_length(&ptr, prop)) {
|
||||
found= TRUE;
|
||||
|
@ -33,12 +33,14 @@
|
||||
#ifndef ED_NODE_H
|
||||
#define ED_NODE_H
|
||||
|
||||
struct ID;
|
||||
struct Main;
|
||||
struct Material;
|
||||
struct Scene;
|
||||
struct Tex;
|
||||
struct bContext;
|
||||
struct bNode;
|
||||
struct ID;
|
||||
struct bNodeTree;
|
||||
struct ScrArea;
|
||||
|
||||
/* drawnode.c */
|
||||
@ -55,6 +57,8 @@ void ED_node_texture_default(struct Tex *tex);
|
||||
void ED_node_link_intersect_test(struct ScrArea *sa, int test);
|
||||
void ED_node_link_insert(struct ScrArea *sa);
|
||||
|
||||
void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node);
|
||||
|
||||
/* node ops.c */
|
||||
void ED_operatormacros_node(void);
|
||||
|
||||
|
@ -710,6 +710,27 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* use to check if we need to disable undo, but dont make any changes
|
||||
* returns FALSE if undo needs to be disabled. */
|
||||
static int ui_but_is_rna_undo(uiBut *but)
|
||||
{
|
||||
if(but->rnapoin.id.data) {
|
||||
/* avoid undo push for buttons who's ID are screen or wm level
|
||||
* we could disable undo for buttons with no ID too but may have
|
||||
* unforseen conciquences, so best check for ID's we _know_ are not
|
||||
* handled by undo - campbell */
|
||||
ID *id= but->rnapoin.id.data;
|
||||
if(ELEM(GS(id->name), ID_SCR, ID_WM)) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* assigns automatic keybindings to menu items for fast access
|
||||
* (underline key in menu) */
|
||||
static void ui_menu_block_set_keyaccels(uiBlock *block)
|
||||
@ -1245,14 +1266,14 @@ int ui_is_but_float(uiBut *but)
|
||||
|
||||
int ui_is_but_unit(uiBut *but)
|
||||
{
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
int unit_type= uiButGetUnitType(but);
|
||||
UnitSettings *unit= but->block->unit;
|
||||
const int unit_type= uiButGetUnitType(but);
|
||||
|
||||
if(unit_type == PROP_UNIT_NONE)
|
||||
return 0;
|
||||
|
||||
#if 1 // removed so angle buttons get correct snapping
|
||||
if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
|
||||
if (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@ -1260,7 +1281,7 @@ int ui_is_but_unit(uiBut *but)
|
||||
if (unit_type == PROP_UNIT_TIME)
|
||||
return 0;
|
||||
|
||||
if (scene->unit.system == USER_UNIT_NONE) {
|
||||
if (unit->system == USER_UNIT_NONE) {
|
||||
if (unit_type != PROP_UNIT_ROTATION) {
|
||||
return 0;
|
||||
}
|
||||
@ -1293,19 +1314,19 @@ double ui_get_but_val(uiBut *but)
|
||||
|
||||
switch(RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||
if(RNA_property_array_check(prop))
|
||||
value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
|
||||
else
|
||||
value= RNA_property_boolean_get(&but->rnapoin, prop);
|
||||
break;
|
||||
case PROP_INT:
|
||||
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||
if(RNA_property_array_check(prop))
|
||||
value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
|
||||
else
|
||||
value= RNA_property_int_get(&but->rnapoin, prop);
|
||||
break;
|
||||
case PROP_FLOAT:
|
||||
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||
if(RNA_property_array_check(prop))
|
||||
value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
|
||||
else
|
||||
value= RNA_property_float_get(&but->rnapoin, prop);
|
||||
@ -1459,19 +1480,20 @@ int ui_get_but_string_max_length(uiBut *but)
|
||||
|
||||
static double ui_get_but_scale_unit(uiBut *but, double value)
|
||||
{
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
UnitSettings *unit= but->block->unit;
|
||||
int unit_type= uiButGetUnitType(but);
|
||||
|
||||
if(unit_type == PROP_UNIT_LENGTH) {
|
||||
return value * (double)scene->unit.scale_length;
|
||||
return value * (double)unit->scale_length;
|
||||
}
|
||||
else if(unit_type == PROP_UNIT_AREA) {
|
||||
return value * pow(scene->unit.scale_length, 2);
|
||||
return value * pow(unit->scale_length, 2);
|
||||
}
|
||||
else if(unit_type == PROP_UNIT_VOLUME) {
|
||||
return value * pow(scene->unit.scale_length, 3);
|
||||
return value * pow(unit->scale_length, 3);
|
||||
}
|
||||
else if(unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
|
||||
Scene *scene= CTX_data_scene(but->block->evil_C);
|
||||
return FRA2TIME(value);
|
||||
}
|
||||
else {
|
||||
@ -1483,14 +1505,14 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
|
||||
void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen)
|
||||
{
|
||||
if(ui_is_but_unit(but)) {
|
||||
UnitSettings *unit= but->block->unit;
|
||||
int unit_type= uiButGetUnitType(but);
|
||||
char *orig_str;
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
|
||||
orig_str= MEM_callocN(sizeof(char)*maxlen + 1, "textedit sub str");
|
||||
memcpy(orig_str, str, maxlen);
|
||||
|
||||
bUnit_ToUnitAltName(str, maxlen, orig_str, scene->unit.system, unit_type>>16);
|
||||
bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, unit_type>>16);
|
||||
|
||||
MEM_freeN(orig_str);
|
||||
}
|
||||
@ -1498,27 +1520,26 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen)
|
||||
|
||||
static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad)
|
||||
{
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
int do_split= scene->unit.flag & USER_UNIT_OPT_SPLIT;
|
||||
UnitSettings *unit= but->block->unit;
|
||||
int do_split= unit->flag & USER_UNIT_OPT_SPLIT;
|
||||
int unit_type= uiButGetUnitType(but);
|
||||
int precision= but->a2;
|
||||
|
||||
if(scene->unit.scale_length<0.0001f) scene->unit.scale_length= 1.0f; // XXX do_versions
|
||||
if(unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions
|
||||
|
||||
/* Sanity checks */
|
||||
if(precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX;
|
||||
else if(precision==0) precision= 2;
|
||||
|
||||
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, scene->unit.system, unit_type>>16, do_split, pad);
|
||||
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, unit->system, unit_type>>16, do_split, pad);
|
||||
}
|
||||
|
||||
static float ui_get_but_step_unit(uiBut *but, float step_default)
|
||||
{
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
int unit_type= uiButGetUnitType(but)>>16;
|
||||
float step;
|
||||
|
||||
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), scene->unit.system, unit_type);
|
||||
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type);
|
||||
|
||||
if(step > 0.0f) { /* -1 is an error value */
|
||||
return (float)((double)step/ui_get_but_scale_unit(but, 1.0))*100.0f;
|
||||
@ -1606,12 +1627,11 @@ static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char *
|
||||
{
|
||||
char str_unit_convert[256];
|
||||
const int unit_type= uiButGetUnitType(but);
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
|
||||
BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert));
|
||||
|
||||
/* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */
|
||||
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type>>16);
|
||||
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), but->block->unit->system, unit_type>>16);
|
||||
|
||||
return (BPY_button_exec(C, str_unit_convert, value, TRUE) != -1);
|
||||
}
|
||||
@ -1958,7 +1978,10 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
|
||||
block->active= 1;
|
||||
block->dt= dt;
|
||||
block->evil_C= (void*)C; // XXX
|
||||
if (scn) block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
|
||||
if (scn) {
|
||||
block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
|
||||
block->unit= &scn->unit;
|
||||
}
|
||||
BLI_strncpy(block->name, name, sizeof(block->name));
|
||||
|
||||
if(region)
|
||||
@ -2506,12 +2529,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
|
||||
|
||||
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
const PropertyType proptype= RNA_property_type(prop);
|
||||
uiBut *but;
|
||||
PropertyType proptype;
|
||||
int freestr= 0, icon= 0;
|
||||
|
||||
proptype= RNA_property_type(prop);
|
||||
|
||||
/* use rna values if parameters are not specified */
|
||||
if(!str) {
|
||||
if(type == MENU && proptype == PROP_ENUM) {
|
||||
@ -2636,9 +2657,14 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
|
||||
UI_DEF_BUT_RNA_DISABLE(but);
|
||||
}
|
||||
|
||||
if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) {
|
||||
but->flag &= ~UI_BUT_UNDO;
|
||||
}
|
||||
|
||||
/* If this button uses units, calculate the step from this */
|
||||
if(ui_is_but_unit(but))
|
||||
if((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
|
||||
but->a1= ui_get_but_step_unit(but, but->a1);
|
||||
}
|
||||
|
||||
if(freestr)
|
||||
MEM_freeN((void *)str);
|
||||
@ -2682,6 +2708,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname,
|
||||
but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
|
||||
but->optype= ot;
|
||||
but->opcontext= opcontext;
|
||||
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
|
||||
|
||||
if(!ot) {
|
||||
but->flag |= UI_BUT_DISABLED;
|
||||
@ -2711,6 +2738,7 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
|
||||
but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
|
||||
but->optype= ot;
|
||||
but->opcontext= opcontext;
|
||||
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
|
||||
|
||||
if(!ot) {
|
||||
but->flag |= UI_BUT_DISABLED;
|
||||
|
@ -2310,13 +2310,13 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
|
||||
float fac= 1.0f;
|
||||
|
||||
if(ui_is_but_unit(but)) {
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
UnitSettings *unit= but->block->unit;
|
||||
int unit_type= uiButGetUnitType(but)>>16;
|
||||
|
||||
if(bUnit_IsValid(scene->unit.system, unit_type)) {
|
||||
fac= (float)bUnit_BaseScalar(scene->unit.system, unit_type);
|
||||
if(bUnit_IsValid(unit->system, unit_type)) {
|
||||
fac= (float)bUnit_BaseScalar(unit->system, unit_type);
|
||||
if(ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
|
||||
fac /= scene->unit.scale_length;
|
||||
fac /= unit->scale_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ struct uiBut {
|
||||
|
||||
BIFIconID icon;
|
||||
char lock;
|
||||
char dt;
|
||||
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied from the block */
|
||||
char changed; /* could be made into a single flag */
|
||||
unsigned char unit_type; /* so buttons can support unit systems which are not RNA */
|
||||
short modifier_key;
|
||||
@ -306,7 +306,8 @@ struct uiBlock {
|
||||
void *drawextra_arg2;
|
||||
|
||||
int flag;
|
||||
char direction, dt;
|
||||
char direction;
|
||||
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */
|
||||
short auto_open;
|
||||
double auto_open_last;
|
||||
|
||||
@ -331,7 +332,9 @@ struct uiBlock {
|
||||
void *evil_C; // XXX hack for dynamic operator enums
|
||||
|
||||
float _hsv[3]; // XXX, only access via ui_block_hsv_get()
|
||||
char color_profile; // color profile for correcting linear colors for display
|
||||
char color_profile; // color profile for correcting linear colors for display
|
||||
struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time.
|
||||
|
||||
};
|
||||
|
||||
typedef struct uiSafetyRct {
|
||||
|
@ -367,7 +367,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
|
||||
unit= UI_UNIT_X*0.75;
|
||||
butw= unit;
|
||||
buth= unit;
|
||||
|
||||
|
||||
if(ptr->type == &RNA_Armature) {
|
||||
bArmature *arm= (bArmature *)ptr->data;
|
||||
layer_used= arm->layer_used;
|
||||
@ -379,7 +379,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
|
||||
for(a=0; a<colbuts; a++) {
|
||||
if(layer_used & (1<<(a+b*colbuts))) icon= ICON_LAYER_USED;
|
||||
else icon= ICON_BLANK1;
|
||||
|
||||
|
||||
but= uiDefAutoButR(block, ptr, prop, a+b*colbuts, "", icon, x + butw*a, y+buth, butw, buth);
|
||||
if(subtype == PROP_LAYER_MEMBER)
|
||||
uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+b*colbuts));
|
||||
@ -387,7 +387,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
|
||||
for(a=0; a<colbuts; a++) {
|
||||
if(layer_used & (1<<(a+len/2+b*colbuts))) icon= ICON_LAYER_USED;
|
||||
else icon= ICON_BLANK1;
|
||||
|
||||
|
||||
but= uiDefAutoButR(block, ptr, prop, a+len/2+b*colbuts, "", icon, x + butw*a, y, butw, buth);
|
||||
if(subtype == PROP_LAYER_MEMBER)
|
||||
uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+len/2+b*colbuts));
|
||||
@ -422,35 +422,46 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
|
||||
uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X*3, UI_UNIT_Y*3, ptr, prop, 0, 0, 0, -1, -1, NULL);
|
||||
}
|
||||
else {
|
||||
if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand)
|
||||
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y);
|
||||
/* note, this block of code is a bit arbitrary and has just been made
|
||||
* to work with common cases, but may need to be re-worked */
|
||||
|
||||
/* special case, boolean array in a menu, this could be used in a more generic way too */
|
||||
if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
|
||||
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y);
|
||||
}
|
||||
else {
|
||||
int *boolarr= NULL;
|
||||
|
||||
/* even if 'expand' is fale, expanding anyway */
|
||||
|
||||
if(!ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) || expand) {
|
||||
/* layout for known array subtypes */
|
||||
char str[3];
|
||||
char str[3]= {'\0'};
|
||||
|
||||
if(!icon_only) {
|
||||
if(type != PROP_BOOLEAN) {
|
||||
str[1]= ':';
|
||||
}
|
||||
}
|
||||
|
||||
/* show checkboxes for rna on a non-emboss block (menu for eg) */
|
||||
if(type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
|
||||
boolarr= MEM_callocN(sizeof(int)*len, "ui_item_array");
|
||||
RNA_property_boolean_get_array(ptr, prop, boolarr);
|
||||
}
|
||||
|
||||
for(a=0; a<len; a++) {
|
||||
str[0]= RNA_property_array_item_char(prop, a);
|
||||
|
||||
if(str[0]) {
|
||||
if (icon_only) {
|
||||
str[0] = '\0';
|
||||
}
|
||||
else if(type == PROP_BOOLEAN) {
|
||||
str[1]= '\0';
|
||||
}
|
||||
else {
|
||||
str[1]= ':';
|
||||
str[2]= '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if(!icon_only) str[0]= RNA_property_array_item_char(prop, a);
|
||||
if(boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
but= uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y);
|
||||
if(slider && but->type==NUM)
|
||||
but->type= NUMSLI;
|
||||
if(toggle && but->type==OPTION)
|
||||
but->type= TOG;
|
||||
}
|
||||
|
||||
if(boolarr) {
|
||||
MEM_freeN(boolarr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -951,13 +962,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
uiBut *but;
|
||||
PropertyType type;
|
||||
char namestr[UI_MAX_NAME_STR];
|
||||
int len, w, h, slider, toggle, expand, icon_only, no_bg;
|
||||
int len, is_array, w, h, slider, toggle, expand, icon_only, no_bg;
|
||||
|
||||
uiBlockSetCurLayout(block, layout);
|
||||
|
||||
/* retrieve info */
|
||||
type= RNA_property_type(prop);
|
||||
len= RNA_property_array_length(ptr, prop);
|
||||
is_array= RNA_property_array_check(prop);
|
||||
len= (is_array) ? RNA_property_array_length(ptr, prop) : 0;
|
||||
|
||||
/* set name and icon */
|
||||
if(!name)
|
||||
@ -967,14 +979,16 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
|
||||
if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
else if(type == PROP_BOOLEAN && len && index == RNA_NO_INDEX)
|
||||
else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
else if(type == PROP_ENUM && index != RNA_ENUM_VALUE)
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
|
||||
if(layout->root->type == UI_LAYOUT_MENU) {
|
||||
if(type == PROP_BOOLEAN)
|
||||
icon= (RNA_property_boolean_get(ptr, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
|
||||
if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
else icon= (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
}
|
||||
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
|
||||
int enum_value= RNA_property_enum_get(ptr, prop);
|
||||
if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
|
||||
@ -999,16 +1013,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
/* array property */
|
||||
if(index == RNA_NO_INDEX && len > 0)
|
||||
if(index == RNA_NO_INDEX && is_array)
|
||||
ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only);
|
||||
/* enum item */
|
||||
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
|
||||
const char *identifier= RNA_property_identifier(prop);
|
||||
|
||||
if(icon && name[0] && !icon_only)
|
||||
uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
|
||||
else if(icon)
|
||||
uiDefIconButR(block, ROW, 0, icon, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
|
||||
uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
|
||||
else
|
||||
uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
|
||||
}
|
||||
|
@ -424,7 +424,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
||||
|
||||
if (unit_type == PROP_UNIT_ROTATION) {
|
||||
if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex));
|
||||
float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", value);
|
||||
data->color[data->totline]= 0x888888;
|
||||
data->totline++;
|
||||
}
|
||||
@ -1188,7 +1189,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
uiBut *bt;
|
||||
uiSafetyRct *saferct;
|
||||
rctf butrct;
|
||||
float aspect;
|
||||
/*float aspect;*/ /*UNUSED*/
|
||||
int xsize, ysize, xof=0, yof=0, center;
|
||||
short dir1= 0, dir2=0;
|
||||
|
||||
@ -1223,7 +1224,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
}
|
||||
}
|
||||
|
||||
aspect= (float)(block->maxx - block->minx + 4);
|
||||
/*aspect= (float)(block->maxx - block->minx + 4);*/ /*UNUSED*/
|
||||
ui_block_to_window_fl(butregion, but->block, &block->minx, &block->miny);
|
||||
ui_block_to_window_fl(butregion, but->block, &block->maxx, &block->maxy);
|
||||
|
||||
@ -1232,7 +1233,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
|
||||
xsize= block->maxx - block->minx+4; // 4 for shadow
|
||||
ysize= block->maxy - block->miny+4;
|
||||
aspect/= (float)xsize;
|
||||
/*aspect/= (float)xsize;*/ /*UNUSED*/
|
||||
|
||||
if(but) {
|
||||
int left=0, right=0, top=0, down=0;
|
||||
|
@ -143,7 +143,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper
|
||||
|
||||
if(label_align != '\0') {
|
||||
PropertyType type = RNA_property_type(prop);
|
||||
int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(ptr, prop));
|
||||
int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
|
||||
|
||||
name= RNA_property_ui_name(prop);
|
||||
|
||||
|
@ -180,7 +180,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
color[3]*= 0.125;
|
||||
color[3] *= 0.125f;
|
||||
glColor4fv(color);
|
||||
|
||||
/* for each AA step */
|
||||
|
@ -1449,9 +1449,8 @@ static int mesh_separate_material(wmOperator *op, Main *bmain, Scene *scene, Bas
|
||||
/* select the material */
|
||||
EM_select_by_material(em, curr_mat);
|
||||
/* and now separate */
|
||||
if(0==mesh_separate_selected(op, bmain, scene, editbase)) {
|
||||
BKE_mesh_end_editmesh(me, em);
|
||||
return 0;
|
||||
if(em->totfacesel > 0) {
|
||||
mesh_separate_selected(op, bmain, scene, editbase);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1699,7 +1699,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type)
|
||||
|
||||
|
||||
/* ctrl+c in mesh editmode */
|
||||
static void mesh_copy_menu(EditMesh *em, wmOperator *op)
|
||||
static void UNUSED_FUNCTION(mesh_copy_menu)(EditMesh *em, wmOperator *op)
|
||||
{
|
||||
EditSelection *ese;
|
||||
int ret;
|
||||
|
@ -3895,7 +3895,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot)
|
||||
|
||||
/* XXX old bevel not ported yet */
|
||||
|
||||
static void bevel_menu(EditMesh *em)
|
||||
static void UNUSED_FUNCTION(bevel_menu)(EditMesh *em)
|
||||
{
|
||||
BME_Mesh *bm;
|
||||
BME_TransData_Head *td;
|
||||
|
@ -182,7 +182,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
|
||||
}
|
||||
|
||||
RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX);
|
||||
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -M_PI * 2.0f, M_PI * 2.0f);
|
||||
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f);
|
||||
|
||||
prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
|
@ -636,14 +636,14 @@ static void apply_heights_data(void *bake_data)
|
||||
if(ibuf->rect_float) {
|
||||
float *rrgbf= ibuf->rect_float + i*4;
|
||||
|
||||
if(max-min > 1e-5) height= (heights[i]-min)/(max-min);
|
||||
if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
|
||||
else height= 0;
|
||||
|
||||
rrgbf[0]=rrgbf[1]=rrgbf[2]= height;
|
||||
} else {
|
||||
char *rrgb= (char*)ibuf->rect + i*4;
|
||||
|
||||
if(max-min > 1e-5) height= (heights[i]-min)/(max-min);
|
||||
if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
|
||||
else height= 0;
|
||||
|
||||
rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height);
|
||||
|
@ -721,7 +721,7 @@ static void spot_interactive(Object *ob, int mode)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void special_editmenu(Scene *scene, View3D *v3d)
|
||||
static void UNUSED_FUNCTION(special_editmenu)(Scene *scene, View3D *v3d)
|
||||
{
|
||||
// XXX static short numcuts= 2;
|
||||
Object *ob= OBACT;
|
||||
@ -1343,7 +1343,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
|
||||
DAG_ids_flush_update(bmain, 0);
|
||||
}
|
||||
|
||||
static void copy_attr_menu(Main *bmain, Scene *scene, View3D *v3d)
|
||||
static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v3d)
|
||||
{
|
||||
Object *ob;
|
||||
short event;
|
||||
@ -1616,7 +1616,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot)
|
||||
|
||||
/* ********************** */
|
||||
|
||||
static void image_aspect(Scene *scene, View3D *v3d)
|
||||
static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
|
||||
{
|
||||
/* all selected objects with an image map: scale in image aspect */
|
||||
Base *base;
|
||||
@ -1691,7 +1691,7 @@ static int vergbaseco(const void *a1, const void *a2)
|
||||
}
|
||||
|
||||
|
||||
static void auto_timeoffs(Scene *scene, View3D *v3d)
|
||||
static void UNUSED_FUNCTION(auto_timeoffs)(Scene *scene, View3D *v3d)
|
||||
{
|
||||
Base *base, **basesort, **bs;
|
||||
float start, delta;
|
||||
@ -1732,7 +1732,7 @@ static void auto_timeoffs(Scene *scene, View3D *v3d)
|
||||
|
||||
}
|
||||
|
||||
static void ofs_timeoffs(Scene *scene, View3D *v3d)
|
||||
static void UNUSED_FUNCTION(ofs_timeoffs)(Scene *scene, View3D *v3d)
|
||||
{
|
||||
float offset=0.0f;
|
||||
|
||||
@ -1751,7 +1751,7 @@ static void ofs_timeoffs(Scene *scene, View3D *v3d)
|
||||
}
|
||||
|
||||
|
||||
static void rand_timeoffs(Scene *scene, View3D *v3d)
|
||||
static void UNUSED_FUNCTION(rand_timeoffs)(Scene *scene, View3D *v3d)
|
||||
{
|
||||
Base *base;
|
||||
float rand_ofs=0.0f;
|
||||
|
@ -246,7 +246,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
|
||||
}
|
||||
|
||||
/* tag for updates */
|
||||
ob->recalc |= OB_RECALC_OB;
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
@ -341,7 +341,8 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
negate_v3_v3(v3, v1);
|
||||
mul_m3_v3(mat, v3);
|
||||
}
|
||||
ob->recalc |= OB_RECALC_OB;
|
||||
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
@ -871,7 +872,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
||||
(ob->dup_group==ob_other->dup_group && (ob->transflag|ob_other->transflag) & OB_DUPLIGROUP) )
|
||||
) {
|
||||
ob_other->flag |= OB_DONE;
|
||||
ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA;
|
||||
DAG_id_tag_update(&ob_other->id, OB_RECALC_OB|OB_RECALC_DATA);
|
||||
|
||||
copy_v3_v3(centn, cent);
|
||||
mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */
|
||||
@ -890,11 +891,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
for (tob= bmain->object.first; tob; tob= tob->id.next) {
|
||||
if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) {
|
||||
tob->recalc= OB_RECALC_OB|OB_RECALC_DATA;
|
||||
}
|
||||
}
|
||||
for (tob= bmain->object.first; tob; tob= tob->id.next)
|
||||
if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
|
||||
DAG_id_tag_update(&tob->id, OB_RECALC_OB|OB_RECALC_DATA);
|
||||
|
||||
if (tot_change) {
|
||||
DAG_ids_flush_update(bmain, 0);
|
||||
|
@ -24,7 +24,7 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/editors/render/render_shading.c
|
||||
/** \file blender/editors/render/render_update.c
|
||||
* \ingroup edrend
|
||||
*/
|
||||
|
||||
@ -58,6 +58,7 @@
|
||||
|
||||
#include "GPU_material.h"
|
||||
|
||||
#include "ED_node.h"
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "render_intern.h" // own include
|
||||
@ -115,6 +116,8 @@ static void texture_changed(Main *bmain, Tex *tex)
|
||||
Material *ma;
|
||||
Lamp *la;
|
||||
World *wo;
|
||||
Scene *scene;
|
||||
bNode *node;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&tex->id));
|
||||
@ -146,6 +149,16 @@ static void texture_changed(Main *bmain, Tex *tex)
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&wo->id));
|
||||
}
|
||||
|
||||
/* find compositing nodes */
|
||||
for(scene=bmain->scene.first; scene; scene=scene->id.next) {
|
||||
if(scene->use_nodes && scene->nodetree) {
|
||||
for(node=scene->nodetree->nodes.first; node; node=node->next) {
|
||||
if(node->id == &tex->id)
|
||||
ED_node_changed_update(&scene->id, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void lamp_changed(Main *bmain, Lamp *la)
|
||||
|
@ -1406,6 +1406,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
|
||||
"Displays current editor type. "
|
||||
"Click for menu of available types");
|
||||
uiButSetFunc(but, spacefunc, NULL, NULL);
|
||||
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||
|
||||
return xco + UI_UNIT_X + 14;
|
||||
}
|
||||
@ -1414,6 +1415,7 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
int xco= 8;
|
||||
uiBut *but;
|
||||
|
||||
if (!sa->full)
|
||||
xco= ED_area_header_switchbutton(C, block, yco);
|
||||
@ -1421,20 +1423,22 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
if (sa->flag & HEADER_NO_PULLDOWN) {
|
||||
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
|
||||
but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
|
||||
ICON_DISCLOSURE_TRI_RIGHT,
|
||||
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
|
||||
&(sa->flag), 0, 0, 0, 0,
|
||||
"Show pulldown menus");
|
||||
}
|
||||
else {
|
||||
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
|
||||
but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
|
||||
ICON_DISCLOSURE_TRI_DOWN,
|
||||
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
|
||||
&(sa->flag), 0, 0, 0, 0,
|
||||
"Hide pulldown menus");
|
||||
}
|
||||
|
||||
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
return xco + UI_UNIT_X;
|
||||
|
@ -904,6 +904,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
|
||||
block= uiLayoutGetBlock(row);
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
|
||||
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||
uiButSetFunc(but, pin_cb, NULL, NULL);
|
||||
|
||||
for(a=0; a<path->len; a++) {
|
||||
|
@ -104,6 +104,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
|
||||
{
|
||||
SpaceButs *sbuts= CTX_wm_space_buts(C);
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
int xco, yco= 2;
|
||||
|
||||
buttons_context_compute(C, sbuts);
|
||||
@ -118,33 +119,32 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
|
||||
xco -= UI_UNIT_X;
|
||||
|
||||
// Default panels
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_RENDER))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_RENDER, 0, 0, "Render");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_SCENE))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_SCENE, 0, 0, "Scene");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_WORLD))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_WORLD, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_WORLD, 0, 0, "World");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_OBJECT))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_OBJECT, 0, 0, "Object");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_CONSTRAINT))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_CONSTRAINT, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_CONSTRAINT, 0, 0, "Object Constraints");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_MODIFIER))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MODIFIER, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_MODIFIER, 0, 0, "Modifiers");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_DATA))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, sbuts->dataicon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_DATA, 0, 0, "Object Data");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_BONE))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_BONE_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_BONE, 0, 0, "Bone");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_BONE_CONSTRAINT))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_CONSTRAINT_BONE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_BONE_CONSTRAINT, 0, 0, "Bone Constraints");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_MATERIAL))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MATERIAL, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_MATERIAL, 0, 0, "Material");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_TEXTURE))
|
||||
uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_TEXTURE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_TEXTURE, 0, 0, "Texture");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_PARTICLE))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PARTICLES, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_PARTICLE, 0, 0, "Particles");
|
||||
if(sbuts->pathflag & (1<<BCONTEXT_PHYSICS))
|
||||
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PHYSICS, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_PHYSICS, 0, 0, "Physics");
|
||||
|
||||
#define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \
|
||||
if(sbuts->pathflag & (1<<_ctx)) { \
|
||||
but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, _tip); \
|
||||
uiButClearFlag(but, UI_BUT_UNDO); \
|
||||
} \
|
||||
|
||||
|
||||
BUTTON_HEADER_CTX(BCONTEXT_RENDER, ICON_SCENE, "Render")
|
||||
BUTTON_HEADER_CTX(BCONTEXT_SCENE, ICON_SCENE_DATA, "Scene");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_WORLD, ICON_WORLD, "World");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_OBJECT, ICON_OBJECT_DATA, "Object");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_CONSTRAINT, ICON_CONSTRAINT, "Object Constraints");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_MODIFIER, ICON_MODIFIER, "Object Modifiers");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_DATA, sbuts->dataicon, "Object Data");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_BONE, ICON_BONE_DATA, "Bone");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_BONE_CONSTRAINT, ICON_CONSTRAINT_BONE, "Bone Constraints");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_MATERIAL, ICON_MATERIAL, "Material");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_TEXTURE, ICON_TEXTURE, "Textures");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_PARTICLE, ICON_PARTICLES, "Particles");
|
||||
BUTTON_HEADER_CTX(BCONTEXT_PHYSICS, ICON_PHYSICS, "Physics");
|
||||
|
||||
#undef BUTTON_HEADER_CTX
|
||||
|
||||
xco+= BUT_UNIT_X;
|
||||
|
||||
uiBlockEndAlign(block);
|
||||
|
@ -675,7 +675,12 @@ static int scrollback_append_exec(bContext *C, wmOperator *op)
|
||||
|
||||
console_scrollback_limit(sc);
|
||||
|
||||
console_textview_update_rect(sc, ar);
|
||||
/* 'ar' can be null depending on the operator that runs
|
||||
* rendering with invoke default for eg causes this */
|
||||
if(ar) {
|
||||
console_textview_update_rect(sc, ar);
|
||||
}
|
||||
|
||||
ED_area_tag_redraw(CTX_wm_area(C));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -1159,6 +1159,13 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* TODO, directory operator is non-functional while a library is loaded
|
||||
* until this is properly supported just disable it. */
|
||||
static int file_directory_poll(bContext *C)
|
||||
{
|
||||
return ED_operator_file_active(C) && filelist_lib(CTX_wm_space_file(C)->files) == NULL;
|
||||
}
|
||||
|
||||
void FILE_OT_directory(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
@ -1169,7 +1176,7 @@ void FILE_OT_directory(struct wmOperatorType *ot)
|
||||
/* api callbacks */
|
||||
ot->invoke= file_directory_invoke;
|
||||
ot->exec= file_directory_exec;
|
||||
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
|
||||
ot->poll= file_directory_poll; /* <- important, handler is on window level */
|
||||
}
|
||||
|
||||
void FILE_OT_refresh(struct wmOperatorType *ot)
|
||||
|
@ -602,28 +602,6 @@ short filelist_changed(struct FileList* filelist)
|
||||
return filelist->changed;
|
||||
}
|
||||
|
||||
static struct ImBuf * filelist_loadimage(struct FileList* filelist, int index)
|
||||
{
|
||||
ImBuf *imb = NULL;
|
||||
int fidx = 0;
|
||||
|
||||
if ( (index < 0) || (index >= filelist->numfiltered) ) {
|
||||
return NULL;
|
||||
}
|
||||
fidx = filelist->fidx[index];
|
||||
imb = filelist->filelist[fidx].image;
|
||||
if (!imb)
|
||||
{
|
||||
if ( (filelist->filelist[fidx].flags & IMAGEFILE) || (filelist->filelist[fidx].flags & MOVIEFILE) ) {
|
||||
imb = IMB_thumb_read(filelist->filelist[fidx].path, THB_NORMAL);
|
||||
}
|
||||
if (imb) {
|
||||
filelist->filelist[fidx].image = imb;
|
||||
}
|
||||
}
|
||||
return imb;
|
||||
}
|
||||
|
||||
struct ImBuf * filelist_getimage(struct FileList* filelist, int index)
|
||||
{
|
||||
ImBuf* ibuf = NULL;
|
||||
|
@ -951,7 +951,7 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void NLA_OT_bake (wmOperatorType *ot)
|
||||
void NLA_OT_bake (wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Bake Strips";
|
||||
|
@ -479,72 +479,88 @@ static void snode_tag_changed(SpaceNode *snode, bNode *node)
|
||||
NodeTagIDChanged(snode->nodetree, gnode->id);
|
||||
}
|
||||
|
||||
void node_set_active(SpaceNode *snode, bNode *node)
|
||||
static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
|
||||
{
|
||||
nodeSetActive(snode->edittree, node);
|
||||
bNode *node;
|
||||
|
||||
if(ntree == lookup)
|
||||
return 1;
|
||||
|
||||
for(node=ntree->nodes.first; node; node=node->next)
|
||||
if(node->type == NODE_GROUP && node->id)
|
||||
if(has_nodetree((bNodeTree*)node->id, lookup))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
nodeSetActive(ntree, node);
|
||||
|
||||
if(node->type!=NODE_GROUP) {
|
||||
int was_output= (node->flag & NODE_DO_OUTPUT);
|
||||
|
||||
/* tree specific activate calls */
|
||||
if(snode->treetype==NTREE_SHADER) {
|
||||
if(ntree->type==NTREE_SHADER) {
|
||||
/* when we select a material, active texture is cleared, for buttons */
|
||||
if(node->id && GS(node->id->name)==ID_MA)
|
||||
nodeClearActiveID(snode->edittree, ID_TE);
|
||||
nodeClearActiveID(ntree, ID_TE);
|
||||
|
||||
if(node->type==SH_NODE_OUTPUT) {
|
||||
bNode *tnode;
|
||||
|
||||
for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next)
|
||||
for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
|
||||
if( tnode->type==SH_NODE_OUTPUT)
|
||||
tnode->flag &= ~NODE_DO_OUTPUT;
|
||||
|
||||
node->flag |= NODE_DO_OUTPUT;
|
||||
if(was_output==0)
|
||||
ED_node_changed_update(snode->id, node);
|
||||
ED_node_generic_update(bmain, ntree, node);
|
||||
}
|
||||
|
||||
WM_main_add_notifier(NC_MATERIAL|ND_NODES, node->id);
|
||||
}
|
||||
else if(snode->treetype==NTREE_COMPOSIT) {
|
||||
Scene *scene= (Scene*)snode->id;
|
||||
|
||||
else if(ntree->type==NTREE_COMPOSIT) {
|
||||
/* make active viewer, currently only 1 supported... */
|
||||
if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
|
||||
bNode *tnode;
|
||||
|
||||
|
||||
for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next)
|
||||
for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
|
||||
if( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
|
||||
tnode->flag &= ~NODE_DO_OUTPUT;
|
||||
|
||||
node->flag |= NODE_DO_OUTPUT;
|
||||
if(was_output==0) {
|
||||
snode_tag_changed(snode, node);
|
||||
|
||||
ED_node_changed_update(snode->id, node);
|
||||
}
|
||||
if(was_output==0)
|
||||
ED_node_generic_update(bmain, ntree, node);
|
||||
|
||||
/* addnode() doesnt link this yet... */
|
||||
node->id= (ID *)BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
|
||||
}
|
||||
else if(node->type==CMP_NODE_R_LAYERS) {
|
||||
if(node->id==NULL || node->id==(ID *)scene) {
|
||||
scene->r.actlay= node->custom1;
|
||||
Scene *scene;
|
||||
|
||||
for(scene=bmain->scene.first; scene; scene=scene->id.next) {
|
||||
if(scene->nodetree && scene->use_nodes && has_nodetree(scene->nodetree, ntree)) {
|
||||
if(node->id==NULL || node->id==(ID *)scene) {
|
||||
scene->r.actlay= node->custom1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(node->type==CMP_NODE_COMPOSITE) {
|
||||
bNode *tnode;
|
||||
|
||||
for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next)
|
||||
for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
|
||||
if( tnode->type==CMP_NODE_COMPOSITE)
|
||||
tnode->flag &= ~NODE_DO_OUTPUT;
|
||||
|
||||
node->flag |= NODE_DO_OUTPUT;
|
||||
ED_node_changed_update(snode->id, node);
|
||||
ED_node_generic_update(bmain, ntree, node);
|
||||
}
|
||||
}
|
||||
else if(snode->treetype==NTREE_TEXTURE) {
|
||||
else if(ntree->type==NTREE_TEXTURE) {
|
||||
// XXX
|
||||
#if 0
|
||||
if(node->id)
|
||||
@ -1625,7 +1641,7 @@ void NODE_OT_link_viewer(wmOperatorType *ot)
|
||||
|
||||
|
||||
/* return 0, nothing done */
|
||||
static int node_mouse_groupheader(SpaceNode *snode)
|
||||
static int UNUSED_FUNCTION(node_mouse_groupheader)(SpaceNode *snode)
|
||||
{
|
||||
bNode *gnode;
|
||||
float mx=0, my=0;
|
||||
@ -1940,7 +1956,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
|
||||
}
|
||||
|
||||
/* can be called from menus too, but they should do own undopush and redraws */
|
||||
bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float locy)
|
||||
bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, int type, float locx, float locy)
|
||||
{
|
||||
bNode *node= NULL, *gnode;
|
||||
|
||||
@ -1955,7 +1971,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
bNodeTree *ngroup= BLI_findlink(&G.main->nodetree, type-NODE_GROUP_MENU);
|
||||
bNodeTree *ngroup= BLI_findlink(&bmain->nodetree, type-NODE_GROUP_MENU);
|
||||
if(ngroup)
|
||||
node= nodeAddNodeType(snode->edittree, NODE_GROUP, ngroup, NULL);
|
||||
}
|
||||
@ -1976,7 +1992,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float
|
||||
}
|
||||
|
||||
node_tree_verify_groups(snode->nodetree);
|
||||
node_set_active(snode, node);
|
||||
ED_node_set_active(bmain, snode->edittree, node);
|
||||
|
||||
if(snode->nodetree->type==NTREE_COMPOSIT) {
|
||||
if(ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE))
|
||||
@ -2991,10 +3007,10 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
for(node= snode->edittree->nodes.first; node; node= node->next) {
|
||||
if(node->flag & SELECT) {
|
||||
if(node->inputs.first && node->outputs.first) {
|
||||
/* Be able to mute in-/output nodes as well. - DingTo
|
||||
if(node->inputs.first && node->outputs.first) { */
|
||||
node->flag ^= NODE_MUTED;
|
||||
snode_tag_changed(snode, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3205,6 +3221,7 @@ void NODE_OT_show_cyclic_dependencies(wmOperatorType *ot)
|
||||
|
||||
static int node_add_file_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceNode *snode= CTX_wm_space_node(C);
|
||||
bNode *node;
|
||||
@ -3245,7 +3262,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
|
||||
|
||||
ED_preview_kill_jobs(C);
|
||||
|
||||
node = node_add_node(snode, scene, ntype, snode->mx, snode->my);
|
||||
node = node_add_node(snode, bmain, scene, ntype, snode->mx, snode->my);
|
||||
|
||||
if (!node) {
|
||||
BKE_report(op->reports, RPT_WARNING, "Could not add an image node.");
|
||||
|
@ -64,6 +64,8 @@
|
||||
|
||||
static void do_node_add(bContext *C, void *UNUSED(arg), int event)
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceNode *snode= CTX_wm_space_node(C);
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
ARegion *ar;
|
||||
@ -87,7 +89,7 @@ static void do_node_add(bContext *C, void *UNUSED(arg), int event)
|
||||
else node->flag &= ~NODE_TEST;
|
||||
}
|
||||
|
||||
node= node_add_node(snode, CTX_data_scene(C), event, snode->mx, snode->my);
|
||||
node= node_add_node(snode, bmain, scene, event, snode->mx, snode->my);
|
||||
|
||||
/* select previous selection before autoconnect */
|
||||
for(node= snode->edittree->nodes.first; node; node= node->next) {
|
||||
|
@ -43,6 +43,7 @@ struct wmWindowManager;
|
||||
struct bNode;
|
||||
struct bNodeSocket;
|
||||
struct bNodeLink;
|
||||
struct Main;
|
||||
|
||||
/* temp data to pass on to modal */
|
||||
typedef struct bNodeLinkDrag
|
||||
@ -97,10 +98,9 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre
|
||||
void snode_notify(bContext *C, SpaceNode *snode);
|
||||
void snode_dag_update(bContext *C, SpaceNode *snode);
|
||||
bNode *next_node(bNodeTree *ntree);
|
||||
bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float locy);
|
||||
bNode *node_add_node(SpaceNode *snode, struct Main *bmain, Scene *scene, int type, float locx, float locy);
|
||||
void snode_set_context(SpaceNode *snode, Scene *scene);
|
||||
void snode_make_group_editable(SpaceNode *snode, bNode *gnode);
|
||||
void node_set_active(SpaceNode *snode, bNode *node);
|
||||
void node_deselectall(SpaceNode *snode);
|
||||
int node_select_same_type(SpaceNode *snode);
|
||||
int node_select_same_type_np(SpaceNode *snode, int dir);
|
||||
|
@ -37,10 +37,12 @@
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_main.h"
|
||||
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "ED_node.h"
|
||||
#include "ED_screen.h"
|
||||
#include "ED_types.h"
|
||||
|
||||
@ -70,7 +72,7 @@ static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my)
|
||||
|
||||
/* ****** Click Select ****** */
|
||||
|
||||
static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2], short extend)
|
||||
static bNode *node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const int mval[2], short extend)
|
||||
{
|
||||
bNode *node;
|
||||
float mx, my;
|
||||
@ -92,7 +94,7 @@ static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2]
|
||||
else
|
||||
node->flag ^= SELECT;
|
||||
|
||||
node_set_active(snode, node);
|
||||
ED_node_set_active(bmain, snode->edittree, node);
|
||||
}
|
||||
|
||||
return node;
|
||||
@ -100,6 +102,7 @@ static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2]
|
||||
|
||||
static int node_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
SpaceNode *snode= CTX_wm_space_node(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
int mval[2];
|
||||
@ -113,7 +116,7 @@ static int node_select_exec(bContext *C, wmOperator *op)
|
||||
extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
/* perform the select */
|
||||
node= node_mouse_select(snode, ar, mval, extend);
|
||||
node= node_mouse_select(bmain, snode, ar, mval, extend);
|
||||
|
||||
/* send notifiers */
|
||||
WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL);
|
||||
|
@ -124,8 +124,8 @@ typedef struct TreeElement {
|
||||
#define OL_TOGW OL_TOG_RESTRICT_VIEWX
|
||||
|
||||
#define OL_RNA_COLX (UI_UNIT_X*15)
|
||||
#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5)
|
||||
#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5)
|
||||
#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5f)
|
||||
#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5f)
|
||||
|
||||
|
||||
/* outliner_tree.c ----------------------------------------------- */
|
||||
@ -143,9 +143,6 @@ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct Space
|
||||
void draw_outliner(const struct bContext *C);
|
||||
|
||||
/* outliner_select.c -------------------------------------------- */
|
||||
|
||||
void outliner_select(struct SpaceOops *soops, ListBase *lb, int *index, short *selecting);
|
||||
|
||||
int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set);
|
||||
int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, TreeElement *te, int set);
|
||||
|
||||
|
@ -106,10 +106,11 @@
|
||||
/* ****************************************************** */
|
||||
/* Outliner Selection (grey-blue highlight for rows) */
|
||||
|
||||
void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
|
||||
static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
int change= 0;
|
||||
|
||||
for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) {
|
||||
tselem= TREESTORE(te);
|
||||
@ -131,6 +132,8 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin
|
||||
tselem->flag |= TSE_SELECTED;
|
||||
else
|
||||
tselem->flag &= ~TSE_SELECTED;
|
||||
|
||||
change |= 1;
|
||||
}
|
||||
}
|
||||
else if ((tselem->flag & TSE_CLOSED)==0) {
|
||||
@ -142,10 +145,12 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin
|
||||
* function correctly
|
||||
*/
|
||||
(*index)--;
|
||||
outliner_select(soops, &te->subtree, index, selecting);
|
||||
change |= outliner_select(soops, &te->subtree, index, selecting);
|
||||
(*index)++;
|
||||
}
|
||||
}
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
/* ****************************************************** */
|
||||
@ -660,8 +665,8 @@ int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement
|
||||
{
|
||||
|
||||
switch(te->idcode) {
|
||||
case ID_OB:
|
||||
return tree_element_set_active_object(C, scene, soops, te, set);
|
||||
/* Note: no ID_OB: objects are handled specially to allow multiple
|
||||
selection. See do_outliner_item_activate. */
|
||||
case ID_MA:
|
||||
return tree_element_active_material(C, scene, soops, te, set);
|
||||
case ID_WO:
|
||||
@ -839,11 +844,14 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
|
||||
fmval[0], fmval[1], NULL, &row);
|
||||
|
||||
/* select relevant row */
|
||||
outliner_select(soops, &soops->tree, &row, &selecting);
|
||||
if(outliner_select(soops, &soops->tree, &row, &selecting)) {
|
||||
|
||||
soops->storeflag |= SO_TREESTORE_REDRAW;
|
||||
soops->storeflag |= SO_TREESTORE_REDRAW;
|
||||
|
||||
ED_undo_push(C, "Outliner selection event");
|
||||
/* no need for undo push here, only changing outliner data which is
|
||||
* scene level - campbell */
|
||||
/* ED_undo_push(C, "Outliner selection event"); */
|
||||
}
|
||||
}
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
|
@ -702,7 +702,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
|
||||
|
||||
static Sequence *special_seq_update= 0;
|
||||
|
||||
static void set_special_seq_update(int val)
|
||||
static void UNUSED_FUNCTION(set_special_seq_update)(int val)
|
||||
{
|
||||
// int x;
|
||||
|
||||
|
@ -75,10 +75,6 @@
|
||||
/* own include */
|
||||
#include "sequencer_intern.h"
|
||||
|
||||
static void error(const char *UNUSED(dummy)) {}
|
||||
static void waitcursor(int UNUSED(val)) {}
|
||||
static void activate_fileselect(int UNUSED(d1), const char *UNUSED(d2), const char *UNUSED(d3), void *UNUSED(d4)) {}
|
||||
static int pupmenu(const char *UNUSED(dummy)) {return 0;}
|
||||
static int okee(const char *UNUSED(dummy)) {return 0;}
|
||||
|
||||
|
||||
@ -139,7 +135,7 @@ void seq_rectf(Sequence *seq, rctf *rectf)
|
||||
rectf->ymax= seq->machine+SEQ_STRIP_OFSTOP;
|
||||
}
|
||||
|
||||
static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect */
|
||||
static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* called from fileselect */
|
||||
{
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
struct SeqEffectHandle sh;
|
||||
@ -762,7 +758,7 @@ static int insert_gap(Scene *scene, int gap, int cfra)
|
||||
return done;
|
||||
}
|
||||
|
||||
static void touch_seq_files(Scene *scene)
|
||||
static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene)
|
||||
{
|
||||
Sequence *seq;
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
@ -774,7 +770,7 @@ static void touch_seq_files(Scene *scene)
|
||||
|
||||
if(okee("Touch and print selected movies")==0) return;
|
||||
|
||||
waitcursor(1);
|
||||
WM_cursor_wait(1);
|
||||
|
||||
SEQP_BEGIN(ed, seq) {
|
||||
if(seq->flag & SELECT) {
|
||||
@ -789,7 +785,7 @@ static void touch_seq_files(Scene *scene)
|
||||
}
|
||||
SEQ_END
|
||||
|
||||
waitcursor(0);
|
||||
WM_cursor_wait(0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -817,7 +813,7 @@ static void set_filter_seq(Scene *scene)
|
||||
}
|
||||
*/
|
||||
|
||||
static void seq_remap_paths(Scene *scene)
|
||||
static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
|
||||
{
|
||||
Sequence *seq, *last_seq = seq_active_get(scene);
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
@ -858,7 +854,7 @@ static void seq_remap_paths(Scene *scene)
|
||||
}
|
||||
|
||||
|
||||
static void no_gaps(Scene *scene)
|
||||
static void UNUSED_FUNCTION(no_gaps)(Scene *scene)
|
||||
{
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
int cfra, first= 0, done;
|
||||
@ -1232,9 +1228,6 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
|
||||
/* api callbacks */
|
||||
ot->exec= sequencer_refresh_all_exec;
|
||||
ot->poll= sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
|
||||
@ -1569,6 +1562,58 @@ void SEQUENCER_OT_delete(wmOperatorType *ot)
|
||||
}
|
||||
|
||||
|
||||
/* offset clear operator */
|
||||
static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
Sequence *seq;
|
||||
|
||||
/* for effects, try to find a replacement input */
|
||||
for(seq=ed->seqbasep->first; seq; seq=seq->next) {
|
||||
if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
|
||||
seq->startofs= seq->endofs= seq->startstill= seq->endstill= 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* updates lengths etc */
|
||||
seq= ed->seqbasep->first;
|
||||
while(seq) {
|
||||
calc_sequence(scene, seq);
|
||||
seq= seq->next;
|
||||
}
|
||||
|
||||
for(seq=ed->seqbasep->first; seq; seq=seq->next) {
|
||||
if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
|
||||
if(seq_test_overlap(ed->seqbasep, seq)) {
|
||||
shuffle_seq(ed->seqbasep, seq, scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
||||
void SEQUENCER_OT_offset_clear(wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Clear Strip Offset";
|
||||
ot->idname= "SEQUENCER_OT_offset_clear";
|
||||
ot->description="Clear strip offsets from the start and end frames";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= sequencer_offset_clear_exec;
|
||||
ot->poll= sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
/* separate_images operator */
|
||||
static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
@ -2803,6 +2848,9 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
RNA_END;
|
||||
|
||||
/* reset these else we wont see all the images */
|
||||
seq->anim_startofs= seq->anim_endofs= 0;
|
||||
|
||||
/* correct start/end frames so we dont move
|
||||
* important not to set seq->len= len; allow the function to handle it */
|
||||
reload_sequence_new_file(scene, seq, TRUE);
|
||||
@ -2815,12 +2863,15 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
|
||||
else {
|
||||
/* lame, set rna filepath */
|
||||
PointerRNA seq_ptr;
|
||||
PropertyRNA *prop;
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr);
|
||||
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
RNA_string_set(&seq_ptr, "filepath", filepath);
|
||||
prop= RNA_struct_find_property(&seq_ptr, "filepath");
|
||||
RNA_property_string_set(&seq_ptr, prop, filepath);
|
||||
RNA_property_update(C, &seq_ptr, prop);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
|
||||
|
@ -93,6 +93,7 @@ void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_duplicate(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_delete(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_offset_clear(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_images_separate(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_meta_toggle(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_meta_make(struct wmOperatorType *ot);
|
||||
|
@ -68,6 +68,7 @@ void sequencer_operatortypes(void)
|
||||
WM_operatortype_append(SEQUENCER_OT_swap_inputs);
|
||||
WM_operatortype_append(SEQUENCER_OT_duplicate);
|
||||
WM_operatortype_append(SEQUENCER_OT_delete);
|
||||
WM_operatortype_append(SEQUENCER_OT_offset_clear);
|
||||
WM_operatortype_append(SEQUENCER_OT_images_separate);
|
||||
WM_operatortype_append(SEQUENCER_OT_meta_toggle);
|
||||
WM_operatortype_append(SEQUENCER_OT_meta_make);
|
||||
@ -149,6 +150,8 @@ void sequencer_keymap(wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", XKEY, KM_PRESS, 0, 0);
|
||||
|
@ -159,7 +159,7 @@ void select_surround_from_last(Scene *scene)
|
||||
#endif
|
||||
|
||||
|
||||
static void select_single_seq(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */
|
||||
static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */
|
||||
{
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "BKE_text.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "WM_types.h"
|
||||
|
||||
@ -192,7 +193,7 @@ static void confirm_suggestion(Text *text, int skipleft)
|
||||
// XXX
|
||||
static int doc_scroll= 0;
|
||||
|
||||
static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val)
|
||||
static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned short evnt, short val)
|
||||
{
|
||||
ARegion *ar= NULL; // XXX
|
||||
int qual= 0; // XXX
|
||||
@ -375,7 +376,7 @@ static short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short
|
||||
; // XXX redraw_alltext();
|
||||
#endif
|
||||
|
||||
static short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val)
|
||||
static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned short evnt, short val)
|
||||
{
|
||||
Text *text;
|
||||
TextMarker *marker, *mrk, *nxt;
|
||||
|
@ -29,7 +29,6 @@
|
||||
* \ingroup spview3d
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
@ -70,24 +69,21 @@
|
||||
|
||||
#include "view3d_intern.h" // own include
|
||||
|
||||
/***/
|
||||
/**************************** Face Select Mode *******************************/
|
||||
|
||||
/* Flags for marked edges */
|
||||
/* Flags for marked edges */
|
||||
enum {
|
||||
eEdge_Visible = (1<<0),
|
||||
eEdge_Select = (1<<1),
|
||||
};
|
||||
|
||||
/* Creates a hash of edges to flags indicating
|
||||
* adjacent tface select/active/etc flags.
|
||||
*/
|
||||
/* Creates a hash of edges to flags indicating selected/visible */
|
||||
static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flags)
|
||||
{
|
||||
int *flags_p;
|
||||
|
||||
if (!BLI_edgehash_haskey(eh, v0, v1)) {
|
||||
if(!BLI_edgehash_haskey(eh, v0, v1))
|
||||
BLI_edgehash_insert(eh, v0, v1, NULL);
|
||||
}
|
||||
|
||||
flags_p = (int*) BLI_edgehash_lookup_p(eh, v0, v1);
|
||||
*flags_p |= flags;
|
||||
@ -96,26 +92,25 @@ static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flag
|
||||
static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
|
||||
{
|
||||
EdgeHash *eh = BLI_edgehash_new();
|
||||
int i;
|
||||
MFace *mf;
|
||||
int i;
|
||||
|
||||
for (i=0; i<me->totface; i++) {
|
||||
for(i=0; i<me->totface; i++) {
|
||||
mf = &me->mface[i];
|
||||
|
||||
if (mf->v3) {
|
||||
if (!(mf->flag&ME_HIDE)) {
|
||||
unsigned int flags = eEdge_Visible;
|
||||
if (mf->flag&ME_FACE_SEL) flags |= eEdge_Select;
|
||||
if(!(mf->flag & ME_HIDE)) {
|
||||
unsigned int flags = eEdge_Visible;
|
||||
if(mf->flag & ME_FACE_SEL) flags |= eEdge_Select;
|
||||
|
||||
get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags);
|
||||
get_marked_edge_info__orFlags(eh, mf->v2, mf->v3, flags);
|
||||
if (mf->v4) {
|
||||
get_marked_edge_info__orFlags(eh, mf->v3, mf->v4, flags);
|
||||
get_marked_edge_info__orFlags(eh, mf->v4, mf->v1, flags);
|
||||
} else {
|
||||
get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags);
|
||||
}
|
||||
get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags);
|
||||
get_marked_edge_info__orFlags(eh, mf->v2, mf->v3, flags);
|
||||
|
||||
if(mf->v4) {
|
||||
get_marked_edge_info__orFlags(eh, mf->v3, mf->v4, flags);
|
||||
get_marked_edge_info__orFlags(eh, mf->v4, mf->v1, flags);
|
||||
}
|
||||
else
|
||||
get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,45 +118,24 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
|
||||
}
|
||||
|
||||
|
||||
static int draw_tfaces3D__setHiddenOpts(void *userData, int index)
|
||||
static int draw_mesh_face_select__setHiddenOpts(void *userData, int index)
|
||||
{
|
||||
struct { Mesh *me; EdgeHash *eh; } *data = userData;
|
||||
Mesh *me= data->me;
|
||||
MEdge *med = &me->medge[index];
|
||||
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
|
||||
|
||||
if((me->drawflag & ME_DRAWSEAMS) && (med->flag&ME_SEAM)) {
|
||||
return 0;
|
||||
} else if(me->drawflag & ME_DRAWEDGES){
|
||||
if (me->drawflag & ME_HIDDENEDGES) {
|
||||
if(me->drawflag & ME_DRAWEDGES) {
|
||||
if(me->drawflag & ME_HIDDENEDGES)
|
||||
return 1;
|
||||
} else {
|
||||
else
|
||||
return (flags & eEdge_Visible);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
return (flags & eEdge_Select);
|
||||
}
|
||||
}
|
||||
|
||||
static int draw_tfaces3D__setSeamOpts(void *userData, int index)
|
||||
{
|
||||
struct { Mesh *me; EdgeHash *eh; } *data = userData;
|
||||
Mesh *me= data->me;
|
||||
MEdge *med = &data->me->medge[index];
|
||||
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
|
||||
|
||||
if (med->flag & ME_SEAM) {
|
||||
if (me->drawflag & ME_HIDDENEDGES) {
|
||||
return 1;
|
||||
} else {
|
||||
return (flags & eEdge_Visible);
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int draw_tfaces3D__setSelectOpts(void *userData, int index)
|
||||
static int draw_mesh_face_select__setSelectOpts(void *userData, int index)
|
||||
{
|
||||
struct { Mesh *me; EdgeHash *eh; } *data = userData;
|
||||
MEdge *med = &data->me->medge[index];
|
||||
@ -170,45 +144,19 @@ static int draw_tfaces3D__setSelectOpts(void *userData, int index)
|
||||
return flags & eEdge_Select;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int draw_tfaces3D__setActiveOpts(void *userData, int index)
|
||||
{
|
||||
struct { Mesh *me; EdgeHash *eh; } *data = userData;
|
||||
MEdge *med = &data->me->medge[index];
|
||||
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
|
||||
|
||||
if (flags & eEdge_Select) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int draw_tfaces3D__drawFaceOpts(void *userData, int index)
|
||||
{
|
||||
Mesh *me = (Mesh*)userData;
|
||||
|
||||
MFace *mface = &me->mface[index];
|
||||
if (!(mface->flag&ME_HIDE) && (mface->flag&ME_FACE_SEL))
|
||||
return 2; /* Don't set color */
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* draws unselected */
|
||||
static int draw_tfaces3D__drawFaceOptsInv(void *userData, int index)
|
||||
static int draw_mesh_face_select__drawFaceOptsInv(void *userData, int index)
|
||||
{
|
||||
Mesh *me = (Mesh*)userData;
|
||||
|
||||
MFace *mface = &me->mface[index];
|
||||
if (!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL))
|
||||
if(!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL))
|
||||
return 2; /* Don't set color */
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short draw_seams)
|
||||
static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
|
||||
{
|
||||
struct { Mesh *me; EdgeHash *eh; } data;
|
||||
|
||||
@ -222,30 +170,16 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d
|
||||
/* Draw (Hidden) Edges */
|
||||
setlinestyle(1);
|
||||
UI_ThemeColor(TH_EDGE_FACESEL);
|
||||
dm->drawMappedEdges(dm, draw_tfaces3D__setHiddenOpts, &data);
|
||||
dm->drawMappedEdges(dm, draw_mesh_face_select__setHiddenOpts, &data);
|
||||
setlinestyle(0);
|
||||
|
||||
/* Draw Seams */
|
||||
if(draw_seams && me->drawflag & ME_DRAWSEAMS) {
|
||||
UI_ThemeColor(TH_EDGE_SEAM);
|
||||
glLineWidth(2);
|
||||
dm->drawMappedEdges(dm, draw_tfaces3D__setSeamOpts, &data);
|
||||
glLineWidth(1);
|
||||
}
|
||||
|
||||
/* Draw Selected Faces */
|
||||
if(me->drawflag & ME_DRAWFACES) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
#if 0
|
||||
UI_ThemeColor4(TH_FACE_SELECT);
|
||||
|
||||
dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOpts, (void*)me);
|
||||
#else
|
||||
/* dull unselected faces so as not to get in the way of seeing color */
|
||||
glColor4ub(96, 96, 96, 64);
|
||||
dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOptsInv, (void*)me);
|
||||
#endif
|
||||
dm->drawMappedFacesTex(dm, draw_mesh_face_select__drawFaceOptsInv, (void*)me);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
@ -255,7 +189,7 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d
|
||||
/* Draw Stippled Outline for selected faces */
|
||||
glColor3ub(255, 255, 255);
|
||||
setlinestyle(1);
|
||||
dm->drawMappedEdges(dm, draw_tfaces3D__setSelectOpts, &data);
|
||||
dm->drawMappedEdges(dm, draw_mesh_face_select__setSelectOpts, &data);
|
||||
setlinestyle(0);
|
||||
|
||||
bglPolygonOffset(rv3d->dist, 0.0); // resets correctly now, even after calling accumulated offsets
|
||||
@ -263,6 +197,8 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short d
|
||||
BLI_edgehash_free(data.eh, NULL);
|
||||
}
|
||||
|
||||
/***************************** Texture Drawing ******************************/
|
||||
|
||||
static Material *give_current_material_or_def(Object *ob, int matnr)
|
||||
{
|
||||
extern Material defmaterial; // render module abuse...
|
||||
@ -668,18 +604,21 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
|
||||
|
||||
if(ob->mode & OB_MODE_EDIT) {
|
||||
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh);
|
||||
} else if(faceselect) {
|
||||
}
|
||||
else if(faceselect) {
|
||||
if(ob->mode & OB_MODE_WEIGHT_PAINT)
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material);
|
||||
else
|
||||
dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, me);
|
||||
}
|
||||
else {
|
||||
if( GPU_buffer_legacy(dm) )
|
||||
if(GPU_buffer_legacy(dm)) {
|
||||
dm->drawFacesTex(dm, draw_tface__set_draw_legacy);
|
||||
}
|
||||
else {
|
||||
if( !CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL) )
|
||||
if(!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL))
|
||||
add_tface_color_layer(dm);
|
||||
|
||||
dm->drawFacesTex(dm, draw_tface__set_draw);
|
||||
}
|
||||
}
|
||||
@ -692,7 +631,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
|
||||
|
||||
/* draw edges and selected faces over textured mesh */
|
||||
if(!(ob == scene->obedit) && faceselect)
|
||||
draw_tfaces3D(rv3d, me, dm, ob->mode & OB_MODE_WEIGHT_PAINT);
|
||||
draw_mesh_face_select(rv3d, me, dm);
|
||||
|
||||
/* reset from negative scale correction */
|
||||
glFrontFace(GL_CCW);
|
||||
|
@ -2405,7 +2405,20 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* useful for debugging index vs shape key index */
|
||||
#if 0
|
||||
{
|
||||
EditVert *eve;
|
||||
int j;
|
||||
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
|
||||
for(eve= em->verts.first, j= 0; eve; eve= eve->next, j++) {
|
||||
sprintf(val, "%d:%d", j, eve->keyindex);
|
||||
view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(v3d->zbuf) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
bglPolygonOffset(rv3d->dist, 0.0f);
|
||||
@ -5520,7 +5533,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
|
||||
}
|
||||
}
|
||||
else if(ob->type==OB_ARMATURE) {
|
||||
if(!(ob->mode & OB_MODE_POSE))
|
||||
if(!(ob->mode & OB_MODE_POSE && base == scene->basact))
|
||||
draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, TRUE);
|
||||
}
|
||||
|
||||
|
@ -721,7 +721,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
|
||||
{
|
||||
#define ROT_AXIS_DETAIL 13
|
||||
const float s = 0.05f * scale;
|
||||
const float step = 2.f * M_PI / ROT_AXIS_DETAIL;
|
||||
const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL);
|
||||
float angle;
|
||||
int i;
|
||||
|
||||
@ -1041,7 +1041,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
|
||||
glBegin(GL_LINES);
|
||||
if(w > h) {
|
||||
if(golden) {
|
||||
ofs = w * (1.0f-(1.0f/1.61803399));
|
||||
ofs = w * (1.0f-(1.0f/1.61803399f));
|
||||
}
|
||||
else {
|
||||
ofs = h * (h / w);
|
||||
@ -1059,7 +1059,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
|
||||
}
|
||||
else {
|
||||
if(golden) {
|
||||
ofs = h * (1.0f-(1.0f/1.61803399));
|
||||
ofs = h * (1.0f-(1.0f/1.61803399f));
|
||||
}
|
||||
else {
|
||||
ofs = w * (w / h);
|
||||
@ -1203,7 +1203,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
|
||||
|
||||
if (ca->dtx & CAM_DTX_GOLDEN) {
|
||||
UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
|
||||
drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399));
|
||||
drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399f));
|
||||
}
|
||||
|
||||
if (ca->dtx & CAM_DTX_GOLDEN_TRI_A) {
|
||||
@ -2769,3 +2769,4 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
|
||||
|
||||
v3d->flag |= V3D_INVALID_BACKBUF;
|
||||
}
|
||||
|
||||
|
@ -1697,7 +1697,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot)
|
||||
static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac)
|
||||
{
|
||||
RegionView3D *rv3d= ar->regiondata;
|
||||
madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0 - dfac));
|
||||
madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0f - dfac));
|
||||
}
|
||||
|
||||
static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert)
|
||||
@ -1718,7 +1718,7 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv
|
||||
if (zoom_invert)
|
||||
SWAP(float, len1, len2);
|
||||
|
||||
zfac = 1.0 + ((len2 - len1) * 0.01 * vod->rv3d->dist);
|
||||
zfac = 1.0f + ((len2 - len1) * 0.01f * vod->rv3d->dist);
|
||||
}
|
||||
|
||||
if(zfac != 1.0f)
|
||||
|
@ -867,7 +867,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
|
||||
upvec[2]=1;
|
||||
mul_m3_v3(mat, upvec);
|
||||
/*make sure we have some z rolling*/
|
||||
if (fabs(upvec[2]) > 0.00001f) {
|
||||
if (fabsf(upvec[2]) > 0.00001f) {
|
||||
roll= upvec[2] * -5.0f;
|
||||
|
||||
upvec[0]= 1.0f; /*rotate the view about this axis*/
|
||||
|
@ -281,31 +281,32 @@ static char *view3d_modeselect_pup(Scene *scene)
|
||||
str += sprintf(str, formatstr, "Object Mode", OB_MODE_OBJECT, ICON_OBJECT_DATA);
|
||||
|
||||
if(ob==NULL || ob->data==NULL) return string;
|
||||
if(ob->id.lib || ((ID *)ob->data)->lib) return string;
|
||||
if(ob->id.lib) return string;
|
||||
|
||||
/* if active object is editable */
|
||||
if ( ((ob->type == OB_MESH)
|
||||
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|
||||
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
|
||||
|
||||
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
|
||||
}
|
||||
else if (ob->type == OB_ARMATURE) {
|
||||
if (ob->mode & OB_MODE_POSE)
|
||||
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
|
||||
else
|
||||
if(!((ID *)ob->data)->lib) {
|
||||
/* if active object is editable */
|
||||
if ( ((ob->type == OB_MESH)
|
||||
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|
||||
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
|
||||
|
||||
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
|
||||
}
|
||||
else if (ob->type == OB_ARMATURE) {
|
||||
if (ob->mode & OB_MODE_POSE)
|
||||
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
|
||||
else
|
||||
str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
|
||||
}
|
||||
|
||||
if (ob->type == OB_MESH) {
|
||||
|
||||
str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
|
||||
str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
|
||||
str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
|
||||
str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
|
||||
}
|
||||
}
|
||||
|
||||
if (ob->type == OB_MESH) {
|
||||
|
||||
str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
|
||||
str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
|
||||
str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
|
||||
str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* if active object is an armature */
|
||||
if (ob->type==OB_ARMATURE) {
|
||||
str += sprintf(str, formatstr, "Pose Mode", OB_MODE_POSE, ICON_POSE_HLT);
|
||||
@ -465,6 +466,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
|
||||
Object *ob= OBACT;
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
uiLayout *row;
|
||||
const float dpi_fac= UI_DPI_FAC;
|
||||
|
||||
@ -518,9 +520,12 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
|
||||
block= uiLayoutGetBlock(row);
|
||||
|
||||
if(v3d->twflag & V3D_USE_MANIPULATOR) {
|
||||
uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode");
|
||||
uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode");
|
||||
uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode");
|
||||
but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode");
|
||||
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||
but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode");
|
||||
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||
but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode");
|
||||
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||
}
|
||||
|
||||
if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) {
|
||||
@ -528,7 +533,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
|
||||
}
|
||||
|
||||
str_menu = BIF_menustringTransformOrientation(C, "Orientation");
|
||||
uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation");
|
||||
but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation");
|
||||
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||
MEM_freeN((void *)str_menu);
|
||||
}
|
||||
|
||||
|
@ -1439,9 +1439,9 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
|
||||
if(oldbasact != basact) {
|
||||
ED_base_object_activate(C, basact); /* adds notifier */
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@ -2002,8 +2002,8 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
if(obedit) {
|
||||
|
||||
if(obedit && center==FALSE) {
|
||||
if(obedit->type==OB_MESH)
|
||||
retval = mouse_mesh(C, event->mval, extend);
|
||||
else if(obedit->type==OB_ARMATURE)
|
||||
@ -2054,7 +2054,7 @@ void VIEW3D_OT_select(wmOperatorType *ot)
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first.");
|
||||
RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting (object mode only).");
|
||||
RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting, in editmode used to extend object selection.");
|
||||
RNA_def_boolean(ot->srna, "enumerate", 0, "Enumerate", "List objects under the mouse (object mode only).");
|
||||
}
|
||||
|
||||
|
@ -1356,16 +1356,15 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
int constraint_axis[3] = {0, 0, 0};
|
||||
int proportional = 0;
|
||||
PropertyRNA *prop;
|
||||
|
||||
if (RNA_struct_find_property(op->ptr, "value"))
|
||||
{
|
||||
if (t->flag & T_AUTOVALUES)
|
||||
{
|
||||
RNA_float_set_array(op->ptr, "value", t->auto_values);
|
||||
if ((prop= RNA_struct_find_property(op->ptr, "value"))) {
|
||||
float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values;
|
||||
if (RNA_property_array_check(prop)) {
|
||||
RNA_property_float_set_array(op->ptr, prop, values);
|
||||
}
|
||||
else
|
||||
{
|
||||
RNA_float_set_array(op->ptr, "value", t->values);
|
||||
else {
|
||||
RNA_property_float_set(op->ptr, prop, values[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4649,7 +4648,7 @@ static int createSlideVerts(TransInfo *t)
|
||||
uv_new = tf->uv[k];
|
||||
|
||||
if (ev->tmp.l) {
|
||||
if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) {
|
||||
if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) {
|
||||
ev->tmp.l = -1; /* Tag as invalid */
|
||||
BLI_linklist_free(suv->fuv_list,NULL);
|
||||
suv->fuv_list = NULL;
|
||||
|
@ -205,11 +205,7 @@ static ParamHandle *construct_param_handle(Scene *scene, EditMesh *em, short imp
|
||||
float *uv[4];
|
||||
int nverts;
|
||||
|
||||
if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
|
||||
if(efa->h)
|
||||
continue;
|
||||
}
|
||||
else if((efa->h) || (sel && (efa->f & SELECT)==0))
|
||||
if((efa->h) || (sel && (efa->f & SELECT)==0))
|
||||
continue;
|
||||
|
||||
tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||
@ -586,7 +582,7 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
|
||||
return;
|
||||
}
|
||||
|
||||
liveHandle = construct_param_handle(scene, em, 0, fillholes, 1, 1);
|
||||
liveHandle = construct_param_handle(scene, em, 0, fillholes, 0, 1);
|
||||
|
||||
param_lscm_begin(liveHandle, PARAM_TRUE, abf);
|
||||
BKE_mesh_end_editmesh(obedit->data, em);
|
||||
|
@ -178,6 +178,7 @@ typedef struct GPUVertexAttribs {
|
||||
struct {
|
||||
int type;
|
||||
int glindex;
|
||||
int gltexco;
|
||||
char name[32];
|
||||
} layer[GPU_MAX_ATTRIB];
|
||||
|
||||
|
@ -355,7 +355,7 @@ struct anim * IMB_open_anim( const char * name, int ib_flags) {
|
||||
|
||||
anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct");
|
||||
if (anim != NULL) {
|
||||
strcpy(anim->name, name); /* fixme: possible buffer overflow here? */
|
||||
BLI_strncpy(anim->name, name, sizeof(anim->name));
|
||||
anim->ib_flags = ib_flags;
|
||||
}
|
||||
return(anim);
|
||||
|
@ -371,11 +371,15 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
|
||||
float weight[25];
|
||||
|
||||
/* build a weights buffer */
|
||||
n= 2;
|
||||
k= 0;
|
||||
n= 1;
|
||||
/*k= 0;
|
||||
for(i = -n; i <= n; i++)
|
||||
for(j = -n; j <= n; j++)
|
||||
weight[k++] = sqrt((float) i * i + j * j);
|
||||
*/
|
||||
weight[0]=1; weight[1]=2; weight[2]=1;
|
||||
weight[3]=2; weight[4]=0; weight[5]=2;
|
||||
weight[6]=1; weight[7]=2; weight[8]=1;
|
||||
|
||||
/* run passes */
|
||||
for(r = 0; cannot_early_out == 1 && r < filter; r++) {
|
||||
@ -393,10 +397,10 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
|
||||
float acc[4]={0,0,0,0};
|
||||
k = 0;
|
||||
|
||||
if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) ||
|
||||
/*if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) ||
|
||||
check_pixel_assigned(srcbuf, srcmask, filter_make_index(x+1, y, width, height), depth, is_float) ||
|
||||
check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y-1, width, height), depth, is_float) ||
|
||||
check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float)) {
|
||||
check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float))*/ {
|
||||
for(i= -n; i<=n; i++) {
|
||||
for(j=-n; j<=n; j++) {
|
||||
if(i != 0 || j != 0) {
|
||||
|
@ -712,16 +712,16 @@ typedef struct ShapeKeyModifierData {
|
||||
typedef struct SolidifyModifierData {
|
||||
ModifierData modifier;
|
||||
|
||||
char defgrp_name[32]; /* name of vertex group to use */
|
||||
char defgrp_name[32]; /* name of vertex group to use */
|
||||
float offset; /* new surface offset level*/
|
||||
float offset_fac; /* midpoint of the offset */
|
||||
float offset_fac_vg; /* factor for the minimum weight to use when vgroups are used, avoids 0.0 weights giving duplicate geometry */
|
||||
float crease_inner;
|
||||
float crease_outer;
|
||||
float crease_rim;
|
||||
int flag;
|
||||
short mat_ofs;
|
||||
short mat_ofs_rim;
|
||||
int pad;
|
||||
} SolidifyModifierData;
|
||||
|
||||
#define MOD_SOLIDIFY_RIM (1<<0)
|
||||
|
@ -654,7 +654,7 @@ int RNA_property_flag(PropertyRNA *prop);
|
||||
void *RNA_property_py_data_get(PropertyRNA *prop);
|
||||
|
||||
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop);
|
||||
int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop);
|
||||
int RNA_property_array_check(PropertyRNA *prop);
|
||||
int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dimension);
|
||||
int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[]);
|
||||
char RNA_property_array_item_char(PropertyRNA *prop, int index);
|
||||
|
@ -281,7 +281,7 @@ typedef struct ParameterList {
|
||||
|
||||
typedef struct ParameterIterator {
|
||||
struct ParameterList *parms;
|
||||
PointerRNA funcptr;
|
||||
/* PointerRNA funcptr; */ /*UNUSED*/
|
||||
void *data;
|
||||
int size, offset;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user